@netlib/widerrufsbutton 2.1.11 → 2.1.14

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 n, jsxs as u, Fragment as M } from "react/jsx-runtime";
2
- import { useState as f, useRef as U, useEffect as T } from "react";
3
- import { createPortal as L } from "react-dom";
4
- async function O(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
  };
@@ -32,56 +32,59 @@ async function O(e, r) {
32
32
  if (!a.ok)
33
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 z(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;
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
45
  }
46
- function P({ config: e, onClose: r }) {
47
- const [t, o] = f(I), [a, b] = f({}), [s, g] = f({}), [w, m] = f("idle"), [d, h] = f(""), v = U(null);
48
- T(() => {
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
49
  var p;
50
50
  (p = v.current) == null || p.focus();
51
- const i = (c) => c.key === "Escape" && r();
51
+ const i = (m) => m.key === "Escape" && r();
52
52
  return document.addEventListener("keydown", i), () => document.removeEventListener("keydown", i);
53
53
  }, [r]);
54
- function x(i, p) {
55
- const c = { ...t, [i]: p };
56
- if (o(c), s[i]) {
57
- const k = z(c);
54
+ function g(i, p) {
55
+ const m = { ...t, [i]: p };
56
+ if (o(m), s[i]) {
57
+ const k = A(m);
58
58
  b((S) => ({ ...S, [i]: k[i] }));
59
59
  }
60
60
  }
61
61
  function N(i) {
62
- g((c) => ({ ...c, [i]: !0 }));
63
- const p = z(t);
64
- b((c) => ({ ...c, [i]: p[i] }));
62
+ x((m) => ({ ...m, [i]: !0 }));
63
+ const p = A(t);
64
+ b((m) => ({ ...m, [i]: p[i] }));
65
65
  }
66
- async function q(i) {
67
- var k, S;
68
- i.preventDefault();
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
+ }
69
72
  const p = Object.fromEntries(
70
73
  Object.keys(t).map(($) => [$, !0])
71
74
  );
72
- g(p);
73
- const c = z(t);
74
- if (b(c), !(Object.keys(c).length > 0)) {
75
- m("loading"), h("");
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 O(e, t), m("success"), (k = e.onSuccess) == null || k.call(e);
80
+ await R(e, t), u("success"), (S = e.onSuccess) == null || S.call(e);
78
81
  } catch ($) {
79
- const C = $ instanceof Error ? $ : new Error("Ein unbekannter Fehler ist aufgetreten.");
80
- h(C.message), m("error"), (S = e.onError) == null || S.call(e, C);
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 F = e.companyName ? `Widerruf – ${e.companyName}` : "Widerrufsformular";
87
+ const U = e.companyName ? `Widerruf – ${e.companyName}` : "Widerrufsformular";
85
88
  return /* @__PURE__ */ n(
86
89
  "div",
87
90
  {
@@ -90,9 +93,9 @@ function P({ config: e, onClose: r }) {
90
93
  "aria-modal": "true",
91
94
  "aria-labelledby": "wrb-title",
92
95
  onClick: (i) => i.target === i.currentTarget && r(),
93
- children: /* @__PURE__ */ u("div", { className: "wrb-modal", children: [
94
- /* @__PURE__ */ u("div", { className: "wrb-modal-header", children: [
95
- /* @__PURE__ */ n("h2", { className: "wrb-modal-title", id: "wrb-title", children: F }),
96
+ children: /* @__PURE__ */ c("div", { className: "wrb-modal", children: [
97
+ /* @__PURE__ */ c("div", { className: "wrb-modal-header", children: [
98
+ /* @__PURE__ */ n("h2", { className: "wrb-modal-title", id: "wrb-title", children: U }),
96
99
  /* @__PURE__ */ n(
97
100
  "button",
98
101
  {
@@ -104,21 +107,21 @@ function P({ config: e, onClose: r }) {
104
107
  }
105
108
  )
106
109
  ] }),
107
- w === "success" ? /* @__PURE__ */ u("div", { className: "wrb-modal-body", children: [
108
- /* @__PURE__ */ u("div", { className: "wrb-success", children: [
110
+ h === "success" ? /* @__PURE__ */ c("div", { className: "wrb-modal-body", children: [
111
+ /* @__PURE__ */ c("div", { className: "wrb-success", children: [
109
112
  /* @__PURE__ */ n("span", { className: "wrb-success-icon", children: "✓" }),
110
113
  /* @__PURE__ */ n("h3", { children: "Widerruf eingegangen" }),
111
- /* @__PURE__ */ u("p", { children: [
114
+ /* @__PURE__ */ c("p", { children: [
112
115
  "Ihr Widerruf wurde erfolgreich übermittelt. Sie erhalten in Kürze eine Bestätigung an ",
113
116
  /* @__PURE__ */ n("strong", { children: t.email }),
114
117
  "."
115
118
  ] })
116
119
  ] }),
117
- /* @__PURE__ */ n(W, { config: e })
118
- ] }) : /* @__PURE__ */ u("div", { className: "wrb-modal-body", children: [
120
+ /* @__PURE__ */ n(B, { config: e })
121
+ ] }) : /* @__PURE__ */ c("div", { className: "wrb-modal-body", children: [
119
122
  e.introText && /* @__PURE__ */ n("p", { className: "wrb-intro", children: e.introText }),
120
- w === "error" && d && /* @__PURE__ */ n("div", { className: "wrb-alert wrb-alert-error", role: "alert", children: d }),
121
- /* @__PURE__ */ u("form", { onSubmit: q, noValidate: !0, children: [
123
+ h === "error" && d && /* @__PURE__ */ n("div", { className: "wrb-alert wrb-alert-error", role: "alert", children: d }),
124
+ /* @__PURE__ */ c("form", { onSubmit: M, noValidate: !0, children: [
122
125
  /* @__PURE__ */ n(
123
126
  y,
124
127
  {
@@ -133,7 +136,7 @@ function P({ config: e, onClose: r }) {
133
136
  type: "text",
134
137
  autoComplete: "given-name",
135
138
  value: t.firstName,
136
- onChange: (i) => x("firstName", i.target.value),
139
+ onChange: (i) => g("firstName", i.target.value),
137
140
  onBlur: () => N("firstName"),
138
141
  placeholder: "Max"
139
142
  }
@@ -153,7 +156,7 @@ function P({ config: e, onClose: r }) {
153
156
  type: "text",
154
157
  autoComplete: "family-name",
155
158
  value: t.lastName,
156
- onChange: (i) => x("lastName", i.target.value),
159
+ onChange: (i) => g("lastName", i.target.value),
157
160
  onBlur: () => N("lastName"),
158
161
  placeholder: "Mustermann"
159
162
  }
@@ -165,7 +168,7 @@ function P({ config: e, onClose: r }) {
165
168
  {
166
169
  label: "E-Mail-Adresse",
167
170
  required: !0,
168
- hint: "Hierüber erhalten Sie die Eingangsbestätigung.",
171
+ hint: "An diese Adresse senden wir Ihnen die Eingangsbestätigung.",
169
172
  error: s.email ? a.email : void 0,
170
173
  children: /* @__PURE__ */ n(
171
174
  "input",
@@ -174,7 +177,7 @@ function P({ config: e, onClose: r }) {
174
177
  type: "email",
175
178
  autoComplete: "email",
176
179
  value: t.email,
177
- onChange: (i) => x("email", i.target.value),
180
+ onChange: (i) => g("email", i.target.value),
178
181
  onBlur: () => N("email"),
179
182
  placeholder: "name@beispiel.de"
180
183
  }
@@ -184,9 +187,8 @@ function P({ config: e, onClose: r }) {
184
187
  /* @__PURE__ */ n(
185
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
192
  error: s.orderNumber ? a.orderNumber : void 0,
191
193
  children: /* @__PURE__ */ n(
192
194
  "input",
@@ -194,9 +196,9 @@ function P({ config: e, onClose: r }) {
194
196
  className: `wrb-input${s.orderNumber && a.orderNumber ? " wrb-error" : ""}`,
195
197
  type: "text",
196
198
  value: t.orderNumber,
197
- onChange: (i) => x("orderNumber", i.target.value),
199
+ onChange: (i) => g("orderNumber", i.target.value),
198
200
  onBlur: () => N("orderNumber"),
199
- placeholder: "z.B. 10045678"
201
+ placeholder: "z.B. RE123456"
200
202
  }
201
203
  )
202
204
  }
@@ -211,14 +213,28 @@ function P({ config: e, onClose: r }) {
211
213
  {
212
214
  className: "wrb-textarea",
213
215
  value: t.reason,
214
- onChange: (i) => x("reason", i.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
  ),
221
- /* @__PURE__ */ u("div", { className: "wrb-actions", children: [
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
+ ] }),
237
+ /* @__PURE__ */ c("div", { className: "wrb-actions", children: [
222
238
  /* @__PURE__ */ n(
223
239
  "button",
224
240
  {
@@ -233,21 +249,21 @@ function P({ config: e, onClose: r }) {
233
249
  {
234
250
  type: "submit",
235
251
  className: "wrb-submit-btn",
236
- disabled: w === "loading",
237
- children: w === "loading" ? "Wird gesendet…" : e.submitLabel ?? "Absenden"
252
+ disabled: h === "loading",
253
+ children: h === "loading" ? "Wird gesendet…" : e.submitLabel ?? "Absenden"
238
254
  }
239
255
  )
240
256
  ] })
241
257
  ] }),
242
- /* @__PURE__ */ n(W, { config: e })
258
+ /* @__PURE__ */ n(B, { config: e })
243
259
  ] })
244
260
  ] })
245
261
  }
246
262
  );
247
263
  }
248
264
  function y({ label: e, required: r, hint: t, error: o, children: a }) {
249
- return /* @__PURE__ */ u("div", { className: "wrb-field", children: [
250
- /* @__PURE__ */ u("label", { className: "wrb-label", children: [
265
+ return /* @__PURE__ */ c("div", { className: "wrb-field", children: [
266
+ /* @__PURE__ */ c("label", { className: "wrb-label", children: [
251
267
  e,
252
268
  r && /* @__PURE__ */ n("span", { className: "wrb-required", "aria-hidden": "true", children: "*" })
253
269
  ] }),
@@ -256,7 +272,7 @@ function y({ label: e, required: r, hint: t, error: o, children: a }) {
256
272
  o && /* @__PURE__ */ n("p", { className: "wrb-field-error", role: "alert", children: o })
257
273
  ] });
258
274
  }
259
- function W({ config: e }) {
275
+ function B({ config: e }) {
260
276
  return e.privacyUrl ? /* @__PURE__ */ n("div", { className: "wrb-legal-links", children: /* @__PURE__ */ n(
261
277
  "a",
262
278
  {
@@ -268,7 +284,7 @@ function W({ config: e }) {
268
284
  }
269
285
  ) }) : null;
270
286
  }
271
- const A = `
287
+ const W = `
272
288
  /* Widerrufsbutton widget — prefix: wrb- */
273
289
  .wrb-btn {
274
290
  display: inline-flex;
@@ -497,19 +513,36 @@ const A = `
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 = A, document.head.appendChild(r);
533
+ r.id = e, r.textContent = W, document.head.appendChild(r);
506
534
  }
507
- function D(e) {
535
+ function H(e) {
508
536
  e.dataset.wrbUpgraded || (e.dataset.wrbUpgraded = "true", e.addEventListener("submit", async (r) => {
509
537
  r.preventDefault();
510
538
  const t = e.querySelector('.wrb-submit-btn, button[type="submit"]'), o = (t == null ? void 0 : t.textContent) ?? "";
511
539
  t && (t.disabled = !0, t.textContent = "Wird gesendet…");
512
- const a = new FormData(e), b = String(a.get("action") ?? ""), s = {
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 = {
513
546
  firstName: String(a.get("firstName") ?? ""),
514
547
  lastName: String(a.get("lastName") ?? ""),
515
548
  email: String(a.get("email") ?? ""),
@@ -517,41 +550,41 @@ function D(e) {
517
550
  reason: String(a.get("reason") ?? "")
518
551
  };
519
552
  e.dataset.companyName && (s.companyName = e.dataset.companyName), e.dataset.senderEmail && (s.senderEmail = e.dataset.senderEmail);
520
- const g = { "Content-Type": "application/json" };
521
- e.dataset.authToken && (g.Authorization = `Bearer ${e.dataset.authToken}`);
522
- const w = e.getAttribute("action") ?? "";
553
+ const x = { "Content-Type": "application/json" };
554
+ e.dataset.authToken && (x.Authorization = `Bearer ${e.dataset.authToken}`);
555
+ const h = e.getAttribute("action") ?? "";
523
556
  try {
524
- const m = await fetch(w, {
557
+ const u = await fetch(h, {
525
558
  method: "PATCH",
526
- headers: g,
559
+ headers: x,
527
560
  body: JSON.stringify({ action: b, payload: s })
528
561
  });
529
562
  let d = null;
530
563
  try {
531
- d = await m.json();
564
+ d = await u.json();
532
565
  } catch {
533
566
  }
534
- if (!(d && typeof d == "object" && "ok" in d ? d.ok !== !1 : m.ok)) {
567
+ if (!(d && typeof d == "object" && "ok" in d ? d.ok !== !1 : u.ok)) {
535
568
  const v = d && typeof d == "object" && "message" in d ? String(d.message ?? "") : "";
536
- throw new Error(v || `Server antwortete mit Status ${m.status}`);
569
+ throw new Error(v || `Server antwortete mit Status ${u.status}`);
537
570
  }
538
571
  e.reset(), location.hash = "#wrb-success";
539
- } catch (m) {
540
- const d = m instanceof Error ? m : new Error("Unbekannter Fehler"), h = document.querySelector("#wrb-error .wrb-alert");
541
- h && (h.textContent = d.message), location.hash = "#wrb-error";
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";
542
575
  } finally {
543
576
  t && (t.disabled = !1, t.textContent = o);
544
577
  }
545
578
  }));
546
579
  }
547
- function H() {
548
- typeof document > "u" || document.querySelectorAll("#wrb-modal form").forEach(D);
580
+ function K() {
581
+ typeof document > "u" || document.querySelectorAll("#wrb-modal form").forEach(H);
549
582
  }
550
- function _({ config: e }) {
583
+ function J({ config: e }) {
551
584
  const [r, t] = f(!1);
552
- return T(() => {
553
- V(), H();
554
- }, []), /* @__PURE__ */ u(M, { children: [
585
+ return q(() => {
586
+ V(), K();
587
+ }, []), /* @__PURE__ */ c(O, { children: [
555
588
  /* @__PURE__ */ n(
556
589
  "button",
557
590
  {
@@ -561,8 +594,8 @@ function _({ config: e }) {
561
594
  children: e.buttonLabel ?? "Vertrag widerrufen"
562
595
  }
563
596
  ),
564
- r && L(
565
- /* @__PURE__ */ n(P, { config: e, onClose: () => t(!1) }),
597
+ r && I(
598
+ /* @__PURE__ */ n(D, { config: e, onClose: () => t(!1) }),
566
599
  document.body
567
600
  )
568
601
  ] });
@@ -578,11 +611,11 @@ function E(e) {
578
611
  <a href="${l(e.privacyUrl)}" class="wrb-legal-link" rel="noopener noreferrer">${r}</a>
579
612
  </div>`;
580
613
  }
581
- function B(e) {
614
+ function F(e) {
582
615
  const r = [];
583
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(" ") : "";
584
617
  }
585
- function j(e, r = "", t = "") {
618
+ function L(e, r = "", t = "") {
586
619
  const o = l(e.successUrl ?? r), a = l(e.errorUrl ?? t);
587
620
  return `
588
621
  <div class="wrb-field">
@@ -605,16 +638,15 @@ function j(e, r = "", t = "") {
605
638
  </label>
606
639
  <input class="wrb-input" type="email" name="email" autocomplete="email"
607
640
  placeholder="name@beispiel.de" required>
608
- <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>
609
642
  </div>
610
643
  <div class="wrb-field">
611
644
  <label class="wrb-label">
612
- Bestell- / Auftrags- / Vertragsnummer
645
+ Rechnungs- / Lieferschein- / Auftragsnummer
613
646
  <span class="wrb-required" aria-hidden="true">*</span>
614
647
  </label>
615
648
  <input class="wrb-input" type="text" name="orderNumber"
616
- placeholder="z.B. 10045678" required>
617
- <p class="wrb-hint">Zu finden in Ihrer Bestellbestätigung.</p>
649
+ placeholder="z.B. RE123456" required>
618
650
  </div>
619
651
  <div class="wrb-field">
620
652
  <label class="wrb-label">Widerrufsgrund</label>
@@ -625,9 +657,13 @@ function j(e, r = "", t = "") {
625
657
  </div>
626
658
  <input type="hidden" name="action" value="${l(e.action)}">
627
659
  ${o ? `<input type="hidden" name="successUrl" value="${o}">` : ""}
628
- ${a ? `<input type="hidden" name="errorUrl" value="${a}">` : ""}`;
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>`;
629
665
  }
630
- function G(e) {
666
+ function Q(e) {
631
667
  const r = e.companyName ? `Widerruf – ${l(e.companyName)}` : "Widerrufsformular", t = l(e.formAction ?? e.apiUrl ?? "/rest/v1/apiCancellation");
632
668
  return `<!DOCTYPE html>
633
669
  <html lang="de">
@@ -647,7 +683,7 @@ function G(e) {
647
683
  }
648
684
  .wrb-page .wrb-modal { max-height: none; }
649
685
  .wrb-page .wrb-modal-title { font-size: 20px; }
650
- ${A}
686
+ ${W}
651
687
  </style>
652
688
  </head>
653
689
  <body>
@@ -658,8 +694,8 @@ function G(e) {
658
694
  </div>
659
695
  <div class="wrb-modal-body">
660
696
  ${e.introText ? `<p class="wrb-intro">${l(e.introText)}</p>` : ""}
661
- <form method="POST" action="${t}"${B(e)}>
662
- ${j(e)}
697
+ <form method="POST" action="${t}"${F(e)}>
698
+ ${L(e)}
663
699
  <div class="wrb-actions">
664
700
  <button type="submit" class="wrb-submit-btn">
665
701
  ${l(e.submitLabel ?? "Absenden")}
@@ -673,12 +709,12 @@ function G(e) {
673
709
  </body>
674
710
  </html>`;
675
711
  }
676
- function J(e, { inlineStyles: r = !0 } = {}) {
712
+ function X(e, { inlineStyles: r = !0 } = {}) {
677
713
  const t = e.companyName ? `Widerruf – ${l(e.companyName)}` : "Widerrufsformular", o = l(e.formAction ?? e.apiUrl ?? "/rest/v1/apiCancellation"), a = `
678
714
  #wrb-modal, #wrb-success, #wrb-error { display: none; }
679
715
  #wrb-modal:target, #wrb-success:target, #wrb-error:target { display: flex; }`;
680
716
  return `${r ? `<style>${a}
681
- ${A}</style>` : `<style>${a}</style>`}
717
+ ${W}</style>` : `<style>${a}</style>`}
682
718
 
683
719
  <!-- Widerruf: Form-Modal -->
684
720
  <div id="wrb-modal" class="wrb-overlay" role="dialog" aria-modal="true" aria-labelledby="wrb-modal-title">
@@ -689,8 +725,8 @@ ${A}</style>` : `<style>${a}</style>`}
689
725
  </div>
690
726
  <div class="wrb-modal-body">
691
727
  ${e.introText ? `<p class="wrb-intro">${l(e.introText)}</p>` : ""}
692
- <form method="POST" action="${o}"${B(e)}>
693
- ${j(e, "#wrb-success", "#wrb-error")}
728
+ <form method="POST" action="${o}"${F(e)}>
729
+ ${L(e, "#wrb-success", "#wrb-error")}
694
730
  <div class="wrb-actions">
695
731
  <a href="#" class="wrb-cancel-btn">${l(e.cancelLabel ?? "Abbrechen")}</a>
696
732
  <button type="submit" class="wrb-submit-btn">
@@ -715,8 +751,10 @@ ${A}</style>` : `<style>${a}</style>`}
715
751
  <span class="wrb-success-icon">✓</span>
716
752
  <h3>Widerruf eingegangen</h3>
717
753
  <p>
718
- Ihr Widerruf wurde erfolgreich übermittelt. Sie erhalten in Kürze eine
719
- Bestätigung per E-Mail.
754
+ Vielen Dank. Ihr Widerruf wurde erfolgreich an uns übermittelt.
755
+ </p>
756
+ <p>
757
+ Sie erhalten in Kürze eine Bestätigung per E-Mail. Wir werden Ihr Anliegen schnellstmöglich bearbeiten.
720
758
  </p>
721
759
  </div>
722
760
  ${E(e)}
@@ -746,10 +784,10 @@ ${A}</style>` : `<style>${a}</style>`}
746
784
  </div>`;
747
785
  }
748
786
  export {
749
- P as WiderrufsModal,
750
- _ as WiderrufsWidget,
751
- G as generateFallbackHtml,
752
- J as generateModalHtml,
753
- H as upgradeAllStaticForms,
754
- D as upgradeStaticForm
787
+ D as WiderrufsModal,
788
+ J as WiderrufsWidget,
789
+ Q as generateFallbackHtml,
790
+ X as generateModalHtml,
791
+ K as upgradeAllStaticForms,
792
+ H as upgradeStaticForm
755
793
  };
package/dist/styles.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export declare const WRB_CSS = "\n/* Widerrufsbutton widget \u2014 prefix: wrb- */\n.wrb-btn {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n padding: 10px 20px;\n background: #c0392b;\n color: #fff;\n border: none;\n border-radius: 6px;\n font-size: 15px;\n font-weight: 600;\n cursor: pointer;\n font-family: inherit;\n transition: background 0.2s;\n text-decoration: none;\n}\n.wrb-btn:hover { background: #a93226; }\n.wrb-btn:focus-visible { outline: 3px solid #e74c3c; outline-offset: 2px; }\n\n/* Overlay */\n.wrb-overlay {\n position: fixed;\n inset: 0;\n background: rgba(0,0,0,0.55);\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: 99999;\n padding: 16px;\n animation: wrb-fade-in 0.15s ease;\n}\n@keyframes wrb-fade-in { from { opacity: 0 } to { opacity: 1 } }\n\n/* Modal box */\n.wrb-modal {\n background: #fff;\n border-radius: 10px;\n box-shadow: 0 20px 60px rgba(0,0,0,0.3);\n width: 100%;\n max-width: 540px;\n max-height: 90vh;\n overflow-y: auto;\n animation: wrb-slide-up 0.2s ease;\n font-family: system-ui, -apple-system, sans-serif;\n font-size: 15px;\n color: #1a1a1a;\n}\n@keyframes wrb-slide-up { from { transform: translateY(20px); opacity: 0 } to { transform: none; opacity: 1 } }\n\n.wrb-modal-header {\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n padding: 20px 24px 16px;\n border-bottom: 1px solid #e5e7eb;\n gap: 12px;\n}\n.wrb-modal-title {\n margin: 0;\n font-size: 18px;\n font-weight: 700;\n color: #111;\n line-height: 1.3;\n}\n.wrb-close-btn {\n background: none;\n border: none;\n cursor: pointer;\n color: #6b7280;\n padding: 4px;\n border-radius: 4px;\n font-size: 20px;\n line-height: 1;\n flex-shrink: 0;\n}\n.wrb-close-btn:hover { color: #111; background: #f3f4f6; }\n\n.wrb-modal-body {\n padding: 20px 24px 24px;\n}\n\n.wrb-intro {\n margin: 0 0 20px;\n color: #4b5563;\n line-height: 1.6;\n font-size: 14px;\n}\n\n/* Form */\n.wrb-field {\n margin-bottom: 16px;\n}\n.wrb-label {\n display: block;\n font-size: 13px;\n font-weight: 600;\n color: #374151;\n margin-bottom: 5px;\n}\n.wrb-required {\n color: #c0392b;\n margin-left: 2px;\n}\n.wrb-input,\n.wrb-textarea {\n width: 100%;\n padding: 9px 12px;\n border: 1.5px solid #d1d5db;\n border-radius: 6px;\n font-size: 15px;\n font-family: inherit;\n color: #111;\n background: #fff;\n box-sizing: border-box;\n transition: border-color 0.15s;\n}\n.wrb-input:focus,\n.wrb-textarea:focus {\n outline: none;\n border-color: #c0392b;\n box-shadow: 0 0 0 3px rgba(192,57,43,0.12);\n}\n.wrb-input.wrb-error,\n.wrb-textarea.wrb-error {\n border-color: #c0392b;\n}\n.wrb-field-error {\n color: #c0392b;\n font-size: 12px;\n margin-top: 4px;\n}\n.wrb-textarea { resize: vertical; min-height: 80px; }\n\n.wrb-hint {\n font-size: 12px;\n color: #6b7280;\n margin-top: 4px;\n}\n\n.wrb-date-display {\n padding: 9px 12px;\n background: #f9fafb;\n border: 1.5px solid #e5e7eb;\n border-radius: 6px;\n color: #6b7280;\n font-size: 15px;\n}\n\n/* Actions */\n.wrb-actions {\n display: flex;\n gap: 10px;\n justify-content: flex-end;\n margin-top: 24px;\n padding-top: 16px;\n border-top: 1px solid #e5e7eb;\n}\n.wrb-submit-btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n text-decoration: none;\n padding: 10px 22px;\n background: #c0392b;\n color: #fff;\n border: none;\n border-radius: 6px;\n font-size: 15px;\n font-weight: 600;\n cursor: pointer;\n font-family: inherit;\n transition: background 0.2s;\n}\n.wrb-submit-btn:hover:not(:disabled) { background: #a93226; }\n.wrb-submit-btn:disabled { opacity: 0.6; cursor: not-allowed; }\n.wrb-cancel-btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n text-decoration: none;\n padding: 10px 18px;\n background: transparent;\n color: #374151;\n border: 1.5px solid #d1d5db;\n border-radius: 6px;\n font-size: 15px;\n cursor: pointer;\n font-family: inherit;\n transition: background 0.15s;\n}\n.wrb-cancel-btn:hover { background: #f3f4f6; }\n\n/* Success / Error states */\n.wrb-success {\n text-align: center;\n padding: 32px 24px;\n}\n.wrb-success-icon { font-size: 48px; display: block; margin-bottom: 12px; }\n.wrb-success h3 { margin: 0 0 8px; font-size: 20px; color: #111; }\n.wrb-success p { margin: 0; color: #4b5563; line-height: 1.6; }\n\n.wrb-alert {\n padding: 12px 16px;\n border-radius: 6px;\n margin-bottom: 16px;\n font-size: 14px;\n}\n.wrb-alert-error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }\n\n/* Legal links */\n.wrb-legal-links {\n display: flex;\n flex-wrap: wrap;\n gap: 4px 16px;\n margin-top: 16px;\n padding-top: 12px;\n border-top: 1px solid #e5e7eb;\n}\n.wrb-legal-link {\n font-size: 12px;\n color: #6b7280;\n text-decoration: none;\n}\n.wrb-legal-link:hover {\n color: #374151;\n text-decoration: underline;\n}\n";
1
+ export declare const WRB_CSS = "\n/* Widerrufsbutton widget \u2014 prefix: wrb- */\n.wrb-btn {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n padding: 10px 20px;\n background: #c0392b;\n color: #fff;\n border: none;\n border-radius: 6px;\n font-size: 15px;\n font-weight: 600;\n cursor: pointer;\n font-family: inherit;\n transition: background 0.2s;\n text-decoration: none;\n}\n.wrb-btn:hover { background: #a93226; }\n.wrb-btn:focus-visible { outline: 3px solid #e74c3c; outline-offset: 2px; }\n\n/* Overlay */\n.wrb-overlay {\n position: fixed;\n inset: 0;\n background: rgba(0,0,0,0.55);\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: 99999;\n padding: 16px;\n animation: wrb-fade-in 0.15s ease;\n}\n@keyframes wrb-fade-in { from { opacity: 0 } to { opacity: 1 } }\n\n/* Modal box */\n.wrb-modal {\n background: #fff;\n border-radius: 10px;\n box-shadow: 0 20px 60px rgba(0,0,0,0.3);\n width: 100%;\n max-width: 540px;\n max-height: 90vh;\n overflow-y: auto;\n animation: wrb-slide-up 0.2s ease;\n font-family: system-ui, -apple-system, sans-serif;\n font-size: 15px;\n color: #1a1a1a;\n}\n@keyframes wrb-slide-up { from { transform: translateY(20px); opacity: 0 } to { transform: none; opacity: 1 } }\n\n.wrb-modal-header {\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n padding: 20px 24px 16px;\n border-bottom: 1px solid #e5e7eb;\n gap: 12px;\n}\n.wrb-modal-title {\n margin: 0;\n font-size: 18px;\n font-weight: 700;\n color: #111;\n line-height: 1.3;\n}\n.wrb-close-btn {\n background: none;\n border: none;\n cursor: pointer;\n color: #6b7280;\n padding: 4px;\n border-radius: 4px;\n font-size: 20px;\n line-height: 1;\n flex-shrink: 0;\n}\n.wrb-close-btn:hover { color: #111; background: #f3f4f6; }\n\n.wrb-modal-body {\n padding: 20px 24px 24px;\n}\n\n.wrb-intro {\n margin: 0 0 20px;\n color: #4b5563;\n line-height: 1.6;\n font-size: 14px;\n}\n\n/* Form */\n.wrb-field {\n margin-bottom: 16px;\n}\n.wrb-label {\n display: block;\n font-size: 13px;\n font-weight: 600;\n color: #374151;\n margin-bottom: 5px;\n}\n.wrb-required {\n color: #c0392b;\n margin-left: 2px;\n}\n.wrb-input,\n.wrb-textarea {\n width: 100%;\n padding: 9px 12px;\n border: 1.5px solid #d1d5db;\n border-radius: 6px;\n font-size: 15px;\n font-family: inherit;\n color: #111;\n background: #fff;\n box-sizing: border-box;\n transition: border-color 0.15s;\n}\n.wrb-input:focus,\n.wrb-textarea:focus {\n outline: none;\n border-color: #c0392b;\n box-shadow: 0 0 0 3px rgba(192,57,43,0.12);\n}\n.wrb-input.wrb-error,\n.wrb-textarea.wrb-error {\n border-color: #c0392b;\n}\n.wrb-field-error {\n color: #c0392b;\n font-size: 12px;\n margin-top: 4px;\n}\n.wrb-textarea { resize: vertical; min-height: 80px; }\n\n.wrb-hint {\n font-size: 12px;\n color: #6b7280;\n margin-top: 4px;\n}\n\n.wrb-date-display {\n padding: 9px 12px;\n background: #f9fafb;\n border: 1.5px solid #e5e7eb;\n border-radius: 6px;\n color: #6b7280;\n font-size: 15px;\n}\n\n/* Actions */\n.wrb-actions {\n display: flex;\n gap: 10px;\n justify-content: flex-end;\n margin-top: 24px;\n padding-top: 16px;\n border-top: 1px solid #e5e7eb;\n}\n.wrb-submit-btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n text-decoration: none;\n padding: 10px 22px;\n background: #c0392b;\n color: #fff;\n border: none;\n border-radius: 6px;\n font-size: 15px;\n font-weight: 600;\n cursor: pointer;\n font-family: inherit;\n transition: background 0.2s;\n}\n.wrb-submit-btn:hover:not(:disabled) { background: #a93226; }\n.wrb-submit-btn:disabled { opacity: 0.6; cursor: not-allowed; }\n.wrb-cancel-btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n text-decoration: none;\n padding: 10px 18px;\n background: transparent;\n color: #374151;\n border: 1.5px solid #d1d5db;\n border-radius: 6px;\n font-size: 15px;\n cursor: pointer;\n font-family: inherit;\n transition: background 0.15s;\n}\n.wrb-cancel-btn:hover { background: #f3f4f6; }\n\n/* Success / Error states */\n.wrb-success {\n text-align: center;\n padding: 32px 24px;\n}\n.wrb-success-icon { font-size: 48px; display: block; margin-bottom: 12px; }\n.wrb-success h3 { margin: 0 0 8px; font-size: 20px; color: #111; }\n.wrb-success p { margin: 0; color: #4b5563; line-height: 1.6; }\n\n.wrb-alert {\n padding: 12px 16px;\n border-radius: 6px;\n margin-bottom: 16px;\n font-size: 14px;\n}\n.wrb-alert-error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }\n\n/* Legal links */\n.wrb-legal-links {\n display: flex;\n flex-wrap: wrap;\n gap: 4px 16px;\n margin-top: 16px;\n padding-top: 12px;\n border-top: 1px solid #e5e7eb;\n}\n.wrb-legal-link {\n font-size: 12px;\n color: #6b7280;\n text-decoration: none;\n}\n.wrb-legal-link:hover {\n color: #374151;\n text-decoration: underline;\n}\n\n/* Honeypot \u2014 off-screen, never visible, not tabbable */\n.wrb-hp {\n position: absolute !important;\n left: -10000px !important;\n top: auto !important;\n width: 1px !important;\n height: 1px !important;\n overflow: hidden !important;\n opacity: 0 !important;\n pointer-events: none !important;\n}\n";
2
2
  /** Injects scoped CSS once into the document head */
3
3
  export declare function injectStyles(): void;
@@ -246,6 +246,18 @@
246
246
  text-decoration: underline;
247
247
  }
248
248
 
249
+ /* Honeypot — off-screen, never visible, not tabbable */
250
+ .wrb-hp {
251
+ position: absolute !important;
252
+ left: -10000px !important;
253
+ top: auto !important;
254
+ width: 1px !important;
255
+ height: 1px !important;
256
+ overflow: hidden !important;
257
+ opacity: 0 !important;
258
+ pointer-events: none !important;
259
+ }
260
+
249
261
  </style>
250
262
  </head>
251
263
  <body>
@@ -278,16 +290,15 @@
278
290
  </label>
279
291
  <input class="wrb-input" type="email" name="email" autocomplete="email"
280
292
  placeholder="name@beispiel.de" required>
281
- <p class="wrb-hint">Hierüber erhalten Sie die Eingangsbestätigung.</p>
293
+ <p class="wrb-hint"An diese Adresse senden wir Ihnen die Eingangsbestätigung.</p>
282
294
  </div>
283
295
  <div class="wrb-field">
284
296
  <label class="wrb-label">
285
- Bestell- / Auftrags- / Vertragsnummer
297
+ Rechnungs- / Lieferschein- / Auftragsnummer
286
298
  <span class="wrb-required" aria-hidden="true">*</span>
287
299
  </label>
288
300
  <input class="wrb-input" type="text" name="orderNumber"
289
- placeholder="z.B. 10045678" required>
290
- <p class="wrb-hint">Zu finden in Ihrer Bestellbestätigung.</p>
301
+ placeholder="z.B. RE123456" required>
291
302
  </div>
292
303
  <div class="wrb-field">
293
304
  <label class="wrb-label">Widerrufsgrund</label>
@@ -299,6 +310,10 @@
299
310
  <input type="hidden" name="action" value="widerruf_submit">
300
311
 
301
312
 
313
+ <div class="wrb-hp" aria-hidden="true">
314
+ <label>Website (leer lassen)</label>
315
+ <input type="text" name="wrbWebsite" tabindex="-1" autocomplete="off" value="">
316
+ </div>
302
317
  <div class="wrb-actions">
303
318
  <button type="submit" class="wrb-submit-btn">
304
319
  Absenden