@netlib/widerrufsbutton 2.1.9 → 2.1.13

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/dist/index.es.js CHANGED
@@ -1,7 +1,7 @@
1
- import { jsx as a, jsxs as c, Fragment as F } from "react/jsx-runtime";
2
- import { useState as m, useRef as L, useEffect as T } from "react";
3
- import { createPortal as O } from "react-dom";
4
- async function U(e, r) {
1
+ import { jsx as n, jsxs as c, Fragment as O } from "react/jsx-runtime";
2
+ import { useState as f, useRef as j, useEffect as q } from "react";
3
+ import { createPortal as I } from "react-dom";
4
+ async function R(e, r) {
5
5
  const t = {
6
6
  "Content-Type": "application/json"
7
7
  };
@@ -13,87 +13,90 @@ async function U(e, r) {
13
13
  ...e.companyName ? { companyName: e.companyName } : {},
14
14
  ...e.senderEmail ? { senderEmail: e.senderEmail } : {}
15
15
  }
16
- }, i = await fetch(e.apiUrl, {
16
+ }, a = await fetch(e.apiUrl, {
17
17
  method: "PATCH",
18
18
  headers: t,
19
19
  body: JSON.stringify(o)
20
20
  });
21
- let d;
21
+ let b;
22
22
  try {
23
- d = await i.json();
23
+ b = await a.json();
24
24
  } catch {
25
- if (!i.ok) throw new Error(`Server antwortete mit Status ${i.status}`);
25
+ if (!a.ok) throw new Error(`Server antwortete mit Status ${a.status}`);
26
26
  return;
27
27
  }
28
- if (d !== null && typeof d == "object" && "ok" in d && d.ok === !1) {
29
- const s = d.message;
30
- throw new Error(typeof s == "string" && s ? s : `Server antwortete mit Status ${i.status}`);
28
+ if (b !== null && typeof b == "object" && "ok" in b && b.ok === !1) {
29
+ const s = b.message;
30
+ throw new Error(typeof s == "string" && s ? s : `Server antwortete mit Status ${a.status}`);
31
31
  }
32
- if (!i.ok)
33
- throw new Error(`Server antwortete mit Status ${i.status}`);
32
+ if (!a.ok)
33
+ throw new Error(`Server antwortete mit Status ${a.status}`);
34
34
  }
35
- const I = {
35
+ const P = {
36
36
  firstName: "",
37
37
  lastName: "",
38
38
  email: "",
39
39
  orderNumber: "",
40
40
  reason: ""
41
41
  };
42
- function k(e) {
42
+ function A(e) {
43
43
  const r = {};
44
- return e.firstName.trim() || (r.firstName = "Bitte geben Sie Ihren Vornamen an."), e.lastName.trim() || (r.lastName = "Bitte geben Sie Ihren Nachnamen 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;
45
- }
46
- function P({ config: e, onClose: r }) {
47
- const [t, o] = m(I), [i, d] = m({}), [s, E] = m({}), [h, N] = m("idle"), [S, z] = m(""), W = L(null);
48
- T(() => {
49
- var u;
50
- (u = W.current) == null || u.focus();
51
- const n = (b) => b.key === "Escape" && r();
52
- return document.addEventListener("keydown", n), () => document.removeEventListener("keydown", n);
44
+ return e.firstName.trim() || (r.firstName = "Bitte geben Sie Ihren Vornamen an."), e.lastName.trim() || (r.lastName = "Bitte geben Sie Ihren Nachnamen 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 Rechnungs-, Lieferschein- oder Auftragsnummer an."), r;
45
+ }
46
+ function D({ config: e, onClose: r }) {
47
+ const [t, o] = f(P), [a, b] = f({}), [s, x] = f({}), [h, u] = f("idle"), [d, w] = f(""), v = j(null), z = j(null);
48
+ q(() => {
49
+ var p;
50
+ (p = v.current) == null || p.focus();
51
+ const i = (m) => m.key === "Escape" && r();
52
+ return document.addEventListener("keydown", i), () => document.removeEventListener("keydown", i);
53
53
  }, [r]);
54
- function p(n, u) {
55
- const b = { ...t, [n]: u };
56
- if (o(b), s[n]) {
57
- const x = k(b);
58
- d((v) => ({ ...v, [n]: x[n] }));
54
+ function g(i, p) {
55
+ const m = { ...t, [i]: p };
56
+ if (o(m), s[i]) {
57
+ const k = A(m);
58
+ b((S) => ({ ...S, [i]: k[i] }));
59
59
  }
60
60
  }
61
- function f(n) {
62
- E((b) => ({ ...b, [n]: !0 }));
63
- const u = k(t);
64
- d((b) => ({ ...b, [n]: u[n] }));
61
+ function N(i) {
62
+ x((m) => ({ ...m, [i]: !0 }));
63
+ const p = A(t);
64
+ b((m) => ({ ...m, [i]: p[i] }));
65
65
  }
66
- async function M(n) {
67
- var x, v;
68
- n.preventDefault();
69
- const u = Object.fromEntries(
70
- Object.keys(t).map((g) => [g, !0])
66
+ async function M(i) {
67
+ var k, S, C;
68
+ if (i.preventDefault(), (((k = z.current) == null ? void 0 : k.value) ?? "").trim() !== "") {
69
+ u("success");
70
+ return;
71
+ }
72
+ const p = Object.fromEntries(
73
+ Object.keys(t).map(($) => [$, !0])
71
74
  );
72
- E(u);
73
- const b = k(t);
74
- if (d(b), !(Object.keys(b).length > 0)) {
75
- N("loading"), z("");
75
+ x(p);
76
+ const m = A(t);
77
+ if (b(m), !(Object.keys(m).length > 0)) {
78
+ u("loading"), w("");
76
79
  try {
77
- await U(e, t), N("success"), (x = e.onSuccess) == null || x.call(e);
78
- } catch (g) {
79
- const A = g instanceof Error ? g : new Error("Ein unbekannter Fehler ist aufgetreten.");
80
- z(A.message), N("error"), (v = e.onError) == null || v.call(e, A);
80
+ await R(e, t), u("success"), (S = e.onSuccess) == null || S.call(e);
81
+ } catch ($) {
82
+ const T = $ instanceof Error ? $ : new Error("Ein unbekannter Fehler ist aufgetreten.");
83
+ w(T.message), u("error"), (C = e.onError) == null || C.call(e, T);
81
84
  }
82
85
  }
83
86
  }
84
- const q = e.companyName ? `Widerruf – ${e.companyName}` : "Widerrufsformular";
85
- return /* @__PURE__ */ a(
87
+ const U = e.companyName ? `Widerruf – ${e.companyName}` : "Widerrufsformular";
88
+ return /* @__PURE__ */ n(
86
89
  "div",
87
90
  {
88
91
  className: "wrb-overlay",
89
92
  role: "dialog",
90
93
  "aria-modal": "true",
91
94
  "aria-labelledby": "wrb-title",
92
- onClick: (n) => n.target === n.currentTarget && r(),
95
+ onClick: (i) => i.target === i.currentTarget && r(),
93
96
  children: /* @__PURE__ */ c("div", { className: "wrb-modal", children: [
94
97
  /* @__PURE__ */ c("div", { className: "wrb-modal-header", children: [
95
- /* @__PURE__ */ a("h2", { className: "wrb-modal-title", id: "wrb-title", children: q }),
96
- /* @__PURE__ */ a(
98
+ /* @__PURE__ */ n("h2", { className: "wrb-modal-title", id: "wrb-title", children: U }),
99
+ /* @__PURE__ */ n(
97
100
  "button",
98
101
  {
99
102
  className: "wrb-close-btn",
@@ -106,120 +109,133 @@ function P({ config: e, onClose: r }) {
106
109
  ] }),
107
110
  h === "success" ? /* @__PURE__ */ c("div", { className: "wrb-modal-body", children: [
108
111
  /* @__PURE__ */ c("div", { className: "wrb-success", children: [
109
- /* @__PURE__ */ a("span", { className: "wrb-success-icon", children: "✓" }),
110
- /* @__PURE__ */ a("h3", { children: "Widerruf eingegangen" }),
112
+ /* @__PURE__ */ n("span", { className: "wrb-success-icon", children: "✓" }),
113
+ /* @__PURE__ */ n("h3", { children: "Widerruf eingegangen" }),
111
114
  /* @__PURE__ */ c("p", { children: [
112
115
  "Ihr Widerruf wurde erfolgreich übermittelt. Sie erhalten in Kürze eine Bestätigung an ",
113
- /* @__PURE__ */ a("strong", { children: t.email }),
116
+ /* @__PURE__ */ n("strong", { children: t.email }),
114
117
  "."
115
118
  ] })
116
119
  ] }),
117
- /* @__PURE__ */ a(B, { config: e })
120
+ /* @__PURE__ */ n(B, { config: e })
118
121
  ] }) : /* @__PURE__ */ c("div", { className: "wrb-modal-body", children: [
119
- e.introText && /* @__PURE__ */ a("p", { className: "wrb-intro", children: e.introText }),
120
- h === "error" && S && /* @__PURE__ */ a("div", { className: "wrb-alert wrb-alert-error", role: "alert", children: S }),
122
+ e.introText && /* @__PURE__ */ n("p", { className: "wrb-intro", children: e.introText }),
123
+ h === "error" && d && /* @__PURE__ */ n("div", { className: "wrb-alert wrb-alert-error", role: "alert", children: d }),
121
124
  /* @__PURE__ */ c("form", { onSubmit: M, noValidate: !0, children: [
122
- /* @__PURE__ */ a(
123
- w,
125
+ /* @__PURE__ */ n(
126
+ y,
124
127
  {
125
128
  label: "Vorname",
126
129
  required: !0,
127
- error: s.firstName ? i.firstName : void 0,
128
- children: /* @__PURE__ */ a(
130
+ error: s.firstName ? a.firstName : void 0,
131
+ children: /* @__PURE__ */ n(
129
132
  "input",
130
133
  {
131
- ref: W,
132
- className: `wrb-input${s.firstName && i.firstName ? " wrb-error" : ""}`,
134
+ ref: v,
135
+ className: `wrb-input${s.firstName && a.firstName ? " wrb-error" : ""}`,
133
136
  type: "text",
134
137
  autoComplete: "given-name",
135
138
  value: t.firstName,
136
- onChange: (n) => p("firstName", n.target.value),
137
- onBlur: () => f("firstName"),
139
+ onChange: (i) => g("firstName", i.target.value),
140
+ onBlur: () => N("firstName"),
138
141
  placeholder: "Max"
139
142
  }
140
143
  )
141
144
  }
142
145
  ),
143
- /* @__PURE__ */ a(
144
- w,
146
+ /* @__PURE__ */ n(
147
+ y,
145
148
  {
146
149
  label: "Nachname",
147
150
  required: !0,
148
- error: s.lastName ? i.lastName : void 0,
149
- children: /* @__PURE__ */ a(
151
+ error: s.lastName ? a.lastName : void 0,
152
+ children: /* @__PURE__ */ n(
150
153
  "input",
151
154
  {
152
- className: `wrb-input${s.lastName && i.lastName ? " wrb-error" : ""}`,
155
+ className: `wrb-input${s.lastName && a.lastName ? " wrb-error" : ""}`,
153
156
  type: "text",
154
157
  autoComplete: "family-name",
155
158
  value: t.lastName,
156
- onChange: (n) => p("lastName", n.target.value),
157
- onBlur: () => f("lastName"),
159
+ onChange: (i) => g("lastName", i.target.value),
160
+ onBlur: () => N("lastName"),
158
161
  placeholder: "Mustermann"
159
162
  }
160
163
  )
161
164
  }
162
165
  ),
163
- /* @__PURE__ */ a(
164
- w,
166
+ /* @__PURE__ */ n(
167
+ y,
165
168
  {
166
169
  label: "E-Mail-Adresse",
167
170
  required: !0,
168
- hint: "Hierüber erhalten Sie die Eingangsbestätigung.",
169
- error: s.email ? i.email : void 0,
170
- children: /* @__PURE__ */ a(
171
+ hint: "An diese Adresse senden wir Ihnen die Eingangsbestätigung.",
172
+ error: s.email ? a.email : void 0,
173
+ children: /* @__PURE__ */ n(
171
174
  "input",
172
175
  {
173
- className: `wrb-input${s.email && i.email ? " wrb-error" : ""}`,
176
+ className: `wrb-input${s.email && a.email ? " wrb-error" : ""}`,
174
177
  type: "email",
175
178
  autoComplete: "email",
176
179
  value: t.email,
177
- onChange: (n) => p("email", n.target.value),
178
- onBlur: () => f("email"),
180
+ onChange: (i) => g("email", i.target.value),
181
+ onBlur: () => N("email"),
179
182
  placeholder: "name@beispiel.de"
180
183
  }
181
184
  )
182
185
  }
183
186
  ),
184
- /* @__PURE__ */ a(
185
- w,
187
+ /* @__PURE__ */ n(
188
+ y,
186
189
  {
187
- label: "Bestell- / Auftrags- / Vertragsnummer",
190
+ label: "Rechnungs- / Lieferschein- / Auftragsnummer",
188
191
  required: !0,
189
- hint: "Zu finden in Ihrer Bestellbestätigung.",
190
- error: s.orderNumber ? i.orderNumber : void 0,
191
- children: /* @__PURE__ */ a(
192
+ error: s.orderNumber ? a.orderNumber : void 0,
193
+ children: /* @__PURE__ */ n(
192
194
  "input",
193
195
  {
194
- className: `wrb-input${s.orderNumber && i.orderNumber ? " wrb-error" : ""}`,
196
+ className: `wrb-input${s.orderNumber && a.orderNumber ? " wrb-error" : ""}`,
195
197
  type: "text",
196
198
  value: t.orderNumber,
197
- onChange: (n) => p("orderNumber", n.target.value),
198
- onBlur: () => f("orderNumber"),
199
- placeholder: "z.B. 10045678"
199
+ onChange: (i) => g("orderNumber", i.target.value),
200
+ onBlur: () => N("orderNumber"),
201
+ placeholder: "z.B. RE123456"
200
202
  }
201
203
  )
202
204
  }
203
205
  ),
204
- /* @__PURE__ */ a(
205
- w,
206
+ /* @__PURE__ */ n(
207
+ y,
206
208
  {
207
209
  label: "Widerrufsgrund",
208
210
  hint: "Freiwillige Angabe – ein Widerruf ist ohne Angabe von Gründen möglich.",
209
- children: /* @__PURE__ */ a(
211
+ children: /* @__PURE__ */ n(
210
212
  "textarea",
211
213
  {
212
214
  className: "wrb-textarea",
213
215
  value: t.reason,
214
- onChange: (n) => p("reason", n.target.value),
216
+ onChange: (i) => g("reason", i.target.value),
215
217
  placeholder: "Optional",
216
218
  rows: 2
217
219
  }
218
220
  )
219
221
  }
220
222
  ),
223
+ /* @__PURE__ */ c("div", { className: "wrb-hp", "aria-hidden": "true", children: [
224
+ /* @__PURE__ */ n("label", { children: "Website (leer lassen)" }),
225
+ /* @__PURE__ */ n(
226
+ "input",
227
+ {
228
+ ref: z,
229
+ type: "text",
230
+ name: "wrbWebsite",
231
+ tabIndex: -1,
232
+ autoComplete: "off",
233
+ defaultValue: ""
234
+ }
235
+ )
236
+ ] }),
221
237
  /* @__PURE__ */ c("div", { className: "wrb-actions", children: [
222
- /* @__PURE__ */ a(
238
+ /* @__PURE__ */ n(
223
239
  "button",
224
240
  {
225
241
  type: "button",
@@ -228,7 +244,7 @@ function P({ config: e, onClose: r }) {
228
244
  children: e.cancelLabel ?? "Abbrechen"
229
245
  }
230
246
  ),
231
- /* @__PURE__ */ a(
247
+ /* @__PURE__ */ n(
232
248
  "button",
233
249
  {
234
250
  type: "submit",
@@ -239,25 +255,25 @@ function P({ config: e, onClose: r }) {
239
255
  )
240
256
  ] })
241
257
  ] }),
242
- /* @__PURE__ */ a(B, { config: e })
258
+ /* @__PURE__ */ n(B, { config: e })
243
259
  ] })
244
260
  ] })
245
261
  }
246
262
  );
247
263
  }
248
- function w({ label: e, required: r, hint: t, error: o, children: i }) {
264
+ function y({ label: e, required: r, hint: t, error: o, children: a }) {
249
265
  return /* @__PURE__ */ c("div", { className: "wrb-field", children: [
250
266
  /* @__PURE__ */ c("label", { className: "wrb-label", children: [
251
267
  e,
252
- r && /* @__PURE__ */ a("span", { className: "wrb-required", "aria-hidden": "true", children: "*" })
268
+ r && /* @__PURE__ */ n("span", { className: "wrb-required", "aria-hidden": "true", children: "*" })
253
269
  ] }),
254
- i,
255
- t && !o && /* @__PURE__ */ a("p", { className: "wrb-hint", children: t }),
256
- o && /* @__PURE__ */ a("p", { className: "wrb-field-error", role: "alert", children: o })
270
+ a,
271
+ t && !o && /* @__PURE__ */ n("p", { className: "wrb-hint", children: t }),
272
+ o && /* @__PURE__ */ n("p", { className: "wrb-field-error", role: "alert", children: o })
257
273
  ] });
258
274
  }
259
275
  function B({ config: e }) {
260
- return e.privacyUrl ? /* @__PURE__ */ a("div", { className: "wrb-legal-links", children: /* @__PURE__ */ a(
276
+ return e.privacyUrl ? /* @__PURE__ */ n("div", { className: "wrb-legal-links", children: /* @__PURE__ */ n(
261
277
  "a",
262
278
  {
263
279
  href: e.privacyUrl,
@@ -268,7 +284,7 @@ function B({ config: e }) {
268
284
  }
269
285
  ) }) : null;
270
286
  }
271
- const $ = `
287
+ const W = `
272
288
  /* Widerrufsbutton widget — prefix: wrb- */
273
289
  .wrb-btn {
274
290
  display: inline-flex;
@@ -497,19 +513,79 @@ const $ = `
497
513
  color: #374151;
498
514
  text-decoration: underline;
499
515
  }
516
+
517
+ /* Honeypot — off-screen, never visible, not tabbable */
518
+ .wrb-hp {
519
+ position: absolute !important;
520
+ left: -10000px !important;
521
+ top: auto !important;
522
+ width: 1px !important;
523
+ height: 1px !important;
524
+ overflow: hidden !important;
525
+ opacity: 0 !important;
526
+ pointer-events: none !important;
527
+ }
500
528
  `;
501
529
  function V() {
502
530
  const e = "wrb-styles";
503
531
  if (document.getElementById(e)) return;
504
532
  const r = document.createElement("style");
505
- r.id = e, r.textContent = $, document.head.appendChild(r);
506
- }
507
- function K({ config: e }) {
508
- const [r, t] = m(!1);
509
- return T(() => {
510
- V();
511
- }, []), /* @__PURE__ */ c(F, { children: [
512
- /* @__PURE__ */ a(
533
+ r.id = e, r.textContent = W, document.head.appendChild(r);
534
+ }
535
+ function H(e) {
536
+ e.dataset.wrbUpgraded || (e.dataset.wrbUpgraded = "true", e.addEventListener("submit", async (r) => {
537
+ r.preventDefault();
538
+ const t = e.querySelector('.wrb-submit-btn, button[type="submit"]'), o = (t == null ? void 0 : t.textContent) ?? "";
539
+ t && (t.disabled = !0, t.textContent = "Wird gesendet…");
540
+ const a = new FormData(e);
541
+ if (String(a.get("wrbWebsite") ?? "").trim() !== "") {
542
+ e.reset(), location.hash = "#wrb-success", t && (t.disabled = !1, t.textContent = o);
543
+ return;
544
+ }
545
+ const b = String(a.get("action") ?? ""), s = {
546
+ firstName: String(a.get("firstName") ?? ""),
547
+ lastName: String(a.get("lastName") ?? ""),
548
+ email: String(a.get("email") ?? ""),
549
+ orderNumber: String(a.get("orderNumber") ?? ""),
550
+ reason: String(a.get("reason") ?? "")
551
+ };
552
+ e.dataset.companyName && (s.companyName = e.dataset.companyName), e.dataset.senderEmail && (s.senderEmail = e.dataset.senderEmail);
553
+ const x = { "Content-Type": "application/json" };
554
+ e.dataset.authToken && (x.Authorization = `Bearer ${e.dataset.authToken}`);
555
+ const h = e.getAttribute("action") ?? "";
556
+ try {
557
+ const u = await fetch(h, {
558
+ method: "PATCH",
559
+ headers: x,
560
+ body: JSON.stringify({ action: b, payload: s })
561
+ });
562
+ let d = null;
563
+ try {
564
+ d = await u.json();
565
+ } catch {
566
+ }
567
+ if (!(d && typeof d == "object" && "ok" in d ? d.ok !== !1 : u.ok)) {
568
+ const v = d && typeof d == "object" && "message" in d ? String(d.message ?? "") : "";
569
+ throw new Error(v || `Server antwortete mit Status ${u.status}`);
570
+ }
571
+ e.reset(), location.hash = "#wrb-success";
572
+ } catch (u) {
573
+ const d = u instanceof Error ? u : new Error("Unbekannter Fehler"), w = document.querySelector("#wrb-error .wrb-alert");
574
+ w && (w.textContent = d.message), location.hash = "#wrb-error";
575
+ } finally {
576
+ t && (t.disabled = !1, t.textContent = o);
577
+ }
578
+ }));
579
+ }
580
+ function K() {
581
+ typeof document > "u" || document.querySelectorAll("#wrb-modal form").forEach(H);
582
+ }
583
+ function J({ config: e }) {
584
+ const [r, t] = f(!1);
585
+ return q(() => {
586
+ V(), K();
587
+ }, []), /* @__PURE__ */ c(O, { children: [
588
+ /* @__PURE__ */ n(
513
589
  "button",
514
590
  {
515
591
  type: "button",
@@ -518,8 +594,8 @@ function K({ config: e }) {
518
594
  children: e.buttonLabel ?? "Vertrag widerrufen"
519
595
  }
520
596
  ),
521
- r && O(
522
- /* @__PURE__ */ a(P, { config: e, onClose: () => t(!1) }),
597
+ r && I(
598
+ /* @__PURE__ */ n(D, { config: e, onClose: () => t(!1) }),
523
599
  document.body
524
600
  )
525
601
  ] });
@@ -527,7 +603,7 @@ function K({ config: e }) {
527
603
  function l(e) {
528
604
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
529
605
  }
530
- function y(e) {
606
+ function E(e) {
531
607
  if (!e.privacyUrl) return "";
532
608
  const r = l(e.privacyLabel ?? "Datenschutz");
533
609
  return `
@@ -535,12 +611,12 @@ function y(e) {
535
611
  <a href="${l(e.privacyUrl)}" class="wrb-legal-link" rel="noopener noreferrer">${r}</a>
536
612
  </div>`;
537
613
  }
538
- function C(e) {
614
+ function F(e) {
539
615
  const r = [];
540
616
  return e.companyName && r.push(`data-company-name="${l(e.companyName)}"`), e.senderEmail && r.push(`data-sender-email="${l(e.senderEmail)}"`), e.authToken && r.push(`data-auth-token="${l(e.authToken)}"`), r.length ? " " + r.join(" ") : "";
541
617
  }
542
- function j(e, r = "", t = "") {
543
- const o = l(e.successUrl ?? r), i = l(e.errorUrl ?? t);
618
+ function L(e, r = "", t = "") {
619
+ const o = l(e.successUrl ?? r), a = l(e.errorUrl ?? t);
544
620
  return `
545
621
  <div class="wrb-field">
546
622
  <label class="wrb-label">
@@ -562,16 +638,15 @@ function j(e, r = "", t = "") {
562
638
  </label>
563
639
  <input class="wrb-input" type="email" name="email" autocomplete="email"
564
640
  placeholder="name@beispiel.de" required>
565
- <p class="wrb-hint">Hierüber erhalten Sie die Eingangsbestätigung.</p>
641
+ <p class="wrb-hint"An diese Adresse senden wir Ihnen die Eingangsbestätigung.</p>
566
642
  </div>
567
643
  <div class="wrb-field">
568
644
  <label class="wrb-label">
569
- Bestell- / Auftrags- / Vertragsnummer
645
+ Rechnungs- / Lieferschein- / Auftragsnummer
570
646
  <span class="wrb-required" aria-hidden="true">*</span>
571
647
  </label>
572
648
  <input class="wrb-input" type="text" name="orderNumber"
573
- placeholder="z.B. 10045678" required>
574
- <p class="wrb-hint">Zu finden in Ihrer Bestellbestätigung.</p>
649
+ placeholder="z.B. RE123456" required>
575
650
  </div>
576
651
  <div class="wrb-field">
577
652
  <label class="wrb-label">Widerrufsgrund</label>
@@ -582,9 +657,13 @@ function j(e, r = "", t = "") {
582
657
  </div>
583
658
  <input type="hidden" name="action" value="${l(e.action)}">
584
659
  ${o ? `<input type="hidden" name="successUrl" value="${o}">` : ""}
585
- ${i ? `<input type="hidden" name="errorUrl" value="${i}">` : ""}`;
660
+ ${a ? `<input type="hidden" name="errorUrl" value="${a}">` : ""}
661
+ <div class="wrb-hp" aria-hidden="true">
662
+ <label>Website (leer lassen)</label>
663
+ <input type="text" name="wrbWebsite" tabindex="-1" autocomplete="off" value="">
664
+ </div>`;
586
665
  }
587
- function Y(e) {
666
+ function Q(e) {
588
667
  const r = e.companyName ? `Widerruf – ${l(e.companyName)}` : "Widerrufsformular", t = l(e.formAction ?? e.apiUrl ?? "/rest/v1/apiCancellation");
589
668
  return `<!DOCTYPE html>
590
669
  <html lang="de">
@@ -604,7 +683,7 @@ function Y(e) {
604
683
  }
605
684
  .wrb-page .wrb-modal { max-height: none; }
606
685
  .wrb-page .wrb-modal-title { font-size: 20px; }
607
- ${$}
686
+ ${W}
608
687
  </style>
609
688
  </head>
610
689
  <body>
@@ -615,27 +694,27 @@ function Y(e) {
615
694
  </div>
616
695
  <div class="wrb-modal-body">
617
696
  ${e.introText ? `<p class="wrb-intro">${l(e.introText)}</p>` : ""}
618
- <form method="POST" action="${t}"${C(e)}>
619
- ${j(e)}
697
+ <form method="POST" action="${t}"${F(e)}>
698
+ ${L(e)}
620
699
  <div class="wrb-actions">
621
700
  <button type="submit" class="wrb-submit-btn">
622
701
  ${l(e.submitLabel ?? "Absenden")}
623
702
  </button>
624
703
  </div>
625
704
  </form>
626
- ${y(e)}
705
+ ${E(e)}
627
706
  </div>
628
707
  </div>
629
708
  </div>
630
709
  </body>
631
710
  </html>`;
632
711
  }
633
- function _(e, { inlineStyles: r = !0 } = {}) {
634
- const t = e.companyName ? `Widerruf – ${l(e.companyName)}` : "Widerrufsformular", o = l(e.formAction ?? e.apiUrl ?? "/rest/v1/apiCancellation"), i = `
712
+ function X(e, { inlineStyles: r = !0 } = {}) {
713
+ const t = e.companyName ? `Widerruf – ${l(e.companyName)}` : "Widerrufsformular", o = l(e.formAction ?? e.apiUrl ?? "/rest/v1/apiCancellation"), a = `
635
714
  #wrb-modal, #wrb-success, #wrb-error { display: none; }
636
715
  #wrb-modal:target, #wrb-success:target, #wrb-error:target { display: flex; }`;
637
- return `${r ? `<style>${i}
638
- ${$}</style>` : `<style>${i}</style>`}
716
+ return `${r ? `<style>${a}
717
+ ${W}</style>` : `<style>${a}</style>`}
639
718
 
640
719
  <!-- Widerruf: Form-Modal -->
641
720
  <div id="wrb-modal" class="wrb-overlay" role="dialog" aria-modal="true" aria-labelledby="wrb-modal-title">
@@ -646,8 +725,8 @@ ${$}</style>` : `<style>${i}</style>`}
646
725
  </div>
647
726
  <div class="wrb-modal-body">
648
727
  ${e.introText ? `<p class="wrb-intro">${l(e.introText)}</p>` : ""}
649
- <form method="POST" action="${o}"${C(e)}>
650
- ${j(e, "#wrb-success", "#wrb-error")}
728
+ <form method="POST" action="${o}"${F(e)}>
729
+ ${L(e, "#wrb-success", "#wrb-error")}
651
730
  <div class="wrb-actions">
652
731
  <a href="#" class="wrb-cancel-btn">${l(e.cancelLabel ?? "Abbrechen")}</a>
653
732
  <button type="submit" class="wrb-submit-btn">
@@ -655,7 +734,7 @@ ${$}</style>` : `<style>${i}</style>`}
655
734
  </button>
656
735
  </div>
657
736
  </form>
658
- ${y(e)}
737
+ ${E(e)}
659
738
  </div>
660
739
  </div>
661
740
  </div>
@@ -676,7 +755,7 @@ ${$}</style>` : `<style>${i}</style>`}
676
755
  Bestätigung per E-Mail.
677
756
  </p>
678
757
  </div>
679
- ${y(e)}
758
+ ${E(e)}
680
759
  </div>
681
760
  </div>
682
761
  </div>
@@ -697,14 +776,16 @@ ${$}</style>` : `<style>${i}</style>`}
697
776
  <a href="#" class="wrb-cancel-btn">Schließen</a>
698
777
  <a href="#wrb-modal" class="wrb-submit-btn">Erneut versuchen</a>
699
778
  </div>
700
- ${y(e)}
779
+ ${E(e)}
701
780
  </div>
702
781
  </div>
703
782
  </div>`;
704
783
  }
705
784
  export {
706
- P as WiderrufsModal,
707
- K as WiderrufsWidget,
708
- Y as generateFallbackHtml,
709
- _ as generateModalHtml
785
+ D as WiderrufsModal,
786
+ J as WiderrufsWidget,
787
+ Q as generateFallbackHtml,
788
+ X as generateModalHtml,
789
+ K as upgradeAllStaticForms,
790
+ H as upgradeStaticForm
710
791
  };