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

639 lines (637 loc) 23.4 kB
declare const getChainNonprofits: ({ headers, baseUrl, apiRoot, pathParams, queryParams, requestBody, }: { baseUrl?: string | undefined; apiRoot?: string | undefined; pathParams?: { chainId: number; } | undefined; queryParams?: { postalCode?: string | undefined; countryCode?: string | undefined; storeId?: number | undefined; lang?: "en" | "fr" | "de" | "es" | "it" | "pl" | "ja" | undefined; widgetName: "select-nonprofit" | "redeem-transaction"; version: string; } | undefined; requestBody?: undefined; headers?: Record<string, string> | undefined; }) => 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; }>; declare const getImpact: ({ headers, baseUrl, apiRoot, pathParams, queryParams, requestBody, }: { baseUrl?: string | undefined; apiRoot?: string | undefined; pathParams?: Record<string, never> | undefined; queryParams?: { chainId?: number | undefined; storeId?: number | undefined; beamUserId?: string | undefined; nonprofitId?: number | undefined; communityImpactLimit?: number | undefined; personalImpactLimit?: number | undefined; widgetName: "impact-overview" | "community-impact" | "subscription-impact" | "subscription-management"; version: string; lang?: "en" | "fr" | "de" | "es" | "it" | "pl" | "ja" | undefined; omitThemes?: boolean | undefined; draftConfig?: boolean | undefined; discountCodes?: string[] | undefined; transactionId?: string | undefined; partnerUserId?: string | undefined; } | undefined; requestBody?: undefined; headers?: Record<string, string> | undefined; }) => 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; }>; declare const postTransaction: ({ headers, baseUrl, apiRoot, pathParams, queryParams, requestBody, }: { baseUrl?: string | undefined; apiRoot?: string | undefined; pathParams?: undefined; queryParams?: undefined; requestBody?: { orderId: string | number; storeId?: number | undefined; selectionId?: string | undefined; beamCartId?: string | undefined; cartId?: string | undefined; nonprofitId?: number | null | undefined; beamUserId?: string | undefined; email?: string | undefined; partnerUserId?: string | undefined; currencyCode: string; defaultToLastNonprofit?: boolean | undefined; postalCode?: string | undefined; countryCode?: string | undefined; cart?: { schema: { source: "shopify"; variant: "ajax"; version?: string | undefined; }; content: { localAmount?: number | undefined; discounts?: { code: string; applicable: boolean; }[] | null | undefined; items: { id?: number | null | undefined; gift_card?: boolean | null | undefined; final_line_price: number | null; final_price?: number | null | undefined; line_level_discount_applications?: ({ title: string; } & { [key: string]: unknown; })[] | null | undefined; quantity?: number | null | undefined; sku: string | null; product_id?: number | null | undefined; product_title?: string | null | undefined; product_type?: string | null | undefined; variant_id?: number | null | undefined; }[]; subscriptions?: { remoteSubscriptionId: string; isNew?: boolean | undefined; }[] | undefined; }; } | { schema: { source: "shopify"; variant: "liquid"; version?: string | undefined; }; content: { localAmount?: number | undefined; discounts?: { code: string; applicable: boolean; }[] | null | undefined; items: { id?: number | null | undefined; gift_card?: boolean | null | undefined; final_line_price: number | null; final_price?: number | null | undefined; line_level_discount_applications?: ({ title: string; } & { [key: string]: unknown; })[] | null | undefined; quantity?: number | null | undefined; sku: string | null; product_id?: number | null | undefined; variant_id?: number | null | undefined; }[]; subscriptions?: { remoteSubscriptionId: string; isNew?: boolean | undefined; }[] | undefined; }; } | { schema: { source: "generic"; variant?: "default" | undefined; version?: string | undefined; }; content: { localAmount?: number | undefined; discounts?: { code: string; applicable: boolean; }[] | null | undefined; items: { remoteProductIdentifier?: string | null | undefined; localAmount: number; remoteSubscriptionId?: string | undefined; discounts?: { code: string; applicable: boolean; }[] | null | undefined; }[]; subscriptions?: { remoteSubscriptionId: string; isNew?: boolean | undefined; }[] | undefined; }; } | undefined; remoteSessionId?: string | undefined; options?: { config?: { omitThemes?: boolean | undefined; draftConfig?: boolean | undefined; } | undefined; response?: { personalImpact?: boolean | undefined; communityImpact?: boolean | undefined; } | undefined; } | undefined; widgetName?: "select-nonprofit" | "redeem-transaction" | "select-nonprofit-cta" | undefined; version?: string | undefined; donation?: { currencyCode: string; amount: number; } | undefined; cartTotal?: number | undefined; discountCodes?: string[] | undefined; creationMethod?: "recurring" | null | undefined; promos?: { unvalidatedPromoCodes: (Partial<{ type?: "manual" | "url" | undefined; } & { attributes?: { value?: string | undefined; } | undefined; }> & Partial<{ type?: "manual" | "url" | undefined; } & { attributes?: { url?: string | undefined; } | undefined; }>)[]; validatedPromoCodes: { promoCodeId: string | null; promoCodeGroupId?: string | null | undefined; promoId?: number | undefined; validatedAt: string; apply: boolean; }[]; } | undefined; } | undefined; headers?: Record<string, string> | undefined; }) => Promise<{ transactionId: string; transactionCreated?: boolean | undefined; beamUserId: string; beamCartId?: string | null | undefined; chainId: number; nonprofitId: number | null; creationMethod?: string | undefined; impact?: { 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; }[] | 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; }[] | undefined; } | undefined; config?: { mobile?: { title?: unknown; description?: string | undefined; theme?: { [key: string]: unknown; } | null | undefined; } | undefined; mobileWeb?: { title?: unknown; description?: string | undefined; theme?: { [key: string]: unknown; } | null | undefined; } | undefined; web?: { title?: string | undefined; description?: string | undefined; theme?: { [key: string]: unknown; } | null | undefined; } | undefined; } | undefined; extensibility?: { excludeB2BOrders?: boolean | undefined; } | undefined; reportSettings?: { excludeRecurringDonations?: boolean | undefined; } | undefined; }>; declare const postProductDetailsPage: ({ headers, baseUrl, apiRoot, pathParams, queryParams, requestBody, }: { baseUrl?: string | undefined; apiRoot?: string | undefined; pathParams?: Record<string, never> | undefined; queryParams?: { lang?: "en" | "fr" | "de" | "es" | "it" | "pl" | "ja" | undefined; version: string; storeId: number; draftConfig?: boolean | undefined; widgetName?: "impact-overview" | "community-impact" | "subscription-impact" | "subscription-management" | "select-nonprofit" | "redeem-transaction" | "cumulative-impact" | "product-details-page" | "select-subscription-nonprofit" | "select-nonprofit-cta" | "mobile-full-screen-nonprofit-selection" | "mobile-impact-list" | "mobile-minimal-nonprofit-selection" | "mobile-personal-impact" | "mobile-selected-nonprofit" | "mobile-progress-bar" | "mobile-share-button" | undefined; remoteProductIdentifier?: string | undefined; } | undefined; requestBody?: { lang?: string | undefined; version?: string | undefined; storeId?: number | undefined; widgetName?: string | undefined; remoteProductIdentifier?: string | undefined; beamCartId?: string | undefined; draftConfig?: boolean | undefined; promos?: { unvalidatedPromoCodes: (Partial<{ type?: "manual" | "url" | undefined; } & { attributes?: { value?: string | undefined; } | undefined; }> & Partial<{ type?: "manual" | "url" | undefined; } & { attributes?: { url?: string | undefined; } | undefined; }>)[]; validatedPromoCodes: { promoCodeId: string | null; promoCodeGroupId?: string | null | undefined; promoId?: number | undefined; validatedAt: string; apply: boolean; }[]; } | undefined; } | undefined; headers?: Record<string, string> | undefined; }) => Promise<{ 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; }; ppgfDisclosure?: { copy: string; } | undefined; ppgfDisclosureHyperlink?: { url: string; copy: string; } | undefined; promos?: { validatedPromoCodes?: { promoCodeId: string | null; promoCodeGroupId?: string | null | undefined; promoId?: number | undefined; validatedAt: string; apply: boolean; }[] | undefined; } | undefined; }>; export { getImpact as a, postTransaction as b, getChainNonprofits as g, postProductDetailsPage as p };