@beamimpact/web-sdk 1.43.2 → 1.45.2

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 (252) hide show
  1. package/dist/chunks/_share-dialog-dependencies-R9RsuSGx.esm.js +2 -0
  2. package/dist/chunks/_share-dialog-dependencies-R9RsuSGx.esm.js.map +1 -0
  3. package/dist/chunks/_share-dialog-dependencies-o5GBtNTA.esm.js +2 -0
  4. package/dist/chunks/_share-dialog-dependencies-o5GBtNTA.esm.js.map +1 -0
  5. package/dist/chunks/{cart-contents-WB1BF6hG.esm.d.ts → cart-contents-HAPzwbeL.esm.d.ts} +1 -1
  6. package/dist/chunks/{css-card-grid-r6wxRbPV.esm.js → css-card-grid-nEc--M5M.esm.js} +2 -2
  7. package/dist/chunks/{css-card-grid-r6wxRbPV.esm.js.map → css-card-grid-nEc--M5M.esm.js.map} +1 -1
  8. package/dist/chunks/{enforce-config-HksNiOMu.esm.js → enforce-config-ZAI7WYAd.esm.js} +2 -2
  9. package/dist/chunks/{enforce-config-HksNiOMu.esm.js.map → enforce-config-ZAI7WYAd.esm.js.map} +1 -1
  10. package/dist/chunks/{enforce-config-er6B5Gkj.esm.js → enforce-config-ZyPq_4CF.esm.js} +2 -2
  11. package/dist/chunks/{enforce-config-er6B5Gkj.esm.js.map → enforce-config-ZyPq_4CF.esm.js.map} +1 -1
  12. package/dist/chunks/{events-MfRTtTVm.esm.d.ts → events-fqRWfo7p.esm.d.ts} +1 -1
  13. package/dist/chunks/{index-keYXyTGw.esm.js → index--JacA4R2.esm.js} +2 -2
  14. package/dist/chunks/{index-keYXyTGw.esm.js.map → index--JacA4R2.esm.js.map} +1 -1
  15. package/dist/chunks/index-1WxwWfcp.esm.js +2 -0
  16. package/dist/chunks/index-1WxwWfcp.esm.js.map +1 -0
  17. package/dist/chunks/index-4fdLArZg.esm.js +2 -0
  18. package/dist/chunks/index-4fdLArZg.esm.js.map +1 -0
  19. package/dist/chunks/{index-UggwPn9Q.esm.d.ts → index-7mukhxz_.esm.d.ts} +1 -1
  20. package/dist/chunks/index-Hd_2hpsA.esm.js +2 -0
  21. package/dist/chunks/index-Hd_2hpsA.esm.js.map +1 -0
  22. package/dist/chunks/{index-1nI7l5vj.esm.js → index-JDZQClkA.esm.js} +2 -2
  23. package/dist/chunks/{index-1nI7l5vj.esm.js.map → index-JDZQClkA.esm.js.map} +1 -1
  24. package/dist/chunks/{index-OaRsZJh7.esm.d.ts → index-JG4nmG9U.esm.d.ts} +1 -1
  25. package/dist/chunks/index-MJNFm2RK.esm.js +2 -0
  26. package/dist/chunks/index-MJNFm2RK.esm.js.map +1 -0
  27. package/dist/chunks/{index-B9w02q6y.esm.d.ts → index-MSoONvC5.esm.d.ts} +1 -1
  28. package/dist/chunks/{index-uqNCQVUx.esm.d.ts → index-SExnliMs.esm.d.ts} +1 -1
  29. package/dist/chunks/{index-mw70Caof.esm.js → index-eXilYHHK.esm.js} +2 -2
  30. package/dist/chunks/{index-mw70Caof.esm.js.map → index-eXilYHHK.esm.js.map} +1 -1
  31. package/dist/chunks/index-gBAASIWa.esm.js +2 -0
  32. package/dist/chunks/index-gBAASIWa.esm.js.map +1 -0
  33. package/dist/chunks/index-lyf1T2wZ.esm.js +2 -0
  34. package/dist/chunks/index-lyf1T2wZ.esm.js.map +1 -0
  35. package/dist/chunks/{index-U3VWulKA.esm.js → index-qs-xQCeM.esm.js} +2 -2
  36. package/dist/chunks/{index-U3VWulKA.esm.js.map → index-qs-xQCeM.esm.js.map} +1 -1
  37. package/dist/chunks/index-qt5iD9Ok.esm.d.ts +14 -0
  38. package/dist/chunks/{index-ozcDdIom.esm.d.ts → index-tdUx2WLc.esm.d.ts} +4 -4
  39. package/dist/chunks/{lit-3QHn3fwl.esm.js → lit-iNN5L_Qk.esm.js} +2 -2
  40. package/dist/chunks/{lit-3QHn3fwl.esm.js.map → lit-iNN5L_Qk.esm.js.map} +1 -1
  41. package/dist/chunks/loading-template-t4fFsYtr.esm.js +2 -0
  42. package/dist/chunks/{loading-template-mLjOGXMj.esm.js.map → loading-template-t4fFsYtr.esm.js.map} +1 -1
  43. package/dist/chunks/localize-m-_ESmpk.esm.js +31 -0
  44. package/dist/chunks/localize-m-_ESmpk.esm.js.map +1 -0
  45. package/dist/chunks/localize-o-cYvHQf.esm.js +31 -0
  46. package/dist/chunks/localize-o-cYvHQf.esm.js.map +1 -0
  47. package/dist/chunks/{openapi-spec-GGEBbqAJ.esm.d.ts → openapi-spec-RlP2IT1i.esm.d.ts} +87 -33
  48. package/dist/chunks/{order-page-LvE0Otsn.esm.d.ts → order-page-FLhpaZg2.esm.d.ts} +4 -4
  49. package/dist/chunks/order-page-KZ7xLkRW.esm.js +2 -0
  50. package/dist/chunks/order-page-KZ7xLkRW.esm.js.map +1 -0
  51. package/dist/chunks/order-page-mlWRT5YL.esm.js +2 -0
  52. package/dist/chunks/order-page-mlWRT5YL.esm.js.map +1 -0
  53. package/dist/chunks/{progress-bar-HVG_n8_6.esm.js → progress-bar-PMU_xI3L.esm.js} +2 -2
  54. package/dist/chunks/{progress-bar-HVG_n8_6.esm.js.map → progress-bar-PMU_xI3L.esm.js.map} +1 -1
  55. package/dist/chunks/promo-pill-label-58PJRvSl.esm.js +15 -0
  56. package/dist/chunks/promo-pill-label-58PJRvSl.esm.js.map +1 -0
  57. package/dist/chunks/{responsive-KbDsZM6S.esm.js → responsive-2lC2Wrtg.esm.js} +2 -2
  58. package/dist/chunks/{responsive-KbDsZM6S.esm.js.map → responsive-2lC2Wrtg.esm.js.map} +1 -1
  59. package/dist/chunks/{routes-L-CN-xXC.esm.js → routes-FBB1GA4-.esm.js} +2 -2
  60. package/dist/chunks/{routes-L-CN-xXC.esm.js.map → routes-FBB1GA4-.esm.js.map} +1 -1
  61. package/dist/chunks/{routes-wCCYf_uA.esm.d.ts → routes-NIuAzAOC.esm.d.ts} +3 -1
  62. package/dist/chunks/{routes-t6bR6BdS.esm.js → routes-jmFlXAbv.esm.js} +2 -2
  63. package/dist/chunks/{routes-t6bR6BdS.esm.js.map → routes-jmFlXAbv.esm.js.map} +1 -1
  64. package/dist/chunks/share-button-SNvuFDC9.esm.js +2 -0
  65. package/dist/chunks/share-button-SNvuFDC9.esm.js.map +1 -0
  66. package/dist/chunks/{share-button-0N1lvlZT.esm.js → share-button-bQ8brpBZ.esm.js} +4 -3
  67. package/dist/chunks/{share-button-0N1lvlZT.esm.js.map → share-button-bQ8brpBZ.esm.js.map} +1 -1
  68. package/dist/chunks/{share-button-7wbogZGx.esm.js → share-button-hLOsYlSA.esm.js} +4 -3
  69. package/dist/chunks/{share-button-7wbogZGx.esm.js.map → share-button-hLOsYlSA.esm.js.map} +1 -1
  70. package/dist/chunks/{shoelace-components-BpI14CrA.esm.js → shoelace-components-leDI-Yop.esm.js} +2 -2
  71. package/dist/chunks/{shoelace-components-BpI14CrA.esm.js.map → shoelace-components-leDI-Yop.esm.js.map} +1 -1
  72. package/dist/chunks/{shoelace-components-VlhAe0ME.esm.js → shoelace-components-qjNlvvPx.esm.js} +2 -2
  73. package/dist/chunks/{shoelace-components-VlhAe0ME.esm.js.map → shoelace-components-qjNlvvPx.esm.js.map} +1 -1
  74. package/dist/chunks/{update-cart-tjLR7pMx.esm.d.ts → update-cart-Hebtxhto.esm.d.ts} +1 -1
  75. package/dist/chunks/update-cart-aKQ3Cjc8.esm.js +2 -0
  76. package/dist/chunks/update-cart-aKQ3Cjc8.esm.js.map +1 -0
  77. package/dist/chunks/update-cart-j9LPS5By.esm.js +2 -0
  78. package/dist/chunks/update-cart-j9LPS5By.esm.js.map +1 -0
  79. package/dist/chunks/{vendor--f7lkyBk.esm.js → vendor-GKiOHg2N.esm.js} +2 -2
  80. package/dist/chunks/{vendor--f7lkyBk.esm.js.map → vendor-GKiOHg2N.esm.js.map} +1 -1
  81. package/dist/components/beam-partner-logos.esm.js +1 -1
  82. package/dist/components/beam-partner-logos.js +1 -1
  83. package/dist/components/community-impact.d.ts +1 -0
  84. package/dist/components/community-impact.esm.js +13 -13
  85. package/dist/components/community-impact.esm.js.map +1 -1
  86. package/dist/components/community-impact.js +13 -13
  87. package/dist/components/community-impact.js.map +1 -1
  88. package/dist/components/cumulative-impact.d.ts +1 -0
  89. package/dist/components/cumulative-impact.esm.js +3 -3
  90. package/dist/components/cumulative-impact.esm.js.map +1 -1
  91. package/dist/components/cumulative-impact.js +3 -3
  92. package/dist/components/cumulative-impact.js.map +1 -1
  93. package/dist/components/impact-overview.d.ts +7 -1
  94. package/dist/components/impact-overview.esm.js +87 -73
  95. package/dist/components/impact-overview.esm.js.map +1 -1
  96. package/dist/components/impact-overview.js +87 -73
  97. package/dist/components/impact-overview.js.map +1 -1
  98. package/dist/components/index.d.ts +3 -3
  99. package/dist/components/index.esm.js +1 -1
  100. package/dist/components/index.js +1 -1
  101. package/dist/components/post-purchase.d.ts +4 -3
  102. package/dist/components/post-purchase.esm.js +4 -2
  103. package/dist/components/post-purchase.esm.js.map +1 -1
  104. package/dist/components/post-purchase.js +4 -2
  105. package/dist/components/post-purchase.js.map +1 -1
  106. package/dist/components/product-details-page.d.ts +2 -1
  107. package/dist/components/product-details-page.esm.js +3 -3
  108. package/dist/components/product-details-page.esm.js.map +1 -1
  109. package/dist/components/product-details-page.js +3 -3
  110. package/dist/components/product-details-page.js.map +1 -1
  111. package/dist/components/redeem-transaction.d.ts +11 -4
  112. package/dist/components/redeem-transaction.esm.js +256 -185
  113. package/dist/components/redeem-transaction.esm.js.map +1 -1
  114. package/dist/components/redeem-transaction.js +256 -185
  115. package/dist/components/redeem-transaction.js.map +1 -1
  116. package/dist/components/select-nonprofit.d.ts +7 -5
  117. package/dist/components/select-nonprofit.esm.js +55 -30
  118. package/dist/components/select-nonprofit.esm.js.map +1 -1
  119. package/dist/components/select-nonprofit.js +55 -30
  120. package/dist/components/select-nonprofit.js.map +1 -1
  121. package/dist/components/select-subscription-nonprofit.d.ts +2 -1
  122. package/dist/components/select-subscription-nonprofit.esm.js +34 -19
  123. package/dist/components/select-subscription-nonprofit.esm.js.map +1 -1
  124. package/dist/components/select-subscription-nonprofit.js +34 -19
  125. package/dist/components/select-subscription-nonprofit.js.map +1 -1
  126. package/dist/components/shopify.d.ts +6 -6
  127. package/dist/components/shopify.esm.js +1 -1
  128. package/dist/components/shopify.esm.js.map +1 -1
  129. package/dist/components/shopify.js +1 -1
  130. package/dist/components/shopify.js.map +1 -1
  131. package/dist/components/social-share.esm.js +1 -1
  132. package/dist/components/social-share.js +1 -1
  133. package/dist/components/subscription-impact.d.ts +2 -1
  134. package/dist/components/subscription-impact.esm.js +6 -6
  135. package/dist/components/subscription-impact.esm.js.map +1 -1
  136. package/dist/components/subscription-impact.js +6 -6
  137. package/dist/components/subscription-impact.js.map +1 -1
  138. package/dist/components/subscription-management.d.ts +5 -4
  139. package/dist/components/subscription-management.esm.js +4 -2
  140. package/dist/components/subscription-management.esm.js.map +1 -1
  141. package/dist/components/subscription-management.js +4 -2
  142. package/dist/components/subscription-management.js.map +1 -1
  143. package/dist/index.d.ts +12 -12
  144. package/dist/index.esm.js +1 -1
  145. package/dist/index.js +1 -1
  146. package/dist/integrations/beam.esm.js +1 -1
  147. package/dist/integrations/beam.js +1 -1
  148. package/dist/integrations/cart.d.ts +3 -3
  149. package/dist/integrations/cart.esm.js +1 -1
  150. package/dist/integrations/cart.js +1 -1
  151. package/dist/integrations/index.d.ts +10 -10
  152. package/dist/integrations/index.esm.js +1 -1
  153. package/dist/integrations/index.js +1 -1
  154. package/dist/integrations/logs.d.ts +2 -2
  155. package/dist/integrations/logs.esm.js +1 -1
  156. package/dist/integrations/logs.js +1 -1
  157. package/dist/integrations/session.esm.js +1 -1
  158. package/dist/integrations/session.js +1 -1
  159. package/dist/integrations/shopify.d.ts +5 -5
  160. package/dist/integrations/shopify.esm.js +1 -1
  161. package/dist/integrations/shopify.js +1 -1
  162. package/dist/integrations/statsig.esm.js +14 -14
  163. package/dist/integrations/statsig.esm.js.map +1 -1
  164. package/dist/integrations/statsig.js +14 -14
  165. package/dist/integrations/statsig.js.map +1 -1
  166. package/dist/integrations/utils.d.ts +3 -3
  167. package/dist/react/beam-partner-logos.esm.js +1 -1
  168. package/dist/react/beam-partner-logos.js +1 -1
  169. package/dist/react/community-impact.esm.js +1 -1
  170. package/dist/react/community-impact.js +1 -1
  171. package/dist/react/cumulative-impact.esm.js +1 -1
  172. package/dist/react/cumulative-impact.js +1 -1
  173. package/dist/react/impact-overview.esm.js +1 -1
  174. package/dist/react/impact-overview.js +1 -1
  175. package/dist/react/index.d.ts +4 -4
  176. package/dist/react/index.esm.js +1 -1
  177. package/dist/react/index.js +1 -1
  178. package/dist/react/post-purchase.d.ts +2 -2
  179. package/dist/react/post-purchase.esm.js +1 -1
  180. package/dist/react/post-purchase.esm.js.map +1 -1
  181. package/dist/react/post-purchase.js +1 -1
  182. package/dist/react/post-purchase.js.map +1 -1
  183. package/dist/react/product-details-page.esm.js +1 -1
  184. package/dist/react/product-details-page.js +1 -1
  185. package/dist/react/redeem-transaction.d.ts +3 -3
  186. package/dist/react/redeem-transaction.esm.js +1 -1
  187. package/dist/react/redeem-transaction.esm.js.map +1 -1
  188. package/dist/react/redeem-transaction.js +1 -1
  189. package/dist/react/redeem-transaction.js.map +1 -1
  190. package/dist/react/select-nonprofit.d.ts +4 -3
  191. package/dist/react/select-nonprofit.esm.js +1 -1
  192. package/dist/react/select-nonprofit.esm.js.map +1 -1
  193. package/dist/react/select-nonprofit.js +1 -1
  194. package/dist/react/select-nonprofit.js.map +1 -1
  195. package/dist/react/select-subscription-nonprofit.d.ts +3 -3
  196. package/dist/react/select-subscription-nonprofit.esm.js +1 -1
  197. package/dist/react/select-subscription-nonprofit.esm.js.map +1 -1
  198. package/dist/react/select-subscription-nonprofit.js +1 -1
  199. package/dist/react/select-subscription-nonprofit.js.map +1 -1
  200. package/dist/react/social-share.esm.js +1 -1
  201. package/dist/react/social-share.js +1 -1
  202. package/dist/react/subscription-impact.esm.js +1 -1
  203. package/dist/react/subscription-impact.js +1 -1
  204. package/dist/react/subscription-management.d.ts +3 -3
  205. package/dist/react/subscription-management.esm.js +1 -1
  206. package/dist/react/subscription-management.esm.js.map +1 -1
  207. package/dist/react/subscription-management.js +1 -1
  208. package/dist/react/subscription-management.js.map +1 -1
  209. package/dist/utils/cart.d.ts +18 -0
  210. package/dist/utils/cart.esm.js +2 -0
  211. package/dist/utils/cart.esm.js.map +1 -0
  212. package/dist/utils/cart.js +2 -0
  213. package/dist/utils/cart.js.map +1 -0
  214. package/dist/utils/events.d.ts +3 -3
  215. package/dist/utils/index.d.ts +3 -3
  216. package/package.json +1 -1
  217. package/dist/chunks/_share-dialog-dependencies-H1_GULvN.esm.js +0 -2
  218. package/dist/chunks/_share-dialog-dependencies-H1_GULvN.esm.js.map +0 -1
  219. package/dist/chunks/_share-dialog-dependencies-ww3ylfIF.esm.js +0 -2
  220. package/dist/chunks/_share-dialog-dependencies-ww3ylfIF.esm.js.map +0 -1
  221. package/dist/chunks/checkbox-P2JYPqxl.esm.js +0 -17
  222. package/dist/chunks/checkbox-P2JYPqxl.esm.js.map +0 -1
  223. package/dist/chunks/index-Gf_Ee-cU.esm.js +0 -2
  224. package/dist/chunks/index-Gf_Ee-cU.esm.js.map +0 -1
  225. package/dist/chunks/index-Mt-ELD4q.esm.js +0 -2
  226. package/dist/chunks/index-Mt-ELD4q.esm.js.map +0 -1
  227. package/dist/chunks/index-X9fTuRmg.esm.js +0 -2
  228. package/dist/chunks/index-X9fTuRmg.esm.js.map +0 -1
  229. package/dist/chunks/index-ixzz4bX7.esm.js +0 -2
  230. package/dist/chunks/index-ixzz4bX7.esm.js.map +0 -1
  231. package/dist/chunks/index-q7eo0lf1.esm.js +0 -2
  232. package/dist/chunks/index-q7eo0lf1.esm.js.map +0 -1
  233. package/dist/chunks/index-uKlidExq.esm.js +0 -2
  234. package/dist/chunks/index-uKlidExq.esm.js.map +0 -1
  235. package/dist/chunks/index-yeW2w5bb.esm.d.ts +0 -13
  236. package/dist/chunks/loading-template-mLjOGXMj.esm.js +0 -2
  237. package/dist/chunks/localize-IRs8JglT.esm.js +0 -29
  238. package/dist/chunks/localize-IRs8JglT.esm.js.map +0 -1
  239. package/dist/chunks/localize-SsJbTmMj.esm.js +0 -29
  240. package/dist/chunks/localize-SsJbTmMj.esm.js.map +0 -1
  241. package/dist/chunks/order-page-4Tj7yLdv.esm.js +0 -2
  242. package/dist/chunks/order-page-4Tj7yLdv.esm.js.map +0 -1
  243. package/dist/chunks/order-page-9qKR3-ys.esm.js +0 -2
  244. package/dist/chunks/order-page-9qKR3-ys.esm.js.map +0 -1
  245. package/dist/chunks/promo-pill-label-3Xtr5ALT.esm.js +0 -14
  246. package/dist/chunks/promo-pill-label-3Xtr5ALT.esm.js.map +0 -1
  247. package/dist/chunks/share-button-CqTd80g8.esm.js +0 -2
  248. package/dist/chunks/share-button-CqTd80g8.esm.js.map +0 -1
  249. package/dist/chunks/update-cart-Djv-AjNu.esm.js +0 -2
  250. package/dist/chunks/update-cart-Djv-AjNu.esm.js.map +0 -1
  251. package/dist/chunks/update-cart-G7FRM8DW.esm.js +0 -2
  252. package/dist/chunks/update-cart-G7FRM8DW.esm.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import{t as y,h as b,y as u,g as c,f as C,p as I}from"../chunks/lit-3QHn3fwl.esm.js";import{d as x}from"../chunks/lodash-P8OIs-at.esm.js";import{c as T,d as S,e as E}from"../chunks/enforce-config-HksNiOMu.esm.js";import{u as p,A as z,_ as f,i as d,d as v,a as B}from"../chunks/localize-IRs8JglT.esm.js";import{D,l as k,S as L}from"../chunks/routes-t6bR6BdS.esm.js";import{B as $}from"../chunks/beam-errors-P-Lu07Ce.esm.js";import{_ as V}from"../chunks/loading-template-mLjOGXMj.esm.js";import{i as A}from"../chunks/is-all-html-elements-SdSkxirh.esm.js";import"../utils/logger.esm.js";var j=Object.defineProperty,R=Object.getOwnPropertyDescriptor,h=(n,e,t,a)=>{for(var i=a>1?void 0:a?R(e,t):e,o=n.length-1,r;o>=0;o--)(r=n[o])&&(i=(a?r(e,t,i):r(i))||i);return a&&i&&j(e,t,i),i};class m extends b{constructor(){super(...arguments),this.finalValue=0,this.duration=1500,this.counter=0,this.intervalId=0,this.handleCounterAnimateIfInView=e=>{e.some(t=>t.isIntersecting)&&(this.animateCounter(),this.unobserveScrollTarget())},this.animateCounter=()=>{const e=41.666666666666664,t=e/this.duration*this.finalValue;this.intervalId=setInterval(()=>{const a=this.counter+t;if(a>=this.finalValue){this.counter=this.finalValue,clearInterval(this.intervalId);return}else this.counter=a},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([c({type:Number})],m.prototype,"finalValue",2),h([c({type:Number})],m.prototype,"duration",2),h([c({type:String})],m.prototype,"scrollTarget",2),h([y()],m.prototype,"counter",2),customElements.get("animated-counter")||customElements.define("animated-counter",m);const O=n=>{const e=n instanceof NodeList?Array.from(n):n;if(e.length===0||!A(e))return;const t=e.sort((i,o)=>{const r=getComputedStyle(i).getPropertyValue("width").replace("px",""),g=getComputedStyle(o).getPropertyValue("width").replace("px","");return parseInt(g)-parseInt(r)})[0],a=getComputedStyle(t).getPropertyValue("width");for(const i of e)getComputedStyle(i).getPropertyValue("width")!==a&&(i.style.width=a)},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 P=Object.defineProperty,q=Object.getOwnPropertyDescriptor,l=(n,e,t,a)=>{for(var i=a>1?void 0:a?q(e,t):e,o=n.length-1,r;o>=0;o--)(r=n[o])&&(i=(a?r(e,t,i):r(i))||i);return a&&i&&P(e,t,i),i};const U=1.5*1e3;class s extends b{constructor(){super(...arguments),this.baseUrl=D,this.lang="en",this.disableAnimation=!1,this.debug=!1,this.getCumulativeImpactData=async()=>(E(["apiKey","chainId"],this),await k({baseUrl:this.baseUrl,pathParams:{chainId:this.chainId},headers:{authorization:`Api-Key ${this.apiKey}`},queryParams:{version:"1.0.0",lang:this.configLang}})),this.cumulativeImpactDataController=new z(this,this.getCumulativeImpactData),this.resizeElements=x(()=>{O(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 a of t)if(e.has(a)){await this.cumulativeImpactDataController.exec();break}this.resizeElements()}render(){const{data:e,error:t,loading:a}=this.cumulativeImpactDataController;return a?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 c,f as y,p as I}from"../chunks/lit-iNN5L_Qk.esm.js";import{d as x}from"../chunks/lodash-P8OIs-at.esm.js";import{c as T,d as S,e as E}from"../chunks/enforce-config-ZAI7WYAd.esm.js";import{u as p,A as z,_ as f,i as d,d as v,a as B}from"../chunks/localize-o-cYvHQf.esm.js";import{D,l as k,S as L}from"../chunks/routes-jmFlXAbv.esm.js";import{B as $}from"../chunks/beam-errors-P-Lu07Ce.esm.js";import{_ as V}from"../chunks/loading-template-t4fFsYtr.esm.js";import{i as A}from"../chunks/is-all-html-elements-SdSkxirh.esm.js";import"../utils/logger.esm.js";var j=Object.defineProperty,R=Object.getOwnPropertyDescriptor,h=(s,e,t,a)=>{for(var i=a>1?void 0:a?R(e,t):e,o=s.length-1,r;o>=0;o--)(r=s[o])&&(i=(a?r(e,t,i):r(i))||i);return a&&i&&j(e,t,i),i};class m extends b{constructor(){super(...arguments),this.finalValue=0,this.duration=1500,this.counter=0,this.intervalId=0,this.handleCounterAnimateIfInView=e=>{e.some(t=>t.isIntersecting)&&(this.animateCounter(),this.unobserveScrollTarget())},this.animateCounter=()=>{const e=41.666666666666664,t=e/this.duration*this.finalValue;this.intervalId=setInterval(()=>{const a=this.counter+t;if(a>=this.finalValue){this.counter=this.finalValue,clearInterval(this.intervalId);return}else this.counter=a},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([c({type:Number})],m.prototype,"finalValue",2),h([c({type:Number})],m.prototype,"duration",2),h([c({type:String})],m.prototype,"scrollTarget",2),h([C()],m.prototype,"counter",2),customElements.get("animated-counter")||customElements.define("animated-counter",m);const O=s=>{const e=s instanceof NodeList?Array.from(s):s;if(e.length===0||!A(e))return;const t=e.sort((i,o)=>{const r=getComputedStyle(i).getPropertyValue("width").replace("px",""),g=getComputedStyle(o).getPropertyValue("width").replace("px","");return parseInt(g)-parseInt(r)})[0],a=getComputedStyle(t).getPropertyValue("width");for(const i of e)getComputedStyle(i).getPropertyValue("width")!==a&&(i.style.width=a)},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 P=Object.defineProperty,q=Object.getOwnPropertyDescriptor,l=(s,e,t,a)=>{for(var i=a>1?void 0:a?q(e,t):e,o=s.length-1,r;o>=0;o--)(r=s[o])&&(i=(a?r(e,t,i):r(i))||i);return a&&i&&P(e,t,i),i};const U=1.5*1e3;class n extends b{constructor(){super(...arguments),this.baseUrl=D,this.lang="en",this.disableAnimation=!1,this.debug=!1,this.draftConfig=!1,this.getCumulativeImpactData=async()=>(E(["apiKey","chainId"],this),await k({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(()=>{O(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 a of t)if(e.has(a)){await this.cumulativeImpactDataController.exec();break}this.resizeElements()}render(){const{data:e,error:t,loading:a}=this.cumulativeImpactDataController;return a?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()}
@@ -42,7 +42,7 @@ import{t as y,h as b,y as u,g as c,f as C,p as I}from"../chunks/lit-3QHn3fwl.esm
42
42
  </div>
43
43
  <div class="impact-row-description">${r} ${g}</div>
44
44
  </div>
45
- `}get cssVariables(){const e={"--beam-fontFamily":"inherit","--beam-fontStyle":"inherit","--beam-fontSize":"16px","--beam-lineHeight":"1","--beam-textColor":"inherit",...v("--beam-CumulativeImpact-title",{fontSize:"32px"}),...v("--beam-CumulativeImpact-description",{marginTop:"16px",lineHeight:"1.3"}),"--beam-CumulativeImpact-impact-list-marginTop":"24px","--beam-CumulativeImpact-row-marginTop":"24px","--beam-CumulativeImpact-row-value-container-borderBottomWidth":"4px","--beam-CumulativeImpact-row-value-container-borderBottomColor":"currentColor","--beam-CumulativeImpact-row-value-container-paddingTop":"0","--beam-CumulativeImpact-row-value-container-paddingRight":"20px","--beam-CumulativeImpact-row-value-container-paddingBottom":"4px","--beam-CumulativeImpact-row-value-container-paddingLeft":"20px",...v("--beam-CumulativeImpact-row-value-counter",{color:"currentColor",fontSize:"24px",fontWeight:"normal"}),...v("--beam-CumulativeImpact-row-description",{color:"currentColor",fontSize:"16px",fontWeight:"normal",lineHeight:"1.3"}),"--beam-CumulativeImpact-row-description-paddingLeft":"24px","--beam-CumulativeImpact-row-description-paddingRight":"24px","--beam-CumulativeImpact-row-description-mobile-marginTop":"12px"},t=this.cumulativeImpactDataController.data?.config?.web?.theme||{},a={...e,...t};return Object.assign(Object.create({toCSS(){return B(this)}}),a)}}s.tagName="beam-cumulative-impact",s.styles=[T,C`
45
+ `}get cssVariables(){const e={"--beam-fontFamily":"inherit","--beam-fontStyle":"inherit","--beam-fontSize":"16px","--beam-lineHeight":"1","--beam-textColor":"inherit",...v("--beam-CumulativeImpact-title",{fontSize:"32px"}),...v("--beam-CumulativeImpact-description",{marginTop:"16px",lineHeight:"1.3"}),"--beam-CumulativeImpact-impact-list-marginTop":"24px","--beam-CumulativeImpact-row-marginTop":"24px","--beam-CumulativeImpact-row-value-container-borderBottomWidth":"4px","--beam-CumulativeImpact-row-value-container-borderBottomColor":"currentColor","--beam-CumulativeImpact-row-value-container-paddingTop":"0","--beam-CumulativeImpact-row-value-container-paddingRight":"20px","--beam-CumulativeImpact-row-value-container-paddingBottom":"4px","--beam-CumulativeImpact-row-value-container-paddingLeft":"20px",...v("--beam-CumulativeImpact-row-value-counter",{color:"currentColor",fontSize:"24px",fontWeight:"normal"}),...v("--beam-CumulativeImpact-row-description",{color:"currentColor",fontSize:"16px",fontWeight:"normal",lineHeight:"1.3"}),"--beam-CumulativeImpact-row-description-paddingLeft":"24px","--beam-CumulativeImpact-row-description-paddingRight":"24px","--beam-CumulativeImpact-row-description-mobile-marginTop":"12px"},t=this.cumulativeImpactDataController.data?.config?.web?.theme||{},a={...e,...t};return Object.assign(Object.create({toCSS(){return B(this)}}),a)}}n.tagName="beam-cumulative-impact",n.styles=[T,y`
46
46
  :host {
47
47
  display: block;
48
48
  font-family: var(--beam-fontFamily, inherit);
@@ -117,5 +117,5 @@ import{t as y,h as b,y as u,g as c,f as C,p as I}from"../chunks/lit-3QHn3fwl.esm
117
117
  padding-bottom: 0;
118
118
  }
119
119
  }
120
- `],l([c({type:String})],s.prototype,"apiKey",2),l([c({type:Number})],s.prototype,"chainId",2),l([c({type:String})],s.prototype,"baseUrl",2),l([c({type:String})],s.prototype,"lang",2),l([c({type:Boolean})],s.prototype,"disableAnimation",2),l([c({type:Boolean})],s.prototype,"debug",2),l([I(".impact-row-value-container")],s.prototype,"impactRowRefs",2),S(s);export{s as BeamCumulativeImpact};
120
+ `],l([c({type:String})],n.prototype,"apiKey",2),l([c({type:Number})],n.prototype,"chainId",2),l([c({type:String})],n.prototype,"baseUrl",2),l([c({type:String})],n.prototype,"lang",2),l([c({type:Boolean})],n.prototype,"disableAnimation",2),l([c({type:Boolean})],n.prototype,"debug",2),l([c({type:Boolean})],n.prototype,"draftConfig",2),l([I(".impact-row-value-container")],n.prototype,"impactRowRefs",2),S(n);export{n as BeamCumulativeImpact};
121
121
  //# sourceMappingURL=cumulative-impact.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cumulative-impact.esm.js","sources":["../../src/shared/components/animated-counter/index.ts","../../src/shared/sync-element-widths.ts","../../src/components/cumulative-impact/strings.ts","../../src/components/cumulative-impact/index.ts"],"sourcesContent":["import { html, LitElement } from \"lit\";\nimport { property } from \"lit/decorators/property.js\";\nimport { state } from \"lit/decorators.js\";\n\nexport class AnimatedCounter extends LitElement {\n @property({ type: Number }) finalValue = 0;\n @property({ type: Number }) duration = 1500;\n @property({ type: String }) scrollTarget?: string;\n\n @state() protected counter = 0;\n private intervalId = 0;\n\n connectedCallback() {\n super.connectedCallback();\n const userPrefersReducedMotion = window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n if (this.duration === 0 || userPrefersReducedMotion) {\n this.counter = this.finalValue;\n } else {\n this.observeScrollTarget();\n }\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.unobserveScrollTarget();\n clearInterval(this.intervalId);\n }\n\n private handleCounterAnimateIfInView: IntersectionObserverCallback = (entries) => {\n if (entries.some((entry) => entry.isIntersecting)) {\n this.animateCounter();\n this.unobserveScrollTarget();\n }\n };\n\n private animateCounter = () => {\n const ANIMATION_FRAME_RATE = 24;\n const MS_PER_FRAME = 1000 / ANIMATION_FRAME_RATE;\n const INCREMENT_RATE_PER_FRAME = MS_PER_FRAME / this.duration;\n const COUNTER_INCREMENT_PER_FRAME = INCREMENT_RATE_PER_FRAME * this.finalValue;\n\n this.intervalId = setInterval(() => {\n const result = this.counter + COUNTER_INCREMENT_PER_FRAME;\n if (result >= this.finalValue) {\n this.counter = this.finalValue;\n clearInterval(this.intervalId);\n return;\n } else {\n this.counter = result;\n }\n }, MS_PER_FRAME);\n };\n\n private observer = new IntersectionObserver(this.handleCounterAnimateIfInView, {\n threshold: 0.1,\n });\n\n private observeScrollTarget = () => {\n const target = this.scrollTargetElement;\n target && this.observer.observe(target);\n };\n\n private unobserveScrollTarget = () => {\n const target = this.scrollTargetElement;\n target && this.observer.unobserve(target);\n };\n\n get scrollTargetElement(): this | Element | null {\n if (this.scrollTarget) {\n return document.querySelector(this.scrollTarget);\n } else {\n return this;\n }\n }\n\n render() {\n return html`${Math.ceil(this.counter).toLocaleString()}`;\n }\n}\n\ncustomElements.get(\"animated-counter\") || customElements.define(\"animated-counter\", AnimatedCounter);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"animated-counter\": AnimatedCounter;\n }\n}\n","import { isAllHtmlElements } from \"./is-all-html-elements\";\n\n/**\n * Synchronize widths of elements\n * @param {Array<HTMLElement|null>} elements - Elements to synchronize\n */\nexport const syncElementWidths = (elements: Array<HTMLElement | null> | NodeList) => {\n const els = elements instanceof NodeList ? Array.from(elements) : elements;\n\n if (els.length === 0 || !isAllHtmlElements(els)) {\n return;\n }\n\n const widthSource = els.sort((a, b) => {\n const widthA = getComputedStyle(a).getPropertyValue(\"width\").replace(\"px\", \"\");\n const widthB = getComputedStyle(b).getPropertyValue(\"width\").replace(\"px\", \"\");\n return parseInt(widthB) - parseInt(widthA);\n })[0];\n\n const syncedWidth = getComputedStyle(widthSource).getPropertyValue(\"width\");\n\n for (const el of els) {\n if (getComputedStyle(el).getPropertyValue(\"width\") !== syncedWidth) {\n el.style[\"width\"] = syncedWidth;\n }\n }\n};\n","export const strings = {\n en: {\n cumulativeImpactTitle: () => `What we've funded`,\n cumulativeImpactDescription: () =>\n \"Here's the impact that our community has made so far in partnership with Beam. Our impact is growing every day— scroll to check out the goals we're working toward together right now.\",\n },\n fr: {\n cumulativeImpactTitle: () => `Ce que nous avons financé`,\n cumulativeImpactDescription: () =>\n \"Voici l'impact que notre communauté a eu jusqu'à présent en partenariat avec Beam. Notre impact grandit chaque jour : faites défiler pour découvrir les objectifs vers lesquels nous travaillons ensemble en ce moment.\",\n },\n de: {\n cumulativeImpactTitle: () => `Was wir finanziert haben`,\n cumulativeImpactDescription: () =>\n \"Hier ist die Wirkung, die unsere Community bisher in Zusammenarbeit mit Beam erzielt hat. Unsere Wirkung wächst von Tag zu Tag - scrollen Sie, um einen Blick auf die Ziele zu werfen, auf die wir derzeit gemeinsam hinarbeiten.\",\n },\n es: {\n cumulativeImpactTitle: () => `Lo que hemos financiado`,\n cumulativeImpactDescription: () =>\n \"Este es el impacto que nuestra comunidad ha tenido hasta ahora en asociación con Beam. Nuestro impacto crece cada día; desplácese para ver los objetivos por los que estamos trabajando juntos en este momento.\",\n },\n it: {\n cumulativeImpactTitle: () => `Cosa abbiamo finanziato`,\n cumulativeImpactDescription: () =>\n \"Ecco l'impatto che la nostra comunità 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.\",\n },\n pl: {\n cumulativeImpactTitle: () => `Co sfinansowaliśmy`,\n cumulativeImpactDescription: () =>\n \"Oto wpływ, jaki nasza społeczność wywarła dotychczas we współpracy z Beam. Nasz wpływ rośnie z każdym dniem — przewiń, aby sprawdzić cele, nad którymi obecnie wspólnie pracujemy.\",\n },\n};\n","import { css, html, LitElement } from \"lit\";\nimport { property } from \"lit/decorators/property.js\";\nimport { queryAll } from \"lit/decorators/query-all.js\";\nimport debounce from \"lodash-es/debounce\";\nimport \"../../shared/components/animated-counter\";\nimport { cssReset } from \"../../shared/css-reset\";\nimport { defineCustomElement } from \"../../shared/defineCustomElement\";\nimport { _cssVariableMap } from \"../../shared/fragments/css-variable-map\";\nimport { DEFAULT_BASE_URL, SUPPORTED_LANGUAGES } from \"../../api-sdk/constants\";\nimport { TNumericId } from \"../../shared/types\";\nimport { LANGUAGES } from \"../../api-sdk/types\";\nimport { getCumulativeImpact } from \"../../api-sdk/v3/routes\";\nimport { enforceConfig } from \"../../shared/enforce-config\";\nimport { BeamError, MissingConfig } from \"../../utils/beam-errors\";\nimport { AsyncController } from \"../../shared/controllers/async-controller\";\nimport { _errorMessage } from \"../../shared/fragments/error-message-template\";\nimport { _loading } from \"../../shared/fragments/loading-template\";\nimport { syncElementWidths } from \"../../shared/sync-element-widths\";\nimport { localizeUserString } from \"../../shared/localize\";\nimport { defineCustomText, useCustomText } from \"../../shared/fragments/custom-text\";\nimport { strings } from \"./strings\";\n\ntype RequiredConfig = {\n apiKey: string;\n chainId: TNumericId;\n};\n\ntype IAPIV3CumulativeImpact = Awaited<ReturnType<typeof getCumulativeImpact>>;\n\nconst MAX_COUNTER_ANIMATION_DURATION = 1.5 * 1000;\n\nexport class BeamCumulativeImpact extends LitElement {\n static tagName = \"beam-cumulative-impact\";\n\n @property({ type: String }) public apiKey?: RequiredConfig[\"apiKey\"];\n\n @property({ type: Number }) public chainId?: RequiredConfig[\"chainId\"];\n\n @property({ type: String }) public baseUrl = DEFAULT_BASE_URL;\n\n @property({ type: String }) public lang: LANGUAGES = \"en\";\n\n @property({ type: Boolean }) public disableAnimation = false;\n\n @property({ type: Boolean }) public debug = false;\n\n get configLang() {\n return SUPPORTED_LANGUAGES[this.lang] || \"en\";\n }\n\n private getCumulativeImpactData = async () => {\n if (!enforceConfig<RequiredConfig>([\"apiKey\", \"chainId\"], this)) {\n throw new MissingConfig();\n }\n const res = await getCumulativeImpact({\n baseUrl: this.baseUrl,\n pathParams: {\n chainId: this.chainId,\n },\n headers: {\n authorization: `Api-Key ${this.apiKey}`,\n },\n queryParams: {\n version: \"1.0.0\",\n lang: this.configLang,\n },\n });\n\n return res;\n };\n\n private cumulativeImpactDataController = new AsyncController<typeof this.getCumulativeImpactData>(\n this,\n this.getCumulativeImpactData\n );\n\n @queryAll(\".impact-row-value-container\")\n impactRowRefs!: HTMLElement[];\n resizeElements = debounce(\n () => {\n syncElementWidths(this.impactRowRefs);\n },\n 50,\n { maxWait: 50, leading: true }\n );\n\n connectedCallback() {\n super.connectedCallback();\n window.addEventListener(\"resize\", this.resizeElements);\n }\n\n async updated(changedProperties: Map<string, unknown>) {\n // Reload nonprofit list on change of any of these props:\n // Also fires on first load as props go from undefined => value\n const requireNewDataProps = [\"chainId\", \"baseUrl\", \"lang\"];\n for (const prop of requireNewDataProps) {\n if (changedProperties.has(prop)) {\n await this.cumulativeImpactDataController.exec();\n break;\n }\n }\n\n this.resizeElements();\n }\n\n render() {\n const { data, error, loading } = this.cumulativeImpactDataController;\n if (loading) {\n return _loading();\n }\n if (error) {\n if (this.debug) {\n return _errorMessage({ error });\n }\n return \"\";\n }\n if (data == null) {\n if (this.debug) {\n return _errorMessage({ error: new BeamError(\"Missing data\") });\n }\n return \"\";\n }\n\n return html`\n <style>\n :host {\n ${this.cssVariables.toCSS()}\n }\n </style>\n <div style=\"display: flex; flex-direction: column;\" class=\"root\">\n <div\n style=\"margin: 10px 0 0 0;\"\n tabindex=\"-1\"\n class=\"options\"\n part=\"options\"\n aria-labelledby=\"beam-RedeemTransaction-title\"\n >\n ${this.renderCumulativeImpact(data)}\n </div>\n </div>\n `;\n }\n\n private renderCumulativeImpact(data: IAPIV3CumulativeImpact) {\n const rawValues = data.impacts ? data.impacts?.map((impact) => impact.value || 0) : [];\n const maxRawValue = Math.max(...rawValues);\n const durations = rawValues.map(\n (val) => (MAX_COUNTER_ANIMATION_DURATION * Math.log(Math.max(val, 1))) / Math.log(maxRawValue)\n );\n return html`\n <div class=\"main\">\n <div class=\"title\" role=\"heading\">\n ${localizeUserString(this.configLang, data?.config?.web?.title || \"\") ||\n strings[this.configLang].cumulativeImpactTitle()}\n </div>\n <p class=\"description\">\n ${localizeUserString(this.configLang, data?.config?.web?.description || \"\") ||\n strings[this.configLang].cumulativeImpactDescription()}\n </p>\n <div class=\"impact-list\">\n ${data.impacts?.map((impact: any, idx: number) => {\n return this.renderCumulativeImpactRow({ impact, animationDuration: durations[idx] });\n })}\n </div>\n </div>\n `;\n }\n\n private renderCumulativeImpactRow({ impact, animationDuration }: { impact: any; animationDuration: number }) {\n const disableAnimation = this.cumulativeImpactDataController.data?.config?.web.disableAnimation;\n const floatingCounterClass = \"impact-row-value-counter impact-row-value-floating-counter\";\n const duration = disableAnimation ? 0 : animationDuration;\n\n const unitDisplay = localizeUserString(this.configLang, impact.unit || \"\");\n const summaryDisplay = localizeUserString(this.configLang, impact.summary || \"\");\n\n /**\n * because we set the width using JavaScript by forcing all impact-row-value-container elements\n * to match the width of the widest sibling, we use a hidden span with the total preloaded to\n * ensure that impact-row-value-container widths do not change as the animation runs.\n */\n return html`\n <div class=\"impact-row\">\n <div class=\"impact-row-value-container\">\n <span class=\"impact-row-value-counter\" style=\"visibility: hidden;\" aria-hidden=\"true\">\n ${impact.value.toLocaleString()}\n </span>\n <animated-counter\n class=\"${floatingCounterClass}\"\n finalValue=${impact.value}\n duration=${duration}\n ></animated-counter>\n </span>\n </div>\n <div class=\"impact-row-description\">${unitDisplay} ${summaryDisplay}</div>\n </div>\n `;\n }\n\n public get cssVariables() {\n const defaults: Record<string, string> = {\n \"--beam-fontFamily\": \"inherit\",\n \"--beam-fontStyle\": \"inherit\",\n \"--beam-fontSize\": \"16px\",\n \"--beam-lineHeight\": \"1\",\n \"--beam-textColor\": \"inherit\",\n // main\n ...defineCustomText(\"--beam-CumulativeImpact-title\", {\n fontSize: \"32px\",\n }),\n ...defineCustomText(\"--beam-CumulativeImpact-description\", {\n marginTop: \"16px\",\n lineHeight: \"1.3\",\n }),\n \"--beam-CumulativeImpact-impact-list-marginTop\": \"24px\",\n \"--beam-CumulativeImpact-row-marginTop\": \"24px\",\n // row value container\n \"--beam-CumulativeImpact-row-value-container-borderBottomWidth\": \"4px\",\n \"--beam-CumulativeImpact-row-value-container-borderBottomColor\": \"currentColor\",\n \"--beam-CumulativeImpact-row-value-container-paddingTop\": \"0\",\n \"--beam-CumulativeImpact-row-value-container-paddingRight\": \"20px\",\n \"--beam-CumulativeImpact-row-value-container-paddingBottom\": \"4px\",\n \"--beam-CumulativeImpact-row-value-container-paddingLeft\": \"20px\",\n // row value counter\n ...defineCustomText(\"--beam-CumulativeImpact-row-value-counter\", {\n color: \"currentColor\",\n fontSize: \"24px\",\n fontWeight: \"normal\",\n }),\n // row description\n ...defineCustomText(\"--beam-CumulativeImpact-row-description\", {\n color: \"currentColor\",\n fontSize: \"16px\",\n fontWeight: \"normal\",\n lineHeight: \"1.3\",\n }),\n \"--beam-CumulativeImpact-row-description-paddingLeft\": \"24px\",\n \"--beam-CumulativeImpact-row-description-paddingRight\": \"24px\",\n \"--beam-CumulativeImpact-row-description-mobile-marginTop\": \"12px\",\n };\n\n const remoteConfig = this.cumulativeImpactDataController.data?.config?.web?.theme || {};\n\n const config = { ...defaults, ...remoteConfig };\n\n const serializable = Object.create({\n toCSS() {\n return _cssVariableMap(this as Record<string, string>);\n },\n });\n\n return Object.assign(serializable, config);\n }\n\n static styles = [\n cssReset,\n css`\n :host {\n display: block;\n font-family: var(--beam-fontFamily, inherit);\n font-style: var(--beam-fontStyle, inherit);\n font-size: var(--beam-fontSize, inherit);\n color: var(--beam-textColor, inherit);\n background-color: var(--beam-backgroundColor, inherit);\n line-height: var(--beam-lineHeight, 1);\n word-break: normal;\n }\n .main {\n text-align: left;\n }\n .title {\n ${useCustomText(\"--beam-CumulativeImpact-title\")}\n text-align: inherit;\n }\n .description {\n ${useCustomText(\"--beam-CumulativeImpact-description\")}\n text-align: inherit;\n }\n .impact-list {\n display: flex;\n flex-direction: column;\n margin-top: var(--beam-CumulativeImpact-impact-list-marginTop);\n }\n .impact-row {\n display: flex;\n align-items: center;\n margin-top: var(--beam-CumulativeImpact-row-marginTop);\n }\n .impact-row-value-container {\n position: relative;\n border-bottom-width: var(--beam-CumulativeImpact-row-value-container-borderBottomWidth);\n border-bottom-color: var(--beam-CumulativeImpact-row-value-container-borderBottomColor);\n border-bottom-style: solid;\n padding-top: var(--beam-CumulativeImpact-row-value-container-paddingTop);\n padding-right: var(--beam-CumulativeImpact-row-value-container-paddingRight);\n padding-bottom: var(--beam-CumulativeImpact-row-value-container-paddingBottom);\n padding-left: var(--beam-CumulativeImpact-row-value-container-paddingLeft);\n text-align: center;\n flex-shrink: 0;\n }\n .impact-row-value-counter {\n ${useCustomText(\"--beam-CumulativeImpact-row-value-counter\")}\n }\n .impact-row-value-floating-counter {\n position: absolute;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n }\n .impact-row-description {\n ${useCustomText(\"--beam-CumulativeImpact-row-description\")}\n padding-left: var(--beam-CumulativeImpact-row-description-paddingLeft);\n padding-right: var(--beam-CumulativeImpact-row-description-paddingRight);\n /* match padding of value of counter for proper centering */\n padding-bottom: var(--beam-CumulativeImpact-row-value-paddingBottom);\n text-align: inherit;\n flex-grow: 1;\n }\n @media (max-width: 500px) {\n .main {\n text-align: center;\n }\n .impact-row {\n flex-direction: column;\n }\n .impact-row-description {\n margin-top: var(--beam-CumulativeImpact-row-description-mobile-marginTop);\n padding-bottom: 0;\n }\n }\n `,\n ];\n}\n\ndefineCustomElement(BeamCumulativeImpact);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"beam-cumulative-impact\": BeamCumulativeImpact;\n }\n}\n"],"names":["AnimatedCounter","LitElement","entries","entry","MS_PER_FRAME","COUNTER_INCREMENT_PER_FRAME","result","target","userPrefersReducedMotion","html","__decorateClass","property","state","syncElementWidths","elements","els","isAllHtmlElements","widthSource","a","b","widthA","widthB","syncedWidth","el","strings","f","h","o","s","m","i","e","r","MAX_COUNTER_ANIMATION_DURATION","BeamCumulativeImpact","DEFAULT_BASE_URL","enforceConfig","getCumulativeImpact","AsyncController","debounce","SUPPORTED_LANGUAGES","changedProperties","requireNewDataProps","prop","data","error","loading","_loading","_errorMessage","BeamError","rawValues","impact","maxRawValue","durations","val","localizeUserString","idx","animationDuration","disableAnimation","floatingCounterClass","duration","unitDisplay","summaryDisplay","defaults","defineCustomText","remoteConfig","config","_cssVariableMap","cssReset","css","useCustomText","queryAll","defineCustomElement"],"mappings":"8wBAIaA,UAAwBC,CAAW,CAAzC,aAAA,CAAA,MAAA,GAAA,SAAA,EACuB,KAAa,WAAA,EACb,KAAW,SAAA,KAG9B,KAAU,QAAU,EAC7B,KAAQ,WAAa,EAkBrB,KAAQ,6BAA8DC,GAAY,CAC5EA,EAAQ,KAAMC,GAAUA,EAAM,cAAc,IAC9C,KAAK,eAAe,EACpB,KAAK,sBAAA,EAET,EAEA,KAAQ,eAAiB,IAAM,CAE7B,MAAMC,EAAe,mBAEfC,EAD2BD,EAAe,KAAK,SACU,KAAK,WAEpE,KAAK,WAAa,YAAY,IAAM,CAClC,MAAME,EAAS,KAAK,QAAUD,EAC9B,GAAIC,GAAU,KAAK,WAAY,CAC7B,KAAK,QAAU,KAAK,WACpB,cAAc,KAAK,UAAU,EAC7B,MACF,MACE,KAAK,QAAUA,CAEnB,EAAGF,CAAY,CACjB,EAEA,KAAQ,SAAW,IAAI,qBAAqB,KAAK,6BAA8B,CAC7E,UAAW,EACb,CAAC,EAED,KAAQ,oBAAsB,IAAM,CAClC,MAAMG,EAAS,KAAK,oBACpBA,GAAU,KAAK,SAAS,QAAQA,CAAM,CACxC,EAEA,KAAQ,sBAAwB,IAAM,CACpC,MAAMA,EAAS,KAAK,oBACpBA,GAAU,KAAK,SAAS,UAAUA,CAAM,CAC1C,CArDA,CAAA,mBAAoB,CAClB,MAAM,oBACN,MAAMC,EAA2B,OAAO,WAAW,kCAAkC,EAAE,QACnF,KAAK,WAAa,GAAKA,EACzB,KAAK,QAAU,KAAK,WAEpB,KAAK,oBAAoB,CAE7B,CAEA,sBAAuB,CACrB,MAAM,qBAAqB,EAC3B,KAAK,sBACL,EAAA,cAAc,KAAK,UAAU,CAC/B,CAyCA,IAAI,qBAA6C,CAC/C,OAAI,KAAK,aACA,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,CAAA,EAEAxB,EAAA,CAAlCC,EAAS,CAAE,KAAM,MAAO,CAAC,CATf,EAAAuB,EASwB,oBAECxB,EAAA,CAAnCC,EAAS,CAAE,KAAM,OAAQ,CAAC,CAAA,EAXhBuB,EAWyB,UAEAxB,mBAAAA,CAAAA,EAAAA,EAAA,CAAnCC,EAAS,CAAE,KAAM,OAAQ,CAAC,GAbhBuB,EAayB,UAAA,QAAA,CAAA,EAiCpCxB,EAAA,CADC6D,EAAS,6BAA6B,CAAA,EA7C5BrC,EA8CX,UAAA,gBAAA,CAAA,EAkQFsC,EAAoBtC,CAAoB"}
1
+ {"version":3,"file":"cumulative-impact.esm.js","sources":["../../src/shared/components/animated-counter/index.ts","../../src/shared/sync-element-widths.ts","../../src/components/cumulative-impact/strings.ts","../../src/components/cumulative-impact/index.ts"],"sourcesContent":["import { html, LitElement } from \"lit\";\nimport { property } from \"lit/decorators/property.js\";\nimport { state } from \"lit/decorators.js\";\n\nexport class AnimatedCounter extends LitElement {\n @property({ type: Number }) finalValue = 0;\n @property({ type: Number }) duration = 1500;\n @property({ type: String }) scrollTarget?: string;\n\n @state() protected counter = 0;\n private intervalId = 0;\n\n connectedCallback() {\n super.connectedCallback();\n const userPrefersReducedMotion = window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n if (this.duration === 0 || userPrefersReducedMotion) {\n this.counter = this.finalValue;\n } else {\n this.observeScrollTarget();\n }\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.unobserveScrollTarget();\n clearInterval(this.intervalId);\n }\n\n private handleCounterAnimateIfInView: IntersectionObserverCallback = (entries) => {\n if (entries.some((entry) => entry.isIntersecting)) {\n this.animateCounter();\n this.unobserveScrollTarget();\n }\n };\n\n private animateCounter = () => {\n const ANIMATION_FRAME_RATE = 24;\n const MS_PER_FRAME = 1000 / ANIMATION_FRAME_RATE;\n const INCREMENT_RATE_PER_FRAME = MS_PER_FRAME / this.duration;\n const COUNTER_INCREMENT_PER_FRAME = INCREMENT_RATE_PER_FRAME * this.finalValue;\n\n this.intervalId = setInterval(() => {\n const result = this.counter + COUNTER_INCREMENT_PER_FRAME;\n if (result >= this.finalValue) {\n this.counter = this.finalValue;\n clearInterval(this.intervalId);\n return;\n } else {\n this.counter = result;\n }\n }, MS_PER_FRAME);\n };\n\n private observer = new IntersectionObserver(this.handleCounterAnimateIfInView, {\n threshold: 0.1,\n });\n\n private observeScrollTarget = () => {\n const target = this.scrollTargetElement;\n target && this.observer.observe(target);\n };\n\n private unobserveScrollTarget = () => {\n const target = this.scrollTargetElement;\n target && this.observer.unobserve(target);\n };\n\n get scrollTargetElement(): this | Element | null {\n if (this.scrollTarget) {\n return document.querySelector(this.scrollTarget);\n } else {\n return this;\n }\n }\n\n render() {\n return html`${Math.ceil(this.counter).toLocaleString()}`;\n }\n}\n\ncustomElements.get(\"animated-counter\") || customElements.define(\"animated-counter\", AnimatedCounter);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"animated-counter\": AnimatedCounter;\n }\n}\n","import { isAllHtmlElements } from \"./is-all-html-elements\";\n\n/**\n * Synchronize widths of elements\n * @param {Array<HTMLElement|null>} elements - Elements to synchronize\n */\nexport const syncElementWidths = (elements: Array<HTMLElement | null> | NodeList) => {\n const els = elements instanceof NodeList ? Array.from(elements) : elements;\n\n if (els.length === 0 || !isAllHtmlElements(els)) {\n return;\n }\n\n const widthSource = els.sort((a, b) => {\n const widthA = getComputedStyle(a).getPropertyValue(\"width\").replace(\"px\", \"\");\n const widthB = getComputedStyle(b).getPropertyValue(\"width\").replace(\"px\", \"\");\n return parseInt(widthB) - parseInt(widthA);\n })[0];\n\n const syncedWidth = getComputedStyle(widthSource).getPropertyValue(\"width\");\n\n for (const el of els) {\n if (getComputedStyle(el).getPropertyValue(\"width\") !== syncedWidth) {\n el.style[\"width\"] = syncedWidth;\n }\n }\n};\n","export const strings = {\n en: {\n cumulativeImpactTitle: () => `What we've funded`,\n cumulativeImpactDescription: () =>\n \"Here's the impact that our community has made so far in partnership with Beam. Our impact is growing every day— scroll to check out the goals we're working toward together right now.\",\n },\n fr: {\n cumulativeImpactTitle: () => `Ce que nous avons financé`,\n cumulativeImpactDescription: () =>\n \"Voici l'impact que notre communauté a eu jusqu'à présent en partenariat avec Beam. Notre impact grandit chaque jour : faites défiler pour découvrir les objectifs vers lesquels nous travaillons ensemble en ce moment.\",\n },\n de: {\n cumulativeImpactTitle: () => `Was wir finanziert haben`,\n cumulativeImpactDescription: () =>\n \"Hier ist die Wirkung, die unsere Community bisher in Zusammenarbeit mit Beam erzielt hat. Unsere Wirkung wächst von Tag zu Tag - scrollen Sie, um einen Blick auf die Ziele zu werfen, auf die wir derzeit gemeinsam hinarbeiten.\",\n },\n es: {\n cumulativeImpactTitle: () => `Lo que hemos financiado`,\n cumulativeImpactDescription: () =>\n \"Este es el impacto que nuestra comunidad ha tenido hasta ahora en asociación con Beam. Nuestro impacto crece cada día; desplácese para ver los objetivos por los que estamos trabajando juntos en este momento.\",\n },\n it: {\n cumulativeImpactTitle: () => `Cosa abbiamo finanziato`,\n cumulativeImpactDescription: () =>\n \"Ecco l'impatto che la nostra comunità 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.\",\n },\n pl: {\n cumulativeImpactTitle: () => `Co sfinansowaliśmy`,\n cumulativeImpactDescription: () =>\n \"Oto wpływ, jaki nasza społeczność wywarła dotychczas we współpracy z Beam. Nasz wpływ rośnie z każdym dniem — przewiń, aby sprawdzić cele, nad którymi obecnie wspólnie pracujemy.\",\n },\n};\n","import { css, html, LitElement } from \"lit\";\nimport { property } from \"lit/decorators/property.js\";\nimport { queryAll } from \"lit/decorators/query-all.js\";\nimport debounce from \"lodash-es/debounce\";\nimport \"../../shared/components/animated-counter\";\nimport { cssReset } from \"../../shared/css-reset\";\nimport { defineCustomElement } from \"../../shared/defineCustomElement\";\nimport { _cssVariableMap } from \"../../shared/fragments/css-variable-map\";\nimport { DEFAULT_BASE_URL, SUPPORTED_LANGUAGES } from \"../../api-sdk/constants\";\nimport { TNumericId } from \"../../shared/types\";\nimport { LANGUAGES } from \"../../api-sdk/types\";\nimport { getCumulativeImpact } from \"../../api-sdk/v3/routes\";\nimport { enforceConfig } from \"../../shared/enforce-config\";\nimport { BeamError, MissingConfig } from \"../../utils/beam-errors\";\nimport { AsyncController } from \"../../shared/controllers/async-controller\";\nimport { _errorMessage } from \"../../shared/fragments/error-message-template\";\nimport { _loading } from \"../../shared/fragments/loading-template\";\nimport { syncElementWidths } from \"../../shared/sync-element-widths\";\nimport { localizeUserString } from \"../../shared/localize\";\nimport { defineCustomText, useCustomText } from \"../../shared/fragments/custom-text\";\nimport { strings } from \"./strings\";\n\ntype RequiredConfig = {\n apiKey: string;\n chainId: TNumericId;\n};\n\ntype IAPIV3CumulativeImpact = Awaited<ReturnType<typeof getCumulativeImpact>>;\n\nconst MAX_COUNTER_ANIMATION_DURATION = 1.5 * 1000;\n\nexport class BeamCumulativeImpact extends LitElement {\n static tagName = \"beam-cumulative-impact\";\n\n @property({ type: String }) public apiKey?: RequiredConfig[\"apiKey\"];\n\n @property({ type: Number }) public chainId?: RequiredConfig[\"chainId\"];\n\n @property({ type: String }) public baseUrl = DEFAULT_BASE_URL;\n\n @property({ type: String }) public lang: LANGUAGES = \"en\";\n\n @property({ type: Boolean }) public disableAnimation = false;\n\n @property({ type: Boolean }) public debug = false;\n\n @property({ type: Boolean }) public draftConfig = false;\n\n get configLang() {\n return SUPPORTED_LANGUAGES[this.lang] || \"en\";\n }\n\n private getCumulativeImpactData = async () => {\n if (!enforceConfig<RequiredConfig>([\"apiKey\", \"chainId\"], this)) {\n throw new MissingConfig();\n }\n const res = await getCumulativeImpact({\n baseUrl: this.baseUrl,\n pathParams: {\n chainId: this.chainId,\n },\n headers: {\n authorization: `Api-Key ${this.apiKey}`,\n },\n queryParams: {\n version: \"1.0.0\",\n lang: this.configLang,\n draftConfig: this.draftConfig,\n },\n });\n\n return res;\n };\n\n private cumulativeImpactDataController = new AsyncController<typeof this.getCumulativeImpactData>(\n this,\n this.getCumulativeImpactData\n );\n\n @queryAll(\".impact-row-value-container\")\n impactRowRefs!: HTMLElement[];\n resizeElements = debounce(\n () => {\n syncElementWidths(this.impactRowRefs);\n },\n 50,\n { maxWait: 50, leading: true }\n );\n\n connectedCallback() {\n super.connectedCallback();\n window.addEventListener(\"resize\", this.resizeElements);\n }\n\n async updated(changedProperties: Map<string, unknown>) {\n // Reload nonprofit list on change of any of these props:\n // Also fires on first load as props go from undefined => value\n const requireNewDataProps = [\"chainId\", \"baseUrl\", \"lang\"];\n for (const prop of requireNewDataProps) {\n if (changedProperties.has(prop)) {\n await this.cumulativeImpactDataController.exec();\n break;\n }\n }\n\n this.resizeElements();\n }\n\n render() {\n const { data, error, loading } = this.cumulativeImpactDataController;\n if (loading) {\n return _loading();\n }\n if (error) {\n if (this.debug) {\n return _errorMessage({ error });\n }\n return \"\";\n }\n if (data == null) {\n if (this.debug) {\n return _errorMessage({ error: new BeamError(\"Missing data\") });\n }\n return \"\";\n }\n\n return html`\n <style>\n :host {\n ${this.cssVariables.toCSS()}\n }\n </style>\n <div style=\"display: flex; flex-direction: column;\" class=\"root\">\n <div\n style=\"margin: 10px 0 0 0;\"\n tabindex=\"-1\"\n class=\"options\"\n part=\"options\"\n aria-labelledby=\"beam-RedeemTransaction-title\"\n >\n ${this.renderCumulativeImpact(data)}\n </div>\n </div>\n `;\n }\n\n private renderCumulativeImpact(data: IAPIV3CumulativeImpact) {\n const rawValues = data.impacts ? data.impacts?.map((impact) => impact.value || 0) : [];\n const maxRawValue = Math.max(...rawValues);\n const durations = rawValues.map(\n (val) => (MAX_COUNTER_ANIMATION_DURATION * Math.log(Math.max(val, 1))) / Math.log(maxRawValue)\n );\n return html`\n <div class=\"main\">\n <div class=\"title\" role=\"heading\">\n ${localizeUserString(this.configLang, data?.config?.web?.title || \"\") ||\n strings[this.configLang].cumulativeImpactTitle()}\n </div>\n <p class=\"description\">\n ${localizeUserString(this.configLang, data?.config?.web?.description || \"\") ||\n strings[this.configLang].cumulativeImpactDescription()}\n </p>\n <div class=\"impact-list\">\n ${data.impacts?.map((impact: any, idx: number) => {\n return this.renderCumulativeImpactRow({ impact, animationDuration: durations[idx] });\n })}\n </div>\n </div>\n `;\n }\n\n private renderCumulativeImpactRow({ impact, animationDuration }: { impact: any; animationDuration: number }) {\n const disableAnimation = this.cumulativeImpactDataController.data?.config?.web.disableAnimation;\n const floatingCounterClass = \"impact-row-value-counter impact-row-value-floating-counter\";\n const duration = disableAnimation ? 0 : animationDuration;\n\n const unitDisplay = localizeUserString(this.configLang, impact.unit || \"\");\n const summaryDisplay = localizeUserString(this.configLang, impact.summary || \"\");\n\n /**\n * because we set the width using JavaScript by forcing all impact-row-value-container elements\n * to match the width of the widest sibling, we use a hidden span with the total preloaded to\n * ensure that impact-row-value-container widths do not change as the animation runs.\n */\n return html`\n <div class=\"impact-row\">\n <div class=\"impact-row-value-container\">\n <span class=\"impact-row-value-counter\" style=\"visibility: hidden;\" aria-hidden=\"true\">\n ${impact.value.toLocaleString()}\n </span>\n <animated-counter\n class=\"${floatingCounterClass}\"\n finalValue=${impact.value}\n duration=${duration}\n ></animated-counter>\n </span>\n </div>\n <div class=\"impact-row-description\">${unitDisplay} ${summaryDisplay}</div>\n </div>\n `;\n }\n\n public get cssVariables() {\n const defaults: Record<string, string> = {\n \"--beam-fontFamily\": \"inherit\",\n \"--beam-fontStyle\": \"inherit\",\n \"--beam-fontSize\": \"16px\",\n \"--beam-lineHeight\": \"1\",\n \"--beam-textColor\": \"inherit\",\n // main\n ...defineCustomText(\"--beam-CumulativeImpact-title\", {\n fontSize: \"32px\",\n }),\n ...defineCustomText(\"--beam-CumulativeImpact-description\", {\n marginTop: \"16px\",\n lineHeight: \"1.3\",\n }),\n \"--beam-CumulativeImpact-impact-list-marginTop\": \"24px\",\n \"--beam-CumulativeImpact-row-marginTop\": \"24px\",\n // row value container\n \"--beam-CumulativeImpact-row-value-container-borderBottomWidth\": \"4px\",\n \"--beam-CumulativeImpact-row-value-container-borderBottomColor\": \"currentColor\",\n \"--beam-CumulativeImpact-row-value-container-paddingTop\": \"0\",\n \"--beam-CumulativeImpact-row-value-container-paddingRight\": \"20px\",\n \"--beam-CumulativeImpact-row-value-container-paddingBottom\": \"4px\",\n \"--beam-CumulativeImpact-row-value-container-paddingLeft\": \"20px\",\n // row value counter\n ...defineCustomText(\"--beam-CumulativeImpact-row-value-counter\", {\n color: \"currentColor\",\n fontSize: \"24px\",\n fontWeight: \"normal\",\n }),\n // row description\n ...defineCustomText(\"--beam-CumulativeImpact-row-description\", {\n color: \"currentColor\",\n fontSize: \"16px\",\n fontWeight: \"normal\",\n lineHeight: \"1.3\",\n }),\n \"--beam-CumulativeImpact-row-description-paddingLeft\": \"24px\",\n \"--beam-CumulativeImpact-row-description-paddingRight\": \"24px\",\n \"--beam-CumulativeImpact-row-description-mobile-marginTop\": \"12px\",\n };\n\n const remoteConfig = this.cumulativeImpactDataController.data?.config?.web?.theme || {};\n\n const config = { ...defaults, ...remoteConfig };\n\n const serializable = Object.create({\n toCSS() {\n return _cssVariableMap(this as Record<string, string>);\n },\n });\n\n return Object.assign(serializable, config);\n }\n\n static styles = [\n cssReset,\n css`\n :host {\n display: block;\n font-family: var(--beam-fontFamily, inherit);\n font-style: var(--beam-fontStyle, inherit);\n font-size: var(--beam-fontSize, inherit);\n color: var(--beam-textColor, inherit);\n background-color: var(--beam-backgroundColor, inherit);\n line-height: var(--beam-lineHeight, 1);\n word-break: normal;\n }\n .main {\n text-align: left;\n }\n .title {\n ${useCustomText(\"--beam-CumulativeImpact-title\")}\n text-align: inherit;\n }\n .description {\n ${useCustomText(\"--beam-CumulativeImpact-description\")}\n text-align: inherit;\n }\n .impact-list {\n display: flex;\n flex-direction: column;\n margin-top: var(--beam-CumulativeImpact-impact-list-marginTop);\n }\n .impact-row {\n display: flex;\n align-items: center;\n margin-top: var(--beam-CumulativeImpact-row-marginTop);\n }\n .impact-row-value-container {\n position: relative;\n border-bottom-width: var(--beam-CumulativeImpact-row-value-container-borderBottomWidth);\n border-bottom-color: var(--beam-CumulativeImpact-row-value-container-borderBottomColor);\n border-bottom-style: solid;\n padding-top: var(--beam-CumulativeImpact-row-value-container-paddingTop);\n padding-right: var(--beam-CumulativeImpact-row-value-container-paddingRight);\n padding-bottom: var(--beam-CumulativeImpact-row-value-container-paddingBottom);\n padding-left: var(--beam-CumulativeImpact-row-value-container-paddingLeft);\n text-align: center;\n flex-shrink: 0;\n }\n .impact-row-value-counter {\n ${useCustomText(\"--beam-CumulativeImpact-row-value-counter\")}\n }\n .impact-row-value-floating-counter {\n position: absolute;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n }\n .impact-row-description {\n ${useCustomText(\"--beam-CumulativeImpact-row-description\")}\n padding-left: var(--beam-CumulativeImpact-row-description-paddingLeft);\n padding-right: var(--beam-CumulativeImpact-row-description-paddingRight);\n /* match padding of value of counter for proper centering */\n padding-bottom: var(--beam-CumulativeImpact-row-value-paddingBottom);\n text-align: inherit;\n flex-grow: 1;\n }\n @media (max-width: 500px) {\n .main {\n text-align: center;\n }\n .impact-row {\n flex-direction: column;\n }\n .impact-row-description {\n margin-top: var(--beam-CumulativeImpact-row-description-mobile-marginTop);\n padding-bottom: 0;\n }\n }\n `,\n ];\n}\n\ndefineCustomElement(BeamCumulativeImpact);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"beam-cumulative-impact\": BeamCumulativeImpact;\n }\n}\n"],"names":["AnimatedCounter","LitElement","entries","entry","MS_PER_FRAME","COUNTER_INCREMENT_PER_FRAME","result","target","userPrefersReducedMotion","html","__decorateClass","property","state","syncElementWidths","elements","els","isAllHtmlElements","widthSource","a","b","widthA","widthB","syncedWidth","el","strings","f","h","r","m","i","e","MAX_COUNTER_ANIMATION_DURATION","BeamCumulativeImpact","DEFAULT_BASE_URL","enforceConfig","getCumulativeImpact","AsyncController","debounce","SUPPORTED_LANGUAGES","changedProperties","requireNewDataProps","prop","data","error","loading","_loading","_errorMessage","BeamError","rawValues","impact","maxRawValue","durations","val","localizeUserString","idx","animationDuration","disableAnimation","floatingCounterClass","duration","unitDisplay","summaryDisplay","defaults","defineCustomText","remoteConfig","config","_cssVariableMap","cssReset","css","useCustomText","queryAll","defineCustomElement"],"mappings":"8wBAIaA,UAAwBC,CAAW,CAAzC,aAAA,CAAA,MAAA,GAAA,SAAA,EACuB,KAAa,WAAA,EACb,KAAW,SAAA,KAG9B,KAAU,QAAU,EAC7B,KAAQ,WAAa,EAkBrB,KAAQ,6BAA8DC,GAAY,CAC5EA,EAAQ,KAAMC,GAAUA,EAAM,cAAc,IAC9C,KAAK,eAAe,EACpB,KAAK,sBAAA,EAET,EAEA,KAAQ,eAAiB,IAAM,CAE7B,MAAMC,EAAe,mBAEfC,EAD2BD,EAAe,KAAK,SACU,KAAK,WAEpE,KAAK,WAAa,YAAY,IAAM,CAClC,MAAME,EAAS,KAAK,QAAUD,EAC9B,GAAIC,GAAU,KAAK,WAAY,CAC7B,KAAK,QAAU,KAAK,WACpB,cAAc,KAAK,UAAU,EAC7B,MACF,MACE,KAAK,QAAUA,CAEnB,EAAGF,CAAY,CACjB,EAEA,KAAQ,SAAW,IAAI,qBAAqB,KAAK,6BAA8B,CAC7E,UAAW,EACb,CAAC,EAED,KAAQ,oBAAsB,IAAM,CAClC,MAAMG,EAAS,KAAK,oBACpBA,GAAU,KAAK,SAAS,QAAQA,CAAM,CACxC,EAEA,KAAQ,sBAAwB,IAAM,CACpC,MAAMA,EAAS,KAAK,oBACpBA,GAAU,KAAK,SAAS,UAAUA,CAAM,CAC1C,CArDA,CAAA,mBAAoB,CAClB,MAAM,oBACN,MAAMC,EAA2B,OAAO,WAAW,kCAAkC,EAAE,QACnF,KAAK,WAAa,GAAKA,EACzB,KAAK,QAAU,KAAK,WAEpB,KAAK,oBAAoB,CAE7B,CAEA,sBAAuB,CACrB,MAAM,qBAAqB,EAC3B,KAAK,sBACL,EAAA,cAAc,KAA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AOwB,uBAEAtB,EAAA,CAAlCC,EAAS,CAAE,KAAM,MAAO,CAAC,CAAA,EATfqB,EASwB,UAAA,OAAA,CAAA,EAECtB,EAAA,CAAnCC,EAAS,CAAE,KAAM,OAAQ,CAAC,CAAA,EAXhBqB,EAWyB,UAAA,mBAAA,CAAA,EAEAtB,EAAA,CAAnCC,EAAS,CAAE,KAAM,OAAQ,CAAC,CAbhB,EAAAqB,EAayB,UAEAtB,QAAAA,CAAAA,EAAAA,EAAA,CAAnCC,EAAS,CAAE,KAAM,OAAQ,CAAC,CAfhB,EAAAqB,EAeyB,UAkCpCtB,cAAAA,CAAAA,EAAAA,EAAA,CADC2D,EAAS,6BAA6B,GAhD5BrC,EAiDX,UAAA,gBAAA,CAAA,EAkQFsC,EAAoBtC,CAAoB"}
@@ -1,4 +1,4 @@
1
- import{t as y,h as b,y as u,g as c,f as C,p as I}from"../chunks/lit-3QHn3fwl.esm.js";import{d as x}from"../chunks/lodash-P8OIs-at.esm.js";import{c as T,d as S,e as E}from"../chunks/enforce-config-er6B5Gkj.esm.js";import{u as p,A as z,_ as f,i as d,d as v,a as B}from"../chunks/localize-SsJbTmMj.esm.js";import{D,l as k,S as L}from"../chunks/routes-L-CN-xXC.esm.js";import{B as $}from"../chunks/beam-errors-P-Lu07Ce.esm.js";import{_ as V}from"../chunks/loading-template-mLjOGXMj.esm.js";import{i as A}from"../chunks/is-all-html-elements-SdSkxirh.esm.js";import"../utils/logger.js";var j=Object.defineProperty,R=Object.getOwnPropertyDescriptor,h=(n,e,t,a)=>{for(var i=a>1?void 0:a?R(e,t):e,o=n.length-1,r;o>=0;o--)(r=n[o])&&(i=(a?r(e,t,i):r(i))||i);return a&&i&&j(e,t,i),i};class m extends b{constructor(){super(...arguments),this.finalValue=0,this.duration=1500,this.counter=0,this.intervalId=0,this.handleCounterAnimateIfInView=e=>{e.some(t=>t.isIntersecting)&&(this.animateCounter(),this.unobserveScrollTarget())},this.animateCounter=()=>{const e=41.666666666666664,t=e/this.duration*this.finalValue;this.intervalId=setInterval(()=>{const a=this.counter+t;if(a>=this.finalValue){this.counter=this.finalValue,clearInterval(this.intervalId);return}else this.counter=a},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([c({type:Number})],m.prototype,"finalValue",2),h([c({type:Number})],m.prototype,"duration",2),h([c({type:String})],m.prototype,"scrollTarget",2),h([y()],m.prototype,"counter",2),customElements.get("animated-counter")||customElements.define("animated-counter",m);const O=n=>{const e=n instanceof NodeList?Array.from(n):n;if(e.length===0||!A(e))return;const t=e.sort((i,o)=>{const r=getComputedStyle(i).getPropertyValue("width").replace("px",""),g=getComputedStyle(o).getPropertyValue("width").replace("px","");return parseInt(g)-parseInt(r)})[0],a=getComputedStyle(t).getPropertyValue("width");for(const i of e)getComputedStyle(i).getPropertyValue("width")!==a&&(i.style.width=a)},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 P=Object.defineProperty,q=Object.getOwnPropertyDescriptor,l=(n,e,t,a)=>{for(var i=a>1?void 0:a?q(e,t):e,o=n.length-1,r;o>=0;o--)(r=n[o])&&(i=(a?r(e,t,i):r(i))||i);return a&&i&&P(e,t,i),i};const U=1.5*1e3;class s extends b{constructor(){super(...arguments),this.baseUrl=D,this.lang="en",this.disableAnimation=!1,this.debug=!1,this.getCumulativeImpactData=async()=>(E(["apiKey","chainId"],this),await k({baseUrl:this.baseUrl,pathParams:{chainId:this.chainId},headers:{authorization:`Api-Key ${this.apiKey}`},queryParams:{version:"1.0.0",lang:this.configLang}})),this.cumulativeImpactDataController=new z(this,this.getCumulativeImpactData),this.resizeElements=x(()=>{O(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 a of t)if(e.has(a)){await this.cumulativeImpactDataController.exec();break}this.resizeElements()}render(){const{data:e,error:t,loading:a}=this.cumulativeImpactDataController;return a?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 c,f as y,p as I}from"../chunks/lit-iNN5L_Qk.esm.js";import{d as x}from"../chunks/lodash-P8OIs-at.esm.js";import{c as T,d as S,e as E}from"../chunks/enforce-config-ZyPq_4CF.esm.js";import{u as p,A as z,_ as f,i as d,d as v,a as B}from"../chunks/localize-m-_ESmpk.esm.js";import{D,l as k,S as L}from"../chunks/routes-FBB1GA4-.esm.js";import{B as $}from"../chunks/beam-errors-P-Lu07Ce.esm.js";import{_ as V}from"../chunks/loading-template-t4fFsYtr.esm.js";import{i as A}from"../chunks/is-all-html-elements-SdSkxirh.esm.js";import"../utils/logger.js";var j=Object.defineProperty,R=Object.getOwnPropertyDescriptor,h=(s,e,t,a)=>{for(var i=a>1?void 0:a?R(e,t):e,o=s.length-1,r;o>=0;o--)(r=s[o])&&(i=(a?r(e,t,i):r(i))||i);return a&&i&&j(e,t,i),i};class m extends b{constructor(){super(...arguments),this.finalValue=0,this.duration=1500,this.counter=0,this.intervalId=0,this.handleCounterAnimateIfInView=e=>{e.some(t=>t.isIntersecting)&&(this.animateCounter(),this.unobserveScrollTarget())},this.animateCounter=()=>{const e=41.666666666666664,t=e/this.duration*this.finalValue;this.intervalId=setInterval(()=>{const a=this.counter+t;if(a>=this.finalValue){this.counter=this.finalValue,clearInterval(this.intervalId);return}else this.counter=a},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([c({type:Number})],m.prototype,"finalValue",2),h([c({type:Number})],m.prototype,"duration",2),h([c({type:String})],m.prototype,"scrollTarget",2),h([C()],m.prototype,"counter",2),customElements.get("animated-counter")||customElements.define("animated-counter",m);const O=s=>{const e=s instanceof NodeList?Array.from(s):s;if(e.length===0||!A(e))return;const t=e.sort((i,o)=>{const r=getComputedStyle(i).getPropertyValue("width").replace("px",""),g=getComputedStyle(o).getPropertyValue("width").replace("px","");return parseInt(g)-parseInt(r)})[0],a=getComputedStyle(t).getPropertyValue("width");for(const i of e)getComputedStyle(i).getPropertyValue("width")!==a&&(i.style.width=a)},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 P=Object.defineProperty,q=Object.getOwnPropertyDescriptor,l=(s,e,t,a)=>{for(var i=a>1?void 0:a?q(e,t):e,o=s.length-1,r;o>=0;o--)(r=s[o])&&(i=(a?r(e,t,i):r(i))||i);return a&&i&&P(e,t,i),i};const U=1.5*1e3;class n extends b{constructor(){super(...arguments),this.baseUrl=D,this.lang="en",this.disableAnimation=!1,this.debug=!1,this.draftConfig=!1,this.getCumulativeImpactData=async()=>(E(["apiKey","chainId"],this),await k({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(()=>{O(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 a of t)if(e.has(a)){await this.cumulativeImpactDataController.exec();break}this.resizeElements()}render(){const{data:e,error:t,loading:a}=this.cumulativeImpactDataController;return a?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()}
@@ -42,7 +42,7 @@ import{t as y,h as b,y as u,g as c,f as C,p as I}from"../chunks/lit-3QHn3fwl.esm
42
42
  </div>
43
43
  <div class="impact-row-description">${r} ${g}</div>
44
44
  </div>
45
- `}get cssVariables(){const e={"--beam-fontFamily":"inherit","--beam-fontStyle":"inherit","--beam-fontSize":"16px","--beam-lineHeight":"1","--beam-textColor":"inherit",...v("--beam-CumulativeImpact-title",{fontSize:"32px"}),...v("--beam-CumulativeImpact-description",{marginTop:"16px",lineHeight:"1.3"}),"--beam-CumulativeImpact-impact-list-marginTop":"24px","--beam-CumulativeImpact-row-marginTop":"24px","--beam-CumulativeImpact-row-value-container-borderBottomWidth":"4px","--beam-CumulativeImpact-row-value-container-borderBottomColor":"currentColor","--beam-CumulativeImpact-row-value-container-paddingTop":"0","--beam-CumulativeImpact-row-value-container-paddingRight":"20px","--beam-CumulativeImpact-row-value-container-paddingBottom":"4px","--beam-CumulativeImpact-row-value-container-paddingLeft":"20px",...v("--beam-CumulativeImpact-row-value-counter",{color:"currentColor",fontSize:"24px",fontWeight:"normal"}),...v("--beam-CumulativeImpact-row-description",{color:"currentColor",fontSize:"16px",fontWeight:"normal",lineHeight:"1.3"}),"--beam-CumulativeImpact-row-description-paddingLeft":"24px","--beam-CumulativeImpact-row-description-paddingRight":"24px","--beam-CumulativeImpact-row-description-mobile-marginTop":"12px"},t=this.cumulativeImpactDataController.data?.config?.web?.theme||{},a={...e,...t};return Object.assign(Object.create({toCSS(){return B(this)}}),a)}}s.tagName="beam-cumulative-impact",s.styles=[T,C`
45
+ `}get cssVariables(){const e={"--beam-fontFamily":"inherit","--beam-fontStyle":"inherit","--beam-fontSize":"16px","--beam-lineHeight":"1","--beam-textColor":"inherit",...v("--beam-CumulativeImpact-title",{fontSize:"32px"}),...v("--beam-CumulativeImpact-description",{marginTop:"16px",lineHeight:"1.3"}),"--beam-CumulativeImpact-impact-list-marginTop":"24px","--beam-CumulativeImpact-row-marginTop":"24px","--beam-CumulativeImpact-row-value-container-borderBottomWidth":"4px","--beam-CumulativeImpact-row-value-container-borderBottomColor":"currentColor","--beam-CumulativeImpact-row-value-container-paddingTop":"0","--beam-CumulativeImpact-row-value-container-paddingRight":"20px","--beam-CumulativeImpact-row-value-container-paddingBottom":"4px","--beam-CumulativeImpact-row-value-container-paddingLeft":"20px",...v("--beam-CumulativeImpact-row-value-counter",{color:"currentColor",fontSize:"24px",fontWeight:"normal"}),...v("--beam-CumulativeImpact-row-description",{color:"currentColor",fontSize:"16px",fontWeight:"normal",lineHeight:"1.3"}),"--beam-CumulativeImpact-row-description-paddingLeft":"24px","--beam-CumulativeImpact-row-description-paddingRight":"24px","--beam-CumulativeImpact-row-description-mobile-marginTop":"12px"},t=this.cumulativeImpactDataController.data?.config?.web?.theme||{},a={...e,...t};return Object.assign(Object.create({toCSS(){return B(this)}}),a)}}n.tagName="beam-cumulative-impact",n.styles=[T,y`
46
46
  :host {
47
47
  display: block;
48
48
  font-family: var(--beam-fontFamily, inherit);
@@ -117,5 +117,5 @@ import{t as y,h as b,y as u,g as c,f as C,p as I}from"../chunks/lit-3QHn3fwl.esm
117
117
  padding-bottom: 0;
118
118
  }
119
119
  }
120
- `],l([c({type:String})],s.prototype,"apiKey",2),l([c({type:Number})],s.prototype,"chainId",2),l([c({type:String})],s.prototype,"baseUrl",2),l([c({type:String})],s.prototype,"lang",2),l([c({type:Boolean})],s.prototype,"disableAnimation",2),l([c({type:Boolean})],s.prototype,"debug",2),l([I(".impact-row-value-container")],s.prototype,"impactRowRefs",2),S(s);export{s as BeamCumulativeImpact};
120
+ `],l([c({type:String})],n.prototype,"apiKey",2),l([c({type:Number})],n.prototype,"chainId",2),l([c({type:String})],n.prototype,"baseUrl",2),l([c({type:String})],n.prototype,"lang",2),l([c({type:Boolean})],n.prototype,"disableAnimation",2),l([c({type:Boolean})],n.prototype,"debug",2),l([c({type:Boolean})],n.prototype,"draftConfig",2),l([I(".impact-row-value-container")],n.prototype,"impactRowRefs",2),S(n);export{n as BeamCumulativeImpact};
121
121
  //# sourceMappingURL=cumulative-impact.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cumulative-impact.js","sources":["../../src/shared/components/animated-counter/index.ts","../../src/shared/sync-element-widths.ts","../../src/components/cumulative-impact/strings.ts","../../src/components/cumulative-impact/index.ts"],"sourcesContent":["import { html, LitElement } from \"lit\";\nimport { property } from \"lit/decorators/property.js\";\nimport { state } from \"lit/decorators.js\";\n\nexport class AnimatedCounter extends LitElement {\n @property({ type: Number }) finalValue = 0;\n @property({ type: Number }) duration = 1500;\n @property({ type: String }) scrollTarget?: string;\n\n @state() protected counter = 0;\n private intervalId = 0;\n\n connectedCallback() {\n super.connectedCallback();\n const userPrefersReducedMotion = window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n if (this.duration === 0 || userPrefersReducedMotion) {\n this.counter = this.finalValue;\n } else {\n this.observeScrollTarget();\n }\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.unobserveScrollTarget();\n clearInterval(this.intervalId);\n }\n\n private handleCounterAnimateIfInView: IntersectionObserverCallback = (entries) => {\n if (entries.some((entry) => entry.isIntersecting)) {\n this.animateCounter();\n this.unobserveScrollTarget();\n }\n };\n\n private animateCounter = () => {\n const ANIMATION_FRAME_RATE = 24;\n const MS_PER_FRAME = 1000 / ANIMATION_FRAME_RATE;\n const INCREMENT_RATE_PER_FRAME = MS_PER_FRAME / this.duration;\n const COUNTER_INCREMENT_PER_FRAME = INCREMENT_RATE_PER_FRAME * this.finalValue;\n\n this.intervalId = setInterval(() => {\n const result = this.counter + COUNTER_INCREMENT_PER_FRAME;\n if (result >= this.finalValue) {\n this.counter = this.finalValue;\n clearInterval(this.intervalId);\n return;\n } else {\n this.counter = result;\n }\n }, MS_PER_FRAME);\n };\n\n private observer = new IntersectionObserver(this.handleCounterAnimateIfInView, {\n threshold: 0.1,\n });\n\n private observeScrollTarget = () => {\n const target = this.scrollTargetElement;\n target && this.observer.observe(target);\n };\n\n private unobserveScrollTarget = () => {\n const target = this.scrollTargetElement;\n target && this.observer.unobserve(target);\n };\n\n get scrollTargetElement(): this | Element | null {\n if (this.scrollTarget) {\n return document.querySelector(this.scrollTarget);\n } else {\n return this;\n }\n }\n\n render() {\n return html`${Math.ceil(this.counter).toLocaleString()}`;\n }\n}\n\ncustomElements.get(\"animated-counter\") || customElements.define(\"animated-counter\", AnimatedCounter);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"animated-counter\": AnimatedCounter;\n }\n}\n","import { isAllHtmlElements } from \"./is-all-html-elements\";\n\n/**\n * Synchronize widths of elements\n * @param {Array<HTMLElement|null>} elements - Elements to synchronize\n */\nexport const syncElementWidths = (elements: Array<HTMLElement | null> | NodeList) => {\n const els = elements instanceof NodeList ? Array.from(elements) : elements;\n\n if (els.length === 0 || !isAllHtmlElements(els)) {\n return;\n }\n\n const widthSource = els.sort((a, b) => {\n const widthA = getComputedStyle(a).getPropertyValue(\"width\").replace(\"px\", \"\");\n const widthB = getComputedStyle(b).getPropertyValue(\"width\").replace(\"px\", \"\");\n return parseInt(widthB) - parseInt(widthA);\n })[0];\n\n const syncedWidth = getComputedStyle(widthSource).getPropertyValue(\"width\");\n\n for (const el of els) {\n if (getComputedStyle(el).getPropertyValue(\"width\") !== syncedWidth) {\n el.style[\"width\"] = syncedWidth;\n }\n }\n};\n","export const strings = {\n en: {\n cumulativeImpactTitle: () => `What we've funded`,\n cumulativeImpactDescription: () =>\n \"Here's the impact that our community has made so far in partnership with Beam. Our impact is growing every day— scroll to check out the goals we're working toward together right now.\",\n },\n fr: {\n cumulativeImpactTitle: () => `Ce que nous avons financé`,\n cumulativeImpactDescription: () =>\n \"Voici l'impact que notre communauté a eu jusqu'à présent en partenariat avec Beam. Notre impact grandit chaque jour : faites défiler pour découvrir les objectifs vers lesquels nous travaillons ensemble en ce moment.\",\n },\n de: {\n cumulativeImpactTitle: () => `Was wir finanziert haben`,\n cumulativeImpactDescription: () =>\n \"Hier ist die Wirkung, die unsere Community bisher in Zusammenarbeit mit Beam erzielt hat. Unsere Wirkung wächst von Tag zu Tag - scrollen Sie, um einen Blick auf die Ziele zu werfen, auf die wir derzeit gemeinsam hinarbeiten.\",\n },\n es: {\n cumulativeImpactTitle: () => `Lo que hemos financiado`,\n cumulativeImpactDescription: () =>\n \"Este es el impacto que nuestra comunidad ha tenido hasta ahora en asociación con Beam. Nuestro impacto crece cada día; desplácese para ver los objetivos por los que estamos trabajando juntos en este momento.\",\n },\n it: {\n cumulativeImpactTitle: () => `Cosa abbiamo finanziato`,\n cumulativeImpactDescription: () =>\n \"Ecco l'impatto che la nostra comunità 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.\",\n },\n pl: {\n cumulativeImpactTitle: () => `Co sfinansowaliśmy`,\n cumulativeImpactDescription: () =>\n \"Oto wpływ, jaki nasza społeczność wywarła dotychczas we współpracy z Beam. Nasz wpływ rośnie z każdym dniem — przewiń, aby sprawdzić cele, nad którymi obecnie wspólnie pracujemy.\",\n },\n};\n","import { css, html, LitElement } from \"lit\";\nimport { property } from \"lit/decorators/property.js\";\nimport { queryAll } from \"lit/decorators/query-all.js\";\nimport debounce from \"lodash-es/debounce\";\nimport \"../../shared/components/animated-counter\";\nimport { cssReset } from \"../../shared/css-reset\";\nimport { defineCustomElement } from \"../../shared/defineCustomElement\";\nimport { _cssVariableMap } from \"../../shared/fragments/css-variable-map\";\nimport { DEFAULT_BASE_URL, SUPPORTED_LANGUAGES } from \"../../api-sdk/constants\";\nimport { TNumericId } from \"../../shared/types\";\nimport { LANGUAGES } from \"../../api-sdk/types\";\nimport { getCumulativeImpact } from \"../../api-sdk/v3/routes\";\nimport { enforceConfig } from \"../../shared/enforce-config\";\nimport { BeamError, MissingConfig } from \"../../utils/beam-errors\";\nimport { AsyncController } from \"../../shared/controllers/async-controller\";\nimport { _errorMessage } from \"../../shared/fragments/error-message-template\";\nimport { _loading } from \"../../shared/fragments/loading-template\";\nimport { syncElementWidths } from \"../../shared/sync-element-widths\";\nimport { localizeUserString } from \"../../shared/localize\";\nimport { defineCustomText, useCustomText } from \"../../shared/fragments/custom-text\";\nimport { strings } from \"./strings\";\n\ntype RequiredConfig = {\n apiKey: string;\n chainId: TNumericId;\n};\n\ntype IAPIV3CumulativeImpact = Awaited<ReturnType<typeof getCumulativeImpact>>;\n\nconst MAX_COUNTER_ANIMATION_DURATION = 1.5 * 1000;\n\nexport class BeamCumulativeImpact extends LitElement {\n static tagName = \"beam-cumulative-impact\";\n\n @property({ type: String }) public apiKey?: RequiredConfig[\"apiKey\"];\n\n @property({ type: Number }) public chainId?: RequiredConfig[\"chainId\"];\n\n @property({ type: String }) public baseUrl = DEFAULT_BASE_URL;\n\n @property({ type: String }) public lang: LANGUAGES = \"en\";\n\n @property({ type: Boolean }) public disableAnimation = false;\n\n @property({ type: Boolean }) public debug = false;\n\n get configLang() {\n return SUPPORTED_LANGUAGES[this.lang] || \"en\";\n }\n\n private getCumulativeImpactData = async () => {\n if (!enforceConfig<RequiredConfig>([\"apiKey\", \"chainId\"], this)) {\n throw new MissingConfig();\n }\n const res = await getCumulativeImpact({\n baseUrl: this.baseUrl,\n pathParams: {\n chainId: this.chainId,\n },\n headers: {\n authorization: `Api-Key ${this.apiKey}`,\n },\n queryParams: {\n version: \"1.0.0\",\n lang: this.configLang,\n },\n });\n\n return res;\n };\n\n private cumulativeImpactDataController = new AsyncController<typeof this.getCumulativeImpactData>(\n this,\n this.getCumulativeImpactData\n );\n\n @queryAll(\".impact-row-value-container\")\n impactRowRefs!: HTMLElement[];\n resizeElements = debounce(\n () => {\n syncElementWidths(this.impactRowRefs);\n },\n 50,\n { maxWait: 50, leading: true }\n );\n\n connectedCallback() {\n super.connectedCallback();\n window.addEventListener(\"resize\", this.resizeElements);\n }\n\n async updated(changedProperties: Map<string, unknown>) {\n // Reload nonprofit list on change of any of these props:\n // Also fires on first load as props go from undefined => value\n const requireNewDataProps = [\"chainId\", \"baseUrl\", \"lang\"];\n for (const prop of requireNewDataProps) {\n if (changedProperties.has(prop)) {\n await this.cumulativeImpactDataController.exec();\n break;\n }\n }\n\n this.resizeElements();\n }\n\n render() {\n const { data, error, loading } = this.cumulativeImpactDataController;\n if (loading) {\n return _loading();\n }\n if (error) {\n if (this.debug) {\n return _errorMessage({ error });\n }\n return \"\";\n }\n if (data == null) {\n if (this.debug) {\n return _errorMessage({ error: new BeamError(\"Missing data\") });\n }\n return \"\";\n }\n\n return html`\n <style>\n :host {\n ${this.cssVariables.toCSS()}\n }\n </style>\n <div style=\"display: flex; flex-direction: column;\" class=\"root\">\n <div\n style=\"margin: 10px 0 0 0;\"\n tabindex=\"-1\"\n class=\"options\"\n part=\"options\"\n aria-labelledby=\"beam-RedeemTransaction-title\"\n >\n ${this.renderCumulativeImpact(data)}\n </div>\n </div>\n `;\n }\n\n private renderCumulativeImpact(data: IAPIV3CumulativeImpact) {\n const rawValues = data.impacts ? data.impacts?.map((impact) => impact.value || 0) : [];\n const maxRawValue = Math.max(...rawValues);\n const durations = rawValues.map(\n (val) => (MAX_COUNTER_ANIMATION_DURATION * Math.log(Math.max(val, 1))) / Math.log(maxRawValue)\n );\n return html`\n <div class=\"main\">\n <div class=\"title\" role=\"heading\">\n ${localizeUserString(this.configLang, data?.config?.web?.title || \"\") ||\n strings[this.configLang].cumulativeImpactTitle()}\n </div>\n <p class=\"description\">\n ${localizeUserString(this.configLang, data?.config?.web?.description || \"\") ||\n strings[this.configLang].cumulativeImpactDescription()}\n </p>\n <div class=\"impact-list\">\n ${data.impacts?.map((impact: any, idx: number) => {\n return this.renderCumulativeImpactRow({ impact, animationDuration: durations[idx] });\n })}\n </div>\n </div>\n `;\n }\n\n private renderCumulativeImpactRow({ impact, animationDuration }: { impact: any; animationDuration: number }) {\n const disableAnimation = this.cumulativeImpactDataController.data?.config?.web.disableAnimation;\n const floatingCounterClass = \"impact-row-value-counter impact-row-value-floating-counter\";\n const duration = disableAnimation ? 0 : animationDuration;\n\n const unitDisplay = localizeUserString(this.configLang, impact.unit || \"\");\n const summaryDisplay = localizeUserString(this.configLang, impact.summary || \"\");\n\n /**\n * because we set the width using JavaScript by forcing all impact-row-value-container elements\n * to match the width of the widest sibling, we use a hidden span with the total preloaded to\n * ensure that impact-row-value-container widths do not change as the animation runs.\n */\n return html`\n <div class=\"impact-row\">\n <div class=\"impact-row-value-container\">\n <span class=\"impact-row-value-counter\" style=\"visibility: hidden;\" aria-hidden=\"true\">\n ${impact.value.toLocaleString()}\n </span>\n <animated-counter\n class=\"${floatingCounterClass}\"\n finalValue=${impact.value}\n duration=${duration}\n ></animated-counter>\n </span>\n </div>\n <div class=\"impact-row-description\">${unitDisplay} ${summaryDisplay}</div>\n </div>\n `;\n }\n\n public get cssVariables() {\n const defaults: Record<string, string> = {\n \"--beam-fontFamily\": \"inherit\",\n \"--beam-fontStyle\": \"inherit\",\n \"--beam-fontSize\": \"16px\",\n \"--beam-lineHeight\": \"1\",\n \"--beam-textColor\": \"inherit\",\n // main\n ...defineCustomText(\"--beam-CumulativeImpact-title\", {\n fontSize: \"32px\",\n }),\n ...defineCustomText(\"--beam-CumulativeImpact-description\", {\n marginTop: \"16px\",\n lineHeight: \"1.3\",\n }),\n \"--beam-CumulativeImpact-impact-list-marginTop\": \"24px\",\n \"--beam-CumulativeImpact-row-marginTop\": \"24px\",\n // row value container\n \"--beam-CumulativeImpact-row-value-container-borderBottomWidth\": \"4px\",\n \"--beam-CumulativeImpact-row-value-container-borderBottomColor\": \"currentColor\",\n \"--beam-CumulativeImpact-row-value-container-paddingTop\": \"0\",\n \"--beam-CumulativeImpact-row-value-container-paddingRight\": \"20px\",\n \"--beam-CumulativeImpact-row-value-container-paddingBottom\": \"4px\",\n \"--beam-CumulativeImpact-row-value-container-paddingLeft\": \"20px\",\n // row value counter\n ...defineCustomText(\"--beam-CumulativeImpact-row-value-counter\", {\n color: \"currentColor\",\n fontSize: \"24px\",\n fontWeight: \"normal\",\n }),\n // row description\n ...defineCustomText(\"--beam-CumulativeImpact-row-description\", {\n color: \"currentColor\",\n fontSize: \"16px\",\n fontWeight: \"normal\",\n lineHeight: \"1.3\",\n }),\n \"--beam-CumulativeImpact-row-description-paddingLeft\": \"24px\",\n \"--beam-CumulativeImpact-row-description-paddingRight\": \"24px\",\n \"--beam-CumulativeImpact-row-description-mobile-marginTop\": \"12px\",\n };\n\n const remoteConfig = this.cumulativeImpactDataController.data?.config?.web?.theme || {};\n\n const config = { ...defaults, ...remoteConfig };\n\n const serializable = Object.create({\n toCSS() {\n return _cssVariableMap(this as Record<string, string>);\n },\n });\n\n return Object.assign(serializable, config);\n }\n\n static styles = [\n cssReset,\n css`\n :host {\n display: block;\n font-family: var(--beam-fontFamily, inherit);\n font-style: var(--beam-fontStyle, inherit);\n font-size: var(--beam-fontSize, inherit);\n color: var(--beam-textColor, inherit);\n background-color: var(--beam-backgroundColor, inherit);\n line-height: var(--beam-lineHeight, 1);\n word-break: normal;\n }\n .main {\n text-align: left;\n }\n .title {\n ${useCustomText(\"--beam-CumulativeImpact-title\")}\n text-align: inherit;\n }\n .description {\n ${useCustomText(\"--beam-CumulativeImpact-description\")}\n text-align: inherit;\n }\n .impact-list {\n display: flex;\n flex-direction: column;\n margin-top: var(--beam-CumulativeImpact-impact-list-marginTop);\n }\n .impact-row {\n display: flex;\n align-items: center;\n margin-top: var(--beam-CumulativeImpact-row-marginTop);\n }\n .impact-row-value-container {\n position: relative;\n border-bottom-width: var(--beam-CumulativeImpact-row-value-container-borderBottomWidth);\n border-bottom-color: var(--beam-CumulativeImpact-row-value-container-borderBottomColor);\n border-bottom-style: solid;\n padding-top: var(--beam-CumulativeImpact-row-value-container-paddingTop);\n padding-right: var(--beam-CumulativeImpact-row-value-container-paddingRight);\n padding-bottom: var(--beam-CumulativeImpact-row-value-container-paddingBottom);\n padding-left: var(--beam-CumulativeImpact-row-value-container-paddingLeft);\n text-align: center;\n flex-shrink: 0;\n }\n .impact-row-value-counter {\n ${useCustomText(\"--beam-CumulativeImpact-row-value-counter\")}\n }\n .impact-row-value-floating-counter {\n position: absolute;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n }\n .impact-row-description {\n ${useCustomText(\"--beam-CumulativeImpact-row-description\")}\n padding-left: var(--beam-CumulativeImpact-row-description-paddingLeft);\n padding-right: var(--beam-CumulativeImpact-row-description-paddingRight);\n /* match padding of value of counter for proper centering */\n padding-bottom: var(--beam-CumulativeImpact-row-value-paddingBottom);\n text-align: inherit;\n flex-grow: 1;\n }\n @media (max-width: 500px) {\n .main {\n text-align: center;\n }\n .impact-row {\n flex-direction: column;\n }\n .impact-row-description {\n margin-top: var(--beam-CumulativeImpact-row-description-mobile-marginTop);\n padding-bottom: 0;\n }\n }\n `,\n ];\n}\n\ndefineCustomElement(BeamCumulativeImpact);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"beam-cumulative-impact\": BeamCumulativeImpact;\n }\n}\n"],"names":["AnimatedCounter","LitElement","entries","entry","MS_PER_FRAME","COUNTER_INCREMENT_PER_FRAME","result","target","userPrefersReducedMotion","html","__decorateClass","property","state","syncElementWidths","elements","els","isAllHtmlElements","widthSource","a","b","widthA","widthB","syncedWidth","el","strings","f","h","o","s","m","i","e","r","MAX_COUNTER_ANIMATION_DURATION","BeamCumulativeImpact","DEFAULT_BASE_URL","enforceConfig","getCumulativeImpact","AsyncController","debounce","SUPPORTED_LANGUAGES","changedProperties","requireNewDataProps","prop","data","error","loading","_loading","_errorMessage","BeamError","rawValues","impact","maxRawValue","durations","val","localizeUserString","idx","animationDuration","disableAnimation","floatingCounterClass","duration","unitDisplay","summaryDisplay","defaults","defineCustomText","remoteConfig","config","_cssVariableMap","cssReset","css","useCustomText","queryAll","defineCustomElement"],"mappings":"0wBAIaA,UAAwBC,CAAW,CAAzC,aAAA,CAAA,MAAA,GAAA,SAAA,EACuB,KAAa,WAAA,EACb,KAAW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AQ,CAAC,GAbhBuB,EAayB,UAAA,QAAA,CAAA,EAiCpCxB,EAAA,CADC6D,EAAS,6BAA6B,CAAA,EA7C5BrC,EA8CX,UAAA,gBAAA,CAAA,EAkQFsC,EAAoBtC,CAAoB"}
1
+ {"version":3,"file":"cumulative-impact.js","sources":["../../src/shared/components/animated-counter/index.ts","../../src/shared/sync-element-widths.ts","../../src/components/cumulative-impact/strings.ts","../../src/components/cumulative-impact/index.ts"],"sourcesContent":["import { html, LitElement } from \"lit\";\nimport { property } from \"lit/decorators/property.js\";\nimport { state } from \"lit/decorators.js\";\n\nexport class AnimatedCounter extends LitElement {\n @property({ type: Number }) finalValue = 0;\n @property({ type: Number }) duration = 1500;\n @property({ type: String }) scrollTarget?: string;\n\n @state() protected counter = 0;\n private intervalId = 0;\n\n connectedCallback() {\n super.connectedCallback();\n const userPrefersReducedMotion = window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n if (this.duration === 0 || userPrefersReducedMotion) {\n this.counter = this.finalValue;\n } else {\n this.observeScrollTarget();\n }\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.unobserveScrollTarget();\n clearInterval(this.intervalId);\n }\n\n private handleCounterAnimateIfInView: IntersectionObserverCallback = (entries) => {\n if (entries.some((entry) => entry.isIntersecting)) {\n this.animateCounter();\n this.unobserveScrollTarget();\n }\n };\n\n private animateCounter = () => {\n const ANIMATION_FRAME_RATE = 24;\n const MS_PER_FRAME = 1000 / ANIMATION_FRAME_RATE;\n const INCREMENT_RATE_PER_FRAME = MS_PER_FRAME / this.duration;\n const COUNTER_INCREMENT_PER_FRAME = INCREMENT_RATE_PER_FRAME * this.finalValue;\n\n this.intervalId = setInterval(() => {\n const result = this.counter + COUNTER_INCREMENT_PER_FRAME;\n if (result >= this.finalValue) {\n this.counter = this.finalValue;\n clearInterval(this.intervalId);\n return;\n } else {\n this.counter = result;\n }\n }, MS_PER_FRAME);\n };\n\n private observer = new IntersectionObserver(this.handleCounterAnimateIfInView, {\n threshold: 0.1,\n });\n\n private observeScrollTarget = () => {\n const target = this.scrollTargetElement;\n target && this.observer.observe(target);\n };\n\n private unobserveScrollTarget = () => {\n const target = this.scrollTargetElement;\n target && this.observer.unobserve(target);\n };\n\n get scrollTargetElement(): this | Element | null {\n if (this.scrollTarget) {\n return document.querySelector(this.scrollTarget);\n } else {\n return this;\n }\n }\n\n render() {\n return html`${Math.ceil(this.counter).toLocaleString()}`;\n }\n}\n\ncustomElements.get(\"animated-counter\") || customElements.define(\"animated-counter\", AnimatedCounter);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"animated-counter\": AnimatedCounter;\n }\n}\n","import { isAllHtmlElements } from \"./is-all-html-elements\";\n\n/**\n * Synchronize widths of elements\n * @param {Array<HTMLElement|null>} elements - Elements to synchronize\n */\nexport const syncElementWidths = (elements: Array<HTMLElement | null> | NodeList) => {\n const els = elements instanceof NodeList ? Array.from(elements) : elements;\n\n if (els.length === 0 || !isAllHtmlElements(els)) {\n return;\n }\n\n const widthSource = els.sort((a, b) => {\n const widthA = getComputedStyle(a).getPropertyValue(\"width\").replace(\"px\", \"\");\n const widthB = getComputedStyle(b).getPropertyValue(\"width\").replace(\"px\", \"\");\n return parseInt(widthB) - parseInt(widthA);\n })[0];\n\n const syncedWidth = getComputedStyle(widthSource).getPropertyValue(\"width\");\n\n for (const el of els) {\n if (getComputedStyle(el).getPropertyValue(\"width\") !== syncedWidth) {\n el.style[\"width\"] = syncedWidth;\n }\n }\n};\n","export const strings = {\n en: {\n cumulativeImpactTitle: () => `What we've funded`,\n cumulativeImpactDescription: () =>\n \"Here's the impact that our community has made so far in partnership with Beam. Our impact is growing every day— scroll to check out the goals we're working toward together right now.\",\n },\n fr: {\n cumulativeImpactTitle: () => `Ce que nous avons financé`,\n cumulativeImpactDescription: () =>\n \"Voici l'impact que notre communauté a eu jusqu'à présent en partenariat avec Beam. Notre impact grandit chaque jour : faites défiler pour découvrir les objectifs vers lesquels nous travaillons ensemble en ce moment.\",\n },\n de: {\n cumulativeImpactTitle: () => `Was wir finanziert haben`,\n cumulativeImpactDescription: () =>\n \"Hier ist die Wirkung, die unsere Community bisher in Zusammenarbeit mit Beam erzielt hat. Unsere Wirkung wächst von Tag zu Tag - scrollen Sie, um einen Blick auf die Ziele zu werfen, auf die wir derzeit gemeinsam hinarbeiten.\",\n },\n es: {\n cumulativeImpactTitle: () => `Lo que hemos financiado`,\n cumulativeImpactDescription: () =>\n \"Este es el impacto que nuestra comunidad ha tenido hasta ahora en asociación con Beam. Nuestro impacto crece cada día; desplácese para ver los objetivos por los que estamos trabajando juntos en este momento.\",\n },\n it: {\n cumulativeImpactTitle: () => `Cosa abbiamo finanziato`,\n cumulativeImpactDescription: () =>\n \"Ecco l'impatto che la nostra comunità 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.\",\n },\n pl: {\n cumulativeImpactTitle: () => `Co sfinansowaliśmy`,\n cumulativeImpactDescription: () =>\n \"Oto wpływ, jaki nasza społeczność wywarła dotychczas we współpracy z Beam. Nasz wpływ rośnie z każdym dniem — przewiń, aby sprawdzić cele, nad którymi obecnie wspólnie pracujemy.\",\n },\n};\n","import { css, html, LitElement } from \"lit\";\nimport { property } from \"lit/decorators/property.js\";\nimport { queryAll } from \"lit/decorators/query-all.js\";\nimport debounce from \"lodash-es/debounce\";\nimport \"../../shared/components/animated-counter\";\nimport { cssReset } from \"../../shared/css-reset\";\nimport { defineCustomElement } from \"../../shared/defineCustomElement\";\nimport { _cssVariableMap } from \"../../shared/fragments/css-variable-map\";\nimport { DEFAULT_BASE_URL, SUPPORTED_LANGUAGES } from \"../../api-sdk/constants\";\nimport { TNumericId } from \"../../shared/types\";\nimport { LANGUAGES } from \"../../api-sdk/types\";\nimport { getCumulativeImpact } from \"../../api-sdk/v3/routes\";\nimport { enforceConfig } from \"../../shared/enforce-config\";\nimport { BeamError, MissingConfig } from \"../../utils/beam-errors\";\nimport { AsyncController } from \"../../shared/controllers/async-controller\";\nimport { _errorMessage } from \"../../shared/fragments/error-message-template\";\nimport { _loading } from \"../../shared/fragments/loading-template\";\nimport { syncElementWidths } from \"../../shared/sync-element-widths\";\nimport { localizeUserString } from \"../../shared/localize\";\nimport { defineCustomText, useCustomText } from \"../../shared/fragments/custom-text\";\nimport { strings } from \"./strings\";\n\ntype RequiredConfig = {\n apiKey: string;\n chainId: TNumericId;\n};\n\ntype IAPIV3CumulativeImpact = Awaited<ReturnType<typeof getCumulativeImpact>>;\n\nconst MAX_COUNTER_ANIMATION_DURATION = 1.5 * 1000;\n\nexport class BeamCumulativeImpact extends LitElement {\n static tagName = \"beam-cumulative-impact\";\n\n @property({ type: String }) public apiKey?: RequiredConfig[\"apiKey\"];\n\n @property({ type: Number }) public chainId?: RequiredConfig[\"chainId\"];\n\n @property({ type: String }) public baseUrl = DEFAULT_BASE_URL;\n\n @property({ type: String }) public lang: LANGUAGES = \"en\";\n\n @property({ type: Boolean }) public disableAnimation = false;\n\n @property({ type: Boolean }) public debug = false;\n\n @property({ type: Boolean }) public draftConfig = false;\n\n get configLang() {\n return SUPPORTED_LANGUAGES[this.lang] || \"en\";\n }\n\n private getCumulativeImpactData = async () => {\n if (!enforceConfig<RequiredConfig>([\"apiKey\", \"chainId\"], this)) {\n throw new MissingConfig();\n }\n const res = await getCumulativeImpact({\n baseUrl: this.baseUrl,\n pathParams: {\n chainId: this.chainId,\n },\n headers: {\n authorization: `Api-Key ${this.apiKey}`,\n },\n queryParams: {\n version: \"1.0.0\",\n lang: this.configLang,\n draftConfig: this.draftConfig,\n },\n });\n\n return res;\n };\n\n private cumulativeImpactDataController = new AsyncController<typeof this.getCumulativeImpactData>(\n this,\n this.getCumulativeImpactData\n );\n\n @queryAll(\".impact-row-value-container\")\n impactRowRefs!: HTMLElement[];\n resizeElements = debounce(\n () => {\n syncElementWidths(this.impactRowRefs);\n },\n 50,\n { maxWait: 50, leading: true }\n );\n\n connectedCallback() {\n super.connectedCallback();\n window.addEventListener(\"resize\", this.resizeElements);\n }\n\n async updated(changedProperties: Map<string, unknown>) {\n // Reload nonprofit list on change of any of these props:\n // Also fires on first load as props go from undefined => value\n const requireNewDataProps = [\"chainId\", \"baseUrl\", \"lang\"];\n for (const prop of requireNewDataProps) {\n if (changedProperties.has(prop)) {\n await this.cumulativeImpactDataController.exec();\n break;\n }\n }\n\n this.resizeElements();\n }\n\n render() {\n const { data, error, loading } = this.cumulativeImpactDataController;\n if (loading) {\n return _loading();\n }\n if (error) {\n if (this.debug) {\n return _errorMessage({ error });\n }\n return \"\";\n }\n if (data == null) {\n if (this.debug) {\n return _errorMessage({ error: new BeamError(\"Missing data\") });\n }\n return \"\";\n }\n\n return html`\n <style>\n :host {\n ${this.cssVariables.toCSS()}\n }\n </style>\n <div style=\"display: flex; flex-direction: column;\" class=\"root\">\n <div\n style=\"margin: 10px 0 0 0;\"\n tabindex=\"-1\"\n class=\"options\"\n part=\"options\"\n aria-labelledby=\"beam-RedeemTransaction-title\"\n >\n ${this.renderCumulativeImpact(data)}\n </div>\n </div>\n `;\n }\n\n private renderCumulativeImpact(data: IAPIV3CumulativeImpact) {\n const rawValues = data.impacts ? data.impacts?.map((impact) => impact.value || 0) : [];\n const maxRawValue = Math.max(...rawValues);\n const durations = rawValues.map(\n (val) => (MAX_COUNTER_ANIMATION_DURATION * Math.log(Math.max(val, 1))) / Math.log(maxRawValue)\n );\n return html`\n <div class=\"main\">\n <div class=\"title\" role=\"heading\">\n ${localizeUserString(this.configLang, data?.config?.web?.title || \"\") ||\n strings[this.configLang].cumulativeImpactTitle()}\n </div>\n <p class=\"description\">\n ${localizeUserString(this.configLang, data?.config?.web?.description || \"\") ||\n strings[this.configLang].cumulativeImpactDescription()}\n </p>\n <div class=\"impact-list\">\n ${data.impacts?.map((impact: any, idx: number) => {\n return this.renderCumulativeImpactRow({ impact, animationDuration: durations[idx] });\n })}\n </div>\n </div>\n `;\n }\n\n private renderCumulativeImpactRow({ impact, animationDuration }: { impact: any; animationDuration: number }) {\n const disableAnimation = this.cumulativeImpactDataController.data?.config?.web.disableAnimation;\n const floatingCounterClass = \"impact-row-value-counter impact-row-value-floating-counter\";\n const duration = disableAnimation ? 0 : animationDuration;\n\n const unitDisplay = localizeUserString(this.configLang, impact.unit || \"\");\n const summaryDisplay = localizeUserString(this.configLang, impact.summary || \"\");\n\n /**\n * because we set the width using JavaScript by forcing all impact-row-value-container elements\n * to match the width of the widest sibling, we use a hidden span with the total preloaded to\n * ensure that impact-row-value-container widths do not change as the animation runs.\n */\n return html`\n <div class=\"impact-row\">\n <div class=\"impact-row-value-container\">\n <span class=\"impact-row-value-counter\" style=\"visibility: hidden;\" aria-hidden=\"true\">\n ${impact.value.toLocaleString()}\n </span>\n <animated-counter\n class=\"${floatingCounterClass}\"\n finalValue=${impact.value}\n duration=${duration}\n ></animated-counter>\n </span>\n </div>\n <div class=\"impact-row-description\">${unitDisplay} ${summaryDisplay}</div>\n </div>\n `;\n }\n\n public get cssVariables() {\n const defaults: Record<string, string> = {\n \"--beam-fontFamily\": \"inherit\",\n \"--beam-fontStyle\": \"inherit\",\n \"--beam-fontSize\": \"16px\",\n \"--beam-lineHeight\": \"1\",\n \"--beam-textColor\": \"inherit\",\n // main\n ...defineCustomText(\"--beam-CumulativeImpact-title\", {\n fontSize: \"32px\",\n }),\n ...defineCustomText(\"--beam-CumulativeImpact-description\", {\n marginTop: \"16px\",\n lineHeight: \"1.3\",\n }),\n \"--beam-CumulativeImpact-impact-list-marginTop\": \"24px\",\n \"--beam-CumulativeImpact-row-marginTop\": \"24px\",\n // row value container\n \"--beam-CumulativeImpact-row-value-container-borderBottomWidth\": \"4px\",\n \"--beam-CumulativeImpact-row-value-container-borderBottomColor\": \"currentColor\",\n \"--beam-CumulativeImpact-row-value-container-paddingTop\": \"0\",\n \"--beam-CumulativeImpact-row-value-container-paddingRight\": \"20px\",\n \"--beam-CumulativeImpact-row-value-container-paddingBottom\": \"4px\",\n \"--beam-CumulativeImpact-row-value-container-paddingLeft\": \"20px\",\n // row value counter\n ...defineCustomText(\"--beam-CumulativeImpact-row-value-counter\", {\n color: \"currentColor\",\n fontSize: \"24px\",\n fontWeight: \"normal\",\n }),\n // row description\n ...defineCustomText(\"--beam-CumulativeImpact-row-description\", {\n color: \"currentColor\",\n fontSize: \"16px\",\n fontWeight: \"normal\",\n lineHeight: \"1.3\",\n }),\n \"--beam-CumulativeImpact-row-description-paddingLeft\": \"24px\",\n \"--beam-CumulativeImpact-row-description-paddingRight\": \"24px\",\n \"--beam-CumulativeImpact-row-description-mobile-marginTop\": \"12px\",\n };\n\n const remoteConfig = this.cumulativeImpactDataController.data?.config?.web?.theme || {};\n\n const config = { ...defaults, ...remoteConfig };\n\n const serializable = Object.create({\n toCSS() {\n return _cssVariableMap(this as Record<string, string>);\n },\n });\n\n return Object.assign(serializable, config);\n }\n\n static styles = [\n cssReset,\n css`\n :host {\n display: block;\n font-family: var(--beam-fontFamily, inherit);\n font-style: var(--beam-fontStyle, inherit);\n font-size: var(--beam-fontSize, inherit);\n color: var(--beam-textColor, inherit);\n background-color: var(--beam-backgroundColor, inherit);\n line-height: var(--beam-lineHeight, 1);\n word-break: normal;\n }\n .main {\n text-align: left;\n }\n .title {\n ${useCustomText(\"--beam-CumulativeImpact-title\")}\n text-align: inherit;\n }\n .description {\n ${useCustomText(\"--beam-CumulativeImpact-description\")}\n text-align: inherit;\n }\n .impact-list {\n display: flex;\n flex-direction: column;\n margin-top: var(--beam-CumulativeImpact-impact-list-marginTop);\n }\n .impact-row {\n display: flex;\n align-items: center;\n margin-top: var(--beam-CumulativeImpact-row-marginTop);\n }\n .impact-row-value-container {\n position: relative;\n border-bottom-width: var(--beam-CumulativeImpact-row-value-container-borderBottomWidth);\n border-bottom-color: var(--beam-CumulativeImpact-row-value-container-borderBottomColor);\n border-bottom-style: solid;\n padding-top: var(--beam-CumulativeImpact-row-value-container-paddingTop);\n padding-right: var(--beam-CumulativeImpact-row-value-container-paddingRight);\n padding-bottom: var(--beam-CumulativeImpact-row-value-container-paddingBottom);\n padding-left: var(--beam-CumulativeImpact-row-value-container-paddingLeft);\n text-align: center;\n flex-shrink: 0;\n }\n .impact-row-value-counter {\n ${useCustomText(\"--beam-CumulativeImpact-row-value-counter\")}\n }\n .impact-row-value-floating-counter {\n position: absolute;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n }\n .impact-row-description {\n ${useCustomText(\"--beam-CumulativeImpact-row-description\")}\n padding-left: var(--beam-CumulativeImpact-row-description-paddingLeft);\n padding-right: var(--beam-CumulativeImpact-row-description-paddingRight);\n /* match padding of value of counter for proper centering */\n padding-bottom: var(--beam-CumulativeImpact-row-value-paddingBottom);\n text-align: inherit;\n flex-grow: 1;\n }\n @media (max-width: 500px) {\n .main {\n text-align: center;\n }\n .impact-row {\n flex-direction: column;\n }\n .impact-row-description {\n margin-top: var(--beam-CumulativeImpact-row-description-mobile-marginTop);\n padding-bottom: 0;\n }\n }\n `,\n ];\n}\n\ndefineCustomElement(BeamCumulativeImpact);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"beam-cumulative-impact\": BeamCumulativeImpact;\n }\n}\n"],"names":["AnimatedCounter","LitElement","entries","entry","MS_PER_FRAME","COUNTER_INCREMENT_PER_FRAME","result","target","userPrefersReducedMotion","html","__decorateClass","property","state","syncElementWidths","elements","els","isAllHtmlElements","widthSource","a","b","widthA","widthB","syncedWidth","el","strings","f","h","r","m","i","e","MAX_COUNTER_ANIMATION_DURATION","BeamCumulativeImpact","DEFAULT_BASE_URL","enforceConfig","getCumulativeImpact","AsyncController","debounce","SUPPORTED_LANGUAGES","changedProperties","requireNewDataProps","prop","data","error","loading","_loading","_errorMessage","BeamError","rawValues","impact","maxRawValue","durations","val","localizeUserString","idx","animationDuration","disableAnimation","floatingCounterClass","duration","unitDisplay","summaryDisplay","defaults","defineCustomText","remoteConfig","config","_cssVariableMap","cssReset","css","useCustomText","queryAll","defineCustomElement"],"mappings":"0wBAIaA,UAAwBC,CAAW,CAAzC,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,KAAM,OAAQ,CAAC,CAbhB,EAAAqB,EAayB,UAEAtB,QAAAA,CAAAA,EAAAA,EAAA,CAAnCC,EAAS,CAAE,KAAM,OAAQ,CAAC,CAfhB,EAAAqB,EAeyB,UAkCpCtB,cAAAA,CAAAA,EAAAA,EAAA,CADC2D,EAAS,6BAA6B,GAhD5BrC,EAiDX,UAAA,gBAAA,CAAA,EAkQFsC,EAAoBtC,CAAoB"}
@@ -22,6 +22,7 @@ declare class BeamImpactOverview extends LitElement {
22
22
  userId?: RequiredConfig["userId"];
23
23
  lang: LANGUAGES;
24
24
  debug: boolean;
25
+ draftConfig: boolean;
25
26
  discountCodes?: string[];
26
27
  transactionId?: string;
27
28
  get configLang(): LANGUAGES;
@@ -158,11 +159,16 @@ declare class BeamImpactOverview extends LitElement {
158
159
  */
159
160
  handleFontLoad<T = any>(callback: () => T | void): Promise<void | T>;
160
161
  resizeElements: lodash.DebouncedFuncLeading<() => void>;
161
- renderCard({ imageUrl, title, percentFunded, description, }: {
162
+ renderCard({ imageUrl, title, percentFunded, goalProgressText, description, urlCopy, impactUrl, isImage, cardType, }: {
162
163
  imageUrl: TUrl;
163
164
  title: string;
164
165
  percentFunded: number;
166
+ goalProgressText: string;
165
167
  description: string;
168
+ urlCopy?: string;
169
+ impactUrl: TUrl;
170
+ isImage: boolean;
171
+ cardType: string;
166
172
  }): lit_html.TemplateResult<1>;
167
173
  render(): "" | lit_html.TemplateResult<1>;
168
174
  get cssVariables(): any;