UNPKG

@beamimpact/web-sdk

Version:

The Beam SDK enables brands to connect with their customers over shared values, not transactional discounts, to build stronger loyalty. Our integration achieves this by allowing customers to (a) choose a nonprofit where the brand will donate part of their

358 lines (355 loc) 13.4 kB
import * as lit_html from 'lit-html'; import * as lit from 'lit'; import { LitElement } from 'lit'; import { g as getChainNonprofits, a as getImpact } from '../chunks/routes-DahRzf8t.esm.js'; import { T as TCart } from '../chunks/cart-contents-CLT7p7Gd.esm.js'; import './select-subscription-nonprofit.js'; import './subscription-impact.js'; import './beam-partner-logos.js'; import '../chunks/progress-bar-CveZ8E6Q.esm.js'; import { L as LANGUAGES } from '../chunks/types-DfRc36jU.esm.js'; import { T as TNumericId } from '../chunks/types-CPxMwnoR.esm.js'; import '../chunks/openapi-spec-Bk7E2QQP.esm.js'; import 'lodash'; import '../chunks/share-button-CDVVaxEc.esm.js'; interface RequiredDataPropsWithEmail { email: string; apiKey: string; subscriptionId: string; } interface RequiredDataPropsWithPartnerUserId { partnerUserId: string; apiKey: string; subscriptionId: string; } type TRequiredDataProps = RequiredDataPropsWithEmail | RequiredDataPropsWithPartnerUserId; type TIAPIV3PersonalImpact = Awaited<ReturnType<typeof getImpact>>["personal"]; type TIAPIV3EligibleNonprofits = Awaited<ReturnType<typeof getChainNonprofits>>["nonprofits"]; type TIAPIV3EligibleNonprofitConfig = Awaited<ReturnType<typeof getChainNonprofits>>["config"]; declare class BeamSubscriptionManagement extends LitElement { static tagName: string; baseUrl: string; apiKey: TRequiredDataProps["apiKey"]; subscriptionId: TRequiredDataProps["subscriptionId"]; storeId?: number; email?: RequiredDataPropsWithEmail["email"]; partnerUserId?: RequiredDataPropsWithPartnerUserId["partnerUserId"]; postalCode?: string; countryCode?: string; selectedNonprofitId?: TNumericId; lang: LANGUAGES; cart?: TCart; debug: boolean; draftConfig: boolean; get configLang(): LANGUAGES; private activeWidget; private nonprofitId; private beamUserId; private eligibleNonprofits; private showAllTiles; private isMobile; private dropdownVisible; private emojis; private subscriptionDataController; private eligibleNonprofitsDataController; private personalImpactDataController; firstUpdated(): Promise<void>; loadWidget(): Promise<void>; fetchEligibleNonprofits(): Promise<{ chain: { name: string; logoUrl: string | null; logoLockupUrl?: string | null | undefined; communityImpactUrl: string | null; donationTypeName: string | null; matchDonationTypeName: string | null; }; config: { web: { title: string; description: string; promoDescriptionPrefix?: string | undefined; promoDescription?: string | undefined; confirmButton?: string | undefined; confirmedButton?: string | undefined; collapsedButton?: string | undefined; theme?: { [key: string]: unknown; } | null | undefined; nonprofitSelectedHeader?: string | undefined; nonprofitUnselectedHeader?: string | undefined; dynamicStrings?: { [key: string]: string; } | null | undefined; additionalStrings?: { [key: string]: string; } | null | undefined; disableAnimation?: boolean | undefined; promo?: { "promo-text-long": string; "promo-text-short": string; "promo-cause-alt-text": string; } | undefined; }; mobileWeb?: { title: string; description: string; nonprofitSelectedHeader?: string | undefined; nonprofitUnselectedHeader?: string | undefined; } | undefined; mobile: { title: string; description: string; nonprofitSelectedHeader?: string | undefined; nonprofitUnselectedHeader?: string | undefined; }; enableNonprofitDeselection?: boolean | undefined; } & { web?: { redeemButtonText?: string | undefined; } | undefined; mobileWeb?: { redeemButtonText?: string | undefined; } | undefined; mobile?: { redeemButtonText?: string | undefined; } | undefined; }; nonprofits: { imageUrl: Partial<string | null>; nonprofit: { id: number; name: string; cause: string | null; causeIconUrl: string | null; causeIconSelectedUrl: string | null; causeColor: string | null; extensibility?: { causeIconUrl?: string | null | undefined; causeIconSelectedUrl?: string | null | undefined; causeIconAndBackgroundUrl?: string | null | undefined; } | undefined; website: string | null; websiteLinkText: string; badge?: string | undefined; includeInPersonalImpact?: boolean | undefined; }; impact: { description: string | null; goalCompletionText: string; goalProgressText: string; goalProgressPercentage: number; }; promo?: { type?: string | undefined; isActive: boolean; multiplier: number | null; } | null | undefined; }[]; store: { id: number; }; region: { id: string | null; }; promos?: { validatedPromoCodes: { promoCodeId: string | null; promoCodeGroupId?: string | null | undefined; promoId?: number | undefined; validatedAt: string; apply: boolean; }[]; } | undefined; extensibility?: { excludeB2BOrders?: boolean | undefined; } | undefined; settings?: { excludeDonationsForRecurringTransactions: boolean; } | undefined; }>; fetchSubscription(): Promise<{ beamUserId: string; remoteSubscriptionId: string; internalSubscriptionId: string; settings?: { excludeDonationsForRecurringTransactions: boolean; } | undefined; nonprofit: { id: number; name?: string | undefined; } | null; }>; fetchImpact(): Promise<{ chain: { name: string; logoUrl: string | null; logoLockupUrl?: string | null | undefined; communityImpactUrl: string | null; donationTypeName: string | null; matchDonationTypeName: string | null; }; store: { name: string | null; displayName: string | null; communityPageURL: string | null; }; config: { web: { title: string; description: string; promoDescriptionPrefix?: string | undefined; promoDescription?: string | undefined; confirmButton?: string | undefined; confirmedButton?: string | undefined; collapsedButton?: string | undefined; theme?: { [key: string]: unknown; } | null | undefined; nonprofitSelectedHeader?: string | undefined; nonprofitUnselectedHeader?: string | undefined; dynamicStrings?: { [key: string]: string; } | null | undefined; additionalStrings?: { [key: string]: string; } | null | undefined; disableAnimation?: boolean | undefined; promo?: { "promo-text-long": string; "promo-text-short": string; "promo-cause-alt-text": string; } | undefined; }; mobileWeb?: { title: string; description: string; nonprofitSelectedHeader?: string | undefined; nonprofitUnselectedHeader?: string | undefined; } | undefined; mobile: { title: string; description: string; nonprofitSelectedHeader?: string | undefined; nonprofitUnselectedHeader?: string | undefined; }; enableNonprofitDeselection?: boolean | undefined; }; personal: { imageUrl: string | null; nonprofit: { id: number; name: string; cause: string | null; causeIconUrl: string | null; causeIconSelectedUrl: string | null; causeColor: string | null; extensibility?: { causeIconUrl?: string | null | undefined; causeIconSelectedUrl?: string | null | undefined; causeIconAndBackgroundUrl?: string | null | undefined; } | undefined; website: string | null; websiteLinkText: string; badge?: string | undefined; includeInPersonalImpact?: boolean | undefined; }; impact: { description: string | null; goalCompletionText: string; goalProgressText: string; goalProgressPercentage: number; }; share: { imageUrl: string | null; }; filters?: string[] | undefined; }[]; community: { imageUrl: string | null; nonprofit: { id: number; name: string; cause: string | null; causeIconUrl: string | null; causeIconSelectedUrl: string | null; causeColor: string | null; extensibility?: { causeIconUrl?: string | null | undefined; causeIconSelectedUrl?: string | null | undefined; causeIconAndBackgroundUrl?: string | null | undefined; } | undefined; website: string | null; websiteLinkText: string; badge?: string | undefined; includeInPersonalImpact?: boolean | undefined; }; impact: { description: string | null; goalCompletionText: string; goalProgressText: string; goalProgressPercentage: number; }; share: { imageUrl: string | null; }; filters?: string[] | undefined; }[]; promo: { type?: string | undefined; isActive: boolean; multiplier: number | null; } | null; promoAssetUrl: string | null; personalImpactAssetUrl: string | null; settings?: { excludeDonationsForRecurringTransactions: boolean; } | undefined; }>; getDisplayablePreviousImpacts(): { imageUrl: string | null; nonprofit: { id: number; name: string; cause: string | null; causeIconUrl: string | null; causeIconSelectedUrl: string | null; causeColor: string | null; extensibility?: { causeIconUrl?: string | null | undefined; causeIconSelectedUrl?: string | null | undefined; causeIconAndBackgroundUrl?: string | null | undefined; } | undefined; website: string | null; websiteLinkText: string; badge?: string | undefined; includeInPersonalImpact?: boolean | undefined; }; impact: { description: string | null; goalCompletionText: string; goalProgressText: string; goalProgressPercentage: number; }; share: { imageUrl: string | null; }; filters?: string[] | undefined; }[]; handleSwapNonprofitButtonClick(): void; handleBackToSubscriptionImpactButtonClick(): void; handleSupportAgainButtonClick(nonprofitId: TNumericId, nonprofitName: string): void; handleNonprofitSelect(event: Event): void; isNonprofitEligible(nonprofitId: TNumericId): boolean; shouldDisplayProgressBar(progressValue: number): boolean; get cssVariables(): any; static styles: lit.CSSResult[]; private renderPreviousImpactTiles; render(): "" | lit_html.TemplateResult<1>; } declare global { interface HTMLElementTagNameMap { "beam-subscription-management": BeamSubscriptionManagement; } } export { BeamSubscriptionManagement, type TIAPIV3EligibleNonprofitConfig, type TIAPIV3EligibleNonprofits, type TIAPIV3PersonalImpact };