@beamimpact/web-sdk 1.55.5 → 1.55.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{_share-dialog-dependencies-BVseSHLF.esm.js → _share-dialog-dependencies-BA9f_o0p.esm.js} +2 -2
- package/dist/chunks/{_share-dialog-dependencies-BVseSHLF.esm.js.map → _share-dialog-dependencies-BA9f_o0p.esm.js.map} +1 -1
- package/dist/chunks/{_share-dialog-dependencies-o8GVV6gC.esm.js → _share-dialog-dependencies-C9KUQdZi.esm.js} +2 -2
- package/dist/chunks/{_share-dialog-dependencies-o8GVV6gC.esm.js.map → _share-dialog-dependencies-C9KUQdZi.esm.js.map} +1 -1
- package/dist/chunks/{events-D-3N9lQA.esm.d.ts → events-B7l6VPsF.esm.d.ts} +2 -0
- package/dist/chunks/events-Dki0ka4F.esm.js.map +1 -1
- package/dist/chunks/index-8_I5ySms.esm.js +2 -0
- package/dist/chunks/index-8_I5ySms.esm.js.map +1 -0
- package/dist/chunks/{index-IAa5EO-6.esm.js → index-B-y_clPF.esm.js} +3 -3
- package/dist/chunks/index-B-y_clPF.esm.js.map +1 -0
- package/dist/chunks/{index-CoYyg3fw.esm.d.ts → index-Bliur1O3.esm.d.ts} +1 -1
- package/dist/chunks/index-CNk8n3rH.esm.js +2 -0
- package/dist/chunks/index-CNk8n3rH.esm.js.map +1 -0
- package/dist/chunks/{index-CVNcspb0.esm.js → index-CQNxdYCM.esm.js} +2 -2
- package/dist/chunks/index-CQNxdYCM.esm.js.map +1 -0
- package/dist/chunks/{index-DiNDMv3P.esm.js → index-Cc56yRag.esm.js} +2 -2
- package/dist/chunks/index-Cc56yRag.esm.js.map +1 -0
- package/dist/chunks/{index-CIQxph2z.esm.js → index-Cvwx-mJw.esm.js} +2 -2
- package/dist/chunks/index-Cvwx-mJw.esm.js.map +1 -0
- package/dist/chunks/{index-MoK57RXU.esm.js → index-D4P62wPH.esm.js} +2 -2
- package/dist/chunks/index-D4P62wPH.esm.js.map +1 -0
- package/dist/chunks/index-D9fJ0fnB.esm.js +2 -0
- package/dist/chunks/index-D9fJ0fnB.esm.js.map +1 -0
- package/dist/chunks/{index-cxEi49sX.esm.d.ts → index-DEoMwStx.esm.d.ts} +1 -1
- package/dist/chunks/{index-DbT2CExl.esm.d.ts → index-DHK-p5LV.esm.d.ts} +1 -1
- package/dist/chunks/{index-BNHAn1OG.esm.js → index-Dcs5wzZR.esm.js} +2 -2
- package/dist/chunks/{index-BNHAn1OG.esm.js.map → index-Dcs5wzZR.esm.js.map} +1 -1
- package/dist/chunks/{index-BWtaQiQa.esm.js → index-DkN5rVx1.esm.js} +3 -3
- package/dist/chunks/index-DkN5rVx1.esm.js.map +1 -0
- package/dist/chunks/index-DuOCy5gV.esm.js +2 -0
- package/dist/chunks/index-DuOCy5gV.esm.js.map +1 -0
- package/dist/chunks/{index-D1Pso4Mx.esm.js → index-R8pxCm8G.esm.js} +2 -2
- package/dist/chunks/{index-D1Pso4Mx.esm.js.map → index-R8pxCm8G.esm.js.map} +1 -1
- package/dist/chunks/{order-page-Brrq-LAx.esm.js → order-page-BVDbpEg3.esm.js} +2 -2
- package/dist/chunks/{order-page-Brrq-LAx.esm.js.map → order-page-BVDbpEg3.esm.js.map} +1 -1
- package/dist/chunks/{order-page-C41TBLoV.esm.js → order-page-BrgnL0la.esm.js} +2 -2
- package/dist/chunks/{order-page-C41TBLoV.esm.js.map → order-page-BrgnL0la.esm.js.map} +1 -1
- package/dist/chunks/{promo-pill-label-BESRGLn7.esm.js → promo-pill-label-B5ymzjIe.esm.js} +2 -2
- package/dist/chunks/{promo-pill-label-BESRGLn7.esm.js.map → promo-pill-label-B5ymzjIe.esm.js.map} +1 -1
- package/dist/chunks/{promo-pill-label-YOC47M3t.esm.js → promo-pill-label-Fdt5WTOL.esm.js} +2 -2
- package/dist/chunks/{promo-pill-label-YOC47M3t.esm.js.map → promo-pill-label-Fdt5WTOL.esm.js.map} +1 -1
- package/dist/chunks/{routes-BGx3ADhY.esm.js → routes-DpniIBF7.esm.js} +2 -2
- package/dist/chunks/{routes-BGx3ADhY.esm.js.map → routes-DpniIBF7.esm.js.map} +1 -1
- package/dist/chunks/{routes-D0_9umO_.esm.js → routes-DzqKnt5D.esm.js} +2 -2
- package/dist/chunks/{routes-D0_9umO_.esm.js.map → routes-DzqKnt5D.esm.js.map} +1 -1
- package/dist/chunks/{share-button-CV5FZFS9.esm.js → share-button-B2RwMJdP.esm.js} +2 -2
- package/dist/chunks/{share-button-CV5FZFS9.esm.js.map → share-button-B2RwMJdP.esm.js.map} +1 -1
- package/dist/chunks/{share-button-BmoEHT-C.esm.js → share-button-CnN0Q1m3.esm.js} +2 -2
- package/dist/chunks/{share-button-BmoEHT-C.esm.js.map → share-button-CnN0Q1m3.esm.js.map} +1 -1
- package/dist/chunks/{share-button-D-c9M84d.esm.js → share-button-DOejRGE7.esm.js} +2 -2
- package/dist/chunks/{share-button-D-c9M84d.esm.js.map → share-button-DOejRGE7.esm.js.map} +1 -1
- package/dist/chunks/{share-button-DcaL0AYo.esm.js → share-button-Gz4GlT28.esm.js} +2 -2
- package/dist/chunks/{share-button-DcaL0AYo.esm.js.map → share-button-Gz4GlT28.esm.js.map} +1 -1
- package/dist/chunks/{update-cart-CFB8JVgq.esm.js → update-cart-BJPNyfQK.esm.js} +2 -2
- package/dist/chunks/{update-cart-CFB8JVgq.esm.js.map → update-cart-BJPNyfQK.esm.js.map} +1 -1
- package/dist/chunks/{update-cart-Dsu0mPtW.esm.js → update-cart-_BGjED9E.esm.js} +2 -2
- package/dist/chunks/{update-cart-Dsu0mPtW.esm.js.map → update-cart-_BGjED9E.esm.js.map} +1 -1
- package/dist/components/community-impact.esm.js +1 -1
- package/dist/components/community-impact.js +1 -1
- package/dist/components/cumulative-impact.esm.js +1 -1
- package/dist/components/cumulative-impact.js +1 -1
- package/dist/components/impact-overview.esm.js +1 -1
- package/dist/components/impact-overview.js +1 -1
- package/dist/components/index.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.d.ts +1 -1
- package/dist/components/product-details-page.esm.js +1 -1
- package/dist/components/product-details-page.js +1 -1
- package/dist/components/redeem-transaction.d.ts +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 +2 -1
- package/dist/components/select-nonprofit.esm.js +15 -15
- package/dist/components/select-nonprofit.esm.js.map +1 -1
- package/dist/components/select-nonprofit.js +15 -15
- 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 +2 -2
- package/dist/components/select-subscription-nonprofit.esm.js.map +1 -1
- package/dist/components/select-subscription-nonprofit.js +2 -2
- package/dist/components/select-subscription-nonprofit.js.map +1 -1
- package/dist/components/shopify.d.ts +1 -1
- package/dist/components/shopify.esm.js +1 -1
- package/dist/components/shopify.js +1 -1
- package/dist/components/social-share.esm.js +1 -1
- package/dist/components/social-share.js +1 -1
- package/dist/components/subscription-impact.d.ts +1 -1
- package/dist/components/subscription-impact.esm.js +1 -1
- package/dist/components/subscription-impact.js +1 -1
- package/dist/components/subscription-management.d.ts +1 -1
- package/dist/components/subscription-management.esm.js +1 -1
- package/dist/components/subscription-management.esm.js.map +1 -1
- package/dist/components/subscription-management.js +1 -1
- package/dist/components/subscription-management.js.map +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 +2 -2
- 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/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/integrations/utils.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.esm.js +1 -1
- package/dist/react/cumulative-impact.js +1 -1
- package/dist/react/impact-overview.esm.js +1 -1
- package/dist/react/impact-overview.js +1 -1
- package/dist/react/index.d.ts +1 -1
- package/dist/react/index.esm.js +1 -1
- package/dist/react/index.js +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.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.esm.js +1 -1
- package/dist/react/social-share.js +1 -1
- package/dist/react/subscription-impact.esm.js +1 -1
- package/dist/react/subscription-impact.js +1 -1
- package/dist/react/subscription-management.esm.js +1 -1
- package/dist/react/subscription-management.js +1 -1
- package/dist/utils/events.d.ts +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/package.json +1 -1
- package/dist/chunks/index-BWtaQiQa.esm.js.map +0 -1
- package/dist/chunks/index-CIQxph2z.esm.js.map +0 -1
- package/dist/chunks/index-CM59QOJP.esm.js +0 -2
- package/dist/chunks/index-CM59QOJP.esm.js.map +0 -1
- package/dist/chunks/index-CVNcspb0.esm.js.map +0 -1
- package/dist/chunks/index-CYxuuwlv.esm.js +0 -2
- package/dist/chunks/index-CYxuuwlv.esm.js.map +0 -1
- package/dist/chunks/index-DiNDMv3P.esm.js.map +0 -1
- package/dist/chunks/index-Dji1l8sT.esm.js +0 -2
- package/dist/chunks/index-Dji1l8sT.esm.js.map +0 -1
- package/dist/chunks/index-DsvbqqAd.esm.js +0 -2
- package/dist/chunks/index-DsvbqqAd.esm.js.map +0 -1
- package/dist/chunks/index-IAa5EO-6.esm.js.map +0 -1
- package/dist/chunks/index-MoK57RXU.esm.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as o,t as i,h as I,y as h}from"../chunks/lit-WqMxC_PA.esm.js";import{M as f}from"../chunks/beam-errors-Ci0d3926.esm.js";import{deleteCookieValue as v,getCookieValue as b}from"../utils/cookies.esm.js";import{c as S,d as P,e as $}from"../chunks/enforce-config-CZ3ToOgr.esm.js";import{createScopedLocalStorage as T}from"../utils/local-storage.esm.js";import{A as U,_ as E}from"../chunks/localize-Btu9xYcE.esm.js";import{D as O,L as u}from"../chunks/routes-
|
|
1
|
+
import{g as o,t as i,h as I,y as h}from"../chunks/lit-WqMxC_PA.esm.js";import{M as f}from"../chunks/beam-errors-Ci0d3926.esm.js";import{deleteCookieValue as v,getCookieValue as b}from"../utils/cookies.esm.js";import{c as S,d as P,e as $}from"../chunks/enforce-config-CZ3ToOgr.esm.js";import{createScopedLocalStorage as T}from"../utils/local-storage.esm.js";import{A as U,_ as E}from"../chunks/localize-Btu9xYcE.esm.js";import{D as O,L as u}from"../chunks/routes-DzqKnt5D.esm.js";import{p as A}from"../chunks/index-B-y_clPF.esm.js";import"./impact-overview.esm.js";import{B as y}from"../chunks/cart-contents-DkoytiZh.esm.js";import{b as D}from"../chunks/events-Dki0ka4F.esm.js";import{formatStoreAndReturnPromoCodes as R,getAllPromoCodesFromCookie as _,mapToUnvalidatedPromoCodes as M,isEmptyPromoData as w,parseJsonStringArray as K}from"../utils/promoManager.esm.js";import{P as N,a as L}from"../chunks/promo-types-DKAOFHJr.esm.js";import"../utils/logger.esm.js";import"../chunks/lodash-D3TLHRR_.esm.js";import"../chunks/progress-bar-DF7UuuHb.esm.js";import"../chunks/promo-pill-label-Fdt5WTOL.esm.js";import"../chunks/_share-dialog-dependencies-C9KUQdZi.esm.js";import"../chunks/vendor-KKSARHWL.esm.js";import"./beam-partner-logos.esm.js";import"../chunks/loading-template-DG4lkIIc.esm.js";import"../chunks/css-card-grid-CvoGpsJH.esm.js";import"../chunks/share-button-DOejRGE7.esm.js";import"../chunks/is-all-html-elements-fcB7UUA1.esm.js";import"../chunks/share-button-CnN0Q1m3.esm.js";import"../chunks/responsive-BR8qUfBa.esm.js";var x=Object.defineProperty,e=(l,r,a,m)=>{for(var s=void 0,d=l.length-1,c;d>=0;d--)(c=l[d])&&(s=c(r,a,s)||s);return s&&x(r,a,s),s};const C=["baseUrl","apiKey","orderId","cartTotal","currencyCode","lang"],F=["storeId","postalCode","countryCode","cart","discountCodes","promoCodes","htmlPromoCodes","email","partnerUserId"];class t extends I{constructor(){super(...arguments),this.baseUrl=O,this.currencyCode="USD",this.lang="en",this.debug=!1,this.activeWidget=null,this.nonprofitId=null,this.selectionId=null,this.cartId=null,this.beamCartId=null,this.userId=null,this.transactionId=null,this.excludeDonationsForRecurringTransactions=!1,this.creationMethod="",this.draftConfig=!1,this.localStorage=T(this),this.handlePostTransaction=async()=>{this.enforceConfig();const r=this.getManualPromoCodes(),a=R(r.map(p=>({value:p})),this.apiKey),m=_(),s={unvalidatedPromoCodes:M(r.map(p=>({value:p}))),validatedPromoCodes:m?.validatedPromoCodes??[]},d=a??s,c=d&&!w(d),n=await A({baseUrl:this.baseUrl,apiRoot:"/api",headers:{authorization:`Api-Key ${this.apiKey}`},requestBody:{selectionId:this.selectionId||void 0,cartId:this.cartId||void 0,beamCartId:this.beamCartId||void 0,storeId:this.storeId,orderId:this.orderId,cartTotal:this.cartTotal,email:this.email,partnerUserId:this.partnerUserId,currencyCode:this.currencyCode,postalCode:this.postalCode,countryCode:this.countryCode,cart:this.cart,...c&&{promos:d},discountCodes:this.discountCodes}});this.transactionId=n.transactionId,this.userId=n.beamUserId,this.nonprofitId=n.nonprofitId,this.excludeDonationsForRecurringTransactions=!!n.reportSettings?.excludeRecurringDonations,this.creationMethod=n.creationMethod||"";const g=!!this.nonprofitId;return this.activeWidget=g?"impact-overview":"redeem-transaction",n.transactionCreated&&(["transaction","cart",N,u.NONPROFIT,u.NONPROFIT_SELECTED_AT].forEach(p=>{this.localStorage.removeItem(p)}),[{name:y,path:"/",domain:this.domain},{name:L,path:"/",domain:this.domain}].forEach(p=>v(p)),dispatchEvent(new D({transactionId:n.transactionId,orderId:this.orderId,cartTotal:this.cartTotal,currencyCode:this.currencyCode}))),n},this.transactionDataController=new U(this,this.handlePostTransaction)}get parsedPromoCodes(){return K(this.htmlPromoCodes)}firstUpdated(r){this.enforceConfig(),this.localStorage.getItem("transaction")?.toLocaleLowerCase()==="undefined"&&this.localStorage.removeItem("transaction"),this.selectionId=this.localStorage.getItem("transaction")||null,this.cartId=this.localStorage.getItemJson("cart")?.cartId||null,this.beamCartId=b(y)||null,this.selectionId&&this.nonprofitId&&(this.activeWidget="impact-overview")}async updated(r){[...C,...F].some(a=>r.has(a))&&await this.transactionDataController.exec()}enforceConfig(){if($(C,this),!this.email&&!this.partnerUserId)throw new f([this.email?"":"email",this.partnerUserId?"":"partnerUserId"].filter(Boolean),"At least one of [email, partnerUserId] must be provided")}getManualPromoCodes(){return this.parsedPromoCodes?.length?this.parsedPromoCodes:this.promoCodes?.length?this.promoCodes:[]}render(){return this.transactionDataController.loading?"":this.transactionDataController.error?this.debug?E({error:this.transactionDataController.error}):"":this.excludeDonationsForRecurringTransactions&&this.creationMethod==="recurring"?h``:this.activeWidget==="redeem-transaction"?h`
|
|
2
2
|
<beam-redeem-transaction
|
|
3
3
|
part="redeem-transaction"
|
|
4
4
|
baseUrl="${this.baseUrl}"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as o,t as i,h as I,y as h}from"../chunks/lit-WqMxC_PA.esm.js";import{M as f}from"../chunks/beam-errors-Ci0d3926.esm.js";import{deleteCookieValue as v,getCookieValue as b}from"../utils/cookies.js";import{c as S,d as P,e as $}from"../chunks/enforce-config-Ba1JkOHs.esm.js";import{createScopedLocalStorage as T}from"../utils/local-storage.js";import{A as U,_ as E}from"../chunks/localize-C25pEGnx.esm.js";import{D as O,L as u}from"../chunks/routes-
|
|
1
|
+
import{g as o,t as i,h as I,y as h}from"../chunks/lit-WqMxC_PA.esm.js";import{M as f}from"../chunks/beam-errors-Ci0d3926.esm.js";import{deleteCookieValue as v,getCookieValue as b}from"../utils/cookies.js";import{c as S,d as P,e as $}from"../chunks/enforce-config-Ba1JkOHs.esm.js";import{createScopedLocalStorage as T}from"../utils/local-storage.js";import{A as U,_ as E}from"../chunks/localize-C25pEGnx.esm.js";import{D as O,L as u}from"../chunks/routes-DpniIBF7.esm.js";import{p as A}from"../chunks/index-DkN5rVx1.esm.js";import"./impact-overview.js";import{B as y}from"../chunks/cart-contents-DkoytiZh.esm.js";import{b as D}from"../chunks/events-Dki0ka4F.esm.js";import{formatStoreAndReturnPromoCodes as R,getAllPromoCodesFromCookie as _,mapToUnvalidatedPromoCodes as M,isEmptyPromoData as w,parseJsonStringArray as K}from"../utils/promoManager.js";import{P as N,a as L}from"../chunks/promo-types-DKAOFHJr.esm.js";import"../utils/logger.js";import"../chunks/lodash-D3TLHRR_.esm.js";import"../chunks/progress-bar-DF7UuuHb.esm.js";import"../chunks/promo-pill-label-B5ymzjIe.esm.js";import"../chunks/_share-dialog-dependencies-BA9f_o0p.esm.js";import"../chunks/vendor-KKSARHWL.esm.js";import"./beam-partner-logos.js";import"../chunks/loading-template-DG4lkIIc.esm.js";import"../chunks/css-card-grid-CvoGpsJH.esm.js";import"../chunks/share-button-B2RwMJdP.esm.js";import"../chunks/is-all-html-elements-fcB7UUA1.esm.js";import"../chunks/share-button-Gz4GlT28.esm.js";import"../chunks/responsive-BR8qUfBa.esm.js";var x=Object.defineProperty,e=(l,r,a,m)=>{for(var s=void 0,d=l.length-1,c;d>=0;d--)(c=l[d])&&(s=c(r,a,s)||s);return s&&x(r,a,s),s};const C=["baseUrl","apiKey","orderId","cartTotal","currencyCode","lang"],F=["storeId","postalCode","countryCode","cart","discountCodes","promoCodes","htmlPromoCodes","email","partnerUserId"];class t extends I{constructor(){super(...arguments),this.baseUrl=O,this.currencyCode="USD",this.lang="en",this.debug=!1,this.activeWidget=null,this.nonprofitId=null,this.selectionId=null,this.cartId=null,this.beamCartId=null,this.userId=null,this.transactionId=null,this.excludeDonationsForRecurringTransactions=!1,this.creationMethod="",this.draftConfig=!1,this.localStorage=T(this),this.handlePostTransaction=async()=>{this.enforceConfig();const r=this.getManualPromoCodes(),a=R(r.map(p=>({value:p})),this.apiKey),m=_(),s={unvalidatedPromoCodes:M(r.map(p=>({value:p}))),validatedPromoCodes:m?.validatedPromoCodes??[]},d=a??s,c=d&&!w(d),n=await A({baseUrl:this.baseUrl,apiRoot:"/api",headers:{authorization:`Api-Key ${this.apiKey}`},requestBody:{selectionId:this.selectionId||void 0,cartId:this.cartId||void 0,beamCartId:this.beamCartId||void 0,storeId:this.storeId,orderId:this.orderId,cartTotal:this.cartTotal,email:this.email,partnerUserId:this.partnerUserId,currencyCode:this.currencyCode,postalCode:this.postalCode,countryCode:this.countryCode,cart:this.cart,...c&&{promos:d},discountCodes:this.discountCodes}});this.transactionId=n.transactionId,this.userId=n.beamUserId,this.nonprofitId=n.nonprofitId,this.excludeDonationsForRecurringTransactions=!!n.reportSettings?.excludeRecurringDonations,this.creationMethod=n.creationMethod||"";const g=!!this.nonprofitId;return this.activeWidget=g?"impact-overview":"redeem-transaction",n.transactionCreated&&(["transaction","cart",N,u.NONPROFIT,u.NONPROFIT_SELECTED_AT].forEach(p=>{this.localStorage.removeItem(p)}),[{name:y,path:"/",domain:this.domain},{name:L,path:"/",domain:this.domain}].forEach(p=>v(p)),dispatchEvent(new D({transactionId:n.transactionId,orderId:this.orderId,cartTotal:this.cartTotal,currencyCode:this.currencyCode}))),n},this.transactionDataController=new U(this,this.handlePostTransaction)}get parsedPromoCodes(){return K(this.htmlPromoCodes)}firstUpdated(r){this.enforceConfig(),this.localStorage.getItem("transaction")?.toLocaleLowerCase()==="undefined"&&this.localStorage.removeItem("transaction"),this.selectionId=this.localStorage.getItem("transaction")||null,this.cartId=this.localStorage.getItemJson("cart")?.cartId||null,this.beamCartId=b(y)||null,this.selectionId&&this.nonprofitId&&(this.activeWidget="impact-overview")}async updated(r){[...C,...F].some(a=>r.has(a))&&await this.transactionDataController.exec()}enforceConfig(){if($(C,this),!this.email&&!this.partnerUserId)throw new f([this.email?"":"email",this.partnerUserId?"":"partnerUserId"].filter(Boolean),"At least one of [email, partnerUserId] must be provided")}getManualPromoCodes(){return this.parsedPromoCodes?.length?this.parsedPromoCodes:this.promoCodes?.length?this.promoCodes:[]}render(){return this.transactionDataController.loading?"":this.transactionDataController.error?this.debug?E({error:this.transactionDataController.error}):"":this.excludeDonationsForRecurringTransactions&&this.creationMethod==="recurring"?h``:this.activeWidget==="redeem-transaction"?h`
|
|
2
2
|
<beam-redeem-transaction
|
|
3
3
|
part="redeem-transaction"
|
|
4
4
|
baseUrl="${this.baseUrl}"
|
|
@@ -91,7 +91,7 @@ declare class BeamProductDetailsPage extends LitElement {
|
|
|
91
91
|
}>;
|
|
92
92
|
private productDetailsPageDataController;
|
|
93
93
|
updated(changedProperties: Map<string, unknown>): Promise<void>;
|
|
94
|
-
render():
|
|
94
|
+
render(): lit_html.TemplateResult<1> | "";
|
|
95
95
|
renderWidgetIcon(iconDisplay: string): lit_html.TemplateResult<1>;
|
|
96
96
|
renderContent(isPromoPillVisible: boolean, shouldDisplayColon: boolean, data: IAPIV3PostProductDetailsPage): lit_html.TemplateResult<1>;
|
|
97
97
|
renderCloseTooltipIcon(): lit_html.TemplateResult<1>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as E,y as r,f as B,g as c,t as A,h as z,k as L}from"../chunks/lit-WqMxC_PA.esm.js";import{u as b,A as M,_ as W,i as k,d as D,a as G}from"../chunks/localize-Btu9xYcE.esm.js";import{D as R,W as y,j as _,S as j}from"../chunks/routes-
|
|
1
|
+
import{j as E,y as r,f as B,g as c,t as A,h as z,k as L}from"../chunks/lit-WqMxC_PA.esm.js";import{u as b,A as M,_ as W,i as k,d as D,a as G}from"../chunks/localize-Btu9xYcE.esm.js";import{D as R,W as y,j as _,S as j}from"../chunks/routes-DzqKnt5D.esm.js";import{c as O,d as H,e as U}from"../chunks/enforce-config-CZ3ToOgr.esm.js";import{c as K}from"../chunks/responsive-BR8qUfBa.esm.js";import"../chunks/_share-dialog-dependencies-C9KUQdZi.esm.js";import"../chunks/vendor-KKSARHWL.esm.js";import{p as N}from"../chunks/promo-pill-label-Fdt5WTOL.esm.js";import{formatStoreAndReturnPromoCodes as V,isEmptyPromoData as q,parseJsonStringArray as J,getPromoCodesFromCart as Y,setPromoCodesInLocalStorage as Z,setPromoCodeInCookie as Q}from"../utils/promoManager.esm.js";import{B as X}from"../chunks/cart-contents-DkoytiZh.esm.js";import{createScopedLocalStorage as ee}from"../utils/local-storage.esm.js";import{makeApiKeyHeader as te}from"../utils/makeApiKeyHeader.esm.js";import{f as w,a as S}from"../chunks/events-Dki0ka4F.esm.js";import{getBeamCartId as oe}from"../utils/cart.esm.js";import"../chunks/beam-errors-Ci0d3926.esm.js";import"../utils/logger.esm.js";import"../chunks/promo-types-DKAOFHJr.esm.js";import"../utils/cookies.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});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as E,y as r,f as B,g as c,t as A,h as z,k as L}from"../chunks/lit-WqMxC_PA.esm.js";import{u as b,A as M,_ as W,i as k,d as D,a as G}from"../chunks/localize-C25pEGnx.esm.js";import{D as R,W as y,j as _,S as j}from"../chunks/routes-
|
|
1
|
+
import{j as E,y as r,f as B,g as c,t as A,h as z,k as L}from"../chunks/lit-WqMxC_PA.esm.js";import{u as b,A as M,_ as W,i as k,d as D,a as G}from"../chunks/localize-C25pEGnx.esm.js";import{D as R,W as y,j as _,S as j}from"../chunks/routes-DpniIBF7.esm.js";import{c as O,d as H,e as U}from"../chunks/enforce-config-Ba1JkOHs.esm.js";import{c as K}from"../chunks/responsive-BR8qUfBa.esm.js";import"../chunks/_share-dialog-dependencies-BA9f_o0p.esm.js";import"../chunks/vendor-KKSARHWL.esm.js";import{p as N}from"../chunks/promo-pill-label-B5ymzjIe.esm.js";import{formatStoreAndReturnPromoCodes as V,isEmptyPromoData as q,parseJsonStringArray as J,getPromoCodesFromCart as Y,setPromoCodesInLocalStorage as Z,setPromoCodeInCookie as Q}from"../utils/promoManager.js";import{B as X}from"../chunks/cart-contents-DkoytiZh.esm.js";import{createScopedLocalStorage as ee}from"../utils/local-storage.js";import{makeApiKeyHeader as te}from"../utils/makeApiKeyHeader.js";import{f as w,a as S}from"../chunks/events-Dki0ka4F.esm.js";import{getBeamCartId as oe}from"../utils/cart.js";import"../chunks/beam-errors-Ci0d3926.esm.js";import"../utils/logger.js";import"../chunks/promo-types-DKAOFHJr.esm.js";import"../utils/cookies.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});
|
|
@@ -73,7 +73,7 @@ declare class BeamRedeemTransaction extends LitElement {
|
|
|
73
73
|
private renderProgressBar;
|
|
74
74
|
private renderNonprofitDetails;
|
|
75
75
|
private renderPromoPill;
|
|
76
|
-
protected render():
|
|
76
|
+
protected render(): lit_html.TemplateResult<1> | "";
|
|
77
77
|
}
|
|
78
78
|
declare global {
|
|
79
79
|
interface HTMLElementTagNameMap {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../chunks/lit-WqMxC_PA.esm.js";import"../chunks/lodash-D3TLHRR_.esm.js";import"../chunks/localize-Btu9xYcE.esm.js";import"../chunks/routes-
|
|
1
|
+
import"../chunks/lit-WqMxC_PA.esm.js";import"../chunks/lodash-D3TLHRR_.esm.js";import"../chunks/localize-Btu9xYcE.esm.js";import"../chunks/routes-DzqKnt5D.esm.js";import"../chunks/progress-bar-DF7UuuHb.esm.js";import"../chunks/promo-pill-label-Fdt5WTOL.esm.js";import"./beam-partner-logos.esm.js";import"../chunks/enforce-config-CZ3ToOgr.esm.js";import"../chunks/loading-template-DG4lkIIc.esm.js";import"../chunks/beam-errors-Ci0d3926.esm.js";import"../utils/local-storage.esm.js";import"../chunks/css-card-grid-CvoGpsJH.esm.js";import{B as h}from"../chunks/index-B-y_clPF.esm.js";import"../chunks/events-Dki0ka4F.esm.js";import"../utils/logger.esm.js";import"../chunks/promo-types-DKAOFHJr.esm.js";import"../chunks/_share-dialog-dependencies-C9KUQdZi.esm.js";import"../chunks/vendor-KKSARHWL.esm.js";export{h as BeamRedeemTransaction};
|
|
2
2
|
//# sourceMappingURL=redeem-transaction.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../chunks/lit-WqMxC_PA.esm.js";import"../chunks/lodash-D3TLHRR_.esm.js";import"../chunks/localize-C25pEGnx.esm.js";import"../chunks/routes-
|
|
1
|
+
import"../chunks/lit-WqMxC_PA.esm.js";import"../chunks/lodash-D3TLHRR_.esm.js";import"../chunks/localize-C25pEGnx.esm.js";import"../chunks/routes-DpniIBF7.esm.js";import"../chunks/progress-bar-DF7UuuHb.esm.js";import"../chunks/promo-pill-label-B5ymzjIe.esm.js";import"./beam-partner-logos.js";import"../chunks/enforce-config-Ba1JkOHs.esm.js";import"../chunks/loading-template-DG4lkIIc.esm.js";import"../chunks/beam-errors-Ci0d3926.esm.js";import"../utils/local-storage.js";import"../chunks/css-card-grid-CvoGpsJH.esm.js";import{B as h}from"../chunks/index-DkN5rVx1.esm.js";import"../chunks/events-Dki0ka4F.esm.js";import"../utils/logger.js";import"../chunks/promo-types-DKAOFHJr.esm.js";import"../chunks/_share-dialog-dependencies-BA9f_o0p.esm.js";import"../chunks/vendor-KKSARHWL.esm.js";export{h as BeamRedeemTransaction};
|
|
2
2
|
//# sourceMappingURL=redeem-transaction.js.map
|
|
@@ -37,6 +37,7 @@ declare class BeamSelectNonprofit extends LitElement {
|
|
|
37
37
|
draftConfig: boolean;
|
|
38
38
|
promoCodes?: string;
|
|
39
39
|
domain?: string;
|
|
40
|
+
private lastSelectionActionDate;
|
|
40
41
|
private isMobile;
|
|
41
42
|
private enableNonprofitDeselection;
|
|
42
43
|
private selectionId?;
|
|
@@ -80,7 +81,7 @@ declare class BeamSelectNonprofit extends LitElement {
|
|
|
80
81
|
evaluateBreakPoints: lodash.DebouncedFuncLeading<() => void>;
|
|
81
82
|
get cssVariables(): any;
|
|
82
83
|
static styles: lit.CSSResult[];
|
|
83
|
-
protected render():
|
|
84
|
+
protected render(): lit_html.TemplateResult<1> | "";
|
|
84
85
|
}
|
|
85
86
|
declare global {
|
|
86
87
|
interface HTMLElementTagNameMap {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{h as
|
|
1
|
+
import{h as D,f as L,y as d,g as f,t as P,q as v,u as J,m as z,k as G}from"../chunks/lit-WqMxC_PA.esm.js";import{i as Q,d as X}from"../chunks/lodash-D3TLHRR_.esm.js";import{u as S,A,d as h,a as Y,_ as B,i as m}from"../chunks/localize-Btu9xYcE.esm.js";import{D as Z,W as C,d as ee,h as te,S as oe}from"../chunks/routes-DzqKnt5D.esm.js";import{p as ie}from"../chunks/progress-bar-DF7UuuHb.esm.js";import{p as ne}from"../chunks/promo-pill-label-Fdt5WTOL.esm.js";import{c as ae,d as re,e as I}from"../chunks/enforce-config-CZ3ToOgr.esm.js";import{_ as se}from"../chunks/loading-template-DG4lkIIc.esm.js";import{f as M,c as k,k as le,i as E,j as ce,g as T,a as F}from"../chunks/events-Dki0ka4F.esm.js";import{logger as pe}from"../utils/logger.esm.js";import{createScopedLocalStorage as de}from"../utils/local-storage.esm.js";import{formatStoreAndReturnPromoCodes as fe,isEmptyPromoData as me,parseJsonStringArray as ge,getPromoCodesFromCart as ue,setPromoCodesInLocalStorage as he,setPromoCodeInCookie as be}from"../utils/promoManager.esm.js";import{c as Se}from"../chunks/responsive-BR8qUfBa.esm.js";import{B as K}from"../chunks/cart-contents-DkoytiZh.esm.js";import{getBeamCartId as W,getExternalCartId as _}from"../utils/cart.esm.js";import"../chunks/beam-errors-Ci0d3926.esm.js";import"../chunks/promo-types-DKAOFHJr.esm.js";import"../chunks/_share-dialog-dependencies-C9KUQdZi.esm.js";import"../chunks/vendor-KKSARHWL.esm.js";import"../utils/cookies.esm.js";class Ne extends D{static get styles(){return L`
|
|
2
2
|
:host {
|
|
3
3
|
}
|
|
4
4
|
|
|
@@ -18,21 +18,21 @@ import{h as $,f as L,y as d,g as f,t as z,q as v,u as J,m as D,k as G}from"../ch
|
|
|
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",Ne);const ve={"--beam-notificationBlip-color-background":"#000"},g={en:{beamAttribution:()=>"Powered by Beam",ctaTitle:()=>"Choose your impact",ctaPromoPrefixMessage:()=>"At no extra cost,",ctaPromoMessage:({donationPercentage:o="1"}={})=>`select a nonprofit and ${o}% will be donated for you.`,ctaMessage:({donationPercentage:o="1"}={})=>`At no extra cost, select a nonprofit and ${o}% will be donated for you.`,inlineSeparator:()=>": "},fr:{beamAttribution:()=>"Optimis\xE9 par Beam",ctaTitle:()=>"Choisissez votre cause",ctaPromoPrefixMessage:()=>"Sans frais suppl\xE9mentaires,",ctaPromoMessage:({donationPercentage:o="1"}={})=>`s\xE9lectionnez une association et ${o} % sera revers\xE9 en votre nom.`,ctaMessage:({donationPercentage:o="1"}={})=>`Sans frais suppl\xE9mentaires, choisissez une association et ${o} % de votre commande sera revers\xE9 en votre nom.`,inlineSeparator:()=>" : "},de:{beamAttribution:()=>"Unterst\xFCtzt von Beam",ctaTitle:()=>"W\xE4hle deine Wirkung",ctaPromoPrefixMessage:()=>"Ohne zus\xE4tzliche Kosten,",ctaPromoMessage:({donationPercentage:o="1"}={})=>`w\xE4hle eine Organisation und ${o}% deines Einkaufs werden gespendet.`,ctaMessage:({donationPercentage:o="1"}={})=>`Ohne zus\xE4tzliche Kosten kannst du eine gemeinn\xFCtzige Organisation ausw\xE4hlen und ${o}% deiner Bestellung werden gespendet.`,inlineSeparator:()=>": "},es:{beamAttribution:()=>"Ofrecido por Beam",ctaTitle:()=>"Elige tu impacto",ctaPromoPrefixMessage:()=>"Sin coste adicional,",ctaPromoMessage:({donationPercentage:o="1"}={})=>`elige una organizaci\xF3n y donaremos el ${o}% en tu nombre.`,ctaMessage:({donationPercentage:o="1"}={})=>`Sin coste adicional, elige una organizaci\xF3n sin fines de lucro y donaremos el ${o}% de tu compra en tu nombre.`,inlineSeparator:()=>": "},it:{beamAttribution:()=>"Gestito da Beam",ctaTitle:()=>"Scegli il tuo impatto",ctaPromoPrefixMessage:()=>"Senza costi aggiuntivi,",ctaPromoMessage:({donationPercentage:o="1"}={})=>`scegli un'organizzazione e doneremo l\u2019${o}% per te.`,ctaMessage:({donationPercentage:o="1"}={})=>`Senza costi aggiuntivi, seleziona un'organizzazione no-profit e doneremo l\u2019${o}% del tuo acquisto per te.`,inlineSeparator:()=>": "},pl:{beamAttribution:()=>"Obs\u0142ugiwane przez Beam",ctaTitle:()=>"Wybierz sw\xF3j wp\u0142yw",ctaPromoPrefixMessage:()=>"Bez dodatkowych koszt\xF3w,",ctaPromoMessage:({donationPercentage:o="1"}={})=>`wybierz organizacj\u0119, a ${o}% zostanie przekazane w Twoim imieniu.`,ctaMessage:({donationPercentage:o="1"}={})=>`Bez dodatkowych koszt\xF3w wybierz organizacj\u0119, kt\xF3rej przeka\u017Cemy ${o}% warto\u015Bci Twojego zam\xF3wienia w Twoim imieniu.`,inlineSeparator:()=>": "},ja:{beamAttribution:()=>"Powered by Beam",ctaTitle:()=>"\u5BC4\u4ED8\u5148\u3092\u304A\u9078\u3073\u304F\u3060\u3055\u3044\u3002",ctaPromoPrefixMessage:()=>"\u8FFD\u52A0\u8CBB\u7528\u306A\u3057\u3067\u3001",ctaPromoMessage:({donationPercentage:o="1"}={})=>`\u975E\u55B6\u5229\u56E3\u4F53\u3092\u9078\u3076\u3068\u3001${o}%\u304C\u305D\u306E\u56E3\u4F53\u306B\u5BC4\u4ED8\u3055\u308C\u307E\u3059\u3002`,ctaMessage:({donationPercentage:o="1"}={})=>`\u8FFD\u52A0\u8CBB\u7528\u306A\u3057\u3067\u975E\u55B6\u5229\u56E3\u4F53\u3092\u304A\u9078\u3073\u3044\u305F\u3060\u304F\u3068\u3001\u3054\u8CFC\u5165\u91D1\u984D\u306E${o}%\u304C\u5BC4\u4ED8\u3055\u308C\u307E\u3059\u3002`,inlineSeparator:()=>"\uFF1A"}};var Ce=Object.defineProperty,p=(o,e,t,i)=>{for(var n=void 0,a=o.length-1,s;a>=0;a--)(s=o[a])&&(n=s(e,t,n)||n);return n&&Ce(e,t,n),n};let j=!1;class l extends ${constructor(){super(...arguments),this.baseUrl=Z,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(i=>i.attributes?.value??i.attributes?.url??"").sort();this.pluginPromoCodes=t},this.getChainNonprofits=async()=>{P(["apiKey"],this);const e=W(K,{apiKey:this.apiKey}),t=_("cart",{apiKey:this.apiKey}),i=this.cart?.content?{schema:this.cart?.schema,content:this.cart?.content}:void 0,n=this.getManualPromoCodes(),a=fe(n.map(u=>({value:u})),this.apiKey),s=a&&!me(a);s&&this.dispatchEvent(new M({source:C.select_nonprofit}));const c=await ee({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:a},options:{config:{draftConfig:this.draftConfig}},cart:i}});return this.enableNonprofitDeselection=!!c.config.enableNonprofitDeselection,this.selectedNonprofitId!==null&&this.selectedNonprofitId&&!c.nonprofits.map(u=>u.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}),i=W(K,{apiKey:this.apiKey}),n=await te({baseUrl:this.baseUrl,headers:{authorization:`Api-Key ${this.apiKey}`},requestBody:{nonprofitId:e,selectionId:this.selectionId,storeId:this.storeId,cartId:t||void 0,beamCartId:i||void 0,creationMethod:"cart",postalCode:this.postalCode,countryCode:this.countryCode}});this.selectionId=n?.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 a=this.getNonprofitById(e);e!==null&&this.dispatchEvent(new I({selectedNonprofitId:e,selectionId:this.selectionId,nonprofitName:a?.nonprofit?.name??null,source:C.select_nonprofit})),e===null&&this.dispatchEvent(new le({newNonprofitId:null,selectionId:this.selectionId}))},this.nonprofitListDataController=new A(this,this.getChainNonprofits),this.selectionDataController=new A(this,this.postSelectNonprofit),this.localStorage=de(this),this.handleCartChange=e=>{this.cart=e.detail},this.handleNonprofitSelect=e=>{const{selectionId:t,selectedNonprofitId:i}=e.detail;i!==this.selectedNonprofitId&&(this.selectionId=t,this.selectedNonprofitId=i??null)},this.handleInitialNonprofitSync=e=>{if(j)return;const{nonprofitId:t,selectionId:i}=e.detail,n=t!==void 0&&this.selectedNonprofitId!==t,a=i!==void 0&&this.selectionId!==i;(n||a)&&(n&&(this.selectedNonprofitId=t),a&&(this.selectionId=i),this.requestUpdate(),j=!0,window.removeEventListener(k.eventName,this.handleInitialNonprofitSync))},this.makeHandleSelect=(e,t,i)=>async n=>{const a=this.selectedNonprofitId;if(n instanceof KeyboardEvent){let s=null;switch(n.key){case"ArrowUp":case"ArrowLeft":t===0?s=i[i.length-1]:s=i[t-1],n.preventDefault();break;case"ArrowRight":case"ArrowDown":t===i.length-1?s=i[0]:s=i[t+1],n.preventDefault();break;case"Enter":case" ":n.preventDefault();break;default:return}if(s){a!=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(n.currentTarget instanceof HTMLElement)if(a===e)if(this.enableNonprofitDeselection)this.selectedNonprofitId=null,this.localStorage.setItem("nonprofit",null);else return;else this.selectedNonprofitId=e;this.dispatchEvent(new ce({})),window.removeEventListener(k.eventName,this.handleInitialNonprofitSync),await this.selectionDataController.exec({selectedNonprofitId:this.selectedNonprofitId})},this.evaluateBreakPoints=X(()=>{this.isMobile=window.innerWidth<768},50,{maxWait:50,leading:!0})}get configLang(){return oe[this.lang]||"en"}get parsedPromoCodes(){return ge(this.promoCodes)}getManualPromoCodes(){if(this.parsedPromoCodes&&this.parsedPromoCodes.length>0)return this.parsedPromoCodes;const e=this.localStorage.getItemJson("cart");return e?ue(e):[]}async handleValidatedPromoCodes(e){e.promos?.validatedPromoCodes&&(await Promise.all([he({apiKey:this.apiKey,promoCodes:{validatedPromoCodes:e.promos.validatedPromoCodes,unvalidatedPromoCodes:[]}}),be({validatedPromoCodes:e.promos.validatedPromoCodes,domain:this.domain})]),this.dispatchEvent(new M({source:C.select_nonprofit})))}getNonprofitById(e){return e?this.nonprofitListDataController?.data?.nonprofits.find(t=>t.nonprofit.id===e):null}async connectedCallback(){super.connectedCallback(),window.addEventListener(k.eventName,this.handleInitialNonprofitSync),window.addEventListener(I.eventName,this.handleNonprofitSelect),this.nonprofitListDataController.loading=!0,window.addEventListener(T.eventName,this.handleCartChange),window.addEventListener("resize",this.evaluateBreakPoints)}async firstUpdated(){await this.restoreStateFromCache(),window.addEventListener(F.eventName,this.handlePromoCodesStored)}async updated(e){const t=["baseUrl","storeId","apiKey","countryCode","postalCode","cart","lang","promoCodes","pluginPromoCodes"];this.pluginPromoCodes;for(const i of t)if(e.has(i)){await this.nonprofitListDataController.exec();break}}disconnectedCallback(){window.removeEventListener(T.eventName,this.handleCartChange),window.removeEventListener("resize",this.evaluateBreakPoints),window.removeEventListener(F.eventName,this.handlePromoCodesStored),window.removeEventListener(I.eventName,this.handleNonprofitSelect),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,i=this.localStorage.getItem("nonprofit_selected_at")??0,n=e>new Date(i).valueOf()+t;n?n&&this.selectedNonprofitId!==null&&(await this.postSelectNonprofit({selectedNonprofitId:null}),this.localStorage.setItem("nonprofit",null)):(this.selectedNonprofitId=parseInt(this.localStorage.getItem("nonprofit")||"")||null,this.selectionId=this.localStorage.getItem("transaction")??void 0);const{createdAt:a=0,data:s}=this.localStorage.getItemJson("chainNonprofits")||{},c=2*60*60*1e3;!(e>new Date(a).valueOf()+c)&&this.nonprofitListDataController.loading&&(this.nonprofitListDataController.data=s,this.nonprofitListDataController.loading=!1)}catch(e){pe.error(e)}}async createNewSelectionForCachedNonprofit(){if(P(["apiKey"],this),!(!this.storeId||this.didTryToCreateNewSelectionFromCache))try{this.didTryToCreateNewSelectionFromCache=!0}catch{}}get cssVariables(){const e={"--beam-fontFamily":"inherit","--beam-fontStyle":"inherit","--beam-fontSize":"inherit","--beam-textColor":"inherit","--beam-backgroundColor":"inherit",...ie,"--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-borderWidth":"1px","--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"}),...ve,...ne,"--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","--beam-SelectNonprofit-force-multiline-header":"false"},t=this.nonprofitListDataController?.data?.config?.web?.theme||{},i={...e,...t};return Object.assign(Object.create({toCSS(){return Y(this)}}),i)}render(){const{selectedNonprofitId:e}=this,{data:t,loading:i}=this.nonprofitListDataController;if(i&&!t)return se();if(this.nonprofitListDataController.error)return this.debug?B({error:this.nonprofitListDataController.error}):"";if(this.selectionDataController.error&&this.debug)return B({error:this.selectionDataController.error});const n=t?.nonprofits||[],a=n.find(r=>r.nonprofit.id===e)||null,s=!!t?.config?.web?.promo,c=n.some(r=>!r.promo||!r.promo.isActive),u=r=>this.cssVariables[r],O=u("--beam-SelectNonprofit-display-notification-blip")==="true",y=u("--beam-SelectNonprofit-title-textAlign")==="center",U=u("--beam-SelectNonprofit-enable-inline-header")==="true",b=u("--beam-SelectNonprofit-force-multiline-header")!=="true"&&(U||this.isMobile),E=d`<h3
|
|
21
|
+
</div>`}}customElements.get("beam-notification-blip")||customElements.define("beam-notification-blip",Ne);const ve={"--beam-notificationBlip-color-background":"#000"},g={en:{beamAttribution:()=>"Powered by Beam",ctaTitle:()=>"Choose your impact",ctaPromoPrefixMessage:()=>"At no extra cost,",ctaPromoMessage:({donationPercentage:o="1"}={})=>`select a nonprofit and ${o}% will be donated for you.`,ctaMessage:({donationPercentage:o="1"}={})=>`At no extra cost, select a nonprofit and ${o}% will be donated for you.`,inlineSeparator:()=>": "},fr:{beamAttribution:()=>"Optimis\xE9 par Beam",ctaTitle:()=>"Choisissez votre cause",ctaPromoPrefixMessage:()=>"Sans frais suppl\xE9mentaires,",ctaPromoMessage:({donationPercentage:o="1"}={})=>`s\xE9lectionnez une association et ${o} % sera revers\xE9 en votre nom.`,ctaMessage:({donationPercentage:o="1"}={})=>`Sans frais suppl\xE9mentaires, choisissez une association et ${o} % de votre commande sera revers\xE9 en votre nom.`,inlineSeparator:()=>" : "},de:{beamAttribution:()=>"Unterst\xFCtzt von Beam",ctaTitle:()=>"W\xE4hle deine Wirkung",ctaPromoPrefixMessage:()=>"Ohne zus\xE4tzliche Kosten,",ctaPromoMessage:({donationPercentage:o="1"}={})=>`w\xE4hle eine Organisation und ${o}% deines Einkaufs werden gespendet.`,ctaMessage:({donationPercentage:o="1"}={})=>`Ohne zus\xE4tzliche Kosten kannst du eine gemeinn\xFCtzige Organisation ausw\xE4hlen und ${o}% deiner Bestellung werden gespendet.`,inlineSeparator:()=>": "},es:{beamAttribution:()=>"Ofrecido por Beam",ctaTitle:()=>"Elige tu impacto",ctaPromoPrefixMessage:()=>"Sin coste adicional,",ctaPromoMessage:({donationPercentage:o="1"}={})=>`elige una organizaci\xF3n y donaremos el ${o}% en tu nombre.`,ctaMessage:({donationPercentage:o="1"}={})=>`Sin coste adicional, elige una organizaci\xF3n sin fines de lucro y donaremos el ${o}% de tu compra en tu nombre.`,inlineSeparator:()=>": "},it:{beamAttribution:()=>"Gestito da Beam",ctaTitle:()=>"Scegli il tuo impatto",ctaPromoPrefixMessage:()=>"Senza costi aggiuntivi,",ctaPromoMessage:({donationPercentage:o="1"}={})=>`scegli un'organizzazione e doneremo l\u2019${o}% per te.`,ctaMessage:({donationPercentage:o="1"}={})=>`Senza costi aggiuntivi, seleziona un'organizzazione no-profit e doneremo l\u2019${o}% del tuo acquisto per te.`,inlineSeparator:()=>": "},pl:{beamAttribution:()=>"Obs\u0142ugiwane przez Beam",ctaTitle:()=>"Wybierz sw\xF3j wp\u0142yw",ctaPromoPrefixMessage:()=>"Bez dodatkowych koszt\xF3w,",ctaPromoMessage:({donationPercentage:o="1"}={})=>`wybierz organizacj\u0119, a ${o}% zostanie przekazane w Twoim imieniu.`,ctaMessage:({donationPercentage:o="1"}={})=>`Bez dodatkowych koszt\xF3w wybierz organizacj\u0119, kt\xF3rej przeka\u017Cemy ${o}% warto\u015Bci Twojego zam\xF3wienia w Twoim imieniu.`,inlineSeparator:()=>": "},ja:{beamAttribution:()=>"Powered by Beam",ctaTitle:()=>"\u5BC4\u4ED8\u5148\u3092\u304A\u9078\u3073\u304F\u3060\u3055\u3044\u3002",ctaPromoPrefixMessage:()=>"\u8FFD\u52A0\u8CBB\u7528\u306A\u3057\u3067\u3001",ctaPromoMessage:({donationPercentage:o="1"}={})=>`\u975E\u55B6\u5229\u56E3\u4F53\u3092\u9078\u3076\u3068\u3001${o}%\u304C\u305D\u306E\u56E3\u4F53\u306B\u5BC4\u4ED8\u3055\u308C\u307E\u3059\u3002`,ctaMessage:({donationPercentage:o="1"}={})=>`\u8FFD\u52A0\u8CBB\u7528\u306A\u3057\u3067\u975E\u55B6\u5229\u56E3\u4F53\u3092\u304A\u9078\u3073\u3044\u305F\u3060\u304F\u3068\u3001\u3054\u8CFC\u5165\u91D1\u984D\u306E${o}%\u304C\u5BC4\u4ED8\u3055\u308C\u307E\u3059\u3002`,inlineSeparator:()=>"\uFF1A"}};var Ce=Object.defineProperty,p=(o,e,t,n)=>{for(var i=void 0,a=o.length-1,r;a>=0;a--)(r=o[a])&&(i=r(e,t,i)||i);return i&&Ce(e,t,i),i};let j=!1;class l extends D{constructor(){super(...arguments),this.baseUrl=Z,this.selectedNonprofitId=null,this.lang="en",this.debug=!1,this.draftConfig=!1,this.lastSelectionActionDate=new Date,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()=>{I(["apiKey"],this);const e=W(K,{apiKey:this.apiKey}),t=_("cart",{apiKey:this.apiKey}),n=this.cart?.content?{schema:this.cart?.schema,content:this.cart?.content}:void 0,i=this.getManualPromoCodes(),a=fe(i.map(u=>({value:u})),this.apiKey),r=a&&!me(a);r&&this.dispatchEvent(new M({source:C.select_nonprofit}));const c=await ee({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,...r&&{promos:a},options:{config:{draftConfig:this.draftConfig}},cart:n}});return this.enableNonprofitDeselection=!!c.config.enableNonprofitDeselection,this.selectedNonprofitId!==null&&this.selectedNonprofitId&&!c.nonprofits.map(u=>u.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})=>{I(["apiKey","storeId"],this);const t=new Date;this.lastSelectionActionDate=t;const n=_("cart",{apiKey:this.apiKey}),i=W(K,{apiKey:this.apiKey}),a=await te({baseUrl:this.baseUrl,headers:{authorization:`Api-Key ${this.apiKey}`},requestBody:{nonprofitId:e,selectionId:this.selectionId,storeId:this.storeId,cartId:n||void 0,beamCartId:i||void 0,creationMethod:"cart",postalCode:this.postalCode,countryCode:this.countryCode}});this.selectionId=a?.selectionId,this.localStorage.setItem("transaction",this.selectionId),this.localStorage.setItem("nonprofit",e),this.localStorage.setItem("nonprofit_selected_at",t.toISOString()),await this.updateComplete;const r=this.getNonprofitById(e);e!==null&&this.dispatchEvent(new k({selectedNonprofitId:e,selectionId:this.selectionId,nonprofitName:r?.nonprofit?.name??null,source:C.select_nonprofit,timestamp:t})),e===null&&this.dispatchEvent(new le({newNonprofitId:null,selectionId:this.selectionId,timestamp:t}))},this.nonprofitListDataController=new A(this,this.getChainNonprofits),this.selectionDataController=new A(this,this.postSelectNonprofit),this.localStorage=de(this),this.handleCartChange=e=>{this.cart=e.detail},this.handleNonprofitSelect=e=>{const{selectionId:t,selectedNonprofitId:n,timestamp:i}=e.detail;!i||i<this.lastSelectionActionDate||(this.lastSelectionActionDate=i,this.selectionId!==t&&(this.selectionId=t),this.selectedNonprofitId!==n&&(this.selectedNonprofitId=n??null))},this.handleInitialNonprofitSync=e=>{if(j)return;const{nonprofitId:t,selectionId:n}=e.detail,i=t!==void 0&&this.selectedNonprofitId!==t,a=n!==void 0&&this.selectionId!==n;(i||a)&&(i&&(this.selectedNonprofitId=t),a&&(this.selectionId=n),this.requestUpdate(),j=!0,window.removeEventListener(E.eventName,this.handleInitialNonprofitSync))},this.makeHandleSelect=(e,t,n)=>async i=>{const a=this.selectedNonprofitId;if(i instanceof KeyboardEvent){let r=null;switch(i.key){case"ArrowUp":case"ArrowLeft":t===0?r=n[n.length-1]:r=n[t-1],i.preventDefault();break;case"ArrowRight":case"ArrowDown":t===n.length-1?r=n[0]:r=n[t+1],i.preventDefault();break;case"Enter":case" ":i.preventDefault();break;default:return}if(r){a!=null&&(this.selectedNonprofitId=r.nonprofit.id);const c=this.renderRoot.querySelector(`[data-value="${r.nonprofit.id}"]`);c!==null&&(c.tabIndex=0,c.focus());return}}if(i.currentTarget instanceof HTMLElement)if(a===e)if(this.enableNonprofitDeselection)this.selectedNonprofitId=null,this.localStorage.setItem("nonprofit",null);else return;else this.selectedNonprofitId=e;this.dispatchEvent(new ce({})),window.removeEventListener(E.eventName,this.handleInitialNonprofitSync),await this.selectionDataController.exec({selectedNonprofitId:this.selectedNonprofitId})},this.evaluateBreakPoints=X(()=>{this.isMobile=window.innerWidth<768},50,{maxWait:50,leading:!0})}get configLang(){return oe[this.lang]||"en"}get parsedPromoCodes(){return ge(this.promoCodes)}getManualPromoCodes(){if(this.parsedPromoCodes&&this.parsedPromoCodes.length>0)return this.parsedPromoCodes;const e=this.localStorage.getItemJson("cart");return e?ue(e):[]}async handleValidatedPromoCodes(e){e.promos?.validatedPromoCodes&&(await Promise.all([he({apiKey:this.apiKey,promoCodes:{validatedPromoCodes:e.promos.validatedPromoCodes,unvalidatedPromoCodes:[]}}),be({validatedPromoCodes:e.promos.validatedPromoCodes,domain:this.domain})]),this.dispatchEvent(new M({source:C.select_nonprofit})))}getNonprofitById(e){return e?this.nonprofitListDataController?.data?.nonprofits.find(t=>t.nonprofit.id===e):null}async connectedCallback(){super.connectedCallback(),window.addEventListener(E.eventName,this.handleInitialNonprofitSync),window.addEventListener(k.eventName,this.handleNonprofitSelect),this.nonprofitListDataController.loading=!0,window.addEventListener(T.eventName,this.handleCartChange),window.addEventListener("resize",this.evaluateBreakPoints)}async firstUpdated(){await this.restoreStateFromCache(),window.addEventListener(F.eventName,this.handlePromoCodesStored)}async updated(e){const t=["baseUrl","storeId","apiKey","countryCode","postalCode","cart","lang","promoCodes","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(F.eventName,this.handlePromoCodesStored),window.removeEventListener(k.eventName,this.handleNonprofitSelect),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,i=e>new Date(n).valueOf()+t;i?i&&this.selectedNonprofitId!==null&&(await this.postSelectNonprofit({selectedNonprofitId:null}),this.localStorage.setItem("nonprofit",null)):(this.selectedNonprofitId=parseInt(this.localStorage.getItem("nonprofit")||"")||null,this.selectionId=this.localStorage.getItem("transaction")??void 0);const{createdAt:a=0,data:r}=this.localStorage.getItemJson("chainNonprofits")||{},c=2*60*60*1e3;!(e>new Date(a).valueOf()+c)&&this.nonprofitListDataController.loading&&(this.nonprofitListDataController.data=r,this.nonprofitListDataController.loading=!1)}catch(e){pe.error(e)}}async createNewSelectionForCachedNonprofit(){if(I(["apiKey"],this),!(!this.storeId||this.didTryToCreateNewSelectionFromCache))try{this.didTryToCreateNewSelectionFromCache=!0}catch{}}get cssVariables(){const e={"--beam-fontFamily":"inherit","--beam-fontStyle":"inherit","--beam-fontSize":"inherit","--beam-textColor":"inherit","--beam-backgroundColor":"inherit",...ie,"--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-borderWidth":"1px","--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"}),...ve,...ne,"--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","--beam-SelectNonprofit-force-multiline-header":"false"},t=this.nonprofitListDataController?.data?.config?.web?.theme||{},n={...e,...t};return Object.assign(Object.create({toCSS(){return Y(this)}}),n)}render(){const{selectedNonprofitId:e}=this,{data:t,loading:n}=this.nonprofitListDataController;if(n&&!t)return se();if(this.nonprofitListDataController.error)return this.debug?B({error:this.nonprofitListDataController.error}):"";if(this.selectionDataController.error&&this.debug)return B({error:this.selectionDataController.error});const i=t?.nonprofits||[],a=i.find(s=>s.nonprofit.id===e)||null,r=!!t?.config?.web?.promo,c=i.some(s=>!s.promo||!s.promo.isActive),u=s=>this.cssVariables[s],O=u("--beam-SelectNonprofit-display-notification-blip")==="true",y=u("--beam-SelectNonprofit-title-textAlign")==="center",U=u("--beam-SelectNonprofit-enable-inline-header")==="true",b=u("--beam-SelectNonprofit-force-multiline-header")!=="true"&&(U||this.isMobile),$=d`<h3
|
|
22
22
|
class=${v({"title-block":!0,"d-none":!0,"d-block":!b})}
|
|
23
23
|
part="title"
|
|
24
24
|
id="beam-SelectNonprofit-title"
|
|
25
25
|
>
|
|
26
26
|
${m(this.configLang,t?.config?.web?.title||"")||g[this.configLang].ctaTitle()}
|
|
27
|
-
</h3>`,R=()=>{const
|
|
28
|
-
${
|
|
27
|
+
</h3>`,R=()=>{const s=v({"block-header-promo-pill-container":!b&&!y,"block-header-promo-pill-container-responsive":b&&!y,"block-header-promo-pill-center-block-container-responsive":!b&&y}),w=z({display:b?"flex":void 0});return r?d`<div class=${s} style=${w}>
|
|
28
|
+
${$}
|
|
29
29
|
<beam-promo-info-pill .promo=${t?.config?.web?.promo}></beam-promo-info-pill>
|
|
30
|
-
</div
|
|
30
|
+
</div>`:$},H=()=>d`
|
|
31
31
|
<div part="heading">
|
|
32
32
|
${R()}
|
|
33
33
|
<p class="description" part="description">
|
|
34
34
|
<span class=${v({"d-none":!0,"d-inline":!b})}>
|
|
35
|
-
${
|
|
35
|
+
${r?d`<span style="font-weight:bold">
|
|
36
36
|
${m(this.configLang,t?.config?.web?.promoDescriptionPrefix||"")||g[this.configLang].ctaPromoPrefixMessage()}
|
|
37
37
|
</span>
|
|
38
38
|
<span>
|
|
@@ -46,7 +46,7 @@ import{h as $,f as L,y as d,g as f,t as z,q as v,u as J,m as D,k as G}from"../ch
|
|
|
46
46
|
${(m(this.configLang,t?.config?.web?.title||"")||g[this.configLang].ctaTitle())+g[this.configLang].inlineSeparator()}
|
|
47
47
|
</span>
|
|
48
48
|
<span class="description-inline" part="description">
|
|
49
|
-
${
|
|
49
|
+
${r?d`<span style="font-weight:bold">
|
|
50
50
|
${m(this.configLang,t?.config?.web?.promoDescriptionPrefix||"")||g[this.configLang].ctaPromoPrefixMessage()}
|
|
51
51
|
</span>
|
|
52
52
|
<span>
|
|
@@ -70,21 +70,21 @@ import{h as $,f as L,y as d,g as f,t as z,q as v,u as J,m as D,k as G}from"../ch
|
|
|
70
70
|
aria-labelledby="beam-SelectNonprofit-title"
|
|
71
71
|
style="display: flex; gap: var(--beam-SelectNonprofit-options-gap); margin: 10px 0 0 0;"
|
|
72
72
|
>
|
|
73
|
-
${J(
|
|
73
|
+
${J(i,s=>s.nonprofit.id,({nonprofit:s,promo:w},x)=>{const N=e===s.id,q=N||a==null&&x===0,V=w?.isActive&&t?.config.web.promo&&c&&O;return d`
|
|
74
74
|
<div
|
|
75
75
|
class="option"
|
|
76
76
|
part="option"
|
|
77
77
|
role="radio"
|
|
78
78
|
tabindex="${q?0:-1}"
|
|
79
|
-
data-value=${
|
|
79
|
+
data-value=${s.id}
|
|
80
80
|
aria-checked=${N}
|
|
81
|
-
@click=${this.makeHandleSelect(
|
|
82
|
-
@keydown=${this.makeHandleSelect(
|
|
83
|
-
aria-label="${m(this.configLang,
|
|
84
|
-
style="${
|
|
81
|
+
@click=${this.makeHandleSelect(s.id,x,i)}
|
|
82
|
+
@keydown=${this.makeHandleSelect(s.id,x,i)}
|
|
83
|
+
aria-label="${m(this.configLang,s.cause||"")}"
|
|
84
|
+
style="${z({cursor:"pointer",flex:"1",textAlign:"center",lineHeight:"1",marginTop:"var(--beam-SelectNonprofit-options-marginTop, 0px)",padding:"var(--beam-SelectNonprofit-options-padding, 10px)",borderStyle:"solid",position:"relative",borderRadius:"var(--beam-SelectNonprofit-options-borderRadius, 0)",borderColor:N?s.causeColor||"var(--beam-SelectNonprofit-options--selected-borderColor, currentColor)":"var(--beam-SelectNonprofit-options-borderColor, currentColor)",borderWidth:"var(--beam-SelectNonprofit-options-borderWidth, 1px)",backgroundColor:N?s.causeColor||"var(--beam-SelectNonprofit-options--selected-backgroundColor, currentColor)":"var(--beam-SelectNonprofit-options-backgroundColor, transparent)"})}"
|
|
85
85
|
>
|
|
86
86
|
<img
|
|
87
|
-
src="${N?
|
|
87
|
+
src="${N?s.causeIconSelectedUrl:s.causeIconUrl}"
|
|
88
88
|
alt=""
|
|
89
89
|
role="presentation"
|
|
90
90
|
style="
|
|
@@ -232,5 +232,5 @@ import{h as $,f as L,y as d,g as f,t as z,q as v,u as J,m as D,k as G}from"../ch
|
|
|
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})],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:(o,e)=>!Q(o,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([
|
|
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:(o,e)=>!Q(o,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([P()],l.prototype,"lastSelectionActionDate"),p([P()],l.prototype,"isMobile"),p([P()],l.prototype,"pluginPromoCodes"),re(l);export{l as BeamSelectNonprofit};
|
|
236
236
|
//# sourceMappingURL=select-nonprofit.esm.js.map
|