@beamimpact/web-sdk 1.51.1 → 1.52.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{_share-dialog-dependencies-CHbTSPha.esm.js → _share-dialog-dependencies-BwdvNwrJ.esm.js} +2 -2
- package/dist/chunks/{_share-dialog-dependencies-CHbTSPha.esm.js.map → _share-dialog-dependencies-BwdvNwrJ.esm.js.map} +1 -1
- package/dist/chunks/{_share-dialog-dependencies-B3N69ml2.esm.js → _share-dialog-dependencies-QaTONkKb.esm.js} +2 -2
- package/dist/chunks/{_share-dialog-dependencies-B3N69ml2.esm.js.map → _share-dialog-dependencies-QaTONkKb.esm.js.map} +1 -1
- package/dist/chunks/{css-card-grid-B6IEaTiP.esm.js → css-card-grid-CvoGpsJH.esm.js} +2 -2
- package/dist/chunks/{css-card-grid-B6IEaTiP.esm.js.map → css-card-grid-CvoGpsJH.esm.js.map} +1 -1
- package/dist/chunks/{enforce-config-CQb5MiAV.esm.js → enforce-config-Ba1JkOHs.esm.js} +2 -2
- package/dist/chunks/{enforce-config-CQb5MiAV.esm.js.map → enforce-config-Ba1JkOHs.esm.js.map} +1 -1
- package/dist/chunks/{enforce-config-Cw52SuAc.esm.js → enforce-config-CZ3ToOgr.esm.js} +2 -2
- package/dist/chunks/{enforce-config-Cw52SuAc.esm.js.map → enforce-config-CZ3ToOgr.esm.js.map} +1 -1
- package/dist/chunks/index-B5vRxWI3.esm.js +2 -0
- package/dist/chunks/index-B5vRxWI3.esm.js.map +1 -0
- package/dist/chunks/{index-BQ4Nr7Ux.esm.js → index-BNjsFEGn.esm.js} +2 -2
- package/dist/chunks/{index-BQ4Nr7Ux.esm.js.map → index-BNjsFEGn.esm.js.map} +1 -1
- package/dist/chunks/index-BsuCVFh-.esm.js +2 -0
- package/dist/chunks/index-BsuCVFh-.esm.js.map +1 -0
- package/dist/chunks/index-C9SnlT_2.esm.js +2 -0
- package/dist/chunks/index-C9SnlT_2.esm.js.map +1 -0
- package/dist/chunks/index-CFZqe2Wn.esm.js +2 -0
- package/dist/chunks/index-CFZqe2Wn.esm.js.map +1 -0
- package/dist/chunks/index-CTt5RnKY.esm.js +2 -0
- package/dist/chunks/index-CTt5RnKY.esm.js.map +1 -0
- package/dist/chunks/{index-kDoWfjd5.esm.js → index-DElVAjg2.esm.js} +2 -2
- package/dist/chunks/{index-kDoWfjd5.esm.js.map → index-DElVAjg2.esm.js.map} +1 -1
- package/dist/chunks/{index-CFYWEffm.esm.js → index-DTGB86pM.esm.js} +2 -2
- package/dist/chunks/{index-CFYWEffm.esm.js.map → index-DTGB86pM.esm.js.map} +1 -1
- package/dist/chunks/index-DZt3Lbb4.esm.js +2 -0
- package/dist/chunks/index-DZt3Lbb4.esm.js.map +1 -0
- package/dist/chunks/{index-C_ZNnJIS.esm.js → index-IKiJwo5v.esm.js} +2 -2
- package/dist/chunks/{index-C_ZNnJIS.esm.js.map → index-IKiJwo5v.esm.js.map} +1 -1
- package/dist/chunks/{index-v0tUXySN.esm.d.ts → index-TAxKoTC1.esm.d.ts} +3 -2
- package/dist/chunks/{index-MS8_Vije.esm.d.ts → index-ki8pLX6n.esm.d.ts} +1 -1
- package/dist/chunks/{lit-5uUWs2aX.esm.js → lit-WqMxC_PA.esm.js} +3 -3
- package/dist/chunks/{lit-5uUWs2aX.esm.js.map → lit-WqMxC_PA.esm.js.map} +1 -1
- package/dist/chunks/loading-template-DG4lkIIc.esm.js +2 -0
- package/dist/chunks/{loading-template-DXNS89Th.esm.js.map → loading-template-DG4lkIIc.esm.js.map} +1 -1
- package/dist/chunks/{localize-cDQFOecn.esm.js → localize-Btu9xYcE.esm.js} +2 -2
- package/dist/chunks/{localize-cDQFOecn.esm.js.map → localize-Btu9xYcE.esm.js.map} +1 -1
- package/dist/chunks/{localize-CQCRjY9s.esm.js → localize-C25pEGnx.esm.js} +2 -2
- package/dist/chunks/{localize-CQCRjY9s.esm.js.map → localize-C25pEGnx.esm.js.map} +1 -1
- package/dist/chunks/{order-page-FzVtMkga.esm.js → order-page-BbrDKYmJ.esm.js} +2 -2
- package/dist/chunks/{order-page-CMGPM57D.esm.js.map → order-page-BbrDKYmJ.esm.js.map} +1 -1
- package/dist/chunks/{order-page-tSPKLQ24.esm.d.ts → order-page-Cerye00Q.esm.d.ts} +12 -1
- package/dist/chunks/{order-page-CMGPM57D.esm.js → order-page-stMlaqKK.esm.js} +2 -2
- package/dist/chunks/{order-page-FzVtMkga.esm.js.map → order-page-stMlaqKK.esm.js.map} +1 -1
- package/dist/chunks/{progress-bar-oJB_t7od.esm.js → progress-bar-DF7UuuHb.esm.js} +2 -2
- package/dist/chunks/{progress-bar-oJB_t7od.esm.js.map → progress-bar-DF7UuuHb.esm.js.map} +1 -1
- package/dist/chunks/{promo-pill-label-D9ptiGak.esm.js → promo-pill-label-CbW_Vcru.esm.js} +2 -2
- package/dist/chunks/{promo-pill-label-D9ptiGak.esm.js.map → promo-pill-label-CbW_Vcru.esm.js.map} +1 -1
- package/dist/chunks/{responsive-9jAzOYoE.esm.js → responsive-BR8qUfBa.esm.js} +2 -2
- package/dist/chunks/{responsive-9jAzOYoE.esm.js.map → responsive-BR8qUfBa.esm.js.map} +1 -1
- package/dist/chunks/{routes-KHEaM_40.esm.js → routes-CAhDCFDX.esm.js} +2 -2
- package/dist/chunks/{routes-KHEaM_40.esm.js.map → routes-CAhDCFDX.esm.js.map} +1 -1
- package/dist/chunks/{routes-CaSRr919.esm.js → routes-pcL-CUiQ.esm.js} +2 -2
- package/dist/chunks/{routes-CaSRr919.esm.js.map → routes-pcL-CUiQ.esm.js.map} +1 -1
- package/dist/chunks/{share-button-DBVhw4qa.esm.d.ts → share-button-B9hpxBVr.esm.d.ts} +5 -0
- package/dist/chunks/share-button-BYVId0-U.esm.js +2 -0
- package/dist/chunks/share-button-BYVId0-U.esm.js.map +1 -0
- package/dist/chunks/share-button-BvUcpOcx.esm.js +167 -0
- package/dist/chunks/share-button-BvUcpOcx.esm.js.map +1 -0
- package/dist/chunks/share-button-C-DXj68Z.esm.js +2 -0
- package/dist/chunks/share-button-C-DXj68Z.esm.js.map +1 -0
- package/dist/chunks/share-button-CtklpZOO.esm.js +167 -0
- package/dist/chunks/share-button-CtklpZOO.esm.js.map +1 -0
- package/dist/chunks/{update-cart-DNfl9QP2.esm.js → update-cart-BLsw_Faz.esm.js} +2 -2
- package/dist/chunks/{update-cart-DNfl9QP2.esm.js.map → update-cart-BLsw_Faz.esm.js.map} +1 -1
- package/dist/chunks/{update-cart-3JFUCJLD.esm.js → update-cart-ciJaz8li.esm.js} +2 -2
- package/dist/chunks/{update-cart-3JFUCJLD.esm.js.map → update-cart-ciJaz8li.esm.js.map} +1 -1
- package/dist/chunks/{vendor-DRA8u-S7.esm.js → vendor-KKSARHWL.esm.js} +2 -2
- package/dist/chunks/{vendor-DRA8u-S7.esm.js.map → vendor-KKSARHWL.esm.js.map} +1 -1
- package/dist/components/beam-partner-logos.esm.js +1 -1
- package/dist/components/beam-partner-logos.js +1 -1
- package/dist/components/community-impact.esm.js +3 -3
- package/dist/components/community-impact.esm.js.map +1 -1
- package/dist/components/community-impact.js +3 -3
- package/dist/components/community-impact.js.map +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 +18 -13
- package/dist/components/impact-overview.esm.js.map +1 -1
- package/dist/components/impact-overview.js +18 -13
- package/dist/components/impact-overview.js.map +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 +1 -1
- package/dist/components/post-purchase.esm.js +1 -1
- package/dist/components/post-purchase.js +1 -1
- package/dist/components/product-details-page.esm.js +1 -1
- package/dist/components/product-details-page.js +1 -1
- package/dist/components/redeem-transaction.esm.js +1 -1
- package/dist/components/redeem-transaction.js +1 -1
- package/dist/components/select-nonprofit.esm.js +88 -88
- package/dist/components/select-nonprofit.esm.js.map +1 -1
- package/dist/components/select-nonprofit.js +88 -88
- package/dist/components/select-nonprofit.js.map +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 +2 -2
- package/dist/components/shopify.esm.js +1 -1
- package/dist/components/shopify.esm.js.map +1 -1
- package/dist/components/shopify.js +1 -1
- package/dist/components/shopify.js.map +1 -1
- package/dist/components/social-share.esm.js +3 -3
- package/dist/components/social-share.esm.js.map +1 -1
- package/dist/components/social-share.js +3 -3
- package/dist/components/social-share.js.map +1 -1
- package/dist/components/subscription-impact.d.ts +1 -1
- package/dist/components/subscription-impact.esm.js +26 -24
- package/dist/components/subscription-impact.esm.js.map +1 -1
- package/dist/components/subscription-impact.js +26 -24
- package/dist/components/subscription-impact.js.map +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 +4 -4
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/integrations/beam.esm.js +1 -1
- package/dist/integrations/beam.js +1 -1
- package/dist/integrations/cart.esm.js +1 -1
- package/dist/integrations/cart.js +1 -1
- package/dist/integrations/index.d.ts +3 -3
- package/dist/integrations/index.esm.js +1 -1
- package/dist/integrations/index.js +1 -1
- package/dist/integrations/logs.esm.js +1 -1
- package/dist/integrations/logs.js +1 -1
- package/dist/integrations/session.esm.js +1 -1
- package/dist/integrations/session.js +1 -1
- package/dist/integrations/shopify.d.ts +2 -2
- package/dist/integrations/shopify.esm.js +1 -1
- package/dist/integrations/shopify.js +1 -1
- package/dist/integrations/statsig.esm.js +1 -1
- package/dist/integrations/statsig.js +1 -1
- package/dist/react/beam-partner-logos.esm.js +1 -1
- package/dist/react/beam-partner-logos.js +1 -1
- package/dist/react/community-impact.esm.js +1 -1
- package/dist/react/community-impact.js +1 -1
- package/dist/react/cumulative-impact.esm.js +1 -1
- package/dist/react/cumulative-impact.js +1 -1
- package/dist/react/impact-overview.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.esm.js +1 -1
- package/dist/react/product-details-page.js +1 -1
- package/dist/react/redeem-transaction.esm.js +1 -1
- package/dist/react/redeem-transaction.js +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.esm.js +1 -1
- package/dist/react/select-subscription-nonprofit.js +1 -1
- package/dist/react/social-share.esm.js +1 -1
- package/dist/react/social-share.js +1 -1
- package/dist/react/subscription-impact.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/package.json +1 -1
- package/dist/chunks/index-B_8DexDX.esm.js +0 -2
- package/dist/chunks/index-B_8DexDX.esm.js.map +0 -1
- package/dist/chunks/index-CpPbNdWA.esm.js +0 -2
- package/dist/chunks/index-CpPbNdWA.esm.js.map +0 -1
- package/dist/chunks/index-CyiXyHi8.esm.js +0 -2
- package/dist/chunks/index-CyiXyHi8.esm.js.map +0 -1
- package/dist/chunks/index-JSoHc6g1.esm.js +0 -2
- package/dist/chunks/index-JSoHc6g1.esm.js.map +0 -1
- package/dist/chunks/index-XZRQN4Rs.esm.js +0 -2
- package/dist/chunks/index-XZRQN4Rs.esm.js.map +0 -1
- package/dist/chunks/index-n7pxZENA.esm.js +0 -2
- package/dist/chunks/index-n7pxZENA.esm.js.map +0 -1
- package/dist/chunks/loading-template-DXNS89Th.esm.js +0 -2
- package/dist/chunks/share-button-BbG-gnwj.esm.js +0 -163
- package/dist/chunks/share-button-BbG-gnwj.esm.js.map +0 -1
- package/dist/chunks/share-button-CvTUluNq.esm.js +0 -163
- package/dist/chunks/share-button-CvTUluNq.esm.js.map +0 -1
- package/dist/chunks/share-button-R7jgVCPv.esm.js +0 -2
- package/dist/chunks/share-button-R7jgVCPv.esm.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{h as
|
|
1
|
+
import{h as k,f as $,y as d,g as f,t as L,q as v,u as H,m as D,k as q}from"../chunks/lit-WqMxC_PA.esm.js";import{i as V,d as J}from"../chunks/lodash-7H4x2457.esm.js";import{u as S,A as E,d as h,a as G,_ as z,i as m}from"../chunks/localize-Btu9xYcE.esm.js";import{D as Q,W as C,e as X,i as Y,S as Z}from"../chunks/routes-pcL-CUiQ.esm.js";import{p as ee}from"../chunks/progress-bar-DF7UuuHb.esm.js";import{p as te}from"../chunks/promo-pill-label-CbW_Vcru.esm.js";import{c as oe,d as ie,e as P}from"../chunks/enforce-config-CZ3ToOgr.esm.js";import{_ as ne}from"../chunks/loading-template-DG4lkIIc.esm.js";import{f as A,c as M,i as re,g as T,a as B}from"../chunks/events-BohmT6Lp.esm.js";import{logger as ae}from"../utils/logger.esm.js";import{createScopedLocalStorage as se}from"../utils/local-storage.esm.js";import{f as le,i as ce,e as pe,h as de,k as fe,s as me}from"../chunks/promoManager-fl54hq13.esm.js";import{c as ge}from"../chunks/responsive-BR8qUfBa.esm.js";import{B as F}from"../chunks/cart-contents-DkoytiZh.esm.js";import{getBeamCartId as K,getExternalCartId as _}from"../utils/cart.esm.js";import"../chunks/beam-errors-Ci0d3926.esm.js";import"../chunks/vendor-KKSARHWL.esm.js";import"../utils/cookies.esm.js";class he extends k{static get styles(){return $`
|
|
2
2
|
:host {
|
|
3
3
|
}
|
|
4
4
|
|
|
@@ -18,49 +18,51 @@ import{h as w,f as I,y as d,g as f,t as P,q as W,m as U,k as R}from"../chunks/li
|
|
|
18
18
|
aria-label="Notification Blip"
|
|
19
19
|
>
|
|
20
20
|
<span class="notification-blip" part="notification-blip" role="button" tabindex="0" aria-hidden="true"></span>
|
|
21
|
-
</div>`}}customElements.get("beam-notification-blip")||customElements.define("beam-notification-blip",de);const fe={"--beam-notificationBlip-color-background":"#000"},g={en:{beamAttribution:()=>"Powered by Beam",ctaTitle:()=>"Choose your impact",ctaPromoPrefixMessage:()=>"At no extra cost,",ctaPromoMessage:({donationPercentage:r="1"}={})=>`select a nonprofit and ${r}% of your purchase will be donated.`,ctaMessage:({donationPercentage:r="1"}={})=>`At no extra cost, select a nonprofit and ${r}% of your purchase will be donated.`,inlineSeparator:()=>": "},fr:{beamAttribution:()=>"Optimis\xE9 par Beam",ctaTitle:()=>"Choisissez votre cause",ctaPromoPrefixMessage:()=>"",ctaPromoMessage:()=>"",ctaMessage:({donationPercentage:r="1"}={})=>`Sans frais suppl\xE9mentaires, choisissez un organisme \xE0 but non lucratif et ${r} % lui sera vers\xE9 en votre nom.`,inlineSeparator:()=>" : "},de:{beamAttribution:()=>"Unterst\xFCtzt von Beam",ctaTitle:()=>"W\xE4hle deinen Impact",ctaPromoPrefixMessage:()=>"",ctaPromoMessage:()=>"",ctaMessage:({donationPercentage:r="1"}={})=>`Ohne zus\xE4tzliche Kosten, w\xE4hle eine der gemeinn\xFCtzigen Organisationen und spende ${r}% deines Einkaufs`,inlineSeparator:()=>": "},es:{beamAttribution:()=>"Ofrecido por Beam",ctaTitle:()=>"Elige tu contribuci\xF3n",ctaPromoPrefixMessage:()=>"",ctaPromoMessage:()=>"",ctaMessage:({donationPercentage:r="1"}={})=>`Sin coste adicional, elige una organizaci\xF3n sin fines de lucro y donaremos ${r}% de tu compra.`,inlineSeparator:()=>": "},it:{beamAttribution:()=>"Gestito da Beam",ctaTitle:()=>"Scegli dove fare la differenza",ctaPromoPrefixMessage:()=>"",ctaPromoMessage:()=>"",ctaMessage:({donationPercentage:r="1"}={})=>`Senza costi aggiuntivi, seleziona un'organizzazione no-profit a cui devolvere l\u2019${r}% del tuo acquisto`,inlineSeparator:()=>": "},pl:{beamAttribution:()=>"Wspierany przez Beam",ctaTitle:()=>"Wybierz inicjatyw\u0119, kt\xF3r\u0105 chcesz wesprze\u0107",ctaPromoPrefixMessage:()=>"",ctaPromoMessage:()=>"",ctaMessage:({donationPercentage:r="1"}={})=>`Bez \u017Cadnych dodatkowych koszt\xF3w wybierz organizacj\u0119, kt\xF3rej przeka\u017Cesz ${r}% warto\u015Bci Twoich zakup\xF3w!`,inlineSeparator:()=>": "}};var me=Object.defineProperty,p=(r,e,t,n)=>{for(var o=void 0,i=r.length-1,a;i>=0;i--)(a=r[i])&&(o=a(e,t,o)||o);return o&&me(e,t,o),o};class s extends w{constructor(){super(...arguments),this.baseUrl=V,this.selectedNonprofitId=null,this.lang="en",this.debug=!1,this.draftConfig=!1,this.isMobile=window.innerWidth<768,this.enableNonprofitDeselection=!1,this.didTryToCreateNewSelectionFromCache=!1,this.pluginPromoCodes=[],this.handlePromoCodesStored=e=>{const t=(e.detail.promoCodes?.unvalidatedPromoCodes??[]).map(n=>n.attributes?.value??n.attributes?.url??"").sort();this.pluginPromoCodes=t},this.getChainNonprofits=async()=>{v(["apiKey"],this);const e=M(A,{apiKey:this.apiKey}),t=T("cart",{apiKey:this.apiKey}),n=this.cart?.content?{schema:this.cart?.schema,content:this.cart?.content}:void 0,o=this.getManualPromoCodes(),i=ne(o.map(u=>({value:u})),this.apiKey),a=i&&!re(i);a&&this.dispatchEvent(new L({source:N.select_nonprofit}));const l=await q({baseUrl:this.baseUrl,apiRoot:"/api/v3",headers:{authorization:`Api-Key ${this.apiKey}`},requestBody:{storeId:this.storeId,widgetName:N.select_nonprofit,postalCode:this.postalCode,countryCode:this.countryCode,beamCartId:e||void 0,cartId:t||void 0,version:"1.0.0",lang:this.configLang,...a&&{promos:i},options:{config:{draftConfig:this.draftConfig}},cart:n}});return this.enableNonprofitDeselection=!!l.config.enableNonprofitDeselection,this.selectedNonprofitId!==null&&this.selectedNonprofitId&&!l.nonprofits.map(u=>u.nonprofit.id).includes(this.selectedNonprofitId)&&(this.selectedNonprofitId=null,await this.postSelectNonprofit({selectedNonprofitId:null}),this.localStorage.setItem("nonprofit",null)),l.store?.id&&l.store.id!==this.storeId&&(this.storeId=l.store.id),await this.createNewSelectionForCachedNonprofit(),this.localStorage.setItemJson("chainNonprofits",{createdAt:new Date,data:l}),this.handleValidatedPromoCodes(l),l},this.postSelectNonprofit=async({selectedNonprofitId:e})=>{v(["apiKey","storeId"],this);const t=T("cart",{apiKey:this.apiKey}),n=M(A,{apiKey:this.apiKey}),o=await J({baseUrl:this.baseUrl,headers:{authorization:`Api-Key ${this.apiKey}`},requestBody:{nonprofitId:e,selectionId:this.selectionId,storeId:this.storeId,cartId:t||void 0,beamCartId:n||void 0,postalCode:this.postalCode,countryCode:this.countryCode}});this.selectionId=o?.selectionId,this.localStorage.setItem("transaction",this.selectionId),this.localStorage.setItem("nonprofit",e),this.localStorage.setItem("nonprofit_selected_at",new Date().toISOString()),await this.updateComplete;const i=this.getNonprofitById(e);e!==null&&this.dispatchEvent(new D({selectedNonprofitId:e,selectionId:this.selectionId,nonprofitName:i?.nonprofit?.name??null,source:N.select_nonprofit})),e===null&&this.dispatchEvent(new te({newNonprofitId:null,selectionId:this.selectionId}))},this.nonprofitListDataController=new k(this,this.getChainNonprofits),this.selectionDataController=new k(this,this.postSelectNonprofit),this.localStorage=ie(this),this.handleCartChange=e=>{this.cart=e.detail},this.makeHandleSelect=(e,t,n)=>async o=>{const i=this.selectedNonprofitId;if(o instanceof KeyboardEvent){let a=null;switch(o.key){case"ArrowUp":case"ArrowLeft":t===0?a=n[n.length-1]:a=n[t-1],o.preventDefault();break;case"ArrowRight":case"ArrowDown":t===n.length-1?a=n[0]:a=n[t+1],o.preventDefault();break;case"Enter":case" ":o.preventDefault();break;default:return}if(a){i!=null&&(this.selectedNonprofitId=a.nonprofit.id);const l=this.renderRoot.querySelector(`[data-value="${a.nonprofit.id}"]`);l!==null&&(l.tabIndex=0,l.focus());return}}if(o.currentTarget instanceof HTMLElement)if(i===e)if(this.enableNonprofitDeselection)this.selectedNonprofitId=null,this.localStorage.setItem("nonprofit",null);else return;else this.selectedNonprofitId=e;await this.selectionDataController.exec({selectedNonprofitId:this.selectedNonprofitId})},this.evaluateBreakPoints=j(()=>{this.isMobile=window.innerWidth<768},50,{maxWait:50,leading:!0})}get configLang(){return G[this.lang]||"en"}get parsedPromoCodes(){return ae(this.promoCodes)}getManualPromoCodes(){if(this.parsedPromoCodes&&this.parsedPromoCodes.length>0)return this.parsedPromoCodes;const e=this.localStorage.getItemJson("cart");return e?se(e):[]}async handleValidatedPromoCodes(e){e.promos?.validatedPromoCodes&&(await Promise.all([le({apiKey:this.apiKey,promoCodes:{validatedPromoCodes:e.promos.validatedPromoCodes,unvalidatedPromoCodes:[]}}),ce({validatedPromoCodes:e.promos.validatedPromoCodes,domain:this.domain})]),this.dispatchEvent(new L({source:N.select_nonprofit})))}getNonprofitById(e){return e?this.nonprofitListDataController?.data?.nonprofits.find(t=>t.nonprofit.id===e):null}async connectedCallback(){super.connectedCallback(),this.nonprofitListDataController.loading=!0,window.addEventListener(E.eventName,this.handleCartChange),window.addEventListener("resize",this.evaluateBreakPoints)}async firstUpdated(){await this.restoreStateFromCache(),window.addEventListener(z.eventName,this.handlePromoCodesStored)}async updated(e){const t=["baseUrl","storeId","apiKey","countryCode","postalCode","cart","lang","pluginPromoCodes"];this.pluginPromoCodes;for(const n of t)if(e.has(n)){await this.nonprofitListDataController.exec();break}}disconnectedCallback(){window.removeEventListener(E.eventName,this.handleCartChange),window.removeEventListener("resize",this.evaluateBreakPoints),window.removeEventListener(z.eventName,this.handlePromoCodesStored),super.disconnectedCallback()}async restoreStateFromCache(){try{const e=new Date().valueOf();this.cart=this.localStorage.getItemJson("cart")??void 0;const t=30*24*60*60*1e3,n=this.localStorage.getItem("nonprofit_selected_at")??0,o=e>new Date(n).valueOf()+t;o?o&&this.selectedNonprofitId!==null&&(await this.postSelectNonprofit({selectedNonprofitId:null}),this.localStorage.setItem("nonprofit",null)):(this.selectedNonprofitId=parseInt(this.localStorage.getItem("nonprofit")||"")||null,this.selectionId=this.localStorage.getItem("transaction")??void 0);const{createdAt:i=0,data:a}=this.localStorage.getItemJson("chainNonprofits")||{},l=2*60*60*1e3;!(e>new Date(i).valueOf()+l)&&this.nonprofitListDataController.loading&&(this.nonprofitListDataController.data=a,this.nonprofitListDataController.loading=!1)}catch(e){oe.error(e)}}async createNewSelectionForCachedNonprofit(){if(v(["apiKey"],this),!(!this.storeId||this.didTryToCreateNewSelectionFromCache))try{if(this.didTryToCreateNewSelectionFromCache=!0,this.selectedNonprofitId){this.selectionId||await this.selectionDataController.exec({selectedNonprofitId:this.selectedNonprofitId});const e=this.getNonprofitById(this.selectedNonprofitId);this.dispatchEvent(new D({selectedNonprofitId:this.selectedNonprofitId,selectionId:this.selectionId,nonprofitName:e?.nonprofit?.name,source:N.select_nonprofit}))}}catch{}}get cssVariables(){const e={"--beam-fontFamily":"inherit","--beam-fontStyle":"inherit","--beam-fontSize":"inherit","--beam-textColor":"inherit","--beam-backgroundColor":"inherit",...Q,"--beam-SelectNonprofit-title-textAlign":"inherit","--beam-SelectNonprofit-description-textAlign":"inherit","--beam-SelectNonprofit-maxWidth":"800px","--beam-SelectNonprofit-options-marginTop":"0px","--beam-SelectNonprofit-options-iconHeight":"24px","--beam-SelectNonprofit-options-padding":"10px","--beam-SelectNonprofit-options-borderRadius":"0px","--beam-SelectNonprofit-options-borderColor":"currentColor","--beam-SelectNonprofit-options--selected-borderColor":"currentColor","--beam-SelectNonprofit-options-backgroundColor":"transparent","--beam-SelectNonprofit-options-gap":"8px","--beam-SelectNonprofit-options--selected-backgroundColor":"currentColor","--beam-SelectNonprofit-details-marginTop":"10px","--beam-SelectNonprofit-details-borderRadius":"0px","--beam-SelectNonprofit-details-borderColor":"currentColor","--beam-SelectNonprofit-details-backgroundColor":"inherit","--beam-SelectNonprofit-details-padding":"10px",...h("--beam-SelectNonprofit-title",{fontSize:"1.25em",fontWeight:"bold"}),"--beam-SelectNonprofit-header-inline-lineHeight":"inherit",...h("--beam-SelectNonprofit-title-inline",{fontWeight:"bold"}),"--beam-SelectNonprofit-title-inline-textTransform":"none","--beam-SelectNonprofit-title-block-margin-right":"8px",...h("--beam-SelectNonprofit-description",{marginTop:"0.5em"}),...h("--beam-SelectNonprofit-description-inline"),...h("--beam-SelectNonprofit-details-cause",{fontSize:"0.85em",fontWeight:"bold"}),...h("--beam-SelectNonprofit-details-beamAttribution",{fontSize:"0.85em"}),...h("--beam-SelectNonprofit-details-impactDescription",{fontSize:"1em",marginTop:"10px"}),"--beam-SelectNonprofit-details-nonprofitName-fontWeight":"bold","--beam-SelectNonprofit-details-nonprofitName-fontStyle":"inherit","--beam-SelectNonprofit-details-fundingProgress-marginTop":"10px",...h("--beam-SelectNonprofit-details-fundingProgressLabel",{fontSize:"0.85em"}),...fe,...X,"--beam-SelectNonprofit-promo-block-header-justifyContent":"initial","--beam-SelectNonprofit-notification-blip-top":"4px","--beam-SelectNonprofit-notification-blip-left":"50%","--beam-SelectNonprofit-display-notification-blip":"true"},t=this.nonprofitListDataController?.data?.config?.web?.theme||{},n={...e,...t};return Object.assign(Object.create({toCSS(){return H(this)}}),n)}render(){const{selectedNonprofitId:e}=this,{data:t,loading:n}=this.nonprofitListDataController;if(n&&!t)return ee();if(this.nonprofitListDataController.error)return this.debug?$({error:this.nonprofitListDataController.error}):"";if(this.selectionDataController.error&&this.debug)return $({error:this.selectionDataController.error});const o=t?.nonprofits||[],i=o.find(c=>c.nonprofit.id===e)||null,a=!!t?.config?.web?.promo,l=o.some(c=>!c.promo||!c.promo.isActive),u=this.cssVariables["--beam-SelectNonprofit-display-notification-blip"]==="true",y=this.cssVariables["--beam-SelectNonprofit-title-textAlign"]==="center",x=d`<h3 class="title-block d-none d-lg-block" part="title" id="beam-SelectNonprofit-title">
|
|
21
|
+
</div>`}}customElements.get("beam-notification-blip")||customElements.define("beam-notification-blip",he);const be={"--beam-notificationBlip-color-background":"#000"},g={en:{beamAttribution:()=>"Powered by Beam",ctaTitle:()=>"Choose your impact",ctaPromoPrefixMessage:()=>"At no extra cost,",ctaPromoMessage:({donationPercentage:r="1"}={})=>`select a nonprofit and ${r}% of your purchase will be donated.`,ctaMessage:({donationPercentage:r="1"}={})=>`At no extra cost, select a nonprofit and ${r}% of your purchase will be donated.`,inlineSeparator:()=>": "},fr:{beamAttribution:()=>"Optimis\xE9 par Beam",ctaTitle:()=>"Choisissez votre cause",ctaPromoPrefixMessage:()=>"",ctaPromoMessage:()=>"",ctaMessage:({donationPercentage:r="1"}={})=>`Sans frais suppl\xE9mentaires, choisissez un organisme \xE0 but non lucratif et ${r} % lui sera vers\xE9 en votre nom.`,inlineSeparator:()=>" : "},de:{beamAttribution:()=>"Unterst\xFCtzt von Beam",ctaTitle:()=>"W\xE4hle deinen Impact",ctaPromoPrefixMessage:()=>"",ctaPromoMessage:()=>"",ctaMessage:({donationPercentage:r="1"}={})=>`Ohne zus\xE4tzliche Kosten, w\xE4hle eine der gemeinn\xFCtzigen Organisationen und spende ${r}% deines Einkaufs`,inlineSeparator:()=>": "},es:{beamAttribution:()=>"Ofrecido por Beam",ctaTitle:()=>"Elige tu contribuci\xF3n",ctaPromoPrefixMessage:()=>"",ctaPromoMessage:()=>"",ctaMessage:({donationPercentage:r="1"}={})=>`Sin coste adicional, elige una organizaci\xF3n sin fines de lucro y donaremos ${r}% de tu compra.`,inlineSeparator:()=>": "},it:{beamAttribution:()=>"Gestito da Beam",ctaTitle:()=>"Scegli dove fare la differenza",ctaPromoPrefixMessage:()=>"",ctaPromoMessage:()=>"",ctaMessage:({donationPercentage:r="1"}={})=>`Senza costi aggiuntivi, seleziona un'organizzazione no-profit a cui devolvere l\u2019${r}% del tuo acquisto`,inlineSeparator:()=>": "},pl:{beamAttribution:()=>"Wspierany przez Beam",ctaTitle:()=>"Wybierz inicjatyw\u0119, kt\xF3r\u0105 chcesz wesprze\u0107",ctaPromoPrefixMessage:()=>"",ctaPromoMessage:()=>"",ctaMessage:({donationPercentage:r="1"}={})=>`Bez \u017Cadnych dodatkowych koszt\xF3w wybierz organizacj\u0119, kt\xF3rej przeka\u017Cesz ${r}% warto\u015Bci Twoich zakup\xF3w!`,inlineSeparator:()=>": "}};var ue=Object.defineProperty,p=(r,e,t,n)=>{for(var o=void 0,i=r.length-1,s;i>=0;i--)(s=r[i])&&(o=s(e,t,o)||o);return o&&ue(e,t,o),o};class l extends k{constructor(){super(...arguments),this.baseUrl=Q,this.selectedNonprofitId=null,this.lang="en",this.debug=!1,this.draftConfig=!1,this.isMobile=window.innerWidth<768,this.enableNonprofitDeselection=!1,this.didTryToCreateNewSelectionFromCache=!1,this.pluginPromoCodes=[],this.handlePromoCodesStored=e=>{const t=(e.detail.promoCodes?.unvalidatedPromoCodes??[]).map(n=>n.attributes?.value??n.attributes?.url??"").sort();this.pluginPromoCodes=t},this.getChainNonprofits=async()=>{P(["apiKey"],this);const e=K(F,{apiKey:this.apiKey}),t=_("cart",{apiKey:this.apiKey}),n=this.cart?.content?{schema:this.cart?.schema,content:this.cart?.content}:void 0,o=this.getManualPromoCodes(),i=le(o.map(b=>({value:b})),this.apiKey),s=i&&!ce(i);s&&this.dispatchEvent(new A({source:C.select_nonprofit}));const c=await X({baseUrl:this.baseUrl,apiRoot:"/api/v3",headers:{authorization:`Api-Key ${this.apiKey}`},requestBody:{storeId:this.storeId,widgetName:C.select_nonprofit,postalCode:this.postalCode,countryCode:this.countryCode,beamCartId:e||void 0,cartId:t||void 0,version:"1.0.0",lang:this.configLang,...s&&{promos:i},options:{config:{draftConfig:this.draftConfig}},cart:n}});return this.enableNonprofitDeselection=!!c.config.enableNonprofitDeselection,this.selectedNonprofitId!==null&&this.selectedNonprofitId&&!c.nonprofits.map(b=>b.nonprofit.id).includes(this.selectedNonprofitId)&&(this.selectedNonprofitId=null,await this.postSelectNonprofit({selectedNonprofitId:null}),this.localStorage.setItem("nonprofit",null)),c.store?.id&&c.store.id!==this.storeId&&(this.storeId=c.store.id),await this.createNewSelectionForCachedNonprofit(),this.localStorage.setItemJson("chainNonprofits",{createdAt:new Date,data:c}),this.handleValidatedPromoCodes(c),c},this.postSelectNonprofit=async({selectedNonprofitId:e})=>{P(["apiKey","storeId"],this);const t=_("cart",{apiKey:this.apiKey}),n=K(F,{apiKey:this.apiKey}),o=await Y({baseUrl:this.baseUrl,headers:{authorization:`Api-Key ${this.apiKey}`},requestBody:{nonprofitId:e,selectionId:this.selectionId,storeId:this.storeId,cartId:t||void 0,beamCartId:n||void 0,postalCode:this.postalCode,countryCode:this.countryCode}});this.selectionId=o?.selectionId,this.localStorage.setItem("transaction",this.selectionId),this.localStorage.setItem("nonprofit",e),this.localStorage.setItem("nonprofit_selected_at",new Date().toISOString()),await this.updateComplete;const i=this.getNonprofitById(e);e!==null&&this.dispatchEvent(new M({selectedNonprofitId:e,selectionId:this.selectionId,nonprofitName:i?.nonprofit?.name??null,source:C.select_nonprofit})),e===null&&this.dispatchEvent(new re({newNonprofitId:null,selectionId:this.selectionId}))},this.nonprofitListDataController=new E(this,this.getChainNonprofits),this.selectionDataController=new E(this,this.postSelectNonprofit),this.localStorage=se(this),this.handleCartChange=e=>{this.cart=e.detail},this.makeHandleSelect=(e,t,n)=>async o=>{const i=this.selectedNonprofitId;if(o instanceof KeyboardEvent){let s=null;switch(o.key){case"ArrowUp":case"ArrowLeft":t===0?s=n[n.length-1]:s=n[t-1],o.preventDefault();break;case"ArrowRight":case"ArrowDown":t===n.length-1?s=n[0]:s=n[t+1],o.preventDefault();break;case"Enter":case" ":o.preventDefault();break;default:return}if(s){i!=null&&(this.selectedNonprofitId=s.nonprofit.id);const c=this.renderRoot.querySelector(`[data-value="${s.nonprofit.id}"]`);c!==null&&(c.tabIndex=0,c.focus());return}}if(o.currentTarget instanceof HTMLElement)if(i===e)if(this.enableNonprofitDeselection)this.selectedNonprofitId=null,this.localStorage.setItem("nonprofit",null);else return;else this.selectedNonprofitId=e;await this.selectionDataController.exec({selectedNonprofitId:this.selectedNonprofitId})},this.evaluateBreakPoints=J(()=>{this.isMobile=window.innerWidth<768},50,{maxWait:50,leading:!0})}get configLang(){return Z[this.lang]||"en"}get parsedPromoCodes(){return pe(this.promoCodes)}getManualPromoCodes(){if(this.parsedPromoCodes&&this.parsedPromoCodes.length>0)return this.parsedPromoCodes;const e=this.localStorage.getItemJson("cart");return e?de(e):[]}async handleValidatedPromoCodes(e){e.promos?.validatedPromoCodes&&(await Promise.all([fe({apiKey:this.apiKey,promoCodes:{validatedPromoCodes:e.promos.validatedPromoCodes,unvalidatedPromoCodes:[]}}),me({validatedPromoCodes:e.promos.validatedPromoCodes,domain:this.domain})]),this.dispatchEvent(new A({source:C.select_nonprofit})))}getNonprofitById(e){return e?this.nonprofitListDataController?.data?.nonprofits.find(t=>t.nonprofit.id===e):null}async connectedCallback(){super.connectedCallback(),this.nonprofitListDataController.loading=!0,window.addEventListener(T.eventName,this.handleCartChange),window.addEventListener("resize",this.evaluateBreakPoints)}async firstUpdated(){await this.restoreStateFromCache(),window.addEventListener(B.eventName,this.handlePromoCodesStored)}async updated(e){const t=["baseUrl","storeId","apiKey","countryCode","postalCode","cart","lang","pluginPromoCodes"];this.pluginPromoCodes;for(const n of t)if(e.has(n)){await this.nonprofitListDataController.exec();break}}disconnectedCallback(){window.removeEventListener(T.eventName,this.handleCartChange),window.removeEventListener("resize",this.evaluateBreakPoints),window.removeEventListener(B.eventName,this.handlePromoCodesStored),super.disconnectedCallback()}async restoreStateFromCache(){try{const e=new Date().valueOf();this.cart=this.localStorage.getItemJson("cart")??void 0;const t=30*24*60*60*1e3,n=this.localStorage.getItem("nonprofit_selected_at")??0,o=e>new Date(n).valueOf()+t;o?o&&this.selectedNonprofitId!==null&&(await this.postSelectNonprofit({selectedNonprofitId:null}),this.localStorage.setItem("nonprofit",null)):(this.selectedNonprofitId=parseInt(this.localStorage.getItem("nonprofit")||"")||null,this.selectionId=this.localStorage.getItem("transaction")??void 0);const{createdAt:i=0,data:s}=this.localStorage.getItemJson("chainNonprofits")||{},c=2*60*60*1e3;!(e>new Date(i).valueOf()+c)&&this.nonprofitListDataController.loading&&(this.nonprofitListDataController.data=s,this.nonprofitListDataController.loading=!1)}catch(e){ae.error(e)}}async createNewSelectionForCachedNonprofit(){if(P(["apiKey"],this),!(!this.storeId||this.didTryToCreateNewSelectionFromCache))try{if(this.didTryToCreateNewSelectionFromCache=!0,this.selectedNonprofitId){this.selectionId||await this.selectionDataController.exec({selectedNonprofitId:this.selectedNonprofitId});const e=this.getNonprofitById(this.selectedNonprofitId);this.dispatchEvent(new M({selectedNonprofitId:this.selectedNonprofitId,selectionId:this.selectionId,nonprofitName:e?.nonprofit?.name,source:C.select_nonprofit}))}}catch{}}get cssVariables(){const e={"--beam-fontFamily":"inherit","--beam-fontStyle":"inherit","--beam-fontSize":"inherit","--beam-textColor":"inherit","--beam-backgroundColor":"inherit",...ee,"--beam-SelectNonprofit-title-textAlign":"inherit","--beam-SelectNonprofit-description-textAlign":"inherit","--beam-SelectNonprofit-maxWidth":"800px","--beam-SelectNonprofit-options-marginTop":"0px","--beam-SelectNonprofit-options-iconHeight":"24px","--beam-SelectNonprofit-options-padding":"10px","--beam-SelectNonprofit-options-borderRadius":"0px","--beam-SelectNonprofit-options-borderColor":"currentColor","--beam-SelectNonprofit-options--selected-borderColor":"currentColor","--beam-SelectNonprofit-options-backgroundColor":"transparent","--beam-SelectNonprofit-options-gap":"8px","--beam-SelectNonprofit-options--selected-backgroundColor":"currentColor","--beam-SelectNonprofit-details-marginTop":"10px","--beam-SelectNonprofit-details-borderRadius":"0px","--beam-SelectNonprofit-details-borderColor":"currentColor","--beam-SelectNonprofit-details-backgroundColor":"inherit","--beam-SelectNonprofit-details-padding":"10px",...h("--beam-SelectNonprofit-title",{fontSize:"1.25em",fontWeight:"bold"}),"--beam-SelectNonprofit-header-inline-lineHeight":"inherit",...h("--beam-SelectNonprofit-title-inline",{fontWeight:"bold"}),"--beam-SelectNonprofit-title-inline-textTransform":"none","--beam-SelectNonprofit-title-block-margin-right":"8px",...h("--beam-SelectNonprofit-description",{marginTop:"0.5em"}),...h("--beam-SelectNonprofit-description-inline"),...h("--beam-SelectNonprofit-details-cause",{fontSize:"0.85em",fontWeight:"bold"}),...h("--beam-SelectNonprofit-details-beamAttribution",{fontSize:"0.85em"}),...h("--beam-SelectNonprofit-details-impactDescription",{fontSize:"1em",marginTop:"10px"}),"--beam-SelectNonprofit-details-nonprofitName-fontWeight":"bold","--beam-SelectNonprofit-details-nonprofitName-fontStyle":"inherit","--beam-SelectNonprofit-details-fundingProgress-marginTop":"10px",...h("--beam-SelectNonprofit-details-fundingProgressLabel",{fontSize:"0.85em"}),...be,...te,"--beam-SelectNonprofit-promo-block-header-justifyContent":"initial","--beam-SelectNonprofit-notification-blip-top":"4px","--beam-SelectNonprofit-notification-blip-left":"50%","--beam-SelectNonprofit-display-notification-blip":"true","--beam-SelectNonprofit-enable-inline-header":"false"},t=this.nonprofitListDataController?.data?.config?.web?.theme||{},n={...e,...t};return Object.assign(Object.create({toCSS(){return G(this)}}),n)}render(){const{selectedNonprofitId:e}=this,{data:t,loading:n}=this.nonprofitListDataController;if(n&&!t)return ne();if(this.nonprofitListDataController.error)return this.debug?z({error:this.nonprofitListDataController.error}):"";if(this.selectionDataController.error&&this.debug)return z({error:this.selectionDataController.error});const o=t?.nonprofits||[],i=o.find(a=>a.nonprofit.id===e)||null,s=!!t?.config?.web?.promo,c=o.some(a=>!a.promo||!a.promo.isActive),b=a=>this.cssVariables[a],W=b("--beam-SelectNonprofit-display-notification-blip")==="true",y=b("--beam-SelectNonprofit-title-textAlign")==="center",u=b("--beam-SelectNonprofit-enable-inline-header")==="true"||this.isMobile,I=d`<h3
|
|
22
|
+
class=${v({"title-block":!0,"d-none":!0,"d-block":!u})}
|
|
23
|
+
part="title"
|
|
24
|
+
id="beam-SelectNonprofit-title"
|
|
25
|
+
>
|
|
22
26
|
${m(this.configLang,t?.config?.web?.title||"")||g[this.configLang].ctaTitle()}
|
|
23
|
-
</h3>`,
|
|
24
|
-
|
|
25
|
-
style="${this.isMobile?"display: flex":""}"
|
|
26
|
-
>
|
|
27
|
-
${x}
|
|
27
|
+
</h3>`,U=()=>{const a=v({"block-header-promo-pill-container":!u&&!y,"block-header-promo-pill-container-responsive":u&&!y,"block-header-promo-pill-center-block-container-responsive":!u&&y}),x=D({display:u?"flex":void 0});return s?d`<div class=${a} style=${x}>
|
|
28
|
+
${I}
|
|
28
29
|
<beam-promo-info-pill .promo=${t?.config?.web?.promo}></beam-promo-info-pill>
|
|
29
|
-
</div>`:
|
|
30
|
-
<style>
|
|
31
|
-
:host {
|
|
32
|
-
${this.cssVariables.toCSS()}
|
|
33
|
-
}
|
|
34
|
-
</style>
|
|
30
|
+
</div>`:I},R=()=>d`
|
|
35
31
|
<div part="heading">
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
${m(this.configLang,t?.config?.web?.promoDescriptionPrefix||"")||g[this.configLang].ctaPromoPrefixMessage()}
|
|
41
|
-
</span>
|
|
42
|
-
<span>
|
|
43
|
-
${m(this.configLang,t?.config?.web?.promoDescription||"")||g[this.configLang].ctaPromoMessage()}
|
|
44
|
-
</span>`:d`<span>
|
|
45
|
-
${m(this.configLang,t?.config?.web?.description||"")||g[this.configLang].ctaMessage()}
|
|
46
|
-
</span>`}
|
|
47
|
-
</span>
|
|
48
|
-
<div class="d-lg-none header-inline">
|
|
49
|
-
<span class="title-inline" part="title">
|
|
50
|
-
${(m(this.configLang,t?.config?.web?.title||"")||g[this.configLang].ctaTitle())+g[this.configLang].inlineSeparator()}
|
|
51
|
-
</span>
|
|
52
|
-
<span class="description-inline" part="description">
|
|
53
|
-
${a?d`<span style="font-weight:bold">
|
|
32
|
+
${U()}
|
|
33
|
+
<p class="description" part="description">
|
|
34
|
+
<span class=${v({"d-none":!0,"d-inline":!u})}>
|
|
35
|
+
${s?d`<span style="font-weight:bold">
|
|
54
36
|
${m(this.configLang,t?.config?.web?.promoDescriptionPrefix||"")||g[this.configLang].ctaPromoPrefixMessage()}
|
|
55
37
|
</span>
|
|
56
38
|
<span>
|
|
57
39
|
${m(this.configLang,t?.config?.web?.promoDescription||"")||g[this.configLang].ctaPromoMessage()}
|
|
58
|
-
</span>`:d`<span
|
|
59
|
-
|
|
40
|
+
</span>`:d`<span>
|
|
41
|
+
${m(this.configLang,t?.config?.web?.description||"")||g[this.configLang].ctaMessage()}
|
|
60
42
|
</span>`}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
43
|
+
</span>
|
|
44
|
+
<div class=${v({"d-none":!u,"header-inline":!0})}>
|
|
45
|
+
<span class="title-inline" part="title">
|
|
46
|
+
${(m(this.configLang,t?.config?.web?.title||"")||g[this.configLang].ctaTitle())+g[this.configLang].inlineSeparator()}
|
|
47
|
+
</span>
|
|
48
|
+
<span class="description-inline" part="description">
|
|
49
|
+
${s?d`<span style="font-weight:bold">
|
|
50
|
+
${m(this.configLang,t?.config?.web?.promoDescriptionPrefix||"")||g[this.configLang].ctaPromoPrefixMessage()}
|
|
51
|
+
</span>
|
|
52
|
+
<span>
|
|
53
|
+
${m(this.configLang,t?.config?.web?.promoDescription||"")||g[this.configLang].ctaPromoMessage()}
|
|
54
|
+
</span>`:d`<span
|
|
55
|
+
>${m(this.configLang,t?.config?.web?.description||"")||g[this.configLang].ctaMessage()}
|
|
56
|
+
</span>`}
|
|
57
|
+
</div>
|
|
58
|
+
</p>
|
|
59
|
+
</div>`;return d`
|
|
60
|
+
<style>
|
|
61
|
+
:host {
|
|
62
|
+
${this.cssVariables.toCSS()}
|
|
63
|
+
}
|
|
64
|
+
</style>
|
|
65
|
+
${R()}
|
|
64
66
|
<div
|
|
65
67
|
class="options"
|
|
66
68
|
part="options"
|
|
@@ -68,21 +70,21 @@ import{h as w,f as I,y as d,g as f,t as P,q as W,m as U,k as R}from"../chunks/li
|
|
|
68
70
|
aria-labelledby="beam-SelectNonprofit-title"
|
|
69
71
|
style="display: flex; gap: var(--beam-SelectNonprofit-options-gap); margin: 10px 0 0 0;"
|
|
70
72
|
>
|
|
71
|
-
${
|
|
73
|
+
${H(o,a=>a.nonprofit.id,({nonprofit:a,promo:x},w)=>{const N=e===a.id,O=N||i==null&&w===0,j=x?.isActive&&t?.config.web.promo&&c&&W;return d`
|
|
72
74
|
<div
|
|
73
75
|
class="option"
|
|
74
76
|
part="option"
|
|
75
77
|
role="radio"
|
|
76
|
-
tabindex="${
|
|
77
|
-
data-value=${
|
|
78
|
-
aria-checked=${
|
|
79
|
-
@click=${this.makeHandleSelect(
|
|
80
|
-
@keydown=${this.makeHandleSelect(
|
|
81
|
-
aria-label="${m(this.configLang,
|
|
82
|
-
style="${
|
|
78
|
+
tabindex="${O?0:-1}"
|
|
79
|
+
data-value=${a.id}
|
|
80
|
+
aria-checked=${N}
|
|
81
|
+
@click=${this.makeHandleSelect(a.id,w,o)}
|
|
82
|
+
@keydown=${this.makeHandleSelect(a.id,w,o)}
|
|
83
|
+
aria-label="${m(this.configLang,a.cause||"")}"
|
|
84
|
+
style="${D({cursor:"pointer",flex:"1",textAlign:"center",lineHeight:"1",marginTop:"var(--beam-SelectNonprofit-options-marginTop, 0px)",padding:"var(--beam-SelectNonprofit-options-padding, 10px)",borderWidth:"var(--beam-SelectNonprofit-options-borderWidth, 1px)",borderStyle:"solid",position:"relative",borderRadius:"var(--beam-SelectNonprofit-options-borderRadius, 0)",borderColor:N?a.causeColor||"var(--beam-SelectNonprofit-options--selected-borderColor, currentColor)":"var(--beam-SelectNonprofit-options-borderColor, currentColor)",backgroundColor:N?a.causeColor||"var(--beam-SelectNonprofit-options--selected-backgroundColor, currentColor)":"var(--beam-SelectNonprofit-options-backgroundColor, transparent)"})}"
|
|
83
85
|
>
|
|
84
86
|
<img
|
|
85
|
-
src="${
|
|
87
|
+
src="${N?a.causeIconSelectedUrl:a.causeIconUrl}"
|
|
86
88
|
alt=""
|
|
87
89
|
role="presentation"
|
|
88
90
|
style="
|
|
@@ -91,62 +93,60 @@ import{h as w,f as I,y as d,g as f,t as P,q as W,m as U,k as R}from"../chunks/li
|
|
|
91
93
|
vertical-align: -webkit-baseline-middle;
|
|
92
94
|
"
|
|
93
95
|
/>
|
|
94
|
-
${
|
|
96
|
+
${j?d`<beam-notification-blip></beam-notification-blip>`:d``}
|
|
95
97
|
</div>
|
|
96
98
|
`})}
|
|
97
99
|
</div>
|
|
98
100
|
${i!=null?d`
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
<div
|
|
102
|
+
class="details"
|
|
103
|
+
part="details"
|
|
104
|
+
style="
|
|
103
105
|
border: 1px solid var(--beam-SelectNonprofit-details-borderColor);
|
|
104
106
|
border-radius: var(--beam-SelectNonprofit-details-borderRadius);
|
|
105
107
|
background-color: var(--beam-SelectNonprofit-details-backgroundColor);
|
|
106
108
|
padding: var(--beam-SelectNonprofit-details-padding);
|
|
107
109
|
margin-top: var(--beam-SelectNonprofit-details-marginTop);
|
|
108
110
|
"
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
111
|
+
aria-label="Funding information for selected nonprofit ${i.nonprofit?.name}. Powered by Beam"
|
|
112
|
+
>
|
|
113
|
+
<div style="display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap-reverse">
|
|
114
|
+
<span
|
|
115
|
+
class="details-cause"
|
|
116
|
+
style="flex: 0 1; white-space: nowrap; ${S("--beam-SelectNonprofit-details-cause")}"
|
|
113
117
|
>
|
|
118
|
+
${i?.promo?.isActive&&c?t?.config.web.promo?.["promo-cause-alt-text"]||i.nonprofit.cause:m(this.configLang,i.nonprofit.cause||"")}
|
|
119
|
+
</span>
|
|
120
|
+
<div aria-hidden="true">
|
|
114
121
|
<span
|
|
115
|
-
class="details-
|
|
116
|
-
|
|
122
|
+
class="details-beamAttribution"
|
|
123
|
+
aria-hidden="true"
|
|
124
|
+
style="flex: 0 1; white-space: nowrap; ${S("--beam-SelectNonprofit-details-beamAttribution")}"
|
|
117
125
|
>
|
|
118
|
-
${
|
|
126
|
+
${g[this.configLang].beamAttribution()}
|
|
119
127
|
</span>
|
|
120
|
-
<div aria-hidden="true">
|
|
121
|
-
<span
|
|
122
|
-
class="details-beamAttribution"
|
|
123
|
-
aria-hidden="true"
|
|
124
|
-
style="flex: 0 1; white-space: nowrap; ${b("--beam-SelectNonprofit-details-beamAttribution")}"
|
|
125
|
-
>
|
|
126
|
-
${g[this.configLang].beamAttribution()}
|
|
127
|
-
</span>
|
|
128
|
-
</div>
|
|
129
128
|
</div>
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
129
|
+
</div>
|
|
130
|
+
<p class="details-impactDescription">
|
|
131
|
+
${q(m(this.configLang,i.impact.description||""))}
|
|
132
|
+
</p>
|
|
133
|
+
<div
|
|
134
|
+
style="display: flex; margin-top: var(--beam-SelectNonprofit-details-fundingProgress-marginTop); align-items: center;"
|
|
135
|
+
>
|
|
136
|
+
<beam-progress-bar
|
|
137
|
+
value="${i.impact.goalProgressPercentage}"
|
|
138
|
+
style="flex: 1 0;"
|
|
139
|
+
></beam-progress-bar>
|
|
140
|
+
<span
|
|
141
|
+
class="details-fundingProgressLabel"
|
|
142
|
+
style="${S("--beam-SelectNonprofit-details-fundingProgressLabel")} white-space: nowrap; text-align: right; flex: 0 1; margin-left: 15px;"
|
|
135
143
|
>
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
style="flex: 1 0;"
|
|
139
|
-
></beam-progress-bar>
|
|
140
|
-
<span
|
|
141
|
-
class="details-fundingProgressLabel"
|
|
142
|
-
style="${b("--beam-SelectNonprofit-details-fundingProgressLabel")} white-space: nowrap; text-align: right; flex: 0 1; margin-left: 15px;"
|
|
143
|
-
>
|
|
144
|
-
${m(this.configLang,i.impact.goalProgressText)}
|
|
145
|
-
</span>
|
|
146
|
-
</div>
|
|
144
|
+
${m(this.configLang,i.impact.goalProgressText)}
|
|
145
|
+
</span>
|
|
147
146
|
</div>
|
|
148
|
-
|
|
149
|
-
|
|
147
|
+
</div>
|
|
148
|
+
`:""}
|
|
149
|
+
`}}l.tagName="beam-select-nonprofit",l.styles=[oe,ge,$`
|
|
150
150
|
:host {
|
|
151
151
|
display: block;
|
|
152
152
|
max-width: var(--beam-SelectNonprofit-maxWidth, 800px);
|
|
@@ -159,7 +159,7 @@ import{h as w,f as I,y as d,g as f,t as P,q as W,m as U,k as R}from"../chunks/li
|
|
|
159
159
|
}
|
|
160
160
|
|
|
161
161
|
.details-impactDescription {
|
|
162
|
-
${
|
|
162
|
+
${S("--beam-SelectNonprofit-details-impactDescription")}
|
|
163
163
|
}
|
|
164
164
|
|
|
165
165
|
.details-impactDescription .nonprofitName {
|
|
@@ -171,7 +171,7 @@ import{h as w,f as I,y as d,g as f,t as P,q as W,m as U,k as R}from"../chunks/li
|
|
|
171
171
|
|
|
172
172
|
.title-block {
|
|
173
173
|
margin-right: var(--beam-SelectNonprofit-title-block-margin-right);
|
|
174
|
-
${
|
|
174
|
+
${S("--beam-SelectNonprofit-title")}
|
|
175
175
|
text-align: var(--beam-SelectNonprofit-title-textAlign);
|
|
176
176
|
}
|
|
177
177
|
|
|
@@ -196,7 +196,7 @@ import{h as w,f as I,y as d,g as f,t as P,q as W,m as U,k as R}from"../chunks/li
|
|
|
196
196
|
}
|
|
197
197
|
|
|
198
198
|
.description {
|
|
199
|
-
${
|
|
199
|
+
${S("--beam-SelectNonprofit-description")}
|
|
200
200
|
text-align: var(--beam-SelectNonprofit-description-textAlign);
|
|
201
201
|
}
|
|
202
202
|
|
|
@@ -232,5 +232,5 @@ import{h as w,f as I,y as d,g as f,t as P,q as W,m as U,k as R}from"../chunks/li
|
|
|
232
232
|
top: var(--beam-SelectNonprofit-notification-blip-top);
|
|
233
233
|
left: var(--beam-SelectNonprofit-notification-blip-left);
|
|
234
234
|
}
|
|
235
|
-
`],p([f({type:String})],
|
|
235
|
+
`],p([f({type:String})],l.prototype,"baseUrl"),p([f({type:String})],l.prototype,"apiKey"),p([f({type:Number,reflect:!0})],l.prototype,"storeId"),p([f({type:String})],l.prototype,"countryCode"),p([f({type:String})],l.prototype,"postalCode"),p([f({attribute:!1,hasChanged:(r,e)=>!V(r,e)})],l.prototype,"cart"),p([f({type:Number,reflect:!0})],l.prototype,"selectedNonprofitId"),p([f({type:String})],l.prototype,"lang"),p([f({type:Boolean})],l.prototype,"debug"),p([f({type:Boolean})],l.prototype,"draftConfig"),p([f({type:String})],l.prototype,"promoCodes"),p([f({type:String})],l.prototype,"domain"),p([L()],l.prototype,"isMobile"),p([L()],l.prototype,"pluginPromoCodes"),ie(l);export{l as BeamSelectNonprofit};
|
|
236
236
|
//# sourceMappingURL=select-nonprofit.esm.js.map
|