hr-design-system-handlebars 1.114.49 → 1.114.50
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/CHANGELOG.md +12 -0
- package/dist/assets/index.css +3 -3
- package/dist/assets/js/alpine.js +1 -0
- package/dist/assets/js/components/newsletter/js/newsletterForm.alpine.js +194 -0
- package/dist/views/components/newsletter/components/controls_no_alpine.hbs +15 -0
- package/dist/views/components/newsletter/components/new_newsletter_form.hbs +36 -11
- package/dist/views/components/newsletter/components/newsletter_form.hbs +6 -4
- package/dist/views/components/newsletter/components/newsletter_result.hbs +1 -1
- package/dist/views/components/newsletter/newsletter.hbs +4 -10
- package/dist/views_static/components/newsletter/components/controls_no_alpine.hbs +15 -0
- package/dist/views_static/components/newsletter/components/new_newsletter_form.hbs +36 -11
- package/dist/views_static/components/newsletter/components/newsletter_form.hbs +6 -4
- package/dist/views_static/components/newsletter/components/newsletter_result.hbs +1 -1
- package/dist/views_static/components/newsletter/newsletter.hbs +4 -10
- package/package.json +1 -1
- package/src/assets/js/alpine.js +1 -0
- package/src/stories/views/components/newsletter/components/controls_no_alpine.hbs +15 -0
- package/src/stories/views/components/newsletter/components/new_newsletter_form.hbs +36 -11
- package/src/stories/views/components/newsletter/components/newsletter_form.hbs +6 -4
- package/src/stories/views/components/newsletter/components/newsletter_result.hbs +1 -1
- package/src/stories/views/components/newsletter/fixtures/new_newsletter.json +4 -0
- package/src/stories/views/components/newsletter/fixtures/newsletter.json +1 -0
- package/src/stories/views/components/newsletter/js/newsletterForm.alpine.js +194 -0
- package/src/stories/views/components/newsletter/newsletter.hbs +4 -10
- package/src/stories/views/components/newsletter/newsletter.stories.js +32 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
# v1.114.50 (Mon Jan 06 2025)
|
|
2
|
+
|
|
3
|
+
#### 🐛 Bug Fix
|
|
4
|
+
|
|
5
|
+
- Dpe 3328 c [#1199](https://github.com/mumprod/hr-design-system-handlebars/pull/1199) ([@Paul-Atreidis](https://github.com/Paul-Atreidis))
|
|
6
|
+
|
|
7
|
+
#### Authors: 1
|
|
8
|
+
|
|
9
|
+
- [@Paul-Atreidis](https://github.com/Paul-Atreidis)
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
1
13
|
# v1.114.49 (Thu Dec 19 2024)
|
|
2
14
|
|
|
3
15
|
#### 🐛 Bug Fix
|
package/dist/assets/index.css
CHANGED
|
@@ -3711,7 +3711,7 @@ article #commentList {
|
|
|
3711
3711
|
border-bottom-color: var(--color-secondary-ds);
|
|
3712
3712
|
}
|
|
3713
3713
|
.counter-reset {
|
|
3714
|
-
counter-reset:
|
|
3714
|
+
counter-reset: cnt1736163494047;
|
|
3715
3715
|
}
|
|
3716
3716
|
html { scroll-behavior: smooth; }
|
|
3717
3717
|
.placeholder-text-xs::-webkit-input-placeholder {
|
|
@@ -4126,7 +4126,7 @@ html { scroll-behavior: smooth; }
|
|
|
4126
4126
|
--tw-ring-color: rgba(255, 255, 255, 0.5);
|
|
4127
4127
|
}
|
|
4128
4128
|
.-ordered {
|
|
4129
|
-
counter-increment:
|
|
4129
|
+
counter-increment: cnt1736163494047 1;
|
|
4130
4130
|
}
|
|
4131
4131
|
.-ordered::before {
|
|
4132
4132
|
position: absolute;
|
|
@@ -4144,7 +4144,7 @@ html { scroll-behavior: smooth; }
|
|
|
4144
4144
|
--tw-text-opacity: 1;
|
|
4145
4145
|
color: rgba(0, 0, 0, 1);
|
|
4146
4146
|
color: rgba(0, 0, 0, var(--tw-text-opacity));
|
|
4147
|
-
content: counter(
|
|
4147
|
+
content: counter(cnt1736163494047);
|
|
4148
4148
|
}
|
|
4149
4149
|
/*! ****************************/
|
|
4150
4150
|
/*! DataPolicy stuff */
|
package/dist/assets/js/alpine.js
CHANGED
|
@@ -21,6 +21,7 @@ AsyncAlpine.init(Alpine)
|
|
|
21
21
|
.data('socialSharingHandler', ()=> import('components/social_sharing/socialSharingHandler.alpine.js'))
|
|
22
22
|
.data('inputHandler', ()=> import('components/forms/js/inputHandler.alpine.js'))
|
|
23
23
|
.data('contactForm', ()=> import('components/forms/js/contactForm.alpine.js'))
|
|
24
|
+
.data('newsletterForm', ()=> import('components/newsletter/js/newsletterForm.alpine.js'))
|
|
24
25
|
.start()
|
|
25
26
|
|
|
26
27
|
window.Alpine = Alpine
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { uxAction } from 'base/tracking/pianoHelper.subfeature'
|
|
2
|
+
|
|
3
|
+
export default function newsletterForm(formId,trackingInformations) {
|
|
4
|
+
return {
|
|
5
|
+
isPosting: false,
|
|
6
|
+
wasPosted: false,
|
|
7
|
+
wasPostedWithSuccess: false,
|
|
8
|
+
wasPostedWithError: false,
|
|
9
|
+
wasPostedAlreadyRegistered: false,
|
|
10
|
+
isWebview: window.parent.document.documentElement.classList.contains('webview'),
|
|
11
|
+
ajaxTimeout: 60 * 1000,
|
|
12
|
+
form: this.$refs[formId],
|
|
13
|
+
formWrapper: this.$refs[formId].closest("#formWrapper"),
|
|
14
|
+
actionUrl: "",
|
|
15
|
+
formInit(){
|
|
16
|
+
this.$store.forms.submissionAttempted[formId] = false;
|
|
17
|
+
//this.$store.forms.errorMessages = JSON.parse(errorMessages.replace(/"/g,'"'))
|
|
18
|
+
this.actionUrl = this.form.getAttribute('action')
|
|
19
|
+
console.log("FORMID: "+formId)
|
|
20
|
+
console.log("FORM: ", this.form)
|
|
21
|
+
console.log("ACTION: "+this.actionUrl)
|
|
22
|
+
console.log("GETATTRIBUTE "+ this.form.getAttribute('action'))
|
|
23
|
+
},
|
|
24
|
+
scrollToElementAndCenterWithTimeout(element, timeout){
|
|
25
|
+
setTimeout(() => {
|
|
26
|
+
element.scrollIntoView({
|
|
27
|
+
behavior: 'smooth',
|
|
28
|
+
block: 'center'
|
|
29
|
+
});
|
|
30
|
+
}, timeout);
|
|
31
|
+
},
|
|
32
|
+
submitButtonHandler(event) {
|
|
33
|
+
this.$store.forms.submissionAttempted[formId] = true;
|
|
34
|
+
if(this.form.reportValidity()){
|
|
35
|
+
this.handleSubmit(event)
|
|
36
|
+
} else {
|
|
37
|
+
this.scrollToElementAndCenterWithTimeout(document.activeElement, 50)
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
retryHandler() {
|
|
41
|
+
this.wasPosted = false;
|
|
42
|
+
this.wasPostedWithError = false;
|
|
43
|
+
this.scrollToElementAndCenterWithTimeout(this.formWrapper.previousElementSibling, 50)
|
|
44
|
+
|
|
45
|
+
},
|
|
46
|
+
handleValidationErrors(errors) {
|
|
47
|
+
console.log('Validation Errors:', errors);
|
|
48
|
+
this.$store.forms.serverErrorFields[formId] = errors;
|
|
49
|
+
console.log('Validation Errors in Store:', this.$store.forms.serverErrorFields);
|
|
50
|
+
},
|
|
51
|
+
resetValidationErrors() {
|
|
52
|
+
this.$store.forms.serverErrorFields[formId] = {}
|
|
53
|
+
},
|
|
54
|
+
async postData() {
|
|
55
|
+
const formData = new FormData(this.form)
|
|
56
|
+
// use timestamp in seconds because the newsletter tool cannot handle milliseconds
|
|
57
|
+
formData.set('confirm-data-protection', Math.ceil(Date.now() / 1000))
|
|
58
|
+
|
|
59
|
+
const response = await fetch(this.actionUrl, {
|
|
60
|
+
method: 'POST',
|
|
61
|
+
body: formData,
|
|
62
|
+
})
|
|
63
|
+
return response
|
|
64
|
+
},
|
|
65
|
+
handleSubmit (event) {
|
|
66
|
+
event.preventDefault();
|
|
67
|
+
|
|
68
|
+
if (!this.isWebview) {
|
|
69
|
+
uxAction(trackingInformations);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (this.isPosting) return;
|
|
73
|
+
this.isPosting = true;
|
|
74
|
+
|
|
75
|
+
this.postData()
|
|
76
|
+
.then(async response => {
|
|
77
|
+
console.log(await response)
|
|
78
|
+
if (!response.ok) {
|
|
79
|
+
|
|
80
|
+
throw new Error('Netzwerk- oder Serverfehler')
|
|
81
|
+
}
|
|
82
|
+
return response
|
|
83
|
+
})
|
|
84
|
+
.then(async response => {
|
|
85
|
+
switch (response.body) {
|
|
86
|
+
case 'OK':
|
|
87
|
+
console.log("OK");
|
|
88
|
+
this.wasPosted = true;
|
|
89
|
+
this.wasPostedWithSuccess = true;
|
|
90
|
+
this.scrollToElementAndCenterWithTimeout(this.formWrapper.previousElementSibling, 0)
|
|
91
|
+
break
|
|
92
|
+
case 'no_valid_newsletters':
|
|
93
|
+
console.log("Already registered");
|
|
94
|
+
this.wasPosted = true;
|
|
95
|
+
this.wasPostedAlreadyRegistered = true;
|
|
96
|
+
this.scrollToElementAndCenterWithTimeout(this.formWrapper.previousElementSibling, 0)
|
|
97
|
+
break
|
|
98
|
+
default:
|
|
99
|
+
console.log("default");
|
|
100
|
+
this.wasPosted = true;
|
|
101
|
+
this.wasPostedWithError = true;
|
|
102
|
+
this.scrollToElementAndCenterWithTimeout(this.formWrapper.previousElementSibling, 0)
|
|
103
|
+
|
|
104
|
+
}
|
|
105
|
+
})
|
|
106
|
+
.catch((error) => {
|
|
107
|
+
console.error('Beim Ausführen des Fetch ist ein Fehler aufgetreten.', error)
|
|
108
|
+
this.wasPosted = true;
|
|
109
|
+
this.wasPostedWithError = true;
|
|
110
|
+
this.scrollToElementAndCenterWithTimeout(this.formWrapper.previousElementSibling, 0)
|
|
111
|
+
})
|
|
112
|
+
},
|
|
113
|
+
handleOldSubmit(event, form ) {
|
|
114
|
+
event.preventDefault();
|
|
115
|
+
|
|
116
|
+
if (!this.isWebview) {
|
|
117
|
+
uxAction(trackingInformations);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if (this.isPosting) return;
|
|
121
|
+
this.isPosting = true;
|
|
122
|
+
|
|
123
|
+
console.log('DATA:', new URLSearchParams(new FormData(form)).toString());
|
|
124
|
+
|
|
125
|
+
let ajaxOptions = {
|
|
126
|
+
method: 'POST',
|
|
127
|
+
headers: {
|
|
128
|
+
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
|
|
129
|
+
},
|
|
130
|
+
timeout: this.ajaxTimeout,
|
|
131
|
+
body: new URLSearchParams(new FormData(form)),
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
fetch(ajaxOptions.url, ajaxOptions)
|
|
135
|
+
.then(async (response) => {
|
|
136
|
+
const data = await response.text();
|
|
137
|
+
if (response.ok) {
|
|
138
|
+
console.log('Done');
|
|
139
|
+
console.log(data);
|
|
140
|
+
if (jsonUrl) {
|
|
141
|
+
const responseData = JSON.parse(data);
|
|
142
|
+
switch (responseData.status) {
|
|
143
|
+
case 'VALIDATION_ERROR':
|
|
144
|
+
this.resetValidationErrors();
|
|
145
|
+
this.handleValidationErrors(responseData.errors);
|
|
146
|
+
break;
|
|
147
|
+
case 'OK':
|
|
148
|
+
console.log("OK");
|
|
149
|
+
this.wasPosted = true;
|
|
150
|
+
this.wasPostedWithSuccess = true;
|
|
151
|
+
this.scrollToElementAndCenterWithTimeout(this.formWrapper.previousElementSibling, 0)
|
|
152
|
+
|
|
153
|
+
break;
|
|
154
|
+
default:
|
|
155
|
+
console.log("default");
|
|
156
|
+
this.wasPosted = true;
|
|
157
|
+
this.wasPostedWithError = true;
|
|
158
|
+
this.scrollToElementAndCenterWithTimeout(this.formWrapper.previousElementSibling, 0)
|
|
159
|
+
break;
|
|
160
|
+
}
|
|
161
|
+
} else {
|
|
162
|
+
|
|
163
|
+
this.wasPosted = true;
|
|
164
|
+
this.wasPostedWithError = true;
|
|
165
|
+
this.scrollToElementAndCenterWithTimeout(this.formWrapper.previousElementSibling, 0)
|
|
166
|
+
}
|
|
167
|
+
if (formId) {
|
|
168
|
+
window.location.hash = formId;
|
|
169
|
+
}
|
|
170
|
+
} else {
|
|
171
|
+
this.wasPosted = true;
|
|
172
|
+
this.wasPostedWithError = true;
|
|
173
|
+
this.scrollToElementAndCenterWithTimeout(this.formWrapper.previousElementSibling, 0)
|
|
174
|
+
throw new Error('Network response was not ok.');
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
}
|
|
178
|
+
})
|
|
179
|
+
.catch((error) => {
|
|
180
|
+
console.error('Fail:', error);
|
|
181
|
+
this.wasPosted = true;
|
|
182
|
+
this.wasPostedWithError = true;
|
|
183
|
+
this.scrollToElementAndCenterWithTimeout(this.formWrapper.previousElementSibling, 0)
|
|
184
|
+
})
|
|
185
|
+
.finally(() => {
|
|
186
|
+
console.log('Always');
|
|
187
|
+
this.isPosting = false;
|
|
188
|
+
});
|
|
189
|
+
},
|
|
190
|
+
getSubmissionAttempted() {
|
|
191
|
+
return this.$store.forms.submissionAttempted[formId]
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<div class="flex flex-col-reverse items-center justify-between sm:flex-row gap-y-6">
|
|
2
|
+
<div class="w-full text-xs basis-full text-gray-scorpion dark:text-text-dark font-headingSerif">{{loca "form_text_required"}}</div>
|
|
3
|
+
<div class="flex items-center justify-end w-full basis-full">
|
|
4
|
+
<label class="order-2 cursor-pointer {{> components/button/utilities/button_base_classes}} {{> components/button/utilities/button_variation_classes _variant='primary'}} {{> components/button/utilities/button_dimension_classes _size='lg'}}">
|
|
5
|
+
<span class="hidden" :class="{'hidden': !isPosting}">{{> components/base/image/icon _icon="reload" _addClass="w-5 h-5 fill-white dark:fill-text-dark animate-spin"}}</span>
|
|
6
|
+
<span class="" :class="{'hidden': isPosting}">{{> components/base/image/icon _icon="send-ds" _addClass="w-5 h-5 fill-white dark:fill-text-dark "}}</span>
|
|
7
|
+
<input type="submit" class="pl-2 cursor-pointer" value="{{loca "form_button_submit"}}" @click.prevent=""/>
|
|
8
|
+
</label>
|
|
9
|
+
|
|
10
|
+
{{#> components/button/button _variant="tertiary"_size="lg" _css="order-1 mr-4" _type="reset"}}
|
|
11
|
+
<span class="text-base ds-button-label ">{{loca "form_button_reset"}}</span>
|
|
12
|
+
{{/components/button/button}}
|
|
13
|
+
|
|
14
|
+
</div>
|
|
15
|
+
</div>
|
|
@@ -1,13 +1,23 @@
|
|
|
1
|
-
<div class="
|
|
2
|
-
<form class="
|
|
3
|
-
|
|
1
|
+
<div id="formWrapper" class="mt-4">
|
|
2
|
+
<form class="relative flex flex-col justify-center overflow-hidden group"
|
|
3
|
+
id="form{{nextRandom}}"
|
|
4
|
+
x-ref="form{{getRandom}}"
|
|
5
|
+
ax-load
|
|
6
|
+
x-data="newsletterForm('form{{getRandom}}','{{this.trackingInformations}}')"
|
|
7
|
+
x-init="formInit()"
|
|
8
|
+
x-ignore
|
|
9
|
+
@submit.prevent
|
|
10
|
+
action="index.html"
|
|
11
|
+
method="post"
|
|
12
|
+
accept-charset="utf-8"
|
|
13
|
+
>
|
|
4
14
|
|
|
5
15
|
{{~> components/forms/components/input
|
|
6
16
|
_type="email"
|
|
7
17
|
_isEmail=true
|
|
8
18
|
_name="email"
|
|
9
19
|
_label="E-Mail"
|
|
10
|
-
_labelClass="
|
|
20
|
+
_labelClass=""
|
|
11
21
|
_description=""
|
|
12
22
|
_required=true
|
|
13
23
|
_maxLength="140"
|
|
@@ -27,7 +37,7 @@
|
|
|
27
37
|
}}
|
|
28
38
|
|
|
29
39
|
|
|
30
|
-
{{~> components/forms/components/controls
|
|
40
|
+
{{~> components/forms/components/controls}}
|
|
31
41
|
|
|
32
42
|
|
|
33
43
|
{{~> components/forms/components/input
|
|
@@ -46,14 +56,29 @@
|
|
|
46
56
|
_hasLabel=false
|
|
47
57
|
}}
|
|
48
58
|
|
|
49
|
-
<
|
|
59
|
+
<div class="flex flex-col gap-6 js-successMessage md:gap-10" id="successMessage" x-show="wasPostedWithSuccess"
|
|
60
|
+
x-transition:enter="transition ease-out duration-300 delay-75"
|
|
61
|
+
x-transition:enter-start="opacity-0 transform scale-90"
|
|
62
|
+
x-transition:enter-end="opacity-100 transform scale-100"
|
|
63
|
+
x-cloak
|
|
64
|
+
>
|
|
50
65
|
{{{include "components/newsletter/components/newsletter_success" }}}
|
|
51
|
-
</
|
|
52
|
-
<
|
|
66
|
+
</div>
|
|
67
|
+
<div class="flex flex-col gap-6 js-errorMessage md:gap-10" id="errorMessage" x-show="wasPostedWithError"
|
|
68
|
+
x-transition:enter="transition ease-out duration-300 delay-75"
|
|
69
|
+
x-transition:enter-start="opacity-0 transform scale-90"
|
|
70
|
+
x-transition:enter-end="opacity-100 transform scale-100"
|
|
71
|
+
x-cloak
|
|
72
|
+
>
|
|
53
73
|
{{{include "components/newsletter/components/newsletter_error" }}}
|
|
54
|
-
</
|
|
55
|
-
<
|
|
74
|
+
</div>
|
|
75
|
+
<div class="flex flex-col gap-6 js-alreadyRegisteredMessage md:gap-10" id="alreadyRegisteredMessage" x-show="wasPostedAlreadyRegistered"
|
|
76
|
+
x-transition:enter="transition ease-out duration-300 delay-75"
|
|
77
|
+
x-transition:enter-start="opacity-0 transform scale-90"
|
|
78
|
+
x-transition:enter-end="opacity-100 transform scale-100"
|
|
79
|
+
x-cloak
|
|
80
|
+
>
|
|
56
81
|
{{{include "components/newsletter/components/newsletter_already_registered" }}}
|
|
57
|
-
</
|
|
82
|
+
</div>
|
|
58
83
|
</form>
|
|
59
84
|
</div>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
<
|
|
1
|
+
<div id="formWrapper" class="mt-4">
|
|
2
|
+
<form class="relative flex flex-col justify-center overflow-hidden group js-form" id="form{{nextRandom}}" x-ref="form{{getRandom}}" ax-load="" x-data="" x-init="" @submit.prevent=""
|
|
2
3
|
action="{{configProperty "mailserver.newsletter"}}" method="post" enctype="application/x-www-form-urlencoded"
|
|
3
4
|
accept-charset="utf-8">
|
|
4
5
|
|
|
@@ -7,7 +8,7 @@
|
|
|
7
8
|
_isEmail="true"
|
|
8
9
|
_name="email"
|
|
9
10
|
_label="E-Mail"
|
|
10
|
-
_labelClass="
|
|
11
|
+
_labelClass=""
|
|
11
12
|
_description=""
|
|
12
13
|
_required="true"
|
|
13
14
|
_maxLength="140"
|
|
@@ -30,7 +31,7 @@
|
|
|
30
31
|
}}
|
|
31
32
|
|
|
32
33
|
|
|
33
|
-
{{~> components/forms/components/controls
|
|
34
|
+
{{~> components/forms/components/controls}}
|
|
34
35
|
|
|
35
36
|
{{~> components/forms/components/input
|
|
36
37
|
_formField=this.formData.INXMAIL_HTTP_REDIRECT
|
|
@@ -58,4 +59,5 @@
|
|
|
58
59
|
_value=this.backlinkUuid
|
|
59
60
|
_hasLabel=false
|
|
60
61
|
}}
|
|
61
|
-
</form>
|
|
62
|
+
</form>
|
|
63
|
+
</div>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{{#if this.useNewNewsletter}}
|
|
2
|
-
<div id="{{this.uuid}}" class="{{_addClass}}
|
|
2
|
+
<div id="{{this.uuid}}" class="relative bg-highlight-1 dark:bg-highlight-1-dark sm:rounded-tl-hr sm:rounded-br-hr px-5 sm:px-13 pb-8 pt-6 sm:pt-12 mt-7 sm:mt-12 mb-5 article-full-width sm:article-narrow {{_addClass}}">
|
|
3
3
|
{{~> components/base/a11y/hiddenText _locaTag="story_newsletter_intro_sr" ~}}
|
|
4
4
|
<h3 class="mb-6 text-2xl md:text-3xl font-headingSerif sm:mb-12 text-text dark:text-text-dark">
|
|
5
5
|
{{this.title}}
|
|
@@ -9,22 +9,16 @@
|
|
|
9
9
|
{{{this.description}}}
|
|
10
10
|
</p>
|
|
11
11
|
{{/if}}
|
|
12
|
-
|
|
13
|
-
{{> components/newsletter/components/new_newsletter_form}}
|
|
14
|
-
</div>
|
|
12
|
+
{{> components/newsletter/components/new_newsletter_form}}
|
|
15
13
|
{{~> components/base/a11y/hiddenText _locaTag="story_newsletter_outro_sr" ~}}
|
|
16
14
|
</div>
|
|
17
15
|
{{else}}
|
|
18
|
-
<div id="{{this.uuid}}" class="{{_addClass}}
|
|
16
|
+
<div id="{{this.uuid}}" class="js-load relative bg-highlight-1 dark:bg-highlight-1-dark sm:rounded-tl-hr sm:rounded-br-hr px-5 sm:px-13 pb-8 pt-6 sm:pt-12 mt-7 sm:mt-12 mb-5 article-full-width sm:article-narrow {{_addClass}}" data-hr-newsletter-ds='{"url": "{{this.url.nocache}}"}'>
|
|
19
17
|
{{~> components/base/a11y/hiddenText _locaTag="story_newsletter_intro_sr" ~}}
|
|
20
18
|
<h3 class="mb-6 text-2xl md:text-3xl font-headingSerif sm:mb-12 text-text dark:text-text-dark">
|
|
21
19
|
{{this.title}}
|
|
22
20
|
</h3>
|
|
23
|
-
|
|
24
|
-
<div class="js-formWrapper">
|
|
25
|
-
{{> components/newsletter/components/newsletter_form}}
|
|
26
|
-
</div>
|
|
27
|
-
|
|
21
|
+
{{> components/newsletter/components/newsletter_form}}
|
|
28
22
|
{{~> components/base/a11y/hiddenText _locaTag="story_newsletter_outro_sr" ~}}
|
|
29
23
|
</div>
|
|
30
24
|
{{/if}}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<div class="flex flex-col-reverse items-center justify-between sm:flex-row gap-y-6">
|
|
2
|
+
<div class="w-full text-xs basis-full text-gray-scorpion dark:text-text-dark font-headingSerif">{{loca "form_text_required"}}</div>
|
|
3
|
+
<div class="flex items-center justify-end w-full basis-full">
|
|
4
|
+
<label class="order-2 cursor-pointer {{> components/button/utilities/button_base_classes}} {{> components/button/utilities/button_variation_classes _variant='primary'}} {{> components/button/utilities/button_dimension_classes _size='lg'}}">
|
|
5
|
+
<span class="hidden" :class="{'hidden': !isPosting}">{{> components/base/image/icon _icon="reload" _addClass="w-5 h-5 fill-white dark:fill-text-dark animate-spin"}}</span>
|
|
6
|
+
<span class="" :class="{'hidden': isPosting}">{{> components/base/image/icon _icon="send-ds" _addClass="w-5 h-5 fill-white dark:fill-text-dark "}}</span>
|
|
7
|
+
<input type="submit" class="pl-2 cursor-pointer" value="{{loca "form_button_submit"}}" @click.prevent=""/>
|
|
8
|
+
</label>
|
|
9
|
+
|
|
10
|
+
{{#> components/button/button _variant="tertiary"_size="lg" _css="order-1 mr-4" _type="reset"}}
|
|
11
|
+
<span class="text-base ds-button-label ">{{loca "form_button_reset"}}</span>
|
|
12
|
+
{{/components/button/button}}
|
|
13
|
+
|
|
14
|
+
</div>
|
|
15
|
+
</div>
|
|
@@ -1,13 +1,23 @@
|
|
|
1
|
-
<div class="
|
|
2
|
-
<form class="
|
|
3
|
-
|
|
1
|
+
<div id="formWrapper" class="mt-4">
|
|
2
|
+
<form class="relative flex flex-col justify-center overflow-hidden group"
|
|
3
|
+
id="form{{nextRandom}}"
|
|
4
|
+
x-ref="form{{getRandom}}"
|
|
5
|
+
ax-load
|
|
6
|
+
x-data="newsletterForm('form{{getRandom}}','{{this.trackingInformations}}')"
|
|
7
|
+
x-init="formInit()"
|
|
8
|
+
x-ignore
|
|
9
|
+
@submit.prevent
|
|
10
|
+
action="index.html"
|
|
11
|
+
method="post"
|
|
12
|
+
accept-charset="utf-8"
|
|
13
|
+
>
|
|
4
14
|
|
|
5
15
|
{{~> components/forms/components/input
|
|
6
16
|
_type="email"
|
|
7
17
|
_isEmail=true
|
|
8
18
|
_name="email"
|
|
9
19
|
_label="E-Mail"
|
|
10
|
-
_labelClass="
|
|
20
|
+
_labelClass=""
|
|
11
21
|
_description=""
|
|
12
22
|
_required=true
|
|
13
23
|
_maxLength="140"
|
|
@@ -27,7 +37,7 @@
|
|
|
27
37
|
}}
|
|
28
38
|
|
|
29
39
|
|
|
30
|
-
{{~> components/forms/components/controls
|
|
40
|
+
{{~> components/forms/components/controls}}
|
|
31
41
|
|
|
32
42
|
|
|
33
43
|
{{~> components/forms/components/input
|
|
@@ -46,14 +56,29 @@
|
|
|
46
56
|
_hasLabel=false
|
|
47
57
|
}}
|
|
48
58
|
|
|
49
|
-
<
|
|
59
|
+
<div class="flex flex-col gap-6 js-successMessage md:gap-10" id="successMessage" x-show="wasPostedWithSuccess"
|
|
60
|
+
x-transition:enter="transition ease-out duration-300 delay-75"
|
|
61
|
+
x-transition:enter-start="opacity-0 transform scale-90"
|
|
62
|
+
x-transition:enter-end="opacity-100 transform scale-100"
|
|
63
|
+
x-cloak
|
|
64
|
+
>
|
|
50
65
|
{{{include "components/newsletter/components/newsletter_success" }}}
|
|
51
|
-
</
|
|
52
|
-
<
|
|
66
|
+
</div>
|
|
67
|
+
<div class="flex flex-col gap-6 js-errorMessage md:gap-10" id="errorMessage" x-show="wasPostedWithError"
|
|
68
|
+
x-transition:enter="transition ease-out duration-300 delay-75"
|
|
69
|
+
x-transition:enter-start="opacity-0 transform scale-90"
|
|
70
|
+
x-transition:enter-end="opacity-100 transform scale-100"
|
|
71
|
+
x-cloak
|
|
72
|
+
>
|
|
53
73
|
{{{include "components/newsletter/components/newsletter_error" }}}
|
|
54
|
-
</
|
|
55
|
-
<
|
|
74
|
+
</div>
|
|
75
|
+
<div class="flex flex-col gap-6 js-alreadyRegisteredMessage md:gap-10" id="alreadyRegisteredMessage" x-show="wasPostedAlreadyRegistered"
|
|
76
|
+
x-transition:enter="transition ease-out duration-300 delay-75"
|
|
77
|
+
x-transition:enter-start="opacity-0 transform scale-90"
|
|
78
|
+
x-transition:enter-end="opacity-100 transform scale-100"
|
|
79
|
+
x-cloak
|
|
80
|
+
>
|
|
56
81
|
{{{include "components/newsletter/components/newsletter_already_registered" }}}
|
|
57
|
-
</
|
|
82
|
+
</div>
|
|
58
83
|
</form>
|
|
59
84
|
</div>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
<
|
|
1
|
+
<div id="formWrapper" class="mt-4">
|
|
2
|
+
<form class="relative flex flex-col justify-center overflow-hidden group js-form" id="form{{nextRandom}}" x-ref="form{{getRandom}}" ax-load="" x-data="" x-init="" @submit.prevent=""
|
|
2
3
|
action="{{configProperty "mailserver.newsletter"}}" method="post" enctype="application/x-www-form-urlencoded"
|
|
3
4
|
accept-charset="utf-8">
|
|
4
5
|
|
|
@@ -7,7 +8,7 @@
|
|
|
7
8
|
_isEmail="true"
|
|
8
9
|
_name="email"
|
|
9
10
|
_label="E-Mail"
|
|
10
|
-
_labelClass="
|
|
11
|
+
_labelClass=""
|
|
11
12
|
_description=""
|
|
12
13
|
_required="true"
|
|
13
14
|
_maxLength="140"
|
|
@@ -30,7 +31,7 @@
|
|
|
30
31
|
}}
|
|
31
32
|
|
|
32
33
|
|
|
33
|
-
{{~> components/forms/components/controls
|
|
34
|
+
{{~> components/forms/components/controls}}
|
|
34
35
|
|
|
35
36
|
{{~> components/forms/components/input
|
|
36
37
|
_formField=this.formData.INXMAIL_HTTP_REDIRECT
|
|
@@ -58,4 +59,5 @@
|
|
|
58
59
|
_value=this.backlinkUuid
|
|
59
60
|
_hasLabel=false
|
|
60
61
|
}}
|
|
61
|
-
</form>
|
|
62
|
+
</form>
|
|
63
|
+
</div>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{{#if this.useNewNewsletter}}
|
|
2
|
-
<div id="{{this.uuid}}" class="{{_addClass}}
|
|
2
|
+
<div id="{{this.uuid}}" class="relative bg-highlight-1 dark:bg-highlight-1-dark sm:rounded-tl-hr sm:rounded-br-hr px-5 sm:px-13 pb-8 pt-6 sm:pt-12 mt-7 sm:mt-12 mb-5 article-full-width sm:article-narrow {{_addClass}}">
|
|
3
3
|
{{~> components/base/a11y/hiddenText _locaTag="story_newsletter_intro_sr" ~}}
|
|
4
4
|
<h3 class="mb-6 text-2xl md:text-3xl font-headingSerif sm:mb-12 text-text dark:text-text-dark">
|
|
5
5
|
{{this.title}}
|
|
@@ -9,22 +9,16 @@
|
|
|
9
9
|
{{{this.description}}}
|
|
10
10
|
</p>
|
|
11
11
|
{{/if}}
|
|
12
|
-
|
|
13
|
-
{{> components/newsletter/components/new_newsletter_form}}
|
|
14
|
-
</div>
|
|
12
|
+
{{> components/newsletter/components/new_newsletter_form}}
|
|
15
13
|
{{~> components/base/a11y/hiddenText _locaTag="story_newsletter_outro_sr" ~}}
|
|
16
14
|
</div>
|
|
17
15
|
{{else}}
|
|
18
|
-
<div id="{{this.uuid}}" class="{{_addClass}}
|
|
16
|
+
<div id="{{this.uuid}}" class="js-load relative bg-highlight-1 dark:bg-highlight-1-dark sm:rounded-tl-hr sm:rounded-br-hr px-5 sm:px-13 pb-8 pt-6 sm:pt-12 mt-7 sm:mt-12 mb-5 article-full-width sm:article-narrow {{_addClass}}" data-hr-newsletter-ds='{"url": "{{this.url.nocache}}"}'>
|
|
19
17
|
{{~> components/base/a11y/hiddenText _locaTag="story_newsletter_intro_sr" ~}}
|
|
20
18
|
<h3 class="mb-6 text-2xl md:text-3xl font-headingSerif sm:mb-12 text-text dark:text-text-dark">
|
|
21
19
|
{{this.title}}
|
|
22
20
|
</h3>
|
|
23
|
-
|
|
24
|
-
<div class="js-formWrapper">
|
|
25
|
-
{{> components/newsletter/components/newsletter_form}}
|
|
26
|
-
</div>
|
|
27
|
-
|
|
21
|
+
{{> components/newsletter/components/newsletter_form}}
|
|
28
22
|
{{~> components/base/a11y/hiddenText _locaTag="story_newsletter_outro_sr" ~}}
|
|
29
23
|
</div>
|
|
30
24
|
{{/if}}
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"repository": "https://github.com/szuelch/hr-design-system-handlebars",
|
|
9
|
-
"version": "1.114.
|
|
9
|
+
"version": "1.114.50",
|
|
10
10
|
"scripts": {
|
|
11
11
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
12
12
|
"storybook": "storybook dev -p 6006 public",
|
package/src/assets/js/alpine.js
CHANGED
|
@@ -21,6 +21,7 @@ AsyncAlpine.init(Alpine)
|
|
|
21
21
|
.data('socialSharingHandler', ()=> import('components/social_sharing/socialSharingHandler.alpine.js'))
|
|
22
22
|
.data('inputHandler', ()=> import('components/forms/js/inputHandler.alpine.js'))
|
|
23
23
|
.data('contactForm', ()=> import('components/forms/js/contactForm.alpine.js'))
|
|
24
|
+
.data('newsletterForm', ()=> import('components/newsletter/js/newsletterForm.alpine.js'))
|
|
24
25
|
.start()
|
|
25
26
|
|
|
26
27
|
window.Alpine = Alpine
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<div class="flex flex-col-reverse items-center justify-between sm:flex-row gap-y-6">
|
|
2
|
+
<div class="w-full text-xs basis-full text-gray-scorpion dark:text-text-dark font-headingSerif">{{loca "form_text_required"}}</div>
|
|
3
|
+
<div class="flex items-center justify-end w-full basis-full">
|
|
4
|
+
<label class="order-2 cursor-pointer {{> components/button/utilities/button_base_classes}} {{> components/button/utilities/button_variation_classes _variant='primary'}} {{> components/button/utilities/button_dimension_classes _size='lg'}}">
|
|
5
|
+
<span class="hidden" :class="{'hidden': !isPosting}">{{> components/base/image/icon _icon="reload" _addClass="w-5 h-5 fill-white dark:fill-text-dark animate-spin"}}</span>
|
|
6
|
+
<span class="" :class="{'hidden': isPosting}">{{> components/base/image/icon _icon="send-ds" _addClass="w-5 h-5 fill-white dark:fill-text-dark "}}</span>
|
|
7
|
+
<input type="submit" class="pl-2 cursor-pointer" value="{{loca "form_button_submit"}}" @click.prevent=""/>
|
|
8
|
+
</label>
|
|
9
|
+
|
|
10
|
+
{{#> components/button/button _variant="tertiary"_size="lg" _css="order-1 mr-4" _type="reset"}}
|
|
11
|
+
<span class="text-base ds-button-label ">{{loca "form_button_reset"}}</span>
|
|
12
|
+
{{/components/button/button}}
|
|
13
|
+
|
|
14
|
+
</div>
|
|
15
|
+
</div>
|
|
@@ -1,13 +1,23 @@
|
|
|
1
|
-
<div class="
|
|
2
|
-
<form class="
|
|
3
|
-
|
|
1
|
+
<div id="formWrapper" class="mt-4">
|
|
2
|
+
<form class="relative flex flex-col justify-center overflow-hidden group"
|
|
3
|
+
id="form{{nextRandom}}"
|
|
4
|
+
x-ref="form{{getRandom}}"
|
|
5
|
+
ax-load
|
|
6
|
+
x-data="newsletterForm('form{{getRandom}}','{{this.trackingInformations}}')"
|
|
7
|
+
x-init="formInit()"
|
|
8
|
+
x-ignore
|
|
9
|
+
@submit.prevent
|
|
10
|
+
action="index.html"
|
|
11
|
+
method="post"
|
|
12
|
+
accept-charset="utf-8"
|
|
13
|
+
>
|
|
4
14
|
|
|
5
15
|
{{~> components/forms/components/input
|
|
6
16
|
_type="email"
|
|
7
17
|
_isEmail=true
|
|
8
18
|
_name="email"
|
|
9
19
|
_label="E-Mail"
|
|
10
|
-
_labelClass="
|
|
20
|
+
_labelClass=""
|
|
11
21
|
_description=""
|
|
12
22
|
_required=true
|
|
13
23
|
_maxLength="140"
|
|
@@ -27,7 +37,7 @@
|
|
|
27
37
|
}}
|
|
28
38
|
|
|
29
39
|
|
|
30
|
-
{{~> components/forms/components/controls
|
|
40
|
+
{{~> components/forms/components/controls}}
|
|
31
41
|
|
|
32
42
|
|
|
33
43
|
{{~> components/forms/components/input
|
|
@@ -46,14 +56,29 @@
|
|
|
46
56
|
_hasLabel=false
|
|
47
57
|
}}
|
|
48
58
|
|
|
49
|
-
<
|
|
59
|
+
<div class="flex flex-col gap-6 js-successMessage md:gap-10" id="successMessage" x-show="wasPostedWithSuccess"
|
|
60
|
+
x-transition:enter="transition ease-out duration-300 delay-75"
|
|
61
|
+
x-transition:enter-start="opacity-0 transform scale-90"
|
|
62
|
+
x-transition:enter-end="opacity-100 transform scale-100"
|
|
63
|
+
x-cloak
|
|
64
|
+
>
|
|
50
65
|
{{{include "components/newsletter/components/newsletter_success" }}}
|
|
51
|
-
</
|
|
52
|
-
<
|
|
66
|
+
</div>
|
|
67
|
+
<div class="flex flex-col gap-6 js-errorMessage md:gap-10" id="errorMessage" x-show="wasPostedWithError"
|
|
68
|
+
x-transition:enter="transition ease-out duration-300 delay-75"
|
|
69
|
+
x-transition:enter-start="opacity-0 transform scale-90"
|
|
70
|
+
x-transition:enter-end="opacity-100 transform scale-100"
|
|
71
|
+
x-cloak
|
|
72
|
+
>
|
|
53
73
|
{{{include "components/newsletter/components/newsletter_error" }}}
|
|
54
|
-
</
|
|
55
|
-
<
|
|
74
|
+
</div>
|
|
75
|
+
<div class="flex flex-col gap-6 js-alreadyRegisteredMessage md:gap-10" id="alreadyRegisteredMessage" x-show="wasPostedAlreadyRegistered"
|
|
76
|
+
x-transition:enter="transition ease-out duration-300 delay-75"
|
|
77
|
+
x-transition:enter-start="opacity-0 transform scale-90"
|
|
78
|
+
x-transition:enter-end="opacity-100 transform scale-100"
|
|
79
|
+
x-cloak
|
|
80
|
+
>
|
|
56
81
|
{{{include "components/newsletter/components/newsletter_already_registered" }}}
|
|
57
|
-
</
|
|
82
|
+
</div>
|
|
58
83
|
</form>
|
|
59
84
|
</div>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
<
|
|
1
|
+
<div id="formWrapper" class="mt-4">
|
|
2
|
+
<form class="relative flex flex-col justify-center overflow-hidden group js-form" id="form{{nextRandom}}" x-ref="form{{getRandom}}" ax-load="" x-data="" x-init="" @submit.prevent=""
|
|
2
3
|
action="{{configProperty "mailserver.newsletter"}}" method="post" enctype="application/x-www-form-urlencoded"
|
|
3
4
|
accept-charset="utf-8">
|
|
4
5
|
|
|
@@ -7,7 +8,7 @@
|
|
|
7
8
|
_isEmail="true"
|
|
8
9
|
_name="email"
|
|
9
10
|
_label="E-Mail"
|
|
10
|
-
_labelClass="
|
|
11
|
+
_labelClass=""
|
|
11
12
|
_description=""
|
|
12
13
|
_required="true"
|
|
13
14
|
_maxLength="140"
|
|
@@ -30,7 +31,7 @@
|
|
|
30
31
|
}}
|
|
31
32
|
|
|
32
33
|
|
|
33
|
-
{{~> components/forms/components/controls
|
|
34
|
+
{{~> components/forms/components/controls}}
|
|
34
35
|
|
|
35
36
|
{{~> components/forms/components/input
|
|
36
37
|
_formField=this.formData.INXMAIL_HTTP_REDIRECT
|
|
@@ -58,4 +59,5 @@
|
|
|
58
59
|
_value=this.backlinkUuid
|
|
59
60
|
_hasLabel=false
|
|
60
61
|
}}
|
|
61
|
-
</form>
|
|
62
|
+
</form>
|
|
63
|
+
</div>
|
|
@@ -6,6 +6,10 @@
|
|
|
6
6
|
{"value":"","label":"Anmelden","title":"Anmelden","name":"Registrierung","isSelected":false},
|
|
7
7
|
{"value":"","label":"Abmelden","title":"Abmelden","name":"Registrierung","isSelected":false}
|
|
8
8
|
],
|
|
9
|
+
"successText":{"richText":"Ficken sie sich oder wie sie heißen, sie kriegen den Newsletter"},
|
|
10
|
+
"registeredText":{"richText":"Ficken sie sich oder wie sie heißen, sie sind bereits bei uns"},
|
|
11
|
+
"errorText":{"richText":"Ficken sie sich oder wie sie heißen, leider nicht funktioniert"},
|
|
12
|
+
"uuid":"d91b7e16-d476-425f-a535-587c6957df37",
|
|
9
13
|
"successLink":"Link wenn erfolgreich",
|
|
10
14
|
"errorLink": "Link wenn Fehler",
|
|
11
15
|
"backlinkUuid": "Backlink mit UUID (altes Voting)",
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
{"value":"","label":"Anmelden","title":"Anmelden","name":"Registrierung","isSelected":false},
|
|
7
7
|
{"value":"","label":"Abmelden","title":"Abmelden","name":"Registrierung","isSelected":false}
|
|
8
8
|
],
|
|
9
|
+
"uuid":"d91b7e16-d476-425f-a535-587c6957df37",
|
|
9
10
|
"successLink":"Link wenn erfolgreich",
|
|
10
11
|
"errorLink": "Link wenn Fehler",
|
|
11
12
|
"backlinkUuid": "Backlink mit UUID (altes Voting)",
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { uxAction } from 'base/tracking/pianoHelper.subfeature'
|
|
2
|
+
|
|
3
|
+
export default function newsletterForm(formId,trackingInformations) {
|
|
4
|
+
return {
|
|
5
|
+
isPosting: false,
|
|
6
|
+
wasPosted: false,
|
|
7
|
+
wasPostedWithSuccess: false,
|
|
8
|
+
wasPostedWithError: false,
|
|
9
|
+
wasPostedAlreadyRegistered: false,
|
|
10
|
+
isWebview: window.parent.document.documentElement.classList.contains('webview'),
|
|
11
|
+
ajaxTimeout: 60 * 1000,
|
|
12
|
+
form: this.$refs[formId],
|
|
13
|
+
formWrapper: this.$refs[formId].closest("#formWrapper"),
|
|
14
|
+
actionUrl: "",
|
|
15
|
+
formInit(){
|
|
16
|
+
this.$store.forms.submissionAttempted[formId] = false;
|
|
17
|
+
//this.$store.forms.errorMessages = JSON.parse(errorMessages.replace(/"/g,'"'))
|
|
18
|
+
this.actionUrl = this.form.getAttribute('action')
|
|
19
|
+
console.log("FORMID: "+formId)
|
|
20
|
+
console.log("FORM: ", this.form)
|
|
21
|
+
console.log("ACTION: "+this.actionUrl)
|
|
22
|
+
console.log("GETATTRIBUTE "+ this.form.getAttribute('action'))
|
|
23
|
+
},
|
|
24
|
+
scrollToElementAndCenterWithTimeout(element, timeout){
|
|
25
|
+
setTimeout(() => {
|
|
26
|
+
element.scrollIntoView({
|
|
27
|
+
behavior: 'smooth',
|
|
28
|
+
block: 'center'
|
|
29
|
+
});
|
|
30
|
+
}, timeout);
|
|
31
|
+
},
|
|
32
|
+
submitButtonHandler(event) {
|
|
33
|
+
this.$store.forms.submissionAttempted[formId] = true;
|
|
34
|
+
if(this.form.reportValidity()){
|
|
35
|
+
this.handleSubmit(event)
|
|
36
|
+
} else {
|
|
37
|
+
this.scrollToElementAndCenterWithTimeout(document.activeElement, 50)
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
retryHandler() {
|
|
41
|
+
this.wasPosted = false;
|
|
42
|
+
this.wasPostedWithError = false;
|
|
43
|
+
this.scrollToElementAndCenterWithTimeout(this.formWrapper.previousElementSibling, 50)
|
|
44
|
+
|
|
45
|
+
},
|
|
46
|
+
handleValidationErrors(errors) {
|
|
47
|
+
console.log('Validation Errors:', errors);
|
|
48
|
+
this.$store.forms.serverErrorFields[formId] = errors;
|
|
49
|
+
console.log('Validation Errors in Store:', this.$store.forms.serverErrorFields);
|
|
50
|
+
},
|
|
51
|
+
resetValidationErrors() {
|
|
52
|
+
this.$store.forms.serverErrorFields[formId] = {}
|
|
53
|
+
},
|
|
54
|
+
async postData() {
|
|
55
|
+
const formData = new FormData(this.form)
|
|
56
|
+
// use timestamp in seconds because the newsletter tool cannot handle milliseconds
|
|
57
|
+
formData.set('confirm-data-protection', Math.ceil(Date.now() / 1000))
|
|
58
|
+
|
|
59
|
+
const response = await fetch(this.actionUrl, {
|
|
60
|
+
method: 'POST',
|
|
61
|
+
body: formData,
|
|
62
|
+
})
|
|
63
|
+
return response
|
|
64
|
+
},
|
|
65
|
+
handleSubmit (event) {
|
|
66
|
+
event.preventDefault();
|
|
67
|
+
|
|
68
|
+
if (!this.isWebview) {
|
|
69
|
+
uxAction(trackingInformations);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (this.isPosting) return;
|
|
73
|
+
this.isPosting = true;
|
|
74
|
+
|
|
75
|
+
this.postData()
|
|
76
|
+
.then(async response => {
|
|
77
|
+
console.log(await response)
|
|
78
|
+
if (!response.ok) {
|
|
79
|
+
|
|
80
|
+
throw new Error('Netzwerk- oder Serverfehler')
|
|
81
|
+
}
|
|
82
|
+
return response
|
|
83
|
+
})
|
|
84
|
+
.then(async response => {
|
|
85
|
+
switch (response.body) {
|
|
86
|
+
case 'OK':
|
|
87
|
+
console.log("OK");
|
|
88
|
+
this.wasPosted = true;
|
|
89
|
+
this.wasPostedWithSuccess = true;
|
|
90
|
+
this.scrollToElementAndCenterWithTimeout(this.formWrapper.previousElementSibling, 0)
|
|
91
|
+
break
|
|
92
|
+
case 'no_valid_newsletters':
|
|
93
|
+
console.log("Already registered");
|
|
94
|
+
this.wasPosted = true;
|
|
95
|
+
this.wasPostedAlreadyRegistered = true;
|
|
96
|
+
this.scrollToElementAndCenterWithTimeout(this.formWrapper.previousElementSibling, 0)
|
|
97
|
+
break
|
|
98
|
+
default:
|
|
99
|
+
console.log("default");
|
|
100
|
+
this.wasPosted = true;
|
|
101
|
+
this.wasPostedWithError = true;
|
|
102
|
+
this.scrollToElementAndCenterWithTimeout(this.formWrapper.previousElementSibling, 0)
|
|
103
|
+
|
|
104
|
+
}
|
|
105
|
+
})
|
|
106
|
+
.catch((error) => {
|
|
107
|
+
console.error('Beim Ausführen des Fetch ist ein Fehler aufgetreten.', error)
|
|
108
|
+
this.wasPosted = true;
|
|
109
|
+
this.wasPostedWithError = true;
|
|
110
|
+
this.scrollToElementAndCenterWithTimeout(this.formWrapper.previousElementSibling, 0)
|
|
111
|
+
})
|
|
112
|
+
},
|
|
113
|
+
handleOldSubmit(event, form ) {
|
|
114
|
+
event.preventDefault();
|
|
115
|
+
|
|
116
|
+
if (!this.isWebview) {
|
|
117
|
+
uxAction(trackingInformations);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if (this.isPosting) return;
|
|
121
|
+
this.isPosting = true;
|
|
122
|
+
|
|
123
|
+
console.log('DATA:', new URLSearchParams(new FormData(form)).toString());
|
|
124
|
+
|
|
125
|
+
let ajaxOptions = {
|
|
126
|
+
method: 'POST',
|
|
127
|
+
headers: {
|
|
128
|
+
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
|
|
129
|
+
},
|
|
130
|
+
timeout: this.ajaxTimeout,
|
|
131
|
+
body: new URLSearchParams(new FormData(form)),
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
fetch(ajaxOptions.url, ajaxOptions)
|
|
135
|
+
.then(async (response) => {
|
|
136
|
+
const data = await response.text();
|
|
137
|
+
if (response.ok) {
|
|
138
|
+
console.log('Done');
|
|
139
|
+
console.log(data);
|
|
140
|
+
if (jsonUrl) {
|
|
141
|
+
const responseData = JSON.parse(data);
|
|
142
|
+
switch (responseData.status) {
|
|
143
|
+
case 'VALIDATION_ERROR':
|
|
144
|
+
this.resetValidationErrors();
|
|
145
|
+
this.handleValidationErrors(responseData.errors);
|
|
146
|
+
break;
|
|
147
|
+
case 'OK':
|
|
148
|
+
console.log("OK");
|
|
149
|
+
this.wasPosted = true;
|
|
150
|
+
this.wasPostedWithSuccess = true;
|
|
151
|
+
this.scrollToElementAndCenterWithTimeout(this.formWrapper.previousElementSibling, 0)
|
|
152
|
+
|
|
153
|
+
break;
|
|
154
|
+
default:
|
|
155
|
+
console.log("default");
|
|
156
|
+
this.wasPosted = true;
|
|
157
|
+
this.wasPostedWithError = true;
|
|
158
|
+
this.scrollToElementAndCenterWithTimeout(this.formWrapper.previousElementSibling, 0)
|
|
159
|
+
break;
|
|
160
|
+
}
|
|
161
|
+
} else {
|
|
162
|
+
|
|
163
|
+
this.wasPosted = true;
|
|
164
|
+
this.wasPostedWithError = true;
|
|
165
|
+
this.scrollToElementAndCenterWithTimeout(this.formWrapper.previousElementSibling, 0)
|
|
166
|
+
}
|
|
167
|
+
if (formId) {
|
|
168
|
+
window.location.hash = formId;
|
|
169
|
+
}
|
|
170
|
+
} else {
|
|
171
|
+
this.wasPosted = true;
|
|
172
|
+
this.wasPostedWithError = true;
|
|
173
|
+
this.scrollToElementAndCenterWithTimeout(this.formWrapper.previousElementSibling, 0)
|
|
174
|
+
throw new Error('Network response was not ok.');
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
}
|
|
178
|
+
})
|
|
179
|
+
.catch((error) => {
|
|
180
|
+
console.error('Fail:', error);
|
|
181
|
+
this.wasPosted = true;
|
|
182
|
+
this.wasPostedWithError = true;
|
|
183
|
+
this.scrollToElementAndCenterWithTimeout(this.formWrapper.previousElementSibling, 0)
|
|
184
|
+
})
|
|
185
|
+
.finally(() => {
|
|
186
|
+
console.log('Always');
|
|
187
|
+
this.isPosting = false;
|
|
188
|
+
});
|
|
189
|
+
},
|
|
190
|
+
getSubmissionAttempted() {
|
|
191
|
+
return this.$store.forms.submissionAttempted[formId]
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{{#if this.useNewNewsletter}}
|
|
2
|
-
<div id="{{this.uuid}}" class="{{_addClass}}
|
|
2
|
+
<div id="{{this.uuid}}" class="relative bg-highlight-1 dark:bg-highlight-1-dark sm:rounded-tl-hr sm:rounded-br-hr px-5 sm:px-13 pb-8 pt-6 sm:pt-12 mt-7 sm:mt-12 mb-5 article-full-width sm:article-narrow {{_addClass}}">
|
|
3
3
|
{{~> components/base/a11y/hiddenText _locaTag="story_newsletter_intro_sr" ~}}
|
|
4
4
|
<h3 class="mb-6 text-2xl md:text-3xl font-headingSerif sm:mb-12 text-text dark:text-text-dark">
|
|
5
5
|
{{this.title}}
|
|
@@ -9,22 +9,16 @@
|
|
|
9
9
|
{{{this.description}}}
|
|
10
10
|
</p>
|
|
11
11
|
{{/if}}
|
|
12
|
-
|
|
13
|
-
{{> components/newsletter/components/new_newsletter_form}}
|
|
14
|
-
</div>
|
|
12
|
+
{{> components/newsletter/components/new_newsletter_form}}
|
|
15
13
|
{{~> components/base/a11y/hiddenText _locaTag="story_newsletter_outro_sr" ~}}
|
|
16
14
|
</div>
|
|
17
15
|
{{else}}
|
|
18
|
-
<div id="{{this.uuid}}" class="{{_addClass}}
|
|
16
|
+
<div id="{{this.uuid}}" class="js-load relative bg-highlight-1 dark:bg-highlight-1-dark sm:rounded-tl-hr sm:rounded-br-hr px-5 sm:px-13 pb-8 pt-6 sm:pt-12 mt-7 sm:mt-12 mb-5 article-full-width sm:article-narrow {{_addClass}}" data-hr-newsletter-ds='{"url": "{{this.url.nocache}}"}'>
|
|
19
17
|
{{~> components/base/a11y/hiddenText _locaTag="story_newsletter_intro_sr" ~}}
|
|
20
18
|
<h3 class="mb-6 text-2xl md:text-3xl font-headingSerif sm:mb-12 text-text dark:text-text-dark">
|
|
21
19
|
{{this.title}}
|
|
22
20
|
</h3>
|
|
23
|
-
|
|
24
|
-
<div class="js-formWrapper">
|
|
25
|
-
{{> components/newsletter/components/newsletter_form}}
|
|
26
|
-
</div>
|
|
27
|
-
|
|
21
|
+
{{> components/newsletter/components/newsletter_form}}
|
|
28
22
|
{{~> components/base/a11y/hiddenText _locaTag="story_newsletter_outro_sr" ~}}
|
|
29
23
|
</div>
|
|
30
24
|
{{/if}}
|
|
@@ -14,21 +14,33 @@ export default {
|
|
|
14
14
|
</div>`
|
|
15
15
|
},
|
|
16
16
|
],
|
|
17
|
+
parameters: {
|
|
18
|
+
fetchMock: {
|
|
19
|
+
mocks: [
|
|
20
|
+
{
|
|
21
|
+
matcher: 'http://localhost:6006/',
|
|
22
|
+
response: {
|
|
23
|
+
status: 200,
|
|
24
|
+
message: 'success',
|
|
25
|
+
body: {
|
|
26
|
+
status: ''
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
}
|
|
30
|
+
],
|
|
31
|
+
}
|
|
32
|
+
}
|
|
17
33
|
}
|
|
18
34
|
const TemplateNewsletterNew = (args) => {
|
|
19
35
|
let hbsTemplate = handlebars.compile(`
|
|
20
|
-
{{#>components/forms/components/backgroundBox }}
|
|
21
36
|
{{> components/newsletter/newsletter }}
|
|
22
|
-
{{/components/forms/components/backgroundBox }}
|
|
23
37
|
`)
|
|
24
38
|
return hbsTemplate({ ...args })
|
|
25
39
|
}
|
|
26
40
|
|
|
27
41
|
const TemplateNewsletterOld = (args) => {
|
|
28
42
|
let hbsTemplate = handlebars.compile(`
|
|
29
|
-
{{#>components/forms/components/backgroundBox }}
|
|
30
43
|
{{> components/newsletter/newsletter }}
|
|
31
|
-
{{/components/forms/components/backgroundBox }}
|
|
32
44
|
`)
|
|
33
45
|
return hbsTemplate({ ...args })
|
|
34
46
|
}
|
|
@@ -37,6 +49,22 @@ export const Default = {
|
|
|
37
49
|
render: TemplateNewsletterNew.bind({}),
|
|
38
50
|
name: 'Neuer Newsletter',
|
|
39
51
|
args: NewNewsletterJson,
|
|
52
|
+
parameters: {
|
|
53
|
+
fetchMock: {
|
|
54
|
+
mocks: [
|
|
55
|
+
{
|
|
56
|
+
matcher: 'http://localhost:6006/',
|
|
57
|
+
response: {
|
|
58
|
+
status: 200,
|
|
59
|
+
message: 'no_valid_newsletters',
|
|
60
|
+
body: {
|
|
61
|
+
status: ''
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
}
|
|
67
|
+
}
|
|
40
68
|
}
|
|
41
69
|
|
|
42
70
|
export const Newsletter_old = {
|