@netlib/widerrufsbutton 2.1.4 → 2.1.6
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.
|
@@ -266,4 +266,4 @@ Error generating stack: `+u.message+`
|
|
|
266
266
|
color: #374151;
|
|
267
267
|
text-decoration: underline;
|
|
268
268
|
}
|
|
269
|
-
`;function oc(){const e="wrb-styles";if(document.getElementById(e))return;const t=document.createElement("style");t.id=e,t.textContent=Ud,document.head.appendChild(t)}function $d({config:e}){const[t,n]=ke.useState(!1);return ke.useEffect(()=>{oc()},[]),z.jsxs(z.Fragment,{children:[z.jsx("button",{type:"button",className:`wrb-btn${e.buttonClass?` ${e.buttonClass}`:""}`,onClick:()=>n(!0),children:e.buttonLabel??"Vertrag widerrufen"}),t&&nc.createPortal(z.jsx(Fd,{config:e,onClose:()=>n(!1)}),document.body)]})}function hl(e,t){oc(),rc(e).render(z.jsx(ke.StrictMode,{children:z.jsx($d,{config:t})}))}function ic(e){return{apiUrl:e.getAttribute("data-api-url")??"/rest/v1/apiCancellation",action:e.getAttribute("data-action")??"widerruf_submit",introText:e.getAttribute("data-intro-text")??void 0,buttonLabel:e.getAttribute("data-button-label")??void 0,buttonClass:e.getAttribute("data-button-class")??void 0,companyName:e.getAttribute("data-company-name")??void 0,senderEmail:e.getAttribute("data-sender-email")??void 0,authToken:e.getAttribute("data-auth-token")??void 0,cancelLabel:e.getAttribute("data-cancel-label")??void 0,submitLabel:e.getAttribute("data-submit-label")??void 0,privacyLabel:e.getAttribute("data-privacy-label")??void 0,privacyUrl:e.getAttribute("data-privacy-url")??void 0,successUrl:e.getAttribute("data-success-url")??void 0}}function Ro(){document.querySelectorAll("[data-widerrufs]").forEach(t=>{const n=document.createElement("span");t.replaceWith(n),hl(n,ic(t))});const e=document.getElementById("wrb-container");e&&e.hasAttribute("data-api-url")&&(e.innerHTML="",hl(e,ic(e)))}const Ad={render(e,t){const n=typeof e=="string"?document.querySelector(e):e;if(!n){console.warn("[WiderrufsButton] Element not found:",e);return}hl(n,t)},renderButton(e,t){const n=typeof e=="string"?document.querySelector(e):e;if(!n){console.warn("[WiderrufsButton] Anchor not found:",e);return}const r=document.createElement("span");n.insertAdjacentElement("afterend",r),hl(r,t)},init:Ro};window.WiderrufsButton=Ad,document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Ro):Ro()})();
|
|
269
|
+
`;function oc(){const e="wrb-styles";if(document.getElementById(e))return;const t=document.createElement("style");t.id=e,t.textContent=Ud,document.head.appendChild(t)}function $d({config:e}){const[t,n]=ke.useState(!1);return ke.useEffect(()=>{oc()},[]),z.jsxs(z.Fragment,{children:[z.jsx("button",{type:"button",className:`wrb-btn${e.buttonClass?` ${e.buttonClass}`:""}`,onClick:()=>n(!0),children:e.buttonLabel??"Vertrag widerrufen"}),t&&nc.createPortal(z.jsx(Fd,{config:e,onClose:()=>n(!1)}),document.body)]})}function hl(e,t){oc(),rc(e).render(z.jsx(ke.StrictMode,{children:z.jsx($d,{config:t})}))}function ic(e){return{apiUrl:e.getAttribute("data-api-url")??"/rest/v1/apiCancellation",action:e.getAttribute("data-action")??"widerruf_submit",introText:e.getAttribute("data-intro-text")??void 0,buttonLabel:e.getAttribute("data-button-label")??void 0,buttonClass:e.getAttribute("data-button-class")??void 0,companyName:e.getAttribute("data-company-name")??void 0,senderEmail:e.getAttribute("data-sender-email")??void 0,authToken:e.getAttribute("data-auth-token")??void 0,cancelLabel:e.getAttribute("data-cancel-label")??void 0,submitLabel:e.getAttribute("data-submit-label")??void 0,privacyLabel:e.getAttribute("data-privacy-label")??void 0,privacyUrl:e.getAttribute("data-privacy-url")??void 0,successUrl:e.getAttribute("data-success-url")??void 0}}function Ro(){document.querySelectorAll("[data-widerrufs]").forEach(t=>{const n=document.createElement("span");t.replaceWith(n),hl(n,ic(t))});const e=document.getElementById("wrb-container");e&&e.hasAttribute("data-api-url")&&(e.innerHTML="",hl(e,ic(e)),["wrb-modal","wrb-success","wrb-error"].forEach(t=>{var n;(n=document.getElementById(t))==null||n.remove()}))}const Ad={render(e,t){const n=typeof e=="string"?document.querySelector(e):e;if(!n){console.warn("[WiderrufsButton] Element not found:",e);return}hl(n,t)},renderButton(e,t){const n=typeof e=="string"?document.querySelector(e):e;if(!n){console.warn("[WiderrufsButton] Anchor not found:",e);return}const r=document.createElement("span");n.insertAdjacentElement("afterend",r),hl(r,t)},init:Ro};window.WiderrufsButton=Ad,document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Ro):Ro()})();
|