@coursebuilder/core
Version:
Core package for Course Builder
680 lines (672 loc) • 27.6 kB
TypeScript
import { AdapterUser, Adapter } from '@auth/core/adapters';
import { Coupon } from './schemas/coupon-schema.js';
import { MerchantCoupon } from './schemas/merchant-coupon-schema.js';
import { MerchantCustomer } from './schemas/merchant-customer-schema.js';
import { MerchantProduct } from './schemas/merchant-product-schema.js';
import { Price } from './schemas/price-schema.js';
import { Product, NewProduct } from './schemas/product-schema.js';
import { Purchase } from './schemas/purchase-schema.js';
import { PurchaseUserTransfer, PurchaseUserTransferState } from './schemas/purchase-user-transfer-schema.js';
import { ResourceProgress, ModuleProgress } from './schemas/resource-progress-schema.js';
import { User } from './schemas/user-schema.js';
import { VideoResource } from './schemas/video-resource.js';
import { UpgradableProduct } from './schemas/upgradable-product-schema.js';
import { MerchantCharge } from './schemas/merchant-charge-schema.js';
import { MerchantPrice } from './schemas/merchant-price-schema.js';
import { ContentResource, ContentResourceResource } from './schemas/content-resource-schema.js';
import { MerchantAccount } from './schemas/merchant-account-schema.js';
import { MerchantSession } from './schemas/merchant-session.js';
import { MerchantSubscription } from './schemas/merchant-subscription.js';
import { OrganizationMember } from './schemas/organization-member.js';
import { Organization } from './schemas/organization-schema.js';
import { Subscription } from './schemas/subscription.js';
import { AuthConfig } from '@auth/core';
import { NodemailerConfig } from '@auth/core/providers/nodemailer';
import { CoreMessage } from 'ai';
import { CookieSerializeOptions } from 'cookie';
import { Inngest } from 'inngest';
import Stripe from 'stripe';
import { z } from 'zod';
import { LoggerInstance } from './lib/utils/logger.js';
import { EmailConfig } from '@auth/core/providers';
import { Subscriber } from './schemas/subscriber-schema.js';
import { PartyProviderConfig } from './providers/partykit.js';
import { NotificationProviderConfig } from './providers/slack.js';
import { PurchaseInfo } from './schemas/purchase-info.js';
import { SubscriptionInfo } from './schemas/subscription-info.js';
declare const CheckoutParamsSchema: z.ZodObject<{
ip_address: z.ZodOptional<z.ZodString>;
productId: z.ZodString;
quantity: z.ZodEffects<z.ZodOptional<z.ZodNumber>, number, number | undefined>;
country: z.ZodOptional<z.ZodString>;
couponId: z.ZodOptional<z.ZodString>;
userId: z.ZodOptional<z.ZodString>;
upgradeFromPurchaseId: z.ZodOptional<z.ZodString>;
bulk: z.ZodEffects<z.ZodBoolean, boolean, unknown>;
cancelUrl: z.ZodString;
usedCouponId: z.ZodOptional<z.ZodString>;
organizationId: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
productId: string;
bulk: boolean;
quantity: number;
cancelUrl: string;
organizationId?: string | undefined;
userId?: string | undefined;
country?: string | undefined;
couponId?: string | undefined;
upgradeFromPurchaseId?: string | undefined;
ip_address?: string | undefined;
usedCouponId?: string | undefined;
}, {
productId: string;
cancelUrl: string;
organizationId?: string | undefined;
userId?: string | undefined;
country?: string | undefined;
couponId?: string | undefined;
upgradeFromPurchaseId?: string | undefined;
bulk?: unknown;
ip_address?: string | undefined;
usedCouponId?: string | undefined;
quantity?: number | undefined;
}>;
type CheckoutParams = z.infer<typeof CheckoutParamsSchema>;
declare class CheckoutError extends Error {
couponId?: string;
productId: string;
constructor(message: string, productId: string, couponId?: string);
}
declare function stripeCheckout({ params, config, adapter, }: {
params: CheckoutParams;
config: PaymentsProviderConsumerConfig;
adapter?: CourseBuilderAdapter;
}): Promise<any>;
interface Cookie extends CookieOption {
value: string;
}
declare function defaultCookies(useSecureCookies: boolean): {};
declare const STREAM_COMPLETE = "\\ok";
interface LlmProviderConfig {
id: string;
name: string;
type: string;
options: LlmProviderConsumerConfig;
apiKey: string;
partyUrlBase: string;
baseUrl?: string;
defaultModel?: string;
createChatCompletion: (options: CreateChatCompletionOptions) => Promise<AIOutput | null>;
}
type LlmProviderConsumerConfig = Omit<Partial<LlmProviderConfig>, 'options' | 'type'> & {
apiKey: string;
partyUrlBase: string;
baseUrl?: string;
defaultModel?: string;
};
type CreateChatCompletionOptions = {
messages: CoreMessage[];
chatId: string;
model: string;
};
declare function OpenAIProvider(options: LlmProviderConsumerConfig): LlmProviderConfig;
declare const MockOpenAIProvider: LlmProviderConfig;
interface EmailListSubscribeOptions {
listId?: string | number;
user: AdapterUser;
fields: Record<string, string>;
listType: string;
}
interface EmailListConfig {
id: string;
name: string;
type: string;
options: EmailListConsumerConfig;
apiKey: string;
apiSecret: string;
defaultListType: string;
defaultListId?: number | string;
subscribeToList: (options: EmailListSubscribeOptions) => Promise<any>;
getSubscriber: (subscriberId: string | null | CookieOption) => Promise<Subscriber | null>;
getSubscriberByEmail: (email: string) => Promise<Subscriber | null>;
tagSubscriber?: (options: {
tag: string;
subscriberId: string;
}) => Promise<any>;
updateSubscriberFields?: (options: {
fields: Record<string, string>;
subscriberId?: string;
subscriberEmail?: string;
}) => Promise<Subscriber | null>;
}
type EmailListConsumerConfig = Omit<Partial<EmailListConfig>, 'options' | 'type'> & {
apiKey: string;
apiSecret: string;
};
/**
* The configuration object for a transcription service provider.
*/
interface TranscriptionConfig {
id: string;
name: string;
type: string;
options: TranscriptionUserConfig;
apiKey: string;
callbackUrl: string;
getCallbackUrl?: (options: {
baseUrl: string;
params: Record<string, string>;
}) => string;
initiateTranscription: (options: {
mediaUrl: string;
resourceId: string;
}) => Promise<any>;
handleCallback: (callbackData: any) => {
srt: string;
transcript: string;
wordLevelSrt: string;
};
}
declare const MockTranscriptionProvider: TranscriptionConfig;
type TranscriptionUserConfig = Omit<Partial<TranscriptionConfig>, 'options' | 'type'> & {
apiKey: string;
callbackUrl: string;
};
/**
* The user configuration object for a transcription service provider.
*/
type ProviderType = 'transcription' | 'email-list' | 'payment' | 'party' | 'checkout' | 'email' | 'notification';
interface InternalProviderOptions {
/** Used to deep merge user-provided config with the default config
*/
options?: Record<string, any>;
}
interface CommonProviderOptions {
/**
* Uniquely identifies the provider in {@link CourseBuilderConfig.providers}.
* It's also part of the URL
*/
id: string;
/**
* The provider name used on the default sign-in page's sign-in button.
* For example if it's "Google", the corresponding button will say:
* "Sign in with Google"
*/
name: string;
/** See {@link ProviderType} */
type: ProviderType;
}
type Provider<P = any> = (((TranscriptionConfig | EmailListConfig | LlmProviderConfig | PartyProviderConfig | PaymentsProviderConfig | EmailConfig | NodemailerConfig | NotificationProviderConfig) & InternalProviderOptions) | ((...args: any) => (TranscriptionConfig | EmailListConfig | LlmProviderConfig | PartyProviderConfig | PaymentsProviderConfig | EmailConfig | NodemailerConfig | NotificationProviderConfig) & InternalProviderOptions)) & InternalProviderOptions;
type Awaitable<T> = T | PromiseLike<T>;
interface ResponseInternal<Body extends string | Record<string, any> | any[] | null = any> {
status?: number;
headers?: Headers | HeadersInit;
body?: Body;
redirect?: string;
cookies?: Cookie[];
}
type CourseBuilderAction = 'webhook' | 'srt' | 'session' | 'subscribe-to-list' | 'checkout' | 'redeem' | 'prices-formatted' | 'subscriber' | 'purchases' | 'lookup' | 'claimed' | 'nameUpdate' | 'transfer' | 'refund' | 'create-magic-link';
interface RequestInternal {
url: URL;
method: 'POST' | 'GET';
cookies?: Partial<Record<string, string>>;
headers?: Record<string, any>;
query?: Record<string, any>;
body?: Record<string, any>;
action: CourseBuilderAction;
providerId?: string;
error?: string;
}
interface PaymentsProviderConfig {
id: string;
name: string;
type: 'payment';
options: PaymentsProviderConsumerConfig;
getBillingPortalUrl: (customerId: string, returnUrl: string) => Promise<string>;
getSubscription: (subscriptionId: string) => Promise<Stripe.Subscription>;
getSubscriptionInfo: (checkoutSessionId: string, adapter: CourseBuilderAdapter) => Promise<SubscriptionInfo>;
getPurchaseInfo: (checkoutSessionId: string, adapter: CourseBuilderAdapter) => Promise<PurchaseInfo>;
createCheckoutSession: (checkoutParams: CheckoutParams, adapter?: CourseBuilderAdapter) => Promise<{
redirect: string;
status: number;
}>;
refundCharge: (chargeId: string) => Promise<Stripe.Refund>;
getCustomer: (customerId: string) => Promise<Stripe.Customer>;
updateCustomer: (customerId: string, customer: {
name: string;
email: string;
metadata?: Record<string, any>;
}) => Promise<void>;
getProduct(productId: string): Promise<Stripe.Response<Stripe.Product>>;
getPrice(priceId: string): Promise<Stripe.Response<Stripe.Price>>;
updateProduct<TProductUpdate = Stripe.Product>(productId: string, productUpdate: Partial<TProductUpdate>): Promise<void>;
updatePrice<TPriceUpdate = Stripe.Price>(priceId: string, priceUpdate: Partial<TPriceUpdate>): Promise<void>;
createPrice(price: Stripe.PriceCreateParams): Promise<Stripe.Response<Stripe.Price>>;
createProduct(product: Stripe.ProductCreateParams): Promise<Stripe.Response<Stripe.Product>>;
}
type PaymentsProviderConsumerConfig = Omit<Partial<PaymentsProviderConfig>, 'options' | 'type'> & {
paymentsAdapter: PaymentsAdapter;
errorRedirectUrl: string;
cancelUrl: string;
baseSuccessUrl: string;
};
interface PaymentsAdapter {
/**
* Returns the percent off for a given coupon
* @param identifier
*/
getCouponPercentOff(identifier: string): Promise<number>;
/**
* Returns a coupon id.
*
* TODO: these use the stripe types and we probably want to use an
* internal interface so that we can think about different providers
* in the future.
* @param params
*/
createCoupon(params: Stripe.CouponCreateParams): Promise<string>;
/**
* Returns a promotion code.
* @param params
*/
createPromotionCode(params: Stripe.PromotionCodeCreateParams): Promise<string>;
/**
* Returns the URL to redirect to for a checkout session.
* @param params
*/
createCheckoutSession(params: Stripe.Checkout.SessionCreateParams): Promise<string | null>;
getCheckoutSession(sessionId: string): Promise<Stripe.Checkout.Session>;
createCustomer(params: Stripe.CustomerCreateParams): Promise<string>;
verifyWebhookSignature(rawBody: string, sig: string): Promise<boolean>;
getCustomer(customerId: string): Promise<Stripe.Customer>;
updateCustomer(customerId: string, customer: {
name: string;
email: string;
metadata?: Record<string, any>;
}): Promise<void>;
refundCharge(chargeId: string): Promise<Stripe.Refund>;
getProduct(productId: string): Promise<Stripe.Response<Stripe.Product>>;
getPrice(priceId: string): Promise<Stripe.Response<Stripe.Price>>;
updateProduct<TProductUpdate = Stripe.Product>(productId: string, product: Partial<TProductUpdate>): Promise<void>;
updatePrice<TPriceUpdate = Stripe.Price>(priceId: string, priceUpdate: Partial<TPriceUpdate>): Promise<void>;
createPrice(price: Stripe.PriceCreateParams): Promise<Stripe.Response<Stripe.Price>>;
createProduct(product: Stripe.ProductCreateParams): Promise<Stripe.Response<Stripe.Product>>;
getSubscription(subscriptionId: string): Promise<Stripe.Subscription>;
getBillingPortalUrl(customerId: string, returnUrl: string): Promise<string>;
}
type InternalProvider<T = ProviderType> = T extends 'transcription' ? TranscriptionConfig : T extends 'email-list' ? EmailListConfig : T extends 'payment' ? PaymentsProviderConfig : T extends 'email' ? NodemailerConfig : never;
interface InternalOptions<TProviderType = ProviderType> {
providers: InternalProvider[];
url: URL;
action: CourseBuilderAction;
provider: InternalProvider<TProviderType>;
debug: boolean;
logger: LoggerInstance;
adapter: Required<CourseBuilderAdapter> | undefined;
cookies: Record<keyof CookiesOptions, CookieOption>;
basePath: string;
inngest: Inngest;
callbacks: CallbacksOptions;
getCurrentUser?: () => Promise<User | null>;
authConfig: AuthConfig;
baseUrl: string;
}
interface CookieOption {
name: string;
options: CookieSerializeOptions;
}
interface CookieOption {
name: string;
options: CookieSerializeOptions;
}
interface CookiesOptions {
ck_subscriber_id?: Partial<CookieOption>;
}
interface DefaultCourseBuilderSession {
}
interface CourseBuilderSession extends DefaultCourseBuilderSession {
}
interface CallbacksOptions {
session: (params: any) => Awaitable<CourseBuilderSession | DefaultCourseBuilderSession>;
}
type FunctionCall = {
arguments: Record<string, any>;
name: string;
};
type AIMessage = CoreMessage & {
createdAt?: Date;
id?: string;
};
type AIError = {
error: string;
};
type AIOutput = AIMessage | AIError;
interface ProgressWriter {
writeResponseInChunks(streamingResponse: Response | ReadableStream): Promise<AIOutput>;
publishMessage(message: string): Promise<void>;
}
type MerchantCouponWithCountry = MerchantCoupon & {
country?: string | undefined;
};
type MinimalMerchantCoupon = Omit<MerchantCouponWithCountry, 'identifier' | 'merchantAccountId'>;
type ProductWithPrices = Product & {
prices?: Price[];
};
type FormattedPrice = {
id: string;
quantity: number;
unitPrice: number;
fullPrice: number;
fixedDiscountForUpgrade: number;
calculatedPrice: number;
availableCoupons: Array<Omit<MerchantCouponWithCountry, 'identifier'> | undefined>;
appliedMerchantCoupon?: MinimalMerchantCoupon;
upgradeFromPurchaseId?: string;
upgradeFromPurchase?: Purchase;
upgradedProduct?: ProductWithPrices | null;
bulk: boolean;
usedCouponId?: string;
usedCoupon?: Coupon | null;
defaultCoupon?: Coupon | null;
};
type FormatPricesForProductOptions = {
productId?: string;
country?: string;
quantity?: number;
merchantCouponId?: string;
ctx: CourseBuilderAdapter;
upgradeFromPurchaseId?: string;
userId?: string;
autoApplyPPP?: boolean;
usedCouponId?: string;
};
type CommerceProps = {
couponIdFromCoupon?: string;
couponFromCode?: CouponForCode;
userId?: string;
purchases?: Purchase[];
products?: Product[];
allowPurchase?: boolean;
country?: string;
};
type CouponForCode = Coupon & {
isValid: boolean;
isRedeemable: boolean;
};
type PricingData = {
formattedPrice?: FormattedPrice | null;
purchaseToUpgrade?: Purchase | null;
quantityAvailable: number;
};
type PricingOptions = {
withImage: boolean;
withTitle: boolean;
withGuaranteeBadge: boolean;
isLiveEvent: boolean;
isCohort: boolean;
isPPPEnabled: boolean;
teamQuantityLimit: number;
allowTeamPurchase: boolean;
cancelUrl: string;
};
interface CourseBuilderAdapter<TDatabaseInstance extends abstract new (...args: any) => any = any> extends Adapter, SkillProductsCommerceSdk {
client: InstanceType<TDatabaseInstance>;
archiveProduct(productId: string): Promise<Product | null>;
createProduct(product: NewProduct): Promise<Product | null>;
updateProduct(product: Product): Promise<Product | null>;
createPurchase(options: {
id?: string;
userId: string;
productId: string;
merchantChargeId?: string;
merchantSessionId?: string;
totalAmount: string;
couponId?: string | null;
redeemedBulkCouponId?: string | null;
status?: string;
metadata?: Record<string, any>;
organizationId?: string;
}): Promise<Purchase>;
addResourceToResource(options: {
childResourceId: string;
parentResourceId: string;
}): Awaitable<ContentResourceResource | null>;
removeResourceFromResource(options: {
childResourceId: string;
parentResourceId: string;
}): Promise<ContentResource | null>;
createContentResource(resource: {
id: string;
type: string;
fields: Record<string, any>;
createdById: string;
}): Awaitable<ContentResource>;
getContentResource(id: string): Promise<ContentResource | null>;
getVideoResource(id: string | null | undefined): Promise<VideoResource | null>;
updateContentResourceFields(options: {
id: string;
fields: Record<string, any>;
}): Awaitable<ContentResource | null>;
getPriceForProduct(productId: string): Promise<Price | null>;
getUpgradableProducts(options: {
upgradableFromId: string;
upgradableToId: string;
}): Promise<UpgradableProduct[]>;
getMerchantCustomerForUserId(userId: string): Promise<MerchantCustomer | null>;
getMerchantAccount(options: {
provider: 'stripe';
}): Promise<MerchantAccount | null>;
createMerchantSession(options: {
identifier: string;
merchantAccountId: string;
organizationId?: string;
}): Promise<MerchantSession>;
createMerchantCustomer(options: {
userId: string;
identifier: string;
merchantAccountId: string;
}): Promise<MerchantCustomer | null>;
getMerchantPriceForProductId(productId: string): Promise<MerchantPrice | null>;
transferPurchaseToUser(options: {
purchaseId: string;
targetUserId: string;
sourceUserId: string;
}): Promise<PurchaseUserTransfer | null>;
createOrganization(options: {
name: string;
}): Promise<Organization | null>;
getOrganization(organizationId: string): Promise<Organization | null>;
addMemberToOrganization(options: {
organizationId: string;
userId: string;
invitedById: string;
}): Promise<OrganizationMember | null>;
removeMemberFromOrganization(options: {
organizationId: string;
userId: string;
}): Promise<void>;
addRoleForMember(options: {
organizationId: string;
memberId: string;
role: string;
}): Promise<void>;
removeRoleForMember(options: {
organizationId: string;
memberId: string;
role: string;
}): Promise<void>;
getMembershipsForUser(userId: string): Promise<OrganizationMember[]>;
getOrganizationMembers(organizationId: string): Promise<OrganizationMember[]>;
getMerchantSubscription(merchantSubscriptionId: string): Promise<MerchantSubscription | null>;
createMerchantSubscription(options: {
merchantAccountId: string;
merchantCustomerId: string;
merchantProductId: string;
identifier: string;
}): Promise<MerchantSubscription | null>;
updateMerchantSubscription(options: {
merchantSubscriptionId: string;
status: string;
}): Promise<MerchantSubscription | null>;
deleteMerchantSubscription(merchantSubscriptionId: string): Promise<void>;
createSubscription(options: {
organizationId: string;
merchantSubscriptionId: string;
productId: string;
}): Promise<Subscription | null>;
getSubscriptionForStripeId(stripeSubscriptionId: string): Promise<Subscription | null>;
getPurchasesForBulkCouponId(bulkCouponId: string): Promise<(Purchase & {
user: User;
})[]>;
}
declare const MockCourseBuilderAdapter: CourseBuilderAdapter;
interface SkillProductsCommerceSdk {
redeemFullPriceCoupon(options: {
email: string;
couponId?: string;
redeemingProductId?: string;
productIds?: string[];
currentUserId?: string | null;
}): Promise<{
purchase: Purchase | null;
redeemingForCurrentUser: boolean;
error?: {
message: string;
};
} | null>;
createPurchaseTransfer(options: {
sourceUserId: string;
purchaseId: string;
expiresAt: Date;
}): Promise<void>;
incrementCouponUsedCount(couponId: string): Promise<void>;
getExistingNonBulkValidPurchasesOfProduct(options: {
userId: string;
productId?: string;
}): Promise<Purchase[]>;
getPurchaseDetails(purchaseId: string, userId: string): Promise<{
purchase?: Purchase;
existingPurchase?: Purchase | null;
availableUpgrades: UpgradableProduct[];
}>;
getPurchaseForStripeCharge(stripeChargeId: string): Promise<Purchase | null>;
updatePurchaseStatusForCharge(chargeId: string, status: 'Valid' | 'Refunded' | 'Disputed' | 'Banned' | 'Restricted'): Promise<Purchase | undefined>;
couponForIdOrCode(options: {
code?: string | null | undefined;
couponId?: string | null | undefined;
}): Promise<(Coupon & {
merchantCoupon: MerchantCoupon;
}) | null>;
availableUpgradesForProduct(purchases: any, productId: string): Promise<{
upgradableTo: {
id: string;
name: string;
};
upgradableFrom: {
id: string;
name: string;
};
}[]>;
completeLessonProgressForUser(options: {
userId: string;
lessonId?: string;
}): Promise<ResourceProgress | null>;
clearLessonProgressForUser(options: {
userId: string;
lessons: {
id: string;
slug: string;
}[];
}): Promise<void>;
toggleLessonProgressForUser(options: {
userId: string;
lessonId?: string;
lessonSlug?: string;
}): Promise<ResourceProgress | null>;
getLessonProgressForUser(userId: string): Promise<ResourceProgress[] | null>;
getModuleProgressForUser(userId: string, moduleId: string): Promise<ModuleProgress | null>;
getLessonProgresses(): Promise<ResourceProgress[]>;
getLessonProgressCountsByDate(): Promise<{
count: number;
completedAt: string;
}[]>;
getPurchaseWithUser(purchaseId: string): Promise<(Purchase & {
user: User;
}) | null>;
getCouponWithBulkPurchases(couponId?: string): Promise<(Coupon & {
redeemedBulkCouponPurchases?: Purchase[] | null;
bulkPurchase?: Purchase | null;
}) | null>;
getPurchase(purchaseId: string): Promise<Purchase | null>;
getPurchaseCountForProduct(productId: string): Promise<number>;
getPurchasesForUser(userId?: string): Promise<Purchase[]>;
getMerchantProduct(stripeProductId: string): Promise<MerchantProduct | null>;
getMerchantProductForProductId(productId: string): Promise<MerchantProduct | null>;
getMerchantCharge(merchantChargeId: string): Promise<MerchantCharge | null>;
createMerchantChargeAndPurchase(options: {
userId: string;
productId: string;
stripeChargeId: string;
stripeCouponId?: string;
merchantAccountId: string;
merchantProductId: string;
merchantCustomerId: string;
stripeChargeAmount: number;
quantity?: number;
bulk?: boolean;
checkoutSessionId: string;
appliedPPPStripeCouponId: string | undefined;
upgradedFromPurchaseId: string | undefined;
usedCouponId: string | undefined;
country?: string;
organizationId?: string;
}): Promise<Purchase>;
findOrCreateMerchantCustomer(options: {
user: User;
identifier: string;
merchantAccountId: string;
}): Promise<MerchantCustomer | null>;
findOrCreateUser(email: string, name?: string | null): Promise<{
user: User;
isNewUser: boolean;
}>;
getUserById(userId: string): Promise<User | null>;
getUserWithPurchasersByEmail(email: string): Promise<any | null>;
getProduct(productId?: string, withResources?: boolean): Promise<Product | null>;
getProductResources(productId: string): Promise<ContentResource[] | null>;
getPrice(productId: string): Promise<Price | null>;
getMerchantCoupon(merchantCouponId: string): Promise<MerchantCoupon | null>;
getMerchantCouponForTypeAndPercent(params: {
type: string;
percentageDiscount: number;
}): Promise<MerchantCoupon | null>;
getMerchantCouponsForTypeAndPercent(params: {
type: string;
percentageDiscount: number;
}): Promise<MerchantCoupon[]>;
getCoupon(couponIdOrCode: string): Promise<Coupon | null>;
getDefaultCoupon(productIds?: string[]): Promise<{
defaultMerchantCoupon: MerchantCoupon;
defaultCoupon: Coupon;
} | null>;
transferPurchasesToNewUser(options: {
merchantCustomerId: string;
userId: string;
}): Promise<unknown>;
getPurchaseUserTransferById(options: {
id: string;
}): Promise<(PurchaseUserTransfer & {
sourceUser: User;
targetUser: User | null;
purchase: Purchase;
}) | null>;
updatePurchaseUserTransferTransferState(options: {
id: string;
transferState: PurchaseUserTransferState;
}): Promise<PurchaseUserTransfer | null>;
pricesOfPurchasesTowardOneBundle(options: {
userId: string | undefined;
bundleId: string;
}): Promise<Price[]>;
}
export { type Awaitable as A, type CookieOption as B, type Cookie as C, type DefaultCourseBuilderSession as D, type EmailListConsumerConfig as E, type FormatPricesForProductOptions as F, type CourseBuilderSession as G, type FunctionCall as H, type InternalOptions as I, type AIMessage as J, type AIError as K, type LlmProviderConfig as L, type MinimalMerchantCoupon as M, type AIOutput as N, OpenAIProvider as O, type PaymentsProviderConsumerConfig as P, type ProgressWriter as Q, type RequestInternal as R, STREAM_COMPLETE as S, type TranscriptionUserConfig as T, type CommerceProps as U, type CouponForCode as V, MockCourseBuilderAdapter as W, type ResponseInternal as a, type CallbacksOptions as b, type CourseBuilderAdapter as c, type EmailListConfig as d, type TranscriptionConfig as e, type PaymentsProviderConfig as f, type PaymentsAdapter as g, type FormattedPrice as h, type PricingOptions as i, type PricingData as j, type CourseBuilderAction as k, type Provider as l, type InternalProvider as m, type CookiesOptions as n, CheckoutParamsSchema as o, type CheckoutParams as p, CheckoutError as q, defaultCookies as r, stripeCheckout as s, type LlmProviderConsumerConfig as t, type CreateChatCompletionOptions as u, MockOpenAIProvider as v, type EmailListSubscribeOptions as w, MockTranscriptionProvider as x, type ProviderType as y, type CommonProviderOptions as z };