@netlib/widerrufsbutton 1.1.2 → 1.2.0
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/README.md +4 -4
- package/dist/fallback.cjs.js +383 -0
- package/dist/fallback.d.ts +21 -4
- package/dist/fallback.es.js +413 -0
- package/dist/index.cjs.js +124 -68
- package/dist/index.d.ts +1 -1
- package/dist/index.es.js +279 -208
- package/dist/styles.d.ts +1 -1
- package/dist/types.d.ts +5 -3
- package/dist/widerruf.html +18 -30
- package/dist/widerrufsbutton.iife.js +17 -9
- package/package.json +8 -3
package/dist/index.es.js
CHANGED
|
@@ -1,259 +1,259 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { createPortal as
|
|
4
|
-
async function
|
|
5
|
-
const
|
|
1
|
+
import { jsx as t, jsxs as c, Fragment as O } from "react/jsx-runtime";
|
|
2
|
+
import { useState as m, useRef as q, useEffect as T } from "react";
|
|
3
|
+
import { createPortal as D } from "react-dom";
|
|
4
|
+
async function I(e, r) {
|
|
5
|
+
const a = {
|
|
6
6
|
"Content-Type": "application/json"
|
|
7
7
|
};
|
|
8
|
-
e.authToken && (
|
|
9
|
-
const
|
|
8
|
+
e.authToken && (a.Authorization = `Bearer ${e.authToken}`);
|
|
9
|
+
const o = {
|
|
10
10
|
action: e.action,
|
|
11
11
|
payload: {
|
|
12
|
-
...
|
|
12
|
+
...r,
|
|
13
13
|
datum: (/* @__PURE__ */ new Date()).toISOString()
|
|
14
14
|
}
|
|
15
15
|
}, i = await fetch(e.apiUrl, {
|
|
16
16
|
method: "PATCH",
|
|
17
|
-
headers:
|
|
18
|
-
body: JSON.stringify(
|
|
17
|
+
headers: a,
|
|
18
|
+
body: JSON.stringify(o)
|
|
19
19
|
});
|
|
20
|
-
let
|
|
20
|
+
let l;
|
|
21
21
|
try {
|
|
22
|
-
|
|
22
|
+
l = await i.json();
|
|
23
23
|
} catch {
|
|
24
24
|
if (!i.ok) throw new Error(`Server antwortete mit Status ${i.status}`);
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
27
|
-
if (
|
|
28
|
-
const
|
|
29
|
-
throw new Error(typeof
|
|
27
|
+
if (l !== null && typeof l == "object" && "ok" in l && l.ok === !1) {
|
|
28
|
+
const d = l.message;
|
|
29
|
+
throw new Error(typeof d == "string" && d ? d : `Server antwortete mit Status ${i.status}`);
|
|
30
30
|
}
|
|
31
31
|
if (!i.ok)
|
|
32
32
|
throw new Error(`Server antwortete mit Status ${i.status}`);
|
|
33
33
|
}
|
|
34
|
-
const
|
|
34
|
+
const C = (/* @__PURE__ */ new Date()).toLocaleDateString("de-DE", {
|
|
35
35
|
day: "2-digit",
|
|
36
36
|
month: "2-digit",
|
|
37
37
|
year: "numeric"
|
|
38
|
-
}),
|
|
38
|
+
}), U = {
|
|
39
39
|
name: "",
|
|
40
40
|
email: "",
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
datum:
|
|
41
|
+
orderNumber: "",
|
|
42
|
+
reason: "",
|
|
43
|
+
datum: C
|
|
44
44
|
};
|
|
45
45
|
function N(e) {
|
|
46
|
-
const
|
|
47
|
-
return e.name.trim() || (
|
|
48
|
-
}
|
|
49
|
-
function
|
|
50
|
-
const [
|
|
51
|
-
|
|
52
|
-
var
|
|
53
|
-
(
|
|
54
|
-
const
|
|
55
|
-
return document.addEventListener("keydown",
|
|
56
|
-
}, [
|
|
57
|
-
function
|
|
58
|
-
const
|
|
59
|
-
if (b
|
|
60
|
-
const f = N(
|
|
61
|
-
|
|
46
|
+
const r = {};
|
|
47
|
+
return e.name.trim() || (r.name = "Bitte geben Sie Ihren Namen an."), e.email.trim() ? /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.email) || (r.email = "Bitte geben Sie eine gültige E-Mail-Adresse an.") : r.email = "Bitte geben Sie Ihre E-Mail-Adresse an.", e.orderNumber.trim() || (r.orderNumber = "Bitte geben Sie die Bestellnummer oder Vertragsnummer an."), r;
|
|
48
|
+
}
|
|
49
|
+
function V({ config: e, onClose: r }) {
|
|
50
|
+
const [a, o] = m(U), [i, l] = m({}), [d, S] = m({}), [w, y] = m("idle"), [E, z] = m(""), W = q(null);
|
|
51
|
+
T(() => {
|
|
52
|
+
var u;
|
|
53
|
+
(u = W.current) == null || u.focus();
|
|
54
|
+
const n = (b) => b.key === "Escape" && r();
|
|
55
|
+
return document.addEventListener("keydown", n), () => document.removeEventListener("keydown", n);
|
|
56
|
+
}, [r]);
|
|
57
|
+
function h(n, u) {
|
|
58
|
+
const b = { ...a, [n]: u };
|
|
59
|
+
if (o(b), d[n]) {
|
|
60
|
+
const f = N(b);
|
|
61
|
+
l((g) => ({ ...g, [n]: f[n] }));
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
-
function k(
|
|
65
|
-
|
|
66
|
-
const
|
|
67
|
-
|
|
64
|
+
function k(n) {
|
|
65
|
+
S((b) => ({ ...b, [n]: !0 }));
|
|
66
|
+
const u = N(a);
|
|
67
|
+
l((b) => ({ ...b, [n]: u[n] }));
|
|
68
68
|
}
|
|
69
|
-
async function
|
|
70
|
-
var f,
|
|
71
|
-
|
|
72
|
-
const
|
|
73
|
-
Object.keys(
|
|
69
|
+
async function F(n) {
|
|
70
|
+
var f, g;
|
|
71
|
+
n.preventDefault();
|
|
72
|
+
const u = Object.fromEntries(
|
|
73
|
+
Object.keys(a).map((x) => [x, !0])
|
|
74
74
|
);
|
|
75
|
-
|
|
76
|
-
const
|
|
77
|
-
if (
|
|
78
|
-
|
|
75
|
+
S(u);
|
|
76
|
+
const b = N(a);
|
|
77
|
+
if (l(b), !(Object.keys(b).length > 0)) {
|
|
78
|
+
y("loading"), z("");
|
|
79
79
|
try {
|
|
80
|
-
await
|
|
81
|
-
} catch (
|
|
82
|
-
const
|
|
83
|
-
|
|
80
|
+
await I(e, a), y("success"), (f = e.onSuccess) == null || f.call(e);
|
|
81
|
+
} catch (x) {
|
|
82
|
+
const A = x instanceof Error ? x : new Error("Ein unbekannter Fehler ist aufgetreten.");
|
|
83
|
+
z(A.message), y("error"), (g = e.onError) == null || g.call(e, A);
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
|
-
const
|
|
88
|
-
return /* @__PURE__ */
|
|
87
|
+
const M = e.companyName ? `Widerruf – ${e.companyName}` : "Widerrufsformular";
|
|
88
|
+
return /* @__PURE__ */ t(
|
|
89
89
|
"div",
|
|
90
90
|
{
|
|
91
91
|
className: "wrb-overlay",
|
|
92
92
|
role: "dialog",
|
|
93
93
|
"aria-modal": "true",
|
|
94
94
|
"aria-labelledby": "wrb-title",
|
|
95
|
-
onClick: (
|
|
96
|
-
children: /* @__PURE__ */
|
|
97
|
-
/* @__PURE__ */
|
|
98
|
-
/* @__PURE__ */
|
|
99
|
-
/* @__PURE__ */
|
|
95
|
+
onClick: (n) => n.target === n.currentTarget && r(),
|
|
96
|
+
children: /* @__PURE__ */ c("div", { className: "wrb-modal", children: [
|
|
97
|
+
/* @__PURE__ */ c("div", { className: "wrb-modal-header", children: [
|
|
98
|
+
/* @__PURE__ */ t("h2", { className: "wrb-modal-title", id: "wrb-title", children: M }),
|
|
99
|
+
/* @__PURE__ */ t(
|
|
100
100
|
"button",
|
|
101
101
|
{
|
|
102
102
|
className: "wrb-close-btn",
|
|
103
|
-
onClick:
|
|
103
|
+
onClick: r,
|
|
104
104
|
"aria-label": "Schließen",
|
|
105
105
|
type: "button",
|
|
106
106
|
children: "✕"
|
|
107
107
|
}
|
|
108
108
|
)
|
|
109
109
|
] }),
|
|
110
|
-
|
|
111
|
-
/* @__PURE__ */
|
|
112
|
-
/* @__PURE__ */
|
|
113
|
-
/* @__PURE__ */
|
|
114
|
-
/* @__PURE__ */
|
|
110
|
+
w === "success" ? /* @__PURE__ */ c("div", { className: "wrb-modal-body", children: [
|
|
111
|
+
/* @__PURE__ */ c("div", { className: "wrb-success", children: [
|
|
112
|
+
/* @__PURE__ */ t("span", { className: "wrb-success-icon", children: "✓" }),
|
|
113
|
+
/* @__PURE__ */ t("h3", { children: "Widerruf eingegangen" }),
|
|
114
|
+
/* @__PURE__ */ c("p", { children: [
|
|
115
115
|
"Ihr Widerruf wurde erfolgreich übermittelt. Sie erhalten in Kürze eine Bestätigung an ",
|
|
116
|
-
/* @__PURE__ */
|
|
116
|
+
/* @__PURE__ */ t("strong", { children: a.email }),
|
|
117
117
|
"."
|
|
118
118
|
] })
|
|
119
119
|
] }),
|
|
120
|
-
/* @__PURE__ */
|
|
121
|
-
] }) : /* @__PURE__ */
|
|
122
|
-
e.introText && /* @__PURE__ */
|
|
123
|
-
|
|
124
|
-
/* @__PURE__ */
|
|
125
|
-
/* @__PURE__ */
|
|
126
|
-
|
|
120
|
+
/* @__PURE__ */ t(B, { links: e.legalLinks })
|
|
121
|
+
] }) : /* @__PURE__ */ c("div", { className: "wrb-modal-body", children: [
|
|
122
|
+
e.introText && /* @__PURE__ */ t("p", { className: "wrb-intro", children: e.introText }),
|
|
123
|
+
w === "error" && E && /* @__PURE__ */ t("div", { className: "wrb-alert wrb-alert-error", role: "alert", children: E }),
|
|
124
|
+
/* @__PURE__ */ c("form", { onSubmit: F, noValidate: !0, children: [
|
|
125
|
+
/* @__PURE__ */ t(
|
|
126
|
+
p,
|
|
127
127
|
{
|
|
128
128
|
label: "Name",
|
|
129
129
|
required: !0,
|
|
130
|
-
error:
|
|
131
|
-
children: /* @__PURE__ */
|
|
130
|
+
error: d.name ? i.name : void 0,
|
|
131
|
+
children: /* @__PURE__ */ t(
|
|
132
132
|
"input",
|
|
133
133
|
{
|
|
134
|
-
ref:
|
|
135
|
-
className: `wrb-input${
|
|
134
|
+
ref: W,
|
|
135
|
+
className: `wrb-input${d.name && i.name ? " wrb-error" : ""}`,
|
|
136
136
|
type: "text",
|
|
137
137
|
autoComplete: "name",
|
|
138
|
-
value:
|
|
139
|
-
onChange: (
|
|
138
|
+
value: a.name,
|
|
139
|
+
onChange: (n) => h("name", n.target.value),
|
|
140
140
|
onBlur: () => k("name"),
|
|
141
141
|
placeholder: "Vor- und Nachname"
|
|
142
142
|
}
|
|
143
143
|
)
|
|
144
144
|
}
|
|
145
145
|
),
|
|
146
|
-
/* @__PURE__ */
|
|
147
|
-
|
|
146
|
+
/* @__PURE__ */ t(
|
|
147
|
+
p,
|
|
148
148
|
{
|
|
149
149
|
label: "E-Mail-Adresse",
|
|
150
150
|
required: !0,
|
|
151
151
|
hint: "Hierüber erhalten Sie die Eingangsbestätigung.",
|
|
152
|
-
error:
|
|
153
|
-
children: /* @__PURE__ */
|
|
152
|
+
error: d.email ? i.email : void 0,
|
|
153
|
+
children: /* @__PURE__ */ t(
|
|
154
154
|
"input",
|
|
155
155
|
{
|
|
156
|
-
className: `wrb-input${
|
|
156
|
+
className: `wrb-input${d.email && i.email ? " wrb-error" : ""}`,
|
|
157
157
|
type: "email",
|
|
158
158
|
autoComplete: "email",
|
|
159
|
-
value:
|
|
160
|
-
onChange: (
|
|
159
|
+
value: a.email,
|
|
160
|
+
onChange: (n) => h("email", n.target.value),
|
|
161
161
|
onBlur: () => k("email"),
|
|
162
162
|
placeholder: "name@beispiel.de"
|
|
163
163
|
}
|
|
164
164
|
)
|
|
165
165
|
}
|
|
166
166
|
),
|
|
167
|
-
/* @__PURE__ */
|
|
168
|
-
|
|
167
|
+
/* @__PURE__ */ t(
|
|
168
|
+
p,
|
|
169
169
|
{
|
|
170
170
|
label: "Bestell- / Auftrags- / Vertragsnummer",
|
|
171
171
|
required: !0,
|
|
172
172
|
hint: "Zu finden in Ihrer Bestellbestätigung.",
|
|
173
|
-
error:
|
|
174
|
-
children: /* @__PURE__ */
|
|
173
|
+
error: d.orderNumber ? i.orderNumber : void 0,
|
|
174
|
+
children: /* @__PURE__ */ t(
|
|
175
175
|
"input",
|
|
176
176
|
{
|
|
177
|
-
className: `wrb-input${
|
|
177
|
+
className: `wrb-input${d.orderNumber && i.orderNumber ? " wrb-error" : ""}`,
|
|
178
178
|
type: "text",
|
|
179
|
-
value:
|
|
180
|
-
onChange: (
|
|
181
|
-
onBlur: () => k("
|
|
179
|
+
value: a.orderNumber,
|
|
180
|
+
onChange: (n) => h("orderNumber", n.target.value),
|
|
181
|
+
onBlur: () => k("orderNumber"),
|
|
182
182
|
placeholder: "z.B. 10045678"
|
|
183
183
|
}
|
|
184
184
|
)
|
|
185
185
|
}
|
|
186
186
|
),
|
|
187
|
-
/* @__PURE__ */
|
|
188
|
-
|
|
187
|
+
/* @__PURE__ */ t(
|
|
188
|
+
p,
|
|
189
189
|
{
|
|
190
|
-
label: "
|
|
190
|
+
label: "reason",
|
|
191
191
|
hint: "Freiwillige Angabe – ein Widerruf ist ohne Angabe von Gründen möglich.",
|
|
192
|
-
children: /* @__PURE__ */
|
|
192
|
+
children: /* @__PURE__ */ t(
|
|
193
193
|
"textarea",
|
|
194
194
|
{
|
|
195
195
|
className: "wrb-textarea",
|
|
196
|
-
value:
|
|
197
|
-
onChange: (
|
|
196
|
+
value: a.reason,
|
|
197
|
+
onChange: (n) => h("reason", n.target.value),
|
|
198
198
|
placeholder: "Optional",
|
|
199
199
|
rows: 3
|
|
200
200
|
}
|
|
201
201
|
)
|
|
202
202
|
}
|
|
203
203
|
),
|
|
204
|
-
/* @__PURE__ */
|
|
205
|
-
/* @__PURE__ */
|
|
206
|
-
/* @__PURE__ */
|
|
204
|
+
/* @__PURE__ */ t(p, { label: "Datum der Widerrufserklärung", children: /* @__PURE__ */ t("div", { className: "wrb-date-display", children: C }) }),
|
|
205
|
+
/* @__PURE__ */ c("div", { className: "wrb-actions", children: [
|
|
206
|
+
/* @__PURE__ */ t(
|
|
207
207
|
"button",
|
|
208
208
|
{
|
|
209
209
|
type: "button",
|
|
210
210
|
className: "wrb-cancel-btn",
|
|
211
|
-
onClick:
|
|
211
|
+
onClick: r,
|
|
212
212
|
children: e.cancelLabel ?? "Abbrechen"
|
|
213
213
|
}
|
|
214
214
|
),
|
|
215
|
-
/* @__PURE__ */
|
|
215
|
+
/* @__PURE__ */ t(
|
|
216
216
|
"button",
|
|
217
217
|
{
|
|
218
218
|
type: "submit",
|
|
219
219
|
className: "wrb-submit-btn",
|
|
220
|
-
disabled:
|
|
221
|
-
children:
|
|
220
|
+
disabled: w === "loading",
|
|
221
|
+
children: w === "loading" ? "Wird gesendet…" : e.submitLabel ?? "Absenden"
|
|
222
222
|
}
|
|
223
223
|
)
|
|
224
224
|
] })
|
|
225
225
|
] }),
|
|
226
|
-
/* @__PURE__ */
|
|
226
|
+
/* @__PURE__ */ t(B, { links: e.legalLinks })
|
|
227
227
|
] })
|
|
228
228
|
] })
|
|
229
229
|
}
|
|
230
230
|
);
|
|
231
231
|
}
|
|
232
|
-
function
|
|
233
|
-
return /* @__PURE__ */
|
|
234
|
-
/* @__PURE__ */
|
|
232
|
+
function p({ label: e, required: r, hint: a, error: o, children: i }) {
|
|
233
|
+
return /* @__PURE__ */ c("div", { className: "wrb-field", children: [
|
|
234
|
+
/* @__PURE__ */ c("label", { className: "wrb-label", children: [
|
|
235
235
|
e,
|
|
236
|
-
|
|
236
|
+
r && /* @__PURE__ */ t("span", { className: "wrb-required", "aria-hidden": "true", children: "*" })
|
|
237
237
|
] }),
|
|
238
238
|
i,
|
|
239
|
-
|
|
240
|
-
|
|
239
|
+
a && !o && /* @__PURE__ */ t("p", { className: "wrb-hint", children: a }),
|
|
240
|
+
o && /* @__PURE__ */ t("p", { className: "wrb-field-error", role: "alert", children: o })
|
|
241
241
|
] });
|
|
242
242
|
}
|
|
243
243
|
function B({ links: e }) {
|
|
244
|
-
return e != null && e.length ? /* @__PURE__ */
|
|
244
|
+
return e != null && e.length ? /* @__PURE__ */ t("div", { className: "wrb-legal-links", children: e.map((r) => /* @__PURE__ */ t(
|
|
245
245
|
"a",
|
|
246
246
|
{
|
|
247
|
-
href:
|
|
247
|
+
href: r.href,
|
|
248
248
|
className: "wrb-legal-link",
|
|
249
249
|
target: "_blank",
|
|
250
250
|
rel: "noopener noreferrer",
|
|
251
|
-
children:
|
|
251
|
+
children: r.name
|
|
252
252
|
},
|
|
253
|
-
|
|
253
|
+
r.href
|
|
254
254
|
)) }) : null;
|
|
255
255
|
}
|
|
256
|
-
const
|
|
256
|
+
const $ = `
|
|
257
257
|
/* Widerrufsbutton widget — prefix: wrb- */
|
|
258
258
|
.wrb-btn {
|
|
259
259
|
display: inline-flex;
|
|
@@ -413,6 +413,10 @@ const A = `
|
|
|
413
413
|
border-top: 1px solid #e5e7eb;
|
|
414
414
|
}
|
|
415
415
|
.wrb-submit-btn {
|
|
416
|
+
display: inline-flex;
|
|
417
|
+
align-items: center;
|
|
418
|
+
justify-content: center;
|
|
419
|
+
text-decoration: none;
|
|
416
420
|
padding: 10px 22px;
|
|
417
421
|
background: #c0392b;
|
|
418
422
|
color: #fff;
|
|
@@ -427,6 +431,10 @@ const A = `
|
|
|
427
431
|
.wrb-submit-btn:hover:not(:disabled) { background: #a93226; }
|
|
428
432
|
.wrb-submit-btn:disabled { opacity: 0.6; cursor: not-allowed; }
|
|
429
433
|
.wrb-cancel-btn {
|
|
434
|
+
display: inline-flex;
|
|
435
|
+
align-items: center;
|
|
436
|
+
justify-content: center;
|
|
437
|
+
text-decoration: none;
|
|
430
438
|
padding: 10px 18px;
|
|
431
439
|
background: transparent;
|
|
432
440
|
color: #374151;
|
|
@@ -475,101 +483,66 @@ const A = `
|
|
|
475
483
|
text-decoration: underline;
|
|
476
484
|
}
|
|
477
485
|
`;
|
|
478
|
-
function
|
|
486
|
+
function P() {
|
|
479
487
|
const e = "wrb-styles";
|
|
480
488
|
if (document.getElementById(e)) return;
|
|
481
|
-
const
|
|
482
|
-
|
|
483
|
-
}
|
|
484
|
-
function
|
|
485
|
-
const [
|
|
486
|
-
return
|
|
487
|
-
|
|
488
|
-
}, []), /* @__PURE__ */
|
|
489
|
-
/* @__PURE__ */
|
|
489
|
+
const r = document.createElement("style");
|
|
490
|
+
r.id = e, r.textContent = $, document.head.appendChild(r);
|
|
491
|
+
}
|
|
492
|
+
function Y({ config: e }) {
|
|
493
|
+
const [r, a] = m(!1);
|
|
494
|
+
return T(() => {
|
|
495
|
+
P();
|
|
496
|
+
}, []), /* @__PURE__ */ c(O, { children: [
|
|
497
|
+
/* @__PURE__ */ t(
|
|
490
498
|
"button",
|
|
491
499
|
{
|
|
492
500
|
type: "button",
|
|
493
501
|
className: `wrb-btn${e.buttonClass ? ` ${e.buttonClass}` : ""}`,
|
|
494
|
-
onClick: () =>
|
|
502
|
+
onClick: () => a(!0),
|
|
495
503
|
children: e.buttonLabel ?? "Vertrag widerrufen"
|
|
496
504
|
}
|
|
497
505
|
),
|
|
498
|
-
|
|
499
|
-
/* @__PURE__ */
|
|
506
|
+
r && D(
|
|
507
|
+
/* @__PURE__ */ t(V, { config: e, onClose: () => a(!1) }),
|
|
500
508
|
document.body
|
|
501
509
|
)
|
|
502
510
|
] });
|
|
503
511
|
}
|
|
504
|
-
function
|
|
512
|
+
function s(e) {
|
|
505
513
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
506
514
|
}
|
|
507
|
-
function
|
|
508
|
-
|
|
509
|
-
const t = (/* @__PURE__ */ new Date()).toLocaleDateString("de-DE", {
|
|
515
|
+
function L() {
|
|
516
|
+
return (/* @__PURE__ */ new Date()).toLocaleDateString("de-DE", {
|
|
510
517
|
day: "2-digit",
|
|
511
518
|
month: "2-digit",
|
|
512
519
|
year: "numeric"
|
|
513
|
-
})
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
function v(e) {
|
|
523
|
+
var r;
|
|
524
|
+
return (r = e.legalLinks) != null && r.length ? `
|
|
514
525
|
<div class="wrb-legal-links">
|
|
515
|
-
${e.legalLinks.map((
|
|
526
|
+
${e.legalLinks.map((a) => `<a href="${s(a.href)}" class="wrb-legal-link" rel="noopener noreferrer">${s(a.name)}</a>`).join(`
|
|
516
527
|
`)}
|
|
517
528
|
</div>` : "";
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
523
|
-
<title>${n}</title>
|
|
524
|
-
<style>
|
|
525
|
-
*, *::before, *::after { box-sizing: border-box; }
|
|
526
|
-
body { margin: 0; background: #f9fafb; }
|
|
527
|
-
.wrb-page {
|
|
528
|
-
min-height: 100vh;
|
|
529
|
-
display: flex;
|
|
530
|
-
align-items: flex-start;
|
|
531
|
-
justify-content: center;
|
|
532
|
-
padding: 40px 16px;
|
|
533
|
-
}
|
|
534
|
-
.wrb-page .wrb-modal { max-height: none; }
|
|
535
|
-
.wrb-page .wrb-modal-title { font-size: 20px; }
|
|
536
|
-
${A}
|
|
537
|
-
</style>
|
|
538
|
-
</head>
|
|
539
|
-
<body>
|
|
540
|
-
<div class="wrb-page">
|
|
541
|
-
<div class="wrb-modal">
|
|
542
|
-
<div class="wrb-modal-header">
|
|
543
|
-
<h1 class="wrb-modal-title">${n}</h1>
|
|
544
|
-
</div>
|
|
545
|
-
<div class="wrb-modal-body">
|
|
546
|
-
${i}
|
|
547
|
-
<form method="POST" action="${b}" novalidate>
|
|
529
|
+
}
|
|
530
|
+
function j(e, r, a = "", o = "") {
|
|
531
|
+
const i = s(e.successUrl ?? a), l = s(e.errorUrl ?? o);
|
|
532
|
+
return `
|
|
548
533
|
<div class="wrb-field">
|
|
549
534
|
<label class="wrb-label">
|
|
550
535
|
Name <span class="wrb-required" aria-hidden="true">*</span>
|
|
551
536
|
</label>
|
|
552
|
-
<input
|
|
553
|
-
|
|
554
|
-
type="text"
|
|
555
|
-
name="name"
|
|
556
|
-
autocomplete="name"
|
|
557
|
-
placeholder="Vor- und Nachname"
|
|
558
|
-
required
|
|
559
|
-
>
|
|
537
|
+
<input class="wrb-input" type="text" name="name" autocomplete="name"
|
|
538
|
+
placeholder="Vor- und Nachname" required>
|
|
560
539
|
</div>
|
|
561
540
|
<div class="wrb-field">
|
|
562
541
|
<label class="wrb-label">
|
|
563
542
|
E-Mail-Adresse <span class="wrb-required" aria-hidden="true">*</span>
|
|
564
543
|
</label>
|
|
565
|
-
<input
|
|
566
|
-
|
|
567
|
-
type="email"
|
|
568
|
-
name="email"
|
|
569
|
-
autocomplete="email"
|
|
570
|
-
placeholder="name@beispiel.de"
|
|
571
|
-
required
|
|
572
|
-
>
|
|
544
|
+
<input class="wrb-input" type="email" name="email" autocomplete="email"
|
|
545
|
+
placeholder="name@beispiel.de" required>
|
|
573
546
|
<p class="wrb-hint">Hierüber erhalten Sie die Eingangsbestätigung.</p>
|
|
574
547
|
</div>
|
|
575
548
|
<div class="wrb-field">
|
|
@@ -577,49 +550,147 @@ function R(e) {
|
|
|
577
550
|
Bestell- / Auftrags- / Vertragsnummer
|
|
578
551
|
<span class="wrb-required" aria-hidden="true">*</span>
|
|
579
552
|
</label>
|
|
580
|
-
<input
|
|
581
|
-
|
|
582
|
-
type="text"
|
|
583
|
-
name="vertragId"
|
|
584
|
-
placeholder="z.B. 10045678"
|
|
585
|
-
required
|
|
586
|
-
>
|
|
553
|
+
<input class="wrb-input" type="text" name="orderNumber"
|
|
554
|
+
placeholder="z.B. 10045678" required>
|
|
587
555
|
<p class="wrb-hint">Zu finden in Ihrer Bestellbestätigung.</p>
|
|
588
556
|
</div>
|
|
589
557
|
<div class="wrb-field">
|
|
590
|
-
<label class="wrb-label">
|
|
591
|
-
<textarea
|
|
592
|
-
class="wrb-textarea"
|
|
593
|
-
name="widerrufsgrund"
|
|
594
|
-
placeholder="Optional"
|
|
595
|
-
rows="3"
|
|
596
|
-
></textarea>
|
|
558
|
+
<label class="wrb-label">reason</label>
|
|
559
|
+
<textarea class="wrb-textarea" name="reason" placeholder="Optional" rows="3"></textarea>
|
|
597
560
|
<p class="wrb-hint">
|
|
598
561
|
Freiwillige Angabe – ein Widerruf ist ohne Angabe von Gründen möglich.
|
|
599
562
|
</p>
|
|
600
563
|
</div>
|
|
601
564
|
<div class="wrb-field">
|
|
602
565
|
<label class="wrb-label">Datum der Widerrufserklärung</label>
|
|
603
|
-
<div class="wrb-date-display">${
|
|
604
|
-
<input type="hidden" name="datum" value="${
|
|
566
|
+
<div class="wrb-date-display">${r}</div>
|
|
567
|
+
<input type="hidden" name="datum" value="${r}">
|
|
605
568
|
</div>
|
|
606
|
-
<input type="hidden" name="action" value="${
|
|
607
|
-
${
|
|
569
|
+
<input type="hidden" name="action" value="${s(e.action)}">
|
|
570
|
+
${i ? `<input type="hidden" name="successUrl" value="${i}">` : ""}
|
|
571
|
+
${l ? `<input type="hidden" name="errorUrl" value="${l}">` : ""}`;
|
|
572
|
+
}
|
|
573
|
+
function _(e) {
|
|
574
|
+
const r = L(), a = e.companyName ? `Widerruf – ${s(e.companyName)}` : "Widerrufsformular", o = s(e.formAction ?? e.apiUrl ?? "/rest/v1/apiCancellation");
|
|
575
|
+
return `<!DOCTYPE html>
|
|
576
|
+
<html lang="de">
|
|
577
|
+
<head>
|
|
578
|
+
<meta charset="UTF-8">
|
|
579
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
580
|
+
<title>${a}</title>
|
|
581
|
+
<style>
|
|
582
|
+
*, *::before, *::after { box-sizing: border-box; }
|
|
583
|
+
body { margin: 0; background: #f9fafb; }
|
|
584
|
+
.wrb-page {
|
|
585
|
+
min-height: 100vh;
|
|
586
|
+
display: flex;
|
|
587
|
+
align-items: flex-start;
|
|
588
|
+
justify-content: center;
|
|
589
|
+
padding: 40px 16px;
|
|
590
|
+
}
|
|
591
|
+
.wrb-page .wrb-modal { max-height: none; }
|
|
592
|
+
.wrb-page .wrb-modal-title { font-size: 20px; }
|
|
593
|
+
${$}
|
|
594
|
+
</style>
|
|
595
|
+
</head>
|
|
596
|
+
<body>
|
|
597
|
+
<div class="wrb-page">
|
|
598
|
+
<div class="wrb-modal">
|
|
599
|
+
<div class="wrb-modal-header">
|
|
600
|
+
<h1 class="wrb-modal-title">${a}</h1>
|
|
601
|
+
</div>
|
|
602
|
+
<div class="wrb-modal-body">
|
|
603
|
+
${e.introText ? `<p class="wrb-intro">${s(e.introText)}</p>` : ""}
|
|
604
|
+
<form method="POST" action="${o}" novalidate>
|
|
605
|
+
${j(e, r)}
|
|
608
606
|
<div class="wrb-actions">
|
|
609
607
|
<button type="submit" class="wrb-submit-btn">
|
|
610
|
-
${
|
|
608
|
+
${s(e.submitLabel ?? "Absenden")}
|
|
611
609
|
</button>
|
|
612
610
|
</div>
|
|
613
611
|
</form>
|
|
614
|
-
${
|
|
612
|
+
${v(e)}
|
|
615
613
|
</div>
|
|
616
614
|
</div>
|
|
617
615
|
</div>
|
|
618
616
|
</body>
|
|
619
617
|
</html>`;
|
|
620
618
|
}
|
|
619
|
+
function G(e, { inlineStyles: r = !0 } = {}) {
|
|
620
|
+
const a = L(), o = e.companyName ? `Widerruf – ${s(e.companyName)}` : "Widerrufsformular", i = s(e.formAction ?? e.apiUrl ?? "/rest/v1/apiCancellation"), l = `
|
|
621
|
+
#wrb-modal, #wrb-success, #wrb-error { display: none; }
|
|
622
|
+
#wrb-modal:target, #wrb-success:target, #wrb-error:target { display: flex; }`;
|
|
623
|
+
return `${r ? `<style>${l}
|
|
624
|
+
${$}</style>` : `<style>${l}</style>`}
|
|
625
|
+
|
|
626
|
+
<!-- Widerruf: Form-Modal -->
|
|
627
|
+
<div id="wrb-modal" class="wrb-overlay" role="dialog" aria-modal="true" aria-labelledby="wrb-modal-title">
|
|
628
|
+
<div class="wrb-modal">
|
|
629
|
+
<div class="wrb-modal-header">
|
|
630
|
+
<h2 class="wrb-modal-title" id="wrb-modal-title">${o}</h2>
|
|
631
|
+
<a href="#" class="wrb-close-btn" aria-label="Schließen">✕</a>
|
|
632
|
+
</div>
|
|
633
|
+
<div class="wrb-modal-body">
|
|
634
|
+
${e.introText ? `<p class="wrb-intro">${s(e.introText)}</p>` : ""}
|
|
635
|
+
<form method="POST" action="${i}" novalidate>
|
|
636
|
+
${j(e, a, "#wrb-success", "#wrb-error")}
|
|
637
|
+
<div class="wrb-actions">
|
|
638
|
+
<a href="#" class="wrb-cancel-btn">${s(e.cancelLabel ?? "Abbrechen")}</a>
|
|
639
|
+
<button type="submit" class="wrb-submit-btn">
|
|
640
|
+
${s(e.submitLabel ?? "Absenden")}
|
|
641
|
+
</button>
|
|
642
|
+
</div>
|
|
643
|
+
</form>
|
|
644
|
+
${v(e)}
|
|
645
|
+
</div>
|
|
646
|
+
</div>
|
|
647
|
+
</div>
|
|
648
|
+
|
|
649
|
+
<!-- Widerruf: Success-Modal -->
|
|
650
|
+
<div id="wrb-success" class="wrb-overlay" role="dialog" aria-modal="true">
|
|
651
|
+
<div class="wrb-modal">
|
|
652
|
+
<div class="wrb-modal-header">
|
|
653
|
+
<h2 class="wrb-modal-title">Widerruf eingegangen</h2>
|
|
654
|
+
<a href="#" class="wrb-close-btn" aria-label="Schließen">✕</a>
|
|
655
|
+
</div>
|
|
656
|
+
<div class="wrb-modal-body">
|
|
657
|
+
<div class="wrb-success">
|
|
658
|
+
<span class="wrb-success-icon">✓</span>
|
|
659
|
+
<h3>Widerruf eingegangen</h3>
|
|
660
|
+
<p>
|
|
661
|
+
Ihr Widerruf wurde erfolgreich übermittelt. Sie erhalten in Kürze eine
|
|
662
|
+
Bestätigung per E-Mail.
|
|
663
|
+
</p>
|
|
664
|
+
</div>
|
|
665
|
+
${v(e)}
|
|
666
|
+
</div>
|
|
667
|
+
</div>
|
|
668
|
+
</div>
|
|
669
|
+
|
|
670
|
+
<!-- Widerruf: Error-Modal -->
|
|
671
|
+
<div id="wrb-error" class="wrb-overlay" role="alertdialog" aria-modal="true">
|
|
672
|
+
<div class="wrb-modal">
|
|
673
|
+
<div class="wrb-modal-header">
|
|
674
|
+
<h2 class="wrb-modal-title">Fehler beim Senden</h2>
|
|
675
|
+
<a href="#" class="wrb-close-btn" aria-label="Schließen">✕</a>
|
|
676
|
+
</div>
|
|
677
|
+
<div class="wrb-modal-body">
|
|
678
|
+
<div class="wrb-alert wrb-alert-error" role="alert">
|
|
679
|
+
Ihr Widerruf konnte leider nicht übermittelt werden. Bitte versuchen Sie es
|
|
680
|
+
erneut oder kontaktieren Sie uns direkt.
|
|
681
|
+
</div>
|
|
682
|
+
<div class="wrb-actions">
|
|
683
|
+
<a href="#" class="wrb-cancel-btn">Schließen</a>
|
|
684
|
+
<a href="#wrb-modal" class="wrb-submit-btn">Erneut versuchen</a>
|
|
685
|
+
</div>
|
|
686
|
+
${v(e)}
|
|
687
|
+
</div>
|
|
688
|
+
</div>
|
|
689
|
+
</div>`;
|
|
690
|
+
}
|
|
621
691
|
export {
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
692
|
+
V as WiderrufsModal,
|
|
693
|
+
Y as WiderrufsWidget,
|
|
694
|
+
_ as generateFallbackHtml,
|
|
695
|
+
G as generateModalHtml
|
|
625
696
|
};
|