@beamimpact/web-sdk 1.57.2 → 1.57.4
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/README.md +66 -42
- package/dist/chunks/{_share-dialog-dependencies-DFXGKz-z.esm.js → _share-dialog-dependencies-BvaXft1r.esm.js} +2 -2
- package/dist/chunks/{_share-dialog-dependencies-DFXGKz-z.esm.js.map → _share-dialog-dependencies-BvaXft1r.esm.js.map} +1 -1
- package/dist/chunks/{cart-hrlPQg3L.esm.d.ts → cart-DCezceUX.esm.d.ts} +2 -2
- package/dist/chunks/index-726Vfz5u.esm.js +32 -0
- package/dist/chunks/index-726Vfz5u.esm.js.map +1 -0
- package/dist/chunks/{index-C20vHMzS.esm.js → index-B7OkmoYI.esm.js} +2 -2
- package/dist/chunks/{index-C20vHMzS.esm.js.map → index-B7OkmoYI.esm.js.map} +1 -1
- package/dist/chunks/{index-xsFjZMYP.esm.js → index-BOHlIBDq.esm.js} +6 -6
- package/dist/chunks/index-BOHlIBDq.esm.js.map +1 -0
- package/dist/chunks/index-Bc_hD09J.esm.js +32 -0
- package/dist/chunks/index-Bc_hD09J.esm.js.map +1 -0
- package/dist/chunks/{index-BXEbjPDK.esm.d.ts → index-Bi9LFICg.esm.d.ts} +1 -1
- package/dist/chunks/{index-D9W31jYp.esm.js → index-Bt4Ob1Fi.esm.js} +2 -2
- package/dist/chunks/{index-D9W31jYp.esm.js.map → index-Bt4Ob1Fi.esm.js.map} +1 -1
- package/dist/chunks/{index-BuLbvDL8.esm.d.ts → index-C6gns2ul.esm.d.ts} +1 -1
- package/dist/chunks/{index-Dc4HgxdT.esm.js → index-CVHrQ1WC.esm.js} +2 -2
- package/dist/chunks/{index-Dc4HgxdT.esm.js.map → index-CVHrQ1WC.esm.js.map} +1 -1
- package/dist/chunks/{index-D3OYVBqK.esm.d.ts → index-DQ89VjpD.esm.d.ts} +1 -1
- package/dist/chunks/{index-DXFRJEgw.esm.js → index-Di1IwSgk.esm.js} +6 -6
- package/dist/chunks/index-Di1IwSgk.esm.js.map +1 -0
- package/dist/chunks/{index-BZZiSTrL.esm.d.ts → index-h_-rDiMR.esm.d.ts} +1 -1
- package/dist/chunks/{promo-pill-label-rrCE5zhs.esm.js → promo-pill-label-D-VXaB27.esm.js} +2 -2
- package/dist/chunks/{promo-pill-label-rrCE5zhs.esm.js.map → promo-pill-label-D-VXaB27.esm.js.map} +1 -1
- package/dist/chunks/{share-button-DctAhc8i.esm.js → share-button-DFuEWa2h.esm.js} +2 -2
- package/dist/chunks/{share-button-DctAhc8i.esm.js.map → share-button-DFuEWa2h.esm.js.map} +1 -1
- package/dist/chunks/{share-button-Dob19-Da.esm.js → share-button-o8IBYAxH.esm.js} +2 -2
- package/dist/chunks/{share-button-Dob19-Da.esm.js.map → share-button-o8IBYAxH.esm.js.map} +1 -1
- package/dist/chunks/{update-cart-BclA4Tsd.esm.d.ts → update-cart-B5Tr9N3V.esm.d.ts} +1 -1
- package/dist/chunks/{utils-SWm8ZEfg.esm.d.ts → utils-BPcZ5h8J.esm.d.ts} +66 -0
- package/dist/components/beam-partner-logos.d.ts +1 -1
- package/dist/components/community-impact.d.ts +1 -1
- package/dist/components/community-impact.esm.js +13 -13
- package/dist/components/community-impact.esm.js.map +1 -1
- package/dist/components/community-impact.js +13 -13
- package/dist/components/community-impact.js.map +1 -1
- package/dist/components/cumulative-impact.d.ts +1 -1
- package/dist/components/cumulative-impact.esm.js +1 -1
- package/dist/components/cumulative-impact.js +1 -1
- package/dist/components/impact-overview.d.ts +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 +1 -1
- package/dist/components/index.esm.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/post-purchase.d.ts +2 -1
- 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 +2 -2
- package/dist/components/product-details-page.esm.js.map +1 -1
- package/dist/components/product-details-page.js +2 -2
- package/dist/components/product-details-page.js.map +1 -1
- package/dist/components/redeem-transaction.d.ts +1 -1
- package/dist/components/redeem-transaction.esm.js +1 -1
- package/dist/components/redeem-transaction.js +1 -1
- package/dist/components/select-nonprofit.d.ts +1 -1
- package/dist/components/select-nonprofit.esm.js +2 -2
- package/dist/components/select-nonprofit.esm.js.map +1 -1
- package/dist/components/select-nonprofit.js +2 -2
- 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 +4 -4
- package/dist/components/shopify.esm.js +1 -1
- package/dist/components/shopify.js +1 -1
- package/dist/components/social-share.d.ts +1 -1
- package/dist/components/social-share.esm.js +1 -1
- package/dist/components/social-share.js +1 -1
- package/dist/components/subscriber-select-nonprofit.d.ts +1 -1
- package/dist/components/subscriber-select-nonprofit.esm.js +1 -1
- package/dist/components/subscriber-select-nonprofit.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 +1 -1
- package/dist/components/subscription-management.esm.js +1 -1
- package/dist/components/subscription-management.js +1 -1
- package/dist/index.d.ts +7 -7
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/integrations/beam.d.ts +1 -1
- package/dist/integrations/beam.esm.js +1 -1
- package/dist/integrations/beam.js +1 -1
- package/dist/integrations/cart.d.ts +2 -2
- package/dist/integrations/cart.esm.js +1 -1
- package/dist/integrations/cart.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/promoManager.d.ts +1 -1
- package/dist/integrations/shopify-order.d.ts +1 -1
- package/dist/integrations/shopify-order.esm.js +1 -1
- package/dist/integrations/shopify-order.js +1 -1
- package/dist/integrations/shopify.d.ts +3 -3
- package/dist/integrations/shopify.esm.js +1 -1
- package/dist/integrations/shopify.js +1 -1
- package/dist/integrations/statsig.d.ts +1 -1
- package/dist/integrations/statsig.esm.js +1 -1
- package/dist/integrations/statsig.js +1 -1
- package/dist/integrations/utils.d.ts +1 -1
- package/dist/react/beam-partner-logos.d.ts +1 -1
- package/dist/react/community-impact.d.ts +1 -1
- package/dist/react/community-impact.esm.js +1 -1
- package/dist/react/community-impact.js +1 -1
- package/dist/react/cumulative-impact.d.ts +1 -1
- package/dist/react/cumulative-impact.esm.js +1 -1
- package/dist/react/cumulative-impact.js +1 -1
- package/dist/react/impact-overview.d.ts +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 +1 -1
- package/dist/react/index.esm.js +1 -1
- package/dist/react/index.js +1 -1
- package/dist/react/post-purchase.d.ts +1 -1
- package/dist/react/post-purchase.esm.js +1 -1
- package/dist/react/post-purchase.js +1 -1
- package/dist/react/product-details-page.d.ts +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 +1 -1
- package/dist/react/redeem-transaction.esm.js +1 -1
- package/dist/react/redeem-transaction.js +1 -1
- package/dist/react/select-nonprofit.d.ts +1 -1
- package/dist/react/select-nonprofit.esm.js +1 -1
- package/dist/react/select-nonprofit.js +1 -1
- package/dist/react/select-subscription-nonprofit.d.ts +1 -1
- package/dist/react/select-subscription-nonprofit.esm.js +1 -1
- package/dist/react/select-subscription-nonprofit.js +1 -1
- package/dist/react/social-share.d.ts +1 -1
- package/dist/react/social-share.esm.js +1 -1
- package/dist/react/social-share.js +1 -1
- package/dist/react/subscriber-select-nonprofit.d.ts +1 -1
- package/dist/react/subscriber-select-nonprofit.esm.js +1 -1
- package/dist/react/subscriber-select-nonprofit.js +1 -1
- package/dist/react/subscription-impact.d.ts +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 +1 -1
- package/dist/react/subscription-management.esm.js +1 -1
- package/dist/react/subscription-management.js +1 -1
- package/dist/utils/beam-errors.d.ts +1 -1
- package/dist/utils/cart.d.ts +1 -1
- package/dist/utils/clear-beam-storage.d.ts +1 -1
- package/dist/utils/cookies.d.ts +1 -1
- package/dist/utils/events.d.ts +1 -1
- package/dist/utils/local-storage.d.ts +1 -1
- package/dist/utils/logger.d.ts +1 -1
- package/dist/utils/makeApiKeyHeader.d.ts +1 -1
- package/dist/utils/memoize-last.d.ts +1 -1
- package/dist/utils/network-listeners.d.ts +1 -1
- package/dist/utils/promoManager.d.ts +1 -1
- package/dist/utils/remote-session.d.ts +1 -1
- package/dist/utils/wait-for-element.d.ts +1 -1
- package/package.json +1 -1
- package/dist/chunks/index-BW8B2iVX.esm.js +0 -32
- package/dist/chunks/index-BW8B2iVX.esm.js.map +0 -1
- package/dist/chunks/index-CxHPGblW.esm.js +0 -32
- package/dist/chunks/index-CxHPGblW.esm.js.map +0 -1
- package/dist/chunks/index-DXFRJEgw.esm.js.map +0 -1
- package/dist/chunks/index-xsFjZMYP.esm.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as x,n as
|
|
1
|
+
import{i as x,n as g,r as I,a as v,h as u,b as l,j as b}from"../chunks/lit-BEag9MFp.esm.js";import{c as $,a as f,d as T,e as k}from"../chunks/css-card-grid-CiqEjkwR.esm.js";import{u as n,g as w,A as S,d as s,_ as L,c as C,e as m,f as A}from"../chunks/index-CVHrQ1WC.esm.js";import{D as z,W as F,v as D,n as M}from"../chunks/utils-C5hmbxa4.esm.js";import{a as E}from"../chunks/share-button-o8IBYAxH.esm.js";import{partnerLogosConfigDefaults as U}from"./beam-partner-logos.js";import"../chunks/lodash-CrMU6wKg.esm.js";const y={en:{fundedTimes:({times:e=0})=>`Funded <b>${e}</b> ${e>1?"times":"time"} so far`,learnMore:()=>"Learn more",seeAll:()=>"See All"},fr:{fundedTimes:({times:e=0})=>`Financ\xE9 <b>${e}</b> fois pour l'instant`,learnMore:()=>"En savoir plus",seeAll:()=>"Voir tout"},de:{fundedTimes:({times:e=0})=>`<b>${e}</b> Mal finanziert`,learnMore:()=>"Mehr erfahren",seeAll:()=>"Alle anzeigen"},es:{fundedTimes:({times:e=0})=>`Financiado <b>${e}</b> ${e>1?"vez":"veces"}`,learnMore:()=>"Saber m\xE1s",seeAll:()=>"Ver Todo"},it:{fundedTimes:({times:e=0})=>`Finanziato <b>${e}</b> ${e>1?"volta":"volte"}`,learnMore:()=>"Scopri di pi\xF9",seeAll:()=>"Vedi Tutto"},pl:{fundedTimes:({times:e=0})=>`Udzielono wsparcia <b>${e}</b> ${e>1?"razy":"raz"}`,learnMore:()=>"Dowiedz si\u0119 wi\u0119cej",seeAll:()=>"Zobacz wszystko"},ja:{fundedTimes:({times:e=0})=>`\u73FE\u5728\u307E\u3067\u306B<b>${e}</b>\u56DE\u3001\u3092\u9054\u6210`,learnMore:()=>"\u8A73\u3057\u304F\u898B\u308B",seeAll:()=>"\u3059\u3079\u3066\u898B\u308B"}};var B=Object.defineProperty,p=(e,a,t,r)=>{for(var o=void 0,i=e.length-1,d;i>=0;i--)(d=e[i])&&(o=d(a,t,o)||o);return o&&B(a,t,o),o};class c extends v{constructor(){super(...arguments),this.baseUrl=z,this.cardStyle="image",this.lang="en",this.debug=!1,this.draftConfig=!1,this.selectedFilter=null,this.getImpactData=async()=>(k(["apiKey","chainId"],this),w({baseUrl:this.baseUrl,headers:{authorization:`Api-Key ${this.apiKey}`},queryParams:{chainId:this.chainId,personalImpactLimit:0,widgetName:F.community_impact,version:"1.0.0",lang:this.configLang,draftConfig:this.draftConfig}})),this.impactDataController=new S(this,this.getImpactData),this.renderImageCard=a=>{const t=`${a.nonprofit?.name} image`,r=`Learn more about ${a.nonprofit?.name}`;return l`
|
|
2
2
|
<div class="image-card" part="nonprofit-card" style="display: flex; flex-direction: column;">
|
|
3
3
|
<div
|
|
4
4
|
class="image-card-image-box"
|
|
@@ -38,7 +38,7 @@ import{i as x,n as d,r as I,a as v,h as u,b as g,j as b}from"../chunks/lit-BEag9
|
|
|
38
38
|
</div>
|
|
39
39
|
</div>
|
|
40
40
|
</div>
|
|
41
|
-
`},this.renderIconCard=a=>{const t=`${a.nonprofit?.name} icon`,r=`Learn more about ${a.nonprofit?.name}`;return
|
|
41
|
+
`},this.renderIconCard=a=>{const t=`${a.nonprofit?.name} icon`,r=`Learn more about ${a.nonprofit?.name}`;return l`
|
|
42
42
|
<div class="icon-card" part="nonprofit-card" style="display: flex; flex-direction: column;">
|
|
43
43
|
<img
|
|
44
44
|
class="icon-card-icon"
|
|
@@ -69,14 +69,14 @@ import{i as x,n as d,r as I,a as v,h as u,b as g,j as b}from"../chunks/lit-BEag9
|
|
|
69
69
|
aria-label="${r}"
|
|
70
70
|
>${s(this.configLang,a.nonprofit?.websiteLinkText)||y[this.configLang].learnMore()}<span class="icon-card-link-arrow"> ›</span>
|
|
71
71
|
</a>
|
|
72
|
-
${a.impact?.goalCompletionText===""?
|
|
72
|
+
${a.impact?.goalCompletionText===""?l`<div class="icon-card-goal-completion"> </div>`:""}
|
|
73
73
|
</div>
|
|
74
74
|
</div>
|
|
75
|
-
`},this.renderCards=({nonprofits:a})=>
|
|
76
|
-
<
|
|
77
|
-
${a?.map(
|
|
78
|
-
</
|
|
79
|
-
`}get configLang(){return D[this.lang]||"en"}async updated(a){const t=["chainId","baseUrl","lang"];for(const r of t)if(a.has(r)){this.impactDataController.exec();break}}renderFilterTabs({nonprofits:a}){const t=Array.from(new Set(a.flatMap(i=>i.filters||[])));if(t.length===0)return"";const r=()=>{this.selectedFilter=null},o=i=>{this.selectedFilter===i?this.selectedFilter=null:this.selectedFilter=i};return
|
|
75
|
+
`},this.renderCards=({nonprofits:a})=>{const t=this.cardStyle==="image"?this.renderImageCard:this.renderIconCard;return l`
|
|
76
|
+
<ul class="beam-nonprofit-${this.cardStyle}-cards" part="nonprofit-cards">
|
|
77
|
+
${a?.map(r=>l`<li part="nonprofit-card-item">${t(r)}</li>`)}
|
|
78
|
+
</ul>
|
|
79
|
+
`}}get configLang(){return D[this.lang]||"en"}async updated(a){const t=["chainId","baseUrl","lang"];for(const r of t)if(a.has(r)){this.impactDataController.exec();break}}renderFilterTabs({nonprofits:a}){const t=Array.from(new Set(a.flatMap(i=>i.filters||[])));if(t.length===0)return"";const r=()=>{this.selectedFilter=null},o=i=>{this.selectedFilter===i?this.selectedFilter=null:this.selectedFilter=i};return l` <div
|
|
80
80
|
class="beam-filter-tabs"
|
|
81
81
|
part="filters"
|
|
82
82
|
style="display: inline-flex; flex-wrap: wrap; gap: 0.5em 1em"
|
|
@@ -88,14 +88,14 @@ import{i as x,n as d,r as I,a as v,h as u,b as g,j as b}from"../chunks/lit-BEag9
|
|
|
88
88
|
@keydown=${i=>{["Enter"," "].includes(i.key)&&(i.preventDefault(),r())}}
|
|
89
89
|
>${y[this.configLang].seeAll()}</span
|
|
90
90
|
>
|
|
91
|
-
${t.map(i=>
|
|
91
|
+
${t.map(i=>l`<span
|
|
92
92
|
tabindex="0"
|
|
93
93
|
@click=${()=>o(i)}
|
|
94
|
-
@keydown=${
|
|
94
|
+
@keydown=${d=>{["Enter"," "].includes(d.key)&&(d.preventDefault(),o(i))}}
|
|
95
95
|
style="${b({"padding-bottom":"1px","border-bottom-width":"2px","border-bottom-style":"solid","border-bottom-color":this.selectedFilter===i?"currentColor":"transparent",cursor:"pointer"})}"
|
|
96
96
|
>${i}</span
|
|
97
97
|
>`)}
|
|
98
|
-
</div>`}render(){const{selectedFilter:a}=this,{data:t,error:r,loading:o}=this.impactDataController;if(o)return L();if(r)return this.debug?C({error:r}):"";if(t==null)return this.debug?C({error:new M("Missing data")}):"";const{community:i}=t,
|
|
98
|
+
</div>`}render(){const{selectedFilter:a}=this,{data:t,error:r,loading:o}=this.impactDataController;if(o)return L();if(r)return this.debug?C({error:r}):"";if(t==null)return this.debug?C({error:new M("Missing data")}):"";const{community:i}=t,d=a?i.filter(h=>h.filters?.includes(a)):i;return l`
|
|
99
99
|
<style>
|
|
100
100
|
:host {
|
|
101
101
|
${this.cssVariables.toCSS()}
|
|
@@ -107,7 +107,7 @@ import{i as x,n as d,r as I,a as v,h as u,b as g,j as b}from"../chunks/lit-BEag9
|
|
|
107
107
|
partnerName="${t.chain.name}"
|
|
108
108
|
></beam-partner-logos>
|
|
109
109
|
|
|
110
|
-
${this.renderFilterTabs({nonprofits:i})} ${this.renderCards({nonprofits:
|
|
110
|
+
${this.renderFilterTabs({nonprofits:i})} ${this.renderCards({nonprofits:d})}
|
|
111
111
|
`}get cssVariables(){const a={"--beam-fontFamily":"inherit","--beam-fontStyle":"inherit","--beam-fontSize":"14px","--beam-lineHeight":"1","--beam-textColor":"inherit","--beam-backgroundColor":"inherit",...U,...E,"--beam-CommunityImpact-filterTabs-textalign":"left","--beam-CommunityImpact-filterTabs-marginBottom":"20px","--beam-CommunityImpact-imageCard-borderColor":"currentColor","--beam-CommunityImpact-imageCard-borderRadius":"0","--beam-CommunityImpact-imageCard-borderWidth":"1px","--beam-CommunityImpact-imageCard-backgroundColor":"inherit","--beam-CommunityImpact-imageCard-foregroundColor":"inherit",...m("--beam-CommunityImpact-filterTabs",{fontSize:"16px",marginTop:"10px",fontWeight:"bold"}),...m("--beam-CommunityImpact-imageCard-cause",{fontSize:"14px",textTransform:"uppercase",color:"#fff"}),...m("--beam-CommunityImpact-imageCard-name",{fontSize:"22px",marginTop:"0",color:"#fff"}),...m("--beam-CommunityImpact-imageCard-description",{marginTop:"10px",lineHeight:"1.3"}),"--beam-CommunityImpact-imageCard-link-color":"inherit","--beam-CommunityImpact-imageCard-linkArrow-display":"none",...m("--beam-CommunityImpact-imageCard-link",{fontSize:"12px"}),...m("--beam-CommunityImpact-imageCard-goalCompletion",{fontSize:"12px"}),"--beam-CommunityImpact-imageCard-goalCompletion-fontStyle":"italic","--beam-CommunityImpact-imageCard-progress-marginTop":"10px",...m("--beam-CommunityImpact-imageCard-progressText"),"--beam-CommunityImpact-imageCard-footer-marginTop":"10px",...m("--beam-CommunityImpact-iconCard-cause",{marginTop:"10px"}),...m("--beam-CommunityImpact-iconCard-name",{marginTop:"5px",fontWeight:"bold"}),"--beam-CommunityImpact-iconCard-progress-marginTop":"10px",...m("--beam-CommunityImpact-iconCard-progressText"),...m("--beam-CommunityImpact-iconCard-description",{marginTop:"10px",lineHeight:"1.3"}),"--beam-CommunityImpact-iconCard-description-textAlign":"left",...m("--beam-CommunityImpact-iconCard-goalCompletion",{marginTop:"10px"}),"--beam-CommunityImpact-iconCard-link-color":"inherit","--beam-CommunityImpact-iconCard-linkArrow-display":"none",...m("--beam-CommunityImpact-iconCard-link",{marginTop:"5px"})},t=(this.impactDataController.data?.community.length||0)===3?3:this.cardStyle==="icon"?4:2;a["--beam-CommunityImpact-columns"]=t.toString(),a["--beam-CommunityImpact-columns-minWidth"]=this.cardStyle==="image"?"300px":"200px";const r=this.impactDataController?.data?.config?.web?.theme||{},o={...a,...r};return Object.assign(Object.create({toCSS(){return A(this)}}),o)}}c.tagName="beam-community-impact",c.styles=[$,x`
|
|
112
112
|
:host {
|
|
113
113
|
display: block;
|
|
@@ -249,5 +249,5 @@ import{i as x,n as d,r as I,a as v,h as u,b as g,j as b}from"../chunks/lit-BEag9
|
|
|
249
249
|
.icon-card-footer {
|
|
250
250
|
margin-top: var(--beam-CommunityImpact-iconCard-footer-marginTop);
|
|
251
251
|
}
|
|
252
|
-
`],
|
|
252
|
+
`],p([g({type:String})],c.prototype,"apiKey"),p([g({type:Number})],c.prototype,"chainId"),p([g({type:String})],c.prototype,"baseUrl"),p([g({type:String})],c.prototype,"cardStyle"),p([g({type:String})],c.prototype,"lang"),p([g({type:Boolean})],c.prototype,"debug"),p([g({type:Boolean})],c.prototype,"draftConfig"),p([I()],c.prototype,"selectedFilter"),T(c);export{c as BeamCommunityImpact};
|
|
253
253
|
//# sourceMappingURL=community-impact.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"community-impact.js","sources":["../../src/components/community-impact/strings.ts","../../src/components/community-impact/index.ts"],"sourcesContent":["export const strings = {\n en: {\n fundedTimes: ({ times = 0 }) => `Funded <b>${times}</b> ${times > 1 ? \"times\" : \"time\"} so far`,\n learnMore: () => `Learn more`,\n seeAll: () => `See All`,\n },\n fr: {\n fundedTimes: ({ times = 0 }) => `Financé <b>${times}</b> fois pour l'instant`,\n learnMore: () => `En savoir plus`,\n seeAll: () => `Voir tout`,\n },\n de: {\n fundedTimes: ({ times = 0 }) => `<b>${times}</b> Mal finanziert`,\n learnMore: () => `Mehr erfahren`,\n seeAll: () => `Alle anzeigen`,\n },\n es: {\n fundedTimes: ({ times = 0 }) => `Financiado <b>${times}</b> ${times > 1 ? \"vez\" : \"veces\"}`,\n learnMore: () => `Saber más`,\n seeAll: () => `Ver Todo`,\n },\n it: {\n fundedTimes: ({ times = 0 }) => `Finanziato <b>${times}</b> ${times > 1 ? \"volta\" : \"volte\"}`,\n learnMore: () => `Scopri di più`,\n seeAll: () => `Vedi Tutto`,\n },\n pl: {\n fundedTimes: ({ times = 0 }) => `Udzielono wsparcia <b>${times}</b> ${times > 1 ? \"razy\" : \"raz\"}`,\n learnMore: () => `Dowiedz się więcej`,\n seeAll: () => `Zobacz wszystko`,\n },\n ja: {\n fundedTimes: ({ times = 0 }) => `現在までに<b>${times}</b>回、を達成`,\n learnMore: () => `詳しく見る`,\n seeAll: () => `すべて見る`,\n },\n};\n","import { css, html, LitElement } from \"lit\";\nimport { property } from \"lit/decorators/property.js\";\nimport { state } from \"lit/decorators/state.js\";\nimport { styleMap } from \"lit/directives/style-map.js\";\nimport { unsafeHTML } from \"lit/directives/unsafe-html.js\";\nimport { cssReset } from \"../../shared/css-reset\";\nimport { defineCustomElement } from \"../../shared/defineCustomElement\";\nimport { _cssVariableMap } from \"../../shared/fragments/css-variable-map\";\nimport { AsyncController } from \"../../shared/controllers/async-controller\";\nimport { getImpact } from \"../../api-sdk/v3/routes\";\nimport { _errorMessage } from \"../../shared/fragments/error-message-template\";\nimport { _loading } from \"../../shared/fragments/loading-template\";\nimport { defineCustomText, useCustomText } from \"../../shared/fragments/custom-text\";\nimport { DEFAULT_BASE_URL, SUPPORTED_LANGUAGES, WIDGET_NAMES } from \"../../api-sdk/constants\";\nimport { enforceConfig } from \"../../shared/enforce-config\";\nimport { BeamError, MissingConfig } from \"../../utils/beam-errors\";\nimport { TNumericId } from \"../../shared/types\";\nimport { cssCardGrid } from \"../../shared/fragments/css-card-grid\";\nimport { LANGUAGES } from \"../../api-sdk/types\";\nimport { localizeUserString } from \"../../shared/localize\";\nimport { progressBarConfigDefaults } from \"../../shared/components/progress-bar\";\nimport { partnerLogosConfigDefaults } from \"../beam-partner-logos\";\nimport { strings } from \"./strings\";\n\ntype RequiredConfig = {\n apiKey: string;\n chainId: TNumericId;\n};\n\ntype IAPIV3NonprofitImpact = Awaited<ReturnType<typeof getImpact>>[\"community\"][0];\n\n/**\n * Beam Impact Overview Widget\n * Displays a grid of cards highlighting progress against funding goals\n * for the non-profits the chain is supporting.\n */\nexport class BeamCommunityImpact extends LitElement {\n static tagName = \"beam-community-impact\";\n\n @property({ type: String }) public apiKey?: RequiredConfig[\"apiKey\"];\n\n @property({ type: Number }) public chainId?: RequiredConfig[\"chainId\"];\n\n @property({ type: String }) public baseUrl = DEFAULT_BASE_URL;\n\n @property({ type: String }) public cardStyle: \"icon\" | \"image\" = \"image\";\n\n @property({ type: String }) public lang: LANGUAGES = \"en\";\n\n @property({ type: Boolean }) public debug = false;\n\n @property({ type: Boolean }) public draftConfig = false;\n\n @state() private selectedFilter: string | null = null;\n\n get configLang() {\n return SUPPORTED_LANGUAGES[this.lang] || \"en\";\n }\n\n private getImpactData = async () => {\n if (!enforceConfig<RequiredConfig>([\"apiKey\", \"chainId\"], this)) throw new MissingConfig();\n const res = getImpact({\n baseUrl: this.baseUrl,\n headers: {\n authorization: `Api-Key ${this.apiKey}`,\n },\n queryParams: {\n chainId: this.chainId,\n personalImpactLimit: 0,\n widgetName: WIDGET_NAMES.community_impact,\n version: \"1.0.0\",\n lang: this.configLang,\n draftConfig: this.draftConfig,\n },\n });\n\n return res;\n };\n\n private impactDataController = new AsyncController<typeof this.getImpactData>(this, this.getImpactData);\n\n async updated(changedProperties: Map<string, unknown>) {\n // Reload nonprofit list on change of any of these props:\n // Also fires on first load as props go from undefined => value\n const requireNewDataProps = [\"chainId\", \"baseUrl\", \"lang\"];\n for (const prop of requireNewDataProps) {\n if (changedProperties.has(prop)) {\n this.impactDataController.exec();\n break;\n }\n }\n }\n\n private renderFilterTabs({ nonprofits }: { nonprofits: IAPIV3NonprofitImpact[] }) {\n const uniqueFilters = Array.from(new Set(nonprofits.flatMap((n) => n.filters || [])));\n if (uniqueFilters.length === 0) return \"\";\n const handleSeeAllFocus = () => {\n this.selectedFilter = null;\n };\n const handleFilterFocus = (filter: string) => {\n if (this.selectedFilter === filter) {\n this.selectedFilter = null;\n } else {\n this.selectedFilter = filter;\n }\n };\n return html` <div\n class=\"beam-filter-tabs\"\n part=\"filters\"\n style=\"display: inline-flex; flex-wrap: wrap; gap: 0.5em 1em\"\n >\n <span\n tabindex=\"0\"\n style=\"${styleMap({\n \"padding-bottom\": \"1px\",\n \"border-bottom-width\": \"2px\",\n \"border-bottom-style\": \"solid\",\n \"border-bottom-color\": this.selectedFilter === null ? \"currentColor\" : \"transparent\",\n cursor: \"pointer\",\n })}\"\n @click=${handleSeeAllFocus}\n @keydown=${(evt: KeyboardEvent) => {\n if ([\"Enter\", \" \"].includes(evt.key)) {\n evt.preventDefault();\n handleSeeAllFocus();\n }\n }}\n >${strings[this.configLang].seeAll()}</span\n >\n ${uniqueFilters.map(\n (filter: string) =>\n html`<span\n tabindex=\"0\"\n @click=${() => handleFilterFocus(filter)}\n @keydown=${(evt: KeyboardEvent) => {\n if ([\"Enter\", \" \"].includes(evt.key)) {\n evt.preventDefault();\n handleFilterFocus(filter);\n }\n }}\n style=\"${styleMap({\n \"padding-bottom\": \"1px\",\n \"border-bottom-width\": \"2px\",\n \"border-bottom-style\": \"solid\",\n \"border-bottom-color\": this.selectedFilter === filter ? \"currentColor\" : \"transparent\",\n cursor: \"pointer\",\n })}\"\n >${filter}</span\n >`,\n )}\n </div>`;\n }\n\n private renderImageCard = (data: IAPIV3NonprofitImpact) => {\n const nonprofitImageAltText = `${data.nonprofit?.name} image`;\n const learnMoreLinkAriaLabel = `Learn more about ${data.nonprofit?.name}`;\n\n return html`\n <div class=\"image-card\" part=\"nonprofit-card\" style=\"display: flex; flex-direction: column;\">\n <div\n class=\"image-card-image-box\"\n style=\"background-image: url('${data.imageUrl}');\"\n aria-label=\"${nonprofitImageAltText}\"\n >\n <p class=\"image-card-cause\">${localizeUserString(this.configLang, data.nonprofit?.cause || \"\")}</p>\n <h2 class=\"image-card-name\">${localizeUserString(this.configLang, data.nonprofit?.name)}</h2>\n </div>\n <div\n style=\"padding: 5px 15px 15px; flex: 1 1 auto; border-radius: 0px; border: none; display: flex; flex-direction: column;\"\n >\n <div class=\"image-card-progress\" style=\"display: flex; align-items: center;\">\n <beam-progress-bar style=\"flex-grow: 1;\" value=\"${data.impact?.goalProgressPercentage}\"></beam-progress-bar>\n <span class=\"image-card-progressText\" style=\"margin-left: 20px;\"\n >${localizeUserString(this.configLang, data.impact?.goalProgressText)}</span\n >\n </div>\n <div class=\"image-card-description\">\n ${unsafeHTML(localizeUserString(this.configLang, data.impact?.description || \"\"))}\n </div>\n <div style=\"display: flex; align-items: end; flex-wrap: wrap; gap: 10px; flex: 1;\" class=\"image-card-footer\">\n <div class=\"image-card-goal-completion\" style=\"flex-grow: 1;\">\n ${unsafeHTML(localizeUserString(this.configLang, data.impact?.goalCompletionText))}\n </div>\n <a\n href=\"${data.nonprofit?.website}\"\n target=\"_blank\"\n class=\"image-card-link\"\n style=\"color: var(--beam-CommunityImpact-imageCard-link-color, inherit); white-space: nowrap\"\n aria-label=\"${learnMoreLinkAriaLabel}\"\n >\n ${localizeUserString(this.configLang, data.nonprofit?.websiteLinkText)}<span class=\"image-card-link-arrow\"\n > ›</span\n >\n </a>\n </div>\n </div>\n </div>\n `;\n };\n\n private renderIconCard = (data: IAPIV3NonprofitImpact) => {\n const nonprofitIconAltText = `${data.nonprofit?.name} icon`;\n const learnMoreLinkAriaLabel = `Learn more about ${data.nonprofit?.name}`;\n\n return html`\n <div class=\"icon-card\" part=\"nonprofit-card\" style=\"display: flex; flex-direction: column;\">\n <img\n class=\"icon-card-icon\"\n src=\"${data.nonprofit?.causeIconUrl}\"\n data-speedsize-ignore=\"true\"\n alt=\"${nonprofitIconAltText}\"\n />\n <p class=\"icon-card-cause\">${localizeUserString(this.configLang, data.nonprofit?.cause ?? \"\")}</p>\n <h2 class=\"icon-card-name\">${localizeUserString(this.configLang, data.nonprofit?.name ?? \"\")}</h2>\n <div class=\"icon-card-description\" part=\"nonprofit-card-description\" style=\"flex: 1;\">\n ${unsafeHTML(localizeUserString(this.configLang, data.impact?.description || \"\"))}\n </div>\n <div class=\"icon-card-footer\" style=\"width: 100%; text-align: center;\">\n <div class=\"icon-card-progress\" style=\"display: flex; align-items: center; width: 100%;\">\n <beam-progress-bar style=\"flex: 1 0;\" value=\"${data.impact?.goalProgressPercentage}\"></beam-progress-bar>\n <span style=\"text-align: right; flex: 0 1; white-space: nowrap\" class=\"icon-card-progressText\"\n >${localizeUserString(this.configLang, data.impact?.goalProgressText)}</span\n >\n </div>\n <div class=\"icon-card-goal-completion\">\n ${unsafeHTML(localizeUserString(this.configLang, data.impact?.goalCompletionText))}\n </div>\n <a\n href=\"${data.nonprofit?.website}\"\n target=\"_blank\"\n class=\"icon-card-link\"\n style=\"color: var(--beam-CommunityImpact-iconCard-link-color, inherit); display: block\"\n aria-label=\"${learnMoreLinkAriaLabel}\"\n >${localizeUserString(this.configLang, data.nonprofit?.websiteLinkText) ||\n strings[this.configLang].learnMore()}<span class=\"icon-card-link-arrow\"> ›</span>\n </a>\n ${data.impact?.goalCompletionText === \"\" ? html`<div class=\"icon-card-goal-completion\"> </div>` : \"\"}\n </div>\n </div>\n `;\n };\n\n private renderCards = ({ nonprofits }: { nonprofits: IAPIV3NonprofitImpact[] }) => {\n return html`\n <div class=\"beam-nonprofit-${this.cardStyle}-cards\" part=\"nonprofit-cards\">\n ${nonprofits?.map(this.cardStyle === \"image\" ? this.renderImageCard : this.renderIconCard)}\n </div>\n `;\n };\n\n render() {\n const { selectedFilter } = this;\n const { data, error, loading } = this.impactDataController;\n if (loading) {\n return _loading();\n }\n if (error) {\n if (this.debug) {\n return _errorMessage({ error });\n }\n return \"\";\n }\n if (data == null) {\n if (this.debug) {\n return _errorMessage({ error: new BeamError(\"Missing data\") });\n }\n return \"\";\n }\n const { community: nonprofits } = data;\n const filteredNonprofits = selectedFilter\n ? nonprofits.filter((np) => np.filters?.includes(selectedFilter))\n : nonprofits;\n return html`\n <style>\n :host {\n ${this.cssVariables.toCSS()}\n }\n </style>\n <beam-partner-logos\n part=\"logos\"\n partnerLogoUrl=\"${data.chain.logoUrl}\"\n partnerName=\"${data.chain.name}\"\n ></beam-partner-logos>\n\n ${this.renderFilterTabs({ nonprofits })} ${this.renderCards({ nonprofits: filteredNonprofits })}\n `;\n }\n\n public get cssVariables() {\n const defaults: Record<string, string> = {\n \"--beam-fontFamily\": \"inherit\",\n \"--beam-fontStyle\": \"inherit\",\n \"--beam-fontSize\": \"14px\",\n \"--beam-lineHeight\": \"1\",\n \"--beam-textColor\": \"inherit\",\n \"--beam-backgroundColor\": \"inherit\",\n ...partnerLogosConfigDefaults,\n ...progressBarConfigDefaults,\n \"--beam-CommunityImpact-filterTabs-textalign\": \"left\",\n \"--beam-CommunityImpact-filterTabs-marginBottom\": \"20px\",\n /* Image Card Styles */\n \"--beam-CommunityImpact-imageCard-borderColor\": \"currentColor\",\n \"--beam-CommunityImpact-imageCard-borderRadius\": \"0\",\n \"--beam-CommunityImpact-imageCard-borderWidth\": \"1px\",\n \"--beam-CommunityImpact-imageCard-backgroundColor\": \"inherit\",\n \"--beam-CommunityImpact-imageCard-foregroundColor\": \"inherit\",\n ...defineCustomText(\"--beam-CommunityImpact-filterTabs\", {\n fontSize: \"16px\",\n marginTop: \"10px\",\n fontWeight: \"bold\",\n }),\n ...defineCustomText(\"--beam-CommunityImpact-imageCard-cause\", {\n fontSize: \"14px\",\n textTransform: \"uppercase\",\n color: \"#fff\",\n }),\n ...defineCustomText(\"--beam-CommunityImpact-imageCard-name\", {\n fontSize: \"22px\",\n marginTop: \"0\",\n color: \"#fff\",\n }),\n ...defineCustomText(\"--beam-CommunityImpact-imageCard-description\", {\n marginTop: \"10px\",\n lineHeight: \"1.3\",\n }),\n \"--beam-CommunityImpact-imageCard-link-color\": \"inherit\",\n \"--beam-CommunityImpact-imageCard-linkArrow-display\": \"none\",\n ...defineCustomText(\"--beam-CommunityImpact-imageCard-link\", {\n fontSize: \"12px\",\n }),\n ...defineCustomText(\"--beam-CommunityImpact-imageCard-goalCompletion\", {\n fontSize: \"12px\",\n }),\n \"--beam-CommunityImpact-imageCard-goalCompletion-fontStyle\": \"italic\",\n \"--beam-CommunityImpact-imageCard-progress-marginTop\": \"10px\",\n ...defineCustomText(\"--beam-CommunityImpact-imageCard-progressText\"),\n \"--beam-CommunityImpact-imageCard-footer-marginTop\": \"10px\",\n /* Icon Card Styles */\n ...defineCustomText(\"--beam-CommunityImpact-iconCard-cause\", {\n marginTop: \"10px\",\n }),\n ...defineCustomText(\"--beam-CommunityImpact-iconCard-name\", {\n marginTop: \"5px\",\n fontWeight: \"bold\",\n }),\n \"--beam-CommunityImpact-iconCard-progress-marginTop\": \"10px\",\n ...defineCustomText(\"--beam-CommunityImpact-iconCard-progressText\"),\n ...defineCustomText(\"--beam-CommunityImpact-iconCard-description\", {\n marginTop: \"10px\",\n lineHeight: \"1.3\",\n }),\n \"--beam-CommunityImpact-iconCard-description-textAlign\": \"left\",\n ...defineCustomText(\"--beam-CommunityImpact-iconCard-goalCompletion\", {\n marginTop: \"10px\",\n }),\n \"--beam-CommunityImpact-iconCard-link-color\": \"inherit\",\n \"--beam-CommunityImpact-iconCard-linkArrow-display\": \"none\",\n ...defineCustomText(\"--beam-CommunityImpact-iconCard-link\", {\n marginTop: \"5px\",\n }),\n };\n\n const cardCount = this.impactDataController.data?.community.length || 0;\n const columnCount = cardCount === 3 ? 3 : this.cardStyle === \"icon\" ? 4 : 2;\n defaults[\"--beam-CommunityImpact-columns\"] = columnCount.toString();\n defaults[\"--beam-CommunityImpact-columns-minWidth\"] = this.cardStyle === \"image\" ? \"300px\" : \"200px\";\n\n const remoteConfig = this.impactDataController?.data?.config?.web?.theme || {};\n\n const config = { ...defaults, ...remoteConfig };\n\n const serializable = Object.create({\n toCSS() {\n return _cssVariableMap(this as Record<string, string>);\n },\n });\n\n return Object.assign(serializable, config);\n }\n\n static styles = [\n cssReset,\n css`\n :host {\n display: block;\n font-family: var(--beam-fontFamily, inherit);\n font-style: var(--beam-fontStyle, inherit);\n font-size: var(--beam-fontSize, inherit);\n color: var(--beam-textColor, inherit);\n background-color: var(--beam-backgroundColor, inherit);\n line-height: var(--beam-lineHeight, 1);\n word-break: normal;\n }\n\n .beam-filter-tabs {\n ${useCustomText(\"--beam-CommunityImpact-filterTabs\")}\n margin-bottom: var(--beam-CommunityImpact-filterTabs-marginBottom, 10px);\n text-align: var(--beam-CommunityImpact-filterTabs-textalign, left);\n }\n\n .beam-nonprofit-image-cards,\n .beam-nonprofit-icon-cards {\n margin-top: 10px;\n }\n\n ${cssCardGrid({\n gap: \"20px\",\n className: \"beam-nonprofit-image-cards\",\n columnCount: \"var(--beam-CommunityImpact-columns)\",\n itemMinWidth: \"var(--beam-CommunityImpact-columns-minWidth)\",\n })}\n\n ${cssCardGrid({\n gap: \"40px\",\n className: \"beam-nonprofit-icon-cards\",\n columnCount: \"var(--beam-CommunityImpact-columns)\",\n itemMinWidth: \"var(--beam-CommunityImpact-columns-minWidth)\",\n })}\n\n /* Image Style Cards */\n\n .image-card {\n overflow-wrap: break-word;\n border-color: var(--beam-CommunityImpact-imageCard-borderColor);\n border-style: solid;\n border-width: var(--beam-CommunityImpact-imageCard-borderWidth);\n border-radius: var(--beam-CommunityImpact-imageCard-borderRadius);\n overflow: hidden;\n background-color: var(--beam-CommunityImpact-imageCard-backgroundColor);\n color: var(--beam-CommunityImpact-imageCard-foregroundColor);\n }\n\n .image-card-image-box {\n height: 200px;\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n padding: 0 24px 16px;\n overflow-wrap: break-word;\n background-color: #555;\n background-blend-mode: overlay;\n background-size: cover;\n background-repeat: no-repeat;\n }\n\n .image-card-cause {\n ${useCustomText(\"--beam-CommunityImpact-imageCard-cause\")}\n }\n\n .image-card-name {\n ${useCustomText(\"--beam-CommunityImpact-imageCard-name\")}\n }\n\n .image-card-progress {\n margin-top: var(--beam-CommunityImpact-imageCard-progress-marginTop);\n }\n\n .image-card-progressText {\n ${useCustomText(\"--beam-CommunityImpact-imageCard-progressText\")}\n }\n\n .image-card-description {\n ${useCustomText(\"--beam-CommunityImpact-imageCard-description\")}\n }\n\n .image-card-link {\n ${useCustomText(\"--beam-CommunityImpact-imageCard-link\")}\n }\n\n .image-card-link-arrow {\n display: var(--beam-CommunityImpact-imageCard-linkArrow-display, \"none\");\n }\n\n .image-card-goal-completion {\n ${useCustomText(\"--beam-CommunityImpact-imageCard-goalCompletion\")}\n font-style: var(--beam-CommunityImpact-imageCard-goalCompletion-fontStyle, italic);\n }\n\n .image-card-footer {\n margin-top: var(--beam-CommunityImpact-imageCard-footer-marginTop);\n }\n\n /* Icon Style Cards */\n\n .icon-card {\n display: flex;\n flex-direction: column;\n justify-content: start;\n align-items: center;\n }\n\n .icon-card-icon {\n height: 50px;\n }\n\n .icon-card-cause {\n ${useCustomText(\"--beam-CommunityImpact-iconCard-cause\")}\n }\n\n .icon-card-name {\n ${useCustomText(\"--beam-CommunityImpact-iconCard-name\")}\n }\n\n .icon-card-progress {\n margin-top: var(--beam-CommunityImpact-iconCard-progress-marginTop);\n }\n\n .icon-card-progressText {\n ${useCustomText(\"--beam-CommunityImpact-iconCard-progressText\")}\n margin-left: 10px;\n }\n\n .icon-card-description {\n ${useCustomText(\"--beam-CommunityImpact-iconCard-description\")}\n text-align: var(--beam-CommunityImpact-iconCard-description-textAlign, left);\n }\n\n .icon-card-link {\n ${useCustomText(\"--beam-CommunityImpact-iconCard-link\")}\n }\n\n .icon-card-link-arrow {\n display: var(--beam-CommunityImpact-iconCard-linkArrow-display, \"none\");\n }\n\n .icon-card-goal-completion {\n ${useCustomText(\"--beam-CommunityImpact-iconCard-goalCompletion\")}\n font-style: var(--beam-CommunityImpact-iconCard-goalCompletion-fontStyle, italic);\n }\n\n .icon-card-footer {\n margin-top: var(--beam-CommunityImpact-iconCard-footer-marginTop);\n }\n `,\n ];\n}\n\ndefineCustomElement(BeamCommunityImpact);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"beam-community-impact\": BeamCommunityImpact;\n }\n}\n"],"names":["strings","times","BeamCommunityImpact","LitElement","DEFAULT_BASE_URL","enforceConfig","getImpact","WIDGET_NAMES","AsyncController","data","nonprofitImageAltText","learnMoreLinkAriaLabel","html","localizeUserString","unsafeHTML","nonprofitIconAltText","nonprofits","SUPPORTED_LANGUAGES","changedProperties","requireNewDataProps","prop","uniqueFilters","n","handleSeeAllFocus","handleFilterFocus","filter","styleMap","evt","selectedFilter","error","loading","_loading","_errorMessage","BeamError","filteredNonprofits","np","defaults","partnerLogosConfigDefaults","progressBarConfigDefaults","defineCustomText","columnCount","remoteConfig","config","_cssVariableMap","cssReset","css","useCustomText","cssCardGrid","__decorateClass","property","state","defineCustomElement"],"mappings":"ogBAAO,MAAMA,EAAU,CACrB,GAAI,CACF,YAAa,CAAC,CAAE,MAAAC,EAAQ,CAAE,IAAM,aAAaA,CAAK,QAAQA,EAAQ,EAAI,QAAU,MAAM,UACtF,UAAW,IAAM,aACjB,OAAQ,IAAM,SACh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AAlCC,EAAS,CAAE,KAAM,MAAO,CAAC,CAAA,EATf/C,EASwB,UAAA,WAAA,EAEA8C,EAAA,CAAlCC,EAAS,CAAE,KAAM,MAAO,CAAC,CAAA,EAXf/C,EAWwB,UAAA,MAAA,EAEC8C,EAAA,CAAnCC,EAAS,CAAE,KAAM,OAAQ,CAAC,CAAA,EAbhB/C,EAayB,UAAA,OAAA,EAEA8C,EAAA,CAAnCC,EAAS,CAAE,KAAM,OAAQ,CAAC,CAAA,EAfhB/C,EAeyB,UAAA,aAAA,EAEnB8C,EAAA,CAAhBE,EAAAA,GAjBUhD,EAiBM,UAAA,gBAAA,EAoenBiD,EAAoBjD,CAAmB"}
|
|
1
|
+
{"version":3,"file":"community-impact.js","sources":["../../src/components/community-impact/strings.ts","../../src/components/community-impact/index.ts"],"sourcesContent":["export const strings = {\n en: {\n fundedTimes: ({ times = 0 }) => `Funded <b>${times}</b> ${times > 1 ? \"times\" : \"time\"} so far`,\n learnMore: () => `Learn more`,\n seeAll: () => `See All`,\n },\n fr: {\n fundedTimes: ({ times = 0 }) => `Financé <b>${times}</b> fois pour l'instant`,\n learnMore: () => `En savoir plus`,\n seeAll: () => `Voir tout`,\n },\n de: {\n fundedTimes: ({ times = 0 }) => `<b>${times}</b> Mal finanziert`,\n learnMore: () => `Mehr erfahren`,\n seeAll: () => `Alle anzeigen`,\n },\n es: {\n fundedTimes: ({ times = 0 }) => `Financiado <b>${times}</b> ${times > 1 ? \"vez\" : \"veces\"}`,\n learnMore: () => `Saber más`,\n seeAll: () => `Ver Todo`,\n },\n it: {\n fundedTimes: ({ times = 0 }) => `Finanziato <b>${times}</b> ${times > 1 ? \"volta\" : \"volte\"}`,\n learnMore: () => `Scopri di più`,\n seeAll: () => `Vedi Tutto`,\n },\n pl: {\n fundedTimes: ({ times = 0 }) => `Udzielono wsparcia <b>${times}</b> ${times > 1 ? \"razy\" : \"raz\"}`,\n learnMore: () => `Dowiedz się więcej`,\n seeAll: () => `Zobacz wszystko`,\n },\n ja: {\n fundedTimes: ({ times = 0 }) => `現在までに<b>${times}</b>回、を達成`,\n learnMore: () => `詳しく見る`,\n seeAll: () => `すべて見る`,\n },\n};\n","import { css, html, LitElement } from \"lit\";\nimport { property } from \"lit/decorators/property.js\";\nimport { state } from \"lit/decorators/state.js\";\nimport { styleMap } from \"lit/directives/style-map.js\";\nimport { unsafeHTML } from \"lit/directives/unsafe-html.js\";\nimport { cssReset } from \"../../shared/css-reset\";\nimport { defineCustomElement } from \"../../shared/defineCustomElement\";\nimport { _cssVariableMap } from \"../../shared/fragments/css-variable-map\";\nimport { AsyncController } from \"../../shared/controllers/async-controller\";\nimport { getImpact } from \"../../api-sdk/v3/routes\";\nimport { _errorMessage } from \"../../shared/fragments/error-message-template\";\nimport { _loading } from \"../../shared/fragments/loading-template\";\nimport { defineCustomText, useCustomText } from \"../../shared/fragments/custom-text\";\nimport { DEFAULT_BASE_URL, SUPPORTED_LANGUAGES, WIDGET_NAMES } from \"../../api-sdk/constants\";\nimport { enforceConfig } from \"../../shared/enforce-config\";\nimport { BeamError, MissingConfig } from \"../../utils/beam-errors\";\nimport { TNumericId } from \"../../shared/types\";\nimport { cssCardGrid } from \"../../shared/fragments/css-card-grid\";\nimport { LANGUAGES } from \"../../api-sdk/types\";\nimport { localizeUserString } from \"../../shared/localize\";\nimport { progressBarConfigDefaults } from \"../../shared/components/progress-bar\";\nimport { partnerLogosConfigDefaults } from \"../beam-partner-logos\";\nimport { strings } from \"./strings\";\n\ntype RequiredConfig = {\n apiKey: string;\n chainId: TNumericId;\n};\n\ntype IAPIV3NonprofitImpact = Awaited<ReturnType<typeof getImpact>>[\"community\"][0];\n\n/**\n * Beam Impact Overview Widget\n * Displays a grid of cards highlighting progress against funding goals\n * for the non-profits the chain is supporting.\n */\nexport class BeamCommunityImpact extends LitElement {\n static tagName = \"beam-community-impact\";\n\n @property({ type: String }) public apiKey?: RequiredConfig[\"apiKey\"];\n\n @property({ type: Number }) public chainId?: RequiredConfig[\"chainId\"];\n\n @property({ type: String }) public baseUrl = DEFAULT_BASE_URL;\n\n @property({ type: String }) public cardStyle: \"icon\" | \"image\" = \"image\";\n\n @property({ type: String }) public lang: LANGUAGES = \"en\";\n\n @property({ type: Boolean }) public debug = false;\n\n @property({ type: Boolean }) public draftConfig = false;\n\n @state() private selectedFilter: string | null = null;\n\n get configLang() {\n return SUPPORTED_LANGUAGES[this.lang] || \"en\";\n }\n\n private getImpactData = async () => {\n if (!enforceConfig<RequiredConfig>([\"apiKey\", \"chainId\"], this)) throw new MissingConfig();\n const res = getImpact({\n baseUrl: this.baseUrl,\n headers: {\n authorization: `Api-Key ${this.apiKey}`,\n },\n queryParams: {\n chainId: this.chainId,\n personalImpactLimit: 0,\n widgetName: WIDGET_NAMES.community_impact,\n version: \"1.0.0\",\n lang: this.configLang,\n draftConfig: this.draftConfig,\n },\n });\n\n return res;\n };\n\n private impactDataController = new AsyncController<typeof this.getImpactData>(this, this.getImpactData);\n\n async updated(changedProperties: Map<string, unknown>) {\n // Reload nonprofit list on change of any of these props:\n // Also fires on first load as props go from undefined => value\n const requireNewDataProps = [\"chainId\", \"baseUrl\", \"lang\"];\n for (const prop of requireNewDataProps) {\n if (changedProperties.has(prop)) {\n this.impactDataController.exec();\n break;\n }\n }\n }\n\n private renderFilterTabs({ nonprofits }: { nonprofits: IAPIV3NonprofitImpact[] }) {\n const uniqueFilters = Array.from(new Set(nonprofits.flatMap((n) => n.filters || [])));\n if (uniqueFilters.length === 0) return \"\";\n const handleSeeAllFocus = () => {\n this.selectedFilter = null;\n };\n const handleFilterFocus = (filter: string) => {\n if (this.selectedFilter === filter) {\n this.selectedFilter = null;\n } else {\n this.selectedFilter = filter;\n }\n };\n return html` <div\n class=\"beam-filter-tabs\"\n part=\"filters\"\n style=\"display: inline-flex; flex-wrap: wrap; gap: 0.5em 1em\"\n >\n <span\n tabindex=\"0\"\n style=\"${styleMap({\n \"padding-bottom\": \"1px\",\n \"border-bottom-width\": \"2px\",\n \"border-bottom-style\": \"solid\",\n \"border-bottom-color\": this.selectedFilter === null ? \"currentColor\" : \"transparent\",\n cursor: \"pointer\",\n })}\"\n @click=${handleSeeAllFocus}\n @keydown=${(evt: KeyboardEvent) => {\n if ([\"Enter\", \" \"].includes(evt.key)) {\n evt.preventDefault();\n handleSeeAllFocus();\n }\n }}\n >${strings[this.configLang].seeAll()}</span\n >\n ${uniqueFilters.map(\n (filter: string) =>\n html`<span\n tabindex=\"0\"\n @click=${() => handleFilterFocus(filter)}\n @keydown=${(evt: KeyboardEvent) => {\n if ([\"Enter\", \" \"].includes(evt.key)) {\n evt.preventDefault();\n handleFilterFocus(filter);\n }\n }}\n style=\"${styleMap({\n \"padding-bottom\": \"1px\",\n \"border-bottom-width\": \"2px\",\n \"border-bottom-style\": \"solid\",\n \"border-bottom-color\": this.selectedFilter === filter ? \"currentColor\" : \"transparent\",\n cursor: \"pointer\",\n })}\"\n >${filter}</span\n >`,\n )}\n </div>`;\n }\n\n private renderImageCard = (data: IAPIV3NonprofitImpact) => {\n const nonprofitImageAltText = `${data.nonprofit?.name} image`;\n const learnMoreLinkAriaLabel = `Learn more about ${data.nonprofit?.name}`;\n\n return html`\n <div class=\"image-card\" part=\"nonprofit-card\" style=\"display: flex; flex-direction: column;\">\n <div\n class=\"image-card-image-box\"\n style=\"background-image: url('${data.imageUrl}');\"\n aria-label=\"${nonprofitImageAltText}\"\n >\n <p class=\"image-card-cause\">${localizeUserString(this.configLang, data.nonprofit?.cause || \"\")}</p>\n <h2 class=\"image-card-name\">${localizeUserString(this.configLang, data.nonprofit?.name)}</h2>\n </div>\n <div\n style=\"padding: 5px 15px 15px; flex: 1 1 auto; border-radius: 0px; border: none; display: flex; flex-direction: column;\"\n >\n <div class=\"image-card-progress\" style=\"display: flex; align-items: center;\">\n <beam-progress-bar style=\"flex-grow: 1;\" value=\"${data.impact?.goalProgressPercentage}\"></beam-progress-bar>\n <span class=\"image-card-progressText\" style=\"margin-left: 20px;\"\n >${localizeUserString(this.configLang, data.impact?.goalProgressText)}</span\n >\n </div>\n <div class=\"image-card-description\">\n ${unsafeHTML(localizeUserString(this.configLang, data.impact?.description || \"\"))}\n </div>\n <div style=\"display: flex; align-items: end; flex-wrap: wrap; gap: 10px; flex: 1;\" class=\"image-card-footer\">\n <div class=\"image-card-goal-completion\" style=\"flex-grow: 1;\">\n ${unsafeHTML(localizeUserString(this.configLang, data.impact?.goalCompletionText))}\n </div>\n <a\n href=\"${data.nonprofit?.website}\"\n target=\"_blank\"\n class=\"image-card-link\"\n style=\"color: var(--beam-CommunityImpact-imageCard-link-color, inherit); white-space: nowrap\"\n aria-label=\"${learnMoreLinkAriaLabel}\"\n >\n ${localizeUserString(this.configLang, data.nonprofit?.websiteLinkText)}<span class=\"image-card-link-arrow\"\n > ›</span\n >\n </a>\n </div>\n </div>\n </div>\n `;\n };\n\n private renderIconCard = (data: IAPIV3NonprofitImpact) => {\n const nonprofitIconAltText = `${data.nonprofit?.name} icon`;\n const learnMoreLinkAriaLabel = `Learn more about ${data.nonprofit?.name}`;\n\n return html`\n <div class=\"icon-card\" part=\"nonprofit-card\" style=\"display: flex; flex-direction: column;\">\n <img\n class=\"icon-card-icon\"\n src=\"${data.nonprofit?.causeIconUrl}\"\n data-speedsize-ignore=\"true\"\n alt=\"${nonprofitIconAltText}\"\n />\n <p class=\"icon-card-cause\">${localizeUserString(this.configLang, data.nonprofit?.cause ?? \"\")}</p>\n <h2 class=\"icon-card-name\">${localizeUserString(this.configLang, data.nonprofit?.name ?? \"\")}</h2>\n <div class=\"icon-card-description\" part=\"nonprofit-card-description\" style=\"flex: 1;\">\n ${unsafeHTML(localizeUserString(this.configLang, data.impact?.description || \"\"))}\n </div>\n <div class=\"icon-card-footer\" style=\"width: 100%; text-align: center;\">\n <div class=\"icon-card-progress\" style=\"display: flex; align-items: center; width: 100%;\">\n <beam-progress-bar style=\"flex: 1 0;\" value=\"${data.impact?.goalProgressPercentage}\"></beam-progress-bar>\n <span style=\"text-align: right; flex: 0 1; white-space: nowrap\" class=\"icon-card-progressText\"\n >${localizeUserString(this.configLang, data.impact?.goalProgressText)}</span\n >\n </div>\n <div class=\"icon-card-goal-completion\">\n ${unsafeHTML(localizeUserString(this.configLang, data.impact?.goalCompletionText))}\n </div>\n <a\n href=\"${data.nonprofit?.website}\"\n target=\"_blank\"\n class=\"icon-card-link\"\n style=\"color: var(--beam-CommunityImpact-iconCard-link-color, inherit); display: block\"\n aria-label=\"${learnMoreLinkAriaLabel}\"\n >${localizeUserString(this.configLang, data.nonprofit?.websiteLinkText) ||\n strings[this.configLang].learnMore()}<span class=\"icon-card-link-arrow\"> ›</span>\n </a>\n ${data.impact?.goalCompletionText === \"\" ? html`<div class=\"icon-card-goal-completion\"> </div>` : \"\"}\n </div>\n </div>\n `;\n };\n\n private renderCards = ({ nonprofits }: { nonprofits: IAPIV3NonprofitImpact[] }) => {\n const renderCard = this.cardStyle === \"image\" ? this.renderImageCard : this.renderIconCard;\n return html`\n <ul class=\"beam-nonprofit-${this.cardStyle}-cards\" part=\"nonprofit-cards\">\n ${nonprofits?.map((data) => html`<li part=\"nonprofit-card-item\">${renderCard(data)}</li>`)}\n </ul>\n `;\n };\n\n render() {\n const { selectedFilter } = this;\n const { data, error, loading } = this.impactDataController;\n if (loading) {\n return _loading();\n }\n if (error) {\n if (this.debug) {\n return _errorMessage({ error });\n }\n return \"\";\n }\n if (data == null) {\n if (this.debug) {\n return _errorMessage({ error: new BeamError(\"Missing data\") });\n }\n return \"\";\n }\n const { community: nonprofits } = data;\n const filteredNonprofits = selectedFilter\n ? nonprofits.filter((np) => np.filters?.includes(selectedFilter))\n : nonprofits;\n return html`\n <style>\n :host {\n ${this.cssVariables.toCSS()}\n }\n </style>\n <beam-partner-logos\n part=\"logos\"\n partnerLogoUrl=\"${data.chain.logoUrl}\"\n partnerName=\"${data.chain.name}\"\n ></beam-partner-logos>\n\n ${this.renderFilterTabs({ nonprofits })} ${this.renderCards({ nonprofits: filteredNonprofits })}\n `;\n }\n\n public get cssVariables() {\n const defaults: Record<string, string> = {\n \"--beam-fontFamily\": \"inherit\",\n \"--beam-fontStyle\": \"inherit\",\n \"--beam-fontSize\": \"14px\",\n \"--beam-lineHeight\": \"1\",\n \"--beam-textColor\": \"inherit\",\n \"--beam-backgroundColor\": \"inherit\",\n ...partnerLogosConfigDefaults,\n ...progressBarConfigDefaults,\n \"--beam-CommunityImpact-filterTabs-textalign\": \"left\",\n \"--beam-CommunityImpact-filterTabs-marginBottom\": \"20px\",\n /* Image Card Styles */\n \"--beam-CommunityImpact-imageCard-borderColor\": \"currentColor\",\n \"--beam-CommunityImpact-imageCard-borderRadius\": \"0\",\n \"--beam-CommunityImpact-imageCard-borderWidth\": \"1px\",\n \"--beam-CommunityImpact-imageCard-backgroundColor\": \"inherit\",\n \"--beam-CommunityImpact-imageCard-foregroundColor\": \"inherit\",\n ...defineCustomText(\"--beam-CommunityImpact-filterTabs\", {\n fontSize: \"16px\",\n marginTop: \"10px\",\n fontWeight: \"bold\",\n }),\n ...defineCustomText(\"--beam-CommunityImpact-imageCard-cause\", {\n fontSize: \"14px\",\n textTransform: \"uppercase\",\n color: \"#fff\",\n }),\n ...defineCustomText(\"--beam-CommunityImpact-imageCard-name\", {\n fontSize: \"22px\",\n marginTop: \"0\",\n color: \"#fff\",\n }),\n ...defineCustomText(\"--beam-CommunityImpact-imageCard-description\", {\n marginTop: \"10px\",\n lineHeight: \"1.3\",\n }),\n \"--beam-CommunityImpact-imageCard-link-color\": \"inherit\",\n \"--beam-CommunityImpact-imageCard-linkArrow-display\": \"none\",\n ...defineCustomText(\"--beam-CommunityImpact-imageCard-link\", {\n fontSize: \"12px\",\n }),\n ...defineCustomText(\"--beam-CommunityImpact-imageCard-goalCompletion\", {\n fontSize: \"12px\",\n }),\n \"--beam-CommunityImpact-imageCard-goalCompletion-fontStyle\": \"italic\",\n \"--beam-CommunityImpact-imageCard-progress-marginTop\": \"10px\",\n ...defineCustomText(\"--beam-CommunityImpact-imageCard-progressText\"),\n \"--beam-CommunityImpact-imageCard-footer-marginTop\": \"10px\",\n /* Icon Card Styles */\n ...defineCustomText(\"--beam-CommunityImpact-iconCard-cause\", {\n marginTop: \"10px\",\n }),\n ...defineCustomText(\"--beam-CommunityImpact-iconCard-name\", {\n marginTop: \"5px\",\n fontWeight: \"bold\",\n }),\n \"--beam-CommunityImpact-iconCard-progress-marginTop\": \"10px\",\n ...defineCustomText(\"--beam-CommunityImpact-iconCard-progressText\"),\n ...defineCustomText(\"--beam-CommunityImpact-iconCard-description\", {\n marginTop: \"10px\",\n lineHeight: \"1.3\",\n }),\n \"--beam-CommunityImpact-iconCard-description-textAlign\": \"left\",\n ...defineCustomText(\"--beam-CommunityImpact-iconCard-goalCompletion\", {\n marginTop: \"10px\",\n }),\n \"--beam-CommunityImpact-iconCard-link-color\": \"inherit\",\n \"--beam-CommunityImpact-iconCard-linkArrow-display\": \"none\",\n ...defineCustomText(\"--beam-CommunityImpact-iconCard-link\", {\n marginTop: \"5px\",\n }),\n };\n\n const cardCount = this.impactDataController.data?.community.length || 0;\n const columnCount = cardCount === 3 ? 3 : this.cardStyle === \"icon\" ? 4 : 2;\n defaults[\"--beam-CommunityImpact-columns\"] = columnCount.toString();\n defaults[\"--beam-CommunityImpact-columns-minWidth\"] = this.cardStyle === \"image\" ? \"300px\" : \"200px\";\n\n const remoteConfig = this.impactDataController?.data?.config?.web?.theme || {};\n\n const config = { ...defaults, ...remoteConfig };\n\n const serializable = Object.create({\n toCSS() {\n return _cssVariableMap(this as Record<string, string>);\n },\n });\n\n return Object.assign(serializable, config);\n }\n\n static styles = [\n cssReset,\n css`\n :host {\n display: block;\n font-family: var(--beam-fontFamily, inherit);\n font-style: var(--beam-fontStyle, inherit);\n font-size: var(--beam-fontSize, inherit);\n color: var(--beam-textColor, inherit);\n background-color: var(--beam-backgroundColor, inherit);\n line-height: var(--beam-lineHeight, 1);\n word-break: normal;\n }\n\n .beam-filter-tabs {\n ${useCustomText(\"--beam-CommunityImpact-filterTabs\")}\n margin-bottom: var(--beam-CommunityImpact-filterTabs-marginBottom, 10px);\n text-align: var(--beam-CommunityImpact-filterTabs-textalign, left);\n }\n\n .beam-nonprofit-image-cards,\n .beam-nonprofit-icon-cards {\n margin-top: 10px;\n }\n\n ${cssCardGrid({\n gap: \"20px\",\n className: \"beam-nonprofit-image-cards\",\n columnCount: \"var(--beam-CommunityImpact-columns)\",\n itemMinWidth: \"var(--beam-CommunityImpact-columns-minWidth)\",\n })}\n\n ${cssCardGrid({\n gap: \"40px\",\n className: \"beam-nonprofit-icon-cards\",\n columnCount: \"var(--beam-CommunityImpact-columns)\",\n itemMinWidth: \"var(--beam-CommunityImpact-columns-minWidth)\",\n })}\n\n /* Image Style Cards */\n\n .image-card {\n overflow-wrap: break-word;\n border-color: var(--beam-CommunityImpact-imageCard-borderColor);\n border-style: solid;\n border-width: var(--beam-CommunityImpact-imageCard-borderWidth);\n border-radius: var(--beam-CommunityImpact-imageCard-borderRadius);\n overflow: hidden;\n background-color: var(--beam-CommunityImpact-imageCard-backgroundColor);\n color: var(--beam-CommunityImpact-imageCard-foregroundColor);\n }\n\n .image-card-image-box {\n height: 200px;\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n padding: 0 24px 16px;\n overflow-wrap: break-word;\n background-color: #555;\n background-blend-mode: overlay;\n background-size: cover;\n background-repeat: no-repeat;\n }\n\n .image-card-cause {\n ${useCustomText(\"--beam-CommunityImpact-imageCard-cause\")}\n }\n\n .image-card-name {\n ${useCustomText(\"--beam-CommunityImpact-imageCard-name\")}\n }\n\n .image-card-progress {\n margin-top: var(--beam-CommunityImpact-imageCard-progress-marginTop);\n }\n\n .image-card-progressText {\n ${useCustomText(\"--beam-CommunityImpact-imageCard-progressText\")}\n }\n\n .image-card-description {\n ${useCustomText(\"--beam-CommunityImpact-imageCard-description\")}\n }\n\n .image-card-link {\n ${useCustomText(\"--beam-CommunityImpact-imageCard-link\")}\n }\n\n .image-card-link-arrow {\n display: var(--beam-CommunityImpact-imageCard-linkArrow-display, \"none\");\n }\n\n .image-card-goal-completion {\n ${useCustomText(\"--beam-CommunityImpact-imageCard-goalCompletion\")}\n font-style: var(--beam-CommunityImpact-imageCard-goalCompletion-fontStyle, italic);\n }\n\n .image-card-footer {\n margin-top: var(--beam-CommunityImpact-imageCard-footer-marginTop);\n }\n\n /* Icon Style Cards */\n\n .icon-card {\n display: flex;\n flex-direction: column;\n justify-content: start;\n align-items: center;\n }\n\n .icon-card-icon {\n height: 50px;\n }\n\n .icon-card-cause {\n ${useCustomText(\"--beam-CommunityImpact-iconCard-cause\")}\n }\n\n .icon-card-name {\n ${useCustomText(\"--beam-CommunityImpact-iconCard-name\")}\n }\n\n .icon-card-progress {\n margin-top: var(--beam-CommunityImpact-iconCard-progress-marginTop);\n }\n\n .icon-card-progressText {\n ${useCustomText(\"--beam-CommunityImpact-iconCard-progressText\")}\n margin-left: 10px;\n }\n\n .icon-card-description {\n ${useCustomText(\"--beam-CommunityImpact-iconCard-description\")}\n text-align: var(--beam-CommunityImpact-iconCard-description-textAlign, left);\n }\n\n .icon-card-link {\n ${useCustomText(\"--beam-CommunityImpact-iconCard-link\")}\n }\n\n .icon-card-link-arrow {\n display: var(--beam-CommunityImpact-iconCard-linkArrow-display, \"none\");\n }\n\n .icon-card-goal-completion {\n ${useCustomText(\"--beam-CommunityImpact-iconCard-goalCompletion\")}\n font-style: var(--beam-CommunityImpact-iconCard-goalCompletion-fontStyle, italic);\n }\n\n .icon-card-footer {\n margin-top: var(--beam-CommunityImpact-iconCard-footer-marginTop);\n }\n `,\n ];\n}\n\ndefineCustomElement(BeamCommunityImpact);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"beam-community-impact\": BeamCommunityImpact;\n }\n}\n"],"names":["strings","times","BeamCommunityImpact","LitElement","DEFAULT_BASE_URL","enforceConfig","getImpact","WIDGET_NAMES","AsyncController","data","nonprofitImageAltText","learnMoreLinkAriaLabel","html","localizeUserString","unsafeHTML","nonprofitIconAltText","nonprofits","renderCard","SUPPORTED_LANGUAGES","changedProperties","requireNewDataProps","prop","uniqueFilters","n","handleSeeAllFocus","handleFilterFocus","filter","styleMap","evt","selectedFilter","error","loading","_loading","_errorMessage","BeamError","filteredNonprofits","np","defaults","partnerLogosConfigDefaults","progressBarConfigDefaults","defineCustomText","columnCount","remoteConfig","config","_cssVariableMap","cssReset","css","useCustomText","cssCardGrid","__decorateClass","property","state","defineCustomElement"],"mappings":"ogBAAO,MAAMA,EAAU,CACrB,GAAI,CACF,YAAa,CAAC,CAAE,MAAAC,EAAQ,CAAE,IAAM,aAAaA,CAAK,QAAQA,EAAQ,EAAI,QAAU,MAAM,UACtF,UAAW,IAAM,aACjB,OAAQ,IAAM,SAChB,EACA,GAAI,CACF,YAAa,CAAC,CAAE,MAAAA,EAAQ,CAAE,IAAM,iBAAcA,CAAK,2BACnD,UAAW,IAAM,iBACjB,OAAQ,IAAM,WAChB,EACA,GAAI,CACF,YAAa,CAAC,CAAE,MAAAA,EAAQ,CAAE,IAAM,MAAMA,CAAK,sBAC3C,UAAW,IAAM,gBACjB,OAAQ,IAAM,eAChB,EACA,GAAI,CACF,YAAa,CAAC,CAAE,MAAAA,EAAQ,CAAE,IAAM,iBAAiBA,CAAK,QAAQA,EAAQ,EAAI,MAAQ,OAAO,GACzF,UAAW,IAAM,eACjB,OAAQ,IAAM,UAChB,EACA,GAAI,CACF,YAAa,CAAC,CAAE,MAAAA,EAAQ,CAAE,IAAM,iBAAiBA,CAAK,QAAQA,EAAQ,EAAI,QAAU,OAAO,GAC3F,UAAW,IAAM,mBACjB,OAAQ,IAAM,YAChB,EACA,GAAI,CACF,YAAa,CAAC,CAAE,MAAAA,EAAQ,CAAE,IAAM,yBAAyBA,CAAK,QAAQA,EAAQ,EAAI,OAAS,KAAK,GAChG,UAAW,IAAM,+BACjB,OAAQ,IAAM,iBAChB,EACA,GAAI,CACF,YAAa,CAAC,CAAE,MAAAA,EAAQ,CAAE,IAAM,oCAAWA,CAAK,qCAChD,UAAW,IAAM,iCACjB,O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AAA;AAAA;AAAA;AAAA;AAAA,UAK7DA,EAAc,6CAA6C,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,UAK5DA,EAAc,sCAAsC,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,UAQrDA,EAAc,gDAAgD,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAQvE,EAhfmCE,EAAA,CAAlCC,EAAS,CAAE,KAAM,MAAO,CAAC,CAAA,EAHfhD,EAGwB,oBAEA+C,EAAA,CAAlCC,EAAS,CAAE,KAAM,MAAO,CAAC,CAAA,EALfhD,EAKwB,qBAEA+C,EAAA,CAAlCC,EAAS,CAAE,KAAM,MAAO,CAAC,CAAA,EAPfhD,EAOwB,qBAEA+C,EAAA,CAAlCC,EAAS,CAAE,KAAM,MAAO,CAAC,CAAA,EATfhD,EASwB,UAAA,WAAA,EAEA+C,EAAA,CAAlCC,EAAS,CAAE,KAAM,MAAO,CAAC,CAAA,EAXfhD,EAWwB,UAAA,MAAA,EAEC+C,EAAA,CAAnCC,EAAS,CAAE,KAAM,OAAQ,CAAC,CAAA,EAbhBhD,EAayB,UAAA,OAAA,EAEA+C,EAAA,CAAnCC,EAAS,CAAE,KAAM,OAAQ,CAAC,CAAA,EAfhBhD,EAeyB,UAAA,aAAA,EAEnB+C,EAAA,CAAhBE,EAAAA,GAjBUjD,EAiBM,UAAA,gBAAA,EAqenBkD,EAAoBlD,CAAmB"}
|
|
@@ -2,7 +2,7 @@ import * as lit from 'lit';
|
|
|
2
2
|
import { LitElement } from 'lit';
|
|
3
3
|
import * as lit_html from 'lit-html';
|
|
4
4
|
import * as lodash from 'lodash';
|
|
5
|
-
import { b as TNumericId, L as LANGUAGES } from '../chunks/utils-
|
|
5
|
+
import { b as TNumericId, L as LANGUAGES } from '../chunks/utils-BPcZ5h8J.esm.js';
|
|
6
6
|
import 'lodash-es/debounce';
|
|
7
7
|
import 'lodash-es/isEqual';
|
|
8
8
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as C,a as b,b as u,n as c,i as y,g as I}from"../chunks/lit-BEag9MFp.esm.js";import{d as x}from"../chunks/lodash-CrMU6wKg.esm.js";import{c as T,d as S,e as E}from"../chunks/css-card-grid-CiqEjkwR.esm.js";import{a as z,u as p,b as B,A as $,_ as k,c as f,d,e as h,f as D}from"../chunks/index-
|
|
1
|
+
import{r as C,a as b,b as u,n as c,i as y,g as I}from"../chunks/lit-BEag9MFp.esm.js";import{d as x}from"../chunks/lodash-CrMU6wKg.esm.js";import{c as T,d as S,e as E}from"../chunks/css-card-grid-CiqEjkwR.esm.js";import{a as z,u as p,b as B,A as $,_ as k,c as f,d,e as h,f as D}from"../chunks/index-CVHrQ1WC.esm.js";import{D as L,v as V,n as A}from"../chunks/utils-C5hmbxa4.esm.js";var R=Object.defineProperty,v=(n,e,t,i)=>{for(var a=void 0,o=n.length-1,s;o>=0;o--)(s=n[o])&&(a=s(e,t,a)||a);return a&&R(e,t,a),a};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 i=this.counter+t;if(i>=this.finalValue){this.counter=this.finalValue,clearInterval(this.intervalId);return}else this.counter=i},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()}`}}v([c({type:Number})],m.prototype,"finalValue"),v([c({type:Number})],m.prototype,"duration"),v([c({type:String})],m.prototype,"scrollTarget"),v([C()],m.prototype,"counter"),customElements.get("animated-counter")||customElements.define("animated-counter",m);const j=n=>{const e=n instanceof NodeList?Array.from(n):n;if(e.length===0||!z(e))return;const t=e.sort((a,o)=>{const s=getComputedStyle(a).getPropertyValue("width").replace("px",""),g=getComputedStyle(o).getPropertyValue("width").replace("px","");return parseInt(g)-parseInt(s)})[0],i=getComputedStyle(t).getPropertyValue("width");for(const a of e)getComputedStyle(a).getPropertyValue("width")!==i&&(a.style.width=i)},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."},ja:{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."}};var q=Object.defineProperty,l=(n,e,t,i)=>{for(var a=void 0,o=n.length-1,s;o>=0;o--)(s=n[o])&&(a=s(e,t,a)||a);return a&&q(e,t,a),a};const U=1.5*1e3;class r extends b{constructor(){super(...arguments),this.baseUrl=L,this.lang="en",this.disableAnimation=!1,this.debug=!1,this.draftConfig=!1,this.getCumulativeImpactData=async()=>(E(["apiKey","chainId"],this),await B({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 $(this,this.getCumulativeImpactData),this.resizeElements=x(()=>{j(this.impactRowRefs)},50,{maxWait:50,leading:!0})}get configLang(){return V[this.lang]||"en"}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.resizeElements)}async updated(e){const t=["chainId","baseUrl","lang"];for(const i of t)if(e.has(i)){await this.cumulativeImpactDataController.exec();break}this.resizeElements()}render(){const{data:e,error:t,loading:i}=this.cumulativeImpactDataController;return i?k():t?this.debug?f({error:t}):"":e==null?this.debug?f({error:new A("Missing data")}):"":u`
|
|
2
2
|
<style>
|
|
3
3
|
:host {
|
|
4
4
|
${this.cssVariables.toCSS()}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as C,a as b,b as u,n as c,i as y,g as I}from"../chunks/lit-BEag9MFp.esm.js";import{d as x}from"../chunks/lodash-CrMU6wKg.esm.js";import{c as T,d as S,e as E}from"../chunks/css-card-grid-CiqEjkwR.esm.js";import{a as z,u as p,b as B,A as $,_ as k,c as f,d,e as h,f as D}from"../chunks/index-
|
|
1
|
+
import{r as C,a as b,b as u,n as c,i as y,g as I}from"../chunks/lit-BEag9MFp.esm.js";import{d as x}from"../chunks/lodash-CrMU6wKg.esm.js";import{c as T,d as S,e as E}from"../chunks/css-card-grid-CiqEjkwR.esm.js";import{a as z,u as p,b as B,A as $,_ as k,c as f,d,e as h,f as D}from"../chunks/index-CVHrQ1WC.esm.js";import{D as L,v as V,n as A}from"../chunks/utils-C5hmbxa4.esm.js";var R=Object.defineProperty,v=(n,e,t,i)=>{for(var a=void 0,o=n.length-1,s;o>=0;o--)(s=n[o])&&(a=s(e,t,a)||a);return a&&R(e,t,a),a};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 i=this.counter+t;if(i>=this.finalValue){this.counter=this.finalValue,clearInterval(this.intervalId);return}else this.counter=i},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()}`}}v([c({type:Number})],m.prototype,"finalValue"),v([c({type:Number})],m.prototype,"duration"),v([c({type:String})],m.prototype,"scrollTarget"),v([C()],m.prototype,"counter"),customElements.get("animated-counter")||customElements.define("animated-counter",m);const j=n=>{const e=n instanceof NodeList?Array.from(n):n;if(e.length===0||!z(e))return;const t=e.sort((a,o)=>{const s=getComputedStyle(a).getPropertyValue("width").replace("px",""),g=getComputedStyle(o).getPropertyValue("width").replace("px","");return parseInt(g)-parseInt(s)})[0],i=getComputedStyle(t).getPropertyValue("width");for(const a of e)getComputedStyle(a).getPropertyValue("width")!==i&&(a.style.width=i)},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."},ja:{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."}};var q=Object.defineProperty,l=(n,e,t,i)=>{for(var a=void 0,o=n.length-1,s;o>=0;o--)(s=n[o])&&(a=s(e,t,a)||a);return a&&q(e,t,a),a};const U=1.5*1e3;class r extends b{constructor(){super(...arguments),this.baseUrl=L,this.lang="en",this.disableAnimation=!1,this.debug=!1,this.draftConfig=!1,this.getCumulativeImpactData=async()=>(E(["apiKey","chainId"],this),await B({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 $(this,this.getCumulativeImpactData),this.resizeElements=x(()=>{j(this.impactRowRefs)},50,{maxWait:50,leading:!0})}get configLang(){return V[this.lang]||"en"}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.resizeElements)}async updated(e){const t=["chainId","baseUrl","lang"];for(const i of t)if(e.has(i)){await this.cumulativeImpactDataController.exec();break}this.resizeElements()}render(){const{data:e,error:t,loading:i}=this.cumulativeImpactDataController;return i?k():t?this.debug?f({error:t}):"":e==null?this.debug?f({error:new A("Missing data")}):"":u`
|
|
2
2
|
<style>
|
|
3
3
|
:host {
|
|
4
4
|
${this.cssVariables.toCSS()}
|
|
@@ -2,7 +2,7 @@ import * as lit from 'lit';
|
|
|
2
2
|
import { LitElement, PropertyValues } from 'lit';
|
|
3
3
|
import * as lit_html from 'lit-html';
|
|
4
4
|
import * as lodash from 'lodash';
|
|
5
|
-
import { T as TUrl, b as TNumericId, c as TId, L as LANGUAGES } from '../chunks/utils-
|
|
5
|
+
import { T as TUrl, b as TNumericId, c as TId, L as LANGUAGES } from '../chunks/utils-BPcZ5h8J.esm.js';
|
|
6
6
|
import 'lodash-es/debounce';
|
|
7
7
|
import 'lodash-es/isEqual';
|
|
8
8
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as k,n as c,g as f,a as N,h as $,b as T}from"../chunks/lit-BEag9MFp.esm.js";import{d as F}from"../chunks/lodash-CrMU6wKg.esm.js";import{D as U,W as D,v as A,l as R}from"../chunks/utils-C5hmbxa4.esm.js";import{u as s,g as j,A as P,d as g,_,c as O,e as d,f as V}from"../chunks/index-
|
|
1
|
+
import{i as k,n as c,g as f,a as N,h as $,b as T}from"../chunks/lit-BEag9MFp.esm.js";import{d as F}from"../chunks/lodash-CrMU6wKg.esm.js";import{D as U,W as D,v as A,l as R}from"../chunks/utils-C5hmbxa4.esm.js";import{u as s,g as j,A as P,d as g,_,c as O,e as d,f as V}from"../chunks/index-CVHrQ1WC.esm.js";import{a as W}from"../chunks/share-button-o8IBYAxH.esm.js";import{c as G,d as K,e as M}from"../chunks/css-card-grid-CiqEjkwR.esm.js";import"../chunks/_share-dialog-dependencies-BvaXft1r.esm.js";import{s as h,a as q}from"../chunks/share-button-DFuEWa2h.esm.js";import{partnerLogosConfigDefaults as Y}from"./beam-partner-logos.esm.js";import{c as H}from"../chunks/responsive-aN8P5PqD.esm.js";import"../chunks/vendor-DUOg5fL-.esm.js";const l={en:{descriptionTitle:({nonprofitName:a="a nonprofit"})=>`You just made an impact for ${a}`,descriptionSubtitle:({brandName:a=""})=>`Check out the impact your ${a} purchase made below.`,yourImpactTitle:()=>"You\u2019re funding",communityImpactTitle:()=>"Together we\u2019re funding",personalImpactLinkCopy:({nonprofitName:a=""})=>`Learn about ${a}`,communityImpactLinkCopy:({brandName:a=""})=>`See all of the ${a} community's impact`,impactShareButton:()=>"Share to Grow Your Impact"},fr:{descriptionTitle:({nonprofitName:a="une organisation"})=>`Vous avez cr\xE9\xE9 un impact pour ${a}`,descriptionSubtitle:({brandName:a=""})=>`D\xE9couvrez ci-dessous l'impact de votre achat ${a}.`,yourImpactTitle:()=>"Vous financez",communityImpactTitle:()=>"Ensemble, nous finan\xE7ons",personalImpactLinkCopy:({nonprofitName:a=""})=>`En savoir plus sur ${a}`,communityImpactLinkCopy:({brandName:a=""})=>`Voir tout l'impact de la communaut\xE9 ${a}`,impactShareButton:()=>"Partagez pour d\xE9velopper votre impact"},de:{descriptionTitle:({nonprofitName:a="eine Organisation"})=>`Du hast einen Beitrag f\xFCr ${a} geleistet`,descriptionSubtitle:({brandName:a=""})=>`Sieh dir unten den Beitrag an, den dein ${a} Einkauf gemacht hat.`,yourImpactTitle:()=>"Du finanzierst",communityImpactTitle:()=>"Gemeinsam finanzieren wir",personalImpactLinkCopy:({nonprofitName:a=""})=>`Mehr \xFCber ${a} erfahren`,communityImpactLinkCopy:({brandName:a=""})=>`Sieh dir den gesamten Beitrag der ${a}-Community an`,impactShareButton:()=>"Teile, um deinen Beitrag zu vergr\xF6\xDFern"},es:{descriptionTitle:({nonprofitName:a="una organizaci\xF3n"})=>`Generaste un impacto para ${a}`,descriptionSubtitle:({brandName:a=""})=>`Mira a continuaci\xF3n el impacto que tu compra de ${a} ha generado.`,yourImpactTitle:()=>"Est\xE1s financiando",communityImpactTitle:()=>"Juntos estamos financiando",personalImpactLinkCopy:({nonprofitName:a=""})=>`Conoce m\xE1s sobre ${a}`,communityImpactLinkCopy:({brandName:a=""})=>`Mira todo el impacto de la comunidad ${a}`,impactShareButton:()=>"Comparte para hacer crecer tu impacto"},it:{descriptionTitle:({nonprofitName:a="un'organizzazione"})=>`Hai creato un impatto per ${a}`,descriptionSubtitle:({brandName:a=""})=>`Scopri qui sotto l'impatto del tuo acquisto ${a}.`,yourImpactTitle:()=>"Stai finanziando",communityImpactTitle:()=>"Insieme stiamo finanziando",personalImpactLinkCopy:({nonprofitName:a=""})=>`Scopri di pi\xF9 su ${a}`,communityImpactLinkCopy:({brandName:a=""})=>`Guarda tutto l'impatto della comunit\xE0 ${a}`,impactShareButton:()=>"Condividi per far crescere il tuo impatto"},pl:{descriptionTitle:({nonprofitName:a="organizacj\u0119"})=>`Wywar\u0142a\u015B_e\u015B wp\u0142yw na ${a}`,descriptionSubtitle:({brandName:a=""})=>`Sprawd\u017A poni\u017Cej, jaki wp\u0142yw mia\u0142 Tw\xF3j zakup ${a}.`,yourImpactTitle:()=>"Finansujesz",communityImpactTitle:()=>"Razem finansujemy",personalImpactLinkCopy:({nonprofitName:a=""})=>`Dowiedz si\u0119 wi\u0119cej o ${a}`,communityImpactLinkCopy:({brandName:a=""})=>`Zobacz ca\u0142y wp\u0142yw spo\u0142eczno\u015Bci ${a}`,impactShareButton:()=>"Udost\u0119pnij, aby powi\u0119kszy\u0107 sw\xF3j wp\u0142yw"},ja:{descriptionTitle:({nonprofitName:a=""})=>`\u3042\u308A\u304C\u3068\u3046\u3054\u3056\u3044\u307E\u3059\uFF01${a}\u3078\u306E\u5BC4\u4ED8\u306B\u3088\u308A\u3001\u4E16\u754C\u306B\u78BA\u304B\u306A\u5909\u5316\u3092\u3082\u305F\u3089\u3057\u307E\u3057\u305F\u3002`,descriptionSubtitle:({brandName:a=""})=>`${a}\u3067\u306E\u3054\u8CFC\u5165\u304C\u3001\u3069\u306E\u3088\u3046\u306B\u4EBA\u3005\u306E\u5F79\u306B\u7ACB\u3064\u304B\u3092\u3054\u78BA\u8A8D\u304F\u3060\u3055\u3044\u3002`,yourImpactTitle:()=>"\u3042\u306A\u305F\u306E\u652F\u63F4\u5B9F\u7E3E",communityImpactTitle:()=>"\u79C1\u305F\u3061\u306F\u5171\u306B\u652F\u63F4\u3057\u3066\u3044\u307E\u3059",personalImpactLinkCopy:({nonprofitName:a=""})=>`${a} \u306B\u3064\u3044\u3066\u8A73\u3057\u304F\u898B\u308B`,communityImpactLinkCopy:({brandName:a=""})=>`${a}\u30B3\u30DF\u30E5\u30CB\u30C6\u30A3\u306E\u6D3B\u52D5\u5B9F\u7E3E\u3092\u3059\u3079\u3066\u898B\u308B `,impactShareButton:()=>"SNS\u3067\u30B7\u30A7\u30A2\u3059\u308B"}};var J=Object.defineProperty,i=(a,e,r,p)=>{for(var n=void 0,m=a.length-1,o;m>=0;m--)(o=a[m])&&(n=o(e,r,n)||n);return n&&J(e,r,n),n};class t extends N{constructor(){super(...arguments),this.baseUrl=U,this.lang="en",this.debug=!1,this.draftConfig=!1,this.getImpactData=async()=>(M(["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:D.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 P(this,this.getImpactData),this.resizeElements=F(()=>{h(this.impactTitleRefs),h(this.impactDescriptionRefs),h(this.impactLinkRefs),h(this.goalCompletionTextRefs)},50,{maxWait:50,leading:!0})}get configLang(){return A[this.lang]||"en"}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.resizeElements)}async updated(e){const r=["baseUrl","storeId","apiKey","userId","lang","discountCodes"];for(const p of r)if(e.has(p)){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(e){if(document.fonts.status==="loading")return await document.fonts.ready.catch(r=>R.error(r)),e()}renderCard({imageUrl:e,title:r,percentFunded:p,goalProgressText:n,description:m,urlCopy:o,impactUrl:b,isImage:u,cardType:y,goalCompletionText:v}){return T`
|
|
2
2
|
<div class="impact-card ${u?"":"icon"}" part="impact-card">
|
|
3
3
|
<div class="${u?"":"icon-background "}">
|
|
4
4
|
<img
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as k,n as c,g as f,a as N,h as $,b as T}from"../chunks/lit-BEag9MFp.esm.js";import{d as F}from"../chunks/lodash-CrMU6wKg.esm.js";import{D as U,W as D,v as A,l as R}from"../chunks/utils-C5hmbxa4.esm.js";import{u as s,g as j,A as P,d as g,_,c as O,e as d,f as V}from"../chunks/index-
|
|
1
|
+
import{i as k,n as c,g as f,a as N,h as $,b as T}from"../chunks/lit-BEag9MFp.esm.js";import{d as F}from"../chunks/lodash-CrMU6wKg.esm.js";import{D as U,W as D,v as A,l as R}from"../chunks/utils-C5hmbxa4.esm.js";import{u as s,g as j,A as P,d as g,_,c as O,e as d,f as V}from"../chunks/index-CVHrQ1WC.esm.js";import{a as W}from"../chunks/share-button-o8IBYAxH.esm.js";import{c as G,d as K,e as M}from"../chunks/css-card-grid-CiqEjkwR.esm.js";import"../chunks/_share-dialog-dependencies-BvaXft1r.esm.js";import{s as h,a as q}from"../chunks/share-button-DFuEWa2h.esm.js";import{partnerLogosConfigDefaults as Y}from"./beam-partner-logos.js";import{c as H}from"../chunks/responsive-aN8P5PqD.esm.js";import"../chunks/vendor-DUOg5fL-.esm.js";const l={en:{descriptionTitle:({nonprofitName:a="a nonprofit"})=>`You just made an impact for ${a}`,descriptionSubtitle:({brandName:a=""})=>`Check out the impact your ${a} purchase made below.`,yourImpactTitle:()=>"You\u2019re funding",communityImpactTitle:()=>"Together we\u2019re funding",personalImpactLinkCopy:({nonprofitName:a=""})=>`Learn about ${a}`,communityImpactLinkCopy:({brandName:a=""})=>`See all of the ${a} community's impact`,impactShareButton:()=>"Share to Grow Your Impact"},fr:{descriptionTitle:({nonprofitName:a="une organisation"})=>`Vous avez cr\xE9\xE9 un impact pour ${a}`,descriptionSubtitle:({brandName:a=""})=>`D\xE9couvrez ci-dessous l'impact de votre achat ${a}.`,yourImpactTitle:()=>"Vous financez",communityImpactTitle:()=>"Ensemble, nous finan\xE7ons",personalImpactLinkCopy:({nonprofitName:a=""})=>`En savoir plus sur ${a}`,communityImpactLinkCopy:({brandName:a=""})=>`Voir tout l'impact de la communaut\xE9 ${a}`,impactShareButton:()=>"Partagez pour d\xE9velopper votre impact"},de:{descriptionTitle:({nonprofitName:a="eine Organisation"})=>`Du hast einen Beitrag f\xFCr ${a} geleistet`,descriptionSubtitle:({brandName:a=""})=>`Sieh dir unten den Beitrag an, den dein ${a} Einkauf gemacht hat.`,yourImpactTitle:()=>"Du finanzierst",communityImpactTitle:()=>"Gemeinsam finanzieren wir",personalImpactLinkCopy:({nonprofitName:a=""})=>`Mehr \xFCber ${a} erfahren`,communityImpactLinkCopy:({brandName:a=""})=>`Sieh dir den gesamten Beitrag der ${a}-Community an`,impactShareButton:()=>"Teile, um deinen Beitrag zu vergr\xF6\xDFern"},es:{descriptionTitle:({nonprofitName:a="una organizaci\xF3n"})=>`Generaste un impacto para ${a}`,descriptionSubtitle:({brandName:a=""})=>`Mira a continuaci\xF3n el impacto que tu compra de ${a} ha generado.`,yourImpactTitle:()=>"Est\xE1s financiando",communityImpactTitle:()=>"Juntos estamos financiando",personalImpactLinkCopy:({nonprofitName:a=""})=>`Conoce m\xE1s sobre ${a}`,communityImpactLinkCopy:({brandName:a=""})=>`Mira todo el impacto de la comunidad ${a}`,impactShareButton:()=>"Comparte para hacer crecer tu impacto"},it:{descriptionTitle:({nonprofitName:a="un'organizzazione"})=>`Hai creato un impatto per ${a}`,descriptionSubtitle:({brandName:a=""})=>`Scopri qui sotto l'impatto del tuo acquisto ${a}.`,yourImpactTitle:()=>"Stai finanziando",communityImpactTitle:()=>"Insieme stiamo finanziando",personalImpactLinkCopy:({nonprofitName:a=""})=>`Scopri di pi\xF9 su ${a}`,communityImpactLinkCopy:({brandName:a=""})=>`Guarda tutto l'impatto della comunit\xE0 ${a}`,impactShareButton:()=>"Condividi per far crescere il tuo impatto"},pl:{descriptionTitle:({nonprofitName:a="organizacj\u0119"})=>`Wywar\u0142a\u015B_e\u015B wp\u0142yw na ${a}`,descriptionSubtitle:({brandName:a=""})=>`Sprawd\u017A poni\u017Cej, jaki wp\u0142yw mia\u0142 Tw\xF3j zakup ${a}.`,yourImpactTitle:()=>"Finansujesz",communityImpactTitle:()=>"Razem finansujemy",personalImpactLinkCopy:({nonprofitName:a=""})=>`Dowiedz si\u0119 wi\u0119cej o ${a}`,communityImpactLinkCopy:({brandName:a=""})=>`Zobacz ca\u0142y wp\u0142yw spo\u0142eczno\u015Bci ${a}`,impactShareButton:()=>"Udost\u0119pnij, aby powi\u0119kszy\u0107 sw\xF3j wp\u0142yw"},ja:{descriptionTitle:({nonprofitName:a=""})=>`\u3042\u308A\u304C\u3068\u3046\u3054\u3056\u3044\u307E\u3059\uFF01${a}\u3078\u306E\u5BC4\u4ED8\u306B\u3088\u308A\u3001\u4E16\u754C\u306B\u78BA\u304B\u306A\u5909\u5316\u3092\u3082\u305F\u3089\u3057\u307E\u3057\u305F\u3002`,descriptionSubtitle:({brandName:a=""})=>`${a}\u3067\u306E\u3054\u8CFC\u5165\u304C\u3001\u3069\u306E\u3088\u3046\u306B\u4EBA\u3005\u306E\u5F79\u306B\u7ACB\u3064\u304B\u3092\u3054\u78BA\u8A8D\u304F\u3060\u3055\u3044\u3002`,yourImpactTitle:()=>"\u3042\u306A\u305F\u306E\u652F\u63F4\u5B9F\u7E3E",communityImpactTitle:()=>"\u79C1\u305F\u3061\u306F\u5171\u306B\u652F\u63F4\u3057\u3066\u3044\u307E\u3059",personalImpactLinkCopy:({nonprofitName:a=""})=>`${a} \u306B\u3064\u3044\u3066\u8A73\u3057\u304F\u898B\u308B`,communityImpactLinkCopy:({brandName:a=""})=>`${a}\u30B3\u30DF\u30E5\u30CB\u30C6\u30A3\u306E\u6D3B\u52D5\u5B9F\u7E3E\u3092\u3059\u3079\u3066\u898B\u308B `,impactShareButton:()=>"SNS\u3067\u30B7\u30A7\u30A2\u3059\u308B"}};var J=Object.defineProperty,i=(a,e,r,p)=>{for(var n=void 0,m=a.length-1,o;m>=0;m--)(o=a[m])&&(n=o(e,r,n)||n);return n&&J(e,r,n),n};class t extends N{constructor(){super(...arguments),this.baseUrl=U,this.lang="en",this.debug=!1,this.draftConfig=!1,this.getImpactData=async()=>(M(["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:D.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 P(this,this.getImpactData),this.resizeElements=F(()=>{h(this.impactTitleRefs),h(this.impactDescriptionRefs),h(this.impactLinkRefs),h(this.goalCompletionTextRefs)},50,{maxWait:50,leading:!0})}get configLang(){return A[this.lang]||"en"}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.resizeElements)}async updated(e){const r=["baseUrl","storeId","apiKey","userId","lang","discountCodes"];for(const p of r)if(e.has(p)){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(e){if(document.fonts.status==="loading")return await document.fonts.ready.catch(r=>R.error(r)),e()}renderCard({imageUrl:e,title:r,percentFunded:p,goalProgressText:n,description:m,urlCopy:o,impactUrl:b,isImage:u,cardType:y,goalCompletionText:v}){return T`
|
|
2
2
|
<div class="impact-card ${u?"":"icon"}" part="impact-card">
|
|
3
3
|
<div class="${u?"":"icon-background "}">
|
|
4
4
|
<img
|
|
@@ -12,7 +12,7 @@ export { BeamSocialShare } from './social-share.js';
|
|
|
12
12
|
export { BeamSubscriberSelectNonprofit } from './subscriber-select-nonprofit.js';
|
|
13
13
|
import 'lit';
|
|
14
14
|
import 'lit-html';
|
|
15
|
-
import '../chunks/utils-
|
|
15
|
+
import '../chunks/utils-BPcZ5h8J.esm.js';
|
|
16
16
|
import 'lodash-es/debounce';
|
|
17
17
|
import 'lodash-es/isEqual';
|
|
18
18
|
import 'lodash';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{BeamCommunityImpact as S}from"./community-impact.esm.js";import{BeamCumulativeImpact as b}from"./cumulative-impact.esm.js";import{BeamImpactOverview as P}from"./impact-overview.esm.js";import{BeamSelectNonprofit as N}from"./select-nonprofit.esm.js";import{B as g}from"../chunks/index-
|
|
1
|
+
import{BeamCommunityImpact as S}from"./community-impact.esm.js";import{BeamCumulativeImpact as b}from"./cumulative-impact.esm.js";import{BeamImpactOverview as P}from"./impact-overview.esm.js";import{BeamSelectNonprofit as N}from"./select-nonprofit.esm.js";import{B as g}from"../chunks/index-BOHlIBDq.esm.js";import{B as C}from"../chunks/index-Bc_hD09J.esm.js";import{BeamSubscriptionManagement as y}from"./subscription-management.esm.js";import{BeamSubscriptionImpact as M}from"./subscription-impact.esm.js";import{BeamProductDetailsPage as R}from"./product-details-page.esm.js";import{BeamSelectSubscriptionNonprofit as j}from"./select-subscription-nonprofit.esm.js";import{BeamSocialShare as q}from"./social-share.esm.js";import{BeamSubscriberSelectNonprofit as A}from"./subscriber-select-nonprofit.esm.js";import"../chunks/lit-BEag9MFp.esm.js";import"../chunks/css-card-grid-CiqEjkwR.esm.js";import"../chunks/utils-C5hmbxa4.esm.js";import"../chunks/lodash-CrMU6wKg.esm.js";import"../chunks/index-CVHrQ1WC.esm.js";import"../chunks/share-button-o8IBYAxH.esm.js";import"./beam-partner-logos.esm.js";import"../chunks/_share-dialog-dependencies-BvaXft1r.esm.js";import"../chunks/vendor-DUOg5fL-.esm.js";import"../chunks/share-button-DFuEWa2h.esm.js";import"../chunks/responsive-aN8P5PqD.esm.js";import"../chunks/promo-pill-label-D-VXaB27.esm.js";import"../chunks/handlebars-B_i-to-h.esm.js";export{S as BeamCommunityImpact,b as BeamCumulativeImpact,P as BeamImpactOverview,C as BeamPostPurchase,R as BeamProductDetailsPage,g as BeamRedeemTransaction,N as BeamSelectNonprofit,j as BeamSelectSubscriptionNonprofit,q as BeamSocialShare,A as BeamSubscriberSelectNonprofit,M as BeamSubscriptionImpact,y as BeamSubscriptionManagement};
|
|
2
2
|
//# sourceMappingURL=index.esm.js.map
|
package/dist/components/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{BeamCommunityImpact as S}from"./community-impact.js";import{BeamCumulativeImpact as b}from"./cumulative-impact.js";import{BeamImpactOverview as P}from"./impact-overview.js";import{BeamSelectNonprofit as N}from"./select-nonprofit.js";import{B as g}from"../chunks/index-
|
|
1
|
+
import{BeamCommunityImpact as S}from"./community-impact.js";import{BeamCumulativeImpact as b}from"./cumulative-impact.js";import{BeamImpactOverview as P}from"./impact-overview.js";import{BeamSelectNonprofit as N}from"./select-nonprofit.js";import{B as g}from"../chunks/index-Di1IwSgk.esm.js";import{B as C}from"../chunks/index-726Vfz5u.esm.js";import{BeamSubscriptionManagement as y}from"./subscription-management.js";import{BeamSubscriptionImpact as M}from"./subscription-impact.js";import{BeamProductDetailsPage as R}from"./product-details-page.js";import{BeamSelectSubscriptionNonprofit as j}from"./select-subscription-nonprofit.js";import{BeamSocialShare as q}from"./social-share.js";import{BeamSubscriberSelectNonprofit as A}from"./subscriber-select-nonprofit.js";import"../chunks/lit-BEag9MFp.esm.js";import"../chunks/css-card-grid-CiqEjkwR.esm.js";import"../chunks/utils-C5hmbxa4.esm.js";import"../chunks/lodash-CrMU6wKg.esm.js";import"../chunks/index-CVHrQ1WC.esm.js";import"../chunks/share-button-o8IBYAxH.esm.js";import"./beam-partner-logos.js";import"../chunks/_share-dialog-dependencies-BvaXft1r.esm.js";import"../chunks/vendor-DUOg5fL-.esm.js";import"../chunks/share-button-DFuEWa2h.esm.js";import"../chunks/responsive-aN8P5PqD.esm.js";import"../chunks/promo-pill-label-D-VXaB27.esm.js";import"../chunks/handlebars-B_i-to-h.esm.js";export{S as BeamCommunityImpact,b as BeamCumulativeImpact,P as BeamImpactOverview,C as BeamPostPurchase,R as BeamProductDetailsPage,g as BeamRedeemTransaction,N as BeamSelectNonprofit,j as BeamSelectSubscriptionNonprofit,q as BeamSocialShare,A as BeamSubscriberSelectNonprofit,M as BeamSubscriptionImpact,y as BeamSubscriptionManagement};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as lit from 'lit';
|
|
2
2
|
import { LitElement, PropertyValues } from 'lit';
|
|
3
3
|
import * as lit_html from 'lit-html';
|
|
4
|
-
import { L as LANGUAGES, d as TCart } from '../chunks/utils-
|
|
4
|
+
import { L as LANGUAGES, d as TCart } from '../chunks/utils-BPcZ5h8J.esm.js';
|
|
5
5
|
import './redeem-transaction.js';
|
|
6
6
|
import './impact-overview.js';
|
|
7
7
|
import 'lodash-es/debounce';
|
|
@@ -57,6 +57,7 @@ declare class BeamPostPurchase extends LitElement {
|
|
|
57
57
|
private getManualPromoCodes;
|
|
58
58
|
handlePostTransaction: () => Promise<{
|
|
59
59
|
transactionId: string;
|
|
60
|
+
selectionId: string | null;
|
|
60
61
|
transactionCreated: boolean;
|
|
61
62
|
beamUserId: string;
|
|
62
63
|
nonprofitId: number | null;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../chunks/lit-BEag9MFp.esm.js";import"../chunks/utils-C5hmbxa4.esm.js";import"../chunks/css-card-grid-CiqEjkwR.esm.js";import"../chunks/index-
|
|
1
|
+
import"../chunks/lit-BEag9MFp.esm.js";import"../chunks/utils-C5hmbxa4.esm.js";import"../chunks/css-card-grid-CiqEjkwR.esm.js";import"../chunks/index-CVHrQ1WC.esm.js";import"../chunks/index-BOHlIBDq.esm.js";import"./impact-overview.esm.js";import{B as b}from"../chunks/index-Bc_hD09J.esm.js";import"../chunks/lodash-CrMU6wKg.esm.js";import"../chunks/share-button-o8IBYAxH.esm.js";import"./beam-partner-logos.esm.js";import"../chunks/promo-pill-label-D-VXaB27.esm.js";import"../chunks/_share-dialog-dependencies-BvaXft1r.esm.js";import"../chunks/vendor-DUOg5fL-.esm.js";import"../chunks/share-button-DFuEWa2h.esm.js";import"../chunks/responsive-aN8P5PqD.esm.js";export{b as BeamPostPurchase};
|
|
2
2
|
//# sourceMappingURL=post-purchase.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../chunks/lit-BEag9MFp.esm.js";import"../chunks/utils-C5hmbxa4.esm.js";import"../chunks/css-card-grid-CiqEjkwR.esm.js";import"../chunks/index-
|
|
1
|
+
import"../chunks/lit-BEag9MFp.esm.js";import"../chunks/utils-C5hmbxa4.esm.js";import"../chunks/css-card-grid-CiqEjkwR.esm.js";import"../chunks/index-CVHrQ1WC.esm.js";import"../chunks/index-Di1IwSgk.esm.js";import"./impact-overview.js";import{B as b}from"../chunks/index-726Vfz5u.esm.js";import"../chunks/lodash-CrMU6wKg.esm.js";import"../chunks/share-button-o8IBYAxH.esm.js";import"./beam-partner-logos.js";import"../chunks/promo-pill-label-D-VXaB27.esm.js";import"../chunks/_share-dialog-dependencies-BvaXft1r.esm.js";import"../chunks/vendor-DUOg5fL-.esm.js";import"../chunks/share-button-DFuEWa2h.esm.js";import"../chunks/responsive-aN8P5PqD.esm.js";export{b as BeamPostPurchase};
|
|
2
2
|
//# sourceMappingURL=post-purchase.js.map
|
|
@@ -2,7 +2,7 @@ import * as lit from 'lit';
|
|
|
2
2
|
import { LitElement } from 'lit';
|
|
3
3
|
import * as lit_html from 'lit-html';
|
|
4
4
|
import { p as postProductDetailsPage } from '../chunks/routes-D6Gtw6kZ.esm.js';
|
|
5
|
-
import { T as TUrl, L as LANGUAGES } from '../chunks/utils-
|
|
5
|
+
import { T as TUrl, L as LANGUAGES } from '../chunks/utils-BPcZ5h8J.esm.js';
|
|
6
6
|
import 'lodash-es/debounce';
|
|
7
7
|
import 'lodash-es/isEqual';
|
|
8
8
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{m as E,b as r,i as B,n as p,r as z,a as A,h as L}from"../chunks/lit-BEag9MFp.esm.js";import{u as b,B as G,l as W,A as M,c as R,d as k,e as D,f as _}from"../chunks/index-
|
|
1
|
+
import{m as E,b as r,i as B,n as p,r as z,a as A,h as L}from"../chunks/lit-BEag9MFp.esm.js";import{u as b,B as G,l as W,A as M,c as R,d as k,e as D,f as _}from"../chunks/index-CVHrQ1WC.esm.js";import{D as O,z as j,A as H,h as U,C as K,E as w,W as y,x as N,v as V,F as q,G as J,H as Y,I as Z,m as S}from"../chunks/utils-C5hmbxa4.esm.js";import{c as Q,d as X,e as ee}from"../chunks/css-card-grid-CiqEjkwR.esm.js";import{c as te}from"../chunks/responsive-aN8P5PqD.esm.js";import"../chunks/_share-dialog-dependencies-BvaXft1r.esm.js";import"../chunks/vendor-DUOg5fL-.esm.js";import{p as oe}from"../chunks/promo-pill-label-D-VXaB27.esm.js";import"../chunks/lodash-CrMU6wKg.esm.js";const ae=(n="",{borderRadius:e="0px",borderStyle:t="unset",borderColor:o="#000000",borderWidth:i="1px"}={})=>{const a=n.startsWith("--beam-")?n:`--beam-${n}`;return{[`${a}-borderRadius`]:e,[`${a}-borderStyle`]:t,[`${a}-borderColor`]:o,[`${a}-borderWidth`]:i}},ie=(n="",{borderRadius:e="0px",borderStyle:t="unset",borderColor:o="#000000",borderWidth:i="1px"}={})=>{const a=n.startsWith("--beam-")?n:`--beam-${n}`;return E(` border-radius: var(${a}-borderRadius, ${e});
|
|
2
2
|
border-style: var(${a}-borderStyle, ${t});
|
|
3
3
|
border-color: var(${a}-borderColor, ${o});
|
|
4
4
|
border-width: var(${a}-borderWidth, ${i});
|
|
@@ -17,7 +17,7 @@ import{m as E,b as r,i as B,n as p,r as z,a as A,h as L}from"../chunks/lit-BEag9
|
|
|
17
17
|
<circle cx="12" cy="12" r="10"></circle>
|
|
18
18
|
<path d="M12 16v-4"></path>
|
|
19
19
|
<path d="M12 8h.01"></path>
|
|
20
|
-
</svg>`,v={en:{ctaTitle:()=>"Choose Your Impact",ctaMessage:()=>"At no extra cost, 1% of every order will be donated to a nonprofit you choose. Add to cart to choose. Powered by Beam",inlineSeparator:()=>":"},fr:{ctaTitle:()=>"Choisissez votre impact",ctaMessage:()=>"Sans frais suppl\xE9mentaires, 1 % de chaque commande est revers\xE9 \xE0 l'association de votre choix. Ajoutez au panier pour choisir. Propuls\xE9 par Beam.",inlineSeparator:()=>":"},es:{ctaTitle:()=>"Elige tu impacto",ctaMessage:()=>"Sin coste adicional, el 1 % de cada pedido se dona a la organizaci\xF3n sin \xE1nimo de lucro que elijas. A\xF1\xE1delo al carrito para elegir. Impulsado por Beam.",inlineSeparator:()=>":"},de:{ctaTitle:()=>"W\xE4hlen Sie Ihren Impact",ctaMessage:()=>"Ohne zus\xE4tzliche Kosten wird 1 % jeder Bestellung an eine von Ihnen gew\xE4hlte gemeinn\xFCtzige Organisation gespendet. Zum Warenkorb hinzuf\xFCgen, um auszuw\xE4hlen. Unterst\xFCtzt von Beam.",inlineSeparator:()=>":"},it:{ctaTitle:()=>"Scegli il tuo impatto",ctaMessage:()=>"L'1 % di ogni acquisto viene donato, senza alcun costo aggiuntivo, a un'organizzazione no-profit a tua scelta. Aggiungi al carrello per scegliere. Promosso da Beam.",inlineSeparator:()=>":"},pl:{ctaTitle:()=>"Wybierz sw\xF3j wp\u0142yw",ctaMessage:()=>"1 % warto\u015Bci ka\u017Cdego zam\xF3wienia przekazywany jest na wybran\u0105 przez Ciebie organizacj\u0119 non-profit \u2013 bez dodatkowych koszt\xF3w. Dodaj do koszyka, aby wybra\u0107. Obs\u0142ugiwane przez Beam.",inlineSeparator:()=>":"},ja:{ctaTitle:()=>"\u5BC4\u4ED8\u5148\u3092\u304A\u9078\u3073\u304F\u3060\u3055\u3044\u3002",ctaMessage:()=>"\u8FFD\u52A0\u8CBB\u7528\u306A\u3057\u3067\u3001\u3054\u6CE8\u6587\u91D1\u984D\u306E1%\u3092\u975E\u55B6\u5229\u56E3\u4F53\u3078\u5BC4\u4ED8\u3067\u304D\u307E\u3059\u3002\u3054\u5E0C\u671B\u306E\u5834\u5408\u3001\u30AB\u30FC\u30C8\u306B\u8FFD\u52A0\u3057\u3066\u5BC4\u4ED8\u5185\u5BB9\u3092\u304A\u9078\u3073\u304F\u3060\u3055\u3044\u3002Powered by Beam",inlineSeparator:()=>":"}};var se=Object.defineProperty,c=(n,e,t,o)=>{for(var i=void 0,a=n.length-1,l;a>=0;a--)(l=n[a])&&(i=l(e,t,i)||i);return i&&se(e,t,i),i};const le="--beam-ProductDetailsPage-imageUrl";class s extends A{constructor(){super(...arguments),this.baseUrl=O,this.lang="en",this.draftConfig=!1,this.debug=!1,this.localStorage=j(this),this.pluginPromoCodes=[],this.handlePromoCodesStored=e=>{const t=(e.detail.promoCodes?.unvalidatedPromoCodes??[]).map(o=>o.attributes?.value??o.attributes?.url??"").sort();this.pluginPromoCodes=t},this.postProductDetailsPageData=async()=>{ee(["apiKey","storeId"],this);const e=H(G,{apiKey:this.apiKey}),t=this.getManualPromoCodes(),o=U(t.map(l=>({value:l})),this.apiKey),i=o&&!K(o);i&&this.dispatchEvent(new w({source:y.product_details_page}));const a=await W({baseUrl:this.baseUrl,headers:N(this.apiKey),queryParams:{version:"1.0.0",lang:this.configLang,storeId:this.storeId,widgetName:y.product_details_page,draftConfig:this.draftConfig,remoteProductIdentifier:this.remoteProductIdentifier},requestBody:{...i&&{promos:o},beamCartId:e||void 0}});return this.handleValidatedPromoCodes(a),a},this.productDetailsPageDataController=new M(this,this.postProductDetailsPageData)}get configLang(){return V[this.lang]||"en"}get parsedPromoCodes(){return q(this.promoCodes)}getManualPromoCodes(){if(this.parsedPromoCodes&&this.parsedPromoCodes.length>0)return this.parsedPromoCodes;const e=this.localStorage.getItemJson("cart");return e?J(e):[]}async handleValidatedPromoCodes(e){e.promos?.validatedPromoCodes&&(await Promise.all([Y({apiKey:this.apiKey,promoCodes:{validatedPromoCodes:e.promos.validatedPromoCodes,unvalidatedPromoCodes:[]}}),Z({validatedPromoCodes:e.promos.validatedPromoCodes,domain:this.domain})]),this.dispatchEvent(new w({source:y.product_details_page})))}async firstUpdated(){window.addEventListener(S.eventName,this.handlePromoCodesStored)}disconnectedCallback(){window.removeEventListener(S.eventName,this.handlePromoCodesStored),super.disconnectedCallback()}async updated(e){const t=["storeId","baseUrl","lang","apiKey","pluginPromoCodes","promoCodes"];this.pluginPromoCodes;for(const o of t)if(e.has(o)){await this.productDetailsPageDataController.exec();break}}render(){const{data:e,loading:t}=this.productDetailsPageDataController,o=this.cssVariables["--beam-ProductDetailsPage-image-placement"],i=P=>P!=="0px"&&P!=="0",a=this.cssVariables["--beam-ProductDetailsPage-shouldDisplayPromoPill"]==="true",l=!!e?.config?.web?.promo,g=i(this.cssVariables["--beam-ProductDetailsPage-imageHeight"]),h=i(this.cssVariables["--beam-ProductDetailsPage-title-fontSize"]),u=a&&l&&g&&h,m=this.cssVariables["--beam-ProductDetailsPage-shouldDisplayColon"]==="true";return t?r``:e==null?this.debug?R({error:new Error("No data")}):"":r`
|
|
20
|
+
</svg>`,v={en:{ctaTitle:()=>"Choose Your Impact",ctaMessage:()=>"At no extra cost, 1% of every order will be donated to a nonprofit you choose. Add to cart to choose. Powered by Beam",inlineSeparator:()=>":"},fr:{ctaTitle:()=>"Choisissez votre impact",ctaMessage:()=>"Sans frais suppl\xE9mentaires, 1 % de chaque commande est revers\xE9 \xE0 l'association de votre choix. Ajoutez au panier pour choisir. Propuls\xE9 par Beam.",inlineSeparator:()=>":"},es:{ctaTitle:()=>"Elige tu impacto",ctaMessage:()=>"Sin coste adicional, el 1 % de cada pedido se dona a la organizaci\xF3n sin \xE1nimo de lucro que elijas. A\xF1\xE1delo al carrito para elegir. Impulsado por Beam.",inlineSeparator:()=>":"},de:{ctaTitle:()=>"W\xE4hlen Sie Ihren Impact",ctaMessage:()=>"Ohne zus\xE4tzliche Kosten wird 1 % jeder Bestellung an eine von Ihnen gew\xE4hlte gemeinn\xFCtzige Organisation gespendet. Zum Warenkorb hinzuf\xFCgen, um auszuw\xE4hlen. Unterst\xFCtzt von Beam.",inlineSeparator:()=>":"},it:{ctaTitle:()=>"Scegli il tuo impatto",ctaMessage:()=>"L'1 % di ogni acquisto viene donato, senza alcun costo aggiuntivo, a un'organizzazione no-profit a tua scelta. Aggiungi al carrello per scegliere. Promosso da Beam.",inlineSeparator:()=>":"},pl:{ctaTitle:()=>"Wybierz sw\xF3j wp\u0142yw",ctaMessage:()=>"1 % warto\u015Bci ka\u017Cdego zam\xF3wienia przekazywany jest na wybran\u0105 przez Ciebie organizacj\u0119 non-profit \u2013 bez dodatkowych koszt\xF3w. Dodaj do koszyka, aby wybra\u0107. Obs\u0142ugiwane przez Beam.",inlineSeparator:()=>":"},ja:{ctaTitle:()=>"\u5BC4\u4ED8\u5148\u3092\u304A\u9078\u3073\u304F\u3060\u3055\u3044\u3002",ctaMessage:()=>"\u8FFD\u52A0\u8CBB\u7528\u306A\u3057\u3067\u3001\u3054\u6CE8\u6587\u91D1\u984D\u306E1%\u3092\u975E\u55B6\u5229\u56E3\u4F53\u3078\u5BC4\u4ED8\u3067\u304D\u307E\u3059\u3002\u3054\u5E0C\u671B\u306E\u5834\u5408\u3001\u30AB\u30FC\u30C8\u306B\u8FFD\u52A0\u3057\u3066\u5BC4\u4ED8\u5185\u5BB9\u3092\u304A\u9078\u3073\u304F\u3060\u3055\u3044\u3002Powered by Beam",inlineSeparator:()=>":"}};var se=Object.defineProperty,c=(n,e,t,o)=>{for(var i=void 0,a=n.length-1,l;a>=0;a--)(l=n[a])&&(i=l(e,t,i)||i);return i&&se(e,t,i),i};const le="--beam-ProductDetailsPage-imageUrl";class s extends A{constructor(){super(...arguments),this.baseUrl=O,this.lang="en",this.draftConfig=!1,this.debug=!1,this.localStorage=j(this),this.pluginPromoCodes=[],this.handlePromoCodesStored=e=>{const t=(e.detail.promoCodes?.unvalidatedPromoCodes??[]).map(o=>o.attributes?.value??o.attributes?.url??"").sort();this.pluginPromoCodes=t},this.postProductDetailsPageData=async()=>{ee(["apiKey","storeId"],this);const e=H(G,{apiKey:this.apiKey}),t=this.getManualPromoCodes(),o=U(t.map(l=>({value:l})),this.apiKey),i=o&&!K(o);i&&this.dispatchEvent(new w({source:y.product_details_page}));const a=await W({baseUrl:this.baseUrl,headers:N(this.apiKey),queryParams:{version:"1.0.0",lang:this.configLang,storeId:this.storeId,widgetName:y.product_details_page,draftConfig:this.draftConfig,remoteProductIdentifier:this.remoteProductIdentifier},requestBody:{...i&&{promos:o},beamCartId:e||void 0}});return this.handleValidatedPromoCodes(a),a},this.productDetailsPageDataController=new M(this,this.postProductDetailsPageData)}get configLang(){return V[this.lang]||"en"}get parsedPromoCodes(){return q(this.promoCodes)}getManualPromoCodes(){if(this.parsedPromoCodes&&this.parsedPromoCodes.length>0)return this.parsedPromoCodes;const e=this.localStorage.getItemJson("cart");return e?J(e):[]}async handleValidatedPromoCodes(e){e.promos?.validatedPromoCodes?.length&&(await Promise.all([Y({apiKey:this.apiKey,promoCodes:{validatedPromoCodes:e.promos.validatedPromoCodes,unvalidatedPromoCodes:[]}}),Z({validatedPromoCodes:e.promos.validatedPromoCodes,domain:this.domain})]),this.dispatchEvent(new w({source:y.product_details_page})))}async firstUpdated(){window.addEventListener(S.eventName,this.handlePromoCodesStored)}disconnectedCallback(){window.removeEventListener(S.eventName,this.handlePromoCodesStored),super.disconnectedCallback()}async updated(e){const t=["storeId","baseUrl","lang","apiKey","pluginPromoCodes","promoCodes"];this.pluginPromoCodes;for(const o of t)if(e.has(o)){await this.productDetailsPageDataController.exec();break}}render(){const{data:e,loading:t}=this.productDetailsPageDataController,o=this.cssVariables["--beam-ProductDetailsPage-image-placement"],i=P=>P!=="0px"&&P!=="0",a=this.cssVariables["--beam-ProductDetailsPage-shouldDisplayPromoPill"]==="true",l=!!e?.config?.web?.promo,g=i(this.cssVariables["--beam-ProductDetailsPage-imageHeight"]),h=i(this.cssVariables["--beam-ProductDetailsPage-title-fontSize"]),u=a&&l&&g&&h,m=this.cssVariables["--beam-ProductDetailsPage-shouldDisplayColon"]==="true";return t?r``:e==null?this.debug?R({error:new Error("No data")}):"":r`
|
|
21
21
|
<style>
|
|
22
22
|
:host {
|
|
23
23
|
${this.cssVariables.toCSS()}
|