@netlib/widerrufsbutton 1.1.0 → 1.1.1

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.
@@ -258,4 +258,4 @@ Error generating stack: `+u.message+`
258
258
  color: #374151;
259
259
  text-decoration: underline;
260
260
  }
261
- `;function ic(){const e="wrb-styles";if(document.getElementById(e))return;const t=document.createElement("style");t.id=e,t.textContent=$d,document.head.appendChild(t)}function Ad({config:e}){const[t,n]=ke.useState(!1);return ke.useEffect(()=>{ic()},[]),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(Ud,{config:e,onClose:()=>n(!1)}),document.body)]})}function hl(e,t){ic(),rc(e).render(z.jsx(ke.StrictMode,{children:z.jsx(Ad,{config:t})}))}function sc(e){let t;const n=e.getAttribute("data-legal-links");if(n)try{t=JSON.parse(n)}catch{}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,authToken:e.getAttribute("data-auth-token")??void 0,cancelLabel:e.getAttribute("data-cancel-label")??void 0,submitLabel:e.getAttribute("data-submit-label")??void 0,legalLinks:t,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,sc(t))});const e=document.getElementById("wrb-container");e&&(e.innerHTML="",hl(e,sc(e)))}const Bd={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=Bd,document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Ro):Ro()})();
261
+ `;function ic(){const e="wrb-styles";if(document.getElementById(e))return;const t=document.createElement("style");t.id=e,t.textContent=$d,document.head.appendChild(t)}function Ad({config:e}){const[t,n]=ke.useState(!1);return ke.useEffect(()=>{ic()},[]),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(Ud,{config:e,onClose:()=>n(!1)}),document.body)]})}function hl(e,t){ic(),rc(e).render(z.jsx(ke.StrictMode,{children:z.jsx(Ad,{config:t})}))}function sc(e){let t;const n=e.getAttribute("data-legal-links");if(n)try{t=JSON.parse(n)}catch{}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,authToken:e.getAttribute("data-auth-token")??void 0,cancelLabel:e.getAttribute("data-cancel-label")??void 0,submitLabel:e.getAttribute("data-submit-label")??void 0,legalLinks:t,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,sc(t))});const e=document.getElementById("wrb-container");e&&e.hasAttribute("data-api-url")&&(e.innerHTML="",hl(e,sc(e)))}const Bd={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=Bd,document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Ro):Ro()})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netlib/widerrufsbutton",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Embeddable Widerrufsbutton widget for German e-commerce compliance",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs.js",