@beamimpact/web-sdk 1.58.1 → 1.58.3
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/dist/chunks/{_share-dialog-dependencies-DPid-O65.esm.js → _share-dialog-dependencies-92ZYF2h0.esm.js} +2 -2
- package/dist/chunks/{_share-dialog-dependencies-DPid-O65.esm.js.map → _share-dialog-dependencies-92ZYF2h0.esm.js.map} +1 -1
- package/dist/chunks/{index-CsNyA6Px.esm.js → index-BMRRnPOO.esm.js} +2 -2
- package/dist/chunks/{index-CsNyA6Px.esm.js.map → index-BMRRnPOO.esm.js.map} +1 -1
- package/dist/chunks/{index-lSPlMuMz.esm.js → index-BN0CMrZb.esm.js} +2 -2
- package/dist/chunks/{index-lSPlMuMz.esm.js.map → index-BN0CMrZb.esm.js.map} +1 -1
- package/dist/chunks/{index-BiOlmhqL.esm.js → index-CCeRUzcY.esm.js} +2 -2
- package/dist/chunks/{index-BiOlmhqL.esm.js.map → index-CCeRUzcY.esm.js.map} +1 -1
- package/dist/chunks/{index-BygeMtqf.esm.js → index-CJHnWESF.esm.js} +2 -2
- package/dist/chunks/{index-BygeMtqf.esm.js.map → index-CJHnWESF.esm.js.map} +1 -1
- package/dist/chunks/{index-U1QpwjdF.esm.js → index-DTyLbt9G.esm.js} +2 -2
- package/dist/chunks/{index-U1QpwjdF.esm.js.map → index-DTyLbt9G.esm.js.map} +1 -1
- package/dist/chunks/{index-C8pScO8d.esm.js → index-DmjV4fgN.esm.js} +2 -2
- package/dist/chunks/{index-C8pScO8d.esm.js.map → index-DmjV4fgN.esm.js.map} +1 -1
- package/dist/chunks/{index-tkscjKkq.esm.js → index-Sf0H3S19.esm.js} +2 -2
- package/dist/chunks/{index-tkscjKkq.esm.js.map → index-Sf0H3S19.esm.js.map} +1 -1
- package/dist/chunks/{index-DnFFgYbT.esm.js → index-V9dChqUp.esm.js} +2 -2
- package/dist/chunks/{index-DnFFgYbT.esm.js.map → index-V9dChqUp.esm.js.map} +1 -1
- package/dist/chunks/{promo-pill-label-DYR3PZH7.esm.js → promo-pill-label-RMzmFdBU.esm.js} +2 -2
- package/dist/chunks/{promo-pill-label-DYR3PZH7.esm.js.map → promo-pill-label-RMzmFdBU.esm.js.map} +1 -1
- package/dist/chunks/{share-button-CqrSfHAr.esm.js → share-button-B1UbCVJc.esm.js} +8 -6
- package/dist/chunks/{share-button-CqrSfHAr.esm.js.map → share-button-B1UbCVJc.esm.js.map} +1 -1
- package/dist/chunks/{share-button-DP2wLhmP.esm.js → share-button-BL75HPEy.esm.js} +2 -2
- package/dist/chunks/{share-button-DP2wLhmP.esm.js.map → share-button-BL75HPEy.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 +9 -14
- package/dist/components/cumulative-impact.esm.js.map +1 -1
- package/dist/components/cumulative-impact.js +9 -14
- package/dist/components/cumulative-impact.js.map +1 -1
- package/dist/components/impact-overview.esm.js +1 -1
- package/dist/components/impact-overview.js +1 -1
- package/dist/components/index.esm.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/post-purchase.esm.js +1 -1
- package/dist/components/post-purchase.js +1 -1
- package/dist/components/product-details-page.esm.js +1 -1
- package/dist/components/product-details-page.js +1 -1
- package/dist/components/redeem-transaction.esm.js +1 -1
- package/dist/components/redeem-transaction.js +1 -1
- package/dist/components/select-nonprofit.esm.js +1 -1
- package/dist/components/select-nonprofit.js +1 -1
- package/dist/components/select-subscription-nonprofit.esm.js +5 -4
- package/dist/components/select-subscription-nonprofit.esm.js.map +1 -1
- package/dist/components/select-subscription-nonprofit.js +5 -4
- package/dist/components/select-subscription-nonprofit.js.map +1 -1
- package/dist/components/shopify.esm.js +1 -1
- package/dist/components/shopify.js +1 -1
- package/dist/components/social-share.esm.js +1 -1
- package/dist/components/social-share.js +1 -1
- package/dist/components/subscriber-select-nonprofit.esm.js +1 -1
- package/dist/components/subscriber-select-nonprofit.js +1 -1
- package/dist/components/subscription-impact.d.ts +1 -0
- package/dist/components/subscription-impact.esm.js +18 -17
- package/dist/components/subscription-impact.esm.js.map +1 -1
- package/dist/components/subscription-impact.js +18 -17
- package/dist/components/subscription-impact.js.map +1 -1
- package/dist/components/subscription-management.d.ts +2 -0
- package/dist/components/subscription-management.esm.js +20 -17
- package/dist/components/subscription-management.esm.js.map +1 -1
- package/dist/components/subscription-management.js +20 -17
- package/dist/components/subscription-management.js.map +1 -1
- 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.esm.js +1 -1
- package/dist/integrations/cart.js +1 -1
- package/dist/integrations/logs.esm.js +1 -1
- package/dist/integrations/logs.js +1 -1
- package/dist/integrations/shopify-order.esm.js +1 -1
- package/dist/integrations/shopify-order.js +1 -1
- package/dist/integrations/shopify.esm.js +1 -1
- package/dist/integrations/shopify.js +1 -1
- package/dist/integrations/statsig.esm.js +14 -14
- package/dist/integrations/statsig.esm.js.map +1 -1
- package/dist/integrations/statsig.js +14 -14
- package/dist/integrations/statsig.js.map +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.esm.js +1 -1
- package/dist/react/index.js +1 -1
- package/dist/react/post-purchase.esm.js +1 -1
- package/dist/react/post-purchase.js +1 -1
- package/dist/react/product-details-page.esm.js +1 -1
- package/dist/react/product-details-page.js +1 -1
- package/dist/react/redeem-transaction.esm.js +1 -1
- package/dist/react/redeem-transaction.js +1 -1
- package/dist/react/select-nonprofit.esm.js +1 -1
- package/dist/react/select-nonprofit.js +1 -1
- package/dist/react/select-subscription-nonprofit.esm.js +1 -1
- package/dist/react/select-subscription-nonprofit.js +1 -1
- package/dist/react/social-share.esm.js +1 -1
- package/dist/react/social-share.js +1 -1
- package/dist/react/subscriber-select-nonprofit.esm.js +1 -1
- package/dist/react/subscriber-select-nonprofit.js +1 -1
- package/dist/react/subscription-impact.esm.js +1 -1
- package/dist/react/subscription-impact.js +1 -1
- package/dist/react/subscription-management.esm.js +1 -1
- package/dist/react/subscription-management.js +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select-subscription-nonprofit.js","sources":["../../src/shared/fragments/checkbox.ts","../../src/components/select-subscription-nonprofit/strings.ts","../../src/components/select-subscription-nonprofit/index.ts"],"sourcesContent":["import { html } from \"lit\";\nimport { styleMap } from \"lit/directives/style-map.js\";\n\nexport const _checkbox = ({ height = \"1em\", width = \"1em\" } = {}) => html`\n <svg\n style=\"${styleMap({ height, width, position: \"relative\", bottom: \"0\" })}\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 78.369 78.369\"\n >\n <g>\n <path\n d=\"M78.049,19.015L29.458,67.606c-0.428,0.428-1.121,0.428-1.548,0L0.32,40.015c-0.427-0.426-0.427-1.119,0-1.547l6.704-6.704\n c0.428-0.427,1.121-0.427,1.548,0l20.113,20.112l41.113-41.113c0.429-0.427,1.12-0.427,1.548,0l6.703,6.704\n C78.477,17.894,78.477,18.586,78.049,19.015z\"\n style=\"fill: currentColor\"\n />\n </g>\n </svg>\n`;\n","export const strings = {\n en: {\n ctaTitle: () => `Choose Your Impact`,\n ctaMessagePrefix: () => ` at no extra cost, with every order of your subscription.`,\n ctaMessage: ({ donationPercentage = \"1%\" } = {}) =>\n `Choose a nonprofit and ${donationPercentage} will be donated there for you,`,\n submitButtonText: () => `Confirm`,\n submitButtonTextCompleted: () => `Confirmed!`,\n chooseButtonText: () => `Choose`,\n },\n fr: {\n ctaTitle: () => `Choisissez votre impact`,\n ctaMessagePrefix: () => ` sans frais supplémentaires, à chaque commande de votre abonnement.`,\n ctaMessage: ({ donationPercentage = \"1%\" } = {}) =>\n `Choisissez une association et ${donationPercentage} sera reversé en votre nom,`,\n submitButtonText: () => `Confirmer`,\n submitButtonTextCompleted: () => `Confirmé !`,\n chooseButtonText: () => `Choisir`,\n },\n de: {\n ctaTitle: () => `Wähle deinen Impact`,\n ctaMessagePrefix: () => ` ohne zusätzliche Kosten, bei jeder Bestellung deines Abonnements.`,\n ctaMessage: ({ donationPercentage = \"1%\" } = {}) =>\n `Wähle eine gemeinnützige Organisation und ${donationPercentage} werden in deinem Namen gespendet,`,\n submitButtonText: () => `Bestätigen`,\n submitButtonTextCompleted: () => `Bestätigt!`,\n chooseButtonText: () => `Wählen`,\n },\n es: {\n ctaTitle: () => `Elige tu impacto`,\n ctaMessagePrefix: () => ` sin coste adicional, con cada pedido de tu suscripción.`,\n ctaMessage: ({ donationPercentage = \"1%\" } = {}) =>\n `Elige una organización sin ánimo de lucro y donaremos ${donationPercentage} en tu nombre,`,\n submitButtonText: () => `Confirmar`,\n submitButtonTextCompleted: () => `¡Confirmado!`,\n chooseButtonText: () => `Elegir`,\n },\n it: {\n ctaTitle: () => `Scegli il tuo impatto`,\n ctaMessagePrefix: () => ` senza costi aggiuntivi, a ogni ordine del tuo abbonamento.`,\n ctaMessage: ({ donationPercentage = \"1%\" } = {}) =>\n `Seleziona un'organizzazione no-profit e l’${donationPercentage} sarà donato a tuo nome,`,\n submitButtonText: () => `Confermare`,\n submitButtonTextCompleted: () => `Confermato!`,\n chooseButtonText: () => `Scegli`,\n },\n pl: {\n ctaTitle: () => `Wybierz swój wpływ`,\n ctaMessagePrefix: () => ` bez żadnych dodatkowych kosztów, przy każdym zamówieniu w ramach subskrypcji.`,\n ctaMessage: ({ donationPercentage = \"1%\" } = {}) =>\n `Wybierz organizację non-profit, a ${donationPercentage} zostanie przekazane w Twoim imieniu,`,\n submitButtonText: () => `Zatwierdź`,\n submitButtonTextCompleted: () => `Zatwierdzono!`,\n chooseButtonText: () => `Wybierz`,\n },\n ja: {\n ctaTitle: () => `寄付先をお選びください。`,\n ctaMessagePrefix: () => `追加費用なしで、ご購入ごとに、`,\n ctaMessage: ({ donationPercentage = \"1%\" } = {}) =>\n `非営利団体を選ぶと、${donationPercentage}がその団体に寄付されます、`,\n submitButtonText: () => `確認する`,\n submitButtonTextCompleted: () => `確認済み`,\n chooseButtonText: () => `選択してください`,\n },\n};\n","import { css, html, LitElement, PropertyValues } from \"lit\";\nimport { property } from \"lit/decorators/property.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { unsafeHTML } from \"lit/directives/unsafe-html.js\";\nimport { repeat } from \"lit/directives/repeat.js\";\nimport { state } from \"lit/decorators/state.js\";\nimport debounce from \"lodash-es/debounce\";\nimport { postChainEligibleNonprofitsForCart, updateSubscription } from \"../../api-sdk/v3/routes\";\nimport { defineCustomText, useCustomText } from \"../../shared/fragments/custom-text\";\nimport { progressBarConfigDefaults } from \"../../shared/components/progress-bar\";\nimport { AsyncController } from \"../../shared/controllers/async-controller\";\nimport {\n DEFAULT_BASE_URL,\n LOCAL_STORAGE_KEYS,\n SELECTION_METHODS,\n SUPPORTED_LANGUAGES,\n WIDGET_NAMES,\n} from \"../../api-sdk/constants\";\nimport { defineCustomElement } from \"../../shared/defineCustomElement\";\nimport { _loading } from \"../../shared/fragments/loading-template\";\nimport { _errorMessage } from \"../../shared/fragments/error-message-template\";\nimport { cssReset } from \"../../shared/css-reset\";\nimport { makeApiKeyHeader } from \"../../utils/makeApiKeyHeader\";\nimport { _cssVariableMap } from \"../../shared/fragments/css-variable-map\";\nimport { BeamError, MissingConfig } from \"../../utils/beam-errors\";\nimport { createScopedLocalStorage } from \"../../utils/local-storage\";\nimport { cssCardGrid } from \"../../shared/fragments/css-card-grid\";\nimport { _checkbox } from \"../../shared/fragments/checkbox\";\nimport { BeamNonprofitSelectEvent } from \"../../utils/events\";\nimport { localizeUserString } from \"../../shared/localize\";\nimport { TNumericId } from \"../../shared/types\";\nimport { LANGUAGES } from \"../../api-sdk/types\";\nimport { enforceConfig } from \"../../shared/enforce-config\";\nimport { strings } from \"./strings\";\nimport \"../beam-partner-logos\";\n\ninterface SubscriptionRequiredConfig {\n apiKey: string;\n subscriptionId: string;\n storeId: TNumericId;\n}\nconst cacheTtl = 2 * 60 * 60 * 1000;\nexport class BeamSelectSubscriptionNonprofit extends LitElement {\n static tagName = \"beam-select-subscription-nonprofit\";\n\n @property({ type: String }) public baseUrl: string = DEFAULT_BASE_URL;\n @property({ type: String }) public apiKey?: SubscriptionRequiredConfig[\"apiKey\"];\n @property({ type: String }) public subscriptionId?: SubscriptionRequiredConfig[\"subscriptionId\"];\n @property({ type: Number }) public storeId?: SubscriptionRequiredConfig[\"storeId\"];\n @property({ type: String }) public countryCode?: string;\n @property({ type: String }) public postalCode?: string;\n @property({ type: Number, reflect: true }) public selectedNonprofitId?: TNumericId;\n @property({ type: String }) public lang: LANGUAGES = \"en\";\n @property({ type: Boolean }) public draftConfig = false;\n @property({ type: Boolean }) public debug = false;\n @state() private isMobile = window.innerWidth < 768;\n\n get configLang() {\n return SUPPORTED_LANGUAGES[this.lang] || \"en\";\n }\n\n private getChainNonprofits = async () => {\n if (!enforceConfig<SubscriptionRequiredConfig>([\"apiKey\", \"subscriptionId\", \"storeId\"], this)) {\n throw new MissingConfig();\n }\n const res = await postChainEligibleNonprofitsForCart({\n baseUrl: this.baseUrl,\n headers: makeApiKeyHeader(this.apiKey),\n requestBody: {\n storeId: this.storeId,\n ...(this.postalCode && { postalCode: this.postalCode }),\n ...(this.countryCode && { countryCode: this.countryCode }),\n widgetName: \"select-subscription-nonprofit\",\n version: \"1.0.0\",\n lang: this.configLang,\n options: {\n config: {\n draftConfig: this.draftConfig,\n },\n },\n },\n });\n\n this.localStorage.setItemJson(LOCAL_STORAGE_KEYS.CHAIN_NONPROFITS, {\n createdAt: new Date(),\n data: res,\n });\n\n return res;\n };\n\n private updateNonprofitIdForSubscription = async ({ selectedNonprofitId }: { selectedNonprofitId: TNumericId }) => {\n if (!this.subscriptionId) {\n return null;\n }\n\n if (!enforceConfig<SubscriptionRequiredConfig>([\"apiKey\", \"subscriptionId\"], this)) {\n throw new MissingConfig();\n }\n\n return updateSubscription({\n baseUrl: this.baseUrl,\n headers: makeApiKeyHeader(this.apiKey),\n requestBody: {\n remoteSubscriptionId: this.subscriptionId,\n nonprofitId: selectedNonprofitId,\n selectionMethod: SELECTION_METHODS.subscription_management_widget,\n },\n });\n };\n\n private nonprofitListDataController = new AsyncController<typeof this.getChainNonprofits>(\n this,\n this.getChainNonprofits,\n );\n\n private subscriptionUpdateDataController = new AsyncController<typeof this.updateNonprofitIdForSubscription>(\n this,\n this.updateNonprofitIdForSubscription,\n );\n\n private localStorage = createScopedLocalStorage(this as LitElement & SubscriptionRequiredConfig);\n\n connectedCallback() {\n super.connectedCallback();\n window.addEventListener(\"resize\", this.evaluateBreakPoints);\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\", \"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 super.disconnectedCallback();\n }\n\n private restoreStateFromCache() {\n if (!enforceConfig<SubscriptionRequiredConfig>([\"apiKey\"], this)) throw new MissingConfig();\n\n try {\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 }>(LOCAL_STORAGE_KEYS.CHAIN_NONPROFITS) || {};\n if (new Date(createdAt).valueOf() + cacheTtl > new Date().valueOf()) {\n this.nonprofitListDataController.data = data;\n this.nonprofitListDataController.loading = false;\n }\n } catch (err) {\n // ignore cache retrieval error and continue to fetch data\n }\n }\n\n /**\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 } }[]): ((event: Event) => void) =>\n async (event: Event) => {\n if (!this.allowChange) return;\n\n const currentId = this.selectedNonprofitId;\n if (event instanceof KeyboardEvent) {\n let nextFocus = null;\n switch (event.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 event.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 event.preventDefault();\n break;\n case \"Enter\":\n case \" \":\n event.preventDefault();\n break; // continue to toggle-selection block below\n default:\n return;\n }\n if (nextFocus) {\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 = event.currentTarget;\n if (targetEl instanceof HTMLElement) {\n if (currentId === id) {\n // this[\"selected-nonprofit-id\"] = undefined; // unset (not supported)\n return; // no API call or localStorage change needed\n } else {\n this.selectedNonprofitId = id;\n }\n }\n };\n\n get allowChange() {\n // Disallow change if already submitted\n return this.subscriptionUpdateDataController.data == null && !this.subscriptionUpdateDataController.loading;\n }\n\n get allowSubmit() {\n // Disabled if no nonprofit has been selected yet or if submission was already received\n return Boolean(this.selectedNonprofitId && this.allowChange);\n }\n\n handleSubmit = async () => {\n const { selectedNonprofitId } = this;\n if (!this.allowSubmit || selectedNonprofitId == null) return;\n await this.subscriptionUpdateDataController.exec({ selectedNonprofitId });\n\n const selectedNonprofit = this.nonprofitListDataController?.data?.nonprofits.find(\n (np) => np.nonprofit.id === selectedNonprofitId,\n );\n\n this.dispatchEvent(\n new BeamNonprofitSelectEvent({\n selectedNonprofitId,\n nonprofitName: selectedNonprofit?.nonprofit.name,\n source: WIDGET_NAMES.select_subscription_nonprofit,\n timestamp: new Date(),\n }),\n );\n };\n\n evaluateBreakPoints = debounce(\n () => {\n this.isMobile = window.innerWidth < 768;\n },\n 50,\n { maxWait: 50, leading: true },\n );\n\n public get cssVariables() {\n const defaults = {\n ...progressBarConfigDefaults,\n \"--beam-fontFamily\": \"inherit\",\n \"--beam-fontStyle\": \"inherit\",\n \"--beam-fontSize\": \"inherit\",\n \"--beam-textColor\": \"inherit\",\n \"--beam-backgroundColor\": \"inherit\",\n \"--beam-SelectSubscriptionNonprofit-maxWidth\": \"800px\",\n \"--beam-SelectSubscriptionNonprofit-mobile-header-alignItems\": \"center\",\n \"--beam-SelectSubscriptionNonprofit-desktop-header-alignItems\": \"center\",\n \"--beam-SelectSubscriptionNonprofit-headerContainer-padding\": \"2px\",\n \"--beam-SelectSubscriptionNonprofit-title-textAlign\": \"inherit\",\n \"--beam-SelectSubscriptionNonprofit-description-textAlign\": \"center\",\n \"--beam-SelectSubscriptionNonprofit-description-lineHeight\": \"138%\",\n \"--beam-SelectSubscriptionNonprofit-description-marginTop\": \"3px\",\n \"--beam-SelectSubscriptionNonprofit-desktop-description-width\": \"80%\",\n \"--beam-SelectSubscriptionNonprofit-mobile-description-width\": \"90%\",\n \"--beam-SelectSubscriptionNonprofit-options-marginTop\": \"10px\",\n \"--beam-SelectSubscriptionNonprofit-options-padding\": \"10px\",\n \"--beam-SelectSubscriptionNonprofit-options-borderWidth\": \"1px\",\n \"--beam-SelectSubscriptionNonprofit-options-borderColor\": \"transparent\",\n \"--beam-SelectSubscriptionNonprofit-options-borderRadius\": \"8px\",\n \"--beam-SelectSubscriptionNonprofit-options-backgroundColor\": \"#F9FBFB\",\n \"--beam-SelectSubscriptionNonprofit-option-padding\": \"15px\",\n \"--beam-SelectSubscriptionNonprofit-options-hover-backgroundColor\": \"#e1f1ee\",\n \"--beam-SelectSubscriptionNonprofit-options-hover-borderWidth\": \"1px\",\n \"--beam-SelectSubscriptionNonprofit-options-hover-borderColor\": \"#e1f1ee\",\n \"--beam-SelectSubscriptionNonprofit-options-selected-borderWidth\": \"1px\",\n \"--beam-SelectSubscriptionNonprofit-options-selected-borderColor\": \"#e1f1ee\",\n \"--beam-SelectSubscriptionNonprofit-options-selected-backgroundColor\": \"#e1f1ee\",\n \"--beam-SelectSubscriptionNonprofit-options-gap\": \"20px\",\n \"--beam-SelectSubscriptionNonprofit-options-minWidth\": \"250px\",\n \"--beam-SelectSubscriptionNonprofit-options-columnCount\": \"2\",\n \"--beam-SelectSubscriptionNonprofit-options-icon-borderRadius\": \"4px\",\n \"--beam-SelectSubscriptionNonprofit-options-icon-padding\": \"10px\",\n \"--beam-SelectSubscriptionNonprofit-options-image-borderRadius\": \"4px\",\n \"--beam-SelectSubscriptionNonprofit-cardIconContainer-height\": \"100%\",\n \"--beam-SelectSubscriptionNonprofit-iconBackground-width\": \"50px\",\n \"--beam-SelectSubscriptionNonprofit-iconBackground-height\": \"50px\",\n \"--beam-SelectSubscriptionNonprofit-iconBackground-borderRadius\": \"50%\",\n \"--beam-SelectSubscriptionNonprofit-iconBackground-background\": \"#0a323c\",\n \"--beam-SelectSubscriptionNonprofit-icon-height\": \"50px\",\n \"--beam-SelectSubscriptionNonprofit-checkmark-backgroundColor\": \"transparent\",\n \"--beam-SelectSubscriptionNonprofit-checkmark-color\": \"transparent\",\n \"--beam-SelectSubscriptionNonprofit-checkmark-borderColor\": \"#0A323C\",\n \"--beam-SelectSubscriptionNonprofit-checkmark-selected-color\": \"#fff\",\n \"--beam-SelectSubscriptionNonprofit-checkmark-selected-backgroundColor\": \"#0A323C\",\n \"--beam-SelectSubscriptionNonprofit-checkmark-selected-borderColor\": \"#0A323C\",\n \"--beam-SelectSubscriptionNonprofit-checkmark-hover-color\": \"#fff\",\n \"--beam-SelectSubscriptionNonprofit-checkmark-hover-backgroundColor\": \"#0A323C\",\n \"--beam-SelectSubscriptionNonprofit-checkmark-hover-borderColor\": \"#0A323C\",\n \"--beam-SelectSubscriptionNonprofit-cardStyle\": \"'selected_icon'\",\n \"--beam-SelectSubscriptionNonprofit-submitButton-color\": \"#fff\",\n \"--beam-SelectSubscriptionNonprofit-submitButton-hover-color\": \"#fff\",\n \"--beam-SelectSubscriptionNonprofit-submitButton-disabled-color\": \"#fff\",\n \"--beam-SelectSubscriptionNonprofit-submitButton-backgroundColor\": \"#0A323C\",\n \"--beam-SelectSubscriptionNonprofit-submitButton-hover-backgroundColor\": \"#222\",\n \"--beam-SelectSubscriptionNonprofit-submitButton-disabled-backgroundColor\": \"#767676\",\n \"--beam-SelectSubscriptionNonprofit-submitButton-borderColor\": \"#333\",\n \"--beam-SelectSubscriptionNonprofit-submitButton-hover-borderColor\": \"#222\",\n \"--beam-SelectSubscriptionNonprofit-submitButton-disabled-borderColor\": \"#767676\",\n \"--beam-SelectSubscriptionNonprofit-submitButton-fontSize\": \"14px\",\n \"--beam-SelectSubscriptionNonprofit-submitButton-fontWeight\": \"inherit\",\n \"--beam-SelectSubscriptionNonprofit-submitButton-fontFamily\": \"inherit\",\n \"--beam-SelectSubscriptionNonprofit-submitButton-textTransform\": \"none\",\n \"--beam-SelectSubscriptionNonprofit-submitButton-borderRadius\": \"30px\",\n \"--beam-SelectSubscriptionNonprofit-submitButton-padding\": \"10px 30px\",\n ...defineCustomText(\"--beam-SelectSubscriptionNonprofit-title\", {\n fontSize: \"20px\",\n fontWeight: \"bold\",\n lineHeight: \"120%\",\n textTransform: \"capitalize\",\n color: \"#0a323c\",\n }),\n ...defineCustomText(\"--beam-SelectSubscriptionNonprofit-descriptionPrefix\", {\n marginTop: \"3px\",\n color: \"#2f302d\",\n fontSize: \"14px\",\n fontWeight: \"bold\",\n fontStyle: \"normal\",\n lineHeight: \"138%\",\n }),\n ...defineCustomText(\"--beam-SelectSubscriptionNonprofit-description\", {\n color: \"#2f302d\",\n fontSize: \"14px\",\n fontStyle: \"normal\",\n }),\n \"--beam-SelectSubscriptionNonprofit-details-cause-letterSpacing\": \"0.36px\",\n ...defineCustomText(\"--beam-SelectSubscriptionNonprofit-details-cause\", {\n fontSize: \"12px\",\n fontWeight: \"bold\",\n color: \"#0a323c\",\n fontStyle: \"normal\",\n lineHeight: \"120%\",\n }),\n ...defineCustomText(\"--beam-SelectSubscriptionNonprofit-details-description\", {\n fontSize: \"12px\",\n marginTop: \"5px\",\n fontStyle: \"normal\",\n lineHeight: \"140%\",\n fontWeight: \"400\",\n }),\n \"--beam-SelectSubscriptionNonprofit-details-fundingProgress-marginTop\": \"7px\",\n ...defineCustomText(\"--beam-SelectSubscriptionNonprofit-details-funding-progress-label\", {\n fontSize: \"12px\",\n color: \"#666666\",\n fontWeight: \"400\",\n fontStyle: \"normal\",\n }),\n \"--beam-SelectSubscriptionNonprofit-stickyFooter-boxShadow\": \"0px -20px 20px 0px rgba(0, 0, 0, 0.04)\",\n \"--beam-SelectSubscriptionNonprofit-stickyFooter-padding\": \"15px 0px 45px\",\n \"--beam-SelectSubscriptionNonprofit-stickyFooter-backgroundColor\": \"white\",\n \"--beam-SelectSubscriptionNonprofit-stickyFooter-marginLeft\": \"-15px\",\n \"--beam-SelectSubscriptionNonprofit-stickyFooter-marginRight\": \"-15px\",\n \"--beam-SelectSubscriptionNonprofit-stickyFooter-width\": \"auto\",\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 css`\n :host {\n display: block;\n max-width: var(--beam-SelectSubscriptionNonprofit-maxWidth);\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 .widget-container-mobile {\n position: relative;\n }\n\n .header-container {\n align-items: flex-start;\n justify-content: space-between;\n padding: var(--beam-SelectSubscriptionNonprofit-headerContainer-padding);\n display: flex;\n flex-direction: column;\n gap: 8px;\n }\n\n .header-container-mobile {\n align-items: var(--beam-SelectSubscriptionNonprofit-mobile-header-alignItems);\n }\n\n .header-container-desktop {\n align-items: var(--beam-SelectSubscriptionNonprofit-desktop-header-alignItems);\n }\n\n .title {\n text-align: var(--beam-SelectSubscriptionNonprofit-title-textAlign);\n ${useCustomText(\"--beam-SelectSubscriptionNonprofit-title\")};\n }\n\n .description-container {\n text-align: var(--beam-SelectSubscriptionNonprofit-description-textAlign);\n line-height: var(--beam-SelectSubscriptionNonprofit-description-lineHeight);\n margin-top: var(--beam-SelectSubscriptionNonprofit-description-marginTop);\n }\n\n .description-prefix {\n ${useCustomText(\"--beam-SelectSubscriptionNonprofit-descriptionPrefix\")};\n }\n\n .description {\n ${useCustomText(\"--beam-SelectSubscriptionNonprofit-description\")};\n }\n\n .description-desktop {\n width: var(--beam-SelectSubscriptionNonprofit-desktop-description-width);\n }\n\n .description-mobile {\n width: var(--beam-SelectSubscriptionNonprofit-mobile-description-width);\n }\n\n .root {\n display: flex;\n flex-direction: column;\n gap: 12px;\n flex-shrink: 0;\n }\n\n .options {\n margin-top: var(--beam-SelectSubscriptionNonprofit-options-marginTop);\n padding: var(--beam-SelectSubscriptionNonprofit-options-padding);\n }\n\n .card-icon-container {\n height: var(--beam-SelectSubscriptionNonprofit-cardIconContainer-height);\n flex: 0;\n flex-direction: column;\n }\n\n .icon-background {\n width: var(--beam-SelectSubscriptionNonprofit-iconBackground-width);\n height: var(--beam-SelectSubscriptionNonprofit-iconBackground-height);\n border-radius: var(--beam-SelectSubscriptionNonprofit-iconBackground-borderRadius);\n overflow: hidden;\n background: var(--beam-SelectSubscriptionNonprofit-iconBackground-background);\n display: flex;\n justify-content: center;\n align-items: center;\n }\n\n .card-icon {\n height: var(--beam-SelectSubscriptionNonprofit-icon-height);\n display: block;\n padding: var(--beam-SelectSubscriptionNonprofit-options-icon-padding);\n border-radius: var(--beam-SelectSubscriptionNonprofit-options-icon-borderRadius);\n }\n\n .card-image-container {\n height: 100%;\n flex: 4;\n display: flex;\n flex-direction: column;\n }\n\n .card-image {\n flex: 1;\n height: auto;\n width: 100%;\n object-fit: cover;\n border-radius: var(--beam-SelectSubscriptionNonprofit-options-image-borderRadius);\n }\n\n .option {\n /* outline is used to prevent layer shift if changing border width */\n outline: var(--beam-SelectSubscriptionNonprofit-options-borderWidth) solid\n var(--beam-SelectSubscriptionNonprofit-options-borderColor);\n border-radius: var(--beam-SelectSubscriptionNonprofit-options-borderRadius);\n background-color: var(--beam-SelectSubscriptionNonprofit-options-backgroundColor);\n cursor: pointer;\n transition:\n border-color 0.2s,\n background-color 0.2s,\n outline 0.2s;\n display: flex;\n gap: 15px;\n padding: var(--beam-SelectSubscriptionNonprofit-option-padding);\n }\n\n .options.cardGrid {\n order: 3;\n }\n\n .option:not(.isDisabled):focus-visible,\n .option:not(.isDisabled):hover,\n .option:not(.isSelected):focus-visible,\n .option:not(.isSelected):hover {\n background-color: var(--beam-SelectSubscriptionNonprofit-options-hover-backgroundColor);\n outline: var(--beam-SelectSubscriptionNonprofit-options-hover-borderWidth) solid\n var(--beam-SelectSubscriptionNonprofit-options-hover-borderColor);\n }\n\n .option.isDisabled {\n cursor: not-allowed;\n }\n\n .option.isSelected {\n outline: var(--beam-SelectSubscriptionNonprofit-options-selected-borderWidth) solid\n var(--beam-SelectSubscriptionNonprofit-options-selected-borderColor);\n background-color: var(--beam-SelectSubscriptionNonprofit-options-selected-backgroundColor);\n }\n\n .option.isSelected:focus-visible,\n .option.isSelected:hover {\n outline: var(--beam-SelectSubscriptionNonprofit-options-selected-borderWidth) solid\n var(--beam-SelectSubscriptionNonprofit-options-selected-borderColor);\n }\n\n .option .checkbox {\n margin-left: 5px;\n float: right;\n padding: 2px;\n border-radius: 100%;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n border-width: 1px;\n border-style: solid;\n transition:\n background-color 0.2s,\n color 0.2s,\n border-color 0.2s;\n color: var(--beam-SelectSubscriptionNonprofit-checkmark-color);\n background-color: var(--beam-SelectSubscriptionNonprofit-checkmark-backgroundColor);\n border-color: var(--beam-SelectSubscriptionNonprofit-checkmark-borderColor);\n }\n\n .option.isSelected .checkbox,\n .option.isSelected:focus-visible .checkbox,\n .option.isSelected:hover .checkbox {\n color: var(--beam-SelectSubscriptionNonprofit-checkmark-selected-color);\n background-color: var(--beam-SelectSubscriptionNonprofit-checkmark-selected-backgroundColor);\n border-color: var(--beam-SelectSubscriptionNonprofit-checkmark-selected-borderColor);\n }\n\n .option:not(.isSelected):focus-visible .checkbox,\n .option:not(.isSelected):hover .checkbox {\n color: var(--beam-SelectSubscriptionNonprofit-checkmark-hover-color);\n background-color: var(--beam-SelectSubscriptionNonprofit-checkmark-hover-backgroundColor);\n border-color: var(--beam-SelectSubscriptionNonprofit-checkmark-hover-borderColor);\n }\n\n .card-details-container {\n flex: 1 1 67%;\n height: 100%;\n display: flex;\n flex-direction: column;\n flex-wrap: nowrap;\n justify-content: space-between;\n align-content: stretch;\n align-items: stretch;\n position: relative;\n }\n\n .details-cause {\n flex: 0 1;\n ${useCustomText(\"--beam-SelectSubscriptionNonprofit-details-cause\")};\n letter-spacing: var(--beam-SelectSubscriptionNonprofit-details-cause-letterSpacing);\n }\n\n .details-description {\n flex: 1 1;\n ${useCustomText(\"--beam-SelectSubscriptionNonprofit-details-description\")}\n }\n\n .details-description .nonprofitName {\n font-weight: var(--beam-SelectSubscriptionNonprofit-details-nonprofitName-fontWeight);\n font-style: var(--beam-SelectSubscriptionNonprofit-details-nonprofitName-fontStyle);\n }\n\n .card-progress-bar {\n display: flex;\n margin-top: var(--beam-SelectSubscriptionNonprofit-details-fundingProgress-marginTop);\n align-items: center;\n }\n\n .details-funding-progress-label {\n white-space: nowrap;\n text-align: right;\n flex: 0 1;\n margin-left: 15px;\n ${useCustomText(\"--beam-SelectSubscriptionNonprofit-details-funding-progress-label\")}\n }\n\n .footer {\n text-align: center;\n }\n\n .sticky-footer {\n position: sticky;\n background: var(--beam-SelectSubscriptionNonprofit-stickyFooter-backgroundColor);\n bottom: 0;\n box-shadow: var(--beam-SelectSubscriptionNonprofit-stickyFooter-boxShadow);\n padding: var(--beam-SelectSubscriptionNonprofit-stickyFooter-padding);\n left: 0;\n right: 0;\n margin-left: var(--beam-SelectSubscriptionNonprofit-stickyFooter-marginLeft);\n margin-right: var(--beam-SelectSubscriptionNonprofit-stickyFooter-marginRight);\n width: var(--beam-SelectSubscriptionNonprofit-stickyFooter-width);\n }\n\n .footer-desktop {\n margin-top: 20px;\n }\n\n .submitButton {\n color: var(--beam-SelectSubscriptionNonprofit-submitButton-color);\n background-color: var(--beam-SelectSubscriptionNonprofit-submitButton-backgroundColor);\n border: 1px solid var(--beam-SelectSubscriptionNonprofit-submitButton-borderColor);\n font-size: var(--beam-SelectSubscriptionNonprofit-submitButton-fontSize);\n font-weight: var(--beam-SelectSubscriptionNonprofit-submitButton-fontWeight);\n font-family: var(--beam-SelectSubscriptionNonprofit-submitButton-fontFamily);\n text-transform: var(--beam-SelectSubscriptionNonprofit-submitButton-textTransform);\n border-radius: var(--beam-SelectSubscriptionNonprofit-submitButton-borderRadius);\n padding: var(--beam-SelectSubscriptionNonprofit-submitButton-padding);\n transition:\n background-color 0.2s,\n border-color 0.2s,\n color 0.2s;\n cursor: pointer;\n display: inline-flex;\n width: 234.173px;\n justify-content: center;\n align-items: center;\n gap: 10px;\n flex-shrink: 0;\n }\n\n .submitButton:not(.isDisabled):focus-visible,\n .submitButton:not(.isDisabled):hover {\n background-color: var(--beam-SelectSubscriptionNonprofit-submitButton-hover-backgroundColor);\n border-color: var(--beam-SelectSubscriptionNonprofit-submitButton-hover-borderColor);\n color: var(--beam-SelectSubscriptionNonprofit-submitButton-hover-color);\n }\n\n .submitButton.isDisabled {\n color: var(--beam-SelectSubscriptionNonprofit-submitButton-disabled-color);\n background-color: var(--beam-SelectSubscriptionNonprofit-submitButton-disabled-backgroundColor);\n border-color: var(--beam-SelectSubscriptionNonprofit-submitButton-disabled-borderColor);\n cursor: not-allowed;\n }\n\n .hideStickyFooter {\n display: none;\n }\n `,\n cssCardGrid({\n gap: \"var(--beam-SelectSubscriptionNonprofit-options-gap)\",\n itemMinWidth: \"var(--beam-SelectSubscriptionNonprofit-options-minWidth)\",\n columnCount: \"var(--beam-SelectSubscriptionNonprofit-options-columnCount)\",\n }),\n ];\n\n protected render() {\n const { selectedNonprofitId } = this;\n const { data, loading } = this.nonprofitListDataController;\n\n if (loading && !data) {\n return _loading();\n }\n if (this.nonprofitListDataController.error) {\n if (this.debug) {\n return _errorMessage({ error: this.nonprofitListDataController.error });\n }\n return \"\";\n }\n if (this.subscriptionUpdateDataController.error) {\n if (this.debug) {\n return _errorMessage({ error: this.subscriptionUpdateDataController.error });\n }\n // do not show error screen for interactive errors by default\n }\n if (data == null) {\n if (this.debug) {\n return _errorMessage({ error: new BeamError(\"No data\") });\n }\n return \"\";\n }\n const nonprofits = data?.nonprofits || [];\n const selectedNonprofit = nonprofits.find((np) => np.nonprofit.id === selectedNonprofitId) || null;\n // changes images in widget to icons\n const cardStyle = this.cssVariables[\"--beam-SelectSubscriptionNonprofit-cardStyle\"];\n const displayIcon = cardStyle === \"'icon'\" || cardStyle === \"'selected_icon'\";\n\n return html`\n <style>\n :host {\n ${this.cssVariables.toCSS()}\n }\n </style>\n <div class=\"widget-container ${this.isMobile ? \"widget-container-mobile\" : \"\"}\">\n <div class=\"header-container ${this.isMobile ? \"header-container-mobile\" : \"header-container-desktop\"}\">\n <h3 class=\"title\" part=\"title\" id=\"beam-SelectSubscriptionNonprofit-title\">\n ${localizeUserString(this.configLang, data?.config?.web?.title || \"\") ||\n strings[this.configLang].ctaTitle()}\n </h3>\n <div\n class=\"description-container ${this.isMobile\n ? \"header-container-mobile description-mobile\"\n : \"header-container-desktop description-desktop\"}\"\n >\n <span class=\"description\" part=\"description\">\n ${localizeUserString(this.configLang, data?.config?.web?.additionalStrings?.[\"ctaMessage\"] || \"\") ||\n strings[this.configLang].ctaMessage()}\n </span>\n <span class=\"description-prefix\" part=\"description\">\n ${localizeUserString(this.configLang, data?.config?.web?.additionalStrings?.[\"ctaMessagePrefix\"] || \"\") ||\n strings[this.configLang].ctaMessagePrefix()}\n </span>\n </div>\n </div>\n <div class=\"root\">\n <div\n tabindex=\"-1\"\n class=\"options cardGrid\"\n part=\"options\"\n role=\"radiogroup\"\n aria-labelledby=\"beam-SelectSubscriptionNonprofit-title\"\n ?aria-disabled=${!this.allowChange}\n >\n ${repeat(\n nonprofits,\n (i) => i.nonprofit.id,\n (np, index) => {\n const isSelected = selectedNonprofitId === np.nonprofit.id;\n const isFocusable = isSelected || (selectedNonprofit == null && index === 0);\n const unselectedIcon = np.nonprofit.causeIconUrl;\n const selectedIcon = np.nonprofit.causeIconSelectedUrl;\n const cardImage = np.imageUrl;\n const iconImage = cardStyle === \"'selected_icon'\" ? selectedIcon : unselectedIcon;\n return html`\n <div\n class=\"option ${classMap({\n isSelected: isSelected,\n isDisabled: !this.allowChange,\n })}\"\n part=\"option\"\n role=\"radio\"\n tabindex=\"${isFocusable ? 0 : -1}\"\n data-value=${np.nonprofit.id}\n ?aria-checked=${isSelected}\n @click=${this.makeHandleSelect(np.nonprofit.id, index, nonprofits)}\n @keydown=${this.makeHandleSelect(np.nonprofit.id, index, nonprofits)}\n aria-label=\"${localizeUserString(this.configLang, np.nonprofit.cause || \"\")}\"\n >\n ${displayIcon\n ? html` <div class=\"card-icon-container\">\n <div class=\"icon-background\">\n <img\n data-speedsize-ignore=\"true\"\n src=\"${iconImage}\"\n alt=\"\"\n role=\"presentation\"\n class=\"card-icon\"\n />\n </div>\n </div>`\n : html` <div class=\"card-image-container\">\n <img\n data-speedsize-ignore=\"true\"\n src=\"${cardImage}\"\n alt=\"\"\n role=\"presentation\"\n class=\"card-image\"\n />\n </div>`}\n <div class=\"card-details-container\" part=\"details\">\n <div class=\"details-cause\">\n <span part=\"checkbox\" class=\"checkbox\">\n <span style=\"line-height: 0;\"> ${_checkbox({ height: \"10px\", width: \"10px\" })} </span>\n </span>\n ${localizeUserString(this.configLang, np.nonprofit.cause || \"\")}\n </div>\n <p class=\"details-description\">\n ${unsafeHTML(localizeUserString(this.configLang, np.impact.description || \"\"))}\n </p>\n <div class=\"card-progress-bar\">\n <beam-progress-bar\n value=\"${np.impact.goalProgressPercentage}\"\n style=\"flex: 1 0;\"\n ></beam-progress-bar>\n <span class=\"details-funding-progress-label\">\n ${localizeUserString(this.configLang, np.impact.goalProgressText)}\n </span>\n </div>\n </div>\n </div>\n `;\n },\n )}\n </div>\n </div>\n <div\n id=\"footer\"\n class=\"footer ${this.isMobile ? \"sticky-footer\" : \"footer-desktop\"} ${this.isMobile &&\n !this.selectedNonprofitId\n ? \"hideStickyFooter\"\n : \"\"}\"\n >\n <button\n type=\"button\"\n ?aria-disabled=${!this.allowSubmit}\n @click=\"${this.handleSubmit}\"\n class=\"${classMap({\n isDisabled: !this.allowSubmit,\n submitButton: true,\n })}\"\n part=\"submitButton\"\n >\n ${this.subscriptionUpdateDataController.data !== null\n ? localizeUserString(\n this.configLang,\n data?.config?.web?.additionalStrings?.[\"submitButtonTextCompleted\"] || \"\",\n ) || strings[this.configLang].submitButtonTextCompleted()\n : localizeUserString(this.configLang, data?.config?.web?.additionalStrings?.[\"submitButtonText\"] || \"\") ||\n strings[this.configLang].submitButtonText()}\n </button>\n </div>\n </div>\n `;\n }\n}\n\ndefineCustomElement(BeamSelectSubscriptionNonprofit);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"beam-select-subscription-nonprofit\": BeamSelectSubscriptionNonprofit;\n }\n}\n"],"names":["_checkbox","height","width","html","styleMap","strings","donationPercentage","$","n","S","d","t","e","r","p","cacheTtl","BeamSelectSubscriptionNonprofit","LitElement","DEFAULT_BASE_URL","enforceConfig","res","postChainEligibleNonprofitsForCart","makeApiKeyHeader","LOCAL_STORAGE_KEYS","selectedNonprofitId","updateSubscription","SELECTION_METHODS","AsyncController","createScopedLocalStorage","id","index","nonprofits","event","currentId","nextFocus","focusTarget","selectedNonprofit","np","BeamNonprofitSelectEvent","WIDGET_NAMES","debounce","SUPPORTED_LANGUAGES","_changedProperties","previousPropertyValues","requireNewDataProps","prop","createdAt","data","defaults","progressBarConfigDefaults","defineCustomText","remoteConfig","config","_cssVariableMap","loading","_loading","_errorMessage","BeamError","cardStyle","displayIcon","localizeUserString","repeat","i","isSelected","isFocusable","unselectedIcon","selectedIcon","cardImage","iconImage","classMap","unsafeHTML","cssReset","css","useCustomText","cssCardGrid","__decorateClass","property","state","defineCustomElement"],"mappings":"8hBAGO,MAAMA,EAAY,CAAC,CAAE,OAAAC,EAAS,MAAO,MAAAC,EAAQ,KAAM,EAAI,CAAA,IAAOC;AAAAA;AAAAA,aAExDC,EAAS,CAAE,OAAAH,EAAQ,MAAAC,EAAO,SAAU,WAAY,OAAQ,GAAI,CAAC,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECL9DG,EAAU,CACrB,GAAI,CACF,SAAU,IAAM,qBAChB,iBAAkB,IAAM,4DACxB,WAAY,CAAC,CAAE,mBAAAC,EAAqB,IAAK,EAAI,CAAA,IAC3C,0BAA0BA,CAAkB,kCAC9C,iBAAkB,IAAM,UACxB,0BAA2B,IAAM,aACjC,iBAAkB,IAAM,QAC1B,EACA,GAAI,CACF,SAAU,IAAM,0BAChB,iBAAkB,IAAM,4EACxB,WAAY,CAAC,CAAE,mBAAAA,EAAqB,IAAK,EAAI,CAAA,IAC3C,iCAAiCA,CAAkB,iCACrD,iBAAkB,IAAM,YACxB,0BAA2B,IAAM,gBACjC,iBAAkB,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CAAC,CAAA,EARf5D,EAQwB,UAAA,YAAA,EACe2D,EAAA,CAAjDC,EAAS,CAAE,KAAM,OAAQ,QAAS,EAAK,CAAC,CAAA,EAT9B5D,EASuC,UAAA,qBAAA,EACf2D,EAAA,CAAlCC,EAAS,CAAE,KAAM,MAAO,CAAC,CAAA,EAVf5D,EAUwB,UAAA,MAAA,EACC2D,EAAA,CAAnCC,EAAS,CAAE,KAAM,OAAQ,CAAC,CAAA,EAXhB5D,EAWyB,UAAA,aAAA,EACA2D,EAAA,CAAnCC,EAAS,CAAE,KAAM,OAAQ,CAAC,CAAA,EAZhB5D,EAYyB,UAAA,OAAA,EACnB2D,EAAA,CAAhBE,EAAAA,CAAM,EAbI7D,EAaM,UAAA,UAAA,EAozBnB8D,EAAoB9D,CAA+B"}
|
|
1
|
+
{"version":3,"file":"select-subscription-nonprofit.js","sources":["../../src/shared/fragments/checkbox.ts","../../src/components/select-subscription-nonprofit/strings.ts","../../src/components/select-subscription-nonprofit/index.ts"],"sourcesContent":["import { html } from \"lit\";\nimport { styleMap } from \"lit/directives/style-map.js\";\n\nexport const _checkbox = ({ height = \"1em\", width = \"1em\" } = {}) => html`\n <svg\n style=\"${styleMap({ height, width, position: \"relative\", bottom: \"0\" })}\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 78.369 78.369\"\n >\n <g>\n <path\n d=\"M78.049,19.015L29.458,67.606c-0.428,0.428-1.121,0.428-1.548,0L0.32,40.015c-0.427-0.426-0.427-1.119,0-1.547l6.704-6.704\n c0.428-0.427,1.121-0.427,1.548,0l20.113,20.112l41.113-41.113c0.429-0.427,1.12-0.427,1.548,0l6.703,6.704\n C78.477,17.894,78.477,18.586,78.049,19.015z\"\n style=\"fill: currentColor\"\n />\n </g>\n </svg>\n`;\n","export const strings = {\n en: {\n ctaTitle: () => `Choose Your Impact`,\n ctaMessagePrefix: () => ` at no extra cost, with every order of your subscription.`,\n ctaMessage: ({ donationPercentage = \"1%\" } = {}) =>\n `Choose a nonprofit and ${donationPercentage} will be donated there for you,`,\n submitButtonText: () => `Confirm`,\n submitButtonTextCompleted: () => `Confirmed!`,\n chooseButtonText: () => `Choose`,\n },\n fr: {\n ctaTitle: () => `Choisissez votre impact`,\n ctaMessagePrefix: () => ` sans frais supplémentaires, à chaque commande de votre abonnement.`,\n ctaMessage: ({ donationPercentage = \"1%\" } = {}) =>\n `Choisissez une association et ${donationPercentage} sera reversé en votre nom,`,\n submitButtonText: () => `Confirmer`,\n submitButtonTextCompleted: () => `Confirmé !`,\n chooseButtonText: () => `Choisir`,\n },\n de: {\n ctaTitle: () => `Wähle deinen Impact`,\n ctaMessagePrefix: () => ` ohne zusätzliche Kosten, bei jeder Bestellung deines Abonnements.`,\n ctaMessage: ({ donationPercentage = \"1%\" } = {}) =>\n `Wähle eine gemeinnützige Organisation und ${donationPercentage} werden in deinem Namen gespendet,`,\n submitButtonText: () => `Bestätigen`,\n submitButtonTextCompleted: () => `Bestätigt!`,\n chooseButtonText: () => `Wählen`,\n },\n es: {\n ctaTitle: () => `Elige tu impacto`,\n ctaMessagePrefix: () => ` sin coste adicional, con cada pedido de tu suscripción.`,\n ctaMessage: ({ donationPercentage = \"1%\" } = {}) =>\n `Elige una organización sin ánimo de lucro y donaremos ${donationPercentage} en tu nombre,`,\n submitButtonText: () => `Confirmar`,\n submitButtonTextCompleted: () => `¡Confirmado!`,\n chooseButtonText: () => `Elegir`,\n },\n it: {\n ctaTitle: () => `Scegli il tuo impatto`,\n ctaMessagePrefix: () => ` senza costi aggiuntivi, a ogni ordine del tuo abbonamento.`,\n ctaMessage: ({ donationPercentage = \"1%\" } = {}) =>\n `Seleziona un'organizzazione no-profit e l’${donationPercentage} sarà donato a tuo nome,`,\n submitButtonText: () => `Confermare`,\n submitButtonTextCompleted: () => `Confermato!`,\n chooseButtonText: () => `Scegli`,\n },\n pl: {\n ctaTitle: () => `Wybierz swój wpływ`,\n ctaMessagePrefix: () => ` bez żadnych dodatkowych kosztów, przy każdym zamówieniu w ramach subskrypcji.`,\n ctaMessage: ({ donationPercentage = \"1%\" } = {}) =>\n `Wybierz organizację non-profit, a ${donationPercentage} zostanie przekazane w Twoim imieniu,`,\n submitButtonText: () => `Zatwierdź`,\n submitButtonTextCompleted: () => `Zatwierdzono!`,\n chooseButtonText: () => `Wybierz`,\n },\n ja: {\n ctaTitle: () => `寄付先をお選びください。`,\n ctaMessagePrefix: () => `追加費用なしで、ご購入ごとに、`,\n ctaMessage: ({ donationPercentage = \"1%\" } = {}) =>\n `非営利団体を選ぶと、${donationPercentage}がその団体に寄付されます、`,\n submitButtonText: () => `確認する`,\n submitButtonTextCompleted: () => `確認済み`,\n chooseButtonText: () => `選択してください`,\n },\n};\n","import { css, html, LitElement, PropertyValues } from \"lit\";\nimport { property } from \"lit/decorators/property.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { unsafeHTML } from \"lit/directives/unsafe-html.js\";\nimport { repeat } from \"lit/directives/repeat.js\";\nimport { state } from \"lit/decorators/state.js\";\nimport debounce from \"lodash-es/debounce\";\nimport { postChainEligibleNonprofitsForCart, updateSubscription } from \"../../api-sdk/v3/routes\";\nimport { defineCustomText, useCustomText } from \"../../shared/fragments/custom-text\";\nimport { progressBarConfigDefaults } from \"../../shared/components/progress-bar\";\nimport { AsyncController } from \"../../shared/controllers/async-controller\";\nimport {\n DEFAULT_BASE_URL,\n LOCAL_STORAGE_KEYS,\n SELECTION_METHODS,\n SUPPORTED_LANGUAGES,\n WIDGET_NAMES,\n} from \"../../api-sdk/constants\";\nimport { defineCustomElement } from \"../../shared/defineCustomElement\";\nimport { _loading } from \"../../shared/fragments/loading-template\";\nimport { _errorMessage } from \"../../shared/fragments/error-message-template\";\nimport { cssReset } from \"../../shared/css-reset\";\nimport { makeApiKeyHeader } from \"../../utils/makeApiKeyHeader\";\nimport { _cssVariableMap } from \"../../shared/fragments/css-variable-map\";\nimport { BeamError, MissingConfig } from \"../../utils/beam-errors\";\nimport { createScopedLocalStorage } from \"../../utils/local-storage\";\nimport { cssCardGrid } from \"../../shared/fragments/css-card-grid\";\nimport { _checkbox } from \"../../shared/fragments/checkbox\";\nimport { BeamNonprofitSelectEvent } from \"../../utils/events\";\nimport { localizeUserString } from \"../../shared/localize\";\nimport { TNumericId } from \"../../shared/types\";\nimport { LANGUAGES } from \"../../api-sdk/types\";\nimport { enforceConfig } from \"../../shared/enforce-config\";\nimport { strings } from \"./strings\";\nimport \"../beam-partner-logos\";\n\ninterface SubscriptionRequiredConfig {\n apiKey: string;\n subscriptionId: string;\n storeId: TNumericId;\n}\nconst cacheTtl = 2 * 60 * 60 * 1000;\nexport class BeamSelectSubscriptionNonprofit extends LitElement {\n static tagName = \"beam-select-subscription-nonprofit\";\n\n @property({ type: String }) public baseUrl: string = DEFAULT_BASE_URL;\n @property({ type: String }) public apiKey?: SubscriptionRequiredConfig[\"apiKey\"];\n @property({ type: String }) public subscriptionId?: SubscriptionRequiredConfig[\"subscriptionId\"];\n @property({ type: Number }) public storeId?: SubscriptionRequiredConfig[\"storeId\"];\n @property({ type: String }) public countryCode?: string;\n @property({ type: String }) public postalCode?: string;\n @property({ type: Number, reflect: true }) public selectedNonprofitId?: TNumericId;\n @property({ type: String }) public lang: LANGUAGES = \"en\";\n @property({ type: Boolean }) public draftConfig = false;\n @property({ type: Boolean }) public debug = false;\n @state() private isMobile = window.innerWidth < 768;\n\n get configLang() {\n return SUPPORTED_LANGUAGES[this.lang] || \"en\";\n }\n\n private getChainNonprofits = async () => {\n if (!enforceConfig<SubscriptionRequiredConfig>([\"apiKey\", \"subscriptionId\", \"storeId\"], this)) {\n throw new MissingConfig();\n }\n const res = await postChainEligibleNonprofitsForCart({\n baseUrl: this.baseUrl,\n headers: makeApiKeyHeader(this.apiKey),\n requestBody: {\n storeId: this.storeId,\n ...(this.postalCode && { postalCode: this.postalCode }),\n ...(this.countryCode && { countryCode: this.countryCode }),\n widgetName: \"select-subscription-nonprofit\",\n version: \"1.0.0\",\n lang: this.configLang,\n options: {\n config: {\n draftConfig: this.draftConfig,\n },\n },\n },\n });\n\n this.localStorage.setItemJson(LOCAL_STORAGE_KEYS.CHAIN_NONPROFITS, {\n createdAt: new Date(),\n data: res,\n });\n\n return res;\n };\n\n private updateNonprofitIdForSubscription = async ({ selectedNonprofitId }: { selectedNonprofitId: TNumericId }) => {\n if (!this.subscriptionId) {\n return null;\n }\n\n if (!enforceConfig<SubscriptionRequiredConfig>([\"apiKey\", \"subscriptionId\"], this)) {\n throw new MissingConfig();\n }\n\n return updateSubscription({\n baseUrl: this.baseUrl,\n headers: makeApiKeyHeader(this.apiKey),\n requestBody: {\n remoteSubscriptionId: this.subscriptionId,\n nonprofitId: selectedNonprofitId,\n selectionMethod: SELECTION_METHODS.subscription_management_widget,\n },\n });\n };\n\n private nonprofitListDataController = new AsyncController<typeof this.getChainNonprofits>(\n this,\n this.getChainNonprofits,\n );\n\n private subscriptionUpdateDataController = new AsyncController<typeof this.updateNonprofitIdForSubscription>(\n this,\n this.updateNonprofitIdForSubscription,\n );\n\n private localStorage = createScopedLocalStorage(this as LitElement & SubscriptionRequiredConfig);\n\n connectedCallback() {\n super.connectedCallback();\n window.addEventListener(\"resize\", this.evaluateBreakPoints);\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\", \"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 super.disconnectedCallback();\n }\n\n private restoreStateFromCache() {\n if (!enforceConfig<SubscriptionRequiredConfig>([\"apiKey\"], this)) throw new MissingConfig();\n\n try {\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 }>(LOCAL_STORAGE_KEYS.CHAIN_NONPROFITS) || {};\n if (new Date(createdAt).valueOf() + cacheTtl > new Date().valueOf()) {\n this.nonprofitListDataController.data = data;\n this.nonprofitListDataController.loading = false;\n }\n } catch (err) {\n // ignore cache retrieval error and continue to fetch data\n }\n }\n\n /**\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 } }[]): ((event: Event) => void) =>\n async (event: Event) => {\n if (!this.allowChange) return;\n\n const currentId = this.selectedNonprofitId;\n if (event instanceof KeyboardEvent) {\n let nextFocus = null;\n switch (event.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 event.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 event.preventDefault();\n break;\n case \"Enter\":\n case \" \":\n event.preventDefault();\n break; // continue to toggle-selection block below\n default:\n return;\n }\n if (nextFocus) {\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 = event.currentTarget;\n if (targetEl instanceof HTMLElement) {\n if (currentId === id) {\n // this[\"selected-nonprofit-id\"] = undefined; // unset (not supported)\n return; // no API call or localStorage change needed\n } else {\n this.selectedNonprofitId = id;\n }\n }\n };\n\n get allowChange() {\n // Disallow change if already submitted\n return this.subscriptionUpdateDataController.data == null && !this.subscriptionUpdateDataController.loading;\n }\n\n get allowSubmit() {\n // Disabled if no nonprofit has been selected yet or if submission was already received\n return Boolean(this.selectedNonprofitId && this.allowChange);\n }\n\n handleSubmit = async () => {\n const { selectedNonprofitId } = this;\n if (!this.allowSubmit || selectedNonprofitId == null) return;\n await this.subscriptionUpdateDataController.exec({ selectedNonprofitId });\n\n const selectedNonprofit = this.nonprofitListDataController?.data?.nonprofits.find(\n (np) => np.nonprofit.id === selectedNonprofitId,\n );\n\n this.dispatchEvent(\n new BeamNonprofitSelectEvent({\n selectedNonprofitId,\n nonprofitName: selectedNonprofit?.nonprofit.name,\n source: WIDGET_NAMES.select_subscription_nonprofit,\n timestamp: new Date(),\n }),\n );\n };\n\n evaluateBreakPoints = debounce(\n () => {\n this.isMobile = window.innerWidth < 768;\n },\n 50,\n { maxWait: 50, leading: true },\n );\n\n public get cssVariables() {\n const defaults = {\n ...progressBarConfigDefaults,\n \"--beam-fontFamily\": \"inherit\",\n \"--beam-fontStyle\": \"inherit\",\n \"--beam-fontSize\": \"inherit\",\n \"--beam-textColor\": \"inherit\",\n \"--beam-backgroundColor\": \"inherit\",\n \"--beam-SelectSubscriptionNonprofit-maxWidth\": \"800px\",\n \"--beam-SelectSubscriptionNonprofit-mobile-header-alignItems\": \"center\",\n \"--beam-SelectSubscriptionNonprofit-desktop-header-alignItems\": \"center\",\n \"--beam-SelectSubscriptionNonprofit-headerContainer-padding\": \"2px\",\n \"--beam-SelectSubscriptionNonprofit-title-textAlign\": \"inherit\",\n \"--beam-SelectSubscriptionNonprofit-description-textAlign\": \"center\",\n \"--beam-SelectSubscriptionNonprofit-description-lineHeight\": \"138%\",\n \"--beam-SelectSubscriptionNonprofit-description-marginTop\": \"3px\",\n \"--beam-SelectSubscriptionNonprofit-desktop-description-width\": \"80%\",\n \"--beam-SelectSubscriptionNonprofit-mobile-description-width\": \"90%\",\n \"--beam-SelectSubscriptionNonprofit-options-marginTop\": \"10px\",\n \"--beam-SelectSubscriptionNonprofit-options-padding\": \"10px\",\n \"--beam-SelectSubscriptionNonprofit-options-borderWidth\": \"1px\",\n \"--beam-SelectSubscriptionNonprofit-options-borderColor\": \"transparent\",\n \"--beam-SelectSubscriptionNonprofit-options-borderRadius\": \"8px\",\n \"--beam-SelectSubscriptionNonprofit-options-backgroundColor\": \"#F9FBFB\",\n \"--beam-SelectSubscriptionNonprofit-option-padding\": \"15px\",\n \"--beam-SelectSubscriptionNonprofit-options-hover-backgroundColor\": \"#e1f1ee\",\n \"--beam-SelectSubscriptionNonprofit-options-hover-borderWidth\": \"1px\",\n \"--beam-SelectSubscriptionNonprofit-options-hover-borderColor\": \"#e1f1ee\",\n \"--beam-SelectSubscriptionNonprofit-options-selected-borderWidth\": \"1px\",\n \"--beam-SelectSubscriptionNonprofit-options-selected-borderColor\": \"#e1f1ee\",\n \"--beam-SelectSubscriptionNonprofit-options-selected-backgroundColor\": \"#e1f1ee\",\n \"--beam-SelectSubscriptionNonprofit-options-gap\": \"20px\",\n \"--beam-SelectSubscriptionNonprofit-options-minWidth\": \"250px\",\n \"--beam-SelectSubscriptionNonprofit-options-columnCount\": \"2\",\n \"--beam-SelectSubscriptionNonprofit-options-icon-borderRadius\": \"4px\",\n \"--beam-SelectSubscriptionNonprofit-options-icon-padding\": \"10px\",\n \"--beam-SelectSubscriptionNonprofit-options-image-borderRadius\": \"4px\",\n \"--beam-SelectSubscriptionNonprofit-cardIconContainer-height\": \"100%\",\n \"--beam-SelectSubscriptionNonprofit-iconBackground-width\": \"50px\",\n \"--beam-SelectSubscriptionNonprofit-iconBackground-height\": \"50px\",\n \"--beam-SelectSubscriptionNonprofit-iconBackground-borderRadius\": \"50%\",\n \"--beam-SelectSubscriptionNonprofit-iconBackground-background\": \"#0a323c\",\n \"--beam-SelectSubscriptionNonprofit-icon-height\": \"50px\",\n \"--beam-SelectSubscriptionNonprofit-checkmark-backgroundColor\": \"transparent\",\n \"--beam-SelectSubscriptionNonprofit-checkmark-color\": \"transparent\",\n \"--beam-SelectSubscriptionNonprofit-checkmark-borderColor\": \"#0A323C\",\n \"--beam-SelectSubscriptionNonprofit-checkmark-selected-color\": \"#fff\",\n \"--beam-SelectSubscriptionNonprofit-checkmark-selected-backgroundColor\": \"#0A323C\",\n \"--beam-SelectSubscriptionNonprofit-checkmark-selected-borderColor\": \"#0A323C\",\n \"--beam-SelectSubscriptionNonprofit-checkmark-hover-color\": \"#fff\",\n \"--beam-SelectSubscriptionNonprofit-checkmark-hover-backgroundColor\": \"#0A323C\",\n \"--beam-SelectSubscriptionNonprofit-checkmark-hover-borderColor\": \"#0A323C\",\n \"--beam-SelectSubscriptionNonprofit-cardStyle\": \"'selected_icon'\",\n \"--beam-SelectSubscriptionNonprofit-submitButton-color\": \"#fff\",\n \"--beam-SelectSubscriptionNonprofit-submitButton-hover-color\": \"#fff\",\n \"--beam-SelectSubscriptionNonprofit-submitButton-disabled-color\": \"#fff\",\n \"--beam-SelectSubscriptionNonprofit-submitButton-backgroundColor\": \"#0A323C\",\n \"--beam-SelectSubscriptionNonprofit-submitButton-hover-backgroundColor\": \"#222\",\n \"--beam-SelectSubscriptionNonprofit-submitButton-disabled-backgroundColor\": \"#767676\",\n \"--beam-SelectSubscriptionNonprofit-submitButton-borderColor\": \"#333\",\n \"--beam-SelectSubscriptionNonprofit-submitButton-hover-borderColor\": \"#222\",\n \"--beam-SelectSubscriptionNonprofit-submitButton-disabled-borderColor\": \"#767676\",\n \"--beam-SelectSubscriptionNonprofit-submitButton-fontSize\": \"14px\",\n \"--beam-SelectSubscriptionNonprofit-submitButton-fontWeight\": \"inherit\",\n \"--beam-SelectSubscriptionNonprofit-submitButton-fontFamily\": \"inherit\",\n \"--beam-SelectSubscriptionNonprofit-submitButton-textTransform\": \"none\",\n \"--beam-SelectSubscriptionNonprofit-submitButton-borderRadius\": \"30px\",\n \"--beam-SelectSubscriptionNonprofit-submitButton-padding\": \"10px 30px\",\n \"--beam-SelectSubscriptionNonprofit-submitButton-width\": \"234.173px\",\n \"--beam-SelectSubscriptionNonprofit-submitButton-maxWidth\": \"100%\",\n ...defineCustomText(\"--beam-SelectSubscriptionNonprofit-title\", {\n fontSize: \"20px\",\n fontWeight: \"bold\",\n lineHeight: \"120%\",\n textTransform: \"capitalize\",\n color: \"#0a323c\",\n }),\n ...defineCustomText(\"--beam-SelectSubscriptionNonprofit-descriptionPrefix\", {\n marginTop: \"3px\",\n color: \"#2f302d\",\n fontSize: \"14px\",\n fontWeight: \"bold\",\n fontStyle: \"normal\",\n lineHeight: \"138%\",\n }),\n ...defineCustomText(\"--beam-SelectSubscriptionNonprofit-description\", {\n color: \"#2f302d\",\n fontSize: \"14px\",\n fontStyle: \"normal\",\n }),\n \"--beam-SelectSubscriptionNonprofit-details-cause-letterSpacing\": \"0.36px\",\n ...defineCustomText(\"--beam-SelectSubscriptionNonprofit-details-cause\", {\n fontSize: \"12px\",\n fontWeight: \"bold\",\n color: \"#0a323c\",\n fontStyle: \"normal\",\n lineHeight: \"120%\",\n }),\n ...defineCustomText(\"--beam-SelectSubscriptionNonprofit-details-description\", {\n fontSize: \"12px\",\n marginTop: \"5px\",\n fontStyle: \"normal\",\n lineHeight: \"140%\",\n fontWeight: \"400\",\n }),\n \"--beam-SelectSubscriptionNonprofit-details-fundingProgress-marginTop\": \"7px\",\n ...defineCustomText(\"--beam-SelectSubscriptionNonprofit-details-funding-progress-label\", {\n fontSize: \"12px\",\n color: \"#666666\",\n fontWeight: \"400\",\n fontStyle: \"normal\",\n }),\n \"--beam-SelectSubscriptionNonprofit-stickyFooter-boxShadow\": \"0px -20px 20px 0px rgba(0, 0, 0, 0.04)\",\n \"--beam-SelectSubscriptionNonprofit-stickyFooter-padding\": \"15px 0px 45px\",\n \"--beam-SelectSubscriptionNonprofit-stickyFooter-backgroundColor\": \"white\",\n \"--beam-SelectSubscriptionNonprofit-stickyFooter-marginLeft\": \"-15px\",\n \"--beam-SelectSubscriptionNonprofit-stickyFooter-marginRight\": \"-15px\",\n \"--beam-SelectSubscriptionNonprofit-stickyFooter-width\": \"auto\",\n \"--beam-SelectSubscriptionNonprofit-footer-margin\": \"20px 0 0 0\",\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 css`\n :host {\n display: block;\n max-width: var(--beam-SelectSubscriptionNonprofit-maxWidth);\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 .widget-container-mobile {\n position: relative;\n }\n\n .header-container {\n align-items: flex-start;\n justify-content: space-between;\n padding: var(--beam-SelectSubscriptionNonprofit-headerContainer-padding);\n display: flex;\n flex-direction: column;\n gap: 8px;\n }\n\n .header-container-mobile {\n align-items: var(--beam-SelectSubscriptionNonprofit-mobile-header-alignItems);\n }\n\n .header-container-desktop {\n align-items: var(--beam-SelectSubscriptionNonprofit-desktop-header-alignItems);\n }\n\n .title {\n text-align: var(--beam-SelectSubscriptionNonprofit-title-textAlign);\n ${useCustomText(\"--beam-SelectSubscriptionNonprofit-title\")};\n }\n\n .description-container {\n text-align: var(--beam-SelectSubscriptionNonprofit-description-textAlign);\n line-height: var(--beam-SelectSubscriptionNonprofit-description-lineHeight);\n margin-top: var(--beam-SelectSubscriptionNonprofit-description-marginTop);\n }\n\n .description-prefix {\n ${useCustomText(\"--beam-SelectSubscriptionNonprofit-descriptionPrefix\")};\n }\n\n .description {\n ${useCustomText(\"--beam-SelectSubscriptionNonprofit-description\")};\n }\n\n .description-desktop {\n width: var(--beam-SelectSubscriptionNonprofit-desktop-description-width);\n }\n\n .description-mobile {\n width: var(--beam-SelectSubscriptionNonprofit-mobile-description-width);\n }\n\n .root {\n display: flex;\n flex-direction: column;\n gap: 12px;\n flex-shrink: 0;\n }\n\n .options {\n margin-top: var(--beam-SelectSubscriptionNonprofit-options-marginTop);\n padding: var(--beam-SelectSubscriptionNonprofit-options-padding);\n }\n\n .card-icon-container {\n height: var(--beam-SelectSubscriptionNonprofit-cardIconContainer-height);\n flex: 0;\n flex-direction: column;\n }\n\n .icon-background {\n width: var(--beam-SelectSubscriptionNonprofit-iconBackground-width);\n height: var(--beam-SelectSubscriptionNonprofit-iconBackground-height);\n border-radius: var(--beam-SelectSubscriptionNonprofit-iconBackground-borderRadius);\n overflow: hidden;\n background: var(--beam-SelectSubscriptionNonprofit-iconBackground-background);\n display: flex;\n justify-content: center;\n align-items: center;\n }\n\n .card-icon {\n height: var(--beam-SelectSubscriptionNonprofit-icon-height);\n display: block;\n padding: var(--beam-SelectSubscriptionNonprofit-options-icon-padding);\n border-radius: var(--beam-SelectSubscriptionNonprofit-options-icon-borderRadius);\n }\n\n .card-image-container {\n height: 100%;\n flex: 4;\n display: flex;\n flex-direction: column;\n }\n\n .card-image {\n flex: 1;\n height: auto;\n width: 100%;\n object-fit: cover;\n border-radius: var(--beam-SelectSubscriptionNonprofit-options-image-borderRadius);\n }\n\n .option {\n /* outline is used to prevent layer shift if changing border width */\n outline: var(--beam-SelectSubscriptionNonprofit-options-borderWidth) solid\n var(--beam-SelectSubscriptionNonprofit-options-borderColor);\n border-radius: var(--beam-SelectSubscriptionNonprofit-options-borderRadius);\n background-color: var(--beam-SelectSubscriptionNonprofit-options-backgroundColor);\n cursor: pointer;\n transition:\n border-color 0.2s,\n background-color 0.2s,\n outline 0.2s;\n display: flex;\n gap: 15px;\n padding: var(--beam-SelectSubscriptionNonprofit-option-padding);\n }\n\n .options.cardGrid {\n order: 3;\n }\n\n .option:not(.isDisabled):focus-visible,\n .option:not(.isDisabled):hover,\n .option:not(.isSelected):focus-visible,\n .option:not(.isSelected):hover {\n background-color: var(--beam-SelectSubscriptionNonprofit-options-hover-backgroundColor);\n outline: var(--beam-SelectSubscriptionNonprofit-options-hover-borderWidth) solid\n var(--beam-SelectSubscriptionNonprofit-options-hover-borderColor);\n }\n\n .option.isDisabled {\n cursor: not-allowed;\n }\n\n .option.isSelected {\n outline: var(--beam-SelectSubscriptionNonprofit-options-selected-borderWidth) solid\n var(--beam-SelectSubscriptionNonprofit-options-selected-borderColor);\n background-color: var(--beam-SelectSubscriptionNonprofit-options-selected-backgroundColor);\n }\n\n .option.isSelected:focus-visible,\n .option.isSelected:hover {\n outline: var(--beam-SelectSubscriptionNonprofit-options-selected-borderWidth) solid\n var(--beam-SelectSubscriptionNonprofit-options-selected-borderColor);\n }\n\n .option .checkbox {\n margin-left: 5px;\n float: right;\n padding: 2px;\n border-radius: 100%;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n border-width: 1px;\n border-style: solid;\n transition:\n background-color 0.2s,\n color 0.2s,\n border-color 0.2s;\n color: var(--beam-SelectSubscriptionNonprofit-checkmark-color);\n background-color: var(--beam-SelectSubscriptionNonprofit-checkmark-backgroundColor);\n border-color: var(--beam-SelectSubscriptionNonprofit-checkmark-borderColor);\n }\n\n .option.isSelected .checkbox,\n .option.isSelected:focus-visible .checkbox,\n .option.isSelected:hover .checkbox {\n color: var(--beam-SelectSubscriptionNonprofit-checkmark-selected-color);\n background-color: var(--beam-SelectSubscriptionNonprofit-checkmark-selected-backgroundColor);\n border-color: var(--beam-SelectSubscriptionNonprofit-checkmark-selected-borderColor);\n }\n\n .option:not(.isSelected):focus-visible .checkbox,\n .option:not(.isSelected):hover .checkbox {\n color: var(--beam-SelectSubscriptionNonprofit-checkmark-hover-color);\n background-color: var(--beam-SelectSubscriptionNonprofit-checkmark-hover-backgroundColor);\n border-color: var(--beam-SelectSubscriptionNonprofit-checkmark-hover-borderColor);\n }\n\n .card-details-container {\n flex: 1 1 67%;\n height: 100%;\n display: flex;\n flex-direction: column;\n flex-wrap: nowrap;\n justify-content: space-between;\n align-content: stretch;\n align-items: stretch;\n position: relative;\n }\n\n .details-cause {\n flex: 0 1;\n ${useCustomText(\"--beam-SelectSubscriptionNonprofit-details-cause\")};\n letter-spacing: var(--beam-SelectSubscriptionNonprofit-details-cause-letterSpacing);\n }\n\n .details-description {\n flex: 1 1;\n ${useCustomText(\"--beam-SelectSubscriptionNonprofit-details-description\")}\n }\n\n .details-description .nonprofitName {\n font-weight: var(--beam-SelectSubscriptionNonprofit-details-nonprofitName-fontWeight);\n font-style: var(--beam-SelectSubscriptionNonprofit-details-nonprofitName-fontStyle);\n }\n\n .card-progress-bar {\n display: flex;\n margin-top: var(--beam-SelectSubscriptionNonprofit-details-fundingProgress-marginTop);\n align-items: center;\n }\n\n .details-funding-progress-label {\n white-space: nowrap;\n text-align: right;\n flex: 0 1;\n margin-left: 15px;\n ${useCustomText(\"--beam-SelectSubscriptionNonprofit-details-funding-progress-label\")}\n }\n\n .footer {\n text-align: center;\n }\n\n .sticky-footer {\n position: sticky;\n background: var(--beam-SelectSubscriptionNonprofit-stickyFooter-backgroundColor);\n bottom: 0;\n box-shadow: var(--beam-SelectSubscriptionNonprofit-stickyFooter-boxShadow);\n padding: var(--beam-SelectSubscriptionNonprofit-stickyFooter-padding);\n left: 0;\n right: 0;\n margin-left: var(--beam-SelectSubscriptionNonprofit-stickyFooter-marginLeft);\n margin-right: var(--beam-SelectSubscriptionNonprofit-stickyFooter-marginRight);\n width: var(--beam-SelectSubscriptionNonprofit-stickyFooter-width);\n }\n\n .footer-desktop {\n margin: var(--beam-SelectSubscriptionNonprofit-footer-margin);\n }\n\n .submitButton {\n color: var(--beam-SelectSubscriptionNonprofit-submitButton-color);\n background-color: var(--beam-SelectSubscriptionNonprofit-submitButton-backgroundColor);\n border: 1px solid var(--beam-SelectSubscriptionNonprofit-submitButton-borderColor);\n font-size: var(--beam-SelectSubscriptionNonprofit-submitButton-fontSize);\n font-weight: var(--beam-SelectSubscriptionNonprofit-submitButton-fontWeight);\n font-family: var(--beam-SelectSubscriptionNonprofit-submitButton-fontFamily);\n text-transform: var(--beam-SelectSubscriptionNonprofit-submitButton-textTransform);\n border-radius: var(--beam-SelectSubscriptionNonprofit-submitButton-borderRadius);\n padding: var(--beam-SelectSubscriptionNonprofit-submitButton-padding);\n transition:\n background-color 0.2s,\n border-color 0.2s,\n color 0.2s;\n cursor: pointer;\n display: inline-flex;\n width: var(--beam-SelectSubscriptionNonprofit-submitButton-width);\n max-width: var(--beam-SelectSubscriptionNonprofit-submitButton-maxWidth);\n justify-content: center;\n align-items: center;\n gap: 10px;\n flex-shrink: 0;\n }\n\n .submitButton:not(.isDisabled):focus-visible,\n .submitButton:not(.isDisabled):hover {\n background-color: var(--beam-SelectSubscriptionNonprofit-submitButton-hover-backgroundColor);\n border-color: var(--beam-SelectSubscriptionNonprofit-submitButton-hover-borderColor);\n color: var(--beam-SelectSubscriptionNonprofit-submitButton-hover-color);\n }\n\n .submitButton.isDisabled {\n color: var(--beam-SelectSubscriptionNonprofit-submitButton-disabled-color);\n background-color: var(--beam-SelectSubscriptionNonprofit-submitButton-disabled-backgroundColor);\n border-color: var(--beam-SelectSubscriptionNonprofit-submitButton-disabled-borderColor);\n cursor: not-allowed;\n }\n\n .hideStickyFooter {\n display: none;\n }\n `,\n cssCardGrid({\n gap: \"var(--beam-SelectSubscriptionNonprofit-options-gap)\",\n itemMinWidth: \"var(--beam-SelectSubscriptionNonprofit-options-minWidth)\",\n columnCount: \"var(--beam-SelectSubscriptionNonprofit-options-columnCount)\",\n }),\n ];\n\n protected render() {\n const { selectedNonprofitId } = this;\n const { data, loading } = this.nonprofitListDataController;\n\n if (loading && !data) {\n return _loading();\n }\n if (this.nonprofitListDataController.error) {\n if (this.debug) {\n return _errorMessage({ error: this.nonprofitListDataController.error });\n }\n return \"\";\n }\n if (this.subscriptionUpdateDataController.error) {\n if (this.debug) {\n return _errorMessage({ error: this.subscriptionUpdateDataController.error });\n }\n // do not show error screen for interactive errors by default\n }\n if (data == null) {\n if (this.debug) {\n return _errorMessage({ error: new BeamError(\"No data\") });\n }\n return \"\";\n }\n const nonprofits = data?.nonprofits || [];\n const selectedNonprofit = nonprofits.find((np) => np.nonprofit.id === selectedNonprofitId) || null;\n // changes images in widget to icons\n const cardStyle = this.cssVariables[\"--beam-SelectSubscriptionNonprofit-cardStyle\"];\n const displayIcon = cardStyle === \"'icon'\" || cardStyle === \"'selected_icon'\";\n\n return html`\n <style>\n :host {\n ${this.cssVariables.toCSS()}\n }\n </style>\n <div class=\"widget-container ${this.isMobile ? \"widget-container-mobile\" : \"\"}\">\n <div class=\"header-container ${this.isMobile ? \"header-container-mobile\" : \"header-container-desktop\"}\">\n <h3 class=\"title\" part=\"title\" id=\"beam-SelectSubscriptionNonprofit-title\">\n ${localizeUserString(this.configLang, data?.config?.web?.title || \"\") ||\n strings[this.configLang].ctaTitle()}\n </h3>\n <div\n class=\"description-container ${this.isMobile\n ? \"header-container-mobile description-mobile\"\n : \"header-container-desktop description-desktop\"}\"\n >\n <span class=\"description\" part=\"description\">\n ${localizeUserString(this.configLang, data?.config?.web?.additionalStrings?.[\"ctaMessage\"] || \"\") ||\n strings[this.configLang].ctaMessage()}\n </span>\n <span class=\"description-prefix\" part=\"description\">\n ${localizeUserString(this.configLang, data?.config?.web?.additionalStrings?.[\"ctaMessagePrefix\"] || \"\") ||\n strings[this.configLang].ctaMessagePrefix()}\n </span>\n </div>\n </div>\n <div class=\"root\">\n <div\n tabindex=\"-1\"\n class=\"options cardGrid\"\n part=\"options\"\n role=\"radiogroup\"\n aria-labelledby=\"beam-SelectSubscriptionNonprofit-title\"\n ?aria-disabled=${!this.allowChange}\n >\n ${repeat(\n nonprofits,\n (i) => i.nonprofit.id,\n (np, index) => {\n const isSelected = selectedNonprofitId === np.nonprofit.id;\n const isFocusable = isSelected || (selectedNonprofit == null && index === 0);\n const unselectedIcon = np.nonprofit.causeIconUrl;\n const selectedIcon = np.nonprofit.causeIconSelectedUrl;\n const cardImage = np.imageUrl;\n const iconImage = cardStyle === \"'selected_icon'\" ? selectedIcon : unselectedIcon;\n return html`\n <div\n class=\"option ${classMap({\n isSelected: isSelected,\n isDisabled: !this.allowChange,\n })}\"\n part=\"option\"\n role=\"radio\"\n tabindex=\"${isFocusable ? 0 : -1}\"\n data-value=${np.nonprofit.id}\n ?aria-checked=${isSelected}\n @click=${this.makeHandleSelect(np.nonprofit.id, index, nonprofits)}\n @keydown=${this.makeHandleSelect(np.nonprofit.id, index, nonprofits)}\n aria-label=\"${localizeUserString(this.configLang, np.nonprofit.cause || \"\")}\"\n >\n ${displayIcon\n ? html` <div class=\"card-icon-container\">\n <div class=\"icon-background\">\n <img\n data-speedsize-ignore=\"true\"\n src=\"${iconImage}\"\n alt=\"\"\n role=\"presentation\"\n class=\"card-icon\"\n />\n </div>\n </div>`\n : html` <div class=\"card-image-container\">\n <img\n data-speedsize-ignore=\"true\"\n src=\"${cardImage}\"\n alt=\"\"\n role=\"presentation\"\n class=\"card-image\"\n />\n </div>`}\n <div class=\"card-details-container\" part=\"details\">\n <div class=\"details-cause\">\n <span part=\"checkbox\" class=\"checkbox\">\n <span style=\"line-height: 0;\"> ${_checkbox({ height: \"10px\", width: \"10px\" })} </span>\n </span>\n ${localizeUserString(this.configLang, np.nonprofit.cause || \"\")}\n </div>\n <p class=\"details-description\">\n ${unsafeHTML(localizeUserString(this.configLang, np.impact.description || \"\"))}\n </p>\n <div class=\"card-progress-bar\">\n <beam-progress-bar\n value=\"${np.impact.goalProgressPercentage}\"\n style=\"flex: 1 0;\"\n ></beam-progress-bar>\n <span class=\"details-funding-progress-label\">\n ${localizeUserString(this.configLang, np.impact.goalProgressText)}\n </span>\n </div>\n </div>\n </div>\n `;\n },\n )}\n </div>\n </div>\n <div\n id=\"footer\"\n class=\"footer ${this.isMobile ? \"sticky-footer\" : \"footer-desktop\"} ${this.isMobile &&\n !this.selectedNonprofitId\n ? \"hideStickyFooter\"\n : \"\"}\"\n >\n <button\n type=\"button\"\n ?aria-disabled=${!this.allowSubmit}\n @click=\"${this.handleSubmit}\"\n class=\"${classMap({\n isDisabled: !this.allowSubmit,\n submitButton: true,\n })}\"\n part=\"submitButton\"\n >\n ${this.subscriptionUpdateDataController.data !== null\n ? localizeUserString(\n this.configLang,\n data?.config?.web?.additionalStrings?.[\"submitButtonTextCompleted\"] || \"\",\n ) || strings[this.configLang].submitButtonTextCompleted()\n : localizeUserString(this.configLang, data?.config?.web?.additionalStrings?.[\"submitButtonText\"] || \"\") ||\n strings[this.configLang].submitButtonText()}\n </button>\n </div>\n </div>\n `;\n }\n}\n\ndefineCustomElement(BeamSelectSubscriptionNonprofit);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"beam-select-subscription-nonprofit\": BeamSelectSubscriptionNonprofit;\n }\n}\n"],"names":["_checkbox","height","width","html","styleMap","strings","donationPercentage","$","n","S","d","t","e","r","p","cacheTtl","BeamSelectSubscriptionNonprofit","LitElement","DEFAULT_BASE_URL","enforceConfig","res","postChainEligibleNonprofitsForCart","makeApiKeyHeader","LOCAL_STORAGE_KEYS","selectedNonprofitId","updateSubscription","SELECTION_METHODS","AsyncController","createScopedLocalStorage","id","index","nonprofits","event","currentId","nextFocus","focusTarget","selectedNonprofit","np","BeamNonprofitSelectEvent","WIDGET_NAMES","debounce","SUPPORTED_LANGUAGES","_changedProperties","previousPropertyValues","requireNewDataProps","prop","createdAt","data","defaults","progressBarConfigDefaults","defineCustomText","remoteConfig","config","_cssVariableMap","loading","_loading","_errorMessage","BeamError","cardStyle","displayIcon","localizeUserString","repeat","i","isSelected","isFocusable","unselectedIcon","selectedIcon","cardImage","iconImage","classMap","unsafeHTML","cssReset","css","useCustomText","cssCardGrid","__decorateClass","property","state","defineCustomElement"],"mappings":"8hBAGO,MAAMA,EAAY,CAAC,CAAE,OAAAC,EAAS,MAAO,MAAAC,EAAQ,KAAM,EAAI,CAAA,IAAOC;AAAAA;AAAAA,aAExDC,EAAS,CAAE,OAAAH,EAAQ,MAAAC,EAAO,SAAU,WAAY,OAAQ,GAAI,CAAC,CAAC;AAAA;AAAA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,MAkExFC,EAAY,CACV,IAAK,sDACL,aAAc,2DACd,YAAa,6DACf,CAAC,CACH,EAtpBmCC,EAAA,CAAlCC,EAAS,CAAE,KAAM,MAAO,CAAC,CAAA,EAHf5D,EAGwB,UAAA,SAAA,EACA2D,EAAA,CAAlCC,EAAS,CAAE,KAAM,MAAO,CAAC,CAAA,EAJf5D,EAIwB,UAAA,QAAA,EACA2D,EAAA,CAAlCC,EAAS,CAAE,KAAM,MAAO,CAAC,CAAA,EALf5D,EAKwB,UAAA,gBAAA,EACA2D,EAAA,CAAlCC,EAAS,CAAE,KAAM,MAAO,CAAC,CAAA,EANf5D,EAMwB,UAAA,SAAA,EACA2D,EAAA,CAAlCC,EAAS,CAAE,KAAM,MAAO,CAAC,CAAA,EAPf5D,EAOwB,yBACA2D,EAAA,CAAlCC,EAAS,CAAE,KAAM,MAAO,CAAC,CAAA,EARf5D,EAQwB,UAAA,YAAA,EACe2D,EAAA,CAAjDC,EAAS,CAAE,KAAM,OAAQ,QAAS,EAAK,CAAC,CAAA,EAT9B5D,EASuC,UAAA,qBAAA,EACf2D,EAAA,CAAlCC,EAAS,CAAE,KAAM,MAAO,CAAC,CAAA,EAVf5D,EAUwB,UAAA,MAAA,EACC2D,EAAA,CAAnCC,EAAS,CAAE,KAAM,OAAQ,CAAC,CAAA,EAXhB5D,EAWyB,UAAA,aAAA,EACA2D,EAAA,CAAnCC,EAAS,CAAE,KAAM,OAAQ,CAAC,CAAA,EAZhB5D,EAYyB,UAAA,OAAA,EACnB2D,EAAA,CAAhBE,EAAAA,CAAM,EAbI7D,EAaM,UAAA,UAAA,EAwzBnB8D,EAAoB9D,CAA+B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{g as t,a as r,w as e}from"../chunks/utils-ly9wMwUO.esm.js";import{e as x,b as S}from"../chunks/utils-ly9wMwUO.esm.js";import{M as y,p as F,a as M,J as c,b as E,L as I,O as L,r as O,s as V,o as v}from"../chunks/index-
|
|
1
|
+
import{g as t,a as r,w as e}from"../chunks/utils-ly9wMwUO.esm.js";import{e as x,b as S}from"../chunks/utils-ly9wMwUO.esm.js";import{M as y,p as F,a as M,J as c,b as E,L as I,O as L,r as O,s as V,o as v}from"../chunks/index-V9dChqUp.esm.js";import{s as N}from"../chunks/index-DTyLbt9G.esm.js";import"../chunks/lodash-CrMU6wKg.esm.js";import"../react/shopify.esm.js";import"../chunks/vendor-DUOg5fL-.esm.js";import"../chunks/lit-BEag9MFp.esm.js";import"../chunks/index-Sf0H3S19.esm.js";import"../chunks/index-CJHnWESF.esm.js";import"../chunks/css-card-grid-tjA36yWj.esm.js";import"../chunks/index-DmjV4fgN.esm.js";import"../chunks/share-button-BL75HPEy.esm.js";import"./beam-partner-logos.esm.js";import"../chunks/promo-pill-label-RMzmFdBU.esm.js";import"../chunks/_share-dialog-dependencies-92ZYF2h0.esm.js";import"./impact-overview.esm.js";import"../chunks/share-button-B1UbCVJc.esm.js";import"../chunks/responsive-aN8P5PqD.esm.js";const a={waitForElement:e,getCookieMap:r,getCookieValue:t};export{y as addBeamAttributesToCart,F as appendBeamAttributesToCart,M as appendStatsigToShopifyCartAttributes,c as appendToShopifyCartBeamAttribute,x as events,E as getBeamAttributesForCart,I as getCurrentCart,L as getShopifyCart,S as initNetworkListeners,O as registerCartIntegration,N as showBeamOrderPageWidgets,V as trackCart,v as unregisterCartIntegration,a as utils};
|
|
2
2
|
//# sourceMappingURL=shopify.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{g as t,a as r,w as e}from"../chunks/utils-ly9wMwUO.esm.js";import{e as x,b as S}from"../chunks/utils-ly9wMwUO.esm.js";import{M as y,p as F,a as M,J as c,b as E,L as I,O as L,r as O,s as V,o as v}from"../chunks/index-
|
|
1
|
+
import{g as t,a as r,w as e}from"../chunks/utils-ly9wMwUO.esm.js";import{e as x,b as S}from"../chunks/utils-ly9wMwUO.esm.js";import{M as y,p as F,a as M,J as c,b as E,L as I,O as L,r as O,s as V,o as v}from"../chunks/index-BMRRnPOO.esm.js";import{s as N}from"../chunks/index-CCeRUzcY.esm.js";import"../chunks/lodash-CrMU6wKg.esm.js";import"../react/shopify.js";import"../chunks/vendor-DUOg5fL-.esm.js";import"../chunks/lit-BEag9MFp.esm.js";import"../chunks/index-Sf0H3S19.esm.js";import"../chunks/index-CJHnWESF.esm.js";import"../chunks/css-card-grid-tjA36yWj.esm.js";import"../chunks/index-BN0CMrZb.esm.js";import"../chunks/share-button-BL75HPEy.esm.js";import"./beam-partner-logos.js";import"../chunks/promo-pill-label-RMzmFdBU.esm.js";import"../chunks/_share-dialog-dependencies-92ZYF2h0.esm.js";import"./impact-overview.js";import"../chunks/share-button-B1UbCVJc.esm.js";import"../chunks/responsive-aN8P5PqD.esm.js";const a={waitForElement:e,getCookieMap:r,getCookieValue:t};export{y as addBeamAttributesToCart,F as appendBeamAttributesToCart,M as appendStatsigToShopifyCartAttributes,c as appendToShopifyCartBeamAttribute,x as events,E as getBeamAttributesForCart,I as getCurrentCart,L as getShopifyCart,S as initNetworkListeners,O as registerCartIntegration,N as showBeamOrderPageWidgets,V as trackCart,v as unregisterCartIntegration,a as utils};
|
|
2
2
|
//# sourceMappingURL=shopify.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as m,n as s,r as n,a as g,b}from"../chunks/lit-BEag9MFp.esm.js";import"../chunks/vendor-DUOg5fL-.esm.js";import"../chunks/_share-dialog-dependencies-
|
|
1
|
+
import{i as m,n as s,r as n,a as g,b}from"../chunks/lit-BEag9MFp.esm.js";import"../chunks/vendor-DUOg5fL-.esm.js";import"../chunks/_share-dialog-dependencies-92ZYF2h0.esm.js";import{u as d,s as r,p}from"../chunks/share-button-BL75HPEy.esm.js";import"./beam-partner-logos.esm.js";import{c as f,d as y,e as u}from"../chunks/css-card-grid-tjA36yWj.esm.js";import{g as w,_ as x}from"../chunks/index-Sf0H3S19.esm.js";import{D as I,x as U,W as S}from"../chunks/utils-ly9wMwUO.esm.js";import"../chunks/lodash-CrMU6wKg.esm.js";var k=Object.defineProperty,a=(l,t,i,v)=>{for(var o=void 0,c=l.length-1,h;c>=0;c--)(h=l[c])&&(o=h(t,i,o)||o);return o&&k(t,i,o),o};class e extends g{constructor(){super(...arguments),this.baseUrl=I,this.lang="en",this.debug=!1,this.brandName=null,this.shareImageUrl=null,this.isMobile=!1,this.windowResized=!1,this.checkViewport=()=>{this.windowResized=window.innerWidth<=768}}get configLang(){return U[this.lang]||"en"}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.checkViewport),this.checkViewport()}disconnectedCallback(){window.removeEventListener("resize",this.checkViewport),super.disconnectedCallback()}async fetchImpactData(){u(["apiKey","storeId","nonprofitId"],this);try{return await w({baseUrl:this.baseUrl,headers:{authorization:`Api-Key ${this.apiKey}`},queryParams:{storeId:this.storeId,personalImpactLimit:0,nonprofitId:this.nonprofitId,widgetName:S.community_impact,version:"1.0.0",lang:this.configLang,transactionId:this.transactionId??void 0}})}catch(t){throw this.debug&&console.error("Failed to fetch impact data",t),t}}async updateImpactData(){try{const t=await this.fetchImpactData();if(t&&(this.brandName=t.chain.name,this.shareImageUrl=t.promoAssetUrl||t.personalImpactAssetUrl||t.community[0].share.imageUrl,this.shareImageUrl)){const i=await d(this.shareImageUrl);this.file=i,this.dataUrl=URL.createObjectURL(i)}}catch(t){this.debug&&console.error("Error updating impact data:",t)}}async firstUpdated(){await this.updateImpactData(),this.isMobile=/Mobi|Android/i.test(navigator.userAgent)||"ontouchstart"in window||navigator.maxTouchPoints>0}async openSystemShareSheet(t){if(t)try{const i=await d(t);navigator.share&&this.brandName&&await navigator.share({files:[i],title:r[this.lang].impactShareTitle(),text:r[this.lang].impactShareText({brandName:this.brandName})})}catch(i){this.debug&&console.error("Failed to open share sheet",i)}}async handleClickCopy(){if(this.file)try{this.apiKey&&this.transactionId?p({baseUrl:this.baseUrl,apiKey:this.apiKey||"",requestBody:{eventName:"ExtensibilityCopyImageButtonClick",nonprofitId:this.nonprofitId,storeId:this.storeId,timestamp:Date.now(),transactionId:Number(this.transactionId)}}).catch(()=>null):console.error("Missing data for social share analytics. Skipping send"),await navigator.clipboard.write([new ClipboardItem({"image/png":this.file})])}catch(t){this.debug&&console.error("Failed to copy image to clipboard:",t)}}handleClickDownload(t){this.apiKey&&this.transactionId?p({baseUrl:this.baseUrl,apiKey:this.apiKey||"",requestBody:{eventName:"ExtensibilityDownloadImageButtonClick",nonprofitId:this.nonprofitId,storeId:this.storeId,timestamp:Date.now(),transactionId:Number(this.transactionId)}}).catch(()=>null):console.error("Missing data for social share analytics. Skipping send");const i=t.currentTarget;this.isMobile&&this.shareImageUrl?(t.preventDefault(),this.openSystemShareSheet(this.shareImageUrl)):this.dataUrl&&(i.href=this.dataUrl,i.download=r[this.lang].impactShareTitle())}render(){return!this.brandName||!this.shareImageUrl||!this.dataUrl?x():b`
|
|
2
2
|
<div class="share-container ${this.windowResized||this.isMobile?"mobile":"desktop"}">
|
|
3
3
|
<h2 class="share-title">${r[this.lang].impactShareTitle()}</h2>
|
|
4
4
|
<p class="share-text">${r[this.lang].impactShareText({brandName:this.brandName})}</p>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as m,n as s,r as n,a as g,b}from"../chunks/lit-BEag9MFp.esm.js";import"../chunks/vendor-DUOg5fL-.esm.js";import"../chunks/_share-dialog-dependencies-
|
|
1
|
+
import{i as m,n as s,r as n,a as g,b}from"../chunks/lit-BEag9MFp.esm.js";import"../chunks/vendor-DUOg5fL-.esm.js";import"../chunks/_share-dialog-dependencies-92ZYF2h0.esm.js";import{u as d,s as r,p}from"../chunks/share-button-BL75HPEy.esm.js";import"./beam-partner-logos.js";import{c as f,d as y,e as u}from"../chunks/css-card-grid-tjA36yWj.esm.js";import{g as w,_ as x}from"../chunks/index-Sf0H3S19.esm.js";import{D as I,x as U,W as S}from"../chunks/utils-ly9wMwUO.esm.js";import"../chunks/lodash-CrMU6wKg.esm.js";var k=Object.defineProperty,a=(l,t,i,v)=>{for(var o=void 0,c=l.length-1,h;c>=0;c--)(h=l[c])&&(o=h(t,i,o)||o);return o&&k(t,i,o),o};class e extends g{constructor(){super(...arguments),this.baseUrl=I,this.lang="en",this.debug=!1,this.brandName=null,this.shareImageUrl=null,this.isMobile=!1,this.windowResized=!1,this.checkViewport=()=>{this.windowResized=window.innerWidth<=768}}get configLang(){return U[this.lang]||"en"}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.checkViewport),this.checkViewport()}disconnectedCallback(){window.removeEventListener("resize",this.checkViewport),super.disconnectedCallback()}async fetchImpactData(){u(["apiKey","storeId","nonprofitId"],this);try{return await w({baseUrl:this.baseUrl,headers:{authorization:`Api-Key ${this.apiKey}`},queryParams:{storeId:this.storeId,personalImpactLimit:0,nonprofitId:this.nonprofitId,widgetName:S.community_impact,version:"1.0.0",lang:this.configLang,transactionId:this.transactionId??void 0}})}catch(t){throw this.debug&&console.error("Failed to fetch impact data",t),t}}async updateImpactData(){try{const t=await this.fetchImpactData();if(t&&(this.brandName=t.chain.name,this.shareImageUrl=t.promoAssetUrl||t.personalImpactAssetUrl||t.community[0].share.imageUrl,this.shareImageUrl)){const i=await d(this.shareImageUrl);this.file=i,this.dataUrl=URL.createObjectURL(i)}}catch(t){this.debug&&console.error("Error updating impact data:",t)}}async firstUpdated(){await this.updateImpactData(),this.isMobile=/Mobi|Android/i.test(navigator.userAgent)||"ontouchstart"in window||navigator.maxTouchPoints>0}async openSystemShareSheet(t){if(t)try{const i=await d(t);navigator.share&&this.brandName&&await navigator.share({files:[i],title:r[this.lang].impactShareTitle(),text:r[this.lang].impactShareText({brandName:this.brandName})})}catch(i){this.debug&&console.error("Failed to open share sheet",i)}}async handleClickCopy(){if(this.file)try{this.apiKey&&this.transactionId?p({baseUrl:this.baseUrl,apiKey:this.apiKey||"",requestBody:{eventName:"ExtensibilityCopyImageButtonClick",nonprofitId:this.nonprofitId,storeId:this.storeId,timestamp:Date.now(),transactionId:Number(this.transactionId)}}).catch(()=>null):console.error("Missing data for social share analytics. Skipping send"),await navigator.clipboard.write([new ClipboardItem({"image/png":this.file})])}catch(t){this.debug&&console.error("Failed to copy image to clipboard:",t)}}handleClickDownload(t){this.apiKey&&this.transactionId?p({baseUrl:this.baseUrl,apiKey:this.apiKey||"",requestBody:{eventName:"ExtensibilityDownloadImageButtonClick",nonprofitId:this.nonprofitId,storeId:this.storeId,timestamp:Date.now(),transactionId:Number(this.transactionId)}}).catch(()=>null):console.error("Missing data for social share analytics. Skipping send");const i=t.currentTarget;this.isMobile&&this.shareImageUrl?(t.preventDefault(),this.openSystemShareSheet(this.shareImageUrl)):this.dataUrl&&(i.href=this.dataUrl,i.download=r[this.lang].impactShareTitle())}render(){return!this.brandName||!this.shareImageUrl||!this.dataUrl?x():b`
|
|
2
2
|
<div class="share-container ${this.windowResized||this.isMobile?"mobile":"desktop"}">
|
|
3
3
|
<h2 class="share-title">${r[this.lang].impactShareTitle()}</h2>
|
|
4
4
|
<p class="share-text">${r[this.lang].impactShareText({brandName:this.brandName})}</p>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{h as A,i as E,n as d,r as T,a as L,b as N,k as H,j as U}from"../chunks/lit-BEag9MFp.esm.js";import{d as P,u as h,h as B,j as z,k as _,A as C,e as g,f as W,_ as K,c as D}from"../chunks/index-tkscjKkq.esm.js";import{D as O,W as k,y as w,z as R,B as j,x as F}from"../chunks/utils-ly9wMwUO.esm.js";import{c as q,d as G,e as v}from"../chunks/css-card-grid-tjA36yWj.esm.js";import{a as V}from"../chunks/share-button-DP2wLhmP.esm.js";import{c as J}from"../chunks/responsive-aN8P5PqD.esm.js";import{h as o,g as $}from"../chunks/handlebars-3tRO54kz.esm.js";import"../chunks/lodash-CrMU6wKg.esm.js";const M={long:"dddd, MMMM D, YYYY",short:"MMM D, YYYY",numeric:"MM/DD/YYYY",iso:"YYYY-MM-DD",time:"h:mm A",time24:"HH:mm",datetime:"MMMM D, YYYY h:mm A",month:"MMMM YYYY",monthShort:"MMM YYYY",dayMonth:"MMMM D"},x=(t,e)=>{const r=M[e??"long"]??e??M.long;return $(t).format(r)};o.registerHelper("currentDate",t=>x(new Date,typeof t=="string"?t:void 0)),o.registerHelper("nextMonth",t=>{const e=$().add(1,"month").toDate();return x(e,typeof t=="string"?t:void 0)}),o.registerHelper("dateOffset",(t,e,r)=>{const s=typeof e=="string"?e:void 0,i=(typeof e=="string"?r:e)?.hash?.from,n=i?new Date(i):new Date,p=$(n).add(t,"day").toDate();return s==="relative"?t===-1?"yesterday":t===0?"today":t===1?"tomorrow":t<0?`${Math.abs(t)} days ago`:`${t} days from now`:x(p,s)}),o.registerHelper("formatDate",(t,e)=>{const r=t instanceof Date?t:new Date(t);return isNaN(r.getTime())?"":x(r,typeof e=="string"?e:void 0)}),o.registerHelper("color",(t,e)=>{const r=o.escapeExpression(e),s=o.escapeExpression(t);return new o.SafeString(`<span style="color:${s}">${r}</span>`)}),o.registerHelper("br",()=>new o.SafeString("<br>")),o.registerHelper("bold",t=>{const e=o.escapeExpression(t);return new o.SafeString(`<strong>${e}</strong>`)}),o.registerHelper("italic",t=>{const e=o.escapeExpression(t);return new o.SafeString(`<em>${e}</em>`)}),o.registerHelper("underline",t=>{const e=o.escapeExpression(t);return new o.SafeString(`<span style="text-decoration:underline">${e}</span>`)}),o.registerHelper("strikethrough",t=>{const e=o.escapeExpression(t);return new o.SafeString(`<s>${e}</s>`)}),o.registerHelper("uppercase",t=>{const e=o.escapeExpression(t);return new o.SafeString(`<span style="text-transform:uppercase">${e}</span>`)}),o.registerHelper("lowercase",t=>{const e=o.escapeExpression(t);return new o.SafeString(`<span style="text-transform:lowercase">${e}</span>`)}),o.registerHelper("capitalize",t=>{const e=String(t??""),r=e.charAt(0).toUpperCase()+e.slice(1);return new o.SafeString(o.escapeExpression(r))}),o.registerHelper("style",(t,e)=>{const{bold:r,italic:s,underline:i,strikethrough:n,uppercase:p,lowercase:a,color:m,fontSize:f,fontFamily:y}=e.hash;let b=o.escapeExpression(t);r&&(b=`<strong>${b}</strong>`),s&&(b=`<em>${b}</em>`),n&&(b=`<s>${b}</s>`);const u=[];return i&&u.push("text-decoration:underline"),p&&u.push("text-transform:uppercase"),a&&u.push("text-transform:lowercase"),m&&u.push(`color:${o.escapeExpression(m)}`),f&&u.push(`font-size:${o.escapeExpression(f)}`),y&&u.push(`font-family:${o.escapeExpression(y)}`),u.length&&(b=`<span style="${u.join(";")}">${b}</span>`),new o.SafeString(b)});const Q="en",Y=(t,e={},r="")=>{const s=e.lang||Q,i=t||r,n=P(s,i)??i;return o.compile(n)(e)},S=(t,e={},r="")=>A(Y(t,e,r)),I={en:{beamAttribution:()=>"Powered by Beam",ctaTitle:()=>"Choose Your Impact",ctaMessage:({donationPercentage:t="1%"}={})=>`Choose a nonprofit and ${t} will be donated there for you,at no extra cost, with every order of your subscription.`},fr:{beamAttribution:()=>"Optimis\xE9 par Beam",ctaTitle:()=>"Choose Your Impact",ctaMessage:({donationPercentage:t="1%"}={})=>`Choose a nonprofit and ${t} will be donated there for you,at no extra cost, with every order of your subscription.`},de:{beamAttribution:()=>"Unterst\xFCtzt von Beam",ctaTitle:()=>"Choose Your Impact",ctaMessage:({donationPercentage:t="1%"}={})=>`Choose a nonprofit and ${t} will be donated there for you,at no extra cost, with every order of your subscription.`},es:{beamAttribution:()=>"Desarrollado por Beam",ctaTitle:()=>"Choose Your Impact",ctaMessage:({donationPercentage:t="1%"}={})=>`Choose a nonprofit and ${t} will be donated there for you,at no extra cost, with every order of your subscription.`},it:{beamAttribution:()=>"Offerto da Beam",ctaTitle:()=>"Choose Your Impact",ctaMessage:({donationPercentage:t="1%"}={})=>`Choose a nonprofit and ${t} will be donated there for you,at no extra cost, with every order of your subscription.`},pl:{beamAttribution:()=>"Wspierane przez Beam",ctaTitle:()=>"Choose Your Impact",ctaMessage:({donationPercentage:t="1%"}={})=>`Choose a nonprofit and ${t} will be donated there for you,at no extra cost, with every order of your subscription.`},ja:{beamAttribution:()=>"Powered by Beam",ctaTitle:()=>"Choose Your Impact",ctaMessage:({donationPercentage:t="1%"}={})=>`Choose a nonprofit and ${t} will be donated there for you,at no extra cost, with every order of your subscription.`}};var X=Object.defineProperty,c=(t,e,r,s)=>{for(var i=void 0,n=t.length-1,p;n>=0;n--)(p=t[n])&&(i=p(e,r,i)||i);return i&&X(e,r,i),i};class l extends L{constructor(){super(...arguments),this.baseUrl=O,this.lang="en",this.debug=!1,this.draftConfig=!1,this.templateData={},this.chain={},this.subscriptionLookup=Promise.resolve(),this.getChainNonprofits=async()=>{v(["apiKey","subscriptionId"],this);const e=await B({baseUrl:this.baseUrl,headers:w(this.apiKey),requestBody:{storeId:this.storeId,widgetName:k.subscriber_select_nonprofit,...this.postalCode&&{postalCode:this.postalCode},...this.countryCode&&{countryCode:this.countryCode},version:"1.0.0",lang:this.configLang,options:{config:{draftConfig:this.draftConfig}}}});if(e.store?.id&&e.store.id!==this.storeId&&(this.storeId=e.store.id),await this.subscriptionLookup,this.selectedNonprofitId!=null&&!e.nonprofits.map(r=>r.nonprofit.id).includes(this.selectedNonprofitId)&&(this.selectedNonprofitId=void 0),this.selectedNonprofitId==null&&this.preselectNonprofitAtIndex!=null){const r=e.nonprofits[this.preselectNonprofitAtIndex-1];r&&(this.selectedNonprofitId=r.nonprofit.id,await this.selectionDataController.exec({selectedNonprofitId:r.nonprofit.id}))}return this.chain={...e?.chain},e},this.fetchSubscription=async()=>{v(["apiKey","subscriptionId"],this);const e=await z({baseUrl:this.baseUrl,headers:w(this.apiKey),requestBody:{remoteSubscriptionId:this.subscriptionId,email:this.email,partnerUserId:this.partnerUserId}});return e.nonprofit?.id&&this.selectedNonprofitId===void 0&&(this.selectedNonprofitId=e.nonprofit.id),e},this.updateNonprofitForSubscription=async({selectedNonprofitId:e})=>{v(["apiKey","subscriptionId"],this);const r=await _({baseUrl:this.baseUrl,headers:w(this.apiKey),requestBody:{remoteSubscriptionId:this.subscriptionId,nonprofitId:e,selectionMethod:R.subscriber_select_nonprofit_widget}});await this.updateComplete;const s=this.getNonprofitById(e);return this.dispatchEvent(new j({selectedNonprofitId:e,nonprofitName:s?.nonprofit?.name??null,source:k.subscriber_select_nonprofit,timestamp:new Date})),r},this.nonprofitListDataController=new C(this,this.getChainNonprofits),this.subscriptionDataController=new C(this,this.fetchSubscription),this.selectionDataController=new C(this,this.updateNonprofitForSubscription),this.makeHandleSelect=(e,r,s)=>async i=>{const n=this.selectedNonprofitId;if(i instanceof KeyboardEvent){let p=null;switch(i.key){case"ArrowUp":case"ArrowLeft":p=r===0?s[s.length-1]:s[r-1],i.preventDefault();break;case"ArrowRight":case"ArrowDown":p=r===s.length-1?s[0]:s[r+1],i.preventDefault();break;case"Enter":case" ":i.preventDefault();break;default:return}if(p){n!=null&&(this.selectedNonprofitId=p.nonprofit.id);const a=this.renderRoot.querySelector(`[data-value="${p.nonprofit.id}"]`);a!==null&&(a.tabIndex=0,a.focus());return}}!(i.currentTarget instanceof HTMLElement)||n===e||(this.selectedNonprofitId=e,await this.selectionDataController.exec({selectedNonprofitId:e}))}}get configLang(){return F[this.lang]||"en"}getNonprofitById(e){return e?this.nonprofitListDataController?.data?.nonprofits.find(r=>r.nonprofit.id===e):null}async connectedCallback(){super.connectedCallback(),this.nonprofitListDataController.loading=!0}async firstUpdated(){!this.apiKey||!this.email&&!this.partnerUserId||(this.subscriptionLookup=this.subscriptionDataController.exec(),await this.subscriptionLookup)}async updated(e){const r=["baseUrl","storeId","apiKey","countryCode","postalCode","lang"];for(const s of r)if(e.has(s)){await this.nonprofitListDataController.exec();break}}disconnectedCallback(){super.disconnectedCallback()}get cssVariables(){const e={"--beam-fontFamily":"inherit","--beam-fontStyle":"inherit","--beam-fontSize":"inherit","--beam-textColor":"inherit","--beam-backgroundColor":"inherit",...V,"--beam-SubscriberSelectNonprofit-title-textAlign":"inherit","--beam-SubscriberSelectNonprofit-description-textAlign":"inherit","--beam-SubscriberSelectNonprofit-maxWidth":"800px","--beam-SubscriberSelectNonprofit-options-marginTop":"0px","--beam-SubscriberSelectNonprofit-options-iconHeight":"20px","--beam-SubscriberSelectNonprofit-options-padding":"6px 4px","--beam-SubscriberSelectNonprofit-options-borderRadius":"4px","--beam-SubscriberSelectNonprofit-options-borderColor":"currentColor","--beam-SubscriberSelectNonprofit-options-borderWidth":"1px","--beam-SubscriberSelectNonprofit-options--selected-borderColor":"currentColor","--beam-SubscriberSelectNonprofit-options-backgroundColor":"transparent","--beam-SubscriberSelectNonprofit-options-gap":"8px","--beam-SubscriberSelectNonprofit-options-margin":"14px 0 0 0","--beam-SubscriberSelectNonprofit-width":"100%","--beam-SubscriberSelectNonprofit-options--selected-backgroundColor":"currentColor","--beam-SubscriberSelectNonprofit-details-marginTop":"6px","--beam-SubscriberSelectNonprofit-details-borderRadius":"4px","--beam-SubscriberSelectNonprofit-details-borderWidth":"1px","--beam-SubscriberSelectNonprofit-details-borderColor":"currentColor","--beam-SubscriberSelectNonprofit-details-backgroundColor":"inherit","--beam-SubscriberSelectNonprofit-details-padding":"10px",...g("--beam-SubscriberSelectNonprofit-title",{fontSize:"1em",fontWeight:"bold"}),...g("--beam-SubscriberSelectNonprofit-description",{marginTop:"1em",fontSize:".85em"}),"--beam-SubscriberSelectNonprofit-title-block-margin-right":"8px",...g("--beam-SubscriberSelectNonprofit-details-cause",{fontSize:"0.85em",fontWeight:"bold",textTransform:"uppercase"}),...g("--beam-SubscriberSelectNonprofit-details-beamAttribution",{fontSize:"0.85em"}),...g("--beam-SubscriberSelectNonprofit-details-impactDescription",{fontSize:".85em",marginTop:"10px",lineHeight:"normal"}),"--beam-SubscriberSelectNonprofit-details-nonprofitName-fontWeight":"bold","--beam-SubscriberSelectNonprofit-details-nonprofitName-fontStyle":"inherit","--beam-SubscriberSelectNonprofit-details-fundingProgress-marginTop":"10px",...g("--beam-SubscriberSelectNonprofit-details-fundingProgressLabel",{fontSize:"0.85em"})},r=this.nonprofitListDataController?.data?.config?.web?.theme||{},s={...e,...r};return Object.assign(Object.create({toCSS(){return W(this)}}),s)}render(){if(!this.apiKey||!this.email&&!this.partnerUserId)return N``;const{selectedNonprofitId:e}=this,{data:r,loading:s}=this.nonprofitListDataController;if(s&&!r)return K();if(this.nonprofitListDataController.error)return this.debug?D({error:this.nonprofitListDataController.error}):"";if(this.selectionDataController.error&&this.debug)return D({error:this.selectionDataController.error});const i=r?.nonprofits||[],n=i.find(a=>a.nonprofit.id===e)||null,p={custom:{...this.templateData},chain:{...this.chain},selectedNonprofit:{...n?.nonprofit},lang:this.configLang};return N`
|
|
1
|
+
import{h as A,i as E,n as d,r as T,a as L,b as N,k as H,j as U}from"../chunks/lit-BEag9MFp.esm.js";import{d as P,u as h,h as B,j as z,k as _,A as C,e as g,f as W,_ as K,c as D}from"../chunks/index-Sf0H3S19.esm.js";import{D as O,W as k,y as w,z as R,B as j,x as F}from"../chunks/utils-ly9wMwUO.esm.js";import{c as q,d as G,e as v}from"../chunks/css-card-grid-tjA36yWj.esm.js";import{a as V}from"../chunks/share-button-BL75HPEy.esm.js";import{c as J}from"../chunks/responsive-aN8P5PqD.esm.js";import{h as o,g as $}from"../chunks/handlebars-3tRO54kz.esm.js";import"../chunks/lodash-CrMU6wKg.esm.js";const M={long:"dddd, MMMM D, YYYY",short:"MMM D, YYYY",numeric:"MM/DD/YYYY",iso:"YYYY-MM-DD",time:"h:mm A",time24:"HH:mm",datetime:"MMMM D, YYYY h:mm A",month:"MMMM YYYY",monthShort:"MMM YYYY",dayMonth:"MMMM D"},x=(t,e)=>{const r=M[e??"long"]??e??M.long;return $(t).format(r)};o.registerHelper("currentDate",t=>x(new Date,typeof t=="string"?t:void 0)),o.registerHelper("nextMonth",t=>{const e=$().add(1,"month").toDate();return x(e,typeof t=="string"?t:void 0)}),o.registerHelper("dateOffset",(t,e,r)=>{const s=typeof e=="string"?e:void 0,i=(typeof e=="string"?r:e)?.hash?.from,n=i?new Date(i):new Date,p=$(n).add(t,"day").toDate();return s==="relative"?t===-1?"yesterday":t===0?"today":t===1?"tomorrow":t<0?`${Math.abs(t)} days ago`:`${t} days from now`:x(p,s)}),o.registerHelper("formatDate",(t,e)=>{const r=t instanceof Date?t:new Date(t);return isNaN(r.getTime())?"":x(r,typeof e=="string"?e:void 0)}),o.registerHelper("color",(t,e)=>{const r=o.escapeExpression(e),s=o.escapeExpression(t);return new o.SafeString(`<span style="color:${s}">${r}</span>`)}),o.registerHelper("br",()=>new o.SafeString("<br>")),o.registerHelper("bold",t=>{const e=o.escapeExpression(t);return new o.SafeString(`<strong>${e}</strong>`)}),o.registerHelper("italic",t=>{const e=o.escapeExpression(t);return new o.SafeString(`<em>${e}</em>`)}),o.registerHelper("underline",t=>{const e=o.escapeExpression(t);return new o.SafeString(`<span style="text-decoration:underline">${e}</span>`)}),o.registerHelper("strikethrough",t=>{const e=o.escapeExpression(t);return new o.SafeString(`<s>${e}</s>`)}),o.registerHelper("uppercase",t=>{const e=o.escapeExpression(t);return new o.SafeString(`<span style="text-transform:uppercase">${e}</span>`)}),o.registerHelper("lowercase",t=>{const e=o.escapeExpression(t);return new o.SafeString(`<span style="text-transform:lowercase">${e}</span>`)}),o.registerHelper("capitalize",t=>{const e=String(t??""),r=e.charAt(0).toUpperCase()+e.slice(1);return new o.SafeString(o.escapeExpression(r))}),o.registerHelper("style",(t,e)=>{const{bold:r,italic:s,underline:i,strikethrough:n,uppercase:p,lowercase:a,color:m,fontSize:f,fontFamily:y}=e.hash;let b=o.escapeExpression(t);r&&(b=`<strong>${b}</strong>`),s&&(b=`<em>${b}</em>`),n&&(b=`<s>${b}</s>`);const u=[];return i&&u.push("text-decoration:underline"),p&&u.push("text-transform:uppercase"),a&&u.push("text-transform:lowercase"),m&&u.push(`color:${o.escapeExpression(m)}`),f&&u.push(`font-size:${o.escapeExpression(f)}`),y&&u.push(`font-family:${o.escapeExpression(y)}`),u.length&&(b=`<span style="${u.join(";")}">${b}</span>`),new o.SafeString(b)});const Q="en",Y=(t,e={},r="")=>{const s=e.lang||Q,i=t||r,n=P(s,i)??i;return o.compile(n)(e)},S=(t,e={},r="")=>A(Y(t,e,r)),I={en:{beamAttribution:()=>"Powered by Beam",ctaTitle:()=>"Choose Your Impact",ctaMessage:({donationPercentage:t="1%"}={})=>`Choose a nonprofit and ${t} will be donated there for you,at no extra cost, with every order of your subscription.`},fr:{beamAttribution:()=>"Optimis\xE9 par Beam",ctaTitle:()=>"Choose Your Impact",ctaMessage:({donationPercentage:t="1%"}={})=>`Choose a nonprofit and ${t} will be donated there for you,at no extra cost, with every order of your subscription.`},de:{beamAttribution:()=>"Unterst\xFCtzt von Beam",ctaTitle:()=>"Choose Your Impact",ctaMessage:({donationPercentage:t="1%"}={})=>`Choose a nonprofit and ${t} will be donated there for you,at no extra cost, with every order of your subscription.`},es:{beamAttribution:()=>"Desarrollado por Beam",ctaTitle:()=>"Choose Your Impact",ctaMessage:({donationPercentage:t="1%"}={})=>`Choose a nonprofit and ${t} will be donated there for you,at no extra cost, with every order of your subscription.`},it:{beamAttribution:()=>"Offerto da Beam",ctaTitle:()=>"Choose Your Impact",ctaMessage:({donationPercentage:t="1%"}={})=>`Choose a nonprofit and ${t} will be donated there for you,at no extra cost, with every order of your subscription.`},pl:{beamAttribution:()=>"Wspierane przez Beam",ctaTitle:()=>"Choose Your Impact",ctaMessage:({donationPercentage:t="1%"}={})=>`Choose a nonprofit and ${t} will be donated there for you,at no extra cost, with every order of your subscription.`},ja:{beamAttribution:()=>"Powered by Beam",ctaTitle:()=>"Choose Your Impact",ctaMessage:({donationPercentage:t="1%"}={})=>`Choose a nonprofit and ${t} will be donated there for you,at no extra cost, with every order of your subscription.`}};var X=Object.defineProperty,c=(t,e,r,s)=>{for(var i=void 0,n=t.length-1,p;n>=0;n--)(p=t[n])&&(i=p(e,r,i)||i);return i&&X(e,r,i),i};class l extends L{constructor(){super(...arguments),this.baseUrl=O,this.lang="en",this.debug=!1,this.draftConfig=!1,this.templateData={},this.chain={},this.subscriptionLookup=Promise.resolve(),this.getChainNonprofits=async()=>{v(["apiKey","subscriptionId"],this);const e=await B({baseUrl:this.baseUrl,headers:w(this.apiKey),requestBody:{storeId:this.storeId,widgetName:k.subscriber_select_nonprofit,...this.postalCode&&{postalCode:this.postalCode},...this.countryCode&&{countryCode:this.countryCode},version:"1.0.0",lang:this.configLang,options:{config:{draftConfig:this.draftConfig}}}});if(e.store?.id&&e.store.id!==this.storeId&&(this.storeId=e.store.id),await this.subscriptionLookup,this.selectedNonprofitId!=null&&!e.nonprofits.map(r=>r.nonprofit.id).includes(this.selectedNonprofitId)&&(this.selectedNonprofitId=void 0),this.selectedNonprofitId==null&&this.preselectNonprofitAtIndex!=null){const r=e.nonprofits[this.preselectNonprofitAtIndex-1];r&&(this.selectedNonprofitId=r.nonprofit.id,await this.selectionDataController.exec({selectedNonprofitId:r.nonprofit.id}))}return this.chain={...e?.chain},e},this.fetchSubscription=async()=>{v(["apiKey","subscriptionId"],this);const e=await z({baseUrl:this.baseUrl,headers:w(this.apiKey),requestBody:{remoteSubscriptionId:this.subscriptionId,email:this.email,partnerUserId:this.partnerUserId}});return e.nonprofit?.id&&this.selectedNonprofitId===void 0&&(this.selectedNonprofitId=e.nonprofit.id),e},this.updateNonprofitForSubscription=async({selectedNonprofitId:e})=>{v(["apiKey","subscriptionId"],this);const r=await _({baseUrl:this.baseUrl,headers:w(this.apiKey),requestBody:{remoteSubscriptionId:this.subscriptionId,nonprofitId:e,selectionMethod:R.subscriber_select_nonprofit_widget}});await this.updateComplete;const s=this.getNonprofitById(e);return this.dispatchEvent(new j({selectedNonprofitId:e,nonprofitName:s?.nonprofit?.name??null,source:k.subscriber_select_nonprofit,timestamp:new Date})),r},this.nonprofitListDataController=new C(this,this.getChainNonprofits),this.subscriptionDataController=new C(this,this.fetchSubscription),this.selectionDataController=new C(this,this.updateNonprofitForSubscription),this.makeHandleSelect=(e,r,s)=>async i=>{const n=this.selectedNonprofitId;if(i instanceof KeyboardEvent){let p=null;switch(i.key){case"ArrowUp":case"ArrowLeft":p=r===0?s[s.length-1]:s[r-1],i.preventDefault();break;case"ArrowRight":case"ArrowDown":p=r===s.length-1?s[0]:s[r+1],i.preventDefault();break;case"Enter":case" ":i.preventDefault();break;default:return}if(p){n!=null&&(this.selectedNonprofitId=p.nonprofit.id);const a=this.renderRoot.querySelector(`[data-value="${p.nonprofit.id}"]`);a!==null&&(a.tabIndex=0,a.focus());return}}!(i.currentTarget instanceof HTMLElement)||n===e||(this.selectedNonprofitId=e,await this.selectionDataController.exec({selectedNonprofitId:e}))}}get configLang(){return F[this.lang]||"en"}getNonprofitById(e){return e?this.nonprofitListDataController?.data?.nonprofits.find(r=>r.nonprofit.id===e):null}async connectedCallback(){super.connectedCallback(),this.nonprofitListDataController.loading=!0}async firstUpdated(){!this.apiKey||!this.email&&!this.partnerUserId||(this.subscriptionLookup=this.subscriptionDataController.exec(),await this.subscriptionLookup)}async updated(e){const r=["baseUrl","storeId","apiKey","countryCode","postalCode","lang"];for(const s of r)if(e.has(s)){await this.nonprofitListDataController.exec();break}}disconnectedCallback(){super.disconnectedCallback()}get cssVariables(){const e={"--beam-fontFamily":"inherit","--beam-fontStyle":"inherit","--beam-fontSize":"inherit","--beam-textColor":"inherit","--beam-backgroundColor":"inherit",...V,"--beam-SubscriberSelectNonprofit-title-textAlign":"inherit","--beam-SubscriberSelectNonprofit-description-textAlign":"inherit","--beam-SubscriberSelectNonprofit-maxWidth":"800px","--beam-SubscriberSelectNonprofit-options-marginTop":"0px","--beam-SubscriberSelectNonprofit-options-iconHeight":"20px","--beam-SubscriberSelectNonprofit-options-padding":"6px 4px","--beam-SubscriberSelectNonprofit-options-borderRadius":"4px","--beam-SubscriberSelectNonprofit-options-borderColor":"currentColor","--beam-SubscriberSelectNonprofit-options-borderWidth":"1px","--beam-SubscriberSelectNonprofit-options--selected-borderColor":"currentColor","--beam-SubscriberSelectNonprofit-options-backgroundColor":"transparent","--beam-SubscriberSelectNonprofit-options-gap":"8px","--beam-SubscriberSelectNonprofit-options-margin":"14px 0 0 0","--beam-SubscriberSelectNonprofit-width":"100%","--beam-SubscriberSelectNonprofit-options--selected-backgroundColor":"currentColor","--beam-SubscriberSelectNonprofit-details-marginTop":"6px","--beam-SubscriberSelectNonprofit-details-borderRadius":"4px","--beam-SubscriberSelectNonprofit-details-borderWidth":"1px","--beam-SubscriberSelectNonprofit-details-borderColor":"currentColor","--beam-SubscriberSelectNonprofit-details-backgroundColor":"inherit","--beam-SubscriberSelectNonprofit-details-padding":"10px",...g("--beam-SubscriberSelectNonprofit-title",{fontSize:"1em",fontWeight:"bold"}),...g("--beam-SubscriberSelectNonprofit-description",{marginTop:"1em",fontSize:".85em"}),"--beam-SubscriberSelectNonprofit-title-block-margin-right":"8px",...g("--beam-SubscriberSelectNonprofit-details-cause",{fontSize:"0.85em",fontWeight:"bold",textTransform:"uppercase"}),...g("--beam-SubscriberSelectNonprofit-details-beamAttribution",{fontSize:"0.85em"}),...g("--beam-SubscriberSelectNonprofit-details-impactDescription",{fontSize:".85em",marginTop:"10px",lineHeight:"normal"}),"--beam-SubscriberSelectNonprofit-details-nonprofitName-fontWeight":"bold","--beam-SubscriberSelectNonprofit-details-nonprofitName-fontStyle":"inherit","--beam-SubscriberSelectNonprofit-details-fundingProgress-marginTop":"10px",...g("--beam-SubscriberSelectNonprofit-details-fundingProgressLabel",{fontSize:"0.85em"})},r=this.nonprofitListDataController?.data?.config?.web?.theme||{},s={...e,...r};return Object.assign(Object.create({toCSS(){return W(this)}}),s)}render(){if(!this.apiKey||!this.email&&!this.partnerUserId)return N``;const{selectedNonprofitId:e}=this,{data:r,loading:s}=this.nonprofitListDataController;if(s&&!r)return K();if(this.nonprofitListDataController.error)return this.debug?D({error:this.nonprofitListDataController.error}):"";if(this.selectionDataController.error&&this.debug)return D({error:this.selectionDataController.error});const i=r?.nonprofits||[],n=i.find(a=>a.nonprofit.id===e)||null,p={custom:{...this.templateData},chain:{...this.chain},selectedNonprofit:{...n?.nonprofit},lang:this.configLang};return N`
|
|
2
2
|
<style>
|
|
3
3
|
:host {
|
|
4
4
|
${this.cssVariables.toCSS()}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{h as A,i as E,n as d,r as T,a as L,b as N,k as H,j as U}from"../chunks/lit-BEag9MFp.esm.js";import{d as P,u as h,h as B,j as z,k as _,A as C,e as g,f as W,_ as K,c as D}from"../chunks/index-tkscjKkq.esm.js";import{D as O,W as k,y as w,z as R,B as j,x as F}from"../chunks/utils-ly9wMwUO.esm.js";import{c as q,d as G,e as v}from"../chunks/css-card-grid-tjA36yWj.esm.js";import{a as V}from"../chunks/share-button-DP2wLhmP.esm.js";import{c as J}from"../chunks/responsive-aN8P5PqD.esm.js";import{h as o,g as $}from"../chunks/handlebars-3tRO54kz.esm.js";import"../chunks/lodash-CrMU6wKg.esm.js";const M={long:"dddd, MMMM D, YYYY",short:"MMM D, YYYY",numeric:"MM/DD/YYYY",iso:"YYYY-MM-DD",time:"h:mm A",time24:"HH:mm",datetime:"MMMM D, YYYY h:mm A",month:"MMMM YYYY",monthShort:"MMM YYYY",dayMonth:"MMMM D"},x=(t,e)=>{const r=M[e??"long"]??e??M.long;return $(t).format(r)};o.registerHelper("currentDate",t=>x(new Date,typeof t=="string"?t:void 0)),o.registerHelper("nextMonth",t=>{const e=$().add(1,"month").toDate();return x(e,typeof t=="string"?t:void 0)}),o.registerHelper("dateOffset",(t,e,r)=>{const s=typeof e=="string"?e:void 0,i=(typeof e=="string"?r:e)?.hash?.from,n=i?new Date(i):new Date,p=$(n).add(t,"day").toDate();return s==="relative"?t===-1?"yesterday":t===0?"today":t===1?"tomorrow":t<0?`${Math.abs(t)} days ago`:`${t} days from now`:x(p,s)}),o.registerHelper("formatDate",(t,e)=>{const r=t instanceof Date?t:new Date(t);return isNaN(r.getTime())?"":x(r,typeof e=="string"?e:void 0)}),o.registerHelper("color",(t,e)=>{const r=o.escapeExpression(e),s=o.escapeExpression(t);return new o.SafeString(`<span style="color:${s}">${r}</span>`)}),o.registerHelper("br",()=>new o.SafeString("<br>")),o.registerHelper("bold",t=>{const e=o.escapeExpression(t);return new o.SafeString(`<strong>${e}</strong>`)}),o.registerHelper("italic",t=>{const e=o.escapeExpression(t);return new o.SafeString(`<em>${e}</em>`)}),o.registerHelper("underline",t=>{const e=o.escapeExpression(t);return new o.SafeString(`<span style="text-decoration:underline">${e}</span>`)}),o.registerHelper("strikethrough",t=>{const e=o.escapeExpression(t);return new o.SafeString(`<s>${e}</s>`)}),o.registerHelper("uppercase",t=>{const e=o.escapeExpression(t);return new o.SafeString(`<span style="text-transform:uppercase">${e}</span>`)}),o.registerHelper("lowercase",t=>{const e=o.escapeExpression(t);return new o.SafeString(`<span style="text-transform:lowercase">${e}</span>`)}),o.registerHelper("capitalize",t=>{const e=String(t??""),r=e.charAt(0).toUpperCase()+e.slice(1);return new o.SafeString(o.escapeExpression(r))}),o.registerHelper("style",(t,e)=>{const{bold:r,italic:s,underline:i,strikethrough:n,uppercase:p,lowercase:a,color:m,fontSize:f,fontFamily:y}=e.hash;let b=o.escapeExpression(t);r&&(b=`<strong>${b}</strong>`),s&&(b=`<em>${b}</em>`),n&&(b=`<s>${b}</s>`);const u=[];return i&&u.push("text-decoration:underline"),p&&u.push("text-transform:uppercase"),a&&u.push("text-transform:lowercase"),m&&u.push(`color:${o.escapeExpression(m)}`),f&&u.push(`font-size:${o.escapeExpression(f)}`),y&&u.push(`font-family:${o.escapeExpression(y)}`),u.length&&(b=`<span style="${u.join(";")}">${b}</span>`),new o.SafeString(b)});const Q="en",Y=(t,e={},r="")=>{const s=e.lang||Q,i=t||r,n=P(s,i)??i;return o.compile(n)(e)},S=(t,e={},r="")=>A(Y(t,e,r)),I={en:{beamAttribution:()=>"Powered by Beam",ctaTitle:()=>"Choose Your Impact",ctaMessage:({donationPercentage:t="1%"}={})=>`Choose a nonprofit and ${t} will be donated there for you,at no extra cost, with every order of your subscription.`},fr:{beamAttribution:()=>"Optimis\xE9 par Beam",ctaTitle:()=>"Choose Your Impact",ctaMessage:({donationPercentage:t="1%"}={})=>`Choose a nonprofit and ${t} will be donated there for you,at no extra cost, with every order of your subscription.`},de:{beamAttribution:()=>"Unterst\xFCtzt von Beam",ctaTitle:()=>"Choose Your Impact",ctaMessage:({donationPercentage:t="1%"}={})=>`Choose a nonprofit and ${t} will be donated there for you,at no extra cost, with every order of your subscription.`},es:{beamAttribution:()=>"Desarrollado por Beam",ctaTitle:()=>"Choose Your Impact",ctaMessage:({donationPercentage:t="1%"}={})=>`Choose a nonprofit and ${t} will be donated there for you,at no extra cost, with every order of your subscription.`},it:{beamAttribution:()=>"Offerto da Beam",ctaTitle:()=>"Choose Your Impact",ctaMessage:({donationPercentage:t="1%"}={})=>`Choose a nonprofit and ${t} will be donated there for you,at no extra cost, with every order of your subscription.`},pl:{beamAttribution:()=>"Wspierane przez Beam",ctaTitle:()=>"Choose Your Impact",ctaMessage:({donationPercentage:t="1%"}={})=>`Choose a nonprofit and ${t} will be donated there for you,at no extra cost, with every order of your subscription.`},ja:{beamAttribution:()=>"Powered by Beam",ctaTitle:()=>"Choose Your Impact",ctaMessage:({donationPercentage:t="1%"}={})=>`Choose a nonprofit and ${t} will be donated there for you,at no extra cost, with every order of your subscription.`}};var X=Object.defineProperty,c=(t,e,r,s)=>{for(var i=void 0,n=t.length-1,p;n>=0;n--)(p=t[n])&&(i=p(e,r,i)||i);return i&&X(e,r,i),i};class l extends L{constructor(){super(...arguments),this.baseUrl=O,this.lang="en",this.debug=!1,this.draftConfig=!1,this.templateData={},this.chain={},this.subscriptionLookup=Promise.resolve(),this.getChainNonprofits=async()=>{v(["apiKey","subscriptionId"],this);const e=await B({baseUrl:this.baseUrl,headers:w(this.apiKey),requestBody:{storeId:this.storeId,widgetName:k.subscriber_select_nonprofit,...this.postalCode&&{postalCode:this.postalCode},...this.countryCode&&{countryCode:this.countryCode},version:"1.0.0",lang:this.configLang,options:{config:{draftConfig:this.draftConfig}}}});if(e.store?.id&&e.store.id!==this.storeId&&(this.storeId=e.store.id),await this.subscriptionLookup,this.selectedNonprofitId!=null&&!e.nonprofits.map(r=>r.nonprofit.id).includes(this.selectedNonprofitId)&&(this.selectedNonprofitId=void 0),this.selectedNonprofitId==null&&this.preselectNonprofitAtIndex!=null){const r=e.nonprofits[this.preselectNonprofitAtIndex-1];r&&(this.selectedNonprofitId=r.nonprofit.id,await this.selectionDataController.exec({selectedNonprofitId:r.nonprofit.id}))}return this.chain={...e?.chain},e},this.fetchSubscription=async()=>{v(["apiKey","subscriptionId"],this);const e=await z({baseUrl:this.baseUrl,headers:w(this.apiKey),requestBody:{remoteSubscriptionId:this.subscriptionId,email:this.email,partnerUserId:this.partnerUserId}});return e.nonprofit?.id&&this.selectedNonprofitId===void 0&&(this.selectedNonprofitId=e.nonprofit.id),e},this.updateNonprofitForSubscription=async({selectedNonprofitId:e})=>{v(["apiKey","subscriptionId"],this);const r=await _({baseUrl:this.baseUrl,headers:w(this.apiKey),requestBody:{remoteSubscriptionId:this.subscriptionId,nonprofitId:e,selectionMethod:R.subscriber_select_nonprofit_widget}});await this.updateComplete;const s=this.getNonprofitById(e);return this.dispatchEvent(new j({selectedNonprofitId:e,nonprofitName:s?.nonprofit?.name??null,source:k.subscriber_select_nonprofit,timestamp:new Date})),r},this.nonprofitListDataController=new C(this,this.getChainNonprofits),this.subscriptionDataController=new C(this,this.fetchSubscription),this.selectionDataController=new C(this,this.updateNonprofitForSubscription),this.makeHandleSelect=(e,r,s)=>async i=>{const n=this.selectedNonprofitId;if(i instanceof KeyboardEvent){let p=null;switch(i.key){case"ArrowUp":case"ArrowLeft":p=r===0?s[s.length-1]:s[r-1],i.preventDefault();break;case"ArrowRight":case"ArrowDown":p=r===s.length-1?s[0]:s[r+1],i.preventDefault();break;case"Enter":case" ":i.preventDefault();break;default:return}if(p){n!=null&&(this.selectedNonprofitId=p.nonprofit.id);const a=this.renderRoot.querySelector(`[data-value="${p.nonprofit.id}"]`);a!==null&&(a.tabIndex=0,a.focus());return}}!(i.currentTarget instanceof HTMLElement)||n===e||(this.selectedNonprofitId=e,await this.selectionDataController.exec({selectedNonprofitId:e}))}}get configLang(){return F[this.lang]||"en"}getNonprofitById(e){return e?this.nonprofitListDataController?.data?.nonprofits.find(r=>r.nonprofit.id===e):null}async connectedCallback(){super.connectedCallback(),this.nonprofitListDataController.loading=!0}async firstUpdated(){!this.apiKey||!this.email&&!this.partnerUserId||(this.subscriptionLookup=this.subscriptionDataController.exec(),await this.subscriptionLookup)}async updated(e){const r=["baseUrl","storeId","apiKey","countryCode","postalCode","lang"];for(const s of r)if(e.has(s)){await this.nonprofitListDataController.exec();break}}disconnectedCallback(){super.disconnectedCallback()}get cssVariables(){const e={"--beam-fontFamily":"inherit","--beam-fontStyle":"inherit","--beam-fontSize":"inherit","--beam-textColor":"inherit","--beam-backgroundColor":"inherit",...V,"--beam-SubscriberSelectNonprofit-title-textAlign":"inherit","--beam-SubscriberSelectNonprofit-description-textAlign":"inherit","--beam-SubscriberSelectNonprofit-maxWidth":"800px","--beam-SubscriberSelectNonprofit-options-marginTop":"0px","--beam-SubscriberSelectNonprofit-options-iconHeight":"20px","--beam-SubscriberSelectNonprofit-options-padding":"6px 4px","--beam-SubscriberSelectNonprofit-options-borderRadius":"4px","--beam-SubscriberSelectNonprofit-options-borderColor":"currentColor","--beam-SubscriberSelectNonprofit-options-borderWidth":"1px","--beam-SubscriberSelectNonprofit-options--selected-borderColor":"currentColor","--beam-SubscriberSelectNonprofit-options-backgroundColor":"transparent","--beam-SubscriberSelectNonprofit-options-gap":"8px","--beam-SubscriberSelectNonprofit-options-margin":"14px 0 0 0","--beam-SubscriberSelectNonprofit-width":"100%","--beam-SubscriberSelectNonprofit-options--selected-backgroundColor":"currentColor","--beam-SubscriberSelectNonprofit-details-marginTop":"6px","--beam-SubscriberSelectNonprofit-details-borderRadius":"4px","--beam-SubscriberSelectNonprofit-details-borderWidth":"1px","--beam-SubscriberSelectNonprofit-details-borderColor":"currentColor","--beam-SubscriberSelectNonprofit-details-backgroundColor":"inherit","--beam-SubscriberSelectNonprofit-details-padding":"10px",...g("--beam-SubscriberSelectNonprofit-title",{fontSize:"1em",fontWeight:"bold"}),...g("--beam-SubscriberSelectNonprofit-description",{marginTop:"1em",fontSize:".85em"}),"--beam-SubscriberSelectNonprofit-title-block-margin-right":"8px",...g("--beam-SubscriberSelectNonprofit-details-cause",{fontSize:"0.85em",fontWeight:"bold",textTransform:"uppercase"}),...g("--beam-SubscriberSelectNonprofit-details-beamAttribution",{fontSize:"0.85em"}),...g("--beam-SubscriberSelectNonprofit-details-impactDescription",{fontSize:".85em",marginTop:"10px",lineHeight:"normal"}),"--beam-SubscriberSelectNonprofit-details-nonprofitName-fontWeight":"bold","--beam-SubscriberSelectNonprofit-details-nonprofitName-fontStyle":"inherit","--beam-SubscriberSelectNonprofit-details-fundingProgress-marginTop":"10px",...g("--beam-SubscriberSelectNonprofit-details-fundingProgressLabel",{fontSize:"0.85em"})},r=this.nonprofitListDataController?.data?.config?.web?.theme||{},s={...e,...r};return Object.assign(Object.create({toCSS(){return W(this)}}),s)}render(){if(!this.apiKey||!this.email&&!this.partnerUserId)return N``;const{selectedNonprofitId:e}=this,{data:r,loading:s}=this.nonprofitListDataController;if(s&&!r)return K();if(this.nonprofitListDataController.error)return this.debug?D({error:this.nonprofitListDataController.error}):"";if(this.selectionDataController.error&&this.debug)return D({error:this.selectionDataController.error});const i=r?.nonprofits||[],n=i.find(a=>a.nonprofit.id===e)||null,p={custom:{...this.templateData},chain:{...this.chain},selectedNonprofit:{...n?.nonprofit},lang:this.configLang};return N`
|
|
1
|
+
import{h as A,i as E,n as d,r as T,a as L,b as N,k as H,j as U}from"../chunks/lit-BEag9MFp.esm.js";import{d as P,u as h,h as B,j as z,k as _,A as C,e as g,f as W,_ as K,c as D}from"../chunks/index-Sf0H3S19.esm.js";import{D as O,W as k,y as w,z as R,B as j,x as F}from"../chunks/utils-ly9wMwUO.esm.js";import{c as q,d as G,e as v}from"../chunks/css-card-grid-tjA36yWj.esm.js";import{a as V}from"../chunks/share-button-BL75HPEy.esm.js";import{c as J}from"../chunks/responsive-aN8P5PqD.esm.js";import{h as o,g as $}from"../chunks/handlebars-3tRO54kz.esm.js";import"../chunks/lodash-CrMU6wKg.esm.js";const M={long:"dddd, MMMM D, YYYY",short:"MMM D, YYYY",numeric:"MM/DD/YYYY",iso:"YYYY-MM-DD",time:"h:mm A",time24:"HH:mm",datetime:"MMMM D, YYYY h:mm A",month:"MMMM YYYY",monthShort:"MMM YYYY",dayMonth:"MMMM D"},x=(t,e)=>{const r=M[e??"long"]??e??M.long;return $(t).format(r)};o.registerHelper("currentDate",t=>x(new Date,typeof t=="string"?t:void 0)),o.registerHelper("nextMonth",t=>{const e=$().add(1,"month").toDate();return x(e,typeof t=="string"?t:void 0)}),o.registerHelper("dateOffset",(t,e,r)=>{const s=typeof e=="string"?e:void 0,i=(typeof e=="string"?r:e)?.hash?.from,n=i?new Date(i):new Date,p=$(n).add(t,"day").toDate();return s==="relative"?t===-1?"yesterday":t===0?"today":t===1?"tomorrow":t<0?`${Math.abs(t)} days ago`:`${t} days from now`:x(p,s)}),o.registerHelper("formatDate",(t,e)=>{const r=t instanceof Date?t:new Date(t);return isNaN(r.getTime())?"":x(r,typeof e=="string"?e:void 0)}),o.registerHelper("color",(t,e)=>{const r=o.escapeExpression(e),s=o.escapeExpression(t);return new o.SafeString(`<span style="color:${s}">${r}</span>`)}),o.registerHelper("br",()=>new o.SafeString("<br>")),o.registerHelper("bold",t=>{const e=o.escapeExpression(t);return new o.SafeString(`<strong>${e}</strong>`)}),o.registerHelper("italic",t=>{const e=o.escapeExpression(t);return new o.SafeString(`<em>${e}</em>`)}),o.registerHelper("underline",t=>{const e=o.escapeExpression(t);return new o.SafeString(`<span style="text-decoration:underline">${e}</span>`)}),o.registerHelper("strikethrough",t=>{const e=o.escapeExpression(t);return new o.SafeString(`<s>${e}</s>`)}),o.registerHelper("uppercase",t=>{const e=o.escapeExpression(t);return new o.SafeString(`<span style="text-transform:uppercase">${e}</span>`)}),o.registerHelper("lowercase",t=>{const e=o.escapeExpression(t);return new o.SafeString(`<span style="text-transform:lowercase">${e}</span>`)}),o.registerHelper("capitalize",t=>{const e=String(t??""),r=e.charAt(0).toUpperCase()+e.slice(1);return new o.SafeString(o.escapeExpression(r))}),o.registerHelper("style",(t,e)=>{const{bold:r,italic:s,underline:i,strikethrough:n,uppercase:p,lowercase:a,color:m,fontSize:f,fontFamily:y}=e.hash;let b=o.escapeExpression(t);r&&(b=`<strong>${b}</strong>`),s&&(b=`<em>${b}</em>`),n&&(b=`<s>${b}</s>`);const u=[];return i&&u.push("text-decoration:underline"),p&&u.push("text-transform:uppercase"),a&&u.push("text-transform:lowercase"),m&&u.push(`color:${o.escapeExpression(m)}`),f&&u.push(`font-size:${o.escapeExpression(f)}`),y&&u.push(`font-family:${o.escapeExpression(y)}`),u.length&&(b=`<span style="${u.join(";")}">${b}</span>`),new o.SafeString(b)});const Q="en",Y=(t,e={},r="")=>{const s=e.lang||Q,i=t||r,n=P(s,i)??i;return o.compile(n)(e)},S=(t,e={},r="")=>A(Y(t,e,r)),I={en:{beamAttribution:()=>"Powered by Beam",ctaTitle:()=>"Choose Your Impact",ctaMessage:({donationPercentage:t="1%"}={})=>`Choose a nonprofit and ${t} will be donated there for you,at no extra cost, with every order of your subscription.`},fr:{beamAttribution:()=>"Optimis\xE9 par Beam",ctaTitle:()=>"Choose Your Impact",ctaMessage:({donationPercentage:t="1%"}={})=>`Choose a nonprofit and ${t} will be donated there for you,at no extra cost, with every order of your subscription.`},de:{beamAttribution:()=>"Unterst\xFCtzt von Beam",ctaTitle:()=>"Choose Your Impact",ctaMessage:({donationPercentage:t="1%"}={})=>`Choose a nonprofit and ${t} will be donated there for you,at no extra cost, with every order of your subscription.`},es:{beamAttribution:()=>"Desarrollado por Beam",ctaTitle:()=>"Choose Your Impact",ctaMessage:({donationPercentage:t="1%"}={})=>`Choose a nonprofit and ${t} will be donated there for you,at no extra cost, with every order of your subscription.`},it:{beamAttribution:()=>"Offerto da Beam",ctaTitle:()=>"Choose Your Impact",ctaMessage:({donationPercentage:t="1%"}={})=>`Choose a nonprofit and ${t} will be donated there for you,at no extra cost, with every order of your subscription.`},pl:{beamAttribution:()=>"Wspierane przez Beam",ctaTitle:()=>"Choose Your Impact",ctaMessage:({donationPercentage:t="1%"}={})=>`Choose a nonprofit and ${t} will be donated there for you,at no extra cost, with every order of your subscription.`},ja:{beamAttribution:()=>"Powered by Beam",ctaTitle:()=>"Choose Your Impact",ctaMessage:({donationPercentage:t="1%"}={})=>`Choose a nonprofit and ${t} will be donated there for you,at no extra cost, with every order of your subscription.`}};var X=Object.defineProperty,c=(t,e,r,s)=>{for(var i=void 0,n=t.length-1,p;n>=0;n--)(p=t[n])&&(i=p(e,r,i)||i);return i&&X(e,r,i),i};class l extends L{constructor(){super(...arguments),this.baseUrl=O,this.lang="en",this.debug=!1,this.draftConfig=!1,this.templateData={},this.chain={},this.subscriptionLookup=Promise.resolve(),this.getChainNonprofits=async()=>{v(["apiKey","subscriptionId"],this);const e=await B({baseUrl:this.baseUrl,headers:w(this.apiKey),requestBody:{storeId:this.storeId,widgetName:k.subscriber_select_nonprofit,...this.postalCode&&{postalCode:this.postalCode},...this.countryCode&&{countryCode:this.countryCode},version:"1.0.0",lang:this.configLang,options:{config:{draftConfig:this.draftConfig}}}});if(e.store?.id&&e.store.id!==this.storeId&&(this.storeId=e.store.id),await this.subscriptionLookup,this.selectedNonprofitId!=null&&!e.nonprofits.map(r=>r.nonprofit.id).includes(this.selectedNonprofitId)&&(this.selectedNonprofitId=void 0),this.selectedNonprofitId==null&&this.preselectNonprofitAtIndex!=null){const r=e.nonprofits[this.preselectNonprofitAtIndex-1];r&&(this.selectedNonprofitId=r.nonprofit.id,await this.selectionDataController.exec({selectedNonprofitId:r.nonprofit.id}))}return this.chain={...e?.chain},e},this.fetchSubscription=async()=>{v(["apiKey","subscriptionId"],this);const e=await z({baseUrl:this.baseUrl,headers:w(this.apiKey),requestBody:{remoteSubscriptionId:this.subscriptionId,email:this.email,partnerUserId:this.partnerUserId}});return e.nonprofit?.id&&this.selectedNonprofitId===void 0&&(this.selectedNonprofitId=e.nonprofit.id),e},this.updateNonprofitForSubscription=async({selectedNonprofitId:e})=>{v(["apiKey","subscriptionId"],this);const r=await _({baseUrl:this.baseUrl,headers:w(this.apiKey),requestBody:{remoteSubscriptionId:this.subscriptionId,nonprofitId:e,selectionMethod:R.subscriber_select_nonprofit_widget}});await this.updateComplete;const s=this.getNonprofitById(e);return this.dispatchEvent(new j({selectedNonprofitId:e,nonprofitName:s?.nonprofit?.name??null,source:k.subscriber_select_nonprofit,timestamp:new Date})),r},this.nonprofitListDataController=new C(this,this.getChainNonprofits),this.subscriptionDataController=new C(this,this.fetchSubscription),this.selectionDataController=new C(this,this.updateNonprofitForSubscription),this.makeHandleSelect=(e,r,s)=>async i=>{const n=this.selectedNonprofitId;if(i instanceof KeyboardEvent){let p=null;switch(i.key){case"ArrowUp":case"ArrowLeft":p=r===0?s[s.length-1]:s[r-1],i.preventDefault();break;case"ArrowRight":case"ArrowDown":p=r===s.length-1?s[0]:s[r+1],i.preventDefault();break;case"Enter":case" ":i.preventDefault();break;default:return}if(p){n!=null&&(this.selectedNonprofitId=p.nonprofit.id);const a=this.renderRoot.querySelector(`[data-value="${p.nonprofit.id}"]`);a!==null&&(a.tabIndex=0,a.focus());return}}!(i.currentTarget instanceof HTMLElement)||n===e||(this.selectedNonprofitId=e,await this.selectionDataController.exec({selectedNonprofitId:e}))}}get configLang(){return F[this.lang]||"en"}getNonprofitById(e){return e?this.nonprofitListDataController?.data?.nonprofits.find(r=>r.nonprofit.id===e):null}async connectedCallback(){super.connectedCallback(),this.nonprofitListDataController.loading=!0}async firstUpdated(){!this.apiKey||!this.email&&!this.partnerUserId||(this.subscriptionLookup=this.subscriptionDataController.exec(),await this.subscriptionLookup)}async updated(e){const r=["baseUrl","storeId","apiKey","countryCode","postalCode","lang"];for(const s of r)if(e.has(s)){await this.nonprofitListDataController.exec();break}}disconnectedCallback(){super.disconnectedCallback()}get cssVariables(){const e={"--beam-fontFamily":"inherit","--beam-fontStyle":"inherit","--beam-fontSize":"inherit","--beam-textColor":"inherit","--beam-backgroundColor":"inherit",...V,"--beam-SubscriberSelectNonprofit-title-textAlign":"inherit","--beam-SubscriberSelectNonprofit-description-textAlign":"inherit","--beam-SubscriberSelectNonprofit-maxWidth":"800px","--beam-SubscriberSelectNonprofit-options-marginTop":"0px","--beam-SubscriberSelectNonprofit-options-iconHeight":"20px","--beam-SubscriberSelectNonprofit-options-padding":"6px 4px","--beam-SubscriberSelectNonprofit-options-borderRadius":"4px","--beam-SubscriberSelectNonprofit-options-borderColor":"currentColor","--beam-SubscriberSelectNonprofit-options-borderWidth":"1px","--beam-SubscriberSelectNonprofit-options--selected-borderColor":"currentColor","--beam-SubscriberSelectNonprofit-options-backgroundColor":"transparent","--beam-SubscriberSelectNonprofit-options-gap":"8px","--beam-SubscriberSelectNonprofit-options-margin":"14px 0 0 0","--beam-SubscriberSelectNonprofit-width":"100%","--beam-SubscriberSelectNonprofit-options--selected-backgroundColor":"currentColor","--beam-SubscriberSelectNonprofit-details-marginTop":"6px","--beam-SubscriberSelectNonprofit-details-borderRadius":"4px","--beam-SubscriberSelectNonprofit-details-borderWidth":"1px","--beam-SubscriberSelectNonprofit-details-borderColor":"currentColor","--beam-SubscriberSelectNonprofit-details-backgroundColor":"inherit","--beam-SubscriberSelectNonprofit-details-padding":"10px",...g("--beam-SubscriberSelectNonprofit-title",{fontSize:"1em",fontWeight:"bold"}),...g("--beam-SubscriberSelectNonprofit-description",{marginTop:"1em",fontSize:".85em"}),"--beam-SubscriberSelectNonprofit-title-block-margin-right":"8px",...g("--beam-SubscriberSelectNonprofit-details-cause",{fontSize:"0.85em",fontWeight:"bold",textTransform:"uppercase"}),...g("--beam-SubscriberSelectNonprofit-details-beamAttribution",{fontSize:"0.85em"}),...g("--beam-SubscriberSelectNonprofit-details-impactDescription",{fontSize:".85em",marginTop:"10px",lineHeight:"normal"}),"--beam-SubscriberSelectNonprofit-details-nonprofitName-fontWeight":"bold","--beam-SubscriberSelectNonprofit-details-nonprofitName-fontStyle":"inherit","--beam-SubscriberSelectNonprofit-details-fundingProgress-marginTop":"10px",...g("--beam-SubscriberSelectNonprofit-details-fundingProgressLabel",{fontSize:"0.85em"})},r=this.nonprofitListDataController?.data?.config?.web?.theme||{},s={...e,...r};return Object.assign(Object.create({toCSS(){return W(this)}}),s)}render(){if(!this.apiKey||!this.email&&!this.partnerUserId)return N``;const{selectedNonprofitId:e}=this,{data:r,loading:s}=this.nonprofitListDataController;if(s&&!r)return K();if(this.nonprofitListDataController.error)return this.debug?D({error:this.nonprofitListDataController.error}):"";if(this.selectionDataController.error&&this.debug)return D({error:this.selectionDataController.error});const i=r?.nonprofits||[],n=i.find(a=>a.nonprofit.id===e)||null,p={custom:{...this.templateData},chain:{...this.chain},selectedNonprofit:{...n?.nonprofit},lang:this.configLang};return N`
|
|
2
2
|
<style>
|
|
3
3
|
:host {
|
|
4
4
|
${this.cssVariables.toCSS()}
|