@beamimpact/web-sdk 1.57.1 → 1.57.3

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.
Files changed (163) hide show
  1. package/README.md +66 -42
  2. package/dist/chunks/{_share-dialog-dependencies-BEUnzuWq.esm.js → _share-dialog-dependencies-BonvNllt.esm.js} +2 -2
  3. package/dist/chunks/{_share-dialog-dependencies-BEUnzuWq.esm.js.map → _share-dialog-dependencies-BonvNllt.esm.js.map} +1 -1
  4. package/dist/chunks/{cart-CKltrzQt.esm.d.ts → cart-DCezceUX.esm.d.ts} +2 -2
  5. package/dist/chunks/{index-DqhM4Yoj.esm.js → index-BXivnoQL.esm.js} +6 -6
  6. package/dist/chunks/index-BXivnoQL.esm.js.map +1 -0
  7. package/dist/chunks/{index-OYSJ-2mk.esm.d.ts → index-Bi9LFICg.esm.d.ts} +1 -1
  8. package/dist/chunks/{index-D6aFJ4cU.esm.js → index-BnbtpTg-.esm.js} +2 -2
  9. package/dist/chunks/{index-D6aFJ4cU.esm.js.map → index-BnbtpTg-.esm.js.map} +1 -1
  10. package/dist/chunks/{index-Dm-K2MLY.esm.js → index-BpR0FMss.esm.js} +2 -2
  11. package/dist/chunks/{index-Dm-K2MLY.esm.js.map → index-BpR0FMss.esm.js.map} +1 -1
  12. package/dist/chunks/index-C03QP2W-.esm.js +32 -0
  13. package/dist/chunks/index-C03QP2W-.esm.js.map +1 -0
  14. package/dist/chunks/{index-C6a13iqC.esm.d.ts → index-C6gns2ul.esm.d.ts} +1 -1
  15. package/dist/chunks/index-CQEhF7Dy.esm.js +32 -0
  16. package/dist/chunks/index-CQEhF7Dy.esm.js.map +1 -0
  17. package/dist/chunks/{index-HqfLVFOU.esm.js → index-DJ5OwAaV.esm.js} +6 -6
  18. package/dist/chunks/index-DJ5OwAaV.esm.js.map +1 -0
  19. package/dist/chunks/{index-BH3YaPLG.esm.d.ts → index-DQ89VjpD.esm.d.ts} +1 -1
  20. package/dist/chunks/{index-MAMeVd6l.esm.js → index-Ghl9JrXJ.esm.js} +2 -2
  21. package/dist/chunks/{index-MAMeVd6l.esm.js.map → index-Ghl9JrXJ.esm.js.map} +1 -1
  22. package/dist/chunks/{index-BAROgNYE.esm.d.ts → index-h_-rDiMR.esm.d.ts} +1 -1
  23. package/dist/chunks/{promo-pill-label-5HmbDVmU.esm.js → promo-pill-label-F6oSUeZ_.esm.js} +2 -2
  24. package/dist/chunks/{promo-pill-label-5HmbDVmU.esm.js.map → promo-pill-label-F6oSUeZ_.esm.js.map} +1 -1
  25. package/dist/chunks/{share-button-C4yPLL_t.esm.js → share-button-C_qDR7Rw.esm.js} +2 -2
  26. package/dist/chunks/{share-button-C4yPLL_t.esm.js.map → share-button-C_qDR7Rw.esm.js.map} +1 -1
  27. package/dist/chunks/{share-button-5gfPmeEh.esm.js → share-button-Cle5Uexn.esm.js} +2 -2
  28. package/dist/chunks/{share-button-5gfPmeEh.esm.js.map → share-button-Cle5Uexn.esm.js.map} +1 -1
  29. package/dist/chunks/{update-cart-DoJGAdoU.esm.d.ts → update-cart-B5Tr9N3V.esm.d.ts} +1 -1
  30. package/dist/chunks/{utils-COGFpDER.esm.d.ts → utils-BPcZ5h8J.esm.d.ts} +75 -0
  31. package/dist/chunks/utils-C5hmbxa4.esm.js.map +1 -1
  32. package/dist/components/beam-partner-logos.d.ts +1 -1
  33. package/dist/components/community-impact.d.ts +1 -1
  34. package/dist/components/community-impact.esm.js +1 -1
  35. package/dist/components/community-impact.js +1 -1
  36. package/dist/components/cumulative-impact.d.ts +1 -1
  37. package/dist/components/cumulative-impact.esm.js +1 -1
  38. package/dist/components/cumulative-impact.js +1 -1
  39. package/dist/components/impact-overview.d.ts +1 -1
  40. package/dist/components/impact-overview.esm.js +1 -1
  41. package/dist/components/impact-overview.js +1 -1
  42. package/dist/components/index.d.ts +1 -1
  43. package/dist/components/index.esm.js +1 -1
  44. package/dist/components/index.js +1 -1
  45. package/dist/components/post-purchase.d.ts +2 -1
  46. package/dist/components/post-purchase.esm.js +1 -1
  47. package/dist/components/post-purchase.js +1 -1
  48. package/dist/components/product-details-page.d.ts +1 -1
  49. package/dist/components/product-details-page.esm.js +2 -2
  50. package/dist/components/product-details-page.esm.js.map +1 -1
  51. package/dist/components/product-details-page.js +2 -2
  52. package/dist/components/product-details-page.js.map +1 -1
  53. package/dist/components/redeem-transaction.d.ts +1 -1
  54. package/dist/components/redeem-transaction.esm.js +1 -1
  55. package/dist/components/redeem-transaction.js +1 -1
  56. package/dist/components/select-nonprofit.d.ts +1 -1
  57. package/dist/components/select-nonprofit.esm.js +2 -2
  58. package/dist/components/select-nonprofit.esm.js.map +1 -1
  59. package/dist/components/select-nonprofit.js +2 -2
  60. package/dist/components/select-nonprofit.js.map +1 -1
  61. package/dist/components/select-subscription-nonprofit.d.ts +1 -1
  62. package/dist/components/select-subscription-nonprofit.esm.js +1 -1
  63. package/dist/components/select-subscription-nonprofit.js +1 -1
  64. package/dist/components/shopify.d.ts +4 -4
  65. package/dist/components/shopify.esm.js +1 -1
  66. package/dist/components/shopify.js +1 -1
  67. package/dist/components/social-share.d.ts +1 -1
  68. package/dist/components/social-share.esm.js +1 -1
  69. package/dist/components/social-share.js +1 -1
  70. package/dist/components/subscriber-select-nonprofit.d.ts +1 -1
  71. package/dist/components/subscriber-select-nonprofit.esm.js +1 -1
  72. package/dist/components/subscriber-select-nonprofit.js +1 -1
  73. package/dist/components/subscription-impact.d.ts +1 -1
  74. package/dist/components/subscription-impact.esm.js +1 -1
  75. package/dist/components/subscription-impact.js +1 -1
  76. package/dist/components/subscription-management.d.ts +1 -1
  77. package/dist/components/subscription-management.esm.js +1 -1
  78. package/dist/components/subscription-management.js +1 -1
  79. package/dist/index.d.ts +7 -7
  80. package/dist/index.esm.js +1 -1
  81. package/dist/index.js +1 -1
  82. package/dist/integrations/beam.d.ts +1 -1
  83. package/dist/integrations/beam.esm.js +1 -1
  84. package/dist/integrations/beam.js +1 -1
  85. package/dist/integrations/cart.d.ts +2 -2
  86. package/dist/integrations/cart.esm.js +1 -1
  87. package/dist/integrations/cart.js +1 -1
  88. package/dist/integrations/logs.d.ts +2 -2
  89. package/dist/integrations/logs.esm.js +1 -1
  90. package/dist/integrations/logs.js +1 -1
  91. package/dist/integrations/promoManager.d.ts +1 -1
  92. package/dist/integrations/shopify-order.d.ts +1 -1
  93. package/dist/integrations/shopify-order.esm.js +1 -1
  94. package/dist/integrations/shopify-order.js +1 -1
  95. package/dist/integrations/shopify.d.ts +3 -3
  96. package/dist/integrations/shopify.esm.js +1 -1
  97. package/dist/integrations/shopify.js +1 -1
  98. package/dist/integrations/statsig.d.ts +1 -1
  99. package/dist/integrations/statsig.esm.js +3 -3
  100. package/dist/integrations/statsig.esm.js.map +1 -1
  101. package/dist/integrations/statsig.js +3 -3
  102. package/dist/integrations/statsig.js.map +1 -1
  103. package/dist/integrations/utils.d.ts +1 -1
  104. package/dist/react/beam-partner-logos.d.ts +1 -1
  105. package/dist/react/community-impact.d.ts +1 -1
  106. package/dist/react/community-impact.esm.js +1 -1
  107. package/dist/react/community-impact.js +1 -1
  108. package/dist/react/cumulative-impact.d.ts +1 -1
  109. package/dist/react/cumulative-impact.esm.js +1 -1
  110. package/dist/react/cumulative-impact.js +1 -1
  111. package/dist/react/impact-overview.d.ts +1 -1
  112. package/dist/react/impact-overview.esm.js +1 -1
  113. package/dist/react/impact-overview.js +1 -1
  114. package/dist/react/index.d.ts +1 -1
  115. package/dist/react/index.esm.js +1 -1
  116. package/dist/react/index.js +1 -1
  117. package/dist/react/post-purchase.d.ts +1 -1
  118. package/dist/react/post-purchase.esm.js +1 -1
  119. package/dist/react/post-purchase.js +1 -1
  120. package/dist/react/product-details-page.d.ts +1 -1
  121. package/dist/react/product-details-page.esm.js +1 -1
  122. package/dist/react/product-details-page.js +1 -1
  123. package/dist/react/redeem-transaction.d.ts +1 -1
  124. package/dist/react/redeem-transaction.esm.js +1 -1
  125. package/dist/react/redeem-transaction.js +1 -1
  126. package/dist/react/select-nonprofit.d.ts +1 -1
  127. package/dist/react/select-nonprofit.esm.js +1 -1
  128. package/dist/react/select-nonprofit.js +1 -1
  129. package/dist/react/select-subscription-nonprofit.d.ts +1 -1
  130. package/dist/react/select-subscription-nonprofit.esm.js +1 -1
  131. package/dist/react/select-subscription-nonprofit.js +1 -1
  132. package/dist/react/social-share.d.ts +1 -1
  133. package/dist/react/social-share.esm.js +1 -1
  134. package/dist/react/social-share.js +1 -1
  135. package/dist/react/subscriber-select-nonprofit.d.ts +1 -1
  136. package/dist/react/subscriber-select-nonprofit.esm.js +1 -1
  137. package/dist/react/subscriber-select-nonprofit.js +1 -1
  138. package/dist/react/subscription-impact.d.ts +1 -1
  139. package/dist/react/subscription-impact.esm.js +1 -1
  140. package/dist/react/subscription-impact.js +1 -1
  141. package/dist/react/subscription-management.d.ts +1 -1
  142. package/dist/react/subscription-management.esm.js +1 -1
  143. package/dist/react/subscription-management.js +1 -1
  144. package/dist/utils/beam-errors.d.ts +1 -1
  145. package/dist/utils/cart.d.ts +1 -1
  146. package/dist/utils/clear-beam-storage.d.ts +1 -1
  147. package/dist/utils/cookies.d.ts +1 -1
  148. package/dist/utils/events.d.ts +1 -1
  149. package/dist/utils/local-storage.d.ts +1 -1
  150. package/dist/utils/logger.d.ts +1 -1
  151. package/dist/utils/makeApiKeyHeader.d.ts +1 -1
  152. package/dist/utils/memoize-last.d.ts +1 -1
  153. package/dist/utils/network-listeners.d.ts +1 -1
  154. package/dist/utils/promoManager.d.ts +1 -1
  155. package/dist/utils/remote-session.d.ts +1 -1
  156. package/dist/utils/wait-for-element.d.ts +1 -1
  157. package/package.json +1 -1
  158. package/dist/chunks/index-BgalrCS_.esm.js +0 -32
  159. package/dist/chunks/index-BgalrCS_.esm.js.map +0 -1
  160. package/dist/chunks/index-C60Vejym.esm.js +0 -32
  161. package/dist/chunks/index-C60Vejym.esm.js.map +0 -1
  162. package/dist/chunks/index-DqhM4Yoj.esm.js.map +0 -1
  163. package/dist/chunks/index-HqfLVFOU.esm.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import{h as A,i as E,n as b,r as T,a as L,b as N,k as H,j as U}from"../chunks/lit-BEag9MFp.esm.js";import{d as P,u as h,h as B,j as z,k as _,A as C,e as g,f as W,_ as K,c as D}from"../chunks/index-Dm-K2MLY.esm.js";import{D as O,W as k,x as w,y as R,B as j,v as F}from"../chunks/utils-C5hmbxa4.esm.js";import{c as q,d as G,e as v}from"../chunks/css-card-grid-CiqEjkwR.esm.js";import{a as V}from"../chunks/share-button-5gfPmeEh.esm.js";import{c as J}from"../chunks/responsive-aN8P5PqD.esm.js";import{h as o,g as $}from"../chunks/handlebars-B_i-to-h.esm.js";import"../chunks/lodash-CrMU6wKg.esm.js";const M={long:"dddd, MMMM D, YYYY",short:"MMM D, YYYY",numeric:"MM/DD/YYYY",iso:"YYYY-MM-DD",time:"h:mm A",time24:"HH:mm",datetime:"MMMM D, YYYY h:mm A",month:"MMMM YYYY",monthShort:"MMM YYYY",dayMonth:"MMMM D"},x=(t,e)=>{const r=M[e??"long"]??e??M.long;return $(t).format(r)};o.registerHelper("currentDate",t=>x(new Date,typeof t=="string"?t:void 0)),o.registerHelper("nextMonth",t=>{const e=$().add(1,"month").toDate();return x(e,typeof t=="string"?t:void 0)}),o.registerHelper("dateOffset",(t,e,r)=>{const s=typeof e=="string"?e:void 0,i=(typeof e=="string"?r:e)?.hash?.from,n=i?new Date(i):new Date,p=$(n).add(t,"day").toDate();return s==="relative"?t===-1?"yesterday":t===0?"today":t===1?"tomorrow":t<0?`${Math.abs(t)} days ago`:`${t} days from now`:x(p,s)}),o.registerHelper("formatDate",(t,e)=>{const r=t instanceof Date?t:new Date(t);return isNaN(r.getTime())?"":x(r,typeof e=="string"?e:void 0)}),o.registerHelper("color",(t,e)=>{const r=o.escapeExpression(e),s=o.escapeExpression(t);return new o.SafeString(`<span style="color:${s}">${r}</span>`)}),o.registerHelper("br",()=>new o.SafeString("<br>")),o.registerHelper("bold",t=>{const e=o.escapeExpression(t);return new o.SafeString(`<strong>${e}</strong>`)}),o.registerHelper("italic",t=>{const e=o.escapeExpression(t);return new o.SafeString(`<em>${e}</em>`)}),o.registerHelper("underline",t=>{const e=o.escapeExpression(t);return new o.SafeString(`<span style="text-decoration:underline">${e}</span>`)}),o.registerHelper("strikethrough",t=>{const e=o.escapeExpression(t);return new o.SafeString(`<s>${e}</s>`)}),o.registerHelper("uppercase",t=>{const e=o.escapeExpression(t);return new o.SafeString(`<span style="text-transform:uppercase">${e}</span>`)}),o.registerHelper("lowercase",t=>{const e=o.escapeExpression(t);return new o.SafeString(`<span style="text-transform:lowercase">${e}</span>`)}),o.registerHelper("capitalize",t=>{const e=String(t??""),r=e.charAt(0).toUpperCase()+e.slice(1);return new o.SafeString(o.escapeExpression(r))}),o.registerHelper("style",(t,e)=>{const{bold:r,italic:s,underline:i,strikethrough:n,uppercase:p,lowercase:a,color:m,fontSize:f,fontFamily:y}=e.hash;let d=o.escapeExpression(t);r&&(d=`<strong>${d}</strong>`),s&&(d=`<em>${d}</em>`),n&&(d=`<s>${d}</s>`);const u=[];return i&&u.push("text-decoration:underline"),p&&u.push("text-transform:uppercase"),a&&u.push("text-transform:lowercase"),m&&u.push(`color:${o.escapeExpression(m)}`),f&&u.push(`font-size:${o.escapeExpression(f)}`),y&&u.push(`font-family:${o.escapeExpression(y)}`),u.length&&(d=`<span style="${u.join(";")}">${d}</span>`),new o.SafeString(d)});const Q="en",Y=(t,e={},r="")=>{const s=e.lang||Q,i=t||r,n=P(s,i)??i;return o.compile(n)(e)},S=(t,e={},r="")=>A(Y(t,e,r)),I={en:{beamAttribution:()=>"Powered by Beam",ctaTitle:()=>"Choose Your Impact",ctaMessage:({donationPercentage:t="1%"}={})=>`Choose a nonprofit and ${t} will be donated there for you,at no extra cost, with every order of your subscription.`},fr:{beamAttribution:()=>"Optimis\xE9 par Beam",ctaTitle:()=>"Choose Your Impact",ctaMessage:({donationPercentage:t="1%"}={})=>`Choose a nonprofit and ${t} will be donated there for you,at no extra cost, with every order of your subscription.`},de:{beamAttribution:()=>"Unterst\xFCtzt von Beam",ctaTitle:()=>"Choose Your Impact",ctaMessage:({donationPercentage:t="1%"}={})=>`Choose a nonprofit and ${t} will be donated there for you,at no extra cost, with every order of your subscription.`},es:{beamAttribution:()=>"Desarrollado por Beam",ctaTitle:()=>"Choose Your Impact",ctaMessage:({donationPercentage:t="1%"}={})=>`Choose a nonprofit and ${t} will be donated there for you,at no extra cost, with every order of your subscription.`},it:{beamAttribution:()=>"Offerto da Beam",ctaTitle:()=>"Choose Your Impact",ctaMessage:({donationPercentage:t="1%"}={})=>`Choose a nonprofit and ${t} will be donated there for you,at no extra cost, with every order of your subscription.`},pl:{beamAttribution:()=>"Wspierane przez Beam",ctaTitle:()=>"Choose Your Impact",ctaMessage:({donationPercentage:t="1%"}={})=>`Choose a nonprofit and ${t} will be donated there for you,at no extra cost, with every order of your subscription.`},ja:{beamAttribution:()=>"Powered by Beam",ctaTitle:()=>"Choose Your Impact",ctaMessage:({donationPercentage:t="1%"}={})=>`Choose a nonprofit and ${t} will be donated there for you,at no extra cost, with every order of your subscription.`}};var X=Object.defineProperty,c=(t,e,r,s)=>{for(var i=void 0,n=t.length-1,p;n>=0;n--)(p=t[n])&&(i=p(e,r,i)||i);return i&&X(e,r,i),i};class l extends L{constructor(){super(...arguments),this.baseUrl=O,this.lang="en",this.debug=!1,this.draftConfig=!1,this.templateData={},this.chain={},this.subscriptionLookup=Promise.resolve(),this.getChainNonprofits=async()=>{v(["apiKey","subscriptionId"],this);const e=await B({baseUrl:this.baseUrl,headers:w(this.apiKey),requestBody:{storeId:this.storeId,widgetName:k.subscriber_select_nonprofit,postalCode:this.postalCode,countryCode:this.countryCode,version:"1.0.0",lang:this.configLang,options:{config:{draftConfig:this.draftConfig}}}});if(e.store?.id&&e.store.id!==this.storeId&&(this.storeId=e.store.id),await this.subscriptionLookup,this.selectedNonprofitId!=null&&!e.nonprofits.map(r=>r.nonprofit.id).includes(this.selectedNonprofitId)&&(this.selectedNonprofitId=void 0),this.selectedNonprofitId==null&&this.preselectNonprofitAtIndex!=null){const r=e.nonprofits[this.preselectNonprofitAtIndex-1];r&&(this.selectedNonprofitId=r.nonprofit.id,await this.selectionDataController.exec({selectedNonprofitId:r.nonprofit.id}))}return this.chain={...e?.chain},e},this.fetchSubscription=async()=>{v(["apiKey","subscriptionId"],this);const e=await z({baseUrl:this.baseUrl,headers:w(this.apiKey),requestBody:{remoteSubscriptionId:this.subscriptionId,email:this.email,partnerUserId:this.partnerUserId}});return e.nonprofit?.id&&this.selectedNonprofitId===void 0&&(this.selectedNonprofitId=e.nonprofit.id),e},this.updateNonprofitForSubscription=async({selectedNonprofitId:e})=>{v(["apiKey","subscriptionId"],this);const r=await _({baseUrl:this.baseUrl,headers:w(this.apiKey),requestBody:{remoteSubscriptionId:this.subscriptionId,nonprofitId:e,selectionMethod:R.subscriber_select_nonprofit_widget}});await this.updateComplete;const s=this.getNonprofitById(e);return this.dispatchEvent(new j({selectedNonprofitId:e,nonprofitName:s?.nonprofit?.name??null,source:k.subscriber_select_nonprofit,timestamp:new Date})),r},this.nonprofitListDataController=new C(this,this.getChainNonprofits),this.subscriptionDataController=new C(this,this.fetchSubscription),this.selectionDataController=new C(this,this.updateNonprofitForSubscription),this.makeHandleSelect=(e,r,s)=>async i=>{const n=this.selectedNonprofitId;if(i instanceof KeyboardEvent){let p=null;switch(i.key){case"ArrowUp":case"ArrowLeft":p=r===0?s[s.length-1]:s[r-1],i.preventDefault();break;case"ArrowRight":case"ArrowDown":p=r===s.length-1?s[0]:s[r+1],i.preventDefault();break;case"Enter":case" ":i.preventDefault();break;default:return}if(p){n!=null&&(this.selectedNonprofitId=p.nonprofit.id);const a=this.renderRoot.querySelector(`[data-value="${p.nonprofit.id}"]`);a!==null&&(a.tabIndex=0,a.focus());return}}!(i.currentTarget instanceof HTMLElement)||n===e||(this.selectedNonprofitId=e,await this.selectionDataController.exec({selectedNonprofitId:e}))}}get configLang(){return F[this.lang]||"en"}getNonprofitById(e){return e?this.nonprofitListDataController?.data?.nonprofits.find(r=>r.nonprofit.id===e):null}async connectedCallback(){super.connectedCallback(),this.nonprofitListDataController.loading=!0}async firstUpdated(){!this.apiKey||!this.email&&!this.partnerUserId||(this.subscriptionLookup=this.subscriptionDataController.exec(),await this.subscriptionLookup)}async updated(e){const r=["baseUrl","storeId","apiKey","countryCode","postalCode","lang"];for(const s of r)if(e.has(s)){await this.nonprofitListDataController.exec();break}}disconnectedCallback(){super.disconnectedCallback()}get cssVariables(){const e={"--beam-fontFamily":"inherit","--beam-fontStyle":"inherit","--beam-fontSize":"inherit","--beam-textColor":"inherit","--beam-backgroundColor":"inherit",...V,"--beam-SubscriberSelectNonprofit-title-textAlign":"inherit","--beam-SubscriberSelectNonprofit-description-textAlign":"inherit","--beam-SubscriberSelectNonprofit-maxWidth":"800px","--beam-SubscriberSelectNonprofit-options-marginTop":"0px","--beam-SubscriberSelectNonprofit-options-iconHeight":"20px","--beam-SubscriberSelectNonprofit-options-padding":"6px 4px","--beam-SubscriberSelectNonprofit-options-borderRadius":"4px","--beam-SubscriberSelectNonprofit-options-borderColor":"currentColor","--beam-SubscriberSelectNonprofit-options-borderWidth":"1px","--beam-SubscriberSelectNonprofit-options--selected-borderColor":"currentColor","--beam-SubscriberSelectNonprofit-options-backgroundColor":"transparent","--beam-SubscriberSelectNonprofit-options-gap":"8px","--beam-SubscriberSelectNonprofit-options-margin":"14px 0 0 0","--beam-SubscriberSelectNonprofit-width":"100%","--beam-SubscriberSelectNonprofit-options--selected-backgroundColor":"currentColor","--beam-SubscriberSelectNonprofit-details-marginTop":"6px","--beam-SubscriberSelectNonprofit-details-borderRadius":"4px","--beam-SubscriberSelectNonprofit-details-borderWidth":"1px","--beam-SubscriberSelectNonprofit-details-borderColor":"currentColor","--beam-SubscriberSelectNonprofit-details-backgroundColor":"inherit","--beam-SubscriberSelectNonprofit-details-padding":"10px",...g("--beam-SubscriberSelectNonprofit-title",{fontSize:"1em",fontWeight:"bold"}),...g("--beam-SubscriberSelectNonprofit-description",{marginTop:"1em",fontSize:".85em"}),"--beam-SubscriberSelectNonprofit-title-block-margin-right":"8px",...g("--beam-SubscriberSelectNonprofit-details-cause",{fontSize:"0.85em",fontWeight:"bold",textTransform:"uppercase"}),...g("--beam-SubscriberSelectNonprofit-details-beamAttribution",{fontSize:"0.85em"}),...g("--beam-SubscriberSelectNonprofit-details-impactDescription",{fontSize:".85em",marginTop:"10px",lineHeight:"normal"}),"--beam-SubscriberSelectNonprofit-details-nonprofitName-fontWeight":"bold","--beam-SubscriberSelectNonprofit-details-nonprofitName-fontStyle":"inherit","--beam-SubscriberSelectNonprofit-details-fundingProgress-marginTop":"10px",...g("--beam-SubscriberSelectNonprofit-details-fundingProgressLabel",{fontSize:"0.85em"})},r=this.nonprofitListDataController?.data?.config?.web?.theme||{},s={...e,...r};return Object.assign(Object.create({toCSS(){return W(this)}}),s)}render(){if(!this.apiKey||!this.email&&!this.partnerUserId)return N``;const{selectedNonprofitId:e}=this,{data:r,loading:s}=this.nonprofitListDataController;if(s&&!r)return K();if(this.nonprofitListDataController.error)return this.debug?D({error:this.nonprofitListDataController.error}):"";if(this.selectionDataController.error&&this.debug)return D({error:this.selectionDataController.error});const i=r?.nonprofits||[],n=i.find(a=>a.nonprofit.id===e)||null,p={custom:{...this.templateData},chain:{...this.chain},selectedNonprofit:{...n?.nonprofit},lang:this.configLang};return N`
1
+ import{h as A,i as E,n as b,r as T,a as L,b as N,k as H,j as U}from"../chunks/lit-BEag9MFp.esm.js";import{d as P,u as h,h as B,j as z,k as _,A as C,e as g,f as W,_ as K,c as D}from"../chunks/index-BpR0FMss.esm.js";import{D as O,W as k,x as w,y as R,B as j,v as F}from"../chunks/utils-C5hmbxa4.esm.js";import{c as q,d as G,e as v}from"../chunks/css-card-grid-CiqEjkwR.esm.js";import{a as V}from"../chunks/share-button-Cle5Uexn.esm.js";import{c as J}from"../chunks/responsive-aN8P5PqD.esm.js";import{h as o,g as $}from"../chunks/handlebars-B_i-to-h.esm.js";import"../chunks/lodash-CrMU6wKg.esm.js";const M={long:"dddd, MMMM D, YYYY",short:"MMM D, YYYY",numeric:"MM/DD/YYYY",iso:"YYYY-MM-DD",time:"h:mm A",time24:"HH:mm",datetime:"MMMM D, YYYY h:mm A",month:"MMMM YYYY",monthShort:"MMM YYYY",dayMonth:"MMMM D"},x=(t,e)=>{const r=M[e??"long"]??e??M.long;return $(t).format(r)};o.registerHelper("currentDate",t=>x(new Date,typeof t=="string"?t:void 0)),o.registerHelper("nextMonth",t=>{const e=$().add(1,"month").toDate();return x(e,typeof t=="string"?t:void 0)}),o.registerHelper("dateOffset",(t,e,r)=>{const s=typeof e=="string"?e:void 0,i=(typeof e=="string"?r:e)?.hash?.from,n=i?new Date(i):new Date,p=$(n).add(t,"day").toDate();return s==="relative"?t===-1?"yesterday":t===0?"today":t===1?"tomorrow":t<0?`${Math.abs(t)} days ago`:`${t} days from now`:x(p,s)}),o.registerHelper("formatDate",(t,e)=>{const r=t instanceof Date?t:new Date(t);return isNaN(r.getTime())?"":x(r,typeof e=="string"?e:void 0)}),o.registerHelper("color",(t,e)=>{const r=o.escapeExpression(e),s=o.escapeExpression(t);return new o.SafeString(`<span style="color:${s}">${r}</span>`)}),o.registerHelper("br",()=>new o.SafeString("<br>")),o.registerHelper("bold",t=>{const e=o.escapeExpression(t);return new o.SafeString(`<strong>${e}</strong>`)}),o.registerHelper("italic",t=>{const e=o.escapeExpression(t);return new o.SafeString(`<em>${e}</em>`)}),o.registerHelper("underline",t=>{const e=o.escapeExpression(t);return new o.SafeString(`<span style="text-decoration:underline">${e}</span>`)}),o.registerHelper("strikethrough",t=>{const e=o.escapeExpression(t);return new o.SafeString(`<s>${e}</s>`)}),o.registerHelper("uppercase",t=>{const e=o.escapeExpression(t);return new o.SafeString(`<span style="text-transform:uppercase">${e}</span>`)}),o.registerHelper("lowercase",t=>{const e=o.escapeExpression(t);return new o.SafeString(`<span style="text-transform:lowercase">${e}</span>`)}),o.registerHelper("capitalize",t=>{const e=String(t??""),r=e.charAt(0).toUpperCase()+e.slice(1);return new o.SafeString(o.escapeExpression(r))}),o.registerHelper("style",(t,e)=>{const{bold:r,italic:s,underline:i,strikethrough:n,uppercase:p,lowercase:a,color:m,fontSize:f,fontFamily:y}=e.hash;let d=o.escapeExpression(t);r&&(d=`<strong>${d}</strong>`),s&&(d=`<em>${d}</em>`),n&&(d=`<s>${d}</s>`);const u=[];return i&&u.push("text-decoration:underline"),p&&u.push("text-transform:uppercase"),a&&u.push("text-transform:lowercase"),m&&u.push(`color:${o.escapeExpression(m)}`),f&&u.push(`font-size:${o.escapeExpression(f)}`),y&&u.push(`font-family:${o.escapeExpression(y)}`),u.length&&(d=`<span style="${u.join(";")}">${d}</span>`),new o.SafeString(d)});const Q="en",Y=(t,e={},r="")=>{const s=e.lang||Q,i=t||r,n=P(s,i)??i;return o.compile(n)(e)},S=(t,e={},r="")=>A(Y(t,e,r)),I={en:{beamAttribution:()=>"Powered by Beam",ctaTitle:()=>"Choose Your Impact",ctaMessage:({donationPercentage:t="1%"}={})=>`Choose a nonprofit and ${t} will be donated there for you,at no extra cost, with every order of your subscription.`},fr:{beamAttribution:()=>"Optimis\xE9 par Beam",ctaTitle:()=>"Choose Your Impact",ctaMessage:({donationPercentage:t="1%"}={})=>`Choose a nonprofit and ${t} will be donated there for you,at no extra cost, with every order of your subscription.`},de:{beamAttribution:()=>"Unterst\xFCtzt von Beam",ctaTitle:()=>"Choose Your Impact",ctaMessage:({donationPercentage:t="1%"}={})=>`Choose a nonprofit and ${t} will be donated there for you,at no extra cost, with every order of your subscription.`},es:{beamAttribution:()=>"Desarrollado por Beam",ctaTitle:()=>"Choose Your Impact",ctaMessage:({donationPercentage:t="1%"}={})=>`Choose a nonprofit and ${t} will be donated there for you,at no extra cost, with every order of your subscription.`},it:{beamAttribution:()=>"Offerto da Beam",ctaTitle:()=>"Choose Your Impact",ctaMessage:({donationPercentage:t="1%"}={})=>`Choose a nonprofit and ${t} will be donated there for you,at no extra cost, with every order of your subscription.`},pl:{beamAttribution:()=>"Wspierane przez Beam",ctaTitle:()=>"Choose Your Impact",ctaMessage:({donationPercentage:t="1%"}={})=>`Choose a nonprofit and ${t} will be donated there for you,at no extra cost, with every order of your subscription.`},ja:{beamAttribution:()=>"Powered by Beam",ctaTitle:()=>"Choose Your Impact",ctaMessage:({donationPercentage:t="1%"}={})=>`Choose a nonprofit and ${t} will be donated there for you,at no extra cost, with every order of your subscription.`}};var X=Object.defineProperty,c=(t,e,r,s)=>{for(var i=void 0,n=t.length-1,p;n>=0;n--)(p=t[n])&&(i=p(e,r,i)||i);return i&&X(e,r,i),i};class l extends L{constructor(){super(...arguments),this.baseUrl=O,this.lang="en",this.debug=!1,this.draftConfig=!1,this.templateData={},this.chain={},this.subscriptionLookup=Promise.resolve(),this.getChainNonprofits=async()=>{v(["apiKey","subscriptionId"],this);const e=await B({baseUrl:this.baseUrl,headers:w(this.apiKey),requestBody:{storeId:this.storeId,widgetName:k.subscriber_select_nonprofit,postalCode:this.postalCode,countryCode:this.countryCode,version:"1.0.0",lang:this.configLang,options:{config:{draftConfig:this.draftConfig}}}});if(e.store?.id&&e.store.id!==this.storeId&&(this.storeId=e.store.id),await this.subscriptionLookup,this.selectedNonprofitId!=null&&!e.nonprofits.map(r=>r.nonprofit.id).includes(this.selectedNonprofitId)&&(this.selectedNonprofitId=void 0),this.selectedNonprofitId==null&&this.preselectNonprofitAtIndex!=null){const r=e.nonprofits[this.preselectNonprofitAtIndex-1];r&&(this.selectedNonprofitId=r.nonprofit.id,await this.selectionDataController.exec({selectedNonprofitId:r.nonprofit.id}))}return this.chain={...e?.chain},e},this.fetchSubscription=async()=>{v(["apiKey","subscriptionId"],this);const e=await z({baseUrl:this.baseUrl,headers:w(this.apiKey),requestBody:{remoteSubscriptionId:this.subscriptionId,email:this.email,partnerUserId:this.partnerUserId}});return e.nonprofit?.id&&this.selectedNonprofitId===void 0&&(this.selectedNonprofitId=e.nonprofit.id),e},this.updateNonprofitForSubscription=async({selectedNonprofitId:e})=>{v(["apiKey","subscriptionId"],this);const r=await _({baseUrl:this.baseUrl,headers:w(this.apiKey),requestBody:{remoteSubscriptionId:this.subscriptionId,nonprofitId:e,selectionMethod:R.subscriber_select_nonprofit_widget}});await this.updateComplete;const s=this.getNonprofitById(e);return this.dispatchEvent(new j({selectedNonprofitId:e,nonprofitName:s?.nonprofit?.name??null,source:k.subscriber_select_nonprofit,timestamp:new Date})),r},this.nonprofitListDataController=new C(this,this.getChainNonprofits),this.subscriptionDataController=new C(this,this.fetchSubscription),this.selectionDataController=new C(this,this.updateNonprofitForSubscription),this.makeHandleSelect=(e,r,s)=>async i=>{const n=this.selectedNonprofitId;if(i instanceof KeyboardEvent){let p=null;switch(i.key){case"ArrowUp":case"ArrowLeft":p=r===0?s[s.length-1]:s[r-1],i.preventDefault();break;case"ArrowRight":case"ArrowDown":p=r===s.length-1?s[0]:s[r+1],i.preventDefault();break;case"Enter":case" ":i.preventDefault();break;default:return}if(p){n!=null&&(this.selectedNonprofitId=p.nonprofit.id);const a=this.renderRoot.querySelector(`[data-value="${p.nonprofit.id}"]`);a!==null&&(a.tabIndex=0,a.focus());return}}!(i.currentTarget instanceof HTMLElement)||n===e||(this.selectedNonprofitId=e,await this.selectionDataController.exec({selectedNonprofitId:e}))}}get configLang(){return F[this.lang]||"en"}getNonprofitById(e){return e?this.nonprofitListDataController?.data?.nonprofits.find(r=>r.nonprofit.id===e):null}async connectedCallback(){super.connectedCallback(),this.nonprofitListDataController.loading=!0}async firstUpdated(){!this.apiKey||!this.email&&!this.partnerUserId||(this.subscriptionLookup=this.subscriptionDataController.exec(),await this.subscriptionLookup)}async updated(e){const r=["baseUrl","storeId","apiKey","countryCode","postalCode","lang"];for(const s of r)if(e.has(s)){await this.nonprofitListDataController.exec();break}}disconnectedCallback(){super.disconnectedCallback()}get cssVariables(){const e={"--beam-fontFamily":"inherit","--beam-fontStyle":"inherit","--beam-fontSize":"inherit","--beam-textColor":"inherit","--beam-backgroundColor":"inherit",...V,"--beam-SubscriberSelectNonprofit-title-textAlign":"inherit","--beam-SubscriberSelectNonprofit-description-textAlign":"inherit","--beam-SubscriberSelectNonprofit-maxWidth":"800px","--beam-SubscriberSelectNonprofit-options-marginTop":"0px","--beam-SubscriberSelectNonprofit-options-iconHeight":"20px","--beam-SubscriberSelectNonprofit-options-padding":"6px 4px","--beam-SubscriberSelectNonprofit-options-borderRadius":"4px","--beam-SubscriberSelectNonprofit-options-borderColor":"currentColor","--beam-SubscriberSelectNonprofit-options-borderWidth":"1px","--beam-SubscriberSelectNonprofit-options--selected-borderColor":"currentColor","--beam-SubscriberSelectNonprofit-options-backgroundColor":"transparent","--beam-SubscriberSelectNonprofit-options-gap":"8px","--beam-SubscriberSelectNonprofit-options-margin":"14px 0 0 0","--beam-SubscriberSelectNonprofit-width":"100%","--beam-SubscriberSelectNonprofit-options--selected-backgroundColor":"currentColor","--beam-SubscriberSelectNonprofit-details-marginTop":"6px","--beam-SubscriberSelectNonprofit-details-borderRadius":"4px","--beam-SubscriberSelectNonprofit-details-borderWidth":"1px","--beam-SubscriberSelectNonprofit-details-borderColor":"currentColor","--beam-SubscriberSelectNonprofit-details-backgroundColor":"inherit","--beam-SubscriberSelectNonprofit-details-padding":"10px",...g("--beam-SubscriberSelectNonprofit-title",{fontSize:"1em",fontWeight:"bold"}),...g("--beam-SubscriberSelectNonprofit-description",{marginTop:"1em",fontSize:".85em"}),"--beam-SubscriberSelectNonprofit-title-block-margin-right":"8px",...g("--beam-SubscriberSelectNonprofit-details-cause",{fontSize:"0.85em",fontWeight:"bold",textTransform:"uppercase"}),...g("--beam-SubscriberSelectNonprofit-details-beamAttribution",{fontSize:"0.85em"}),...g("--beam-SubscriberSelectNonprofit-details-impactDescription",{fontSize:".85em",marginTop:"10px",lineHeight:"normal"}),"--beam-SubscriberSelectNonprofit-details-nonprofitName-fontWeight":"bold","--beam-SubscriberSelectNonprofit-details-nonprofitName-fontStyle":"inherit","--beam-SubscriberSelectNonprofit-details-fundingProgress-marginTop":"10px",...g("--beam-SubscriberSelectNonprofit-details-fundingProgressLabel",{fontSize:"0.85em"})},r=this.nonprofitListDataController?.data?.config?.web?.theme||{},s={...e,...r};return Object.assign(Object.create({toCSS(){return W(this)}}),s)}render(){if(!this.apiKey||!this.email&&!this.partnerUserId)return N``;const{selectedNonprofitId:e}=this,{data:r,loading:s}=this.nonprofitListDataController;if(s&&!r)return K();if(this.nonprofitListDataController.error)return this.debug?D({error:this.nonprofitListDataController.error}):"";if(this.selectionDataController.error&&this.debug)return D({error:this.selectionDataController.error});const i=r?.nonprofits||[],n=i.find(a=>a.nonprofit.id===e)||null,p={custom:{...this.templateData},chain:{...this.chain},selectedNonprofit:{...n?.nonprofit},lang:this.configLang};return N`
2
2
  <style>
3
3
  :host {
4
4
  ${this.cssVariables.toCSS()}
@@ -2,7 +2,7 @@ import * as lit from 'lit';
2
2
  import { LitElement, PropertyValues } from 'lit';
3
3
  import * as lit_html from 'lit-html';
4
4
  import * as lodash from 'lodash';
5
- import { f as TUrl, b as TNumericId, c as TId, L as LANGUAGES } from '../chunks/utils-COGFpDER.esm.js';
5
+ import { f as TUrl, b as TNumericId, c as TId, L as LANGUAGES } from '../chunks/utils-BPcZ5h8J.esm.js';
6
6
  import 'lodash-es/debounce';
7
7
  import 'lodash-es/isEqual';
8
8
 
@@ -1,4 +1,4 @@
1
- import{a as w,i as $,b as p,n as l,r as _,g as C}from"../chunks/lit-BEag9MFp.esm.js";import{d as z,a as G}from"../chunks/lodash-CrMU6wKg.esm.js";import{a as Y}from"../chunks/share-button-5gfPmeEh.esm.js";import{s as S,a as K}from"../chunks/share-button-C4yPLL_t.esm.js";import"../chunks/_share-dialog-dependencies-BEUnzuWq.esm.js";import"../chunks/vendor-DUOg5fL-.esm.js";import{D as q,x as J,v as Q,l as X}from"../chunks/utils-C5hmbxa4.esm.js";import{u as b,g as Z,A as ee,e as u,f as ie,_ as ae,c as te,d as n}from"../chunks/index-Dm-K2MLY.esm.js";import{c as ne,a as re,d as oe,e as se}from"../chunks/css-card-grid-CiqEjkwR.esm.js";import{c as ce}from"../chunks/responsive-aN8P5PqD.esm.js";var pe=Object.defineProperty,le=(i,e,r,m)=>{for(var t=void 0,a=i.length-1,d;a>=0;a--)(d=i[a])&&(t=d(e,r,t)||t);return t&&pe(e,r,t),t};class A extends w{constructor(){super(...arguments),this.infoText=""}static get styles(){return $`
1
+ import{a as w,i as $,b as p,n as l,r as _,g as C}from"../chunks/lit-BEag9MFp.esm.js";import{d as z,a as G}from"../chunks/lodash-CrMU6wKg.esm.js";import{a as Y}from"../chunks/share-button-Cle5Uexn.esm.js";import{s as S,a as K}from"../chunks/share-button-C_qDR7Rw.esm.js";import"../chunks/_share-dialog-dependencies-BonvNllt.esm.js";import"../chunks/vendor-DUOg5fL-.esm.js";import{D as q,x as J,v as Q,l as X}from"../chunks/utils-C5hmbxa4.esm.js";import{u as b,g as Z,A as ee,e as u,f as ie,_ as ae,c as te,d as n}from"../chunks/index-BpR0FMss.esm.js";import{c as ne,a as re,d as oe,e as se}from"../chunks/css-card-grid-CiqEjkwR.esm.js";import{c as ce}from"../chunks/responsive-aN8P5PqD.esm.js";var pe=Object.defineProperty,le=(i,e,r,m)=>{for(var t=void 0,a=i.length-1,d;a>=0;a--)(d=i[a])&&(t=d(e,r,t)||t);return t&&pe(e,r,t),t};class A extends w{constructor(){super(...arguments),this.infoText=""}static get styles(){return $`
2
2
  sl-badge::part(base) {
3
3
  background-color: var(--beam-pillLabel-color-background, #000);
4
4
  color: var(--beam-pillLabel-color, #fff);
@@ -1,4 +1,4 @@
1
- import{a as w,i as $,b as p,n as l,r as _,g as C}from"../chunks/lit-BEag9MFp.esm.js";import{d as z,a as G}from"../chunks/lodash-CrMU6wKg.esm.js";import{a as Y}from"../chunks/share-button-5gfPmeEh.esm.js";import{s as S,a as K}from"../chunks/share-button-C4yPLL_t.esm.js";import"../chunks/_share-dialog-dependencies-BEUnzuWq.esm.js";import"../chunks/vendor-DUOg5fL-.esm.js";import{D as q,x as J,v as Q,l as X}from"../chunks/utils-C5hmbxa4.esm.js";import{u as b,g as Z,A as ee,e as u,f as ie,_ as ae,c as te,d as n}from"../chunks/index-Dm-K2MLY.esm.js";import{c as ne,a as re,d as oe,e as se}from"../chunks/css-card-grid-CiqEjkwR.esm.js";import{c as ce}from"../chunks/responsive-aN8P5PqD.esm.js";var pe=Object.defineProperty,le=(i,e,r,m)=>{for(var t=void 0,a=i.length-1,d;a>=0;a--)(d=i[a])&&(t=d(e,r,t)||t);return t&&pe(e,r,t),t};class A extends w{constructor(){super(...arguments),this.infoText=""}static get styles(){return $`
1
+ import{a as w,i as $,b as p,n as l,r as _,g as C}from"../chunks/lit-BEag9MFp.esm.js";import{d as z,a as G}from"../chunks/lodash-CrMU6wKg.esm.js";import{a as Y}from"../chunks/share-button-Cle5Uexn.esm.js";import{s as S,a as K}from"../chunks/share-button-C_qDR7Rw.esm.js";import"../chunks/_share-dialog-dependencies-BonvNllt.esm.js";import"../chunks/vendor-DUOg5fL-.esm.js";import{D as q,x as J,v as Q,l as X}from"../chunks/utils-C5hmbxa4.esm.js";import{u as b,g as Z,A as ee,e as u,f as ie,_ as ae,c as te,d as n}from"../chunks/index-BpR0FMss.esm.js";import{c as ne,a as re,d as oe,e as se}from"../chunks/css-card-grid-CiqEjkwR.esm.js";import{c as ce}from"../chunks/responsive-aN8P5PqD.esm.js";var pe=Object.defineProperty,le=(i,e,r,m)=>{for(var t=void 0,a=i.length-1,d;a>=0;a--)(d=i[a])&&(t=d(e,r,t)||t);return t&&pe(e,r,t),t};class A extends w{constructor(){super(...arguments),this.infoText=""}static get styles(){return $`
2
2
  sl-badge::part(base) {
3
3
  background-color: var(--beam-pillLabel-color-background, #000);
4
4
  color: var(--beam-pillLabel-color, #fff);
@@ -2,7 +2,7 @@ import * as lit_html from 'lit-html';
2
2
  import * as lit from 'lit';
3
3
  import { LitElement } from 'lit';
4
4
  import { g as getChainNonprofits, a as getImpact } from '../chunks/routes-D6Gtw6kZ.esm.js';
5
- import { b as TNumericId, L as LANGUAGES, d as TCart } from '../chunks/utils-COGFpDER.esm.js';
5
+ import { b as TNumericId, L as LANGUAGES, d as TCart } from '../chunks/utils-BPcZ5h8J.esm.js';
6
6
  import './select-subscription-nonprofit.js';
7
7
  import './subscription-impact.js';
8
8
  import 'lodash-es/debounce';
@@ -1,4 +1,4 @@
1
- import{i as z,n as r,r as d,a as H,b as o,h as E}from"../chunks/lit-BEag9MFp.esm.js";import{D as R,v as j,P as K,W as B,x as y,B as N}from"../chunks/utils-C5hmbxa4.esm.js";import{a as _}from"../chunks/share-button-5gfPmeEh.esm.js";import{c as F,a as O,d as V,e as S}from"../chunks/css-card-grid-CiqEjkwR.esm.js";import{u as l,A as x,h as Y,j as G,g as q,e as c,f as J,d as p,_ as D,c as v}from"../chunks/index-Dm-K2MLY.esm.js";import"./select-subscription-nonprofit.esm.js";import"./subscription-impact.esm.js";import{partnerLogosConfigDefaults as Q}from"./beam-partner-logos.esm.js";import"../chunks/lodash-CrMU6wKg.esm.js";import"../chunks/share-button-C4yPLL_t.esm.js";import"../chunks/vendor-DUOg5fL-.esm.js";import"../chunks/_share-dialog-dependencies-BEUnzuWq.esm.js";import"../chunks/responsive-aN8P5PqD.esm.js";const g={en:{changeNonprofitButton:()=>"Change Nonprofit",previousImpactHeader:()=>"Your Previous Impact",previousNonprofitButton:()=>"Back to Previous Nonprofit",supportAgainButton:()=>"Support Again",via:()=>"via",showAllButton:()=>"Show All",showLessButton:()=>"Show Less"},fr:{changeNonprofitButton:()=>"Change Nonprofit",previousImpactHeader:()=>"Your Previous Impact",previousNonprofitButton:()=>"Back to Previous Nonprofit",supportAgainButton:()=>"Support Again",via:()=>"via",showAllButton:()=>"Show All",showLessButton:()=>"Show Less"},de:{changeNonprofitButton:()=>"Change Nonprofit",previousImpactHeader:()=>"Your Previous Impact",previousNonprofitButton:()=>"Back to Previous Nonprofit",supportAgainButton:()=>"Support Again",via:()=>"via",showAllButton:()=>"Show All",showLessButton:()=>"Show Less"},es:{changeNonprofitButton:()=>"Change Nonprofit",previousImpactHeader:()=>"Your Previous Impact",previousNonprofitButton:()=>"Back to Previous Nonprofit",supportAgainButton:()=>"Support Again",via:()=>"via",showAllButton:()=>"Show All",showLessButton:()=>"Show Less"},it:{changeNonprofitButton:()=>"Change Nonprofit",previousImpactHeader:()=>"Your Previous Impact",previousNonprofitButton:()=>"Back to Previous Nonprofit",supportAgainButton:()=>"Support Again",via:()=>"via",showAllButton:()=>"Show All",showLessButton:()=>"Show Less"},pl:{changeNonprofitButton:()=>"Change Nonprofit",previousImpactHeader:()=>"Your Previous Impact",previousNonprofitButton:()=>"Back to Previous Nonprofit",supportAgainButton:()=>"Support Again",via:()=>"via",showAllButton:()=>"Show All",showLessButton:()=>"Show Less"},ja:{changeNonprofitButton:()=>"Change Nonprofit",previousImpactHeader:()=>"Your Previous Impact",previousNonprofitButton:()=>"Back to Previous Nonprofit",supportAgainButton:()=>"Support Again",via:()=>"via",showAllButton:()=>"Show All",showLessButton:()=>"Show Less"}};var X=Object.defineProperty,i=(M,t,n,s)=>{for(var a=void 0,b=M.length-1,u;b>=0;b--)(u=M[b])&&(a=u(t,n,a)||a);return a&&X(t,n,a),a};const $=3,Z=0,tt=1,et=98;class e extends H{constructor(){super(...arguments),this.baseUrl=R,this.lang="en",this.debug=!1,this.draftConfig=!1,this.activeWidget=null,this.nonprofitId=null,this.beamUserId=null,this.eligibleNonprofits=[],this.showAllTiles=!1,this.isMobile=window.innerWidth<720,this.dropdownVisible=!1,this.emojis=["\u{1F44F}","\u{1F4AA}","\u{1F64C}","\u2728","\u{1F947}"],this.subscriptionDataController=new x(this,this.fetchSubscription),this.eligibleNonprofitsDataController=new x(this,this.fetchEligibleNonprofits),this.personalImpactDataController=new x(this,this.fetchImpact)}get configLang(){return j[this.lang]||"en"}async firstUpdated(){if(!this.email&&!this.partnerUserId)throw new K(["email","partnerUserId"],"One of the following properties needs to be specified: email, partnerUserId ");S(["apiKey","subscriptionId"],this),await this.loadWidget()}async loadWidget(){await Promise.all([this.fetchEligibleNonprofits(),this.fetchSubscription()]),await this.fetchImpact(),this.activeWidget=this.nonprofitId?"subscription-impact":"select-subscription-nonprofit"}async fetchEligibleNonprofits(){S(["apiKey","subscriptionId"],this);const t=await Y({baseUrl:this.baseUrl,headers:y(this.apiKey),requestBody:{storeId:this.storeId||void 0,postalCode:this.postalCode||void 0,countryCode:this.countryCode||void 0,widgetName:B.subscription_management,version:"1.0.0"}});return this.storeId=t.store.id,this.eligibleNonprofits=t.nonprofits,this.eligibleNonprofitsDataController.data=t,t}async fetchSubscription(){S(["apiKey","subscriptionId"],this);const t=await G({baseUrl:this.baseUrl,headers:y(this.apiKey),requestBody:{remoteSubscriptionId:this.subscriptionId,email:this.email,partnerUserId:this.partnerUserId}});return this.beamUserId=t.beamUserId,this.nonprofitId=t.nonprofit?.id||null,t}async fetchImpact(){S(["apiKey"],this);const t=await q({baseUrl:this.baseUrl,headers:y(this.apiKey),queryParams:{beamUserId:this.beamUserId?this.beamUserId:void 0,widgetName:"subscription-management",version:"1.0.0",lang:this.configLang}});return this.personalImpactDataController.data=t,t}getDisplayablePreviousImpacts(){const t=this.personalImpactDataController.data?.personal;return!t||t?.length<1?[]:t.filter(n=>!(!n.nonprofit.includeInPersonalImpact||n.nonprofit.id===this.nonprofitId&&(!n.impact.goalCompletionText||n.impact.goalCompletionText?.length<1)))}handleSwapNonprofitButtonClick(){this.activeWidget="select-subscription-nonprofit"}handleBackToSubscriptionImpactButtonClick(){this.activeWidget="subscription-impact"}handleSupportAgainButtonClick(t,n){this.activeWidget="select-subscription-nonprofit",this.selectedNonprofitId=t;const s=new N({selectedNonprofitId:t,nonprofitName:n,source:B.subscription_management,timestamp:new Date});this.dispatchEvent(s)}handleNonprofitSelect(t){if(!(t instanceof N))return;const{selectedNonprofitId:n}=t.detail;this.nonprofitId=n??null,this.activeWidget="subscription-impact"}isNonprofitEligible(t){return this.eligibleNonprofits.some(n=>n.nonprofit.id===t)}shouldDisplayProgressBar(t){return t>tt&&t<et}get cssVariables(){const t={...Q,..._,"--beam-fontFamily":"inherit","--beam-fontStyle":"inherit","--beam-fontSize":"inherit","--beam-textColor":"inherit","--beam-backgroundColor":"inherit","--beam-SubscriptionManagement-widgetContainer-borderColor":"#d5d5d5","--beam-SubscriptionManagement-widgetContainer-borderRadius":"4px","--beam-SubscriptionManagement-widgetContainer-padding":"8px 20px","--beam-SubscriptionManagement-widgetContainer-backgroundColor":"inherit","--beam-SubscriptionManagement-widgetContainer-maxWidth":"820px","--beam-SubscriptionManagement-logo-align-desktop":"left","--beam-SubscriptionManagement-logo-align-mobile":"center","--beam-SubscriptionManagement-previousImpact-cardStyle":"'selected_icon'","--beam-SubscriptionManagement-header-padding":"10px 20px 10px 0px","--beam-SubscriptionManagement-header-borderRadius":"0px","--beam-SubscriptionManagement-header-backgroundColor":"#fff","--beam-SubscriptionManagement-header-meatballsMenu-fontSize":"24px","--beam-SubscriptionManagement-header-meatballsMenu-color":"24px","--beam-SubscriptionManagement-lineBreak-color":"#ddd","--beam-SubscriptionManagement-lineBreak-width":"1px","--beam-SubscriptionManagement-lineBreak-margin":"10px 0 20px 0","--beam-SubscriptionManagement-tile-marginBottom":"20px","--beam-SubscriptionManagement-tile-border-width":"0px","--beam-SubscriptionManagement-tile-border-color":"#ddd","--beam-SubscriptionManagement-tile-padding":"12.5px","--beam-SubscriptionManagement-tile-borderRadius":"8px","--beam-SubscriptionManagement-tile-background":"#f8fbfb","--beam-SubscriptionManagement-tileContent-gap":" 15px","--beam-SubscriptionManagement-tileContent-padding":"5px 0px","--beam-SubscriptionManagement-tile-icon-borderRadius":"4px","--beam-SubscriptionManagement-tile-icon-height":"28px","--beam-SubscriptionManagement-tile-icon-background-borderRadius":"50%","--beam-SubscriptionManagement-tile-icon-background-width":"50px","--beam-SubscriptionManagement-tile-icon-background-height":"50px","--beam-SubscriptionManagement-tile-icon-background-backgroundColor":"#0a323c","--beam-SubscriptionManagement-tile-icon-background-padding":"10px","--beam-SubscriptionManagement-blockTileDescription-gap":"5px","--beam-SubscriptionManagement-blockTileDescription-padding":"0px","--beam-SubscriptionManagement-blockTileDescription-lineHeight":"130%","--beam-SubscriptionManagement-blockTileDescription-progressBar-width-desktop":"60%","--beam-SubscriptionManagement-blockTileDescription-progressBar-width-mobile":"100%","--beam-SubscriptionManagement-subWidgetContainer-padding":"0px 0px 10px","--beam-SubscriptionManagement-previousImpactContainer-padding-desktop":"10px 24px 10px 0px","--beam-SubscriptionManagement-previousImpactContainer-padding-mobile":"0px","--beam-SubscriptionManagement-dropDown-padding":"15px 8px","--beam-SubscriptionManagement-dropDown-borderRadius":"8px","--beam-SubscriptionManagement-dropDown-backgroundColor":"#f8fbfb","--beam-SubscriptionManagement-dropDown-boxShadow":"0px 4px 28px 0px rgba(0, 0, 0, 0.04)","--beam-SubscriptionManagement-dropDown-width":"128px","--beam-SubscriptionManagement-dropDown-hover-backgroundColor":"#E1F1EE","--beam-SubscriptionManagement-dropDownOptions-textDecoration":"underline",...c("--beam-SubscriptionManagement-dropDownOptions",{fontSize:"12px",fontWeight:"400",textTransform:"capitalize",fontStyle:"normal",color:"#0a323c"}),"--beam-SubscriptionManagement-yourPreviousImpactTitle-marginBottom":"15px",...c("--beam-SubscriptionManagement-yourPreviousImpactTitle",{fontSize:"18px",fontWeight:"bold",lineHeight:"120%",textTransform:"capitalize",fontStyle:"normal",color:"#0a323c"}),"--beam-SubscriptionManagement-yourPreviousImpact-showAllButton-textDecoration":"underline",...c("--beam-SubscriptionManagement-yourPreviousImpact-showAllButton",{fontSize:"12px",fontWeight:"bold",lineHeight:"120%",textTransform:"capitalize",fontStyle:"normal",color:"#0a323c"}),"--beam-SubscriptionManagement-tile-title-letterSpacing":"0.36px",...c("--beam-SubscriptionManagement-tile-title",{fontSize:"12px",fontWeight:"bold",lineHeight:"120%",textTransform:"uppercase",fontStyle:"normal",color:"#0a323c"}),...c("--beam-SubscriptionManagement-tile-description",{fontSize:"14px",lineHeight:"120%",fontStyle:"normal",color:"#454a47"}),...c("--beam-SubscriptionManagement-tile-via",{fontSize:"14px",lineHeight:"120%",fontStyle:"normal",color:"#454a47"}),"--beam-SubscriptionManagement-tile-nonprofitLink-textDecoration":"underline",...c("--beam-SubscriptionManagement-tile-nonprofitLink",{fontSize:"14px",fontWeight:"400",lineHeight:"120%",textTransform:"capitalize",fontStyle:"normal",color:"#0a323c"}),"--beam-SubscriptionManagement-tile-supportAgainButton-textDecoration":"underline",...c("--beam-SubscriptionManagement-tile-supportAgainButton",{fontSize:"14px",fontWeight:"400",lineHeight:"120%",textTransform:"capitalize",fontStyle:"normal",color:"#0a323c"}),"--beam-SubscriptionManagement-tile-progressBarLabel-marginLeft":"8px",...c("--beam-SubscriptionManagement-tile-progressBarLabel",{fontSize:"10px",fontWeight:"bold",fontStyle:"normal",color:"#878a92"}),"--beam-SubscriptionManagement-tile-fundedAmount-lineHeight":"16px",...c("--beam-SubscriptionManagement-tile-fundedAmount",{fontSize:"14px",fontWeight:"400",lineHeight:"120%",fontStyle:"italic",color:"#0a323c"})},n=this.eligibleNonprofitsDataController?.data?.config?.web?.theme||{},s={...t,...n};return Object.assign(Object.create({toCSS(){return J(this)}}),s)}renderPreviousImpactTiles({personalImpact:t,cardStyle:n,eligibleNonprofitConfig:s}){if(!t)return o``;if(!s)return o``;const a=this.showAllTiles?t:t.slice(0,$);let b=0;return o`
1
+ import{i as z,n as r,r as d,a as H,b as o,h as E}from"../chunks/lit-BEag9MFp.esm.js";import{D as R,v as j,P as K,W as B,x as y,B as N}from"../chunks/utils-C5hmbxa4.esm.js";import{a as _}from"../chunks/share-button-Cle5Uexn.esm.js";import{c as F,a as O,d as V,e as S}from"../chunks/css-card-grid-CiqEjkwR.esm.js";import{u as l,A as x,h as Y,j as G,g as q,e as c,f as J,d as p,_ as D,c as v}from"../chunks/index-BpR0FMss.esm.js";import"./select-subscription-nonprofit.esm.js";import"./subscription-impact.esm.js";import{partnerLogosConfigDefaults as Q}from"./beam-partner-logos.esm.js";import"../chunks/lodash-CrMU6wKg.esm.js";import"../chunks/share-button-C_qDR7Rw.esm.js";import"../chunks/vendor-DUOg5fL-.esm.js";import"../chunks/_share-dialog-dependencies-BonvNllt.esm.js";import"../chunks/responsive-aN8P5PqD.esm.js";const g={en:{changeNonprofitButton:()=>"Change Nonprofit",previousImpactHeader:()=>"Your Previous Impact",previousNonprofitButton:()=>"Back to Previous Nonprofit",supportAgainButton:()=>"Support Again",via:()=>"via",showAllButton:()=>"Show All",showLessButton:()=>"Show Less"},fr:{changeNonprofitButton:()=>"Change Nonprofit",previousImpactHeader:()=>"Your Previous Impact",previousNonprofitButton:()=>"Back to Previous Nonprofit",supportAgainButton:()=>"Support Again",via:()=>"via",showAllButton:()=>"Show All",showLessButton:()=>"Show Less"},de:{changeNonprofitButton:()=>"Change Nonprofit",previousImpactHeader:()=>"Your Previous Impact",previousNonprofitButton:()=>"Back to Previous Nonprofit",supportAgainButton:()=>"Support Again",via:()=>"via",showAllButton:()=>"Show All",showLessButton:()=>"Show Less"},es:{changeNonprofitButton:()=>"Change Nonprofit",previousImpactHeader:()=>"Your Previous Impact",previousNonprofitButton:()=>"Back to Previous Nonprofit",supportAgainButton:()=>"Support Again",via:()=>"via",showAllButton:()=>"Show All",showLessButton:()=>"Show Less"},it:{changeNonprofitButton:()=>"Change Nonprofit",previousImpactHeader:()=>"Your Previous Impact",previousNonprofitButton:()=>"Back to Previous Nonprofit",supportAgainButton:()=>"Support Again",via:()=>"via",showAllButton:()=>"Show All",showLessButton:()=>"Show Less"},pl:{changeNonprofitButton:()=>"Change Nonprofit",previousImpactHeader:()=>"Your Previous Impact",previousNonprofitButton:()=>"Back to Previous Nonprofit",supportAgainButton:()=>"Support Again",via:()=>"via",showAllButton:()=>"Show All",showLessButton:()=>"Show Less"},ja:{changeNonprofitButton:()=>"Change Nonprofit",previousImpactHeader:()=>"Your Previous Impact",previousNonprofitButton:()=>"Back to Previous Nonprofit",supportAgainButton:()=>"Support Again",via:()=>"via",showAllButton:()=>"Show All",showLessButton:()=>"Show Less"}};var X=Object.defineProperty,i=(M,t,n,s)=>{for(var a=void 0,b=M.length-1,u;b>=0;b--)(u=M[b])&&(a=u(t,n,a)||a);return a&&X(t,n,a),a};const $=3,Z=0,tt=1,et=98;class e extends H{constructor(){super(...arguments),this.baseUrl=R,this.lang="en",this.debug=!1,this.draftConfig=!1,this.activeWidget=null,this.nonprofitId=null,this.beamUserId=null,this.eligibleNonprofits=[],this.showAllTiles=!1,this.isMobile=window.innerWidth<720,this.dropdownVisible=!1,this.emojis=["\u{1F44F}","\u{1F4AA}","\u{1F64C}","\u2728","\u{1F947}"],this.subscriptionDataController=new x(this,this.fetchSubscription),this.eligibleNonprofitsDataController=new x(this,this.fetchEligibleNonprofits),this.personalImpactDataController=new x(this,this.fetchImpact)}get configLang(){return j[this.lang]||"en"}async firstUpdated(){if(!this.email&&!this.partnerUserId)throw new K(["email","partnerUserId"],"One of the following properties needs to be specified: email, partnerUserId ");S(["apiKey","subscriptionId"],this),await this.loadWidget()}async loadWidget(){await Promise.all([this.fetchEligibleNonprofits(),this.fetchSubscription()]),await this.fetchImpact(),this.activeWidget=this.nonprofitId?"subscription-impact":"select-subscription-nonprofit"}async fetchEligibleNonprofits(){S(["apiKey","subscriptionId"],this);const t=await Y({baseUrl:this.baseUrl,headers:y(this.apiKey),requestBody:{storeId:this.storeId||void 0,postalCode:this.postalCode||void 0,countryCode:this.countryCode||void 0,widgetName:B.subscription_management,version:"1.0.0"}});return this.storeId=t.store.id,this.eligibleNonprofits=t.nonprofits,this.eligibleNonprofitsDataController.data=t,t}async fetchSubscription(){S(["apiKey","subscriptionId"],this);const t=await G({baseUrl:this.baseUrl,headers:y(this.apiKey),requestBody:{remoteSubscriptionId:this.subscriptionId,email:this.email,partnerUserId:this.partnerUserId}});return this.beamUserId=t.beamUserId,this.nonprofitId=t.nonprofit?.id||null,t}async fetchImpact(){S(["apiKey"],this);const t=await q({baseUrl:this.baseUrl,headers:y(this.apiKey),queryParams:{beamUserId:this.beamUserId?this.beamUserId:void 0,widgetName:"subscription-management",version:"1.0.0",lang:this.configLang}});return this.personalImpactDataController.data=t,t}getDisplayablePreviousImpacts(){const t=this.personalImpactDataController.data?.personal;return!t||t?.length<1?[]:t.filter(n=>!(!n.nonprofit.includeInPersonalImpact||n.nonprofit.id===this.nonprofitId&&(!n.impact.goalCompletionText||n.impact.goalCompletionText?.length<1)))}handleSwapNonprofitButtonClick(){this.activeWidget="select-subscription-nonprofit"}handleBackToSubscriptionImpactButtonClick(){this.activeWidget="subscription-impact"}handleSupportAgainButtonClick(t,n){this.activeWidget="select-subscription-nonprofit",this.selectedNonprofitId=t;const s=new N({selectedNonprofitId:t,nonprofitName:n,source:B.subscription_management,timestamp:new Date});this.dispatchEvent(s)}handleNonprofitSelect(t){if(!(t instanceof N))return;const{selectedNonprofitId:n}=t.detail;this.nonprofitId=n??null,this.activeWidget="subscription-impact"}isNonprofitEligible(t){return this.eligibleNonprofits.some(n=>n.nonprofit.id===t)}shouldDisplayProgressBar(t){return t>tt&&t<et}get cssVariables(){const t={...Q,..._,"--beam-fontFamily":"inherit","--beam-fontStyle":"inherit","--beam-fontSize":"inherit","--beam-textColor":"inherit","--beam-backgroundColor":"inherit","--beam-SubscriptionManagement-widgetContainer-borderColor":"#d5d5d5","--beam-SubscriptionManagement-widgetContainer-borderRadius":"4px","--beam-SubscriptionManagement-widgetContainer-padding":"8px 20px","--beam-SubscriptionManagement-widgetContainer-backgroundColor":"inherit","--beam-SubscriptionManagement-widgetContainer-maxWidth":"820px","--beam-SubscriptionManagement-logo-align-desktop":"left","--beam-SubscriptionManagement-logo-align-mobile":"center","--beam-SubscriptionManagement-previousImpact-cardStyle":"'selected_icon'","--beam-SubscriptionManagement-header-padding":"10px 20px 10px 0px","--beam-SubscriptionManagement-header-borderRadius":"0px","--beam-SubscriptionManagement-header-backgroundColor":"#fff","--beam-SubscriptionManagement-header-meatballsMenu-fontSize":"24px","--beam-SubscriptionManagement-header-meatballsMenu-color":"24px","--beam-SubscriptionManagement-lineBreak-color":"#ddd","--beam-SubscriptionManagement-lineBreak-width":"1px","--beam-SubscriptionManagement-lineBreak-margin":"10px 0 20px 0","--beam-SubscriptionManagement-tile-marginBottom":"20px","--beam-SubscriptionManagement-tile-border-width":"0px","--beam-SubscriptionManagement-tile-border-color":"#ddd","--beam-SubscriptionManagement-tile-padding":"12.5px","--beam-SubscriptionManagement-tile-borderRadius":"8px","--beam-SubscriptionManagement-tile-background":"#f8fbfb","--beam-SubscriptionManagement-tileContent-gap":" 15px","--beam-SubscriptionManagement-tileContent-padding":"5px 0px","--beam-SubscriptionManagement-tile-icon-borderRadius":"4px","--beam-SubscriptionManagement-tile-icon-height":"28px","--beam-SubscriptionManagement-tile-icon-background-borderRadius":"50%","--beam-SubscriptionManagement-tile-icon-background-width":"50px","--beam-SubscriptionManagement-tile-icon-background-height":"50px","--beam-SubscriptionManagement-tile-icon-background-backgroundColor":"#0a323c","--beam-SubscriptionManagement-tile-icon-background-padding":"10px","--beam-SubscriptionManagement-blockTileDescription-gap":"5px","--beam-SubscriptionManagement-blockTileDescription-padding":"0px","--beam-SubscriptionManagement-blockTileDescription-lineHeight":"130%","--beam-SubscriptionManagement-blockTileDescription-progressBar-width-desktop":"60%","--beam-SubscriptionManagement-blockTileDescription-progressBar-width-mobile":"100%","--beam-SubscriptionManagement-subWidgetContainer-padding":"0px 0px 10px","--beam-SubscriptionManagement-previousImpactContainer-padding-desktop":"10px 24px 10px 0px","--beam-SubscriptionManagement-previousImpactContainer-padding-mobile":"0px","--beam-SubscriptionManagement-dropDown-padding":"15px 8px","--beam-SubscriptionManagement-dropDown-borderRadius":"8px","--beam-SubscriptionManagement-dropDown-backgroundColor":"#f8fbfb","--beam-SubscriptionManagement-dropDown-boxShadow":"0px 4px 28px 0px rgba(0, 0, 0, 0.04)","--beam-SubscriptionManagement-dropDown-width":"128px","--beam-SubscriptionManagement-dropDown-hover-backgroundColor":"#E1F1EE","--beam-SubscriptionManagement-dropDownOptions-textDecoration":"underline",...c("--beam-SubscriptionManagement-dropDownOptions",{fontSize:"12px",fontWeight:"400",textTransform:"capitalize",fontStyle:"normal",color:"#0a323c"}),"--beam-SubscriptionManagement-yourPreviousImpactTitle-marginBottom":"15px",...c("--beam-SubscriptionManagement-yourPreviousImpactTitle",{fontSize:"18px",fontWeight:"bold",lineHeight:"120%",textTransform:"capitalize",fontStyle:"normal",color:"#0a323c"}),"--beam-SubscriptionManagement-yourPreviousImpact-showAllButton-textDecoration":"underline",...c("--beam-SubscriptionManagement-yourPreviousImpact-showAllButton",{fontSize:"12px",fontWeight:"bold",lineHeight:"120%",textTransform:"capitalize",fontStyle:"normal",color:"#0a323c"}),"--beam-SubscriptionManagement-tile-title-letterSpacing":"0.36px",...c("--beam-SubscriptionManagement-tile-title",{fontSize:"12px",fontWeight:"bold",lineHeight:"120%",textTransform:"uppercase",fontStyle:"normal",color:"#0a323c"}),...c("--beam-SubscriptionManagement-tile-description",{fontSize:"14px",lineHeight:"120%",fontStyle:"normal",color:"#454a47"}),...c("--beam-SubscriptionManagement-tile-via",{fontSize:"14px",lineHeight:"120%",fontStyle:"normal",color:"#454a47"}),"--beam-SubscriptionManagement-tile-nonprofitLink-textDecoration":"underline",...c("--beam-SubscriptionManagement-tile-nonprofitLink",{fontSize:"14px",fontWeight:"400",lineHeight:"120%",textTransform:"capitalize",fontStyle:"normal",color:"#0a323c"}),"--beam-SubscriptionManagement-tile-supportAgainButton-textDecoration":"underline",...c("--beam-SubscriptionManagement-tile-supportAgainButton",{fontSize:"14px",fontWeight:"400",lineHeight:"120%",textTransform:"capitalize",fontStyle:"normal",color:"#0a323c"}),"--beam-SubscriptionManagement-tile-progressBarLabel-marginLeft":"8px",...c("--beam-SubscriptionManagement-tile-progressBarLabel",{fontSize:"10px",fontWeight:"bold",fontStyle:"normal",color:"#878a92"}),"--beam-SubscriptionManagement-tile-fundedAmount-lineHeight":"16px",...c("--beam-SubscriptionManagement-tile-fundedAmount",{fontSize:"14px",fontWeight:"400",lineHeight:"120%",fontStyle:"italic",color:"#0a323c"})},n=this.eligibleNonprofitsDataController?.data?.config?.web?.theme||{},s={...t,...n};return Object.assign(Object.create({toCSS(){return J(this)}}),s)}renderPreviousImpactTiles({personalImpact:t,cardStyle:n,eligibleNonprofitConfig:s}){if(!t)return o``;if(!s)return o``;const a=this.showAllTiles?t:t.slice(0,$);let b=0;return o`
2
2
  ${a.map(u=>{const{impact:{goalCompletionText:m,description:h,goalProgressPercentage:f,goalProgressText:A},nonprofit:{cause:C,causeIconSelectedUrl:L,causeIconUrl:T,website:P,name:I,id:w}}=u,k=this.nonprofitId!==w&&this.isNonprofitEligible(w),U=k&&this.shouldDisplayProgressBar(f),W=m?`${this.emojis[b]} `:"";return b=(b+1)%this.emojis.length,o`
3
3
  <div class="tile">
4
4
  <div class="tile-header">
@@ -1,4 +1,4 @@
1
- import{i as z,n as r,r as d,a as H,b as o,h as E}from"../chunks/lit-BEag9MFp.esm.js";import{D as R,v as j,P as K,W as B,x as y,B as N}from"../chunks/utils-C5hmbxa4.esm.js";import{a as _}from"../chunks/share-button-5gfPmeEh.esm.js";import{c as F,a as O,d as V,e as S}from"../chunks/css-card-grid-CiqEjkwR.esm.js";import{u as l,A as x,h as Y,j as G,g as q,e as c,f as J,d as p,_ as D,c as v}from"../chunks/index-Dm-K2MLY.esm.js";import"./select-subscription-nonprofit.js";import"./subscription-impact.js";import{partnerLogosConfigDefaults as Q}from"./beam-partner-logos.js";import"../chunks/lodash-CrMU6wKg.esm.js";import"../chunks/share-button-C4yPLL_t.esm.js";import"../chunks/vendor-DUOg5fL-.esm.js";import"../chunks/_share-dialog-dependencies-BEUnzuWq.esm.js";import"../chunks/responsive-aN8P5PqD.esm.js";const g={en:{changeNonprofitButton:()=>"Change Nonprofit",previousImpactHeader:()=>"Your Previous Impact",previousNonprofitButton:()=>"Back to Previous Nonprofit",supportAgainButton:()=>"Support Again",via:()=>"via",showAllButton:()=>"Show All",showLessButton:()=>"Show Less"},fr:{changeNonprofitButton:()=>"Change Nonprofit",previousImpactHeader:()=>"Your Previous Impact",previousNonprofitButton:()=>"Back to Previous Nonprofit",supportAgainButton:()=>"Support Again",via:()=>"via",showAllButton:()=>"Show All",showLessButton:()=>"Show Less"},de:{changeNonprofitButton:()=>"Change Nonprofit",previousImpactHeader:()=>"Your Previous Impact",previousNonprofitButton:()=>"Back to Previous Nonprofit",supportAgainButton:()=>"Support Again",via:()=>"via",showAllButton:()=>"Show All",showLessButton:()=>"Show Less"},es:{changeNonprofitButton:()=>"Change Nonprofit",previousImpactHeader:()=>"Your Previous Impact",previousNonprofitButton:()=>"Back to Previous Nonprofit",supportAgainButton:()=>"Support Again",via:()=>"via",showAllButton:()=>"Show All",showLessButton:()=>"Show Less"},it:{changeNonprofitButton:()=>"Change Nonprofit",previousImpactHeader:()=>"Your Previous Impact",previousNonprofitButton:()=>"Back to Previous Nonprofit",supportAgainButton:()=>"Support Again",via:()=>"via",showAllButton:()=>"Show All",showLessButton:()=>"Show Less"},pl:{changeNonprofitButton:()=>"Change Nonprofit",previousImpactHeader:()=>"Your Previous Impact",previousNonprofitButton:()=>"Back to Previous Nonprofit",supportAgainButton:()=>"Support Again",via:()=>"via",showAllButton:()=>"Show All",showLessButton:()=>"Show Less"},ja:{changeNonprofitButton:()=>"Change Nonprofit",previousImpactHeader:()=>"Your Previous Impact",previousNonprofitButton:()=>"Back to Previous Nonprofit",supportAgainButton:()=>"Support Again",via:()=>"via",showAllButton:()=>"Show All",showLessButton:()=>"Show Less"}};var X=Object.defineProperty,i=(M,t,n,s)=>{for(var a=void 0,b=M.length-1,u;b>=0;b--)(u=M[b])&&(a=u(t,n,a)||a);return a&&X(t,n,a),a};const $=3,Z=0,tt=1,et=98;class e extends H{constructor(){super(...arguments),this.baseUrl=R,this.lang="en",this.debug=!1,this.draftConfig=!1,this.activeWidget=null,this.nonprofitId=null,this.beamUserId=null,this.eligibleNonprofits=[],this.showAllTiles=!1,this.isMobile=window.innerWidth<720,this.dropdownVisible=!1,this.emojis=["\u{1F44F}","\u{1F4AA}","\u{1F64C}","\u2728","\u{1F947}"],this.subscriptionDataController=new x(this,this.fetchSubscription),this.eligibleNonprofitsDataController=new x(this,this.fetchEligibleNonprofits),this.personalImpactDataController=new x(this,this.fetchImpact)}get configLang(){return j[this.lang]||"en"}async firstUpdated(){if(!this.email&&!this.partnerUserId)throw new K(["email","partnerUserId"],"One of the following properties needs to be specified: email, partnerUserId ");S(["apiKey","subscriptionId"],this),await this.loadWidget()}async loadWidget(){await Promise.all([this.fetchEligibleNonprofits(),this.fetchSubscription()]),await this.fetchImpact(),this.activeWidget=this.nonprofitId?"subscription-impact":"select-subscription-nonprofit"}async fetchEligibleNonprofits(){S(["apiKey","subscriptionId"],this);const t=await Y({baseUrl:this.baseUrl,headers:y(this.apiKey),requestBody:{storeId:this.storeId||void 0,postalCode:this.postalCode||void 0,countryCode:this.countryCode||void 0,widgetName:B.subscription_management,version:"1.0.0"}});return this.storeId=t.store.id,this.eligibleNonprofits=t.nonprofits,this.eligibleNonprofitsDataController.data=t,t}async fetchSubscription(){S(["apiKey","subscriptionId"],this);const t=await G({baseUrl:this.baseUrl,headers:y(this.apiKey),requestBody:{remoteSubscriptionId:this.subscriptionId,email:this.email,partnerUserId:this.partnerUserId}});return this.beamUserId=t.beamUserId,this.nonprofitId=t.nonprofit?.id||null,t}async fetchImpact(){S(["apiKey"],this);const t=await q({baseUrl:this.baseUrl,headers:y(this.apiKey),queryParams:{beamUserId:this.beamUserId?this.beamUserId:void 0,widgetName:"subscription-management",version:"1.0.0",lang:this.configLang}});return this.personalImpactDataController.data=t,t}getDisplayablePreviousImpacts(){const t=this.personalImpactDataController.data?.personal;return!t||t?.length<1?[]:t.filter(n=>!(!n.nonprofit.includeInPersonalImpact||n.nonprofit.id===this.nonprofitId&&(!n.impact.goalCompletionText||n.impact.goalCompletionText?.length<1)))}handleSwapNonprofitButtonClick(){this.activeWidget="select-subscription-nonprofit"}handleBackToSubscriptionImpactButtonClick(){this.activeWidget="subscription-impact"}handleSupportAgainButtonClick(t,n){this.activeWidget="select-subscription-nonprofit",this.selectedNonprofitId=t;const s=new N({selectedNonprofitId:t,nonprofitName:n,source:B.subscription_management,timestamp:new Date});this.dispatchEvent(s)}handleNonprofitSelect(t){if(!(t instanceof N))return;const{selectedNonprofitId:n}=t.detail;this.nonprofitId=n??null,this.activeWidget="subscription-impact"}isNonprofitEligible(t){return this.eligibleNonprofits.some(n=>n.nonprofit.id===t)}shouldDisplayProgressBar(t){return t>tt&&t<et}get cssVariables(){const t={...Q,..._,"--beam-fontFamily":"inherit","--beam-fontStyle":"inherit","--beam-fontSize":"inherit","--beam-textColor":"inherit","--beam-backgroundColor":"inherit","--beam-SubscriptionManagement-widgetContainer-borderColor":"#d5d5d5","--beam-SubscriptionManagement-widgetContainer-borderRadius":"4px","--beam-SubscriptionManagement-widgetContainer-padding":"8px 20px","--beam-SubscriptionManagement-widgetContainer-backgroundColor":"inherit","--beam-SubscriptionManagement-widgetContainer-maxWidth":"820px","--beam-SubscriptionManagement-logo-align-desktop":"left","--beam-SubscriptionManagement-logo-align-mobile":"center","--beam-SubscriptionManagement-previousImpact-cardStyle":"'selected_icon'","--beam-SubscriptionManagement-header-padding":"10px 20px 10px 0px","--beam-SubscriptionManagement-header-borderRadius":"0px","--beam-SubscriptionManagement-header-backgroundColor":"#fff","--beam-SubscriptionManagement-header-meatballsMenu-fontSize":"24px","--beam-SubscriptionManagement-header-meatballsMenu-color":"24px","--beam-SubscriptionManagement-lineBreak-color":"#ddd","--beam-SubscriptionManagement-lineBreak-width":"1px","--beam-SubscriptionManagement-lineBreak-margin":"10px 0 20px 0","--beam-SubscriptionManagement-tile-marginBottom":"20px","--beam-SubscriptionManagement-tile-border-width":"0px","--beam-SubscriptionManagement-tile-border-color":"#ddd","--beam-SubscriptionManagement-tile-padding":"12.5px","--beam-SubscriptionManagement-tile-borderRadius":"8px","--beam-SubscriptionManagement-tile-background":"#f8fbfb","--beam-SubscriptionManagement-tileContent-gap":" 15px","--beam-SubscriptionManagement-tileContent-padding":"5px 0px","--beam-SubscriptionManagement-tile-icon-borderRadius":"4px","--beam-SubscriptionManagement-tile-icon-height":"28px","--beam-SubscriptionManagement-tile-icon-background-borderRadius":"50%","--beam-SubscriptionManagement-tile-icon-background-width":"50px","--beam-SubscriptionManagement-tile-icon-background-height":"50px","--beam-SubscriptionManagement-tile-icon-background-backgroundColor":"#0a323c","--beam-SubscriptionManagement-tile-icon-background-padding":"10px","--beam-SubscriptionManagement-blockTileDescription-gap":"5px","--beam-SubscriptionManagement-blockTileDescription-padding":"0px","--beam-SubscriptionManagement-blockTileDescription-lineHeight":"130%","--beam-SubscriptionManagement-blockTileDescription-progressBar-width-desktop":"60%","--beam-SubscriptionManagement-blockTileDescription-progressBar-width-mobile":"100%","--beam-SubscriptionManagement-subWidgetContainer-padding":"0px 0px 10px","--beam-SubscriptionManagement-previousImpactContainer-padding-desktop":"10px 24px 10px 0px","--beam-SubscriptionManagement-previousImpactContainer-padding-mobile":"0px","--beam-SubscriptionManagement-dropDown-padding":"15px 8px","--beam-SubscriptionManagement-dropDown-borderRadius":"8px","--beam-SubscriptionManagement-dropDown-backgroundColor":"#f8fbfb","--beam-SubscriptionManagement-dropDown-boxShadow":"0px 4px 28px 0px rgba(0, 0, 0, 0.04)","--beam-SubscriptionManagement-dropDown-width":"128px","--beam-SubscriptionManagement-dropDown-hover-backgroundColor":"#E1F1EE","--beam-SubscriptionManagement-dropDownOptions-textDecoration":"underline",...c("--beam-SubscriptionManagement-dropDownOptions",{fontSize:"12px",fontWeight:"400",textTransform:"capitalize",fontStyle:"normal",color:"#0a323c"}),"--beam-SubscriptionManagement-yourPreviousImpactTitle-marginBottom":"15px",...c("--beam-SubscriptionManagement-yourPreviousImpactTitle",{fontSize:"18px",fontWeight:"bold",lineHeight:"120%",textTransform:"capitalize",fontStyle:"normal",color:"#0a323c"}),"--beam-SubscriptionManagement-yourPreviousImpact-showAllButton-textDecoration":"underline",...c("--beam-SubscriptionManagement-yourPreviousImpact-showAllButton",{fontSize:"12px",fontWeight:"bold",lineHeight:"120%",textTransform:"capitalize",fontStyle:"normal",color:"#0a323c"}),"--beam-SubscriptionManagement-tile-title-letterSpacing":"0.36px",...c("--beam-SubscriptionManagement-tile-title",{fontSize:"12px",fontWeight:"bold",lineHeight:"120%",textTransform:"uppercase",fontStyle:"normal",color:"#0a323c"}),...c("--beam-SubscriptionManagement-tile-description",{fontSize:"14px",lineHeight:"120%",fontStyle:"normal",color:"#454a47"}),...c("--beam-SubscriptionManagement-tile-via",{fontSize:"14px",lineHeight:"120%",fontStyle:"normal",color:"#454a47"}),"--beam-SubscriptionManagement-tile-nonprofitLink-textDecoration":"underline",...c("--beam-SubscriptionManagement-tile-nonprofitLink",{fontSize:"14px",fontWeight:"400",lineHeight:"120%",textTransform:"capitalize",fontStyle:"normal",color:"#0a323c"}),"--beam-SubscriptionManagement-tile-supportAgainButton-textDecoration":"underline",...c("--beam-SubscriptionManagement-tile-supportAgainButton",{fontSize:"14px",fontWeight:"400",lineHeight:"120%",textTransform:"capitalize",fontStyle:"normal",color:"#0a323c"}),"--beam-SubscriptionManagement-tile-progressBarLabel-marginLeft":"8px",...c("--beam-SubscriptionManagement-tile-progressBarLabel",{fontSize:"10px",fontWeight:"bold",fontStyle:"normal",color:"#878a92"}),"--beam-SubscriptionManagement-tile-fundedAmount-lineHeight":"16px",...c("--beam-SubscriptionManagement-tile-fundedAmount",{fontSize:"14px",fontWeight:"400",lineHeight:"120%",fontStyle:"italic",color:"#0a323c"})},n=this.eligibleNonprofitsDataController?.data?.config?.web?.theme||{},s={...t,...n};return Object.assign(Object.create({toCSS(){return J(this)}}),s)}renderPreviousImpactTiles({personalImpact:t,cardStyle:n,eligibleNonprofitConfig:s}){if(!t)return o``;if(!s)return o``;const a=this.showAllTiles?t:t.slice(0,$);let b=0;return o`
1
+ import{i as z,n as r,r as d,a as H,b as o,h as E}from"../chunks/lit-BEag9MFp.esm.js";import{D as R,v as j,P as K,W as B,x as y,B as N}from"../chunks/utils-C5hmbxa4.esm.js";import{a as _}from"../chunks/share-button-Cle5Uexn.esm.js";import{c as F,a as O,d as V,e as S}from"../chunks/css-card-grid-CiqEjkwR.esm.js";import{u as l,A as x,h as Y,j as G,g as q,e as c,f as J,d as p,_ as D,c as v}from"../chunks/index-BpR0FMss.esm.js";import"./select-subscription-nonprofit.js";import"./subscription-impact.js";import{partnerLogosConfigDefaults as Q}from"./beam-partner-logos.js";import"../chunks/lodash-CrMU6wKg.esm.js";import"../chunks/share-button-C_qDR7Rw.esm.js";import"../chunks/vendor-DUOg5fL-.esm.js";import"../chunks/_share-dialog-dependencies-BonvNllt.esm.js";import"../chunks/responsive-aN8P5PqD.esm.js";const g={en:{changeNonprofitButton:()=>"Change Nonprofit",previousImpactHeader:()=>"Your Previous Impact",previousNonprofitButton:()=>"Back to Previous Nonprofit",supportAgainButton:()=>"Support Again",via:()=>"via",showAllButton:()=>"Show All",showLessButton:()=>"Show Less"},fr:{changeNonprofitButton:()=>"Change Nonprofit",previousImpactHeader:()=>"Your Previous Impact",previousNonprofitButton:()=>"Back to Previous Nonprofit",supportAgainButton:()=>"Support Again",via:()=>"via",showAllButton:()=>"Show All",showLessButton:()=>"Show Less"},de:{changeNonprofitButton:()=>"Change Nonprofit",previousImpactHeader:()=>"Your Previous Impact",previousNonprofitButton:()=>"Back to Previous Nonprofit",supportAgainButton:()=>"Support Again",via:()=>"via",showAllButton:()=>"Show All",showLessButton:()=>"Show Less"},es:{changeNonprofitButton:()=>"Change Nonprofit",previousImpactHeader:()=>"Your Previous Impact",previousNonprofitButton:()=>"Back to Previous Nonprofit",supportAgainButton:()=>"Support Again",via:()=>"via",showAllButton:()=>"Show All",showLessButton:()=>"Show Less"},it:{changeNonprofitButton:()=>"Change Nonprofit",previousImpactHeader:()=>"Your Previous Impact",previousNonprofitButton:()=>"Back to Previous Nonprofit",supportAgainButton:()=>"Support Again",via:()=>"via",showAllButton:()=>"Show All",showLessButton:()=>"Show Less"},pl:{changeNonprofitButton:()=>"Change Nonprofit",previousImpactHeader:()=>"Your Previous Impact",previousNonprofitButton:()=>"Back to Previous Nonprofit",supportAgainButton:()=>"Support Again",via:()=>"via",showAllButton:()=>"Show All",showLessButton:()=>"Show Less"},ja:{changeNonprofitButton:()=>"Change Nonprofit",previousImpactHeader:()=>"Your Previous Impact",previousNonprofitButton:()=>"Back to Previous Nonprofit",supportAgainButton:()=>"Support Again",via:()=>"via",showAllButton:()=>"Show All",showLessButton:()=>"Show Less"}};var X=Object.defineProperty,i=(M,t,n,s)=>{for(var a=void 0,b=M.length-1,u;b>=0;b--)(u=M[b])&&(a=u(t,n,a)||a);return a&&X(t,n,a),a};const $=3,Z=0,tt=1,et=98;class e extends H{constructor(){super(...arguments),this.baseUrl=R,this.lang="en",this.debug=!1,this.draftConfig=!1,this.activeWidget=null,this.nonprofitId=null,this.beamUserId=null,this.eligibleNonprofits=[],this.showAllTiles=!1,this.isMobile=window.innerWidth<720,this.dropdownVisible=!1,this.emojis=["\u{1F44F}","\u{1F4AA}","\u{1F64C}","\u2728","\u{1F947}"],this.subscriptionDataController=new x(this,this.fetchSubscription),this.eligibleNonprofitsDataController=new x(this,this.fetchEligibleNonprofits),this.personalImpactDataController=new x(this,this.fetchImpact)}get configLang(){return j[this.lang]||"en"}async firstUpdated(){if(!this.email&&!this.partnerUserId)throw new K(["email","partnerUserId"],"One of the following properties needs to be specified: email, partnerUserId ");S(["apiKey","subscriptionId"],this),await this.loadWidget()}async loadWidget(){await Promise.all([this.fetchEligibleNonprofits(),this.fetchSubscription()]),await this.fetchImpact(),this.activeWidget=this.nonprofitId?"subscription-impact":"select-subscription-nonprofit"}async fetchEligibleNonprofits(){S(["apiKey","subscriptionId"],this);const t=await Y({baseUrl:this.baseUrl,headers:y(this.apiKey),requestBody:{storeId:this.storeId||void 0,postalCode:this.postalCode||void 0,countryCode:this.countryCode||void 0,widgetName:B.subscription_management,version:"1.0.0"}});return this.storeId=t.store.id,this.eligibleNonprofits=t.nonprofits,this.eligibleNonprofitsDataController.data=t,t}async fetchSubscription(){S(["apiKey","subscriptionId"],this);const t=await G({baseUrl:this.baseUrl,headers:y(this.apiKey),requestBody:{remoteSubscriptionId:this.subscriptionId,email:this.email,partnerUserId:this.partnerUserId}});return this.beamUserId=t.beamUserId,this.nonprofitId=t.nonprofit?.id||null,t}async fetchImpact(){S(["apiKey"],this);const t=await q({baseUrl:this.baseUrl,headers:y(this.apiKey),queryParams:{beamUserId:this.beamUserId?this.beamUserId:void 0,widgetName:"subscription-management",version:"1.0.0",lang:this.configLang}});return this.personalImpactDataController.data=t,t}getDisplayablePreviousImpacts(){const t=this.personalImpactDataController.data?.personal;return!t||t?.length<1?[]:t.filter(n=>!(!n.nonprofit.includeInPersonalImpact||n.nonprofit.id===this.nonprofitId&&(!n.impact.goalCompletionText||n.impact.goalCompletionText?.length<1)))}handleSwapNonprofitButtonClick(){this.activeWidget="select-subscription-nonprofit"}handleBackToSubscriptionImpactButtonClick(){this.activeWidget="subscription-impact"}handleSupportAgainButtonClick(t,n){this.activeWidget="select-subscription-nonprofit",this.selectedNonprofitId=t;const s=new N({selectedNonprofitId:t,nonprofitName:n,source:B.subscription_management,timestamp:new Date});this.dispatchEvent(s)}handleNonprofitSelect(t){if(!(t instanceof N))return;const{selectedNonprofitId:n}=t.detail;this.nonprofitId=n??null,this.activeWidget="subscription-impact"}isNonprofitEligible(t){return this.eligibleNonprofits.some(n=>n.nonprofit.id===t)}shouldDisplayProgressBar(t){return t>tt&&t<et}get cssVariables(){const t={...Q,..._,"--beam-fontFamily":"inherit","--beam-fontStyle":"inherit","--beam-fontSize":"inherit","--beam-textColor":"inherit","--beam-backgroundColor":"inherit","--beam-SubscriptionManagement-widgetContainer-borderColor":"#d5d5d5","--beam-SubscriptionManagement-widgetContainer-borderRadius":"4px","--beam-SubscriptionManagement-widgetContainer-padding":"8px 20px","--beam-SubscriptionManagement-widgetContainer-backgroundColor":"inherit","--beam-SubscriptionManagement-widgetContainer-maxWidth":"820px","--beam-SubscriptionManagement-logo-align-desktop":"left","--beam-SubscriptionManagement-logo-align-mobile":"center","--beam-SubscriptionManagement-previousImpact-cardStyle":"'selected_icon'","--beam-SubscriptionManagement-header-padding":"10px 20px 10px 0px","--beam-SubscriptionManagement-header-borderRadius":"0px","--beam-SubscriptionManagement-header-backgroundColor":"#fff","--beam-SubscriptionManagement-header-meatballsMenu-fontSize":"24px","--beam-SubscriptionManagement-header-meatballsMenu-color":"24px","--beam-SubscriptionManagement-lineBreak-color":"#ddd","--beam-SubscriptionManagement-lineBreak-width":"1px","--beam-SubscriptionManagement-lineBreak-margin":"10px 0 20px 0","--beam-SubscriptionManagement-tile-marginBottom":"20px","--beam-SubscriptionManagement-tile-border-width":"0px","--beam-SubscriptionManagement-tile-border-color":"#ddd","--beam-SubscriptionManagement-tile-padding":"12.5px","--beam-SubscriptionManagement-tile-borderRadius":"8px","--beam-SubscriptionManagement-tile-background":"#f8fbfb","--beam-SubscriptionManagement-tileContent-gap":" 15px","--beam-SubscriptionManagement-tileContent-padding":"5px 0px","--beam-SubscriptionManagement-tile-icon-borderRadius":"4px","--beam-SubscriptionManagement-tile-icon-height":"28px","--beam-SubscriptionManagement-tile-icon-background-borderRadius":"50%","--beam-SubscriptionManagement-tile-icon-background-width":"50px","--beam-SubscriptionManagement-tile-icon-background-height":"50px","--beam-SubscriptionManagement-tile-icon-background-backgroundColor":"#0a323c","--beam-SubscriptionManagement-tile-icon-background-padding":"10px","--beam-SubscriptionManagement-blockTileDescription-gap":"5px","--beam-SubscriptionManagement-blockTileDescription-padding":"0px","--beam-SubscriptionManagement-blockTileDescription-lineHeight":"130%","--beam-SubscriptionManagement-blockTileDescription-progressBar-width-desktop":"60%","--beam-SubscriptionManagement-blockTileDescription-progressBar-width-mobile":"100%","--beam-SubscriptionManagement-subWidgetContainer-padding":"0px 0px 10px","--beam-SubscriptionManagement-previousImpactContainer-padding-desktop":"10px 24px 10px 0px","--beam-SubscriptionManagement-previousImpactContainer-padding-mobile":"0px","--beam-SubscriptionManagement-dropDown-padding":"15px 8px","--beam-SubscriptionManagement-dropDown-borderRadius":"8px","--beam-SubscriptionManagement-dropDown-backgroundColor":"#f8fbfb","--beam-SubscriptionManagement-dropDown-boxShadow":"0px 4px 28px 0px rgba(0, 0, 0, 0.04)","--beam-SubscriptionManagement-dropDown-width":"128px","--beam-SubscriptionManagement-dropDown-hover-backgroundColor":"#E1F1EE","--beam-SubscriptionManagement-dropDownOptions-textDecoration":"underline",...c("--beam-SubscriptionManagement-dropDownOptions",{fontSize:"12px",fontWeight:"400",textTransform:"capitalize",fontStyle:"normal",color:"#0a323c"}),"--beam-SubscriptionManagement-yourPreviousImpactTitle-marginBottom":"15px",...c("--beam-SubscriptionManagement-yourPreviousImpactTitle",{fontSize:"18px",fontWeight:"bold",lineHeight:"120%",textTransform:"capitalize",fontStyle:"normal",color:"#0a323c"}),"--beam-SubscriptionManagement-yourPreviousImpact-showAllButton-textDecoration":"underline",...c("--beam-SubscriptionManagement-yourPreviousImpact-showAllButton",{fontSize:"12px",fontWeight:"bold",lineHeight:"120%",textTransform:"capitalize",fontStyle:"normal",color:"#0a323c"}),"--beam-SubscriptionManagement-tile-title-letterSpacing":"0.36px",...c("--beam-SubscriptionManagement-tile-title",{fontSize:"12px",fontWeight:"bold",lineHeight:"120%",textTransform:"uppercase",fontStyle:"normal",color:"#0a323c"}),...c("--beam-SubscriptionManagement-tile-description",{fontSize:"14px",lineHeight:"120%",fontStyle:"normal",color:"#454a47"}),...c("--beam-SubscriptionManagement-tile-via",{fontSize:"14px",lineHeight:"120%",fontStyle:"normal",color:"#454a47"}),"--beam-SubscriptionManagement-tile-nonprofitLink-textDecoration":"underline",...c("--beam-SubscriptionManagement-tile-nonprofitLink",{fontSize:"14px",fontWeight:"400",lineHeight:"120%",textTransform:"capitalize",fontStyle:"normal",color:"#0a323c"}),"--beam-SubscriptionManagement-tile-supportAgainButton-textDecoration":"underline",...c("--beam-SubscriptionManagement-tile-supportAgainButton",{fontSize:"14px",fontWeight:"400",lineHeight:"120%",textTransform:"capitalize",fontStyle:"normal",color:"#0a323c"}),"--beam-SubscriptionManagement-tile-progressBarLabel-marginLeft":"8px",...c("--beam-SubscriptionManagement-tile-progressBarLabel",{fontSize:"10px",fontWeight:"bold",fontStyle:"normal",color:"#878a92"}),"--beam-SubscriptionManagement-tile-fundedAmount-lineHeight":"16px",...c("--beam-SubscriptionManagement-tile-fundedAmount",{fontSize:"14px",fontWeight:"400",lineHeight:"120%",fontStyle:"italic",color:"#0a323c"})},n=this.eligibleNonprofitsDataController?.data?.config?.web?.theme||{},s={...t,...n};return Object.assign(Object.create({toCSS(){return J(this)}}),s)}renderPreviousImpactTiles({personalImpact:t,cardStyle:n,eligibleNonprofitConfig:s}){if(!t)return o``;if(!s)return o``;const a=this.showAllTiles?t:t.slice(0,$);let b=0;return o`
2
2
  ${a.map(u=>{const{impact:{goalCompletionText:m,description:h,goalProgressPercentage:f,goalProgressText:A},nonprofit:{cause:C,causeIconSelectedUrl:L,causeIconUrl:T,website:P,name:I,id:w}}=u,k=this.nonprofitId!==w&&this.isNonprofitEligible(w),U=k&&this.shouldDisplayProgressBar(f),W=m?`${this.emojis[b]} `:"";return b=(b+1)%this.emojis.length,o`
3
3
  <div class="tile">
4
4
  <div class="tile-header">
package/dist/index.d.ts CHANGED
@@ -9,13 +9,13 @@ export { BeamSubscriptionImpact } from './components/subscription-impact.js';
9
9
  export { BeamProductDetailsPage } from './components/product-details-page.js';
10
10
  export { BeamSelectSubscriptionNonprofit } from './components/select-subscription-nonprofit.js';
11
11
  export { BeamSocialShare } from './components/social-share.js';
12
- import { i as index$5 } from './chunks/index-BAROgNYE.esm.js';
13
- import { i as index$4 } from './chunks/index-C6a13iqC.esm.js';
12
+ import { i as index$5 } from './chunks/index-h_-rDiMR.esm.js';
13
+ import { i as index$4 } from './chunks/index-C6gns2ul.esm.js';
14
14
  import { i as index$3 } from './chunks/index-mBTWm4YP.esm.js';
15
- import { i as index$1 } from './chunks/index-OYSJ-2mk.esm.js';
16
- import { i as index$2 } from './chunks/index-BH3YaPLG.esm.js';
15
+ import { i as index$1 } from './chunks/index-Bi9LFICg.esm.js';
16
+ import { i as index$2 } from './chunks/index-DQ89VjpD.esm.js';
17
17
  export { i as ReactComponents } from './chunks/index-BoIHE1tC.esm.js';
18
- export { a as Utils } from './chunks/utils-COGFpDER.esm.js';
18
+ export { a as Utils } from './chunks/utils-BPcZ5h8J.esm.js';
19
19
  import 'lit';
20
20
  import 'lit-html';
21
21
  import 'lodash';
@@ -23,8 +23,8 @@ import './chunks/routes-D6Gtw6kZ.esm.js';
23
23
  import './components/beam-partner-logos.js';
24
24
  import 'lodash-es/debounce';
25
25
  import 'lodash-es/isEqual';
26
- import './chunks/cart-CKltrzQt.esm.js';
27
- import './chunks/update-cart-DoJGAdoU.esm.js';
26
+ import './chunks/cart-DCezceUX.esm.js';
27
+ import './chunks/update-cart-B5Tr9N3V.esm.js';
28
28
  import './react/community-impact.js';
29
29
  import '@lit/react';
30
30
  import './react/cumulative-impact.js';
package/dist/index.esm.js CHANGED
@@ -1,2 +1,2 @@
1
- import{BeamCommunityImpact as M}from"./components/community-impact.esm.js";import{BeamCumulativeImpact as k}from"./components/cumulative-impact.esm.js";import{BeamImpactOverview as A}from"./components/impact-overview.esm.js";import{BeamSelectNonprofit as F}from"./components/select-nonprofit.esm.js";import{B as H}from"./chunks/index-HqfLVFOU.esm.js";import{B as K}from"./chunks/index-C60Vejym.esm.js";import{BeamSubscriptionManagement as V}from"./components/subscription-management.esm.js";import{BeamSubscriptionImpact as X}from"./components/subscription-impact.esm.js";import{BeamProductDetailsPage as Z}from"./components/product-details-page.esm.js";import{BeamSelectSubscriptionNonprofit as ro}from"./components/select-subscription-nonprofit.esm.js";import{BeamSocialShare as mo}from"./components/social-share.esm.js";import{i as o,a as r}from"./react/shopify.esm.js";import{i as t}from"./chunks/index-D6aFJ4cU.esm.js";import{i as m}from"./chunks/index-MAMeVd6l.esm.js";import{i}from"./chunks/index-Dm-K2MLY.esm.js";import{i as eo}from"./chunks/index-BHglsF5j.esm.js";import{i as ao}from"./chunks/utils-C5hmbxa4.esm.js";import"./chunks/lit-BEag9MFp.esm.js";import"./chunks/css-card-grid-CiqEjkwR.esm.js";import"./chunks/share-button-5gfPmeEh.esm.js";import"./components/beam-partner-logos.esm.js";import"./chunks/lodash-CrMU6wKg.esm.js";import"./chunks/_share-dialog-dependencies-BEUnzuWq.esm.js";import"./chunks/vendor-DUOg5fL-.esm.js";import"./chunks/share-button-C4yPLL_t.esm.js";import"./chunks/responsive-aN8P5PqD.esm.js";import"./chunks/promo-pill-label-5HmbDVmU.esm.js";import"./react/community-impact.esm.js";import"react";import"./react/cumulative-impact.esm.js";import"./react/impact-overview.esm.js";import"./react/select-nonprofit.esm.js";import"./react/redeem-transaction.esm.js";import"./react/post-purchase.esm.js";import"./react/subscription-management.esm.js";import"./react/select-subscription-nonprofit.esm.js";import"./react/subscription-impact.esm.js";import"./react/product-details-page.esm.js";import"./react/social-share.esm.js";import"./react/subscriber-select-nonprofit.esm.js";import"./components/subscriber-select-nonprofit.esm.js";import"./chunks/handlebars-B_i-to-h.esm.js";var e=Object.freeze({__proto__:null,Cart:m,Logs:i,Session:o,Shopify:t,Utils:r});export{M as BeamCommunityImpact,k as BeamCumulativeImpact,A as BeamImpactOverview,K as BeamPostPurchase,Z as BeamProductDetailsPage,H as BeamRedeemTransaction,F as BeamSelectNonprofit,ro as BeamSelectSubscriptionNonprofit,mo as BeamSocialShare,X as BeamSubscriptionImpact,V as BeamSubscriptionManagement,e as Integrations,eo as ReactComponents,ao as Utils};
1
+ import{BeamCommunityImpact as M}from"./components/community-impact.esm.js";import{BeamCumulativeImpact as k}from"./components/cumulative-impact.esm.js";import{BeamImpactOverview as A}from"./components/impact-overview.esm.js";import{BeamSelectNonprofit as F}from"./components/select-nonprofit.esm.js";import{B as H}from"./chunks/index-DJ5OwAaV.esm.js";import{B as K}from"./chunks/index-C03QP2W-.esm.js";import{BeamSubscriptionManagement as V}from"./components/subscription-management.esm.js";import{BeamSubscriptionImpact as X}from"./components/subscription-impact.esm.js";import{BeamProductDetailsPage as Z}from"./components/product-details-page.esm.js";import{BeamSelectSubscriptionNonprofit as ro}from"./components/select-subscription-nonprofit.esm.js";import{BeamSocialShare as mo}from"./components/social-share.esm.js";import{i as o,a as r}from"./react/shopify.esm.js";import{i as t}from"./chunks/index-BnbtpTg-.esm.js";import{i as m}from"./chunks/index-Ghl9JrXJ.esm.js";import{i}from"./chunks/index-BpR0FMss.esm.js";import{i as eo}from"./chunks/index-BHglsF5j.esm.js";import{i as ao}from"./chunks/utils-C5hmbxa4.esm.js";import"./chunks/lit-BEag9MFp.esm.js";import"./chunks/css-card-grid-CiqEjkwR.esm.js";import"./chunks/share-button-Cle5Uexn.esm.js";import"./components/beam-partner-logos.esm.js";import"./chunks/lodash-CrMU6wKg.esm.js";import"./chunks/_share-dialog-dependencies-BonvNllt.esm.js";import"./chunks/vendor-DUOg5fL-.esm.js";import"./chunks/share-button-C_qDR7Rw.esm.js";import"./chunks/responsive-aN8P5PqD.esm.js";import"./chunks/promo-pill-label-F6oSUeZ_.esm.js";import"./react/community-impact.esm.js";import"react";import"./react/cumulative-impact.esm.js";import"./react/impact-overview.esm.js";import"./react/select-nonprofit.esm.js";import"./react/redeem-transaction.esm.js";import"./react/post-purchase.esm.js";import"./react/subscription-management.esm.js";import"./react/select-subscription-nonprofit.esm.js";import"./react/subscription-impact.esm.js";import"./react/product-details-page.esm.js";import"./react/social-share.esm.js";import"./react/subscriber-select-nonprofit.esm.js";import"./components/subscriber-select-nonprofit.esm.js";import"./chunks/handlebars-B_i-to-h.esm.js";var e=Object.freeze({__proto__:null,Cart:m,Logs:i,Session:o,Shopify:t,Utils:r});export{M as BeamCommunityImpact,k as BeamCumulativeImpact,A as BeamImpactOverview,K as BeamPostPurchase,Z as BeamProductDetailsPage,H as BeamRedeemTransaction,F as BeamSelectNonprofit,ro as BeamSelectSubscriptionNonprofit,mo as BeamSocialShare,X as BeamSubscriptionImpact,V as BeamSubscriptionManagement,e as Integrations,eo as ReactComponents,ao as Utils};
2
2
  //# sourceMappingURL=index.esm.js.map
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import{BeamCommunityImpact as M}from"./components/community-impact.js";import{BeamCumulativeImpact as k}from"./components/cumulative-impact.js";import{BeamImpactOverview as A}from"./components/impact-overview.js";import{BeamSelectNonprofit as F}from"./components/select-nonprofit.js";import{B as H}from"./chunks/index-DqhM4Yoj.esm.js";import{B as K}from"./chunks/index-BgalrCS_.esm.js";import{BeamSubscriptionManagement as V}from"./components/subscription-management.js";import{BeamSubscriptionImpact as X}from"./components/subscription-impact.js";import{BeamProductDetailsPage as Z}from"./components/product-details-page.js";import{BeamSelectSubscriptionNonprofit as ro}from"./components/select-subscription-nonprofit.js";import{BeamSocialShare as mo}from"./components/social-share.js";import{i as o,a as r}from"./react/shopify.js";import{i as t}from"./chunks/index-D6aFJ4cU.esm.js";import{i as m}from"./chunks/index-MAMeVd6l.esm.js";import{i}from"./chunks/index-Dm-K2MLY.esm.js";import{i as eo}from"./chunks/index-B4xKTDaF.esm.js";import{i as ao}from"./chunks/utils-C5hmbxa4.esm.js";import"./chunks/lit-BEag9MFp.esm.js";import"./chunks/css-card-grid-CiqEjkwR.esm.js";import"./chunks/share-button-5gfPmeEh.esm.js";import"./components/beam-partner-logos.js";import"./chunks/lodash-CrMU6wKg.esm.js";import"./chunks/_share-dialog-dependencies-BEUnzuWq.esm.js";import"./chunks/vendor-DUOg5fL-.esm.js";import"./chunks/share-button-C4yPLL_t.esm.js";import"./chunks/responsive-aN8P5PqD.esm.js";import"./chunks/promo-pill-label-5HmbDVmU.esm.js";import"./react/community-impact.js";import"react";import"./react/cumulative-impact.js";import"./react/impact-overview.js";import"./react/select-nonprofit.js";import"./react/redeem-transaction.js";import"./react/post-purchase.js";import"./react/subscription-management.js";import"./react/select-subscription-nonprofit.js";import"./react/subscription-impact.js";import"./react/product-details-page.js";import"./react/social-share.js";import"./react/subscriber-select-nonprofit.js";import"./components/subscriber-select-nonprofit.js";import"./chunks/handlebars-B_i-to-h.esm.js";var e=Object.freeze({__proto__:null,Cart:m,Logs:i,Session:o,Shopify:t,Utils:r});export{M as BeamCommunityImpact,k as BeamCumulativeImpact,A as BeamImpactOverview,K as BeamPostPurchase,Z as BeamProductDetailsPage,H as BeamRedeemTransaction,F as BeamSelectNonprofit,ro as BeamSelectSubscriptionNonprofit,mo as BeamSocialShare,X as BeamSubscriptionImpact,V as BeamSubscriptionManagement,e as Integrations,eo as ReactComponents,ao as Utils};
1
+ import{BeamCommunityImpact as M}from"./components/community-impact.js";import{BeamCumulativeImpact as k}from"./components/cumulative-impact.js";import{BeamImpactOverview as A}from"./components/impact-overview.js";import{BeamSelectNonprofit as F}from"./components/select-nonprofit.js";import{B as H}from"./chunks/index-BXivnoQL.esm.js";import{B as K}from"./chunks/index-CQEhF7Dy.esm.js";import{BeamSubscriptionManagement as V}from"./components/subscription-management.js";import{BeamSubscriptionImpact as X}from"./components/subscription-impact.js";import{BeamProductDetailsPage as Z}from"./components/product-details-page.js";import{BeamSelectSubscriptionNonprofit as ro}from"./components/select-subscription-nonprofit.js";import{BeamSocialShare as mo}from"./components/social-share.js";import{i as o,a as r}from"./react/shopify.js";import{i as t}from"./chunks/index-BnbtpTg-.esm.js";import{i as m}from"./chunks/index-Ghl9JrXJ.esm.js";import{i}from"./chunks/index-BpR0FMss.esm.js";import{i as eo}from"./chunks/index-B4xKTDaF.esm.js";import{i as ao}from"./chunks/utils-C5hmbxa4.esm.js";import"./chunks/lit-BEag9MFp.esm.js";import"./chunks/css-card-grid-CiqEjkwR.esm.js";import"./chunks/share-button-Cle5Uexn.esm.js";import"./components/beam-partner-logos.js";import"./chunks/lodash-CrMU6wKg.esm.js";import"./chunks/_share-dialog-dependencies-BonvNllt.esm.js";import"./chunks/vendor-DUOg5fL-.esm.js";import"./chunks/share-button-C_qDR7Rw.esm.js";import"./chunks/responsive-aN8P5PqD.esm.js";import"./chunks/promo-pill-label-F6oSUeZ_.esm.js";import"./react/community-impact.js";import"react";import"./react/cumulative-impact.js";import"./react/impact-overview.js";import"./react/select-nonprofit.js";import"./react/redeem-transaction.js";import"./react/post-purchase.js";import"./react/subscription-management.js";import"./react/select-subscription-nonprofit.js";import"./react/subscription-impact.js";import"./react/product-details-page.js";import"./react/social-share.js";import"./react/subscriber-select-nonprofit.js";import"./components/subscriber-select-nonprofit.js";import"./chunks/handlebars-B_i-to-h.esm.js";var e=Object.freeze({__proto__:null,Cart:m,Logs:i,Session:o,Shopify:t,Utils:r});export{M as BeamCommunityImpact,k as BeamCumulativeImpact,A as BeamImpactOverview,K as BeamPostPurchase,Z as BeamProductDetailsPage,H as BeamRedeemTransaction,F as BeamSelectNonprofit,ro as BeamSelectSubscriptionNonprofit,mo as BeamSocialShare,X as BeamSubscriptionImpact,V as BeamSubscriptionManagement,e as Integrations,eo as ReactComponents,ao as Utils};
2
2
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- import { N as TApiKey, f as TUrl, b as TNumericId } from '../chunks/utils-COGFpDER.esm.js';
1
+ import { N as TApiKey, f as TUrl, b as TNumericId } from '../chunks/utils-BPcZ5h8J.esm.js';
2
2
  import 'lodash-es/debounce';
3
3
  import 'lodash-es/isEqual';
4
4
 
@@ -1,2 +1,2 @@
1
- import{S as d,c as o,l as u,D as g,d as y}from"../chunks/utils-C5hmbxa4.esm.js";import{s as v}from"../chunks/index-Dm-K2MLY.esm.js";import"../chunks/lodash-CrMU6wKg.esm.js";import"../chunks/lit-BEag9MFp.esm.js";var h=t=>{throw TypeError(t)},w=(t,s,a)=>s.has(t)||h("Cannot "+a),U=(t,s,a)=>s.has(t)?h("Cannot add the same private member more than once"):s instanceof WeakSet?s.add(t):s.set(t,a),r=(t,s,a)=>(w(t,s,"access private method"),a),i,n,c;let l,m;const E=new Promise((t,s)=>{l=t,m=s});class f extends EventTarget{constructor(s){super(),U(this,i),this.readyPromise=E,this.plugins={},this.status="pending",r(this,i,n).call(this,s)}async init(s){r(this,i,n).call(this,s);try{await r(this,i,c).call(this,s)}catch(a){const e=new d;throw e.cause=a,this.status="error",this.dispatchEvent(new o({status:"error",error:e})),m(e),u.error(e),this.apiKey&&await v({apiKey:this.apiKey,baseUrl:this.logUrl},{type:"error",code:e.name,metadata:{message:e.message,cause:a?.message}}),a}return this.status="ready",this.dispatchEvent(new o({status:"ready"})),l(!0),this}}i=new WeakSet,n=function(t){this.apiKey=t.apiKey,this.chainId=t.chainId,this.storeId=t.storeId,this.domain=t.domain,this.baseUrl=t.baseUrl||g,this.logUrl=t.logUrl||y},c=async function(t){const s=(t.plugins||[]).map(async a=>(await a.init(t),this.plugins[a.name]=a,a));return Promise.all(s)};const p=new f({}),L=t=>p.init(t),S=()=>p;export{S as getConfig,L as init};
1
+ import{S as d,c as o,l as u,D as g,d as y}from"../chunks/utils-C5hmbxa4.esm.js";import{s as v}from"../chunks/index-BpR0FMss.esm.js";import"../chunks/lodash-CrMU6wKg.esm.js";import"../chunks/lit-BEag9MFp.esm.js";var h=t=>{throw TypeError(t)},w=(t,s,a)=>s.has(t)||h("Cannot "+a),U=(t,s,a)=>s.has(t)?h("Cannot add the same private member more than once"):s instanceof WeakSet?s.add(t):s.set(t,a),r=(t,s,a)=>(w(t,s,"access private method"),a),i,n,c;let l,m;const E=new Promise((t,s)=>{l=t,m=s});class f extends EventTarget{constructor(s){super(),U(this,i),this.readyPromise=E,this.plugins={},this.status="pending",r(this,i,n).call(this,s)}async init(s){r(this,i,n).call(this,s);try{await r(this,i,c).call(this,s)}catch(a){const e=new d;throw e.cause=a,this.status="error",this.dispatchEvent(new o({status:"error",error:e})),m(e),u.error(e),this.apiKey&&await v({apiKey:this.apiKey,baseUrl:this.logUrl},{type:"error",code:e.name,metadata:{message:e.message,cause:a?.message}}),a}return this.status="ready",this.dispatchEvent(new o({status:"ready"})),l(!0),this}}i=new WeakSet,n=function(t){this.apiKey=t.apiKey,this.chainId=t.chainId,this.storeId=t.storeId,this.domain=t.domain,this.baseUrl=t.baseUrl||g,this.logUrl=t.logUrl||y},c=async function(t){const s=(t.plugins||[]).map(async a=>(await a.init(t),this.plugins[a.name]=a,a));return Promise.all(s)};const p=new f({}),L=t=>p.init(t),S=()=>p;export{S as getConfig,L as init};
2
2
  //# sourceMappingURL=beam.esm.js.map
@@ -1,2 +1,2 @@
1
- import{S as d,c as o,l as u,D as g,d as y}from"../chunks/utils-C5hmbxa4.esm.js";import{s as v}from"../chunks/index-Dm-K2MLY.esm.js";import"../chunks/lodash-CrMU6wKg.esm.js";import"../chunks/lit-BEag9MFp.esm.js";var h=t=>{throw TypeError(t)},w=(t,s,a)=>s.has(t)||h("Cannot "+a),U=(t,s,a)=>s.has(t)?h("Cannot add the same private member more than once"):s instanceof WeakSet?s.add(t):s.set(t,a),r=(t,s,a)=>(w(t,s,"access private method"),a),i,n,c;let l,m;const E=new Promise((t,s)=>{l=t,m=s});class f extends EventTarget{constructor(s){super(),U(this,i),this.readyPromise=E,this.plugins={},this.status="pending",r(this,i,n).call(this,s)}async init(s){r(this,i,n).call(this,s);try{await r(this,i,c).call(this,s)}catch(a){const e=new d;throw e.cause=a,this.status="error",this.dispatchEvent(new o({status:"error",error:e})),m(e),u.error(e),this.apiKey&&await v({apiKey:this.apiKey,baseUrl:this.logUrl},{type:"error",code:e.name,metadata:{message:e.message,cause:a?.message}}),a}return this.status="ready",this.dispatchEvent(new o({status:"ready"})),l(!0),this}}i=new WeakSet,n=function(t){this.apiKey=t.apiKey,this.chainId=t.chainId,this.storeId=t.storeId,this.domain=t.domain,this.baseUrl=t.baseUrl||g,this.logUrl=t.logUrl||y},c=async function(t){const s=(t.plugins||[]).map(async a=>(await a.init(t),this.plugins[a.name]=a,a));return Promise.all(s)};const p=new f({}),L=t=>p.init(t),S=()=>p;export{S as getConfig,L as init};
1
+ import{S as d,c as o,l as u,D as g,d as y}from"../chunks/utils-C5hmbxa4.esm.js";import{s as v}from"../chunks/index-BpR0FMss.esm.js";import"../chunks/lodash-CrMU6wKg.esm.js";import"../chunks/lit-BEag9MFp.esm.js";var h=t=>{throw TypeError(t)},w=(t,s,a)=>s.has(t)||h("Cannot "+a),U=(t,s,a)=>s.has(t)?h("Cannot add the same private member more than once"):s instanceof WeakSet?s.add(t):s.set(t,a),r=(t,s,a)=>(w(t,s,"access private method"),a),i,n,c;let l,m;const E=new Promise((t,s)=>{l=t,m=s});class f extends EventTarget{constructor(s){super(),U(this,i),this.readyPromise=E,this.plugins={},this.status="pending",r(this,i,n).call(this,s)}async init(s){r(this,i,n).call(this,s);try{await r(this,i,c).call(this,s)}catch(a){const e=new d;throw e.cause=a,this.status="error",this.dispatchEvent(new o({status:"error",error:e})),m(e),u.error(e),this.apiKey&&await v({apiKey:this.apiKey,baseUrl:this.logUrl},{type:"error",code:e.name,metadata:{message:e.message,cause:a?.message}}),a}return this.status="ready",this.dispatchEvent(new o({status:"ready"})),l(!0),this}}i=new WeakSet,n=function(t){this.apiKey=t.apiKey,this.chainId=t.chainId,this.storeId=t.storeId,this.domain=t.domain,this.baseUrl=t.baseUrl||g,this.logUrl=t.logUrl||y},c=async function(t){const s=(t.plugins||[]).map(async a=>(await a.init(t),this.plugins[a.name]=a,a));return Promise.all(s)};const p=new f({}),L=t=>p.init(t),S=()=>p;export{S as getConfig,L as init};
2
2
  //# sourceMappingURL=beam.js.map
@@ -1,5 +1,5 @@
1
- export { B as BeamCartAPIConfig, a as BeamCartValues, u as updateCart } from '../chunks/update-cart-DoJGAdoU.esm.js';
1
+ export { B as BeamCartAPIConfig, a as BeamCartValues, u as updateCart } from '../chunks/update-cart-B5Tr9N3V.esm.js';
2
2
  import 'lodash';
3
- import '../chunks/utils-COGFpDER.esm.js';
3
+ import '../chunks/utils-BPcZ5h8J.esm.js';
4
4
  import 'lodash-es/debounce';
5
5
  import 'lodash-es/isEqual';
@@ -1,2 +1,2 @@
1
- import{O as a}from"../chunks/index-MAMeVd6l.esm.js";import"../chunks/lodash-CrMU6wKg.esm.js";import"../chunks/utils-C5hmbxa4.esm.js";import"../chunks/index-Dm-K2MLY.esm.js";import"../chunks/lit-BEag9MFp.esm.js";export{a as updateCart};
1
+ import{O as a}from"../chunks/index-Ghl9JrXJ.esm.js";import"../chunks/lodash-CrMU6wKg.esm.js";import"../chunks/utils-C5hmbxa4.esm.js";import"../chunks/index-BpR0FMss.esm.js";import"../chunks/lit-BEag9MFp.esm.js";export{a as updateCart};
2
2
  //# sourceMappingURL=cart.esm.js.map
@@ -1,2 +1,2 @@
1
- import{O as a}from"../chunks/index-MAMeVd6l.esm.js";import"../chunks/lodash-CrMU6wKg.esm.js";import"../chunks/utils-C5hmbxa4.esm.js";import"../chunks/index-Dm-K2MLY.esm.js";import"../chunks/lit-BEag9MFp.esm.js";export{a as updateCart};
1
+ import{O as a}from"../chunks/index-Ghl9JrXJ.esm.js";import"../chunks/lodash-CrMU6wKg.esm.js";import"../chunks/utils-C5hmbxa4.esm.js";import"../chunks/index-BpR0FMss.esm.js";import"../chunks/lit-BEag9MFp.esm.js";export{a as updateCart};
2
2
  //# sourceMappingURL=cart.js.map
@@ -1,4 +1,4 @@
1
- import '../chunks/utils-COGFpDER.esm.js';
2
- export { s as sendLog } from '../chunks/index-BH3YaPLG.esm.js';
1
+ import '../chunks/utils-BPcZ5h8J.esm.js';
2
+ export { s as sendLog } from '../chunks/index-DQ89VjpD.esm.js';
3
3
  import 'lodash-es/debounce';
4
4
  import 'lodash-es/isEqual';
@@ -1,2 +1,2 @@
1
- import{s as i}from"../chunks/index-Dm-K2MLY.esm.js";import"../chunks/utils-C5hmbxa4.esm.js";import"../chunks/lit-BEag9MFp.esm.js";import"../chunks/lodash-CrMU6wKg.esm.js";export{i as sendLog};
1
+ import{s as i}from"../chunks/index-BpR0FMss.esm.js";import"../chunks/utils-C5hmbxa4.esm.js";import"../chunks/lit-BEag9MFp.esm.js";import"../chunks/lodash-CrMU6wKg.esm.js";export{i as sendLog};
2
2
  //# sourceMappingURL=logs.esm.js.map
@@ -1,2 +1,2 @@
1
- import{s as i}from"../chunks/index-Dm-K2MLY.esm.js";import"../chunks/utils-C5hmbxa4.esm.js";import"../chunks/lit-BEag9MFp.esm.js";import"../chunks/lodash-CrMU6wKg.esm.js";export{i as sendLog};
1
+ import{s as i}from"../chunks/index-BpR0FMss.esm.js";import"../chunks/utils-C5hmbxa4.esm.js";import"../chunks/lit-BEag9MFp.esm.js";import"../chunks/lodash-CrMU6wKg.esm.js";export{i as sendLog};
2
2
  //# sourceMappingURL=logs.js.map
@@ -1,5 +1,5 @@
1
1
  import { BeamPlugin, BeamConfigOptions } from './beam.js';
2
- import '../chunks/utils-COGFpDER.esm.js';
2
+ import '../chunks/utils-BPcZ5h8J.esm.js';
3
3
  import 'lodash-es/debounce';
4
4
  import 'lodash-es/isEqual';
5
5
 
@@ -1,6 +1,6 @@
1
1
  import '../components/post-purchase.js';
2
2
  import { b as postTransaction } from '../chunks/routes-D6Gtw6kZ.esm.js';
3
- import { d as TCart, T as TUrl, L as LANGUAGES } from '../chunks/utils-COGFpDER.esm.js';
3
+ import { d as TCart, T as TUrl, L as LANGUAGES } from '../chunks/utils-BPcZ5h8J.esm.js';
4
4
  import 'lit';
5
5
  import 'lit-html';
6
6
  import '../components/redeem-transaction.js';
@@ -1,2 +1,2 @@
1
- import{s as O}from"../chunks/index-C60Vejym.esm.js";import"../chunks/lit-BEag9MFp.esm.js";import"../chunks/utils-C5hmbxa4.esm.js";import"../chunks/lodash-CrMU6wKg.esm.js";import"../chunks/css-card-grid-CiqEjkwR.esm.js";import"../chunks/index-Dm-K2MLY.esm.js";import"../chunks/index-HqfLVFOU.esm.js";import"../chunks/share-button-5gfPmeEh.esm.js";import"../components/beam-partner-logos.esm.js";import"../chunks/promo-pill-label-5HmbDVmU.esm.js";import"../chunks/_share-dialog-dependencies-BEUnzuWq.esm.js";import"../chunks/vendor-DUOg5fL-.esm.js";import"../components/impact-overview.esm.js";import"../chunks/share-button-C4yPLL_t.esm.js";import"../chunks/responsive-aN8P5PqD.esm.js";export{O as showBeamOrderPageWidgets};
1
+ import{s as O}from"../chunks/index-C03QP2W-.esm.js";import"../chunks/lit-BEag9MFp.esm.js";import"../chunks/utils-C5hmbxa4.esm.js";import"../chunks/lodash-CrMU6wKg.esm.js";import"../chunks/css-card-grid-CiqEjkwR.esm.js";import"../chunks/index-BpR0FMss.esm.js";import"../chunks/index-DJ5OwAaV.esm.js";import"../chunks/share-button-Cle5Uexn.esm.js";import"../components/beam-partner-logos.esm.js";import"../chunks/promo-pill-label-F6oSUeZ_.esm.js";import"../chunks/_share-dialog-dependencies-BonvNllt.esm.js";import"../chunks/vendor-DUOg5fL-.esm.js";import"../components/impact-overview.esm.js";import"../chunks/share-button-C_qDR7Rw.esm.js";import"../chunks/responsive-aN8P5PqD.esm.js";export{O as showBeamOrderPageWidgets};
2
2
  //# sourceMappingURL=shopify-order.esm.js.map
@@ -1,2 +1,2 @@
1
- import{s as O}from"../chunks/index-BgalrCS_.esm.js";import"../chunks/lit-BEag9MFp.esm.js";import"../chunks/utils-C5hmbxa4.esm.js";import"../chunks/lodash-CrMU6wKg.esm.js";import"../chunks/css-card-grid-CiqEjkwR.esm.js";import"../chunks/index-Dm-K2MLY.esm.js";import"../chunks/index-DqhM4Yoj.esm.js";import"../chunks/share-button-5gfPmeEh.esm.js";import"../components/beam-partner-logos.js";import"../chunks/promo-pill-label-5HmbDVmU.esm.js";import"../chunks/_share-dialog-dependencies-BEUnzuWq.esm.js";import"../chunks/vendor-DUOg5fL-.esm.js";import"../components/impact-overview.js";import"../chunks/share-button-C4yPLL_t.esm.js";import"../chunks/responsive-aN8P5PqD.esm.js";export{O as showBeamOrderPageWidgets};
1
+ import{s as O}from"../chunks/index-CQEhF7Dy.esm.js";import"../chunks/lit-BEag9MFp.esm.js";import"../chunks/utils-C5hmbxa4.esm.js";import"../chunks/lodash-CrMU6wKg.esm.js";import"../chunks/css-card-grid-CiqEjkwR.esm.js";import"../chunks/index-BpR0FMss.esm.js";import"../chunks/index-BXivnoQL.esm.js";import"../chunks/share-button-Cle5Uexn.esm.js";import"../components/beam-partner-logos.js";import"../chunks/promo-pill-label-F6oSUeZ_.esm.js";import"../chunks/_share-dialog-dependencies-BonvNllt.esm.js";import"../chunks/vendor-DUOg5fL-.esm.js";import"../components/impact-overview.js";import"../chunks/share-button-C_qDR7Rw.esm.js";import"../chunks/responsive-aN8P5PqD.esm.js";export{O as showBeamOrderPageWidgets};
2
2
  //# sourceMappingURL=shopify-order.js.map
@@ -1,6 +1,6 @@
1
- export { B as BeamShopifyCartIntegrationConfig, a as addBeamAttributesToCart, b as appendBeamAttributesToCart, c as appendStatsigToShopifyCartAttributes, d as appendToShopifyCartBeamAttribute, g as getBeamAttributesForCart, e as getCurrentCart, f as getShopifyCart, r as registerCartIntegration, t as trackCart, u as unregisterCartIntegration } from '../chunks/cart-CKltrzQt.esm.js';
1
+ export { B as BeamShopifyCartIntegrationConfig, a as addBeamAttributesToCart, b as appendBeamAttributesToCart, c as appendStatsigToShopifyCartAttributes, d as appendToShopifyCartBeamAttribute, g as getBeamAttributesForCart, e as getCurrentCart, f as getShopifyCart, r as registerCartIntegration, t as trackCart, u as unregisterCartIntegration } from '../chunks/cart-DCezceUX.esm.js';
2
2
  import 'lodash';
3
- import '../chunks/utils-COGFpDER.esm.js';
3
+ import '../chunks/utils-BPcZ5h8J.esm.js';
4
4
  import 'lodash-es/debounce';
5
5
  import 'lodash-es/isEqual';
6
- import '../chunks/update-cart-DoJGAdoU.esm.js';
6
+ import '../chunks/update-cart-B5Tr9N3V.esm.js';
@@ -1,2 +1,2 @@
1
- import{J as p,g as C,n as m,x as n,y as g,L as u,T as b,e as d,r as A,a as T}from"../chunks/index-D6aFJ4cU.esm.js";import"../chunks/lodash-CrMU6wKg.esm.js";import"../chunks/utils-C5hmbxa4.esm.js";import"../chunks/index-Dm-K2MLY.esm.js";import"../chunks/lit-BEag9MFp.esm.js";import"../chunks/index-MAMeVd6l.esm.js";export{p as addBeamAttributesToCart,C as appendBeamAttributesToCart,m as appendStatsigToShopifyCartAttributes,n as appendToShopifyCartBeamAttribute,g as getBeamAttributesForCart,u as getCurrentCart,b as getShopifyCart,d as registerCartIntegration,A as trackCart,T as unregisterCartIntegration};
1
+ import{J as p,g as C,n as m,x as n,y as g,L as u,T as b,e as d,r as A,a as T}from"../chunks/index-BnbtpTg-.esm.js";import"../chunks/lodash-CrMU6wKg.esm.js";import"../chunks/utils-C5hmbxa4.esm.js";import"../chunks/index-BpR0FMss.esm.js";import"../chunks/lit-BEag9MFp.esm.js";import"../chunks/index-Ghl9JrXJ.esm.js";export{p as addBeamAttributesToCart,C as appendBeamAttributesToCart,m as appendStatsigToShopifyCartAttributes,n as appendToShopifyCartBeamAttribute,g as getBeamAttributesForCart,u as getCurrentCart,b as getShopifyCart,d as registerCartIntegration,A as trackCart,T as unregisterCartIntegration};
2
2
  //# sourceMappingURL=shopify.esm.js.map
@@ -1,2 +1,2 @@
1
- import{J as p,g as C,n as m,x as n,y as g,L as u,T as b,e as d,r as A,a as T}from"../chunks/index-D6aFJ4cU.esm.js";import"../chunks/lodash-CrMU6wKg.esm.js";import"../chunks/utils-C5hmbxa4.esm.js";import"../chunks/index-Dm-K2MLY.esm.js";import"../chunks/lit-BEag9MFp.esm.js";import"../chunks/index-MAMeVd6l.esm.js";export{p as addBeamAttributesToCart,C as appendBeamAttributesToCart,m as appendStatsigToShopifyCartAttributes,n as appendToShopifyCartBeamAttribute,g as getBeamAttributesForCart,u as getCurrentCart,b as getShopifyCart,d as registerCartIntegration,A as trackCart,T as unregisterCartIntegration};
1
+ import{J as p,g as C,n as m,x as n,y as g,L as u,T as b,e as d,r as A,a as T}from"../chunks/index-BnbtpTg-.esm.js";import"../chunks/lodash-CrMU6wKg.esm.js";import"../chunks/utils-C5hmbxa4.esm.js";import"../chunks/index-BpR0FMss.esm.js";import"../chunks/lit-BEag9MFp.esm.js";import"../chunks/index-Ghl9JrXJ.esm.js";export{p as addBeamAttributesToCart,C as appendBeamAttributesToCart,m as appendStatsigToShopifyCartAttributes,n as appendToShopifyCartBeamAttribute,g as getBeamAttributesForCart,u as getCurrentCart,b as getShopifyCart,d as registerCartIntegration,A as trackCart,T as unregisterCartIntegration};
2
2
  //# sourceMappingURL=shopify.js.map
@@ -1,5 +1,5 @@
1
1
  import { BeamPlugin, BeamConfigOptions } from './beam.js';
2
- import '../chunks/utils-COGFpDER.esm.js';
2
+ import '../chunks/utils-BPcZ5h8J.esm.js';
3
3
  import 'lodash-es/debounce';
4
4
  import 'lodash-es/isEqual';
5
5
 
@@ -1,4 +1,4 @@
1
- import{B as x,p as M}from"../chunks/index-Dm-K2MLY.esm.js";import{l as b,n as u,s as D,g as f,o as k,q as K,r as P,t as z,u as W,B as j}from"../chunks/utils-C5hmbxa4.esm.js";import"../chunks/lit-BEag9MFp.esm.js";import"../chunks/lodash-CrMU6wKg.esm.js";var y=t=>{throw TypeError(t)},E=(t,e,i)=>e.has(t)||y("Cannot "+i),d=(t,e,i)=>(E(t,e,"read from private field"),i?i.call(t):e.get(t)),p=(t,e,i)=>e.has(t)?y("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,i),C=(t,e,i,s)=>(E(t,e,"write to private field"),e.set(t,i),i),h=(t,e,i)=>(E(t,e,"access private method"),i),c,w,o,R,v,A,B,m,T,S,O,L;const U=4,F=`https://cdn.jsdelivr.net/npm/statsig-js@${U}/build/statsig-prod-web-sdk.min.js`,N=K.STATSIG_STABLE_ID,n="data-beam-visibility",G="beam-sync-visibility",g={STATSIG_INIT:"statsig_init",CART_CREATED:"cart_created",ORDER_CREATED:"order_created",BEAM_SELECTION:"beam_selection",SESSION_RETURN:"session_return"},V="beam_ssid",q="beam_return_origin";class H{constructor(e){p(this,o),this.name="statsig",this.experiments={shouldShowBeam:!1,isLoggingEnabled:!0,sessionReturnOrigin:null},p(this,c),p(this,w),p(this,m,[]),this.logEvent=(i,s,a={})=>{if(!this.statsig){d(this,m).push([i,s,a]);return}const r=this.experiments.shouldShowBeam,l=window.location.hostname,I=window.location.pathname,_=window.location.href;if(this.experiments.isLoggingEnabled){const $=this.beforeLogEvent?this.beforeLogEvent(i,s,a):a;this.statsig.logEvent(i,s,{...$,withBeam:r,domain:l,path:I,page:_})}b.debug(i,s,{...a,withBeam:r,domain:l,path:I,page:_})},this.statsigApiKey=e.statsigApiKey,this.beforeLogEvent=e.beforeLogEvent}async init(e){const{sessionReturnOrigin:i}=h(this,o,v).call(this);C(this,c,e),h(this,o,A).call(this),h(this,o,S).call(this,"hide"),i&&(this.sessionReturnOrigin=i);const s=document.createElement("style");if(s.innerHTML=`
1
+ import{B as k,p as K}from"../chunks/index-BpR0FMss.esm.js";import{l as S,n as b,s as P,g as y,o as z,q as U,r as W,t as j,u as q,B as F}from"../chunks/utils-C5hmbxa4.esm.js";import"../chunks/lit-BEag9MFp.esm.js";import"../chunks/lodash-CrMU6wKg.esm.js";var C=t=>{throw TypeError(t)},v=(t,e,i)=>e.has(t)||C("Cannot "+i),l=(t,e,i)=>(v(t,e,"read from private field"),i?i.call(t):e.get(t)),w=(t,e,i)=>e.has(t)?C("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,i),A=(t,e,i,s)=>(v(t,e,"write to private field"),e.set(t,i),i),d=(t,e,i)=>(v(t,e,"access private method"),i),c,E,o,B,f,R,T,g,O,_,L,N;const G=4,V=`https://cdn.jsdelivr.net/npm/statsig-js@${G}/build/statsig-prod-web-sdk.min.js`,$=U.STATSIG_STABLE_ID,n="data-beam-visibility",H="beam-sync-visibility",u={STATSIG_INIT:"statsig_init",CART_CREATED:"cart_created",ORDER_CREATED:"order_created",BEAM_SELECTION:"beam_selection",SESSION_RETURN:"session_return"},J="beam_ssid",Q="beam_return_origin";class Y{constructor(e){w(this,o),this.name="statsig",this.experiments={shouldShowBeam:!1,isLoggingEnabled:!0,sessionReturnOrigin:null},w(this,c),w(this,E),w(this,g,[]),this.logEvent=(i,s,a={})=>{if(!this.statsig){l(this,g).push([i,s,a]);return}const r=this.experiments.shouldShowBeam,h=window.location.hostname,p=window.location.pathname,m=window.location.href;if(this.experiments.isLoggingEnabled){const I=this.beforeLogEvent?this.beforeLogEvent(i,s,a):a;this.statsig.logEvent(i,s,{...I,withBeam:r,domain:h,path:p,page:m})}S.debug(i,s,{...a,withBeam:r,domain:h,path:p,page:m})},this.statsigApiKey=e.statsigApiKey,this.beforeLogEvent=e.beforeLogEvent}async init(e){const{sessionReturnOrigin:i}=d(this,o,f).call(this);A(this,c,e),d(this,o,R).call(this),d(this,o,_).call(this,"hide"),i&&(this.sessionReturnOrigin=i);const s=document.createElement("style");if(s.innerHTML=`
2
2
  [${n}="hide"] beam-select-nonprofit,
3
3
  [${n}="hide"] beam-post-purchase,
4
4
  [${n}="hide"] beam-redeem-transaction,
@@ -10,8 +10,8 @@ import{B as x,p as M}from"../chunks/index-Dm-K2MLY.esm.js";import{l as b,n as u,
10
10
  [${n}="hide"] beam-subscription-impact,
11
11
  [${n}="hide"] beam-select-subscription-nonprofit,
12
12
  [${n}="hide"] beam-social-share,
13
- [${n}="hide"] .${G} {
13
+ [${n}="hide"] .${H} {
14
14
  display: none;
15
15
  }
16
- `,document.head.append(s),await h(this,o,B).call(this),this.stableId=this.statsig.getStableID(),!this.stableId)throw new u("Statsig failed to assign stableId",{name:"StatsigInitError"});h(this,o,T).call(this),D({remoteSessionId:this.stableId,apiKey:e.apiKey}),C(this,w,f(x)),k({name:N,value:this.stableId,path:"/",domain:e.domain}),this.experiments={shouldShowBeam:this.statsig.getLayer("beam_trial_layer").get("show_beam",!1),isLoggingEnabled:this.statsig.getLayer("beam_trial_layer").get("enable_logging",!0),...this.sessionReturnOrigin!=null&&{sessionReturnOrigin:this.sessionReturnOrigin}},await Promise.all([h(this,o,O).call(this),h(this,o,L).call(this)]),h(this,o,S).call(this,this.experiments.shouldShowBeam?"show":"hide"),h(this,o,R).call(this),b.debug("Statsig Experiment Assignments",this.experiments)}}c=new WeakMap,w=new WeakMap,o=new WeakSet,R=function(){try{const t=new P({showBeam:this.experiments.shouldShowBeam,stableId:this.stableId});window.dispatchEvent(t)}catch(t){b.error("[BeamStatsigInitializedEvent] Failed to dispatch event:",t)}},v=function(){const t=new URLSearchParams(window.location.search),e=t.get(V),i=t.get(q);return{stableId:e,sessionReturnOrigin:i==="cart_abandon"||i==="checkout_abandon"?i:null}},A=function(){window.addEventListener(z.eventName,e=>{const i=e,{itemCount:s,cartId:a,subtotal:r,currencyCode:l}=i.detail;this.logEvent(g.CART_CREATED,!0,{itemCount:s,cartId:a,subtotal:r,currencyCode:l})}),window.addEventListener(W.eventName,e=>{const i=e,{orderId:s,cartTotal:a,currencyCode:r}=i.detail;this.logEvent(g.ORDER_CREATED,a,{orderId:s,cartTotal:a,currencyCode:r,hasCart:!!d(this,w)})});let t;window.addEventListener(j.eventName,e=>{const i=e,{selectedNonprofitId:s,selectionId:a,source:r}=i.detail;s!==t&&(this.logEvent(g.BEAM_SELECTION,!0,{nonprofitId:s,widget:r,selectionId:a}),t=s)})},B=async function(){const{stableId:t,sessionReturnOrigin:e}=h(this,o,v).call(this);t&&e&&this.logEvent(g.SESSION_RETURN,e,{session_return_origin:e,stable_id:t});const i=document.createElement("script");i.src=F,i.async=!1;const s=new Promise((r,l)=>{i.addEventListener("load",r),i.addEventListener("error",l)});document.head.append(i);try{await s}catch{throw new u("Failed to load Statsig script",{name:"StatsigInitError"})}if(this.statsig=window.statsig,!this.statsig)throw new u("Failed to detect Statsig",{name:"StatsigInitError"});const a={disableErrorLogging:!0,disableAutoMetricsLogging:!0,disableCurrentPageLogging:!0,loggingIntervalMillis:1e3,loggingBufferMaxSize:2,overrideStableID:t??f(N)??null};await this.statsig.initialize(this.statsigApiKey,{},a)},m=new WeakMap,T=function(){for(;d(this,m).length>0;){const t=d(this,m).shift();t&&this.logEvent(...t)}},S=function(t){document.body.setAttribute(n,t)},O=async function(){const t="https://events.statsigapi.net/v1/log_event";try{await fetch(t,{method:"POST",headers:{"content-type":"application/json","statsig-api-key":this.statsigApiKey},body:JSON.stringify({eventName:g.STATSIG_INIT,value:"true",time:new Date().getTime()/1e3,metadata:{show_beam:this.experiments.shouldShowBeam.toString(),domain:window.location.hostname,path:window.location.pathname,page:window.location.href},user:{userID:this.stableId}})})}catch(e){throw new u("Could not call Statsig API",{name:"StatsigInitError",cause:e})}},L=async function(){return M({baseUrl:d(this,c)?.baseUrl,headers:{authorization:`Api-Key ${d(this,c)?.apiKey}`},requestBody:{remoteSessionId:this.stableId,storeId:d(this,c)?.storeId,experiments:{showBeam:this.experiments.shouldShowBeam,...this.sessionReturnOrigin!=null&&{events:[{eventName:"session_return",eventValue:this.sessionReturnOrigin,timestamp:new Date().toISOString()}]}}}})};export{H as StatsigPlugin};
16
+ `,document.head.append(s),await d(this,o,T).call(this),this.stableId=this.statsig.getStableID(),!this.stableId)throw new b("Statsig failed to assign stableId",{name:"StatsigInitError"});d(this,o,O).call(this),P({remoteSessionId:this.stableId,apiKey:e.apiKey}),A(this,E,y(k)),z({name:$,value:this.stableId,path:"/",domain:e.domain}),this.experiments={shouldShowBeam:this.statsig.getLayer("beam_trial_layer").get("show_beam",!1),isLoggingEnabled:this.statsig.getLayer("beam_trial_layer").get("enable_logging",!0),...this.sessionReturnOrigin!=null&&{sessionReturnOrigin:this.sessionReturnOrigin}},await Promise.all([d(this,o,L).call(this),d(this,o,N).call(this)]),d(this,o,_).call(this,this.experiments.shouldShowBeam?"show":"hide"),d(this,o,B).call(this),S.debug("Statsig Experiment Assignments",this.experiments)}}c=new WeakMap,E=new WeakMap,o=new WeakSet,B=function(){try{const t=new W({showBeam:this.experiments.shouldShowBeam,stableId:this.stableId});window.dispatchEvent(t)}catch(t){S.error("[BeamStatsigInitializedEvent] Failed to dispatch event:",t)}},f=function(){const t=new URLSearchParams(window.location.search),e=t.get(J),i=t.get(Q);return{stableId:e,sessionReturnOrigin:i==="cart_abandon"||i==="checkout_abandon"?i:null}},R=function(){window.addEventListener(j.eventName,e=>{const i=e,{itemCount:s,cartId:a,subtotal:r,currencyCode:h}=i.detail;this.logEvent(u.CART_CREATED,!0,{itemCount:s,cartId:a,subtotal:r,currencyCode:h})}),window.addEventListener(q.eventName,e=>{const i=e,{orderId:s,cartTotal:a,currencyCode:r,cartId:h,selectionId:p,beamCartId:m,storeId:I,remoteSessionId:x,transactionNonprofitId:M,orderProcessedAt:D}=i.detail;this.logEvent(u.ORDER_CREATED,a,{orderId:s,cartTotal:a,currencyCode:r,hasCart:!!m||!!l(this,E),selectionId:p,storeId:I,cartId:h,beamCartId:m,remoteSessionId:x,transactionNonprofitId:M,orderProcessedAt:D})});let t;window.addEventListener(F.eventName,e=>{const i=e,{selectedNonprofitId:s,selectionId:a,source:r}=i.detail;s!==t&&(this.logEvent(u.BEAM_SELECTION,!0,{nonprofitId:s,widget:r,selectionId:a}),t=s)})},T=async function(){const{stableId:t,sessionReturnOrigin:e}=d(this,o,f).call(this);t&&e&&this.logEvent(u.SESSION_RETURN,e,{session_return_origin:e,stable_id:t});const i=document.createElement("script");i.src=V,i.async=!1;const s=new Promise((r,h)=>{i.addEventListener("load",r),i.addEventListener("error",h)});document.head.append(i);try{await s}catch{throw new b("Failed to load Statsig script",{name:"StatsigInitError"})}if(this.statsig=window.statsig,!this.statsig)throw new b("Failed to detect Statsig",{name:"StatsigInitError"});const a={disableErrorLogging:!0,disableAutoMetricsLogging:!0,disableCurrentPageLogging:!0,loggingIntervalMillis:1e3,loggingBufferMaxSize:2,overrideStableID:t??y($)??null};await this.statsig.initialize(this.statsigApiKey,{},a)},g=new WeakMap,O=function(){for(;l(this,g).length>0;){const t=l(this,g).shift();t&&this.logEvent(...t)}},_=function(t){document.body.setAttribute(n,t)},L=async function(){const t="https://events.statsigapi.net/v1/log_event";try{await fetch(t,{method:"POST",headers:{"content-type":"application/json","statsig-api-key":this.statsigApiKey},body:JSON.stringify({eventName:u.STATSIG_INIT,value:"true",time:new Date().getTime()/1e3,metadata:{show_beam:this.experiments.shouldShowBeam.toString(),domain:window.location.hostname,path:window.location.pathname,page:window.location.href},user:{userID:this.stableId}})})}catch(e){throw new b("Could not call Statsig API",{name:"StatsigInitError",cause:e})}},N=async function(){return K({baseUrl:l(this,c)?.baseUrl,headers:{authorization:`Api-Key ${l(this,c)?.apiKey}`},requestBody:{remoteSessionId:this.stableId,storeId:l(this,c)?.storeId,experiments:{showBeam:this.experiments.shouldShowBeam,...this.sessionReturnOrigin!=null&&{events:[{eventName:"session_return",eventValue:this.sessionReturnOrigin,timestamp:new Date().toISOString()}]}}}})};export{Y as StatsigPlugin};
17
17
  //# sourceMappingURL=statsig.esm.js.map