@beamimpact/web-sdk 1.37.0 → 1.37.1
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.
- package/README.md +21 -1
- package/dist/chunks/{_share-dialog-dependencies-Ex1exJdU.esm.js → _share-dialog-dependencies-FheD3_vQ.esm.js} +2 -2
- package/dist/chunks/_share-dialog-dependencies-FheD3_vQ.esm.js.map +1 -0
- package/dist/chunks/{_share-dialog-dependencies-GOqKRBIc.esm.js → _share-dialog-dependencies-l35ECwOP.esm.js} +2 -2
- package/dist/chunks/_share-dialog-dependencies-l35ECwOP.esm.js.map +1 -0
- package/dist/chunks/{cart-contents-Cdq4ob0J.esm.d.ts → cart-contents-IOhdr24g.esm.d.ts} +1 -1
- package/dist/chunks/events-Y8fYvSqM.esm.js +2 -0
- package/dist/chunks/{events-5IECSF-x.esm.js.map → events-Y8fYvSqM.esm.js.map} +1 -1
- package/dist/chunks/{events-3-Mzl-dS.esm.d.ts → events-j-SJ9Cot.esm.d.ts} +17 -3
- package/dist/chunks/{index-SZxnIRAX.esm.d.ts → index-3F_Wjm5v.esm.d.ts} +1 -1
- package/dist/chunks/{index-9gijHGwh.esm.js → index-8yrr7ZZv.esm.js} +2 -2
- package/dist/chunks/index-8yrr7ZZv.esm.js.map +1 -0
- package/dist/chunks/index-B2oj1JKu.esm.js +2 -0
- package/dist/chunks/index-B2oj1JKu.esm.js.map +1 -0
- package/dist/chunks/index-E_HMWZ2A.esm.js +2 -0
- package/dist/chunks/index-E_HMWZ2A.esm.js.map +1 -0
- package/dist/chunks/{index-jYAdXbGg.esm.js → index-Gz7Q9nUW.esm.js} +2 -2
- package/dist/chunks/{index-jYAdXbGg.esm.js.map → index-Gz7Q9nUW.esm.js.map} +1 -1
- package/dist/chunks/index-JsXH5Lnc.esm.js +2 -0
- package/dist/chunks/index-JsXH5Lnc.esm.js.map +1 -0
- package/dist/chunks/{index-OnjTwvAw.esm.js → index-Lw32NXij.esm.js} +2 -2
- package/dist/chunks/index-Lw32NXij.esm.js.map +1 -0
- package/dist/chunks/index-RDKeoKqc.esm.js +2 -0
- package/dist/chunks/index-RDKeoKqc.esm.js.map +1 -0
- package/dist/chunks/index-VGoZaoVm.esm.js +2 -0
- package/dist/chunks/index-VGoZaoVm.esm.js.map +1 -0
- package/dist/chunks/{index-9Cs92uGK.esm.d.ts → index-WX8Yyx2u.esm.d.ts} +1 -1
- package/dist/chunks/{index-7-XLaXA4.esm.d.ts → index-mWnpDGl1.esm.d.ts} +1 -1
- package/dist/chunks/{index-U8Oy2aur.esm.js → index-phDmC-TS.esm.js} +2 -2
- package/dist/chunks/index-phDmC-TS.esm.js.map +1 -0
- package/dist/chunks/{index-xRjeUrl2.esm.d.ts → index-s8uQH63W.esm.d.ts} +4 -4
- package/dist/chunks/{index-b3DeBLwb.esm.d.ts → index-slrOT8Gd.esm.d.ts} +1 -1
- package/dist/chunks/{index-wsdeaTHd.esm.js → index-uF-Qtewb.esm.js} +2 -2
- package/dist/chunks/index-uF-Qtewb.esm.js.map +1 -0
- package/dist/chunks/{index-KErjmUlF.esm.js → index-vpkWmZo_.esm.js} +2 -2
- package/dist/chunks/{index-KErjmUlF.esm.js.map → index-vpkWmZo_.esm.js.map} +1 -1
- package/dist/chunks/index-xYLcuL6Z.esm.js +2 -0
- package/dist/chunks/index-xYLcuL6Z.esm.js.map +1 -0
- package/dist/chunks/{index-AhT9jBIr.esm.d.ts → index-yXqJ9Znv.esm.d.ts} +1 -1
- package/dist/chunks/{openapi-spec-WpREPNjl.esm.d.ts → openapi-spec-b529HHW3.esm.d.ts} +7 -7
- package/dist/chunks/order-page-9B0nZVh1.esm.js +2 -0
- package/dist/chunks/order-page-9B0nZVh1.esm.js.map +1 -0
- package/dist/chunks/{order-page-eOCpZ8vN.esm.d.ts → order-page-jkuLE25f.esm.d.ts} +3 -4
- package/dist/chunks/order-page-yM2h67MI.esm.js +2 -0
- package/dist/chunks/order-page-yM2h67MI.esm.js.map +1 -0
- package/dist/chunks/routes-LFjgVNGB.esm.js +2 -0
- package/dist/chunks/routes-LFjgVNGB.esm.js.map +1 -0
- package/dist/chunks/routes-ad0I3Ayc.esm.js +2 -0
- package/dist/chunks/routes-ad0I3Ayc.esm.js.map +1 -0
- package/dist/chunks/{update-cart-8nDxTnnQ.esm.js → update-cart-A2hs4tF8.esm.js} +2 -2
- package/dist/chunks/{update-cart-8nDxTnnQ.esm.js.map → update-cart-A2hs4tF8.esm.js.map} +1 -1
- package/dist/chunks/{update-cart-D4jDrYC0.esm.d.ts → update-cart-EKZbvT8c.esm.d.ts} +1 -1
- package/dist/chunks/{update-cart-_cCsAqH9.esm.js → update-cart-vcujKNky.esm.js} +2 -2
- package/dist/chunks/{update-cart-_cCsAqH9.esm.js.map → update-cart-vcujKNky.esm.js.map} +1 -1
- package/dist/components/community-impact.esm.js +1 -1
- package/dist/components/community-impact.js +1 -1
- package/dist/components/cumulative-impact.esm.js +1 -1
- package/dist/components/cumulative-impact.js +1 -1
- package/dist/components/impact-overview.esm.js +1 -1
- package/dist/components/impact-overview.js +1 -1
- package/dist/components/index.d.ts +2 -2
- package/dist/components/index.esm.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/post-purchase.d.ts +3 -3
- package/dist/components/post-purchase.esm.js +1 -1
- package/dist/components/post-purchase.js +1 -1
- package/dist/components/redeem-transaction.d.ts +3 -3
- package/dist/components/redeem-transaction.esm.js +1 -1
- package/dist/components/redeem-transaction.js +1 -1
- package/dist/components/select-nonprofit.d.ts +3 -3
- package/dist/components/select-nonprofit.esm.js +19 -19
- package/dist/components/select-nonprofit.esm.js.map +1 -1
- package/dist/components/select-nonprofit.js +19 -19
- package/dist/components/select-nonprofit.js.map +1 -1
- package/dist/components/shopify.d.ts +5 -5
- package/dist/components/shopify.esm.js +1 -1
- package/dist/components/shopify.js +1 -1
- package/dist/components/subscription-management.d.ts +3 -3
- package/dist/components/subscription-management.esm.js +1 -1
- package/dist/components/subscription-management.js +1 -1
- package/dist/index.d.ts +11 -11
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/integrations/beam.esm.js +1 -1
- package/dist/integrations/beam.js +1 -1
- package/dist/integrations/cart.d.ts +3 -3
- package/dist/integrations/cart.esm.js +1 -1
- package/dist/integrations/cart.js +1 -1
- package/dist/integrations/index.d.ts +9 -9
- package/dist/integrations/index.esm.js +1 -1
- package/dist/integrations/index.js +1 -1
- package/dist/integrations/logs.d.ts +2 -2
- package/dist/integrations/logs.esm.js +1 -1
- package/dist/integrations/logs.js +1 -1
- package/dist/integrations/shopify.d.ts +4 -4
- package/dist/integrations/shopify.esm.js +1 -1
- package/dist/integrations/shopify.js +1 -1
- package/dist/integrations/statsig.esm.js +1 -1
- package/dist/integrations/statsig.js +1 -1
- package/dist/integrations/utils.d.ts +3 -3
- package/dist/integrations/utils.esm.js +1 -1
- package/dist/integrations/utils.js +1 -1
- package/dist/react/community-impact.esm.js +1 -1
- package/dist/react/community-impact.js +1 -1
- package/dist/react/cumulative-impact.esm.js +1 -1
- package/dist/react/cumulative-impact.js +1 -1
- package/dist/react/impact-overview.esm.js +1 -1
- package/dist/react/impact-overview.js +1 -1
- package/dist/react/index.d.ts +3 -3
- package/dist/react/index.esm.js +1 -1
- package/dist/react/index.js +1 -1
- package/dist/react/post-purchase.d.ts +2 -2
- package/dist/react/post-purchase.esm.js +1 -1
- package/dist/react/post-purchase.js +1 -1
- package/dist/react/redeem-transaction.d.ts +3 -3
- package/dist/react/redeem-transaction.esm.js +1 -1
- package/dist/react/redeem-transaction.js +1 -1
- package/dist/react/select-nonprofit.d.ts +3 -3
- package/dist/react/select-nonprofit.esm.js +1 -1
- package/dist/react/select-nonprofit.js +1 -1
- package/dist/react/subscription-management.d.ts +2 -2
- package/dist/react/subscription-management.esm.js +1 -1
- package/dist/react/subscription-management.js +1 -1
- package/dist/utils/events.d.ts +3 -3
- package/dist/utils/events.esm.js +1 -1
- package/dist/utils/events.js +1 -1
- package/dist/utils/index.d.ts +3 -3
- package/dist/utils/index.esm.js +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/network-listeners.esm.js +1 -1
- package/dist/utils/network-listeners.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/_share-dialog-dependencies-Ex1exJdU.esm.js.map +0 -1
- package/dist/chunks/_share-dialog-dependencies-GOqKRBIc.esm.js.map +0 -1
- package/dist/chunks/events-5IECSF-x.esm.js +0 -2
- package/dist/chunks/index-5AkzIYu3.esm.js +0 -2
- package/dist/chunks/index-5AkzIYu3.esm.js.map +0 -1
- package/dist/chunks/index-8VxiCO_y.esm.js +0 -2
- package/dist/chunks/index-8VxiCO_y.esm.js.map +0 -1
- package/dist/chunks/index-9gijHGwh.esm.js.map +0 -1
- package/dist/chunks/index-OnjTwvAw.esm.js.map +0 -1
- package/dist/chunks/index-U8Oy2aur.esm.js.map +0 -1
- package/dist/chunks/index-a9SRo_pt.esm.js +0 -2
- package/dist/chunks/index-a9SRo_pt.esm.js.map +0 -1
- package/dist/chunks/index-fdm0Zxu6.esm.js +0 -2
- package/dist/chunks/index-fdm0Zxu6.esm.js.map +0 -1
- package/dist/chunks/index-gfShfkGQ.esm.js +0 -2
- package/dist/chunks/index-gfShfkGQ.esm.js.map +0 -1
- package/dist/chunks/index-wsdeaTHd.esm.js.map +0 -1
- package/dist/chunks/index-yEHTVDWu.esm.js +0 -2
- package/dist/chunks/index-yEHTVDWu.esm.js.map +0 -1
- package/dist/chunks/order-page-ZyVxKalS.esm.js +0 -2
- package/dist/chunks/order-page-ZyVxKalS.esm.js.map +0 -1
- package/dist/chunks/order-page-nKOujF0G.esm.js +0 -2
- package/dist/chunks/order-page-nKOujF0G.esm.js.map +0 -1
- package/dist/chunks/routes-S3ZS-od_.esm.js +0 -2
- package/dist/chunks/routes-S3ZS-od_.esm.js.map +0 -1
- package/dist/chunks/routes-jQjZhNH9.esm.js +0 -2
- package/dist/chunks/routes-jQjZhNH9.esm.js.map +0 -1
|
@@ -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, logger } 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 this.localStorage.setItem(\"nonprofit_selected_at\", new Date().toISOString());\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 const currentTimestamp = new Date().valueOf();\n\n this.cart = this.localStorage.getItemJson<TBeamCartLocalStorage>(\"cart\") ?? undefined;\n\n // Restore previous nonprofit selection, unless it is too old\n // (Note: localStorage key is called \"transaction\" for backwards compatibility with legacy SDK)\n const selectionTtl = 30 * 24 * 60 * 60 * 1000; // 30 days in milliseconds\n const selectionCreatedAt = this.localStorage.getItem(\"nonprofit_selected_at\") ?? 0;\n const isSelectionExpired = currentTimestamp > new Date(selectionCreatedAt).valueOf() + selectionTtl;\n if (!isSelectionExpired) {\n this.selectedNonprofitId = parseInt(this.localStorage.getItem(\"nonprofit\") || \"\") || null;\n this.selectionId = this.localStorage.getItem(\"transaction\") ?? undefined;\n }\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; // 2 hours in milliseconds\n const isCacheExpired = currentTimestamp > new Date(createdAt).valueOf() + cacheTtl;\n if (!isCacheExpired) {\n this.nonprofitListDataController.data = data;\n this.nonprofitListDataController.loading = false;\n }\n } catch (err) {\n logger.error(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","l","h","f","e","t","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","currentTimestamp","selectionTtl","selectionCreatedAt","createdAt","data","cacheTtl","err","logger","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":"62BAAO,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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AA;AAAA;AAAA;AAAA,UAyB7CA,EAAc,oCAAoC,CAAC;AAAA;AAAA;AAAA,KAI3D,EApbmCK,EAAA,CAAlCC,EAAS,CAAE,KAAM,MAAO,CAAC,CAAA,EAHf9D,EAGwB,UAAA,UAAA,CAAA,EAEA6D,EAAA,CAAlCC,EAAS,CAAE,KAAM,MAAO,CAAC,GALf9D,EAKwB,UAAA,SAAA,CAAA,EAGe6D,EAAA,CAAjDC,EAAS,CAAE,KAAM,OAAQ,QAAS,EAAK,CAAC,CAAA,EAR9B9D,EAQuC,UAEf6D,UAAAA,CAAAA,EAAAA,EAAA,CAAlCC,EAAS,CAAE,KAAM,MAAO,CAAC,CAAA,EAVf9D,EAUwB,UAAA,cAAA,CAAA,EAEA6D,EAAA,CAAlCC,EAAS,CAAE,KAAM,MAAO,CAAC,CAZf,EAAA9D,EAYwB,0BAE0C6D,EAAA,CAA5EC,EAAS,CAAE,UAAW,GAAO,WAAY,CAACC,EAAGC,IAAM,CAACC,EAAQF,EAAGC,CAAC,CAAE,CAAC,CAAA,EAdzDhE,EAckE,UAAA,OAAA,CAAA,EAE3B6D,EAAA,CAAjDC,EAAS,CAAE,KAAM,OAAQ,QAAS,EAAK,CAAC,CAAA,EAhB9B9D,EAgBuC,UAAA,sBAAA,CAAA,EAEf6D,EAAA,CAAlCC,EAAS,CAAE,KAAM,MAAO,CAAC,CAlBf,EAAA9D,EAkBwB,oBAEC6D,EAAA,CAAnCC,EAAS,CAAE,KAAM,OAAQ,CAAC,CApBhB,EAAA9D,EAoByB,UAglBtCkE,QAAAA,CAAAA,EAAAA,EAAoBlE,CAAmB"}
|
|
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, logger } 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, BeamNonprofitSelectionRemovedEvent } 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 [\"nonprofit_selected_at\", \"nonprofit\"].forEach((key) => {\n this.localStorage.removeItem(key);\n });\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 postalCode: this.postalCode,\n countryCode: this.countryCode,\n },\n });\n\n this.selectionId = result?.selectionId;\n this.localStorage.setItem(\"transaction\", this.selectionId);\n this.localStorage.setItem(\"nonprofit\", selectedNonprofitId);\n this.localStorage.setItem(\"nonprofit_selected_at\", new Date().toISOString());\n\n await this.updateComplete;\n\n const selectedNonprofit = this.getNonprofitById(selectedNonprofitId);\n\n this.dispatchEvent(\n selectedNonprofitId !== null\n ? new BeamNonprofitSelectEvent({\n selectedNonprofitId,\n selectionId: this.selectionId,\n nonprofitName: selectedNonprofit?.nonprofit?.name ?? null,\n })\n : new BeamNonprofitSelectionRemovedEvent({\n newNonprofitId: 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 const currentTimestamp = new Date().valueOf();\n\n this.cart = this.localStorage.getItemJson<TBeamCartLocalStorage>(\"cart\") ?? undefined;\n\n // Restore the previous nonprofit selection unless it exceeds the defined time limit, in which case clear the selection\n // (Note: localStorage key is called \"transaction\" for backwards compatibility with legacy SDK)\n const selectionTtl = 30 * 24 * 60 * 60 * 1000; // 30 days in milliseconds\n const selectionCreatedAt = this.localStorage.getItem(\"nonprofit_selected_at\") ?? 0;\n const isSelectionExpired = currentTimestamp > new Date(selectionCreatedAt).valueOf() + selectionTtl;\n if (!isSelectionExpired) {\n this.selectedNonprofitId = parseInt(this.localStorage.getItem(\"nonprofit\") || \"\") || null;\n this.selectionId = this.localStorage.getItem(\"transaction\") ?? undefined;\n } else {\n await this.postSelectNonprofit({ selectedNonprofitId: null });\n [\"nonprofit_selected_at\", \"nonprofit\"].forEach((key) => {\n this.localStorage.removeItem(key);\n });\n }\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; // 2 hours in milliseconds\n const isCacheExpired = currentTimestamp > new Date(createdAt).valueOf() + cacheTtl;\n if (!isCacheExpired) {\n this.nonprofitListDataController.data = data;\n this.nonprofitListDataController.loading = false;\n }\n } catch (err) {\n logger.error(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 await this.postSelectNonprofit({ selectedNonprofitId: null });\n [\"nonprofit_selected_at\", \"nonprofit\"].forEach((key) => {\n this.localStorage.removeItem(key);\n });\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","l","h","f","e","t","o","i","r","BeamSelectNonprofit","LitElement","DEFAULT_BASE_URL","enforceConfig","cart","res","postChainEligibleNonprofitsForCart","np","key","selectedNonprofitId","cartId","beamCartId","result","postSelectNonprofit","selectedNonprofit","BeamNonprofitSelectEvent","BeamNonprofitSelectionRemovedEvent","AsyncController","createScopedLocalStorage","evt","id","index","nonprofits","currentId","nextFocus","focusTarget","SUPPORTED_LANGUAGES","BeamCartChangeEvent","_changedProperties","previousPropertyValues","requireNewDataProps","prop","getCookieValue","BEAM_CART_COOKIE_NAME","currentTimestamp","selectionTtl","selectionCreatedAt","createdAt","data","cacheTtl","err","logger","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":"+2BAAO,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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WAAY,CAACC,EAAGC,IAAM,CAACC,EAAQF,EAAGC,CAAC,CAAE,CAAC,CAAA,EAdzDlE,EAckE,UAAA,OAAA,CAAA,EAE3B+D,EAAA,CAAjDC,EAAS,CAAE,KAAM,OAAQ,QAAS,EAAK,CAAC,CAAA,EAhB9BhE,EAgBuC,UAAA,sBAAA,CAAA,EAEf+D,EAAA,CAAlCC,EAAS,CAAE,KAAM,MAAO,CAAC,CAlBf,EAAAhE,EAkBwB,oBAEC+D,EAAA,CAAnCC,EAAS,CAAE,KAAM,OAAQ,CAAC,CApBhB,EAAAhE,EAoByB,UAkmBtCoE,QAAAA,CAAAA,EAAAA,EAAoBpE,CAAmB"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { waitForElement } from '../utils/wait-for-element.js';
|
|
2
2
|
export { initNetworkListeners } from '../utils/network-listeners.js';
|
|
3
|
-
export { e as events } from '../chunks/events-
|
|
4
|
-
export { T as TBeamOrderPageParams, a as addBeamAttributesToCart, g as getCurrentCart, r as registerCartIntegration, s as showBeamOrderPageWidgets, t as trackCart } from '../chunks/order-page-
|
|
5
|
-
import '../chunks/cart-contents-
|
|
6
|
-
import '../chunks/openapi-spec-
|
|
3
|
+
export { e as events } from '../chunks/events-j-SJ9Cot.esm.js';
|
|
4
|
+
export { T as TBeamOrderPageParams, a as addBeamAttributesToCart, g as getCurrentCart, r as registerCartIntegration, s as showBeamOrderPageWidgets, t as trackCart } from '../chunks/order-page-jkuLE25f.esm.js';
|
|
5
|
+
import '../chunks/cart-contents-IOhdr24g.esm.js';
|
|
6
|
+
import '../chunks/openapi-spec-b529HHW3.esm.js';
|
|
7
7
|
import '../chunks/types-7kSi85Gv.esm.js';
|
|
8
8
|
import 'lodash';
|
|
9
|
-
import '../chunks/update-cart-
|
|
9
|
+
import '../chunks/update-cart-EKZbvT8c.esm.js';
|
|
10
10
|
import '../chunks/types-aju0qrRe.esm.js';
|
|
11
11
|
import './post-purchase.js';
|
|
12
12
|
import 'lit';
|
|
@@ -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
|
|
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 A}from"../utils/network-listeners.esm.js";import{e as L}from"../chunks/events-Y8fYvSqM.esm.js";import{f as O,p as R,P as T,s as W,R as j}from"../chunks/order-page-yM2h67MI.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../chunks/lodash-P8OIs-at.esm.js";import"../utils/logger.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-A2hs4tF8.esm.js";import"../chunks/routes-LFjgVNGB.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{O as addBeamAttributesToCart,L as events,R as getCurrentCart,A as initNetworkListeners,T as registerCartIntegration,W as showBeamOrderPageWidgets,j 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
|
|
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 A}from"../utils/network-listeners.js";import{e as L}from"../chunks/events-Y8fYvSqM.esm.js";import{f as O,p as R,P as T,s as W,R as j}from"../chunks/order-page-9B0nZVh1.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../chunks/lodash-P8OIs-at.esm.js";import"../utils/logger.js";import"../utils/local-storage.js";import"../utils/memoize-last.js";import"../chunks/cart-contents-h60geKWa.esm.js";import"../chunks/update-cart-vcujKNky.esm.js";import"../chunks/routes-ad0I3Ayc.esm.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{O as addBeamAttributesToCart,L as events,R as getCurrentCart,A as initNetworkListeners,T as registerCartIntegration,W as showBeamOrderPageWidgets,j as trackCart,i as utils};
|
|
2
2
|
//# sourceMappingURL=shopify.js.map
|
|
@@ -2,8 +2,8 @@ import * as lit from 'lit';
|
|
|
2
2
|
import { LitElement } from 'lit';
|
|
3
3
|
import * as lit_html from 'lit-html';
|
|
4
4
|
import { L as LANGUAGES } from '../chunks/types-aju0qrRe.esm.js';
|
|
5
|
-
import { T as TCart } from '../chunks/cart-contents-
|
|
6
|
-
import '../chunks/openapi-spec-
|
|
5
|
+
import { T as TCart } from '../chunks/cart-contents-IOhdr24g.esm.js';
|
|
6
|
+
import '../chunks/openapi-spec-b529HHW3.esm.js';
|
|
7
7
|
|
|
8
8
|
interface RequiredDataPropsWithEmail {
|
|
9
9
|
email: string;
|
|
@@ -116,7 +116,7 @@ declare class BeamSubscriptionManagement extends LitElement {
|
|
|
116
116
|
} | null;
|
|
117
117
|
}>;
|
|
118
118
|
handleSwapNonprofitButtonClick(): void;
|
|
119
|
-
renderSwapNonprofitButton():
|
|
119
|
+
renderSwapNonprofitButton(): lit_html.TemplateResult<1> | "";
|
|
120
120
|
get cssVariables(): any;
|
|
121
121
|
static styles: lit.CSSResult[];
|
|
122
122
|
render(): lit_html.TemplateResult<1>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{f as h,g as o,t as p,h as g,y as d}from"../chunks/lit-yVXn5Cbs.esm.js";import{D as f,e as y,h as w}from"../chunks/routes-
|
|
1
|
+
import{f as h,g as o,t as p,h as g,y as d}from"../chunks/lit-yVXn5Cbs.esm.js";import{D as f,e as y,h as w}from"../chunks/routes-LFjgVNGB.esm.js";import{c as S,d as v,A as u,e as b,a as C,_ as m}from"../chunks/enforce-config-qna7hEL6.esm.js";import{c as x}from"../chunks/events-Y8fYvSqM.esm.js";import{M as N}from"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../utils/logger.esm.js";const I={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,$=Object.getOwnPropertyDescriptor,n=(i,t,r,a)=>{for(var s=a>1?void 0:a?$(t,r):t,l=i.length-1,c;l>=0;l--)(c=i[l])&&(s=(a?c(t,r,s):c(s))||s);return a&&s&&M(t,r,s),s};class e extends g{constructor(){super(...arguments),this.baseUrl=f,this.lang="en",this.debug=!1,this.activeWidget=null,this.nonprofitId=null,this.userId=null,this.chainName=null,this.subscriptionDataController=new u(this,this.fetchSubscription),this.eligibleNonprofitsDataController=new u(this,this.fetchEligibleNonprofits)}async firstUpdated(){if(!this.email&&!this.partnerUserId)throw new N(["email","partnerUserId"],"One of the following properties needs to be specified: email, partnerUserId ");b(["apiKey","subscriptionId"],this),await this.loadWidget()}async loadWidget(){await Promise.all([this.fetchEligibleNonprofits(),this.fetchSubscription()]),this.activeWidget=this.nonprofitId?"impact-overview":"redeem-transaction"}async fetchEligibleNonprofits(){b(["apiKey","subscriptionId"],this);const t=await y({baseUrl:this.baseUrl,headers:{authorization:`Api-Key ${this.apiKey}`},requestBody:{storeId:this.storeId||void 0,postalCode:this.postalCode||void 0,countryCode:this.countryCode||void 0,widgetName:"subscription-management",version:"1.0.0"}});return this.chainName=t.chain.name,this.storeId=t.store.id,this.eligibleNonprofitsDataController.data=t,t}async fetchSubscription(){b(["apiKey","subscriptionId"],this);const t=await w({baseUrl:this.baseUrl,headers:{authorization:`Api-Key ${this.apiKey}`},requestBody:{remoteSubscriptionId:this.subscriptionId,email:this.email,partnerUserId:this.partnerUserId}});return this.userId=t.beamUserId,this.nonprofitId=t.nonprofit?.id||null,t}handleSwapNonprofitButtonClick(){this.activeWidget="redeem-transaction"}renderSwapNonprofitButton(){return this.activeWidget==="impact-overview"?d`<button class="swap-nonprofit-button" @click="${this.handleSwapNonprofitButtonClick}">
|
|
2
2
|
${I[this.lang].nonprofitSwapText({brandName:this.chainName||""})}
|
|
3
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 m({error:this.subscriptionDataController.error});if(this.eligibleNonprofitsDataController.error!==null)return m({error:this.eligibleNonprofitsDataController.error})}else t="";return this.activeWidget==="redeem-transaction"?t=d` <beam-redeem-transaction
|
|
4
4
|
part="redeem-transaction"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{f as h,g as o,t as p,h as g,y as d}from"../chunks/lit-yVXn5Cbs.esm.js";import{D as f,e as y,h as w}from"../chunks/routes-
|
|
1
|
+
import{f as h,g as o,t as p,h as g,y as d}from"../chunks/lit-yVXn5Cbs.esm.js";import{D as f,e as y,h as w}from"../chunks/routes-ad0I3Ayc.esm.js";import{c as S,d as v,A as u,e as b,a as C,_ as m}from"../chunks/enforce-config-fo8kIfoY.esm.js";import{c as x}from"../chunks/events-Y8fYvSqM.esm.js";import{M as N}from"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../utils/logger.js";const I={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,$=Object.getOwnPropertyDescriptor,n=(i,t,r,a)=>{for(var s=a>1?void 0:a?$(t,r):t,l=i.length-1,c;l>=0;l--)(c=i[l])&&(s=(a?c(t,r,s):c(s))||s);return a&&s&&M(t,r,s),s};class e extends g{constructor(){super(...arguments),this.baseUrl=f,this.lang="en",this.debug=!1,this.activeWidget=null,this.nonprofitId=null,this.userId=null,this.chainName=null,this.subscriptionDataController=new u(this,this.fetchSubscription),this.eligibleNonprofitsDataController=new u(this,this.fetchEligibleNonprofits)}async firstUpdated(){if(!this.email&&!this.partnerUserId)throw new N(["email","partnerUserId"],"One of the following properties needs to be specified: email, partnerUserId ");b(["apiKey","subscriptionId"],this),await this.loadWidget()}async loadWidget(){await Promise.all([this.fetchEligibleNonprofits(),this.fetchSubscription()]),this.activeWidget=this.nonprofitId?"impact-overview":"redeem-transaction"}async fetchEligibleNonprofits(){b(["apiKey","subscriptionId"],this);const t=await y({baseUrl:this.baseUrl,headers:{authorization:`Api-Key ${this.apiKey}`},requestBody:{storeId:this.storeId||void 0,postalCode:this.postalCode||void 0,countryCode:this.countryCode||void 0,widgetName:"subscription-management",version:"1.0.0"}});return this.chainName=t.chain.name,this.storeId=t.store.id,this.eligibleNonprofitsDataController.data=t,t}async fetchSubscription(){b(["apiKey","subscriptionId"],this);const t=await w({baseUrl:this.baseUrl,headers:{authorization:`Api-Key ${this.apiKey}`},requestBody:{remoteSubscriptionId:this.subscriptionId,email:this.email,partnerUserId:this.partnerUserId}});return this.userId=t.beamUserId,this.nonprofitId=t.nonprofit?.id||null,t}handleSwapNonprofitButtonClick(){this.activeWidget="redeem-transaction"}renderSwapNonprofitButton(){return this.activeWidget==="impact-overview"?d`<button class="swap-nonprofit-button" @click="${this.handleSwapNonprofitButtonClick}">
|
|
2
2
|
${I[this.lang].nonprofitSwapText({brandName:this.chainName||""})}
|
|
3
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 m({error:this.subscriptionDataController.error});if(this.eligibleNonprofitsDataController.error!==null)return m({error:this.eligibleNonprofitsDataController.error})}else t="";return this.activeWidget==="redeem-transaction"?t=d` <beam-redeem-transaction
|
|
4
4
|
part="redeem-transaction"
|
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-
|
|
2
|
+
export { i as Integrations } from './chunks/index-s8uQH63W.esm.js';
|
|
3
3
|
export { i as ReactComponents } from './chunks/index-6t9MtjyS.esm.js';
|
|
4
|
-
export { i as Utils } from './chunks/index-
|
|
4
|
+
export { i as Utils } from './chunks/index-slrOT8Gd.esm.js';
|
|
5
5
|
import './components/community-impact.js';
|
|
6
6
|
import 'lit';
|
|
7
7
|
import 'lit-html';
|
|
@@ -13,14 +13,14 @@ import './components/cumulative-impact.js';
|
|
|
13
13
|
import 'lodash';
|
|
14
14
|
import './components/impact-overview.js';
|
|
15
15
|
import './components/select-nonprofit.js';
|
|
16
|
-
import './chunks/cart-contents-
|
|
17
|
-
import './chunks/openapi-spec-
|
|
16
|
+
import './chunks/cart-contents-IOhdr24g.esm.js';
|
|
17
|
+
import './chunks/openapi-spec-b529HHW3.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-
|
|
21
|
+
import './chunks/index-mWnpDGl1.esm.js';
|
|
22
22
|
import './chunks/beam-errors-fXDkG1zo.esm.js';
|
|
23
|
-
import './chunks/events-
|
|
23
|
+
import './chunks/events-j-SJ9Cot.esm.js';
|
|
24
24
|
import './utils/logger.js';
|
|
25
25
|
import './utils/network-listeners.js';
|
|
26
26
|
import './utils/local-storage.js';
|
|
@@ -30,12 +30,12 @@ import './utils/remote-session.js';
|
|
|
30
30
|
import './utils/memoize-last.js';
|
|
31
31
|
import 'lodash-es/debounce';
|
|
32
32
|
import 'lodash-es/isEqual';
|
|
33
|
-
import './chunks/index-
|
|
34
|
-
import './chunks/order-page-
|
|
35
|
-
import './chunks/update-cart-
|
|
33
|
+
import './chunks/index-3F_Wjm5v.esm.js';
|
|
34
|
+
import './chunks/order-page-jkuLE25f.esm.js';
|
|
35
|
+
import './chunks/update-cart-EKZbvT8c.esm.js';
|
|
36
36
|
import './chunks/index-EGiUuWe-.esm.js';
|
|
37
|
-
import './chunks/index-
|
|
38
|
-
import './chunks/index-
|
|
37
|
+
import './chunks/index-WX8Yyx2u.esm.js';
|
|
38
|
+
import './chunks/index-yXqJ9Znv.esm.js';
|
|
39
39
|
import './react/community-impact.js';
|
|
40
40
|
import '@lit/react';
|
|
41
41
|
import './react/cumulative-impact.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-
|
|
1
|
+
import{i as Q}from"./chunks/index-5yFqo0yl.esm.js";import{i as T}from"./chunks/index-xYLcuL6Z.esm.js";import{i as X}from"./chunks/index-o7YiP4gC.esm.js";import{i as Z}from"./chunks/index-8yrr7ZZv.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-LFjgVNGB.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-Y8fYvSqM.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-Lw32NXij.esm.js";import"./utils/wait-for-element.esm.js";import"./utils/remote-session.esm.js";import"./utils/memoize-last.esm.js";import"./chunks/index-JsXH5Lnc.esm.js";import"./chunks/order-page-yM2h67MI.esm.js";import"./chunks/update-cart-A2hs4tF8.esm.js";import"./chunks/index-9YcaEQju.esm.js";import"./chunks/index-B2oj1JKu.esm.js";import"./chunks/index-vpkWmZo_.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-
|
|
1
|
+
import{i as Q}from"./chunks/index-IzAvjker.esm.js";import{i as T}from"./chunks/index-RDKeoKqc.esm.js";import{i as X}from"./chunks/index-EHubF2KN.esm.js";import{i as Z}from"./chunks/index-phDmC-TS.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-ad0I3Ayc.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-Y8fYvSqM.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-uF-Qtewb.esm.js";import"./utils/wait-for-element.js";import"./utils/remote-session.js";import"./utils/memoize-last.js";import"./chunks/index-VGoZaoVm.esm.js";import"./chunks/order-page-9B0nZVh1.esm.js";import"./chunks/update-cart-vcujKNky.esm.js";import"./chunks/index-Z1UUeVXR.esm.js";import"./chunks/index-E_HMWZ2A.esm.js";import"./chunks/index-Gz7Q9nUW.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
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{D as u,a as g}from"../chunks/routes-
|
|
1
|
+
import{D as u,a as g}from"../chunks/routes-LFjgVNGB.esm.js";import{S as y}from"../chunks/beam-errors-P-Lu07Ce.esm.js";import{B as h}from"../chunks/events-Y8fYvSqM.esm.js";import{logger as w}from"../utils/logger.esm.js";import{s as f}from"../chunks/index-vpkWmZo_.esm.js";var v=(t,s,a)=>{if(!s.has(t))throw TypeError("Cannot "+a)},c=(t,s,a)=>{if(s.has(t))throw TypeError("Cannot add the same private member more than once");s instanceof WeakSet?s.add(t):s.set(t,a)},i=(t,s,a)=>(v(t,s,"access private method"),a),r,n,o,m;let p,l;const E=new Promise((t,s)=>{p=t,l=s});class U extends EventTarget{constructor(s){super(),c(this,r),c(this,o),this.readyPromise=E,this.plugins={},this.status="pending",i(this,r,n).call(this,s)}async init(s){i(this,r,n).call(this,s);try{await i(this,o,m).call(this,s)}catch(a){const e=new y;throw e.cause=a,this.status="error",this.dispatchEvent(new h({status:"error",error:e})),l(e),w.error(e),this.apiKey&&await f({apiKey:this.apiKey,baseUrl:this.logUrl},{type:"error",code:e.name,metadata:{message:e.message,cause:a?.message}}),a}return this.status="ready",this.dispatchEvent(new h({status:"ready"})),p(!0),this}}r=new WeakSet,n=function(t){this.apiKey=t.apiKey,this.chainId=t.chainId,this.storeId=t.storeId,this.domain=t.domain,this.baseUrl=t.baseUrl||u,this.logUrl=t.logUrl||g},o=new WeakSet,m=async function(t){const s=(t.plugins||[]).map(async a=>(await a.init(t),this.plugins[a.name]=a,a));return Promise.all(s)};const d=new U({}),S=t=>d.init(t),L=()=>d;export{L as getConfig,S as init};
|
|
2
2
|
//# sourceMappingURL=beam.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{D as u,a as g}from"../chunks/routes-
|
|
1
|
+
import{D as u,a as g}from"../chunks/routes-ad0I3Ayc.esm.js";import{S as y}from"../chunks/beam-errors-P-Lu07Ce.esm.js";import{B as h}from"../chunks/events-Y8fYvSqM.esm.js";import{logger as w}from"../utils/logger.js";import{s as f}from"../chunks/index-Gz7Q9nUW.esm.js";var v=(t,s,a)=>{if(!s.has(t))throw TypeError("Cannot "+a)},c=(t,s,a)=>{if(s.has(t))throw TypeError("Cannot add the same private member more than once");s instanceof WeakSet?s.add(t):s.set(t,a)},i=(t,s,a)=>(v(t,s,"access private method"),a),r,n,o,m;let p,l;const E=new Promise((t,s)=>{p=t,l=s});class U extends EventTarget{constructor(s){super(),c(this,r),c(this,o),this.readyPromise=E,this.plugins={},this.status="pending",i(this,r,n).call(this,s)}async init(s){i(this,r,n).call(this,s);try{await i(this,o,m).call(this,s)}catch(a){const e=new y;throw e.cause=a,this.status="error",this.dispatchEvent(new h({status:"error",error:e})),l(e),w.error(e),this.apiKey&&await f({apiKey:this.apiKey,baseUrl:this.logUrl},{type:"error",code:e.name,metadata:{message:e.message,cause:a?.message}}),a}return this.status="ready",this.dispatchEvent(new h({status:"ready"})),p(!0),this}}r=new WeakSet,n=function(t){this.apiKey=t.apiKey,this.chainId=t.chainId,this.storeId=t.storeId,this.domain=t.domain,this.baseUrl=t.baseUrl||u,this.logUrl=t.logUrl||g},o=new WeakSet,m=async function(t){const s=(t.plugins||[]).map(async a=>(await a.init(t),this.plugins[a.name]=a,a));return Promise.all(s)};const d=new U({}),S=t=>d.init(t),L=()=>d;export{L as getConfig,S as init};
|
|
2
2
|
//# sourceMappingURL=beam.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { B as BeamCartAPIConfig, a as BeamCartValues, u as updateCart } from '../chunks/update-cart-
|
|
1
|
+
export { B as BeamCartAPIConfig, a as BeamCartValues, u as updateCart } from '../chunks/update-cart-EKZbvT8c.esm.js';
|
|
2
2
|
import 'lodash';
|
|
3
3
|
import '../chunks/types-aju0qrRe.esm.js';
|
|
4
|
-
import '../chunks/cart-contents-
|
|
5
|
-
import '../chunks/openapi-spec-
|
|
4
|
+
import '../chunks/cart-contents-IOhdr24g.esm.js';
|
|
5
|
+
import '../chunks/openapi-spec-b529HHW3.esm.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{x as C}from"../chunks/update-cart-
|
|
1
|
+
import{x as C}from"../chunks/update-cart-A2hs4tF8.esm.js";import"../chunks/lodash-P8OIs-at.esm.js";import"../chunks/routes-LFjgVNGB.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../utils/logger.esm.js";import"../chunks/events-Y8fYvSqM.esm.js";import"../utils/network-listeners.esm.js";import"../utils/local-storage.esm.js";import"../utils/cookies.esm.js";import"../utils/remote-session.esm.js";import"../utils/memoize-last.esm.js";import"../chunks/cart-contents-h60geKWa.esm.js";export{C as updateCart};
|
|
2
2
|
//# sourceMappingURL=cart.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{x as C}from"../chunks/update-cart-
|
|
1
|
+
import{x as C}from"../chunks/update-cart-vcujKNky.esm.js";import"../chunks/lodash-P8OIs-at.esm.js";import"../chunks/routes-ad0I3Ayc.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../utils/logger.js";import"../chunks/events-Y8fYvSqM.esm.js";import"../utils/network-listeners.js";import"../utils/local-storage.js";import"../utils/cookies.js";import"../utils/remote-session.js";import"../utils/memoize-last.js";import"../chunks/cart-contents-h60geKWa.esm.js";export{C as updateCart};
|
|
2
2
|
//# sourceMappingURL=cart.js.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export { i as Utils } from '../chunks/index-
|
|
2
|
-
export { i as Shopify } from '../chunks/index-
|
|
1
|
+
export { i as Utils } from '../chunks/index-mWnpDGl1.esm.js';
|
|
2
|
+
export { i as Shopify } from '../chunks/index-3F_Wjm5v.esm.js';
|
|
3
3
|
export { i as Session } from '../chunks/index-EGiUuWe-.esm.js';
|
|
4
|
-
export { i as Cart } from '../chunks/index-
|
|
5
|
-
export { i as Logs } from '../chunks/index-
|
|
4
|
+
export { i as Cart } from '../chunks/index-WX8Yyx2u.esm.js';
|
|
5
|
+
export { i as Logs } from '../chunks/index-yXqJ9Znv.esm.js';
|
|
6
6
|
import '../chunks/beam-errors-fXDkG1zo.esm.js';
|
|
7
|
-
import '../chunks/events-
|
|
8
|
-
import '../chunks/cart-contents-
|
|
9
|
-
import '../chunks/openapi-spec-
|
|
7
|
+
import '../chunks/events-j-SJ9Cot.esm.js';
|
|
8
|
+
import '../chunks/cart-contents-IOhdr24g.esm.js';
|
|
9
|
+
import '../chunks/openapi-spec-b529HHW3.esm.js';
|
|
10
10
|
import '../chunks/types-7kSi85Gv.esm.js';
|
|
11
11
|
import '../utils/logger.js';
|
|
12
12
|
import '../utils/network-listeners.js';
|
|
@@ -17,9 +17,9 @@ import '../utils/remote-session.js';
|
|
|
17
17
|
import '../utils/memoize-last.js';
|
|
18
18
|
import 'lodash-es/debounce';
|
|
19
19
|
import 'lodash-es/isEqual';
|
|
20
|
-
import '../chunks/order-page-
|
|
20
|
+
import '../chunks/order-page-jkuLE25f.esm.js';
|
|
21
21
|
import 'lodash';
|
|
22
|
-
import '../chunks/update-cart-
|
|
22
|
+
import '../chunks/update-cart-EKZbvT8c.esm.js';
|
|
23
23
|
import '../chunks/types-aju0qrRe.esm.js';
|
|
24
24
|
import '../components/post-purchase.js';
|
|
25
25
|
import 'lit';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{i as w}from"../chunks/index-
|
|
1
|
+
import{i as w}from"../chunks/index-Lw32NXij.esm.js";import{i as A}from"../chunks/index-JsXH5Lnc.esm.js";import{i as D}from"../chunks/index-9YcaEQju.esm.js";import{i as F}from"../chunks/index-B2oj1JKu.esm.js";import{i as H}from"../chunks/index-vpkWmZo_.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../chunks/events-Y8fYvSqM.esm.js";import"../utils/logger.esm.js";import"../utils/network-listeners.esm.js";import"../utils/local-storage.esm.js";import"../utils/wait-for-element.esm.js";import"../utils/cookies.esm.js";import"../utils/remote-session.esm.js";import"../utils/memoize-last.esm.js";import"../chunks/lodash-P8OIs-at.esm.js";import"../chunks/order-page-yM2h67MI.esm.js";import"../chunks/cart-contents-h60geKWa.esm.js";import"../chunks/update-cart-A2hs4tF8.esm.js";import"../chunks/routes-LFjgVNGB.esm.js";import"../components/post-purchase.esm.js";import"../chunks/lit-yVXn5Cbs.esm.js";import"../chunks/enforce-config-qna7hEL6.esm.js";import"../components/redeem-transaction.esm.js";import"../chunks/progress-bar-7gWYaGlq.esm.js";import"../components/beam-partner-logos.esm.js";import"../chunks/localize-GCkVUD8S.esm.js";import"../chunks/css-card-grid-3b56QBzq.esm.js";import"../components/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";export{F as Cart,H as Logs,D as Session,A as Shopify,w as Utils};
|
|
2
2
|
//# sourceMappingURL=index.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{i as w}from"../chunks/index-
|
|
1
|
+
import{i as w}from"../chunks/index-uF-Qtewb.esm.js";import{i as A}from"../chunks/index-VGoZaoVm.esm.js";import{i as D}from"../chunks/index-Z1UUeVXR.esm.js";import{i as F}from"../chunks/index-E_HMWZ2A.esm.js";import{i as H}from"../chunks/index-Gz7Q9nUW.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../chunks/events-Y8fYvSqM.esm.js";import"../utils/logger.js";import"../utils/network-listeners.js";import"../utils/local-storage.js";import"../utils/wait-for-element.js";import"../utils/cookies.js";import"../utils/remote-session.js";import"../utils/memoize-last.js";import"../chunks/lodash-P8OIs-at.esm.js";import"../chunks/order-page-9B0nZVh1.esm.js";import"../chunks/cart-contents-h60geKWa.esm.js";import"../chunks/update-cart-vcujKNky.esm.js";import"../chunks/routes-ad0I3Ayc.esm.js";import"../components/post-purchase.js";import"../chunks/lit-yVXn5Cbs.esm.js";import"../chunks/enforce-config-fo8kIfoY.esm.js";import"../components/redeem-transaction.js";import"../chunks/progress-bar-7gWYaGlq.esm.js";import"../components/beam-partner-logos.js";import"../chunks/localize-pzAAkBvG.esm.js";import"../chunks/css-card-grid-3b56QBzq.esm.js";import"../components/impact-overview.js";import"../chunks/vendor-eeJfrOkP.esm.js";import"../chunks/is-all-html-elements-SdSkxirh.esm.js";import"../chunks/responsive-LYEag6TI.esm.js";export{F as Cart,H as Logs,D as Session,A as Shopify,w as Utils};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import '../chunks/openapi-spec-
|
|
2
|
-
export { s as sendLog } from '../chunks/index-
|
|
1
|
+
import '../chunks/openapi-spec-b529HHW3.esm.js';
|
|
2
|
+
export { s as sendLog } from '../chunks/index-yXqJ9Znv.esm.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../chunks/routes-
|
|
1
|
+
import"../chunks/routes-LFjgVNGB.esm.js";import"../utils/logger.esm.js";import{s as i}from"../chunks/index-vpkWmZo_.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";export{i as sendLog};
|
|
2
2
|
//# sourceMappingURL=logs.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../chunks/routes-
|
|
1
|
+
import"../chunks/routes-ad0I3Ayc.esm.js";import"../utils/logger.js";import{s as i}from"../chunks/index-Gz7Q9nUW.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";export{i as sendLog};
|
|
2
2
|
//# sourceMappingURL=logs.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { T as TBeamOrderPageParams, a as addBeamAttributesToCart, g as getCurrentCart, r as registerCartIntegration, s as showBeamOrderPageWidgets, t as trackCart } from '../chunks/order-page-
|
|
1
|
+
export { T as TBeamOrderPageParams, a as addBeamAttributesToCart, g as getCurrentCart, r as registerCartIntegration, s as showBeamOrderPageWidgets, t as trackCart } from '../chunks/order-page-jkuLE25f.esm.js';
|
|
2
2
|
import 'lodash';
|
|
3
|
-
import '../chunks/update-cart-
|
|
3
|
+
import '../chunks/update-cart-EKZbvT8c.esm.js';
|
|
4
4
|
import '../chunks/types-aju0qrRe.esm.js';
|
|
5
|
-
import '../chunks/cart-contents-
|
|
6
|
-
import '../chunks/openapi-spec-
|
|
5
|
+
import '../chunks/cart-contents-IOhdr24g.esm.js';
|
|
6
|
+
import '../chunks/openapi-spec-b529HHW3.esm.js';
|
|
7
7
|
import '../components/post-purchase.js';
|
|
8
8
|
import 'lit';
|
|
9
9
|
import 'lit-html';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{f as T,p as W,P as j,s as l,R as q}from"../chunks/order-page-yM2h67MI.esm.js";import"../chunks/lodash-P8OIs-at.esm.js";import"../chunks/events-Y8fYvSqM.esm.js";import"../utils/logger.esm.js";import"../utils/network-listeners.esm.js";import"../utils/local-storage.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../utils/cookies.esm.js";import"../utils/memoize-last.esm.js";import"../chunks/cart-contents-h60geKWa.esm.js";import"../chunks/update-cart-A2hs4tF8.esm.js";import"../chunks/routes-LFjgVNGB.esm.js";import"../utils/remote-session.esm.js";import"../components/post-purchase.esm.js";import"../chunks/lit-yVXn5Cbs.esm.js";import"../chunks/enforce-config-qna7hEL6.esm.js";import"../components/redeem-transaction.esm.js";import"../chunks/progress-bar-7gWYaGlq.esm.js";import"../components/beam-partner-logos.esm.js";import"../chunks/localize-GCkVUD8S.esm.js";import"../chunks/css-card-grid-3b56QBzq.esm.js";import"../components/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";import"../utils/wait-for-element.esm.js";export{T as addBeamAttributesToCart,W as getCurrentCart,j as registerCartIntegration,l as showBeamOrderPageWidgets,q as trackCart};
|
|
2
2
|
//# sourceMappingURL=shopify.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{f as T,p as W,P as j,s as l,R as q}from"../chunks/order-page-9B0nZVh1.esm.js";import"../chunks/lodash-P8OIs-at.esm.js";import"../chunks/events-Y8fYvSqM.esm.js";import"../utils/logger.js";import"../utils/network-listeners.js";import"../utils/local-storage.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../utils/cookies.js";import"../utils/memoize-last.js";import"../chunks/cart-contents-h60geKWa.esm.js";import"../chunks/update-cart-vcujKNky.esm.js";import"../chunks/routes-ad0I3Ayc.esm.js";import"../utils/remote-session.js";import"../components/post-purchase.js";import"../chunks/lit-yVXn5Cbs.esm.js";import"../chunks/enforce-config-fo8kIfoY.esm.js";import"../components/redeem-transaction.js";import"../chunks/progress-bar-7gWYaGlq.esm.js";import"../components/beam-partner-logos.js";import"../chunks/localize-pzAAkBvG.esm.js";import"../chunks/css-card-grid-3b56QBzq.esm.js";import"../components/impact-overview.js";import"../chunks/vendor-eeJfrOkP.esm.js";import"../chunks/is-all-html-elements-SdSkxirh.esm.js";import"../chunks/responsive-LYEag6TI.esm.js";import"../utils/wait-for-element.js";export{T as addBeamAttributesToCart,W as getCurrentCart,j as registerCartIntegration,l as showBeamOrderPageWidgets,q as trackCart};
|
|
2
2
|
//# sourceMappingURL=shopify.js.map
|