@revenuecat/purchases-js-vega 1.67.0

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.
@@ -0,0 +1,2657 @@
1
+ import { CompleteWorkflowNavigateArgs } from '@revenuecat/purchases-ui-js';
2
+ import { CustomVariables } from '@revenuecat/purchases-ui-js';
3
+ import { CustomVariableValue } from '@revenuecat/purchases-ui-js';
4
+ import { PackageInfo } from '@revenuecat/purchases-ui-js';
5
+ import { PaywallData } from '@revenuecat/purchases-ui-js';
6
+ import { PaywallPackage } from '@revenuecat/purchases-ui-js';
7
+ import { UIConfig } from '@revenuecat/purchases-ui-js';
8
+ import { WalletButtonRender } from '@revenuecat/purchases-ui-js';
9
+ import { WalletButtonTheme } from '@revenuecat/purchases-ui-js';
10
+
11
+ /* Excluded from this release type: AttributionMetadata */
12
+
13
+ declare enum BackendErrorCode {
14
+ BackendInvalidPlatform = 7000,
15
+ BackendInvalidEmail = 7012,
16
+ BackendStoreProblem = 7101,
17
+ BackendCannotTransferPurchase = 7102,
18
+ BackendInvalidReceiptToken = 7103,
19
+ BackendInvalidAppStoreSharedSecret = 7104,
20
+ BackendInvalidPaymentModeOrIntroPriceNotProvided = 7105,
21
+ BackendProductIdForGoogleReceiptNotProvided = 7106,
22
+ BackendInvalidPlayStoreCredentials = 7107,
23
+ BackendInternalServerError = 7110,
24
+ BackendTooManyRequests = 7114,
25
+ BackendEmptyAppUserId = 7220,
26
+ BackendInvalidAuthToken = 7224,
27
+ BackendInvalidAPIKey = 7225,
28
+ BackendBadRequest = 7226,
29
+ BackendPlayStoreQuotaExceeded = 7229,
30
+ BackendPlayStoreInvalidPackageName = 7230,
31
+ BackendPlayStoreGenericError = 7231,
32
+ BackendUserIneligibleForPromoOffer = 7232,
33
+ BackendInvalidAppleSubscriptionKey = 7234,
34
+ BackendSubscriberNotFound = 7259,
35
+ BackendInvalidSubscriberAttributes = 7263,
36
+ BackendInvalidSubscriberAttributesBody = 7264,
37
+ BackendProductIDsMalformed = 7662,
38
+ BackendAlreadySubscribedError = 7772,
39
+ BackendPaymentGatewayGenericError = 7773,
40
+ BackendOfferNotFound = 7814,
41
+ BackendNoMXRecordsFound = 7834,
42
+ BackendInvalidOperationSession = 7877,
43
+ BackendPurchaseCannotBeCompleted = 7878,
44
+ BackendEmailIsRequired = 7879,
45
+ BackendGatewaySetupErrorStripeTaxNotActive = 7898,
46
+ BackendGatewaySetupErrorInvalidTaxOriginAddress = 7899,
47
+ BackendGatewaySetupErrorMissingRequiredPermission = 7900,
48
+ BackendGatewaySetupErrorSandboxModeOnly = 7901,
49
+ BackendInvalidPaddleAPIKey = 7967,
50
+ BackendQuickPurchaseUnavailable = 8172,
51
+ BackendGatewaySetupErrorInvalidTaxOriginAddressDuringCheckout = 8174
52
+ }
53
+
54
+ /* Excluded from this release type: BillingWrapper */
55
+
56
+ /**
57
+ * @public
58
+ * `BrandingAppearance` defines the appearance settings
59
+ * of an app's branding configuration.
60
+ */
61
+ export declare interface BrandingAppearance {
62
+ color_buttons_primary: string;
63
+ color_buttons_primary_text?: string | null;
64
+ color_accent: string;
65
+ color_error: string;
66
+ color_product_info_bg: string;
67
+ color_form_bg: string;
68
+ color_page_bg: string;
69
+ font: string;
70
+ shapes: "default" | "rectangle" | "rounded" | "pill";
71
+ show_product_description: boolean;
72
+ }
73
+
74
+ declare interface BuildVariablesPerPackageOptions {
75
+ selectedLocale?: string;
76
+ fallbackLocale?: string;
77
+ customTranslations?: CustomTranslations;
78
+ translator?: Translator;
79
+ }
80
+
81
+ /**
82
+ * Type containing all information regarding the customer.
83
+ * @public
84
+ */
85
+ export declare interface CustomerInfo {
86
+ /**
87
+ * Entitlements attached to this customer info.
88
+ */
89
+ readonly entitlements: EntitlementInfos;
90
+ /**
91
+ * Map of productIds to expiration dates.
92
+ */
93
+ readonly allExpirationDatesByProduct: {
94
+ [productIdentifier: string]: Date | null;
95
+ };
96
+ /**
97
+ * Map of productIds to purchase dates.
98
+ */
99
+ readonly allPurchaseDatesByProduct: {
100
+ [productIdentifier: string]: Date | null;
101
+ };
102
+ /**
103
+ * Set of active subscription product identifiers.
104
+ */
105
+ readonly activeSubscriptions: Set<string>;
106
+ /**
107
+ * URL to manage the active subscription of the user.
108
+ * If this user has an active Web Billing subscription, a link to the management page.
109
+ * If this user has an active iOS subscription, this will point to the App Store.
110
+ * If the user has an active Play Store subscription it will point there.
111
+ * If there are no active subscriptions it will be null.
112
+ */
113
+ readonly managementURL: string | null;
114
+ /**
115
+ * Date when this info was requested.
116
+ */
117
+ readonly requestDate: Date;
118
+ /**
119
+ * The date this user was first seen in RevenueCat.
120
+ */
121
+ readonly firstSeenDate: Date;
122
+ /**
123
+ * The purchase date for the version of the application when the user bought the app.
124
+ * Use this for grandfathering users when migrating to subscriptions. This can be null.
125
+ */
126
+ readonly originalPurchaseDate: Date | null;
127
+ /**
128
+ * The original App User Id recorded for this user.
129
+ */
130
+ readonly originalAppUserId: string;
131
+ /**
132
+ * The list of non-subscription transactions made by the user.
133
+ */
134
+ readonly nonSubscriptionTransactions: NonSubscriptionTransaction[];
135
+ /**
136
+ * Dictionary of all subscription product identifiers and their subscription info.
137
+ */
138
+ readonly subscriptionsByProductIdentifier: {
139
+ [productId: string]: SubscriptionInfo;
140
+ };
141
+ }
142
+
143
+ /**
144
+ * Parameters for tracking an impression of a custom paywall.
145
+ *
146
+ * Pass the offering used to render the paywall to include its offering,
147
+ * placement, and targeting attribution in the event.
148
+ * @public
149
+ */
150
+ export declare interface CustomPaywallImpressionParams {
151
+ /** An optional identifier for the custom paywall shown to the customer. */
152
+ paywallId?: string;
153
+ /** The offering used to render the custom paywall. */
154
+ offering?: Offering;
155
+ }
156
+
157
+ /**
158
+ * Custom translations to be used in the purchase flow.
159
+ * This class allows you to override the default translations used in the purchase flow.
160
+ * The main level keys are the locale codes and the values are objects with the same keys as the default translations.
161
+ * @public
162
+ * @example
163
+ * This example will override the default translation for the email step title in the English locale.
164
+ * ```typescript
165
+ * const customTranslations = {
166
+ * en: {
167
+ * "email_entry_page.email_step_title": "Billing email",
168
+ * }
169
+ * }
170
+ * ```
171
+ */
172
+ declare type CustomTranslations = {
173
+ [langKey: string]: {
174
+ [translationKey in LocalizationKeys]?: string;
175
+ };
176
+ };
177
+
178
+ export { CustomVariables }
179
+
180
+ export { CustomVariableValue }
181
+
182
+ /* Excluded from this release type: DiscountPhase */
183
+
184
+ declare interface DiscountResponse extends PriceResponse {
185
+ name: string | null;
186
+ duration_mode: "one_time" | "time_window" | "forever";
187
+ time_window: string | null;
188
+ discount_type: "percentage" | "fixed_amount";
189
+ percentage?: number | null;
190
+ fixed_amount_micros?: number | null;
191
+ }
192
+
193
+ declare type EmptyString = "";
194
+
195
+ /**
196
+ * This object gives you access to all the information about the status
197
+ * of a user's entitlements.
198
+ * @public
199
+ */
200
+ export declare interface EntitlementInfo {
201
+ /**
202
+ * The entitlement identifier configured in the RevenueCat dashboard.
203
+ */
204
+ readonly identifier: string;
205
+ /**
206
+ * True if the user has access to the entitlement.
207
+ */
208
+ readonly isActive: boolean;
209
+ /**
210
+ * True if the underlying subscription is set to renew at the end of the
211
+ * billing period (expirationDate). Will always be True if entitlement is
212
+ * for lifetime access.
213
+ */
214
+ readonly willRenew: boolean;
215
+ /**
216
+ * The store where this entitlement was unlocked from.
217
+ */
218
+ readonly store: Store;
219
+ /**
220
+ * The latest purchase or renewal date for the entitlement.
221
+ */
222
+ readonly latestPurchaseDate: Date;
223
+ /**
224
+ * The first date this entitlement was purchased.
225
+ */
226
+ readonly originalPurchaseDate: Date;
227
+ /**
228
+ * The expiration date for the entitlement, can be `null` for lifetime
229
+ * access. If the {@link EntitlementInfo.periodType} is `trial`, this is the trial
230
+ * expiration date.
231
+ */
232
+ readonly expirationDate: Date | null;
233
+ /**
234
+ * The product identifier that unlocked this entitlement.
235
+ */
236
+ readonly productIdentifier: string;
237
+ /**
238
+ * The base plan identifier that unlocked this entitlement (For Google Play subs only).
239
+ */
240
+ readonly productPlanIdentifier: string | null;
241
+ /**
242
+ * The date an unsubscribe was detected. Can be `null`.
243
+ * Note: Entitlement may still be active even if user has unsubscribed.
244
+ * Check the {@link EntitlementInfo.isActive} property.
245
+ */
246
+ readonly unsubscribeDetectedAt: Date | null;
247
+ /**
248
+ * The date a billing issue was detected. Can be `null` if there is
249
+ * no billing issue or an issue has been resolved. Note: Entitlement may
250
+ * still be active even if there is a billing issue.
251
+ * Check the `isActive` property.
252
+ */
253
+ readonly billingIssueDetectedAt: Date | null;
254
+ /**
255
+ * False if this entitlement is unlocked via a production purchase.
256
+ */
257
+ readonly isSandbox: boolean;
258
+ /**
259
+ * The last period type this entitlement was in.
260
+ */
261
+ readonly periodType: PeriodType;
262
+ /**
263
+ * Use this property to determine whether a purchase was made by the
264
+ * current user or shared to them by a family member. This can be useful
265
+ * for onboarding users who have had an entitlement shared with them,
266
+ * but might not be entirely aware of the benefits they now have.
267
+ */
268
+ readonly ownershipType: OwnershipType | null;
269
+ }
270
+
271
+ /**
272
+ * Contains all the entitlements associated to the user.
273
+ * @public
274
+ */
275
+ export declare interface EntitlementInfos {
276
+ /**
277
+ * Map of all {@link EntitlementInfo} objects (active and inactive) keyed by
278
+ * entitlement identifier.
279
+ */
280
+ readonly all: {
281
+ [entitlementId: string]: EntitlementInfo;
282
+ };
283
+ /**
284
+ * Dictionary of active {@link EntitlementInfo} keyed by entitlement identifier.
285
+ */
286
+ readonly active: {
287
+ [entitlementId: string]: EntitlementInfo;
288
+ };
289
+ }
290
+
291
+ /**
292
+ * Error codes for the Purchases SDK.
293
+ * @public
294
+ */
295
+ export declare enum ErrorCode {
296
+ UnknownError = 0,
297
+ UserCancelledError = 1,
298
+ StoreProblemError = 2,
299
+ PurchaseNotAllowedError = 3,
300
+ PurchaseInvalidError = 4,
301
+ ProductNotAvailableForPurchaseError = 5,
302
+ ProductAlreadyPurchasedError = 6,
303
+ ReceiptAlreadyInUseError = 7,
304
+ InvalidReceiptError = 8,
305
+ MissingReceiptFileError = 9,
306
+ NetworkError = 10,
307
+ InvalidCredentialsError = 11,
308
+ UnexpectedBackendResponseError = 12,
309
+ InvalidAppUserIdError = 14,
310
+ OperationAlreadyInProgressError = 15,
311
+ UnknownBackendError = 16,
312
+ InvalidAppleSubscriptionKeyError = 17,
313
+ IneligibleError = 18,
314
+ InsufficientPermissionsError = 19,
315
+ PaymentPendingError = 20,
316
+ InvalidSubscriberAttributesError = 21,
317
+ LogOutWithAnonymousUserError = 22,
318
+ ConfigurationError = 23,
319
+ UnsupportedError = 24,
320
+ EmptySubscriberAttributesError = 25,
321
+ CustomerInfoError = 28,
322
+ SignatureVerificationError = 36,
323
+ InvalidEmailError = 38,
324
+ TestStoreSimulatedPurchaseError = 42
325
+ }
326
+
327
+ declare interface EventProperties {
328
+ [key: string]: EventPropertyValue;
329
+ }
330
+
331
+ declare type EventPropertySingleValue = string | number | boolean;
332
+
333
+ declare type EventPropertyValue = null | EventPropertySingleValue | Array<EventPropertyValue>;
334
+
335
+ /**
336
+ * Callback to be called when the express purchase button is ready to be updated.
337
+ * @experimental
338
+ * @public
339
+ */
340
+ export declare interface ExpressPurchaseButtonUpdater {
341
+ /**
342
+ * Updates the purchase option of the express purchase button.
343
+ */
344
+ updatePurchase: (pkg: Package, purchaseOption?: PurchaseOption) => void;
345
+ }
346
+
347
+ /**
348
+ * Flags used to enable or disable certain features in the sdk.
349
+ * @public
350
+ */
351
+ export declare interface FlagsConfig {
352
+ /**
353
+ * If set to true, the SDK will automatically collect UTM parameters and store them as at the time of purchase.
354
+ * @defaultValue true
355
+ */
356
+ autoCollectUTMAsMetadata?: boolean;
357
+ /**
358
+ * If set to true, the SDK will automatically collect analytics events.
359
+ * @defaultValue true
360
+ */
361
+ collectAnalyticsEvents?: boolean;
362
+ /**
363
+ * If set to true, the checkout back button will be hidden.
364
+ * @defaultValue false
365
+ */
366
+ hideBackButton?: boolean;
367
+ /**
368
+ * If set to true, the SDK injects the branding app icon as an
369
+ * `apple-touch-icon` link tag so it appears in the Apple Pay sheet.
370
+ * Best effort is made to not overwrite an existing `apple-touch-icon` on the page.
371
+ * @defaultValue false
372
+ */
373
+ applePayBrandingLogoEnabled?: boolean;
374
+ /* Excluded from this release type: rcSource */
375
+ /* Excluded from this release type: forceEnableWalletMethods */
376
+ /**
377
+ * Determines when the store module (e.g. Stripe) is loaded.
378
+ * - `"configuration"`: Preloaded when the SDK is configured (default).
379
+ * - `"purchase_start"`: Loaded on demand when a purchase is started.
380
+ * @defaultValue "configuration"
381
+ * @deprecated we always load stripe only when needed
382
+ */
383
+ storeLoadTime?: StoreLoadTime;
384
+ }
385
+
386
+ /**
387
+ * Parameters for the {@link Purchases.getOfferings} method.
388
+ * @public
389
+ */
390
+ export declare interface GetOfferingsParams {
391
+ /**
392
+ * The currency code in ISO 4217 to fetch the offerings for.
393
+ * If not specified, the default currency will be used.
394
+ */
395
+ readonly currency?: string;
396
+ /**
397
+ * The identifier of the offering to fetch.
398
+ * Can be a string identifier or one of the predefined keywords.
399
+ */
400
+ readonly offeringIdentifier?: string | OfferingKeyword;
401
+ /* Excluded from this release type: discountCode */
402
+ }
403
+
404
+ /**
405
+ * Parameters used to customise the http requests executed by purchases-js.
406
+ * @public
407
+ */
408
+ export declare interface HttpConfig {
409
+ /**
410
+ * Additional headers to include in all HTTP requests.
411
+ */
412
+ additionalHeaders?: Record<string, string>;
413
+ /**
414
+ * Set this property to your proxy URL *only* if you've received a proxy
415
+ * key value from your RevenueCat contact. This value should never end with
416
+ * a trailing slash.
417
+ */
418
+ proxyURL?: string;
419
+ /* Excluded from this release type: eventsURL */
420
+ }
421
+
422
+ /**
423
+ * Represents the result of an identify user operation.
424
+ * @public
425
+ */
426
+ export declare interface IdentifyResult {
427
+ /**
428
+ * The customer information after the logIn attempt.
429
+ */
430
+ readonly customerInfo: CustomerInfo;
431
+ /**
432
+ * true if a new user has been registered in the backend,
433
+ * false if the user had already been registered.
434
+ */
435
+ readonly wasCreated: boolean;
436
+ }
437
+
438
+ declare type JsonPrimitive = string | number | boolean | null;
439
+
440
+ declare type JsonValue = JsonPrimitive | JsonValue[] | {
441
+ [key: string]: JsonValue;
442
+ };
443
+
444
+ declare class LocaleTranslations {
445
+ readonly labels: Record<string, string>;
446
+ readonly localeKey: string;
447
+ constructor(labels: Record<string, string> | undefined, localeKey: string);
448
+ private replaceVariables;
449
+ translate(labelId: LocalizationKeys | EmptyString, variables?: TranslationVariables): string | undefined;
450
+ translatePeriod(amount: number, period: PeriodUnit, options?: TranslatePeriodOptions): string | undefined;
451
+ translatePeriodUnit(period: PeriodUnit, options?: TranslatePeriodOptions): string | undefined;
452
+ translatePeriodFrequency(amount: number, period: PeriodUnit, options?: TranslateFrequencyOptions): string | undefined;
453
+ translateDate(date: Date, options?: Intl.DateTimeFormatOptions): string | undefined;
454
+ }
455
+
456
+ declare enum LocalizationKeys {
457
+ PeriodsWeek = "periods.week",
458
+ PeriodsMonth = "periods.month",
459
+ PeriodsYear = "periods.year",
460
+ PeriodsDay = "periods.day",
461
+ PeriodsWeekShort = "periods.weekShort",
462
+ PeriodsMonthShort = "periods.monthShort",
463
+ PeriodsYearShort = "periods.yearShort",
464
+ PeriodsDayShort = "periods.dayShort",
465
+ PeriodsLifetime = "periods.lifetime",
466
+ PeriodsWeekPlural = "periods.weekPlural",
467
+ PeriodsMonthPlural = "periods.monthPlural",
468
+ PeriodsYearPlural = "periods.yearPlural",
469
+ PeriodsDayPlural = "periods.dayPlural",
470
+ PeriodsWeekFrequency = "periods.weekFrequency",
471
+ PeriodsMonthFrequency = "periods.monthFrequency",
472
+ PeriodsYearFrequency = "periods.yearFrequency",
473
+ PeriodsDayFrequency = "periods.dayFrequency",
474
+ PeriodsPerWeekFrequency = "periods.perWeekFrequency",
475
+ PeriodsPerMonthFrequency = "periods.perMonthFrequency",
476
+ PeriodsPerYearFrequency = "periods.perYearFrequency",
477
+ PeriodsPerDayFrequency = "periods.perDayFrequency",
478
+ PeriodsUnknownFrequency = "periods.unknownFrequency",
479
+ PeriodsWeekFrequencyPlural = "periods.weekFrequencyPlural",
480
+ PeriodsMonthFrequencyPlural = "periods.monthFrequencyPlural",
481
+ PeriodsYearFrequencyPlural = "periods.yearFrequencyPlural",
482
+ PeriodsDayFrequencyPlural = "periods.dayFrequencyPlural",
483
+ ProductInfoProductTitle = "product_info.product_title",
484
+ ProductInfoProductDescription = "product_info.product_description",
485
+ ProductInfoProductPrice = "product_info.product_price",
486
+ ProductInfoFreeTrialDuration = "product_info.free_trial_duration",
487
+ ProductInfoPriceAfterFreeTrial = "product_info.price_after_free_trial",
488
+ ProductInfoIntroPricePhaseAfterTrial = "product_info.intro_price_phase_after_trial",
489
+ ProductInfoIntroPricePhasePaidOnce = "product_info.intro_price_phase_paid_once",
490
+ ProductInfoIntroPricePhase = "product_info.intro_price_phase",
491
+ ProductInfoPriceAfterIntroPrice = "product_info.price_after_intro_price",
492
+ ProductInfoAfterTrial = "product_info.after_trial",
493
+ ProductInfoAfter = "product_info.after",
494
+ ProductInfoPriceTotalDueToday = "product_info.total_due_today",
495
+ ProductInfoSubscribeTo = "product_info.subscribe_to",
496
+ ProductInfoRenewalFrequency = "product_info.renewal_frequency",
497
+ ProductInfoContinuesUntilCancelled = "product_info.continues_until_cancelled",
498
+ ProductInfoCancelAnytime = "product_info.cancel_anytime",
499
+ PaymentEntryPagePaymentStepTitle = "payment_entry_page.payment_step_title",
500
+ PaymentEntryPageTrialSubscriptionTermsInfo = "payment_entry_page.trial_subscription_terms_info",
501
+ PaymentEntryPageSubscriptionTermsInfo = "payment_entry_page.subscription_terms_info",
502
+ PaymentEntryPageSubscriptionTermsInfoWithoutAppName = "payment_entry_page.subscription_terms_info_without_app_name",
503
+ PaymentEntryPageOtpTermsInfo = "payment_entry_page.otp_terms_info",
504
+ PaymentEntryPageOtpTermsInfoWithoutAppName = "payment_entry_page.otp_terms_info_without_app_name",
505
+ PaymentEntryPageTermsLinkLabel = "payment_entry_page.terms_link_label",
506
+ PaymentEntryPageCheckoutConsentAgreement = "payment_entry_page.checkout_consent_agreement",
507
+ PaymentEntryPageCheckoutConsentAgreementWithoutAppName = "payment_entry_page.checkout_consent_agreement_without_app_name",
508
+ PaymentEntryPageCheckoutConsentTermsOfService = "payment_entry_page.checkout_consent_terms_of_service",
509
+ PaymentEntryPageSubscriptionInfo = "payment_entry_page.subscription_info",
510
+ PaymentEntryPageButtonPay = "payment_entry_page.button_pay",
511
+ PaymentEntryPageButtonStartTrial = "payment_entry_page.button_start_trial",
512
+ PaymentEntryPageButtonWithPrice = "payment_entry_page.button_with_price",
513
+ PaymentEntryPageButtonPaymentMethod = "payment_entry_page.button_payment_method",
514
+ PaymentEntryPageExpressCheckoutDivider = "payment_entry_page.express_checkout_divider",
515
+ PaymentEntryPagePaymentMethodError = "payment_entry_page.payment_method_error",
516
+ PaymentEntryPagePaymentMethodErrorCardNotSupported = "payment_entry_page.payment_method_error_card_not_supported",
517
+ SuccessPagePurchaseSuccessful = "success_page.purchase_successful",
518
+ SuccessPageButtonClose = "success_page.button_close",
519
+ LoadingPageProcessingPayment = "loading_page.processing_payment",
520
+ LoadingPageKeepPageOpen = "loading_page.keep_page_open",
521
+ ErrorPageCloseButtonTitle = "error_page.close_button_title",
522
+ ErrorPageIfErrorPersists = "error_page.if_error_persists",
523
+ ErrorPageTroubleAccessing = "error_page.trouble_accessing",
524
+ ErrorPageErrorTitleAlreadySubscribed = "error_page.error_title_already_subscribed",
525
+ ErrorPageErrorTitleAlreadyPurchased = "error_page.error_title_already_purchased",
526
+ ErrorPageErrorTitleOtherErrors = "error_page.error_title_other_errors",
527
+ ErrorPageErrorTitleStripeTaxNotActive = "error_page.error_title_stripe_tax_not_active",
528
+ ErrorPageErrorTitleStripeInvalidTaxOriginAddress = "error_page.error_title_stripe_invalid_tax_origin_address",
529
+ ErrorPageErrorTitleStripeMissingRequiredPermission = "error_page.error_title_stripe_missing_required_permission",
530
+ ErrorPageErrorMessageAlreadySubscribed = "error_page.error_message_already_subscribed",
531
+ ErrorPageErrorMessageAlreadyPurchased = "error_page.error_message_already_purchased",
532
+ ErrorPageErrorMessageMissingEmailError = "error_page.error_message_missing_email_error",
533
+ ErrorPageErrorMessageInvalidEmailError = "error_page.error_message_invalid_email_error",
534
+ ErrorPageErrorMessageNetworkError = "error_page.error_message_network_error",
535
+ ErrorPageErrorMessageErrorChargingPayment = "error_page.error_message_error_charging_payment",
536
+ ErrorPageErrorMessageErrorSettingUpPurchase = "error_page.error_message_error_setting_up_purchase",
537
+ ErrorPageErrorMessageUnknownError = "error_page.error_message_unknown_error",
538
+ ErrorPageErrorMessageInvalidTaxLocation = "error_page.error_message_invalid_tax_location",
539
+ ErrorPageErrorMessageStripeTaxNotActive = "error_page.error_message_stripe_tax_not_active",
540
+ ErrorPageErrorMessageStripeInvalidTaxOriginAddress = "error_page.error_message_stripe_invalid_tax_origin_address",
541
+ ErrorPageErrorMessageStripeInvalidTaxOriginAddressDuringCheckout = "error_page.error_message_stripe_invalid_tax_origin_address_during_checkout",
542
+ ErrorPageErrorMessageStripeMissingRequiredPermission = "error_page.error_message_stripe_missing_required_permission",
543
+ ErrorPageErrorMessageOnlyInSandbox = "error_page.error_only_in_sandbox",
544
+ ErrorButtonTryAgain = "error_page.button_try_again",
545
+ ErrorButtonClose = "error_page.button_close",
546
+ PaywallVariablesPricePerPeriod = "paywall_variables.price_per_period",
547
+ PaywallVariablesSubRelativeDiscount = "paywall_variables.sub_relative_discount",
548
+ PaywallVariablesTotalPriceAndPerMonth = "paywall_variables.total_price_and_per_month",
549
+ PaywallVariablesFreePrice = "paywall_variables.free_price",
550
+ PricingDropdownShowDetails = "pricing_dropdown.show_details",
551
+ PricingDropdownHideDetails = "pricing_dropdown.hide_details",
552
+ PricingDropdownAddPromoCode = "pricing_dropdown.add_promo_code",
553
+ DiscountInputLabel = "discount_input.label",
554
+ PricingTotalExcludingTax = "pricing_table.total_excluding_tax",
555
+ PricingTableTrialEnds = "pricing_table.trial_ends",
556
+ PricingTableTotalDueToday = "pricing_table.total_due_today",
557
+ PricingTableSubtotal = "pricing_table.subtotal",
558
+ PricingTableDiscount = "pricing_table.discount",
559
+ PricingTableTax = "pricing_table.tax",
560
+ PricingTableEnterBillingAddressToCalculate = "pricing_table.enter_billing_address_to_calculate",
561
+ PricingTableEnterStateOrPostalCodeToCalculate = "pricing_table.enter_state_or_postal_code_to_calculate",
562
+ PricingTableEnterPostalCodeToCalculate = "pricing_table.enter_postal_code_to_calculate",
563
+ NavbarHeaderDetails = "navbar_header.details",
564
+ NavbarBackButton = "navbar_header.back_button",
565
+ PriceUpdateTitle = "price_update.title",
566
+ PriceUpdateBaseMessage = "price_update.base_message",
567
+ PriceUpdateTrialMessage = "price_update.trial_message",
568
+ ApplePayFreeTrial = "apple_pay.free_trial",
569
+ UpgradeProductInfoChangeSubscriptionTitle = "upgrade_product_info.change_subscription_title",
570
+ UpgradeProductInfoUpgradeSubscriptionTitle = "upgrade_product_info.upgrade_subscription_title",
571
+ UpgradeProductInfoTaxEstimated = "upgrade_product_info.tax_estimated",
572
+ UpgradeProductInfoEstimatedAtNextRenewal = "upgrade_product_info.estimated_at_next_renewal",
573
+ UpgradeProductInfoCalculatedLater = "upgrade_product_info.calculated_later",
574
+ PlanCardCurrent = "plan_card.current",
575
+ PlanCardNew = "plan_card.new",
576
+ RefundForUnusedTimeTitle = "refund_for_unused_time.title",
577
+ RefundForUnusedTimeMessage = "refund_for_unused_time.message",
578
+ CreditForUnusedTimeTitle = "credit_for_unused_time.title",
579
+ CreditForUnusedTimeMessage = "credit_for_unused_time.message",
580
+ UpgradeConfirmPageTitle = "upgrade_confirm_page.title",
581
+ UpgradeConfirmPageSubtitleImmediate = "upgrade_confirm_page.subtitle_immediate",
582
+ UpgradeConfirmPageSubtitleDeferred = "upgrade_confirm_page.subtitle_deferred",
583
+ UpgradeConfirmPageConfirming = "upgrade_confirm_page.confirming",
584
+ UpgradeConfirmPageConfirmSchedule = "upgrade_confirm_page.confirm_schedule",
585
+ UpgradeConfirmPageConfirmUpgrade = "upgrade_confirm_page.confirm_upgrade",
586
+ UpgradeConfirmPageConfirmUpgradeWithPrice = "upgrade_confirm_page.confirm_upgrade_with_price",
587
+ UpgradeConfirmPageOnFile = "upgrade_confirm_page.on_file",
588
+ UpgradeConfirmPageEmail = "upgrade_confirm_page.email",
589
+ UpgradeConfirmPagePaymentMethod = "upgrade_confirm_page.payment_method",
590
+ UpgradeConfirmPageBillingAddress = "upgrade_confirm_page.billing_address",
591
+ PaddleCheckoutReturnTo = "paddle_checkout.return_to",
592
+ PaddleOrderSummaryBilledFrequency = "paddle_order_summary.billed_frequency",
593
+ PaddleOrderSummaryIntroThenRecurring = "paddle_order_summary.intro_then_recurring",
594
+ PaddleOrderSummaryIncTax = "paddle_order_summary.inc_tax",
595
+ PaddleOrderSummaryDueOn = "paddle_order_summary.due_on"
596
+ }
597
+
598
+ /**
599
+ * Custom log handler function type. Allows you to handle SDK log messages
600
+ * with your own logging system.
601
+ * @param logLevel - The log level of the message
602
+ * @param message - The log message
603
+ * @public
604
+ */
605
+ export declare type LogHandler = (logLevel: LogLevel, message: string) => void;
606
+
607
+ /**
608
+ * Possible levels to log in the console.
609
+ * @public
610
+ */
611
+ export declare enum LogLevel {
612
+ /**
613
+ * No logs will be shown in the console.
614
+ */
615
+ Silent = 0,
616
+ /**
617
+ * Only errors will be shown in the console.
618
+ */
619
+ Error = 1,
620
+ /**
621
+ * Only warnings and errors will be shown in the console.
622
+ */
623
+ Warn = 2,
624
+ /**
625
+ * Only info, warnings, and errors will be shown in the console.
626
+ */
627
+ Info = 3,
628
+ /**
629
+ * Debug, info, warnings, and errors will be shown in the console.
630
+ */
631
+ Debug = 4,
632
+ /**
633
+ * All logs will be shown in the console.
634
+ */
635
+ Verbose = 5
636
+ }
637
+
638
+ /* Excluded from this release type: MetaCanonicalAttributionMetadata */
639
+
640
+ /* Excluded from this release type: MetaCapiAttributionMetadata */
641
+
642
+ /**
643
+ * Represents a possible option to purchase a non-subscription product.
644
+ * @public
645
+ */
646
+ export declare interface NonSubscriptionOption extends PurchaseOption {
647
+ /**
648
+ * The base price for the product.
649
+ */
650
+ readonly basePrice: Price;
651
+ /* Excluded from this release type: discount */
652
+ }
653
+
654
+ declare interface NonSubscriptionOptionResponse extends PurchaseOptionResponse {
655
+ base_price: PriceResponse;
656
+ }
657
+
658
+ /**
659
+ * Information that represents a non-subscription purchase made by a user.
660
+ * @public
661
+ */
662
+ export declare interface NonSubscriptionTransaction {
663
+ /**
664
+ * The unique identifier for the transaction created by RevenueCat.
665
+ */
666
+ readonly transactionIdentifier: string;
667
+ /**
668
+ * The product identifier.
669
+ */
670
+ readonly productIdentifier: string;
671
+ /**
672
+ * The date that the store charged the user’s account.
673
+ */
674
+ readonly purchaseDate: Date;
675
+ /**
676
+ * The unique identifier for the transaction created by the Store.
677
+ */
678
+ readonly storeTransactionId: string | null;
679
+ /**
680
+ * The {@link Store} where the transaction was made.
681
+ */
682
+ readonly store: Store;
683
+ }
684
+
685
+ /**
686
+ * An offering is a collection of {@link Package} available for the user to purchase.
687
+ * For more info see https://docs.revenuecat.com/docs/entitlements
688
+ * @public
689
+ */
690
+ export declare interface Offering {
691
+ /**
692
+ * Unique identifier defined in RevenueCat dashboard.
693
+ */
694
+ readonly identifier: string;
695
+ /**
696
+ * Offering description defined in RevenueCat dashboard.
697
+ */
698
+ readonly serverDescription: string;
699
+ /**
700
+ * Offering metadata defined in RevenueCat dashboard.
701
+ */
702
+ readonly metadata: {
703
+ [key: string]: unknown;
704
+ } | null;
705
+ /**
706
+ * The default web checkout URL for this offering, if available.
707
+ */
708
+ readonly webCheckoutURL?: string | null;
709
+ /**
710
+ * A map of all the packages available for purchase keyed by package ID.
711
+ */
712
+ readonly packagesById: {
713
+ [key: string]: Package;
714
+ };
715
+ /**
716
+ * A list of all the packages available for purchase.
717
+ */
718
+ readonly availablePackages: Package[];
719
+ /**
720
+ * Lifetime package type configured in the RevenueCat dashboard, if available.
721
+ */
722
+ readonly lifetime: Package | null;
723
+ /**
724
+ * Annual package type configured in the RevenueCat dashboard, if available.
725
+ */
726
+ readonly annual: Package | null;
727
+ /**
728
+ * Six month package type configured in the RevenueCat dashboard, if available.
729
+ */
730
+ readonly sixMonth: Package | null;
731
+ /**
732
+ * Three month package type configured in the RevenueCat dashboard, if available.
733
+ */
734
+ readonly threeMonth: Package | null;
735
+ /**
736
+ * Two month package type configured in the RevenueCat dashboard, if available.
737
+ */
738
+ readonly twoMonth: Package | null;
739
+ /**
740
+ * Monthly package type configured in the RevenueCat dashboard, if available.
741
+ */
742
+ readonly monthly: Package | null;
743
+ /**
744
+ * Weekly package type configured in the RevenueCat dashboard, if available.
745
+ */
746
+ readonly weekly: Package | null;
747
+ /**
748
+ * Whether this offering has an attached paywall configured in the RevenueCat dashboard.
749
+ */
750
+ readonly hasPaywall: boolean;
751
+ /* Excluded from this release type: paywallComponents */
752
+ /* Excluded from this release type: uiConfig */
753
+ }
754
+
755
+ /**
756
+ * Keywords for identifying specific offerings in the {@link Purchases.getOfferings} method.
757
+ * @public
758
+ */
759
+ export declare enum OfferingKeyword {
760
+ /**
761
+ * The current offering.
762
+ */
763
+ Current = "current"
764
+ }
765
+
766
+ /**
767
+ * This class contains all the offerings configured in RevenueCat dashboard.
768
+ * For more info see https://docs.revenuecat.com/docs/entitlements
769
+ * @public
770
+ */
771
+ export declare interface Offerings {
772
+ /**
773
+ * Dictionary containing all {@link Offering} objects, keyed by their identifier.
774
+ */
775
+ readonly all: {
776
+ [offeringId: string]: Offering;
777
+ };
778
+ /**
779
+ * Current offering configured in the RevenueCat dashboard.
780
+ * It can be `null` if no current offering is configured or if a specific offering
781
+ * was requested that is not the current one.
782
+ */
783
+ readonly current: Offering | null;
784
+ }
785
+
786
+ /**
787
+ * The types used to describe whether a transaction was purchased by the user,
788
+ * or is available to them through Family Sharing.
789
+ * @public
790
+ */
791
+ export declare type OwnershipType = "PURCHASED" | "FAMILY_SHARED" | "UNKNOWN";
792
+
793
+ /**
794
+ * Contains information about the product available for the user to purchase.
795
+ * For more info see https://docs.revenuecat.com/docs/entitlements
796
+ * @public
797
+ */
798
+ export declare interface Package {
799
+ /**
800
+ * Unique identifier for this package. Can be one a predefined package type or a custom one.
801
+ */
802
+ readonly identifier: string;
803
+ /**
804
+ * The {@link Product} assigned to this package.
805
+ * @deprecated - Use {@link Package.product} instead.
806
+ */
807
+ readonly rcBillingProduct: Product;
808
+ /**
809
+ * The {@link Product} assigned to this package.
810
+ * @deprecated - Use {@link Package.product} instead.
811
+ */
812
+ readonly webBillingProduct: Product;
813
+ /**
814
+ * The {@link Product} assigned to this package.
815
+ */
816
+ readonly product: Product;
817
+ /**
818
+ * The web checkout URL for this package, if available.
819
+ */
820
+ readonly webCheckoutURL?: string | null;
821
+ /**
822
+ * The type of package.
823
+ */
824
+ readonly packageType: PackageType;
825
+ }
826
+
827
+ /**
828
+ * Enumeration of all possible Package types.
829
+ * @public
830
+ */
831
+ export declare enum PackageType {
832
+ /**
833
+ * A package that was defined with an unrecognized RC identifier.
834
+ */
835
+ Unknown = "unknown",
836
+ /**
837
+ * A package that was defined with a custom identifier.
838
+ */
839
+ Custom = "custom",
840
+ /**
841
+ * A package configured with the predefined lifetime identifier.
842
+ */
843
+ Lifetime = "$rc_lifetime",
844
+ /**
845
+ * A package configured with the predefined annual identifier.
846
+ */
847
+ Annual = "$rc_annual",
848
+ /**
849
+ * A package configured with the predefined six month identifier.
850
+ */
851
+ SixMonth = "$rc_six_month",
852
+ /**
853
+ * A package configured with the predefined three month identifier.
854
+ */
855
+ ThreeMonth = "$rc_three_month",
856
+ /**
857
+ * A package configured with the predefined two month identifier.
858
+ */
859
+ TwoMonth = "$rc_two_month",
860
+ /**
861
+ * A package configured with the predefined monthly identifier.
862
+ */
863
+ Monthly = "$rc_monthly",
864
+ /**
865
+ * A package configured with the predefined weekly identifier.
866
+ */
867
+ Weekly = "$rc_weekly"
868
+ }
869
+
870
+ /**
871
+ * Known values of `component_type` in {@link PaywallInteractionEvent}.
872
+ * @public
873
+ */
874
+ export declare const PAYWALL_COMPONENT_TYPES: {
875
+ readonly TAB: "tab";
876
+ readonly SWITCH: "switch";
877
+ readonly CAROUSEL: "carousel";
878
+ readonly BUTTON: "button";
879
+ readonly TEXT: "text";
880
+ readonly PACKAGE: "package";
881
+ readonly PACKAGE_SELECTION_SHEET: "package_selection_sheet";
882
+ readonly PURCHASE_BUTTON: "purchase_button";
883
+ readonly WALLET_BUTTON: "wallet_button";
884
+ };
885
+
886
+ /**
887
+ * A paywall control interaction, as passed to `PaywallListener.onInteraction`. Keys that do not apply
888
+ * are omitted.
889
+ *
890
+ * See https://rev.cat/paywall-interaction-events for what each component type sends.
891
+ * @public
892
+ */
893
+ export declare interface PaywallInteractionEvent {
894
+ readonly timestamp: number;
895
+ readonly session_id: string;
896
+ readonly offering_id: string;
897
+ readonly paywall_id?: string;
898
+ readonly paywall_revision: number;
899
+ readonly display_mode?: string;
900
+ readonly dark_mode?: boolean;
901
+ readonly locale?: string;
902
+ readonly component_type: string;
903
+ readonly component_value: string;
904
+ readonly component_name?: string;
905
+ readonly component_url?: string;
906
+ readonly origin_index?: number;
907
+ readonly destination_index?: number;
908
+ readonly origin_context_name?: string;
909
+ readonly destination_context_name?: string;
910
+ readonly default_index?: number;
911
+ readonly origin_package_id?: string;
912
+ readonly destination_package_id?: string;
913
+ readonly default_package_id?: string;
914
+ readonly current_package_id?: string;
915
+ readonly resulting_package_id?: string;
916
+ readonly origin_product_id?: string;
917
+ readonly destination_product_id?: string;
918
+ readonly default_product_id?: string;
919
+ readonly current_product_id?: string;
920
+ readonly resulting_product_id?: string;
921
+ }
922
+
923
+ /**
924
+ * Listener for paywall purchase lifecycle events.
925
+ * @public
926
+ */
927
+ export declare type PaywallListener = PurchaseListener & {
928
+ /**
929
+ * Called when the user interacts with a paywall control.
930
+ * Exceptions thrown here are logged and do not affect the paywall.
931
+ */
932
+ onInteraction?: (event: PaywallInteractionEvent) => void;
933
+ };
934
+
935
+ /**
936
+ * Represents the result of a purchase operation initiated from a paywall.
937
+ * @public
938
+ */
939
+ export declare interface PaywallPurchaseResult extends PurchaseResult {
940
+ /**
941
+ * The package selected by the customer while interacting with the paywall.
942
+ */
943
+ selectedPackage: Package;
944
+ }
945
+
946
+ /**
947
+ * Represents a period of time.
948
+ * @public
949
+ */
950
+ export declare interface Period {
951
+ /**
952
+ * The number of units in the period.
953
+ */
954
+ number: number;
955
+ /**
956
+ * The unit of time.
957
+ */
958
+ unit: PeriodUnit;
959
+ }
960
+
961
+ /**
962
+ * Supported period types for an entitlement.
963
+ * - "normal" If the entitlement is not under an introductory or trial period.
964
+ * - "intro" If the entitlement is under an introductory period.
965
+ * - "trial" If the entitlement is under a trial period.
966
+ * - "prepaid" If the entitlement is a prepaid entitlement. Only for Google Play subscriptions.
967
+ * @public
968
+ */
969
+ export declare type PeriodType = "normal" | "intro" | "trial" | "prepaid";
970
+
971
+ /**
972
+ * Represents a unit of time.
973
+ * @public
974
+ */
975
+ export declare enum PeriodUnit {
976
+ Year = "year",
977
+ Month = "month",
978
+ Week = "week",
979
+ Day = "day"
980
+ }
981
+
982
+ /**
983
+ * PlatformInfo is an interface that represents the information about the platform.
984
+ * Used by RevenueCat Hybrid SDKs to provide information about the platform.
985
+ * @public
986
+ * @experimental
987
+ */
988
+ export declare interface PlatformInfo {
989
+ /**
990
+ * The flavor of the SDK.
991
+ */
992
+ readonly flavor: string;
993
+ /**
994
+ * The version of the hybrid SDK.
995
+ */
996
+ readonly version: string;
997
+ }
998
+
999
+ /* Excluded from this release type: PrepareQuickPurchaseParams */
1000
+
1001
+ /**
1002
+ * Contains data about the context in which an offering was presented.
1003
+ * @public
1004
+ */
1005
+ export declare interface PresentedOfferingContext {
1006
+ /**
1007
+ * The identifier of the offering used to obtain this object.
1008
+ */
1009
+ readonly offeringIdentifier: string;
1010
+ /**
1011
+ * The targeting context used to obtain this object.
1012
+ */
1013
+ readonly targetingContext: TargetingContext | null;
1014
+ /**
1015
+ * If obtained this information from a placement,
1016
+ * the identifier of the placement.
1017
+ */
1018
+ readonly placementIdentifier: string | null;
1019
+ }
1020
+
1021
+ /**
1022
+ * Parameters for the {@link Purchases.presentExpressPurchaseButton} method.
1023
+ *
1024
+ * @example
1025
+ * ```ts
1026
+ * const offerings = await purchases.getOfferings();
1027
+ * const pkg = offerings.current?.availablePackages[0];
1028
+ * const htmlTarget = document.getElementById("express-purchase-button");
1029
+ * const fallbackButton = document.getElementById("checkout-button");
1030
+ *
1031
+ * if (pkg && htmlTarget) {
1032
+ * let expressButtonUpdater: ExpressPurchaseButtonUpdater | undefined;
1033
+ *
1034
+ * void purchases.presentExpressPurchaseButton({
1035
+ * rcPackage: pkg,
1036
+ * htmlTarget,
1037
+ * onButtonReady: (updater, walletsAvailable) => {
1038
+ * expressButtonUpdater = updater;
1039
+ * htmlTarget.hidden = !walletsAvailable;
1040
+ *
1041
+ * if (fallbackButton) {
1042
+ * fallbackButton.hidden = walletsAvailable;
1043
+ * }
1044
+ * },
1045
+ * });
1046
+ *
1047
+ * // If the customer selects a different package later, update the button
1048
+ * // instead of rendering a new one.
1049
+ * function onSelectedPackageChanged(nextPackage: Package) {
1050
+ * expressButtonUpdater?.updatePurchase(nextPackage);
1051
+ * }
1052
+ * }
1053
+ * ```
1054
+ *
1055
+ * @experimental
1056
+ * @public
1057
+ */
1058
+ export declare interface PresentExpressPurchaseButtonParams {
1059
+ /**
1060
+ * The package you want to purchase. Obtained from {@link Purchases.getOfferings}.
1061
+ */
1062
+ rcPackage: Package;
1063
+ /**
1064
+ * The HTML element where the express purchase button should be rendered.
1065
+ */
1066
+ htmlTarget: HTMLElement;
1067
+ /**
1068
+ * The option to be used for this purchase. If not specified or null the default one will be used.
1069
+ */
1070
+ purchaseOption?: PurchaseOption | null;
1071
+ /**
1072
+ * The email of the user. If undefined, RevenueCat will ask the customer for their email.
1073
+ */
1074
+ customerEmail?: string;
1075
+ /**
1076
+ * The RevenueCat public identifier for an Apple external purchase token.
1077
+ */
1078
+ externalPurchaseTokenId?: string;
1079
+ /**
1080
+ * The locale to use for the purchase flow. If not specified, English will be used
1081
+ */
1082
+ selectedLocale?: string;
1083
+ /**
1084
+ * The default locale to use if the selectedLocale is not available.
1085
+ * Defaults to english.
1086
+ */
1087
+ defaultLocale?: string;
1088
+ /**
1089
+ * The purchase metadata to be passed to the backend.
1090
+ * Any information provided here will be propagated to the payment gateway and
1091
+ * to the RC transaction as metadata.
1092
+ */
1093
+ metadata?: PurchaseMetadata;
1094
+ /* Excluded from this release type: labelsOverride */
1095
+ /**
1096
+ * Callback to be called when the express purchase button is ready to be clicked.
1097
+ */
1098
+ onButtonReady?: (updater: ExpressPurchaseButtonUpdater, walletsAvailable: boolean) => void;
1099
+ /**
1100
+ * Optional listener for purchase lifecycle events.
1101
+ */
1102
+ listener?: PurchaseListener;
1103
+ /**
1104
+ * Theme for the Stripe wallet button appearance.
1105
+ * Matches Apple Pay button styles: 'black', 'white', or 'white-outline'
1106
+ * Defaults to "black".
1107
+ */
1108
+ walletButtonTheme?: WalletButtonTheme;
1109
+ }
1110
+
1111
+ /**
1112
+ * Parameters for the {@link Purchases.presentPaywall} method.
1113
+ * @public
1114
+ */
1115
+ export declare interface PresentPaywallParams {
1116
+ /**
1117
+ * The identifier of the offering to fetch the paywall for.
1118
+ * Can be a string identifier or one of the predefined keywords.
1119
+ */
1120
+ readonly offering?: Offering;
1121
+ /**
1122
+ * The target element where the paywall will be rendered.
1123
+ * The paywall will create a full-screen overlay if null.
1124
+ */
1125
+ readonly htmlTarget?: HTMLElement;
1126
+ /**
1127
+ * The target element where the checkout flow will be rendered.
1128
+ * The checkout flow will create a full-screen overlay if null.
1129
+ */
1130
+ readonly purchaseHtmlTarget?: HTMLElement;
1131
+ /**
1132
+ * The email of the customer starting the purchase.
1133
+ * If passed the checkout flow will not ask for it to the customer.
1134
+ */
1135
+ readonly customerEmail?: string;
1136
+ /**
1137
+ * The RevenueCat public identifier for an Apple external purchase token.
1138
+ */
1139
+ readonly externalPurchaseTokenId?: string;
1140
+ /**
1141
+ * The purchase metadata to be passed to the backend when a purchase is started
1142
+ * from the paywall.
1143
+ * Any information provided here will be propagated to the payment gateway and
1144
+ * to the RC transaction as metadata.
1145
+ */
1146
+ readonly metadata?: PurchaseMetadata;
1147
+ /**
1148
+ * Overrides the branding appearance for the purchase started from this
1149
+ * paywall. Only the provided values are overridden. These values take
1150
+ * precedence over the override passed to `Purchases.configure()`.
1151
+ *
1152
+ * For Stripe Checkout, this customizes the supported mobile wallet experience.
1153
+ * The Stripe-hosted fallback opened through "Pay another way" remains light and
1154
+ * cannot currently be customized.
1155
+ */
1156
+ readonly brandingAppearanceOverride?: Partial<BrandingAppearance>;
1157
+ /**
1158
+ * @experimental
1159
+ * If set to true, the Web Billing checkout shown from the paywall
1160
+ * will display a discount input code field.
1161
+ */
1162
+ readonly showDiscountCodeField?: boolean;
1163
+ /**
1164
+ * @experimental
1165
+ * Initial discount code to apply to the checkout when one already exists
1166
+ * outside of the paywall UI, for example in the hosting page's URL.
1167
+ */
1168
+ readonly discountCode?: string;
1169
+ /**
1170
+ * @experimental
1171
+ * Called when the applied discount code changes in the checkout shown from
1172
+ * the paywall. This can be used to sync host state such as URL parameters.
1173
+ */
1174
+ readonly onDiscountCodeChanged?: (discountCode: string | null) => void;
1175
+ /**
1176
+ * Callback to be called when the paywall tries to navigate to an external URL.
1177
+ *
1178
+ * Markdown text links keep their native browser navigation. Use this callback
1179
+ * for side effects or to customize how button-driven URL actions are handled.
1180
+ */
1181
+ readonly onNavigateToUrl?: (url: string) => void;
1182
+ /* Excluded from this release type: onCompleteWorkflowNavigate */
1183
+ /**
1184
+ * Callback to be called when the paywall tries to navigate back.
1185
+ *
1186
+ * Example:
1187
+ * ```ts
1188
+ * onBack: (closePaywall) => {
1189
+ * // You may want to keep the paywall open while showing a confirmation
1190
+ * // modal or logging analytics, then close it if the user confirms.
1191
+ * // If you want the back action to dismiss the paywall immediately,
1192
+ * // call closePaywall() right away.
1193
+ * closePaywall();
1194
+ * }
1195
+ * ```
1196
+ */
1197
+ readonly onBack?: (closePaywall: () => void) => void;
1198
+ /**
1199
+ * Callback to be called when the paywall tries to visit the customer center.
1200
+ */
1201
+ readonly onVisitCustomerCenter?: () => void;
1202
+ /**
1203
+ * Callback called when an error that won't close the paywall occurs.
1204
+ * For example, a retryable error during the purchase process.
1205
+ * @deprecated Use `listener.onPurchaseError` instead.
1206
+ */
1207
+ readonly onPurchaseError?: (error: Error) => void;
1208
+ /**
1209
+ * Optional listener for paywall purchase lifecycle events.
1210
+ */
1211
+ readonly listener?: PaywallListener;
1212
+ /**
1213
+ * The locale to use for the paywall and the checkout flow.
1214
+ */
1215
+ readonly selectedLocale?: string;
1216
+ /**
1217
+ * Whether to hide back buttons in the paywall. Defaults to false.
1218
+ */
1219
+ readonly hideBackButtons?: boolean;
1220
+ /**
1221
+ * Custom variables to pass to the paywall at runtime, overriding defaults set
1222
+ * in the RevenueCat dashboard.
1223
+ *
1224
+ * Variables must be defined in the dashboard first. Reference them in paywall
1225
+ * text using the `custom.` prefix (e.g. `{{ custom.player_name }}`).
1226
+ *
1227
+ * @example
1228
+ * ```ts
1229
+ * presentPaywall({
1230
+ * customVariables: {
1231
+ * player_name: CustomVariableValue.string('Ada'),
1232
+ * level: CustomVariableValue.number(42),
1233
+ * is_premium: CustomVariableValue.boolean(true),
1234
+ * },
1235
+ * });
1236
+ * ```
1237
+ */
1238
+ readonly customVariables?: CustomVariables;
1239
+ /* Excluded from this release type: productChangeInfo */
1240
+ }
1241
+
1242
+ /**
1243
+ * Price information for a product.
1244
+ * @public
1245
+ */
1246
+ export declare interface Price {
1247
+ /**
1248
+ * Price in cents of the currency.
1249
+ * @deprecated - Use {@link Price.amountMicros} instead.
1250
+ */
1251
+ readonly amount: number;
1252
+ /**
1253
+ * Price in micro-units of the currency. For example, $9.99 is represented as 9990000.
1254
+ */
1255
+ readonly amountMicros: number;
1256
+ /**
1257
+ * Returns ISO 4217 currency code for price.
1258
+ * For example, if price is specified in British pounds sterling,
1259
+ * currency is "GBP".
1260
+ * If currency code cannot be determined, currency symbol is returned.
1261
+ */
1262
+ readonly currency: string;
1263
+ /**
1264
+ * Formatted price string including price and currency.
1265
+ */
1266
+ readonly formattedPrice: string;
1267
+ }
1268
+
1269
+ declare interface PriceResponse {
1270
+ amount_micros: number;
1271
+ currency: string;
1272
+ }
1273
+
1274
+ /**
1275
+ * Represents the price and duration information for a phase of the purchase option.
1276
+ * @public
1277
+ */
1278
+ export declare interface PricingPhase {
1279
+ /**
1280
+ * The duration of the phase in ISO 8601 format.
1281
+ */
1282
+ readonly periodDuration: string | null;
1283
+ /**
1284
+ * The duration of the phase as a {@link Period}.
1285
+ */
1286
+ readonly period: Period | null;
1287
+ /**
1288
+ * The price for the purchase option.
1289
+ * Null in case of trials.
1290
+ */
1291
+ readonly price: Price | null;
1292
+ /**
1293
+ * The number of cycles this option's price repeats.
1294
+ * I.e. 2 subscription cycles, 0 if not applicable.
1295
+ */
1296
+ readonly cycleCount: number;
1297
+ /**
1298
+ * The approximated price converted to weekly rate, based on the period information.
1299
+ * Null in case of trials.
1300
+ */
1301
+ readonly pricePerWeek: Price | null;
1302
+ /**
1303
+ * The approximated price converted to monthly rate, based on the period information.
1304
+ * Null in case of trials.
1305
+ */
1306
+ readonly pricePerMonth: Price | null;
1307
+ /**
1308
+ * The approximated price converted to yearly rate, based on the period information.
1309
+ * Null in case of trials.
1310
+ */
1311
+ readonly pricePerYear: Price | null;
1312
+ }
1313
+
1314
+ declare interface PricingPhaseResponse {
1315
+ period_duration: string | null;
1316
+ price: PriceResponse | null;
1317
+ cycle_count: number;
1318
+ }
1319
+
1320
+ /**
1321
+ * Represents product's listing details.
1322
+ * @public
1323
+ */
1324
+ export declare interface Product {
1325
+ /**
1326
+ * The product ID.
1327
+ */
1328
+ readonly identifier: string;
1329
+ /**
1330
+ * Name of the product.
1331
+ * @deprecated - Use {@link Product.title} instead.
1332
+ */
1333
+ readonly displayName: string;
1334
+ /**
1335
+ * The title of the product as configured in the RevenueCat dashboard.
1336
+ */
1337
+ readonly title: string;
1338
+ /**
1339
+ * The description of the product as configured in the RevenueCat dashboard.
1340
+ */
1341
+ readonly description: string | null;
1342
+ /**
1343
+ * Price of the product. This will match the default option's base phase price
1344
+ * in subscriptions or the price in non-subscriptions.
1345
+ * @deprecated Use {@link Product.price}.
1346
+ */
1347
+ readonly currentPrice: Price;
1348
+ /**
1349
+ * The type of product.
1350
+ */
1351
+ readonly productType: ProductType;
1352
+ /**
1353
+ * The period duration for a subscription product. This will match the default
1354
+ * option's base phase period duration. Null for non-subscriptions.
1355
+ */
1356
+ readonly normalPeriodDuration: string | null;
1357
+ /**
1358
+ * The offering ID used to obtain this product.
1359
+ * @deprecated - Use {@link Product.presentedOfferingContext} instead.
1360
+ */
1361
+ readonly presentedOfferingIdentifier: string;
1362
+ /**
1363
+ * The context from which this product was obtained.
1364
+ */
1365
+ readonly presentedOfferingContext: PresentedOfferingContext;
1366
+ /**
1367
+ * The default purchase option for this product.
1368
+ */
1369
+ readonly defaultPurchaseOption: PurchaseOption;
1370
+ /**
1371
+ * The default subscription option for this product.
1372
+ * Null if no subscription options are available like in the case of consumables and non-consumables.
1373
+ */
1374
+ readonly defaultSubscriptionOption: SubscriptionOption | null;
1375
+ /**
1376
+ * A dictionary with all the possible subscription options available for this
1377
+ * product. Each key contains the key to be used when executing a purchase.
1378
+ * Will be empty for non-subscriptions
1379
+ *
1380
+ * If retrieved through getOfferings the offers are only the ones the customer is
1381
+ * entitled to.
1382
+ */
1383
+ readonly subscriptionOptions: {
1384
+ [optionId: string]: SubscriptionOption;
1385
+ };
1386
+ /**
1387
+ * The default non-subscription option for this product.
1388
+ * Null in the case of subscriptions.
1389
+ */
1390
+ readonly defaultNonSubscriptionOption: NonSubscriptionOption | null;
1391
+ /**
1392
+ * Base price (after any offers) for subscriptions, price for non-subscriptions.
1393
+ */
1394
+ readonly price: Price;
1395
+ /**
1396
+ * Base subscription duration.
1397
+ * Null for non-subscriptions.
1398
+ * Convenience accessor for the default subscription option's base phase period.
1399
+ */
1400
+ readonly period: Period | null;
1401
+ /**
1402
+ * Free trial phase information for subscriptions.
1403
+ * Null for non-subscriptions or when no free trial is available.
1404
+ * Convenience accessor for defaultSubscriptionOption?.trial.
1405
+ */
1406
+ readonly freeTrialPhase: PricingPhase | null;
1407
+ /**
1408
+ * Introductory price phase information for subscriptions.
1409
+ * Null for non-subscriptions or when no introductory price is available.
1410
+ * Convenience accessor for defaultSubscriptionOption?.introPrice.
1411
+ */
1412
+ readonly introPricePhase: PricingPhase | null;
1413
+ /* Excluded from this release type: discountPhase */
1414
+ }
1415
+
1416
+ /* Excluded from this release type: ProductChangeInfo */
1417
+
1418
+ /* Excluded from this release type: ProductChangeResult */
1419
+
1420
+ declare interface ProductResponse {
1421
+ identifier: string;
1422
+ product_type: string;
1423
+ title: string;
1424
+ description: string | null;
1425
+ default_purchase_option_id: string | null;
1426
+ purchase_options: {
1427
+ [key: string]: NonSubscriptionOptionResponse | SubscriptionOptionResponse;
1428
+ };
1429
+ }
1430
+
1431
+ declare interface ProductsResponse {
1432
+ product_details: ProductResponse[];
1433
+ }
1434
+
1435
+ /**
1436
+ * Possible product types
1437
+ * @public
1438
+ */
1439
+ export declare enum ProductType {
1440
+ /**
1441
+ * A product that is an auto-renewing subscription.
1442
+ */
1443
+ Subscription = "subscription",
1444
+ /**
1445
+ * A product that does not renew and can be consumed to be purchased again.
1446
+ */
1447
+ Consumable = "consumable",
1448
+ /**
1449
+ * A product that does not renew and can only be purchased once.
1450
+ */
1451
+ NonConsumable = "non_consumable"
1452
+ }
1453
+
1454
+ declare class PurchaseFlowError extends Error {
1455
+ readonly errorCode: PurchaseFlowErrorCode;
1456
+ readonly underlyingErrorMessage?: string | null | undefined;
1457
+ readonly purchasesErrorCode?: ErrorCode | undefined;
1458
+ readonly extra?: PurchasesErrorExtra | undefined;
1459
+ readonly displayPurchaseFlowErrorCode?: boolean | undefined;
1460
+ constructor(errorCode: PurchaseFlowErrorCode, message?: string, underlyingErrorMessage?: string | null | undefined, purchasesErrorCode?: ErrorCode | undefined, extra?: PurchasesErrorExtra | undefined, displayPurchaseFlowErrorCode?: boolean | undefined);
1461
+ getErrorCode(): number;
1462
+ static fromPurchasesError(e: PurchasesError, defaultFlowErrorCode: PurchaseFlowErrorCode, displayPurchaseFlowErrorCode?: boolean): PurchaseFlowError;
1463
+ static fromBackendErrorCode(backendErrorCode: BackendErrorCode | undefined): PurchaseFlowErrorCode | null;
1464
+ }
1465
+
1466
+ declare enum PurchaseFlowErrorCode {
1467
+ ErrorSettingUpPurchase = 0,
1468
+ ErrorChargingPayment = 1,
1469
+ UnknownError = 2,
1470
+ NetworkError = 3,
1471
+ MissingEmailError = 4,
1472
+ AlreadyPurchasedError = 5,
1473
+ StripeTaxNotActive = 6,
1474
+ StripeInvalidTaxOriginAddress = 7,
1475
+ StripeMissingRequiredPermission = 8,
1476
+ InvalidPaddleAPIKeyError = 9,
1477
+ StripeInvalidTaxOriginAddressDuringCheckout = 10
1478
+ }
1479
+
1480
+ /**
1481
+ * Listener for purchase lifecycle events.
1482
+ * @public
1483
+ */
1484
+ export declare interface PurchaseListener {
1485
+ /**
1486
+ * Called when a purchase flow is about to start for the given package.
1487
+ */
1488
+ onPurchaseStarted?: (rcPackage: Package) => void;
1489
+ /**
1490
+ * Callback called when an error that won't close the paywall occurs.
1491
+ * For example, a retryable error during the purchase process.
1492
+ */
1493
+ onPurchaseError?: (error: Error) => void;
1494
+ /**
1495
+ * Called when the user cancels the purchase flow.
1496
+ */
1497
+ onPurchaseCancelled?: () => void;
1498
+ }
1499
+
1500
+ /**
1501
+ * Metadata that can be passed to the backend when making a purchase.
1502
+ * They will propagate to the payment gateway (i.e. Stripe) and to RevenueCat.
1503
+ * @public
1504
+ */
1505
+ export declare type PurchaseMetadata = Record<string, string | null>;
1506
+
1507
+ /**
1508
+ * Represents a possible option to purchase a product.
1509
+ * @public
1510
+ */
1511
+ export declare interface PurchaseOption {
1512
+ /**
1513
+ * The unique id for a purchase option
1514
+ */
1515
+ readonly id: string;
1516
+ /**
1517
+ * The public price id for this subscription option.
1518
+ */
1519
+ readonly priceId: string;
1520
+ }
1521
+
1522
+ declare interface PurchaseOptionResponse {
1523
+ id: string;
1524
+ price_id: string;
1525
+ discount: DiscountResponse | null;
1526
+ }
1527
+
1528
+ /**
1529
+ * Parameters used to customise the purchase flow when invoking the `.purchase` method.
1530
+ * @public
1531
+ */
1532
+ export declare interface PurchaseParams {
1533
+ /**
1534
+ * The package you want to purchase. Obtained from {@link Purchases.getOfferings}.
1535
+ */
1536
+ rcPackage: Package;
1537
+ /**
1538
+ * The option to be used for this purchase. If not specified or null the default one will be used.
1539
+ */
1540
+ purchaseOption?: PurchaseOption | null;
1541
+ /**
1542
+ * The HTML element where the billing view should be added. If undefined, a new div will be created at the root of the page and appended to the body.
1543
+ */
1544
+ htmlTarget?: HTMLElement;
1545
+ /**
1546
+ * The email of the user. If undefined, RevenueCat will ask the customer for their email.
1547
+ */
1548
+ customerEmail?: string;
1549
+ /**
1550
+ * The RevenueCat public identifier for an Apple external purchase token.
1551
+ */
1552
+ externalPurchaseTokenId?: string;
1553
+ /* Excluded from this release type: workflowPurchaseContext */
1554
+ /* Excluded from this release type: attributionMetadata */
1555
+ /* Excluded from this release type: paywallId */
1556
+ /* Excluded from this release type: paywallSessionId */
1557
+ /**
1558
+ * The locale to use for the purchase flow. If not specified, English will be used
1559
+ */
1560
+ selectedLocale?: string;
1561
+ /**
1562
+ * The default locale to use if the selectedLocale is not available.
1563
+ * Defaults to english.
1564
+ */
1565
+ defaultLocale?: string;
1566
+ /**
1567
+ * The purchase metadata to be passed to the backend.
1568
+ * Any information provided here will be propagated to the payment gateway and
1569
+ * to the RC transaction as metadata.
1570
+ */
1571
+ metadata?: PurchaseMetadata;
1572
+ /**
1573
+ * If set to true, the SDK will skip the success page and automatically
1574
+ * continue the flow once the purchase completes successfully.
1575
+ * Defaults to `false`.
1576
+ */
1577
+ skipSuccessPage?: boolean;
1578
+ /**
1579
+ * @experimental
1580
+ * If set to true, the Web Billing checkout will show a discount input code field.
1581
+ */
1582
+ showDiscountCodeField?: boolean;
1583
+ /**
1584
+ * @experimental
1585
+ * Initial discount code to apply at checkout.
1586
+ * For Web Billing this is displayed as applied in the checkout UI.
1587
+ * For Paddle this is passed to Paddle Checkout as `discountCode`.
1588
+ * This is useful when the code originated outside of the checkout UI,
1589
+ * for example from a URL parameter.
1590
+ */
1591
+ discountCode?: string;
1592
+ /* Excluded from this release type: discountId */
1593
+ /**
1594
+ * @experimental
1595
+ * Called when the applied discount code changes in the Web Billing checkout.
1596
+ * This can be used by host applications to keep external state, such as the URL,
1597
+ * in sync with the checkout.
1598
+ */
1599
+ onDiscountCodeChanged?: (discountCode: string | null) => void;
1600
+ /**
1601
+ * Overrides the Dashboard branding appearance for this purchase.
1602
+ * Only the provided values are overridden; all other values keep their
1603
+ * Dashboard configuration.
1604
+ *
1605
+ * For Stripe Checkout, this customizes the supported mobile wallet experience.
1606
+ * The Stripe-hosted fallback opened through "Pay another way" remains light and
1607
+ * cannot currently be customized.
1608
+ */
1609
+ brandingAppearanceOverride?: Partial<BrandingAppearance>;
1610
+ /* Excluded from this release type: labelsOverride */
1611
+ /**
1612
+ * Link to the terms and conditions that should be shown in the checkout footer.
1613
+ */
1614
+ termsAndConditionsUrl?: string;
1615
+ /* Excluded from this release type: productChangeInfo */
1616
+ /* Excluded from this release type: tryWithApplePay */
1617
+ }
1618
+
1619
+ /* Excluded from this release type: PurchaseResponseAttributionMetadata */
1620
+
1621
+ /**
1622
+ * Represents the result of a purchase operation.
1623
+ * @public
1624
+ */
1625
+ export declare interface PurchaseResult {
1626
+ /**
1627
+ * The customer information after the purchase.
1628
+ */
1629
+ readonly customerInfo: CustomerInfo;
1630
+ /**
1631
+ * The redemption information after the purchase if available.
1632
+ */
1633
+ readonly redemptionInfo: RedemptionInfo | null;
1634
+ /**
1635
+ * The operation session id of the purchase.
1636
+ *
1637
+ * For Amazon Store purchases, this will contain the Amazon Store's receipt ID from the purchase.
1638
+ */
1639
+ readonly operationSessionId: string;
1640
+ /**
1641
+ * The store transaction associated with the purchase.
1642
+ */
1643
+ readonly storeTransaction: StoreTransaction;
1644
+ /**
1645
+ * The email used for this purchase (checkout form or wallet).
1646
+ * Undefined when the SDK did not collect one (e.g. some hosted/Paddle paths).
1647
+ */
1648
+ readonly customerEmail?: string;
1649
+ /* Excluded from this release type: attributionMetadata */
1650
+ /* Excluded from this release type: productChange */
1651
+ }
1652
+
1653
+ /**
1654
+ * Entry point for the RevenueCat Purchases SDK for Amazon Vega.
1655
+ *
1656
+ * Support for the `@revenuecat/purchases-js-vega` package is currently in beta.
1657
+ *
1658
+ * @experimental
1659
+ */
1660
+ export declare class Purchases extends Purchases_2 {
1661
+ /* Excluded from this release type: __constructor */
1662
+ static configure(config: PurchasesConfig): Purchases;
1663
+ static configure(apiKey: string, appUserId: string, httpConfig?: HttpConfig, flags?: FlagsConfig): Purchases;
1664
+ static getSharedInstance(): Purchases;
1665
+ /**
1666
+ * Restores purchases made with the current store account for the current user.
1667
+ * This method posts all purchases associated with the current Amazon Appstore account to RevenueCat and associates
1668
+ * them with the current `appUserId`. If a receipt is already used by an existing user, the current `appUserId`
1669
+ * may be aliased with that user's `appUserId` depending on your app's Restore Behavior. For more information,
1670
+ * refer to https://www.revenuecat.com/docs/projects/restore-behavior
1671
+ *
1672
+ * This method also sends expired subscriptions and consumed one-time purchases to RevenueCat.
1673
+ *
1674
+ * You shouldn't use this method if you have your own account system. In that case, restoration is provided by
1675
+ * your app passing the same `appUserId` that was used for the original purchase.
1676
+ *
1677
+ * @warning This operation can take a relatively long time when the user has many purchases.
1678
+ * @returns The {@link CustomerInfo} with restored purchases.
1679
+ * @throws {@link PurchasesError} if restoration fails.
1680
+ */
1681
+ restorePurchases(): Promise<RestorePurchasesResult>;
1682
+ /**
1683
+ * Sends purchases made with the current store account to the RevenueCat backend.
1684
+ * Call this when using your own purchase implementation whenever a sync is needed, such as while migrating
1685
+ * existing users to RevenueCat. It resolves when all purchases have been synced successfully or when there are
1686
+ * no purchases to sync; otherwise it throws with the first error encountered.
1687
+ *
1688
+ * This method also sends expired subscriptions and consumed one-time purchases to RevenueCat.
1689
+ *
1690
+ * @warning This operation can take a relatively long time when the user has many purchases.
1691
+ * @returns The {@link CustomerInfo} after purchases have been synced.
1692
+ * @throws {@link PurchasesError} if syncing fails.
1693
+ */
1694
+ syncPurchases(): Promise<SyncPurchasesResult>;
1695
+ }
1696
+
1697
+ /**
1698
+ * Entry point for Purchases SDK. It should be instantiated as soon as your
1699
+ * app is started. Only one instance of Purchases should be instantiated
1700
+ * at a time!
1701
+ * @public
1702
+ */
1703
+ declare class Purchases_2 {
1704
+ /* Excluded from this release type: _API_KEY */
1705
+ /* Excluded from this release type: _appUserId */
1706
+ /* Excluded from this release type: _brandingInfo */
1707
+ /* Excluded from this release type: _loadingResourcesPromise */
1708
+ /* Excluded from this release type: _flags */
1709
+ /* Excluded from this release type: _subscriberToken */
1710
+ /* Excluded from this release type: _brandingAppearanceOverride */
1711
+ /* Excluded from this release type: _context */
1712
+ /* Excluded from this release type: backend */
1713
+ /* Excluded from this release type: purchaseOperationHelper */
1714
+ /* Excluded from this release type: eventsTracker */
1715
+ /* Excluded from this release type: _platformInfo */
1716
+ /* Excluded from this release type: inMemoryCache */
1717
+ /* Excluded from this release type: billingWrapper */
1718
+ /* Excluded from this release type: offeringsRequests */
1719
+ /* Excluded from this release type: cachedCurrentOffering */
1720
+ /* Excluded from this release type: customWebCheckoutEnabled */
1721
+ /* Excluded from this release type: stripeBillingQuickPurchaseState */
1722
+ /* Excluded from this release type: stripeBillingQuickPurchasePreparation */
1723
+ /* Excluded from this release type: instance */
1724
+ /**
1725
+ * Set the log level. Logs of the given level and below will be printed
1726
+ * in the console.
1727
+ * Default is `LogLevel.Silent` so no logs will be printed in the console.
1728
+ * @param logLevel - LogLevel to set.
1729
+ */
1730
+ static setLogLevel(logLevel: LogLevel): void;
1731
+ /**
1732
+ * Set a custom log handler to handle SDK log messages with your own logging system.
1733
+ * If set to null, the SDK will use the default console logging.
1734
+ * @param handler - LogHandler function or null to use default console logging.
1735
+ */
1736
+ static setLogHandler(handler: LogHandler | null): void;
1737
+ /**
1738
+ * Meant to be used by RevenueCat hybrids SDKS only.
1739
+ * @experimental
1740
+ * */
1741
+ static setPlatformInfo(platformInfo: PlatformInfo): void;
1742
+ /* Excluded from this release type: buildVariablesPerPackage */
1743
+ /* Excluded from this release type: buildInfoPerPackage */
1744
+ /* Excluded from this release type: buildPaywallContextPackages */
1745
+ /* Excluded from this release type: getPlatformInfo */
1746
+ /* Excluded from this release type: applyPaddleDiscountsToOffering */
1747
+ /**
1748
+ * Get the singleton instance of Purchases. It's preferred to use the instance
1749
+ * obtained from the `configure` method when possible.
1750
+ * @throws {@link UninitializedPurchasesError} if the instance has not been initialized yet.
1751
+ */
1752
+ static getSharedInstance(): Purchases_2;
1753
+ /**
1754
+ * Returns whether the Purchases SDK is configured or not.
1755
+ */
1756
+ static isConfigured(): boolean;
1757
+ /**
1758
+ * Configures the Purchases SDK. This should be called as soon as your app
1759
+ * has a unique user id for your user. You should only call this once, and
1760
+ * keep the returned instance around for use throughout your application.
1761
+ * @param config - Configuration object containing apiKey, appUserId, and optional configurations.
1762
+ * @throws {@link PurchasesError} if the API key or user id are invalid.
1763
+ */
1764
+ static configure(config: PurchasesConfig): Purchases_2;
1765
+ /**
1766
+ * Legacy method to configure the Purchases SDK. This method is deprecated and will be removed in a future version.
1767
+ * @deprecated - please use the `configure` method with a {@link PurchasesConfig} object instead.
1768
+ * @param apiKey - RevenueCat API Key. Can be obtained from the RevenueCat dashboard.
1769
+ * @param appUserId - Your unique id for identifying the user.
1770
+ * @param httpConfig - Advanced http configuration to customise the SDK usage {@link HttpConfig}.
1771
+ * @param flags - Advanced functionality configuration {@link FlagsConfig}.
1772
+ * @throws {@link PurchasesError} if the API key or user id are invalid.
1773
+ */
1774
+ static configure(apiKey: string, appUserId: string, httpConfig?: HttpConfig, flags?: FlagsConfig): Purchases_2;
1775
+ private static configureInternal;
1776
+ private static validateConfig;
1777
+ /**
1778
+ * Loads and caches some optional data in the Purchases SDK.
1779
+ * Currently only fetching branding information.
1780
+ * You can call this method after configuring the SDK to speed
1781
+ * up the first call to {@link Purchases.purchase}.
1782
+ */
1783
+ preload(): Promise<void>;
1784
+ /* Excluded from this release type: fetchAndCacheBrandingInfo */
1785
+ /* Excluded from this release type: syncApplePayWebsiteIcon */
1786
+ /* Excluded from this release type: hasLoadedResources */
1787
+ /* Excluded from this release type: __constructor */
1788
+ /**
1789
+ * Renders an RC Paywall and allows the user to purchase from it using Web Billing.
1790
+ *
1791
+ * Unsupported for Amazon apps.
1792
+ *
1793
+ * @param paywallParams - The parameters object to customise the paywall render. Check {@link PresentPaywallParams}
1794
+ * @returns Promise<PurchaseResult>
1795
+ */
1796
+ presentPaywall(paywallParams: PresentPaywallParams): Promise<PaywallPurchaseResult>;
1797
+ /**
1798
+ * Fetch the configured offerings for this user. You can configure these
1799
+ * in the RevenueCat dashboard.
1800
+ * @param params - The parameters object to customise the offerings fetch. Check {@link GetOfferingsParams}
1801
+ */
1802
+ getOfferings(params?: GetOfferingsParams): Promise<Offerings>;
1803
+ /**
1804
+ * Invalidates the cached offerings response for the current user.
1805
+ * The next call to {@link Purchases.getOfferings} or
1806
+ * {@link Purchases.getCurrentOfferingForPlacement} will fetch the latest
1807
+ * offerings from the network.
1808
+ */
1809
+ invalidateOfferingsCache(): void;
1810
+ /**
1811
+ * Tracks an impression for a custom paywall.
1812
+ *
1813
+ * Pass the offering used to render the paywall to preserve placement and
1814
+ * targeting attribution. When no offering is passed, the most recently
1815
+ * fetched current offering is used if available.
1816
+ *
1817
+ * Each call creates a separate impression event. Call this once per
1818
+ * paywall presentation and avoid lifecycle callbacks that may run
1819
+ * multiple times for the same display.
1820
+ *
1821
+ * @param params Parameters for the custom paywall impression event.
1822
+ */
1823
+ trackCustomPaywallImpression(params?: CustomPaywallImpressionParams): void;
1824
+ /**
1825
+ * Retrieves a specific offering by a placement identifier.
1826
+ * For more info see https://www.revenuecat.com/docs/tools/targeting
1827
+ * @param placementIdentifier - The placement identifier to retrieve the offering for.
1828
+ * @param params - The parameters object to customise the offerings fetch. Check {@link GetOfferingsParams}
1829
+ */
1830
+ getCurrentOfferingForPlacement(placementIdentifier: string, params?: GetOfferingsParams): Promise<Offering | null>;
1831
+ private getOfferingsResponse;
1832
+ private clearOfferingsCache;
1833
+ private invalidateRequestDataCaches;
1834
+ private findOfferingById;
1835
+ private updatePaywallOfferingWithDiscountedProducts;
1836
+ private getAllOfferings;
1837
+ private fetchProductsForOfferings;
1838
+ /**
1839
+ * Convenience method to check whether a user is entitled to a specific
1840
+ * entitlement. This will use {@link Purchases.getCustomerInfo} under the hood.
1841
+ * @param entitlementIdentifier - The entitlement identifier you want to check.
1842
+ * @returns Whether the user is entitled to the specified entitlement
1843
+ * @throws {@link PurchasesError} if there is an error while fetching the customer info.
1844
+ * @see {@link Purchases.getCustomerInfo}
1845
+ */
1846
+ isEntitledTo(entitlementIdentifier: string): Promise<boolean>;
1847
+ /* Excluded from this release type: prepareForQuickPurchases */
1848
+ /* Excluded from this release type: prepareStripeBillingQuickPurchase */
1849
+ /* Excluded from this release type: resolveStripeBillingQuickPurchaseContext */
1850
+ /**
1851
+ * Method to perform a purchase for a given package. You can obtain the
1852
+ * package from {@link Purchases.getOfferings}. This method will present the purchase
1853
+ * form on your site, using the given HTML element as the mount point, if
1854
+ * provided, or as a modal if not.
1855
+ * @deprecated - please use .purchase
1856
+ * @param rcPackage - The package you want to purchase. Obtained from {@link Purchases.getOfferings}.
1857
+ * @param customerEmail - The email of the user. If undefined, RevenueCat will ask the customer for their email.
1858
+ * @param htmlTarget - The HTML element where the billing view should be added. If undefined, a new div will be created at the root of the page and appended to the body.
1859
+ * @returns a Promise for the customer info after the purchase is completed successfully.
1860
+ * @throws {@link PurchasesError} if there is an error while performing the purchase. If the {@link PurchasesError.errorCode} is {@link ErrorCode.UserCancelledError}, the user cancelled the purchase.
1861
+ */
1862
+ purchasePackage(rcPackage: Package, customerEmail?: string, htmlTarget?: HTMLElement): Promise<PurchaseResult>;
1863
+ /**
1864
+ * Renders an Express Purchase button for the supported wallets (Apple Pay/Google Pay).
1865
+ * When clicked it uses the wallet UI to execute the purchase instead of
1866
+ * the checkout flow that would be shown with `.purchase`.
1867
+ *
1868
+ * Unsupported for Amazon apps.
1869
+ *
1870
+ * @param params - The parameters object to customise the purchase flow. Check {@link PresentExpressPurchaseButtonParams}
1871
+ * @returns Promise<PurchaseResult>
1872
+ */
1873
+ presentExpressPurchaseButton(params: PresentExpressPurchaseButtonParams): Promise<PurchaseResult>;
1874
+ /* Excluded from this release type: getWalletButtonRender */
1875
+ /**
1876
+ * Method to perform a purchase for a given package. You can obtain the
1877
+ * package from {@link Purchases.getOfferings}. This method will present the purchase
1878
+ * form on your site, using the given HTML element as the mount point, if
1879
+ * provided, or as a modal if not.
1880
+ *
1881
+ * When {@link PurchaseParams.productChangeInfo} is set with a subscriber token,
1882
+ * checkout starts in product-change mode: if the backend can change the
1883
+ * existing subscription, an upgrade-confirm page is shown; otherwise the
1884
+ * same checkout session continues as a normal purchase.
1885
+ *
1886
+ * @param params - The parameters object to customise the purchase flow. Check {@link PurchaseParams}
1887
+ * @returns a Promise for the customer and redemption info after the purchase is completed successfully.
1888
+ * @throws {@link PurchasesError} if there is an error while performing the purchase. If the {@link PurchasesError.errorCode} is {@link ErrorCode.UserCancelledError}, the user cancelled the purchase.
1889
+ */
1890
+ purchase(params: PurchaseParams): Promise<PurchaseResult>;
1891
+ /* Excluded from this release type: tryPreparedStripeBillingQuickPurchase */
1892
+ /* Excluded from this release type: purchaseAfterLoadingResources */
1893
+ private performStripePurchase;
1894
+ private performWebBillingPurchase;
1895
+ private performPaddlePurchase;
1896
+ /**
1897
+ * Uses htmlTarget if provided. Otherwise, looks for an element with id "rcb-ui-root".
1898
+ * If no element is found, creates a new div with className "rcb-ui-root".
1899
+ */
1900
+ private resolveHTMLTarget;
1901
+ private createCheckoutOnCloseHandler;
1902
+ private getSupportedRCSource;
1903
+ private shouldHideCheckoutBackButton;
1904
+ private createCheckoutOnFinishedHandler;
1905
+ private createCheckoutOnErrorHandler;
1906
+ /* Excluded from this release type: _isConfiguredWithSimulatedStore */
1907
+ /* Excluded from this release type: _shouldForceEnableWalletMethods */
1908
+ /* Excluded from this release type: _postSimulatedStoreReceipt */
1909
+ /**
1910
+ * Gets latest available {@link CustomerInfo}.
1911
+ * @returns The latest {@link CustomerInfo}.
1912
+ * @throws {@link PurchasesError} if there is an error while fetching the customer info.
1913
+ */
1914
+ getCustomerInfo(): Promise<CustomerInfo>;
1915
+ /**
1916
+ * Gets the current app user id.
1917
+ */
1918
+ getAppUserId(): string;
1919
+ /**
1920
+ * Sets attributes for the current user. Attributes are useful for storing additional, structured information on a customer that can be used elsewhere in the system.
1921
+ * For example, you could store your customer's email address or additional system identifiers through the applicable reserved attributes, or store arbitrary facts like onboarding survey responses, feature usage, or other dimensions as custom attributes.
1922
+ *
1923
+ * Note: Unlike our mobile SDKs, the web SDK does not cache or retry sending attributes if the request fails. If the request fails, the attributes will not be saved and you will need to retry the operation.
1924
+ *
1925
+ * @param attributes - A dictionary of attributes to set for the current user.
1926
+ * @throws {@link PurchasesError} if there is an error while setting the attributes or if the customer doesn't exist.
1927
+ */
1928
+ setAttributes(attributes: {
1929
+ [key: string | ReservedCustomerAttribute]: string | null;
1930
+ }): Promise<void>;
1931
+ /**
1932
+ * Change the current app user id. Returns the customer info for the new
1933
+ * user id.
1934
+ * @param newAppUserId - The user id to change to.
1935
+ */
1936
+ changeUser(newAppUserId: string): Promise<CustomerInfo>;
1937
+ /**
1938
+ * Identifies the current user ID with the provided appUserId, as long as the
1939
+ * previous user ID is an anonymous user ID. This will create an alias
1940
+ * between the two user ids in RevenueCat and replace the current user ID used.
1941
+ * If the old user ID is not anonymous, this method will change the current
1942
+ * user ID to the given appUserId without creating an alias.
1943
+ * @returns The customer info for the new user ID.
1944
+ * @throws {@link PurchasesError} if there is an error while performing the aliasing or fetching the customer info.
1945
+ * @param appUserId - The new user ID to identify the current user as.
1946
+ * @experimental
1947
+ */
1948
+ identifyUser(appUserId: string): Promise<IdentifyResult>;
1949
+ /**
1950
+ * Resolves {@link PurchaseParams.productChangeInfo} into the product-change
1951
+ * context passed to the checkout UI, or undefined when the purchase should
1952
+ * proceed as a normal purchase (no info, no token, or an API key whose
1953
+ * gateway doesn't support product change, e.g. Paddle).
1954
+ */
1955
+ private resolveProductChange;
1956
+ /**
1957
+ * Rejects anything shaped like a RevenueCat API key so a secret or public
1958
+ * key is never sent (or exposed) where a subscriber token belongs.
1959
+ */
1960
+ private validateSubscriberToken;
1961
+ private replaceUserId;
1962
+ /* Excluded from this release type: logMissingProductIds */
1963
+ /**
1964
+ * @returns Whether the SDK is using a sandbox API Key.
1965
+ */
1966
+ isSandbox(): boolean;
1967
+ /**
1968
+ * @returns Whether the current user is anonymous.
1969
+ */
1970
+ isAnonymous(): boolean;
1971
+ /**
1972
+ * Fetches the virtual currencies for the current subscriber.
1973
+ *
1974
+ * @returns {Promise<VirtualCurrencies>} A VirtualCurrencies object containing the subscriber's virtual currencies.
1975
+ */
1976
+ getVirtualCurrencies(): Promise<VirtualCurrencies>;
1977
+ /**
1978
+ * The currently cached {@link VirtualCurrencies} if one is available.
1979
+ * This value will remain null until virtual currencies have been fetched at
1980
+ * least once with {@link Purchases.getVirtualCurrencies} or an equivalent function.
1981
+ *
1982
+ * @returns {VirtualCurrencies | null} A {@link VirtualCurrencies} object containing the subscriber's virtual currencies,
1983
+ * or null if no cached data is available.
1984
+ */
1985
+ getCachedVirtualCurrencies(): VirtualCurrencies | null;
1986
+ /**
1987
+ * Invalidates the cache for virtual currencies.
1988
+ *
1989
+ * This is useful for cases where a virtual currency's balance might have been updated
1990
+ * in a different part of your system, like if you decreased a user's balance from the user spending a virtual currency,
1991
+ * or if you increased the balance from your backend using the server APIs.
1992
+ */
1993
+ invalidateVirtualCurrenciesCache(): void;
1994
+ /**
1995
+ * Closes the Purchases instance. You should never have to do this normally.
1996
+ */
1997
+ close(): void;
1998
+ /* Excluded from this release type: _getCustomerInfoForUserId */
1999
+ /* Excluded from this release type: _getVirtualCurrenciesForUserId */
2000
+ /**
2001
+ * Generates an anonymous app user ID that follows RevenueCat's format.
2002
+ * This can be used when you don't have a user identifier system in place.
2003
+ * The generated ID will be in the format: $RCAnonymousID:\<UUID without dashes\>
2004
+ * Example: $RCAnonymousID:123e4567e89b12d3a456426614174000
2005
+ * @returns A new anonymous app user ID string
2006
+ * @public
2007
+ */
2008
+ static generateRevenueCatAnonymousAppUserId(): string;
2009
+ /* Excluded from this release type: _trackEvent */
2010
+ /* Excluded from this release type: _flushAllEvents */
2011
+ /* Excluded from this release type: unwrappedBillingWrapper */
2012
+ }
2013
+
2014
+ /**
2015
+ * Configuration object for initializing the Purchases SDK.
2016
+ *
2017
+ * @example
2018
+ * ```typescript
2019
+ * // Object-based configuration (recommended)
2020
+ * const purchases = Purchases.configure({
2021
+ * apiKey: "your_api_key",
2022
+ * appUserId: "user_123",
2023
+ * httpConfig: { additionalHeaders: { "Custom-Header": "value" } },
2024
+ * flags: { autoCollectUTMAsMetadata: true }
2025
+ * });
2026
+ *
2027
+ * // Legacy separate arguments (deprecated)
2028
+ * const purchases = Purchases.configure(
2029
+ * "your_api_key",
2030
+ * "user_123",
2031
+ * { additionalHeaders: { "Custom-Header": "value" } },
2032
+ * { autoCollectUTMAsMetadata: true }
2033
+ * );
2034
+ * ```
2035
+ *
2036
+ * @public
2037
+ */
2038
+ export declare interface PurchasesConfig {
2039
+ /**
2040
+ * RevenueCat API Key. Can be obtained from the RevenueCat dashboard.
2041
+ */
2042
+ apiKey: string;
2043
+ /**
2044
+ * Your unique id for identifying the user.
2045
+ */
2046
+ appUserId: string;
2047
+ /**
2048
+ * Advanced http configuration to customise the SDK usage {@link HttpConfig}.
2049
+ */
2050
+ httpConfig?: HttpConfig;
2051
+ /**
2052
+ * Advanced functionality configuration {@link FlagsConfig}.
2053
+ */
2054
+ flags?: FlagsConfig;
2055
+ /**
2056
+ * Overrides the Dashboard branding appearance for purchases created by this
2057
+ * instance, including purchases started through {@link Purchases.presentPaywall}.
2058
+ * Only the provided values are overridden. A value passed directly to
2059
+ * {@link PurchaseParams.brandingAppearanceOverride} takes precedence for that
2060
+ * purchase.
2061
+ *
2062
+ * For Stripe Checkout, this customizes the supported mobile wallet experience.
2063
+ * The Stripe-hosted fallback opened through "Pay another way" remains light and
2064
+ * cannot currently be customized.
2065
+ */
2066
+ brandingAppearanceOverride?: Partial<BrandingAppearance>;
2067
+ /* Excluded from this release type: subscriberToken */
2068
+ /* Excluded from this release type: context */
2069
+ /* Excluded from this release type: trace_id */
2070
+ }
2071
+
2072
+ /* Excluded from this release type: PurchasesContext */
2073
+
2074
+ /**
2075
+ * Error class for Purchases SDK. You should handle these errors and react
2076
+ * accordingly in your app.
2077
+ * @public
2078
+ */
2079
+ export declare class PurchasesError extends Error {
2080
+ /**
2081
+ * Error code for the error. This is useful to appropriately react to
2082
+ * different error situations.
2083
+ */
2084
+ readonly errorCode: ErrorCode;
2085
+ /**
2086
+ * Underlying error message. This provides more details on the error and
2087
+ * can be useful for debugging and logging.
2088
+ */
2089
+ readonly underlyingErrorMessage?: string | null | undefined;
2090
+ /**
2091
+ * Contains extra information that is available in certain types of errors.
2092
+ */
2093
+ readonly extra?: PurchasesErrorExtra | undefined;
2094
+ /* Excluded from this release type: getForBackendError */
2095
+ /* Excluded from this release type: getForPurchasesFlowError */
2096
+ constructor(
2097
+ /**
2098
+ * Error code for the error. This is useful to appropriately react to
2099
+ * different error situations.
2100
+ */
2101
+ errorCode: ErrorCode,
2102
+ /**
2103
+ * Message for the error. This is useful for debugging and logging.
2104
+ */
2105
+ message?: string,
2106
+ /**
2107
+ * Underlying error message. This provides more details on the error and
2108
+ * can be useful for debugging and logging.
2109
+ */
2110
+ underlyingErrorMessage?: string | null | undefined,
2111
+ /**
2112
+ * Contains extra information that is available in certain types of errors.
2113
+ */
2114
+ extra?: PurchasesErrorExtra | undefined);
2115
+ toString: () => string;
2116
+ }
2117
+
2118
+ /**
2119
+ * Extra information that is available in certain types of errors.
2120
+ * @public
2121
+ */
2122
+ export declare interface PurchasesErrorExtra {
2123
+ /**
2124
+ * If this is a request error, the HTTP status code of the response.
2125
+ */
2126
+ readonly statusCode?: number;
2127
+ /**
2128
+ * If this is a RevenueCat backend error, the error code from the servers.
2129
+ */
2130
+ readonly backendErrorCode?: number;
2131
+ }
2132
+
2133
+ /* Excluded from this release type: QuickPurchasePreparationResult */
2134
+
2135
+ /**
2136
+ * This object gives you access to the purchase redemption data when
2137
+ * the purchase can be redeemed to a mobile user, like in the case of anonymous users.
2138
+ * @public
2139
+ */
2140
+ export declare interface RedemptionInfo {
2141
+ /**
2142
+ * The redeem url.
2143
+ */
2144
+ readonly redeemUrl: string | null;
2145
+ /**
2146
+ * The HTTPS URL that redirects to the redeem URL.
2147
+ * Use this URL when a browser-compatible URL is required, such as for QR codes.
2148
+ */
2149
+ readonly redeemUrlRedirect?: string | null;
2150
+ }
2151
+
2152
+ /**
2153
+ * Enumeration of reserved customer attributes.
2154
+ * @public
2155
+ */
2156
+ export declare enum ReservedCustomerAttribute {
2157
+ /**
2158
+ * The display name that should be used to reference the customer.
2159
+ */
2160
+ DisplayName = "$displayName",
2161
+ /**
2162
+ * The email address of the customer.
2163
+ */
2164
+ Email = "$email",
2165
+ /**
2166
+ * The phone number of the customer.
2167
+ */
2168
+ PhoneNumber = "$phoneNumber",
2169
+ /**
2170
+ * iOS advertising identifier UUID for the customer.
2171
+ */
2172
+ IDFA = "$idfa",
2173
+ /**
2174
+ * iOS vendor identifier UUID for the customer.
2175
+ */
2176
+ IDFV = "$idfv",
2177
+ /**
2178
+ * The advertising ID that is provided by Google Play services for the customer.
2179
+ */
2180
+ GPSAdId = "$gpsAdId",
2181
+ /**
2182
+ * The Android ID of the customer.
2183
+ */
2184
+ AndroidId = "$androidId",
2185
+ /**
2186
+ * The Amazon Advertising ID of the customer.
2187
+ */
2188
+ AmazonAdId = "$amazonAdId",
2189
+ /**
2190
+ * The IP address of the customer.
2191
+ */
2192
+ IP = "$ip",
2193
+ /**
2194
+ * The unique Adjust identifier for the customer.
2195
+ */
2196
+ AdjustId = "$adjustId",
2197
+ /**
2198
+ * The Amplitude device ID of the customer.
2199
+ */
2200
+ AmplitudeDeviceId = "$amplitudeDeviceId",
2201
+ /**
2202
+ * The Amplitude user ID of the customer.
2203
+ */
2204
+ AmplitudeUserId = "$amplitudeUserId",
2205
+ /**
2206
+ * Appsflyer Id. The unique Appsflyer identifier for the customer.
2207
+ */
2208
+ AppsflyerId = "$appsflyerId",
2209
+ /**
2210
+ * The AppsFlyer sharing filter of the customer.
2211
+ */
2212
+ AppsflyerSharingFilter = "$appsflyerSharingFilter",
2213
+ /**
2214
+ * The Branch ID of the customer.
2215
+ */
2216
+ BranchId = "$branchId",
2217
+ /**
2218
+ * The Braze 'alias_name' in User Alias Object.
2219
+ */
2220
+ BrazeAliasName = "$brazeAliasName",
2221
+ /**
2222
+ * The Braze 'alias_label' in User Alias Object.
2223
+ */
2224
+ BrazeAliasLabel = "$brazeAliasLabel",
2225
+ /**
2226
+ * The CleverTap ID of the customer.
2227
+ */
2228
+ ClevertapId = "$clevertapId",
2229
+ /**
2230
+ * The Facebook anonymous ID of the customer.
2231
+ */
2232
+ FbAnonId = "$fbAnonId",
2233
+ /**
2234
+ * The unique mParticle user identifier (mpid).
2235
+ */
2236
+ MparticleId = "$mparticleId",
2237
+ /**
2238
+ * The OneSignal Player Id for the customer.
2239
+ */
2240
+ OnesignalId = "$onesignalId",
2241
+ /**
2242
+ * The OneSignal user ID of the customer.
2243
+ */
2244
+ OnesignalUserId = "$onesignalUserId",
2245
+ /**
2246
+ * The Intercom contact ID of the customer.
2247
+ */
2248
+ IntercomContactId = "$intercomContactId",
2249
+ /**
2250
+ * The media source of the customer.
2251
+ */
2252
+ MediaSource = "$mediaSource",
2253
+ /**
2254
+ * The campaign of the customer.
2255
+ */
2256
+ Campaign = "$campaign",
2257
+ /**
2258
+ * The ad group of the customer.
2259
+ */
2260
+ AdGroup = "$adGroup",
2261
+ /**
2262
+ * The Ad ID of the customer.
2263
+ */
2264
+ AdId = "$ad",
2265
+ /**
2266
+ * The keyword of the customer.
2267
+ */
2268
+ Keyword = "$keyword",
2269
+ /**
2270
+ * The creative of the customer.
2271
+ */
2272
+ Creative = "$creative",
2273
+ /**
2274
+ * Apple push notification tokens for the customer.
2275
+ */
2276
+ APNSTokens = "$apnsTokens",
2277
+ /**
2278
+ * Google push notification tokens for the customer.
2279
+ */
2280
+ FCMTokens = "$fcmTokens",
2281
+ /**
2282
+ * The Airship channel ID of the customer.
2283
+ */
2284
+ AirshipChannelId = "$airshipChannelId",
2285
+ /**
2286
+ * The segment ID of the customer.
2287
+ */
2288
+ SegmentId = "$segmentId",
2289
+ /**
2290
+ * The Iterable user ID of the customer.
2291
+ */
2292
+ IterableUserId = "$iterableUserId",
2293
+ /**
2294
+ * The Iterable campaign ID of the customer.
2295
+ */
2296
+ IterableCampaignId = "$iterableCampaignId",
2297
+ /**
2298
+ * The Iterable template ID of the customer.
2299
+ */
2300
+ IterableTemplateId = "$iterableTemplateId",
2301
+ /**
2302
+ * The Firebase app instance ID of the customer.
2303
+ */
2304
+ FirebaseAppInstanceId = "$firebaseAppInstanceId",
2305
+ /**
2306
+ * The Mixpanel distinct ID of the customer.
2307
+ */
2308
+ MixpanelDistinctId = "$mixpanelDistinctId",
2309
+ /**
2310
+ * Apple App Tracking Transparency consent status for the customer.
2311
+ */
2312
+ ATTConsentStatus = "$attConsentStatus",
2313
+ /**
2314
+ * The unique Kochava device identifier of the customer.
2315
+ */
2316
+ KochavaDeviceId = "$kochavaDeviceId",
2317
+ /**
2318
+ * The device version of the customer.
2319
+ */
2320
+ DeviceVersion = "$deviceVersion",
2321
+ /**
2322
+ * The PostHog user ID of the customer.
2323
+ */
2324
+ PosthogUserId = "$posthogUserId",
2325
+ /**
2326
+ * The Telemetry Deck user ID of the customer.
2327
+ */
2328
+ TelemetryDeckUserId = "$telemetryDeckUserId",
2329
+ /**
2330
+ * The Telemetry Deck app ID of the customer.
2331
+ */
2332
+ TelemetryDeckAppId = "$telemetryDeckAppId",
2333
+ /**
2334
+ * The Apple refund handling preference of the customer.
2335
+ */
2336
+ AppleRefundHandlingPreference = "$appleRefundHandlingPreference",
2337
+ /**
2338
+ * The customer.io ID of the customer.
2339
+ */
2340
+ CustomerioId = "$customerioId",
2341
+ /**
2342
+ * The Tenjin ID of the customer.
2343
+ */
2344
+ TenjinId = "$tenjinId",
2345
+ /**
2346
+ * The Singular Device ID (SDID) of the customer, generated by the Singular SDK.
2347
+ * Required by Singular's Event Endpoint V2.
2348
+ */
2349
+ SingularDeviceId = "$singularDeviceId"
2350
+ }
2351
+
2352
+ /**
2353
+ * The result of restoring purchases.
2354
+ * @public
2355
+ */
2356
+ export declare interface RestorePurchasesResult {
2357
+ customerInfo: CustomerInfo;
2358
+ }
2359
+
2360
+ declare type SDKEventContextSource = "sdk" | "wpl" | string;
2361
+
2362
+ /**
2363
+ * The store where the user originally subscribed.
2364
+ * @public
2365
+ */
2366
+ export declare type Store = "app_store" | "mac_app_store" | "play_store" | "amazon" | "stripe" | "rc_billing" | "promotional" | "paddle" | "test_store" | "galaxy" | "unknown";
2367
+
2368
+ /**
2369
+ * Determines when the store module (e.g. Stripe) is loaded.
2370
+ * - `"configuration"`: The store module is preloaded when the SDK is configured.
2371
+ * - `"purchase_start"`: The store module is loaded on demand when a purchase is started.
2372
+ * @public
2373
+ * @deprecated we always load stripe only when needed
2374
+ */
2375
+ export declare type StoreLoadTime = "configuration" | "purchase_start";
2376
+
2377
+ /**
2378
+ * Represents a transaction made in the store.
2379
+ * @public
2380
+ */
2381
+ export declare interface StoreTransaction {
2382
+ /**
2383
+ * The unique identifier for the store transaction.
2384
+ */
2385
+ readonly storeTransactionId: string;
2386
+ /**
2387
+ * The identifier of the product purchased in the transaction.
2388
+ */
2389
+ readonly productIdentifier: string;
2390
+ /**
2391
+ * The date when the transaction was made.
2392
+ */
2393
+ readonly purchaseDate: Date;
2394
+ }
2395
+
2396
+ /**
2397
+ * Subscription purchases of the Customer.
2398
+ * @public
2399
+ */
2400
+ export declare interface SubscriptionInfo {
2401
+ /**
2402
+ * The product identifier.
2403
+ */
2404
+ readonly productIdentifier: string;
2405
+ /**
2406
+ * The base plan identifier of the subscription (For Google Play subs only).
2407
+ */
2408
+ readonly productPlanIdentifier: string | null;
2409
+ /**
2410
+ * Date when the last subscription period started.
2411
+ */
2412
+ readonly purchaseDate: Date;
2413
+ /**
2414
+ * Date when this subscription first started. This property does not update with renewals.
2415
+ * This property also does not update for product changes within a subscription group or
2416
+ * re-subscriptions by lapsed subscribers.
2417
+ */
2418
+ readonly originalPurchaseDate: Date | null;
2419
+ /**
2420
+ * Date when the subscription expires/expired
2421
+ */
2422
+ readonly expiresDate: Date | null;
2423
+ /**
2424
+ * Store where the subscription was purchased.
2425
+ */
2426
+ readonly store: Store;
2427
+ /**
2428
+ * Date when RevenueCat detected that auto-renewal was turned off for this subscription.
2429
+ * Note the subscription may still be active, check the {@link SubscriptionInfo.expiresDate} attribute.
2430
+ */
2431
+ readonly unsubscribeDetectedAt: Date | null;
2432
+ /**
2433
+ * Whether or not the purchase was made in sandbox mode.
2434
+ */
2435
+ readonly isSandbox: boolean;
2436
+ /**
2437
+ * Date when RevenueCat detected any billing issues with this subscription.
2438
+ * If and when the billing issue gets resolved, this field is set to null.
2439
+ * Note the subscription may still be active, check the {@link SubscriptionInfo.expiresDate} attribute.
2440
+ */
2441
+ readonly billingIssuesDetectedAt: Date | null;
2442
+ /**
2443
+ * Date when any grace period for this subscription expires/expired.
2444
+ * null if the customer has never been in a grace period.
2445
+ */
2446
+ readonly gracePeriodExpiresDate: Date | null;
2447
+ /**
2448
+ * How the Customer received access to this subscription:
2449
+ * - "PURCHASED": The customer bought the subscription.
2450
+ * - "FAMILY_SHARED": The customer has access to the product via their family.
2451
+ */
2452
+ readonly ownershipType: OwnershipType;
2453
+ /**
2454
+ * Type of the current subscription period:
2455
+ * - "normal": The product is in a normal period (default)
2456
+ * - "trial": The product is in a free trial period
2457
+ * - "intro": The product is in an introductory pricing period
2458
+ * - "prepaid": The product is in a prepaid pricing period
2459
+ */
2460
+ readonly periodType: PeriodType;
2461
+ /**
2462
+ * Date when RevenueCat detected a refund of this subscription.
2463
+ */
2464
+ readonly refundedAt: Date | null;
2465
+ /**
2466
+ * The transaction id in the store of the subscription.
2467
+ */
2468
+ readonly storeTransactionId: string | null;
2469
+ /**
2470
+ * URL to manage this subscription, if available.
2471
+ */
2472
+ readonly managementURL: string | null;
2473
+ /**
2474
+ * Whether the subscription is currently active
2475
+ * (at the time this object was obtained).
2476
+ */
2477
+ readonly isActive: boolean;
2478
+ /**
2479
+ * Whether the subscription will renew at the next billing period.
2480
+ */
2481
+ readonly willRenew: boolean;
2482
+ /**
2483
+ * The display name of the subscription as configured in the RevenueCat dashboard.
2484
+ */
2485
+ readonly displayName: string | null;
2486
+ /**
2487
+ * Date when a paused subscription is expected to automatically resume.
2488
+ * Only set for Google Play subscriptions that have been paused; null otherwise.
2489
+ */
2490
+ readonly autoResumeDate: Date | null;
2491
+ /**
2492
+ * Paid price for the subscription.
2493
+ */
2494
+ readonly price: Price | null;
2495
+ }
2496
+
2497
+ /**
2498
+ * Represents a possible option to purchase a subscription product.
2499
+ * @public
2500
+ */
2501
+ export declare interface SubscriptionOption extends PurchaseOption {
2502
+ /**
2503
+ * The base phase for a SubscriptionOption, represents
2504
+ * the price that the customer will be charged after all the discounts have
2505
+ * been consumed and the period at which it will renew.
2506
+ */
2507
+ readonly base: PricingPhase;
2508
+ /**
2509
+ * The trial information for this subscription option if available.
2510
+ */
2511
+ readonly trial: PricingPhase | null;
2512
+ /**
2513
+ * The introductory price period for this subscription option if available.
2514
+ */
2515
+ readonly introPrice: PricingPhase | null;
2516
+ /* Excluded from this release type: discount */
2517
+ }
2518
+
2519
+ declare interface SubscriptionOptionResponse extends PurchaseOptionResponse {
2520
+ base: PricingPhaseResponse | null;
2521
+ trial: PricingPhaseResponse | null;
2522
+ intro_price: PricingPhaseResponse | null;
2523
+ }
2524
+
2525
+ /**
2526
+ * The result of syncing purchases.
2527
+ * @public
2528
+ */
2529
+ export declare interface SyncPurchasesResult {
2530
+ customerInfo: CustomerInfo;
2531
+ }
2532
+
2533
+ /**
2534
+ * Contains information about the targeting context used to obtain an object.
2535
+ * @public
2536
+ */
2537
+ export declare interface TargetingContext {
2538
+ /**
2539
+ * The rule id from the targeting used to obtain this object.
2540
+ */
2541
+ readonly ruleId: string;
2542
+ /**
2543
+ * The revision of the targeting used to obtain this object.
2544
+ */
2545
+ readonly revision: number;
2546
+ }
2547
+
2548
+ declare interface TrackEventProps {
2549
+ eventName: string;
2550
+ source: SDKEventContextSource;
2551
+ properties?: EventProperties;
2552
+ }
2553
+
2554
+ declare interface TranslateFrequencyOptions {
2555
+ useMultipleWords?: boolean;
2556
+ }
2557
+
2558
+ declare interface TranslatePeriodOptions {
2559
+ noWhitespace?: boolean;
2560
+ short?: boolean;
2561
+ }
2562
+
2563
+ /**
2564
+ * Translation variables to be used in the translation.
2565
+ * This class allows you to pass variables to the translate method.
2566
+ * @public
2567
+ * @example Given a label with id `periods.monthPlural` and value `{{amount}} months`. This example will replace the variable `{{amount}}` with the value `10`.
2568
+ * ```typescript
2569
+ * translator.translate('periods.monthPlural', { amount: 10 });
2570
+ * // Output: 10 months
2571
+ * ```
2572
+ */
2573
+ declare type TranslationVariables = Record<string, string | number | undefined | null>;
2574
+
2575
+ declare class Translator {
2576
+ readonly selectedLocale: string;
2577
+ readonly defaultLocale: string;
2578
+ readonly locales: Record<string, LocaleTranslations>;
2579
+ static fallback(): Translator;
2580
+ constructor(customTranslations?: CustomTranslations, selectedLocale?: string, defaultLocale?: string);
2581
+ override(customTranslations: CustomTranslations): void;
2582
+ formatPrice(priceInMicros: number, currency: string): string;
2583
+ /**
2584
+ * Returns the locale in a format that is compatible with other JS libraries.
2585
+ * This is particularly important for zh_Hans and zh_Hant that are instead
2586
+ * represented as zh-Hans and zh-Hant in Intl.DateTimeFormat.
2587
+ */
2588
+ get bcp47Locale(): string;
2589
+ /**
2590
+ * Returns the fallback locale in a format that is compatible with other JS
2591
+ * libraries.
2592
+ * This is particularly important for zh_Hans and zh_Hant that are instead
2593
+ * represented as zh-Hans and zh-Hant in Intl.DateTimeFormat.
2594
+ */
2595
+ get fallbackBcp47Locale(): string;
2596
+ private getLanguageCodeString;
2597
+ private getLocaleInstance;
2598
+ translate(key: LocalizationKeys | EmptyString, variables?: TranslationVariables): string;
2599
+ formatCountry(countryCode: string): string;
2600
+ translatePeriod(amount: number, period: PeriodUnit, options?: TranslatePeriodOptions): string | undefined;
2601
+ translatePeriodUnit(period: PeriodUnit, options?: TranslatePeriodOptions): string | undefined;
2602
+ translatePeriodFrequency(amount: number, period: PeriodUnit, options?: TranslateFrequencyOptions): string | undefined;
2603
+ translateDate(date: Date, options?: Intl.DateTimeFormatOptions): string | undefined;
2604
+ }
2605
+
2606
+ /**
2607
+ * Error indicating that the SDK was accessed before it was initialized.
2608
+ * @public
2609
+ */
2610
+ export declare class UninitializedPurchasesError extends Error {
2611
+ constructor();
2612
+ }
2613
+
2614
+ /**
2615
+ * The VirtualCurrencies object contains all the virtual currencies associated to the user.
2616
+ *
2617
+ * @public
2618
+ */
2619
+ export declare interface VirtualCurrencies {
2620
+ /**
2621
+ * Map of all {@link VirtualCurrency} objects keyed by virtual currency code.
2622
+ */
2623
+ readonly all: {
2624
+ [key: string]: VirtualCurrency;
2625
+ };
2626
+ }
2627
+
2628
+ /**
2629
+ * The VirtualCurrency object represents information about a virtual currency in the app.
2630
+ * Use this object to access information about a virtual currency, such as its current balance.
2631
+ *
2632
+ * @public
2633
+ */
2634
+ export declare interface VirtualCurrency {
2635
+ /**
2636
+ * The virtual currency's balance.
2637
+ */
2638
+ readonly balance: number;
2639
+ /**
2640
+ * The virtual currency's name.
2641
+ */
2642
+ readonly name: string;
2643
+ /**
2644
+ * The virtual currency's code.
2645
+ */
2646
+ readonly code: string;
2647
+ /**
2648
+ * The virtual currency's description defined in the RevenueCat dashboard.
2649
+ */
2650
+ readonly serverDescription: string | null;
2651
+ }
2652
+
2653
+ /* Excluded from this release type: WorkflowContext */
2654
+
2655
+ /* Excluded from this release type: WorkflowPurchaseContext */
2656
+
2657
+ export { }