@beamimpact/web-sdk 1.46.2 → 1.47.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.
- package/dist/chunks/_share-dialog-dependencies-0ivyNKvC.esm.js +2 -0
- package/dist/chunks/_share-dialog-dependencies-0ivyNKvC.esm.js.map +1 -0
- package/dist/chunks/_share-dialog-dependencies-tTzjG045.esm.js +2 -0
- package/dist/chunks/_share-dialog-dependencies-tTzjG045.esm.js.map +1 -0
- package/dist/chunks/{cart-contents-MrYQNVDx.esm.d.ts → cart-contents-CMm57qu0.esm.d.ts} +1 -1
- package/dist/chunks/{events-_4nImo3u.esm.js → events-6Z5MkCRr.esm.js} +2 -2
- package/dist/chunks/{events-_4nImo3u.esm.js.map → events-6Z5MkCRr.esm.js.map} +1 -1
- package/dist/chunks/{events--Qgk7Mel.esm.d.ts → events-ZCTR9JGZ.esm.d.ts} +1 -1
- package/dist/chunks/index--z5MSe4-.esm.d.ts +17 -0
- package/dist/chunks/{index-8gDNc2to.esm.d.ts → index-2bLOkP4H.esm.d.ts} +3 -5
- package/dist/chunks/{index-wfB8PWKi.esm.js → index-59K_SAPn.esm.js} +2 -2
- package/dist/chunks/{index-wfB8PWKi.esm.js.map → index-59K_SAPn.esm.js.map} +1 -1
- package/dist/chunks/index-B6jnCB4o.esm.js +2 -0
- package/dist/chunks/index-B6jnCB4o.esm.js.map +1 -0
- package/dist/chunks/index-BPg2EdL3.esm.js +2 -0
- package/dist/chunks/index-BPg2EdL3.esm.js.map +1 -0
- package/dist/chunks/index-CsWTfuok.esm.js +2 -0
- package/dist/chunks/index-CsWTfuok.esm.js.map +1 -0
- package/dist/chunks/{index-S_lCvtkH.esm.d.ts → index-GynYZRPI.esm.d.ts} +3 -5
- package/dist/chunks/{index-PYcJ35zU.esm.js → index-KOSC2Z9-.esm.js} +2 -2
- package/dist/chunks/{index-PYcJ35zU.esm.js.map → index-KOSC2Z9-.esm.js.map} +1 -1
- package/dist/chunks/index-MIp7LlXH.esm.js +2 -0
- package/dist/chunks/index-MIp7LlXH.esm.js.map +1 -0
- package/dist/chunks/{index-gQHtJWVP.esm.d.ts → index-PA0NAKHV.esm.d.ts} +1 -1
- package/dist/chunks/{index-ikzViFqS.esm.d.ts → index-XH3OS_sy.esm.d.ts} +4 -4
- package/dist/chunks/index-YJNgLCif.esm.js +2 -0
- package/dist/chunks/index-YJNgLCif.esm.js.map +1 -0
- package/dist/chunks/index-YcyQB-6f.esm.js +2 -0
- package/dist/chunks/index-YcyQB-6f.esm.js.map +1 -0
- package/dist/chunks/index-ZZthq-Fl.esm.js +2 -0
- package/dist/chunks/index-ZZthq-Fl.esm.js.map +1 -0
- package/dist/chunks/index-b3WjW4PD.esm.js +2 -0
- package/dist/chunks/index-b3WjW4PD.esm.js.map +1 -0
- package/dist/chunks/index-cuCnejll.esm.js +2 -0
- package/dist/chunks/index-cuCnejll.esm.js.map +1 -0
- package/dist/chunks/index-iK195-B9.esm.js +2 -0
- package/dist/chunks/index-iK195-B9.esm.js.map +1 -0
- package/dist/chunks/{index-wqLh9Pnq.esm.d.ts → index-v6fG3D6u.esm.d.ts} +1 -1
- package/dist/chunks/{openapi-spec--os_utEo.esm.d.ts → openapi-spec-hjdK2L9Q.esm.d.ts} +2 -0
- package/dist/chunks/order-page-84vnjksY.esm.js +2 -0
- package/dist/chunks/order-page-84vnjksY.esm.js.map +1 -0
- package/dist/chunks/{order-page-GwRa273v.esm.d.ts → order-page-9clVUPaS.esm.d.ts} +28 -4
- package/dist/chunks/order-page-dERTuQ8T.esm.js +2 -0
- package/dist/chunks/order-page-dERTuQ8T.esm.js.map +1 -0
- package/dist/chunks/{routes-b7lCNh-s.esm.js → routes-Jhhqcsg7.esm.js} +2 -2
- package/dist/chunks/{routes-b7lCNh-s.esm.js.map → routes-Jhhqcsg7.esm.js.map} +1 -1
- package/dist/chunks/{routes-vHy3QeuK.esm.js → routes-tB5fHy2T.esm.js} +2 -2
- package/dist/chunks/{routes-vHy3QeuK.esm.js.map → routes-tB5fHy2T.esm.js.map} +1 -1
- package/dist/chunks/{share-button-D28taUvf.esm.js → share-button-DeVQh1aE.esm.js} +2 -2
- package/dist/chunks/{share-button-D28taUvf.esm.js.map → share-button-DeVQh1aE.esm.js.map} +1 -1
- package/dist/chunks/{share-button-bbxUQLhv.esm.js → share-button-bUM2WBaV.esm.js} +2 -2
- package/dist/chunks/{share-button-bbxUQLhv.esm.js.map → share-button-bUM2WBaV.esm.js.map} +1 -1
- package/dist/chunks/{shoelace-components--UHnsHoB.esm.js → shoelace-components-JZANE20x.esm.js} +2 -2
- package/dist/chunks/{shoelace-components--UHnsHoB.esm.js.map → shoelace-components-JZANE20x.esm.js.map} +1 -1
- package/dist/chunks/{shoelace-components-fcKiMM8E.esm.js → shoelace-components-Jghvahj3.esm.js} +2 -2
- package/dist/chunks/{shoelace-components-fcKiMM8E.esm.js.map → shoelace-components-Jghvahj3.esm.js.map} +1 -1
- package/dist/chunks/update-cart-i5yZ2fyd.esm.js +2 -0
- package/dist/chunks/update-cart-i5yZ2fyd.esm.js.map +1 -0
- package/dist/chunks/{update-cart-KjKc8Cls.esm.d.ts → update-cart-l86bU5uS.esm.d.ts} +2 -2
- package/dist/chunks/update-cart-v61CI4O9.esm.js +2 -0
- package/dist/chunks/update-cart-v61CI4O9.esm.js.map +1 -0
- package/dist/components/community-impact.esm.js +1 -1
- package/dist/components/community-impact.js +1 -1
- package/dist/components/cumulative-impact.esm.js +1 -1
- package/dist/components/cumulative-impact.js +1 -1
- package/dist/components/impact-overview.esm.js +1 -1
- package/dist/components/impact-overview.js +1 -1
- package/dist/components/index.d.ts +2 -2
- package/dist/components/index.esm.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/post-purchase.d.ts +3 -3
- package/dist/components/post-purchase.esm.js +1 -1
- package/dist/components/post-purchase.js +1 -1
- package/dist/components/product-details-page.d.ts +1 -1
- package/dist/components/product-details-page.esm.js +1 -1
- package/dist/components/product-details-page.js +1 -1
- package/dist/components/redeem-transaction.d.ts +3 -3
- package/dist/components/redeem-transaction.esm.js +1 -1
- package/dist/components/redeem-transaction.js +1 -1
- package/dist/components/select-nonprofit.d.ts +6 -6
- package/dist/components/select-nonprofit.esm.js +3 -3
- package/dist/components/select-nonprofit.esm.js.map +1 -1
- package/dist/components/select-nonprofit.js +3 -3
- package/dist/components/select-nonprofit.js.map +1 -1
- package/dist/components/select-subscription-nonprofit.d.ts +1 -1
- package/dist/components/select-subscription-nonprofit.esm.js +1 -1
- package/dist/components/select-subscription-nonprofit.js +1 -1
- package/dist/components/shopify.d.ts +5 -5
- package/dist/components/shopify.esm.js +1 -1
- package/dist/components/shopify.esm.js.map +1 -1
- package/dist/components/shopify.js +1 -1
- package/dist/components/shopify.js.map +1 -1
- package/dist/components/social-share.esm.js +1 -1
- package/dist/components/social-share.js +1 -1
- package/dist/components/subscription-impact.d.ts +1 -1
- package/dist/components/subscription-impact.esm.js +1 -1
- package/dist/components/subscription-impact.js +1 -1
- package/dist/components/subscription-management.d.ts +3 -3
- package/dist/components/subscription-management.esm.js +1 -1
- package/dist/components/subscription-management.js +1 -1
- package/dist/index.d.ts +11 -11
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/integrations/beam.esm.js +1 -1
- package/dist/integrations/beam.js +1 -1
- package/dist/integrations/cart.d.ts +3 -3
- package/dist/integrations/cart.esm.js +1 -1
- package/dist/integrations/cart.js +1 -1
- package/dist/integrations/index.d.ts +9 -9
- package/dist/integrations/index.esm.js +1 -1
- package/dist/integrations/index.js +1 -1
- package/dist/integrations/logs.d.ts +2 -2
- package/dist/integrations/logs.esm.js +1 -1
- package/dist/integrations/logs.js +1 -1
- package/dist/integrations/shopify.d.ts +4 -4
- package/dist/integrations/shopify.esm.js +1 -1
- package/dist/integrations/shopify.js +1 -1
- package/dist/integrations/statsig.esm.js +2 -2
- package/dist/integrations/statsig.esm.js.map +1 -1
- package/dist/integrations/statsig.js +2 -2
- package/dist/integrations/statsig.js.map +1 -1
- package/dist/integrations/utils.d.ts +4 -4
- package/dist/integrations/utils.esm.js +1 -1
- package/dist/integrations/utils.js +1 -1
- package/dist/react/community-impact.esm.js +1 -1
- package/dist/react/community-impact.js +1 -1
- package/dist/react/cumulative-impact.esm.js +1 -1
- package/dist/react/cumulative-impact.js +1 -1
- package/dist/react/impact-overview.esm.js +1 -1
- package/dist/react/impact-overview.js +1 -1
- package/dist/react/index.d.ts +3 -3
- package/dist/react/index.esm.js +1 -1
- package/dist/react/index.js +1 -1
- package/dist/react/post-purchase.d.ts +2 -2
- package/dist/react/post-purchase.esm.js +1 -1
- package/dist/react/post-purchase.js +1 -1
- package/dist/react/product-details-page.esm.js +1 -1
- package/dist/react/product-details-page.js +1 -1
- package/dist/react/redeem-transaction.d.ts +3 -3
- package/dist/react/redeem-transaction.esm.js +1 -1
- package/dist/react/redeem-transaction.js +1 -1
- package/dist/react/select-nonprofit.d.ts +3 -3
- package/dist/react/select-nonprofit.esm.js +1 -1
- package/dist/react/select-nonprofit.esm.js.map +1 -1
- package/dist/react/select-nonprofit.js +1 -1
- package/dist/react/select-nonprofit.js.map +1 -1
- package/dist/react/select-subscription-nonprofit.d.ts +3 -3
- package/dist/react/select-subscription-nonprofit.esm.js +1 -1
- package/dist/react/select-subscription-nonprofit.js +1 -1
- package/dist/react/social-share.esm.js +1 -1
- package/dist/react/social-share.js +1 -1
- package/dist/react/subscription-impact.esm.js +1 -1
- package/dist/react/subscription-impact.js +1 -1
- package/dist/react/subscription-management.d.ts +2 -2
- package/dist/react/subscription-management.esm.js +1 -1
- package/dist/react/subscription-management.js +1 -1
- package/dist/utils/events.d.ts +3 -3
- package/dist/utils/events.esm.js +1 -1
- package/dist/utils/events.js +1 -1
- package/dist/utils/index.d.ts +4 -4
- package/dist/utils/index.esm.js +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/network-listeners.d.ts +1 -3
- package/dist/utils/network-listeners.esm.js +1 -1
- package/dist/utils/network-listeners.esm.js.map +1 -1
- package/dist/utils/network-listeners.js +1 -1
- package/dist/utils/network-listeners.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunks/_share-dialog-dependencies-3Xvd7RYp.esm.js +0 -2
- package/dist/chunks/_share-dialog-dependencies-3Xvd7RYp.esm.js.map +0 -1
- package/dist/chunks/_share-dialog-dependencies-aLaHfqo_.esm.js +0 -2
- package/dist/chunks/_share-dialog-dependencies-aLaHfqo_.esm.js.map +0 -1
- package/dist/chunks/index-98DSdEeF.esm.js +0 -2
- package/dist/chunks/index-98DSdEeF.esm.js.map +0 -1
- package/dist/chunks/index-Ie9en2n6.esm.d.ts +0 -14
- package/dist/chunks/index-JRHxSUdx.esm.js +0 -2
- package/dist/chunks/index-JRHxSUdx.esm.js.map +0 -1
- package/dist/chunks/index-MDaf3XUP.esm.js +0 -2
- package/dist/chunks/index-MDaf3XUP.esm.js.map +0 -1
- package/dist/chunks/index-NOF_HeFP.esm.js +0 -2
- package/dist/chunks/index-NOF_HeFP.esm.js.map +0 -1
- package/dist/chunks/index-S-HErLKG.esm.js +0 -2
- package/dist/chunks/index-S-HErLKG.esm.js.map +0 -1
- package/dist/chunks/index-Zc4r-zfe.esm.js +0 -2
- package/dist/chunks/index-Zc4r-zfe.esm.js.map +0 -1
- package/dist/chunks/index-aSTQRIxI.esm.js +0 -2
- package/dist/chunks/index-aSTQRIxI.esm.js.map +0 -1
- package/dist/chunks/index-n6QNFLXV.esm.js +0 -2
- package/dist/chunks/index-n6QNFLXV.esm.js.map +0 -1
- package/dist/chunks/index-x2kxA_Xo.esm.js +0 -2
- package/dist/chunks/index-x2kxA_Xo.esm.js.map +0 -1
- package/dist/chunks/index-z8c9I9IQ.esm.js +0 -2
- package/dist/chunks/index-z8c9I9IQ.esm.js.map +0 -1
- package/dist/chunks/order-page-5RGgVlVp.esm.js +0 -2
- package/dist/chunks/order-page-5RGgVlVp.esm.js.map +0 -1
- package/dist/chunks/order-page-RErpDzIb.esm.js +0 -2
- package/dist/chunks/order-page-RErpDzIb.esm.js.map +0 -1
- package/dist/chunks/update-cart-7lapx5-_.esm.js +0 -2
- package/dist/chunks/update-cart-7lapx5-_.esm.js.map +0 -1
- package/dist/chunks/update-cart-jxckGinN.esm.js +0 -2
- package/dist/chunks/update-cart-jxckGinN.esm.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t as C,h as b,y as u,g as c,f as y,p as I}from"../chunks/lit-iNN5L_Qk.esm.js";import{d as x}from"../chunks/lodash-P8OIs-at.esm.js";import{c as T,d as S,e as E}from"../chunks/enforce-config-ZAI7WYAd.esm.js";import{u as p,A as z,_ as f,i as d,d as v,a as B}from"../chunks/localize-o-cYvHQf.esm.js";import{D,k,S as L}from"../chunks/routes-
|
|
1
|
+
import{t as C,h as b,y as u,g as c,f as y,p as I}from"../chunks/lit-iNN5L_Qk.esm.js";import{d as x}from"../chunks/lodash-P8OIs-at.esm.js";import{c as T,d as S,e as E}from"../chunks/enforce-config-ZAI7WYAd.esm.js";import{u as p,A as z,_ as f,i as d,d as v,a as B}from"../chunks/localize-o-cYvHQf.esm.js";import{D,k,S as L}from"../chunks/routes-Jhhqcsg7.esm.js";import{B as $}from"../chunks/beam-errors-P-Lu07Ce.esm.js";import{_ as V}from"../chunks/loading-template-t4fFsYtr.esm.js";import{i as A}from"../chunks/is-all-html-elements-SdSkxirh.esm.js";import"../utils/logger.esm.js";var j=Object.defineProperty,R=Object.getOwnPropertyDescriptor,h=(s,e,t,a)=>{for(var i=a>1?void 0:a?R(e,t):e,o=s.length-1,r;o>=0;o--)(r=s[o])&&(i=(a?r(e,t,i):r(i))||i);return a&&i&&j(e,t,i),i};class m extends b{constructor(){super(...arguments),this.finalValue=0,this.duration=1500,this.counter=0,this.intervalId=0,this.handleCounterAnimateIfInView=e=>{e.some(t=>t.isIntersecting)&&(this.animateCounter(),this.unobserveScrollTarget())},this.animateCounter=()=>{const e=41.666666666666664,t=e/this.duration*this.finalValue;this.intervalId=setInterval(()=>{const a=this.counter+t;if(a>=this.finalValue){this.counter=this.finalValue,clearInterval(this.intervalId);return}else this.counter=a},e)},this.observer=new IntersectionObserver(this.handleCounterAnimateIfInView,{threshold:.1}),this.observeScrollTarget=()=>{const e=this.scrollTargetElement;e&&this.observer.observe(e)},this.unobserveScrollTarget=()=>{const e=this.scrollTargetElement;e&&this.observer.unobserve(e)}}connectedCallback(){super.connectedCallback();const e=window.matchMedia("(prefers-reduced-motion: reduce)").matches;this.duration===0||e?this.counter=this.finalValue:this.observeScrollTarget()}disconnectedCallback(){super.disconnectedCallback(),this.unobserveScrollTarget(),clearInterval(this.intervalId)}get scrollTargetElement(){return this.scrollTarget?document.querySelector(this.scrollTarget):this}render(){return u`${Math.ceil(this.counter).toLocaleString()}`}}h([c({type:Number})],m.prototype,"finalValue",2),h([c({type:Number})],m.prototype,"duration",2),h([c({type:String})],m.prototype,"scrollTarget",2),h([C()],m.prototype,"counter",2),customElements.get("animated-counter")||customElements.define("animated-counter",m);const O=s=>{const e=s instanceof NodeList?Array.from(s):s;if(e.length===0||!A(e))return;const t=e.sort((i,o)=>{const r=getComputedStyle(i).getPropertyValue("width").replace("px",""),g=getComputedStyle(o).getPropertyValue("width").replace("px","");return parseInt(g)-parseInt(r)})[0],a=getComputedStyle(t).getPropertyValue("width");for(const i of e)getComputedStyle(i).getPropertyValue("width")!==a&&(i.style.width=a)},w={en:{cumulativeImpactTitle:()=>"What we've funded",cumulativeImpactDescription:()=>"Here's the impact that our community has made so far in partnership with Beam. Our impact is growing every day\u2014 scroll to check out the goals we're working toward together right now."},fr:{cumulativeImpactTitle:()=>"Ce que nous avons financ\xE9",cumulativeImpactDescription:()=>"Voici l'impact que notre communaut\xE9 a eu jusqu'\xE0 pr\xE9sent en partenariat avec Beam. Notre impact grandit chaque jour : faites d\xE9filer pour d\xE9couvrir les objectifs vers lesquels nous travaillons ensemble en ce moment."},de:{cumulativeImpactTitle:()=>"Was wir finanziert haben",cumulativeImpactDescription:()=>"Hier ist die Wirkung, die unsere Community bisher in Zusammenarbeit mit Beam erzielt hat. Unsere Wirkung w\xE4chst von Tag zu Tag - scrollen Sie, um einen Blick auf die Ziele zu werfen, auf die wir derzeit gemeinsam hinarbeiten."},es:{cumulativeImpactTitle:()=>"Lo que hemos financiado",cumulativeImpactDescription:()=>"Este es el impacto que nuestra comunidad ha tenido hasta ahora en asociaci\xF3n con Beam. Nuestro impacto crece cada d\xEDa; despl\xE1cese para ver los objetivos por los que estamos trabajando juntos en este momento."},it:{cumulativeImpactTitle:()=>"Cosa abbiamo finanziato",cumulativeImpactDescription:()=>"Ecco l'impatto che la nostra comunit\xE0 ha avuto finora in collaborazione con Beam. Il nostro impatto cresce ogni giorno: scorri per scoprire gli obiettivi a cui stiamo lavorando insieme in questo momento."},pl:{cumulativeImpactTitle:()=>"Co sfinansowali\u015Bmy",cumulativeImpactDescription:()=>"Oto wp\u0142yw, jaki nasza spo\u0142eczno\u015B\u0107 wywar\u0142a dotychczas we wsp\xF3\u0142pracy z Beam. Nasz wp\u0142yw ro\u015Bnie z ka\u017Cdym dniem \u2014 przewi\u0144, aby sprawdzi\u0107 cele, nad kt\xF3rymi obecnie wsp\xF3lnie pracujemy."}};var P=Object.defineProperty,q=Object.getOwnPropertyDescriptor,l=(s,e,t,a)=>{for(var i=a>1?void 0:a?q(e,t):e,o=s.length-1,r;o>=0;o--)(r=s[o])&&(i=(a?r(e,t,i):r(i))||i);return a&&i&&P(e,t,i),i};const U=1.5*1e3;class n extends b{constructor(){super(...arguments),this.baseUrl=D,this.lang="en",this.disableAnimation=!1,this.debug=!1,this.draftConfig=!1,this.getCumulativeImpactData=async()=>(E(["apiKey","chainId"],this),await k({baseUrl:this.baseUrl,pathParams:{chainId:this.chainId},headers:{authorization:`Api-Key ${this.apiKey}`},queryParams:{version:"1.0.0",lang:this.configLang,draftConfig:this.draftConfig}})),this.cumulativeImpactDataController=new z(this,this.getCumulativeImpactData),this.resizeElements=x(()=>{O(this.impactRowRefs)},50,{maxWait:50,leading:!0})}get configLang(){return L[this.lang]||"en"}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.resizeElements)}async updated(e){const t=["chainId","baseUrl","lang"];for(const a of t)if(e.has(a)){await this.cumulativeImpactDataController.exec();break}this.resizeElements()}render(){const{data:e,error:t,loading:a}=this.cumulativeImpactDataController;return a?V():t?this.debug?f({error:t}):"":e==null?this.debug?f({error:new $("Missing data")}):"":u`
|
|
2
2
|
<style>
|
|
3
3
|
:host {
|
|
4
4
|
${this.cssVariables.toCSS()}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t as C,h as b,y as u,g as c,f as y,p as I}from"../chunks/lit-iNN5L_Qk.esm.js";import{d as x}from"../chunks/lodash-P8OIs-at.esm.js";import{c as T,d as S,e as E}from"../chunks/enforce-config-ZyPq_4CF.esm.js";import{u as p,A as z,_ as f,i as d,d as v,a as B}from"../chunks/localize-m-_ESmpk.esm.js";import{D,k,S as L}from"../chunks/routes-
|
|
1
|
+
import{t as C,h as b,y as u,g as c,f as y,p as I}from"../chunks/lit-iNN5L_Qk.esm.js";import{d as x}from"../chunks/lodash-P8OIs-at.esm.js";import{c as T,d as S,e as E}from"../chunks/enforce-config-ZyPq_4CF.esm.js";import{u as p,A as z,_ as f,i as d,d as v,a as B}from"../chunks/localize-m-_ESmpk.esm.js";import{D,k,S as L}from"../chunks/routes-tB5fHy2T.esm.js";import{B as $}from"../chunks/beam-errors-P-Lu07Ce.esm.js";import{_ as V}from"../chunks/loading-template-t4fFsYtr.esm.js";import{i as A}from"../chunks/is-all-html-elements-SdSkxirh.esm.js";import"../utils/logger.js";var j=Object.defineProperty,R=Object.getOwnPropertyDescriptor,h=(s,e,t,a)=>{for(var i=a>1?void 0:a?R(e,t):e,o=s.length-1,r;o>=0;o--)(r=s[o])&&(i=(a?r(e,t,i):r(i))||i);return a&&i&&j(e,t,i),i};class m extends b{constructor(){super(...arguments),this.finalValue=0,this.duration=1500,this.counter=0,this.intervalId=0,this.handleCounterAnimateIfInView=e=>{e.some(t=>t.isIntersecting)&&(this.animateCounter(),this.unobserveScrollTarget())},this.animateCounter=()=>{const e=41.666666666666664,t=e/this.duration*this.finalValue;this.intervalId=setInterval(()=>{const a=this.counter+t;if(a>=this.finalValue){this.counter=this.finalValue,clearInterval(this.intervalId);return}else this.counter=a},e)},this.observer=new IntersectionObserver(this.handleCounterAnimateIfInView,{threshold:.1}),this.observeScrollTarget=()=>{const e=this.scrollTargetElement;e&&this.observer.observe(e)},this.unobserveScrollTarget=()=>{const e=this.scrollTargetElement;e&&this.observer.unobserve(e)}}connectedCallback(){super.connectedCallback();const e=window.matchMedia("(prefers-reduced-motion: reduce)").matches;this.duration===0||e?this.counter=this.finalValue:this.observeScrollTarget()}disconnectedCallback(){super.disconnectedCallback(),this.unobserveScrollTarget(),clearInterval(this.intervalId)}get scrollTargetElement(){return this.scrollTarget?document.querySelector(this.scrollTarget):this}render(){return u`${Math.ceil(this.counter).toLocaleString()}`}}h([c({type:Number})],m.prototype,"finalValue",2),h([c({type:Number})],m.prototype,"duration",2),h([c({type:String})],m.prototype,"scrollTarget",2),h([C()],m.prototype,"counter",2),customElements.get("animated-counter")||customElements.define("animated-counter",m);const O=s=>{const e=s instanceof NodeList?Array.from(s):s;if(e.length===0||!A(e))return;const t=e.sort((i,o)=>{const r=getComputedStyle(i).getPropertyValue("width").replace("px",""),g=getComputedStyle(o).getPropertyValue("width").replace("px","");return parseInt(g)-parseInt(r)})[0],a=getComputedStyle(t).getPropertyValue("width");for(const i of e)getComputedStyle(i).getPropertyValue("width")!==a&&(i.style.width=a)},w={en:{cumulativeImpactTitle:()=>"What we've funded",cumulativeImpactDescription:()=>"Here's the impact that our community has made so far in partnership with Beam. Our impact is growing every day\u2014 scroll to check out the goals we're working toward together right now."},fr:{cumulativeImpactTitle:()=>"Ce que nous avons financ\xE9",cumulativeImpactDescription:()=>"Voici l'impact que notre communaut\xE9 a eu jusqu'\xE0 pr\xE9sent en partenariat avec Beam. Notre impact grandit chaque jour : faites d\xE9filer pour d\xE9couvrir les objectifs vers lesquels nous travaillons ensemble en ce moment."},de:{cumulativeImpactTitle:()=>"Was wir finanziert haben",cumulativeImpactDescription:()=>"Hier ist die Wirkung, die unsere Community bisher in Zusammenarbeit mit Beam erzielt hat. Unsere Wirkung w\xE4chst von Tag zu Tag - scrollen Sie, um einen Blick auf die Ziele zu werfen, auf die wir derzeit gemeinsam hinarbeiten."},es:{cumulativeImpactTitle:()=>"Lo que hemos financiado",cumulativeImpactDescription:()=>"Este es el impacto que nuestra comunidad ha tenido hasta ahora en asociaci\xF3n con Beam. Nuestro impacto crece cada d\xEDa; despl\xE1cese para ver los objetivos por los que estamos trabajando juntos en este momento."},it:{cumulativeImpactTitle:()=>"Cosa abbiamo finanziato",cumulativeImpactDescription:()=>"Ecco l'impatto che la nostra comunit\xE0 ha avuto finora in collaborazione con Beam. Il nostro impatto cresce ogni giorno: scorri per scoprire gli obiettivi a cui stiamo lavorando insieme in questo momento."},pl:{cumulativeImpactTitle:()=>"Co sfinansowali\u015Bmy",cumulativeImpactDescription:()=>"Oto wp\u0142yw, jaki nasza spo\u0142eczno\u015B\u0107 wywar\u0142a dotychczas we wsp\xF3\u0142pracy z Beam. Nasz wp\u0142yw ro\u015Bnie z ka\u017Cdym dniem \u2014 przewi\u0144, aby sprawdzi\u0107 cele, nad kt\xF3rymi obecnie wsp\xF3lnie pracujemy."}};var P=Object.defineProperty,q=Object.getOwnPropertyDescriptor,l=(s,e,t,a)=>{for(var i=a>1?void 0:a?q(e,t):e,o=s.length-1,r;o>=0;o--)(r=s[o])&&(i=(a?r(e,t,i):r(i))||i);return a&&i&&P(e,t,i),i};const U=1.5*1e3;class n extends b{constructor(){super(...arguments),this.baseUrl=D,this.lang="en",this.disableAnimation=!1,this.debug=!1,this.draftConfig=!1,this.getCumulativeImpactData=async()=>(E(["apiKey","chainId"],this),await k({baseUrl:this.baseUrl,pathParams:{chainId:this.chainId},headers:{authorization:`Api-Key ${this.apiKey}`},queryParams:{version:"1.0.0",lang:this.configLang,draftConfig:this.draftConfig}})),this.cumulativeImpactDataController=new z(this,this.getCumulativeImpactData),this.resizeElements=x(()=>{O(this.impactRowRefs)},50,{maxWait:50,leading:!0})}get configLang(){return L[this.lang]||"en"}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.resizeElements)}async updated(e){const t=["chainId","baseUrl","lang"];for(const a of t)if(e.has(a)){await this.cumulativeImpactDataController.exec();break}this.resizeElements()}render(){const{data:e,error:t,loading:a}=this.cumulativeImpactDataController;return a?V():t?this.debug?f({error:t}):"":e==null?this.debug?f({error:new $("Missing data")}):"":u`
|
|
2
2
|
<style>
|
|
3
3
|
:host {
|
|
4
4
|
${this.cssVariables.toCSS()}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{f as O,g as c,p as b,h as D,y as T,k as $}from"../chunks/lit-iNN5L_Qk.esm.js";import{d as N}from"../chunks/lodash-P8OIs-at.esm.js";import{D as R,g as j,W as F,S as P}from"../chunks/routes-
|
|
1
|
+
import{f as O,g as c,p as b,h as D,y as T,k as $}from"../chunks/lit-iNN5L_Qk.esm.js";import{d as N}from"../chunks/lodash-P8OIs-at.esm.js";import{D as R,g as j,W as F,S as P}from"../chunks/routes-Jhhqcsg7.esm.js";import{p as A}from"../chunks/progress-bar-PMU_xI3L.esm.js";import{u as l,A as _,i as v,_ as S,d as u,a as V}from"../chunks/localize-o-cYvHQf.esm.js";import{c as W,d as q,e as G}from"../chunks/enforce-config-ZAI7WYAd.esm.js";import{_ as K}from"../chunks/loading-template-t4fFsYtr.esm.js";import{logger as M}from"../utils/logger.esm.js";import"../chunks/shoelace-components-Jghvahj3.esm.js";import{s as h,a as H}from"../chunks/share-button-DeVQh1aE.esm.js";import{partnerLogosConfigDefaults as Y}from"./beam-partner-logos.esm.js";import{c as J}from"../chunks/responsive-2lC2Wrtg.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../chunks/vendor-GKiOHg2N.esm.js";import"../chunks/is-all-html-elements-SdSkxirh.esm.js";import"../chunks/share-button-SNvuFDC9.esm.js";const g={en:{descriptionTitle:({nonprofitName:e="a nonprofit"})=>`You've just made an impact for ${e}`,descriptionSubtitle:()=>"Check out the impact your purchase made below.",yourImpactTitle:()=>"You\u2019ve Funded",communityImpactTitle:()=>"Together we\u2019re funding",personalImpactLinkCopy:({name:e=""})=>`Learn about ${e}`,communityImpactLinkCopy:({name:e=""})=>`See all of the impact by the ${e} community`,impactShareButton:()=>"Share to Grow Your Impact"},fr:{descriptionTitle:({nonprofitName:e=""})=>`Vous avez eu un impact positif sur ${e}`,descriptionSubtitle:({causeName:e=""})=>`D\xE9couvrez quel est l'impact de votre achat chez ${e} ci-dessous.`,yourImpactTitle:()=>"Vous avez financ\xE9",communityImpactTitle:()=>"Ensemble, nous finan\xE7ons",personalImpactLinkCopy:({name:e=""})=>`En savoir sur ${e}`,communityImpactLinkCopy:({name:e=""})=>`Voir toutes les contributions de la communaut\xE9 de ${e}`,impactShareButton:()=>"Partagez pour augmentez notre cause"},de:{descriptionTitle:({nonprofitName:e=""})=>`Du hast soeben einen Beitrag geleistet f\xFCr ${e}`,descriptionSubtitle:({causeName:e=""})=>`Erfahre mehr \xFCber den Beitrag, den du mit deinem ${e} Kauf geleistet hast`,yourImpactTitle:()=>"Sie haben finanziert",communityImpactTitle:()=>"Gemeinsam finanzieren wir",personalImpactLinkCopy:({name:e=""})=>`Mehr \xFCber ${e} lernen`,communityImpactLinkCopy:({name:e=""})=>`Informiere dich \xFCber den bisher geleisteten Beitrag der ${e} community`,impactShareButton:()=>"Teil, um unserem Beitrag zu erh\xF6hen"},es:{descriptionTitle:({nonprofitName:e=""})=>`Acabas de contribuir con ${e}`,descriptionSubtitle:({causeName:e=""})=>`Comprueba la contribuci\xF3n que has hecho con tu compra ${e} a continuaci\xF3n`,yourImpactTitle:()=>"Has financiado",communityImpactTitle:()=>"Juntos estamos financiando",personalImpactLinkCopy:({name:e=""})=>`Saber de ${e}`,communityImpactLinkCopy:({name:e=""})=>`Mira lo que ha conseguido la comunidad ${e}`,impactShareButton:()=>"Comparte para aumentar nuestro impacto"},it:{descriptionTitle:({nonprofitName:e=""})=>`Hai appena fatto la differenza per ${e}`,descriptionSubtitle:({causeName:e=""})=>`Guarda qui sotto l'impatto del tuo acquisto ${e}`,yourImpactTitle:()=>"Hai finanziato",communityImpactTitle:()=>"Insieme stiamo finanziando",personalImpactLinkCopy:({name:e=""})=>`Scopri su ${e}`,communityImpactLinkCopy:({name:e=""})=>`Guarda come la comunit\xE0 di ${e} fa la differenza`,impactShareButton:()=>"Condividi, aiutaci a fare la differenza"},pl:{descriptionTitle:({nonprofitName:e=""})=>`W\u0142a\u015Bnie wspar\u0142a\u015B_e\u015B ${e}!`,descriptionSubtitle:({causeName:e=""})=>`Sprawd\u017A ni\u017Cej, jakiego wsparcia udzieli\u0142a\u015B_e\u015B kupuj\u0105c w ${e} `,yourImpactTitle:()=>"Sfinansowa\u0142e\u015B(a) ",communityImpactTitle:()=>"Razem finansujemy",personalImpactLinkCopy:({name:e=""})=>`Dowiedz si\u0119 o ${e}`,communityImpactLinkCopy:({name:e=""})=>`Zobacz, ile dobrego zrobi\u0142a do tej pory spo\u0142eczno\u015B\u0107 ${e}`,impactShareButton:()=>"Udost\u0119pnij, by szerzy\u0107 nasz\u0105 misj\u0119"}};var Z=Object.defineProperty,Q=Object.getOwnPropertyDescriptor,r=(e,a,i,o)=>{for(var n=o>1?void 0:o?Q(a,i):a,s=e.length-1,m;s>=0;s--)(m=e[s])&&(n=(o?m(a,i,n):m(n))||n);return o&&n&&Z(a,i,n),n};class t extends D{constructor(){super(...arguments),this.baseUrl=R,this.lang="en",this.debug=!1,this.draftConfig=!1,this.getImpactData=async()=>(G(["apiKey","userId","nonprofitId"],this),await j({baseUrl:this.baseUrl,headers:{authorization:`Api-Key ${this.apiKey}`},queryParams:{nonprofitId:this.nonprofitId,beamUserId:this.userId,personalImpactLimit:1,communityImpactLimit:1,storeId:this.storeId,widgetName:F.impact_overview,version:"1.0.0",draftConfig:this.draftConfig,lang:this.configLang,discountCodes:this.discountCodes&&this.discountCodes.length>0?this.discountCodes:void 0,transactionId:this.transactionId??void 0}})),this.impactDataController=new _(this,this.getImpactData),this.resizeElements=N(()=>{h(this.impactTitleRefs),h(this.impactDescriptionRefs),h(this.impactLinkRefs),h(this.goalCompletionTextRefs)},50,{maxWait:50,leading:!0})}get configLang(){return P[this.lang]||"en"}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.resizeElements)}async updated(a){const i=["baseUrl","storeId","apiKey","userId","lang","discountCodes"];for(const o of i)if(a.has(o)){await this.impactDataController.exec();break}this.resizeElements(),await this.handleFontLoad(this.resizeElements)}disconnectedCallback(){window.removeEventListener("resize",this.resizeElements),document.fonts.removeEventListener("loadingdone",this.resizeElements),super.disconnectedCallback()}async handleFontLoad(a){if(document.fonts.status==="loading")return await document.fonts.ready.catch(i=>M.error(i)),a()}renderCard({imageUrl:a,title:i,percentFunded:o,goalProgressText:n,description:s,urlCopy:m,impactUrl:p,isImage:d,cardType:f,goalCompletionText:y}){return T`
|
|
2
2
|
<div class="impact-card ${d?"":"icon"}" part="impact-card">
|
|
3
3
|
<div class="${d?"":"icon-background "}">
|
|
4
4
|
<img src="${a}" alt="${i}" class="${d?"impact-card-image":"impact-card-icon"}" />
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{f as O,g as c,p as b,h as D,y as T,k as $}from"../chunks/lit-iNN5L_Qk.esm.js";import{d as N}from"../chunks/lodash-P8OIs-at.esm.js";import{D as R,g as j,W as F,S as P}from"../chunks/routes-
|
|
1
|
+
import{f as O,g as c,p as b,h as D,y as T,k as $}from"../chunks/lit-iNN5L_Qk.esm.js";import{d as N}from"../chunks/lodash-P8OIs-at.esm.js";import{D as R,g as j,W as F,S as P}from"../chunks/routes-tB5fHy2T.esm.js";import{p as A}from"../chunks/progress-bar-PMU_xI3L.esm.js";import{u as l,A as _,i as v,_ as S,d as u,a as V}from"../chunks/localize-m-_ESmpk.esm.js";import{c as W,d as q,e as G}from"../chunks/enforce-config-ZyPq_4CF.esm.js";import{_ as K}from"../chunks/loading-template-t4fFsYtr.esm.js";import{logger as M}from"../utils/logger.js";import"../chunks/shoelace-components-JZANE20x.esm.js";import{s as h,a as H}from"../chunks/share-button-bUM2WBaV.esm.js";import{partnerLogosConfigDefaults as Y}from"./beam-partner-logos.js";import{c as J}from"../chunks/responsive-2lC2Wrtg.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../chunks/vendor-GKiOHg2N.esm.js";import"../chunks/is-all-html-elements-SdSkxirh.esm.js";import"../chunks/share-button-SNvuFDC9.esm.js";const g={en:{descriptionTitle:({nonprofitName:e="a nonprofit"})=>`You've just made an impact for ${e}`,descriptionSubtitle:()=>"Check out the impact your purchase made below.",yourImpactTitle:()=>"You\u2019ve Funded",communityImpactTitle:()=>"Together we\u2019re funding",personalImpactLinkCopy:({name:e=""})=>`Learn about ${e}`,communityImpactLinkCopy:({name:e=""})=>`See all of the impact by the ${e} community`,impactShareButton:()=>"Share to Grow Your Impact"},fr:{descriptionTitle:({nonprofitName:e=""})=>`Vous avez eu un impact positif sur ${e}`,descriptionSubtitle:({causeName:e=""})=>`D\xE9couvrez quel est l'impact de votre achat chez ${e} ci-dessous.`,yourImpactTitle:()=>"Vous avez financ\xE9",communityImpactTitle:()=>"Ensemble, nous finan\xE7ons",personalImpactLinkCopy:({name:e=""})=>`En savoir sur ${e}`,communityImpactLinkCopy:({name:e=""})=>`Voir toutes les contributions de la communaut\xE9 de ${e}`,impactShareButton:()=>"Partagez pour augmentez notre cause"},de:{descriptionTitle:({nonprofitName:e=""})=>`Du hast soeben einen Beitrag geleistet f\xFCr ${e}`,descriptionSubtitle:({causeName:e=""})=>`Erfahre mehr \xFCber den Beitrag, den du mit deinem ${e} Kauf geleistet hast`,yourImpactTitle:()=>"Sie haben finanziert",communityImpactTitle:()=>"Gemeinsam finanzieren wir",personalImpactLinkCopy:({name:e=""})=>`Mehr \xFCber ${e} lernen`,communityImpactLinkCopy:({name:e=""})=>`Informiere dich \xFCber den bisher geleisteten Beitrag der ${e} community`,impactShareButton:()=>"Teil, um unserem Beitrag zu erh\xF6hen"},es:{descriptionTitle:({nonprofitName:e=""})=>`Acabas de contribuir con ${e}`,descriptionSubtitle:({causeName:e=""})=>`Comprueba la contribuci\xF3n que has hecho con tu compra ${e} a continuaci\xF3n`,yourImpactTitle:()=>"Has financiado",communityImpactTitle:()=>"Juntos estamos financiando",personalImpactLinkCopy:({name:e=""})=>`Saber de ${e}`,communityImpactLinkCopy:({name:e=""})=>`Mira lo que ha conseguido la comunidad ${e}`,impactShareButton:()=>"Comparte para aumentar nuestro impacto"},it:{descriptionTitle:({nonprofitName:e=""})=>`Hai appena fatto la differenza per ${e}`,descriptionSubtitle:({causeName:e=""})=>`Guarda qui sotto l'impatto del tuo acquisto ${e}`,yourImpactTitle:()=>"Hai finanziato",communityImpactTitle:()=>"Insieme stiamo finanziando",personalImpactLinkCopy:({name:e=""})=>`Scopri su ${e}`,communityImpactLinkCopy:({name:e=""})=>`Guarda come la comunit\xE0 di ${e} fa la differenza`,impactShareButton:()=>"Condividi, aiutaci a fare la differenza"},pl:{descriptionTitle:({nonprofitName:e=""})=>`W\u0142a\u015Bnie wspar\u0142a\u015B_e\u015B ${e}!`,descriptionSubtitle:({causeName:e=""})=>`Sprawd\u017A ni\u017Cej, jakiego wsparcia udzieli\u0142a\u015B_e\u015B kupuj\u0105c w ${e} `,yourImpactTitle:()=>"Sfinansowa\u0142e\u015B(a) ",communityImpactTitle:()=>"Razem finansujemy",personalImpactLinkCopy:({name:e=""})=>`Dowiedz si\u0119 o ${e}`,communityImpactLinkCopy:({name:e=""})=>`Zobacz, ile dobrego zrobi\u0142a do tej pory spo\u0142eczno\u015B\u0107 ${e}`,impactShareButton:()=>"Udost\u0119pnij, by szerzy\u0107 nasz\u0105 misj\u0119"}};var Z=Object.defineProperty,Q=Object.getOwnPropertyDescriptor,r=(e,a,i,o)=>{for(var n=o>1?void 0:o?Q(a,i):a,s=e.length-1,m;s>=0;s--)(m=e[s])&&(n=(o?m(a,i,n):m(n))||n);return o&&n&&Z(a,i,n),n};class t extends D{constructor(){super(...arguments),this.baseUrl=R,this.lang="en",this.debug=!1,this.draftConfig=!1,this.getImpactData=async()=>(G(["apiKey","userId","nonprofitId"],this),await j({baseUrl:this.baseUrl,headers:{authorization:`Api-Key ${this.apiKey}`},queryParams:{nonprofitId:this.nonprofitId,beamUserId:this.userId,personalImpactLimit:1,communityImpactLimit:1,storeId:this.storeId,widgetName:F.impact_overview,version:"1.0.0",draftConfig:this.draftConfig,lang:this.configLang,discountCodes:this.discountCodes&&this.discountCodes.length>0?this.discountCodes:void 0,transactionId:this.transactionId??void 0}})),this.impactDataController=new _(this,this.getImpactData),this.resizeElements=N(()=>{h(this.impactTitleRefs),h(this.impactDescriptionRefs),h(this.impactLinkRefs),h(this.goalCompletionTextRefs)},50,{maxWait:50,leading:!0})}get configLang(){return P[this.lang]||"en"}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.resizeElements)}async updated(a){const i=["baseUrl","storeId","apiKey","userId","lang","discountCodes"];for(const o of i)if(a.has(o)){await this.impactDataController.exec();break}this.resizeElements(),await this.handleFontLoad(this.resizeElements)}disconnectedCallback(){window.removeEventListener("resize",this.resizeElements),document.fonts.removeEventListener("loadingdone",this.resizeElements),super.disconnectedCallback()}async handleFontLoad(a){if(document.fonts.status==="loading")return await document.fonts.ready.catch(i=>M.error(i)),a()}renderCard({imageUrl:a,title:i,percentFunded:o,goalProgressText:n,description:s,urlCopy:m,impactUrl:p,isImage:d,cardType:f,goalCompletionText:y}){return T`
|
|
2
2
|
<div class="impact-card ${d?"":"icon"}" part="impact-card">
|
|
3
3
|
<div class="${d?"":"icon-background "}">
|
|
4
4
|
<img src="${a}" alt="${i}" class="${d?"impact-card-image":"impact-card-icon"}" />
|
|
@@ -18,6 +18,6 @@ import '../chunks/types-zbTZ8-KP.esm.js';
|
|
|
18
18
|
import 'lodash';
|
|
19
19
|
import '../chunks/share-button-hDn8fnBI.esm.js';
|
|
20
20
|
import '../chunks/promo-pill-label-3bA1z-la.esm.js';
|
|
21
|
-
import '../chunks/cart-contents-
|
|
22
|
-
import '../chunks/openapi-spec
|
|
21
|
+
import '../chunks/cart-contents-CMm57qu0.esm.js';
|
|
22
|
+
import '../chunks/openapi-spec-hjdK2L9Q.esm.js';
|
|
23
23
|
import '../chunks/routes-iurI6dvR.esm.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{BeamCommunityImpact as
|
|
1
|
+
import{BeamCommunityImpact as w}from"./community-impact.esm.js";import{BeamCumulativeImpact as D}from"./cumulative-impact.esm.js";import{BeamImpactOverview as O}from"./impact-overview.esm.js";import{BeamSelectNonprofit as T}from"./select-nonprofit.esm.js";import{BeamRedeemTransaction as k}from"./redeem-transaction.esm.js";import{BeamPostPurchase as z}from"./post-purchase.esm.js";import{BeamSubscriptionManagement as E}from"./subscription-management.esm.js";import{BeamSubscriptionImpact as G}from"./subscription-impact.esm.js";import{BeamProductDetailsPage as J}from"./product-details-page.esm.js";import{BeamSelectSubscriptionNonprofit as L}from"./select-subscription-nonprofit.esm.js";import{BeamSocialShare as U}from"./social-share.esm.js";import"../chunks/lit-iNN5L_Qk.esm.js";import"../chunks/progress-bar-PMU_xI3L.esm.js";import"./beam-partner-logos.esm.js";import"../chunks/enforce-config-ZAI7WYAd.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../utils/logger.esm.js";import"../chunks/localize-o-cYvHQf.esm.js";import"../chunks/routes-Jhhqcsg7.esm.js";import"../chunks/loading-template-t4fFsYtr.esm.js";import"../chunks/css-card-grid-nEc--M5M.esm.js";import"../chunks/lodash-P8OIs-at.esm.js";import"../chunks/is-all-html-elements-SdSkxirh.esm.js";import"../chunks/shoelace-components-Jghvahj3.esm.js";import"../chunks/vendor-GKiOHg2N.esm.js";import"../chunks/share-button-DeVQh1aE.esm.js";import"../chunks/share-button-SNvuFDC9.esm.js";import"../chunks/responsive-2lC2Wrtg.esm.js";import"../chunks/promo-pill-label-P1X4xeAx.esm.js";import"../chunks/events-6Z5MkCRr.esm.js";import"../utils/local-storage.esm.js";import"../chunks/cart-contents-h60geKWa.esm.js";import"../utils/cart.esm.js";import"../utils/cookies.esm.js";import"../utils/makeApiKeyHeader.esm.js";export{w as BeamCommunityImpact,D as BeamCumulativeImpact,O as BeamImpactOverview,z as BeamPostPurchase,J as BeamProductDetailsPage,k as BeamRedeemTransaction,T as BeamSelectNonprofit,L as BeamSelectSubscriptionNonprofit,U as BeamSocialShare,G as BeamSubscriptionImpact,E as BeamSubscriptionManagement};
|
|
2
2
|
//# sourceMappingURL=index.esm.js.map
|
package/dist/components/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{BeamCommunityImpact as
|
|
1
|
+
import{BeamCommunityImpact as w}from"./community-impact.js";import{BeamCumulativeImpact as D}from"./cumulative-impact.js";import{BeamImpactOverview as O}from"./impact-overview.js";import{BeamSelectNonprofit as T}from"./select-nonprofit.js";import{BeamRedeemTransaction as k}from"./redeem-transaction.js";import{BeamPostPurchase as z}from"./post-purchase.js";import{BeamSubscriptionManagement as E}from"./subscription-management.js";import{BeamSubscriptionImpact as G}from"./subscription-impact.js";import{BeamProductDetailsPage as J}from"./product-details-page.js";import{BeamSelectSubscriptionNonprofit as L}from"./select-subscription-nonprofit.js";import{BeamSocialShare as U}from"./social-share.js";import"../chunks/lit-iNN5L_Qk.esm.js";import"../chunks/progress-bar-PMU_xI3L.esm.js";import"./beam-partner-logos.js";import"../chunks/enforce-config-ZyPq_4CF.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../utils/logger.js";import"../chunks/localize-m-_ESmpk.esm.js";import"../chunks/routes-tB5fHy2T.esm.js";import"../chunks/loading-template-t4fFsYtr.esm.js";import"../chunks/css-card-grid-nEc--M5M.esm.js";import"../chunks/lodash-P8OIs-at.esm.js";import"../chunks/is-all-html-elements-SdSkxirh.esm.js";import"../chunks/shoelace-components-JZANE20x.esm.js";import"../chunks/vendor-GKiOHg2N.esm.js";import"../chunks/share-button-bUM2WBaV.esm.js";import"../chunks/share-button-SNvuFDC9.esm.js";import"../chunks/responsive-2lC2Wrtg.esm.js";import"../chunks/promo-pill-label-P1X4xeAx.esm.js";import"../chunks/events-6Z5MkCRr.esm.js";import"../utils/local-storage.js";import"../chunks/cart-contents-h60geKWa.esm.js";import"../utils/cart.js";import"../utils/cookies.js";import"../utils/makeApiKeyHeader.js";export{w as BeamCommunityImpact,D as BeamCumulativeImpact,O as BeamImpactOverview,z as BeamPostPurchase,J as BeamProductDetailsPage,k as BeamRedeemTransaction,T as BeamSelectNonprofit,L as BeamSelectSubscriptionNonprofit,U as BeamSocialShare,G as BeamSubscriptionImpact,E as BeamSubscriptionManagement};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -4,13 +4,13 @@ import * as lit_html from 'lit-html';
|
|
|
4
4
|
import { L as LANGUAGES } from '../chunks/types-aju0qrRe.esm.js';
|
|
5
5
|
import './redeem-transaction.js';
|
|
6
6
|
import './impact-overview.js';
|
|
7
|
-
import { T as TCart } from '../chunks/cart-contents-
|
|
7
|
+
import { T as TCart } from '../chunks/cart-contents-CMm57qu0.esm.js';
|
|
8
8
|
import 'lodash';
|
|
9
9
|
import '../chunks/progress-bar-0VS_AmEf.esm.js';
|
|
10
10
|
import '../chunks/promo-pill-label-3bA1z-la.esm.js';
|
|
11
11
|
import './beam-partner-logos.js';
|
|
12
12
|
import '../chunks/types-zbTZ8-KP.esm.js';
|
|
13
|
-
import '../chunks/openapi-spec
|
|
13
|
+
import '../chunks/openapi-spec-hjdK2L9Q.esm.js';
|
|
14
14
|
import '../chunks/share-button-hDn8fnBI.esm.js';
|
|
15
15
|
|
|
16
16
|
declare class BeamPostPurchase extends LitElement {
|
|
@@ -141,7 +141,7 @@ declare class BeamPostPurchase extends LitElement {
|
|
|
141
141
|
} | undefined;
|
|
142
142
|
}>;
|
|
143
143
|
private transactionDataController;
|
|
144
|
-
render(): lit_html.TemplateResult<1
|
|
144
|
+
render(): "" | lit_html.TemplateResult<1>;
|
|
145
145
|
static styles: lit.CSSResult[];
|
|
146
146
|
}
|
|
147
147
|
declare global {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as o,t as s,h as I,y as l}from"../chunks/lit-iNN5L_Qk.esm.js";import{M as y}from"../chunks/beam-errors-P-Lu07Ce.esm.js";import{deleteCookieValue as g,getCookieValue as u}from"../utils/cookies.esm.js";import{c as f,d as C,e as v}from"../chunks/enforce-config-ZAI7WYAd.esm.js";import{createScopedLocalStorage as b}from"../utils/local-storage.esm.js";import{A as $,_ as S}from"../chunks/localize-o-cYvHQf.esm.js";import{D as U,p as w}from"../chunks/routes-
|
|
1
|
+
import{g as o,t as s,h as I,y as l}from"../chunks/lit-iNN5L_Qk.esm.js";import{M as y}from"../chunks/beam-errors-P-Lu07Ce.esm.js";import{deleteCookieValue as g,getCookieValue as u}from"../utils/cookies.esm.js";import{c as f,d as C,e as v}from"../chunks/enforce-config-ZAI7WYAd.esm.js";import{createScopedLocalStorage as b}from"../utils/local-storage.esm.js";import{A as $,_ as S}from"../chunks/localize-o-cYvHQf.esm.js";import{D as U,p as w}from"../chunks/routes-Jhhqcsg7.esm.js";import"./redeem-transaction.esm.js";import"./impact-overview.esm.js";import{B as h}from"../chunks/cart-contents-h60geKWa.esm.js";import{a as T}from"../chunks/events-6Z5MkCRr.esm.js";import"../utils/logger.esm.js";import"../chunks/lodash-P8OIs-at.esm.js";import"../chunks/progress-bar-PMU_xI3L.esm.js";import"../chunks/promo-pill-label-P1X4xeAx.esm.js";import"../chunks/vendor-GKiOHg2N.esm.js";import"./beam-partner-logos.esm.js";import"../chunks/loading-template-t4fFsYtr.esm.js";import"../chunks/css-card-grid-nEc--M5M.esm.js";import"../chunks/shoelace-components-Jghvahj3.esm.js";import"../chunks/share-button-DeVQh1aE.esm.js";import"../chunks/is-all-html-elements-SdSkxirh.esm.js";import"../chunks/share-button-SNvuFDC9.esm.js";import"../chunks/responsive-2lC2Wrtg.esm.js";var A=Object.defineProperty,B=Object.getOwnPropertyDescriptor,e=(d,r,i,n)=>{for(var a=n>1?void 0:n?B(r,i):r,p=d.length-1,c;p>=0;p--)(c=d[p])&&(a=(n?c(r,i,a):c(a))||a);return n&&a&&A(r,i,a),a};const m=["baseUrl","apiKey","orderId","cartTotal","currencyCode","lang"],D=["storeId","postalCode","countryCode","cart","discountCodes","email","partnerUserId"];class t extends I{constructor(){super(...arguments),this.baseUrl=U,this.currencyCode="USD",this.lang="en",this.debug=!1,this.activeWidget=null,this.nonprofitId=null,this.selectionId=null,this.cartId=null,this.beamCartId=null,this.userId=null,this.transactionId=null,this.draftConfig=!1,this.localStorage=b(this),this.handlePostTransaction=async()=>{this.enforceConfig();const r=await w({baseUrl:this.baseUrl,headers:{authorization:`Api-Key ${this.apiKey}`},requestBody:{nonprofitId:this.nonprofitId||void 0,selectionId:this.selectionId||void 0,cartId:this.cartId||void 0,beamCartId:this.beamCartId||void 0,storeId:this.storeId,orderId:this.orderId,cartTotal:this.cartTotal,email:this.email,partnerUserId:this.partnerUserId,currencyCode:this.currencyCode,postalCode:this.postalCode,countryCode:this.countryCode,cart:this.cart,discountCodes:this.discountCodes}});return this.transactionId=r.transactionId,this.userId=r.beamUserId,this.nonprofitId=r.nonprofitId,this.activeWidget=this.nonprofitId?"impact-overview":"redeem-transaction",this.localStorage.removeItem("transaction"),this.localStorage.removeItem("cart"),g({name:h,path:"/",domain:this.domain}),r.transactionCreated&&dispatchEvent(new T({transactionId:r.transactionId,orderId:this.orderId,cartTotal:this.cartTotal,currencyCode:this.currencyCode})),r},this.transactionDataController=new $(this,this.handlePostTransaction)}firstUpdated(r){this.enforceConfig(),this.nonprofitId=Number(this.localStorage.getItem("nonprofit"))||null,this.selectionId=this.localStorage.getItem("transaction")||null,this.cartId=this.localStorage.getItemJson("cart")?.cartId||null,this.beamCartId=u(h)||null,this.selectionId&&this.nonprofitId&&(this.activeWidget="impact-overview")}async updated(r){[...m,...D].some(i=>r.has(i))&&await this.transactionDataController.exec()}enforceConfig(){if(v(m,this),!this.email&&!this.partnerUserId)throw new y([this.email?"":"email",this.partnerUserId?"":"partnerUserId"].filter(Boolean),"At least one of [email, partnerUserId] must be provided")}render(){return this.transactionDataController.loading?"":this.transactionDataController.error?this.debug?S({error:this.transactionDataController.error}):"":this.activeWidget==="redeem-transaction"?l`
|
|
2
2
|
<beam-redeem-transaction
|
|
3
3
|
part="redeem-transaction"
|
|
4
4
|
baseUrl="${this.baseUrl}"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as o,t as s,h as I,y as l}from"../chunks/lit-iNN5L_Qk.esm.js";import{M as y}from"../chunks/beam-errors-P-Lu07Ce.esm.js";import{deleteCookieValue as g,getCookieValue as u}from"../utils/cookies.js";import{c as f,d as C,e as v}from"../chunks/enforce-config-ZyPq_4CF.esm.js";import{createScopedLocalStorage as b}from"../utils/local-storage.js";import{A as $,_ as S}from"../chunks/localize-m-_ESmpk.esm.js";import{D as U,p as w}from"../chunks/routes-
|
|
1
|
+
import{g as o,t as s,h as I,y as l}from"../chunks/lit-iNN5L_Qk.esm.js";import{M as y}from"../chunks/beam-errors-P-Lu07Ce.esm.js";import{deleteCookieValue as g,getCookieValue as u}from"../utils/cookies.js";import{c as f,d as C,e as v}from"../chunks/enforce-config-ZyPq_4CF.esm.js";import{createScopedLocalStorage as b}from"../utils/local-storage.js";import{A as $,_ as S}from"../chunks/localize-m-_ESmpk.esm.js";import{D as U,p as w}from"../chunks/routes-tB5fHy2T.esm.js";import"./redeem-transaction.js";import"./impact-overview.js";import{B as h}from"../chunks/cart-contents-h60geKWa.esm.js";import{a as T}from"../chunks/events-6Z5MkCRr.esm.js";import"../utils/logger.js";import"../chunks/lodash-P8OIs-at.esm.js";import"../chunks/progress-bar-PMU_xI3L.esm.js";import"../chunks/promo-pill-label-P1X4xeAx.esm.js";import"../chunks/vendor-GKiOHg2N.esm.js";import"./beam-partner-logos.js";import"../chunks/loading-template-t4fFsYtr.esm.js";import"../chunks/css-card-grid-nEc--M5M.esm.js";import"../chunks/shoelace-components-JZANE20x.esm.js";import"../chunks/share-button-bUM2WBaV.esm.js";import"../chunks/is-all-html-elements-SdSkxirh.esm.js";import"../chunks/share-button-SNvuFDC9.esm.js";import"../chunks/responsive-2lC2Wrtg.esm.js";var A=Object.defineProperty,B=Object.getOwnPropertyDescriptor,e=(d,r,i,n)=>{for(var a=n>1?void 0:n?B(r,i):r,p=d.length-1,c;p>=0;p--)(c=d[p])&&(a=(n?c(r,i,a):c(a))||a);return n&&a&&A(r,i,a),a};const m=["baseUrl","apiKey","orderId","cartTotal","currencyCode","lang"],D=["storeId","postalCode","countryCode","cart","discountCodes","email","partnerUserId"];class t extends I{constructor(){super(...arguments),this.baseUrl=U,this.currencyCode="USD",this.lang="en",this.debug=!1,this.activeWidget=null,this.nonprofitId=null,this.selectionId=null,this.cartId=null,this.beamCartId=null,this.userId=null,this.transactionId=null,this.draftConfig=!1,this.localStorage=b(this),this.handlePostTransaction=async()=>{this.enforceConfig();const r=await w({baseUrl:this.baseUrl,headers:{authorization:`Api-Key ${this.apiKey}`},requestBody:{nonprofitId:this.nonprofitId||void 0,selectionId:this.selectionId||void 0,cartId:this.cartId||void 0,beamCartId:this.beamCartId||void 0,storeId:this.storeId,orderId:this.orderId,cartTotal:this.cartTotal,email:this.email,partnerUserId:this.partnerUserId,currencyCode:this.currencyCode,postalCode:this.postalCode,countryCode:this.countryCode,cart:this.cart,discountCodes:this.discountCodes}});return this.transactionId=r.transactionId,this.userId=r.beamUserId,this.nonprofitId=r.nonprofitId,this.activeWidget=this.nonprofitId?"impact-overview":"redeem-transaction",this.localStorage.removeItem("transaction"),this.localStorage.removeItem("cart"),g({name:h,path:"/",domain:this.domain}),r.transactionCreated&&dispatchEvent(new T({transactionId:r.transactionId,orderId:this.orderId,cartTotal:this.cartTotal,currencyCode:this.currencyCode})),r},this.transactionDataController=new $(this,this.handlePostTransaction)}firstUpdated(r){this.enforceConfig(),this.nonprofitId=Number(this.localStorage.getItem("nonprofit"))||null,this.selectionId=this.localStorage.getItem("transaction")||null,this.cartId=this.localStorage.getItemJson("cart")?.cartId||null,this.beamCartId=u(h)||null,this.selectionId&&this.nonprofitId&&(this.activeWidget="impact-overview")}async updated(r){[...m,...D].some(i=>r.has(i))&&await this.transactionDataController.exec()}enforceConfig(){if(v(m,this),!this.email&&!this.partnerUserId)throw new y([this.email?"":"email",this.partnerUserId?"":"partnerUserId"].filter(Boolean),"At least one of [email, partnerUserId] must be provided")}render(){return this.transactionDataController.loading?"":this.transactionDataController.error?this.debug?S({error:this.transactionDataController.error}):"":this.activeWidget==="redeem-transaction"?l`
|
|
2
2
|
<beam-redeem-transaction
|
|
3
3
|
part="redeem-transaction"
|
|
4
4
|
baseUrl="${this.baseUrl}"
|
|
@@ -72,7 +72,7 @@ declare class BeamProductDetailsPage extends LitElement {
|
|
|
72
72
|
}>;
|
|
73
73
|
private productDetailsPageDataController;
|
|
74
74
|
updated(changedProperties: Map<string, unknown>): Promise<void>;
|
|
75
|
-
render(): lit_html.TemplateResult<1
|
|
75
|
+
render(): "" | lit_html.TemplateResult<1>;
|
|
76
76
|
renderWidgetIcon(iconDisplay: string): lit_html.TemplateResult<1>;
|
|
77
77
|
renderContent(isPromoPillVisible: boolean, shouldDisplayColon: boolean, data: IAPIV3GetProductDetailsPage): lit_html.TemplateResult<1>;
|
|
78
78
|
renderCloseTooltipIcon(): lit_html.TemplateResult<1>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as v,y as i,f as y,g as n,h as x,k as C}from"../chunks/lit-iNN5L_Qk.esm.js";import{u as g,A as k,_ as w,i as f,d as u,a as $}from"../chunks/localize-o-cYvHQf.esm.js";import{D as S,l as T,W as I,S as F}from"../chunks/routes-
|
|
1
|
+
import{j as v,y as i,f as y,g as n,h as x,k as C}from"../chunks/lit-iNN5L_Qk.esm.js";import{u as g,A as k,_ as w,i as f,d as u,a as $}from"../chunks/localize-o-cYvHQf.esm.js";import{D as S,l as T,W as I,S as F}from"../chunks/routes-Jhhqcsg7.esm.js";import{makeApiKeyHeader as z}from"../utils/makeApiKeyHeader.esm.js";import{c as L,d as W,e as B}from"../chunks/enforce-config-ZAI7WYAd.esm.js";import{c as E}from"../chunks/responsive-2lC2Wrtg.esm.js";import"../chunks/vendor-GKiOHg2N.esm.js";import{p as G}from"../chunks/promo-pill-label-P1X4xeAx.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../utils/logger.esm.js";const A=(s="",{borderRadius:e="0px",borderStyle:o="unset",borderColor:t="#000000",borderWidth:r="1px"}={})=>{const a=s.startsWith("--beam-")?s:`--beam-${s}`;return{[`${a}-borderRadius`]:e,[`${a}-borderStyle`]:o,[`${a}-borderColor`]:t,[`${a}-borderWidth`]:r}},M=(s="",{borderRadius:e="0px",borderStyle:o="unset",borderColor:t="#000000",borderWidth:r="1px"}={})=>{const a=s.startsWith("--beam-")?s:`--beam-${s}`;return v(` border-radius: var(${a}-borderRadius, ${e});
|
|
2
2
|
border-style: var(${a}-borderStyle, ${o});
|
|
3
3
|
border-color: var(${a}-borderColor, ${t});
|
|
4
4
|
border-width: var(${a}-borderWidth, ${r});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as v,y as i,f as y,g as n,h as x,k as C}from"../chunks/lit-iNN5L_Qk.esm.js";import{u as g,A as k,_ as w,i as f,d as u,a as $}from"../chunks/localize-m-_ESmpk.esm.js";import{D as S,l as T,W as I,S as F}from"../chunks/routes-
|
|
1
|
+
import{j as v,y as i,f as y,g as n,h as x,k as C}from"../chunks/lit-iNN5L_Qk.esm.js";import{u as g,A as k,_ as w,i as f,d as u,a as $}from"../chunks/localize-m-_ESmpk.esm.js";import{D as S,l as T,W as I,S as F}from"../chunks/routes-tB5fHy2T.esm.js";import{makeApiKeyHeader as z}from"../utils/makeApiKeyHeader.js";import{c as L,d as W,e as B}from"../chunks/enforce-config-ZyPq_4CF.esm.js";import{c as E}from"../chunks/responsive-2lC2Wrtg.esm.js";import"../chunks/vendor-GKiOHg2N.esm.js";import{p as G}from"../chunks/promo-pill-label-P1X4xeAx.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../utils/logger.js";const A=(s="",{borderRadius:e="0px",borderStyle:o="unset",borderColor:t="#000000",borderWidth:r="1px"}={})=>{const a=s.startsWith("--beam-")?s:`--beam-${s}`;return{[`${a}-borderRadius`]:e,[`${a}-borderStyle`]:o,[`${a}-borderColor`]:t,[`${a}-borderWidth`]:r}},M=(s="",{borderRadius:e="0px",borderStyle:o="unset",borderColor:t="#000000",borderWidth:r="1px"}={})=>{const a=s.startsWith("--beam-")?s:`--beam-${s}`;return v(` border-radius: var(${a}-borderRadius, ${e});
|
|
2
2
|
border-style: var(${a}-borderStyle, ${o});
|
|
3
3
|
border-color: var(${a}-borderColor, ${t});
|
|
4
4
|
border-width: var(${a}-borderWidth, ${r});
|
|
@@ -6,9 +6,9 @@ import '../chunks/progress-bar-0VS_AmEf.esm.js';
|
|
|
6
6
|
import '../chunks/promo-pill-label-3bA1z-la.esm.js';
|
|
7
7
|
import './beam-partner-logos.js';
|
|
8
8
|
import { T as TNumericId, a as TId } from '../chunks/types-zbTZ8-KP.esm.js';
|
|
9
|
-
import { T as TCart } from '../chunks/cart-contents-
|
|
9
|
+
import { T as TCart } from '../chunks/cart-contents-CMm57qu0.esm.js';
|
|
10
10
|
import { L as LANGUAGES } from '../chunks/types-aju0qrRe.esm.js';
|
|
11
|
-
import '../chunks/openapi-spec
|
|
11
|
+
import '../chunks/openapi-spec-hjdK2L9Q.esm.js';
|
|
12
12
|
|
|
13
13
|
interface TransactionRequiredConfig {
|
|
14
14
|
apiKey: string;
|
|
@@ -82,7 +82,7 @@ declare class BeamRedeemTransaction extends LitElement {
|
|
|
82
82
|
private renderProgressBar;
|
|
83
83
|
private renderNonprofitDetails;
|
|
84
84
|
private renderPromoPill;
|
|
85
|
-
protected render(): lit_html.TemplateResult<1
|
|
85
|
+
protected render(): "" | lit_html.TemplateResult<1>;
|
|
86
86
|
}
|
|
87
87
|
declare global {
|
|
88
88
|
interface HTMLElementTagNameMap {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{y as a,m as k,f as $,g as c,t as v,h as I,u as C,k as P,q as D}from"../chunks/lit-iNN5L_Qk.esm.js";import{d as N}from"../chunks/lodash-P8OIs-at.esm.js";import{u as h,A as y,d as f,a as L,i as m,_ as x}from"../chunks/localize-o-cYvHQf.esm.js";import{D as z,f as U,W as B,j as M,u as E,S as W}from"../chunks/routes-
|
|
1
|
+
import{y as a,m as k,f as $,g as c,t as v,h as I,u as C,k as P,q as D}from"../chunks/lit-iNN5L_Qk.esm.js";import{d as N}from"../chunks/lodash-P8OIs-at.esm.js";import{u as h,A as y,d as f,a as L,i as m,_ as x}from"../chunks/localize-o-cYvHQf.esm.js";import{D as z,f as U,W as B,j as M,u as E,S as W}from"../chunks/routes-Jhhqcsg7.esm.js";import{p as A}from"../chunks/progress-bar-PMU_xI3L.esm.js";import{p as F}from"../chunks/promo-pill-label-P1X4xeAx.esm.js";import{partnerLogosConfigDefaults as j}from"./beam-partner-logos.esm.js";import{c as K,d as _,a as O,e as R,b as w}from"../chunks/enforce-config-ZAI7WYAd.esm.js";import{_ as V}from"../chunks/loading-template-t4fFsYtr.esm.js";import{M as H,B as q}from"../chunks/beam-errors-P-Lu07Ce.esm.js";import{createScopedLocalStorage as G}from"../utils/local-storage.esm.js";import{c as J}from"../chunks/css-card-grid-nEc--M5M.esm.js";import{b as Z}from"../chunks/events-6Z5MkCRr.esm.js";import"../utils/logger.esm.js";import"../chunks/vendor-GKiOHg2N.esm.js";const Q=({height:n="1em",width:e="1em"}={})=>a`
|
|
2
2
|
<svg
|
|
3
3
|
style="${k({height:n,width:e,position:"relative",bottom:"0"})}"
|
|
4
4
|
xmlns="http://www.w3.org/2000/svg"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{y as a,m as k,f as $,g as c,t as v,h as I,u as C,k as P,q as D}from"../chunks/lit-iNN5L_Qk.esm.js";import{d as N}from"../chunks/lodash-P8OIs-at.esm.js";import{u as h,A as y,d as f,a as L,i as m,_ as x}from"../chunks/localize-m-_ESmpk.esm.js";import{D as z,f as U,W as B,j as M,u as E,S as W}from"../chunks/routes-
|
|
1
|
+
import{y as a,m as k,f as $,g as c,t as v,h as I,u as C,k as P,q as D}from"../chunks/lit-iNN5L_Qk.esm.js";import{d as N}from"../chunks/lodash-P8OIs-at.esm.js";import{u as h,A as y,d as f,a as L,i as m,_ as x}from"../chunks/localize-m-_ESmpk.esm.js";import{D as z,f as U,W as B,j as M,u as E,S as W}from"../chunks/routes-tB5fHy2T.esm.js";import{p as A}from"../chunks/progress-bar-PMU_xI3L.esm.js";import{p as F}from"../chunks/promo-pill-label-P1X4xeAx.esm.js";import{partnerLogosConfigDefaults as j}from"./beam-partner-logos.js";import{c as K,d as _,a as O,e as R,b as w}from"../chunks/enforce-config-ZyPq_4CF.esm.js";import{_ as V}from"../chunks/loading-template-t4fFsYtr.esm.js";import{M as H,B as q}from"../chunks/beam-errors-P-Lu07Ce.esm.js";import{createScopedLocalStorage as G}from"../utils/local-storage.js";import{c as J}from"../chunks/css-card-grid-nEc--M5M.esm.js";import{b as Z}from"../chunks/events-6Z5MkCRr.esm.js";import"../utils/logger.js";import"../chunks/vendor-GKiOHg2N.esm.js";const Q=({height:n="1em",width:e="1em"}={})=>a`
|
|
2
2
|
<svg
|
|
3
3
|
style="${k({height:n,width:e,position:"relative",bottom:"0"})}"
|
|
4
4
|
xmlns="http://www.w3.org/2000/svg"
|
|
@@ -6,8 +6,8 @@ import '../chunks/progress-bar-0VS_AmEf.esm.js';
|
|
|
6
6
|
import '../chunks/promo-pill-label-3bA1z-la.esm.js';
|
|
7
7
|
import { T as TNumericId } from '../chunks/types-zbTZ8-KP.esm.js';
|
|
8
8
|
import { L as LANGUAGES } from '../chunks/types-aju0qrRe.esm.js';
|
|
9
|
-
import { T as TCart } from '../chunks/cart-contents-
|
|
10
|
-
import '../chunks/openapi-spec
|
|
9
|
+
import { T as TCart } from '../chunks/cart-contents-CMm57qu0.esm.js';
|
|
10
|
+
import '../chunks/openapi-spec-hjdK2L9Q.esm.js';
|
|
11
11
|
|
|
12
12
|
declare class BeamNotificationBlip extends LitElement {
|
|
13
13
|
static get styles(): lit.CSSResult;
|
|
@@ -47,9 +47,9 @@ declare class BeamSelectNonprofit extends LitElement {
|
|
|
47
47
|
private localStorage;
|
|
48
48
|
private getNonprofitById;
|
|
49
49
|
private handleCartChange;
|
|
50
|
-
connectedCallback(): void
|
|
51
|
-
firstUpdated(
|
|
52
|
-
updated(
|
|
50
|
+
connectedCallback(): Promise<void>;
|
|
51
|
+
firstUpdated(): Promise<void>;
|
|
52
|
+
updated(changedProperties: PropertyValues): Promise<void>;
|
|
53
53
|
disconnectedCallback(): void;
|
|
54
54
|
private restoreStateFromCache;
|
|
55
55
|
private createNewSelectionForCachedNonprofit;
|
|
@@ -71,7 +71,7 @@ declare class BeamSelectNonprofit extends LitElement {
|
|
|
71
71
|
evaluateBreakPoints: lodash.DebouncedFuncLeading<() => void>;
|
|
72
72
|
get cssVariables(): any;
|
|
73
73
|
static styles: lit.CSSResult[];
|
|
74
|
-
protected render(): lit_html.TemplateResult<1
|
|
74
|
+
protected render(): "" | lit_html.TemplateResult<1>;
|
|
75
75
|
}
|
|
76
76
|
declare global {
|
|
77
77
|
interface HTMLElementTagNameMap {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{h as x,f as w,y as c,g as f,t as E,q as T,m as M,k as B}from"../chunks/lit-iNN5L_Qk.esm.js";import{d as F,i as W}from"../chunks/lodash-P8OIs-at.esm.js";import{u as h,A as I,d as b,a as _,_ as k,i as p}from"../chunks/localize-o-cYvHQf.esm.js";import{D as U,f as K,W as N,i as O,S as R}from"../chunks/routes-
|
|
1
|
+
import{h as x,f as w,y as c,g as f,t as E,q as T,m as M,k as B}from"../chunks/lit-iNN5L_Qk.esm.js";import{d as F,i as W}from"../chunks/lodash-P8OIs-at.esm.js";import{u as h,A as I,d as b,a as _,_ as k,i as p}from"../chunks/localize-o-cYvHQf.esm.js";import{D as U,f as K,W as N,i as O,S as R}from"../chunks/routes-Jhhqcsg7.esm.js";import{p as j}from"../chunks/progress-bar-PMU_xI3L.esm.js";import{p as H}from"../chunks/promo-pill-label-P1X4xeAx.esm.js";import{c as q,d as G,e as v}from"../chunks/enforce-config-ZAI7WYAd.esm.js";import{_ as V}from"../chunks/loading-template-t4fFsYtr.esm.js";import{b as $,g as J,d as P}from"../chunks/events-6Z5MkCRr.esm.js";import{logger as Q}from"../utils/logger.esm.js";import{createScopedLocalStorage as X}from"../utils/local-storage.esm.js";import{c as Y}from"../chunks/responsive-2lC2Wrtg.esm.js";import{B as Z}from"../chunks/cart-contents-h60geKWa.esm.js";import{getExternalCartId as ee,getBeamCartId as te}from"../utils/cart.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../chunks/vendor-GKiOHg2N.esm.js";import"../utils/cookies.esm.js";class oe extends x{static get styles(){return w`
|
|
2
2
|
:host {
|
|
3
3
|
}
|
|
4
4
|
|
|
@@ -18,10 +18,10 @@ import{h as x,f as w,y as c,g as f,t as E,q as T,m as M,k as B}from"../chunks/li
|
|
|
18
18
|
aria-label="Notification Blip"
|
|
19
19
|
>
|
|
20
20
|
<span class="notification-blip" part="notification-blip" role="button" tabindex="0" aria-hidden="true"></span>
|
|
21
|
-
</div>`}}customElements.get("beam-notification-blip")||customElements.define("beam-notification-blip",oe);const ie={"--beam-notificationBlip-color-background":"#000"},m={en:{beamAttribution:()=>"Powered by Beam",ctaTitle:()=>"Choose your impact",ctaPromoPrefixMessage:()=>"At no extra cost,",ctaPromoMessage:({donationPercentage:n="1"}={})=>`select a nonprofit and ${n}% of your purchase will be donated.`,ctaMessage:({donationPercentage:n="1"}={})=>`At no extra cost, select a nonprofit and ${n}% of your purchase will be donated.`,inlineSeparator:()=>": "},fr:{beamAttribution:()=>"Optimis\xE9 par Beam",ctaTitle:()=>"Choisissez votre cause",ctaPromoPrefixMessage:()=>"",ctaPromoMessage:()=>"",ctaMessage:({donationPercentage:n="1"}={})=>`Sans frais suppl\xE9mentaires, choisissez un organisme \xE0 but non lucratif et ${n} % lui sera vers\xE9 en votre nom.`,inlineSeparator:()=>" : "},de:{beamAttribution:()=>"Unterst\xFCtzt von Beam",ctaTitle:()=>"W\xE4hle deinen Impact",ctaPromoPrefixMessage:()=>"",ctaPromoMessage:()=>"",ctaMessage:({donationPercentage:n="1"}={})=>`Ohne zus\xE4tzliche Kosten, w\xE4hle eine der gemeinn\xFCtzigen Organisationen und spende ${n}% deines Einkaufs`,inlineSeparator:()=>": "},es:{beamAttribution:()=>"Ofrecido por Beam",ctaTitle:()=>"Elige tu contribuci\xF3n",ctaPromoPrefixMessage:()=>"",ctaPromoMessage:()=>"",ctaMessage:({donationPercentage:n="1"}={})=>`Sin coste adicional, elige una organizaci\xF3n sin fines de lucro y donaremos ${n}% de tu compra.`,inlineSeparator:()=>": "},it:{beamAttribution:()=>"Gestito da Beam",ctaTitle:()=>"Scegli dove fare la differenza",ctaPromoPrefixMessage:()=>"",ctaPromoMessage:()=>"",ctaMessage:({donationPercentage:n="1"}={})=>`Senza costi aggiuntivi, seleziona un'organizzazione no-profit a cui devolvere l\u2019${n}% del tuo acquisto`,inlineSeparator:()=>": "},pl:{beamAttribution:()=>"Wspierany przez Beam",ctaTitle:()=>"Wybierz inicjatyw\u0119, kt\xF3r\u0105 chcesz wesprze\u0107",ctaPromoPrefixMessage:()=>"",ctaPromoMessage:()=>"",ctaMessage:({donationPercentage:n="1"}={})=>`Bez \u017Cadnych dodatkowych koszt\xF3w wybierz organizacj\u0119, kt\xF3rej przeka\u017Cesz ${n}% warto\u015Bci Twoich zakup\xF3w!`,inlineSeparator:()=>": "}};var ne=Object.defineProperty,ae=Object.getOwnPropertyDescriptor,d=(n,t,e,i)=>{for(var o=i>1?void 0:i?ae(t,e):t,a=n.length-1,r;a>=0;a--)(r=n[a])&&(o=(i?r(t,e,o):r(o))||o);return i&&o&&ne(t,e,o),o};class l extends x{constructor(){super(...arguments),this.baseUrl=U,this.selectedNonprofitId=null,this.lang="en",this.debug=!1,this.draftConfig=!1,this.isMobile=window.innerWidth<768,this.enableNonprofitDeselection=!1,this.didTryToCreateNewSelectionFromCache=!1,this.getChainNonprofits=async()=>{y(["apiKey"],this);const t=this.cart?.content?{schema:this.cart?.schema,content:this.cart?.content}:void 0,e=await K({baseUrl:this.baseUrl,apiRoot:"/api/v3",headers:{authorization:`Api-Key ${this.apiKey}`},requestBody:{storeId:this.storeId,widgetName:N.select_nonprofit,postalCode:this.postalCode,countryCode:this.countryCode,version:"1.0.0",lang:this.configLang,options:{config:{draftConfig:this.draftConfig}},cart:t}});return this.enableNonprofitDeselection=!!e.config.enableNonprofitDeselection,this.selectedNonprofitId!==null&&this.selectedNonprofitId&&!e.nonprofits.map(i=>i.nonprofit.id).includes(this.selectedNonprofitId)&&(this.selectedNonprofitId=null,await this.postSelectNonprofit({selectedNonprofitId:null}),this.localStorage.setItem("nonprofit",null)),e.store?.id&&e.store.id!==this.storeId&&(this.storeId=e.store.id),await this.createNewSelectionForCachedNonprofit(),this.localStorage.setItemJson("chainNonprofits",{createdAt:new Date,data:e}),e},this.postSelectNonprofit=async({selectedNonprofitId:t})=>{y(["apiKey","storeId"],this);const e=ee("cart",{apiKey:this.apiKey}),i=te(Z,{apiKey:this.apiKey}),o=await O({baseUrl:this.baseUrl,headers:{authorization:`Api-Key ${this.apiKey}`},requestBody:{nonprofitId:t,selectionId:this.selectionId,storeId:this.storeId,cartId:e||void 0,beamCartId:i||void 0,postalCode:this.postalCode,countryCode:this.countryCode}});this.selectionId=o?.selectionId,this.localStorage.setItem("transaction",this.selectionId),this.localStorage.setItem("nonprofit",t),this.localStorage.setItem("nonprofit_selected_at",new Date().toISOString()),await this.updateComplete;const a=this.getNonprofitById(t);t!==null&&this.dispatchEvent(new $({selectedNonprofitId:t,selectionId:this.selectionId,nonprofitName:a?.nonprofit?.name??null,source:N.select_nonprofit})),t===null&&this.dispatchEvent(new J({newNonprofitId:null,selectionId:this.selectionId}))},this.nonprofitListDataController=new I(this,this.getChainNonprofits),this.selectionDataController=new I(this,this.postSelectNonprofit),this.localStorage=X(this),this.handleCartChange=t=>{this.cart=t.detail},this.makeHandleSelect=(t,e,i)=>async o=>{const a=this.selectedNonprofitId;if(o instanceof KeyboardEvent){let r=null;switch(o.key){case"ArrowUp":case"ArrowLeft":e===0?r=i[i.length-1]:r=i[e-1],o.preventDefault();break;case"ArrowRight":case"ArrowDown":e===i.length-1?r=i[0]:r=i[e+1],o.preventDefault();break;case"Enter":case" ":o.preventDefault();break;default:return}if(r){a!=null&&(this.selectedNonprofitId=r.nonprofit.id);const g=this.renderRoot.querySelector(`[data-value="${r.nonprofit.id}"]`);g!==null&&(g.tabIndex=0,g.focus());return}}if(o.currentTarget instanceof HTMLElement)if(a===t)if(this.enableNonprofitDeselection)this.selectedNonprofitId=null,this.localStorage.setItem("nonprofit",null);else return;else this.selectedNonprofitId=t;await this.selectionDataController.exec({selectedNonprofitId:this.selectedNonprofitId})},this.evaluateBreakPoints=F(()=>{this.isMobile=window.innerWidth<768},50,{maxWait:50,leading:!0})}get configLang(){return R[this.lang]||"en"}getNonprofitById(t){return t?this.nonprofitListDataController?.data?.nonprofits.find(e=>e.nonprofit.id===t):null}connectedCallback(){super.connectedCallback(),window.addEventListener(P.eventName,this.handleCartChange),window.addEventListener("resize",this.evaluateBreakPoints)}async firstUpdated(t){await this.restoreStateFromCache()}async updated(t){const e=["baseUrl","storeId","apiKey","countryCode","postalCode","cart","lang"];for(const i of e)if(t.has(i)){await this.nonprofitListDataController.exec();break}}disconnectedCallback(){window.removeEventListener(P.eventName,this.handleCartChange),super.disconnectedCallback()}async restoreStateFromCache(){try{const t=new Date().valueOf();this.cart=this.localStorage.getItemJson("cart")??void 0;const e=30*24*60*60*1e3,i=this.localStorage.getItem("nonprofit_selected_at")??0,o=t>new Date(i).valueOf()+e;o?o&&this.selectedNonprofitId!==null&&(await this.postSelectNonprofit({selectedNonprofitId:null}),this.localStorage.setItem("nonprofit",null)):(this.selectedNonprofitId=parseInt(this.localStorage.getItem("nonprofit")||"")||null,this.selectionId=this.localStorage.getItem("transaction")??void 0);const{createdAt:a=0,data:r}=this.localStorage.getItemJson("chainNonprofits")||{},g=2*60*60*1e3;t>new Date(a).valueOf()+g||(this.nonprofitListDataController.data=r,this.nonprofitListDataController.loading=!1)}catch(t){Q.error(t)}}async createNewSelectionForCachedNonprofit(){if(y(["apiKey"],this),!(!this.storeId||this.didTryToCreateNewSelectionFromCache))try{if(this.didTryToCreateNewSelectionFromCache=!0,this.selectedNonprofitId){this.selectionId||await this.selectionDataController.exec({selectedNonprofitId:this.selectedNonprofitId});const t=this.getNonprofitById(this.selectedNonprofitId);this.dispatchEvent(new $({selectedNonprofitId:this.selectedNonprofitId,selectionId:this.selectionId,nonprofitName:t?.nonprofit?.name,source:N.select_nonprofit}))}}catch{}}get cssVariables(){const t={"--beam-fontFamily":"inherit","--beam-fontStyle":"inherit","--beam-fontSize":"inherit","--beam-textColor":"inherit","--beam-backgroundColor":"inherit",...j,"--beam-SelectNonprofit-title-textAlign":"inherit","--beam-SelectNonprofit-description-textAlign":"inherit","--beam-SelectNonprofit-maxWidth":"800px","--beam-SelectNonprofit-options-marginTop":"0px","--beam-SelectNonprofit-options-iconHeight":"24px","--beam-SelectNonprofit-options-padding":"10px","--beam-SelectNonprofit-options-borderRadius":"0px","--beam-SelectNonprofit-options-borderColor":"currentColor","--beam-SelectNonprofit-options--selected-borderColor":"currentColor","--beam-SelectNonprofit-options-backgroundColor":"transparent","--beam-SelectNonprofit-options-gap":"8px","--beam-SelectNonprofit-options--selected-backgroundColor":"currentColor","--beam-SelectNonprofit-details-marginTop":"10px","--beam-SelectNonprofit-details-borderRadius":"0px","--beam-SelectNonprofit-details-borderColor":"currentColor","--beam-SelectNonprofit-details-backgroundColor":"inherit","--beam-SelectNonprofit-details-padding":"10px",...b("--beam-SelectNonprofit-title",{fontSize:"1.25em",fontWeight:"bold"}),"--beam-SelectNonprofit-header-inline-lineHeight":"inherit",...b("--beam-SelectNonprofit-title-inline",{fontWeight:"bold"}),"--beam-SelectNonprofit-title-inline-textTransform":"none","--beam-SelectNonprofit-title-block-margin-right":"8px",...b("--beam-SelectNonprofit-description",{marginTop:"0.5em"}),...b("--beam-SelectNonprofit-description-inline"),...b("--beam-SelectNonprofit-details-cause",{fontSize:"0.85em",fontWeight:"bold"}),...b("--beam-SelectNonprofit-details-beamAttribution",{fontSize:"0.85em"}),...b("--beam-SelectNonprofit-details-impactDescription",{fontSize:"1em",marginTop:"10px"}),"--beam-SelectNonprofit-details-nonprofitName-fontWeight":"bold","--beam-SelectNonprofit-details-nonprofitName-fontStyle":"inherit","--beam-SelectNonprofit-details-fundingProgress-marginTop":"10px",...b("--beam-SelectNonprofit-details-fundingProgressLabel",{fontSize:"0.85em"}),...ie,...H,"--beam-SelectNonprofit-promo-block-header-justifyContent":"initial","--beam-SelectNonprofit-notification-blip-top":"4px","--beam-SelectNonprofit-notification-blip-left":"50%"},e=this.nonprofitListDataController?.data?.config?.web?.theme||{},i={...t,...e};return Object.assign(Object.create({toCSS(){return _(this)}}),i)}render(){const{selectedNonprofitId:t}=this,{data:e,loading:i}=this.nonprofitListDataController;if(i&&!e)return V();if(this.nonprofitListDataController.error)return this.debug?k({error:this.nonprofitListDataController.error}):"";if(this.selectionDataController.error&&this.debug)return k({error:this.selectionDataController.error});const o=e?.nonprofits||[],a=o.find(s=>s.nonprofit.id===t)||null,r=!!e?.config?.web?.promo,g=o.some(s=>!s.promo||!s.promo.isActive),v=this.cssVariables["--beam-SelectNonprofit-title-textAlign"]==="center",C=c`<h3 class="title-block d-none d-lg-block" part="title" id="beam-SelectNonprofit-title">
|
|
21
|
+
</div>`}}customElements.get("beam-notification-blip")||customElements.define("beam-notification-blip",oe);const ie={"--beam-notificationBlip-color-background":"#000"},m={en:{beamAttribution:()=>"Powered by Beam",ctaTitle:()=>"Choose your impact",ctaPromoPrefixMessage:()=>"At no extra cost,",ctaPromoMessage:({donationPercentage:n="1"}={})=>`select a nonprofit and ${n}% of your purchase will be donated.`,ctaMessage:({donationPercentage:n="1"}={})=>`At no extra cost, select a nonprofit and ${n}% of your purchase will be donated.`,inlineSeparator:()=>": "},fr:{beamAttribution:()=>"Optimis\xE9 par Beam",ctaTitle:()=>"Choisissez votre cause",ctaPromoPrefixMessage:()=>"",ctaPromoMessage:()=>"",ctaMessage:({donationPercentage:n="1"}={})=>`Sans frais suppl\xE9mentaires, choisissez un organisme \xE0 but non lucratif et ${n} % lui sera vers\xE9 en votre nom.`,inlineSeparator:()=>" : "},de:{beamAttribution:()=>"Unterst\xFCtzt von Beam",ctaTitle:()=>"W\xE4hle deinen Impact",ctaPromoPrefixMessage:()=>"",ctaPromoMessage:()=>"",ctaMessage:({donationPercentage:n="1"}={})=>`Ohne zus\xE4tzliche Kosten, w\xE4hle eine der gemeinn\xFCtzigen Organisationen und spende ${n}% deines Einkaufs`,inlineSeparator:()=>": "},es:{beamAttribution:()=>"Ofrecido por Beam",ctaTitle:()=>"Elige tu contribuci\xF3n",ctaPromoPrefixMessage:()=>"",ctaPromoMessage:()=>"",ctaMessage:({donationPercentage:n="1"}={})=>`Sin coste adicional, elige una organizaci\xF3n sin fines de lucro y donaremos ${n}% de tu compra.`,inlineSeparator:()=>": "},it:{beamAttribution:()=>"Gestito da Beam",ctaTitle:()=>"Scegli dove fare la differenza",ctaPromoPrefixMessage:()=>"",ctaPromoMessage:()=>"",ctaMessage:({donationPercentage:n="1"}={})=>`Senza costi aggiuntivi, seleziona un'organizzazione no-profit a cui devolvere l\u2019${n}% del tuo acquisto`,inlineSeparator:()=>": "},pl:{beamAttribution:()=>"Wspierany przez Beam",ctaTitle:()=>"Wybierz inicjatyw\u0119, kt\xF3r\u0105 chcesz wesprze\u0107",ctaPromoPrefixMessage:()=>"",ctaPromoMessage:()=>"",ctaMessage:({donationPercentage:n="1"}={})=>`Bez \u017Cadnych dodatkowych koszt\xF3w wybierz organizacj\u0119, kt\xF3rej przeka\u017Cesz ${n}% warto\u015Bci Twoich zakup\xF3w!`,inlineSeparator:()=>": "}};var ne=Object.defineProperty,ae=Object.getOwnPropertyDescriptor,d=(n,t,e,i)=>{for(var o=i>1?void 0:i?ae(t,e):t,a=n.length-1,r;a>=0;a--)(r=n[a])&&(o=(i?r(t,e,o):r(o))||o);return i&&o&&ne(t,e,o),o};class l extends x{constructor(){super(...arguments),this.baseUrl=U,this.selectedNonprofitId=null,this.lang="en",this.debug=!1,this.draftConfig=!1,this.isMobile=window.innerWidth<768,this.enableNonprofitDeselection=!1,this.didTryToCreateNewSelectionFromCache=!1,this.getChainNonprofits=async()=>{v(["apiKey"],this);const t=this.cart?.content?{schema:this.cart?.schema,content:this.cart?.content}:void 0,e=await K({baseUrl:this.baseUrl,apiRoot:"/api/v3",headers:{authorization:`Api-Key ${this.apiKey}`},requestBody:{storeId:this.storeId,widgetName:N.select_nonprofit,postalCode:this.postalCode,countryCode:this.countryCode,version:"1.0.0",lang:this.configLang,options:{config:{draftConfig:this.draftConfig}},cart:t}});return this.enableNonprofitDeselection=!!e.config.enableNonprofitDeselection,this.selectedNonprofitId!==null&&this.selectedNonprofitId&&!e.nonprofits.map(i=>i.nonprofit.id).includes(this.selectedNonprofitId)&&(this.selectedNonprofitId=null,await this.postSelectNonprofit({selectedNonprofitId:null}),this.localStorage.setItem("nonprofit",null)),e.store?.id&&e.store.id!==this.storeId&&(this.storeId=e.store.id),await this.createNewSelectionForCachedNonprofit(),this.localStorage.setItemJson("chainNonprofits",{createdAt:new Date,data:e}),e},this.postSelectNonprofit=async({selectedNonprofitId:t})=>{v(["apiKey","storeId"],this);const e=ee("cart",{apiKey:this.apiKey}),i=te(Z,{apiKey:this.apiKey}),o=await O({baseUrl:this.baseUrl,headers:{authorization:`Api-Key ${this.apiKey}`},requestBody:{nonprofitId:t,selectionId:this.selectionId,storeId:this.storeId,cartId:e||void 0,beamCartId:i||void 0,postalCode:this.postalCode,countryCode:this.countryCode}});this.selectionId=o?.selectionId,this.localStorage.setItem("transaction",this.selectionId),this.localStorage.setItem("nonprofit",t),this.localStorage.setItem("nonprofit_selected_at",new Date().toISOString()),await this.updateComplete;const a=this.getNonprofitById(t);t!==null&&this.dispatchEvent(new $({selectedNonprofitId:t,selectionId:this.selectionId,nonprofitName:a?.nonprofit?.name??null,source:N.select_nonprofit})),t===null&&this.dispatchEvent(new J({newNonprofitId:null,selectionId:this.selectionId}))},this.nonprofitListDataController=new I(this,this.getChainNonprofits),this.selectionDataController=new I(this,this.postSelectNonprofit),this.localStorage=X(this),this.handleCartChange=t=>{this.cart=t.detail},this.makeHandleSelect=(t,e,i)=>async o=>{const a=this.selectedNonprofitId;if(o instanceof KeyboardEvent){let r=null;switch(o.key){case"ArrowUp":case"ArrowLeft":e===0?r=i[i.length-1]:r=i[e-1],o.preventDefault();break;case"ArrowRight":case"ArrowDown":e===i.length-1?r=i[0]:r=i[e+1],o.preventDefault();break;case"Enter":case" ":o.preventDefault();break;default:return}if(r){a!=null&&(this.selectedNonprofitId=r.nonprofit.id);const g=this.renderRoot.querySelector(`[data-value="${r.nonprofit.id}"]`);g!==null&&(g.tabIndex=0,g.focus());return}}if(o.currentTarget instanceof HTMLElement)if(a===t)if(this.enableNonprofitDeselection)this.selectedNonprofitId=null,this.localStorage.setItem("nonprofit",null);else return;else this.selectedNonprofitId=t;await this.selectionDataController.exec({selectedNonprofitId:this.selectedNonprofitId})},this.evaluateBreakPoints=F(()=>{this.isMobile=window.innerWidth<768},50,{maxWait:50,leading:!0})}get configLang(){return R[this.lang]||"en"}getNonprofitById(t){return t?this.nonprofitListDataController?.data?.nonprofits.find(e=>e.nonprofit.id===t):null}async connectedCallback(){super.connectedCallback(),this.nonprofitListDataController.loading=!0,window.addEventListener(P.eventName,this.handleCartChange),window.addEventListener("resize",this.evaluateBreakPoints)}async firstUpdated(){await this.restoreStateFromCache()}async updated(t){const e=["baseUrl","storeId","apiKey","countryCode","postalCode","cart","lang"];for(const i of e)if(t.has(i)){await this.nonprofitListDataController.exec();break}}disconnectedCallback(){window.removeEventListener(P.eventName,this.handleCartChange),window.removeEventListener("resize",this.evaluateBreakPoints),super.disconnectedCallback()}async restoreStateFromCache(){try{const t=new Date().valueOf();this.cart=this.localStorage.getItemJson("cart")??void 0;const e=30*24*60*60*1e3,i=this.localStorage.getItem("nonprofit_selected_at")??0,o=t>new Date(i).valueOf()+e;o?o&&this.selectedNonprofitId!==null&&(await this.postSelectNonprofit({selectedNonprofitId:null}),this.localStorage.setItem("nonprofit",null)):(this.selectedNonprofitId=parseInt(this.localStorage.getItem("nonprofit")||"")||null,this.selectionId=this.localStorage.getItem("transaction")??void 0);const{createdAt:a=0,data:r}=this.localStorage.getItemJson("chainNonprofits")||{},g=2*60*60*1e3;!(t>new Date(a).valueOf()+g)&&this.nonprofitListDataController.loading&&(this.nonprofitListDataController.data=r,this.nonprofitListDataController.loading=!1)}catch(t){Q.error(t)}}async createNewSelectionForCachedNonprofit(){if(v(["apiKey"],this),!(!this.storeId||this.didTryToCreateNewSelectionFromCache))try{if(this.didTryToCreateNewSelectionFromCache=!0,this.selectedNonprofitId){this.selectionId||await this.selectionDataController.exec({selectedNonprofitId:this.selectedNonprofitId});const t=this.getNonprofitById(this.selectedNonprofitId);this.dispatchEvent(new $({selectedNonprofitId:this.selectedNonprofitId,selectionId:this.selectionId,nonprofitName:t?.nonprofit?.name,source:N.select_nonprofit}))}}catch{}}get cssVariables(){const t={"--beam-fontFamily":"inherit","--beam-fontStyle":"inherit","--beam-fontSize":"inherit","--beam-textColor":"inherit","--beam-backgroundColor":"inherit",...j,"--beam-SelectNonprofit-title-textAlign":"inherit","--beam-SelectNonprofit-description-textAlign":"inherit","--beam-SelectNonprofit-maxWidth":"800px","--beam-SelectNonprofit-options-marginTop":"0px","--beam-SelectNonprofit-options-iconHeight":"24px","--beam-SelectNonprofit-options-padding":"10px","--beam-SelectNonprofit-options-borderRadius":"0px","--beam-SelectNonprofit-options-borderColor":"currentColor","--beam-SelectNonprofit-options--selected-borderColor":"currentColor","--beam-SelectNonprofit-options-backgroundColor":"transparent","--beam-SelectNonprofit-options-gap":"8px","--beam-SelectNonprofit-options--selected-backgroundColor":"currentColor","--beam-SelectNonprofit-details-marginTop":"10px","--beam-SelectNonprofit-details-borderRadius":"0px","--beam-SelectNonprofit-details-borderColor":"currentColor","--beam-SelectNonprofit-details-backgroundColor":"inherit","--beam-SelectNonprofit-details-padding":"10px",...b("--beam-SelectNonprofit-title",{fontSize:"1.25em",fontWeight:"bold"}),"--beam-SelectNonprofit-header-inline-lineHeight":"inherit",...b("--beam-SelectNonprofit-title-inline",{fontWeight:"bold"}),"--beam-SelectNonprofit-title-inline-textTransform":"none","--beam-SelectNonprofit-title-block-margin-right":"8px",...b("--beam-SelectNonprofit-description",{marginTop:"0.5em"}),...b("--beam-SelectNonprofit-description-inline"),...b("--beam-SelectNonprofit-details-cause",{fontSize:"0.85em",fontWeight:"bold"}),...b("--beam-SelectNonprofit-details-beamAttribution",{fontSize:"0.85em"}),...b("--beam-SelectNonprofit-details-impactDescription",{fontSize:"1em",marginTop:"10px"}),"--beam-SelectNonprofit-details-nonprofitName-fontWeight":"bold","--beam-SelectNonprofit-details-nonprofitName-fontStyle":"inherit","--beam-SelectNonprofit-details-fundingProgress-marginTop":"10px",...b("--beam-SelectNonprofit-details-fundingProgressLabel",{fontSize:"0.85em"}),...ie,...H,"--beam-SelectNonprofit-promo-block-header-justifyContent":"initial","--beam-SelectNonprofit-notification-blip-top":"4px","--beam-SelectNonprofit-notification-blip-left":"50%"},e=this.nonprofitListDataController?.data?.config?.web?.theme||{},i={...t,...e};return Object.assign(Object.create({toCSS(){return _(this)}}),i)}render(){const{selectedNonprofitId:t}=this,{data:e,loading:i}=this.nonprofitListDataController;if(i&&!e)return V();if(this.nonprofitListDataController.error)return this.debug?k({error:this.nonprofitListDataController.error}):"";if(this.selectionDataController.error&&this.debug)return k({error:this.selectionDataController.error});const o=e?.nonprofits||[],a=o.find(s=>s.nonprofit.id===t)||null,r=!!e?.config?.web?.promo,g=o.some(s=>!s.promo||!s.promo.isActive),y=this.cssVariables["--beam-SelectNonprofit-title-textAlign"]==="center",C=c`<h3 class="title-block d-none d-lg-block" part="title" id="beam-SelectNonprofit-title">
|
|
22
22
|
${p(this.configLang,e?.config?.web?.title||"")||m[this.configLang].ctaTitle()}
|
|
23
23
|
</h3>`,L=()=>r?c`<div
|
|
24
|
-
class="${this.isMobile?
|
|
24
|
+
class="${this.isMobile?y?"block-header-promo-pill-center-block-container-responsive":"block-header-promo-pill-container-responsive":y?"block-header-promo-pill-center-block-container-responsive":"block-header-promo-pill-container"}"
|
|
25
25
|
style="${this.isMobile?"display: flex":""}"
|
|
26
26
|
>
|
|
27
27
|
${C}
|