@beamimpact/web-sdk 1.36.10 → 1.36.12
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-3mmhET8U.esm.js → _share-dialog-dependencies-6VF8H43o.esm.js} +2 -2
- package/dist/chunks/_share-dialog-dependencies-6VF8H43o.esm.js.map +1 -0
- package/dist/chunks/{_share-dialog-dependencies-3jvcgxc-.esm.js → _share-dialog-dependencies-EtRWS6m5.esm.js} +2 -2
- package/dist/chunks/_share-dialog-dependencies-EtRWS6m5.esm.js.map +1 -0
- package/dist/chunks/index-0-TeGf3K.esm.js +2 -0
- package/dist/chunks/index-0-TeGf3K.esm.js.map +1 -0
- package/dist/chunks/{index-ZiApqExt.esm.js → index-AzO-vVC_.esm.js} +2 -2
- package/dist/chunks/{index-ZiApqExt.esm.js.map → index-AzO-vVC_.esm.js.map} +1 -1
- package/dist/chunks/index-GnUmyy1z.esm.js +2 -0
- package/dist/chunks/index-GnUmyy1z.esm.js.map +1 -0
- package/dist/chunks/index-IR9Ar71Q.esm.js +2 -0
- package/dist/chunks/index-IR9Ar71Q.esm.js.map +1 -0
- package/dist/chunks/index-Q1G7wE5Y.esm.js +2 -0
- package/dist/chunks/index-Q1G7wE5Y.esm.js.map +1 -0
- package/dist/chunks/index-d7x511He.esm.js +2 -0
- package/dist/chunks/index-d7x511He.esm.js.map +1 -0
- package/dist/chunks/index-ePiYABlF.esm.js +2 -0
- package/dist/chunks/index-ePiYABlF.esm.js.map +1 -0
- package/dist/chunks/{index-HSr3vG8C.esm.js → index-eZQGsMRE.esm.js} +2 -2
- package/dist/chunks/{index-HSr3vG8C.esm.js.map → index-eZQGsMRE.esm.js.map} +1 -1
- package/dist/chunks/{order-page-NwFyJU-V.esm.js → order-page-Lr9R8-is.esm.js} +2 -2
- package/dist/chunks/{order-page-NwFyJU-V.esm.js.map → order-page-Lr9R8-is.esm.js.map} +1 -1
- package/dist/chunks/{order-page-XNVqjTGF.esm.js → order-page-U_bvO9-n.esm.js} +2 -2
- package/dist/chunks/{order-page-XNVqjTGF.esm.js.map → order-page-U_bvO9-n.esm.js.map} +1 -1
- package/dist/chunks/{routes-d2vC4TDa.esm.js → routes-Y3xQURF0.esm.js} +2 -2
- package/dist/chunks/{routes-d2vC4TDa.esm.js.map → routes-Y3xQURF0.esm.js.map} +1 -1
- package/dist/chunks/{routes-a8lsE6eZ.esm.js → routes-fBXLZ-QV.esm.js} +2 -2
- package/dist/chunks/{routes-a8lsE6eZ.esm.js.map → routes-fBXLZ-QV.esm.js.map} +1 -1
- package/dist/chunks/{update-cart-gv6ortZ5.esm.js → update-cart-9ANMUWR9.esm.js} +2 -2
- package/dist/chunks/{update-cart-gv6ortZ5.esm.js.map → update-cart-9ANMUWR9.esm.js.map} +1 -1
- package/dist/chunks/{update-cart-p84B0Ga6.esm.js → update-cart-OMt_qKQ8.esm.js} +2 -2
- package/dist/chunks/{update-cart-p84B0Ga6.esm.js.map → update-cart-OMt_qKQ8.esm.js.map} +1 -1
- package/dist/components/community-impact.esm.js +1 -1
- package/dist/components/community-impact.js +1 -1
- package/dist/components/cumulative-impact.esm.js +1 -1
- package/dist/components/cumulative-impact.js +1 -1
- package/dist/components/impact-overview.esm.js +1 -1
- package/dist/components/impact-overview.js +1 -1
- package/dist/components/index.esm.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/post-purchase.d.ts +1 -1
- package/dist/components/post-purchase.esm.js +1 -1
- package/dist/components/post-purchase.js +1 -1
- package/dist/components/redeem-transaction.d.ts +1 -1
- package/dist/components/redeem-transaction.esm.js +1 -1
- package/dist/components/redeem-transaction.js +1 -1
- package/dist/components/select-nonprofit.d.ts +1 -1
- package/dist/components/select-nonprofit.esm.js +1 -1
- package/dist/components/select-nonprofit.js +1 -1
- package/dist/components/shopify.esm.js +1 -1
- package/dist/components/shopify.js +1 -1
- package/dist/components/subscription-management.d.ts +1 -1
- package/dist/components/subscription-management.esm.js +4 -4
- package/dist/components/subscription-management.esm.js.map +1 -1
- package/dist/components/subscription-management.js +4 -4
- 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/index.esm.js +1 -1
- package/dist/integrations/index.js +1 -1
- package/dist/integrations/logs.esm.js +1 -1
- package/dist/integrations/logs.js +1 -1
- package/dist/integrations/shopify.esm.js +1 -1
- package/dist/integrations/shopify.js +1 -1
- package/dist/integrations/statsig.esm.js +1 -1
- package/dist/integrations/statsig.js +1 -1
- package/dist/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/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/subscription-management.esm.js +1 -1
- package/dist/react/subscription-management.js +1 -1
- package/package.json +6 -5
- package/dist/chunks/_share-dialog-dependencies-3jvcgxc-.esm.js.map +0 -1
- package/dist/chunks/_share-dialog-dependencies-3mmhET8U.esm.js.map +0 -1
- package/dist/chunks/index-2d2pxFdE.esm.js +0 -2
- package/dist/chunks/index-2d2pxFdE.esm.js.map +0 -1
- package/dist/chunks/index-Gz47LtoA.esm.js +0 -2
- package/dist/chunks/index-Gz47LtoA.esm.js.map +0 -1
- package/dist/chunks/index-HmjLoc_p.esm.js +0 -2
- package/dist/chunks/index-HmjLoc_p.esm.js.map +0 -1
- package/dist/chunks/index-kLkFc8M_.esm.js +0 -2
- package/dist/chunks/index-kLkFc8M_.esm.js.map +0 -1
- package/dist/chunks/index-yWjLS42R.esm.js +0 -2
- package/dist/chunks/index-yWjLS42R.esm.js.map +0 -1
- package/dist/chunks/index-yxnSM7PZ.esm.js +0 -2
- package/dist/chunks/index-yxnSM7PZ.esm.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscription-management.esm.js","sources":["../../src/components/subscription-management/strings.ts","../../src/components/subscription-management/index.ts"],"sourcesContent":["export const strings = {\n en: {\n nonprofitSwapText: ({ brandName = \"\" }) => `Support a new nonprofit with your next ${brandName} recurring order`,\n },\n fr: {\n nonprofitSwapText: ({ brandName = \"\" }) =>\n `Soutenez une nouvelle organisation à but non lucratif avec votre prochaine commande récurrente ${brandName}`,\n },\n de: {\n nonprofitSwapText: ({ brandName = \"\" }) =>\n `Unterstützen Sie eine neue gemeinnützige Organisation mit Ihrer nächsten wiederkehrenden Bestellung bei ${brandName}`,\n },\n es: {\n nonprofitSwapText: ({ brandName = \"\" }) =>\n `Apoye a una nueva organización sin fines de lucro con su próximo pedido recurrente ${brandName}`,\n },\n it: {\n nonprofitSwapText: ({ brandName = \"\" }) =>\n `Sostieni una nuova organizzazione non profit con il tuo prossimo ordine ricorrente ${brandName}`,\n },\n pl: {\n nonprofitSwapText: ({ brandName = \"\" }) =>\n `Wesprzyj nową organizację non-profit przy kolejnym zamówieniu cyklicznym ${brandName}`,\n },\n};\n","import { css, html, LitElement } from \"lit\";\nimport { property } from \"lit/decorators/property.js\";\nimport { state } from \"lit/decorators/state.js\";\nimport { DEFAULT_BASE_URL } from \"../../api-sdk/constants\";\nimport { LANGUAGES } from \"../../api-sdk/types\";\nimport { TCart } from \"../../shared/cart-contents\";\nimport { enforceConfig } from \"../../shared/enforce-config\";\nimport { postFindOrCreateSubscription, postChainEligibleNonprofitsForCart } from \"../../api-sdk/v3/routes\";\nimport { AsyncController } from \"../../shared/controllers/async-controller\";\nimport { cssReset } from \"../../shared/css-reset\";\nimport { defineCustomElement } from \"../../shared/defineCustomElement\";\nimport { _errorMessage } from \"../../shared/fragments/error-message-template\";\nimport { _cssVariableMap } from \"../../shared/fragments/css-variable-map\";\nimport { BeamNonprofitSelectEvent } from \"../../utils/events\";\nimport { MissingConfig } from \"../../utils/beam-errors\";\nimport { strings } from \"./strings\";\n\ninterface RequiredDataPropsWithEmail {\n email: string;\n apiKey: string;\n subscriptionId: string;\n}\n\ninterface RequiredDataPropsWithPartnerUserId {\n partnerUserId: string;\n apiKey: string;\n subscriptionId: string;\n}\n\ntype TRequiredDataProps = RequiredDataPropsWithEmail | RequiredDataPropsWithPartnerUserId;\nexport class BeamSubscriptionManagement extends LitElement {\n static tagName = \"beam-subscription-management\";\n\n @property({ type: String })\n public baseUrl: string = DEFAULT_BASE_URL;\n\n @property({ type: String })\n public apiKey!: TRequiredDataProps[\"apiKey\"];\n\n @property({ type: String })\n public subscriptionId!: TRequiredDataProps[\"subscriptionId\"];\n\n @property({ type: Number, reflect: true })\n public storeId?: number; // Either storeId or postalCode, countryCode must be provided\n\n @property({ type: String })\n public email?: RequiredDataPropsWithEmail[\"email\"]; // Either email or partnerUserId must be provided\n\n @property({ type: String })\n public partnerUserId?: RequiredDataPropsWithPartnerUserId[\"partnerUserId\"]; // Either email or partnerUserId must be provided\n\n @property({ type: String })\n public postalCode?: string;\n\n @property({ type: String })\n public countryCode?: string;\n\n @property({ type: String })\n public lang: LANGUAGES = \"en\";\n\n @property({ type: Object })\n public cart?: TCart;\n\n @property({ type: Boolean })\n public debug = false;\n\n @state() private activeWidget: \"redeem-transaction\" | \"impact-overview\" | null = null; // Based on /findSubscriptionByRemoteId\n @state() private nonprofitId: number | null = null; // From /findSubscriptionByRemoteId response\n @state() private userId: string | null = null; // From findSubscriptionByRemoteId\n @state() private chainName: string | null = null; // From findEligibleNonprofitsForCart\n\n private subscriptionDataController = new AsyncController<typeof this.fetchSubscription>(this, this.fetchSubscription);\n private eligibleNonprofitsDataController = new AsyncController<typeof this.fetchEligibleNonprofits>(\n this,\n this.fetchEligibleNonprofits\n );\n\n async firstUpdated() {\n if (!this.email && !this.partnerUserId) {\n throw new MissingConfig(\n [\"email\", \"partnerUserId\"],\n \"One of the following properties needs to be specified: email, partnerUserId \"\n );\n }\n enforceConfig<TRequiredDataProps>([\"apiKey\", \"subscriptionId\"], this);\n await this.loadWidget();\n }\n\n async loadWidget() {\n // In parallel:\n // (1). Fetch eligible nonprofits [storeId and chainName]\n // (2). Fetch subscription [userId and nonprofitId]\n await Promise.all([this.fetchEligibleNonprofits(), this.fetchSubscription()]);\n this.activeWidget = this.nonprofitId ? \"impact-overview\" : \"redeem-transaction\";\n }\n\n async fetchEligibleNonprofits() {\n enforceConfig<TRequiredDataProps>([\"apiKey\", \"subscriptionId\"], this);\n const res = await postChainEligibleNonprofitsForCart({\n baseUrl: this.baseUrl,\n headers: {\n authorization: `Api-Key ${this.apiKey}`,\n },\n requestBody: {\n postalCode: this.postalCode ? this.postalCode : undefined,\n countryCode: this.countryCode ? this.countryCode : undefined,\n widgetName: \"subscription-management\",\n version: \"1.0.0\",\n },\n });\n this.chainName = res.chain.name;\n this.storeId = res.store.id;\n return res;\n }\n\n async fetchSubscription() {\n enforceConfig<TRequiredDataProps>([\"apiKey\", \"subscriptionId\"], this);\n const result = await postFindOrCreateSubscription({\n baseUrl: this.baseUrl,\n headers: {\n authorization: `Api-Key ${this.apiKey}`,\n },\n requestBody: {\n remoteSubscriptionId: this.subscriptionId,\n email: this.email,\n partnerUserId: this.partnerUserId,\n },\n });\n\n this.userId = result.beamUserId; // Returned in response regardless of subscription redemption\n this.nonprofitId = result.nonprofit?.id || null;\n return result;\n }\n\n handleSwapNonprofitButtonClick() {\n this.activeWidget = \"redeem-transaction\";\n }\n\n renderSwapNonprofitButton() {\n if (this.activeWidget === \"impact-overview\") {\n return html`<button class=\"swap-nonprofit-button\" @click=\"${this.handleSwapNonprofitButtonClick}\">\n ${strings[this.lang].nonprofitSwapText({ brandName: this.chainName || \"\" })}\n </button>`;\n } else {\n return \"\";\n }\n }\n\n public get cssVariables() {\n const defaults = {\n \"--beam-fontFamily\": \"inherit\",\n \"--beam-fontStyle\": \"inherit\",\n \"--beam-fontSize\": \"inherit\",\n \"--beam-textColor\": \"inherit\",\n \"--beam-backgroundColor\": \"inherit\",\n \"--beam-SubscriptionManagement-widgetContainer-borderColor\": \"#d5d5d5\",\n \"--beam-SubscriptionManagement-widgetContainer-borderRadius\": \"4px\",\n \"--beam-SubscriptionManagement-widgetContainer-padding\": \"15px\",\n \"--beam-SubscriptionManagement-widgetContainer-backgroundColor\": \"inherit\",\n \"--beam-SubscriptionManagement-widgetContainer-maxWidth\": \"800px\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-textDecoration\": \"underline\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-fontFamily\": \"inherit\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-fontStyle\": \"inherit\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-fontWeight\": \"inherit\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-lineHeight\": \"inherit\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-marginTop\": \"10px\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-fontSize\": \"inherit\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-color\": \"inherit\",\n };\n\n const remoteConfig = this.eligibleNonprofitsDataController?.data?.config?.web?.theme || {};\n\n const config = { ...defaults, ...remoteConfig };\n\n const serializable = Object.create({\n toCSS() {\n return _cssVariableMap(this as Record<string, string>);\n },\n });\n return Object.assign(serializable, config);\n }\n\n static styles = [\n cssReset,\n css`\n :host {\n display: block;\n font-family: var(--beam-fontFamily);\n font-style: var(--beam-fontStyle);\n font-size: var(--beam-fontSize);\n background-color: var(--beam-backgroundColor);\n color: var(--beam-textColor);\n word-break: normal;\n }\n .swap-nonprofit-button {\n margin-top: var(--beam-SubscriptionManagement-swapNonprofitButtonText-marginTop, 10px);\n color: var(--beam-SubscriptionManagement-swapNonprofitButtonText-color, inherit);\n font-size: var(--beam-SubscriptionManagement-swapNonprofitButtonText-fontSize, inherit);\n text-decoration: var(--beam-SubscriptionManagement-swapNonprofitButtonText-textDecoration, underline);\n font-family: var(--beam-SubscriptionManagement-swapNonprofitButtonText-fontFamily, inherit);\n font-style: var(--beam-SubscriptionManagement-swapNonprofitButtonText-fontStyle, inherit);\n font-weight: var(--beam-SubscriptionManagement-swapNonprofitButtonText-fontWeight, inherit);\n line-height: var(--beam-SubscriptionManagement-swapNonprofitButtonText-lineHeight, inherit);\n background: none;\n border: none;\n cursor: pointer;\n }\n .sub-widget-container {\n background-color: var(--beam-SubscriptionManagement-widgetContainer-backgroundColor, inherit);\n border: 1px solid var(--beam-SubscriptionManagement-widgetContainer-borderColor, #d5d5d5);\n border-radius: var(--beam-SubscriptionManagement-widgetContainer-borderRadius, 4px);\n overflow: hidden; /* maintain clean border-radius */\n padding: var(--beam-SubscriptionManagement-widgetContainer-padding, 15px);\n max-width: var(--beam-SubscriptionManagement-widgetContainer-maxWidth, 800px);\n }\n }`,\n ];\n\n render() {\n let content;\n\n if (this.subscriptionDataController.loading || this.eligibleNonprofitsDataController.loading) {\n content = \"\";\n }\n\n if ((this.subscriptionDataController.error || this.eligibleNonprofitsDataController.error) && this.debug) {\n if (this.subscriptionDataController.error !== null) {\n return _errorMessage({ error: this.subscriptionDataController.error });\n } else if (this.eligibleNonprofitsDataController.error !== null) {\n return _errorMessage({ error: this.eligibleNonprofitsDataController.error });\n }\n } else {\n content = \"\";\n }\n\n if (this.activeWidget === \"redeem-transaction\") {\n content = html` <beam-redeem-transaction\n part=\"redeem-transaction\"\n subscriptionId=\"${this.subscriptionId}\"\n nonprofitId=${this.nonprofitId}\n baseUrl=\"${this.baseUrl}\"\n apiKey=\"${this.apiKey}\"\n postalCode=\"${this.postalCode}\"\n countryCode=\"${this.countryCode}\"\n lang=\"${this.lang}\"\n ?debug=\"${this.debug}\"\n @beamnonprofitselect=\"${(event: Event) => {\n if (!(event instanceof BeamNonprofitSelectEvent)) return; // TS guard\n const { selectedNonprofitId } = event.detail;\n this.nonprofitId = selectedNonprofitId ?? null;\n this.activeWidget = \"impact-overview\";\n }}\"\n ></beam-redeem-transaction>`;\n } else if (this.activeWidget === \"impact-overview\") {\n content = html`\n <beam-impact-overview\n part=\"impact-overview\"\n baseUrl=\"${this.baseUrl}\"\n apiKey=\"${this.apiKey}\"\n userId=\"${this.userId}\"\n nonprofitId=\"${this.nonprofitId}\"\n lang=\"${this.lang}\"\n ?debug=\"${this.debug}\"\n ></beam-impact-overview>\n `;\n }\n return html`\n <style>\n :host {\n ${this.cssVariables.toCSS()}\n }\n </style>\n <div class=\"sub-widget-container\">${content}</div>\n ${this.renderSwapNonprofitButton()}\n `;\n }\n}\n\ndefineCustomElement(BeamSubscriptionManagement);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"beam-subscription-management\": BeamSubscriptionManagement;\n }\n}\n"],"names":["strings","brandName","m","h","e","l","n","t","o","i","a","d","BeamSubscriptionManagement","LitElement","DEFAULT_BASE_URL","AsyncController","MissingConfig","enforceConfig","res","postChainEligibleNonprofitsForCart","result","postFindOrCreateSubscription","html","defaults","remoteConfig","config","_cssVariableMap","content","_errorMessage","event","BeamNonprofitSelectEvent","selectedNonprofitId","cssReset","css","__decorateClass","property","state","defineCustomElement"],"mappings":"+XAAO,MAAMA,EAAU,CACrB,GAAI,CACF,kBAAmB,CAAC,CAAE,UAAAC,EAAY,EAAG,IAAM,0CAA0CA,CAAS,kBAChG,EACA,GAAI,CACF,kBAAmB,CAAC,CAAE,UAAAA,EAAY,EAAG,IACnC,wGAAkGA,CAAS,EAC/G,EACA,GAAI,CACF,kBAAmB,CAAC,CAAE,UAAAA,EAAY,EAAG,IACnC,oHAA2GA,CAAS,EACxH,EACA,GAAI,CACF,kBAAmB,CAAC,CAAE,UAAAA,EAAY,EAAG,IACnC,4FAAsFA,CAAS,EACnG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AAC,CAAA,EA9BfvB,EA+BJ,UAGAsB,OAAAA,CAAAA,EAAAA,EAAA,CADNC,EAAS,CAAE,KAAM,OAAQ,CAAC,GAjChBvB,EAkCJ,UAAA,QAAA,CAAA,EAEUsB,EAAA,CAAhBE,EAAM,CAAA,EApCIxB,EAoCM,UAAA,eAAA,CAAA,EACAsB,EAAA,CAAhBE,GArCU,EAAAxB,EAqCM,UACAsB,cAAAA,CAAAA,EAAAA,EAAA,CAAhBE,KAtCUxB,EAsCM,UAAA,SAAA,CAAA,EACAsB,EAAA,CAAhBE,EAAM,CAAA,EAvCIxB,EAuCM,UAAA,YAAA,CAAA,EAiNnByB,EAAoBzB,CAA0B"}
|
|
1
|
+
{"version":3,"file":"subscription-management.esm.js","sources":["../../src/components/subscription-management/strings.ts","../../src/components/subscription-management/index.ts"],"sourcesContent":["export const strings = {\n en: {\n nonprofitSwapText: ({ brandName = \"\" }) => `Support a new nonprofit with your next ${brandName} recurring order`,\n },\n fr: {\n nonprofitSwapText: ({ brandName = \"\" }) =>\n `Soutenez une nouvelle organisation à but non lucratif avec votre prochaine commande récurrente ${brandName}`,\n },\n de: {\n nonprofitSwapText: ({ brandName = \"\" }) =>\n `Unterstützen Sie eine neue gemeinnützige Organisation mit Ihrer nächsten wiederkehrenden Bestellung bei ${brandName}`,\n },\n es: {\n nonprofitSwapText: ({ brandName = \"\" }) =>\n `Apoye a una nueva organización sin fines de lucro con su próximo pedido recurrente ${brandName}`,\n },\n it: {\n nonprofitSwapText: ({ brandName = \"\" }) =>\n `Sostieni una nuova organizzazione non profit con il tuo prossimo ordine ricorrente ${brandName}`,\n },\n pl: {\n nonprofitSwapText: ({ brandName = \"\" }) =>\n `Wesprzyj nową organizację non-profit przy kolejnym zamówieniu cyklicznym ${brandName}`,\n },\n};\n","import { css, html, LitElement } from \"lit\";\nimport { property } from \"lit/decorators/property.js\";\nimport { state } from \"lit/decorators/state.js\";\nimport { DEFAULT_BASE_URL } from \"../../api-sdk/constants\";\nimport { LANGUAGES } from \"../../api-sdk/types\";\nimport { TCart } from \"../../shared/cart-contents\";\nimport { enforceConfig } from \"../../shared/enforce-config\";\nimport { postFindOrCreateSubscription, postChainEligibleNonprofitsForCart } from \"../../api-sdk/v3/routes\";\nimport { AsyncController } from \"../../shared/controllers/async-controller\";\nimport { cssReset } from \"../../shared/css-reset\";\nimport { defineCustomElement } from \"../../shared/defineCustomElement\";\nimport { _errorMessage } from \"../../shared/fragments/error-message-template\";\nimport { _cssVariableMap } from \"../../shared/fragments/css-variable-map\";\nimport { BeamNonprofitSelectEvent } from \"../../utils/events\";\nimport { MissingConfig } from \"../../utils/beam-errors\";\nimport { strings } from \"./strings\";\n\ninterface RequiredDataPropsWithEmail {\n email: string;\n apiKey: string;\n subscriptionId: string;\n}\n\ninterface RequiredDataPropsWithPartnerUserId {\n partnerUserId: string;\n apiKey: string;\n subscriptionId: string;\n}\n\ntype TRequiredDataProps = RequiredDataPropsWithEmail | RequiredDataPropsWithPartnerUserId;\nexport class BeamSubscriptionManagement extends LitElement {\n static tagName = \"beam-subscription-management\";\n\n @property({ type: String })\n public baseUrl: string = DEFAULT_BASE_URL;\n\n @property({ type: String })\n public apiKey!: TRequiredDataProps[\"apiKey\"];\n\n @property({ type: String })\n public subscriptionId!: TRequiredDataProps[\"subscriptionId\"];\n\n @property({ type: Number, reflect: true })\n public storeId?: number; // Either storeId or postalCode, countryCode must be provided\n\n @property({ type: String })\n public email?: RequiredDataPropsWithEmail[\"email\"]; // Either email or partnerUserId must be provided\n\n @property({ type: String })\n public partnerUserId?: RequiredDataPropsWithPartnerUserId[\"partnerUserId\"]; // Either email or partnerUserId must be provided\n\n @property({ type: String })\n public postalCode?: string;\n\n @property({ type: String })\n public countryCode?: string;\n\n @property({ type: String })\n public lang: LANGUAGES = \"en\";\n\n @property({ type: Object })\n public cart?: TCart;\n\n @property({ type: Boolean })\n public debug = false;\n\n @state() private activeWidget: \"redeem-transaction\" | \"impact-overview\" | null = null; // Based on /findSubscriptionByRemoteId\n @state() private nonprofitId: number | null = null; // From /findSubscriptionByRemoteId response\n @state() private userId: string | null = null; // From findSubscriptionByRemoteId\n @state() private chainName: string | null = null; // From findEligibleNonprofitsForCart\n\n private subscriptionDataController = new AsyncController<typeof this.fetchSubscription>(this, this.fetchSubscription);\n private eligibleNonprofitsDataController = new AsyncController<typeof this.fetchEligibleNonprofits>(\n this,\n this.fetchEligibleNonprofits\n );\n\n async firstUpdated() {\n if (!this.email && !this.partnerUserId) {\n throw new MissingConfig(\n [\"email\", \"partnerUserId\"],\n \"One of the following properties needs to be specified: email, partnerUserId \"\n );\n }\n enforceConfig<TRequiredDataProps>([\"apiKey\", \"subscriptionId\"], this);\n await this.loadWidget();\n }\n\n async loadWidget() {\n // In parallel:\n // (1). Fetch eligible nonprofits [storeId and chainName]\n // (2). Fetch subscription [userId and nonprofitId]\n await Promise.all([this.fetchEligibleNonprofits(), this.fetchSubscription()]);\n this.activeWidget = this.nonprofitId ? \"impact-overview\" : \"redeem-transaction\";\n }\n\n async fetchEligibleNonprofits() {\n enforceConfig<TRequiredDataProps>([\"apiKey\", \"subscriptionId\"], this);\n const res = await postChainEligibleNonprofitsForCart({\n baseUrl: this.baseUrl,\n headers: {\n authorization: `Api-Key ${this.apiKey}`,\n },\n requestBody: {\n postalCode: this.postalCode ? this.postalCode : undefined,\n countryCode: this.countryCode ? this.countryCode : undefined,\n widgetName: \"subscription-management\",\n version: \"1.0.0\",\n },\n });\n this.chainName = res.chain.name;\n this.storeId = res.store.id;\n this.eligibleNonprofitsDataController.data = res;\n return res;\n }\n\n async fetchSubscription() {\n enforceConfig<TRequiredDataProps>([\"apiKey\", \"subscriptionId\"], this);\n const result = await postFindOrCreateSubscription({\n baseUrl: this.baseUrl,\n headers: {\n authorization: `Api-Key ${this.apiKey}`,\n },\n requestBody: {\n remoteSubscriptionId: this.subscriptionId,\n email: this.email,\n partnerUserId: this.partnerUserId,\n },\n });\n\n this.userId = result.beamUserId; // Returned in response regardless of subscription redemption\n this.nonprofitId = result.nonprofit?.id || null;\n return result;\n }\n\n handleSwapNonprofitButtonClick() {\n this.activeWidget = \"redeem-transaction\";\n }\n\n renderSwapNonprofitButton() {\n if (this.activeWidget === \"impact-overview\") {\n return html`<button class=\"swap-nonprofit-button\" @click=\"${this.handleSwapNonprofitButtonClick}\">\n ${strings[this.lang].nonprofitSwapText({ brandName: this.chainName || \"\" })}\n </button>`;\n } else {\n return \"\";\n }\n }\n\n public get cssVariables() {\n const defaults = {\n \"--beam-fontFamily\": \"inherit\",\n \"--beam-fontStyle\": \"inherit\",\n \"--beam-fontSize\": \"inherit\",\n \"--beam-textColor\": \"inherit\",\n \"--beam-backgroundColor\": \"inherit\",\n \"--beam-SubscriptionManagement-widgetContainer-borderColor\": \"#d5d5d5\",\n \"--beam-SubscriptionManagement-widgetContainer-borderRadius\": \"4px\",\n \"--beam-SubscriptionManagement-widgetContainer-padding\": \"15px\",\n \"--beam-SubscriptionManagement-widgetContainer-backgroundColor\": \"inherit\",\n \"--beam-SubscriptionManagement-widgetContainer-maxWidth\": \"800px\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-textDecoration\": \"underline\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-fontFamily\": \"inherit\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-fontStyle\": \"inherit\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-fontWeight\": \"inherit\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-lineHeight\": \"inherit\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-marginTop\": \"10px\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-fontSize\": \"inherit\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-color\": \"inherit\",\n };\n\n const remoteConfig = this.eligibleNonprofitsDataController?.data?.config?.web?.theme || {};\n\n const config = { ...defaults, ...remoteConfig };\n\n const serializable = Object.create({\n toCSS() {\n return _cssVariableMap(this as Record<string, string>);\n },\n });\n return Object.assign(serializable, config);\n }\n\n static styles = [\n cssReset,\n css`\n :host {\n display: block;\n font-family: var(--beam-fontFamily);\n font-style: var(--beam-fontStyle);\n font-size: var(--beam-fontSize);\n background-color: var(--beam-backgroundColor);\n color: var(--beam-textColor);\n word-break: normal;\n }\n .swap-nonprofit-button {\n margin-top: var(--beam-SubscriptionManagement-swapNonprofitButtonText-marginTop, 10px);\n color: var(--beam-SubscriptionManagement-swapNonprofitButtonText-color, inherit);\n font-size: var(--beam-SubscriptionManagement-swapNonprofitButtonText-fontSize, inherit);\n text-decoration: var(--beam-SubscriptionManagement-swapNonprofitButtonText-textDecoration, underline);\n font-family: var(--beam-SubscriptionManagement-swapNonprofitButtonText-fontFamily, inherit);\n font-style: var(--beam-SubscriptionManagement-swapNonprofitButtonText-fontStyle, inherit);\n font-weight: var(--beam-SubscriptionManagement-swapNonprofitButtonText-fontWeight, inherit);\n line-height: var(--beam-SubscriptionManagement-swapNonprofitButtonText-lineHeight, inherit);\n background: none;\n border: none;\n cursor: pointer;\n }\n .sub-widget-container {\n background-color: var(--beam-SubscriptionManagement-widgetContainer-backgroundColor, inherit);\n border: 1px solid var(--beam-SubscriptionManagement-widgetContainer-borderColor, #d5d5d5);\n border-radius: var(--beam-SubscriptionManagement-widgetContainer-borderRadius, 4px);\n overflow: hidden; /* maintain clean border-radius */\n padding: var(--beam-SubscriptionManagement-widgetContainer-padding, 15px);\n max-width: var(--beam-SubscriptionManagement-widgetContainer-maxWidth, 800px);\n }\n }`,\n ];\n\n render() {\n let content;\n\n if (this.subscriptionDataController.loading || this.eligibleNonprofitsDataController.loading) {\n content = \"\";\n }\n\n if ((this.subscriptionDataController.error || this.eligibleNonprofitsDataController.error) && this.debug) {\n if (this.subscriptionDataController.error !== null) {\n return _errorMessage({ error: this.subscriptionDataController.error });\n } else if (this.eligibleNonprofitsDataController.error !== null) {\n return _errorMessage({ error: this.eligibleNonprofitsDataController.error });\n }\n } else {\n content = \"\";\n }\n\n if (this.activeWidget === \"redeem-transaction\") {\n content = html` <beam-redeem-transaction\n part=\"redeem-transaction\"\n subscriptionId=\"${this.subscriptionId}\"\n nonprofitId=${this.nonprofitId}\n baseUrl=\"${this.baseUrl}\"\n apiKey=\"${this.apiKey}\"\n postalCode=\"${this.postalCode}\"\n countryCode=\"${this.countryCode}\"\n lang=\"${this.lang}\"\n ?debug=\"${this.debug}\"\n @beamnonprofitselect=\"${(event: Event) => {\n if (!(event instanceof BeamNonprofitSelectEvent)) return; // TS guard\n const { selectedNonprofitId } = event.detail;\n this.nonprofitId = selectedNonprofitId ?? null;\n this.activeWidget = \"impact-overview\";\n }}\"\n ></beam-redeem-transaction>`;\n } else if (this.activeWidget === \"impact-overview\") {\n content = html`\n <beam-impact-overview\n part=\"impact-overview\"\n baseUrl=\"${this.baseUrl}\"\n apiKey=\"${this.apiKey}\"\n userId=\"${this.userId}\"\n nonprofitId=\"${this.nonprofitId}\"\n lang=\"${this.lang}\"\n ?debug=\"${this.debug}\"\n ></beam-impact-overview>\n `;\n }\n return html`\n <style>\n :host {\n ${this.cssVariables.toCSS()}\n }\n </style>\n <div class=\"sub-widget-container\">${content}</div>\n ${this.renderSwapNonprofitButton()}\n `;\n }\n}\n\ndefineCustomElement(BeamSubscriptionManagement);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"beam-subscription-management\": BeamSubscriptionManagement;\n }\n}\n"],"names":["strings","brandName","m","h","e","l","n","t","o","i","a","d","BeamSubscriptionManagement","LitElement","DEFAULT_BASE_URL","AsyncController","MissingConfig","enforceConfig","res","postChainEligibleNonprofitsForCart","result","postFindOrCreateSubscription","html","defaults","remoteConfig","config","_cssVariableMap","content","_errorMessage","event","BeamNonprofitSelectEvent","selectedNonprofitId","cssReset","css","__decorateClass","property","state","defineCustomElement"],"mappings":"+XAAO,MAAMA,EAAU,CACrB,GAAI,CACF,kBAAmB,CAAC,CAAE,UAAAC,EAAY,EAAG,IAAM,0CAA0CA,CAAS,kBAChG,EACA,GAAI,CACF,kBAAmB,CAAC,CAAE,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EAsBJ,UAAA,aAAA,CAAA,EAGAsB,EAAA,CADNC,EAAS,CAAE,KAAM,MAAO,CAAC,CAAA,EAxBfvB,EAyBJ,UAAA,cAAA,CAAA,EAGAsB,EAAA,CADNC,EAAS,CAAE,KAAM,MAAO,CAAC,CA3Bf,EAAAvB,EA4BJ,oBAGAsB,EAAA,CADNC,EAAS,CAAE,KAAM,MAAO,CAAC,CAAA,EA9BfvB,EA+BJ,UAGAsB,OAAAA,CAAAA,EAAAA,EAAA,CADNC,EAAS,CAAE,KAAM,OAAQ,CAAC,GAjChBvB,EAkCJ,UAAA,QAAA,CAAA,EAEUsB,EAAA,CAAhBE,EAAM,CAAA,EApCIxB,EAoCM,UAAA,eAAA,CAAA,EACAsB,EAAA,CAAhBE,GArCU,EAAAxB,EAqCM,UACAsB,cAAAA,CAAAA,EAAAA,EAAA,CAAhBE,KAtCUxB,EAsCM,UAAA,SAAA,CAAA,EACAsB,EAAA,CAAhBE,EAAM,CAAA,EAvCIxB,EAuCM,UAAA,YAAA,CAAA,EAkNnByB,EAAoBzB,CAA0B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{f as h,g as o,t as p,h as g,y as
|
|
1
|
+
import{f as h,g as o,t as p,h as g,y as l}from"../chunks/lit-yVXn5Cbs.esm.js";import{D as f,b as y,h as w}from"../chunks/routes-fBXLZ-QV.esm.js";import{c as S,d as v,A as u,e as b,a as C,_ as m}from"../chunks/enforce-config-fo8kIfoY.esm.js";import{c as x}from"../chunks/events-5IECSF-x.esm.js";import{M as N}from"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../utils/logger.js";const I={en:{nonprofitSwapText:({brandName:i=""})=>`Support a new nonprofit with your next ${i} recurring order`},fr:{nonprofitSwapText:({brandName:i=""})=>`Soutenez une nouvelle organisation \xE0 but non lucratif avec votre prochaine commande r\xE9currente ${i}`},de:{nonprofitSwapText:({brandName:i=""})=>`Unterst\xFCtzen Sie eine neue gemeinn\xFCtzige Organisation mit Ihrer n\xE4chsten wiederkehrenden Bestellung bei ${i}`},es:{nonprofitSwapText:({brandName:i=""})=>`Apoye a una nueva organizaci\xF3n sin fines de lucro con su pr\xF3ximo pedido recurrente ${i}`},it:{nonprofitSwapText:({brandName:i=""})=>`Sostieni una nuova organizzazione non profit con il tuo prossimo ordine ricorrente ${i}`},pl:{nonprofitSwapText:({brandName:i=""})=>`Wesprzyj now\u0105 organizacj\u0119 non-profit przy kolejnym zam\xF3wieniu cyklicznym ${i}`}};var M=Object.defineProperty,$=Object.getOwnPropertyDescriptor,n=(i,t,r,a)=>{for(var s=a>1?void 0:a?$(t,r):t,d=i.length-1,c;d>=0;d--)(c=i[d])&&(s=(a?c(t,r,s):c(s))||s);return a&&s&&M(t,r,s),s};class e extends g{constructor(){super(...arguments),this.baseUrl=f,this.lang="en",this.debug=!1,this.activeWidget=null,this.nonprofitId=null,this.userId=null,this.chainName=null,this.subscriptionDataController=new u(this,this.fetchSubscription),this.eligibleNonprofitsDataController=new u(this,this.fetchEligibleNonprofits)}async firstUpdated(){if(!this.email&&!this.partnerUserId)throw new N(["email","partnerUserId"],"One of the following properties needs to be specified: email, partnerUserId ");b(["apiKey","subscriptionId"],this),await this.loadWidget()}async loadWidget(){await Promise.all([this.fetchEligibleNonprofits(),this.fetchSubscription()]),this.activeWidget=this.nonprofitId?"impact-overview":"redeem-transaction"}async fetchEligibleNonprofits(){b(["apiKey","subscriptionId"],this);const t=await y({baseUrl:this.baseUrl,headers:{authorization:`Api-Key ${this.apiKey}`},requestBody:{postalCode:this.postalCode?this.postalCode:void 0,countryCode:this.countryCode?this.countryCode:void 0,widgetName:"subscription-management",version:"1.0.0"}});return this.chainName=t.chain.name,this.storeId=t.store.id,this.eligibleNonprofitsDataController.data=t,t}async fetchSubscription(){b(["apiKey","subscriptionId"],this);const t=await w({baseUrl:this.baseUrl,headers:{authorization:`Api-Key ${this.apiKey}`},requestBody:{remoteSubscriptionId:this.subscriptionId,email:this.email,partnerUserId:this.partnerUserId}});return this.userId=t.beamUserId,this.nonprofitId=t.nonprofit?.id||null,t}handleSwapNonprofitButtonClick(){this.activeWidget="redeem-transaction"}renderSwapNonprofitButton(){return this.activeWidget==="impact-overview"?l`<button class="swap-nonprofit-button" @click="${this.handleSwapNonprofitButtonClick}">
|
|
2
2
|
${I[this.lang].nonprofitSwapText({brandName:this.chainName||""})}
|
|
3
|
-
</button>`:""}get cssVariables(){const t={"--beam-fontFamily":"inherit","--beam-fontStyle":"inherit","--beam-fontSize":"inherit","--beam-textColor":"inherit","--beam-backgroundColor":"inherit","--beam-SubscriptionManagement-widgetContainer-borderColor":"#d5d5d5","--beam-SubscriptionManagement-widgetContainer-borderRadius":"4px","--beam-SubscriptionManagement-widgetContainer-padding":"15px","--beam-SubscriptionManagement-widgetContainer-backgroundColor":"inherit","--beam-SubscriptionManagement-widgetContainer-maxWidth":"800px","--beam-SubscriptionManagement-swapNonprofitButtonText-textDecoration":"underline","--beam-SubscriptionManagement-swapNonprofitButtonText-fontFamily":"inherit","--beam-SubscriptionManagement-swapNonprofitButtonText-fontStyle":"inherit","--beam-SubscriptionManagement-swapNonprofitButtonText-fontWeight":"inherit","--beam-SubscriptionManagement-swapNonprofitButtonText-lineHeight":"inherit","--beam-SubscriptionManagement-swapNonprofitButtonText-marginTop":"10px","--beam-SubscriptionManagement-swapNonprofitButtonText-fontSize":"inherit","--beam-SubscriptionManagement-swapNonprofitButtonText-color":"inherit"},r=this.eligibleNonprofitsDataController?.data?.config?.web?.theme||{},a={...t,...r};return Object.assign(Object.create({toCSS(){return C(this)}}),a)}render(){let t;if((this.subscriptionDataController.loading||this.eligibleNonprofitsDataController.loading)&&(t=""),(this.subscriptionDataController.error||this.eligibleNonprofitsDataController.error)&&this.debug){if(this.subscriptionDataController.error!==null)return m({error:this.subscriptionDataController.error});if(this.eligibleNonprofitsDataController.error!==null)return m({error:this.eligibleNonprofitsDataController.error})}else t="";return this.activeWidget==="redeem-transaction"?t=
|
|
3
|
+
</button>`:""}get cssVariables(){const t={"--beam-fontFamily":"inherit","--beam-fontStyle":"inherit","--beam-fontSize":"inherit","--beam-textColor":"inherit","--beam-backgroundColor":"inherit","--beam-SubscriptionManagement-widgetContainer-borderColor":"#d5d5d5","--beam-SubscriptionManagement-widgetContainer-borderRadius":"4px","--beam-SubscriptionManagement-widgetContainer-padding":"15px","--beam-SubscriptionManagement-widgetContainer-backgroundColor":"inherit","--beam-SubscriptionManagement-widgetContainer-maxWidth":"800px","--beam-SubscriptionManagement-swapNonprofitButtonText-textDecoration":"underline","--beam-SubscriptionManagement-swapNonprofitButtonText-fontFamily":"inherit","--beam-SubscriptionManagement-swapNonprofitButtonText-fontStyle":"inherit","--beam-SubscriptionManagement-swapNonprofitButtonText-fontWeight":"inherit","--beam-SubscriptionManagement-swapNonprofitButtonText-lineHeight":"inherit","--beam-SubscriptionManagement-swapNonprofitButtonText-marginTop":"10px","--beam-SubscriptionManagement-swapNonprofitButtonText-fontSize":"inherit","--beam-SubscriptionManagement-swapNonprofitButtonText-color":"inherit"},r=this.eligibleNonprofitsDataController?.data?.config?.web?.theme||{},a={...t,...r};return Object.assign(Object.create({toCSS(){return C(this)}}),a)}render(){let t;if((this.subscriptionDataController.loading||this.eligibleNonprofitsDataController.loading)&&(t=""),(this.subscriptionDataController.error||this.eligibleNonprofitsDataController.error)&&this.debug){if(this.subscriptionDataController.error!==null)return m({error:this.subscriptionDataController.error});if(this.eligibleNonprofitsDataController.error!==null)return m({error:this.eligibleNonprofitsDataController.error})}else t="";return this.activeWidget==="redeem-transaction"?t=l` <beam-redeem-transaction
|
|
4
4
|
part="redeem-transaction"
|
|
5
5
|
subscriptionId="${this.subscriptionId}"
|
|
6
6
|
nonprofitId=${this.nonprofitId}
|
|
@@ -11,7 +11,7 @@ import{f as h,g as o,t as p,h as g,y as d}from"../chunks/lit-yVXn5Cbs.esm.js";im
|
|
|
11
11
|
lang="${this.lang}"
|
|
12
12
|
?debug="${this.debug}"
|
|
13
13
|
@beamnonprofitselect="${r=>{if(!(r instanceof x))return;const{selectedNonprofitId:a}=r.detail;this.nonprofitId=a??null,this.activeWidget="impact-overview"}}"
|
|
14
|
-
></beam-redeem-transaction>`:this.activeWidget==="impact-overview"&&(t=
|
|
14
|
+
></beam-redeem-transaction>`:this.activeWidget==="impact-overview"&&(t=l`
|
|
15
15
|
<beam-impact-overview
|
|
16
16
|
part="impact-overview"
|
|
17
17
|
baseUrl="${this.baseUrl}"
|
|
@@ -21,7 +21,7 @@ import{f as h,g as o,t as p,h as g,y as d}from"../chunks/lit-yVXn5Cbs.esm.js";im
|
|
|
21
21
|
lang="${this.lang}"
|
|
22
22
|
?debug="${this.debug}"
|
|
23
23
|
></beam-impact-overview>
|
|
24
|
-
`),
|
|
24
|
+
`),l`
|
|
25
25
|
<style>
|
|
26
26
|
:host {
|
|
27
27
|
${this.cssVariables.toCSS()}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscription-management.js","sources":["../../src/components/subscription-management/strings.ts","../../src/components/subscription-management/index.ts"],"sourcesContent":["export const strings = {\n en: {\n nonprofitSwapText: ({ brandName = \"\" }) => `Support a new nonprofit with your next ${brandName} recurring order`,\n },\n fr: {\n nonprofitSwapText: ({ brandName = \"\" }) =>\n `Soutenez une nouvelle organisation à but non lucratif avec votre prochaine commande récurrente ${brandName}`,\n },\n de: {\n nonprofitSwapText: ({ brandName = \"\" }) =>\n `Unterstützen Sie eine neue gemeinnützige Organisation mit Ihrer nächsten wiederkehrenden Bestellung bei ${brandName}`,\n },\n es: {\n nonprofitSwapText: ({ brandName = \"\" }) =>\n `Apoye a una nueva organización sin fines de lucro con su próximo pedido recurrente ${brandName}`,\n },\n it: {\n nonprofitSwapText: ({ brandName = \"\" }) =>\n `Sostieni una nuova organizzazione non profit con il tuo prossimo ordine ricorrente ${brandName}`,\n },\n pl: {\n nonprofitSwapText: ({ brandName = \"\" }) =>\n `Wesprzyj nową organizację non-profit przy kolejnym zamówieniu cyklicznym ${brandName}`,\n },\n};\n","import { css, html, LitElement } from \"lit\";\nimport { property } from \"lit/decorators/property.js\";\nimport { state } from \"lit/decorators/state.js\";\nimport { DEFAULT_BASE_URL } from \"../../api-sdk/constants\";\nimport { LANGUAGES } from \"../../api-sdk/types\";\nimport { TCart } from \"../../shared/cart-contents\";\nimport { enforceConfig } from \"../../shared/enforce-config\";\nimport { postFindOrCreateSubscription, postChainEligibleNonprofitsForCart } from \"../../api-sdk/v3/routes\";\nimport { AsyncController } from \"../../shared/controllers/async-controller\";\nimport { cssReset } from \"../../shared/css-reset\";\nimport { defineCustomElement } from \"../../shared/defineCustomElement\";\nimport { _errorMessage } from \"../../shared/fragments/error-message-template\";\nimport { _cssVariableMap } from \"../../shared/fragments/css-variable-map\";\nimport { BeamNonprofitSelectEvent } from \"../../utils/events\";\nimport { MissingConfig } from \"../../utils/beam-errors\";\nimport { strings } from \"./strings\";\n\ninterface RequiredDataPropsWithEmail {\n email: string;\n apiKey: string;\n subscriptionId: string;\n}\n\ninterface RequiredDataPropsWithPartnerUserId {\n partnerUserId: string;\n apiKey: string;\n subscriptionId: string;\n}\n\ntype TRequiredDataProps = RequiredDataPropsWithEmail | RequiredDataPropsWithPartnerUserId;\nexport class BeamSubscriptionManagement extends LitElement {\n static tagName = \"beam-subscription-management\";\n\n @property({ type: String })\n public baseUrl: string = DEFAULT_BASE_URL;\n\n @property({ type: String })\n public apiKey!: TRequiredDataProps[\"apiKey\"];\n\n @property({ type: String })\n public subscriptionId!: TRequiredDataProps[\"subscriptionId\"];\n\n @property({ type: Number, reflect: true })\n public storeId?: number; // Either storeId or postalCode, countryCode must be provided\n\n @property({ type: String })\n public email?: RequiredDataPropsWithEmail[\"email\"]; // Either email or partnerUserId must be provided\n\n @property({ type: String })\n public partnerUserId?: RequiredDataPropsWithPartnerUserId[\"partnerUserId\"]; // Either email or partnerUserId must be provided\n\n @property({ type: String })\n public postalCode?: string;\n\n @property({ type: String })\n public countryCode?: string;\n\n @property({ type: String })\n public lang: LANGUAGES = \"en\";\n\n @property({ type: Object })\n public cart?: TCart;\n\n @property({ type: Boolean })\n public debug = false;\n\n @state() private activeWidget: \"redeem-transaction\" | \"impact-overview\" | null = null; // Based on /findSubscriptionByRemoteId\n @state() private nonprofitId: number | null = null; // From /findSubscriptionByRemoteId response\n @state() private userId: string | null = null; // From findSubscriptionByRemoteId\n @state() private chainName: string | null = null; // From findEligibleNonprofitsForCart\n\n private subscriptionDataController = new AsyncController<typeof this.fetchSubscription>(this, this.fetchSubscription);\n private eligibleNonprofitsDataController = new AsyncController<typeof this.fetchEligibleNonprofits>(\n this,\n this.fetchEligibleNonprofits\n );\n\n async firstUpdated() {\n if (!this.email && !this.partnerUserId) {\n throw new MissingConfig(\n [\"email\", \"partnerUserId\"],\n \"One of the following properties needs to be specified: email, partnerUserId \"\n );\n }\n enforceConfig<TRequiredDataProps>([\"apiKey\", \"subscriptionId\"], this);\n await this.loadWidget();\n }\n\n async loadWidget() {\n // In parallel:\n // (1). Fetch eligible nonprofits [storeId and chainName]\n // (2). Fetch subscription [userId and nonprofitId]\n await Promise.all([this.fetchEligibleNonprofits(), this.fetchSubscription()]);\n this.activeWidget = this.nonprofitId ? \"impact-overview\" : \"redeem-transaction\";\n }\n\n async fetchEligibleNonprofits() {\n enforceConfig<TRequiredDataProps>([\"apiKey\", \"subscriptionId\"], this);\n const res = await postChainEligibleNonprofitsForCart({\n baseUrl: this.baseUrl,\n headers: {\n authorization: `Api-Key ${this.apiKey}`,\n },\n requestBody: {\n postalCode: this.postalCode ? this.postalCode : undefined,\n countryCode: this.countryCode ? this.countryCode : undefined,\n widgetName: \"subscription-management\",\n version: \"1.0.0\",\n },\n });\n this.chainName = res.chain.name;\n this.storeId = res.store.id;\n return res;\n }\n\n async fetchSubscription() {\n enforceConfig<TRequiredDataProps>([\"apiKey\", \"subscriptionId\"], this);\n const result = await postFindOrCreateSubscription({\n baseUrl: this.baseUrl,\n headers: {\n authorization: `Api-Key ${this.apiKey}`,\n },\n requestBody: {\n remoteSubscriptionId: this.subscriptionId,\n email: this.email,\n partnerUserId: this.partnerUserId,\n },\n });\n\n this.userId = result.beamUserId; // Returned in response regardless of subscription redemption\n this.nonprofitId = result.nonprofit?.id || null;\n return result;\n }\n\n handleSwapNonprofitButtonClick() {\n this.activeWidget = \"redeem-transaction\";\n }\n\n renderSwapNonprofitButton() {\n if (this.activeWidget === \"impact-overview\") {\n return html`<button class=\"swap-nonprofit-button\" @click=\"${this.handleSwapNonprofitButtonClick}\">\n ${strings[this.lang].nonprofitSwapText({ brandName: this.chainName || \"\" })}\n </button>`;\n } else {\n return \"\";\n }\n }\n\n public get cssVariables() {\n const defaults = {\n \"--beam-fontFamily\": \"inherit\",\n \"--beam-fontStyle\": \"inherit\",\n \"--beam-fontSize\": \"inherit\",\n \"--beam-textColor\": \"inherit\",\n \"--beam-backgroundColor\": \"inherit\",\n \"--beam-SubscriptionManagement-widgetContainer-borderColor\": \"#d5d5d5\",\n \"--beam-SubscriptionManagement-widgetContainer-borderRadius\": \"4px\",\n \"--beam-SubscriptionManagement-widgetContainer-padding\": \"15px\",\n \"--beam-SubscriptionManagement-widgetContainer-backgroundColor\": \"inherit\",\n \"--beam-SubscriptionManagement-widgetContainer-maxWidth\": \"800px\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-textDecoration\": \"underline\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-fontFamily\": \"inherit\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-fontStyle\": \"inherit\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-fontWeight\": \"inherit\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-lineHeight\": \"inherit\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-marginTop\": \"10px\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-fontSize\": \"inherit\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-color\": \"inherit\",\n };\n\n const remoteConfig = this.eligibleNonprofitsDataController?.data?.config?.web?.theme || {};\n\n const config = { ...defaults, ...remoteConfig };\n\n const serializable = Object.create({\n toCSS() {\n return _cssVariableMap(this as Record<string, string>);\n },\n });\n return Object.assign(serializable, config);\n }\n\n static styles = [\n cssReset,\n css`\n :host {\n display: block;\n font-family: var(--beam-fontFamily);\n font-style: var(--beam-fontStyle);\n font-size: var(--beam-fontSize);\n background-color: var(--beam-backgroundColor);\n color: var(--beam-textColor);\n word-break: normal;\n }\n .swap-nonprofit-button {\n margin-top: var(--beam-SubscriptionManagement-swapNonprofitButtonText-marginTop, 10px);\n color: var(--beam-SubscriptionManagement-swapNonprofitButtonText-color, inherit);\n font-size: var(--beam-SubscriptionManagement-swapNonprofitButtonText-fontSize, inherit);\n text-decoration: var(--beam-SubscriptionManagement-swapNonprofitButtonText-textDecoration, underline);\n font-family: var(--beam-SubscriptionManagement-swapNonprofitButtonText-fontFamily, inherit);\n font-style: var(--beam-SubscriptionManagement-swapNonprofitButtonText-fontStyle, inherit);\n font-weight: var(--beam-SubscriptionManagement-swapNonprofitButtonText-fontWeight, inherit);\n line-height: var(--beam-SubscriptionManagement-swapNonprofitButtonText-lineHeight, inherit);\n background: none;\n border: none;\n cursor: pointer;\n }\n .sub-widget-container {\n background-color: var(--beam-SubscriptionManagement-widgetContainer-backgroundColor, inherit);\n border: 1px solid var(--beam-SubscriptionManagement-widgetContainer-borderColor, #d5d5d5);\n border-radius: var(--beam-SubscriptionManagement-widgetContainer-borderRadius, 4px);\n overflow: hidden; /* maintain clean border-radius */\n padding: var(--beam-SubscriptionManagement-widgetContainer-padding, 15px);\n max-width: var(--beam-SubscriptionManagement-widgetContainer-maxWidth, 800px);\n }\n }`,\n ];\n\n render() {\n let content;\n\n if (this.subscriptionDataController.loading || this.eligibleNonprofitsDataController.loading) {\n content = \"\";\n }\n\n if ((this.subscriptionDataController.error || this.eligibleNonprofitsDataController.error) && this.debug) {\n if (this.subscriptionDataController.error !== null) {\n return _errorMessage({ error: this.subscriptionDataController.error });\n } else if (this.eligibleNonprofitsDataController.error !== null) {\n return _errorMessage({ error: this.eligibleNonprofitsDataController.error });\n }\n } else {\n content = \"\";\n }\n\n if (this.activeWidget === \"redeem-transaction\") {\n content = html` <beam-redeem-transaction\n part=\"redeem-transaction\"\n subscriptionId=\"${this.subscriptionId}\"\n nonprofitId=${this.nonprofitId}\n baseUrl=\"${this.baseUrl}\"\n apiKey=\"${this.apiKey}\"\n postalCode=\"${this.postalCode}\"\n countryCode=\"${this.countryCode}\"\n lang=\"${this.lang}\"\n ?debug=\"${this.debug}\"\n @beamnonprofitselect=\"${(event: Event) => {\n if (!(event instanceof BeamNonprofitSelectEvent)) return; // TS guard\n const { selectedNonprofitId } = event.detail;\n this.nonprofitId = selectedNonprofitId ?? null;\n this.activeWidget = \"impact-overview\";\n }}\"\n ></beam-redeem-transaction>`;\n } else if (this.activeWidget === \"impact-overview\") {\n content = html`\n <beam-impact-overview\n part=\"impact-overview\"\n baseUrl=\"${this.baseUrl}\"\n apiKey=\"${this.apiKey}\"\n userId=\"${this.userId}\"\n nonprofitId=\"${this.nonprofitId}\"\n lang=\"${this.lang}\"\n ?debug=\"${this.debug}\"\n ></beam-impact-overview>\n `;\n }\n return html`\n <style>\n :host {\n ${this.cssVariables.toCSS()}\n }\n </style>\n <div class=\"sub-widget-container\">${content}</div>\n ${this.renderSwapNonprofitButton()}\n `;\n }\n}\n\ndefineCustomElement(BeamSubscriptionManagement);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"beam-subscription-management\": BeamSubscriptionManagement;\n }\n}\n"],"names":["strings","brandName","m","h","e","l","n","t","o","i","a","d","BeamSubscriptionManagement","LitElement","DEFAULT_BASE_URL","AsyncController","MissingConfig","enforceConfig","res","postChainEligibleNonprofitsForCart","result","postFindOrCreateSubscription","html","defaults","remoteConfig","config","_cssVariableMap","content","_errorMessage","event","BeamNonprofitSelectEvent","selectedNonprofitId","cssReset","css","__decorateClass","property","state","defineCustomElement"],"mappings":"2XAAO,MAAMA,EAAU,CACrB,GAAI,CACF,kBAAmB,CAAC,CAAE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EAAA,CADNC,EAAS,CAAE,KAAM,MAAO,CAAC,CAAA,EArBfvB,EAsBJ,UAAA,aAAA,CAAA,EAGAsB,EAAA,CADNC,EAAS,CAAE,KAAM,MAAO,CAAC,CAAA,EAxBfvB,EAyBJ,UAAA,cAAA,CAAA,EAGAsB,EAAA,CADNC,EAAS,CAAE,KAAM,MAAO,CAAC,CA3Bf,EAAAvB,EA4BJ,oBAGAsB,EAAA,CADNC,EAAS,CAAE,KAAM,MAAO,CAAC,CAAA,EA9BfvB,EA+BJ,UAGAsB,OAAAA,CAAAA,EAAAA,EAAA,CADNC,EAAS,CAAE,KAAM,OAAQ,CAAC,GAjChBvB,EAkCJ,UAAA,QAAA,CAAA,EAEUsB,EAAA,CAAhBE,EAAM,CAAA,EApCIxB,EAoCM,UAAA,eAAA,CAAA,EACAsB,EAAA,CAAhBE,GArCU,EAAAxB,EAqCM,UACAsB,cAAAA,CAAAA,EAAAA,EAAA,CAAhBE,KAtCUxB,EAsCM,UAAA,SAAA,CAAA,EACAsB,EAAA,CAAhBE,EAAM,CAAA,EAvCIxB,EAuCM,UAAA,YAAA,CAAA,EAiNnByB,EAAoBzB,CAA0B"}
|
|
1
|
+
{"version":3,"file":"subscription-management.js","sources":["../../src/components/subscription-management/strings.ts","../../src/components/subscription-management/index.ts"],"sourcesContent":["export const strings = {\n en: {\n nonprofitSwapText: ({ brandName = \"\" }) => `Support a new nonprofit with your next ${brandName} recurring order`,\n },\n fr: {\n nonprofitSwapText: ({ brandName = \"\" }) =>\n `Soutenez une nouvelle organisation à but non lucratif avec votre prochaine commande récurrente ${brandName}`,\n },\n de: {\n nonprofitSwapText: ({ brandName = \"\" }) =>\n `Unterstützen Sie eine neue gemeinnützige Organisation mit Ihrer nächsten wiederkehrenden Bestellung bei ${brandName}`,\n },\n es: {\n nonprofitSwapText: ({ brandName = \"\" }) =>\n `Apoye a una nueva organización sin fines de lucro con su próximo pedido recurrente ${brandName}`,\n },\n it: {\n nonprofitSwapText: ({ brandName = \"\" }) =>\n `Sostieni una nuova organizzazione non profit con il tuo prossimo ordine ricorrente ${brandName}`,\n },\n pl: {\n nonprofitSwapText: ({ brandName = \"\" }) =>\n `Wesprzyj nową organizację non-profit przy kolejnym zamówieniu cyklicznym ${brandName}`,\n },\n};\n","import { css, html, LitElement } from \"lit\";\nimport { property } from \"lit/decorators/property.js\";\nimport { state } from \"lit/decorators/state.js\";\nimport { DEFAULT_BASE_URL } from \"../../api-sdk/constants\";\nimport { LANGUAGES } from \"../../api-sdk/types\";\nimport { TCart } from \"../../shared/cart-contents\";\nimport { enforceConfig } from \"../../shared/enforce-config\";\nimport { postFindOrCreateSubscription, postChainEligibleNonprofitsForCart } from \"../../api-sdk/v3/routes\";\nimport { AsyncController } from \"../../shared/controllers/async-controller\";\nimport { cssReset } from \"../../shared/css-reset\";\nimport { defineCustomElement } from \"../../shared/defineCustomElement\";\nimport { _errorMessage } from \"../../shared/fragments/error-message-template\";\nimport { _cssVariableMap } from \"../../shared/fragments/css-variable-map\";\nimport { BeamNonprofitSelectEvent } from \"../../utils/events\";\nimport { MissingConfig } from \"../../utils/beam-errors\";\nimport { strings } from \"./strings\";\n\ninterface RequiredDataPropsWithEmail {\n email: string;\n apiKey: string;\n subscriptionId: string;\n}\n\ninterface RequiredDataPropsWithPartnerUserId {\n partnerUserId: string;\n apiKey: string;\n subscriptionId: string;\n}\n\ntype TRequiredDataProps = RequiredDataPropsWithEmail | RequiredDataPropsWithPartnerUserId;\nexport class BeamSubscriptionManagement extends LitElement {\n static tagName = \"beam-subscription-management\";\n\n @property({ type: String })\n public baseUrl: string = DEFAULT_BASE_URL;\n\n @property({ type: String })\n public apiKey!: TRequiredDataProps[\"apiKey\"];\n\n @property({ type: String })\n public subscriptionId!: TRequiredDataProps[\"subscriptionId\"];\n\n @property({ type: Number, reflect: true })\n public storeId?: number; // Either storeId or postalCode, countryCode must be provided\n\n @property({ type: String })\n public email?: RequiredDataPropsWithEmail[\"email\"]; // Either email or partnerUserId must be provided\n\n @property({ type: String })\n public partnerUserId?: RequiredDataPropsWithPartnerUserId[\"partnerUserId\"]; // Either email or partnerUserId must be provided\n\n @property({ type: String })\n public postalCode?: string;\n\n @property({ type: String })\n public countryCode?: string;\n\n @property({ type: String })\n public lang: LANGUAGES = \"en\";\n\n @property({ type: Object })\n public cart?: TCart;\n\n @property({ type: Boolean })\n public debug = false;\n\n @state() private activeWidget: \"redeem-transaction\" | \"impact-overview\" | null = null; // Based on /findSubscriptionByRemoteId\n @state() private nonprofitId: number | null = null; // From /findSubscriptionByRemoteId response\n @state() private userId: string | null = null; // From findSubscriptionByRemoteId\n @state() private chainName: string | null = null; // From findEligibleNonprofitsForCart\n\n private subscriptionDataController = new AsyncController<typeof this.fetchSubscription>(this, this.fetchSubscription);\n private eligibleNonprofitsDataController = new AsyncController<typeof this.fetchEligibleNonprofits>(\n this,\n this.fetchEligibleNonprofits\n );\n\n async firstUpdated() {\n if (!this.email && !this.partnerUserId) {\n throw new MissingConfig(\n [\"email\", \"partnerUserId\"],\n \"One of the following properties needs to be specified: email, partnerUserId \"\n );\n }\n enforceConfig<TRequiredDataProps>([\"apiKey\", \"subscriptionId\"], this);\n await this.loadWidget();\n }\n\n async loadWidget() {\n // In parallel:\n // (1). Fetch eligible nonprofits [storeId and chainName]\n // (2). Fetch subscription [userId and nonprofitId]\n await Promise.all([this.fetchEligibleNonprofits(), this.fetchSubscription()]);\n this.activeWidget = this.nonprofitId ? \"impact-overview\" : \"redeem-transaction\";\n }\n\n async fetchEligibleNonprofits() {\n enforceConfig<TRequiredDataProps>([\"apiKey\", \"subscriptionId\"], this);\n const res = await postChainEligibleNonprofitsForCart({\n baseUrl: this.baseUrl,\n headers: {\n authorization: `Api-Key ${this.apiKey}`,\n },\n requestBody: {\n postalCode: this.postalCode ? this.postalCode : undefined,\n countryCode: this.countryCode ? this.countryCode : undefined,\n widgetName: \"subscription-management\",\n version: \"1.0.0\",\n },\n });\n this.chainName = res.chain.name;\n this.storeId = res.store.id;\n this.eligibleNonprofitsDataController.data = res;\n return res;\n }\n\n async fetchSubscription() {\n enforceConfig<TRequiredDataProps>([\"apiKey\", \"subscriptionId\"], this);\n const result = await postFindOrCreateSubscription({\n baseUrl: this.baseUrl,\n headers: {\n authorization: `Api-Key ${this.apiKey}`,\n },\n requestBody: {\n remoteSubscriptionId: this.subscriptionId,\n email: this.email,\n partnerUserId: this.partnerUserId,\n },\n });\n\n this.userId = result.beamUserId; // Returned in response regardless of subscription redemption\n this.nonprofitId = result.nonprofit?.id || null;\n return result;\n }\n\n handleSwapNonprofitButtonClick() {\n this.activeWidget = \"redeem-transaction\";\n }\n\n renderSwapNonprofitButton() {\n if (this.activeWidget === \"impact-overview\") {\n return html`<button class=\"swap-nonprofit-button\" @click=\"${this.handleSwapNonprofitButtonClick}\">\n ${strings[this.lang].nonprofitSwapText({ brandName: this.chainName || \"\" })}\n </button>`;\n } else {\n return \"\";\n }\n }\n\n public get cssVariables() {\n const defaults = {\n \"--beam-fontFamily\": \"inherit\",\n \"--beam-fontStyle\": \"inherit\",\n \"--beam-fontSize\": \"inherit\",\n \"--beam-textColor\": \"inherit\",\n \"--beam-backgroundColor\": \"inherit\",\n \"--beam-SubscriptionManagement-widgetContainer-borderColor\": \"#d5d5d5\",\n \"--beam-SubscriptionManagement-widgetContainer-borderRadius\": \"4px\",\n \"--beam-SubscriptionManagement-widgetContainer-padding\": \"15px\",\n \"--beam-SubscriptionManagement-widgetContainer-backgroundColor\": \"inherit\",\n \"--beam-SubscriptionManagement-widgetContainer-maxWidth\": \"800px\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-textDecoration\": \"underline\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-fontFamily\": \"inherit\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-fontStyle\": \"inherit\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-fontWeight\": \"inherit\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-lineHeight\": \"inherit\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-marginTop\": \"10px\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-fontSize\": \"inherit\",\n \"--beam-SubscriptionManagement-swapNonprofitButtonText-color\": \"inherit\",\n };\n\n const remoteConfig = this.eligibleNonprofitsDataController?.data?.config?.web?.theme || {};\n\n const config = { ...defaults, ...remoteConfig };\n\n const serializable = Object.create({\n toCSS() {\n return _cssVariableMap(this as Record<string, string>);\n },\n });\n return Object.assign(serializable, config);\n }\n\n static styles = [\n cssReset,\n css`\n :host {\n display: block;\n font-family: var(--beam-fontFamily);\n font-style: var(--beam-fontStyle);\n font-size: var(--beam-fontSize);\n background-color: var(--beam-backgroundColor);\n color: var(--beam-textColor);\n word-break: normal;\n }\n .swap-nonprofit-button {\n margin-top: var(--beam-SubscriptionManagement-swapNonprofitButtonText-marginTop, 10px);\n color: var(--beam-SubscriptionManagement-swapNonprofitButtonText-color, inherit);\n font-size: var(--beam-SubscriptionManagement-swapNonprofitButtonText-fontSize, inherit);\n text-decoration: var(--beam-SubscriptionManagement-swapNonprofitButtonText-textDecoration, underline);\n font-family: var(--beam-SubscriptionManagement-swapNonprofitButtonText-fontFamily, inherit);\n font-style: var(--beam-SubscriptionManagement-swapNonprofitButtonText-fontStyle, inherit);\n font-weight: var(--beam-SubscriptionManagement-swapNonprofitButtonText-fontWeight, inherit);\n line-height: var(--beam-SubscriptionManagement-swapNonprofitButtonText-lineHeight, inherit);\n background: none;\n border: none;\n cursor: pointer;\n }\n .sub-widget-container {\n background-color: var(--beam-SubscriptionManagement-widgetContainer-backgroundColor, inherit);\n border: 1px solid var(--beam-SubscriptionManagement-widgetContainer-borderColor, #d5d5d5);\n border-radius: var(--beam-SubscriptionManagement-widgetContainer-borderRadius, 4px);\n overflow: hidden; /* maintain clean border-radius */\n padding: var(--beam-SubscriptionManagement-widgetContainer-padding, 15px);\n max-width: var(--beam-SubscriptionManagement-widgetContainer-maxWidth, 800px);\n }\n }`,\n ];\n\n render() {\n let content;\n\n if (this.subscriptionDataController.loading || this.eligibleNonprofitsDataController.loading) {\n content = \"\";\n }\n\n if ((this.subscriptionDataController.error || this.eligibleNonprofitsDataController.error) && this.debug) {\n if (this.subscriptionDataController.error !== null) {\n return _errorMessage({ error: this.subscriptionDataController.error });\n } else if (this.eligibleNonprofitsDataController.error !== null) {\n return _errorMessage({ error: this.eligibleNonprofitsDataController.error });\n }\n } else {\n content = \"\";\n }\n\n if (this.activeWidget === \"redeem-transaction\") {\n content = html` <beam-redeem-transaction\n part=\"redeem-transaction\"\n subscriptionId=\"${this.subscriptionId}\"\n nonprofitId=${this.nonprofitId}\n baseUrl=\"${this.baseUrl}\"\n apiKey=\"${this.apiKey}\"\n postalCode=\"${this.postalCode}\"\n countryCode=\"${this.countryCode}\"\n lang=\"${this.lang}\"\n ?debug=\"${this.debug}\"\n @beamnonprofitselect=\"${(event: Event) => {\n if (!(event instanceof BeamNonprofitSelectEvent)) return; // TS guard\n const { selectedNonprofitId } = event.detail;\n this.nonprofitId = selectedNonprofitId ?? null;\n this.activeWidget = \"impact-overview\";\n }}\"\n ></beam-redeem-transaction>`;\n } else if (this.activeWidget === \"impact-overview\") {\n content = html`\n <beam-impact-overview\n part=\"impact-overview\"\n baseUrl=\"${this.baseUrl}\"\n apiKey=\"${this.apiKey}\"\n userId=\"${this.userId}\"\n nonprofitId=\"${this.nonprofitId}\"\n lang=\"${this.lang}\"\n ?debug=\"${this.debug}\"\n ></beam-impact-overview>\n `;\n }\n return html`\n <style>\n :host {\n ${this.cssVariables.toCSS()}\n }\n </style>\n <div class=\"sub-widget-container\">${content}</div>\n ${this.renderSwapNonprofitButton()}\n `;\n }\n}\n\ndefineCustomElement(BeamSubscriptionManagement);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"beam-subscription-management\": BeamSubscriptionManagement;\n }\n}\n"],"names":["strings","brandName","m","h","e","l","n","t","o","i","a","d","BeamSubscriptionManagement","LitElement","DEFAULT_BASE_URL","AsyncController","MissingConfig","enforceConfig","res","postChainEligibleNonprofitsForCart","result","postFindOrCreateSubscription","html","defaults","remoteConfig","config","_cssVariableMap","content","_errorMessage","event","BeamNonprofitSelectEvent","selectedNonprofitId","cssReset","css","__decorateClass","property","state","defineCustomElement"],"mappings":"2XAAO,MAAMA,EAAU,CACrB,GAAI,CACF,kBAAmB,CAAC,CAAE,UAAAC,EAAY,EAAG,IAAM,0CAA0CA,CAAS,kBAChG,EACA,GAAI,CACF,kBAAmB,CAAC,CAAE,UAAAA,EAAY,EAAG,IACnC,wGAAkGA,CAAS,EAC/G,EACA,GAAI,CACF,kBAAmB,CAAC,CAAE,UAAAA,EAAY,EAAG,IACnC,oHAA2GA,CAAS,EACxH,EACA,GAAI,CACF,kBAAmB,CAAC,CAAE,UAAAA,EAAY,EAAG,IACnC,4FAAsFA,CAAS,EACnG,EACA,GAAI,CACF,kBAAmB,CAAC,CAAE,UAAAA,EAAY,EAAG,IACnC,sFAAsFA,CAAS,EACnG,EACA,GAAI,CACF,kBAAmB,CAAC,CAAE,UAAAA,EAAY,EAAG,IACnC,yFAA4EA,CAAS,EACzF,CACF,ECxBA,IAAAC,EAAA,OAAA,eAAAC,EAAA,OAAA,yBAAAC,EAAA,CAAAC,EAAAC,EAAAC,EAAAC,IAAA,CAAA,QAAAC,EAAAD,EAAA,EAAA,OAAAA,EAAAL,EAAAG,EAAAC,CAAA,EAAAD,EAAAI,EAAAL,EAAA,OAAA,EAAAM,EAAAD,GAAA,EAAAA,KAAAC,EAAAN,EAAAK,CAAA,KAAAD,GAAAD,EAAAG,EAAAL,EAAAC,EAAAE,CAAA,EAAAE,EAAAF,CAAA,IAAAA,GAAA,OAAAD,GAAAC,GAAAP,EAAAI,EAAAC,EAAAE,CAAA,EAAAA,CAAA,EA8Ba,MAAAG,UAAmCC,CAAW,CAApD,aAIL,CAAA,MAAA,GAAA,SAAA,EAAA,KAAO,QAAkBC,EAwBzB,KAAO,KAAkB,KAMzB,KAAO,MAAQ,GAEN,KAAQ,aAAgE,KACxE,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9B,EAAAvB,EAaJ,UAGAsB,UAAAA,CAAAA,EAAAA,EAAA,CADNC,EAAS,CAAE,KAAM,MAAO,CAAC,CAAA,EAffvB,EAgBJ,UAAA,QAAA,CAAA,EAGAsB,EAAA,CADNC,EAAS,CAAE,KAAM,MAAO,CAAC,CAlBf,EAAAvB,EAmBJ,UAGAsB,gBAAAA,CAAAA,EAAAA,EAAA,CADNC,EAAS,CAAE,KAAM,MAAO,CAAC,CAAA,EArBfvB,EAsBJ,UAAA,aAAA,CAAA,EAGAsB,EAAA,CADNC,EAAS,CAAE,KAAM,MAAO,CAAC,CAAA,EAxBfvB,EAyBJ,UAAA,cAAA,CAAA,EAGAsB,EAAA,CADNC,EAAS,CAAE,KAAM,MAAO,CAAC,CA3Bf,EAAAvB,EA4BJ,oBAGAsB,EAAA,CADNC,EAAS,CAAE,KAAM,MAAO,CAAC,CAAA,EA9BfvB,EA+BJ,UAGAsB,OAAAA,CAAAA,EAAAA,EAAA,CADNC,EAAS,CAAE,KAAM,OAAQ,CAAC,GAjChBvB,EAkCJ,UAAA,QAAA,CAAA,EAEUsB,EAAA,CAAhBE,EAAM,CAAA,EApCIxB,EAoCM,UAAA,eAAA,CAAA,EACAsB,EAAA,CAAhBE,GArCU,EAAAxB,EAqCM,UACAsB,cAAAA,CAAAA,EAAAA,EAAA,CAAhBE,KAtCUxB,EAsCM,UAAA,SAAA,CAAA,EACAsB,EAAA,CAAhBE,EAAM,CAAA,EAvCIxB,EAuCM,UAAA,YAAA,CAAA,EAkNnByB,EAAoBzB,CAA0B"}
|
package/dist/index.esm.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{i as Q}from"./chunks/index-5yFqo0yl.esm.js";import{i as T}from"./chunks/index-
|
|
1
|
+
import{i as Q}from"./chunks/index-5yFqo0yl.esm.js";import{i as T}from"./chunks/index-0-TeGf3K.esm.js";import{i as X}from"./chunks/index-o7YiP4gC.esm.js";import{i as Z}from"./chunks/index-9gijHGwh.esm.js";import"./components/community-impact.esm.js";import"./chunks/lit-yVXn5Cbs.esm.js";import"./chunks/progress-bar-7gWYaGlq.esm.js";import"./components/beam-partner-logos.esm.js";import"./chunks/enforce-config-qna7hEL6.esm.js";import"./chunks/beam-errors-P-Lu07Ce.esm.js";import"./utils/logger.esm.js";import"./chunks/routes-Y3xQURF0.esm.js";import"./chunks/localize-GCkVUD8S.esm.js";import"./chunks/css-card-grid-3b56QBzq.esm.js";import"./components/cumulative-impact.esm.js";import"./chunks/lodash-P8OIs-at.esm.js";import"./chunks/is-all-html-elements-SdSkxirh.esm.js";import"./components/impact-overview.esm.js";import"./chunks/vendor-eeJfrOkP.esm.js";import"./chunks/responsive-LYEag6TI.esm.js";import"./components/select-nonprofit.esm.js";import"./chunks/events-5IECSF-x.esm.js";import"./utils/network-listeners.esm.js";import"./utils/local-storage.esm.js";import"./utils/cookies.esm.js";import"./chunks/cart-contents-h60geKWa.esm.js";import"./components/redeem-transaction.esm.js";import"./components/post-purchase.esm.js";import"./components/subscription-management.esm.js";import"./chunks/index-OnjTwvAw.esm.js";import"./utils/wait-for-element.esm.js";import"./utils/remote-session.esm.js";import"./utils/memoize-last.esm.js";import"./chunks/index-ePiYABlF.esm.js";import"./chunks/order-page-U_bvO9-n.esm.js";import"./chunks/update-cart-OMt_qKQ8.esm.js";import"./chunks/index-9YcaEQju.esm.js";import"./chunks/index-d7x511He.esm.js";import"./chunks/index-AzO-vVC_.esm.js";import"./react/community-impact.esm.js";import"react";import"./react/cumulative-impact.esm.js";import"./react/impact-overview.esm.js";import"./react/select-nonprofit.esm.js";import"./react/redeem-transaction.esm.js";import"./react/post-purchase.esm.js";import"./react/subscription-management.esm.js";export{T as Integrations,X as ReactComponents,Z as Utils,Q as WebComponents};
|
|
2
2
|
//# sourceMappingURL=index.esm.js.map
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{i as Q}from"./chunks/index-IzAvjker.esm.js";import{i as T}from"./chunks/index-
|
|
1
|
+
import{i as Q}from"./chunks/index-IzAvjker.esm.js";import{i as T}from"./chunks/index-Q1G7wE5Y.esm.js";import{i as X}from"./chunks/index-EHubF2KN.esm.js";import{i as Z}from"./chunks/index-wsdeaTHd.esm.js";import"./components/community-impact.js";import"./chunks/lit-yVXn5Cbs.esm.js";import"./chunks/progress-bar-7gWYaGlq.esm.js";import"./components/beam-partner-logos.js";import"./chunks/enforce-config-fo8kIfoY.esm.js";import"./chunks/beam-errors-P-Lu07Ce.esm.js";import"./utils/logger.js";import"./chunks/routes-fBXLZ-QV.esm.js";import"./chunks/localize-pzAAkBvG.esm.js";import"./chunks/css-card-grid-3b56QBzq.esm.js";import"./components/cumulative-impact.js";import"./chunks/lodash-P8OIs-at.esm.js";import"./chunks/is-all-html-elements-SdSkxirh.esm.js";import"./components/impact-overview.js";import"./chunks/vendor-eeJfrOkP.esm.js";import"./chunks/responsive-LYEag6TI.esm.js";import"./components/select-nonprofit.js";import"./chunks/events-5IECSF-x.esm.js";import"./utils/network-listeners.js";import"./utils/local-storage.js";import"./utils/cookies.js";import"./chunks/cart-contents-h60geKWa.esm.js";import"./components/redeem-transaction.js";import"./components/post-purchase.js";import"./components/subscription-management.js";import"./chunks/index-U8Oy2aur.esm.js";import"./utils/wait-for-element.js";import"./utils/remote-session.js";import"./utils/memoize-last.js";import"./chunks/index-GnUmyy1z.esm.js";import"./chunks/order-page-Lr9R8-is.esm.js";import"./chunks/update-cart-9ANMUWR9.esm.js";import"./chunks/index-Z1UUeVXR.esm.js";import"./chunks/index-IR9Ar71Q.esm.js";import"./chunks/index-eZQGsMRE.esm.js";import"./react/community-impact.js";import"react";import"./react/cumulative-impact.js";import"./react/impact-overview.js";import"./react/select-nonprofit.js";import"./react/redeem-transaction.js";import"./react/post-purchase.js";import"./react/subscription-management.js";export{T as Integrations,X as ReactComponents,Z as Utils,Q as WebComponents};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{D as u,a as g}from"../chunks/routes-
|
|
1
|
+
import{D as u,a as g}from"../chunks/routes-Y3xQURF0.esm.js";import{S as y}from"../chunks/beam-errors-P-Lu07Ce.esm.js";import{B as h}from"../chunks/events-5IECSF-x.esm.js";import{logger as w}from"../utils/logger.esm.js";import{s as f}from"../chunks/index-AzO-vVC_.esm.js";var v=(t,s,a)=>{if(!s.has(t))throw TypeError("Cannot "+a)},c=(t,s,a)=>{if(s.has(t))throw TypeError("Cannot add the same private member more than once");s instanceof WeakSet?s.add(t):s.set(t,a)},i=(t,s,a)=>(v(t,s,"access private method"),a),r,n,o,m;let p,l;const E=new Promise((t,s)=>{p=t,l=s});class U extends EventTarget{constructor(s){super(),c(this,r),c(this,o),this.readyPromise=E,this.plugins={},this.status="pending",i(this,r,n).call(this,s)}async init(s){i(this,r,n).call(this,s);try{await i(this,o,m).call(this,s)}catch(a){const e=new y;throw e.cause=a,this.status="error",this.dispatchEvent(new h({status:"error",error:e})),l(e),w.error(e),this.apiKey&&await f({apiKey:this.apiKey,baseUrl:this.logUrl},{type:"error",code:e.name,metadata:{message:e.message,cause:a?.message}}),a}return this.status="ready",this.dispatchEvent(new h({status:"ready"})),p(!0),this}}r=new WeakSet,n=function(t){this.apiKey=t.apiKey,this.chainId=t.chainId,this.storeId=t.storeId,this.domain=t.domain,this.baseUrl=t.baseUrl||u,this.logUrl=t.logUrl||g},o=new WeakSet,m=async function(t){const s=(t.plugins||[]).map(async a=>(await a.init(t),this.plugins[a.name]=a,a));return Promise.all(s)};const d=new U({}),S=t=>d.init(t),L=()=>d;export{L as getConfig,S as init};
|
|
2
2
|
//# sourceMappingURL=beam.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{D as u,a as g}from"../chunks/routes-
|
|
1
|
+
import{D as u,a as g}from"../chunks/routes-fBXLZ-QV.esm.js";import{S as y}from"../chunks/beam-errors-P-Lu07Ce.esm.js";import{B as h}from"../chunks/events-5IECSF-x.esm.js";import{logger as w}from"../utils/logger.js";import{s as f}from"../chunks/index-eZQGsMRE.esm.js";var v=(t,s,a)=>{if(!s.has(t))throw TypeError("Cannot "+a)},c=(t,s,a)=>{if(s.has(t))throw TypeError("Cannot add the same private member more than once");s instanceof WeakSet?s.add(t):s.set(t,a)},i=(t,s,a)=>(v(t,s,"access private method"),a),r,n,o,m;let p,l;const E=new Promise((t,s)=>{p=t,l=s});class U extends EventTarget{constructor(s){super(),c(this,r),c(this,o),this.readyPromise=E,this.plugins={},this.status="pending",i(this,r,n).call(this,s)}async init(s){i(this,r,n).call(this,s);try{await i(this,o,m).call(this,s)}catch(a){const e=new y;throw e.cause=a,this.status="error",this.dispatchEvent(new h({status:"error",error:e})),l(e),w.error(e),this.apiKey&&await f({apiKey:this.apiKey,baseUrl:this.logUrl},{type:"error",code:e.name,metadata:{message:e.message,cause:a?.message}}),a}return this.status="ready",this.dispatchEvent(new h({status:"ready"})),p(!0),this}}r=new WeakSet,n=function(t){this.apiKey=t.apiKey,this.chainId=t.chainId,this.storeId=t.storeId,this.domain=t.domain,this.baseUrl=t.baseUrl||u,this.logUrl=t.logUrl||g},o=new WeakSet,m=async function(t){const s=(t.plugins||[]).map(async a=>(await a.init(t),this.plugins[a.name]=a,a));return Promise.all(s)};const d=new U({}),S=t=>d.init(t),L=()=>d;export{L as getConfig,S as init};
|
|
2
2
|
//# sourceMappingURL=beam.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{x as C}from"../chunks/update-cart-
|
|
1
|
+
import{x as C}from"../chunks/update-cart-OMt_qKQ8.esm.js";import"../chunks/lodash-P8OIs-at.esm.js";import"../chunks/routes-Y3xQURF0.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../utils/logger.esm.js";import"../chunks/events-5IECSF-x.esm.js";import"../utils/network-listeners.esm.js";import"../utils/local-storage.esm.js";import"../utils/cookies.esm.js";import"../utils/remote-session.esm.js";import"../utils/memoize-last.esm.js";import"../chunks/cart-contents-h60geKWa.esm.js";export{C as updateCart};
|
|
2
2
|
//# sourceMappingURL=cart.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{x as C}from"../chunks/update-cart-
|
|
1
|
+
import{x as C}from"../chunks/update-cart-9ANMUWR9.esm.js";import"../chunks/lodash-P8OIs-at.esm.js";import"../chunks/routes-fBXLZ-QV.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../utils/logger.js";import"../chunks/events-5IECSF-x.esm.js";import"../utils/network-listeners.js";import"../utils/local-storage.js";import"../utils/cookies.js";import"../utils/remote-session.js";import"../utils/memoize-last.js";import"../chunks/cart-contents-h60geKWa.esm.js";export{C as updateCart};
|
|
2
2
|
//# sourceMappingURL=cart.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{i as w}from"../chunks/index-
|
|
1
|
+
import{i as w}from"../chunks/index-OnjTwvAw.esm.js";import{i as A}from"../chunks/index-ePiYABlF.esm.js";import{i as D}from"../chunks/index-9YcaEQju.esm.js";import{i as F}from"../chunks/index-d7x511He.esm.js";import{i as H}from"../chunks/index-AzO-vVC_.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../chunks/events-5IECSF-x.esm.js";import"../utils/logger.esm.js";import"../utils/network-listeners.esm.js";import"../utils/local-storage.esm.js";import"../utils/wait-for-element.esm.js";import"../utils/cookies.esm.js";import"../utils/remote-session.esm.js";import"../utils/memoize-last.esm.js";import"../chunks/lodash-P8OIs-at.esm.js";import"../chunks/order-page-U_bvO9-n.esm.js";import"../chunks/cart-contents-h60geKWa.esm.js";import"../chunks/update-cart-OMt_qKQ8.esm.js";import"../chunks/routes-Y3xQURF0.esm.js";import"../components/post-purchase.esm.js";import"../chunks/lit-yVXn5Cbs.esm.js";import"../chunks/enforce-config-qna7hEL6.esm.js";import"../components/redeem-transaction.esm.js";import"../chunks/progress-bar-7gWYaGlq.esm.js";import"../components/beam-partner-logos.esm.js";import"../chunks/localize-GCkVUD8S.esm.js";import"../chunks/css-card-grid-3b56QBzq.esm.js";import"../components/impact-overview.esm.js";import"../chunks/vendor-eeJfrOkP.esm.js";import"../chunks/is-all-html-elements-SdSkxirh.esm.js";import"../chunks/responsive-LYEag6TI.esm.js";export{F as Cart,H as Logs,D as Session,A as Shopify,w as Utils};
|
|
2
2
|
//# sourceMappingURL=index.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{i as w}from"../chunks/index-U8Oy2aur.esm.js";import{i as A}from"../chunks/index-
|
|
1
|
+
import{i as w}from"../chunks/index-U8Oy2aur.esm.js";import{i as A}from"../chunks/index-GnUmyy1z.esm.js";import{i as D}from"../chunks/index-Z1UUeVXR.esm.js";import{i as F}from"../chunks/index-IR9Ar71Q.esm.js";import{i as H}from"../chunks/index-eZQGsMRE.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../chunks/events-5IECSF-x.esm.js";import"../utils/logger.js";import"../utils/network-listeners.js";import"../utils/local-storage.js";import"../utils/wait-for-element.js";import"../utils/cookies.js";import"../utils/remote-session.js";import"../utils/memoize-last.js";import"../chunks/lodash-P8OIs-at.esm.js";import"../chunks/order-page-Lr9R8-is.esm.js";import"../chunks/cart-contents-h60geKWa.esm.js";import"../chunks/update-cart-9ANMUWR9.esm.js";import"../chunks/routes-fBXLZ-QV.esm.js";import"../components/post-purchase.js";import"../chunks/lit-yVXn5Cbs.esm.js";import"../chunks/enforce-config-fo8kIfoY.esm.js";import"../components/redeem-transaction.js";import"../chunks/progress-bar-7gWYaGlq.esm.js";import"../components/beam-partner-logos.js";import"../chunks/localize-pzAAkBvG.esm.js";import"../chunks/css-card-grid-3b56QBzq.esm.js";import"../components/impact-overview.js";import"../chunks/vendor-eeJfrOkP.esm.js";import"../chunks/is-all-html-elements-SdSkxirh.esm.js";import"../chunks/responsive-LYEag6TI.esm.js";export{F as Cart,H as Logs,D as Session,A as Shopify,w as Utils};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../chunks/routes-
|
|
1
|
+
import"../chunks/routes-Y3xQURF0.esm.js";import"../utils/logger.esm.js";import{s as i}from"../chunks/index-AzO-vVC_.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";export{i as sendLog};
|
|
2
2
|
//# sourceMappingURL=logs.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../chunks/routes-
|
|
1
|
+
import"../chunks/routes-fBXLZ-QV.esm.js";import"../utils/logger.js";import{s as i}from"../chunks/index-eZQGsMRE.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";export{i as sendLog};
|
|
2
2
|
//# sourceMappingURL=logs.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{g as T,C as W,L as j,s as l,P as q}from"../chunks/order-page-
|
|
1
|
+
import{g as T,C as W,L as j,s as l,P as q}from"../chunks/order-page-U_bvO9-n.esm.js";import"../chunks/lodash-P8OIs-at.esm.js";import"../chunks/events-5IECSF-x.esm.js";import"../utils/logger.esm.js";import"../utils/network-listeners.esm.js";import"../utils/local-storage.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../utils/cookies.esm.js";import"../utils/memoize-last.esm.js";import"../chunks/cart-contents-h60geKWa.esm.js";import"../chunks/update-cart-OMt_qKQ8.esm.js";import"../chunks/routes-Y3xQURF0.esm.js";import"../utils/remote-session.esm.js";import"../components/post-purchase.esm.js";import"../chunks/lit-yVXn5Cbs.esm.js";import"../chunks/enforce-config-qna7hEL6.esm.js";import"../components/redeem-transaction.esm.js";import"../chunks/progress-bar-7gWYaGlq.esm.js";import"../components/beam-partner-logos.esm.js";import"../chunks/localize-GCkVUD8S.esm.js";import"../chunks/css-card-grid-3b56QBzq.esm.js";import"../components/impact-overview.esm.js";import"../chunks/vendor-eeJfrOkP.esm.js";import"../chunks/is-all-html-elements-SdSkxirh.esm.js";import"../chunks/responsive-LYEag6TI.esm.js";import"../utils/wait-for-element.esm.js";export{T as addBeamAttributesToCart,W as getCurrentCart,j as registerCartIntegration,l as showBeamOrderPageWidgets,q as trackCart};
|
|
2
2
|
//# sourceMappingURL=shopify.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{g as T,C as W,L as j,s as l,P as q}from"../chunks/order-page-
|
|
1
|
+
import{g as T,C as W,L as j,s as l,P as q}from"../chunks/order-page-Lr9R8-is.esm.js";import"../chunks/lodash-P8OIs-at.esm.js";import"../chunks/events-5IECSF-x.esm.js";import"../utils/logger.js";import"../utils/network-listeners.js";import"../utils/local-storage.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../utils/cookies.js";import"../utils/memoize-last.js";import"../chunks/cart-contents-h60geKWa.esm.js";import"../chunks/update-cart-9ANMUWR9.esm.js";import"../chunks/routes-fBXLZ-QV.esm.js";import"../utils/remote-session.js";import"../components/post-purchase.js";import"../chunks/lit-yVXn5Cbs.esm.js";import"../chunks/enforce-config-fo8kIfoY.esm.js";import"../components/redeem-transaction.js";import"../chunks/progress-bar-7gWYaGlq.esm.js";import"../components/beam-partner-logos.js";import"../chunks/localize-pzAAkBvG.esm.js";import"../chunks/css-card-grid-3b56QBzq.esm.js";import"../components/impact-overview.js";import"../chunks/vendor-eeJfrOkP.esm.js";import"../chunks/is-all-html-elements-SdSkxirh.esm.js";import"../chunks/responsive-LYEag6TI.esm.js";import"../utils/wait-for-element.js";export{T as addBeamAttributesToCart,W as getCurrentCart,j as registerCartIntegration,l as showBeamOrderPageWidgets,q as trackCart};
|
|
2
2
|
//# sourceMappingURL=shopify.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{p as R}from"../chunks/routes-
|
|
1
|
+
import{p as R}from"../chunks/routes-Y3xQURF0.esm.js";import{B as M}from"../chunks/cart-contents-h60geKWa.esm.js";import{a as D,b as O,c as W}from"../chunks/events-5IECSF-x.esm.js";import{B as m}from"../chunks/beam-errors-P-Lu07Ce.esm.js";import{getCookieValue as f,setCookieValue as $}from"../utils/cookies.esm.js";import{logger as C}from"../utils/logger.esm.js";import{saveRemoteSession as K}from"../utils/remote-session.esm.js";import"../utils/local-storage.esm.js";var w=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},d=(e,t,i)=>(w(e,t,"read from private field"),i?i.call(e):t.get(e)),n=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},_=(e,t,i,s)=>(w(e,t,"write to private field"),s?s.call(e,i):t.set(e,i),i),r=(e,t,i)=>(w(e,t,"access private method"),i),h,c,E,T,b,A,l,v,B,g,S,y,L,I,k;const P=4,j=`https://cdn.jsdelivr.net/npm/statsig-js@${P}/build/statsig-prod-web-sdk.min.js`,x="beam_statsig_session_id",o="data-beam-visibility",z="beam-sync-visibility",p={STATSIG_INIT:"statsig_init",CART_CREATED:"cart_created",ORDER_CREATED:"order_created",BEAM_SELECTION:"beam_selection"};class G{constructor(t){n(this,E),n(this,b),n(this,v),n(this,g),n(this,y),n(this,I),this.name="statsig",this.experiments={shouldShowBeam:!1,isLoggingEnabled:!0},n(this,h,void 0),n(this,c,void 0),n(this,l,[]),this.statsigApiKey=t.statsigApiKey}async init(t){_(this,h,t),r(this,E,T).call(this),r(this,g,S).call(this,"hide");const i=document.createElement("style");if(i.innerHTML=`
|
|
2
2
|
[${o}="hide"] beam-select-nonprofit,
|
|
3
3
|
[${o}="hide"] beam-post-purchase,
|
|
4
4
|
[${o}="hide"] beam-redeem-transaction,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{p as R}from"../chunks/routes-
|
|
1
|
+
import{p as R}from"../chunks/routes-fBXLZ-QV.esm.js";import{B as M}from"../chunks/cart-contents-h60geKWa.esm.js";import{a as D,b as O,c as W}from"../chunks/events-5IECSF-x.esm.js";import{B as m}from"../chunks/beam-errors-P-Lu07Ce.esm.js";import{getCookieValue as f,setCookieValue as $}from"../utils/cookies.js";import{logger as C}from"../utils/logger.js";import{saveRemoteSession as K}from"../utils/remote-session.js";import"../utils/local-storage.js";var w=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},d=(e,t,i)=>(w(e,t,"read from private field"),i?i.call(e):t.get(e)),n=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},_=(e,t,i,s)=>(w(e,t,"write to private field"),s?s.call(e,i):t.set(e,i),i),r=(e,t,i)=>(w(e,t,"access private method"),i),h,c,E,T,b,A,l,v,B,g,S,y,L,I,k;const P=4,j=`https://cdn.jsdelivr.net/npm/statsig-js@${P}/build/statsig-prod-web-sdk.min.js`,x="beam_statsig_session_id",o="data-beam-visibility",z="beam-sync-visibility",p={STATSIG_INIT:"statsig_init",CART_CREATED:"cart_created",ORDER_CREATED:"order_created",BEAM_SELECTION:"beam_selection"};class G{constructor(t){n(this,E),n(this,b),n(this,v),n(this,g),n(this,y),n(this,I),this.name="statsig",this.experiments={shouldShowBeam:!1,isLoggingEnabled:!0},n(this,h,void 0),n(this,c,void 0),n(this,l,[]),this.statsigApiKey=t.statsigApiKey}async init(t){_(this,h,t),r(this,E,T).call(this),r(this,g,S).call(this,"hide");const i=document.createElement("style");if(i.innerHTML=`
|
|
2
2
|
[${o}="hide"] beam-select-nonprofit,
|
|
3
3
|
[${o}="hide"] beam-post-purchase,
|
|
4
4
|
[${o}="hide"] beam-redeem-transaction,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import o from"react";import{l as r}from"../chunks/lit-yVXn5Cbs.esm.js";import{BeamCommunityImpact as m}from"../components/community-impact.esm.js";import"../chunks/progress-bar-7gWYaGlq.esm.js";import"../components/beam-partner-logos.esm.js";import"../chunks/enforce-config-qna7hEL6.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../utils/logger.esm.js";import"../chunks/routes-
|
|
1
|
+
import o from"react";import{l as r}from"../chunks/lit-yVXn5Cbs.esm.js";import{BeamCommunityImpact as m}from"../components/community-impact.esm.js";import"../chunks/progress-bar-7gWYaGlq.esm.js";import"../components/beam-partner-logos.esm.js";import"../chunks/enforce-config-qna7hEL6.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../utils/logger.esm.js";import"../chunks/routes-Y3xQURF0.esm.js";import"../chunks/localize-GCkVUD8S.esm.js";import"../chunks/css-card-grid-3b56QBzq.esm.js";const t=r({tagName:m.tagName,elementClass:m,react:o,events:{}});export{t as BeamCommunityImpact,t as default};
|
|
2
2
|
//# sourceMappingURL=community-impact.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import o from"react";import{l as r}from"../chunks/lit-yVXn5Cbs.esm.js";import{BeamCommunityImpact as m}from"../components/community-impact.js";import"../chunks/progress-bar-7gWYaGlq.esm.js";import"../components/beam-partner-logos.js";import"../chunks/enforce-config-fo8kIfoY.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../utils/logger.js";import"../chunks/routes-
|
|
1
|
+
import o from"react";import{l as r}from"../chunks/lit-yVXn5Cbs.esm.js";import{BeamCommunityImpact as m}from"../components/community-impact.js";import"../chunks/progress-bar-7gWYaGlq.esm.js";import"../components/beam-partner-logos.js";import"../chunks/enforce-config-fo8kIfoY.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../utils/logger.js";import"../chunks/routes-fBXLZ-QV.esm.js";import"../chunks/localize-pzAAkBvG.esm.js";import"../chunks/css-card-grid-3b56QBzq.esm.js";const t=r({tagName:m.tagName,elementClass:m,react:o,events:{}});export{t as BeamCommunityImpact,t as default};
|
|
2
2
|
//# sourceMappingURL=community-impact.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import a from"react";import{l as e}from"../chunks/lit-yVXn5Cbs.esm.js";import{BeamCumulativeImpact as m}from"../components/cumulative-impact.esm.js";import"../chunks/lodash-P8OIs-at.esm.js";import"../chunks/enforce-config-qna7hEL6.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../utils/logger.esm.js";import"../chunks/routes-
|
|
1
|
+
import a from"react";import{l as e}from"../chunks/lit-yVXn5Cbs.esm.js";import{BeamCumulativeImpact as m}from"../components/cumulative-impact.esm.js";import"../chunks/lodash-P8OIs-at.esm.js";import"../chunks/enforce-config-qna7hEL6.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../utils/logger.esm.js";import"../chunks/routes-Y3xQURF0.esm.js";import"../chunks/localize-GCkVUD8S.esm.js";import"../chunks/is-all-html-elements-SdSkxirh.esm.js";const t=e({tagName:m.tagName,elementClass:m,react:a,events:{}});export{t as BeamCumulativeImpact,t as default};
|
|
2
2
|
//# sourceMappingURL=cumulative-impact.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import a from"react";import{l as e}from"../chunks/lit-yVXn5Cbs.esm.js";import{BeamCumulativeImpact as m}from"../components/cumulative-impact.js";import"../chunks/lodash-P8OIs-at.esm.js";import"../chunks/enforce-config-fo8kIfoY.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../utils/logger.js";import"../chunks/routes-
|
|
1
|
+
import a from"react";import{l as e}from"../chunks/lit-yVXn5Cbs.esm.js";import{BeamCumulativeImpact as m}from"../components/cumulative-impact.js";import"../chunks/lodash-P8OIs-at.esm.js";import"../chunks/enforce-config-fo8kIfoY.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../utils/logger.js";import"../chunks/routes-fBXLZ-QV.esm.js";import"../chunks/localize-pzAAkBvG.esm.js";import"../chunks/is-all-html-elements-SdSkxirh.esm.js";const t=e({tagName:m.tagName,elementClass:m,react:a,events:{}});export{t as BeamCumulativeImpact,t as default};
|
|
2
2
|
//# sourceMappingURL=cumulative-impact.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import r from"react";import{l as e}from"../chunks/lit-yVXn5Cbs.esm.js";import{BeamImpactOverview as m}from"../components/impact-overview.esm.js";import"../chunks/lodash-P8OIs-at.esm.js";import"../chunks/routes-
|
|
1
|
+
import r from"react";import{l as e}from"../chunks/lit-yVXn5Cbs.esm.js";import{BeamImpactOverview as m}from"../components/impact-overview.esm.js";import"../chunks/lodash-P8OIs-at.esm.js";import"../chunks/routes-Y3xQURF0.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../utils/logger.esm.js";import"../chunks/progress-bar-7gWYaGlq.esm.js";import"../chunks/enforce-config-qna7hEL6.esm.js";import"../chunks/localize-GCkVUD8S.esm.js";import"../chunks/vendor-eeJfrOkP.esm.js";import"../chunks/is-all-html-elements-SdSkxirh.esm.js";import"../components/beam-partner-logos.esm.js";import"../chunks/responsive-LYEag6TI.esm.js";const t=e({tagName:m.tagName,elementClass:m,react:r,events:{}});export{t as BeamImpactOverview,t as default};
|
|
2
2
|
//# sourceMappingURL=impact-overview.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import r from"react";import{l as e}from"../chunks/lit-yVXn5Cbs.esm.js";import{BeamImpactOverview as m}from"../components/impact-overview.js";import"../chunks/lodash-P8OIs-at.esm.js";import"../chunks/routes-
|
|
1
|
+
import r from"react";import{l as e}from"../chunks/lit-yVXn5Cbs.esm.js";import{BeamImpactOverview as m}from"../components/impact-overview.js";import"../chunks/lodash-P8OIs-at.esm.js";import"../chunks/routes-fBXLZ-QV.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../utils/logger.js";import"../chunks/progress-bar-7gWYaGlq.esm.js";import"../chunks/enforce-config-fo8kIfoY.esm.js";import"../chunks/localize-pzAAkBvG.esm.js";import"../chunks/vendor-eeJfrOkP.esm.js";import"../chunks/is-all-html-elements-SdSkxirh.esm.js";import"../components/beam-partner-logos.js";import"../chunks/responsive-LYEag6TI.esm.js";const t=e({tagName:m.tagName,elementClass:m,react:r,events:{}});export{t as BeamImpactOverview,t as default};
|
|
2
2
|
//# sourceMappingURL=impact-overview.js.map
|
package/dist/react/index.esm.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{BeamCommunityImpact as N}from"./community-impact.esm.js";import{BeamCumulativeImpact as R}from"./cumulative-impact.esm.js";import{BeamImpactOverview as j}from"./impact-overview.esm.js";import{BeamSelectNonprofit as q}from"./select-nonprofit.esm.js";import{BeamRedeemTransaction as A}from"./redeem-transaction.esm.js";import{BeamPostPurchase as E}from"./post-purchase.esm.js";import{BeamSubscriptionManagement as G}from"./subscription-management.esm.js";import"react";import"../chunks/lit-yVXn5Cbs.esm.js";import"../components/community-impact.esm.js";import"../chunks/progress-bar-7gWYaGlq.esm.js";import"../components/beam-partner-logos.esm.js";import"../chunks/enforce-config-qna7hEL6.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../utils/logger.esm.js";import"../chunks/routes-
|
|
1
|
+
import{BeamCommunityImpact as N}from"./community-impact.esm.js";import{BeamCumulativeImpact as R}from"./cumulative-impact.esm.js";import{BeamImpactOverview as j}from"./impact-overview.esm.js";import{BeamSelectNonprofit as q}from"./select-nonprofit.esm.js";import{BeamRedeemTransaction as A}from"./redeem-transaction.esm.js";import{BeamPostPurchase as E}from"./post-purchase.esm.js";import{BeamSubscriptionManagement as G}from"./subscription-management.esm.js";import"react";import"../chunks/lit-yVXn5Cbs.esm.js";import"../components/community-impact.esm.js";import"../chunks/progress-bar-7gWYaGlq.esm.js";import"../components/beam-partner-logos.esm.js";import"../chunks/enforce-config-qna7hEL6.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../utils/logger.esm.js";import"../chunks/routes-Y3xQURF0.esm.js";import"../chunks/localize-GCkVUD8S.esm.js";import"../chunks/css-card-grid-3b56QBzq.esm.js";import"../components/cumulative-impact.esm.js";import"../chunks/lodash-P8OIs-at.esm.js";import"../chunks/is-all-html-elements-SdSkxirh.esm.js";import"../components/impact-overview.esm.js";import"../chunks/vendor-eeJfrOkP.esm.js";import"../chunks/responsive-LYEag6TI.esm.js";import"../chunks/events-5IECSF-x.esm.js";import"../components/select-nonprofit.esm.js";import"../utils/network-listeners.esm.js";import"../utils/local-storage.esm.js";import"../utils/cookies.esm.js";import"../chunks/cart-contents-h60geKWa.esm.js";import"../components/redeem-transaction.esm.js";import"../components/post-purchase.esm.js";import"../components/subscription-management.esm.js";export{N as BeamCommunityImpact,R as BeamCumulativeImpact,j as BeamImpactOverview,E as BeamPostPurchase,A as BeamRedeemTransaction,q as BeamSelectNonprofit,G as BeamSubscriptionManagement};
|
|
2
2
|
//# sourceMappingURL=index.esm.js.map
|
package/dist/react/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{BeamCommunityImpact as N}from"./community-impact.js";import{BeamCumulativeImpact as R}from"./cumulative-impact.js";import{BeamImpactOverview as j}from"./impact-overview.js";import{BeamSelectNonprofit as q}from"./select-nonprofit.js";import{BeamRedeemTransaction as A}from"./redeem-transaction.js";import{BeamPostPurchase as E}from"./post-purchase.js";import{BeamSubscriptionManagement as G}from"./subscription-management.js";import"react";import"../chunks/lit-yVXn5Cbs.esm.js";import"../components/community-impact.js";import"../chunks/progress-bar-7gWYaGlq.esm.js";import"../components/beam-partner-logos.js";import"../chunks/enforce-config-fo8kIfoY.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../utils/logger.js";import"../chunks/routes-
|
|
1
|
+
import{BeamCommunityImpact as N}from"./community-impact.js";import{BeamCumulativeImpact as R}from"./cumulative-impact.js";import{BeamImpactOverview as j}from"./impact-overview.js";import{BeamSelectNonprofit as q}from"./select-nonprofit.js";import{BeamRedeemTransaction as A}from"./redeem-transaction.js";import{BeamPostPurchase as E}from"./post-purchase.js";import{BeamSubscriptionManagement as G}from"./subscription-management.js";import"react";import"../chunks/lit-yVXn5Cbs.esm.js";import"../components/community-impact.js";import"../chunks/progress-bar-7gWYaGlq.esm.js";import"../components/beam-partner-logos.js";import"../chunks/enforce-config-fo8kIfoY.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../utils/logger.js";import"../chunks/routes-fBXLZ-QV.esm.js";import"../chunks/localize-pzAAkBvG.esm.js";import"../chunks/css-card-grid-3b56QBzq.esm.js";import"../components/cumulative-impact.js";import"../chunks/lodash-P8OIs-at.esm.js";import"../chunks/is-all-html-elements-SdSkxirh.esm.js";import"../components/impact-overview.js";import"../chunks/vendor-eeJfrOkP.esm.js";import"../chunks/responsive-LYEag6TI.esm.js";import"../chunks/events-5IECSF-x.esm.js";import"../components/select-nonprofit.js";import"../utils/network-listeners.js";import"../utils/local-storage.js";import"../utils/cookies.js";import"../chunks/cart-contents-h60geKWa.esm.js";import"../components/redeem-transaction.js";import"../components/post-purchase.js";import"../components/subscription-management.js";export{N as BeamCommunityImpact,R as BeamCumulativeImpact,j as BeamImpactOverview,E as BeamPostPurchase,A as BeamRedeemTransaction,q as BeamSelectNonprofit,G as BeamSubscriptionManagement};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import o from"react";import{l as r}from"../chunks/lit-yVXn5Cbs.esm.js";import{BeamPostPurchase as t}from"../components/post-purchase.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../utils/cookies.esm.js";import"../chunks/enforce-config-qna7hEL6.esm.js";import"../utils/logger.esm.js";import"../utils/local-storage.esm.js";import"../chunks/routes-
|
|
1
|
+
import o from"react";import{l as r}from"../chunks/lit-yVXn5Cbs.esm.js";import{BeamPostPurchase as t}from"../components/post-purchase.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../utils/cookies.esm.js";import"../chunks/enforce-config-qna7hEL6.esm.js";import"../utils/logger.esm.js";import"../utils/local-storage.esm.js";import"../chunks/routes-Y3xQURF0.esm.js";import"../components/redeem-transaction.esm.js";import"../chunks/lodash-P8OIs-at.esm.js";import"../chunks/progress-bar-7gWYaGlq.esm.js";import"../components/beam-partner-logos.esm.js";import"../chunks/localize-GCkVUD8S.esm.js";import"../chunks/css-card-grid-3b56QBzq.esm.js";import"../chunks/events-5IECSF-x.esm.js";import"../components/impact-overview.esm.js";import"../chunks/vendor-eeJfrOkP.esm.js";import"../chunks/is-all-html-elements-SdSkxirh.esm.js";import"../chunks/responsive-LYEag6TI.esm.js";import"../chunks/cart-contents-h60geKWa.esm.js";const m=r({tagName:t.tagName,elementClass:t,react:o,events:{}});export{m as BeamPostPurchase,m as default};
|
|
2
2
|
//# sourceMappingURL=post-purchase.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import o from"react";import{l as r}from"../chunks/lit-yVXn5Cbs.esm.js";import{BeamPostPurchase as t}from"../components/post-purchase.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../utils/cookies.js";import"../chunks/enforce-config-fo8kIfoY.esm.js";import"../utils/logger.js";import"../utils/local-storage.js";import"../chunks/routes-
|
|
1
|
+
import o from"react";import{l as r}from"../chunks/lit-yVXn5Cbs.esm.js";import{BeamPostPurchase as t}from"../components/post-purchase.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../utils/cookies.js";import"../chunks/enforce-config-fo8kIfoY.esm.js";import"../utils/logger.js";import"../utils/local-storage.js";import"../chunks/routes-fBXLZ-QV.esm.js";import"../components/redeem-transaction.js";import"../chunks/lodash-P8OIs-at.esm.js";import"../chunks/progress-bar-7gWYaGlq.esm.js";import"../components/beam-partner-logos.js";import"../chunks/localize-pzAAkBvG.esm.js";import"../chunks/css-card-grid-3b56QBzq.esm.js";import"../chunks/events-5IECSF-x.esm.js";import"../components/impact-overview.js";import"../chunks/vendor-eeJfrOkP.esm.js";import"../chunks/is-all-html-elements-SdSkxirh.esm.js";import"../chunks/responsive-LYEag6TI.esm.js";import"../chunks/cart-contents-h60geKWa.esm.js";const m=r({tagName:t.tagName,elementClass:t,react:o,events:{}});export{m as BeamPostPurchase,m as default};
|
|
2
2
|
//# sourceMappingURL=post-purchase.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import m from"react";import{l as o}from"../chunks/lit-yVXn5Cbs.esm.js";import{c as r}from"../chunks/events-5IECSF-x.esm.js";import{BeamRedeemTransaction as t}from"../components/redeem-transaction.esm.js";import"../chunks/lodash-P8OIs-at.esm.js";import"../chunks/enforce-config-qna7hEL6.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../utils/logger.esm.js";import"../chunks/routes-
|
|
1
|
+
import m from"react";import{l as o}from"../chunks/lit-yVXn5Cbs.esm.js";import{c as r}from"../chunks/events-5IECSF-x.esm.js";import{BeamRedeemTransaction as t}from"../components/redeem-transaction.esm.js";import"../chunks/lodash-P8OIs-at.esm.js";import"../chunks/enforce-config-qna7hEL6.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../utils/logger.esm.js";import"../chunks/routes-Y3xQURF0.esm.js";import"../chunks/progress-bar-7gWYaGlq.esm.js";import"../components/beam-partner-logos.esm.js";import"../chunks/localize-GCkVUD8S.esm.js";import"../utils/local-storage.esm.js";import"../chunks/css-card-grid-3b56QBzq.esm.js";const e=o({tagName:t.tagName,elementClass:t,react:m,events:{onNonprofitSelect:r.eventName}});export{e as BeamRedeemTransaction,e as default};
|
|
2
2
|
//# sourceMappingURL=redeem-transaction.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import m from"react";import{l as o}from"../chunks/lit-yVXn5Cbs.esm.js";import{c as r}from"../chunks/events-5IECSF-x.esm.js";import{BeamRedeemTransaction as t}from"../components/redeem-transaction.js";import"../chunks/lodash-P8OIs-at.esm.js";import"../chunks/enforce-config-fo8kIfoY.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../utils/logger.js";import"../chunks/routes-
|
|
1
|
+
import m from"react";import{l as o}from"../chunks/lit-yVXn5Cbs.esm.js";import{c as r}from"../chunks/events-5IECSF-x.esm.js";import{BeamRedeemTransaction as t}from"../components/redeem-transaction.js";import"../chunks/lodash-P8OIs-at.esm.js";import"../chunks/enforce-config-fo8kIfoY.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../utils/logger.js";import"../chunks/routes-fBXLZ-QV.esm.js";import"../chunks/progress-bar-7gWYaGlq.esm.js";import"../components/beam-partner-logos.js";import"../chunks/localize-pzAAkBvG.esm.js";import"../utils/local-storage.js";import"../chunks/css-card-grid-3b56QBzq.esm.js";const e=o({tagName:t.tagName,elementClass:t,react:m,events:{onNonprofitSelect:r.eventName}});export{e as BeamRedeemTransaction,e as default};
|
|
2
2
|
//# sourceMappingURL=redeem-transaction.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import o from"react";import{l as e}from"../chunks/lit-yVXn5Cbs.esm.js";import{c as m}from"../chunks/events-5IECSF-x.esm.js";import{BeamSelectNonprofit as r}from"../components/select-nonprofit.esm.js";import"../chunks/enforce-config-qna7hEL6.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../utils/logger.esm.js";import"../chunks/routes-
|
|
1
|
+
import o from"react";import{l as e}from"../chunks/lit-yVXn5Cbs.esm.js";import{c as m}from"../chunks/events-5IECSF-x.esm.js";import{BeamSelectNonprofit as r}from"../components/select-nonprofit.esm.js";import"../chunks/enforce-config-qna7hEL6.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../utils/logger.esm.js";import"../chunks/routes-Y3xQURF0.esm.js";import"../chunks/progress-bar-7gWYaGlq.esm.js";import"../chunks/localize-GCkVUD8S.esm.js";import"../utils/network-listeners.esm.js";import"../utils/local-storage.esm.js";import"../utils/cookies.esm.js";import"../chunks/lodash-P8OIs-at.esm.js";import"../chunks/responsive-LYEag6TI.esm.js";import"../chunks/cart-contents-h60geKWa.esm.js";const t=e({tagName:"beam-select-nonprofit",elementClass:r,react:o,events:{onNonprofitSelect:m.eventName}});export{t as BeamSelectNonprofit,t as default};
|
|
2
2
|
//# sourceMappingURL=select-nonprofit.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import o from"react";import{l as e}from"../chunks/lit-yVXn5Cbs.esm.js";import{c as m}from"../chunks/events-5IECSF-x.esm.js";import{BeamSelectNonprofit as r}from"../components/select-nonprofit.js";import"../chunks/enforce-config-fo8kIfoY.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../utils/logger.js";import"../chunks/routes-
|
|
1
|
+
import o from"react";import{l as e}from"../chunks/lit-yVXn5Cbs.esm.js";import{c as m}from"../chunks/events-5IECSF-x.esm.js";import{BeamSelectNonprofit as r}from"../components/select-nonprofit.js";import"../chunks/enforce-config-fo8kIfoY.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../utils/logger.js";import"../chunks/routes-fBXLZ-QV.esm.js";import"../chunks/progress-bar-7gWYaGlq.esm.js";import"../chunks/localize-pzAAkBvG.esm.js";import"../utils/network-listeners.js";import"../utils/local-storage.js";import"../utils/cookies.js";import"../chunks/lodash-P8OIs-at.esm.js";import"../chunks/responsive-LYEag6TI.esm.js";import"../chunks/cart-contents-h60geKWa.esm.js";const t=e({tagName:"beam-select-nonprofit",elementClass:r,react:o,events:{onNonprofitSelect:m.eventName}});export{t as BeamSelectNonprofit,t as default};
|
|
2
2
|
//# sourceMappingURL=select-nonprofit.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from"react";import{l as a}from"../chunks/lit-yVXn5Cbs.esm.js";import{BeamSubscriptionManagement as t}from"../components/subscription-management.esm.js";import"../chunks/routes-
|
|
1
|
+
import e from"react";import{l as a}from"../chunks/lit-yVXn5Cbs.esm.js";import{BeamSubscriptionManagement as t}from"../components/subscription-management.esm.js";import"../chunks/routes-Y3xQURF0.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../utils/logger.esm.js";import"../chunks/enforce-config-qna7hEL6.esm.js";import"../chunks/events-5IECSF-x.esm.js";const m=a({tagName:t.tagName,elementClass:t,react:e,events:{}});export{m as BeamSubscriptionManagement,m as default};
|
|
2
2
|
//# sourceMappingURL=subscription-management.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from"react";import{l as a}from"../chunks/lit-yVXn5Cbs.esm.js";import{BeamSubscriptionManagement as t}from"../components/subscription-management.js";import"../chunks/routes-
|
|
1
|
+
import e from"react";import{l as a}from"../chunks/lit-yVXn5Cbs.esm.js";import{BeamSubscriptionManagement as t}from"../components/subscription-management.js";import"../chunks/routes-fBXLZ-QV.esm.js";import"../chunks/beam-errors-P-Lu07Ce.esm.js";import"../utils/logger.js";import"../chunks/enforce-config-fo8kIfoY.esm.js";import"../chunks/events-5IECSF-x.esm.js";const m=a({tagName:t.tagName,elementClass:t,react:e,events:{}});export{m as BeamSubscriptionManagement,m as default};
|
|
2
2
|
//# sourceMappingURL=subscription-management.js.map
|