@beamimpact/web-sdk 1.40.0 → 1.42.0

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 (320) hide show
  1. package/README.md +7 -11
  2. package/dist/chunks/_share-dialog-dependencies-0XZ9j6DF.esm.js +2 -0
  3. package/dist/chunks/_share-dialog-dependencies-0XZ9j6DF.esm.js.map +1 -0
  4. package/dist/chunks/_share-dialog-dependencies-cBi8GG00.esm.js +2 -0
  5. package/dist/chunks/_share-dialog-dependencies-cBi8GG00.esm.js.map +1 -0
  6. package/dist/chunks/cart-contents-h60geKWa.esm.js.map +1 -1
  7. package/dist/chunks/{cart-contents-3-9fB-7m.esm.d.ts → cart-contents-sUhfwLAz.esm.d.ts} +2 -1
  8. package/dist/chunks/checkbox-P2JYPqxl.esm.js +17 -0
  9. package/dist/chunks/checkbox-P2JYPqxl.esm.js.map +1 -0
  10. package/dist/chunks/{css-card-grid-7tObtoJx.esm.js → css-card-grid-r6wxRbPV.esm.js} +2 -2
  11. package/dist/chunks/{css-card-grid-7tObtoJx.esm.js.map → css-card-grid-r6wxRbPV.esm.js.map} +1 -1
  12. package/dist/chunks/enforce-config-HksNiOMu.esm.js +3 -0
  13. package/dist/chunks/enforce-config-HksNiOMu.esm.js.map +1 -0
  14. package/dist/chunks/enforce-config-er6B5Gkj.esm.js +3 -0
  15. package/dist/chunks/enforce-config-er6B5Gkj.esm.js.map +1 -0
  16. package/dist/chunks/{events-7cGXyV7_.esm.d.ts → events-QJc86_5Y.esm.d.ts} +2 -2
  17. package/dist/chunks/{events-Y8fYvSqM.esm.js → events-_4nImo3u.esm.js} +2 -2
  18. package/dist/chunks/{events-Y8fYvSqM.esm.js.map → events-_4nImo3u.esm.js.map} +1 -1
  19. package/dist/chunks/index--phjcEHh.esm.js +2 -0
  20. package/dist/chunks/index--phjcEHh.esm.js.map +1 -0
  21. package/dist/chunks/{index-uCfdsWtt.esm.js → index-1nI7l5vj.esm.js} +2 -2
  22. package/dist/chunks/{index-uCfdsWtt.esm.js.map → index-1nI7l5vj.esm.js.map} +1 -1
  23. package/dist/chunks/index-2K1cEtb1.esm.js +2 -0
  24. package/dist/chunks/index-2K1cEtb1.esm.js.map +1 -0
  25. package/dist/chunks/index-3-VTK-nH.esm.js +2 -0
  26. package/dist/chunks/index-3-VTK-nH.esm.js.map +1 -0
  27. package/dist/chunks/index-AQ8n9ODJ.esm.js +2 -0
  28. package/dist/chunks/{index-fINTvZVX.esm.js.map → index-AQ8n9ODJ.esm.js.map} +1 -1
  29. package/dist/chunks/index-E8H5A7Qq.esm.js +2 -0
  30. package/dist/chunks/index-E8H5A7Qq.esm.js.map +1 -0
  31. package/dist/chunks/index-FQExZDX9.esm.js +2 -0
  32. package/dist/chunks/index-FQExZDX9.esm.js.map +1 -0
  33. package/dist/chunks/index-JA-7NqMF.esm.js +2 -0
  34. package/dist/chunks/index-JA-7NqMF.esm.js.map +1 -0
  35. package/dist/chunks/{index-8KzbQIsU.esm.d.ts → index-M-0eAFA6.esm.d.ts} +1 -1
  36. package/dist/chunks/{index-phDmC-TS.esm.js → index-NOF_HeFP.esm.js} +2 -2
  37. package/dist/chunks/index-NOF_HeFP.esm.js.map +1 -0
  38. package/dist/chunks/index-PiMq5a49.esm.js +2 -0
  39. package/dist/chunks/index-PiMq5a49.esm.js.map +1 -0
  40. package/dist/chunks/{index-rFBYAk7m.esm.d.ts → index-VHXu2kRx.esm.d.ts} +1 -1
  41. package/dist/chunks/index-XCMf22lv.esm.js +2 -0
  42. package/dist/chunks/index-XCMf22lv.esm.js.map +1 -0
  43. package/dist/chunks/{index-0VcD5nhV.esm.d.ts → index-ZgCs6F4e.esm.d.ts} +4 -4
  44. package/dist/chunks/{index-TOzSFOvI.esm.d.ts → index-_Hgu38MH.esm.d.ts} +1 -1
  45. package/dist/chunks/{index-SxFKifVJ.esm.d.ts → index-_UuYsIe9.esm.d.ts} +1 -1
  46. package/dist/chunks/index-cUb-0Igl.esm.js +2 -0
  47. package/dist/chunks/{index-kxMe_AX1.esm.js.map → index-cUb-0Igl.esm.js.map} +1 -1
  48. package/dist/chunks/index-eHSdKArB.esm.js +2 -0
  49. package/dist/chunks/index-eHSdKArB.esm.js.map +1 -0
  50. package/dist/chunks/{index-HBDtoJlQ.esm.d.ts → index-euJMrXIc.esm.d.ts} +1 -1
  51. package/dist/chunks/{index-Hb-jziQs.esm.d.ts → index-hn6JhG_w.esm.d.ts} +7 -1
  52. package/dist/chunks/{index-6t9MtjyS.esm.d.ts → index-mTXm0DPh.esm.d.ts} +9 -1
  53. package/dist/chunks/{index-Q1vx4WtG.esm.js → index-mw70Caof.esm.js} +2 -2
  54. package/dist/chunks/{index-Q1vx4WtG.esm.js.map → index-mw70Caof.esm.js.map} +1 -1
  55. package/dist/chunks/{index-8yrr7ZZv.esm.js → index-n6QNFLXV.esm.js} +2 -2
  56. package/dist/chunks/index-n6QNFLXV.esm.js.map +1 -0
  57. package/dist/chunks/index-sOAq6oM0.esm.js +2 -0
  58. package/dist/chunks/index-sOAq6oM0.esm.js.map +1 -0
  59. package/dist/chunks/{index-uF-Qtewb.esm.js → index-x2kxA_Xo.esm.js} +2 -2
  60. package/dist/chunks/index-x2kxA_Xo.esm.js.map +1 -0
  61. package/dist/chunks/{index-Lw32NXij.esm.js → index-z8c9I9IQ.esm.js} +2 -2
  62. package/dist/chunks/index-z8c9I9IQ.esm.js.map +1 -0
  63. package/dist/chunks/{lit-qtGbjGnK.esm.js → lit-3QHn3fwl.esm.js} +5 -5
  64. package/dist/chunks/lit-3QHn3fwl.esm.js.map +1 -0
  65. package/dist/chunks/loading-template-mLjOGXMj.esm.js +2 -0
  66. package/dist/chunks/{loading-template-Av0IUyKF.esm.js.map → loading-template-mLjOGXMj.esm.js.map} +1 -1
  67. package/dist/chunks/localize-IRs8JglT.esm.js +29 -0
  68. package/dist/chunks/localize-IRs8JglT.esm.js.map +1 -0
  69. package/dist/chunks/localize-SsJbTmMj.esm.js +29 -0
  70. package/dist/chunks/localize-SsJbTmMj.esm.js.map +1 -0
  71. package/dist/chunks/{openapi-spec--MzXvfCC.esm.d.ts → openapi-spec--WoGcZgR.esm.d.ts} +232 -9
  72. package/dist/chunks/order-page-4qPr8vqZ.esm.js +2 -0
  73. package/dist/chunks/order-page-4qPr8vqZ.esm.js.map +1 -0
  74. package/dist/chunks/order-page-Ps8Qyjfg.esm.d.ts +74 -0
  75. package/dist/chunks/order-page-akvp5h2x.esm.js +2 -0
  76. package/dist/chunks/order-page-akvp5h2x.esm.js.map +1 -0
  77. package/dist/chunks/{progress-bar-Sn2QspHy.esm.js → progress-bar-HVG_n8_6.esm.js} +7 -6
  78. package/dist/chunks/progress-bar-HVG_n8_6.esm.js.map +1 -0
  79. package/dist/chunks/{promo-pill-label-j0A8qZ0c.esm.js → promo-pill-label-3Xtr5ALT.esm.js} +4 -3
  80. package/dist/chunks/{promo-pill-label-j0A8qZ0c.esm.js.map → promo-pill-label-3Xtr5ALT.esm.js.map} +1 -1
  81. package/dist/chunks/{responsive-aWj_7ZN_.esm.js → responsive-KbDsZM6S.esm.js} +2 -2
  82. package/dist/chunks/{responsive-aWj_7ZN_.esm.js.map → responsive-KbDsZM6S.esm.js.map} +1 -1
  83. package/dist/chunks/routes-qbvie7oI.esm.d.ts +445 -0
  84. package/dist/chunks/routes-r5D_LdgT.esm.js +2 -0
  85. package/dist/chunks/routes-r5D_LdgT.esm.js.map +1 -0
  86. package/dist/chunks/routes-rmhOokKz.esm.js +2 -0
  87. package/dist/chunks/routes-rmhOokKz.esm.js.map +1 -0
  88. package/dist/chunks/share-button-CqTd80g8.esm.js +2 -0
  89. package/dist/chunks/share-button-CqTd80g8.esm.js.map +1 -0
  90. package/dist/chunks/share-button-JqbM7N_4.esm.js +163 -0
  91. package/dist/chunks/share-button-JqbM7N_4.esm.js.map +1 -0
  92. package/dist/chunks/share-button-hDn8fnBI.esm.d.ts +22 -0
  93. package/dist/chunks/share-button-jpa1X3FA.esm.js +163 -0
  94. package/dist/chunks/share-button-jpa1X3FA.esm.js.map +1 -0
  95. package/dist/chunks/shoelace-components-NR11kwmz.esm.js +2 -0
  96. package/dist/chunks/shoelace-components-NR11kwmz.esm.js.map +1 -0
  97. package/dist/chunks/shoelace-components-yXqj8DyM.esm.js +2 -0
  98. package/dist/chunks/shoelace-components-yXqj8DyM.esm.js.map +1 -0
  99. package/dist/chunks/{types-CfbVJRfU.esm.d.ts → types-zbTZ8-KP.esm.d.ts} +4 -1
  100. package/dist/chunks/update-cart-05ZiT0Xf.esm.js +2 -0
  101. package/dist/chunks/update-cart-05ZiT0Xf.esm.js.map +1 -0
  102. package/dist/chunks/{update-cart-xaWdPxse.esm.d.ts → update-cart-SajqAoez.esm.d.ts} +2 -1
  103. package/dist/chunks/update-cart-lTgKV-Zu.esm.js +2 -0
  104. package/dist/chunks/update-cart-lTgKV-Zu.esm.js.map +1 -0
  105. package/dist/chunks/{vendor-jQ8cxMpw.esm.js → vendor--f7lkyBk.esm.js} +44 -44
  106. package/dist/chunks/vendor--f7lkyBk.esm.js.map +1 -0
  107. package/dist/components/beam-partner-logos.esm.js +2 -2
  108. package/dist/components/beam-partner-logos.esm.js.map +1 -1
  109. package/dist/components/beam-partner-logos.js +2 -2
  110. package/dist/components/beam-partner-logos.js.map +1 -1
  111. package/dist/components/community-impact.d.ts +1 -1
  112. package/dist/components/community-impact.esm.js +15 -9
  113. package/dist/components/community-impact.esm.js.map +1 -1
  114. package/dist/components/community-impact.js +15 -9
  115. package/dist/components/community-impact.js.map +1 -1
  116. package/dist/components/cumulative-impact.d.ts +1 -1
  117. package/dist/components/cumulative-impact.esm.js +1 -1
  118. package/dist/components/cumulative-impact.esm.js.map +1 -1
  119. package/dist/components/cumulative-impact.js +1 -1
  120. package/dist/components/cumulative-impact.js.map +1 -1
  121. package/dist/components/impact-overview.d.ts +16 -4
  122. package/dist/components/impact-overview.esm.js +29 -146
  123. package/dist/components/impact-overview.esm.js.map +1 -1
  124. package/dist/components/impact-overview.js +29 -146
  125. package/dist/components/impact-overview.js.map +1 -1
  126. package/dist/components/index.d.ts +8 -3
  127. package/dist/components/index.esm.js +1 -1
  128. package/dist/components/index.js +1 -1
  129. package/dist/components/post-purchase.d.ts +7 -4
  130. package/dist/components/post-purchase.esm.js +2 -1
  131. package/dist/components/post-purchase.esm.js.map +1 -1
  132. package/dist/components/post-purchase.js +2 -1
  133. package/dist/components/post-purchase.js.map +1 -1
  134. package/dist/components/product-details-page.d.ts +7 -1
  135. package/dist/components/product-details-page.esm.js +5 -5
  136. package/dist/components/product-details-page.esm.js.map +1 -1
  137. package/dist/components/product-details-page.js +5 -5
  138. package/dist/components/product-details-page.js.map +1 -1
  139. package/dist/components/redeem-transaction.d.ts +5 -4
  140. package/dist/components/redeem-transaction.esm.js +44 -55
  141. package/dist/components/redeem-transaction.esm.js.map +1 -1
  142. package/dist/components/redeem-transaction.js +44 -55
  143. package/dist/components/redeem-transaction.js.map +1 -1
  144. package/dist/components/select-nonprofit.d.ts +4 -4
  145. package/dist/components/select-nonprofit.esm.js +20 -16
  146. package/dist/components/select-nonprofit.esm.js.map +1 -1
  147. package/dist/components/select-nonprofit.js +20 -16
  148. package/dist/components/select-nonprofit.js.map +1 -1
  149. package/dist/components/select-subscription-nonprofit.d.ts +67 -0
  150. package/dist/components/select-subscription-nonprofit.esm.js +373 -0
  151. package/dist/components/select-subscription-nonprofit.esm.js.map +1 -0
  152. package/dist/components/select-subscription-nonprofit.js +373 -0
  153. package/dist/components/select-subscription-nonprofit.js.map +1 -0
  154. package/dist/components/shopify.d.ts +8 -6
  155. package/dist/components/shopify.esm.js +1 -1
  156. package/dist/components/shopify.esm.js.map +1 -1
  157. package/dist/components/shopify.js +1 -1
  158. package/dist/components/shopify.js.map +1 -1
  159. package/dist/components/social-share.d.ts +47 -0
  160. package/dist/components/social-share.esm.js +170 -0
  161. package/dist/components/social-share.esm.js.map +1 -0
  162. package/dist/components/social-share.js +170 -0
  163. package/dist/components/social-share.js.map +1 -0
  164. package/dist/components/subscription-impact.d.ts +179 -0
  165. package/dist/components/subscription-impact.esm.js +269 -0
  166. package/dist/components/subscription-impact.esm.js.map +1 -0
  167. package/dist/components/subscription-impact.js +269 -0
  168. package/dist/components/subscription-impact.js.map +1 -0
  169. package/dist/components/subscription-management.d.ts +143 -14
  170. package/dist/components/subscription-management.esm.js +267 -31
  171. package/dist/components/subscription-management.esm.js.map +1 -1
  172. package/dist/components/subscription-management.js +267 -31
  173. package/dist/components/subscription-management.js.map +1 -1
  174. package/dist/index.d.ts +23 -14
  175. package/dist/index.esm.js +1 -1
  176. package/dist/index.js +1 -1
  177. package/dist/integrations/beam.d.ts +1 -1
  178. package/dist/integrations/beam.esm.js +1 -1
  179. package/dist/integrations/beam.js +1 -1
  180. package/dist/integrations/cart.d.ts +3 -3
  181. package/dist/integrations/cart.esm.js +1 -1
  182. package/dist/integrations/cart.js +1 -1
  183. package/dist/integrations/index.d.ts +12 -10
  184. package/dist/integrations/index.esm.js +1 -1
  185. package/dist/integrations/index.js +1 -1
  186. package/dist/integrations/logs.d.ts +2 -2
  187. package/dist/integrations/logs.esm.js +1 -1
  188. package/dist/integrations/logs.js +1 -1
  189. package/dist/integrations/session.esm.js +1 -1
  190. package/dist/integrations/session.js +1 -1
  191. package/dist/integrations/shopify.d.ts +7 -5
  192. package/dist/integrations/shopify.esm.js +1 -1
  193. package/dist/integrations/shopify.js +1 -1
  194. package/dist/integrations/statsig.d.ts +1 -1
  195. package/dist/integrations/statsig.esm.js +14 -10
  196. package/dist/integrations/statsig.esm.js.map +1 -1
  197. package/dist/integrations/statsig.js +14 -10
  198. package/dist/integrations/statsig.js.map +1 -1
  199. package/dist/integrations/utils.d.ts +4 -4
  200. package/dist/integrations/utils.esm.js +1 -1
  201. package/dist/integrations/utils.js +1 -1
  202. package/dist/react/beam-partner-logos.esm.js +1 -1
  203. package/dist/react/beam-partner-logos.js +1 -1
  204. package/dist/react/community-impact.d.ts +1 -1
  205. package/dist/react/community-impact.esm.js +1 -1
  206. package/dist/react/community-impact.esm.js.map +1 -1
  207. package/dist/react/community-impact.js +1 -1
  208. package/dist/react/community-impact.js.map +1 -1
  209. package/dist/react/cumulative-impact.d.ts +1 -1
  210. package/dist/react/cumulative-impact.esm.js +1 -1
  211. package/dist/react/cumulative-impact.esm.js.map +1 -1
  212. package/dist/react/cumulative-impact.js +1 -1
  213. package/dist/react/cumulative-impact.js.map +1 -1
  214. package/dist/react/impact-overview.d.ts +2 -1
  215. package/dist/react/impact-overview.esm.js +1 -1
  216. package/dist/react/impact-overview.esm.js.map +1 -1
  217. package/dist/react/impact-overview.js +1 -1
  218. package/dist/react/impact-overview.js.map +1 -1
  219. package/dist/react/index.d.ts +14 -4
  220. package/dist/react/index.esm.js +1 -1
  221. package/dist/react/index.js +1 -1
  222. package/dist/react/post-purchase.d.ts +4 -3
  223. package/dist/react/post-purchase.esm.js +1 -1
  224. package/dist/react/post-purchase.esm.js.map +1 -1
  225. package/dist/react/post-purchase.js +1 -1
  226. package/dist/react/post-purchase.js.map +1 -1
  227. package/dist/react/product-details-page.esm.js +1 -1
  228. package/dist/react/product-details-page.esm.js.map +1 -1
  229. package/dist/react/product-details-page.js +1 -1
  230. package/dist/react/product-details-page.js.map +1 -1
  231. package/dist/react/redeem-transaction.d.ts +4 -4
  232. package/dist/react/redeem-transaction.esm.js +1 -1
  233. package/dist/react/redeem-transaction.esm.js.map +1 -1
  234. package/dist/react/redeem-transaction.js +1 -1
  235. package/dist/react/redeem-transaction.js.map +1 -1
  236. package/dist/react/select-nonprofit.d.ts +4 -4
  237. package/dist/react/select-nonprofit.esm.js +1 -1
  238. package/dist/react/select-nonprofit.esm.js.map +1 -1
  239. package/dist/react/select-nonprofit.js +1 -1
  240. package/dist/react/select-nonprofit.js.map +1 -1
  241. package/dist/react/select-subscription-nonprofit.d.ts +19 -0
  242. package/dist/react/select-subscription-nonprofit.esm.js +2 -0
  243. package/dist/react/select-subscription-nonprofit.esm.js.map +1 -0
  244. package/dist/react/select-subscription-nonprofit.js +2 -0
  245. package/dist/react/select-subscription-nonprofit.js.map +1 -0
  246. package/dist/react/social-share.d.ts +12 -0
  247. package/dist/react/social-share.esm.js +2 -0
  248. package/dist/react/social-share.esm.js.map +1 -0
  249. package/dist/react/social-share.js +2 -0
  250. package/dist/react/social-share.js.map +1 -0
  251. package/dist/react/subscription-impact.d.ts +13 -0
  252. package/dist/react/subscription-impact.esm.js +2 -0
  253. package/dist/react/subscription-impact.esm.js.map +1 -0
  254. package/dist/react/subscription-impact.js +2 -0
  255. package/dist/react/subscription-impact.js.map +1 -0
  256. package/dist/react/subscription-management.d.ts +9 -8
  257. package/dist/react/subscription-management.esm.js +1 -1
  258. package/dist/react/subscription-management.esm.js.map +1 -1
  259. package/dist/react/subscription-management.js +1 -1
  260. package/dist/react/subscription-management.js.map +1 -1
  261. package/dist/utils/events.d.ts +4 -4
  262. package/dist/utils/events.esm.js +1 -1
  263. package/dist/utils/events.js +1 -1
  264. package/dist/utils/index.d.ts +4 -4
  265. package/dist/utils/index.esm.js +1 -1
  266. package/dist/utils/index.js +1 -1
  267. package/dist/utils/network-listeners.esm.js +1 -1
  268. package/dist/utils/network-listeners.js +1 -1
  269. package/package.json +1 -1
  270. package/dist/chunks/_share-dialog-dependencies-1vD2dmjh.esm.js +0 -2
  271. package/dist/chunks/_share-dialog-dependencies-1vD2dmjh.esm.js.map +0 -1
  272. package/dist/chunks/_share-dialog-dependencies-jvbBs-cC.esm.js +0 -2
  273. package/dist/chunks/_share-dialog-dependencies-jvbBs-cC.esm.js.map +0 -1
  274. package/dist/chunks/index-8yrr7ZZv.esm.js.map +0 -1
  275. package/dist/chunks/index-EHubF2KN.esm.js +0 -2
  276. package/dist/chunks/index-EHubF2KN.esm.js.map +0 -1
  277. package/dist/chunks/index-FIfx75-P.esm.js +0 -2
  278. package/dist/chunks/index-FIfx75-P.esm.js.map +0 -1
  279. package/dist/chunks/index-GocMPeWn.esm.js +0 -2
  280. package/dist/chunks/index-GocMPeWn.esm.js.map +0 -1
  281. package/dist/chunks/index-HyzTMHYl.esm.js +0 -2
  282. package/dist/chunks/index-HyzTMHYl.esm.js.map +0 -1
  283. package/dist/chunks/index-LmCqzg5B.esm.js +0 -2
  284. package/dist/chunks/index-LmCqzg5B.esm.js.map +0 -1
  285. package/dist/chunks/index-Lw32NXij.esm.js.map +0 -1
  286. package/dist/chunks/index-V-BsPYtl.esm.js +0 -2
  287. package/dist/chunks/index-V-BsPYtl.esm.js.map +0 -1
  288. package/dist/chunks/index-bUooCSdc.esm.js +0 -2
  289. package/dist/chunks/index-bUooCSdc.esm.js.map +0 -1
  290. package/dist/chunks/index-cekgAcEE.esm.js +0 -2
  291. package/dist/chunks/index-cekgAcEE.esm.js.map +0 -1
  292. package/dist/chunks/index-fINTvZVX.esm.js +0 -2
  293. package/dist/chunks/index-iMRMlkF3.esm.js +0 -2
  294. package/dist/chunks/index-iMRMlkF3.esm.js.map +0 -1
  295. package/dist/chunks/index-kxMe_AX1.esm.js +0 -2
  296. package/dist/chunks/index-o7YiP4gC.esm.js +0 -2
  297. package/dist/chunks/index-o7YiP4gC.esm.js.map +0 -1
  298. package/dist/chunks/index-phDmC-TS.esm.js.map +0 -1
  299. package/dist/chunks/index-uF-Qtewb.esm.js.map +0 -1
  300. package/dist/chunks/lit-qtGbjGnK.esm.js.map +0 -1
  301. package/dist/chunks/loading-template-Av0IUyKF.esm.js +0 -2
  302. package/dist/chunks/localize-F31ae3j6.esm.js +0 -30
  303. package/dist/chunks/localize-F31ae3j6.esm.js.map +0 -1
  304. package/dist/chunks/localize-fH8KOrMi.esm.js +0 -30
  305. package/dist/chunks/localize-fH8KOrMi.esm.js.map +0 -1
  306. package/dist/chunks/order-page-0azkW5QD.esm.js +0 -2
  307. package/dist/chunks/order-page-0azkW5QD.esm.js.map +0 -1
  308. package/dist/chunks/order-page-DPx5SUKM.esm.d.ts +0 -255
  309. package/dist/chunks/order-page-n12hvsCN.esm.js +0 -2
  310. package/dist/chunks/order-page-n12hvsCN.esm.js.map +0 -1
  311. package/dist/chunks/progress-bar-Sn2QspHy.esm.js.map +0 -1
  312. package/dist/chunks/routes-31m626dW.esm.js +0 -2
  313. package/dist/chunks/routes-31m626dW.esm.js.map +0 -1
  314. package/dist/chunks/routes-sbqL3QFm.esm.js +0 -2
  315. package/dist/chunks/routes-sbqL3QFm.esm.js.map +0 -1
  316. package/dist/chunks/update-cart-NEt4A8dB.esm.js +0 -2
  317. package/dist/chunks/update-cart-NEt4A8dB.esm.js.map +0 -1
  318. package/dist/chunks/update-cart-XAwwFxhS.esm.js +0 -2
  319. package/dist/chunks/update-cart-XAwwFxhS.esm.js.map +0 -1
  320. package/dist/chunks/vendor-jQ8cxMpw.esm.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"localize-SsJbTmMj.esm.js","sources":["../../src/shared/fragments/css-variable-map.ts","../../src/shared/controllers/async-controller.ts","../../src/shared/fragments/error-message-template.ts","../../src/shared/fragments/custom-text.ts","../../src/shared/localize.ts"],"sourcesContent":["export const _cssVariableMap = (variables: Record<string, string>) => {\n return Object.entries(variables)\n .map(([k, v]) => `${k}: ${v};`)\n .join(\"\\n\");\n};\n","import { ReactiveController, ReactiveControllerHost } from \"lit\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AsyncFunction = (...args: any[]) => Promise<any>;\n\n/**\n * Creates a declarative wrapper around async operations\n * @example\n * class MyElement extends LitElement {\n * private user = new AsyncController(\n * this,\n * async ({ id }) => get(url, { id }));\n *\n * async updated(changedProperties) {\n * if (changedProperties.has(\"userId\")) {\n * await this.user.exec({ id: this.userId })\n * }\n * }\n *\n * render() {\n * const { data, loading, error } = this.user;\n * if (loading) return html`Please wait...`\n * if (error) return html`Error! <button @click=${this.user.retry}>Reload</button>`;\n * return html`My name is: ${data.name}`\n * }\n * }\n */\nexport class AsyncController<TFn extends AsyncFunction> implements ReactiveController {\n public data: Awaited<ReturnType<TFn>> | null = null;\n public loading = false;\n public error: Error | null = null;\n\n private readonly host: ReactiveControllerHost;\n private readonly asyncFn: TFn;\n private lastArgs?: Parameters<TFn>;\n\n constructor(host: ReactiveControllerHost, asyncFn: TFn) {\n (this.host = host).addController(this);\n this.asyncFn = asyncFn;\n }\n\n public async exec(...args: Parameters<TFn>): Promise<ReturnType<TFn> | null> {\n this.lastArgs = args;\n this.loading = true;\n this.host.requestUpdate();\n try {\n // TODO: prevent race condition if later invocation returns before earlier\n this.data = await this.asyncFn(...args);\n this.error = null;\n } catch (err) {\n if (err instanceof Error) {\n this.error = err;\n this.data = null;\n }\n }\n this.loading = false;\n this.host.requestUpdate();\n return this.data;\n }\n\n public async retry() {\n return this.exec(...((this.lastArgs || []) as Parameters<TFn>));\n }\n\n hostDisconnected() {\n // TODO: cancel API calls\n }\n}\n","import { html } from \"lit\";\nimport { MissingConfig, NetworkError } from \"../../utils/beam-errors\";\n\nconst strings = {\n errorTitle: `Beam encountered an error. Please try again.`,\n retry: `Retry`,\n};\n\nexport const _errorMessage = ({ error, retry }: { error: Error; retry?: (...args: never) => void }) => {\n let details = html``;\n if (error instanceof NetworkError) {\n const response = JSON.stringify(\n {\n status: error.response.status,\n statusText: error.response.statusText,\n url: error.response.url,\n body: error.body,\n },\n null,\n 4\n );\n details = html`\n <p><b>Network Response:</b></p>\n <p>${response}</p>\n `;\n }\n if (error instanceof MissingConfig) {\n details = html`\n <p><b>Missing Required Config Options:</b></p>\n <p>${error.missingConfigKeyNames.join(\", \")}</p>\n `;\n }\n return html`<div class=\"beam-error\" style=\"text-align: left\">\n <p>${strings.errorTitle} ${retry ? html` <button type=\"reset\" @click=\"${retry}\">${strings.retry}</button>` : \"\"}</p>\n <br />\n <details>\n <div style=\"white-space: pre-wrap; font-family: monospace; line-height: 1;\">\n ${details}\n <p><b>Message:</b> ${error.message || html`<i>None</i>`}</p>\n <p><b>Stack:</b> ${error.stack}</p>\n </div>\n </details>\n <br />\n <p>Help: <a href=\"https://www.beamimpact.com\">www.beamimpact.com</a></p>\n </div>`;\n};\n","import { CSSResult, unsafeCSS } from \"lit\";\n\n/**\n * Create an object that can be passed to cssVariableMap\n * to define CSS variables in a style tag. The default properties\n * are the ones exposed for customization in the remote config interface.\n * @example\n * const variables = {\n * ...customizableTextJs(\"widget-header\",\n * \"widget-border-color\": \"red\"\n * };\n *\n * html`<style>:host { ${_cssVariableMap(variables)} }</style>`;\n * @returns {{[p: string]: string}}\n */\nexport const defineCustomText = (\n namespace = \"\",\n {\n fontFamily = \"inherit\",\n fontStyle = \"inherit\",\n fontSize = \"inherit\",\n fontWeight = \"inherit\",\n textTransform = \"none\",\n marginTop = \"0\",\n lineHeight = \"inherit\",\n color = \"inherit\",\n } = {}\n): Record<string, string> => {\n const prefix = namespace.startsWith(\"--beam-\") ? namespace : `--beam-${namespace}`;\n return {\n [`${prefix}-fontFamily`]: fontFamily,\n [`${prefix}-fontStyle`]: fontStyle,\n [`${prefix}-fontSize`]: fontSize,\n [`${prefix}-fontWeight`]: fontWeight,\n [`${prefix}-textTransform`]: textTransform,\n [`${prefix}-marginTop`]: marginTop,\n [`${prefix}-lineHeight`]: lineHeight,\n [`${prefix}-color`]: color,\n };\n};\n\n/**\n * Returns a string that defines css properties based on variables,\n * which can be used in a css`` template. The default properties are the\n * ones exposed for customization in the remote config interface.\n * @example\n * css`.widget-header { ${customizableTextCss(\"widget-header\")} border: none; }`\n * @returns {CSSResult}\n */\nexport const useCustomText = (\n namespace = \"\",\n {\n fontFamily = \"inherit\",\n fontStyle = \"inherit\",\n fontSize = \"inherit\",\n fontWeight = \"inherit\",\n textTransform = \"none\",\n marginTop = \"0\",\n lineHeight = \"inherit\",\n color = \"inherit\",\n } = {}\n): CSSResult => {\n const prefix = namespace.startsWith(\"--beam-\") ? namespace : `--beam-${namespace}`;\n return unsafeCSS(`\\\n font-family: var(${prefix}-fontFamily, ${fontFamily});\n font-style: var(${prefix}-fontStyle, ${fontStyle});\n font-size: var(${prefix}-fontSize, ${fontSize});\n font-weight: var(${prefix}-fontWeight, ${fontWeight});\n text-transform: var(${prefix}-textTransform, ${textTransform});\n margin-top: var(${prefix}-marginTop, ${marginTop});\n line-height: var(${prefix}-lineHeight, ${lineHeight});\n color: var(${prefix}-color, ${color});\n `);\n};\n\n/**\n * Same as useCustomText except returns an object that can be passed to styleMap\n */\nexport const useCustomTextMap = (\n namespace = \"\",\n {\n fontSize = \"inherit\",\n fontStyle = \"inherit\",\n fontWeight = \"inherit\",\n textTransform = \"none\",\n marginTop = \"0\",\n lineHeight = \"inherit\",\n } = {}\n): Record<string, string> => {\n const prefix = namespace.startsWith(\"--beam-\") ? namespace : `--beam-${namespace}`;\n return {\n fontSize: `var(${prefix}-fontSize, ${fontSize})`,\n fontStyle: `var(${prefix}-fontStyle, ${fontStyle})`,\n fontWeight: `var(${prefix}-fontWeight, ${fontWeight})`,\n textTransform: `var(${prefix}-textTransform, ${textTransform})`,\n marginTop: `var(${prefix}-marginTop, ${marginTop})`,\n lineHeight: `var(${prefix}-lineHeight, ${lineHeight})`,\n };\n};\n","import { LANGUAGES } from \"../api-sdk/types\";\nimport { logger } from \"../utils/logger\";\nimport { BeamError } from \"../utils/beam-errors\";\n\n/**\n * User-provided strings may include embedded translations in JSON form\n * This function extracts the string for the provided language\n * If it fails to parse, or the string is not json-like, it returns the whole string\n * TODO: consider returning unsafeHtml() or adding an option for it\n */\nconst localizeUserString = (lang: LANGUAGES, str: string): string => {\n const isJson = str.startsWith(\"{\");\n if (isJson) {\n try {\n const json = JSON.parse(str);\n return json[lang] ?? json[\"en\"] ?? str;\n } catch (err) {\n logger.error(new BeamError(\"Failed to extract JSON translation from string\"), str);\n return str;\n }\n }\n return str;\n};\n\nexport { localizeUserString };\n"],"names":["_cssVariableMap","variables","k","v","AsyncController","host","asyncFn","args","err","strings","_errorMessage","error","retry","details","html","NetworkError","response","MissingConfig","defineCustomText","namespace","fontFamily","fontStyle","fontSize","fontWeight","textTransform","marginTop","lineHeight","color","prefix","useCustomText","unsafeCSS","localizeUserString","lang","str","json","logger","BeamError"],"mappings":"6JAAO,MAAMA,EA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AAAA,0BAC1CI,CAAM,eAAeH,CAAS;AAAA,2BAC7BG,CAAM,gBAAgBF,CAAU;AAAA,qBACtCE,CAAM,WAAWD,CAAK;AAAA,KACtC,CACL,EC/DMI,EAAqB,CAACC,EAAiBC,IAAwB,CAEnE,GADeA,EAAI,WAAW,GAAG,EAE/B,GAAI,CACF,MAAMC,EAAO,KAAK,MAAMD,CAAG,EAC3B,OAAOC,EAAKF,CAAI,GAAKE,EAAK,IAASD,CACrC,MAAc,CACZ,OAAAE,EAAO,MAAM,IAAIC,EAAU,gDAAgD,EAAGH,CAAG,EAC1EA,CACT,CAEF,OAAOA,CACT"}
@@ -81,6 +81,14 @@ interface paths {
81
81
  * @example Make your purchase a force for good
82
82
  */
83
83
  nonprofitUnselectedHeader?: string;
84
+ /** @description An object containing dynamic strings for the widget. These strings serve as templates and include dynamic variables that vary based on the widget type. */
85
+ dynamicStrings?: {
86
+ [key: string]: string;
87
+ } | null;
88
+ /** @description An object containing additional static strings specific to each widget. These strings are unique to the widget and are not shared across different widgets. */
89
+ additionalStrings?: {
90
+ [key: string]: string;
91
+ } | null;
84
92
  /** @description Disables counter animation for cumulative-impact widget */
85
93
  disableAnimation?: boolean;
86
94
  /** @description promo copy is sent in this object to be used in conditionally rendered UI components. This object serves as a repository for server-generated copy */
@@ -199,6 +207,8 @@ interface paths {
199
207
  * @example Hawaii
200
208
  */
201
209
  badge?: string;
210
+ /** @description should include nonprofit in personal impact */
211
+ includeInPersonalImpact?: boolean;
202
212
  };
203
213
  impact: {
204
214
  /**
@@ -340,6 +350,14 @@ interface paths {
340
350
  * @example Make your purchase a force for good
341
351
  */
342
352
  nonprofitUnselectedHeader?: string;
353
+ /** @description An object containing dynamic strings for the widget. These strings serve as templates and include dynamic variables that vary based on the widget type. */
354
+ dynamicStrings?: {
355
+ [key: string]: string;
356
+ } | null;
357
+ /** @description An object containing additional static strings specific to each widget. These strings are unique to the widget and are not shared across different widgets. */
358
+ additionalStrings?: {
359
+ [key: string]: string;
360
+ } | null;
343
361
  /** @description Disables counter animation for cumulative-impact widget */
344
362
  disableAnimation?: boolean;
345
363
  /** @description promo copy is sent in this object to be used in conditionally rendered UI components. This object serves as a repository for server-generated copy */
@@ -549,6 +567,14 @@ interface paths {
549
567
  * @example Make your purchase a force for good
550
568
  */
551
569
  nonprofitUnselectedHeader?: string;
570
+ /** @description An object containing dynamic strings for the widget. These strings serve as templates and include dynamic variables that vary based on the widget type. */
571
+ dynamicStrings?: {
572
+ [key: string]: string;
573
+ } | null;
574
+ /** @description An object containing additional static strings specific to each widget. These strings are unique to the widget and are not shared across different widgets. */
575
+ additionalStrings?: {
576
+ [key: string]: string;
577
+ } | null;
552
578
  /** @description Disables counter animation for cumulative-impact widget */
553
579
  disableAnimation?: boolean;
554
580
  /** @description promo copy is sent in this object to be used in conditionally rendered UI components. This object serves as a repository for server-generated copy */
@@ -667,6 +693,8 @@ interface paths {
667
693
  * @example Hawaii
668
694
  */
669
695
  badge?: string;
696
+ /** @description should include nonprofit in personal impact */
697
+ includeInPersonalImpact?: boolean;
670
698
  };
671
699
  impact: {
672
700
  /**
@@ -729,7 +757,7 @@ interface paths {
729
757
  */
730
758
  lang?: "en" | "fr" | "de" | "es" | "it" | "pl";
731
759
  /** @enum {string} */
732
- widgetName: "select-nonprofit" | "redeem-transaction" | "post-purchase" | "subscription-management";
760
+ widgetName: "select-nonprofit" | "redeem-transaction" | "post-purchase" | "subscription-management" | "select-subscription-nonprofit";
733
761
  /** @example 1.0 */
734
762
  version: string;
735
763
  cart?: {
@@ -742,13 +770,27 @@ interface paths {
742
770
  };
743
771
  content: {
744
772
  localAmount?: number;
773
+ /** @description Order or cart level discounts */
774
+ discounts?: {
775
+ /** @description The code for the discount */
776
+ code: string;
777
+ /** @description Whether the discount code is applicable to the current order, cart, or item */
778
+ applicable: boolean;
779
+ }[] | null;
745
780
  items: {
746
781
  id?: number | null;
747
782
  gift_card?: boolean | null;
748
783
  /** @description Price for line item (qty * unit price), after discounts, in integer cents format (3.50 => 350) */
749
784
  final_line_price: number | null;
750
785
  /** @description Unit price for line item, in integer cents format (3.50 => 350) */
751
- final__price?: number | null;
786
+ final_price?: number | null;
787
+ /** @description Line item discounts */
788
+ line_level_discount_applications?: ({
789
+ /** @description The code for the discount */
790
+ title: string;
791
+ } & {
792
+ [key: string]: unknown;
793
+ })[] | null;
752
794
  quantity?: number | null;
753
795
  sku: string | null;
754
796
  product_id?: number | null;
@@ -771,6 +813,13 @@ interface paths {
771
813
  };
772
814
  content: {
773
815
  localAmount?: number;
816
+ /** @description Order or cart level discounts */
817
+ discounts?: {
818
+ /** @description The code for the discount */
819
+ code: string;
820
+ /** @description Whether the discount code is applicable to the current order, cart, or item */
821
+ applicable: boolean;
822
+ }[] | null;
774
823
  items: {
775
824
  id?: number | null;
776
825
  gift_card?: boolean | null;
@@ -778,6 +827,13 @@ interface paths {
778
827
  final_line_price: number | null;
779
828
  /** @description Unit price for line item in decimal format (3.50) */
780
829
  final_price?: number | null;
830
+ /** @description Line item discounts */
831
+ line_level_discount_applications?: ({
832
+ /** @description The code for the discount */
833
+ title: string;
834
+ } & {
835
+ [key: string]: unknown;
836
+ })[] | null;
781
837
  quantity?: number | null;
782
838
  sku: string | null;
783
839
  product_id?: number | null;
@@ -801,10 +857,24 @@ interface paths {
801
857
  };
802
858
  content: {
803
859
  localAmount?: number;
860
+ /** @description Order or cart level discounts */
861
+ discounts?: {
862
+ /** @description The code for the discount */
863
+ code: string;
864
+ /** @description Whether the discount code is applicable to the current order, cart, or item */
865
+ applicable: boolean;
866
+ }[] | null;
804
867
  items: {
805
868
  remoteProductIdentifier?: string | null;
806
869
  localAmount: number;
807
870
  remoteSubscriptionId?: string;
871
+ /** @description Line item discounts */
872
+ discounts?: {
873
+ /** @description The code for the discount */
874
+ code: string;
875
+ /** @description Whether the discount code is applicable to the current order, cart, or item */
876
+ applicable: boolean;
877
+ }[] | null;
808
878
  }[];
809
879
  subscriptions?: {
810
880
  remoteSubscriptionId: string;
@@ -838,13 +908,15 @@ interface paths {
838
908
  /** The limit on the number of personal impact objects to return */
839
909
  personalImpactLimit?: number;
840
910
  /** The type of view to fetch the config for */
841
- widgetName: "impact-overview" | "community-impact";
911
+ widgetName: "impact-overview" | "community-impact" | "subscription-impact" | "subscription-management";
842
912
  /** The version of the config */
843
913
  version: string;
844
914
  /** Language code. */
845
915
  lang?: "en" | "fr" | "de" | "es" | "it" | "pl";
846
916
  /** When set to true, themes are removed from widget config objects */
847
917
  "options.config.omitThemes"?: boolean;
918
+ /** Discount codes applied to the order */
919
+ discountCodes?: string[];
848
920
  };
849
921
  };
850
922
  responses: {
@@ -867,6 +939,15 @@ interface paths {
867
939
  donationTypeName: string | null;
868
940
  matchDonationTypeName: string | null;
869
941
  };
942
+ store: {
943
+ name: string | null;
944
+ displayName: string | null;
945
+ /**
946
+ * @description A URL string, but can be null
947
+ * @example https://beamimpact.com
948
+ */
949
+ communityPageURL: string | null;
950
+ };
870
951
  config: {
871
952
  web: {
872
953
  /**
@@ -900,6 +981,14 @@ interface paths {
900
981
  * @example Make your purchase a force for good
901
982
  */
902
983
  nonprofitUnselectedHeader?: string;
984
+ /** @description An object containing dynamic strings for the widget. These strings serve as templates and include dynamic variables that vary based on the widget type. */
985
+ dynamicStrings?: {
986
+ [key: string]: string;
987
+ } | null;
988
+ /** @description An object containing additional static strings specific to each widget. These strings are unique to the widget and are not shared across different widgets. */
989
+ additionalStrings?: {
990
+ [key: string]: string;
991
+ } | null;
903
992
  /** @description Disables counter animation for cumulative-impact widget */
904
993
  disableAnimation?: boolean;
905
994
  /** @description promo copy is sent in this object to be used in conditionally rendered UI components. This object serves as a repository for server-generated copy */
@@ -1008,6 +1097,8 @@ interface paths {
1008
1097
  * @example Hawaii
1009
1098
  */
1010
1099
  badge?: string;
1100
+ /** @description should include nonprofit in personal impact */
1101
+ includeInPersonalImpact?: boolean;
1011
1102
  };
1012
1103
  impact: {
1013
1104
  /**
@@ -1089,6 +1180,8 @@ interface paths {
1089
1180
  * @example Hawaii
1090
1181
  */
1091
1182
  badge?: string;
1183
+ /** @description should include nonprofit in personal impact */
1184
+ includeInPersonalImpact?: boolean;
1092
1185
  };
1093
1186
  impact: {
1094
1187
  /**
@@ -1332,6 +1425,8 @@ interface paths {
1332
1425
  * @example Hawaii
1333
1426
  */
1334
1427
  badge?: string;
1428
+ /** @description should include nonprofit in personal impact */
1429
+ includeInPersonalImpact?: boolean;
1335
1430
  };
1336
1431
  impact: {
1337
1432
  /**
@@ -1413,6 +1508,8 @@ interface paths {
1413
1508
  * @example Hawaii
1414
1509
  */
1415
1510
  badge?: string;
1511
+ /** @description should include nonprofit in personal impact */
1512
+ includeInPersonalImpact?: boolean;
1416
1513
  };
1417
1514
  impact: {
1418
1515
  /**
@@ -1571,6 +1668,8 @@ interface paths {
1571
1668
  * @example Hawaii
1572
1669
  */
1573
1670
  badge?: string;
1671
+ /** @description should include nonprofit in personal impact */
1672
+ includeInPersonalImpact?: boolean;
1574
1673
  };
1575
1674
  impact: {
1576
1675
  /**
@@ -1652,6 +1751,8 @@ interface paths {
1652
1751
  * @example Hawaii
1653
1752
  */
1654
1753
  badge?: string;
1754
+ /** @description should include nonprofit in personal impact */
1755
+ includeInPersonalImpact?: boolean;
1655
1756
  };
1656
1757
  impact: {
1657
1758
  /**
@@ -1823,13 +1924,27 @@ interface paths {
1823
1924
  };
1824
1925
  content: {
1825
1926
  localAmount?: number;
1927
+ /** @description Order or cart level discounts */
1928
+ discounts?: {
1929
+ /** @description The code for the discount */
1930
+ code: string;
1931
+ /** @description Whether the discount code is applicable to the current order, cart, or item */
1932
+ applicable: boolean;
1933
+ }[] | null;
1826
1934
  items: {
1827
1935
  id?: number | null;
1828
1936
  gift_card?: boolean | null;
1829
1937
  /** @description Price for line item (qty * unit price), after discounts, in integer cents format (3.50 => 350) */
1830
1938
  final_line_price: number | null;
1831
1939
  /** @description Unit price for line item, in integer cents format (3.50 => 350) */
1832
- final__price?: number | null;
1940
+ final_price?: number | null;
1941
+ /** @description Line item discounts */
1942
+ line_level_discount_applications?: ({
1943
+ /** @description The code for the discount */
1944
+ title: string;
1945
+ } & {
1946
+ [key: string]: unknown;
1947
+ })[] | null;
1833
1948
  quantity?: number | null;
1834
1949
  sku: string | null;
1835
1950
  product_id?: number | null;
@@ -1852,6 +1967,13 @@ interface paths {
1852
1967
  };
1853
1968
  content: {
1854
1969
  localAmount?: number;
1970
+ /** @description Order or cart level discounts */
1971
+ discounts?: {
1972
+ /** @description The code for the discount */
1973
+ code: string;
1974
+ /** @description Whether the discount code is applicable to the current order, cart, or item */
1975
+ applicable: boolean;
1976
+ }[] | null;
1855
1977
  items: {
1856
1978
  id?: number | null;
1857
1979
  gift_card?: boolean | null;
@@ -1859,6 +1981,13 @@ interface paths {
1859
1981
  final_line_price: number | null;
1860
1982
  /** @description Unit price for line item in decimal format (3.50) */
1861
1983
  final_price?: number | null;
1984
+ /** @description Line item discounts */
1985
+ line_level_discount_applications?: ({
1986
+ /** @description The code for the discount */
1987
+ title: string;
1988
+ } & {
1989
+ [key: string]: unknown;
1990
+ })[] | null;
1862
1991
  quantity?: number | null;
1863
1992
  sku: string | null;
1864
1993
  product_id?: number | null;
@@ -1882,10 +2011,24 @@ interface paths {
1882
2011
  };
1883
2012
  content: {
1884
2013
  localAmount?: number;
2014
+ /** @description Order or cart level discounts */
2015
+ discounts?: {
2016
+ /** @description The code for the discount */
2017
+ code: string;
2018
+ /** @description Whether the discount code is applicable to the current order, cart, or item */
2019
+ applicable: boolean;
2020
+ }[] | null;
1885
2021
  items: {
1886
2022
  remoteProductIdentifier?: string | null;
1887
2023
  localAmount: number;
1888
2024
  remoteSubscriptionId?: string;
2025
+ /** @description Line item discounts */
2026
+ discounts?: {
2027
+ /** @description The code for the discount */
2028
+ code: string;
2029
+ /** @description Whether the discount code is applicable to the current order, cart, or item */
2030
+ applicable: boolean;
2031
+ }[] | null;
1889
2032
  }[];
1890
2033
  subscriptions?: {
1891
2034
  remoteSubscriptionId: string;
@@ -2069,6 +2212,14 @@ interface paths {
2069
2212
  * @example Make your purchase a force for good
2070
2213
  */
2071
2214
  nonprofitUnselectedHeader?: string;
2215
+ /** @description An object containing dynamic strings for the widget. These strings serve as templates and include dynamic variables that vary based on the widget type. */
2216
+ dynamicStrings?: {
2217
+ [key: string]: string;
2218
+ } | null;
2219
+ /** @description An object containing additional static strings specific to each widget. These strings are unique to the widget and are not shared across different widgets. */
2220
+ additionalStrings?: {
2221
+ [key: string]: string;
2222
+ } | null;
2072
2223
  /** @description Disables counter animation for cumulative-impact widget */
2073
2224
  disableAnimation?: boolean;
2074
2225
  /** @description promo copy is sent in this object to be used in conditionally rendered UI components. This object serves as a repository for server-generated copy */
@@ -2178,6 +2329,8 @@ interface paths {
2178
2329
  * @example Hawaii
2179
2330
  */
2180
2331
  badge?: string;
2332
+ /** @description should include nonprofit in personal impact */
2333
+ includeInPersonalImpact?: boolean;
2181
2334
  };
2182
2335
  impact: {
2183
2336
  /**
@@ -2259,6 +2412,8 @@ interface paths {
2259
2412
  * @example Hawaii
2260
2413
  */
2261
2414
  badge?: string;
2415
+ /** @description should include nonprofit in personal impact */
2416
+ includeInPersonalImpact?: boolean;
2262
2417
  };
2263
2418
  impact: {
2264
2419
  /**
@@ -2384,13 +2539,27 @@ interface paths {
2384
2539
  };
2385
2540
  content: {
2386
2541
  localAmount?: number;
2542
+ /** @description Order or cart level discounts */
2543
+ discounts?: {
2544
+ /** @description The code for the discount */
2545
+ code: string;
2546
+ /** @description Whether the discount code is applicable to the current order, cart, or item */
2547
+ applicable: boolean;
2548
+ }[] | null;
2387
2549
  items: {
2388
2550
  id?: number | null;
2389
2551
  gift_card?: boolean | null;
2390
2552
  /** @description Price for line item (qty * unit price), after discounts, in integer cents format (3.50 => 350) */
2391
2553
  final_line_price: number | null;
2392
2554
  /** @description Unit price for line item, in integer cents format (3.50 => 350) */
2393
- final__price?: number | null;
2555
+ final_price?: number | null;
2556
+ /** @description Line item discounts */
2557
+ line_level_discount_applications?: ({
2558
+ /** @description The code for the discount */
2559
+ title: string;
2560
+ } & {
2561
+ [key: string]: unknown;
2562
+ })[] | null;
2394
2563
  quantity?: number | null;
2395
2564
  sku: string | null;
2396
2565
  product_id?: number | null;
@@ -2413,6 +2582,13 @@ interface paths {
2413
2582
  };
2414
2583
  content: {
2415
2584
  localAmount?: number;
2585
+ /** @description Order or cart level discounts */
2586
+ discounts?: {
2587
+ /** @description The code for the discount */
2588
+ code: string;
2589
+ /** @description Whether the discount code is applicable to the current order, cart, or item */
2590
+ applicable: boolean;
2591
+ }[] | null;
2416
2592
  items: {
2417
2593
  id?: number | null;
2418
2594
  gift_card?: boolean | null;
@@ -2420,6 +2596,13 @@ interface paths {
2420
2596
  final_line_price: number | null;
2421
2597
  /** @description Unit price for line item in decimal format (3.50) */
2422
2598
  final_price?: number | null;
2599
+ /** @description Line item discounts */
2600
+ line_level_discount_applications?: ({
2601
+ /** @description The code for the discount */
2602
+ title: string;
2603
+ } & {
2604
+ [key: string]: unknown;
2605
+ })[] | null;
2423
2606
  quantity?: number | null;
2424
2607
  sku: string | null;
2425
2608
  product_id?: number | null;
@@ -2443,10 +2626,24 @@ interface paths {
2443
2626
  };
2444
2627
  content: {
2445
2628
  localAmount?: number;
2629
+ /** @description Order or cart level discounts */
2630
+ discounts?: {
2631
+ /** @description The code for the discount */
2632
+ code: string;
2633
+ /** @description Whether the discount code is applicable to the current order, cart, or item */
2634
+ applicable: boolean;
2635
+ }[] | null;
2446
2636
  items: {
2447
2637
  remoteProductIdentifier?: string | null;
2448
2638
  localAmount: number;
2449
2639
  remoteSubscriptionId?: string;
2640
+ /** @description Line item discounts */
2641
+ discounts?: {
2642
+ /** @description The code for the discount */
2643
+ code: string;
2644
+ /** @description Whether the discount code is applicable to the current order, cart, or item */
2645
+ applicable: boolean;
2646
+ }[] | null;
2450
2647
  }[];
2451
2648
  subscriptions?: {
2452
2649
  remoteSubscriptionId: string;
@@ -2460,7 +2657,7 @@ interface paths {
2460
2657
  nonprofitId?: number;
2461
2658
  isCanceled?: boolean;
2462
2659
  /** @enum {string} */
2463
- widgetName?: "community-impact" | "impact-overview" | "select-nonprofit" | "redeem-transaction" | "cumulative-impact" | "mobile-full-screen-nonprofit-selection" | "mobile-impact-list" | "mobile-minimal-nonprofit-selection" | "mobile-personal-impact" | "mobile-selected-nonprofit" | "mobile-progress-bar" | "select-nonprofit-cta" | "mobile-share-button" | "subscription-management" | "product-details-page";
2660
+ widgetName?: "community-impact" | "impact-overview" | "select-nonprofit" | "redeem-transaction" | "cumulative-impact" | "mobile-full-screen-nonprofit-selection" | "mobile-impact-list" | "mobile-minimal-nonprofit-selection" | "mobile-personal-impact" | "mobile-selected-nonprofit" | "mobile-progress-bar" | "select-nonprofit-cta" | "mobile-share-button" | "subscription-management" | "product-details-page" | "select-subscription-nonprofit" | "subscription-impact";
2464
2661
  version?: string;
2465
2662
  options?: {
2466
2663
  response?: {
@@ -2491,6 +2688,8 @@ interface paths {
2491
2688
  /** @description Id derived from partner services. Not the Beam subscription ID. */
2492
2689
  remoteSubscriptionId: string;
2493
2690
  nonprofitId: number | null;
2691
+ /** @enum {string|null} */
2692
+ selectionMethod?: ("cart" | "checkout" | "dashboard") | null;
2494
2693
  };
2495
2694
  };
2496
2695
  };
@@ -2704,7 +2903,7 @@ interface paths {
2704
2903
  parameters: {
2705
2904
  query: {
2706
2905
  chainId: number;
2707
- widgetName: "community-impact" | "impact-overview" | "select-nonprofit" | "redeem-transaction" | "cumulative-impact" | "mobile-full-screen-nonprofit-selection" | "mobile-impact-list" | "mobile-minimal-nonprofit-selection" | "mobile-personal-impact" | "mobile-selected-nonprofit" | "mobile-progress-bar" | "select-nonprofit-cta" | "mobile-share-button" | "subscription-management" | "product-details-page";
2906
+ widgetName: "community-impact" | "impact-overview" | "select-nonprofit" | "redeem-transaction" | "cumulative-impact" | "mobile-full-screen-nonprofit-selection" | "mobile-impact-list" | "mobile-minimal-nonprofit-selection" | "mobile-personal-impact" | "mobile-selected-nonprofit" | "mobile-progress-bar" | "select-nonprofit-cta" | "mobile-share-button" | "subscription-management" | "product-details-page" | "select-subscription-nonprofit" | "subscription-impact";
2708
2907
  version: string;
2709
2908
  };
2710
2909
  };
@@ -2756,7 +2955,7 @@ interface paths {
2756
2955
  /** @example 4058 */
2757
2956
  chainId: number;
2758
2957
  /** @enum {string} */
2759
- widgetName: "community-impact" | "impact-overview" | "select-nonprofit" | "redeem-transaction" | "cumulative-impact" | "mobile-full-screen-nonprofit-selection" | "mobile-impact-list" | "mobile-minimal-nonprofit-selection" | "mobile-personal-impact" | "mobile-selected-nonprofit" | "mobile-progress-bar" | "select-nonprofit-cta" | "mobile-share-button" | "subscription-management" | "product-details-page";
2958
+ widgetName: "community-impact" | "impact-overview" | "select-nonprofit" | "redeem-transaction" | "cumulative-impact" | "mobile-full-screen-nonprofit-selection" | "mobile-impact-list" | "mobile-minimal-nonprofit-selection" | "mobile-personal-impact" | "mobile-selected-nonprofit" | "mobile-progress-bar" | "select-nonprofit-cta" | "mobile-share-button" | "subscription-management" | "product-details-page" | "select-subscription-nonprofit" | "subscription-impact";
2760
2959
  /** @example 1.0 */
2761
2960
  version: string;
2762
2961
  config: {
@@ -2793,6 +2992,14 @@ interface paths {
2793
2992
  * @example Make your purchase a force for good
2794
2993
  */
2795
2994
  nonprofitUnselectedHeader?: string;
2995
+ /** @description An object containing dynamic strings for the widget. These strings serve as templates and include dynamic variables that vary based on the widget type. */
2996
+ dynamicStrings?: {
2997
+ [key: string]: string;
2998
+ } | null;
2999
+ /** @description An object containing additional static strings specific to each widget. These strings are unique to the widget and are not shared across different widgets. */
3000
+ additionalStrings?: {
3001
+ [key: string]: string;
3002
+ } | null;
2796
3003
  /** @description Disables counter animation for cumulative-impact widget */
2797
3004
  disableAnimation?: boolean;
2798
3005
  /** @description promo copy is sent in this object to be used in conditionally rendered UI components. This object serves as a repository for server-generated copy */
@@ -2891,6 +3098,14 @@ interface paths {
2891
3098
  * @example Make your purchase a force for good
2892
3099
  */
2893
3100
  nonprofitUnselectedHeader?: string;
3101
+ /** @description An object containing dynamic strings for the widget. These strings serve as templates and include dynamic variables that vary based on the widget type. */
3102
+ dynamicStrings?: {
3103
+ [key: string]: string;
3104
+ } | null;
3105
+ /** @description An object containing additional static strings specific to each widget. These strings are unique to the widget and are not shared across different widgets. */
3106
+ additionalStrings?: {
3107
+ [key: string]: string;
3108
+ } | null;
2894
3109
  /** @description Disables counter animation for cumulative-impact widget */
2895
3110
  disableAnimation?: boolean;
2896
3111
  /** @description promo copy is sent in this object to be used in conditionally rendered UI components. This object serves as a repository for server-generated copy */
@@ -5755,7 +5970,7 @@ interface paths {
5755
5970
  /** The version of the config */
5756
5971
  version: string;
5757
5972
  storeId: number;
5758
- widgetName?: "community-impact" | "impact-overview" | "select-nonprofit" | "redeem-transaction" | "cumulative-impact" | "mobile-full-screen-nonprofit-selection" | "mobile-impact-list" | "mobile-minimal-nonprofit-selection" | "mobile-personal-impact" | "mobile-selected-nonprofit" | "mobile-progress-bar" | "select-nonprofit-cta" | "mobile-share-button" | "subscription-management" | "product-details-page";
5973
+ widgetName?: "community-impact" | "impact-overview" | "select-nonprofit" | "redeem-transaction" | "cumulative-impact" | "mobile-full-screen-nonprofit-selection" | "mobile-impact-list" | "mobile-minimal-nonprofit-selection" | "mobile-personal-impact" | "mobile-selected-nonprofit" | "mobile-progress-bar" | "select-nonprofit-cta" | "mobile-share-button" | "subscription-management" | "product-details-page" | "select-subscription-nonprofit" | "subscription-impact";
5759
5974
  };
5760
5975
  };
5761
5976
  responses: {
@@ -5797,6 +6012,14 @@ interface paths {
5797
6012
  * @example Make your purchase a force for good
5798
6013
  */
5799
6014
  nonprofitUnselectedHeader?: string;
6015
+ /** @description An object containing dynamic strings for the widget. These strings serve as templates and include dynamic variables that vary based on the widget type. */
6016
+ dynamicStrings?: {
6017
+ [key: string]: string;
6018
+ } | null;
6019
+ /** @description An object containing additional static strings specific to each widget. These strings are unique to the widget and are not shared across different widgets. */
6020
+ additionalStrings?: {
6021
+ [key: string]: string;
6022
+ } | null;
5800
6023
  /** @description Disables counter animation for cumulative-impact widget */
5801
6024
  disableAnimation?: boolean;
5802
6025
  /** @description promo copy is sent in this object to be used in conditionally rendered UI components. This object serves as a repository for server-generated copy */
@@ -0,0 +1,2 @@
1
+ import{i as T}from"./lodash-P8OIs-at.esm.js";import{b as U,d as A,c as O,g as j}from"./events-_4nImo3u.esm.js";import{logger as k}from"../utils/logger.esm.js";import{initNetworkListeners as D}from"../utils/network-listeners.esm.js";import{createScopedLocalStorage as E}from"../utils/local-storage.esm.js";import{getCookieValue as w}from"../utils/cookies.esm.js";import{memoizeLast as J}from"../utils/memoize-last.esm.js";import{B as S}from"./cart-contents-h60geKWa.esm.js";import{K as y}from"./update-cart-05ZiT0Xf.esm.js";import{W as K,D as R}from"./routes-rmhOokKz.esm.js";import"../components/post-purchase.esm.js";import{waitForElement as M}from"../utils/wait-for-element.esm.js";import{B as x}from"./beam-errors-P-Lu07Ce.esm.js";const N=window.Shopify?.routes?.root||"/";let v=!1;const B="cart";async function P(a){if(v)return!1;const l=await C(a);await y(a,l.cart),await h({}),D(),window.addEventListener(U.eventName,async s=>{const i=s,n=/cart\/(add|change|update|clear)/,e=i.detail.type==="xhr"?i.detail.xhr.responseURL:i.detail.response.url,r=new URL(e);if(!n.test(r.pathname))return;const t=await C(a);if(!t.changed)return;const c={schema:t.cart.schema,content:{items:t.cart.content.items,discounts:t.cart.content.discounts}};window.dispatchEvent(new A(c)),await y(a,t.cart)});let d,m;return window.addEventListener(O.eventName,async s=>{const i=s,{source:n,selectedNonprofitId:e,selectionId:r}=i.detail;if(n===K.select_nonprofit){const t=await w(B),c=await w(S),{chainId:p,storeId:u}=a;if(d===e&&m===r)return;await h({selectedNonprofitId:e,selectionId:r,beamCartId:c,cartId:t,chainId:p,storeId:u}),m=r,d=e}}),window.addEventListener(j.eventName,async s=>{const i=s,{newNonprofitId:n,selectionId:e}=i.detail,r=await w(B),t=await w(S),{chainId:c,storeId:p}=a;d===n&&m===e||(await h({selectedNonprofitId:n,beamCartId:t,selectionId:e,cartId:r,chainId:c,storeId:p}),m=e,d=n)}),v=!0,!0}async function C(a){const{token:l,total_price:d,item_count:m,currency:s,items:i,cart_level_discount_applications:n}=await window.fetch(N+"cart.js",{method:"GET",headers:{"Content-Type":"application/json"}}).then(c=>c.json()),e={cartId:l,subtotal:d/100,itemCount:m,currencyCode:s,schema:{source:"generic"},content:{items:i.map(({sku:c,final_line_price:p,product_id:u,line_level_discount_allocations:_})=>{const g=c||String(u),f=p/100,I=_?.map(({discount_application:o})=>({code:o?.title,applicable:!0}));return{remoteProductIdentifier:g,localAmount:f,discounts:I}}),discounts:n.map(({title:c})=>({code:c,applicable:!0}))}};let r=!1;const t=E(a).getItemJson("cart");return T(e,t)||(r=!0),{changed:r,cart:e}}const W=y,h=J(async function({selectedNonprofitId:a,selectionId:l,beamCartId:d,cartId:m,chainId:s,storeId:i}){let n,e;if(window.statsig){const t=window.statsig;n=t.getLayer("beam_trial_layer").get("show_beam",!1),e=t.getStableID()}const r={beam:JSON.stringify({nonprofit_id:a,selection_id:l,beam_cart_id:d,shopify_cart_id:m,chain_id:s,store_id:i,show_beam:n,remote_session_id:e})};try{await window.fetch(N+"cart/update.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({attributes:r})})}catch(t){k.error(t)}});async function q({parentSelector:a=".step__sections",apiKey:l,baseUrl:d=R,storeId:m,postalCode:s,countryCode:i,orderId:n,email:e,cartTotal:r,cart:t,discountCodes:c,currencyCode:p="USD",domain:u,lang:_="en",debug:g=!1}){const f=document.querySelector(a)||await M(a);if(!f)throw new x(`Timed out waiting for selector '${a}'. Could not render Beam post-purchase widget.`);const I=await w("cart");if(I){const b=E({apiKey:l}),L=b.getItemJson("cart")||{};b.setItemJson("cart",{...L,cartId:I})}const o=document.createElement("beam-post-purchase");o.apiKey=l,o.baseUrl=d,o.storeId=m,o.postalCode=s,o.countryCode=i,o.orderId=String(n),o.email=e,o.cartTotal=r,o.cart=t,o.discountCodes=c,o.currencyCode=p,o.domain=u,o.lang=_,o.debug=g,f.appendChild(o)}export{C as I,P as M,W as U,h as p,q as s};
2
+ //# sourceMappingURL=order-page-4qPr8vqZ.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"order-page-4qPr8vqZ.esm.js","sources":["../../src/integrations/shopify/cart-page.ts","../../src/integrations/shopify/order-page.ts"],"sourcesContent":["/* eslint-disable camelcase */\nimport isEqual from \"lodash-es/isEqual\";\nimport { logger, memoizeLast } from \"../../utils\";\nimport { getCookieValue } from \"../../utils/cookies\";\nimport { initNetworkListeners } from \"../../utils/network-listeners\";\nimport {\n BeamCartChangeEvent,\n BeamNetworkCallEvent,\n BeamNonprofitSelectEvent,\n BeamNonprofitSelectionRemovedEvent,\n} from \"../../utils/events\";\nimport { createScopedLocalStorage } from \"../../utils/local-storage\";\nimport { BEAM_CART_COOKIE_NAME, TCart, TCartApi, TCartItems } from \"../../shared/cart-contents\";\nimport { BeamCartAPIConfig, updateCart } from \"../cart\";\nimport { WIDGET_NAMES } from \"../../api-sdk/constants\";\n\ntype BeamShopifyCartIntegrationConfig = BeamCartAPIConfig & {\n storeId: number; // will be added to cart custom_attributes, and used in cart API call\n chainId?: number; // will be added to cart custom_attributes\n};\n\ntype ShopifyDiscountApplication = {\n title: string;\n value: string;\n};\n\ntype ShopifyLineLevelDiscountAllocations = {\n amount?: string;\n discount_application: ShopifyDiscountApplication;\n};\n\nconst SHOPIFY_BASE_URL = window.Shopify?.routes?.root || \"/\"; // see window.d.ts\n\nlet isBeamCartIntegrationRegistered = false; // Skip registering event listeners if already set up\n\nconst SHOPIFY_CART_COOKIE_NAME = \"cart\";\n\n/**\n * @main registerCartIntegration - set up event listeners to integrate Beam with Shopify cart\n * @return {boolean} returns true if NEW listeners were created, false if setup was already done\n */\nasync function registerCartIntegration(config: BeamShopifyCartIntegrationConfig) {\n if (isBeamCartIntegrationRegistered) {\n return false; // Do nothing if listeners are already attached\n }\n\n // Handle full-page load, ie, first-time page load and reloads from form submit events\n // This creates a GET to /cart.js\n const currentCart = await getCurrentCart(config);\n await updateCart(config, currentCart.cart);\n // pre load beam cart attribute to save statsig info\n await addBeamAttributesToCart({});\n // Set up event listeners for AJAX events\n initNetworkListeners();\n\n window.addEventListener(BeamNetworkCallEvent.eventName, async (_event: Event) => {\n const event = _event as BeamNetworkCallEvent;\n const cartChangePaths = /cart\\/(add|change|update|clear)/;\n // note: response urls below follow redirects\n const requestUrlStr = event.detail.type === \"xhr\" ? event.detail.xhr.responseURL : event.detail.response.url;\n const url = new URL(requestUrlStr);\n if (!cartChangePaths.test(url.pathname)) {\n return;\n }\n const currentCart = await getCurrentCart(config);\n if (!currentCart.changed) {\n return;\n }\n const eventDetail: TCartApi = {\n schema: currentCart.cart.schema as any, // TS union type can't figure out what variant applies here\n content: {\n items: currentCart.cart.content.items as any,\n discounts: currentCart.cart.content.discounts as any,\n },\n };\n window.dispatchEvent(new BeamCartChangeEvent(eventDetail));\n // Send cart to Beam to update timestamp, which is used for cart abandonment / ROI calc\n await updateCart(config, currentCart.cart);\n });\n\n // Listen to Beam's own events to integrate Beam data into Shopify order\n let lastNonprofitId: number | null | undefined;\n let lastSelectionId: string | null | undefined;\n window.addEventListener(BeamNonprofitSelectEvent.eventName, async (_event) => {\n const event = _event as BeamNonprofitSelectEvent;\n const { source, selectedNonprofitId, selectionId } = event.detail;\n\n if (source === WIDGET_NAMES.select_nonprofit) {\n const cartId = await getCookieValue(SHOPIFY_CART_COOKIE_NAME); // Shopify cart ID cookie\n const beamCartId = await getCookieValue(BEAM_CART_COOKIE_NAME); // Beam cart ID cookie\n const { chainId, storeId } = config;\n // Skip update if nothing changed (can happen if widget is re-initialized and\n // emits event after cache restoration, i.e., on cart re-render).\n if (lastNonprofitId === selectedNonprofitId && lastSelectionId === selectionId) {\n return;\n }\n await addBeamAttributesToCart({\n selectedNonprofitId,\n selectionId,\n beamCartId,\n cartId,\n chainId,\n storeId,\n });\n lastSelectionId = selectionId;\n lastNonprofitId = selectedNonprofitId;\n }\n });\n\n /**\n * Upon removal of the selected nonprofit from the widget and local storage,\n * an event is emitted and that event is then used to update the cart attributes accordingly\n * This event listener updates the cart attributes based on the emitted event\n */\n window.addEventListener(BeamNonprofitSelectionRemovedEvent.eventName, async (_event) => {\n const event = _event as BeamNonprofitSelectionRemovedEvent;\n const { newNonprofitId, selectionId } = event.detail;\n const cartId = await getCookieValue(SHOPIFY_CART_COOKIE_NAME);\n const beamCartId = await getCookieValue(BEAM_CART_COOKIE_NAME);\n const { chainId, storeId } = config;\n if (lastNonprofitId === newNonprofitId && lastSelectionId === selectionId) {\n return;\n }\n await addBeamAttributesToCart({\n selectedNonprofitId: newNonprofitId,\n beamCartId,\n selectionId,\n cartId,\n chainId,\n storeId,\n });\n lastSelectionId = selectionId;\n lastNonprofitId = newNonprofitId;\n });\n\n isBeamCartIntegrationRegistered = true;\n\n return true;\n}\n\n/* ***************************************** HELPER FUNCTIONS *****************************************\n These may be used individually to integrate with carts if the registerCartIntegration\n script doesn't work for some reason.\n ****************************************************************************************************/\n\n/**\n * Detects change in cart since last page load,\n * by calling GET /cart.js, and returns cart values.\n * Used for:\n * - Form-based carts where the page refreshes to modify cart instead of using AJAX calls\n * - Hydrogen/GraphQL based carts (needs to be integrated manually)\n */\nasync function getCurrentCart(config: BeamShopifyCartIntegrationConfig): Promise<{\n changed: boolean;\n cart: {\n cartId: string;\n subtotal: number;\n itemCount: number;\n currencyCode: string;\n } & TCart;\n}> {\n const {\n token, // equal to \"cart\" cookie\n total_price, // this is the pretax value, after discounts, and multiplied by 100 (integer from decimal)\n item_count,\n currency,\n items,\n cart_level_discount_applications,\n } = await window\n .fetch(SHOPIFY_BASE_URL + \"cart.js\", {\n method: \"GET\",\n headers: { \"Content-Type\": \"application/json\" },\n })\n .then((res) => res.json());\n\n const cart = {\n cartId: token,\n subtotal: total_price / 100,\n itemCount: item_count,\n currencyCode: currency,\n schema: { source: \"generic\" } as const,\n content: {\n // pull out minimal fields from full line items\n items: (items as TCartItems).map(({ sku, final_line_price, product_id, line_level_discount_allocations }) => {\n const remoteProductIdentifier = sku || String(product_id);\n const localAmount = final_line_price / 100;\n const discounts = (line_level_discount_allocations as ShopifyLineLevelDiscountAllocations[])?.map(\n ({ discount_application }) => {\n return { code: discount_application?.title, applicable: true };\n }\n );\n return { remoteProductIdentifier, localAmount, discounts };\n }),\n discounts: (cart_level_discount_applications as ShopifyDiscountApplication[]).map(({ title }) => {\n return { code: title, applicable: true };\n }),\n },\n };\n\n let changed = false;\n\n const localStorage = createScopedLocalStorage(config);\n\n const cachedCart = localStorage.getItemJson(\"cart\");\n\n if (!isEqual(cart, cachedCart)) {\n changed = true;\n }\n\n return { changed, cart };\n}\n\n/**\n * trackCart - Backwards-compatible alias for updateCart\n */\nconst trackCart = updateCart;\n\n/**\n * Sends Beam data to Shopify to integrate with order as custom attributes.\n * Memoized so that calls with the same data as the previous don't create additional API calls to Shopify.\n */\nconst addBeamAttributesToCart = memoizeLast(async function addBeamAttributesToCart({\n selectedNonprofitId,\n selectionId,\n beamCartId,\n cartId,\n chainId,\n storeId,\n}: {\n selectedNonprofitId?: number | null;\n selectionId?: string;\n beamCartId?: string;\n cartId?: string;\n chainId?: number;\n storeId?: number;\n}) {\n let showBeam;\n let remoteSessionId;\n if (window.statsig) {\n const statsig = window.statsig as any;\n showBeam = statsig.getLayer(\"beam_trial_layer\").get(\"show_beam\", false /* default to hide */) as boolean;\n remoteSessionId = statsig.getStableID();\n }\n const beamCartAttrs = {\n beam: JSON.stringify({\n nonprofit_id: selectedNonprofitId,\n selection_id: selectionId,\n beam_cart_id: beamCartId,\n shopify_cart_id: cartId,\n chain_id: chainId,\n store_id: storeId,\n show_beam: showBeam,\n remote_session_id: remoteSessionId,\n }),\n };\n\n try {\n await window.fetch(SHOPIFY_BASE_URL + \"cart/update.js\", {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({ attributes: beamCartAttrs }),\n });\n } catch (err) {\n logger.error(err); // don't throw, allow later calls to continue\n }\n});\n\ndeclare global {\n interface Window {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n statsig?: any; // attached by Statsig CDN script\n }\n}\nexport { trackCart, getCurrentCart, addBeamAttributesToCart, registerCartIntegration };\n","import \"../../components/post-purchase\";\nimport { postTransaction } from \"../../api-sdk/v3/routes\";\nimport { DEFAULT_BASE_URL } from \"../../api-sdk/constants\";\nimport { LANGUAGES, TUrl } from \"../../api-sdk/types\";\nimport { waitForElement } from \"../../utils/wait-for-element\";\nimport { BeamError } from \"../../utils/beam-errors\";\nimport { getCookieValue } from \"../../utils/cookies\";\nimport { createScopedLocalStorage } from \"../../utils/local-storage\";\nimport { TCart } from \"../../shared/cart-contents\";\n\n// Shopify admin page: admin/settings/checkout\n\nexport type TBeamOrderPageParams = Parameters<typeof postTransaction>[0][\"requestBody\"] & {\n // Either storeId or postalCode + countryCode must be provided\n storeId?: number;\n postalCode?: string;\n countryCode?: string;\n orderId: string;\n email: string;\n cartTotal: number;\n cart: TCart;\n discountCodes: string[];\n currencyCode: string;\n parentSelector: string; // CSS Selector for parent of widget to be inserted into DOM\n apiKey: string;\n baseUrl: TUrl;\n domain?: string; // Base domain for setting cookies\n lang: LANGUAGES;\n debug: boolean;\n};\n\nexport async function showBeamOrderPageWidgets({\n parentSelector = \".step__sections\",\n apiKey,\n baseUrl = DEFAULT_BASE_URL,\n storeId,\n postalCode,\n countryCode,\n orderId,\n email,\n cartTotal,\n cart,\n discountCodes,\n currencyCode = \"USD\",\n domain,\n lang = \"en\",\n debug = false,\n}: TBeamOrderPageParams) {\n const parentElement = document.querySelector(parentSelector) || (await waitForElement(parentSelector));\n if (!parentElement) {\n throw new BeamError(\n `Timed out waiting for selector '${parentSelector}'. Could not render Beam post-purchase widget.`\n );\n }\n\n // If checkout and order page are on different subdomains, we can't access localStorage\n // We can make postTransaction work by copying the cart cookie to the expected localStorage key on the current domain\n const cartId = await getCookieValue(\"cart\"); // Shopify-only cart identifier\n if (cartId) {\n const beamLocalStorage = createScopedLocalStorage({ apiKey });\n const existingValue = beamLocalStorage.getItemJson(\"cart\") || {};\n beamLocalStorage.setItemJson(\"cart\", { ...existingValue, cartId });\n }\n\n // Note: assign properties one by one instead of bulk Object.assign to type check assignments\n const widget = document.createElement(\"beam-post-purchase\");\n widget.apiKey = apiKey;\n widget.baseUrl = baseUrl;\n widget.storeId = storeId;\n widget.postalCode = postalCode;\n widget.countryCode = countryCode;\n widget.orderId = String(orderId);\n widget.email = email;\n widget.cartTotal = cartTotal;\n widget.cart = cart;\n widget.discountCodes = discountCodes;\n widget.currencyCode = currencyCode;\n widget.domain = domain;\n widget.lang = lang;\n widget.debug = debug;\n\n // Insert widget into DOM\n parentElement.appendChild(widget);\n}\n"],"names":["SHOPIFY_BASE_URL","isBeamCartIntegrationRegistered","SHOPIFY_CART_COOKIE_NAME","registerCartIntegration","config","currentCart","getCurrentCart","updateCart","addBeamAttributesToCart","initNetworkListeners","BeamNetworkCallEvent","_event","event","cartChangePaths","requestUrlStr","url","eventDetail","BeamCartChangeEvent","lastNonprofitId","lastSelectionId","BeamNonprofitSelectEvent","source","selectedNonprofitId","selectionId","WIDGET_NAMES","cartId","getCookieValue","beamCartId","BEAM_CART_COOKIE_NAME","chainId","storeId","BeamNonprofitSelectionRemovedEvent","newNonprofitId","token","total_price","item_count","currency","items","cart_level_discount_applications","res","cart","sku","final_line_price","product_id","line_level_discount_allocations","remoteProductIdentifier","localAmount","discounts","discount_application","title","changed","cachedCart","createScopedLocalStorage","isEqual","trackCart","memoizeLast","showBeam","remoteSessionId","statsig","beamCartAttrs","err","logger","showBeamOrderPageWidgets","parentSelector","apiKey","baseUrl","DEFAULT_BASE_URL","postalCode","countryCode","orderId","email","cartTotal","discountCodes","currencyCode","domain","lang","debug","parentElement","waitForElement","BeamError","beamLocalStorage","existingValue","widget"],"mappings":"8tBA+BA,MAAMA,EAAmB,OAAO,SAAS,QAAQ,MAAQ,IAEzD,IAAIC,EAAkC,GAEtC,MAAMC,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