@beamimpact/web-sdk 1.52.5 → 1.52.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. package/dist/chunks/{_share-dialog-dependencies-BvevL0CH.esm.js → _share-dialog-dependencies-Cry6mcdg.esm.js} +2 -2
  2. package/dist/chunks/{_share-dialog-dependencies-BvevL0CH.esm.js.map → _share-dialog-dependencies-Cry6mcdg.esm.js.map} +1 -1
  3. package/dist/chunks/{_share-dialog-dependencies-Dt4WMt_y.esm.js → _share-dialog-dependencies-DSYemenF.esm.js} +2 -2
  4. package/dist/chunks/{_share-dialog-dependencies-Dt4WMt_y.esm.js.map → _share-dialog-dependencies-DSYemenF.esm.js.map} +1 -1
  5. package/dist/chunks/{index-CWZ6mszB.esm.js → index--lGfTDwX.esm.js} +2 -2
  6. package/dist/chunks/{index-CWZ6mszB.esm.js.map → index--lGfTDwX.esm.js.map} +1 -1
  7. package/dist/chunks/index-1hlAGQPk.esm.js +2 -0
  8. package/dist/chunks/index-1hlAGQPk.esm.js.map +1 -0
  9. package/dist/chunks/{index-DhtZDPvk.esm.js → index-AEnQH-so.esm.js} +2 -2
  10. package/dist/chunks/index-AEnQH-so.esm.js.map +1 -0
  11. package/dist/chunks/{index-DVOp4ShL.esm.js → index-B-uw46_j.esm.js} +2 -2
  12. package/dist/chunks/{index-DVOp4ShL.esm.js.map → index-B-uw46_j.esm.js.map} +1 -1
  13. package/dist/chunks/{index-BZlgN66e.esm.js → index-BTYU0dxk.esm.js} +2 -2
  14. package/dist/chunks/index-BTYU0dxk.esm.js.map +1 -0
  15. package/dist/chunks/{index-C-beNpP0.esm.js → index-CtYbieoH.esm.js} +2 -2
  16. package/dist/chunks/index-CtYbieoH.esm.js.map +1 -0
  17. package/dist/chunks/index-D2Ox_xyE.esm.js +2 -0
  18. package/dist/chunks/index-D2Ox_xyE.esm.js.map +1 -0
  19. package/dist/chunks/{index-BlE3m0uQ.esm.js → index-D8jCSss3.esm.js} +2 -2
  20. package/dist/chunks/index-D8jCSss3.esm.js.map +1 -0
  21. package/dist/chunks/index-DE2QManY.esm.js +2 -0
  22. package/dist/chunks/index-DE2QManY.esm.js.map +1 -0
  23. package/dist/chunks/{index-GcpuX_TZ.esm.js → index-DhhPQ773.esm.js} +2 -2
  24. package/dist/chunks/index-DhhPQ773.esm.js.map +1 -0
  25. package/dist/chunks/{index-CbWdmBet.esm.js → index-DtfQd6C4.esm.js} +2 -2
  26. package/dist/chunks/index-DtfQd6C4.esm.js.map +1 -0
  27. package/dist/chunks/index-GmNTlVv2.esm.js +2 -0
  28. package/dist/chunks/index-GmNTlVv2.esm.js.map +1 -0
  29. package/dist/chunks/{lodash-7H4x2457.esm.js → lodash-D3TLHRR_.esm.js} +2 -2
  30. package/dist/chunks/lodash-D3TLHRR_.esm.js.map +1 -0
  31. package/dist/chunks/{order-page-DrOzbzU8.esm.js → order-page-BRpixGl8.esm.js} +2 -2
  32. package/dist/chunks/{order-page-DrOzbzU8.esm.js.map → order-page-BRpixGl8.esm.js.map} +1 -1
  33. package/dist/chunks/{order-page-D5xI18DI.esm.js → order-page-CW5aw6Kh.esm.js} +2 -2
  34. package/dist/chunks/{order-page-D5xI18DI.esm.js.map → order-page-CW5aw6Kh.esm.js.map} +1 -1
  35. package/dist/chunks/{routes-S0vKQTft.esm.js → routes-D-AQPRne.esm.js} +2 -2
  36. package/dist/chunks/{routes-S0vKQTft.esm.js.map → routes-D-AQPRne.esm.js.map} +1 -1
  37. package/dist/chunks/{routes-TtLdALcf.esm.js → routes-Lvj2SXN4.esm.js} +2 -2
  38. package/dist/chunks/{routes-TtLdALcf.esm.js.map → routes-Lvj2SXN4.esm.js.map} +1 -1
  39. package/dist/chunks/{share-button-Ck4hnQPC.esm.js → share-button-Bj6RA_H6.esm.js} +2 -2
  40. package/dist/chunks/{share-button-Ck4hnQPC.esm.js.map → share-button-Bj6RA_H6.esm.js.map} +1 -1
  41. package/dist/chunks/{share-button-Cq3aCOGt.esm.js → share-button-DNgyupow.esm.js} +2 -2
  42. package/dist/chunks/{share-button-Cq3aCOGt.esm.js.map → share-button-DNgyupow.esm.js.map} +1 -1
  43. package/dist/chunks/{share-button-DBLPdobK.esm.js → share-button-DUn-zC5t.esm.js} +2 -2
  44. package/dist/chunks/{share-button-DBLPdobK.esm.js.map → share-button-DUn-zC5t.esm.js.map} +1 -1
  45. package/dist/chunks/{share-button-P726e8AH.esm.js → share-button-XJxSyBaT.esm.js} +2 -2
  46. package/dist/chunks/{share-button-P726e8AH.esm.js.map → share-button-XJxSyBaT.esm.js.map} +1 -1
  47. package/dist/chunks/{update-cart-DMO5uiQX.esm.js → update-cart-Kt4NGuYW.esm.js} +2 -2
  48. package/dist/chunks/{update-cart-DMO5uiQX.esm.js.map → update-cart-Kt4NGuYW.esm.js.map} +1 -1
  49. package/dist/chunks/{update-cart-g_YbHKJQ.esm.js → update-cart-y9guItUM.esm.js} +2 -2
  50. package/dist/chunks/{update-cart-g_YbHKJQ.esm.js.map → update-cart-y9guItUM.esm.js.map} +1 -1
  51. package/dist/components/community-impact.esm.js +1 -1
  52. package/dist/components/community-impact.js +1 -1
  53. package/dist/components/cumulative-impact.esm.js +1 -1
  54. package/dist/components/cumulative-impact.js +1 -1
  55. package/dist/components/impact-overview.esm.js +3 -3
  56. package/dist/components/impact-overview.esm.js.map +1 -1
  57. package/dist/components/impact-overview.js +3 -3
  58. package/dist/components/impact-overview.js.map +1 -1
  59. package/dist/components/index.esm.js +1 -1
  60. package/dist/components/index.js +1 -1
  61. package/dist/components/post-purchase.esm.js +1 -1
  62. package/dist/components/post-purchase.js +1 -1
  63. package/dist/components/product-details-page.esm.js +15 -15
  64. package/dist/components/product-details-page.esm.js.map +1 -1
  65. package/dist/components/product-details-page.js +15 -15
  66. package/dist/components/product-details-page.js.map +1 -1
  67. package/dist/components/redeem-transaction.esm.js +1 -1
  68. package/dist/components/redeem-transaction.js +1 -1
  69. package/dist/components/select-nonprofit.esm.js +2 -2
  70. package/dist/components/select-nonprofit.esm.js.map +1 -1
  71. package/dist/components/select-nonprofit.js +2 -2
  72. package/dist/components/select-nonprofit.js.map +1 -1
  73. package/dist/components/select-subscription-nonprofit.esm.js +1 -1
  74. package/dist/components/select-subscription-nonprofit.js +1 -1
  75. package/dist/components/shopify.esm.js +1 -1
  76. package/dist/components/shopify.js +1 -1
  77. package/dist/components/social-share.esm.js +1 -1
  78. package/dist/components/social-share.js +1 -1
  79. package/dist/components/subscription-impact.esm.js +6 -6
  80. package/dist/components/subscription-impact.esm.js.map +1 -1
  81. package/dist/components/subscription-impact.js +6 -6
  82. package/dist/components/subscription-impact.js.map +1 -1
  83. package/dist/components/subscription-management.esm.js +1 -1
  84. package/dist/components/subscription-management.js +1 -1
  85. package/dist/index.esm.js +1 -1
  86. package/dist/index.js +1 -1
  87. package/dist/integrations/beam.esm.js +1 -1
  88. package/dist/integrations/beam.js +1 -1
  89. package/dist/integrations/cart.esm.js +1 -1
  90. package/dist/integrations/cart.js +1 -1
  91. package/dist/integrations/index.esm.js +1 -1
  92. package/dist/integrations/index.js +1 -1
  93. package/dist/integrations/logs.esm.js +1 -1
  94. package/dist/integrations/logs.js +1 -1
  95. package/dist/integrations/shopify.esm.js +1 -1
  96. package/dist/integrations/shopify.js +1 -1
  97. package/dist/integrations/statsig.esm.js +1 -1
  98. package/dist/integrations/statsig.js +1 -1
  99. package/dist/integrations/utils.esm.js +1 -1
  100. package/dist/integrations/utils.js +1 -1
  101. package/dist/react/community-impact.esm.js +1 -1
  102. package/dist/react/community-impact.js +1 -1
  103. package/dist/react/cumulative-impact.esm.js +1 -1
  104. package/dist/react/cumulative-impact.js +1 -1
  105. package/dist/react/impact-overview.esm.js +1 -1
  106. package/dist/react/impact-overview.js +1 -1
  107. package/dist/react/index.esm.js +1 -1
  108. package/dist/react/index.js +1 -1
  109. package/dist/react/post-purchase.esm.js +1 -1
  110. package/dist/react/post-purchase.js +1 -1
  111. package/dist/react/product-details-page.esm.js +1 -1
  112. package/dist/react/product-details-page.js +1 -1
  113. package/dist/react/redeem-transaction.esm.js +1 -1
  114. package/dist/react/redeem-transaction.js +1 -1
  115. package/dist/react/select-nonprofit.esm.js +1 -1
  116. package/dist/react/select-nonprofit.js +1 -1
  117. package/dist/react/select-subscription-nonprofit.esm.js +1 -1
  118. package/dist/react/select-subscription-nonprofit.js +1 -1
  119. package/dist/react/social-share.esm.js +1 -1
  120. package/dist/react/social-share.js +1 -1
  121. package/dist/react/subscription-impact.esm.js +1 -1
  122. package/dist/react/subscription-impact.js +1 -1
  123. package/dist/react/subscription-management.esm.js +1 -1
  124. package/dist/react/subscription-management.js +1 -1
  125. package/dist/utils/debounce.esm.js +1 -1
  126. package/dist/utils/debounce.js +1 -1
  127. package/dist/utils/index.esm.js +1 -1
  128. package/dist/utils/index.js +1 -1
  129. package/dist/utils/is-equal.esm.js +1 -1
  130. package/dist/utils/is-equal.js +1 -1
  131. package/dist/utils/memoize-last.esm.js +1 -1
  132. package/dist/utils/memoize-last.js +1 -1
  133. package/package.json +1 -1
  134. package/dist/chunks/index-BYnzONl8.esm.js +0 -2
  135. package/dist/chunks/index-BYnzONl8.esm.js.map +0 -1
  136. package/dist/chunks/index-BZlgN66e.esm.js.map +0 -1
  137. package/dist/chunks/index-BlE3m0uQ.esm.js.map +0 -1
  138. package/dist/chunks/index-C-beNpP0.esm.js.map +0 -1
  139. package/dist/chunks/index-CNPuQxhN.esm.js +0 -2
  140. package/dist/chunks/index-CNPuQxhN.esm.js.map +0 -1
  141. package/dist/chunks/index-CbWdmBet.esm.js.map +0 -1
  142. package/dist/chunks/index-DMbz_yfr.esm.js +0 -2
  143. package/dist/chunks/index-DMbz_yfr.esm.js.map +0 -1
  144. package/dist/chunks/index-DhtZDPvk.esm.js.map +0 -1
  145. package/dist/chunks/index-DtPf9NaI.esm.js +0 -2
  146. package/dist/chunks/index-DtPf9NaI.esm.js.map +0 -1
  147. package/dist/chunks/index-GcpuX_TZ.esm.js.map +0 -1
  148. package/dist/chunks/lodash-7H4x2457.esm.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import{i as y}from"./is-all-html-elements-fcB7UUA1.esm.js";import{h as x,y as d,Z as v,g as s}from"./lit-WqMxC_PA.esm.js";import{p as m,u as p,s as r}from"./share-button-Ck4hnQPC.esm.js";import{D as S}from"./routes-S0vKQTft.esm.js";import"./vendor-KKSARHWL.esm.js";const I=(l,{source:e="contentLength"}={})=>{const a=l instanceof NodeList?Array.from(l):l;if(a.length===0||!y(a))return;const i=(e==="contentLength"?a.sort((t,o)=>o.innerText.length-t.innerText.length)[0]:a.sort((t,o)=>o.clientHeight-t.clientHeight)[0])?.clientHeight||0;for(const t of a)t.clientHeight!==i&&(t.style.height=i+"px")};function w(){return/Android|iPhone/i.test(navigator.userAgent)}var C=Object.defineProperty,h=(l,e,a,i)=>{for(var t=void 0,o=l.length-1,c;o>=0;o--)(c=l[o])&&(t=c(e,a,t)||t);return t&&C(e,a,t),t};class n extends x{constructor(){super(...arguments),this.shareIcon=null,this.imageUrl=null,this.brandName=null,this.buttonText=null,this.configLang="en",this.baseUrl=S,this.nonprofitId=null,this.storeId=null,this.transactionId=null}connectedCallback(){super.connectedCallback()}async handleShareClick(){try{if(!this.imageUrl||!this.brandName||!this.configLang)return;await import("./_share-dialog-dependencies-Dt4WMt_y.esm.js");const{nonprofitId:e,storeId:a,transactionId:i,baseUrl:t,apiKey:o}=this;m({baseUrl:t,apiKey:o,requestBody:{eventName:"shareImageButtonClick",nonprofitId:e,storeId:a,timestamp:Date.now(),transactionId:i}}).catch(()=>null),w()?this.openSystemShareSheet(this.imageUrl):this.handleShareDialog(this.imageUrl,this.brandName)}catch(e){console.error("Error sharing impact:",e)}}async handleShareDialog(e,a){if(!e)return;const i=this.shadowRoot?.querySelector("sl-dialog");if(i){i.show();return}await import("./_share-dialog-dependencies-Dt4WMt_y.esm.js");const t=this.shadowRoot?.querySelector("#modal-root"),o=await p(e),c=URL.createObjectURL(o),b=()=>{this.shadowRoot?.querySelector("sl-dialog")?.hide()},g=async()=>{m({baseUrl:this.baseUrl,apiKey:this.apiKey,requestBody:{eventName:"copyImageButtonClick",nonprofitId:this.nonprofitId,storeId:this.storeId,timestamp:Date.now(),transactionId:this.transactionId}}).catch(()=>null),await navigator.clipboard.write([new ClipboardItem({"image/png":o})]),setTimeout(b,250)},u=()=>{m({baseUrl:this.baseUrl,apiKey:this.apiKey,requestBody:{eventName:"downloadImageButtonClick",nonprofitId:this.nonprofitId,storeId:this.storeId,timestamp:Date.now(),transactionId:this.transactionId}}).catch(()=>null),setTimeout(b,250)},f=d`
1
+ import{i as y}from"./is-all-html-elements-fcB7UUA1.esm.js";import{h as x,y as d,Z as v,g as s}from"./lit-WqMxC_PA.esm.js";import{p as m,u as p,s as r}from"./share-button-DUn-zC5t.esm.js";import{D as S}from"./routes-Lvj2SXN4.esm.js";import"./vendor-KKSARHWL.esm.js";const I=(l,{source:e="contentLength"}={})=>{const a=l instanceof NodeList?Array.from(l):l;if(a.length===0||!y(a))return;const i=(e==="contentLength"?a.sort((t,o)=>o.innerText.length-t.innerText.length)[0]:a.sort((t,o)=>o.clientHeight-t.clientHeight)[0])?.clientHeight||0;for(const t of a)t.clientHeight!==i&&(t.style.height=i+"px")};function w(){return/Android|iPhone/i.test(navigator.userAgent)}var C=Object.defineProperty,h=(l,e,a,i)=>{for(var t=void 0,o=l.length-1,c;o>=0;o--)(c=l[o])&&(t=c(e,a,t)||t);return t&&C(e,a,t),t};class n extends x{constructor(){super(...arguments),this.shareIcon=null,this.imageUrl=null,this.brandName=null,this.buttonText=null,this.configLang="en",this.baseUrl=S,this.nonprofitId=null,this.storeId=null,this.transactionId=null}connectedCallback(){super.connectedCallback()}async handleShareClick(){try{if(!this.imageUrl||!this.brandName||!this.configLang)return;await import("./_share-dialog-dependencies-Cry6mcdg.esm.js");const{nonprofitId:e,storeId:a,transactionId:i,baseUrl:t,apiKey:o}=this;m({baseUrl:t,apiKey:o,requestBody:{eventName:"shareImageButtonClick",nonprofitId:e,storeId:a,timestamp:Date.now(),transactionId:i}}).catch(()=>null),w()?this.openSystemShareSheet(this.imageUrl):this.handleShareDialog(this.imageUrl,this.brandName)}catch(e){console.error("Error sharing impact:",e)}}async handleShareDialog(e,a){if(!e)return;const i=this.shadowRoot?.querySelector("sl-dialog");if(i){i.show();return}await import("./_share-dialog-dependencies-Cry6mcdg.esm.js");const t=this.shadowRoot?.querySelector("#modal-root"),o=await p(e),c=URL.createObjectURL(o),b=()=>{this.shadowRoot?.querySelector("sl-dialog")?.hide()},g=async()=>{m({baseUrl:this.baseUrl,apiKey:this.apiKey,requestBody:{eventName:"copyImageButtonClick",nonprofitId:this.nonprofitId,storeId:this.storeId,timestamp:Date.now(),transactionId:this.transactionId}}).catch(()=>null),await navigator.clipboard.write([new ClipboardItem({"image/png":o})]),setTimeout(b,250)},u=()=>{m({baseUrl:this.baseUrl,apiKey:this.apiKey,requestBody:{eventName:"downloadImageButtonClick",nonprofitId:this.nonprofitId,storeId:this.storeId,timestamp:Date.now(),transactionId:this.transactionId}}).catch(()=>null),setTimeout(b,250)},f=d`
2
2
  <style>
3
3
  .plain-button {
4
4
  border: none;
@@ -164,4 +164,4 @@ import{i as y}from"./is-all-html-elements-fcB7UUA1.esm.js";import{h as x,y as d,
164
164
  </button>
165
165
  <div id="modal-root"></div>
166
166
  `}}h([s({type:String})],n.prototype,"shareIcon"),h([s({type:String})],n.prototype,"imageUrl"),h([s({type:String})],n.prototype,"brandName"),h([s({type:String})],n.prototype,"buttonText"),h([s({type:String})],n.prototype,"configLang"),h([s({type:String})],n.prototype,"baseUrl"),h([s({type:String})],n.prototype,"nonprofitId"),h([s({type:String})],n.prototype,"storeId"),h([s({type:String})],n.prototype,"transactionId"),h([s({type:String})],n.prototype,"apiKey"),customElements.get("beam-share-button")||customElements.define("beam-share-button",n);const k={"--beam-share-button-fontFamily":"inherit","--beam-share-button-fontSize":"14px","--beam-share-button-fontWeight":"600","--beam-share-button-textTransform":"none","--beam-share-button-marginTop":"10px","--beam-share-button-marginBottom":"10px","--beam-share-button-padding":"8px 18px 8px 16px","--beam-share-button-lineHeight":"inherit","--beam-share-button-color":"#0A323C","--beam-share-button-backgroundColor":"#fff","--beam-share-button-borderRadius":"30px","--beam-share-button-borderColor":"#0A323C","--beam-share-button-borderWidth":"1px","--beam-share-button-width":"auto","--beam-share-button-hover-borderColor":"transparent","--beam-share-button-hover-backgroundColor":"#0A323C","--beam-share-button-hover-color":"#fff","--beam-share-button-icon-size":"16px","--beam-share-button-text-textDecoration":"none","--beam-share-dialog-padding":"30px 30px","--beam-share-title-fontSize":"30px","--beam-share-title-fontWeight":"bold","--beam-share-text-fontSize":"16px","--beam-share-text-lineHeight":"1.3","--beam-share-text-marginTop":"10px","--beam-share-image-borderRadius":"4px","--beam-share-image-width":"200px","--beam-share-image-margin":"20px","--beam-share-actions-margin":"30px 60px","--beam-share-action-icon-size":"32px","--beam-share-action-text-fontSize":"16px","--beam-share-action-text-lineHeight":"1.3","--beam-share-text-action-marginTop":"10px","--beam-share-close-backgroundColor":"#ffd522","--beam-share-close-text-color":"#000","--beam-share-close-padding":"12px","--beam-share-close-borderRadius":"4px","--beam-share-close-fontSize":"16px","--beam-share-close-fontWeight":"bold","--beam-share-close-focus-borderColor":"#c2dcff"};export{k as a,I as s};
167
- //# sourceMappingURL=share-button-P726e8AH.esm.js.map
167
+ //# sourceMappingURL=share-button-XJxSyBaT.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"share-button-P726e8AH.esm.js","sources":["../../src/shared/sync-element-heights.ts","../../src/shared/feature-detection.ts","../../src/shared/components/share-button.ts"],"sourcesContent":["import { isAllHtmlElements } from \"./is-all-html-elements\";\n\n/**\n * Synchronize heights of elements\n * @param {Array<HTMLElement|null>} elements - Elements to synchronize\n * @param {'contentLength' | 'currentHeight'} [options.source='contentLength'] -\n * Method used to get the height value to sync across elements. `contentLength`\n * (innerText.length) is reliable for pure text content when responding to\n * window resizing. Otherwise, currentHeight can be used to sync the tallest\n * element's height to all the other elements. Note that this works poorly\n * unless content is allowed to reflow with explicit height attributes removed\n * between synchronization calls.\n */\nexport const syncElementHeights = (\n elements: Array<HTMLElement | null> | NodeList,\n {\n source = \"contentLength\",\n }: {\n source?: \"contentLength\" | \"currentHeight\";\n } = {}\n) => {\n const els = elements instanceof NodeList ? Array.from(elements) : elements;\n\n if (els.length === 0 || !isAllHtmlElements(els)) {\n return;\n }\n\n const heightSource =\n source === \"contentLength\"\n ? els.sort((a, b) => {\n return b.innerText.length - a.innerText.length;\n })[0]\n : els.sort((a, b) => {\n return b.clientHeight - a.clientHeight;\n })[0];\n\n const syncedHeight = heightSource?.clientHeight || 0;\n\n for (const el of els) {\n if (el.clientHeight !== syncedHeight) {\n el.style[\"height\"] = syncedHeight + \"px\";\n }\n }\n};\n","export function isMobile() {\n return /Android|iPhone/i.test(navigator.userAgent);\n}\n\nexport function hasSystemShare() {\n return !!navigator.share;\n}\n","import { LitElement, html, render } from \"lit\";\nimport { property } from \"lit/decorators/property.js\";\nimport { postSocialShareAnalyticsEvent } from \"../../api-sdk/v2/users/events\";\nimport { DEFAULT_BASE_URL } from \"../../api-sdk/constants\";\nimport \"@shoelace-style/shoelace/dist/components/icon/icon.js\";\nimport { LANGUAGES } from \"../../api-sdk/types\";\nimport { urlToFile } from \"../files\";\nimport { isMobile } from \"../feature-detection\";\nimport { strings } from \"./strings/share-button\";\n\ninterface SlDialogElement extends HTMLElement {\n show: () => void;\n hide: () => void;\n}\n\nexport class BeamShareButton extends LitElement {\n @property({ type: String }) shareIcon: string | null = null;\n @property({ type: String }) imageUrl?: string | null = null;\n @property({ type: String }) brandName: string | null = null;\n @property({ type: String }) buttonText?: string | null = null;\n @property({ type: String }) configLang: LANGUAGES = \"en\";\n @property({ type: String }) baseUrl: string = DEFAULT_BASE_URL;\n @property({ type: String }) nonprofitId?: number | null = null;\n @property({ type: String }) storeId?: number | null = null;\n @property({ type: String }) transactionId?: number | null = null;\n @property({ type: String }) apiKey!: string;\n\n connectedCallback() {\n super.connectedCallback();\n }\n\n async handleShareClick() {\n try {\n if (!this.imageUrl || !this.brandName || !this.configLang) return;\n await import(\"./_share-dialog-dependencies.js\");\n\n const { nonprofitId, storeId, transactionId, baseUrl, apiKey } = this;\n void postSocialShareAnalyticsEvent({\n baseUrl,\n apiKey,\n requestBody: { eventName: \"shareImageButtonClick\", nonprofitId, storeId, timestamp: Date.now(), transactionId },\n }).catch(() => null);\n\n if (isMobile()) {\n this.openSystemShareSheet(this.imageUrl);\n } else {\n this.handleShareDialog(this.imageUrl, this.brandName);\n }\n } catch (err) {\n console.error(\"Error sharing impact:\", err);\n }\n }\n\n async handleShareDialog(imageUrl: string, brandName: string) {\n if (!imageUrl) return;\n\n const existingDialog = this.shadowRoot?.querySelector(\"sl-dialog\") as SlDialogElement;\n\n if (existingDialog) {\n existingDialog.show();\n return;\n }\n\n await import(\"./_share-dialog-dependencies.js\"); // Import libraries async to reduce bundle size if share feature is unused\n\n const modalRoot = this.shadowRoot?.querySelector(\"#modal-root\") as HTMLElement;\n\n const file = await urlToFile(imageUrl);\n\n const dataUrl = URL.createObjectURL(file);\n\n const handleClickClose = () => {\n (this.shadowRoot?.querySelector(\"sl-dialog\") as SlDialogElement)?.hide();\n };\n\n const handleClickCopy = async () => {\n void postSocialShareAnalyticsEvent({\n baseUrl: this.baseUrl,\n apiKey: this.apiKey,\n requestBody: {\n eventName: \"copyImageButtonClick\",\n nonprofitId: this.nonprofitId,\n storeId: this.storeId,\n timestamp: Date.now(),\n transactionId: this.transactionId,\n },\n }).catch(() => null);\n await navigator.clipboard.write([new ClipboardItem({ \"image/png\": file })]);\n setTimeout(handleClickClose, 250);\n };\n\n const handleClickDownload = () => {\n void postSocialShareAnalyticsEvent({\n baseUrl: this.baseUrl,\n apiKey: this.apiKey,\n requestBody: {\n eventName: \"downloadImageButtonClick\",\n nonprofitId: this.nonprofitId,\n storeId: this.storeId,\n timestamp: Date.now(),\n transactionId: this.transactionId,\n },\n }).catch(() => null);\n setTimeout(handleClickClose, 250);\n };\n\n const dialogTemplate = html`\n <style>\n .plain-button {\n border: none;\n background: none;\n font-size: inherit;\n font-family: inherit;\n }\n .share-dialog::part(panel) {\n padding: var(--beam-share-dialog-padding);\n text-align: center;\n }\n .share-title {\n font-size: var(--beam-share-title-fontSize);\n font-weight: var(--beam-share-title-fontWeight);\n }\n .share-text {\n font-size: var(--beam-share-text-fontSize);\n line-height: var(--beam-share-text-lineHeight);\n margin-top: var(--beam-share-text-marginTop);\n }\n .share-image {\n border-radius: var(--beam-share-image-borderRadius);\n width: var(--beam-share-image-width);\n display: block;\n margin: var(--beam-share-image-margin) auto;\n }\n .share-actions {\n margin: var(--beam-share-actions-margin);\n }\n .share-action-button {\n display: inline-flex;\n justify-content: center;\n align-items: center;\n flex-direction: column;\n padding: 5px;\n }\n .share-action-icon {\n font-size: var(--beam-share-action-icon-size);\n }\n .share-action-button:hover .share-action-icon {\n scale: 1.1;\n }\n .share-action-text {\n font-size: var(--beam-share-action-text-fontSize);\n line-height: var(--beam-share-action-text-lineHeight);\n margin-top: var(--beam-share-text-action-marginTop);\n }\n .plain-button {\n border: none;\n background: none;\n font-size: inherit;\n font-family: inherit;\n }\n .plain-link {\n text-decoration: none;\n color: inherit;\n }\n .share-close {\n display: block;\n background-color: var(--beam-share-close-backgroundColor);\n color: var(--beam-share-close-text-color);\n justify-content: center;\n padding: var(--beam-share-close-padding);\n border-radius: var(--beam-share-close-borderRadius);\n width: 100%;\n font-size: var(--beam-share-close-fontSize);\n font-weight: var(--beam-share-close-fontWeight);\n }\n .share-close:hover {\n outline: 2px solid var(--beam-share-close-focus-borderColor);\n }\n </style>\n <sl-dialog open label=\"${strings[this.configLang].impactShareTitle()}\" no-header class=\"share-dialog\">\n <h2 class=\"share-title\">${strings[this.configLang].impactShareTitle()}</h2>\n <p class=\"share-text\">${strings[this.configLang].impactShareText({ brandName })}</p>\n <img src=\"${imageUrl}\" alt=\"${strings[this.configLang].impactShareTitle()}\" class=\"share-image\" />\n <div class=\"share-actions\" style=\"display: flex; justify-content: space-evenly\">\n <div style=\"flex: 1; text-align: center\">\n <button class=\"plain-button button share-action-button\" @click=\"${handleClickCopy}\">\n <sl-icon\n library=\"lucide\"\n name=\"copy\"\n label=\"${strings[this.configLang].impactShareCopy()}\"\n class=\"share-action-icon\"\n ></sl-icon>\n <div class=\"share-action-text\">${strings[this.configLang].impactShareCopy()}</div>\n </button>\n </div>\n <div style=\"flex: 1; text-align: center\">\n <a\n class=\"plain-button button share-action-button plain-link\"\n download=\"${strings[this.configLang].impactShareTitle()}\"\n href=\"${dataUrl}\"\n @click=\"${handleClickDownload}\"\n >\n <sl-icon\n library=\"lucide\"\n name=\"download\"\n label=\"${strings[this.configLang].impactShareDownload()}\"\n class=\"share-action-icon\"\n ></sl-icon>\n <div class=\"share-action-text\">${strings[this.configLang].impactShareDownload()}</div>\n </a>\n </div>\n </div>\n <button class=\"plain-button button share-close\" @click=\"${handleClickClose}\">\n ${strings[this.configLang].impactShareClose()}\n </button>\n </sl-dialog>\n `;\n if (modalRoot) {\n render(dialogTemplate, modalRoot);\n }\n }\n\n async openSystemShareSheet(imageUrl: string) {\n if (!imageUrl) return;\n\n const file = await urlToFile(imageUrl);\n\n if (navigator.share) {\n await navigator\n .share({\n files: [file],\n })\n .then(() => {\n const { nonprofitId, storeId, transactionId, baseUrl, apiKey } = this;\n void postSocialShareAnalyticsEvent({\n baseUrl,\n apiKey,\n requestBody: { eventName: \"shareSheetShare\", nonprofitId, storeId, timestamp: Date.now(), transactionId },\n }).catch(() => null);\n })\n .catch(() => null);\n }\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n }\n render() {\n if (!this.imageUrl || !this.brandName || !this.configLang) return html``;\n return html`\n <style>\n .share-button {\n font-family: var(--beam-share-button-fontFamily);\n font-size: var(--beam-share-button-fontSize);\n font-weight: var(--beam-share-button-fontWeight);\n margin-top: var(--beam-share-button-marginTop);\n margin-bottom: var(--beam-share-button-marginBottom);\n text-transform: var(--beam-share-button-textTransform);\n line-height: var(--beam-share-button-lineHeight);\n background-color: var(--beam-share-button-backgroundColor);\n color: var(--beam-share-button-color, inherit);\n border-radius: var(--beam-share-button-borderRadius);\n border-color: var(--beam-share-button-borderColor);\n border-width: var(--beam-share-button-borderWidth);\n /* add extra padding on side without icon for optical alignment */\n padding: var(--beam-share-button-padding);\n width: var(--beam-share-button-width);\n transition: 0.15s;\n }\n .share-button:hover {\n background-color: var(--beam-share-button-hover-backgroundColor);\n color: var(--beam-share-button-hover-color);\n border-color: var(--beam-share-button-hover-borderColor);\n }\n .share-button-text {\n text-decoration: var(--beam-share-button-text-textDecoration);\n margin-left: 0.33em;\n }\n .share-button-icon {\n font-size: var(--beam-share-button-icon-size);\n }\n .button {\n cursor: pointer;\n }\n .icon-button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n }\n </style>\n <button\n @click=\"${this.handleShareClick}\"\n baseUrl=\"${this.baseUrl}\"\n class=\"share-button share-button-inline button icon-button\"\n >\n <sl-icon\n name=\"${this.shareIcon}\"\n library=\"lucide\"\n label=\"${strings[this.configLang].impactShareButton()}\"\n class=\"share-button-icon\"\n ></sl-icon>\n <span class=\"share-button-text\">${this.buttonText || strings[this.configLang].impactShareButton()}</span>\n </button>\n <div id=\"modal-root\"></div>\n `;\n }\n}\n\ncustomElements.get(\"beam-share-button\") || customElements.define(\"beam-share-button\", BeamShareButton);\n\nexport const shareButtonConfigDefaults = {\n \"--beam-share-button-fontFamily\": \"inherit\",\n \"--beam-share-button-fontSize\": \"14px\",\n \"--beam-share-button-fontWeight\": \"600\",\n \"--beam-share-button-textTransform\": \"none\",\n \"--beam-share-button-marginTop\": \"10px\",\n \"--beam-share-button-marginBottom\": \"10px\",\n \"--beam-share-button-padding\": \"8px 18px 8px 16px\",\n \"--beam-share-button-lineHeight\": \"inherit\",\n \"--beam-share-button-color\": \"#0A323C\",\n \"--beam-share-button-backgroundColor\": \"#fff\",\n \"--beam-share-button-borderRadius\": \"30px\",\n \"--beam-share-button-borderColor\": \"#0A323C\",\n \"--beam-share-button-borderWidth\": \"1px\",\n\n \"--beam-share-button-width\": \"auto\",\n\n \"--beam-share-button-hover-borderColor\": \"transparent\",\n \"--beam-share-button-hover-backgroundColor\": \"#0A323C\",\n \"--beam-share-button-hover-color\": \"#fff\",\n\n \"--beam-share-button-icon-size\": \"16px\",\n\n \"--beam-share-button-text-textDecoration\": \"none\",\n\n \"--beam-share-dialog-padding\": \"30px 30px\",\n\n \"--beam-share-title-fontSize\": \"30px\",\n \"--beam-share-title-fontWeight\": \"bold\",\n\n \"--beam-share-text-fontSize\": \"16px\",\n \"--beam-share-text-lineHeight\": \"1.3\",\n \"--beam-share-text-marginTop\": \"10px\",\n\n \"--beam-share-image-borderRadius\": \"4px\",\n \"--beam-share-image-width\": \"200px\",\n \"--beam-share-image-margin\": \"20px\",\n\n \"--beam-share-actions-margin\": \"30px 60px\",\n \"--beam-share-action-icon-size\": \"32px\",\n\n \"--beam-share-action-text-fontSize\": \"16px\",\n \"--beam-share-action-text-lineHeight\": \"1.3\",\n \"--beam-share-text-action-marginTop\": \"10px\",\n\n \"--beam-share-close-backgroundColor\": \"#ffd522\",\n \"--beam-share-close-text-color\": \"#000\",\n \"--beam-share-close-padding\": \"12px\",\n \"--beam-share-close-borderRadius\": \"4px\",\n \"--beam-share-close-fontSize\": \"16px\",\n \"--beam-share-close-fontWeight\": \"bold\",\n\n \"--beam-share-close-focus-borderColor\": \"#c2dcff\",\n} as const;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"beam-share-button\": BeamShareButton;\n }\n}\n"],"names":["syncElementHeights","elements","source","els","isAllHtmlElements","syncedHeight","a","b","el","isMobile","v","o","l","e","n","r","i","BeamShareButton","LitElement","DEFAULT_BASE_URL","nonprofitId","storeId","transactionId","baseUrl","apiKey","postSocialShareAnalyticsEvent","err","imageUrl","brandName","existingDialog","modalRoot","file","urlToFile","dataUrl","handleClickClose","handleClickCopy","handleClickDownload","dialogTemplate","html","strings","render","__decorateClass","property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AoC,OACpC,kCAAmC,UACnC,kCAAmC,MAEnC,4BAA6B,OAE7B,wCAAyC,cACzC,4CAA6C,UAC7C,kCAAmC,OAEnC,gCAAiC,OAEjC,0CAA2C,OAE3C,8BAA+B,YAE/B,8BAA+B,OAC/B,gCAAiC,OAEjC,6BAA8B,OAC9B,+BAAgC,MAChC,8BAA+B,OAE/B,kCAAmC,MACnC,2BAA4B,QAC5B,4BAA6B,OAE7B,8BAA+B,YAC/B,gCAAiC,OAEjC,oCAAqC,OACrC,sCAAuC,MACvC,qCAAsC,OAEtC,qCAAsC,UACtC,gCAAiC,OACjC,6BAA8B,OAC9B,kCAAmC,MACnC,8BAA+B,OAC/B,gCAAiC,OAEjC,uCAAwC,SAC1C"}
1
+ {"version":3,"file":"share-button-XJxSyBaT.esm.js","sources":["../../src/shared/sync-element-heights.ts","../../src/shared/feature-detection.ts","../../src/shared/components/share-button.ts"],"sourcesContent":["import { isAllHtmlElements } from \"./is-all-html-elements\";\n\n/**\n * Synchronize heights of elements\n * @param {Array<HTMLElement|null>} elements - Elements to synchronize\n * @param {'contentLength' | 'currentHeight'} [options.source='contentLength'] -\n * Method used to get the height value to sync across elements. `contentLength`\n * (innerText.length) is reliable for pure text content when responding to\n * window resizing. Otherwise, currentHeight can be used to sync the tallest\n * element's height to all the other elements. Note that this works poorly\n * unless content is allowed to reflow with explicit height attributes removed\n * between synchronization calls.\n */\nexport const syncElementHeights = (\n elements: Array<HTMLElement | null> | NodeList,\n {\n source = \"contentLength\",\n }: {\n source?: \"contentLength\" | \"currentHeight\";\n } = {}\n) => {\n const els = elements instanceof NodeList ? Array.from(elements) : elements;\n\n if (els.length === 0 || !isAllHtmlElements(els)) {\n return;\n }\n\n const heightSource =\n source === \"contentLength\"\n ? els.sort((a, b) => {\n return b.innerText.length - a.innerText.length;\n })[0]\n : els.sort((a, b) => {\n return b.clientHeight - a.clientHeight;\n })[0];\n\n const syncedHeight = heightSource?.clientHeight || 0;\n\n for (const el of els) {\n if (el.clientHeight !== syncedHeight) {\n el.style[\"height\"] = syncedHeight + \"px\";\n }\n }\n};\n","export function isMobile() {\n return /Android|iPhone/i.test(navigator.userAgent);\n}\n\nexport function hasSystemShare() {\n return !!navigator.share;\n}\n","import { LitElement, html, render } from \"lit\";\nimport { property } from \"lit/decorators/property.js\";\nimport { postSocialShareAnalyticsEvent } from \"../../api-sdk/v2/users/events\";\nimport { DEFAULT_BASE_URL } from \"../../api-sdk/constants\";\nimport \"@shoelace-style/shoelace/dist/components/icon/icon.js\";\nimport { LANGUAGES } from \"../../api-sdk/types\";\nimport { urlToFile } from \"../files\";\nimport { isMobile } from \"../feature-detection\";\nimport { strings } from \"./strings/share-button\";\n\ninterface SlDialogElement extends HTMLElement {\n show: () => void;\n hide: () => void;\n}\n\nexport class BeamShareButton extends LitElement {\n @property({ type: String }) shareIcon: string | null = null;\n @property({ type: String }) imageUrl?: string | null = null;\n @property({ type: String }) brandName: string | null = null;\n @property({ type: String }) buttonText?: string | null = null;\n @property({ type: String }) configLang: LANGUAGES = \"en\";\n @property({ type: String }) baseUrl: string = DEFAULT_BASE_URL;\n @property({ type: String }) nonprofitId?: number | null = null;\n @property({ type: String }) storeId?: number | null = null;\n @property({ type: String }) transactionId?: number | null = null;\n @property({ type: String }) apiKey!: string;\n\n connectedCallback() {\n super.connectedCallback();\n }\n\n async handleShareClick() {\n try {\n if (!this.imageUrl || !this.brandName || !this.configLang) return;\n await import(\"./_share-dialog-dependencies.js\");\n\n const { nonprofitId, storeId, transactionId, baseUrl, apiKey } = this;\n void postSocialShareAnalyticsEvent({\n baseUrl,\n apiKey,\n requestBody: { eventName: \"shareImageButtonClick\", nonprofitId, storeId, timestamp: Date.now(), transactionId },\n }).catch(() => null);\n\n if (isMobile()) {\n this.openSystemShareSheet(this.imageUrl);\n } else {\n this.handleShareDialog(this.imageUrl, this.brandName);\n }\n } catch (err) {\n console.error(\"Error sharing impact:\", err);\n }\n }\n\n async handleShareDialog(imageUrl: string, brandName: string) {\n if (!imageUrl) return;\n\n const existingDialog = this.shadowRoot?.querySelector(\"sl-dialog\") as SlDialogElement;\n\n if (existingDialog) {\n existingDialog.show();\n return;\n }\n\n await import(\"./_share-dialog-dependencies.js\"); // Import libraries async to reduce bundle size if share feature is unused\n\n const modalRoot = this.shadowRoot?.querySelector(\"#modal-root\") as HTMLElement;\n\n const file = await urlToFile(imageUrl);\n\n const dataUrl = URL.createObjectURL(file);\n\n const handleClickClose = () => {\n (this.shadowRoot?.querySelector(\"sl-dialog\") as SlDialogElement)?.hide();\n };\n\n const handleClickCopy = async () => {\n void postSocialShareAnalyticsEvent({\n baseUrl: this.baseUrl,\n apiKey: this.apiKey,\n requestBody: {\n eventName: \"copyImageButtonClick\",\n nonprofitId: this.nonprofitId,\n storeId: this.storeId,\n timestamp: Date.now(),\n transactionId: this.transactionId,\n },\n }).catch(() => null);\n await navigator.clipboard.write([new ClipboardItem({ \"image/png\": file })]);\n setTimeout(handleClickClose, 250);\n };\n\n const handleClickDownload = () => {\n void postSocialShareAnalyticsEvent({\n baseUrl: this.baseUrl,\n apiKey: this.apiKey,\n requestBody: {\n eventName: \"downloadImageButtonClick\",\n nonprofitId: this.nonprofitId,\n storeId: this.storeId,\n timestamp: Date.now(),\n transactionId: this.transactionId,\n },\n }).catch(() => null);\n setTimeout(handleClickClose, 250);\n };\n\n const dialogTemplate = html`\n <style>\n .plain-button {\n border: none;\n background: none;\n font-size: inherit;\n font-family: inherit;\n }\n .share-dialog::part(panel) {\n padding: var(--beam-share-dialog-padding);\n text-align: center;\n }\n .share-title {\n font-size: var(--beam-share-title-fontSize);\n font-weight: var(--beam-share-title-fontWeight);\n }\n .share-text {\n font-size: var(--beam-share-text-fontSize);\n line-height: var(--beam-share-text-lineHeight);\n margin-top: var(--beam-share-text-marginTop);\n }\n .share-image {\n border-radius: var(--beam-share-image-borderRadius);\n width: var(--beam-share-image-width);\n display: block;\n margin: var(--beam-share-image-margin) auto;\n }\n .share-actions {\n margin: var(--beam-share-actions-margin);\n }\n .share-action-button {\n display: inline-flex;\n justify-content: center;\n align-items: center;\n flex-direction: column;\n padding: 5px;\n }\n .share-action-icon {\n font-size: var(--beam-share-action-icon-size);\n }\n .share-action-button:hover .share-action-icon {\n scale: 1.1;\n }\n .share-action-text {\n font-size: var(--beam-share-action-text-fontSize);\n line-height: var(--beam-share-action-text-lineHeight);\n margin-top: var(--beam-share-text-action-marginTop);\n }\n .plain-button {\n border: none;\n background: none;\n font-size: inherit;\n font-family: inherit;\n }\n .plain-link {\n text-decoration: none;\n color: inherit;\n }\n .share-close {\n display: block;\n background-color: var(--beam-share-close-backgroundColor);\n color: var(--beam-share-close-text-color);\n justify-content: center;\n padding: var(--beam-share-close-padding);\n border-radius: var(--beam-share-close-borderRadius);\n width: 100%;\n font-size: var(--beam-share-close-fontSize);\n font-weight: var(--beam-share-close-fontWeight);\n }\n .share-close:hover {\n outline: 2px solid var(--beam-share-close-focus-borderColor);\n }\n </style>\n <sl-dialog open label=\"${strings[this.configLang].impactShareTitle()}\" no-header class=\"share-dialog\">\n <h2 class=\"share-title\">${strings[this.configLang].impactShareTitle()}</h2>\n <p class=\"share-text\">${strings[this.configLang].impactShareText({ brandName })}</p>\n <img src=\"${imageUrl}\" alt=\"${strings[this.configLang].impactShareTitle()}\" class=\"share-image\" />\n <div class=\"share-actions\" style=\"display: flex; justify-content: space-evenly\">\n <div style=\"flex: 1; text-align: center\">\n <button class=\"plain-button button share-action-button\" @click=\"${handleClickCopy}\">\n <sl-icon\n library=\"lucide\"\n name=\"copy\"\n label=\"${strings[this.configLang].impactShareCopy()}\"\n class=\"share-action-icon\"\n ></sl-icon>\n <div class=\"share-action-text\">${strings[this.configLang].impactShareCopy()}</div>\n </button>\n </div>\n <div style=\"flex: 1; text-align: center\">\n <a\n class=\"plain-button button share-action-button plain-link\"\n download=\"${strings[this.configLang].impactShareTitle()}\"\n href=\"${dataUrl}\"\n @click=\"${handleClickDownload}\"\n >\n <sl-icon\n library=\"lucide\"\n name=\"download\"\n label=\"${strings[this.configLang].impactShareDownload()}\"\n class=\"share-action-icon\"\n ></sl-icon>\n <div class=\"share-action-text\">${strings[this.configLang].impactShareDownload()}</div>\n </a>\n </div>\n </div>\n <button class=\"plain-button button share-close\" @click=\"${handleClickClose}\">\n ${strings[this.configLang].impactShareClose()}\n </button>\n </sl-dialog>\n `;\n if (modalRoot) {\n render(dialogTemplate, modalRoot);\n }\n }\n\n async openSystemShareSheet(imageUrl: string) {\n if (!imageUrl) return;\n\n const file = await urlToFile(imageUrl);\n\n if (navigator.share) {\n await navigator\n .share({\n files: [file],\n })\n .then(() => {\n const { nonprofitId, storeId, transactionId, baseUrl, apiKey } = this;\n void postSocialShareAnalyticsEvent({\n baseUrl,\n apiKey,\n requestBody: { eventName: \"shareSheetShare\", nonprofitId, storeId, timestamp: Date.now(), transactionId },\n }).catch(() => null);\n })\n .catch(() => null);\n }\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n }\n render() {\n if (!this.imageUrl || !this.brandName || !this.configLang) return html``;\n return html`\n <style>\n .share-button {\n font-family: var(--beam-share-button-fontFamily);\n font-size: var(--beam-share-button-fontSize);\n font-weight: var(--beam-share-button-fontWeight);\n margin-top: var(--beam-share-button-marginTop);\n margin-bottom: var(--beam-share-button-marginBottom);\n text-transform: var(--beam-share-button-textTransform);\n line-height: var(--beam-share-button-lineHeight);\n background-color: var(--beam-share-button-backgroundColor);\n color: var(--beam-share-button-color, inherit);\n border-radius: var(--beam-share-button-borderRadius);\n border-color: var(--beam-share-button-borderColor);\n border-width: var(--beam-share-button-borderWidth);\n /* add extra padding on side without icon for optical alignment */\n padding: var(--beam-share-button-padding);\n width: var(--beam-share-button-width);\n transition: 0.15s;\n }\n .share-button:hover {\n background-color: var(--beam-share-button-hover-backgroundColor);\n color: var(--beam-share-button-hover-color);\n border-color: var(--beam-share-button-hover-borderColor);\n }\n .share-button-text {\n text-decoration: var(--beam-share-button-text-textDecoration);\n margin-left: 0.33em;\n }\n .share-button-icon {\n font-size: var(--beam-share-button-icon-size);\n }\n .button {\n cursor: pointer;\n }\n .icon-button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n }\n </style>\n <button\n @click=\"${this.handleShareClick}\"\n baseUrl=\"${this.baseUrl}\"\n class=\"share-button share-button-inline button icon-button\"\n >\n <sl-icon\n name=\"${this.shareIcon}\"\n library=\"lucide\"\n label=\"${strings[this.configLang].impactShareButton()}\"\n class=\"share-button-icon\"\n ></sl-icon>\n <span class=\"share-button-text\">${this.buttonText || strings[this.configLang].impactShareButton()}</span>\n </button>\n <div id=\"modal-root\"></div>\n `;\n }\n}\n\ncustomElements.get(\"beam-share-button\") || customElements.define(\"beam-share-button\", BeamShareButton);\n\nexport const shareButtonConfigDefaults = {\n \"--beam-share-button-fontFamily\": \"inherit\",\n \"--beam-share-button-fontSize\": \"14px\",\n \"--beam-share-button-fontWeight\": \"600\",\n \"--beam-share-button-textTransform\": \"none\",\n \"--beam-share-button-marginTop\": \"10px\",\n \"--beam-share-button-marginBottom\": \"10px\",\n \"--beam-share-button-padding\": \"8px 18px 8px 16px\",\n \"--beam-share-button-lineHeight\": \"inherit\",\n \"--beam-share-button-color\": \"#0A323C\",\n \"--beam-share-button-backgroundColor\": \"#fff\",\n \"--beam-share-button-borderRadius\": \"30px\",\n \"--beam-share-button-borderColor\": \"#0A323C\",\n \"--beam-share-button-borderWidth\": \"1px\",\n\n \"--beam-share-button-width\": \"auto\",\n\n \"--beam-share-button-hover-borderColor\": \"transparent\",\n \"--beam-share-button-hover-backgroundColor\": \"#0A323C\",\n \"--beam-share-button-hover-color\": \"#fff\",\n\n \"--beam-share-button-icon-size\": \"16px\",\n\n \"--beam-share-button-text-textDecoration\": \"none\",\n\n \"--beam-share-dialog-padding\": \"30px 30px\",\n\n \"--beam-share-title-fontSize\": \"30px\",\n \"--beam-share-title-fontWeight\": \"bold\",\n\n \"--beam-share-text-fontSize\": \"16px\",\n \"--beam-share-text-lineHeight\": \"1.3\",\n \"--beam-share-text-marginTop\": \"10px\",\n\n \"--beam-share-image-borderRadius\": \"4px\",\n \"--beam-share-image-width\": \"200px\",\n \"--beam-share-image-margin\": \"20px\",\n\n \"--beam-share-actions-margin\": \"30px 60px\",\n \"--beam-share-action-icon-size\": \"32px\",\n\n \"--beam-share-action-text-fontSize\": \"16px\",\n \"--beam-share-action-text-lineHeight\": \"1.3\",\n \"--beam-share-text-action-marginTop\": \"10px\",\n\n \"--beam-share-close-backgroundColor\": \"#ffd522\",\n \"--beam-share-close-text-color\": \"#000\",\n \"--beam-share-close-padding\": \"12px\",\n \"--beam-share-close-borderRadius\": \"4px\",\n \"--beam-share-close-fontSize\": \"16px\",\n \"--beam-share-close-fontWeight\": \"bold\",\n\n \"--beam-share-close-focus-borderColor\": \"#c2dcff\",\n} as const;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"beam-share-button\": BeamShareButton;\n }\n}\n"],"names":["syncElementHeights","elements","source","els","isAllHtmlElements","syncedHeight","a","b","el","isMobile","v","o","l","e","n","r","i","BeamShareButton","LitElement","DEFAULT_BASE_URL","nonprofitId","storeId","transactionId","baseUrl","apiKey","postSocialShareAnalyticsEvent","err","imageUrl","brandName","existingDialog","modalRoot","file","urlToFile","dataUrl","handleClickClose","handleClickCopy","handleClickDownload","dialogTemplate","html","strings","render","__decorateClass","property","shareButtonConfigDefaults"],"mappings":"yQAaO,MAAMA,EAAqB,CAChCC,EACA,CACE,OAAAC,EAAS,eACX,EAEI,CAAA,IACD,CACH,MAAMC,EAAMF,aAAoB,SAAW,MAAM,KAAKA,CAAQ,EAAIA,EAElE,GAAIE,EAAI,SAAW,GAAK,CAACC,EAAkBD,CAAG,EAC5C,OAYF,MAAME,GARJH,IAAW,gBACPC,EAAI,KAAK,CAACG,EAAGC,IACJA,EAAE,UAAU,OAASD,EAAE,UAAU,MACzC,EAAE,CAAC,EACJH,EAAI,KAAK,CAACG,EAAGC,IACJA,EAAE,aAAeD,EAAE,YAC3B,EAAE,CAAC,IAEyB,cAAgB,EAEnD,UAAWE,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EjC,uCAAwC,SAC1C"}
@@ -1,2 +1,2 @@
1
- import{d as B,i as A}from"./lodash-7H4x2457.esm.js";import{D as v,H as S,b as _}from"./routes-TtLdALcf.esm.js";import{B as K}from"./beam-errors-Ci0d3926.esm.js";import{f as L,g as R,h as J}from"./events-BohmT6Lp.esm.js";import{createScopedLocalStorage as U}from"../utils/local-storage.esm.js";import{setCookieValue as x}from"../utils/cookies.esm.js";import{getRemoteSession as D}from"../utils/remote-session.esm.js";import{memoizeLast as M}from"../utils/memoize-last.esm.js";import{f as N}from"./promoManager-fl54hq13.esm.js";import{B as b}from"./cart-contents-DkoytiZh.esm.js";import{getBeamCartId as O}from"../utils/cart.esm.js";const P=50,T=B(M(async function(e,m,E=!1){try{const t=U({apiKey:e.apiKey}),l=e.baseUrl??v,o=t.getItemJson("cart"),a=O(b,e),w=D(e)??void 0,{cartId:n,subtotal:i,itemCount:d,currencyCode:c,content:{items:C=[],discounts:u=[]}={},schema:p={source:"generic"}}=m,r={cartId:n,subtotal:i,itemCount:d,currencyCode:c,content:{items:C,discounts:u},schema:p,beamCartId:a};if(E&&!o&&m?.itemCount){t.setItemJson("cart",{...r,beamCartId:a});return}if(A(r,{...o,cartId:o?.cartId})||m.itemCount===0&&(!a||o?.itemCount===0)){t.setItemJson("cart",{...r,beamCartId:a});return}N((u??[]).map(g=>({value:g?.code})),e.apiKey),window.dispatchEvent(new L({source:S.cart_update}));const h=await _({baseUrl:l,headers:{authorization:`Api-Key ${e.apiKey}`},requestBody:{beamCartId:a,storeId:e.storeId,remoteSessionId:w,cartId:n,subtotal:i,itemCount:d,currencyCode:c}}),{beamCartId:s,expiresAt:I,beamCartCreated:y}=h;s&&I&&await x({name:b,domain:e.domain,value:s,path:"/",expires:new Date(I).getTime()}),t.setItemJson("cart",{...r,beamCartId:s});const f={schema:p,content:{items:C,discounts:u},subtotal:i,itemCount:d,currencyCode:c,cartId:n,beamCartId:s};window.dispatchEvent(new R(f)),y&&window.dispatchEvent(new J(f))}catch(t){throw new K("Could not update cart in Beam",{cause:t})}}),P,{leading:!0});export{T as O};
2
- //# sourceMappingURL=update-cart-DMO5uiQX.esm.js.map
1
+ import{d as B,i as A}from"./lodash-D3TLHRR_.esm.js";import{D as v,H as S,b as _}from"./routes-Lvj2SXN4.esm.js";import{B as K}from"./beam-errors-Ci0d3926.esm.js";import{f as L,g as R,h as J}from"./events-BohmT6Lp.esm.js";import{createScopedLocalStorage as U}from"../utils/local-storage.esm.js";import{setCookieValue as x}from"../utils/cookies.esm.js";import{getRemoteSession as D}from"../utils/remote-session.esm.js";import{memoizeLast as M}from"../utils/memoize-last.esm.js";import{f as N}from"./promoManager-fl54hq13.esm.js";import{B as b}from"./cart-contents-DkoytiZh.esm.js";import{getBeamCartId as O}from"../utils/cart.esm.js";const P=50,T=B(M(async function(e,m,E=!1){try{const t=U({apiKey:e.apiKey}),l=e.baseUrl??v,o=t.getItemJson("cart"),a=O(b,e),w=D(e)??void 0,{cartId:n,subtotal:i,itemCount:d,currencyCode:c,content:{items:C=[],discounts:u=[]}={},schema:p={source:"generic"}}=m,r={cartId:n,subtotal:i,itemCount:d,currencyCode:c,content:{items:C,discounts:u},schema:p,beamCartId:a};if(E&&!o&&m?.itemCount){t.setItemJson("cart",{...r,beamCartId:a});return}if(A(r,{...o,cartId:o?.cartId})||m.itemCount===0&&(!a||o?.itemCount===0)){t.setItemJson("cart",{...r,beamCartId:a});return}N((u??[]).map(g=>({value:g?.code})),e.apiKey),window.dispatchEvent(new L({source:S.cart_update}));const h=await _({baseUrl:l,headers:{authorization:`Api-Key ${e.apiKey}`},requestBody:{beamCartId:a,storeId:e.storeId,remoteSessionId:w,cartId:n,subtotal:i,itemCount:d,currencyCode:c}}),{beamCartId:s,expiresAt:I,beamCartCreated:y}=h;s&&I&&await x({name:b,domain:e.domain,value:s,path:"/",expires:new Date(I).getTime()}),t.setItemJson("cart",{...r,beamCartId:s});const f={schema:p,content:{items:C,discounts:u},subtotal:i,itemCount:d,currencyCode:c,cartId:n,beamCartId:s};window.dispatchEvent(new R(f)),y&&window.dispatchEvent(new J(f))}catch(t){throw new K("Could not update cart in Beam",{cause:t})}}),P,{leading:!0});export{T as O};
2
+ //# sourceMappingURL=update-cart-Kt4NGuYW.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"update-cart-DMO5uiQX.esm.js","sources":["../../src/integrations/cart/update-cart.ts"],"sourcesContent":["import isEqual from \"lodash-es/isEqual\";\nimport { DEFAULT_BASE_URL, HELPER_NAMES } from \"../../api-sdk/constants\";\nimport { BeamBaseAPIConfig } from \"../../api-sdk/types\";\nimport { postCart } from \"../../api-sdk/v3/routes\";\nimport { debounce, memoizeLast } from \"../../utils\";\nimport { BeamError } from \"../../utils/beam-errors\";\nimport { BEAM_CART_COOKIE_NAME, TBeamCartLocalStorage, TCartApi } from \"../../shared/cart-contents\";\nimport { setCookieValue } from \"../../utils/cookies\";\nimport { BeamCartChangeEvent, BeamCartCreatedEvent, BeamWidgetStoredPromoCodesEvent } from \"../../utils/events\";\nimport { createScopedLocalStorage } from \"../../utils/local-storage\";\nimport { getRemoteSession } from \"../../utils/remote-session\";\nimport { getBeamCartId } from \"../../utils/cart\";\nimport { formatStoreAndReturnPromoCodes } from \"../../utils/promoManager\";\n\nexport type BeamCartAPIConfig = BeamBaseAPIConfig & {\n storeId: number;\n domain?: string; // Domain to set cookies on\n statsigExperiment?: string;\n};\n\nexport type BeamCartValues = {\n cartId?: string; // External (partner) cart ID\n itemCount?: number;\n subtotal?: number;\n currencyCode?: string;\n} & Partial<TCartApi>;\n\n/**\n * The debounce time in milliseconds for updating the cart - updateCart will delay until it hasn't been called for\n * this long before handling the last call.\n */\nconst UPDATE_CART_DEBOUNCE_MS = 50;\n\n/**\n * Sends cart information to Beam\n * Memoized based on previous arguments - if the objects are deep-equal, no update is made.\n * @side-effects Sets beam_cart cookie, set cart data in localstorage\n * @example\n * const BeamConfig = { apiKey: 'abc-123' }\n * const { beamCartId } = await updateCart(BeamConfig, { beamCartId, itemCount, subtotal, currencyCode })\n * */\nconst updateCart = debounce(\n memoizeLast(async function updateCart(\n config: BeamCartAPIConfig,\n cartValues: BeamCartValues,\n isFirstCartUpdateOnPageLoad = false\n ) {\n try {\n const localStorage = createScopedLocalStorage({ apiKey: config.apiKey });\n const baseUrl = config.baseUrl ?? DEFAULT_BASE_URL;\n\n // The cart cache is used to detect changes after page refreshes / across tabs\n const cachedCart: TBeamCartLocalStorage | null = localStorage.getItemJson(\"cart\");\n // The Beam cart cookie is used to identify the cart across subdomains\n // Use explicit null if empty because API requires it\n const beamCartId: string | null = getBeamCartId(BEAM_CART_COOKIE_NAME, config);\n // Remote session ID (ie, device ID from an A/B testing tool) will be linked to the cart\n const remoteSessionId: string | undefined = getRemoteSession(config) ?? undefined;\n\n const {\n cartId,\n subtotal,\n itemCount,\n currencyCode,\n content: { items = [], discounts = [] } = {},\n schema = { source: \"generic\" },\n } = cartValues;\n\n const cartWithDefaults = {\n cartId,\n subtotal,\n itemCount,\n currencyCode,\n content: { items, discounts },\n schema,\n beamCartId,\n };\n\n // If this is our first time calling \"updateCart\" on page load, and there is\n // no prior \"cachedCart\", and the current Platform cart is not empty,\n // we should assume that the cart has not been interacted with.\n // In this case, we want to cache the current cart, but not send it to Beam\n // so that the next time we call this method, it will compare to the existing\n // Platform cart\n if (isFirstCartUpdateOnPageLoad && !cachedCart && !!cartValues?.itemCount) {\n // logger.debug(\n // \"[update-cart] first attempt to update cart; no prior cart found, cart is not empty; skipping update to Beam\"\n // );\n localStorage.setItemJson(\"cart\", {\n ...cartWithDefaults,\n beamCartId: beamCartId,\n });\n\n return;\n }\n\n // Early return conditions. Skip sending cart to Beam if any apply:\n // 1. The cart has not changed\n // 2. Cart is empty, unless the cart was not empty before\n if (\n isEqual(cartWithDefaults, {\n ...cachedCart,\n cartId: cachedCart?.cartId /* make sure optional key is defined even if empty */,\n }) || // cart has not changed, OR\n (cartValues.itemCount === 0 && // nothing in current cart, AND\n (!beamCartId || cachedCart?.itemCount === 0)) // no/expired prev cart or prev cart was empty\n ) {\n // logger.debug(\"[update-cart] cart not changed\");\n // If the cart has not changed because the cart is empty now,\n // we still want to save that this changed happened in our cached cart\n // so the next update will compare against a current cart\n localStorage.setItemJson(\"cart\", {\n ...cartWithDefaults,\n beamCartId: beamCartId,\n });\n\n return;\n }\n\n formatStoreAndReturnPromoCodes(\n (discounts ?? []).map((discount) => ({ value: discount?.code })),\n config.apiKey\n );\n window.dispatchEvent(new BeamWidgetStoredPromoCodesEvent({ source: HELPER_NAMES.cart_update }));\n // logger.debug(\"[update-cart] sending cart update request\");\n const response = await postCart({\n baseUrl,\n headers: {\n authorization: `Api-Key ${config.apiKey}`,\n },\n requestBody: {\n beamCartId, // backwards compat: explicitly sending null here is required to get initial beamCartId\n storeId: config.storeId,\n remoteSessionId,\n cartId,\n subtotal,\n itemCount,\n currencyCode,\n },\n });\n\n // Response will contain a new beamCartId if one was not provided, or old one expired\n const { beamCartId: newBeamCartId, expiresAt, beamCartCreated } = response;\n\n if (newBeamCartId && expiresAt) {\n await setCookieValue({\n name: BEAM_CART_COOKIE_NAME,\n domain: config.domain,\n value: newBeamCartId,\n path: \"/\",\n // If we don't set an expiration, the cookie will be cleared when the tab is closed\n expires: new Date(expiresAt).getTime(),\n });\n }\n\n localStorage.setItemJson(\"cart\", {\n ...cartWithDefaults,\n beamCartId: newBeamCartId,\n });\n\n const eventDetail = {\n schema: schema as any, // TS union type can't figure out what variant applies here\n content: {\n items: items as any,\n discounts: discounts as any,\n },\n subtotal,\n itemCount,\n currencyCode,\n cartId,\n beamCartId: newBeamCartId,\n };\n\n // emit change event on any create/update/delete of cart items\n window.dispatchEvent(new BeamCartChangeEvent(eventDetail));\n\n // emit created event only when the cart is new according to Beam\n if (beamCartCreated) {\n window.dispatchEvent(new BeamCartCreatedEvent(eventDetail));\n }\n } catch (err) {\n throw new BeamError(\"Could not update cart in Beam\", { cause: err });\n }\n }),\n UPDATE_CART_DEBOUNCE_MS,\n { leading: true } // handle first call immediately but delay for more calls within debounce window\n);\n\nexport { updateCart };\n"],"names":["UPDATE_CART_DEBOUNCE_MS","updateCart","debounce","memoizeLast","config","cartValues","isFirstCartUpdateOnPageLoad","localStorage","createScopedLocalStorage","baseUrl","DEFAULT_BASE_URL","cachedCart","beamCartId","getBeamCartId","BEAM_CART_COOKIE_NAME","remoteSessionId","getRemoteSession","cartId","subtotal","itemCount","currencyCode","items","discounts","schema","cartWithDefaults","isEqual","formatStoreAndReturnPromoCodes","discount","BeamWidgetStoredPromoCodesEvent","HELPER_NAMES","response","postCart","newBeamCartId","expiresAt","beamCartCreated","setCookieValue","eventDetail","BeamCartChangeEvent","BeamCartCreatedEvent","err","BeamError"],"mappings":"6nBA+BMA,EAA0B,GAU1BC,EAAaC,EACjBC,EAAY,eACVC,EACAC,EACAC,EAA8B,GAC9B,CACA,GAAI,CACF,MAAMC,EAAeC,EAAyB,CAAE,OAAQJ,EAAO,MAAO,CAAC,EACjEK,EAAUL,EAAO,SAAWM,EAG5BC,EAA2CJ,EAAa,YAAY,MAAM,EAG1EK,EAA4BC,EAAcC,EAAuBV,CAAM,EAEvEW,EAAsCC,EAAiBZ,CAAM,GAAK,OAElE,CACJ,OAAAa,EACA,SAAAC,EACA,UAAAC,EACA,aAAAC,EACA,QAAS,CAAE,MAAAC,EAAQ,CAAI,EAAA,UAAAC,EAAY,CAAG,CAAA,EAAI,CAAA,EAC1C,OAAAC,EAAS,CAAE,OAAQ,SAAU,CAC/B,EAAIlB,EAEEmB,EAAmB,CACvB,OAAAP,EACA,SAAAC,EACA,UAAAC,EACA,aAAAC,EACA,QAAS,CAAE,MAAAC,EAAO,UAAAC,CAAU,EAC5B,OAAAC,EACA,WAAAX,CACF,EAQA,GAAIN,GAA+B,CAACK,GAAgBN,GAAY,UAAW,CAIzEE,EAAa,YAAY,OAAQ,CAC/B,GAAGiB,EACH,WAAYZ,CACd,CAAC,EAED,MACF,CAKA,GACEa,EAAQD,EAAkB,CACxB,GAAGb,EACH,OAAQA,GAA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cart/update-cart.ts"],"sourcesContent":["import isEqual from \"lodash-es/isEqual\";\nimport { DEFAULT_BASE_URL, HELPER_NAMES } from \"../../api-sdk/constants\";\nimport { BeamBaseAPIConfig } from \"../../api-sdk/types\";\nimport { postCart } from \"../../api-sdk/v3/routes\";\nimport { debounce, memoizeLast } from \"../../utils\";\nimport { BeamError } from \"../../utils/beam-errors\";\nimport { BEAM_CART_COOKIE_NAME, TBeamCartLocalStorage, TCartApi } from \"../../shared/cart-contents\";\nimport { setCookieValue } from \"../../utils/cookies\";\nimport { BeamCartChangeEvent, BeamCartCreatedEvent, BeamWidgetStoredPromoCodesEvent } from \"../../utils/events\";\nimport { createScopedLocalStorage } from \"../../utils/local-storage\";\nimport { getRemoteSession } from \"../../utils/remote-session\";\nimport { getBeamCartId } from \"../../utils/cart\";\nimport { formatStoreAndReturnPromoCodes } from \"../../utils/promoManager\";\n\nexport type BeamCartAPIConfig = BeamBaseAPIConfig & {\n storeId: number;\n domain?: string; // Domain to set cookies on\n statsigExperiment?: string;\n};\n\nexport type BeamCartValues = {\n cartId?: string; // External (partner) cart ID\n itemCount?: number;\n subtotal?: number;\n currencyCode?: string;\n} & Partial<TCartApi>;\n\n/**\n * The debounce time in milliseconds for updating the cart - updateCart will delay until it hasn't been called for\n * this long before handling the last call.\n */\nconst UPDATE_CART_DEBOUNCE_MS = 50;\n\n/**\n * Sends cart information to Beam\n * Memoized based on previous arguments - if the objects are deep-equal, no update is made.\n * @side-effects Sets beam_cart cookie, set cart data in localstorage\n * @example\n * const BeamConfig = { apiKey: 'abc-123' }\n * const { beamCartId } = await updateCart(BeamConfig, { beamCartId, itemCount, subtotal, currencyCode })\n * */\nconst updateCart = debounce(\n memoizeLast(async function updateCart(\n config: BeamCartAPIConfig,\n cartValues: BeamCartValues,\n isFirstCartUpdateOnPageLoad = false\n ) {\n try {\n const localStorage = createScopedLocalStorage({ apiKey: config.apiKey });\n const baseUrl = config.baseUrl ?? DEFAULT_BASE_URL;\n\n // The cart cache is used to detect changes after page refreshes / across tabs\n const cachedCart: TBeamCartLocalStorage | null = localStorage.getItemJson(\"cart\");\n // The Beam cart cookie is used to identify the cart across subdomains\n // Use explicit null if empty because API requires it\n const beamCartId: string | null = getBeamCartId(BEAM_CART_COOKIE_NAME, config);\n // Remote session ID (ie, device ID from an A/B testing tool) will be linked to the cart\n const remoteSessionId: string | undefined = getRemoteSession(config) ?? undefined;\n\n const {\n cartId,\n subtotal,\n itemCount,\n currencyCode,\n content: { items = [], discounts = [] } = {},\n schema = { source: \"generic\" },\n } = cartValues;\n\n const cartWithDefaults = {\n cartId,\n subtotal,\n itemCount,\n currencyCode,\n content: { items, discounts },\n schema,\n beamCartId,\n };\n\n // If this is our first time calling \"updateCart\" on page load, and there is\n // no prior \"cachedCart\", and the current Platform cart is not empty,\n // we should assume that the cart has not been interacted with.\n // In this case, we want to cache the current cart, but not send it to Beam\n // so that the next time we call this method, it will compare to the existing\n // Platform cart\n if (isFirstCartUpdateOnPageLoad && !cachedCart && !!cartValues?.itemCount) {\n // logger.debug(\n // \"[update-cart] first attempt to update cart; no prior cart found, cart is not empty; skipping update to Beam\"\n // );\n localStorage.setItemJson(\"cart\", {\n ...cartWithDefaults,\n beamCartId: beamCartId,\n });\n\n return;\n }\n\n // Early return conditions. Skip sending cart to Beam if any apply:\n // 1. The cart has not changed\n // 2. Cart is empty, unless the cart was not empty before\n if (\n isEqual(cartWithDefaults, {\n ...cachedCart,\n cartId: cachedCart?.cartId /* make sure optional key is defined even if empty */,\n }) || // cart has not changed, OR\n (cartValues.itemCount === 0 && // nothing in current cart, AND\n (!beamCartId || cachedCart?.itemCount === 0)) // no/expired prev cart or prev cart was empty\n ) {\n // logger.debug(\"[update-cart] cart not changed\");\n // If the cart has not changed because the cart is empty now,\n // we still want to save that this changed happened in our cached cart\n // so the next update will compare against a current cart\n localStorage.setItemJson(\"cart\", {\n ...cartWithDefaults,\n beamCartId: beamCartId,\n });\n\n return;\n }\n\n formatStoreAndReturnPromoCodes(\n (discounts ?? []).map((discount) => ({ value: discount?.code })),\n config.apiKey\n );\n window.dispatchEvent(new BeamWidgetStoredPromoCodesEvent({ source: HELPER_NAMES.cart_update }));\n // logger.debug(\"[update-cart] sending cart update request\");\n const response = await postCart({\n baseUrl,\n headers: {\n authorization: `Api-Key ${config.apiKey}`,\n },\n requestBody: {\n beamCartId, // backwards compat: explicitly sending null here is required to get initial beamCartId\n storeId: config.storeId,\n remoteSessionId,\n cartId,\n subtotal,\n itemCount,\n currencyCode,\n },\n });\n\n // Response will contain a new beamCartId if one was not provided, or old one expired\n const { beamCartId: newBeamCartId, expiresAt, beamCartCreated } = response;\n\n if (newBeamCartId && expiresAt) {\n await setCookieValue({\n name: BEAM_CART_COOKIE_NAME,\n domain: config.domain,\n value: newBeamCartId,\n path: \"/\",\n // If we don't set an expiration, the cookie will be cleared when the tab is closed\n expires: new Date(expiresAt).getTime(),\n });\n }\n\n localStorage.setItemJson(\"cart\", {\n ...cartWithDefaults,\n beamCartId: newBeamCartId,\n });\n\n const eventDetail = {\n schema: schema as any, // TS union type can't figure out what variant applies here\n content: {\n items: items as any,\n discounts: discounts as any,\n },\n subtotal,\n itemCount,\n currencyCode,\n cartId,\n beamCartId: newBeamCartId,\n };\n\n // emit change event on any create/update/delete of cart items\n window.dispatchEvent(new BeamCartChangeEvent(eventDetail));\n\n // emit created event only when the cart is new according to Beam\n if (beamCartCreated) {\n window.dispatchEvent(new BeamCartCreatedEvent(eventDetail));\n }\n } catch (err) {\n throw new BeamError(\"Could not update cart in Beam\", { cause: err });\n }\n }),\n UPDATE_CART_DEBOUNCE_MS,\n { leading: true } // handle first call immediately but delay for more calls within debounce window\n);\n\nexport { updateCart };\n"],"names":["UPDATE_CART_DEBOUNCE_MS","updateCart","debounce","memoizeLast","config","cartValues","isFirstCartUpdateOnPageLoad","localStorage","createScopedLocalStorage","baseUrl","DEFAULT_BASE_URL","cachedCart","beamCartId","getBeamCartId","BEAM_CART_COOKIE_NAME","remoteSessionId","getRemoteSession","cartId","subtotal","itemCount","currencyCode","items","discounts","schema","cartWithDefaults","isEqual","formatStoreAndReturnPromoCodes","discount","BeamWidgetStoredPromoCodesEvent","HELPER_NAMES","response","postCart","newBeamCartId","expiresAt","beamCartCreated","setCookieValue","eventDetail","BeamCartChangeEvent","BeamCartCreatedEvent","err","BeamError"],"mappings":"6nBA+BMA,EAA0B,GAU1BC,EAAaC,EACjBC,EAAY,eACVC,EACAC,EACAC,EAA8B,GAC9B,CACA,GAAI,CACF,MAAMC,EAAeC,EAAyB,CAAE,OAAQJ,EAAO,MAAO,CAAC,EACjEK,EAAUL,EAAO,SAAWM,EAG5BC,EAA2CJ,EAAa,YAAY,MAAM,EAG1EK,EAA4BC,EAAcC,EAAuBV,CAAM,EAEvEW,EAAsCC,EAAiBZ,CAAM,GAAK,OAElE,CACJ,OAAAa,EACA,SAAAC,EACA,UAAAC,EACA,aAAAC,EACA,QAAS,CAAE,MAAAC,EAAQ,CAAI,EAAA,UAAAC,EAAY,CAAG,CAAA,EAAI,CAAA,EAC1C,OAAAC,EAAS,CAAE,OAAQ,SAAU,CAC/B,EAAIlB,EAEEmB,EAAmB,CACvB,OAAAP,EACA,SAAAC,EACA,UAAAC,EACA,aAAAC,EACA,QAAS,CAAE,MAAAC,EAAO,UAAAC,CAAU,EAC5B,OAAAC,EACA,WAAAX,CACF,EAQA,GAAIN,GAA+B,CAACK,GAAgBN,GAAY,UAAW,CAIzEE,EAAa,YAAY,OAAQ,CAC/B,GAAGiB,EACH,WAAYZ,CACd,CAAC,EAED,MACF,CAKA,GACEa,EAAQD,EAAkB,CACxB,GAAGb,EACH,OAAQA,GAAY,MACtB,CAAC,GACAN,EAAW,YAAc,IACvB,CAACO,GAAcD,GAAY,YAAc,GAC5C,CAKAJ,EAAa,YAAY,OAAQ,CAC/B,GAAGiB,EACH,WAAYZ,CACd,CAAC,EAED,MACF,CAEAc,GACGJ,GAAa,CAAC,GAAG,IAAKK,IAAc,CAAE,MAAOA,GAAU,IAAK,EAAE,EAC/DvB,EAAO,MACT,EACA,OAAO,cAAc,IAAIwB,EAAgC,CAAE,OAAQC,EAAa,WAAY,CAAC,CAAC,EAE9F,MAAMC,EAAW,MAAMC,EAAS,CAC9B,QAAAtB,EACA,QAAS,CACP,cAAe,WAAWL,EAAO,MAAM,EACzC,EACA,YAAa,CACX,WAAAQ,EACA,QAASR,EAAO,QAChB,gBAAAW,EACA,OAAAE,EACA,SAAAC,EACA,UAAAC,EACA,aAAAC,CACF,CACF,CAAC,EAGK,CAAE,WAAYY,EAAe,UAAAC,EAAW,gBAAAC,CAAgB,EAAIJ,EAE9DE,GAAiBC,GACnB,MAAME,EAAe,CACnB,KAAMrB,EACN,OAAQV,EAAO,OACf,MAAO4B,EACP,KAAM,IAEN,QAAS,IAAI,KAAKC,CAAS,EAAE,QAAA,CAC/B,CAAC,EAGH1B,EAAa,YAAY,OAAQ,CAC/B,GAAGiB,EACH,WAAYQ,CACd,CAAC,EAED,MAAMI,EAAc,CAClB,OAAQb,EACR,QAAS,CACP,MAAOF,EACP,UAAWC,CACb,EACA,SAAAJ,EACA,UAAAC,EACA,aAAAC,EACA,OAAAH,EACA,WAAYe,CACd,EAGA,OAAO,cAAc,IAAIK,EAAoBD,CAAW,CAAC,EAGrDF,GACF,OAAO,cAAc,IAAII,EAAqBF,CAAW,CAAC,CAE9D,OAASG,EAAK,CACZ,MAAM,IAAIC,EAAU,gCAAiC,CAAE,MAAOD,CAAI,CAAC,CACrE,CACF,CAAC,EACDvC,EACA,CAAE,QAAS,EAAK,CAClB"}
@@ -1,2 +1,2 @@
1
- import{d as B,i as A}from"./lodash-7H4x2457.esm.js";import{D as v,H as S,b as _}from"./routes-S0vKQTft.esm.js";import{B as K}from"./beam-errors-Ci0d3926.esm.js";import{f as L,g as R,h as J}from"./events-BohmT6Lp.esm.js";import{createScopedLocalStorage as U}from"../utils/local-storage.js";import{setCookieValue as x}from"../utils/cookies.js";import{getRemoteSession as D}from"../utils/remote-session.js";import{memoizeLast as M}from"../utils/memoize-last.js";import{f as N}from"./promoManager-B9cTR1R3.esm.js";import{B as b}from"./cart-contents-DkoytiZh.esm.js";import{getBeamCartId as O}from"../utils/cart.js";const P=50,T=B(M(async function(e,m,E=!1){try{const t=U({apiKey:e.apiKey}),l=e.baseUrl??v,o=t.getItemJson("cart"),a=O(b,e),w=D(e)??void 0,{cartId:n,subtotal:i,itemCount:d,currencyCode:c,content:{items:C=[],discounts:u=[]}={},schema:p={source:"generic"}}=m,r={cartId:n,subtotal:i,itemCount:d,currencyCode:c,content:{items:C,discounts:u},schema:p,beamCartId:a};if(E&&!o&&m?.itemCount){t.setItemJson("cart",{...r,beamCartId:a});return}if(A(r,{...o,cartId:o?.cartId})||m.itemCount===0&&(!a||o?.itemCount===0)){t.setItemJson("cart",{...r,beamCartId:a});return}N((u??[]).map(g=>({value:g?.code})),e.apiKey),window.dispatchEvent(new L({source:S.cart_update}));const h=await _({baseUrl:l,headers:{authorization:`Api-Key ${e.apiKey}`},requestBody:{beamCartId:a,storeId:e.storeId,remoteSessionId:w,cartId:n,subtotal:i,itemCount:d,currencyCode:c}}),{beamCartId:s,expiresAt:I,beamCartCreated:y}=h;s&&I&&await x({name:b,domain:e.domain,value:s,path:"/",expires:new Date(I).getTime()}),t.setItemJson("cart",{...r,beamCartId:s});const f={schema:p,content:{items:C,discounts:u},subtotal:i,itemCount:d,currencyCode:c,cartId:n,beamCartId:s};window.dispatchEvent(new R(f)),y&&window.dispatchEvent(new J(f))}catch(t){throw new K("Could not update cart in Beam",{cause:t})}}),P,{leading:!0});export{T as O};
2
- //# sourceMappingURL=update-cart-g_YbHKJQ.esm.js.map
1
+ import{d as B,i as A}from"./lodash-D3TLHRR_.esm.js";import{D as v,H as S,b as _}from"./routes-D-AQPRne.esm.js";import{B as K}from"./beam-errors-Ci0d3926.esm.js";import{f as L,g as R,h as J}from"./events-BohmT6Lp.esm.js";import{createScopedLocalStorage as U}from"../utils/local-storage.js";import{setCookieValue as x}from"../utils/cookies.js";import{getRemoteSession as D}from"../utils/remote-session.js";import{memoizeLast as M}from"../utils/memoize-last.js";import{f as N}from"./promoManager-B9cTR1R3.esm.js";import{B as b}from"./cart-contents-DkoytiZh.esm.js";import{getBeamCartId as O}from"../utils/cart.js";const P=50,T=B(M(async function(e,m,E=!1){try{const t=U({apiKey:e.apiKey}),l=e.baseUrl??v,o=t.getItemJson("cart"),a=O(b,e),w=D(e)??void 0,{cartId:n,subtotal:i,itemCount:d,currencyCode:c,content:{items:C=[],discounts:u=[]}={},schema:p={source:"generic"}}=m,r={cartId:n,subtotal:i,itemCount:d,currencyCode:c,content:{items:C,discounts:u},schema:p,beamCartId:a};if(E&&!o&&m?.itemCount){t.setItemJson("cart",{...r,beamCartId:a});return}if(A(r,{...o,cartId:o?.cartId})||m.itemCount===0&&(!a||o?.itemCount===0)){t.setItemJson("cart",{...r,beamCartId:a});return}N((u??[]).map(g=>({value:g?.code})),e.apiKey),window.dispatchEvent(new L({source:S.cart_update}));const h=await _({baseUrl:l,headers:{authorization:`Api-Key ${e.apiKey}`},requestBody:{beamCartId:a,storeId:e.storeId,remoteSessionId:w,cartId:n,subtotal:i,itemCount:d,currencyCode:c}}),{beamCartId:s,expiresAt:I,beamCartCreated:y}=h;s&&I&&await x({name:b,domain:e.domain,value:s,path:"/",expires:new Date(I).getTime()}),t.setItemJson("cart",{...r,beamCartId:s});const f={schema:p,content:{items:C,discounts:u},subtotal:i,itemCount:d,currencyCode:c,cartId:n,beamCartId:s};window.dispatchEvent(new R(f)),y&&window.dispatchEvent(new J(f))}catch(t){throw new K("Could not update cart in Beam",{cause:t})}}),P,{leading:!0});export{T as O};
2
+ //# sourceMappingURL=update-cart-y9guItUM.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"update-cart-g_YbHKJQ.esm.js","sources":["../../src/integrations/cart/update-cart.ts"],"sourcesContent":["import isEqual from \"lodash-es/isEqual\";\nimport { DEFAULT_BASE_URL, HELPER_NAMES } from \"../../api-sdk/constants\";\nimport { BeamBaseAPIConfig } from \"../../api-sdk/types\";\nimport { postCart } from \"../../api-sdk/v3/routes\";\nimport { debounce, memoizeLast } from \"../../utils\";\nimport { BeamError } from \"../../utils/beam-errors\";\nimport { BEAM_CART_COOKIE_NAME, TBeamCartLocalStorage, TCartApi } from \"../../shared/cart-contents\";\nimport { setCookieValue } from \"../../utils/cookies\";\nimport { BeamCartChangeEvent, BeamCartCreatedEvent, BeamWidgetStoredPromoCodesEvent } from \"../../utils/events\";\nimport { createScopedLocalStorage } from \"../../utils/local-storage\";\nimport { getRemoteSession } from \"../../utils/remote-session\";\nimport { getBeamCartId } from \"../../utils/cart\";\nimport { formatStoreAndReturnPromoCodes } from \"../../utils/promoManager\";\n\nexport type BeamCartAPIConfig = BeamBaseAPIConfig & {\n storeId: number;\n domain?: string; // Domain to set cookies on\n statsigExperiment?: string;\n};\n\nexport type BeamCartValues = {\n cartId?: string; // External (partner) cart ID\n itemCount?: number;\n subtotal?: number;\n currencyCode?: string;\n} & Partial<TCartApi>;\n\n/**\n * The debounce time in milliseconds for updating the cart - updateCart will delay until it hasn't been called for\n * this long before handling the last call.\n */\nconst UPDATE_CART_DEBOUNCE_MS = 50;\n\n/**\n * Sends cart information to Beam\n * Memoized based on previous arguments - if the objects are deep-equal, no update is made.\n * @side-effects Sets beam_cart cookie, set cart data in localstorage\n * @example\n * const BeamConfig = { apiKey: 'abc-123' }\n * const { beamCartId } = await updateCart(BeamConfig, { beamCartId, itemCount, subtotal, currencyCode })\n * */\nconst updateCart = debounce(\n memoizeLast(async function updateCart(\n config: BeamCartAPIConfig,\n cartValues: BeamCartValues,\n isFirstCartUpdateOnPageLoad = false\n ) {\n try {\n const localStorage = createScopedLocalStorage({ apiKey: config.apiKey });\n const baseUrl = config.baseUrl ?? DEFAULT_BASE_URL;\n\n // The cart cache is used to detect changes after page refreshes / across tabs\n const cachedCart: TBeamCartLocalStorage | null = localStorage.getItemJson(\"cart\");\n // The Beam cart cookie is used to identify the cart across subdomains\n // Use explicit null if empty because API requires it\n const beamCartId: string | null = getBeamCartId(BEAM_CART_COOKIE_NAME, config);\n // Remote session ID (ie, device ID from an A/B testing tool) will be linked to the cart\n const remoteSessionId: string | undefined = getRemoteSession(config) ?? undefined;\n\n const {\n cartId,\n subtotal,\n itemCount,\n currencyCode,\n content: { items = [], discounts = [] } = {},\n schema = { source: \"generic\" },\n } = cartValues;\n\n const cartWithDefaults = {\n cartId,\n subtotal,\n itemCount,\n currencyCode,\n content: { items, discounts },\n schema,\n beamCartId,\n };\n\n // If this is our first time calling \"updateCart\" on page load, and there is\n // no prior \"cachedCart\", and the current Platform cart is not empty,\n // we should assume that the cart has not been interacted with.\n // In this case, we want to cache the current cart, but not send it to Beam\n // so that the next time we call this method, it will compare to the existing\n // Platform cart\n if (isFirstCartUpdateOnPageLoad && !cachedCart && !!cartValues?.itemCount) {\n // logger.debug(\n // \"[update-cart] first attempt to update cart; no prior cart found, cart is not empty; skipping update to Beam\"\n // );\n localStorage.setItemJson(\"cart\", {\n ...cartWithDefaults,\n beamCartId: beamCartId,\n });\n\n return;\n }\n\n // Early return conditions. Skip sending cart to Beam if any apply:\n // 1. The cart has not changed\n // 2. Cart is empty, unless the cart was not empty before\n if (\n isEqual(cartWithDefaults, {\n ...cachedCart,\n cartId: cachedCart?.cartId /* make sure optional key is defined even if empty */,\n }) || // cart has not changed, OR\n (cartValues.itemCount === 0 && // nothing in current cart, AND\n (!beamCartId || cachedCart?.itemCount === 0)) // no/expired prev cart or prev cart was empty\n ) {\n // logger.debug(\"[update-cart] cart not changed\");\n // If the cart has not changed because the cart is empty now,\n // we still want to save that this changed happened in our cached cart\n // so the next update will compare against a current cart\n localStorage.setItemJson(\"cart\", {\n ...cartWithDefaults,\n beamCartId: beamCartId,\n });\n\n return;\n }\n\n formatStoreAndReturnPromoCodes(\n (discounts ?? []).map((discount) => ({ value: discount?.code })),\n config.apiKey\n );\n window.dispatchEvent(new BeamWidgetStoredPromoCodesEvent({ source: HELPER_NAMES.cart_update }));\n // logger.debug(\"[update-cart] sending cart update request\");\n const response = await postCart({\n baseUrl,\n headers: {\n authorization: `Api-Key ${config.apiKey}`,\n },\n requestBody: {\n beamCartId, // backwards compat: explicitly sending null here is required to get initial beamCartId\n storeId: config.storeId,\n remoteSessionId,\n cartId,\n subtotal,\n itemCount,\n currencyCode,\n },\n });\n\n // Response will contain a new beamCartId if one was not provided, or old one expired\n const { beamCartId: newBeamCartId, expiresAt, beamCartCreated } = response;\n\n if (newBeamCartId && expiresAt) {\n await setCookieValue({\n name: BEAM_CART_COOKIE_NAME,\n domain: config.domain,\n value: newBeamCartId,\n path: \"/\",\n // If we don't set an expiration, the cookie will be cleared when the tab is closed\n expires: new Date(expiresAt).getTime(),\n });\n }\n\n localStorage.setItemJson(\"cart\", {\n ...cartWithDefaults,\n beamCartId: newBeamCartId,\n });\n\n const eventDetail = {\n schema: schema as any, // TS union type can't figure out what variant applies here\n content: {\n items: items as any,\n discounts: discounts as any,\n },\n subtotal,\n itemCount,\n currencyCode,\n cartId,\n beamCartId: newBeamCartId,\n };\n\n // emit change event on any create/update/delete of cart items\n window.dispatchEvent(new BeamCartChangeEvent(eventDetail));\n\n // emit created event only when the cart is new according to Beam\n if (beamCartCreated) {\n window.dispatchEvent(new BeamCartCreatedEvent(eventDetail));\n }\n } catch (err) {\n throw new BeamError(\"Could not update cart in Beam\", { cause: err });\n }\n }),\n UPDATE_CART_DEBOUNCE_MS,\n { leading: true } // handle first call immediately but delay for more calls within debounce window\n);\n\nexport { updateCart };\n"],"names":["UPDATE_CART_DEBOUNCE_MS","updateCart","debounce","memoizeLast","config","cartValues","isFirstCartUpdateOnPageLoad","localStorage","createScopedLocalStorage","baseUrl","DEFAULT_BASE_URL","cachedCart","beamCartId","getBeamCartId","BEAM_CART_COOKIE_NAME","remoteSessionId","getRemoteSession","cartId","subtotal","itemCount","currencyCode","items","discounts","schema","cartWithDefaults","isEqual","formatStoreAndReturnPromoCodes","discount","BeamWidgetStoredPromoCodesEvent","HELPER_NAMES","response","postCart","newBeamCartId","expiresAt","beamCartCreated","setCookieValue","eventDetail","BeamCartChangeEvent","BeamCartCreatedEvent","err","BeamError"],"mappings":"ymBA+BMA,EAA0B,GAU1BC,EAAaC,EACjBC,EAAY,eACVC,EACAC,EACAC,EAA8B,GAC9B,CACA,GAAI,CACF,MAAMC,EAAeC,EAAyB,CAAE,OAAQJ,EAAO,MAAO,CAAC,EACjEK,EAAUL,EAAO,SAAWM,EAG5BC,EAA2CJ,EAAa,YAAY,MAAM,EAG1EK,EAA4BC,EAAcC,EAAuBV,CAAM,EAEvEW,EAAsCC,EAAiBZ,CAAM,GAAK,OAElE,CACJ,OAAAa,EACA,SAAAC,EACA,UAAAC,EACA,aAAAC,EACA,QAAS,CAAE,MAAAC,EAAQ,CAAI,EAAA,UAAAC,EAAY,CAAG,CAAA,EAAI,CAAA,EAC1C,OAAAC,EAAS,CAAE,OAAQ,SAAU,CAC/B,EAAIlB,EAEEmB,EAAmB,CACvB,OAAAP,EACA,SAAAC,EACA,UAAAC,EACA,aAAAC,EACA,QAAS,CAAE,MAAAC,EAAO,UAAAC,CAAU,EAC5B,OAAAC,EACA,WAAAX,CACF,EAQA,GAAIN,GAA+B,CAACK,GAAgBN,GAAY,UAAW,CAIzEE,EAAa,YAAY,OAAQ,CAC/B,GAAGiB,EACH,WAAYZ,CACd,CAAC,EAED,MACF,CAKA,GACEa,EAAQD,EAAkB,CACxB,GAAGb,EACH,OAAQA,GAAY,MACtB,CAAC,GACAN,EAAW,YAAc,IACvB,CAACO,GAAcD,GAAY,YAAc,GAC5C,CAKAJ,EAAa,YAAY,OAAQ,CAC/B,GAAGiB,EACH,WAAYZ,CACd,CAAC,EAED,MACF,CAEAc,GACGJ,GAAa,CAAC,GAAG,IAAKK,IAAc,CAAE,MAAOA,GAAU,IAAK,EAAE,EAC/DvB,EAAO,MACT,EACA,OAAO,cAAc,IAAIwB,EAAgC,CAAE,OAAQC,EAAa,WAAY,CAAC,CAAC,EAE9F,MAAMC,EAAW,MAAMC,EAAS,CAC9B,QAAAtB,EACA,QAAS,CACP,cAAe,WAAWL,EAAO,MAAM,EACzC,EACA,YAAa,CACX,WAAAQ,EACA,QAASR,EAAO,QAChB,gBAAAW,EACA,OAAAE,EACA,SAAAC,EACA,UAAAC,EACA,aAAAC,CACF,CACF,CAAC,EAGK,CAAE,WAAYY,EAAe,UAAAC,EAAW,gBAAAC,CAAgB,EAAIJ,EAE9DE,GAAiBC,GACnB,MAAME,EAAe,CACnB,KAAMrB,EACN,OAAQV,EAAO,OACf,MAAO4B,EACP,KAAM,IAEN,QAAS,IAAI,KAAKC,CAAS,EAAE,QAAA,CAC/B,CAAC,EAGH1B,EAAa,YAAY,OAAQ,CAC/B,GAAGiB,EACH,WAAYQ,CACd,CAAC,EAED,MAAMI,EAAc,CAClB,OAAQb,EACR,QAAS,CACP,MAAOF,EACP,UAAWC,CACb,EACA,SAAAJ,EACA,UAAAC,EACA,aAAAC,EACA,OAAAH,EACA,WAAYe,CACd,EAGA,OAAO,cAAc,IAAIK,EAAoBD,CAAW,CAAC,EAGrDF,GACF,OAAO,cAAc,IAAII,EAAqBF,CAAW,CAAC,CAE9D,OAASG,EAAK,CACZ,MAAM,IAAIC,EAAU,gCAAiC,CAAE,MAAOD,CAAI,CAAC,CACrE,CACF,CAAC,EACDvC,EACA,CAAE,QAAS,EAAK,CAClB"}
1
+ {"version":3,"file":"update-cart-y9guItUM.esm.js","sources":["../../src/integrations/cart/update-cart.ts"],"sourcesContent":["import isEqual from \"lodash-es/isEqual\";\nimport { DEFAULT_BASE_URL, HELPER_NAMES } from \"../../api-sdk/constants\";\nimport { BeamBaseAPIConfig } from \"../../api-sdk/types\";\nimport { postCart } from \"../../api-sdk/v3/routes\";\nimport { debounce, memoizeLast } from \"../../utils\";\nimport { BeamError } from \"../../utils/beam-errors\";\nimport { BEAM_CART_COOKIE_NAME, TBeamCartLocalStorage, TCartApi } from \"../../shared/cart-contents\";\nimport { setCookieValue } from \"../../utils/cookies\";\nimport { BeamCartChangeEvent, BeamCartCreatedEvent, BeamWidgetStoredPromoCodesEvent } from \"../../utils/events\";\nimport { createScopedLocalStorage } from \"../../utils/local-storage\";\nimport { getRemoteSession } from \"../../utils/remote-session\";\nimport { getBeamCartId } from \"../../utils/cart\";\nimport { formatStoreAndReturnPromoCodes } from \"../../utils/promoManager\";\n\nexport type BeamCartAPIConfig = BeamBaseAPIConfig & {\n storeId: number;\n domain?: string; // Domain to set cookies on\n statsigExperiment?: string;\n};\n\nexport type BeamCartValues = {\n cartId?: string; // External (partner) cart ID\n itemCount?: number;\n subtotal?: number;\n currencyCode?: string;\n} & Partial<TCartApi>;\n\n/**\n * The debounce time in milliseconds for updating the cart - updateCart will delay until it hasn't been called for\n * this long before handling the last call.\n */\nconst UPDATE_CART_DEBOUNCE_MS = 50;\n\n/**\n * Sends cart information to Beam\n * Memoized based on previous arguments - if the objects are deep-equal, no update is made.\n * @side-effects Sets beam_cart cookie, set cart data in localstorage\n * @example\n * const BeamConfig = { apiKey: 'abc-123' }\n * const { beamCartId } = await updateCart(BeamConfig, { beamCartId, itemCount, subtotal, currencyCode })\n * */\nconst updateCart = debounce(\n memoizeLast(async function updateCart(\n config: BeamCartAPIConfig,\n cartValues: BeamCartValues,\n isFirstCartUpdateOnPageLoad = false\n ) {\n try {\n const localStorage = createScopedLocalStorage({ apiKey: config.apiKey });\n const baseUrl = config.baseUrl ?? DEFAULT_BASE_URL;\n\n // The cart cache is used to detect changes after page refreshes / across tabs\n const cachedCart: TBeamCartLocalStorage | null = localStorage.getItemJson(\"cart\");\n // The Beam cart cookie is used to identify the cart across subdomains\n // Use explicit null if empty because API requires it\n const beamCartId: string | null = getBeamCartId(BEAM_CART_COOKIE_NAME, config);\n // Remote session ID (ie, device ID from an A/B testing tool) will be linked to the cart\n const remoteSessionId: string | undefined = getRemoteSession(config) ?? undefined;\n\n const {\n cartId,\n subtotal,\n itemCount,\n currencyCode,\n content: { items = [], discounts = [] } = {},\n schema = { source: \"generic\" },\n } = cartValues;\n\n const cartWithDefaults = {\n cartId,\n subtotal,\n itemCount,\n currencyCode,\n content: { items, discounts },\n schema,\n beamCartId,\n };\n\n // If this is our first time calling \"updateCart\" on page load, and there is\n // no prior \"cachedCart\", and the current Platform cart is not empty,\n // we should assume that the cart has not been interacted with.\n // In this case, we want to cache the current cart, but not send it to Beam\n // so that the next time we call this method, it will compare to the existing\n // Platform cart\n if (isFirstCartUpdateOnPageLoad && !cachedCart && !!cartValues?.itemCount) {\n // logger.debug(\n // \"[update-cart] first attempt to update cart; no prior cart found, cart is not empty; skipping update to Beam\"\n // );\n localStorage.setItemJson(\"cart\", {\n ...cartWithDefaults,\n beamCartId: beamCartId,\n });\n\n return;\n }\n\n // Early return conditions. Skip sending cart to Beam if any apply:\n // 1. The cart has not changed\n // 2. Cart is empty, unless the cart was not empty before\n if (\n isEqual(cartWithDefaults, {\n ...cachedCart,\n cartId: cachedCart?.cartId /* make sure optional key is defined even if empty */,\n }) || // cart has not changed, OR\n (cartValues.itemCount === 0 && // nothing in current cart, AND\n (!beamCartId || cachedCart?.itemCount === 0)) // no/expired prev cart or prev cart was empty\n ) {\n // logger.debug(\"[update-cart] cart not changed\");\n // If the cart has not changed because the cart is empty now,\n // we still want to save that this changed happened in our cached cart\n // so the next update will compare against a current cart\n localStorage.setItemJson(\"cart\", {\n ...cartWithDefaults,\n beamCartId: beamCartId,\n });\n\n return;\n }\n\n formatStoreAndReturnPromoCodes(\n (discounts ?? []).map((discount) => ({ value: discount?.code })),\n config.apiKey\n );\n window.dispatchEvent(new BeamWidgetStoredPromoCodesEvent({ source: HELPER_NAMES.cart_update }));\n // logger.debug(\"[update-cart] sending cart update request\");\n const response = await postCart({\n baseUrl,\n headers: {\n authorization: `Api-Key ${config.apiKey}`,\n },\n requestBody: {\n beamCartId, // backwards compat: explicitly sending null here is required to get initial beamCartId\n storeId: config.storeId,\n remoteSessionId,\n cartId,\n subtotal,\n itemCount,\n currencyCode,\n },\n });\n\n // Response will contain a new beamCartId if one was not provided, or old one expired\n const { beamCartId: newBeamCartId, expiresAt, beamCartCreated } = response;\n\n if (newBeamCartId && expiresAt) {\n await setCookieValue({\n name: BEAM_CART_COOKIE_NAME,\n domain: config.domain,\n value: newBeamCartId,\n path: \"/\",\n // If we don't set an expiration, the cookie will be cleared when the tab is closed\n expires: new Date(expiresAt).getTime(),\n });\n }\n\n localStorage.setItemJson(\"cart\", {\n ...cartWithDefaults,\n beamCartId: newBeamCartId,\n });\n\n const eventDetail = {\n schema: schema as any, // TS union type can't figure out what variant applies here\n content: {\n items: items as any,\n discounts: discounts as any,\n },\n subtotal,\n itemCount,\n currencyCode,\n cartId,\n beamCartId: newBeamCartId,\n };\n\n // emit change event on any create/update/delete of cart items\n window.dispatchEvent(new BeamCartChangeEvent(eventDetail));\n\n // emit created event only when the cart is new according to Beam\n if (beamCartCreated) {\n window.dispatchEvent(new BeamCartCreatedEvent(eventDetail));\n }\n } catch (err) {\n throw new BeamError(\"Could not update cart in Beam\", { cause: err });\n }\n }),\n UPDATE_CART_DEBOUNCE_MS,\n { leading: true } // handle first call immediately but delay for more calls within debounce window\n);\n\nexport { updateCart };\n"],"names":["UPDATE_CART_DEBOUNCE_MS","updateCart","debounce","memoizeLast","config","cartValues","isFirstCartUpdateOnPageLoad","localStorage","createScopedLocalStorage","baseUrl","DEFAULT_BASE_URL","cachedCart","beamCartId","getBeamCartId","BEAM_CART_COOKIE_NAME","remoteSessionId","getRemoteSession","cartId","subtotal","itemCount","currencyCode","items","discounts","schema","cartWithDefaults","isEqual","formatStoreAndReturnPromoCodes","discount","BeamWidgetStoredPromoCodesEvent","HELPER_NAMES","response","postCart","newBeamCartId","expiresAt","beamCartCreated","setCookieValue","eventDetail","BeamCartChangeEvent","BeamCartCreatedEvent","err","BeamError"],"mappings":"ymBA+BMA,EAA0B,GAU1BC,EAAaC,EACjBC,EAAY,eACVC,EACAC,EACAC,EAA8B,GAC9B,CACA,GAAI,CACF,MAAMC,EAAeC,EAAyB,CAAE,OAAQ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AC,EAAW,gBAAAC,CAAgB,EAAIJ,EAE9DE,GAAiBC,GACnB,MAAME,EAAe,CACnB,KAAMrB,EACN,OAAQV,EAAO,OACf,MAAO4B,EACP,KAAM,IAEN,QAAS,IAAI,KAAKC,CAAS,EAAE,QAAA,CAC/B,CAAC,EAGH1B,EAAa,YAAY,OAAQ,CAC/B,GAAGiB,EACH,WAAYQ,CACd,CAAC,EAED,MAAMI,EAAc,CAClB,OAAQb,EACR,QAAS,CACP,MAAOF,EACP,UAAWC,CACb,EACA,SAAAJ,EACA,UAAAC,EACA,aAAAC,EACA,OAAAH,EACA,WAAYe,CACd,EAGA,OAAO,cAAc,IAAIK,EAAoBD,CAAW,CAAC,EAGrDF,GACF,OAAO,cAAc,IAAII,EAAqBF,CAAW,CAAC,CAE9D,OAASG,EAAK,CACZ,MAAM,IAAIC,EAAU,gCAAiC,CAAE,MAAOD,CAAI,CAAC,CACrE,CACF,CAAC,EACDvC,EACA,CAAE,QAAS,EAAK,CAClB"}
@@ -1,4 +1,4 @@
1
- import{f as x,g as d,t as I,h as v,k as b,y as g,m as u}from"../chunks/lit-WqMxC_PA.esm.js";import{p as $}from"../chunks/progress-bar-DF7UuuHb.esm.js";import{partnerLogosConfigDefaults as T}from"./beam-partner-logos.esm.js";import{c as k,d as w,e as S}from"../chunks/enforce-config-CZ3ToOgr.esm.js";import{u as n,A as L,i as s,_ as f,d as m,a as A}from"../chunks/localize-Btu9xYcE.esm.js";import{D as z,g as F,W as D,S as M}from"../chunks/routes-TtLdALcf.esm.js";import{_ as U}from"../chunks/loading-template-DG4lkIIc.esm.js";import{B as E}from"../chunks/beam-errors-Ci0d3926.esm.js";import{c as C}from"../chunks/css-card-grid-CvoGpsJH.esm.js";import"../utils/logger.esm.js";const y={en:{fundedTimes:({times:i=0})=>`Funded <b>${i}</b> ${i>1?"times":"time"} so far`,learnMore:()=>"Learn more",seeAll:()=>"See All"},fr:{fundedTimes:({times:i=0})=>`Financ\xE9 <b>${i}</b> fois pour l'instant`,learnMore:()=>"En savoir plus",seeAll:()=>"Voir tout"},de:{fundedTimes:({times:i=0})=>`<b>${i}</b> Mal finanziert`,learnMore:()=>"Mehr erfahren",seeAll:()=>"Alle anzeigen"},es:{fundedTimes:({times:i=0})=>`Financiado <b>${i}</b> ${i>1?"vez":"veces"}`,learnMore:()=>"Saber m\xE1s",seeAll:()=>"Ver Todo"},it:{fundedTimes:({times:i=0})=>`Finanziato <b>${i}</b> ${i>1?"volta":"volte"}`,learnMore:()=>"Scopri di pi\xF9",seeAll:()=>"Vedi Tutto"},pl:{fundedTimes:({times:i=0})=>`Udzielono wsparcia <b>${i}</b> ${i>1?"razy":"raz"}`,learnMore:()=>"Dowiedz si\u0119 wi\u0119cej",seeAll:()=>"Zobacz wszystko"}};var _=Object.defineProperty,l=(i,a,t,r)=>{for(var o=void 0,e=i.length-1,p;e>=0;e--)(p=i[e])&&(o=p(a,t,o)||o);return o&&_(a,t,o),o};class c extends v{constructor(){super(...arguments),this.baseUrl=z,this.cardStyle="image",this.lang="en",this.debug=!1,this.draftConfig=!1,this.selectedFilter=null,this.getImpactData=async()=>(S(["apiKey","chainId"],this),F({baseUrl:this.baseUrl,headers:{authorization:`Api-Key ${this.apiKey}`},queryParams:{chainId:this.chainId,personalImpactLimit:0,widgetName:D.community_impact,version:"1.0.0",lang:this.configLang,draftConfig:this.draftConfig}})),this.impactDataController=new L(this,this.getImpactData),this.renderImageCard=a=>{const t=`${a.nonprofit?.name} image`,r=`Learn more about ${a.nonprofit?.name}`;return g`
1
+ import{f as x,g as d,t as I,h as v,k as b,y as g,m as u}from"../chunks/lit-WqMxC_PA.esm.js";import{p as $}from"../chunks/progress-bar-DF7UuuHb.esm.js";import{partnerLogosConfigDefaults as T}from"./beam-partner-logos.esm.js";import{c as k,d as w,e as S}from"../chunks/enforce-config-CZ3ToOgr.esm.js";import{u as n,A as L,i as s,_ as f,d as m,a as A}from"../chunks/localize-Btu9xYcE.esm.js";import{D as z,g as F,W as D,S as M}from"../chunks/routes-Lvj2SXN4.esm.js";import{_ as U}from"../chunks/loading-template-DG4lkIIc.esm.js";import{B as E}from"../chunks/beam-errors-Ci0d3926.esm.js";import{c as C}from"../chunks/css-card-grid-CvoGpsJH.esm.js";import"../utils/logger.esm.js";const y={en:{fundedTimes:({times:i=0})=>`Funded <b>${i}</b> ${i>1?"times":"time"} so far`,learnMore:()=>"Learn more",seeAll:()=>"See All"},fr:{fundedTimes:({times:i=0})=>`Financ\xE9 <b>${i}</b> fois pour l'instant`,learnMore:()=>"En savoir plus",seeAll:()=>"Voir tout"},de:{fundedTimes:({times:i=0})=>`<b>${i}</b> Mal finanziert`,learnMore:()=>"Mehr erfahren",seeAll:()=>"Alle anzeigen"},es:{fundedTimes:({times:i=0})=>`Financiado <b>${i}</b> ${i>1?"vez":"veces"}`,learnMore:()=>"Saber m\xE1s",seeAll:()=>"Ver Todo"},it:{fundedTimes:({times:i=0})=>`Finanziato <b>${i}</b> ${i>1?"volta":"volte"}`,learnMore:()=>"Scopri di pi\xF9",seeAll:()=>"Vedi Tutto"},pl:{fundedTimes:({times:i=0})=>`Udzielono wsparcia <b>${i}</b> ${i>1?"razy":"raz"}`,learnMore:()=>"Dowiedz si\u0119 wi\u0119cej",seeAll:()=>"Zobacz wszystko"}};var _=Object.defineProperty,l=(i,a,t,r)=>{for(var o=void 0,e=i.length-1,p;e>=0;e--)(p=i[e])&&(o=p(a,t,o)||o);return o&&_(a,t,o),o};class c extends v{constructor(){super(...arguments),this.baseUrl=z,this.cardStyle="image",this.lang="en",this.debug=!1,this.draftConfig=!1,this.selectedFilter=null,this.getImpactData=async()=>(S(["apiKey","chainId"],this),F({baseUrl:this.baseUrl,headers:{authorization:`Api-Key ${this.apiKey}`},queryParams:{chainId:this.chainId,personalImpactLimit:0,widgetName:D.community_impact,version:"1.0.0",lang:this.configLang,draftConfig:this.draftConfig}})),this.impactDataController=new L(this,this.getImpactData),this.renderImageCard=a=>{const t=`${a.nonprofit?.name} image`,r=`Learn more about ${a.nonprofit?.name}`;return g`
2
2
  <div class="image-card" part="nonprofit-card" style="display: flex; flex-direction: column;">
3
3
  <div
4
4
  class="image-card-image-box"
@@ -1,4 +1,4 @@
1
- import{f as x,g as d,t as I,h as v,k as b,y as g,m as u}from"../chunks/lit-WqMxC_PA.esm.js";import{p as $}from"../chunks/progress-bar-DF7UuuHb.esm.js";import{partnerLogosConfigDefaults as T}from"./beam-partner-logos.js";import{c as k,d as w,e as S}from"../chunks/enforce-config-Ba1JkOHs.esm.js";import{u as n,A as L,i as s,_ as f,d as m,a as A}from"../chunks/localize-C25pEGnx.esm.js";import{D as z,g as F,W as D,S as M}from"../chunks/routes-S0vKQTft.esm.js";import{_ as U}from"../chunks/loading-template-DG4lkIIc.esm.js";import{B as E}from"../chunks/beam-errors-Ci0d3926.esm.js";import{c as C}from"../chunks/css-card-grid-CvoGpsJH.esm.js";import"../utils/logger.js";const y={en:{fundedTimes:({times:i=0})=>`Funded <b>${i}</b> ${i>1?"times":"time"} so far`,learnMore:()=>"Learn more",seeAll:()=>"See All"},fr:{fundedTimes:({times:i=0})=>`Financ\xE9 <b>${i}</b> fois pour l'instant`,learnMore:()=>"En savoir plus",seeAll:()=>"Voir tout"},de:{fundedTimes:({times:i=0})=>`<b>${i}</b> Mal finanziert`,learnMore:()=>"Mehr erfahren",seeAll:()=>"Alle anzeigen"},es:{fundedTimes:({times:i=0})=>`Financiado <b>${i}</b> ${i>1?"vez":"veces"}`,learnMore:()=>"Saber m\xE1s",seeAll:()=>"Ver Todo"},it:{fundedTimes:({times:i=0})=>`Finanziato <b>${i}</b> ${i>1?"volta":"volte"}`,learnMore:()=>"Scopri di pi\xF9",seeAll:()=>"Vedi Tutto"},pl:{fundedTimes:({times:i=0})=>`Udzielono wsparcia <b>${i}</b> ${i>1?"razy":"raz"}`,learnMore:()=>"Dowiedz si\u0119 wi\u0119cej",seeAll:()=>"Zobacz wszystko"}};var _=Object.defineProperty,l=(i,a,t,r)=>{for(var o=void 0,e=i.length-1,p;e>=0;e--)(p=i[e])&&(o=p(a,t,o)||o);return o&&_(a,t,o),o};class c extends v{constructor(){super(...arguments),this.baseUrl=z,this.cardStyle="image",this.lang="en",this.debug=!1,this.draftConfig=!1,this.selectedFilter=null,this.getImpactData=async()=>(S(["apiKey","chainId"],this),F({baseUrl:this.baseUrl,headers:{authorization:`Api-Key ${this.apiKey}`},queryParams:{chainId:this.chainId,personalImpactLimit:0,widgetName:D.community_impact,version:"1.0.0",lang:this.configLang,draftConfig:this.draftConfig}})),this.impactDataController=new L(this,this.getImpactData),this.renderImageCard=a=>{const t=`${a.nonprofit?.name} image`,r=`Learn more about ${a.nonprofit?.name}`;return g`
1
+ import{f as x,g as d,t as I,h as v,k as b,y as g,m as u}from"../chunks/lit-WqMxC_PA.esm.js";import{p as $}from"../chunks/progress-bar-DF7UuuHb.esm.js";import{partnerLogosConfigDefaults as T}from"./beam-partner-logos.js";import{c as k,d as w,e as S}from"../chunks/enforce-config-Ba1JkOHs.esm.js";import{u as n,A as L,i as s,_ as f,d as m,a as A}from"../chunks/localize-C25pEGnx.esm.js";import{D as z,g as F,W as D,S as M}from"../chunks/routes-D-AQPRne.esm.js";import{_ as U}from"../chunks/loading-template-DG4lkIIc.esm.js";import{B as E}from"../chunks/beam-errors-Ci0d3926.esm.js";import{c as C}from"../chunks/css-card-grid-CvoGpsJH.esm.js";import"../utils/logger.js";const y={en:{fundedTimes:({times:i=0})=>`Funded <b>${i}</b> ${i>1?"times":"time"} so far`,learnMore:()=>"Learn more",seeAll:()=>"See All"},fr:{fundedTimes:({times:i=0})=>`Financ\xE9 <b>${i}</b> fois pour l'instant`,learnMore:()=>"En savoir plus",seeAll:()=>"Voir tout"},de:{fundedTimes:({times:i=0})=>`<b>${i}</b> Mal finanziert`,learnMore:()=>"Mehr erfahren",seeAll:()=>"Alle anzeigen"},es:{fundedTimes:({times:i=0})=>`Financiado <b>${i}</b> ${i>1?"vez":"veces"}`,learnMore:()=>"Saber m\xE1s",seeAll:()=>"Ver Todo"},it:{fundedTimes:({times:i=0})=>`Finanziato <b>${i}</b> ${i>1?"volta":"volte"}`,learnMore:()=>"Scopri di pi\xF9",seeAll:()=>"Vedi Tutto"},pl:{fundedTimes:({times:i=0})=>`Udzielono wsparcia <b>${i}</b> ${i>1?"razy":"raz"}`,learnMore:()=>"Dowiedz si\u0119 wi\u0119cej",seeAll:()=>"Zobacz wszystko"}};var _=Object.defineProperty,l=(i,a,t,r)=>{for(var o=void 0,e=i.length-1,p;e>=0;e--)(p=i[e])&&(o=p(a,t,o)||o);return o&&_(a,t,o),o};class c extends v{constructor(){super(...arguments),this.baseUrl=z,this.cardStyle="image",this.lang="en",this.debug=!1,this.draftConfig=!1,this.selectedFilter=null,this.getImpactData=async()=>(S(["apiKey","chainId"],this),F({baseUrl:this.baseUrl,headers:{authorization:`Api-Key ${this.apiKey}`},queryParams:{chainId:this.chainId,personalImpactLimit:0,widgetName:D.community_impact,version:"1.0.0",lang:this.configLang,draftConfig:this.draftConfig}})),this.impactDataController=new L(this,this.getImpactData),this.renderImageCard=a=>{const t=`${a.nonprofit?.name} image`,r=`Learn more about ${a.nonprofit?.name}`;return g`
2
2
  <div class="image-card" part="nonprofit-card" style="display: flex; flex-direction: column;">
3
3
  <div
4
4
  class="image-card-image-box"
@@ -1,4 +1,4 @@
1
- import{t as C,h as b,y as u,g as l,f as y,p as I}from"../chunks/lit-WqMxC_PA.esm.js";import{d as x}from"../chunks/lodash-7H4x2457.esm.js";import{c as T,d as S,e as E}from"../chunks/enforce-config-CZ3ToOgr.esm.js";import{u as p,A as z,_ as f,i as d,d as v,a as B}from"../chunks/localize-Btu9xYcE.esm.js";import{D as k,k as D,S as L}from"../chunks/routes-TtLdALcf.esm.js";import{B as $}from"../chunks/beam-errors-Ci0d3926.esm.js";import{_ as V}from"../chunks/loading-template-DG4lkIIc.esm.js";import{i as A}from"../chunks/is-all-html-elements-fcB7UUA1.esm.js";import"../utils/logger.esm.js";var R=Object.defineProperty,h=(n,e,t,i)=>{for(var a=void 0,o=n.length-1,s;o>=0;o--)(s=n[o])&&(a=s(e,t,a)||a);return a&&R(e,t,a),a};class c extends b{constructor(){super(...arguments),this.finalValue=0,this.duration=1500,this.counter=0,this.intervalId=0,this.handleCounterAnimateIfInView=e=>{e.some(t=>t.isIntersecting)&&(this.animateCounter(),this.unobserveScrollTarget())},this.animateCounter=()=>{const e=41.666666666666664,t=e/this.duration*this.finalValue;this.intervalId=setInterval(()=>{const i=this.counter+t;if(i>=this.finalValue){this.counter=this.finalValue,clearInterval(this.intervalId);return}else this.counter=i},e)},this.observer=new IntersectionObserver(this.handleCounterAnimateIfInView,{threshold:.1}),this.observeScrollTarget=()=>{const e=this.scrollTargetElement;e&&this.observer.observe(e)},this.unobserveScrollTarget=()=>{const e=this.scrollTargetElement;e&&this.observer.unobserve(e)}}connectedCallback(){super.connectedCallback();const e=window.matchMedia("(prefers-reduced-motion: reduce)").matches;this.duration===0||e?this.counter=this.finalValue:this.observeScrollTarget()}disconnectedCallback(){super.disconnectedCallback(),this.unobserveScrollTarget(),clearInterval(this.intervalId)}get scrollTargetElement(){return this.scrollTarget?document.querySelector(this.scrollTarget):this}render(){return u`${Math.ceil(this.counter).toLocaleString()}`}}h([l({type:Number})],c.prototype,"finalValue"),h([l({type:Number})],c.prototype,"duration"),h([l({type:String})],c.prototype,"scrollTarget"),h([C()],c.prototype,"counter"),customElements.get("animated-counter")||customElements.define("animated-counter",c);const j=n=>{const e=n instanceof NodeList?Array.from(n):n;if(e.length===0||!A(e))return;const t=e.sort((a,o)=>{const s=getComputedStyle(a).getPropertyValue("width").replace("px",""),g=getComputedStyle(o).getPropertyValue("width").replace("px","");return parseInt(g)-parseInt(s)})[0],i=getComputedStyle(t).getPropertyValue("width");for(const a of e)getComputedStyle(a).getPropertyValue("width")!==i&&(a.style.width=i)},w={en:{cumulativeImpactTitle:()=>"What we've funded",cumulativeImpactDescription:()=>"Here's the impact that our community has made so far in partnership with Beam. Our impact is growing every day\u2014 scroll to check out the goals we're working toward together right now."},fr:{cumulativeImpactTitle:()=>"Ce que nous avons financ\xE9",cumulativeImpactDescription:()=>"Voici l'impact que notre communaut\xE9 a eu jusqu'\xE0 pr\xE9sent en partenariat avec Beam. Notre impact grandit chaque jour : faites d\xE9filer pour d\xE9couvrir les objectifs vers lesquels nous travaillons ensemble en ce moment."},de:{cumulativeImpactTitle:()=>"Was wir finanziert haben",cumulativeImpactDescription:()=>"Hier ist die Wirkung, die unsere Community bisher in Zusammenarbeit mit Beam erzielt hat. Unsere Wirkung w\xE4chst von Tag zu Tag - scrollen Sie, um einen Blick auf die Ziele zu werfen, auf die wir derzeit gemeinsam hinarbeiten."},es:{cumulativeImpactTitle:()=>"Lo que hemos financiado",cumulativeImpactDescription:()=>"Este es el impacto que nuestra comunidad ha tenido hasta ahora en asociaci\xF3n con Beam. Nuestro impacto crece cada d\xEDa; despl\xE1cese para ver los objetivos por los que estamos trabajando juntos en este momento."},it:{cumulativeImpactTitle:()=>"Cosa abbiamo finanziato",cumulativeImpactDescription:()=>"Ecco l'impatto che la nostra comunit\xE0 ha avuto finora in collaborazione con Beam. Il nostro impatto cresce ogni giorno: scorri per scoprire gli obiettivi a cui stiamo lavorando insieme in questo momento."},pl:{cumulativeImpactTitle:()=>"Co sfinansowali\u015Bmy",cumulativeImpactDescription:()=>"Oto wp\u0142yw, jaki nasza spo\u0142eczno\u015B\u0107 wywar\u0142a dotychczas we wsp\xF3\u0142pracy z Beam. Nasz wp\u0142yw ro\u015Bnie z ka\u017Cdym dniem \u2014 przewi\u0144, aby sprawdzi\u0107 cele, nad kt\xF3rymi obecnie wsp\xF3lnie pracujemy."}};var q=Object.defineProperty,m=(n,e,t,i)=>{for(var a=void 0,o=n.length-1,s;o>=0;o--)(s=n[o])&&(a=s(e,t,a)||a);return a&&q(e,t,a),a};const U=1.5*1e3;class r extends b{constructor(){super(...arguments),this.baseUrl=k,this.lang="en",this.disableAnimation=!1,this.debug=!1,this.draftConfig=!1,this.getCumulativeImpactData=async()=>(E(["apiKey","chainId"],this),await D({baseUrl:this.baseUrl,pathParams:{chainId:this.chainId},headers:{authorization:`Api-Key ${this.apiKey}`},queryParams:{version:"1.0.0",lang:this.configLang,draftConfig:this.draftConfig}})),this.cumulativeImpactDataController=new z(this,this.getCumulativeImpactData),this.resizeElements=x(()=>{j(this.impactRowRefs)},50,{maxWait:50,leading:!0})}get configLang(){return L[this.lang]||"en"}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.resizeElements)}async updated(e){const t=["chainId","baseUrl","lang"];for(const i of t)if(e.has(i)){await this.cumulativeImpactDataController.exec();break}this.resizeElements()}render(){const{data:e,error:t,loading:i}=this.cumulativeImpactDataController;return i?V():t?this.debug?f({error:t}):"":e==null?this.debug?f({error:new $("Missing data")}):"":u`
1
+ import{t as C,h as b,y as u,g as l,f as y,p as I}from"../chunks/lit-WqMxC_PA.esm.js";import{d as x}from"../chunks/lodash-D3TLHRR_.esm.js";import{c as T,d as S,e as E}from"../chunks/enforce-config-CZ3ToOgr.esm.js";import{u as p,A as z,_ as f,i as d,d as v,a as B}from"../chunks/localize-Btu9xYcE.esm.js";import{D as k,k as D,S as L}from"../chunks/routes-Lvj2SXN4.esm.js";import{B as $}from"../chunks/beam-errors-Ci0d3926.esm.js";import{_ as V}from"../chunks/loading-template-DG4lkIIc.esm.js";import{i as A}from"../chunks/is-all-html-elements-fcB7UUA1.esm.js";import"../utils/logger.esm.js";var R=Object.defineProperty,h=(n,e,t,i)=>{for(var a=void 0,o=n.length-1,s;o>=0;o--)(s=n[o])&&(a=s(e,t,a)||a);return a&&R(e,t,a),a};class c extends b{constructor(){super(...arguments),this.finalValue=0,this.duration=1500,this.counter=0,this.intervalId=0,this.handleCounterAnimateIfInView=e=>{e.some(t=>t.isIntersecting)&&(this.animateCounter(),this.unobserveScrollTarget())},this.animateCounter=()=>{const e=41.666666666666664,t=e/this.duration*this.finalValue;this.intervalId=setInterval(()=>{const i=this.counter+t;if(i>=this.finalValue){this.counter=this.finalValue,clearInterval(this.intervalId);return}else this.counter=i},e)},this.observer=new IntersectionObserver(this.handleCounterAnimateIfInView,{threshold:.1}),this.observeScrollTarget=()=>{const e=this.scrollTargetElement;e&&this.observer.observe(e)},this.unobserveScrollTarget=()=>{const e=this.scrollTargetElement;e&&this.observer.unobserve(e)}}connectedCallback(){super.connectedCallback();const e=window.matchMedia("(prefers-reduced-motion: reduce)").matches;this.duration===0||e?this.counter=this.finalValue:this.observeScrollTarget()}disconnectedCallback(){super.disconnectedCallback(),this.unobserveScrollTarget(),clearInterval(this.intervalId)}get scrollTargetElement(){return this.scrollTarget?document.querySelector(this.scrollTarget):this}render(){return u`${Math.ceil(this.counter).toLocaleString()}`}}h([l({type:Number})],c.prototype,"finalValue"),h([l({type:Number})],c.prototype,"duration"),h([l({type:String})],c.prototype,"scrollTarget"),h([C()],c.prototype,"counter"),customElements.get("animated-counter")||customElements.define("animated-counter",c);const j=n=>{const e=n instanceof NodeList?Array.from(n):n;if(e.length===0||!A(e))return;const t=e.sort((a,o)=>{const s=getComputedStyle(a).getPropertyValue("width").replace("px",""),g=getComputedStyle(o).getPropertyValue("width").replace("px","");return parseInt(g)-parseInt(s)})[0],i=getComputedStyle(t).getPropertyValue("width");for(const a of e)getComputedStyle(a).getPropertyValue("width")!==i&&(a.style.width=i)},w={en:{cumulativeImpactTitle:()=>"What we've funded",cumulativeImpactDescription:()=>"Here's the impact that our community has made so far in partnership with Beam. Our impact is growing every day\u2014 scroll to check out the goals we're working toward together right now."},fr:{cumulativeImpactTitle:()=>"Ce que nous avons financ\xE9",cumulativeImpactDescription:()=>"Voici l'impact que notre communaut\xE9 a eu jusqu'\xE0 pr\xE9sent en partenariat avec Beam. Notre impact grandit chaque jour : faites d\xE9filer pour d\xE9couvrir les objectifs vers lesquels nous travaillons ensemble en ce moment."},de:{cumulativeImpactTitle:()=>"Was wir finanziert haben",cumulativeImpactDescription:()=>"Hier ist die Wirkung, die unsere Community bisher in Zusammenarbeit mit Beam erzielt hat. Unsere Wirkung w\xE4chst von Tag zu Tag - scrollen Sie, um einen Blick auf die Ziele zu werfen, auf die wir derzeit gemeinsam hinarbeiten."},es:{cumulativeImpactTitle:()=>"Lo que hemos financiado",cumulativeImpactDescription:()=>"Este es el impacto que nuestra comunidad ha tenido hasta ahora en asociaci\xF3n con Beam. Nuestro impacto crece cada d\xEDa; despl\xE1cese para ver los objetivos por los que estamos trabajando juntos en este momento."},it:{cumulativeImpactTitle:()=>"Cosa abbiamo finanziato",cumulativeImpactDescription:()=>"Ecco l'impatto che la nostra comunit\xE0 ha avuto finora in collaborazione con Beam. Il nostro impatto cresce ogni giorno: scorri per scoprire gli obiettivi a cui stiamo lavorando insieme in questo momento."},pl:{cumulativeImpactTitle:()=>"Co sfinansowali\u015Bmy",cumulativeImpactDescription:()=>"Oto wp\u0142yw, jaki nasza spo\u0142eczno\u015B\u0107 wywar\u0142a dotychczas we wsp\xF3\u0142pracy z Beam. Nasz wp\u0142yw ro\u015Bnie z ka\u017Cdym dniem \u2014 przewi\u0144, aby sprawdzi\u0107 cele, nad kt\xF3rymi obecnie wsp\xF3lnie pracujemy."}};var q=Object.defineProperty,m=(n,e,t,i)=>{for(var a=void 0,o=n.length-1,s;o>=0;o--)(s=n[o])&&(a=s(e,t,a)||a);return a&&q(e,t,a),a};const U=1.5*1e3;class r extends b{constructor(){super(...arguments),this.baseUrl=k,this.lang="en",this.disableAnimation=!1,this.debug=!1,this.draftConfig=!1,this.getCumulativeImpactData=async()=>(E(["apiKey","chainId"],this),await D({baseUrl:this.baseUrl,pathParams:{chainId:this.chainId},headers:{authorization:`Api-Key ${this.apiKey}`},queryParams:{version:"1.0.0",lang:this.configLang,draftConfig:this.draftConfig}})),this.cumulativeImpactDataController=new z(this,this.getCumulativeImpactData),this.resizeElements=x(()=>{j(this.impactRowRefs)},50,{maxWait:50,leading:!0})}get configLang(){return L[this.lang]||"en"}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.resizeElements)}async updated(e){const t=["chainId","baseUrl","lang"];for(const i of t)if(e.has(i)){await this.cumulativeImpactDataController.exec();break}this.resizeElements()}render(){const{data:e,error:t,loading:i}=this.cumulativeImpactDataController;return i?V():t?this.debug?f({error:t}):"":e==null?this.debug?f({error:new $("Missing data")}):"":u`
2
2
  <style>
3
3
  :host {
4
4
  ${this.cssVariables.toCSS()}
@@ -1,4 +1,4 @@
1
- import{t as C,h as b,y as u,g as l,f as y,p as I}from"../chunks/lit-WqMxC_PA.esm.js";import{d as x}from"../chunks/lodash-7H4x2457.esm.js";import{c as T,d as S,e as E}from"../chunks/enforce-config-Ba1JkOHs.esm.js";import{u as p,A as z,_ as f,i as d,d as v,a as B}from"../chunks/localize-C25pEGnx.esm.js";import{D as k,k as D,S as L}from"../chunks/routes-S0vKQTft.esm.js";import{B as $}from"../chunks/beam-errors-Ci0d3926.esm.js";import{_ as V}from"../chunks/loading-template-DG4lkIIc.esm.js";import{i as A}from"../chunks/is-all-html-elements-fcB7UUA1.esm.js";import"../utils/logger.js";var R=Object.defineProperty,h=(n,e,t,i)=>{for(var a=void 0,o=n.length-1,s;o>=0;o--)(s=n[o])&&(a=s(e,t,a)||a);return a&&R(e,t,a),a};class c extends b{constructor(){super(...arguments),this.finalValue=0,this.duration=1500,this.counter=0,this.intervalId=0,this.handleCounterAnimateIfInView=e=>{e.some(t=>t.isIntersecting)&&(this.animateCounter(),this.unobserveScrollTarget())},this.animateCounter=()=>{const e=41.666666666666664,t=e/this.duration*this.finalValue;this.intervalId=setInterval(()=>{const i=this.counter+t;if(i>=this.finalValue){this.counter=this.finalValue,clearInterval(this.intervalId);return}else this.counter=i},e)},this.observer=new IntersectionObserver(this.handleCounterAnimateIfInView,{threshold:.1}),this.observeScrollTarget=()=>{const e=this.scrollTargetElement;e&&this.observer.observe(e)},this.unobserveScrollTarget=()=>{const e=this.scrollTargetElement;e&&this.observer.unobserve(e)}}connectedCallback(){super.connectedCallback();const e=window.matchMedia("(prefers-reduced-motion: reduce)").matches;this.duration===0||e?this.counter=this.finalValue:this.observeScrollTarget()}disconnectedCallback(){super.disconnectedCallback(),this.unobserveScrollTarget(),clearInterval(this.intervalId)}get scrollTargetElement(){return this.scrollTarget?document.querySelector(this.scrollTarget):this}render(){return u`${Math.ceil(this.counter).toLocaleString()}`}}h([l({type:Number})],c.prototype,"finalValue"),h([l({type:Number})],c.prototype,"duration"),h([l({type:String})],c.prototype,"scrollTarget"),h([C()],c.prototype,"counter"),customElements.get("animated-counter")||customElements.define("animated-counter",c);const j=n=>{const e=n instanceof NodeList?Array.from(n):n;if(e.length===0||!A(e))return;const t=e.sort((a,o)=>{const s=getComputedStyle(a).getPropertyValue("width").replace("px",""),g=getComputedStyle(o).getPropertyValue("width").replace("px","");return parseInt(g)-parseInt(s)})[0],i=getComputedStyle(t).getPropertyValue("width");for(const a of e)getComputedStyle(a).getPropertyValue("width")!==i&&(a.style.width=i)},w={en:{cumulativeImpactTitle:()=>"What we've funded",cumulativeImpactDescription:()=>"Here's the impact that our community has made so far in partnership with Beam. Our impact is growing every day\u2014 scroll to check out the goals we're working toward together right now."},fr:{cumulativeImpactTitle:()=>"Ce que nous avons financ\xE9",cumulativeImpactDescription:()=>"Voici l'impact que notre communaut\xE9 a eu jusqu'\xE0 pr\xE9sent en partenariat avec Beam. Notre impact grandit chaque jour : faites d\xE9filer pour d\xE9couvrir les objectifs vers lesquels nous travaillons ensemble en ce moment."},de:{cumulativeImpactTitle:()=>"Was wir finanziert haben",cumulativeImpactDescription:()=>"Hier ist die Wirkung, die unsere Community bisher in Zusammenarbeit mit Beam erzielt hat. Unsere Wirkung w\xE4chst von Tag zu Tag - scrollen Sie, um einen Blick auf die Ziele zu werfen, auf die wir derzeit gemeinsam hinarbeiten."},es:{cumulativeImpactTitle:()=>"Lo que hemos financiado",cumulativeImpactDescription:()=>"Este es el impacto que nuestra comunidad ha tenido hasta ahora en asociaci\xF3n con Beam. Nuestro impacto crece cada d\xEDa; despl\xE1cese para ver los objetivos por los que estamos trabajando juntos en este momento."},it:{cumulativeImpactTitle:()=>"Cosa abbiamo finanziato",cumulativeImpactDescription:()=>"Ecco l'impatto che la nostra comunit\xE0 ha avuto finora in collaborazione con Beam. Il nostro impatto cresce ogni giorno: scorri per scoprire gli obiettivi a cui stiamo lavorando insieme in questo momento."},pl:{cumulativeImpactTitle:()=>"Co sfinansowali\u015Bmy",cumulativeImpactDescription:()=>"Oto wp\u0142yw, jaki nasza spo\u0142eczno\u015B\u0107 wywar\u0142a dotychczas we wsp\xF3\u0142pracy z Beam. Nasz wp\u0142yw ro\u015Bnie z ka\u017Cdym dniem \u2014 przewi\u0144, aby sprawdzi\u0107 cele, nad kt\xF3rymi obecnie wsp\xF3lnie pracujemy."}};var q=Object.defineProperty,m=(n,e,t,i)=>{for(var a=void 0,o=n.length-1,s;o>=0;o--)(s=n[o])&&(a=s(e,t,a)||a);return a&&q(e,t,a),a};const U=1.5*1e3;class r extends b{constructor(){super(...arguments),this.baseUrl=k,this.lang="en",this.disableAnimation=!1,this.debug=!1,this.draftConfig=!1,this.getCumulativeImpactData=async()=>(E(["apiKey","chainId"],this),await D({baseUrl:this.baseUrl,pathParams:{chainId:this.chainId},headers:{authorization:`Api-Key ${this.apiKey}`},queryParams:{version:"1.0.0",lang:this.configLang,draftConfig:this.draftConfig}})),this.cumulativeImpactDataController=new z(this,this.getCumulativeImpactData),this.resizeElements=x(()=>{j(this.impactRowRefs)},50,{maxWait:50,leading:!0})}get configLang(){return L[this.lang]||"en"}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.resizeElements)}async updated(e){const t=["chainId","baseUrl","lang"];for(const i of t)if(e.has(i)){await this.cumulativeImpactDataController.exec();break}this.resizeElements()}render(){const{data:e,error:t,loading:i}=this.cumulativeImpactDataController;return i?V():t?this.debug?f({error:t}):"":e==null?this.debug?f({error:new $("Missing data")}):"":u`
1
+ import{t as C,h as b,y as u,g as l,f as y,p as I}from"../chunks/lit-WqMxC_PA.esm.js";import{d as x}from"../chunks/lodash-D3TLHRR_.esm.js";import{c as T,d as S,e as E}from"../chunks/enforce-config-Ba1JkOHs.esm.js";import{u as p,A as z,_ as f,i as d,d as v,a as B}from"../chunks/localize-C25pEGnx.esm.js";import{D as k,k as D,S as L}from"../chunks/routes-D-AQPRne.esm.js";import{B as $}from"../chunks/beam-errors-Ci0d3926.esm.js";import{_ as V}from"../chunks/loading-template-DG4lkIIc.esm.js";import{i as A}from"../chunks/is-all-html-elements-fcB7UUA1.esm.js";import"../utils/logger.js";var R=Object.defineProperty,h=(n,e,t,i)=>{for(var a=void 0,o=n.length-1,s;o>=0;o--)(s=n[o])&&(a=s(e,t,a)||a);return a&&R(e,t,a),a};class c extends b{constructor(){super(...arguments),this.finalValue=0,this.duration=1500,this.counter=0,this.intervalId=0,this.handleCounterAnimateIfInView=e=>{e.some(t=>t.isIntersecting)&&(this.animateCounter(),this.unobserveScrollTarget())},this.animateCounter=()=>{const e=41.666666666666664,t=e/this.duration*this.finalValue;this.intervalId=setInterval(()=>{const i=this.counter+t;if(i>=this.finalValue){this.counter=this.finalValue,clearInterval(this.intervalId);return}else this.counter=i},e)},this.observer=new IntersectionObserver(this.handleCounterAnimateIfInView,{threshold:.1}),this.observeScrollTarget=()=>{const e=this.scrollTargetElement;e&&this.observer.observe(e)},this.unobserveScrollTarget=()=>{const e=this.scrollTargetElement;e&&this.observer.unobserve(e)}}connectedCallback(){super.connectedCallback();const e=window.matchMedia("(prefers-reduced-motion: reduce)").matches;this.duration===0||e?this.counter=this.finalValue:this.observeScrollTarget()}disconnectedCallback(){super.disconnectedCallback(),this.unobserveScrollTarget(),clearInterval(this.intervalId)}get scrollTargetElement(){return this.scrollTarget?document.querySelector(this.scrollTarget):this}render(){return u`${Math.ceil(this.counter).toLocaleString()}`}}h([l({type:Number})],c.prototype,"finalValue"),h([l({type:Number})],c.prototype,"duration"),h([l({type:String})],c.prototype,"scrollTarget"),h([C()],c.prototype,"counter"),customElements.get("animated-counter")||customElements.define("animated-counter",c);const j=n=>{const e=n instanceof NodeList?Array.from(n):n;if(e.length===0||!A(e))return;const t=e.sort((a,o)=>{const s=getComputedStyle(a).getPropertyValue("width").replace("px",""),g=getComputedStyle(o).getPropertyValue("width").replace("px","");return parseInt(g)-parseInt(s)})[0],i=getComputedStyle(t).getPropertyValue("width");for(const a of e)getComputedStyle(a).getPropertyValue("width")!==i&&(a.style.width=i)},w={en:{cumulativeImpactTitle:()=>"What we've funded",cumulativeImpactDescription:()=>"Here's the impact that our community has made so far in partnership with Beam. Our impact is growing every day\u2014 scroll to check out the goals we're working toward together right now."},fr:{cumulativeImpactTitle:()=>"Ce que nous avons financ\xE9",cumulativeImpactDescription:()=>"Voici l'impact que notre communaut\xE9 a eu jusqu'\xE0 pr\xE9sent en partenariat avec Beam. Notre impact grandit chaque jour : faites d\xE9filer pour d\xE9couvrir les objectifs vers lesquels nous travaillons ensemble en ce moment."},de:{cumulativeImpactTitle:()=>"Was wir finanziert haben",cumulativeImpactDescription:()=>"Hier ist die Wirkung, die unsere Community bisher in Zusammenarbeit mit Beam erzielt hat. Unsere Wirkung w\xE4chst von Tag zu Tag - scrollen Sie, um einen Blick auf die Ziele zu werfen, auf die wir derzeit gemeinsam hinarbeiten."},es:{cumulativeImpactTitle:()=>"Lo que hemos financiado",cumulativeImpactDescription:()=>"Este es el impacto que nuestra comunidad ha tenido hasta ahora en asociaci\xF3n con Beam. Nuestro impacto crece cada d\xEDa; despl\xE1cese para ver los objetivos por los que estamos trabajando juntos en este momento."},it:{cumulativeImpactTitle:()=>"Cosa abbiamo finanziato",cumulativeImpactDescription:()=>"Ecco l'impatto che la nostra comunit\xE0 ha avuto finora in collaborazione con Beam. Il nostro impatto cresce ogni giorno: scorri per scoprire gli obiettivi a cui stiamo lavorando insieme in questo momento."},pl:{cumulativeImpactTitle:()=>"Co sfinansowali\u015Bmy",cumulativeImpactDescription:()=>"Oto wp\u0142yw, jaki nasza spo\u0142eczno\u015B\u0107 wywar\u0142a dotychczas we wsp\xF3\u0142pracy z Beam. Nasz wp\u0142yw ro\u015Bnie z ka\u017Cdym dniem \u2014 przewi\u0144, aby sprawdzi\u0107 cele, nad kt\xF3rymi obecnie wsp\xF3lnie pracujemy."}};var q=Object.defineProperty,m=(n,e,t,i)=>{for(var a=void 0,o=n.length-1,s;o>=0;o--)(s=n[o])&&(a=s(e,t,a)||a);return a&&q(e,t,a),a};const U=1.5*1e3;class r extends b{constructor(){super(...arguments),this.baseUrl=k,this.lang="en",this.disableAnimation=!1,this.debug=!1,this.draftConfig=!1,this.getCumulativeImpactData=async()=>(E(["apiKey","chainId"],this),await D({baseUrl:this.baseUrl,pathParams:{chainId:this.chainId},headers:{authorization:`Api-Key ${this.apiKey}`},queryParams:{version:"1.0.0",lang:this.configLang,draftConfig:this.draftConfig}})),this.cumulativeImpactDataController=new z(this,this.getCumulativeImpactData),this.resizeElements=x(()=>{j(this.impactRowRefs)},50,{maxWait:50,leading:!0})}get configLang(){return L[this.lang]||"en"}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.resizeElements)}async updated(e){const t=["chainId","baseUrl","lang"];for(const i of t)if(e.has(i)){await this.cumulativeImpactDataController.exec();break}this.resizeElements()}render(){const{data:e,error:t,loading:i}=this.cumulativeImpactDataController;return i?V():t?this.debug?f({error:t}):"":e==null?this.debug?f({error:new $("Missing data")}):"":u`
2
2
  <style>
3
3
  :host {
4
4
  ${this.cssVariables.toCSS()}
@@ -1,4 +1,4 @@
1
- import{f as $,g as n,p as v,h as D,k as T,y as O}from"../chunks/lit-WqMxC_PA.esm.js";import{d as N}from"../chunks/lodash-7H4x2457.esm.js";import{D as R,g as F,W as j,S as A}from"../chunks/routes-TtLdALcf.esm.js";import{p as P}from"../chunks/progress-bar-DF7UuuHb.esm.js";import{u as l,A as _,i as b,_ as S,d as u,a as V}from"../chunks/localize-Btu9xYcE.esm.js";import{c as W,d as K,e as q}from"../chunks/enforce-config-CZ3ToOgr.esm.js";import{_ as G}from"../chunks/loading-template-DG4lkIIc.esm.js";import{logger as M}from"../utils/logger.esm.js";import"../chunks/_share-dialog-dependencies-BvevL0CH.esm.js";import{s as h,a as H}from"../chunks/share-button-Cq3aCOGt.esm.js";import{partnerLogosConfigDefaults as Y}from"./beam-partner-logos.esm.js";import{c as J}from"../chunks/responsive-BR8qUfBa.esm.js";import"../chunks/beam-errors-Ci0d3926.esm.js";import"../chunks/vendor-KKSARHWL.esm.js";import"../chunks/is-all-html-elements-fcB7UUA1.esm.js";import"../chunks/share-button-DBLPdobK.esm.js";const g={en:{descriptionTitle:({nonprofitName:e="a nonprofit"})=>`You've just made an impact for ${e}`,descriptionSubtitle:()=>"Check out the impact your purchase made below.",yourImpactTitle:()=>"You\u2019ve Funded",communityImpactTitle:()=>"Together we\u2019re funding",personalImpactLinkCopy:({name:e=""})=>`Learn about ${e}`,communityImpactLinkCopy:({name:e=""})=>`See all of the impact by the ${e} community`,impactShareButton:()=>"Share to Grow Your Impact"},fr:{descriptionTitle:({nonprofitName:e=""})=>`Vous avez eu un impact positif sur ${e}`,descriptionSubtitle:({causeName:e=""})=>`D\xE9couvrez quel est l'impact de votre achat chez ${e} ci-dessous.`,yourImpactTitle:()=>"Vous avez financ\xE9",communityImpactTitle:()=>"Ensemble, nous finan\xE7ons",personalImpactLinkCopy:({name:e=""})=>`En savoir sur ${e}`,communityImpactLinkCopy:({name:e=""})=>`Voir toutes les contributions de la communaut\xE9 de ${e}`,impactShareButton:()=>"Partagez pour augmentez notre cause"},de:{descriptionTitle:({nonprofitName:e=""})=>`Du hast soeben einen Beitrag geleistet f\xFCr ${e}`,descriptionSubtitle:({causeName:e=""})=>`Erfahre mehr \xFCber den Beitrag, den du mit deinem ${e} Kauf geleistet hast`,yourImpactTitle:()=>"Sie haben finanziert",communityImpactTitle:()=>"Gemeinsam finanzieren wir",personalImpactLinkCopy:({name:e=""})=>`Mehr \xFCber ${e} lernen`,communityImpactLinkCopy:({name:e=""})=>`Informiere dich \xFCber den bisher geleisteten Beitrag der ${e} community`,impactShareButton:()=>"Teil, um unserem Beitrag zu erh\xF6hen"},es:{descriptionTitle:({nonprofitName:e=""})=>`Acabas de contribuir con ${e}`,descriptionSubtitle:({causeName:e=""})=>`Comprueba la contribuci\xF3n que has hecho con tu compra ${e} a continuaci\xF3n`,yourImpactTitle:()=>"Has financiado",communityImpactTitle:()=>"Juntos estamos financiando",personalImpactLinkCopy:({name:e=""})=>`Saber de ${e}`,communityImpactLinkCopy:({name:e=""})=>`Mira lo que ha conseguido la comunidad ${e}`,impactShareButton:()=>"Comparte para aumentar nuestro impacto"},it:{descriptionTitle:({nonprofitName:e=""})=>`Hai appena fatto la differenza per ${e}`,descriptionSubtitle:({causeName:e=""})=>`Guarda qui sotto l'impatto del tuo acquisto ${e}`,yourImpactTitle:()=>"Hai finanziato",communityImpactTitle:()=>"Insieme stiamo finanziando",personalImpactLinkCopy:({name:e=""})=>`Scopri su ${e}`,communityImpactLinkCopy:({name:e=""})=>`Guarda come la comunit\xE0 di ${e} fa la differenza`,impactShareButton:()=>"Condividi, aiutaci a fare la differenza"},pl:{descriptionTitle:({nonprofitName:e=""})=>`W\u0142a\u015Bnie wspar\u0142a\u015B_e\u015B ${e}!`,descriptionSubtitle:({causeName:e=""})=>`Sprawd\u017A ni\u017Cej, jakiego wsparcia udzieli\u0142a\u015B_e\u015B kupuj\u0105c w ${e} `,yourImpactTitle:()=>"Sfinansowa\u0142e\u015B(a) ",communityImpactTitle:()=>"Razem finansujemy",personalImpactLinkCopy:({name:e=""})=>`Dowiedz si\u0119 o ${e}`,communityImpactLinkCopy:({name:e=""})=>`Zobacz, ile dobrego zrobi\u0142a do tej pory spo\u0142eczno\u015B\u0107 ${e}`,impactShareButton:()=>"Udost\u0119pnij, by szerzy\u0107 nasz\u0105 misj\u0119"}};var Z=Object.defineProperty,i=(e,a,r,c)=>{for(var o=void 0,p=e.length-1,s;p>=0;p--)(s=e[p])&&(o=s(a,r,o)||o);return o&&Z(a,r,o),o};class t extends D{constructor(){super(...arguments),this.baseUrl=R,this.lang="en",this.debug=!1,this.draftConfig=!1,this.getImpactData=async()=>(q(["apiKey","userId","nonprofitId"],this),await F({baseUrl:this.baseUrl,headers:{authorization:`Api-Key ${this.apiKey}`},queryParams:{nonprofitId:this.nonprofitId,beamUserId:this.userId,personalImpactLimit:1,communityImpactLimit:1,storeId:this.storeId,widgetName:j.impact_overview,version:"1.0.0",draftConfig:this.draftConfig,lang:this.configLang,discountCodes:this.discountCodes&&this.discountCodes.length>0?this.discountCodes:void 0,transactionId:this.transactionId??void 0}})),this.impactDataController=new _(this,this.getImpactData),this.resizeElements=N(()=>{h(this.impactTitleRefs),h(this.impactDescriptionRefs),h(this.impactLinkRefs),h(this.goalCompletionTextRefs)},50,{maxWait:50,leading:!0})}get configLang(){return A[this.lang]||"en"}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.resizeElements)}async updated(a){const r=["baseUrl","storeId","apiKey","userId","lang","discountCodes"];for(const c of r)if(a.has(c)){await this.impactDataController.exec();break}this.resizeElements(),await this.handleFontLoad(this.resizeElements)}disconnectedCallback(){window.removeEventListener("resize",this.resizeElements),document.fonts.removeEventListener("loadingdone",this.resizeElements),super.disconnectedCallback()}async handleFontLoad(a){if(document.fonts.status==="loading")return await document.fonts.ready.catch(r=>M.error(r)),a()}renderCard({imageUrl:a,title:r,percentFunded:c,goalProgressText:o,description:p,urlCopy:s,impactUrl:m,isImage:d,cardType:f,goalCompletionText:y}){return O`
1
+ import{f as $,g as n,p as v,h as D,k as T,y as O}from"../chunks/lit-WqMxC_PA.esm.js";import{d as N}from"../chunks/lodash-D3TLHRR_.esm.js";import{D as R,g as F,W as j,S as P}from"../chunks/routes-Lvj2SXN4.esm.js";import{p as A}from"../chunks/progress-bar-DF7UuuHb.esm.js";import{u as l,A as _,i as b,_ as S,d as u,a as V}from"../chunks/localize-Btu9xYcE.esm.js";import{c as W,d as K,e as q}from"../chunks/enforce-config-CZ3ToOgr.esm.js";import{_ as G}from"../chunks/loading-template-DG4lkIIc.esm.js";import{logger as M}from"../utils/logger.esm.js";import"../chunks/_share-dialog-dependencies-Cry6mcdg.esm.js";import{s as h,a as H}from"../chunks/share-button-XJxSyBaT.esm.js";import{partnerLogosConfigDefaults as Y}from"./beam-partner-logos.esm.js";import{c as J}from"../chunks/responsive-BR8qUfBa.esm.js";import"../chunks/beam-errors-Ci0d3926.esm.js";import"../chunks/vendor-KKSARHWL.esm.js";import"../chunks/is-all-html-elements-fcB7UUA1.esm.js";import"../chunks/share-button-DUn-zC5t.esm.js";const g={en:{descriptionTitle:({nonprofitName:e="a nonprofit"})=>`You've just made an impact for ${e}`,descriptionSubtitle:()=>"Check out the impact your purchase made below.",yourImpactTitle:()=>"You\u2019ve Funded",communityImpactTitle:()=>"Together we\u2019re funding",personalImpactLinkCopy:({name:e=""})=>`Learn about ${e}`,communityImpactLinkCopy:({name:e=""})=>`See all of the impact by the ${e} community`,impactShareButton:()=>"Share to Grow Your Impact"},fr:{descriptionTitle:({nonprofitName:e=""})=>`Vous avez eu un impact positif sur ${e}`,descriptionSubtitle:({causeName:e=""})=>`D\xE9couvrez quel est l'impact de votre achat chez ${e} ci-dessous.`,yourImpactTitle:()=>"Vous avez financ\xE9",communityImpactTitle:()=>"Ensemble, nous finan\xE7ons",personalImpactLinkCopy:({name:e=""})=>`En savoir sur ${e}`,communityImpactLinkCopy:({name:e=""})=>`Voir toutes les contributions de la communaut\xE9 de ${e}`,impactShareButton:()=>"Partagez pour augmentez notre cause"},de:{descriptionTitle:({nonprofitName:e=""})=>`Du hast soeben einen Beitrag geleistet f\xFCr ${e}`,descriptionSubtitle:({causeName:e=""})=>`Erfahre mehr \xFCber den Beitrag, den du mit deinem ${e} Kauf geleistet hast`,yourImpactTitle:()=>"Sie haben finanziert",communityImpactTitle:()=>"Gemeinsam finanzieren wir",personalImpactLinkCopy:({name:e=""})=>`Mehr \xFCber ${e} lernen`,communityImpactLinkCopy:({name:e=""})=>`Informiere dich \xFCber den bisher geleisteten Beitrag der ${e} community`,impactShareButton:()=>"Teil, um unserem Beitrag zu erh\xF6hen"},es:{descriptionTitle:({nonprofitName:e=""})=>`Acabas de contribuir con ${e}`,descriptionSubtitle:({causeName:e=""})=>`Comprueba la contribuci\xF3n que has hecho con tu compra ${e} a continuaci\xF3n`,yourImpactTitle:()=>"Has financiado",communityImpactTitle:()=>"Juntos estamos financiando",personalImpactLinkCopy:({name:e=""})=>`Saber de ${e}`,communityImpactLinkCopy:({name:e=""})=>`Mira lo que ha conseguido la comunidad ${e}`,impactShareButton:()=>"Comparte para aumentar nuestro impacto"},it:{descriptionTitle:({nonprofitName:e=""})=>`Hai appena fatto la differenza per ${e}`,descriptionSubtitle:({causeName:e=""})=>`Guarda qui sotto l'impatto del tuo acquisto ${e}`,yourImpactTitle:()=>"Hai finanziato",communityImpactTitle:()=>"Insieme stiamo finanziando",personalImpactLinkCopy:({name:e=""})=>`Scopri su ${e}`,communityImpactLinkCopy:({name:e=""})=>`Guarda come la comunit\xE0 di ${e} fa la differenza`,impactShareButton:()=>"Condividi, aiutaci a fare la differenza"},pl:{descriptionTitle:({nonprofitName:e=""})=>`W\u0142a\u015Bnie wspar\u0142a\u015B_e\u015B ${e}!`,descriptionSubtitle:({causeName:e=""})=>`Sprawd\u017A ni\u017Cej, jakiego wsparcia udzieli\u0142a\u015B_e\u015B kupuj\u0105c w ${e} `,yourImpactTitle:()=>"Sfinansowa\u0142e\u015B(a) ",communityImpactTitle:()=>"Razem finansujemy",personalImpactLinkCopy:({name:e=""})=>`Dowiedz si\u0119 o ${e}`,communityImpactLinkCopy:({name:e=""})=>`Zobacz, ile dobrego zrobi\u0142a do tej pory spo\u0142eczno\u015B\u0107 ${e}`,impactShareButton:()=>"Udost\u0119pnij, by szerzy\u0107 nasz\u0105 misj\u0119"}};var Z=Object.defineProperty,i=(e,a,r,c)=>{for(var o=void 0,p=e.length-1,s;p>=0;p--)(s=e[p])&&(o=s(a,r,o)||o);return o&&Z(a,r,o),o};class t extends D{constructor(){super(...arguments),this.baseUrl=R,this.lang="en",this.debug=!1,this.draftConfig=!1,this.getImpactData=async()=>(q(["apiKey","userId","nonprofitId"],this),await F({baseUrl:this.baseUrl,headers:{authorization:`Api-Key ${this.apiKey}`},queryParams:{nonprofitId:this.nonprofitId,beamUserId:this.userId,personalImpactLimit:1,communityImpactLimit:1,storeId:this.storeId,widgetName:j.impact_overview,version:"1.0.0",draftConfig:this.draftConfig,lang:this.configLang,discountCodes:this.discountCodes&&this.discountCodes.length>0?this.discountCodes:void 0,transactionId:this.transactionId??void 0}})),this.impactDataController=new _(this,this.getImpactData),this.resizeElements=N(()=>{h(this.impactTitleRefs),h(this.impactDescriptionRefs),h(this.impactLinkRefs),h(this.goalCompletionTextRefs)},50,{maxWait:50,leading:!0})}get configLang(){return P[this.lang]||"en"}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.resizeElements)}async updated(a){const r=["baseUrl","storeId","apiKey","userId","lang","discountCodes"];for(const c of r)if(a.has(c)){await this.impactDataController.exec();break}this.resizeElements(),await this.handleFontLoad(this.resizeElements)}disconnectedCallback(){window.removeEventListener("resize",this.resizeElements),document.fonts.removeEventListener("loadingdone",this.resizeElements),super.disconnectedCallback()}async handleFontLoad(a){if(document.fonts.status==="loading")return await document.fonts.ready.catch(r=>M.error(r)),a()}renderCard({imageUrl:a,title:r,percentFunded:c,goalProgressText:o,description:p,urlCopy:s,impactUrl:m,isImage:d,cardType:f,goalCompletionText:y}){return O`
2
2
  <div class="impact-card ${d?"":"icon"}" part="impact-card">
3
3
  <div class="${d?"":"icon-background "}">
4
4
  <img src="${a}" alt="${r}" class="${d?"impact-card-image":"impact-card-icon"}" />
@@ -55,7 +55,7 @@ import{f as $,g as n,p as v,h as D,k as T,y as O}from"../chunks/lit-WqMxC_PA.esm
55
55
  ${this.renderCard({isImage:m,imageUrl:L||"",title:g[this.configLang].yourImpactTitle(),percentFunded:a.personal[0]?.impact?.goalProgressPercentage||0,goalProgressText:a.personal[0]?.impact?.goalProgressText,description:b(this.configLang,a.personal[0]?.impact?.description||""),urlCopy:a.personal[0].nonprofit?.name,impactUrl:a.personal[0].nonprofit?.website||"",cardType:"personal",goalCompletionText:a.personal[0].impact.goalCompletionText})}
56
56
  </div>
57
57
  <div class="impact community-impact ${m?"image-card-container":"icon-card-container"}">
58
- ${this.renderCard({isImage:m,imageUrl:z||"",title:g[this.configLang].communityImpactTitle(),percentFunded:a.community[0].impact?.goalProgressPercentage||0,goalProgressText:a.community[0]?.impact?.goalProgressText,description:b(this.configLang,a.community[0].impact?.description||""),urlCopy:a.chain.name,impactUrl:a.chain.communityImpactUrl||a.community[0].nonprofit.website||"",cardType:"community",goalCompletionText:a.community[0].impact.goalCompletionText})}
58
+ ${this.renderCard({isImage:m,imageUrl:z||"",title:g[this.configLang].communityImpactTitle(),percentFunded:a.community[0].impact?.goalProgressPercentage||0,goalProgressText:a.community[0]?.impact?.goalProgressText,description:b(this.configLang,a.community[0].impact?.description||""),urlCopy:a.chain.name,impactUrl:a.store.communityPageURL||a.chain.communityImpactUrl||a.personal[0].nonprofit.website||"",cardType:"community",goalCompletionText:a.community[0].impact.goalCompletionText})}
59
59
  </div>
60
60
  </div>
61
61
 
@@ -75,7 +75,7 @@ import{f as $,g as n,p as v,h as D,k as T,y as O}from"../chunks/lit-WqMxC_PA.esm
75
75
  </div>
76
76
 
77
77
  <div id="modal-root"></div>
78
- `}get cssVariables(){const a={"--beam-fontFamily":"inherit","--beam-fontStyle":"inherit","--beam-fontSize":"inherit","--beam-textColor":"inherit","--beam-backgroundColor":"inherit",...Y,...P,...H,...u("--beam-ImpactOverview-title",{fontSize:"16px",fontWeight:"bold",marginTop:"10px",textTransform:"capitalize"}),...u("--beam-ImpactOverview-subtitle",{marginTop:"5px"}),"--beam-ImpactOverview-impactCards-maxWidth":"650px","--beam-ImpactOverview-impactCard-backgroundColor":"inherit","--beam-ImpactOverview-impactCard-foregroundColor":"currentColor","--beam-ImpactOverview-impactCard-borderColor":"currentColor","--beam-ImpactOverview-impactCard-borderRadius":"5px","--beam-ImpactOverview-impactCard-marginTop":"10px",...u("--beam-ImpactOverview-impactCard-title",{fontSize:"15px",fontWeight:"bold",letterSpacing:"0.36px"}),"--beam-ImpactOverview-impactCard-progress-marginTop":"8px",...u("--beam-ImpactOverview-impactCard-progressText"),...u("--beam-ImpactOverview-impactCard-description",{marginTop:"10px"}),"--beam-ImpactOverview-impactCard-linkArrow-display":"inline","--beam-ImpactOverview-impactCard-link-color":"inherit",...u("--beam-ImpactOverview-impactCard-link",{marginTop:"10px",textDecoration:"underline",textTransform:"capitalize"}),...u("--beam-ImpactOverview-goalCompletionText",{marginTop:"5px",fontWeight:"600",textTransform:"capitalize",fontSize:"13px"}),"--beam-ImpactOverview-share-button-display":"none","--beam-ImpactOverview-share-button-display-mobile":"inherit","--beam-ImpactOverview-share-button-display-desktop":"inherit","--beam-ImpactOverview-image-display":"block","--beam-ImpactOverview-cardStyle":"'image'","--beam-ImpactOverview-iconBackground-width":"75px","--beam-ImpactOverview-iconBackground-height":"75px","--beam-ImpactOverview-iconBackground-borderRadius":"50px","--beam-ImpactOverview-icon-padding":"0px","--beam-ImpactOverview-iconBackground-background":"#f3f3f3","--beam-ImpactOverview-impactCard-shareButton-background":"#fff","--beam-ImpactOverview-impactCard-shareButton-boxShadow":"0px -20px 20px 0px rgb(0 0 0 / 2%)"},r=this.impactDataController?.data?.config?.web?.theme||{},c={...a,...r};return Object.assign(Object.create({toCSS(){return V(this)}}),c)}}t.tagName="beam-impact-overview",t.styles=[W,J,$`
78
+ `}get cssVariables(){const a={"--beam-fontFamily":"inherit","--beam-fontStyle":"inherit","--beam-fontSize":"inherit","--beam-textColor":"inherit","--beam-backgroundColor":"inherit",...Y,...A,...H,...u("--beam-ImpactOverview-title",{fontSize:"16px",fontWeight:"bold",marginTop:"10px",textTransform:"capitalize"}),...u("--beam-ImpactOverview-subtitle",{marginTop:"5px"}),"--beam-ImpactOverview-impactCards-maxWidth":"650px","--beam-ImpactOverview-impactCard-backgroundColor":"inherit","--beam-ImpactOverview-impactCard-foregroundColor":"currentColor","--beam-ImpactOverview-impactCard-borderColor":"currentColor","--beam-ImpactOverview-impactCard-borderRadius":"5px","--beam-ImpactOverview-impactCard-marginTop":"10px",...u("--beam-ImpactOverview-impactCard-title",{fontSize:"15px",fontWeight:"bold",letterSpacing:"0.36px"}),"--beam-ImpactOverview-impactCard-progress-marginTop":"8px",...u("--beam-ImpactOverview-impactCard-progressText"),...u("--beam-ImpactOverview-impactCard-description",{marginTop:"10px"}),"--beam-ImpactOverview-impactCard-linkArrow-display":"inline","--beam-ImpactOverview-impactCard-link-color":"inherit",...u("--beam-ImpactOverview-impactCard-link",{marginTop:"10px",textDecoration:"underline",textTransform:"capitalize"}),...u("--beam-ImpactOverview-goalCompletionText",{marginTop:"5px",fontWeight:"600",textTransform:"capitalize",fontSize:"13px"}),"--beam-ImpactOverview-share-button-display":"none","--beam-ImpactOverview-share-button-display-mobile":"inherit","--beam-ImpactOverview-share-button-display-desktop":"inherit","--beam-ImpactOverview-image-display":"block","--beam-ImpactOverview-cardStyle":"'image'","--beam-ImpactOverview-iconBackground-width":"75px","--beam-ImpactOverview-iconBackground-height":"75px","--beam-ImpactOverview-iconBackground-borderRadius":"50px","--beam-ImpactOverview-icon-padding":"0px","--beam-ImpactOverview-iconBackground-background":"#f3f3f3","--beam-ImpactOverview-impactCard-shareButton-background":"#fff","--beam-ImpactOverview-impactCard-shareButton-boxShadow":"0px -20px 20px 0px rgb(0 0 0 / 2%)"},r=this.impactDataController?.data?.config?.web?.theme||{},c={...a,...r};return Object.assign(Object.create({toCSS(){return V(this)}}),c)}}t.tagName="beam-impact-overview",t.styles=[W,J,$`
79
79
  :host {
80
80
  display: block;
81
81
  font-family: var(--beam-fontFamily);