domma-cms 0.5.0 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/admin/css/admin.css +1 -1
- package/admin/js/templates/settings.html +44 -2
- package/admin/js/views/settings.js +3 -3
- package/config/navigation.json +5 -15
- package/config/site.json +11 -11
- package/package.json +3 -2
- package/plugins/example-analytics/stats.json +2 -2
- package/plugins/form-builder/data/forms/contacts.json +66 -0
- package/plugins/form-builder/data/forms/enquiries.json +103 -0
- package/plugins/form-builder/data/forms/feedback.json +131 -0
- package/plugins/form-builder/data/forms/notes.json +79 -0
- package/plugins/form-builder/data/forms/to-do.json +100 -0
- package/plugins/form-builder/data/submissions/contacts.json +1 -0
- package/plugins/form-builder/data/submissions/enquiries.json +1 -0
- package/plugins/form-builder/data/submissions/feedback.json +1 -0
- package/plugins/form-builder/data/submissions/notes.json +1 -0
- package/plugins/form-builder/data/submissions/to-do.json +1 -0
- package/public/css/forms.css +1 -1
- package/public/js/forms.js +1 -1
- package/public/js/site.js +1 -1
- package/scripts/seed.js +335 -51
- package/server/routes/api/forms.js +8 -0
- package/server/routes/api/settings.js +1 -1
- package/server/services/renderer.js +24 -2
- package/server/templates/page.html +5 -0
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
{
|
|
2
|
+
"slug": "feedback",
|
|
3
|
+
"title": "Feedback",
|
|
4
|
+
"description": "Share your feedback with us",
|
|
5
|
+
"fields": [
|
|
6
|
+
{
|
|
7
|
+
"name": "name",
|
|
8
|
+
"type": "string",
|
|
9
|
+
"label": "Your Name",
|
|
10
|
+
"required": true,
|
|
11
|
+
"placeholder": "Please enter your full name",
|
|
12
|
+
"helper": "Please enter your full name",
|
|
13
|
+
"validation": {
|
|
14
|
+
"min": 2,
|
|
15
|
+
"max": 100
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"name": "email",
|
|
20
|
+
"type": "email",
|
|
21
|
+
"label": "Email Address",
|
|
22
|
+
"required": true,
|
|
23
|
+
"placeholder": "your@email.com",
|
|
24
|
+
"helper": "Please enter your email address"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"name": "rating",
|
|
28
|
+
"type": "select",
|
|
29
|
+
"label": "Overall Rating",
|
|
30
|
+
"required": true,
|
|
31
|
+
"helper": "Tell us how we are doing!",
|
|
32
|
+
"options": [
|
|
33
|
+
{
|
|
34
|
+
"value": "none",
|
|
35
|
+
"label": "Please Choose"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"value": "excellent",
|
|
39
|
+
"label": "Excellent"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"value": "good",
|
|
43
|
+
"label": "Good"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"value": "average",
|
|
47
|
+
"label": "Average"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"value": "poor",
|
|
51
|
+
"label": "Poor"
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"name": "category",
|
|
57
|
+
"type": "select",
|
|
58
|
+
"label": "Category",
|
|
59
|
+
"required": true,
|
|
60
|
+
"placeholder": "Please select a category",
|
|
61
|
+
"helper": "",
|
|
62
|
+
"options": [
|
|
63
|
+
{
|
|
64
|
+
"value": "general",
|
|
65
|
+
"label": "General"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"value": "bug-report",
|
|
69
|
+
"label": "Bug Report"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"value": "feature-request",
|
|
73
|
+
"label": "Feature Request"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"value": "praise",
|
|
77
|
+
"label": "Praise"
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"name": "subject",
|
|
83
|
+
"type": "string",
|
|
84
|
+
"label": "Subject",
|
|
85
|
+
"required": true,
|
|
86
|
+
"placeholder": "Brief summary of your feedback",
|
|
87
|
+
"helper": "",
|
|
88
|
+
"validation": {
|
|
89
|
+
"max": 200
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"name": "message",
|
|
94
|
+
"type": "textarea",
|
|
95
|
+
"label": "Your Feedback",
|
|
96
|
+
"required": true,
|
|
97
|
+
"placeholder": "Please share your thoughts in detail…",
|
|
98
|
+
"helper": "Please share your thoughts in detail…",
|
|
99
|
+
"rows": 4,
|
|
100
|
+
"validation": {
|
|
101
|
+
"min": 10,
|
|
102
|
+
"max": 2000
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
],
|
|
106
|
+
"settings": {
|
|
107
|
+
"submitText": "Submit Feedback",
|
|
108
|
+
"successMessage": "Thank you for your feedback! We appreciate you taking the time.",
|
|
109
|
+
"layout": "stacked",
|
|
110
|
+
"honeypot": true,
|
|
111
|
+
"rateLimitPerMinute": 3
|
|
112
|
+
},
|
|
113
|
+
"actions": {
|
|
114
|
+
"email": {
|
|
115
|
+
"enabled": true,
|
|
116
|
+
"recipients": "",
|
|
117
|
+
"subjectPrefix": "[feedback]"
|
|
118
|
+
},
|
|
119
|
+
"webhook": {
|
|
120
|
+
"enabled": false,
|
|
121
|
+
"url": "",
|
|
122
|
+
"method": "POST"
|
|
123
|
+
},
|
|
124
|
+
"collection": {
|
|
125
|
+
"enabled": true,
|
|
126
|
+
"slug": "feedback"
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
"createdAt": "2026-03-13T14:07:25.959Z",
|
|
130
|
+
"updatedAt": "2026-03-13T14:07:25.959Z"
|
|
131
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
{
|
|
2
|
+
"slug": "notes",
|
|
3
|
+
"title": "Notes",
|
|
4
|
+
"description": "Free-form notes with categories and tags.",
|
|
5
|
+
"fields": [
|
|
6
|
+
{
|
|
7
|
+
"name": "title",
|
|
8
|
+
"type": "string",
|
|
9
|
+
"label": "Title",
|
|
10
|
+
"required": true,
|
|
11
|
+
"placeholder": "Note title"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"name": "content",
|
|
15
|
+
"type": "textarea",
|
|
16
|
+
"label": "Content",
|
|
17
|
+
"required": true,
|
|
18
|
+
"placeholder": "Write your note here…",
|
|
19
|
+
"rows": 5
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"name": "category",
|
|
23
|
+
"type": "select",
|
|
24
|
+
"label": "Category",
|
|
25
|
+
"required": false,
|
|
26
|
+
"options": [
|
|
27
|
+
{
|
|
28
|
+
"value": "general",
|
|
29
|
+
"label": "General"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"value": "idea",
|
|
33
|
+
"label": "Idea"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"value": "reminder",
|
|
37
|
+
"label": "Reminder"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"value": "reference",
|
|
41
|
+
"label": "Reference"
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"name": "tags",
|
|
47
|
+
"type": "string",
|
|
48
|
+
"label": "Tags",
|
|
49
|
+
"required": false,
|
|
50
|
+
"placeholder": "Comma-separated tags",
|
|
51
|
+
"helper": "Separate tags with commas"
|
|
52
|
+
}
|
|
53
|
+
],
|
|
54
|
+
"settings": {
|
|
55
|
+
"submitText": "Save Note",
|
|
56
|
+
"successMessage": "Note saved successfully.",
|
|
57
|
+
"layout": "stacked",
|
|
58
|
+
"honeypot": true,
|
|
59
|
+
"rateLimitPerMinute": 3
|
|
60
|
+
},
|
|
61
|
+
"actions": {
|
|
62
|
+
"email": {
|
|
63
|
+
"enabled": false,
|
|
64
|
+
"recipients": "",
|
|
65
|
+
"subjectPrefix": "[notes]"
|
|
66
|
+
},
|
|
67
|
+
"webhook": {
|
|
68
|
+
"enabled": false,
|
|
69
|
+
"url": "",
|
|
70
|
+
"method": "POST"
|
|
71
|
+
},
|
|
72
|
+
"collection": {
|
|
73
|
+
"enabled": true,
|
|
74
|
+
"slug": "notes"
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"createdAt": "2026-03-13T14:07:25.959Z",
|
|
78
|
+
"updatedAt": "2026-03-13T14:07:25.959Z"
|
|
79
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
{
|
|
2
|
+
"slug": "to-do",
|
|
3
|
+
"title": "To-Do",
|
|
4
|
+
"description": "Task tracking with status, priority, and due dates.",
|
|
5
|
+
"fields": [
|
|
6
|
+
{
|
|
7
|
+
"name": "title",
|
|
8
|
+
"type": "string",
|
|
9
|
+
"label": "Title",
|
|
10
|
+
"required": true,
|
|
11
|
+
"placeholder": "Task title"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"name": "description",
|
|
15
|
+
"type": "textarea",
|
|
16
|
+
"label": "Description",
|
|
17
|
+
"required": false,
|
|
18
|
+
"placeholder": "Task details…",
|
|
19
|
+
"rows": 3
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"name": "status",
|
|
23
|
+
"type": "select",
|
|
24
|
+
"label": "Status",
|
|
25
|
+
"required": true,
|
|
26
|
+
"options": [
|
|
27
|
+
{
|
|
28
|
+
"value": "pending",
|
|
29
|
+
"label": "Pending"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"value": "in-progress",
|
|
33
|
+
"label": "In Progress"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"value": "done",
|
|
37
|
+
"label": "Done"
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"name": "priority",
|
|
43
|
+
"type": "select",
|
|
44
|
+
"label": "Priority",
|
|
45
|
+
"required": false,
|
|
46
|
+
"options": [
|
|
47
|
+
{
|
|
48
|
+
"value": "low",
|
|
49
|
+
"label": "Low"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"value": "medium",
|
|
53
|
+
"label": "Medium"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"value": "high",
|
|
57
|
+
"label": "High"
|
|
58
|
+
}
|
|
59
|
+
]
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"name": "due_date",
|
|
63
|
+
"type": "date",
|
|
64
|
+
"label": "Due Date",
|
|
65
|
+
"required": false
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"name": "assigned_to",
|
|
69
|
+
"type": "string",
|
|
70
|
+
"label": "Assigned To",
|
|
71
|
+
"required": false,
|
|
72
|
+
"placeholder": "Name or email"
|
|
73
|
+
}
|
|
74
|
+
],
|
|
75
|
+
"settings": {
|
|
76
|
+
"submitText": "Add Task",
|
|
77
|
+
"successMessage": "Task added successfully.",
|
|
78
|
+
"layout": "stacked",
|
|
79
|
+
"honeypot": true,
|
|
80
|
+
"rateLimitPerMinute": 3
|
|
81
|
+
},
|
|
82
|
+
"actions": {
|
|
83
|
+
"email": {
|
|
84
|
+
"enabled": false,
|
|
85
|
+
"recipients": "",
|
|
86
|
+
"subjectPrefix": "[to-do]"
|
|
87
|
+
},
|
|
88
|
+
"webhook": {
|
|
89
|
+
"enabled": false,
|
|
90
|
+
"url": "",
|
|
91
|
+
"method": "POST"
|
|
92
|
+
},
|
|
93
|
+
"collection": {
|
|
94
|
+
"enabled": true,
|
|
95
|
+
"slug": "to-do"
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
"createdAt": "2026-03-13T14:07:25.959Z",
|
|
99
|
+
"updatedAt": "2026-03-13T14:07:25.959Z"
|
|
100
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[]
|
package/public/css/forms.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.fb-form-wrapper{max-width:600px;margin:2rem auto}.fb-form-honeypot{
|
|
1
|
+
.fb-form-wrapper{max-width:600px;margin:2rem auto}.fb-form-honeypot{position:absolute;left:-9999px;top:-9999px;width:0;height:0;overflow:hidden;opacity:0;z-index:-1}.fb-form-success{padding:1rem 1.25rem;border-radius:6px;background:#34d3991f;border:1px solid rgba(52,211,153,.3);color:#34d399;font-size:.95rem;margin-top:.5rem}.fb-form-error{padding:.75rem 1rem;border-radius:6px;background:#ef44441a;border:1px solid rgba(239,68,68,.25);color:#f87171;font-size:.875rem;margin-top:.75rem}.fb-form-loading{opacity:.6;pointer-events:none}.wizard-progress{height:4px;background:var(--border-color, #333);border-radius:2px;margin-bottom:1rem}.wizard-progress-bar{height:100%;background:var(--primary, #5b8cff);border-radius:2px;transition:width .3s ease}.wizard-step-title{font-size:1.1rem;font-weight:600;margin-bottom:.25rem}.wizard-step-description{font-size:.875rem;color:var(--text-muted, #888);margin-bottom:1rem}.wizard-nav{display:flex;justify-content:space-between;gap:.5rem;margin-top:1rem}.fb-field-hidden{display:none!important}.fb-validation-error{color:var(--danger, #ef4444);font-size:.8rem;margin-top:.25rem}.fb-form-wrapper .domma-form-field{margin-bottom:2rem}.fb-form-wrapper .form-group:not(.form-buttons){margin-bottom:2rem}.fb-spacer{height:2rem}
|
package/public/js/forms.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const targets=document.querySelectorAll("[data-form]");targets.length&&targets.forEach(initFormTarget);function showMessage(i,
|
|
1
|
+
const targets=document.querySelectorAll("[data-form]");targets.length&&targets.forEach(initFormTarget);function showMessage(i,r,t){const e=i.querySelector(".fb-form-success, .fb-form-error");e&&e.remove();const s=document.createElement("div");s.className=t==="success"?"fb-form-success":"fb-form-error",s.textContent=r,i.appendChild(s)}function buildBlueprintFromFields(i,r){const t={};return i.forEach(function(e){if(e.type==="page-break"||e.type==="spacer"||!e.name)return;const s=e.type==="checkbox"?"boolean":e.type==="date"?"string":e.type,o={...e.formConfig||{}};o.span==="full"&&r&&(o.span=r),t[e.name]={type:s,label:e.label||e.name,required:e.required||!1,options:e.options,formConfig:{...e.placeholder&&{placeholder:e.placeholder},...e.helper&&{hint:e.helper},...o}},e.minLength!==void 0&&(t[e.name].minLength=e.minLength),e.maxLength!==void 0&&(t[e.name].maxLength=e.maxLength),e.min!==void 0&&(t[e.name].min=e.min),e.max!==void 0&&(t[e.name].max=e.max)}),t}function buildInitialData(i){const r={};return i.forEach(function(t){if(!(!t.name||t.type==="page-break"||t.type==="spacer")&&(t.type==="select"||t.type==="multiselect")&&t.required){const e=(t.options||[])[0];e&&(r[t.name]=typeof e=="object"?e.value:e)}}),r}function patchDateInputs(i,r){(r||[]).forEach(function(t){if(t.type!=="date"||!t.name)return;const e=i.querySelector('[name="'+t.name+'"]');e&&e.type!=="date"&&(e.type="date")})}function buildWizardSteps(i,r){const t=[];let e=[],s=r||"Step 1",o="";return i.forEach(function(m){m.type==="page-break"?(t.push({title:s,description:o,fieldGroup:e}),e=[],s=m.label||"Step "+(t.length+1),o=m.description||""):m.type!=="spacer"&&e.push(m)}),t.push({title:s,description:o,fieldGroup:e}),t}function injectHoneypot(i){const r=document.createElement("div");r.className="fb-form-honeypot",r.setAttribute("aria-hidden","true");const t=document.createElement("input");t.name="website",t.type="text",t.tabIndex=-1,t.autocomplete="url",t.placeholder="https://",r.appendChild(t);const e=document.createElement("input");e.name="_t",e.type="hidden",e.value=Date.now(),r.appendChild(e),i.appendChild(r)}function injectSpacers(i,r){const t=i.querySelector("form");if(!t)return;const e=Array.from(t.querySelectorAll(".form-group"));let s=0;r.forEach(function(o){if(o.type==="spacer"){const m=document.createElement("div");m.className="fb-spacer";const a=e[s];if(a)t.insertBefore(m,a);else{const u=t.querySelector('[type="submit"]');u?t.insertBefore(m,u):t.appendChild(m)}}else o.type!=="page-break"&&s++})}function submitForm(i,r,t,e,s){const o=s||e,m=o.querySelector('[name="website"]')?.value||"",a=o.querySelector('[name="_t"]')?.value||"",u=Object.assign({},r,{_hp:m,_t:a});return fetch("/api/forms/submit/"+i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(u)}).then(c=>c.json().then(n=>({ok:c.ok,body:n}))).then(c=>{c.ok&&c.body.ok?(e.textContent="",showMessage(e,c.body.message||t.successMessage||"Thank you.","success")):showMessage(e,c.body.error||"Something went wrong.","error")}).catch(()=>{showMessage(e,"Unable to submit. Please check your connection.","error")})}function renderManualForm(i,r,t,e,s){const o=document.createElement("form");o.noValidate=!0,r.forEach(function(a){const u=document.createElement("div");u.className="form-group",u.style.marginBottom="1.25rem";const c=document.createElement("label");if(c.className="form-label",c.textContent=a.label||a.name,a.required){const p=document.createElement("span");p.textContent=" *",p.style.color="#f87171",c.appendChild(p)}let n;a.type==="textarea"?(n=document.createElement("textarea"),n.rows=a.formConfig?.rows||4,n.className="form-input"):a.type==="select"?(n=document.createElement("select"),n.className="form-input",(a.options||[]).forEach(function(p){const l=document.createElement("option");l.value=typeof p=="string"?p:p.value??"",l.textContent=typeof p=="string"?p:p.label||l.value,n.appendChild(l)})):(n=document.createElement("input"),n.type=a.type||"text",n.className="form-input",a.placeholder&&(n.placeholder=a.placeholder)),n.name=a.name,n.required=a.required||!1,u.appendChild(c),u.appendChild(n),o.appendChild(u)}),t.honeypot&&injectHoneypot(o);const m=document.createElement("button");m.type="submit",m.className="btn btn-primary",m.textContent=t.submitText||"Submit",o.appendChild(m),o.addEventListener("submit",function(a){a.preventDefault();const u={};if(r.forEach(function(c){const n=o.querySelector('[name="'+c.name+'"]');n&&(u[c.name]=n.value)}),window.FormLogicEngine&&s){const c=window.FormLogicEngine,n=[],p=[];if(r.forEach(function(l){if(c.evaluateFieldVisibility(l,u)==="hidden"){delete u[l.name];return}const h=c.evaluateFieldRequirement(l,u),f=u[l.name];h&&(!f||!String(f).trim())&&n.push(l.label||l.name);const d=c.validateField(l,f||"",u);d.length&&p.push(d[0].message)}),n.length||p.length){const l=[];n.length&&l.push("Required: "+n.join(", ")),p.length&&l.push(p.join("; ")),showMessage(i,l.join(". "),"error");return}}i.classList.add("fb-form-loading"),m.disabled=!0,submitForm(e,u,t,i,o).finally(function(){i.classList.remove("fb-form-loading"),m.disabled=!1})}),i.appendChild(o),window.FormLogicEngine&&s&&r.some(a=>a.logic)&&new window.FormLogicEngine.FormLogicRuntime(s,i).init()}function initFormTarget(i){const r=i.getAttribute("data-form");r&&fetch("/api/forms/"+r+"/public").then(t=>{if(!t.ok)throw new Error("Form not found: "+r);return t.json()}).then(t=>{const e=t.fields||[],s=t.settings||{},o=document.createElement("div");o.className="fb-form-wrapper",i.appendChild(o);const m=e.some(a=>a.type==="page-break");if(typeof Domma<"u"&&Domma.forms){const a=s.columns||1;if(m&&Domma.forms.wizard){const c=buildWizardSteps(e,t.title).map(function(n){return{title:n.title,description:n.description,fields:buildBlueprintFromFields(n.fieldGroup,a)}});if(Domma.forms.wizard(o,{schema:{steps:c},onSubmit:function(n){return submitForm(r,n,s,o,null)}}),patchDateInputs(o,e),window.FormLogicEngine&&e.some(n=>n.logic)&&new window.FormLogicEngine.FormLogicRuntime(t,o).init(),s.honeypot){const n=o.querySelector("form");n&&injectHoneypot(n)}}else if(Domma.forms.render){const u=buildBlueprintFromFields(e,a),c=buildInitialData(e);if(Domma.forms.render(o,u,c,{submitText:s.submitText||"Submit",layout:s.layout||"stacked",columns:a,onSubmit:function(n){return submitForm(r,n,s,o,null)}}),patchDateInputs(o,e),window.FormLogicEngine&&e.some(n=>n.logic)&&new window.FormLogicEngine.FormLogicRuntime(t,o).init(),e.some(n=>n.type==="spacer")&&injectSpacers(o,e),s.honeypot){const n=o.querySelector("form");n&&injectHoneypot(n)}}}else renderManualForm(o,e.filter(a=>a.type!=="page-break"&&a.type!=="spacer"),s,r,t)}).catch(t=>{const e=document.createElement("p");e.textContent="Form unavailable.",e.style.cssText="color:#f87171;font-style:italic;",i.appendChild(e),console.warn("[forms]",t.message)})}
|
package/public/js/site.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
$(()=>{const u=window.__CMS_NAV__||{},i=window.__CMS_SITE__||{};if($("#site-navbar").length&&u.brand){const a={...u.brand};if(a.icon){let o=`<span data-icon="${a.icon}" style="width:1.1em;height:1.1em;margin-right:.35em;vertical-align:middle;"></span>`;a.text&&(o+=`<span class="navbar-brand-text">${a.text}</span>`),a.html=o}Domma.elements.navbar("#site-navbar",{brand:a,items:u.items||[],variant:u.variant||"dark",position:u.position||"sticky",collapsible:!0}),Domma.icons.scan("#site-navbar")}const y=$("#site-footer");if(y.length){const a=i.social||{},o={twitter:{label:"X / Twitter",svg:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-4.714-6.231-5.401 6.231H2.742l7.73-8.835L1.254 2.25H8.08l4.259 5.629L18.244 2.25zm-1.161 17.52h1.833L7.084 4.126H5.117z"/></svg>'},facebook:{label:"Facebook",svg:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z"/></svg>'},instagram:{label:"Instagram",svg:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M12 2.163c3.204 0 3.584.012 4.85.07 3.252.148 4.771 1.691 4.919 4.919.058 1.265.069 1.645.069 4.849 0 3.205-.012 3.584-.069 4.849-.149 3.225-1.664 4.771-4.919 4.919-1.266.058-1.644.07-4.85.07-3.204 0-3.584-.012-4.849-.07-3.26-.149-4.771-1.699-4.919-4.92-.058-1.265-.07-1.644-.07-4.849 0-3.204.013-3.583.07-4.849.149-3.227 1.664-4.771 4.919-4.919 1.266-.057 1.645-.069 4.849-.069zM12 0C8.741 0 8.333.014 7.053.072 2.695.272.273 2.69.073 7.052.014 8.333 0 8.741 0 12c0 3.259.014 3.668.072 4.948.2 4.358 2.618 6.78 6.98 6.98C8.333 23.986 8.741 24 12 24c3.259 0 3.668-.014 4.948-.072 4.354-.2 6.782-2.618 6.979-6.98.059-1.28.073-1.689.073-4.948 0-3.259-.014-3.667-.072-4.947-.196-4.354-2.617-6.78-6.979-6.98C15.668.014 15.259 0 12 0zm0 5.838a6.162 6.162 0 100 12.324 6.162 6.162 0 000-12.324zM12 16a4 4 0 110-8 4 4 0 010 8zm6.406-11.845a1.44 1.44 0 100 2.881 1.44 1.44 0 000-2.881z"/></svg>'},linkedin:{label:"LinkedIn",svg:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433a2.062 2.062 0 01-2.063-2.065 2.064 2.064 0 112.063 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z"/></svg>'},github:{label:"GitHub",svg:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"/></svg>'},youtube:{label:"YouTube",svg:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M23.495 6.205a3.007 3.007 0 00-2.088-2.088c-1.87-.501-9.396-.501-9.396-.501s-7.507-.01-9.396.501A3.007 3.007 0 00.527 6.205a31.247 31.247 0 00-.522 5.805 31.247 31.247 0 00.522 5.783 3.007 3.007 0 002.088 2.088c1.868.502 9.396.502 9.396.502s7.506 0 9.396-.502a3.007 3.007 0 002.088-2.088 31.247 31.247 0 00.5-5.783 31.247 31.247 0 00-.5-5.805zM9.609 15.601V8.408l6.264 3.602z"/></svg>'}};let t='<div class="footer-inner container">';if(i.footer){const n=i.footer;t+=`<p>${n.copyright||""}</p>`,n.links?.length&&(t+='<nav class="footer-links">',n.links.forEach(l=>{t+=`<a href="${l.url}">${l.text}</a>`}),t+="</nav>");const f=Object.keys(o).filter(l=>a[l]);f.length&&(t+='<div class="footer-social">',f.forEach(l=>{const{label:c,svg:s}=o[l];t+=`<a href="${a[l]}" target="_blank" rel="noopener noreferrer" aria-label="${c}" class="footer-social-link">${s}</a>`}),t+="</div>")}const e=S.get("reduced_motion"),d=e!==null?!!e:!!(window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);t+=`<label class="form-switch footer-motion-switch" title="Reduce motion"><input type="checkbox" class="form-switch-input" id="dm-motion-switch"${d?" checked":""}><span class="form-switch-label">Reduce motion</span></label>`,t+="</div>",y.html(t,{safe:!1}),document.getElementById("dm-motion-switch").addEventListener("change",function(){S.set("reduced_motion",this.checked),window.location.reload()})}$("#site-sidebar").length&&Domma.elements.sidebar("#site-sidebar",{autoGenerate:!0,selector:"h2, h3",collapsible:!1,push:!0,contentSelector:".site-content"}),Domma.icons.scan();const r=$(".page-body");if(r.length&&(r.find(".accordion").each(function(){Domma.elements.accordion(this,{allowMultiple:this.dataset.multi==="true"})}),r.find(".tabs").each(function(){Domma.elements.tabs(this)}),r.find(".carousel").each(function(){Domma.elements.carousel(this,{autoplay:this.dataset.autoplay==="true",interval:parseInt(this.dataset.interval,10)||5e3,loop:this.dataset.loop!=="false",animation:this.dataset.animation||"slide"})}),r.find(".dm-countdown").each(function(){const a={autoStart:!0};this.dataset.to&&(a.targetDate=new Date(this.dataset.to)),this.dataset.duration&&(a.duration=parseInt(this.dataset.duration,10)),this.dataset.format&&(a.format=this.dataset.format),Domma.elements.timer(this,a)}),r.find("[data-tooltip]").each(function(){Domma.elements.tooltip(this,{content:$(this).data("tooltip"),position:$(this).data("tooltip-position")||"top"})}),r.find(".dm-progression").each(function(){Domma.elements.progression(this,{layout:this.dataset.layout||"vertical",theme:this.dataset.theme||"minimal",mode:this.dataset.mode||"timeline",statusIcons:!0})}),r.find(".card[data-collapsible]").each(function(){const a=this.querySelector(".card-header");a&&a.addEventListener("click",()=>this.classList.toggle("is-collapsed"))}),r.find(".dm-so-trigger").each(function(){this.addEventListener("click",()=>{const a=this.dataset.soTarget,o=document.getElementById(a);if(!o)return;const t=E.slideover({title:o.dataset.soTitle||"",size:o.dataset.soSize||"md",position:o.dataset.soPosition||"right"});o.style.display="",t.setContent(o),t.open()})})),typeof $.setup=="function"){const a=Object.assign({},window.__CMS_DCONFIG__||{});if(document.querySelectorAll(".dm-page-config[data-config]").forEach(o=>{try{const t=atob(o.dataset.config),e=JSON.parse(t);Object.assign(a,e)}catch{}}),Object.keys(a).length>0){const o={};for(const[t,e]of Object.entries(a)){const d=e?.events?.click,{confirm:n,toast:f,alert:l,prompt:c,...s}=d||{};n||f||l||c?($(t).on("click",async function(h){if(h.preventDefault(),n&&!await E.confirm(n))return;let m=null;if(!(c&&(m=await E.prompt(c,{inputPlaceholder:s.promptPlaceholder||"",inputValue:s.promptDefault||""}),m===null))){if(s.target){const b=$(s.target);s.toggleClass&&b.toggleClass(s.toggleClass),s.addClass&&b.addClass(s.addClass),s.removeClass&&b.removeClass(s.removeClass),m!==null&&(s.setText&&b.text(m),s.setVal&&b.val(m),s.setAttr&&b.attr(s.setAttr,m))}s.href&&(window.location.href=s.href),f&&E.toast(f,{type:s.toastType||"success"}),l&&E.alert(l)}}),Object.keys(s).length&&(o[t]={...e,events:{...e.events,click:s}})):o[t]=e}$.setup(o)}}r.length&&wireCTAButtons(r.get(0))});function wireCTAButtons(u){u.querySelectorAll(".dm-cta-trigger").forEach(i=>{i.addEventListener("click",async()=>{const g=i.dataset.action,y=i.dataset.entry,p=i.dataset.confirm;let r=S.get("auth_token");if(!r){E.toast("Please log in to perform this action.",{type:"warning"});return}if(p&&!await E.confirm(p))return;const a=Array.from(i.childNodes).map(t=>t.cloneNode(!0));i.disabled=!0,i.textContent="Running\u2026";const o=t=>fetch(`/api/actions/${g}/public`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify({entryId:y})});try{let t=await o(r);if(t.status===401){const d=S.get("auth_refresh_token");if(d){const n=await fetch("/api/auth/refresh",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:d})});if(n.ok){const{token:f}=await n.json();S.set("auth_token",f),r=f,t=await o(r)}}}const e=await t.json().catch(()=>({}));if(!t.ok)throw new Error(e.error||e.message||`Error ${t.status}`);E.toast(e.message||"Action completed.",{type:"success"})}catch(t){E.toast(t.message||"Action failed.",{type:"error"})}finally{i.disabled=!1,i.textContent="",a.forEach(t=>i.appendChild(t)),Domma.icons.scan(i)}})})}(function(){const i=document.querySelectorAll("[data-collection-table]");!i.length||typeof T>"u"||!T.create||i.forEach(g=>{let y;try{y=JSON.parse(atob(g.dataset.payload))}catch{return}const{columns:p,rows:r,search:a,sortable:o,exportable:t,pageSize:e,empty:d,ctaConfig:n}=y;if(!p?.length)return;if(n){const c=p.findIndex(s=>s.key==="_cta");c!==-1&&(p[c]={key:"_cta",title:"",render:(s,v)=>{const h=document.createElement("button");if(h.className=`btn btn-${n.style||"primary"} dm-cta-trigger`,h.dataset.action=n.action||"",h.dataset.entry=v._entryId||"",n.confirm&&(h.dataset.confirm=n.confirm),n.icon){const m=document.createElement("span");m.dataset.icon=n.icon,h.appendChild(m),h.appendChild(document.createTextNode(" "))}return h.appendChild(document.createTextNode(n.label||"Run")),h}})}const f="col-table-"+Math.random().toString(36).slice(2,7),l=document.createElement("div");l.id=f,g.replaceChildren(l),T.create("#"+f,{data:r,columns:p,search:a,sortable:o,exportable:t,pageSize:e,emptyMessage:d}),n&&wireCTAButtons(l)})})(),(function(){const i=document.querySelectorAll("[data-form-inline]");if(!i.length||typeof F>"u")return;function g(a,o){const t={};return(a||[]).forEach(e=>{if(e.type==="page-break"||e.type==="spacer"||!e.name)return;const d=e.type==="checkbox"?"boolean":e.type==="date"?"string":e.type,n={...e.formConfig||{}};n.span==="full"&&o&&(n.span=o),t[e.name]={type:d,label:e.label,required:e.required,options:e.options,formConfig:{...e.placeholder&&{placeholder:e.placeholder},...e.helper&&{hint:e.helper},...n}}}),t}function y(a){const o={};return(a||[]).forEach(t=>{if(!(!t.name||t.type==="page-break"||t.type==="spacer")&&(t.type==="select"||t.type==="multiselect")&&t.required){const e=(t.options||[])[0];e&&(o[t.name]=typeof e=="object"?e.value:e)}}),o}function p(a,o){(o||[]).forEach(t=>{if(t.type!=="date"||!t.name)return;const e=a.querySelector(`[name="${t.name}"]`);e&&e.type!=="date"&&(e.type="date")})}function r(a,o,t){let e=a.querySelector(".cms-form-message");e||(e=document.createElement("p"),e.className="cms-form-message",a.appendChild(e)),e.textContent=o,e.style.cssText=t?"color:var(--danger,#f87171);margin-top:.75rem;":"color:var(--success,#4ade80);margin-top:.75rem;"}i.forEach(a=>{let o;try{o=JSON.parse(atob(a.dataset.formInline))}catch{return}const t=o.fields||[],e=o.settings||{},d=e.columns||1,n=e.layout||"stacked",f=t.some(c=>c.type==="page-break"),l=async c=>{try{const s=await H.post(`/api/forms/submit/${o.slug}`,c);if(s?.redirect){window.location.href=s.redirect;return}for(;a.firstChild;)a.removeChild(a.firstChild);r(a,s?.message||e.successMessage||"Thank you for your submission.",!1)}catch(s){throw r(a,s.message||"Submission failed. Please try again.",!0),s}};if(f&&F.wizard){const c=[];let s=[],v=o.title||"Step 1",h="";t.forEach(m=>{m.type==="page-break"?(c.push({title:v,description:h,fields:g(s,d)}),s=[],v=m.label||`Step ${c.length+1}`,h=m.description||""):m.type!=="spacer"&&s.push(m)}),c.push({title:v,description:h,fields:g(s,d)}),F.wizard(a,{schema:{steps:c},onSubmit:l}),p(a,t)}else if(F.render){if(F.render(a,g(t,d),y(t),{submitText:e.submitText||"Submit",layout:n,columns:d,onSubmit:l}),n==="grid"&&e.submitSpan==="full"){const c=a.querySelector(".form-buttons");c&&c.classList.add("col-span-full")}p(a,t)}})})();
|
|
1
|
+
$(()=>{const y=window.__CMS_NAV__||{},r=window.__CMS_SITE__||{};if(r.autoTheme?.enabled){let e=function(n){const u=(n||"07:00").split(":");return+u[0]*60+(+u[1]||0)},o=function(){const n=new Date,u=n.getHours()*60+n.getMinutes();return u>=e(t.dayStart)&&u<e(t.nightStart)?t.dayTheme:t.nightTheme};var s=e,l=o;const t=r.autoTheme;Domma.theme.set(o()),setInterval(()=>Domma.theme.set(o()),6e4)}if($("#site-navbar").length&&y.brand){const t={...y.brand};if(t.icon){let e=`<span data-icon="${t.icon}" style="width:1.1em;height:1.1em;margin-right:.35em;vertical-align:middle;"></span>`;t.text&&(e+=`<span class="navbar-brand-text">${t.text}</span>`),t.html=e}Domma.elements.navbar("#site-navbar",{brand:t,items:y.items||[],variant:y.variant||"dark",position:y.position||"sticky",collapsible:!0}),Domma.icons.scan("#site-navbar")}const v=$("#site-footer");if(v.length){const t=r.social||{},e={twitter:{label:"X / Twitter",svg:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-4.714-6.231-5.401 6.231H2.742l7.73-8.835L1.254 2.25H8.08l4.259 5.629L18.244 2.25zm-1.161 17.52h1.833L7.084 4.126H5.117z"/></svg>'},facebook:{label:"Facebook",svg:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z"/></svg>'},instagram:{label:"Instagram",svg:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M12 2.163c3.204 0 3.584.012 4.85.07 3.252.148 4.771 1.691 4.919 4.919.058 1.265.069 1.645.069 4.849 0 3.205-.012 3.584-.069 4.849-.149 3.225-1.664 4.771-4.919 4.919-1.266.058-1.644.07-4.85.07-3.204 0-3.584-.012-4.849-.07-3.26-.149-4.771-1.699-4.919-4.92-.058-1.265-.07-1.644-.07-4.849 0-3.204.013-3.583.07-4.849.149-3.227 1.664-4.771 4.919-4.919 1.266-.057 1.645-.069 4.849-.069zM12 0C8.741 0 8.333.014 7.053.072 2.695.272.273 2.69.073 7.052.014 8.333 0 8.741 0 12c0 3.259.014 3.668.072 4.948.2 4.358 2.618 6.78 6.98 6.98C8.333 23.986 8.741 24 12 24c3.259 0 3.668-.014 4.948-.072 4.354-.2 6.782-2.618 6.979-6.98.059-1.28.073-1.689.073-4.948 0-3.259-.014-3.667-.072-4.947-.196-4.354-2.617-6.78-6.979-6.98C15.668.014 15.259 0 12 0zm0 5.838a6.162 6.162 0 100 12.324 6.162 6.162 0 000-12.324zM12 16a4 4 0 110-8 4 4 0 010 8zm6.406-11.845a1.44 1.44 0 100 2.881 1.44 1.44 0 000-2.881z"/></svg>'},linkedin:{label:"LinkedIn",svg:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433a2.062 2.062 0 01-2.063-2.065 2.064 2.064 0 112.063 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z"/></svg>'},github:{label:"GitHub",svg:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"/></svg>'},youtube:{label:"YouTube",svg:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M23.495 6.205a3.007 3.007 0 00-2.088-2.088c-1.87-.501-9.396-.501-9.396-.501s-7.507-.01-9.396.501A3.007 3.007 0 00.527 6.205a31.247 31.247 0 00-.522 5.805 31.247 31.247 0 00.522 5.783 3.007 3.007 0 002.088 2.088c1.868.502 9.396.502 9.396.502s7.506 0 9.396-.502a3.007 3.007 0 002.088-2.088 31.247 31.247 0 00.5-5.783 31.247 31.247 0 00-.5-5.805zM9.609 15.601V8.408l6.264 3.602z"/></svg>'}};let o='<div class="footer-inner container">';if(r.footer){const h=r.footer;o+=`<p>${h.copyright||""}</p>`,h.links?.length&&(o+='<nav class="footer-links">',h.links.forEach(i=>{o+=`<a href="${i.url}">${i.text}</a>`}),o+="</nav>");const f=Object.keys(e).filter(i=>t[i]);f.length&&(o+='<div class="footer-social">',f.forEach(i=>{const{label:d,svg:a}=e[i];o+=`<a href="${t[i]}" target="_blank" rel="noopener noreferrer" aria-label="${d}" class="footer-social-link">${a}</a>`}),o+="</div>")}const n=S.get("reduced_motion"),u=n!==null?!!n:!!(window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);o+=`<label class="form-switch footer-motion-switch" title="Reduce motion"><input type="checkbox" class="form-switch-input" id="dm-motion-switch"${u?" checked":""}><span class="form-switch-label">Reduce motion</span></label>`,o+="</div>",v.html(o,{safe:!1}),document.getElementById("dm-motion-switch").addEventListener("change",function(){S.set("reduced_motion",this.checked),window.location.reload()})}$("#site-sidebar").length&&Domma.elements.sidebar("#site-sidebar",{autoGenerate:!0,selector:"h2, h3",collapsible:!1,push:!0,contentSelector:".site-content"}),Domma.icons.scan();const c=$(".page-body");if(c.length&&(c.find(".accordion").each(function(){Domma.elements.accordion(this,{allowMultiple:this.dataset.multi==="true"})}),c.find(".tabs").each(function(){Domma.elements.tabs(this)}),c.find(".carousel").each(function(){Domma.elements.carousel(this,{autoplay:this.dataset.autoplay==="true",interval:parseInt(this.dataset.interval,10)||5e3,loop:this.dataset.loop!=="false",animation:this.dataset.animation||"slide"})}),c.find(".dm-countdown").each(function(){const t={autoStart:!0};this.dataset.to&&(t.targetDate=new Date(this.dataset.to)),this.dataset.duration&&(t.duration=parseInt(this.dataset.duration,10)),this.dataset.format&&(t.format=this.dataset.format),Domma.elements.timer(this,t)}),c.find("[data-tooltip]").each(function(){Domma.elements.tooltip(this,{content:$(this).data("tooltip"),position:$(this).data("tooltip-position")||"top"})}),c.find(".dm-progression").each(function(){Domma.elements.progression(this,{layout:this.dataset.layout||"vertical",theme:this.dataset.theme||"minimal",mode:this.dataset.mode||"timeline",statusIcons:!0})}),c.find(".card[data-collapsible]").each(function(){const t=this.querySelector(".card-header");t&&t.addEventListener("click",()=>this.classList.toggle("is-collapsed"))}),c.find(".dm-so-trigger").each(function(){this.addEventListener("click",()=>{const t=this.dataset.soTarget,e=document.getElementById(t);if(!e)return;const o=E.slideover({title:e.dataset.soTitle||"",size:e.dataset.soSize||"md",position:e.dataset.soPosition||"right"});e.style.display="",o.setContent(e),o.open()})})),typeof $.setup=="function"){const t=Object.assign({},window.__CMS_DCONFIG__||{});if(document.querySelectorAll(".dm-page-config[data-config]").forEach(e=>{try{const o=atob(e.dataset.config),n=JSON.parse(o);Object.assign(t,n)}catch{}}),Object.keys(t).length>0){const e={};for(const[o,n]of Object.entries(t)){const u=n?.events?.click,{confirm:h,toast:f,alert:i,prompt:d,...a}=u||{};h||f||i||d?($(o).on("click",async function(p){if(p.preventDefault(),h&&!await E.confirm(h))return;let C=null;if(!(d&&(C=await E.prompt(d,{inputPlaceholder:a.promptPlaceholder||"",inputValue:a.promptDefault||""}),C===null))){if(a.target){const w=$(a.target);a.toggleClass&&w.toggleClass(a.toggleClass),a.addClass&&w.addClass(a.addClass),a.removeClass&&w.removeClass(a.removeClass),C!==null&&(a.setText&&w.text(C),a.setVal&&w.val(C),a.setAttr&&w.attr(a.setAttr,C))}a.href&&(window.location.href=a.href),f&&E.toast(f,{type:a.toastType||"success"}),i&&E.alert(i)}}),Object.keys(a).length&&(e[o]={...n,events:{...n.events,click:a}})):e[o]=n}$.setup(e)}}c.length&&wireCTAButtons(c.get(0))});function wireCTAButtons(y){y.querySelectorAll(".dm-cta-trigger").forEach(r=>{r.addEventListener("click",async()=>{const b=r.dataset.action,v=r.dataset.entry,g=r.dataset.confirm;let c=S.get("auth_token");if(!c){E.toast("Please log in to perform this action.",{type:"warning"});return}if(g&&!await E.confirm(g))return;const s=Array.from(r.childNodes).map(t=>t.cloneNode(!0));r.disabled=!0,r.textContent="Running\u2026";const l=t=>fetch(`/api/actions/${b}/public`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify({entryId:v})});try{let t=await l(c);if(t.status===401){const o=S.get("auth_refresh_token");if(o){const n=await fetch("/api/auth/refresh",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:o})});if(n.ok){const{token:u}=await n.json();S.set("auth_token",u),c=u,t=await l(c)}}}const e=await t.json().catch(()=>({}));if(!t.ok)throw new Error(e.error||e.message||`Error ${t.status}`);E.toast(e.message||"Action completed.",{type:"success"})}catch(t){E.toast(t.message||"Action failed.",{type:"error"})}finally{r.disabled=!1,r.textContent="",s.forEach(t=>r.appendChild(t)),Domma.icons.scan(r)}})})}(function(){const r=document.querySelectorAll("[data-collection-table]");!r.length||typeof T>"u"||!T.create||r.forEach(b=>{let v;try{v=JSON.parse(atob(b.dataset.payload))}catch{return}const{columns:g,rows:c,search:s,sortable:l,exportable:t,pageSize:e,empty:o,ctaConfig:n}=v;if(!g?.length)return;if(n){const f=g.findIndex(i=>i.key==="_cta");f!==-1&&(g[f]={key:"_cta",title:"",render:(i,d)=>{const a=document.createElement("button");if(a.className=`btn btn-${n.style||"primary"} dm-cta-trigger`,a.dataset.action=n.action||"",a.dataset.entry=d._entryId||"",n.confirm&&(a.dataset.confirm=n.confirm),n.icon){const m=document.createElement("span");m.dataset.icon=n.icon,a.appendChild(m),a.appendChild(document.createTextNode(" "))}return a.appendChild(document.createTextNode(n.label||"Run")),a}})}const u="col-table-"+Math.random().toString(36).slice(2,7),h=document.createElement("div");h.id=u,b.replaceChildren(h),T.create("#"+u,{data:c,columns:g,search:s,sortable:l,exportable:t,pageSize:e,emptyMessage:o}),n&&wireCTAButtons(h)})})(),(function(){const r=document.querySelectorAll("[data-form-inline]");if(!r.length||typeof F>"u")return;function b(s,l){const t={};return(s||[]).forEach(e=>{if(e.type==="page-break"||e.type==="spacer"||!e.name)return;const o=e.type==="checkbox"?"boolean":e.type==="date"?"string":e.type,n={...e.formConfig||{}};n.span==="full"&&l&&(n.span=l),t[e.name]={type:o,label:e.label,required:e.required,options:e.options,formConfig:{...e.placeholder&&{placeholder:e.placeholder},...e.helper&&{hint:e.helper},...n}}}),t}function v(s){const l={};return(s||[]).forEach(t=>{if(!(!t.name||t.type==="page-break"||t.type==="spacer")&&(t.type==="select"||t.type==="multiselect")&&t.required){const e=(t.options||[])[0];e&&(l[t.name]=typeof e=="object"?e.value:e)}}),l}function g(s,l){(l||[]).forEach(t=>{if(t.type!=="date"||!t.name)return;const e=s.querySelector(`[name="${t.name}"]`);e&&e.type!=="date"&&(e.type="date")})}function c(s,l,t){let e=s.querySelector(".cms-form-message");e||(e=document.createElement("p"),e.className="cms-form-message",s.appendChild(e)),e.textContent=l,e.style.cssText=t?"color:var(--danger,#f87171);margin-top:.75rem;":"color:var(--success,#4ade80);margin-top:.75rem;"}r.forEach(s=>{let l;try{l=JSON.parse(atob(s.dataset.formInline))}catch{return}const t=l.fields||[],e=l.settings||{},o=e.columns||1,n=e.layout||"stacked",u=t.some(i=>i.type==="page-break"),h=async i=>{try{const d=s.querySelector('[name="website"]'),a=s.querySelector('[name="_t"]'),m=Object.assign({},i);d!==null&&(m._hp=d.value),a!==null&&(m._t=a.value);const p=await H.post(`/api/forms/submit/${l.slug}`,m);if(p?.redirect){window.location.href=p.redirect;return}for(;s.firstChild;)s.removeChild(s.firstChild);c(s,p?.message||e.successMessage||"Thank you for your submission.",!1)}catch(d){throw c(s,d.message||"Submission failed. Please try again.",!0),d}};function f(i){const d=i.querySelector("form");if(!d)return;const a=document.createElement("div");a.className="fb-form-honeypot",a.setAttribute("aria-hidden","true");const m=document.createElement("input");m.name="website",m.type="text",m.tabIndex=-1,m.autocomplete="url",m.placeholder="https://",a.appendChild(m);const p=document.createElement("input");p.name="_t",p.type="hidden",p.value=Date.now(),a.appendChild(p),d.appendChild(a)}if(u&&F.wizard){const i=[];let d=[],a=l.title||"Step 1",m="";t.forEach(p=>{p.type==="page-break"?(i.push({title:a,description:m,fields:b(d,o)}),d=[],a=p.label||`Step ${i.length+1}`,m=p.description||""):p.type!=="spacer"&&d.push(p)}),i.push({title:a,description:m,fields:b(d,o)}),F.wizard(s,{schema:{steps:i},onSubmit:h}),g(s,t),e.honeypot!==!1&&f(s)}else if(F.render){if(F.render(s,b(t,o),v(t),{submitText:e.submitText||"Submit",layout:n,columns:o,onSubmit:h}),n==="grid"&&e.submitSpan==="full"){const i=s.querySelector(".form-buttons");i&&i.classList.add("col-span-full")}g(s,t),e.honeypot!==!1&&f(s)}})})();
|