@beamimpact/web-sdk 1.36.7 → 1.36.8

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 (172) hide show
  1. package/dist/chunks/_share-dialog-dependencies-FglfQ7YP.esm.js +2 -0
  2. package/dist/chunks/_share-dialog-dependencies-FglfQ7YP.esm.js.map +1 -0
  3. package/dist/chunks/_share-dialog-dependencies-YbNiVx56.esm.js +2 -0
  4. package/dist/chunks/_share-dialog-dependencies-YbNiVx56.esm.js.map +1 -0
  5. package/dist/chunks/beam-errors-P-Lu07Ce.esm.js +2 -0
  6. package/dist/chunks/beam-errors-P-Lu07Ce.esm.js.map +1 -0
  7. package/dist/chunks/{beam-errors-bKCZlkvr.esm.d.ts → beam-errors-fXDkG1zo.esm.d.ts} +7 -2
  8. package/dist/chunks/enforce-config-fo8kIfoY.esm.js +22 -0
  9. package/dist/chunks/{enforce-config-MqLZWolV.esm.js.map → enforce-config-fo8kIfoY.esm.js.map} +1 -1
  10. package/dist/chunks/enforce-config-qna7hEL6.esm.js +22 -0
  11. package/dist/chunks/{enforce-config-n0D_zfMC.esm.js.map → enforce-config-qna7hEL6.esm.js.map} +1 -1
  12. package/dist/chunks/index-1qXot92e.esm.js +2 -0
  13. package/dist/chunks/index-1qXot92e.esm.js.map +1 -0
  14. package/dist/chunks/{index-FAF7tYU6.esm.js → index-9gijHGwh.esm.js} +2 -2
  15. package/dist/chunks/index-9gijHGwh.esm.js.map +1 -0
  16. package/dist/chunks/{index-3ThDVYOT.esm.d.ts → index-EZ_Bg1n7.esm.d.ts} +1 -1
  17. package/dist/chunks/index-EpanGShY.esm.js +2 -0
  18. package/dist/chunks/index-EpanGShY.esm.js.map +1 -0
  19. package/dist/chunks/{index-kuEhVQcF.esm.d.ts → index-GkPHba-I.esm.d.ts} +1 -1
  20. package/dist/chunks/{index-uqEAgdEf.esm.js → index-OnjTwvAw.esm.js} +2 -2
  21. package/dist/chunks/index-OnjTwvAw.esm.js.map +1 -0
  22. package/dist/chunks/{index-rrdYIcOi.esm.js → index-U8Oy2aur.esm.js} +2 -2
  23. package/dist/chunks/index-U8Oy2aur.esm.js.map +1 -0
  24. package/dist/chunks/index-XMD0b6ql.esm.js +2 -0
  25. package/dist/chunks/index-XMD0b6ql.esm.js.map +1 -0
  26. package/dist/chunks/{index-hC71uT32.esm.js → index-fqDBrscF.esm.js} +2 -2
  27. package/dist/chunks/{index-hC71uT32.esm.js.map → index-fqDBrscF.esm.js.map} +1 -1
  28. package/dist/chunks/{index-MAsTKsZm.esm.js → index-gULINFkH.esm.js} +2 -2
  29. package/dist/chunks/{index-MAsTKsZm.esm.js.map → index-gULINFkH.esm.js.map} +1 -1
  30. package/dist/chunks/index-ll8zLjbu.esm.js +2 -0
  31. package/dist/chunks/index-ll8zLjbu.esm.js.map +1 -0
  32. package/dist/chunks/{index-tfP1RBZU.esm.d.ts → index-pDraUd1x.esm.d.ts} +1 -1
  33. package/dist/chunks/index-r9Yb1UY4.esm.js +2 -0
  34. package/dist/chunks/index-r9Yb1UY4.esm.js.map +1 -0
  35. package/dist/chunks/index-t4uX5Dg1.esm.js +2 -0
  36. package/dist/chunks/index-t4uX5Dg1.esm.js.map +1 -0
  37. package/dist/chunks/{index-w9_XpjIg.esm.js → index-wsdeaTHd.esm.js} +2 -2
  38. package/dist/chunks/index-wsdeaTHd.esm.js.map +1 -0
  39. package/dist/chunks/{localize-eZMViIud.esm.js → localize-GCkVUD8S.esm.js} +2 -2
  40. package/dist/chunks/{localize-eZMViIud.esm.js.map → localize-GCkVUD8S.esm.js.map} +1 -1
  41. package/dist/chunks/{localize-0rA0DbzI.esm.js → localize-pzAAkBvG.esm.js} +2 -2
  42. package/dist/chunks/{localize-0rA0DbzI.esm.js.map → localize-pzAAkBvG.esm.js.map} +1 -1
  43. package/dist/chunks/{order-page-PGTQXoSr.esm.js → order-page-JdaAppB7.esm.js} +2 -2
  44. package/dist/chunks/{order-page-PGTQXoSr.esm.js.map → order-page-JdaAppB7.esm.js.map} +1 -1
  45. package/dist/chunks/{order-page-MyFrJe1o.esm.js → order-page-W1jR35W9.esm.js} +2 -2
  46. package/dist/chunks/{order-page-MyFrJe1o.esm.js.map → order-page-W1jR35W9.esm.js.map} +1 -1
  47. package/dist/chunks/routes-CqjzL4oL.esm.js +2 -0
  48. package/dist/chunks/{routes-USQ3n64Y.esm.js.map → routes-CqjzL4oL.esm.js.map} +1 -1
  49. package/dist/chunks/routes-lsOWIDmE.esm.js +2 -0
  50. package/dist/chunks/{routes-wPiw5U5n.esm.js.map → routes-lsOWIDmE.esm.js.map} +1 -1
  51. package/dist/chunks/{update-cart-OkpQAdyP.esm.js → update-cart-T32-282v.esm.js} +2 -2
  52. package/dist/chunks/{update-cart-OkpQAdyP.esm.js.map → update-cart-T32-282v.esm.js.map} +1 -1
  53. package/dist/chunks/{update-cart-8xlajjFj.esm.js → update-cart-yneR8zk1.esm.js} +2 -2
  54. package/dist/chunks/{update-cart-8xlajjFj.esm.js.map → update-cart-yneR8zk1.esm.js.map} +1 -1
  55. package/dist/components/community-impact.esm.js +2 -1
  56. package/dist/components/community-impact.esm.js.map +1 -1
  57. package/dist/components/community-impact.js +2 -1
  58. package/dist/components/community-impact.js.map +1 -1
  59. package/dist/components/cumulative-impact.esm.js +2 -1
  60. package/dist/components/cumulative-impact.esm.js.map +1 -1
  61. package/dist/components/cumulative-impact.js +2 -1
  62. package/dist/components/cumulative-impact.js.map +1 -1
  63. package/dist/components/impact-overview.esm.js +2 -1
  64. package/dist/components/impact-overview.esm.js.map +1 -1
  65. package/dist/components/impact-overview.js +2 -1
  66. package/dist/components/impact-overview.js.map +1 -1
  67. package/dist/components/index.esm.js +1 -1
  68. package/dist/components/index.js +1 -1
  69. package/dist/components/post-purchase.d.ts +1 -1
  70. package/dist/components/post-purchase.esm.js +1 -1
  71. package/dist/components/post-purchase.js +1 -1
  72. package/dist/components/redeem-transaction.d.ts +14 -4
  73. package/dist/components/redeem-transaction.esm.js +12 -11
  74. package/dist/components/redeem-transaction.esm.js.map +1 -1
  75. package/dist/components/redeem-transaction.js +12 -11
  76. package/dist/components/redeem-transaction.js.map +1 -1
  77. package/dist/components/select-nonprofit.d.ts +1 -1
  78. package/dist/components/select-nonprofit.esm.js +2 -1
  79. package/dist/components/select-nonprofit.esm.js.map +1 -1
  80. package/dist/components/select-nonprofit.js +2 -1
  81. package/dist/components/select-nonprofit.js.map +1 -1
  82. package/dist/components/shopify.d.ts +1 -1
  83. package/dist/components/shopify.esm.js +1 -1
  84. package/dist/components/shopify.js +1 -1
  85. package/dist/components/subscription-management.d.ts +1 -1
  86. package/dist/components/subscription-management.esm.js +13 -3
  87. package/dist/components/subscription-management.esm.js.map +1 -1
  88. package/dist/components/subscription-management.js +13 -3
  89. package/dist/components/subscription-management.js.map +1 -1
  90. package/dist/index.d.ts +4 -4
  91. package/dist/index.esm.js +1 -1
  92. package/dist/index.js +1 -1
  93. package/dist/integrations/beam.esm.js +1 -1
  94. package/dist/integrations/beam.js +1 -1
  95. package/dist/integrations/cart.esm.js +1 -1
  96. package/dist/integrations/cart.js +1 -1
  97. package/dist/integrations/index.d.ts +2 -2
  98. package/dist/integrations/index.esm.js +1 -1
  99. package/dist/integrations/index.js +1 -1
  100. package/dist/integrations/logs.esm.js +1 -1
  101. package/dist/integrations/logs.js +1 -1
  102. package/dist/integrations/session.esm.js +1 -1
  103. package/dist/integrations/session.js +1 -1
  104. package/dist/integrations/shopify.esm.js +1 -1
  105. package/dist/integrations/shopify.js +1 -1
  106. package/dist/integrations/statsig.esm.js +1 -1
  107. package/dist/integrations/statsig.js +1 -1
  108. package/dist/integrations/utils.d.ts +1 -1
  109. package/dist/integrations/utils.esm.js +1 -1
  110. package/dist/integrations/utils.js +1 -1
  111. package/dist/react/community-impact.esm.js +1 -1
  112. package/dist/react/community-impact.js +1 -1
  113. package/dist/react/cumulative-impact.esm.js +1 -1
  114. package/dist/react/cumulative-impact.js +1 -1
  115. package/dist/react/impact-overview.esm.js +1 -1
  116. package/dist/react/impact-overview.js +1 -1
  117. package/dist/react/index.esm.js +1 -1
  118. package/dist/react/index.js +1 -1
  119. package/dist/react/post-purchase.esm.js +1 -1
  120. package/dist/react/post-purchase.js +1 -1
  121. package/dist/react/redeem-transaction.esm.js +1 -1
  122. package/dist/react/redeem-transaction.js +1 -1
  123. package/dist/react/select-nonprofit.esm.js +1 -1
  124. package/dist/react/select-nonprofit.js +1 -1
  125. package/dist/react/subscription-management.esm.js +1 -1
  126. package/dist/react/subscription-management.esm.js.map +1 -1
  127. package/dist/react/subscription-management.js +1 -1
  128. package/dist/react/subscription-management.js.map +1 -1
  129. package/dist/utils/beam-errors.d.ts +1 -1
  130. package/dist/utils/beam-errors.esm.js +1 -1
  131. package/dist/utils/beam-errors.js +1 -1
  132. package/dist/utils/cookies.d.ts +1 -1
  133. package/dist/utils/cookies.esm.js +1 -1
  134. package/dist/utils/cookies.esm.js.map +1 -1
  135. package/dist/utils/cookies.js +1 -1
  136. package/dist/utils/cookies.js.map +1 -1
  137. package/dist/utils/index.d.ts +1 -1
  138. package/dist/utils/index.esm.js +1 -1
  139. package/dist/utils/index.js +1 -1
  140. package/dist/utils/local-storage.esm.js +1 -1
  141. package/dist/utils/local-storage.js +1 -1
  142. package/dist/utils/remote-session.esm.js +1 -1
  143. package/dist/utils/remote-session.js +1 -1
  144. package/dist/utils/wait-for-element.esm.js +1 -1
  145. package/dist/utils/wait-for-element.js +1 -1
  146. package/package.json +1 -1
  147. package/dist/chunks/_share-dialog-dependencies-BGBxD2DS.esm.js +0 -2
  148. package/dist/chunks/_share-dialog-dependencies-BGBxD2DS.esm.js.map +0 -1
  149. package/dist/chunks/_share-dialog-dependencies-l3E6m-4b.esm.js +0 -2
  150. package/dist/chunks/_share-dialog-dependencies-l3E6m-4b.esm.js.map +0 -1
  151. package/dist/chunks/beam-errors-AMvTvR1C.esm.js +0 -2
  152. package/dist/chunks/beam-errors-AMvTvR1C.esm.js.map +0 -1
  153. package/dist/chunks/enforce-config-MqLZWolV.esm.js +0 -22
  154. package/dist/chunks/enforce-config-n0D_zfMC.esm.js +0 -22
  155. package/dist/chunks/index-0CUzV2-m.esm.js +0 -2
  156. package/dist/chunks/index-0CUzV2-m.esm.js.map +0 -1
  157. package/dist/chunks/index-0JdRzhqA.esm.js +0 -2
  158. package/dist/chunks/index-0JdRzhqA.esm.js.map +0 -1
  159. package/dist/chunks/index-6hf6jo8u.esm.js +0 -2
  160. package/dist/chunks/index-6hf6jo8u.esm.js.map +0 -1
  161. package/dist/chunks/index-8G1d1I0a.esm.js +0 -2
  162. package/dist/chunks/index-8G1d1I0a.esm.js.map +0 -1
  163. package/dist/chunks/index-FAF7tYU6.esm.js.map +0 -1
  164. package/dist/chunks/index-L6UcfXYR.esm.js +0 -2
  165. package/dist/chunks/index-L6UcfXYR.esm.js.map +0 -1
  166. package/dist/chunks/index-m6tLtpwd.esm.js +0 -2
  167. package/dist/chunks/index-m6tLtpwd.esm.js.map +0 -1
  168. package/dist/chunks/index-rrdYIcOi.esm.js.map +0 -1
  169. package/dist/chunks/index-uqEAgdEf.esm.js.map +0 -1
  170. package/dist/chunks/index-w9_XpjIg.esm.js.map +0 -1
  171. package/dist/chunks/routes-USQ3n64Y.esm.js +0 -2
  172. package/dist/chunks/routes-wPiw5U5n.esm.js +0 -2
@@ -1 +1 @@
1
- {"version":3,"file":"select-nonprofit.js","sources":["../../src/components/select-nonprofit/strings.ts","../../src/components/select-nonprofit/index.ts"],"sourcesContent":["export const strings = {\n en: {\n beamAttribution: () => `Powered by Beam`,\n ctaTitle: () => `Choose your impact`,\n ctaMessage: ({ donationPercentage = \"1\" } = {}) =>\n `Select a nonprofit and ${donationPercentage}% of your purchase will be donated, at no extra cost.`,\n inlineSeparator: () => `: `,\n },\n fr: {\n beamAttribution: () => `Optimisé par Beam`,\n ctaTitle: () => `Choisissez votre cause`,\n ctaMessage: ({ donationPercentage = \"1\" } = {}) =>\n `Choisissez un organisme à but non lucratif et ${donationPercentage} % lui sera versé en votre nom, sans frais supplémentaires.`,\n inlineSeparator: () => ` : `,\n },\n de: {\n beamAttribution: () => `Unterstützt von Beam`,\n ctaTitle: () => `Wähle deinen Impact`,\n ctaMessage: ({ donationPercentage = \"1\" } = {}) =>\n `Wähle eine der gemeinnützigen Organisationen und spende ${donationPercentage}% deines Einkaufs ohne zusätzliche Kosten`,\n inlineSeparator: () => `: `,\n },\n es: {\n beamAttribution: () => \"Ofrecido por Beam\",\n ctaTitle: () => \"Elige tu contribución\",\n ctaMessage: ({ donationPercentage = \"1\" } = {}) =>\n `Elige una organización sin fines de lucro y donaremos ${donationPercentage}% de tu compra sin coste adicional.`,\n inlineSeparator: () => \": \",\n },\n it: {\n beamAttribution: () => \"Gestito da Beam\",\n ctaTitle: () => \"Scegli dove fare la differenza\",\n ctaMessage: ({ donationPercentage = \"1\" } = {}) =>\n `Seleziona un'organizzazione no-profit a cui devolvere l’${donationPercentage}% del tuo acquisto, senza costi aggiuntivi`,\n inlineSeparator: () => \": \",\n },\n pl: {\n beamAttribution: () => `Wspierany przez Beam`,\n ctaTitle: () => `Wybierz inicjatywę, którą chcesz wesprzeć`,\n ctaMessage: ({ donationPercentage = \"1\" } = {}) =>\n `Wybierz organizację, której przekażesz ${donationPercentage}% wartości Twoich zakupów – bez żadnych dodatkowych kosztów!`,\n inlineSeparator: () => `: `,\n },\n};\n","import { css, html, LitElement, PropertyValues } from \"lit\";\nimport { repeat } from \"lit/directives/repeat.js\";\nimport { unsafeHTML } from \"lit/directives/unsafe-html.js\";\nimport { property } from \"lit/decorators/property.js\";\nimport { styleMap } from \"lit/directives/style-map.js\";\nimport { AsyncController } from \"../../shared/controllers/async-controller\";\nimport { DEFAULT_BASE_URL, SUPPORTED_LANGUAGES } from \"../../api-sdk/constants\";\nimport \"../../shared/components/progress-bar\";\nimport { defineCustomElement } from \"../../shared/defineCustomElement\";\nimport { _loading } from \"../../shared/fragments/loading-template\";\nimport { _errorMessage } from \"../../shared/fragments/error-message-template\";\nimport { defineCustomText, useCustomText } from \"../../shared/fragments/custom-text\";\nimport { cssReset } from \"../../shared/css-reset\";\nimport { _cssVariableMap } from \"../../shared/fragments/css-variable-map\";\nimport { enforceConfig } from \"../../shared/enforce-config\";\nimport { isEqual } from \"../../utils\";\nimport { MissingConfig } from \"../../utils/beam-errors\";\nimport { TNumericId } from \"../../shared/types\";\nimport { createScopedLocalStorage } from \"../../utils/local-storage\";\nimport { postChainEligibleNonprofitsForCart, postSelectNonprofit } from \"../../api-sdk/v3/routes\";\nimport { LANGUAGES } from \"../../api-sdk/types\";\nimport { BeamCartChangeEvent, BeamNonprofitSelectEvent } from \"../../utils/events\";\nimport { getCookieValue } from \"../../utils/cookies\";\nimport { localizeUserString } from \"../../shared/localize\";\nimport { progressBarConfigDefaults } from \"../../shared/components/progress-bar\";\nimport { cssResponsiveUtils } from \"../../shared/responsive\";\nimport { BEAM_CART_COOKIE_NAME, TBeamCartLocalStorage, TCart } from \"../../shared/cart-contents\";\nimport { strings } from \"./strings\";\n\ninterface RequiredConfig {\n apiKey: string;\n storeId: TNumericId; // Can be set async by postalCode + countryCode lookup\n}\n\nexport class BeamSelectNonprofit extends LitElement {\n static tagName = \"beam-select-nonprofit\";\n\n @property({ type: String }) public baseUrl: string = DEFAULT_BASE_URL;\n\n @property({ type: String }) public apiKey?: RequiredConfig[\"apiKey\"];\n\n // storeId can be omitted if countryCode + postalCode are provided\n @property({ type: Number, reflect: true }) public storeId?: TNumericId;\n\n @property({ type: String }) public countryCode?: string;\n\n @property({ type: String }) public postalCode?: string;\n\n @property({ attribute: false, hasChanged: (a, b) => !isEqual(a, b) }) public cart?: TCart;\n\n @property({ type: Number, reflect: true }) public selectedNonprofitId: TNumericId | null = null;\n\n @property({ type: String }) public lang: LANGUAGES = \"en\";\n\n @property({ type: Boolean }) public debug = false;\n\n private enableNonprofitDeselection = false;\n\n private selectionId?: string;\n\n private didTryToCreateNewSelectionFromCache = false; // Should only create selection once\n\n get configLang() {\n return SUPPORTED_LANGUAGES[this.lang] || \"en\";\n }\n\n private getChainNonprofits = async () => {\n if (!enforceConfig<RequiredConfig>([\"apiKey\"], this)) {\n throw new MissingConfig();\n }\n\n const cart: any = this.cart?.content\n ? {\n schema: this.cart?.schema,\n content: this.cart?.content,\n }\n : undefined;\n\n // We use a POST method because we send a nested JSON with data that we don't want to serialize/expose in URL\n const res = await postChainEligibleNonprofitsForCart({\n baseUrl: this.baseUrl,\n apiRoot: \"/api/v3\",\n headers: {\n authorization: `Api-Key ${this.apiKey}`,\n },\n requestBody: {\n storeId: this.storeId,\n widgetName: \"select-nonprofit\",\n postalCode: this.postalCode,\n countryCode: this.countryCode,\n version: \"1.0.0\",\n lang: this.configLang,\n cart,\n },\n });\n\n this.enableNonprofitDeselection = !!res.config.enableNonprofitDeselection;\n\n // Reset selection if list doesn't include the current selected nonprofit\n if (this.selectedNonprofitId && !res.nonprofits.map((np) => np.nonprofit.id).includes(this.selectedNonprofitId)) {\n this.selectedNonprofitId = null;\n await this.postSelectNonprofit({ selectedNonprofitId: null });\n }\n\n // If store ID was not provided, get the store ID from response here\n if (res.store?.id && res.store.id !== this.storeId) {\n this.storeId = res.store.id;\n }\n\n await this.createNewSelectionForCachedNonprofit();\n\n this.localStorage.setItemJson(\"chainNonprofits\", {\n createdAt: new Date(),\n data: res,\n });\n\n return res;\n };\n\n private postSelectNonprofit = async ({ selectedNonprofitId }: { selectedNonprofitId: TNumericId | null }) => {\n if (!enforceConfig<RequiredConfig>([\"apiKey\", \"storeId\"], this)) {\n throw new MissingConfig();\n }\n const cartId = this.getExternalCartId();\n const beamCartId = this.getBeamCartId();\n const result = await postSelectNonprofit({\n baseUrl: this.baseUrl,\n headers: {\n authorization: `Api-Key ${this.apiKey}`,\n },\n requestBody: {\n nonprofitId: selectedNonprofitId,\n selectionId: this.selectionId,\n storeId: this.storeId,\n cartId,\n beamCartId,\n },\n });\n\n this.selectionId = result?.selectionId;\n this.localStorage.setItem(\"transaction\", this.selectionId);\n this.localStorage.setItem(\"nonprofit\", selectedNonprofitId);\n\n await this.updateComplete;\n\n const selectedNonprofit = this.getNonprofitById(selectedNonprofitId);\n\n this.dispatchEvent(\n new BeamNonprofitSelectEvent({\n selectedNonprofitId,\n selectionId: this.selectionId,\n nonprofitName: selectedNonprofit?.nonprofit?.name ?? null,\n })\n );\n };\n\n private nonprofitListDataController = new AsyncController<typeof this.getChainNonprofits>(\n this,\n this.getChainNonprofits\n );\n\n private selectionDataController = new AsyncController<typeof this.postSelectNonprofit>(\n this,\n this.postSelectNonprofit\n );\n\n private localStorage = createScopedLocalStorage(this as LitElement & RequiredConfig);\n\n private getNonprofitById(selectedNonprofitId: number | null) {\n if (!selectedNonprofitId) return null;\n return this.nonprofitListDataController?.data?.nonprofits.find((np) => np.nonprofit.id === selectedNonprofitId);\n }\n\n private handleCartChange = (evt: BeamCartChangeEvent) => {\n this.cart = evt.detail;\n };\n\n connectedCallback() {\n super.connectedCallback();\n window.addEventListener(BeamCartChangeEvent.eventName, this.handleCartChange as EventListener);\n }\n\n async firstUpdated(_changedProperties: PropertyValues) {\n await this.restoreStateFromCache();\n }\n\n async updated(previousPropertyValues: PropertyValues) {\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 = [\"baseUrl\", \"storeId\", \"apiKey\", \"countryCode\", \"postalCode\", \"cart\", \"lang\"];\n for (const prop of requireNewDataProps) {\n if (previousPropertyValues.has(prop)) {\n await this.nonprofitListDataController.exec();\n break;\n }\n }\n }\n\n disconnectedCallback() {\n window.removeEventListener(BeamCartChangeEvent.eventName, this.handleCartChange as EventListener);\n super.disconnectedCallback();\n }\n\n private getExternalCartId() {\n return this.localStorage.getItemJson<TBeamCartLocalStorage>(\"cart\")?.cartId ?? getCookieValue(\"cart\");\n }\n\n private getBeamCartId() {\n return getCookieValue(BEAM_CART_COOKIE_NAME);\n }\n\n private async restoreStateFromCache() {\n try {\n // Restore previous selected nonprofit\n this.selectedNonprofitId = parseInt(this.localStorage.getItem(\"nonprofit\") || \"\") || null;\n // Restore previous transaction/selection\n // TODO: add max TTL for this cache item of 20 days [WEB-100]\n this.selectionId = this.localStorage.getItem(\"transaction\") ?? undefined;\n this.cart = this.localStorage.getItemJson<TBeamCartLocalStorage>(\"cart\") ?? undefined;\n\n // Try to restore nonprofit list if we have data and it's not too old\n // list will continue to refresh async and replace this data when ready\n const { createdAt = 0, data } =\n this.localStorage.getItemJson<{ createdAt: string; data: any }>(\"chainNonprofits\") || {};\n const cacheTtl = 2 * 60 * 60 * 1000;\n if (new Date(createdAt).valueOf() + cacheTtl > new Date().valueOf()) {\n this.nonprofitListDataController.data = data;\n this.nonprofitListDataController.loading = false;\n }\n } catch (err) {\n // ignore cache retrieval error and continue to fetch data\n }\n }\n\n private async createNewSelectionForCachedNonprofit() {\n if (!enforceConfig<RequiredConfig>([\"apiKey\"], this)) {\n throw new MissingConfig();\n }\n if (!this.storeId || this.didTryToCreateNewSelectionFromCache) {\n return; // storeId can be set async as a result of calling find nonprofits with postalCode + zipCode\n }\n try {\n // Immediately set flag to prevent more cache restore attempts from triggering\n this.didTryToCreateNewSelectionFromCache = true;\n\n // Create a new selection ID for the session (e.g., if restoring nonprofit after a completed order)\n\n if (this.selectedNonprofitId) {\n if (!this.selectionId) {\n await this.selectionDataController.exec({ selectedNonprofitId: this.selectedNonprofitId });\n }\n const selectedNonprofit = this.getNonprofitById(this.selectedNonprofitId);\n this.dispatchEvent(\n new BeamNonprofitSelectEvent({\n selectedNonprofitId: this.selectedNonprofitId,\n selectionId: this.selectionId,\n nonprofitName: selectedNonprofit?.nonprofit?.name,\n })\n );\n }\n } catch (err) {\n // Ignore error\n }\n }\n\n /**\n * Factory for selection event handler\n *\n * Nonprofit selector implements radio-button semantics:\n * * If nothing is selected, tabbing into selector selects first card\n * * Arrow keys changes focus between cards, but doesn't select\n * * Enter/Space sets selection\n * * If a nonprofit is selected, arrow keys change focus AND selection\n * * Click sets selection\n * @param {number} id\n * @param {number} index\n * @param {{id: number}[]} nonprofits\n * @returns {(evt: Event) => void}\n */\n private makeHandleSelect =\n (id: number, index: number, nonprofits: { nonprofit: { id: number } }[]) => async (evt: Event) => {\n const currentId = this.selectedNonprofitId;\n if (evt instanceof KeyboardEvent) {\n let nextFocus = null;\n switch (evt.key) {\n case \"ArrowUp\":\n case \"ArrowLeft\":\n if (index === 0) {\n nextFocus = nonprofits[nonprofits.length - 1];\n } else {\n nextFocus = nonprofits[index - 1];\n }\n evt.preventDefault();\n break;\n case \"ArrowRight\":\n case \"ArrowDown\":\n if (index === nonprofits.length - 1) {\n nextFocus = nonprofits[0];\n } else {\n nextFocus = nonprofits[index + 1];\n }\n evt.preventDefault();\n break;\n case \"Enter\":\n case \" \":\n evt.preventDefault();\n break; // continue to toggle-selection block below\n default:\n return;\n }\n if (nextFocus) {\n if (currentId != null) {\n this.selectedNonprofitId = nextFocus.nonprofit.id;\n }\n const focusTarget = this.renderRoot.querySelector(`[data-value=\"${nextFocus.nonprofit.id}\"]`) as HTMLElement;\n if (focusTarget !== null) {\n focusTarget.tabIndex = 0;\n focusTarget.focus();\n }\n return;\n }\n }\n // Handle selection with click or Enter/Space key\n const targetEl = evt.currentTarget;\n if (targetEl instanceof HTMLElement) {\n if (currentId === id) {\n if (this.enableNonprofitDeselection) {\n this.selectedNonprofitId = null; // unset\n } else {\n return;\n }\n } else {\n this.selectedNonprofitId = id;\n }\n }\n await this.selectionDataController.exec({ selectedNonprofitId: this.selectedNonprofitId });\n };\n\n public get cssVariables() {\n const defaults = {\n \"--beam-fontFamily\": \"inherit\",\n \"--beam-fontStyle\": \"inherit\",\n \"--beam-fontSize\": \"inherit\",\n \"--beam-textColor\": \"inherit\",\n \"--beam-backgroundColor\": \"inherit\",\n ...progressBarConfigDefaults,\n \"--beam-SelectNonprofit-title-textAlign\": \"inherit\",\n \"--beam-SelectNonprofit-description-textAlign\": \"inherit\",\n \"--beam-SelectNonprofit-maxWidth\": \"800px\",\n \"--beam-SelectNonprofit-options-marginTop\": \"0px\",\n \"--beam-SelectNonprofit-options-iconHeight\": \"24px\",\n \"--beam-SelectNonprofit-options-padding\": \"10px\",\n \"--beam-SelectNonprofit-options-borderRadius\": \"0px\",\n \"--beam-SelectNonprofit-options-borderColor\": \"currentColor\",\n \"--beam-SelectNonprofit-options--selected-borderColor\": \"currentColor\",\n \"--beam-SelectNonprofit-options-backgroundColor\": \"transparent\",\n \"--beam-SelectNonprofit-options-gap\": \"8px\",\n \"--beam-SelectNonprofit-options--selected-backgroundColor\": \"currentColor\",\n \"--beam-SelectNonprofit-details-marginTop\": \"10px\",\n \"--beam-SelectNonprofit-details-borderRadius\": \"0px\",\n \"--beam-SelectNonprofit-details-borderColor\": \"currentColor\",\n \"--beam-SelectNonprofit-details-backgroundColor\": \"inherit\",\n ...defineCustomText(\"--beam-SelectNonprofit-title\", {\n fontSize: \"1.25em\",\n fontWeight: \"bold\",\n }),\n \"--beam-SelectNonprofit-header-inline-lineHeight\": \"inherit\",\n ...defineCustomText(\"--beam-SelectNonprofit-title-inline\", {\n fontWeight: \"bold\",\n }),\n \"--beam-SelectNonprofit-title-inline-textTransform\": \"none\",\n ...defineCustomText(\"--beam-SelectNonprofit-description\", {\n marginTop: \"0.5em\",\n }),\n ...defineCustomText(\"--beam-SelectNonprofit-description-inline\"),\n ...defineCustomText(\"--beam-SelectNonprofit-details-cause\", {\n fontSize: \"0.85em\",\n fontWeight: \"bold\",\n }),\n ...defineCustomText(\"--beam-SelectNonprofit-details-beamAttribution\", {\n fontSize: \"0.85em\",\n }),\n ...defineCustomText(\"--beam-SelectNonprofit-details-impactDescription\", {\n fontSize: \"1em\",\n marginTop: \"10px\",\n }),\n \"--beam-SelectNonprofit-details-nonprofitName-fontWeight\": \"bold\",\n \"--beam-SelectNonprofit-details-nonprofitName-fontStyle\": \"inherit\",\n \"--beam-SelectNonprofit-details-fundingProgress-marginTop\": \"10px\",\n ...defineCustomText(\"--beam-SelectNonprofit-details-fundingProgressLabel\", {\n fontSize: \"0.85em\",\n }),\n };\n\n const remoteConfig = this.nonprofitListDataController?.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 cssResponsiveUtils,\n css`\n :host {\n display: block;\n max-width: var(--beam-SelectNonprofit-maxWidth, 800px);\n font-family: var(--beam-fontFamily);\n font-style: var(--beam-fontStyle);\n font-size: var(--beam-fontSize);\n background-color: var(--beam-backgroundColor);\n color: var(--beam-textColor);\n }\n\n .details-impactDescription {\n ${useCustomText(\"--beam-SelectNonprofit-details-impactDescription\")}\n }\n\n .details-impactDescription .nonprofitName {\n font-weight: var(--beam-SelectNonprofit-details-nonprofitName-fontWeight);\n font-style: var(--beam-SelectNonprofit-details-nonprofitName-fontStyle, inherit);\n }\n\n /* Note: title/description display is responsive */\n\n .title-block {\n ${useCustomText(\"--beam-SelectNonprofit-title\")}\n text-align: var(--beam-SelectNonprofit-title-textAlign);\n }\n\n .header-inline {\n line-height: var(--beam-SelectNonprofit-header-inline-lineHeight);\n }\n\n .title-inline {\n font-size: var(--beam-SelectNonprofit-title-inline-fontSize);\n font-weight: var(--beam-SelectNonprofit-title-inline-fontWeight);\n color: var(--beam-SelectNonprofit-title-inline-color);\n font-family: var(--beam-SelectNonprofit-title-inline-fontFamily);\n text-transform: var(--beam-SelectNonprofit-title-inline-textTransform);\n }\n\n .description-inline {\n font-family: var(--beam-SelectNonprofit-description-inline-fontFamily);\n font-weight: var(--beam-SelectNonprofit-description-inline-fontWeight);\n color: var(--beam-SelectNonprofit-description-inline-color);\n text-transform: var(--beam-SelectNonprofit-description-inline-textTransform);\n font-size: var(--beam-SelectNonprofit-description-inline-fontSize);\n }\n\n .description {\n ${useCustomText(\"--beam-SelectNonprofit-description\")}\n text-align: var(--beam-SelectNonprofit-description-textAlign);\n }\n `,\n ];\n\n protected render() {\n const { selectedNonprofitId } = this;\n const { data, loading } = this.nonprofitListDataController;\n\n if (loading && !data) {\n // TODO: better loading UI\n return _loading(); // TODO: css theme first\n }\n if (this.nonprofitListDataController.error) {\n if (this.debug) {\n return _errorMessage({ error: this.nonprofitListDataController.error });\n }\n return \"\";\n }\n if (this.selectionDataController.error) {\n if (this.debug) {\n return _errorMessage({ error: this.selectionDataController.error });\n }\n // do not show error screen for interactive errors by default\n }\n const nonprofits = data?.nonprofits || [];\n const selectedNonprofit = nonprofits.find((np) => np.nonprofit.id === selectedNonprofitId) || null;\n return html`\n <style>\n :host {\n ${this.cssVariables.toCSS()}\n }\n </style>\n <div part=\"heading\">\n <h3 class=\"title-block d-none d-lg-block\" part=\"title\" id=\"beam-SelectNonprofit-title\">\n ${localizeUserString(this.configLang, data?.config?.web?.title || \"\") || strings[this.configLang].ctaTitle()}\n </h3>\n <p class=\"description\" part=\"description\">\n <span class=\"d-none d-lg-inline\">\n ${\n localizeUserString(this.configLang, data?.config?.web?.description || \"\") ||\n strings[this.configLang].ctaMessage()\n }\n </span>\n <div class=\"d-lg-none header-inline\">\n <span class=\"title-inline\" part=\"title\">\n ${\n (localizeUserString(this.configLang, data?.config?.web?.title || \"\") ||\n strings[this.configLang].ctaTitle()) + strings[this.configLang].inlineSeparator()\n }\n </span>\n <span class=\"description-inline\" part=\"description\">\n ${\n localizeUserString(this.configLang, data?.config?.web?.description || \"\") ||\n strings[this.configLang].ctaMessage()\n }\n </span>\n </div>\n </p>\n </div>\n <div\n class=\"options\"\n part=\"options\"\n role=\"radiogroup\"\n aria-labelledby=\"beam-SelectNonprofit-title\"\n style=\"display: flex; gap: var(--beam-SelectNonprofit-options-gap); margin: 10px 0 0 0;\"\n >\n ${repeat(\n nonprofits,\n (i) => i.nonprofit.id,\n ({ nonprofit }, index) => {\n const isSelected = selectedNonprofitId === nonprofit.id;\n const isFocusable = isSelected || (selectedNonprofit == null && index === 0);\n return html`\n <div\n class=\"option\"\n part=\"option\"\n role=\"radio\"\n tabindex=\"${isFocusable ? 0 : -1}\"\n data-value=${nonprofit.id}\n aria-checked=${isSelected}\n @click=${this.makeHandleSelect(nonprofit.id, index, nonprofits)}\n @keydown=${this.makeHandleSelect(nonprofit.id, index, nonprofits)}\n aria-label=\"${localizeUserString(this.configLang, nonprofit.cause || \"\")}\"\n style=\"${styleMap({\n cursor: \"pointer\",\n flex: \"1\",\n textAlign: \"center\",\n lineHeight: \"1\",\n marginTop: \"var(--beam-SelectNonprofit-options-marginTop, 0px)\",\n padding: \"var(--beam-SelectNonprofit-options-padding, 10px)\",\n borderWidth: \"var(--beam-SelectNonprofit-options-borderWidth, 1px)\",\n borderStyle: \"solid\",\n borderRadius: \"var(--beam-SelectNonprofit-options-borderRadius, 0)\",\n borderColor: isSelected\n ? nonprofit.causeColor || \"var(--beam-SelectNonprofit-options--selected-borderColor, currentColor)\"\n : \"var(--beam-SelectNonprofit-options-borderColor, currentColor)\",\n backgroundColor: isSelected\n ? nonprofit.causeColor ||\n \"var(--beam-SelectNonprofit-options--selected-backgroundColor, currentColor)\"\n : \"var(--beam-SelectNonprofit-options-backgroundColor, transparent)\",\n })}\"\n >\n <img\n src=\"${isSelected ? nonprofit.causeIconSelectedUrl : nonprofit.causeIconUrl}\"\n alt=\"\"\n role=\"presentation\"\n style=\"\n height: var(--beam-SelectNonprofit-options-iconHeight, 24px);\n user-select: none;\n \"\n />\n </div>\n `;\n }\n )}\n </div>\n ${\n selectedNonprofit != null\n ? html`\n <div\n class=\"details\"\n part=\"details\"\n style=\"\n border: 1px solid var(--beam-SelectNonprofit-details-borderColor);\n border-radius: var(--beam-SelectNonprofit-details-borderRadius);\n background-color: var(--beam-SelectNonprofit-details-backgroundColor);\n padding: 10px;\n margin-top: var(--beam-SelectNonprofit-details-marginTop)\n \"\n >\n <div\n style=\"display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap-reverse\"\n >\n <span\n class=\"details-cause\"\n style=\"flex: 0 1; white-space: nowrap; ${useCustomText(\"--beam-SelectNonprofit-details-cause\")}\"\n >\n ${localizeUserString(this.configLang, selectedNonprofit.nonprofit.cause || \"\")}\n </span>\n <span\n class=\"details-beamAttribution\"\n style=\"flex: 0 1; white-space: nowrap; ${useCustomText(\n \"--beam-SelectNonprofit-details-beamAttribution\"\n )}\"\n >\n ${strings[this.configLang].beamAttribution()}\n </span>\n </div>\n <p class=\"details-impactDescription\">\n ${unsafeHTML(localizeUserString(this.configLang, selectedNonprofit.impact.description || \"\"))}\n </p>\n <div\n style=\"display: flex; margin-top: var(--beam-SelectNonprofit-details-fundingProgress-marginTop); align-items: center;\"\n >\n <beam-progress-bar\n value=\"${selectedNonprofit.impact.goalProgressPercentage}\"\n style=\"flex: 1 0;\"\n ></beam-progress-bar>\n <span\n class=\"details-fundingProgressLabel\"\n style=\"${useCustomText(\n \"--beam-SelectNonprofit-details-fundingProgressLabel\"\n )} white-space: nowrap; text-align: right; flex: 0 1; margin-left: 15px;\"\n >\n ${localizeUserString(this.configLang, selectedNonprofit.impact.goalProgressText)}\n </span>\n </div>\n </div>\n `\n : \"\"\n }\n `;\n }\n}\n\ndefineCustomElement(BeamSelectNonprofit);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"beam-select-nonprofit\": BeamSelectNonprofit;\n }\n}\n"],"names":["strings","donationPercentage","x","L","s","h","f","e","o","i","r","BeamSelectNonprofit","LitElement","DEFAULT_BASE_URL","enforceConfig","cart","res","postChainEligibleNonprofitsForCart","np","selectedNonprofitId","cartId","beamCartId","result","postSelectNonprofit","selectedNonprofit","BeamNonprofitSelectEvent","AsyncController","createScopedLocalStorage","evt","id","index","nonprofits","currentId","nextFocus","focusTarget","SUPPORTED_LANGUAGES","BeamCartChangeEvent","_changedProperties","previousPropertyValues","requireNewDataProps","prop","getCookieValue","BEAM_CART_COOKIE_NAME","createdAt","data","cacheTtl","defaults","progressBarConfigDefaults","defineCustomText","remoteConfig","config","_cssVariableMap","loading","_loading","_errorMessage","html","localizeUserString","repeat","nonprofit","isSelected","isFocusable","styleMap","useCustomText","unsafeHTML","cssReset","cssResponsi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/strings.ts","../../src/components/select-nonprofit/index.ts"],"sourcesContent":["export const strings = {\n en: {\n beamAttribution: () => `Powered by Beam`,\n ctaTitle: () => `Choose your impact`,\n ctaMessage: ({ donationPercentage = \"1\" } = {}) =>\n `Select a nonprofit and ${donationPercentage}% of your purchase will be donated, at no extra cost.`,\n inlineSeparator: () => `: `,\n },\n fr: {\n beamAttribution: () => `Optimisé par Beam`,\n ctaTitle: () => `Choisissez votre cause`,\n ctaMessage: ({ donationPercentage = \"1\" } = {}) =>\n `Choisissez un organisme à but non lucratif et ${donationPercentage} % lui sera versé en votre nom, sans frais supplémentaires.`,\n inlineSeparator: () => ` : `,\n },\n de: {\n beamAttribution: () => `Unterstützt von Beam`,\n ctaTitle: () => `Wähle deinen Impact`,\n ctaMessage: ({ donationPercentage = \"1\" } = {}) =>\n `Wähle eine der gemeinnützigen Organisationen und spende ${donationPercentage}% deines Einkaufs ohne zusätzliche Kosten`,\n inlineSeparator: () => `: `,\n },\n es: {\n beamAttribution: () => \"Ofrecido por Beam\",\n ctaTitle: () => \"Elige tu contribución\",\n ctaMessage: ({ donationPercentage = \"1\" } = {}) =>\n `Elige una organización sin fines de lucro y donaremos ${donationPercentage}% de tu compra sin coste adicional.`,\n inlineSeparator: () => \": \",\n },\n it: {\n beamAttribution: () => \"Gestito da Beam\",\n ctaTitle: () => \"Scegli dove fare la differenza\",\n ctaMessage: ({ donationPercentage = \"1\" } = {}) =>\n `Seleziona un'organizzazione no-profit a cui devolvere l’${donationPercentage}% del tuo acquisto, senza costi aggiuntivi`,\n inlineSeparator: () => \": \",\n },\n pl: {\n beamAttribution: () => `Wspierany przez Beam`,\n ctaTitle: () => `Wybierz inicjatywę, którą chcesz wesprzeć`,\n ctaMessage: ({ donationPercentage = \"1\" } = {}) =>\n `Wybierz organizację, której przekażesz ${donationPercentage}% wartości Twoich zakupów – bez żadnych dodatkowych kosztów!`,\n inlineSeparator: () => `: `,\n },\n};\n","import { css, html, LitElement, PropertyValues } from \"lit\";\nimport { repeat } from \"lit/directives/repeat.js\";\nimport { unsafeHTML } from \"lit/directives/unsafe-html.js\";\nimport { property } from \"lit/decorators/property.js\";\nimport { styleMap } from \"lit/directives/style-map.js\";\nimport { AsyncController } from \"../../shared/controllers/async-controller\";\nimport { DEFAULT_BASE_URL, SUPPORTED_LANGUAGES } from \"../../api-sdk/constants\";\nimport \"../../shared/components/progress-bar\";\nimport { defineCustomElement } from \"../../shared/defineCustomElement\";\nimport { _loading } from \"../../shared/fragments/loading-template\";\nimport { _errorMessage } from \"../../shared/fragments/error-message-template\";\nimport { defineCustomText, useCustomText } from \"../../shared/fragments/custom-text\";\nimport { cssReset } from \"../../shared/css-reset\";\nimport { _cssVariableMap } from \"../../shared/fragments/css-variable-map\";\nimport { enforceConfig } from \"../../shared/enforce-config\";\nimport { isEqual } from \"../../utils\";\nimport { MissingConfig } from \"../../utils/beam-errors\";\nimport { TNumericId } from \"../../shared/types\";\nimport { createScopedLocalStorage } from \"../../utils/local-storage\";\nimport { postChainEligibleNonprofitsForCart, postSelectNonprofit } from \"../../api-sdk/v3/routes\";\nimport { LANGUAGES } from \"../../api-sdk/types\";\nimport { BeamCartChangeEvent, BeamNonprofitSelectEvent } from \"../../utils/events\";\nimport { getCookieValue } from \"../../utils/cookies\";\nimport { localizeUserString } from \"../../shared/localize\";\nimport { progressBarConfigDefaults } from \"../../shared/components/progress-bar\";\nimport { cssResponsiveUtils } from \"../../shared/responsive\";\nimport { BEAM_CART_COOKIE_NAME, TBeamCartLocalStorage, TCart } from \"../../shared/cart-contents\";\nimport { strings } from \"./strings\";\n\ninterface RequiredConfig {\n apiKey: string;\n storeId: TNumericId; // Can be set async by postalCode + countryCode lookup\n}\n\nexport class BeamSelectNonprofit extends LitElement {\n static tagName = \"beam-select-nonprofit\";\n\n @property({ type: String }) public baseUrl: string = DEFAULT_BASE_URL;\n\n @property({ type: String }) public apiKey?: RequiredConfig[\"apiKey\"];\n\n // storeId can be omitted if countryCode + postalCode are provided\n @property({ type: Number, reflect: true }) public storeId?: TNumericId;\n\n @property({ type: String }) public countryCode?: string;\n\n @property({ type: String }) public postalCode?: string;\n\n @property({ attribute: false, hasChanged: (a, b) => !isEqual(a, b) }) public cart?: TCart;\n\n @property({ type: Number, reflect: true }) public selectedNonprofitId: TNumericId | null = null;\n\n @property({ type: String }) public lang: LANGUAGES = \"en\";\n\n @property({ type: Boolean }) public debug = false;\n\n private enableNonprofitDeselection = false;\n\n private selectionId?: string;\n\n private didTryToCreateNewSelectionFromCache = false; // Should only create selection once\n\n get configLang() {\n return SUPPORTED_LANGUAGES[this.lang] || \"en\";\n }\n\n private getChainNonprofits = async () => {\n if (!enforceConfig<RequiredConfig>([\"apiKey\"], this)) {\n throw new MissingConfig();\n }\n\n const cart: any = this.cart?.content\n ? {\n schema: this.cart?.schema,\n content: this.cart?.content,\n }\n : undefined;\n\n // We use a POST method because we send a nested JSON with data that we don't want to serialize/expose in URL\n const res = await postChainEligibleNonprofitsForCart({\n baseUrl: this.baseUrl,\n apiRoot: \"/api/v3\",\n headers: {\n authorization: `Api-Key ${this.apiKey}`,\n },\n requestBody: {\n storeId: this.storeId,\n widgetName: \"select-nonprofit\",\n postalCode: this.postalCode,\n countryCode: this.countryCode,\n version: \"1.0.0\",\n lang: this.configLang,\n cart,\n },\n });\n\n this.enableNonprofitDeselection = !!res.config.enableNonprofitDeselection;\n\n // Reset selection if list doesn't include the current selected nonprofit\n if (this.selectedNonprofitId && !res.nonprofits.map((np) => np.nonprofit.id).includes(this.selectedNonprofitId)) {\n this.selectedNonprofitId = null;\n await this.postSelectNonprofit({ selectedNonprofitId: null });\n }\n\n // If store ID was not provided, get the store ID from response here\n if (res.store?.id && res.store.id !== this.storeId) {\n this.storeId = res.store.id;\n }\n\n await this.createNewSelectionForCachedNonprofit();\n\n this.localStorage.setItemJson(\"chainNonprofits\", {\n createdAt: new Date(),\n data: res,\n });\n\n return res;\n };\n\n private postSelectNonprofit = async ({ selectedNonprofitId }: { selectedNonprofitId: TNumericId | null }) => {\n if (!enforceConfig<RequiredConfig>([\"apiKey\", \"storeId\"], this)) {\n throw new MissingConfig();\n }\n const cartId = this.getExternalCartId();\n const beamCartId = this.getBeamCartId();\n const result = await postSelectNonprofit({\n baseUrl: this.baseUrl,\n headers: {\n authorization: `Api-Key ${this.apiKey}`,\n },\n requestBody: {\n nonprofitId: selectedNonprofitId,\n selectionId: this.selectionId,\n storeId: this.storeId,\n cartId,\n beamCartId,\n },\n });\n\n this.selectionId = result?.selectionId;\n this.localStorage.setItem(\"transaction\", this.selectionId);\n this.localStorage.setItem(\"nonprofit\", selectedNonprofitId);\n\n await this.updateComplete;\n\n const selectedNonprofit = this.getNonprofitById(selectedNonprofitId);\n\n this.dispatchEvent(\n new BeamNonprofitSelectEvent({\n selectedNonprofitId,\n selectionId: this.selectionId,\n nonprofitName: selectedNonprofit?.nonprofit?.name ?? null,\n })\n );\n };\n\n private nonprofitListDataController = new AsyncController<typeof this.getChainNonprofits>(\n this,\n this.getChainNonprofits\n );\n\n private selectionDataController = new AsyncController<typeof this.postSelectNonprofit>(\n this,\n this.postSelectNonprofit\n );\n\n private localStorage = createScopedLocalStorage(this as LitElement & RequiredConfig);\n\n private getNonprofitById(selectedNonprofitId: number | null) {\n if (!selectedNonprofitId) return null;\n return this.nonprofitListDataController?.data?.nonprofits.find((np) => np.nonprofit.id === selectedNonprofitId);\n }\n\n private handleCartChange = (evt: BeamCartChangeEvent) => {\n this.cart = evt.detail;\n };\n\n connectedCallback() {\n super.connectedCallback();\n window.addEventListener(BeamCartChangeEvent.eventName, this.handleCartChange as EventListener);\n }\n\n async firstUpdated(_changedProperties: PropertyValues) {\n await this.restoreStateFromCache();\n }\n\n async updated(previousPropertyValues: PropertyValues) {\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 = [\"baseUrl\", \"storeId\", \"apiKey\", \"countryCode\", \"postalCode\", \"cart\", \"lang\"];\n for (const prop of requireNewDataProps) {\n if (previousPropertyValues.has(prop)) {\n await this.nonprofitListDataController.exec();\n break;\n }\n }\n }\n\n disconnectedCallback() {\n window.removeEventListener(BeamCartChangeEvent.eventName, this.handleCartChange as EventListener);\n super.disconnectedCallback();\n }\n\n private getExternalCartId() {\n return this.localStorage.getItemJson<TBeamCartLocalStorage>(\"cart\")?.cartId ?? getCookieValue(\"cart\");\n }\n\n private getBeamCartId() {\n return getCookieValue(BEAM_CART_COOKIE_NAME);\n }\n\n private async restoreStateFromCache() {\n try {\n // Restore previous selected nonprofit\n this.selectedNonprofitId = parseInt(this.localStorage.getItem(\"nonprofit\") || \"\") || null;\n // Restore previous transaction/selection\n // TODO: add max TTL for this cache item of 20 days [WEB-100]\n this.selectionId = this.localStorage.getItem(\"transaction\") ?? undefined;\n this.cart = this.localStorage.getItemJson<TBeamCartLocalStorage>(\"cart\") ?? undefined;\n\n // Try to restore nonprofit list if we have data and it's not too old\n // list will continue to refresh async and replace this data when ready\n const { createdAt = 0, data } =\n this.localStorage.getItemJson<{ createdAt: string; data: any }>(\"chainNonprofits\") || {};\n const cacheTtl = 2 * 60 * 60 * 1000;\n if (new Date(createdAt).valueOf() + cacheTtl > new Date().valueOf()) {\n this.nonprofitListDataController.data = data;\n this.nonprofitListDataController.loading = false;\n }\n } catch (err) {\n // ignore cache retrieval error and continue to fetch data\n }\n }\n\n private async createNewSelectionForCachedNonprofit() {\n if (!enforceConfig<RequiredConfig>([\"apiKey\"], this)) {\n throw new MissingConfig();\n }\n if (!this.storeId || this.didTryToCreateNewSelectionFromCache) {\n return; // storeId can be set async as a result of calling find nonprofits with postalCode + zipCode\n }\n try {\n // Immediately set flag to prevent more cache restore attempts from triggering\n this.didTryToCreateNewSelectionFromCache = true;\n\n // Create a new selection ID for the session (e.g., if restoring nonprofit after a completed order)\n\n if (this.selectedNonprofitId) {\n if (!this.selectionId) {\n await this.selectionDataController.exec({ selectedNonprofitId: this.selectedNonprofitId });\n }\n const selectedNonprofit = this.getNonprofitById(this.selectedNonprofitId);\n this.dispatchEvent(\n new BeamNonprofitSelectEvent({\n selectedNonprofitId: this.selectedNonprofitId,\n selectionId: this.selectionId,\n nonprofitName: selectedNonprofit?.nonprofit?.name,\n })\n );\n }\n } catch (err) {\n // Ignore error\n }\n }\n\n /**\n * Factory for selection event handler\n *\n * Nonprofit selector implements radio-button semantics:\n * * If nothing is selected, tabbing into selector selects first card\n * * Arrow keys changes focus between cards, but doesn't select\n * * Enter/Space sets selection\n * * If a nonprofit is selected, arrow keys change focus AND selection\n * * Click sets selection\n * @param {number} id\n * @param {number} index\n * @param {{id: number}[]} nonprofits\n * @returns {(evt: Event) => void}\n */\n private makeHandleSelect =\n (id: number, index: number, nonprofits: { nonprofit: { id: number } }[]) => async (evt: Event) => {\n const currentId = this.selectedNonprofitId;\n if (evt instanceof KeyboardEvent) {\n let nextFocus = null;\n switch (evt.key) {\n case \"ArrowUp\":\n case \"ArrowLeft\":\n if (index === 0) {\n nextFocus = nonprofits[nonprofits.length - 1];\n } else {\n nextFocus = nonprofits[index - 1];\n }\n evt.preventDefault();\n break;\n case \"ArrowRight\":\n case \"ArrowDown\":\n if (index === nonprofits.length - 1) {\n nextFocus = nonprofits[0];\n } else {\n nextFocus = nonprofits[index + 1];\n }\n evt.preventDefault();\n break;\n case \"Enter\":\n case \" \":\n evt.preventDefault();\n break; // continue to toggle-selection block below\n default:\n return;\n }\n if (nextFocus) {\n if (currentId != null) {\n this.selectedNonprofitId = nextFocus.nonprofit.id;\n }\n const focusTarget = this.renderRoot.querySelector(`[data-value=\"${nextFocus.nonprofit.id}\"]`) as HTMLElement;\n if (focusTarget !== null) {\n focusTarget.tabIndex = 0;\n focusTarget.focus();\n }\n return;\n }\n }\n // Handle selection with click or Enter/Space key\n const targetEl = evt.currentTarget;\n if (targetEl instanceof HTMLElement) {\n if (currentId === id) {\n if (this.enableNonprofitDeselection) {\n this.selectedNonprofitId = null; // unset\n } else {\n return;\n }\n } else {\n this.selectedNonprofitId = id;\n }\n }\n await this.selectionDataController.exec({ selectedNonprofitId: this.selectedNonprofitId });\n };\n\n public get cssVariables() {\n const defaults = {\n \"--beam-fontFamily\": \"inherit\",\n \"--beam-fontStyle\": \"inherit\",\n \"--beam-fontSize\": \"inherit\",\n \"--beam-textColor\": \"inherit\",\n \"--beam-backgroundColor\": \"inherit\",\n ...progressBarConfigDefaults,\n \"--beam-SelectNonprofit-title-textAlign\": \"inherit\",\n \"--beam-SelectNonprofit-description-textAlign\": \"inherit\",\n \"--beam-SelectNonprofit-maxWidth\": \"800px\",\n \"--beam-SelectNonprofit-options-marginTop\": \"0px\",\n \"--beam-SelectNonprofit-options-iconHeight\": \"24px\",\n \"--beam-SelectNonprofit-options-padding\": \"10px\",\n \"--beam-SelectNonprofit-options-borderRadius\": \"0px\",\n \"--beam-SelectNonprofit-options-borderColor\": \"currentColor\",\n \"--beam-SelectNonprofit-options--selected-borderColor\": \"currentColor\",\n \"--beam-SelectNonprofit-options-backgroundColor\": \"transparent\",\n \"--beam-SelectNonprofit-options-gap\": \"8px\",\n \"--beam-SelectNonprofit-options--selected-backgroundColor\": \"currentColor\",\n \"--beam-SelectNonprofit-details-marginTop\": \"10px\",\n \"--beam-SelectNonprofit-details-borderRadius\": \"0px\",\n \"--beam-SelectNonprofit-details-borderColor\": \"currentColor\",\n \"--beam-SelectNonprofit-details-backgroundColor\": \"inherit\",\n ...defineCustomText(\"--beam-SelectNonprofit-title\", {\n fontSize: \"1.25em\",\n fontWeight: \"bold\",\n }),\n \"--beam-SelectNonprofit-header-inline-lineHeight\": \"inherit\",\n ...defineCustomText(\"--beam-SelectNonprofit-title-inline\", {\n fontWeight: \"bold\",\n }),\n \"--beam-SelectNonprofit-title-inline-textTransform\": \"none\",\n ...defineCustomText(\"--beam-SelectNonprofit-description\", {\n marginTop: \"0.5em\",\n }),\n ...defineCustomText(\"--beam-SelectNonprofit-description-inline\"),\n ...defineCustomText(\"--beam-SelectNonprofit-details-cause\", {\n fontSize: \"0.85em\",\n fontWeight: \"bold\",\n }),\n ...defineCustomText(\"--beam-SelectNonprofit-details-beamAttribution\", {\n fontSize: \"0.85em\",\n }),\n ...defineCustomText(\"--beam-SelectNonprofit-details-impactDescription\", {\n fontSize: \"1em\",\n marginTop: \"10px\",\n }),\n \"--beam-SelectNonprofit-details-nonprofitName-fontWeight\": \"bold\",\n \"--beam-SelectNonprofit-details-nonprofitName-fontStyle\": \"inherit\",\n \"--beam-SelectNonprofit-details-fundingProgress-marginTop\": \"10px\",\n ...defineCustomText(\"--beam-SelectNonprofit-details-fundingProgressLabel\", {\n fontSize: \"0.85em\",\n }),\n };\n\n const remoteConfig = this.nonprofitListDataController?.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 cssResponsiveUtils,\n css`\n :host {\n display: block;\n max-width: var(--beam-SelectNonprofit-maxWidth, 800px);\n font-family: var(--beam-fontFamily);\n font-style: var(--beam-fontStyle);\n font-size: var(--beam-fontSize);\n background-color: var(--beam-backgroundColor);\n color: var(--beam-textColor);\n word-break: normal;\n }\n\n .details-impactDescription {\n ${useCustomText(\"--beam-SelectNonprofit-details-impactDescription\")}\n }\n\n .details-impactDescription .nonprofitName {\n font-weight: var(--beam-SelectNonprofit-details-nonprofitName-fontWeight);\n font-style: var(--beam-SelectNonprofit-details-nonprofitName-fontStyle, inherit);\n }\n\n /* Note: title/description display is responsive */\n\n .title-block {\n ${useCustomText(\"--beam-SelectNonprofit-title\")}\n text-align: var(--beam-SelectNonprofit-title-textAlign);\n }\n\n .header-inline {\n line-height: var(--beam-SelectNonprofit-header-inline-lineHeight);\n }\n\n .title-inline {\n font-size: var(--beam-SelectNonprofit-title-inline-fontSize);\n font-weight: var(--beam-SelectNonprofit-title-inline-fontWeight);\n color: var(--beam-SelectNonprofit-title-inline-color);\n font-family: var(--beam-SelectNonprofit-title-inline-fontFamily);\n text-transform: var(--beam-SelectNonprofit-title-inline-textTransform);\n }\n\n .description-inline {\n font-family: var(--beam-SelectNonprofit-description-inline-fontFamily);\n font-weight: var(--beam-SelectNonprofit-description-inline-fontWeight);\n color: var(--beam-SelectNonprofit-description-inline-color);\n text-transform: var(--beam-SelectNonprofit-description-inline-textTransform);\n font-size: var(--beam-SelectNonprofit-description-inline-fontSize);\n }\n\n .description {\n ${useCustomText(\"--beam-SelectNonprofit-description\")}\n text-align: var(--beam-SelectNonprofit-description-textAlign);\n }\n `,\n ];\n\n protected render() {\n const { selectedNonprofitId } = this;\n const { data, loading } = this.nonprofitListDataController;\n\n if (loading && !data) {\n // TODO: better loading UI\n return _loading(); // TODO: css theme first\n }\n if (this.nonprofitListDataController.error) {\n if (this.debug) {\n return _errorMessage({ error: this.nonprofitListDataController.error });\n }\n return \"\";\n }\n if (this.selectionDataController.error) {\n if (this.debug) {\n return _errorMessage({ error: this.selectionDataController.error });\n }\n // do not show error screen for interactive errors by default\n }\n const nonprofits = data?.nonprofits || [];\n const selectedNonprofit = nonprofits.find((np) => np.nonprofit.id === selectedNonprofitId) || null;\n return html`\n <style>\n :host {\n ${this.cssVariables.toCSS()}\n }\n </style>\n <div part=\"heading\">\n <h3 class=\"title-block d-none d-lg-block\" part=\"title\" id=\"beam-SelectNonprofit-title\">\n ${localizeUserString(this.configLang, data?.config?.web?.title || \"\") || strings[this.configLang].ctaTitle()}\n </h3>\n <p class=\"description\" part=\"description\">\n <span class=\"d-none d-lg-inline\">\n ${\n localizeUserString(this.configLang, data?.config?.web?.description || \"\") ||\n strings[this.configLang].ctaMessage()\n }\n </span>\n <div class=\"d-lg-none header-inline\">\n <span class=\"title-inline\" part=\"title\">\n ${\n (localizeUserString(this.configLang, data?.config?.web?.title || \"\") ||\n strings[this.configLang].ctaTitle()) + strings[this.configLang].inlineSeparator()\n }\n </span>\n <span class=\"description-inline\" part=\"description\">\n ${\n localizeUserString(this.configLang, data?.config?.web?.description || \"\") ||\n strings[this.configLang].ctaMessage()\n }\n </span>\n </div>\n </p>\n </div>\n <div\n class=\"options\"\n part=\"options\"\n role=\"radiogroup\"\n aria-labelledby=\"beam-SelectNonprofit-title\"\n style=\"display: flex; gap: var(--beam-SelectNonprofit-options-gap); margin: 10px 0 0 0;\"\n >\n ${repeat(\n nonprofits,\n (i) => i.nonprofit.id,\n ({ nonprofit }, index) => {\n const isSelected = selectedNonprofitId === nonprofit.id;\n const isFocusable = isSelected || (selectedNonprofit == null && index === 0);\n return html`\n <div\n class=\"option\"\n part=\"option\"\n role=\"radio\"\n tabindex=\"${isFocusable ? 0 : -1}\"\n data-value=${nonprofit.id}\n aria-checked=${isSelected}\n @click=${this.makeHandleSelect(nonprofit.id, index, nonprofits)}\n @keydown=${this.makeHandleSelect(nonprofit.id, index, nonprofits)}\n aria-label=\"${localizeUserString(this.configLang, nonprofit.cause || \"\")}\"\n style=\"${styleMap({\n cursor: \"pointer\",\n flex: \"1\",\n textAlign: \"center\",\n lineHeight: \"1\",\n marginTop: \"var(--beam-SelectNonprofit-options-marginTop, 0px)\",\n padding: \"var(--beam-SelectNonprofit-options-padding, 10px)\",\n borderWidth: \"var(--beam-SelectNonprofit-options-borderWidth, 1px)\",\n borderStyle: \"solid\",\n borderRadius: \"var(--beam-SelectNonprofit-options-borderRadius, 0)\",\n borderColor: isSelected\n ? nonprofit.causeColor || \"var(--beam-SelectNonprofit-options--selected-borderColor, currentColor)\"\n : \"var(--beam-SelectNonprofit-options-borderColor, currentColor)\",\n backgroundColor: isSelected\n ? nonprofit.causeColor ||\n \"var(--beam-SelectNonprofit-options--selected-backgroundColor, currentColor)\"\n : \"var(--beam-SelectNonprofit-options-backgroundColor, transparent)\",\n })}\"\n >\n <img\n src=\"${isSelected ? nonprofit.causeIconSelectedUrl : nonprofit.causeIconUrl}\"\n alt=\"\"\n role=\"presentation\"\n style=\"\n height: var(--beam-SelectNonprofit-options-iconHeight, 24px);\n user-select: none;\n \"\n />\n </div>\n `;\n }\n )}\n </div>\n ${\n selectedNonprofit != null\n ? html`\n <div\n class=\"details\"\n part=\"details\"\n style=\"\n border: 1px solid var(--beam-SelectNonprofit-details-borderColor);\n border-radius: var(--beam-SelectNonprofit-details-borderRadius);\n background-color: var(--beam-SelectNonprofit-details-backgroundColor);\n padding: 10px;\n margin-top: var(--beam-SelectNonprofit-details-marginTop)\n \"\n >\n <div\n style=\"display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap-reverse\"\n >\n <span\n class=\"details-cause\"\n style=\"flex: 0 1; white-space: nowrap; ${useCustomText(\"--beam-SelectNonprofit-details-cause\")}\"\n >\n ${localizeUserString(this.configLang, selectedNonprofit.nonprofit.cause || \"\")}\n </span>\n <span\n class=\"details-beamAttribution\"\n style=\"flex: 0 1; white-space: nowrap; ${useCustomText(\n \"--beam-SelectNonprofit-details-beamAttribution\"\n )}\"\n >\n ${strings[this.configLang].beamAttribution()}\n </span>\n </div>\n <p class=\"details-impactDescription\">\n ${unsafeHTML(localizeUserString(this.configLang, selectedNonprofit.impact.description || \"\"))}\n </p>\n <div\n style=\"display: flex; margin-top: var(--beam-SelectNonprofit-details-fundingProgress-marginTop); align-items: center;\"\n >\n <beam-progress-bar\n value=\"${selectedNonprofit.impact.goalProgressPercentage}\"\n style=\"flex: 1 0;\"\n ></beam-progress-bar>\n <span\n class=\"details-fundingProgressLabel\"\n style=\"${useCustomText(\n \"--beam-SelectNonprofit-details-fundingProgressLabel\"\n )} white-space: nowrap; text-align: right; flex: 0 1; margin-left: 15px;\"\n >\n ${localizeUserString(this.configLang, selectedNonprofit.impact.goalProgressText)}\n </span>\n </div>\n </div>\n `\n : \"\"\n }\n `;\n }\n}\n\ndefineCustomElement(BeamSelectNonprofit);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"beam-select-nonprofit\": BeamSelectNonprofit;\n }\n}\n"],"names":["strings","donationPercentage","x","L","s","h","f","e","o","i","r","BeamSelectNonprofit","LitElement","DEFAULT_BASE_URL","enforceConfig","cart","res","postChainEligibleNonprofitsForCart","np","selectedNonprofitId","cartId","beamCartId","result","postSelectNonprofit","selectedNonprofit","BeamNonprofitSelectEvent","AsyncController","createScopedLocalStorage","evt","id","index","nonprofits","currentId","nextFocus","focusTarget","SUPPORTED_LANGUAGES","BeamCartChangeEvent","_changedProperties","previousPropertyValues","requireNewDataProps","prop","getCookieValue","BEAM_CART_COOKIE_NAME","createdAt","data","cacheTtl","defaults","progressBarConfigDefaults","defineCustomText","remoteConfig","config","_cssVariableMap","loading","_loading","_errorMessage","html","localizeUserString","repeat","nonprofit","isSelected","isFocusable","styleMap","useCustomText","unsafeHTML","cssReset","cssResponsiveUtils","css","__decorateClass","property","a","b","isEqual","defineCustomElement"],"mappings":"41BAAO,MAAMA,EAAU,CACrB,GAAI,CACF,gBAAiB,IAAM,kBACvB,SAAU,IAAM,qBAChB,WAAY,CAAC,CAAE,mBAAAC,EAAqB,GAAI,EAAI,CAAA,IAC1C,0BAA0BA,CAAkB,wDAC9C,gBAAiB,IAAM,IACzB,EACA,GAAI,CACF,gBAAiB,IAAM,uBACvB,SAAU,IAAM,yBAChB,WAAY,CAAC,CAAE,mBAAAA,EAAqB,GAAI,EAAI,CAAA,IAC1C,oDAAiDA,CAAkB,oEACrE,gBAAiB,IAAM,KACzB,EACA,GAAI,CACF,gBAAiB,IAAM,0BACvB,SAAU,IAAM,yBAChB,WAAY,CAAC,CAAE,mBAAAA,EAAqB,GAAI,EAAI,CAAC,IAC3C,iEAA2DA,CAAkB,+CAC/E,gBAAiB,IAAM,IACzB,EACA,GAAI,CACF,gBAAiB,IAAM,oBACvB,SAAU,IAAM,2BAChB,WAAY,CAAC,CAAE,mBAAAA,EAAqB,GAAI,EAAI,CAC1C,IAAA,4DAAyDA,CAAkB,sCAC7E,gBAAiB,IAAM,IACzB,EACA,GAAI,CACF,gBAAiB,IAAM,kBACvB,SAAU,IAAM,iCAChB,WAAY,CAAC,CAAE,mBAAAA,EAAqB,GAAI,EAAI,CAAC,IAC3C,gEAA2DA,CAAkB,6CAC/E,gB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A,OAAA,CAAA,EAE3BwD,EAAA,CAAjDC,EAAS,CAAE,KAAM,OAAQ,QAAS,EAAK,CAAC,CAAA,EAhB9BzD,EAgBuC,UAAA,sBAAA,CAAA,EAEfwD,EAAA,CAAlCC,EAAS,CAAE,KAAM,MAAO,CAAC,CAlBf,EAAAzD,EAkBwB,oBAECwD,EAAA,CAAnCC,EAAS,CAAE,KAAM,OAAQ,CAAC,CApBhB,EAAAzD,EAoByB,UAskBtC6D,QAAAA,CAAAA,EAAAA,EAAoB7D,CAAmB"}
@@ -25,7 +25,7 @@ import './impact-overview.js';
25
25
 
26
26
  declare const utils: {
27
27
  waitForElement: typeof waitForElement;
28
- getCookieMap: () => Map<string, string>;
28
+ getCookieMap: (cookieString?: string) => Map<string, string>;
29
29
  getCookieValue: (name: string) => string | undefined;
30
30
  };
31
31
 
@@ -1,2 +1,2 @@
1
- import{waitForElement as t}from"../utils/wait-for-element.esm.js";import{getCookieMap as r,getCookieValue as o}from"../utils/cookies.esm.js";import{initNetworkListeners as v}from"../utils/network-listeners.esm.js";import{e as I}from"../chunks/events-5IECSF-x.esm.js";import{h as P,C as T,O as W,s as j,L as q}from"../chunks/order-page-PGTQXoSr.esm.js";import"../chunks/beam-errors-AMvTvR1C.esm.js";import"../chunks/lodash-P8OIs-at.esm.js";import"../utils/local-storage.esm.js";import"../utils/memoize-last.esm.js";import"../chunks/cart-contents-h60geKWa.esm.js";import"../chunks/update-cart-8xlajjFj.esm.js";import"../chunks/routes-USQ3n64Y.esm.js";import"../utils/logger.esm.js";import"../utils/remote-session.esm.js";import"./post-purchase.esm.js";import"../chunks/lit-yVXn5Cbs.esm.js";import"../chunks/enforce-config-MqLZWolV.esm.js";import"./redeem-transaction.esm.js";import"../chunks/progress-bar-7gWYaGlq.esm.js";import"./beam-partner-logos.esm.js";import"../chunks/localize-eZMViIud.esm.js";import"../chunks/css-card-grid-3b56QBzq.esm.js";import"./impact-overview.esm.js";import"../chunks/vendor-eeJfrOkP.esm.js";import"../chunks/is-all-html-elements-SdSkxirh.esm.js";import"../chunks/responsive-LYEag6TI.esm.js";const i={waitForElement:t,getCookieMap:r,getCookieValue:o};export{P as addBeamAttributesToCart,I as events,T as getCurrentCart,v as initNetworkListeners,W as registerCartIntegration,j as showBeamOrderPageWidgets,q as trackCart,i as utils};
1
+ import{waitForElement as t}from"../utils/wait-for-element.esm.js";import{getCookieMap as r,getCookieValue as o}from"../utils/cookies.esm.js";import{initNetworkListeners as v}from"../utils/network-listeners.esm.js";import{e as I}from"../chunks/events-5IECSF-x.esm.js";import{h as P,C as T,O as W,s as j,L as q}from"../chunks/order-page-JdaAppB7.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../chunks/lodash-P8OIs-at.esm.js";import"../utils/local-storage.esm.js";import"../utils/memoize-last.esm.js";import"../chunks/cart-contents-h60geKWa.esm.js";import"../chunks/update-cart-yneR8zk1.esm.js";import"../chunks/routes-lsOWIDmE.esm.js";import"../utils/logger.esm.js";import"../utils/remote-session.esm.js";import"./post-purchase.esm.js";import"../chunks/lit-yVXn5Cbs.esm.js";import"../chunks/enforce-config-qna7hEL6.esm.js";import"./redeem-transaction.esm.js";import"../chunks/progress-bar-7gWYaGlq.esm.js";import"./beam-partner-logos.esm.js";import"../chunks/localize-GCkVUD8S.esm.js";import"../chunks/css-card-grid-3b56QBzq.esm.js";import"./impact-overview.esm.js";import"../chunks/vendor-eeJfrOkP.esm.js";import"../chunks/is-all-html-elements-SdSkxirh.esm.js";import"../chunks/responsive-LYEag6TI.esm.js";const i={waitForElement:t,getCookieMap:r,getCookieValue:o};export{P as addBeamAttributesToCart,I as events,T as getCurrentCart,v as initNetworkListeners,W as registerCartIntegration,j as showBeamOrderPageWidgets,q as trackCart,i as utils};
2
2
  //# sourceMappingURL=shopify.esm.js.map
@@ -1,2 +1,2 @@
1
- import{waitForElement as t}from"../utils/wait-for-element.js";import{getCookieMap as r,getCookieValue as o}from"../utils/cookies.js";import{initNetworkListeners as v}from"../utils/network-listeners.js";import{e as I}from"../chunks/events-5IECSF-x.esm.js";import{h as P,C as T,O as W,s as j,L as q}from"../chunks/order-page-MyFrJe1o.esm.js";import"../chunks/beam-errors-AMvTvR1C.esm.js";import"../chunks/lodash-P8OIs-at.esm.js";import"../utils/local-storage.js";import"../utils/memoize-last.js";import"../chunks/cart-contents-h60geKWa.esm.js";import"../chunks/update-cart-OkpQAdyP.esm.js";import"../chunks/routes-wPiw5U5n.esm.js";import"../utils/logger.js";import"../utils/remote-session.js";import"./post-purchase.js";import"../chunks/lit-yVXn5Cbs.esm.js";import"../chunks/enforce-config-n0D_zfMC.esm.js";import"./redeem-transaction.js";import"../chunks/progress-bar-7gWYaGlq.esm.js";import"./beam-partner-logos.js";import"../chunks/localize-0rA0DbzI.esm.js";import"../chunks/css-card-grid-3b56QBzq.esm.js";import"./impact-overview.js";import"../chunks/vendor-eeJfrOkP.esm.js";import"../chunks/is-all-html-elements-SdSkxirh.esm.js";import"../chunks/responsive-LYEag6TI.esm.js";const i={waitForElement:t,getCookieMap:r,getCookieValue:o};export{P as addBeamAttributesToCart,I as events,T as getCurrentCart,v as initNetworkListeners,W as registerCartIntegration,j as showBeamOrderPageWidgets,q as trackCart,i as utils};
1
+ import{waitForElement as t}from"../utils/wait-for-element.js";import{getCookieMap as r,getCookieValue as o}from"../utils/cookies.js";import{initNetworkListeners as v}from"../utils/network-listeners.js";import{e as I}from"../chunks/events-5IECSF-x.esm.js";import{h as P,C as T,O as W,s as j,L as q}from"../chunks/order-page-W1jR35W9.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../chunks/lodash-P8OIs-at.esm.js";import"../utils/local-storage.js";import"../utils/memoize-last.js";import"../chunks/cart-contents-h60geKWa.esm.js";import"../chunks/update-cart-T32-282v.esm.js";import"../chunks/routes-CqjzL4oL.esm.js";import"../utils/logger.js";import"../utils/remote-session.js";import"./post-purchase.js";import"../chunks/lit-yVXn5Cbs.esm.js";import"../chunks/enforce-config-fo8kIfoY.esm.js";import"./redeem-transaction.js";import"../chunks/progress-bar-7gWYaGlq.esm.js";import"./beam-partner-logos.js";import"../chunks/localize-pzAAkBvG.esm.js";import"../chunks/css-card-grid-3b56QBzq.esm.js";import"./impact-overview.js";import"../chunks/vendor-eeJfrOkP.esm.js";import"../chunks/is-all-html-elements-SdSkxirh.esm.js";import"../chunks/responsive-LYEag6TI.esm.js";const i={waitForElement:t,getCookieMap:r,getCookieValue:o};export{P as addBeamAttributesToCart,I as events,T as getCurrentCart,v as initNetworkListeners,W as registerCartIntegration,j as showBeamOrderPageWidgets,q as trackCart,i as utils};
2
2
  //# sourceMappingURL=shopify.js.map
@@ -100,7 +100,7 @@ declare class BeamSubscriptionManagement extends LitElement {
100
100
  } | null;
101
101
  }>;
102
102
  handleSwapNonprofitButtonClick(): void;
103
- renderSwapNonprofitButton(): lit_html.TemplateResult<1> | "";
103
+ renderSwapNonprofitButton(): "" | lit_html.TemplateResult<1>;
104
104
  get cssVariables(): any;
105
105
  static styles: lit.CSSResult[];
106
106
  render(): lit_html.TemplateResult<1>;
@@ -1,6 +1,15 @@
1
- import{f as g,g as o,t as p,h as f,y as l}from"../chunks/lit-yVXn5Cbs.esm.js";import{D as y,b as S,h as w}from"../chunks/routes-USQ3n64Y.esm.js";import{c as v,d as x,A as m,e as d,a as C,_ as h}from"../chunks/enforce-config-MqLZWolV.esm.js";import"../chunks/beam-errors-AMvTvR1C.esm.js";import"../utils/logger.esm.js";const N={en:{nonprofitSwapText:({brandName:i=""})=>`Support a new nonprofit with your next ${i} recurring order`},fr:{nonprofitSwapText:({brandName:i=""})=>`Soutenez une nouvelle organisation \xE0 but non lucratif avec votre prochaine commande r\xE9currente ${i}`},de:{nonprofitSwapText:({brandName:i=""})=>`Unterst\xFCtzen Sie eine neue gemeinn\xFCtzige Organisation mit Ihrer n\xE4chsten wiederkehrenden Bestellung bei ${i}`},es:{nonprofitSwapText:({brandName:i=""})=>`Apoye a una nueva organizaci\xF3n sin fines de lucro con su pr\xF3ximo pedido recurrente ${i}`},it:{nonprofitSwapText:({brandName:i=""})=>`Sostieni una nuova organizzazione non profit con il tuo prossimo ordine ricorrente ${i}`},pl:{nonprofitSwapText:({brandName:i=""})=>`Wesprzyj now\u0105 organizacj\u0119 non-profit przy kolejnym zam\xF3wieniu cyklicznym ${i}`}};var M=Object.defineProperty,B=Object.getOwnPropertyDescriptor,n=(i,t,s,a)=>{for(var r=a>1?void 0:a?B(t,s):t,c=i.length-1,b;c>=0;c--)(b=i[c])&&(r=(a?b(t,s,r):b(r))||r);return a&&r&&M(t,s,r),r};const u=["baseUrl","apiKey","subscriptionId","email","lang"];class e extends f{constructor(){super(...arguments),this.baseUrl=y,this.lang="en",this.debug=!1,this.activeWidget=null,this.nonprofitId=null,this.userId=null,this.chainName=null,this.subscriptionDataController=new m(this,this.fetchSubscription),this.eligibleNonprofitsDataController=new m(this,this.fetchEligibleNonprofits)}async firstUpdated(){d(u,this),await this.loadWidget()}async loadWidget(){await Promise.all([this.fetchEligibleNonprofits(),this.fetchSubscription()]),this.activeWidget=this.nonprofitId?"impact-overview":"redeem-transaction"}async fetchEligibleNonprofits(){d(u,this);const t=await S({baseUrl:this.baseUrl,headers:{authorization:`Api-Key ${this.apiKey}`},requestBody:{postalCode:this.postalCode?this.postalCode:void 0,countryCode:this.countryCode?this.countryCode:void 0,widgetName:"subscription-management",version:"1.0.0"}});return this.chainName=t.chain.name,this.storeId=t.store.id,t}async fetchSubscription(){d(u,this);const t=await w({baseUrl:this.baseUrl,headers:{authorization:`Api-Key ${this.apiKey}`},requestBody:{remoteSubscriptionId:this.subscriptionId,email:this.email}});return this.userId=t.beamUserId,this.nonprofitId=t.nonprofit?.id||null,t}handleSwapNonprofitButtonClick(){this.activeWidget="redeem-transaction"}renderSwapNonprofitButton(){return this.activeWidget==="impact-overview"?l`<button class="swap-nonprofit-button" @click="${this.handleSwapNonprofitButtonClick}">
2
- ${N[this.lang].nonprofitSwapText({brandName:this.chainName||""})}
3
- </button>`:""}get cssVariables(){const t={"--beam-fontFamily":"inherit","--beam-fontStyle":"inherit","--beam-fontSize":"inherit","--beam-textColor":"inherit","--beam-backgroundColor":"inherit","--beam-SubscriptionManagement-widgetContainer-borderColor":"#d5d5d5","--beam-SubscriptionManagement-widgetContainer-borderRadius":"4px","--beam-SubscriptionManagement-widgetContainer-padding":"15px","--beam-SubscriptionManagement-widgetContainer-backgroundColor":"inherit","--beam-SubscriptionManagement-widgetContainer-maxWidth":"800px","--beam-SubscriptionManagement-swapNonprofitButtonText-textDecoration":"underline","--beam-SubscriptionManagement-swapNonprofitButtonText-fontFamily":"inherit","--beam-SubscriptionManagement-swapNonprofitButtonText-fontStyle":"inherit","--beam-SubscriptionManagement-swapNonprofitButtonText-fontWeight":"inherit","--beam-SubscriptionManagement-swapNonprofitButtonText-lineHeight":"inherit","--beam-SubscriptionManagement-swapNonprofitButtonText-marginTop":"10px","--beam-SubscriptionManagement-swapNonprofitButtonText-fontSize":"inherit","--beam-SubscriptionManagement-swapNonprofitButtonText-color":"inherit"},s=this.eligibleNonprofitsDataController?.data?.config?.web?.theme||{},a={...t,...s};return Object.assign(Object.create({toCSS(){return C(this)}}),a)}render(){let t;if((this.subscriptionDataController.loading||this.eligibleNonprofitsDataController.loading)&&(t=""),(this.subscriptionDataController.error||this.eligibleNonprofitsDataController.error)&&this.debug){if(this.subscriptionDataController.error!==null)return h({error:this.subscriptionDataController.error});if(this.eligibleNonprofitsDataController.error!==null)return h({error:this.eligibleNonprofitsDataController.error})}else t="";return this.activeWidget==="redeem-transaction"?t=l` <p>Redeem transaction widget placeholder</p>`:this.activeWidget==="impact-overview"&&(t=l`
1
+ import{f as g,g as o,t as p,h as f,y as l}from"../chunks/lit-yVXn5Cbs.esm.js";import{D as y,b as S,h as w}from"../chunks/routes-lsOWIDmE.esm.js";import{c as v,d as x,A as m,e as b,a as C,_ as h}from"../chunks/enforce-config-qna7hEL6.esm.js";import{c as N}from"../chunks/events-5IECSF-x.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../utils/logger.esm.js";const M={en:{nonprofitSwapText:({brandName:i=""})=>`Support a new nonprofit with your next ${i} recurring order`},fr:{nonprofitSwapText:({brandName:i=""})=>`Soutenez une nouvelle organisation \xE0 but non lucratif avec votre prochaine commande r\xE9currente ${i}`},de:{nonprofitSwapText:({brandName:i=""})=>`Unterst\xFCtzen Sie eine neue gemeinn\xFCtzige Organisation mit Ihrer n\xE4chsten wiederkehrenden Bestellung bei ${i}`},es:{nonprofitSwapText:({brandName:i=""})=>`Apoye a una nueva organizaci\xF3n sin fines de lucro con su pr\xF3ximo pedido recurrente ${i}`},it:{nonprofitSwapText:({brandName:i=""})=>`Sostieni una nuova organizzazione non profit con il tuo prossimo ordine ricorrente ${i}`},pl:{nonprofitSwapText:({brandName:i=""})=>`Wesprzyj now\u0105 organizacj\u0119 non-profit przy kolejnym zam\xF3wieniu cyklicznym ${i}`}};var B=Object.defineProperty,$=Object.getOwnPropertyDescriptor,n=(i,t,r,a)=>{for(var s=a>1?void 0:a?$(t,r):t,c=i.length-1,d;c>=0;c--)(d=i[c])&&(s=(a?d(t,r,s):d(s))||s);return a&&s&&B(t,r,s),s};const u=["baseUrl","apiKey","subscriptionId","email","lang"];class e extends f{constructor(){super(...arguments),this.baseUrl=y,this.lang="en",this.debug=!1,this.activeWidget=null,this.nonprofitId=null,this.userId=null,this.chainName=null,this.subscriptionDataController=new m(this,this.fetchSubscription),this.eligibleNonprofitsDataController=new m(this,this.fetchEligibleNonprofits)}async firstUpdated(){b(u,this),await this.loadWidget()}async loadWidget(){await Promise.all([this.fetchEligibleNonprofits(),this.fetchSubscription()]),this.activeWidget=this.nonprofitId?"impact-overview":"redeem-transaction"}async fetchEligibleNonprofits(){b(u,this);const t=await S({baseUrl:this.baseUrl,headers:{authorization:`Api-Key ${this.apiKey}`},requestBody:{postalCode:this.postalCode?this.postalCode:void 0,countryCode:this.countryCode?this.countryCode:void 0,widgetName:"subscription-management",version:"1.0.0"}});return this.chainName=t.chain.name,this.storeId=t.store.id,t}async fetchSubscription(){b(u,this);const t=await w({baseUrl:this.baseUrl,headers:{authorization:`Api-Key ${this.apiKey}`},requestBody:{remoteSubscriptionId:this.subscriptionId,email:this.email}});return this.userId=t.beamUserId,this.nonprofitId=t.nonprofit?.id||null,t}handleSwapNonprofitButtonClick(){this.activeWidget="redeem-transaction"}renderSwapNonprofitButton(){return this.activeWidget==="impact-overview"?l`<button class="swap-nonprofit-button" @click="${this.handleSwapNonprofitButtonClick}">
2
+ ${M[this.lang].nonprofitSwapText({brandName:this.chainName||""})}
3
+ </button>`:""}get cssVariables(){const t={"--beam-fontFamily":"inherit","--beam-fontStyle":"inherit","--beam-fontSize":"inherit","--beam-textColor":"inherit","--beam-backgroundColor":"inherit","--beam-SubscriptionManagement-widgetContainer-borderColor":"#d5d5d5","--beam-SubscriptionManagement-widgetContainer-borderRadius":"4px","--beam-SubscriptionManagement-widgetContainer-padding":"15px","--beam-SubscriptionManagement-widgetContainer-backgroundColor":"inherit","--beam-SubscriptionManagement-widgetContainer-maxWidth":"800px","--beam-SubscriptionManagement-swapNonprofitButtonText-textDecoration":"underline","--beam-SubscriptionManagement-swapNonprofitButtonText-fontFamily":"inherit","--beam-SubscriptionManagement-swapNonprofitButtonText-fontStyle":"inherit","--beam-SubscriptionManagement-swapNonprofitButtonText-fontWeight":"inherit","--beam-SubscriptionManagement-swapNonprofitButtonText-lineHeight":"inherit","--beam-SubscriptionManagement-swapNonprofitButtonText-marginTop":"10px","--beam-SubscriptionManagement-swapNonprofitButtonText-fontSize":"inherit","--beam-SubscriptionManagement-swapNonprofitButtonText-color":"inherit"},r=this.eligibleNonprofitsDataController?.data?.config?.web?.theme||{},a={...t,...r};return Object.assign(Object.create({toCSS(){return C(this)}}),a)}render(){let t;if((this.subscriptionDataController.loading||this.eligibleNonprofitsDataController.loading)&&(t=""),(this.subscriptionDataController.error||this.eligibleNonprofitsDataController.error)&&this.debug){if(this.subscriptionDataController.error!==null)return h({error:this.subscriptionDataController.error});if(this.eligibleNonprofitsDataController.error!==null)return h({error:this.eligibleNonprofitsDataController.error})}else t="";return this.activeWidget==="redeem-transaction"?t=l` <beam-redeem-transaction
4
+ part="redeem-transaction"
5
+ subscriptionId="${this.subscriptionId}"
6
+ nonprofitId=${this.nonprofitId}
7
+ baseUrl="${this.baseUrl}"
8
+ apiKey="${this.apiKey}"
9
+ lang="${this.lang}"
10
+ ?debug="${this.debug}"
11
+ @beamnonprofitselect="${r=>{if(!(r instanceof N))return;const{selectedNonprofitId:a}=r.detail;this.nonprofitId=a??null,this.activeWidget="impact-overview"}}"
12
+ ></beam-redeem-transaction>`:this.activeWidget==="impact-overview"&&(t=l`
4
13
  <beam-impact-overview
5
14
  part="impact-overview"
6
15
  baseUrl="${this.baseUrl}"
@@ -26,6 +35,7 @@ import{f as g,g as o,t as p,h as f,y as l}from"../chunks/lit-yVXn5Cbs.esm.js";im
26
35
  font-size: var(--beam-fontSize);
27
36
  background-color: var(--beam-backgroundColor);
28
37
  color: var(--beam-textColor);
38
+ word-break: normal;
29
39
  }
30
40
  .swap-nonprofit-button {
31
41
  margin-top: var(--beam-SubscriptionManagement-swapNonprofitButtonText-marginTop, 10px);
@@ -1 +1 @@
1
- {"version":3,"file":"subscription-management.esm.js","sources":["../../src/components/subscription-management/strings.ts","../../src/components/subscription-management/index.ts"],"sourcesContent":["export const strings = {\n en: {\n nonprofitSwapText: ({ brandName = \"\" }) => `Support a new nonprofit with your next ${brandName} recurring order`,\n },\n fr: {\n nonprofitSwapText: ({ brandName = \"\" }) =>\n `Soutenez une nouvelle organisation à but non lucratif avec votre prochaine commande récurrente ${brandName}`,\n },\n de: {\n nonprofitSwapText: ({ brandName = \"\" }) =>\n `Unterstützen Sie eine neue gemeinnützige Organisation mit Ihrer nächsten wiederkehrenden Bestellung bei ${brandName}`,\n },\n es: {\n nonprofitSwapText: ({ brandName = \"\" }) =>\n `Apoye a una nueva organización sin fines de lucro con su próximo pedido recurrente ${brandName}`,\n },\n it: {\n nonprofitSwapText: ({ brandName = \"\" }) =>\n `Sostieni una nuova organizzazione non profit con il tuo prossimo ordine ricorrente ${brandName}`,\n },\n pl: {\n nonprofitSwapText: ({ brandName = \"\" }) =>\n `Wesprzyj nową organizację non-profit przy kolejnym zamówieniu cyklicznym ${brandName}`,\n },\n};\n","import { css, html, LitElement } from \"lit\";\nimport { property } from \"lit/decorators/property.js\";\nimport { state } from \"lit/decorators/state.js\";\nimport { DEFAULT_BASE_URL } from \"../../api-sdk/constants\";\nimport { LANGUAGES } from \"../../api-sdk/types\";\nimport { TCart } from \"../../shared/cart-contents\";\nimport { enforceConfig } from \"../../shared/enforce-config\";\nimport { postFindSubscription, postChainEligibleNonprofitsForCart } from \"../../api-sdk/v3/routes\";\nimport { AsyncController } from \"../../shared/controllers/async-controller\";\nimport { cssReset } from \"../../shared/css-reset\";\nimport { defineCustomElement } from \"../../shared/defineCustomElement\";\nimport { _errorMessage } from \"../../shared/fragments/error-message-template\";\nimport { _cssVariableMap } from \"../../shared/fragments/css-variable-map\";\nimport { strings } from \"./strings\";\n\nconst REQUIRED_DATA_PROPS = [\"baseUrl\", \"apiKey\", \"subscriptionId\", \"email\", \"lang\"];\n\nexport class BeamSubscriptionManagement extends LitElement {\n static tagName = \"beam-subscription-management\";\n\n @property({ type: String })\n public baseUrl: string = DEFAULT_BASE_URL;\n\n @property({ type: String })\n public apiKey!: string;\n\n @property({ type: String })\n public subscriptionId!: string;\n\n @property({ type: Number, reflect: true })\n public storeId?: number; // Either storeId or postalCode, countryCode must be provided\n\n @property({ type: String })\n public email!: string;\n\n @property({ type: String })\n public postalCode?: string;\n\n @property({ type: String })\n public countryCode?: string;\n\n @property({ type: String })\n public lang: LANGUAGES = \"en\";\n\n @property({ type: Object })\n public cart?: TCart;\n\n @property({ type: Boolean })\n public debug = false;\n\n @state() private activeWidget: \"redeem-transaction\" | \"impact-overview\" | null = null; // Based on /findSubscriptionByRemoteId\n @state() private nonprofitId: number | null = null; // From /findSubscriptionByRemoteId response\n @state() private userId: string | null = null; // From findSubscriptionByRemoteId\n @state() private chainName: string | null = null; // From findEligibleNonprofitsForCart\n\n private subscriptionDataController = new AsyncController<typeof this.fetchSubscription>(this, this.fetchSubscription);\n private eligibleNonprofitsDataController = new AsyncController<typeof this.fetchEligibleNonprofits>(\n this,\n this.fetchEligibleNonprofits\n );\n\n async firstUpdated() {\n enforceConfig(REQUIRED_DATA_PROPS, this);\n await this.loadWidget();\n }\n\n async loadWidget() {\n // In parallel:\n // (1). Fetch eligible nonprofits [storeId and chainName]\n // (2). Fetch subscription [userId and nonprofitId]\n await Promise.all([this.fetchEligibleNonprofits(), this.fetchSubscription()]);\n this.activeWidget = this.nonprofitId ? \"impact-overview\" : \"redeem-transaction\";\n }\n\n async fetchEligibleNonprofits() {\n enforceConfig(REQUIRED_DATA_PROPS, this);\n const res = await postChainEligibleNonprofitsForCart({\n baseUrl: this.baseUrl,\n headers: {\n authorization: `Api-Key ${this.apiKey}`,\n },\n requestBody: {\n postalCode: this.postalCode ? this.postalCode : undefined,\n countryCode: this.countryCode ? this.countryCode : undefined,\n widgetName: \"subscription-management\",\n version: \"1.0.0\",\n },\n });\n this.chainName = res.chain.name;\n this.storeId = res.store.id;\n return res;\n }\n\n async fetchSubscription() {\n enforceConfig(REQUIRED_DATA_PROPS, this);\n const result = await postFindSubscription({\n baseUrl: this.baseUrl,\n headers: {\n authorization: `Api-Key ${this.apiKey}`,\n },\n requestBody: {\n remoteSubscriptionId: this.subscriptionId,\n email: this.email,\n },\n });\n\n this.userId = result.beamUserId; // Returned in response regardless of subscription redemption\n this.nonprofitId = result.nonprofit?.id || null;\n return result;\n }\n\n handleSwapNonprofitButtonClick() {\n this.activeWidget = \"redeem-transaction\";\n }\n\n renderSwapNonprofitButton() {\n if (this.activeWidget === \"impact-overview\") {\n return html`<button class=\"swap-nonprofit-button\" @click=\"${this.handleSwapNonprofitButtonClick}\">\n ${strings[this.lang].nonprofitSwapText({ brandName: this.chainName || \"\" })}\n </button>`;\n } else {\n return \"\";\n }\n }\n\n public get cssVariables() {\n const defaults = {\n \"--beam-fontFamily\": \"inherit\",\n \"--beam-fontStyle\": \"inherit\",\n \"--beam-fontSize\": \"inherit\",\n \"--beam-textColor\": \"inherit\",\n \"--beam-backgroundColor\": \"inherit\",\n \"--beam-SubscriptionManagement-widgetContainer-borderColor\": \"#d5d5d5\",\n \"--beam-SubscriptionManagement-widgetContainer-borderRadius\": \"4px\",\n \"--beam-SubscriptionManagement-widgetContainer-padding\": \"15px\",\n \"--beam-SubscriptionManagement-widgetContainer-backgroundColor\": \"inherit\",\n \"--beam-SubscriptionManagement-widgetContainer-maxWidth\": \"800px\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-textDecoration\": \"underline\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-fontFamily\": \"inherit\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-fontStyle\": \"inherit\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-fontWeight\": \"inherit\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-lineHeight\": \"inherit\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-marginTop\": \"10px\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-fontSize\": \"inherit\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-color\": \"inherit\",\n };\n\n const remoteConfig = this.eligibleNonprofitsDataController?.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 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);\n font-style: var(--beam-fontStyle);\n font-size: var(--beam-fontSize);\n background-color: var(--beam-backgroundColor);\n color: var(--beam-textColor);\n }\n .swap-nonprofit-button {\n margin-top: var(--beam-SubscriptionManagement-swapNonprofitButtonText-marginTop, 10px);\n color: var(--beam-SubscriptionManagement-swapNonprofitButtonText-color, inherit);\n font-size: var(--beam-SubscriptionManagement-swapNonprofitButtonText-fontSize, inherit);\n text-decoration: var(--beam-SubscriptionManagement-swapNonprofitButtonText-textDecoration, underline);\n font-family: var(--beam-SubscriptionManagement-swapNonprofitButtonText-fontFamily, inherit);\n font-style: var(--beam-SubscriptionManagement-swapNonprofitButtonText-fontStyle, inherit);\n font-weight: var(--beam-SubscriptionManagement-swapNonprofitButtonText-fontWeight, inherit);\n line-height: var(--beam-SubscriptionManagement-swapNonprofitButtonText-lineHeight, inherit);\n background: none;\n border: none;\n cursor: pointer;\n }\n .sub-widget-container {\n background-color: var(--beam-SubscriptionManagement-widgetContainer-backgroundColor, inherit);\n border: 1px solid var(--beam-SubscriptionManagement-widgetContainer-borderColor, #d5d5d5);\n border-radius: var(--beam-SubscriptionManagement-widgetContainer-borderRadius, 4px);\n overflow: hidden; /* maintain clean border-radius */\n padding: var(--beam-SubscriptionManagement-widgetContainer-padding, 15px);\n max-width: var(--beam-SubscriptionManagement-widgetContainer-maxWidth, 800px);\n }\n }`,\n ];\n\n render() {\n let content;\n\n if (this.subscriptionDataController.loading || this.eligibleNonprofitsDataController.loading) {\n content = \"\";\n }\n\n if ((this.subscriptionDataController.error || this.eligibleNonprofitsDataController.error) && this.debug) {\n if (this.subscriptionDataController.error !== null) {\n return _errorMessage({ error: this.subscriptionDataController.error });\n } else if (this.eligibleNonprofitsDataController.error !== null) {\n return _errorMessage({ error: this.eligibleNonprofitsDataController.error });\n }\n } else {\n content = \"\";\n }\n\n if (this.activeWidget === \"redeem-transaction\") {\n // TODO: https://beamimpact.atlassian.net/browse/SDK-1695\n content = html` <p>Redeem transaction widget placeholder</p>`;\n } else if (this.activeWidget === \"impact-overview\") {\n content = html`\n <beam-impact-overview\n part=\"impact-overview\"\n baseUrl=\"${this.baseUrl}\"\n apiKey=\"${this.apiKey}\"\n userId=\"${this.userId}\"\n nonprofitId=\"${this.nonprofitId}\"\n lang=\"${this.lang}\"\n ?debug=\"${this.debug}\"\n ></beam-impact-overview>\n `;\n }\n return html`\n <style>\n :host {\n ${this.cssVariables.toCSS()}\n }\n </style>\n <div class=\"sub-widget-container\">${content}</div>\n ${this.renderSwapNonprofitButton()}\n `;\n }\n}\n\ndefineCustomElement(BeamSubscriptionManagement);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"beam-subscription-management\": BeamSubscriptionManagement;\n }\n}\n"],"names":["strings","brandName","f","h","i","l","n","t","o","a","REQUIRED_DATA_PROPS","BeamSubscriptionManagement","LitElement","DEFAULT_BASE_URL","AsyncController","enforceConfig","res","postChainEligibleNonprofitsForCart","result","postFindSubscription","html","defaults","remoteConfig","config","_cssVariableMap","content","_errorMessage","cssReset","css","__decorateClass","property","state","defineCustomElement"],"mappings":"8TAAO,MAAMA,EAAU,CACrB,GAAI,CACF,kBAAmB,CAAC,CAAE,UAAAC,EAAY,EAAG,IAAM,0CAA0CA,CAAS,kBAChG,EACA,GAAI,CACF,kBAAmB,CAAC,CAAE,UAAAA,EAAY,EAAG,IACnC,wGAAkGA,CAAS,EAC/G,EACA,GAAI,CACF,kBAAmB,CAAC,CAAE,UAAAA,EAAY,EAAG,IACnC,oHAA2GA,CAAS,EACxH,EACA,GAAI,CACF,kBAAmB,CAAC,CAAE,UAAAA,EAAY,EAAG,IACnC,4FAAsFA,CAAS,EACnG,EACA,GAAI,CACF,kBAAmB,CAAC,CAAE,UAAAA,EAAY,EAAG,IACnC,sFAAsFA,CAAS,EACnG,EACA,GAAI,CACF,kBAAmB,CAAC,CAAE,UAAAA,EAAY,EAAG,IACnC,yFAA4EA,CAAS,EACzF,CACF,ECxBA,IAAAC,EAAA,OAAA,eAAAC,EAAA,OAAA,yBAAAC,EAAA,CAAAC,EAAAC,EAAAC,EAAAC,IAAA,CAAA,QAAA,EAAAA,EAAA,EAAA,OAAAA,EAAAL,EAAAG,EAAAC,CAAA,EAAAD,EAAAG,EAAAJ,EAAA,OAAA,EAAA,EAAAI,GAAA,EAAAA,KAAA,EAAAJ,EAAA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,CAAAA,EAAAA,EAAA,CADNC,EAAS,CAAE,KAAM,MAAO,CAAC,CArBf,EAAAnB,EAsBJ,UAGAkB,cAAAA,CAAAA,EAAAA,EAAA,CADNC,EAAS,CAAE,KAAM,MAAO,CAAC,CAxBf,EAAAnB,EAyBJ,UAGAkB,OAAAA,CAAAA,EAAAA,EAAA,CADNC,EAAS,CAAE,KAAM,MAAO,CAAC,CA3Bf,EAAAnB,EA4BJ,UAGAkB,OAAAA,CAAAA,EAAAA,EAAA,CADNC,EAAS,CAAE,KAAM,OAAQ,CAAC,CAAA,EA9BhBnB,EA+BJ,UAAA,QAAA,CAAA,EAEUkB,EAAA,CAAhBE,EAAM,CAAA,EAjCIpB,EAiCM,UAAA,eAAA,CAAA,EACAkB,EAAA,CAAhBE,EAAM,CAAA,EAlCIpB,EAkCM,UAAA,cAAA,CAAA,EACAkB,EAAA,CAAhBE,EAAM,CAAA,EAnCIpB,EAmCM,UAAA,SAAA,CAAA,EACAkB,EAAA,CAAhBE,EAAM,CAAA,EApCIpB,EAoCM,UAAA,YAAA,CAAA,EA0LnBqB,EAAoBrB,CAA0B"}
1
+ {"version":3,"file":"subscription-management.esm.js","sources":["../../src/components/subscription-management/strings.ts","../../src/components/subscription-management/index.ts"],"sourcesContent":["export const strings = {\n en: {\n nonprofitSwapText: ({ brandName = \"\" }) => `Support a new nonprofit with your next ${brandName} recurring order`,\n },\n fr: {\n nonprofitSwapText: ({ brandName = \"\" }) =>\n `Soutenez une nouvelle organisation à but non lucratif avec votre prochaine commande récurrente ${brandName}`,\n },\n de: {\n nonprofitSwapText: ({ brandName = \"\" }) =>\n `Unterstützen Sie eine neue gemeinnützige Organisation mit Ihrer nächsten wiederkehrenden Bestellung bei ${brandName}`,\n },\n es: {\n nonprofitSwapText: ({ brandName = \"\" }) =>\n `Apoye a una nueva organización sin fines de lucro con su próximo pedido recurrente ${brandName}`,\n },\n it: {\n nonprofitSwapText: ({ brandName = \"\" }) =>\n `Sostieni una nuova organizzazione non profit con il tuo prossimo ordine ricorrente ${brandName}`,\n },\n pl: {\n nonprofitSwapText: ({ brandName = \"\" }) =>\n `Wesprzyj nową organizację non-profit przy kolejnym zamówieniu cyklicznym ${brandName}`,\n },\n};\n","import { css, html, LitElement } from \"lit\";\nimport { property } from \"lit/decorators/property.js\";\nimport { state } from \"lit/decorators/state.js\";\nimport { DEFAULT_BASE_URL } from \"../../api-sdk/constants\";\nimport { LANGUAGES } from \"../../api-sdk/types\";\nimport { TCart } from \"../../shared/cart-contents\";\nimport { enforceConfig } from \"../../shared/enforce-config\";\nimport { postFindSubscription, postChainEligibleNonprofitsForCart } from \"../../api-sdk/v3/routes\";\nimport { AsyncController } from \"../../shared/controllers/async-controller\";\nimport { cssReset } from \"../../shared/css-reset\";\nimport { defineCustomElement } from \"../../shared/defineCustomElement\";\nimport { _errorMessage } from \"../../shared/fragments/error-message-template\";\nimport { _cssVariableMap } from \"../../shared/fragments/css-variable-map\";\nimport { BeamNonprofitSelectEvent } from \"../../utils/events\";\nimport { strings } from \"./strings\";\n\nconst REQUIRED_DATA_PROPS = [\"baseUrl\", \"apiKey\", \"subscriptionId\", \"email\", \"lang\"];\n\nexport class BeamSubscriptionManagement extends LitElement {\n static tagName = \"beam-subscription-management\";\n\n @property({ type: String })\n public baseUrl: string = DEFAULT_BASE_URL;\n\n @property({ type: String })\n public apiKey!: string;\n\n @property({ type: String })\n public subscriptionId!: string;\n\n @property({ type: Number, reflect: true })\n public storeId?: number; // Either storeId or postalCode, countryCode must be provided\n\n @property({ type: String })\n public email!: string;\n\n @property({ type: String })\n public postalCode?: string;\n\n @property({ type: String })\n public countryCode?: string;\n\n @property({ type: String })\n public lang: LANGUAGES = \"en\";\n\n @property({ type: Object })\n public cart?: TCart;\n\n @property({ type: Boolean })\n public debug = false;\n\n @state() private activeWidget: \"redeem-transaction\" | \"impact-overview\" | null = null; // Based on /findSubscriptionByRemoteId\n @state() private nonprofitId: number | null = null; // From /findSubscriptionByRemoteId response\n @state() private userId: string | null = null; // From findSubscriptionByRemoteId\n @state() private chainName: string | null = null; // From findEligibleNonprofitsForCart\n\n private subscriptionDataController = new AsyncController<typeof this.fetchSubscription>(this, this.fetchSubscription);\n private eligibleNonprofitsDataController = new AsyncController<typeof this.fetchEligibleNonprofits>(\n this,\n this.fetchEligibleNonprofits\n );\n\n async firstUpdated() {\n enforceConfig(REQUIRED_DATA_PROPS, this);\n await this.loadWidget();\n }\n\n async loadWidget() {\n // In parallel:\n // (1). Fetch eligible nonprofits [storeId and chainName]\n // (2). Fetch subscription [userId and nonprofitId]\n await Promise.all([this.fetchEligibleNonprofits(), this.fetchSubscription()]);\n this.activeWidget = this.nonprofitId ? \"impact-overview\" : \"redeem-transaction\";\n }\n\n async fetchEligibleNonprofits() {\n enforceConfig(REQUIRED_DATA_PROPS, this);\n const res = await postChainEligibleNonprofitsForCart({\n baseUrl: this.baseUrl,\n headers: {\n authorization: `Api-Key ${this.apiKey}`,\n },\n requestBody: {\n postalCode: this.postalCode ? this.postalCode : undefined,\n countryCode: this.countryCode ? this.countryCode : undefined,\n widgetName: \"subscription-management\",\n version: \"1.0.0\",\n },\n });\n this.chainName = res.chain.name;\n this.storeId = res.store.id;\n return res;\n }\n\n async fetchSubscription() {\n enforceConfig(REQUIRED_DATA_PROPS, this);\n const result = await postFindSubscription({\n baseUrl: this.baseUrl,\n headers: {\n authorization: `Api-Key ${this.apiKey}`,\n },\n requestBody: {\n remoteSubscriptionId: this.subscriptionId,\n email: this.email,\n },\n });\n\n this.userId = result.beamUserId; // Returned in response regardless of subscription redemption\n this.nonprofitId = result.nonprofit?.id || null;\n return result;\n }\n\n handleSwapNonprofitButtonClick() {\n this.activeWidget = \"redeem-transaction\";\n }\n\n renderSwapNonprofitButton() {\n if (this.activeWidget === \"impact-overview\") {\n return html`<button class=\"swap-nonprofit-button\" @click=\"${this.handleSwapNonprofitButtonClick}\">\n ${strings[this.lang].nonprofitSwapText({ brandName: this.chainName || \"\" })}\n </button>`;\n } else {\n return \"\";\n }\n }\n\n public get cssVariables() {\n const defaults = {\n \"--beam-fontFamily\": \"inherit\",\n \"--beam-fontStyle\": \"inherit\",\n \"--beam-fontSize\": \"inherit\",\n \"--beam-textColor\": \"inherit\",\n \"--beam-backgroundColor\": \"inherit\",\n \"--beam-SubscriptionManagement-widgetContainer-borderColor\": \"#d5d5d5\",\n \"--beam-SubscriptionManagement-widgetContainer-borderRadius\": \"4px\",\n \"--beam-SubscriptionManagement-widgetContainer-padding\": \"15px\",\n \"--beam-SubscriptionManagement-widgetContainer-backgroundColor\": \"inherit\",\n \"--beam-SubscriptionManagement-widgetContainer-maxWidth\": \"800px\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-textDecoration\": \"underline\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-fontFamily\": \"inherit\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-fontStyle\": \"inherit\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-fontWeight\": \"inherit\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-lineHeight\": \"inherit\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-marginTop\": \"10px\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-fontSize\": \"inherit\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-color\": \"inherit\",\n };\n\n const remoteConfig = this.eligibleNonprofitsDataController?.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 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);\n font-style: var(--beam-fontStyle);\n font-size: var(--beam-fontSize);\n background-color: var(--beam-backgroundColor);\n color: var(--beam-textColor);\n word-break: normal;\n }\n .swap-nonprofit-button {\n margin-top: var(--beam-SubscriptionManagement-swapNonprofitButtonText-marginTop, 10px);\n color: var(--beam-SubscriptionManagement-swapNonprofitButtonText-color, inherit);\n font-size: var(--beam-SubscriptionManagement-swapNonprofitButtonText-fontSize, inherit);\n text-decoration: var(--beam-SubscriptionManagement-swapNonprofitButtonText-textDecoration, underline);\n font-family: var(--beam-SubscriptionManagement-swapNonprofitButtonText-fontFamily, inherit);\n font-style: var(--beam-SubscriptionManagement-swapNonprofitButtonText-fontStyle, inherit);\n font-weight: var(--beam-SubscriptionManagement-swapNonprofitButtonText-fontWeight, inherit);\n line-height: var(--beam-SubscriptionManagement-swapNonprofitButtonText-lineHeight, inherit);\n background: none;\n border: none;\n cursor: pointer;\n }\n .sub-widget-container {\n background-color: var(--beam-SubscriptionManagement-widgetContainer-backgroundColor, inherit);\n border: 1px solid var(--beam-SubscriptionManagement-widgetContainer-borderColor, #d5d5d5);\n border-radius: var(--beam-SubscriptionManagement-widgetContainer-borderRadius, 4px);\n overflow: hidden; /* maintain clean border-radius */\n padding: var(--beam-SubscriptionManagement-widgetContainer-padding, 15px);\n max-width: var(--beam-SubscriptionManagement-widgetContainer-maxWidth, 800px);\n }\n }`,\n ];\n\n render() {\n let content;\n\n if (this.subscriptionDataController.loading || this.eligibleNonprofitsDataController.loading) {\n content = \"\";\n }\n\n if ((this.subscriptionDataController.error || this.eligibleNonprofitsDataController.error) && this.debug) {\n if (this.subscriptionDataController.error !== null) {\n return _errorMessage({ error: this.subscriptionDataController.error });\n } else if (this.eligibleNonprofitsDataController.error !== null) {\n return _errorMessage({ error: this.eligibleNonprofitsDataController.error });\n }\n } else {\n content = \"\";\n }\n\n if (this.activeWidget === \"redeem-transaction\") {\n content = html` <beam-redeem-transaction\n part=\"redeem-transaction\"\n subscriptionId=\"${this.subscriptionId}\"\n nonprofitId=${this.nonprofitId}\n baseUrl=\"${this.baseUrl}\"\n apiKey=\"${this.apiKey}\"\n lang=\"${this.lang}\"\n ?debug=\"${this.debug}\"\n @beamnonprofitselect=\"${(event: Event) => {\n if (!(event instanceof BeamNonprofitSelectEvent)) return; // TS guard\n const { selectedNonprofitId } = event.detail;\n this.nonprofitId = selectedNonprofitId ?? null;\n this.activeWidget = \"impact-overview\";\n }}\"\n ></beam-redeem-transaction>`;\n } else if (this.activeWidget === \"impact-overview\") {\n content = html`\n <beam-impact-overview\n part=\"impact-overview\"\n baseUrl=\"${this.baseUrl}\"\n apiKey=\"${this.apiKey}\"\n userId=\"${this.userId}\"\n nonprofitId=\"${this.nonprofitId}\"\n lang=\"${this.lang}\"\n ?debug=\"${this.debug}\"\n ></beam-impact-overview>\n `;\n }\n return html`\n <style>\n :host {\n ${this.cssVariables.toCSS()}\n }\n </style>\n <div class=\"sub-widget-container\">${content}</div>\n ${this.renderSwapNonprofitButton()}\n `;\n }\n}\n\ndefineCustomElement(BeamSubscriptionManagement);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"beam-subscription-management\": BeamSubscriptionManagement;\n }\n}\n"],"names":["strings","brandName","f","h","i","l","n","t","o","e","a","b","REQUIRED_DATA_PROPS","BeamSubscriptionManagement","LitElement","DEFAULT_BASE_URL","AsyncController","enforceConfig","res","postChainEligibleNonprofitsForCart","result","postFindSubscription","html","defaults","remoteConfig","config","_cssVariableMap","content","_errorMessage","event","BeamNonprofitSelectEvent","selectedNonprofitId","cssReset","css","__decorateClass","property","state","defineCustomElement"],"mappings":"mXAAO,MAAMA,EAAU,CACrB,GAAI,CACF,kBAAmB,CAAC,CAAE,UAAAC,EAAY,EAAG,IAAM,0CAA0CA,CAAS,kBAChG,EACA,GAAI,CACF,kBAAmB,CAAC,CAAE,UAAAA,EAAY,EAAG,IACnC,wGAAkGA,CAAS,EAC/G,EACA,GAAI,CACF,kBAAmB,CAAC,CAAE,UAAAA,EAAY,EAAG,IACnC,oHAA2GA,CAAS,EACxH,EACA,GAAI,CACF,kBAAmB,CAAC,CAAE,UAAAA,EAAY,EAAG,IACnC,4FAAsFA,CAAS,EACnG,EACA,GAAI,CACF,kBAAmB,CAAC,CAAE,UAAAA,EAAY,EAAG,IACnC,sFAAsFA,CAAS,EACnG,EACA,GAAI,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vB,EAmCM,UAAA,SAAA,CAAA,EACAqB,EAAA,CAAhBE,EAAM,CAAA,EApCIvB,EAoCM,UAAA,YAAA,CAAA,EAwMnBwB,EAAoBxB,CAA0B"}
@@ -1,6 +1,15 @@
1
- import{f as g,g as o,t as p,h as f,y as l}from"../chunks/lit-yVXn5Cbs.esm.js";import{D as y,b as S,h as w}from"../chunks/routes-wPiw5U5n.esm.js";import{c as v,d as x,A as m,e as d,a as C,_ as h}from"../chunks/enforce-config-n0D_zfMC.esm.js";import"../chunks/beam-errors-AMvTvR1C.esm.js";import"../utils/logger.js";const N={en:{nonprofitSwapText:({brandName:i=""})=>`Support a new nonprofit with your next ${i} recurring order`},fr:{nonprofitSwapText:({brandName:i=""})=>`Soutenez une nouvelle organisation \xE0 but non lucratif avec votre prochaine commande r\xE9currente ${i}`},de:{nonprofitSwapText:({brandName:i=""})=>`Unterst\xFCtzen Sie eine neue gemeinn\xFCtzige Organisation mit Ihrer n\xE4chsten wiederkehrenden Bestellung bei ${i}`},es:{nonprofitSwapText:({brandName:i=""})=>`Apoye a una nueva organizaci\xF3n sin fines de lucro con su pr\xF3ximo pedido recurrente ${i}`},it:{nonprofitSwapText:({brandName:i=""})=>`Sostieni una nuova organizzazione non profit con il tuo prossimo ordine ricorrente ${i}`},pl:{nonprofitSwapText:({brandName:i=""})=>`Wesprzyj now\u0105 organizacj\u0119 non-profit przy kolejnym zam\xF3wieniu cyklicznym ${i}`}};var M=Object.defineProperty,B=Object.getOwnPropertyDescriptor,n=(i,t,s,a)=>{for(var r=a>1?void 0:a?B(t,s):t,c=i.length-1,b;c>=0;c--)(b=i[c])&&(r=(a?b(t,s,r):b(r))||r);return a&&r&&M(t,s,r),r};const u=["baseUrl","apiKey","subscriptionId","email","lang"];class e extends f{constructor(){super(...arguments),this.baseUrl=y,this.lang="en",this.debug=!1,this.activeWidget=null,this.nonprofitId=null,this.userId=null,this.chainName=null,this.subscriptionDataController=new m(this,this.fetchSubscription),this.eligibleNonprofitsDataController=new m(this,this.fetchEligibleNonprofits)}async firstUpdated(){d(u,this),await this.loadWidget()}async loadWidget(){await Promise.all([this.fetchEligibleNonprofits(),this.fetchSubscription()]),this.activeWidget=this.nonprofitId?"impact-overview":"redeem-transaction"}async fetchEligibleNonprofits(){d(u,this);const t=await S({baseUrl:this.baseUrl,headers:{authorization:`Api-Key ${this.apiKey}`},requestBody:{postalCode:this.postalCode?this.postalCode:void 0,countryCode:this.countryCode?this.countryCode:void 0,widgetName:"subscription-management",version:"1.0.0"}});return this.chainName=t.chain.name,this.storeId=t.store.id,t}async fetchSubscription(){d(u,this);const t=await w({baseUrl:this.baseUrl,headers:{authorization:`Api-Key ${this.apiKey}`},requestBody:{remoteSubscriptionId:this.subscriptionId,email:this.email}});return this.userId=t.beamUserId,this.nonprofitId=t.nonprofit?.id||null,t}handleSwapNonprofitButtonClick(){this.activeWidget="redeem-transaction"}renderSwapNonprofitButton(){return this.activeWidget==="impact-overview"?l`<button class="swap-nonprofit-button" @click="${this.handleSwapNonprofitButtonClick}">
2
- ${N[this.lang].nonprofitSwapText({brandName:this.chainName||""})}
3
- </button>`:""}get cssVariables(){const t={"--beam-fontFamily":"inherit","--beam-fontStyle":"inherit","--beam-fontSize":"inherit","--beam-textColor":"inherit","--beam-backgroundColor":"inherit","--beam-SubscriptionManagement-widgetContainer-borderColor":"#d5d5d5","--beam-SubscriptionManagement-widgetContainer-borderRadius":"4px","--beam-SubscriptionManagement-widgetContainer-padding":"15px","--beam-SubscriptionManagement-widgetContainer-backgroundColor":"inherit","--beam-SubscriptionManagement-widgetContainer-maxWidth":"800px","--beam-SubscriptionManagement-swapNonprofitButtonText-textDecoration":"underline","--beam-SubscriptionManagement-swapNonprofitButtonText-fontFamily":"inherit","--beam-SubscriptionManagement-swapNonprofitButtonText-fontStyle":"inherit","--beam-SubscriptionManagement-swapNonprofitButtonText-fontWeight":"inherit","--beam-SubscriptionManagement-swapNonprofitButtonText-lineHeight":"inherit","--beam-SubscriptionManagement-swapNonprofitButtonText-marginTop":"10px","--beam-SubscriptionManagement-swapNonprofitButtonText-fontSize":"inherit","--beam-SubscriptionManagement-swapNonprofitButtonText-color":"inherit"},s=this.eligibleNonprofitsDataController?.data?.config?.web?.theme||{},a={...t,...s};return Object.assign(Object.create({toCSS(){return C(this)}}),a)}render(){let t;if((this.subscriptionDataController.loading||this.eligibleNonprofitsDataController.loading)&&(t=""),(this.subscriptionDataController.error||this.eligibleNonprofitsDataController.error)&&this.debug){if(this.subscriptionDataController.error!==null)return h({error:this.subscriptionDataController.error});if(this.eligibleNonprofitsDataController.error!==null)return h({error:this.eligibleNonprofitsDataController.error})}else t="";return this.activeWidget==="redeem-transaction"?t=l` <p>Redeem transaction widget placeholder</p>`:this.activeWidget==="impact-overview"&&(t=l`
1
+ import{f as g,g as o,t as p,h as f,y as l}from"../chunks/lit-yVXn5Cbs.esm.js";import{D as y,b as S,h as w}from"../chunks/routes-CqjzL4oL.esm.js";import{c as v,d as x,A as m,e as b,a as C,_ as h}from"../chunks/enforce-config-fo8kIfoY.esm.js";import{c as N}from"../chunks/events-5IECSF-x.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../utils/logger.js";const M={en:{nonprofitSwapText:({brandName:i=""})=>`Support a new nonprofit with your next ${i} recurring order`},fr:{nonprofitSwapText:({brandName:i=""})=>`Soutenez une nouvelle organisation \xE0 but non lucratif avec votre prochaine commande r\xE9currente ${i}`},de:{nonprofitSwapText:({brandName:i=""})=>`Unterst\xFCtzen Sie eine neue gemeinn\xFCtzige Organisation mit Ihrer n\xE4chsten wiederkehrenden Bestellung bei ${i}`},es:{nonprofitSwapText:({brandName:i=""})=>`Apoye a una nueva organizaci\xF3n sin fines de lucro con su pr\xF3ximo pedido recurrente ${i}`},it:{nonprofitSwapText:({brandName:i=""})=>`Sostieni una nuova organizzazione non profit con il tuo prossimo ordine ricorrente ${i}`},pl:{nonprofitSwapText:({brandName:i=""})=>`Wesprzyj now\u0105 organizacj\u0119 non-profit przy kolejnym zam\xF3wieniu cyklicznym ${i}`}};var B=Object.defineProperty,$=Object.getOwnPropertyDescriptor,n=(i,t,r,a)=>{for(var s=a>1?void 0:a?$(t,r):t,c=i.length-1,d;c>=0;c--)(d=i[c])&&(s=(a?d(t,r,s):d(s))||s);return a&&s&&B(t,r,s),s};const u=["baseUrl","apiKey","subscriptionId","email","lang"];class e extends f{constructor(){super(...arguments),this.baseUrl=y,this.lang="en",this.debug=!1,this.activeWidget=null,this.nonprofitId=null,this.userId=null,this.chainName=null,this.subscriptionDataController=new m(this,this.fetchSubscription),this.eligibleNonprofitsDataController=new m(this,this.fetchEligibleNonprofits)}async firstUpdated(){b(u,this),await this.loadWidget()}async loadWidget(){await Promise.all([this.fetchEligibleNonprofits(),this.fetchSubscription()]),this.activeWidget=this.nonprofitId?"impact-overview":"redeem-transaction"}async fetchEligibleNonprofits(){b(u,this);const t=await S({baseUrl:this.baseUrl,headers:{authorization:`Api-Key ${this.apiKey}`},requestBody:{postalCode:this.postalCode?this.postalCode:void 0,countryCode:this.countryCode?this.countryCode:void 0,widgetName:"subscription-management",version:"1.0.0"}});return this.chainName=t.chain.name,this.storeId=t.store.id,t}async fetchSubscription(){b(u,this);const t=await w({baseUrl:this.baseUrl,headers:{authorization:`Api-Key ${this.apiKey}`},requestBody:{remoteSubscriptionId:this.subscriptionId,email:this.email}});return this.userId=t.beamUserId,this.nonprofitId=t.nonprofit?.id||null,t}handleSwapNonprofitButtonClick(){this.activeWidget="redeem-transaction"}renderSwapNonprofitButton(){return this.activeWidget==="impact-overview"?l`<button class="swap-nonprofit-button" @click="${this.handleSwapNonprofitButtonClick}">
2
+ ${M[this.lang].nonprofitSwapText({brandName:this.chainName||""})}
3
+ </button>`:""}get cssVariables(){const t={"--beam-fontFamily":"inherit","--beam-fontStyle":"inherit","--beam-fontSize":"inherit","--beam-textColor":"inherit","--beam-backgroundColor":"inherit","--beam-SubscriptionManagement-widgetContainer-borderColor":"#d5d5d5","--beam-SubscriptionManagement-widgetContainer-borderRadius":"4px","--beam-SubscriptionManagement-widgetContainer-padding":"15px","--beam-SubscriptionManagement-widgetContainer-backgroundColor":"inherit","--beam-SubscriptionManagement-widgetContainer-maxWidth":"800px","--beam-SubscriptionManagement-swapNonprofitButtonText-textDecoration":"underline","--beam-SubscriptionManagement-swapNonprofitButtonText-fontFamily":"inherit","--beam-SubscriptionManagement-swapNonprofitButtonText-fontStyle":"inherit","--beam-SubscriptionManagement-swapNonprofitButtonText-fontWeight":"inherit","--beam-SubscriptionManagement-swapNonprofitButtonText-lineHeight":"inherit","--beam-SubscriptionManagement-swapNonprofitButtonText-marginTop":"10px","--beam-SubscriptionManagement-swapNonprofitButtonText-fontSize":"inherit","--beam-SubscriptionManagement-swapNonprofitButtonText-color":"inherit"},r=this.eligibleNonprofitsDataController?.data?.config?.web?.theme||{},a={...t,...r};return Object.assign(Object.create({toCSS(){return C(this)}}),a)}render(){let t;if((this.subscriptionDataController.loading||this.eligibleNonprofitsDataController.loading)&&(t=""),(this.subscriptionDataController.error||this.eligibleNonprofitsDataController.error)&&this.debug){if(this.subscriptionDataController.error!==null)return h({error:this.subscriptionDataController.error});if(this.eligibleNonprofitsDataController.error!==null)return h({error:this.eligibleNonprofitsDataController.error})}else t="";return this.activeWidget==="redeem-transaction"?t=l` <beam-redeem-transaction
4
+ part="redeem-transaction"
5
+ subscriptionId="${this.subscriptionId}"
6
+ nonprofitId=${this.nonprofitId}
7
+ baseUrl="${this.baseUrl}"
8
+ apiKey="${this.apiKey}"
9
+ lang="${this.lang}"
10
+ ?debug="${this.debug}"
11
+ @beamnonprofitselect="${r=>{if(!(r instanceof N))return;const{selectedNonprofitId:a}=r.detail;this.nonprofitId=a??null,this.activeWidget="impact-overview"}}"
12
+ ></beam-redeem-transaction>`:this.activeWidget==="impact-overview"&&(t=l`
4
13
  <beam-impact-overview
5
14
  part="impact-overview"
6
15
  baseUrl="${this.baseUrl}"
@@ -26,6 +35,7 @@ import{f as g,g as o,t as p,h as f,y as l}from"../chunks/lit-yVXn5Cbs.esm.js";im
26
35
  font-size: var(--beam-fontSize);
27
36
  background-color: var(--beam-backgroundColor);
28
37
  color: var(--beam-textColor);
38
+ word-break: normal;
29
39
  }
30
40
  .swap-nonprofit-button {
31
41
  margin-top: var(--beam-SubscriptionManagement-swapNonprofitButtonText-marginTop, 10px);
@@ -1 +1 @@
1
- {"version":3,"file":"subscription-management.js","sources":["../../src/components/subscription-management/strings.ts","../../src/components/subscription-management/index.ts"],"sourcesContent":["export const strings = {\n en: {\n nonprofitSwapText: ({ brandName = \"\" }) => `Support a new nonprofit with your next ${brandName} recurring order`,\n },\n fr: {\n nonprofitSwapText: ({ brandName = \"\" }) =>\n `Soutenez une nouvelle organisation à but non lucratif avec votre prochaine commande récurrente ${brandName}`,\n },\n de: {\n nonprofitSwapText: ({ brandName = \"\" }) =>\n `Unterstützen Sie eine neue gemeinnützige Organisation mit Ihrer nächsten wiederkehrenden Bestellung bei ${brandName}`,\n },\n es: {\n nonprofitSwapText: ({ brandName = \"\" }) =>\n `Apoye a una nueva organización sin fines de lucro con su próximo pedido recurrente ${brandName}`,\n },\n it: {\n nonprofitSwapText: ({ brandName = \"\" }) =>\n `Sostieni una nuova organizzazione non profit con il tuo prossimo ordine ricorrente ${brandName}`,\n },\n pl: {\n nonprofitSwapText: ({ brandName = \"\" }) =>\n `Wesprzyj nową organizację non-profit przy kolejnym zamówieniu cyklicznym ${brandName}`,\n },\n};\n","import { css, html, LitElement } from \"lit\";\nimport { property } from \"lit/decorators/property.js\";\nimport { state } from \"lit/decorators/state.js\";\nimport { DEFAULT_BASE_URL } from \"../../api-sdk/constants\";\nimport { LANGUAGES } from \"../../api-sdk/types\";\nimport { TCart } from \"../../shared/cart-contents\";\nimport { enforceConfig } from \"../../shared/enforce-config\";\nimport { postFindSubscription, postChainEligibleNonprofitsForCart } from \"../../api-sdk/v3/routes\";\nimport { AsyncController } from \"../../shared/controllers/async-controller\";\nimport { cssReset } from \"../../shared/css-reset\";\nimport { defineCustomElement } from \"../../shared/defineCustomElement\";\nimport { _errorMessage } from \"../../shared/fragments/error-message-template\";\nimport { _cssVariableMap } from \"../../shared/fragments/css-variable-map\";\nimport { strings } from \"./strings\";\n\nconst REQUIRED_DATA_PROPS = [\"baseUrl\", \"apiKey\", \"subscriptionId\", \"email\", \"lang\"];\n\nexport class BeamSubscriptionManagement extends LitElement {\n static tagName = \"beam-subscription-management\";\n\n @property({ type: String })\n public baseUrl: string = DEFAULT_BASE_URL;\n\n @property({ type: String })\n public apiKey!: string;\n\n @property({ type: String })\n public subscriptionId!: string;\n\n @property({ type: Number, reflect: true })\n public storeId?: number; // Either storeId or postalCode, countryCode must be provided\n\n @property({ type: String })\n public email!: string;\n\n @property({ type: String })\n public postalCode?: string;\n\n @property({ type: String })\n public countryCode?: string;\n\n @property({ type: String })\n public lang: LANGUAGES = \"en\";\n\n @property({ type: Object })\n public cart?: TCart;\n\n @property({ type: Boolean })\n public debug = false;\n\n @state() private activeWidget: \"redeem-transaction\" | \"impact-overview\" | null = null; // Based on /findSubscriptionByRemoteId\n @state() private nonprofitId: number | null = null; // From /findSubscriptionByRemoteId response\n @state() private userId: string | null = null; // From findSubscriptionByRemoteId\n @state() private chainName: string | null = null; // From findEligibleNonprofitsForCart\n\n private subscriptionDataController = new AsyncController<typeof this.fetchSubscription>(this, this.fetchSubscription);\n private eligibleNonprofitsDataController = new AsyncController<typeof this.fetchEligibleNonprofits>(\n this,\n this.fetchEligibleNonprofits\n );\n\n async firstUpdated() {\n enforceConfig(REQUIRED_DATA_PROPS, this);\n await this.loadWidget();\n }\n\n async loadWidget() {\n // In parallel:\n // (1). Fetch eligible nonprofits [storeId and chainName]\n // (2). Fetch subscription [userId and nonprofitId]\n await Promise.all([this.fetchEligibleNonprofits(), this.fetchSubscription()]);\n this.activeWidget = this.nonprofitId ? \"impact-overview\" : \"redeem-transaction\";\n }\n\n async fetchEligibleNonprofits() {\n enforceConfig(REQUIRED_DATA_PROPS, this);\n const res = await postChainEligibleNonprofitsForCart({\n baseUrl: this.baseUrl,\n headers: {\n authorization: `Api-Key ${this.apiKey}`,\n },\n requestBody: {\n postalCode: this.postalCode ? this.postalCode : undefined,\n countryCode: this.countryCode ? this.countryCode : undefined,\n widgetName: \"subscription-management\",\n version: \"1.0.0\",\n },\n });\n this.chainName = res.chain.name;\n this.storeId = res.store.id;\n return res;\n }\n\n async fetchSubscription() {\n enforceConfig(REQUIRED_DATA_PROPS, this);\n const result = await postFindSubscription({\n baseUrl: this.baseUrl,\n headers: {\n authorization: `Api-Key ${this.apiKey}`,\n },\n requestBody: {\n remoteSubscriptionId: this.subscriptionId,\n email: this.email,\n },\n });\n\n this.userId = result.beamUserId; // Returned in response regardless of subscription redemption\n this.nonprofitId = result.nonprofit?.id || null;\n return result;\n }\n\n handleSwapNonprofitButtonClick() {\n this.activeWidget = \"redeem-transaction\";\n }\n\n renderSwapNonprofitButton() {\n if (this.activeWidget === \"impact-overview\") {\n return html`<button class=\"swap-nonprofit-button\" @click=\"${this.handleSwapNonprofitButtonClick}\">\n ${strings[this.lang].nonprofitSwapText({ brandName: this.chainName || \"\" })}\n </button>`;\n } else {\n return \"\";\n }\n }\n\n public get cssVariables() {\n const defaults = {\n \"--beam-fontFamily\": \"inherit\",\n \"--beam-fontStyle\": \"inherit\",\n \"--beam-fontSize\": \"inherit\",\n \"--beam-textColor\": \"inherit\",\n \"--beam-backgroundColor\": \"inherit\",\n \"--beam-SubscriptionManagement-widgetContainer-borderColor\": \"#d5d5d5\",\n \"--beam-SubscriptionManagement-widgetContainer-borderRadius\": \"4px\",\n \"--beam-SubscriptionManagement-widgetContainer-padding\": \"15px\",\n \"--beam-SubscriptionManagement-widgetContainer-backgroundColor\": \"inherit\",\n \"--beam-SubscriptionManagement-widgetContainer-maxWidth\": \"800px\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-textDecoration\": \"underline\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-fontFamily\": \"inherit\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-fontStyle\": \"inherit\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-fontWeight\": \"inherit\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-lineHeight\": \"inherit\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-marginTop\": \"10px\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-fontSize\": \"inherit\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-color\": \"inherit\",\n };\n\n const remoteConfig = this.eligibleNonprofitsDataController?.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 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);\n font-style: var(--beam-fontStyle);\n font-size: var(--beam-fontSize);\n background-color: var(--beam-backgroundColor);\n color: var(--beam-textColor);\n }\n .swap-nonprofit-button {\n margin-top: var(--beam-SubscriptionManagement-swapNonprofitButtonText-marginTop, 10px);\n color: var(--beam-SubscriptionManagement-swapNonprofitButtonText-color, inherit);\n font-size: var(--beam-SubscriptionManagement-swapNonprofitButtonText-fontSize, inherit);\n text-decoration: var(--beam-SubscriptionManagement-swapNonprofitButtonText-textDecoration, underline);\n font-family: var(--beam-SubscriptionManagement-swapNonprofitButtonText-fontFamily, inherit);\n font-style: var(--beam-SubscriptionManagement-swapNonprofitButtonText-fontStyle, inherit);\n font-weight: var(--beam-SubscriptionManagement-swapNonprofitButtonText-fontWeight, inherit);\n line-height: var(--beam-SubscriptionManagement-swapNonprofitButtonText-lineHeight, inherit);\n background: none;\n border: none;\n cursor: pointer;\n }\n .sub-widget-container {\n background-color: var(--beam-SubscriptionManagement-widgetContainer-backgroundColor, inherit);\n border: 1px solid var(--beam-SubscriptionManagement-widgetContainer-borderColor, #d5d5d5);\n border-radius: var(--beam-SubscriptionManagement-widgetContainer-borderRadius, 4px);\n overflow: hidden; /* maintain clean border-radius */\n padding: var(--beam-SubscriptionManagement-widgetContainer-padding, 15px);\n max-width: var(--beam-SubscriptionManagement-widgetContainer-maxWidth, 800px);\n }\n }`,\n ];\n\n render() {\n let content;\n\n if (this.subscriptionDataController.loading || this.eligibleNonprofitsDataController.loading) {\n content = \"\";\n }\n\n if ((this.subscriptionDataController.error || this.eligibleNonprofitsDataController.error) && this.debug) {\n if (this.subscriptionDataController.error !== null) {\n return _errorMessage({ error: this.subscriptionDataController.error });\n } else if (this.eligibleNonprofitsDataController.error !== null) {\n return _errorMessage({ error: this.eligibleNonprofitsDataController.error });\n }\n } else {\n content = \"\";\n }\n\n if (this.activeWidget === \"redeem-transaction\") {\n // TODO: https://beamimpact.atlassian.net/browse/SDK-1695\n content = html` <p>Redeem transaction widget placeholder</p>`;\n } else if (this.activeWidget === \"impact-overview\") {\n content = html`\n <beam-impact-overview\n part=\"impact-overview\"\n baseUrl=\"${this.baseUrl}\"\n apiKey=\"${this.apiKey}\"\n userId=\"${this.userId}\"\n nonprofitId=\"${this.nonprofitId}\"\n lang=\"${this.lang}\"\n ?debug=\"${this.debug}\"\n ></beam-impact-overview>\n `;\n }\n return html`\n <style>\n :host {\n ${this.cssVariables.toCSS()}\n }\n </style>\n <div class=\"sub-widget-container\">${content}</div>\n ${this.renderSwapNonprofitButton()}\n `;\n }\n}\n\ndefineCustomElement(BeamSubscriptionManagement);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"beam-subscription-management\": BeamSubscriptionManagement;\n }\n}\n"],"names":["strings","brandName","f","h","i","l","n","t","o","a","REQUIRED_DATA_PROPS","BeamSubscriptionManagement","LitElement","DEFAULT_BASE_URL","AsyncController","enforceConfig","res","postChainEligibleNonprofitsForCart","result","postFindSubscription","html","defaults","remoteConfig","config","_cssVariableMap","content","_errorMessage","cssReset","css","__decorateClass","property","state","defineCustomElement"],"mappings":"0TAAO,MAAMA,EAAU,CACrB,GAAI,CACF,kBAAmB,CAAC,CAAE,UAAAC,EAAY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kB,EAAA,CAAhBE,EAAM,CAAA,EAnCIpB,EAmCM,UAAA,SAAA,CAAA,EACAkB,EAAA,CAAhBE,EAAM,CAAA,EApCIpB,EAoCM,UAAA,YAAA,CAAA,EA0LnBqB,EAAoBrB,CAA0B"}
1
+ {"version":3,"file":"subscription-management.js","sources":["../../src/components/subscription-management/strings.ts","../../src/components/subscription-management/index.ts"],"sourcesContent":["export const strings = {\n en: {\n nonprofitSwapText: ({ brandName = \"\" }) => `Support a new nonprofit with your next ${brandName} recurring order`,\n },\n fr: {\n nonprofitSwapText: ({ brandName = \"\" }) =>\n `Soutenez une nouvelle organisation à but non lucratif avec votre prochaine commande récurrente ${brandName}`,\n },\n de: {\n nonprofitSwapText: ({ brandName = \"\" }) =>\n `Unterstützen Sie eine neue gemeinnützige Organisation mit Ihrer nächsten wiederkehrenden Bestellung bei ${brandName}`,\n },\n es: {\n nonprofitSwapText: ({ brandName = \"\" }) =>\n `Apoye a una nueva organización sin fines de lucro con su próximo pedido recurrente ${brandName}`,\n },\n it: {\n nonprofitSwapText: ({ brandName = \"\" }) =>\n `Sostieni una nuova organizzazione non profit con il tuo prossimo ordine ricorrente ${brandName}`,\n },\n pl: {\n nonprofitSwapText: ({ brandName = \"\" }) =>\n `Wesprzyj nową organizację non-profit przy kolejnym zamówieniu cyklicznym ${brandName}`,\n },\n};\n","import { css, html, LitElement } from \"lit\";\nimport { property } from \"lit/decorators/property.js\";\nimport { state } from \"lit/decorators/state.js\";\nimport { DEFAULT_BASE_URL } from \"../../api-sdk/constants\";\nimport { LANGUAGES } from \"../../api-sdk/types\";\nimport { TCart } from \"../../shared/cart-contents\";\nimport { enforceConfig } from \"../../shared/enforce-config\";\nimport { postFindSubscription, postChainEligibleNonprofitsForCart } from \"../../api-sdk/v3/routes\";\nimport { AsyncController } from \"../../shared/controllers/async-controller\";\nimport { cssReset } from \"../../shared/css-reset\";\nimport { defineCustomElement } from \"../../shared/defineCustomElement\";\nimport { _errorMessage } from \"../../shared/fragments/error-message-template\";\nimport { _cssVariableMap } from \"../../shared/fragments/css-variable-map\";\nimport { BeamNonprofitSelectEvent } from \"../../utils/events\";\nimport { strings } from \"./strings\";\n\nconst REQUIRED_DATA_PROPS = [\"baseUrl\", \"apiKey\", \"subscriptionId\", \"email\", \"lang\"];\n\nexport class BeamSubscriptionManagement extends LitElement {\n static tagName = \"beam-subscription-management\";\n\n @property({ type: String })\n public baseUrl: string = DEFAULT_BASE_URL;\n\n @property({ type: String })\n public apiKey!: string;\n\n @property({ type: String })\n public subscriptionId!: string;\n\n @property({ type: Number, reflect: true })\n public storeId?: number; // Either storeId or postalCode, countryCode must be provided\n\n @property({ type: String })\n public email!: string;\n\n @property({ type: String })\n public postalCode?: string;\n\n @property({ type: String })\n public countryCode?: string;\n\n @property({ type: String })\n public lang: LANGUAGES = \"en\";\n\n @property({ type: Object })\n public cart?: TCart;\n\n @property({ type: Boolean })\n public debug = false;\n\n @state() private activeWidget: \"redeem-transaction\" | \"impact-overview\" | null = null; // Based on /findSubscriptionByRemoteId\n @state() private nonprofitId: number | null = null; // From /findSubscriptionByRemoteId response\n @state() private userId: string | null = null; // From findSubscriptionByRemoteId\n @state() private chainName: string | null = null; // From findEligibleNonprofitsForCart\n\n private subscriptionDataController = new AsyncController<typeof this.fetchSubscription>(this, this.fetchSubscription);\n private eligibleNonprofitsDataController = new AsyncController<typeof this.fetchEligibleNonprofits>(\n this,\n this.fetchEligibleNonprofits\n );\n\n async firstUpdated() {\n enforceConfig(REQUIRED_DATA_PROPS, this);\n await this.loadWidget();\n }\n\n async loadWidget() {\n // In parallel:\n // (1). Fetch eligible nonprofits [storeId and chainName]\n // (2). Fetch subscription [userId and nonprofitId]\n await Promise.all([this.fetchEligibleNonprofits(), this.fetchSubscription()]);\n this.activeWidget = this.nonprofitId ? \"impact-overview\" : \"redeem-transaction\";\n }\n\n async fetchEligibleNonprofits() {\n enforceConfig(REQUIRED_DATA_PROPS, this);\n const res = await postChainEligibleNonprofitsForCart({\n baseUrl: this.baseUrl,\n headers: {\n authorization: `Api-Key ${this.apiKey}`,\n },\n requestBody: {\n postalCode: this.postalCode ? this.postalCode : undefined,\n countryCode: this.countryCode ? this.countryCode : undefined,\n widgetName: \"subscription-management\",\n version: \"1.0.0\",\n },\n });\n this.chainName = res.chain.name;\n this.storeId = res.store.id;\n return res;\n }\n\n async fetchSubscription() {\n enforceConfig(REQUIRED_DATA_PROPS, this);\n const result = await postFindSubscription({\n baseUrl: this.baseUrl,\n headers: {\n authorization: `Api-Key ${this.apiKey}`,\n },\n requestBody: {\n remoteSubscriptionId: this.subscriptionId,\n email: this.email,\n },\n });\n\n this.userId = result.beamUserId; // Returned in response regardless of subscription redemption\n this.nonprofitId = result.nonprofit?.id || null;\n return result;\n }\n\n handleSwapNonprofitButtonClick() {\n this.activeWidget = \"redeem-transaction\";\n }\n\n renderSwapNonprofitButton() {\n if (this.activeWidget === \"impact-overview\") {\n return html`<button class=\"swap-nonprofit-button\" @click=\"${this.handleSwapNonprofitButtonClick}\">\n ${strings[this.lang].nonprofitSwapText({ brandName: this.chainName || \"\" })}\n </button>`;\n } else {\n return \"\";\n }\n }\n\n public get cssVariables() {\n const defaults = {\n \"--beam-fontFamily\": \"inherit\",\n \"--beam-fontStyle\": \"inherit\",\n \"--beam-fontSize\": \"inherit\",\n \"--beam-textColor\": \"inherit\",\n \"--beam-backgroundColor\": \"inherit\",\n \"--beam-SubscriptionManagement-widgetContainer-borderColor\": \"#d5d5d5\",\n \"--beam-SubscriptionManagement-widgetContainer-borderRadius\": \"4px\",\n \"--beam-SubscriptionManagement-widgetContainer-padding\": \"15px\",\n \"--beam-SubscriptionManagement-widgetContainer-backgroundColor\": \"inherit\",\n \"--beam-SubscriptionManagement-widgetContainer-maxWidth\": \"800px\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-textDecoration\": \"underline\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-fontFamily\": \"inherit\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-fontStyle\": \"inherit\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-fontWeight\": \"inherit\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-lineHeight\": \"inherit\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-marginTop\": \"10px\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-fontSize\": \"inherit\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-color\": \"inherit\",\n };\n\n const remoteConfig = this.eligibleNonprofitsDataController?.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 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);\n font-style: var(--beam-fontStyle);\n font-size: var(--beam-fontSize);\n background-color: var(--beam-backgroundColor);\n color: var(--beam-textColor);\n word-break: normal;\n }\n .swap-nonprofit-button {\n margin-top: var(--beam-SubscriptionManagement-swapNonprofitButtonText-marginTop, 10px);\n color: var(--beam-SubscriptionManagement-swapNonprofitButtonText-color, inherit);\n font-size: var(--beam-SubscriptionManagement-swapNonprofitButtonText-fontSize, inherit);\n text-decoration: var(--beam-SubscriptionManagement-swapNonprofitButtonText-textDecoration, underline);\n font-family: var(--beam-SubscriptionManagement-swapNonprofitButtonText-fontFamily, inherit);\n font-style: var(--beam-SubscriptionManagement-swapNonprofitButtonText-fontStyle, inherit);\n font-weight: var(--beam-SubscriptionManagement-swapNonprofitButtonText-fontWeight, inherit);\n line-height: var(--beam-SubscriptionManagement-swapNonprofitButtonText-lineHeight, inherit);\n background: none;\n border: none;\n cursor: pointer;\n }\n .sub-widget-container {\n background-color: var(--beam-SubscriptionManagement-widgetContainer-backgroundColor, inherit);\n border: 1px solid var(--beam-SubscriptionManagement-widgetContainer-borderColor, #d5d5d5);\n border-radius: var(--beam-SubscriptionManagement-widgetContainer-borderRadius, 4px);\n overflow: hidden; /* maintain clean border-radius */\n padding: var(--beam-SubscriptionManagement-widgetContainer-padding, 15px);\n max-width: var(--beam-SubscriptionManagement-widgetContainer-maxWidth, 800px);\n }\n }`,\n ];\n\n render() {\n let content;\n\n if (this.subscriptionDataController.loading || this.eligibleNonprofitsDataController.loading) {\n content = \"\";\n }\n\n if ((this.subscriptionDataController.error || this.eligibleNonprofitsDataController.error) && this.debug) {\n if (this.subscriptionDataController.error !== null) {\n return _errorMessage({ error: this.subscriptionDataController.error });\n } else if (this.eligibleNonprofitsDataController.error !== null) {\n return _errorMessage({ error: this.eligibleNonprofitsDataController.error });\n }\n } else {\n content = \"\";\n }\n\n if (this.activeWidget === \"redeem-transaction\") {\n content = html` <beam-redeem-transaction\n part=\"redeem-transaction\"\n subscriptionId=\"${this.subscriptionId}\"\n nonprofitId=${this.nonprofitId}\n baseUrl=\"${this.baseUrl}\"\n apiKey=\"${this.apiKey}\"\n lang=\"${this.lang}\"\n ?debug=\"${this.debug}\"\n @beamnonprofitselect=\"${(event: Event) => {\n if (!(event instanceof BeamNonprofitSelectEvent)) return; // TS guard\n const { selectedNonprofitId } = event.detail;\n this.nonprofitId = selectedNonprofitId ?? null;\n this.activeWidget = \"impact-overview\";\n }}\"\n ></beam-redeem-transaction>`;\n } else if (this.activeWidget === \"impact-overview\") {\n content = html`\n <beam-impact-overview\n part=\"impact-overview\"\n baseUrl=\"${this.baseUrl}\"\n apiKey=\"${this.apiKey}\"\n userId=\"${this.userId}\"\n nonprofitId=\"${this.nonprofitId}\"\n lang=\"${this.lang}\"\n ?debug=\"${this.debug}\"\n ></beam-impact-overview>\n `;\n }\n return html`\n <style>\n :host {\n ${this.cssVariables.toCSS()}\n }\n </style>\n <div class=\"sub-widget-container\">${content}</div>\n ${this.renderSwapNonprofitButton()}\n `;\n }\n}\n\ndefineCustomElement(BeamSubscriptionManagement);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"beam-subscription-management\": BeamSubscriptionManagement;\n }\n}\n"],"names":["strings","brandName","f","h","i","l","n","t","o","e","a","b","REQUIRED_DATA_PROPS","BeamSubscriptionManagement","LitElement","DEFAULT_BASE_URL","AsyncController","enforceConfig","res","postChainEligibleNonprofitsForCart","result","postFindSubscription","html","defaults","remoteConfig","config","_cssVariableMap","content","_errorMessage","event","BeamNonprofitSelectEvent","selectedNonprofitId","cssReset","css","__decorateClass","property","state","defineCustomElement"],"mappings":"+WAAO,MAAMA,EAAU,CACrB,GAAI,CACF,kBAAmB,CAAC,CAAE,UAAAC,EAAY,EAAG,IAAM,0CAA0CA,CAAS,kBAChG,EACA,GAAI,CACF,kBAAmB,CAAC,CAAE,UAAAA,EAAY,EAAG,IACnC,wGAAkGA,CAAS,EAC/G,EACA,GAAI,CACF,kBAAmB,CAAC,CAAE,UAAAA,EAAY,EAAG,IACnC,oHAA2GA,CAAS,EACxH,EACA,GAAI,CACF,kBAAmB,CAAC,CAAE,UAAAA,EAAY,EAAG,IACnC,4FAAsFA,CAAS,EACnG,EACA,GAAI,CACF,kBAAmB,CAAC,CAAE,UAAAA,EAAY,EAAG,IACnC,sFAAsFA,CAAS,EACnG,EACA,GAAI,CACF,kBAAmB,CAAC,CAAE,UAAAA,EAAY,EAAG,IACnC,yFAA4EA,CAAS,EACzF,CACF,ECxBA,IAAAC,EAAA,OAAA,eAAAC,EAAA,OAAA,yBAAAC,EAAA,CAAAC,EAAAC,EAAAC,EAAAC,IAAA,CAAA,QAAAC,EAAAD,EAAA,EAAA,OAAAA,EAAAL,EAAAG,EAAAC,CAAA,EAAAD,EAAAI,EAAAL,EAAA,OAAA,EAAAM,EAAAD,GAAA,EAAAA,KAAAC,EAAAN,EAAAK,CAAA,KAAAD,GAAAD,EAAAG,EAAAL,EAAAC,EAAAE,CAAA,EAAAE,EAAAF,CAAA,IAAAA,GAAA,OAAAD,GAAAC,GAAAP,EAAAI,EAAAC,EAAAE,CAAA,EAAAA,CAAA,EAgBA,MAAMG,EAAsB,CAAC,UAAW,SAAU,iBAAkB,QAAS,MAAM,EA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AAA,EAfftB,EAgBJ,UAAA,QAAA,CAAA,EAGAqB,EAAA,CADNC,EAAS,CAAE,KAAM,MAAO,CAAC,CAAA,EAlBftB,EAmBJ,UAGAqB,aAAAA,CAAAA,EAAAA,EAAA,CADNC,EAAS,CAAE,KAAM,MAAO,CAAC,CArBf,EAAAtB,EAsBJ,UAGAqB,cAAAA,CAAAA,EAAAA,EAAA,CADNC,EAAS,CAAE,KAAM,MAAO,CAAC,CAxBf,EAAAtB,EAyBJ,UAGAqB,OAAAA,CAAAA,EAAAA,EAAA,CADNC,EAAS,CAAE,KAAM,MAAO,CAAC,CA3Bf,EAAAtB,EA4BJ,UAGAqB,OAAAA,CAAAA,EAAAA,EAAA,CADNC,EAAS,CAAE,KAAM,OAAQ,CAAC,CAAA,EA9BhBtB,EA+BJ,UAAA,QAAA,CAAA,EAEUqB,EAAA,CAAhBE,EAAM,CAAA,EAjCIvB,EAiCM,UAAA,eAAA,CAAA,EACAqB,EAAA,CAAhBE,EAAM,CAAA,EAlCIvB,EAkCM,UAAA,cAAA,CAAA,EACAqB,EAAA,CAAhBE,EAAM,CAAA,EAnCIvB,EAmCM,UAAA,SAAA,CAAA,EACAqB,EAAA,CAAhBE,EAAM,CAAA,EApCIvB,EAoCM,UAAA,YAAA,CAAA,EAwMnBwB,EAAoBxB,CAA0B"}
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { i as WebComponents } from './chunks/index-oLz4lmx2.esm.js';
2
- export { i as Integrations } from './chunks/index-3ThDVYOT.esm.js';
2
+ export { i as Integrations } from './chunks/index-EZ_Bg1n7.esm.js';
3
3
  export { i as ReactComponents } from './chunks/index-6t9MtjyS.esm.js';
4
- export { i as Utils } from './chunks/index-kuEhVQcF.esm.js';
4
+ export { i as Utils } from './chunks/index-GkPHba-I.esm.js';
5
5
  import './components/community-impact.js';
6
6
  import 'lit';
7
7
  import 'lit-html';
@@ -18,8 +18,8 @@ import './chunks/openapi-spec-D_Zzbl2J.esm.js';
18
18
  import './components/redeem-transaction.js';
19
19
  import './components/post-purchase.js';
20
20
  import './components/subscription-management.js';
21
- import './chunks/index-tfP1RBZU.esm.js';
22
- import './chunks/beam-errors-bKCZlkvr.esm.js';
21
+ import './chunks/index-pDraUd1x.esm.js';
22
+ import './chunks/beam-errors-fXDkG1zo.esm.js';
23
23
  import './chunks/events-qTu4iIOo.esm.js';
24
24
  import './utils/logger.js';
25
25
  import './utils/network-listeners.js';
package/dist/index.esm.js CHANGED
@@ -1,2 +1,2 @@
1
- import{i as Q}from"./chunks/index-5yFqo0yl.esm.js";import{i as T}from"./chunks/index-0JdRzhqA.esm.js";import{i as X}from"./chunks/index-o7YiP4gC.esm.js";import{i as Z}from"./chunks/index-FAF7tYU6.esm.js";import"./components/community-impact.esm.js";import"./chunks/lit-yVXn5Cbs.esm.js";import"./chunks/progress-bar-7gWYaGlq.esm.js";import"./components/beam-partner-logos.esm.js";import"./chunks/enforce-config-MqLZWolV.esm.js";import"./chunks/beam-errors-AMvTvR1C.esm.js";import"./utils/logger.esm.js";import"./chunks/routes-USQ3n64Y.esm.js";import"./chunks/localize-eZMViIud.esm.js";import"./chunks/css-card-grid-3b56QBzq.esm.js";import"./components/cumulative-impact.esm.js";import"./chunks/lodash-P8OIs-at.esm.js";import"./chunks/is-all-html-elements-SdSkxirh.esm.js";import"./components/impact-overview.esm.js";import"./chunks/vendor-eeJfrOkP.esm.js";import"./chunks/responsive-LYEag6TI.esm.js";import"./components/select-nonprofit.esm.js";import"./chunks/events-5IECSF-x.esm.js";import"./utils/network-listeners.esm.js";import"./utils/local-storage.esm.js";import"./utils/cookies.esm.js";import"./chunks/cart-contents-h60geKWa.esm.js";import"./components/redeem-transaction.esm.js";import"./components/post-purchase.esm.js";import"./components/subscription-management.esm.js";import"./chunks/index-uqEAgdEf.esm.js";import"./utils/wait-for-element.esm.js";import"./utils/remote-session.esm.js";import"./utils/memoize-last.esm.js";import"./chunks/index-8G1d1I0a.esm.js";import"./chunks/order-page-PGTQXoSr.esm.js";import"./chunks/update-cart-8xlajjFj.esm.js";import"./chunks/index-9YcaEQju.esm.js";import"./chunks/index-L6UcfXYR.esm.js";import"./chunks/index-MAsTKsZm.esm.js";import"./react/community-impact.esm.js";import"react";import"./react/cumulative-impact.esm.js";import"./react/impact-overview.esm.js";import"./react/select-nonprofit.esm.js";import"./react/redeem-transaction.esm.js";import"./react/post-purchase.esm.js";import"./react/subscription-management.esm.js";export{T as Integrations,X as ReactComponents,Z as Utils,Q as WebComponents};
1
+ import{i as Q}from"./chunks/index-5yFqo0yl.esm.js";import{i as T}from"./chunks/index-XMD0b6ql.esm.js";import{i as X}from"./chunks/index-o7YiP4gC.esm.js";import{i as Z}from"./chunks/index-OnjTwvAw.esm.js";import"./components/community-impact.esm.js";import"./chunks/lit-yVXn5Cbs.esm.js";import"./chunks/progress-bar-7gWYaGlq.esm.js";import"./components/beam-partner-logos.esm.js";import"./chunks/enforce-config-qna7hEL6.esm.js";import"./chunks/beam-errors-P-Lu07Ce.esm.js";import"./utils/logger.esm.js";import"./chunks/routes-lsOWIDmE.esm.js";import"./chunks/localize-GCkVUD8S.esm.js";import"./chunks/css-card-grid-3b56QBzq.esm.js";import"./components/cumulative-impact.esm.js";import"./chunks/lodash-P8OIs-at.esm.js";import"./chunks/is-all-html-elements-SdSkxirh.esm.js";import"./components/impact-overview.esm.js";import"./chunks/vendor-eeJfrOkP.esm.js";import"./chunks/responsive-LYEag6TI.esm.js";import"./components/select-nonprofit.esm.js";import"./chunks/events-5IECSF-x.esm.js";import"./utils/network-listeners.esm.js";import"./utils/local-storage.esm.js";import"./utils/cookies.esm.js";import"./chunks/cart-contents-h60geKWa.esm.js";import"./components/redeem-transaction.esm.js";import"./components/post-purchase.esm.js";import"./components/subscription-management.esm.js";import"./chunks/index-9gijHGwh.esm.js";import"./utils/wait-for-element.esm.js";import"./utils/remote-session.esm.js";import"./utils/memoize-last.esm.js";import"./chunks/index-t4uX5Dg1.esm.js";import"./chunks/order-page-JdaAppB7.esm.js";import"./chunks/update-cart-yneR8zk1.esm.js";import"./chunks/index-9YcaEQju.esm.js";import"./chunks/index-ll8zLjbu.esm.js";import"./chunks/index-gULINFkH.esm.js";import"./react/community-impact.esm.js";import"react";import"./react/cumulative-impact.esm.js";import"./react/impact-overview.esm.js";import"./react/select-nonprofit.esm.js";import"./react/redeem-transaction.esm.js";import"./react/post-purchase.esm.js";import"./react/subscription-management.esm.js";export{T as Integrations,X as ReactComponents,Z as Utils,Q as WebComponents};
2
2
  //# sourceMappingURL=index.esm.js.map
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import{i as Q}from"./chunks/index-IzAvjker.esm.js";import{i as T}from"./chunks/index-0CUzV2-m.esm.js";import{i as X}from"./chunks/index-EHubF2KN.esm.js";import{i as Z}from"./chunks/index-rrdYIcOi.esm.js";import"./components/community-impact.js";import"./chunks/lit-yVXn5Cbs.esm.js";import"./chunks/progress-bar-7gWYaGlq.esm.js";import"./components/beam-partner-logos.js";import"./chunks/enforce-config-n0D_zfMC.esm.js";import"./chunks/beam-errors-AMvTvR1C.esm.js";import"./utils/logger.js";import"./chunks/routes-wPiw5U5n.esm.js";import"./chunks/localize-0rA0DbzI.esm.js";import"./chunks/css-card-grid-3b56QBzq.esm.js";import"./components/cumulative-impact.js";import"./chunks/lodash-P8OIs-at.esm.js";import"./chunks/is-all-html-elements-SdSkxirh.esm.js";import"./components/impact-overview.js";import"./chunks/vendor-eeJfrOkP.esm.js";import"./chunks/responsive-LYEag6TI.esm.js";import"./components/select-nonprofit.js";import"./chunks/events-5IECSF-x.esm.js";import"./utils/network-listeners.js";import"./utils/local-storage.js";import"./utils/cookies.js";import"./chunks/cart-contents-h60geKWa.esm.js";import"./components/redeem-transaction.js";import"./components/post-purchase.js";import"./components/subscription-management.js";import"./chunks/index-w9_XpjIg.esm.js";import"./utils/wait-for-element.js";import"./utils/remote-session.js";import"./utils/memoize-last.js";import"./chunks/index-6hf6jo8u.esm.js";import"./chunks/order-page-MyFrJe1o.esm.js";import"./chunks/update-cart-OkpQAdyP.esm.js";import"./chunks/index-Z1UUeVXR.esm.js";import"./chunks/index-m6tLtpwd.esm.js";import"./chunks/index-hC71uT32.esm.js";import"./react/community-impact.js";import"react";import"./react/cumulative-impact.js";import"./react/impact-overview.js";import"./react/select-nonprofit.js";import"./react/redeem-transaction.js";import"./react/post-purchase.js";import"./react/subscription-management.js";export{T as Integrations,X as ReactComponents,Z as Utils,Q as WebComponents};
1
+ import{i as Q}from"./chunks/index-IzAvjker.esm.js";import{i as T}from"./chunks/index-r9Yb1UY4.esm.js";import{i as X}from"./chunks/index-EHubF2KN.esm.js";import{i as Z}from"./chunks/index-wsdeaTHd.esm.js";import"./components/community-impact.js";import"./chunks/lit-yVXn5Cbs.esm.js";import"./chunks/progress-bar-7gWYaGlq.esm.js";import"./components/beam-partner-logos.js";import"./chunks/enforce-config-fo8kIfoY.esm.js";import"./chunks/beam-errors-P-Lu07Ce.esm.js";import"./utils/logger.js";import"./chunks/routes-CqjzL4oL.esm.js";import"./chunks/localize-pzAAkBvG.esm.js";import"./chunks/css-card-grid-3b56QBzq.esm.js";import"./components/cumulative-impact.js";import"./chunks/lodash-P8OIs-at.esm.js";import"./chunks/is-all-html-elements-SdSkxirh.esm.js";import"./components/impact-overview.js";import"./chunks/vendor-eeJfrOkP.esm.js";import"./chunks/responsive-LYEag6TI.esm.js";import"./components/select-nonprofit.js";import"./chunks/events-5IECSF-x.esm.js";import"./utils/network-listeners.js";import"./utils/local-storage.js";import"./utils/cookies.js";import"./chunks/cart-contents-h60geKWa.esm.js";import"./components/redeem-transaction.js";import"./components/post-purchase.js";import"./components/subscription-management.js";import"./chunks/index-U8Oy2aur.esm.js";import"./utils/wait-for-element.js";import"./utils/remote-session.js";import"./utils/memoize-last.js";import"./chunks/index-1qXot92e.esm.js";import"./chunks/order-page-W1jR35W9.esm.js";import"./chunks/update-cart-T32-282v.esm.js";import"./chunks/index-Z1UUeVXR.esm.js";import"./chunks/index-EpanGShY.esm.js";import"./chunks/index-fqDBrscF.esm.js";import"./react/community-impact.js";import"react";import"./react/cumulative-impact.js";import"./react/impact-overview.js";import"./react/select-nonprofit.js";import"./react/redeem-transaction.js";import"./react/post-purchase.js";import"./react/subscription-management.js";export{T as Integrations,X as ReactComponents,Z as Utils,Q as WebComponents};
2
2
  //# sourceMappingURL=index.js.map