@revenuecat/purchases-capacitor-ui 14.0.0 → 14.1.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.
package/Package.swift CHANGED
@@ -11,7 +11,7 @@ let package = Package(
11
11
  ],
12
12
  dependencies: [
13
13
  .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "8.0.0"),
14
- .package(url: "https://github.com/RevenueCat/purchases-hybrid-common.git", exact: "20.0.0")
14
+ .package(url: "https://github.com/RevenueCat/purchases-hybrid-common.git", exact: "20.1.0")
15
15
  ],
16
16
  targets: [
17
17
  .target(
package/README.md CHANGED
@@ -97,6 +97,50 @@ import { RevenueCatUI } from '@revenuecat/purchases-capacitor-ui';
97
97
  await RevenueCatUI.presentCustomerCenter();
98
98
  ```
99
99
 
100
+ ### Checkpoints (experimental, invite-only)
101
+
102
+ > [!WARNING]
103
+ > **Experimental, invite-only API.**
104
+
105
+ A checkpoint gates navigation with a dashboard-defined flow. Configure Purchases first.
106
+ Requires iOS 15+ or Android; web is unsupported, including mock web mode.
107
+
108
+ ```typescript
109
+ import { RevenueCatUI, FLOW_PRESENTATION_MODE } from '@revenuecat/purchases-capacitor-ui';
110
+
111
+ try {
112
+ const remove = await RevenueCatUI.checkpoint(
113
+ 'upgrade',
114
+ (result) => {
115
+ // Continue only from this callback. result.flow is null if nothing needed presenting.
116
+ console.log(result.customer, result.flow);
117
+ },
118
+ {
119
+ customVariables: { level: 12, premium: false },
120
+ presentationMode: FLOW_PRESENTATION_MODE.MODAL_SHEET,
121
+ },
122
+ );
123
+
124
+ // When the owning screen unmounts:
125
+ await remove();
126
+ } catch (error) {
127
+ console.error('Checkpoint error:', error);
128
+ }
129
+ ```
130
+
131
+ Continue your app inside the callback passed as the second argument to `checkpoint()`.
132
+ The callback runs at most once, when the checkpoint lets the user continue.
133
+ It won't run if the user dismisses the flow, an error blocks it, or another
134
+ checkpoint is already presenting. Errors are shown in native SDK dialogs.
135
+
136
+ `await RevenueCatUI.checkpoint(...)` waits for setup and returns `remove`. Setup errors
137
+ reject the promise. Call `await remove()` when the screen closes to stop listening for the
138
+ callback. It is safe to call more than once. It does not dismiss the flow or pass the checkpoint.
139
+
140
+ `CheckpointResult` contains `customer: CustomerInfo` and `flow: FlowResult | null`. A flow
141
+ contains `obtainedEntitlements` (each with `entitlementInfo`) and `obtainedProducts` (each with
142
+ `product`). Presentation modes are `DEFAULT`, `MODAL_FULL_SCREEN`, and `MODAL_SHEET`.
143
+
100
144
  ## Demo
101
145
 
102
146
  Here's a quick demo of Paywalls running on iOS:
@@ -13,6 +13,6 @@ Pod::Spec.new do |s|
13
13
  s.source_files = 'ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}'
14
14
  s.ios.deployment_target = '15.0'
15
15
  s.dependency 'Capacitor'
16
- s.dependency 'PurchasesHybridCommonUI', '20.0.0'
16
+ s.dependency 'PurchasesHybridCommonUI', '20.1.0'
17
17
  s.swift_version = '5.1'
18
18
  end
@@ -53,6 +53,6 @@ repositories {
53
53
  dependencies {
54
54
  implementation project(':capacitor-android')
55
55
  implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
56
- implementation 'com.revenuecat.purchases:purchases-hybrid-common-ui:20.0.0'
56
+ implementation 'com.revenuecat.purchases:purchases-hybrid-common-ui:20.1.0'
57
57
  implementation "org.jetbrains.kotlin:kotlin-stdlib:2.2.20"
58
58
  }
@@ -10,6 +10,8 @@ import com.getcapacitor.PluginCall
10
10
  import com.getcapacitor.PluginMethod
11
11
  import com.getcapacitor.annotation.CapacitorPlugin
12
12
  import com.revenuecat.purchases.PresentedOfferingContext
13
+ import com.revenuecat.purchases.hybridcommon.ui.CheckpointListener
14
+ import com.revenuecat.purchases.hybridcommon.ui.presentCheckpoint
13
15
  import com.revenuecat.purchases.hybridcommon.ui.PaywallListenerWrapper
14
16
  import com.revenuecat.purchases.hybridcommon.ui.PaywallResultListener
15
17
  import com.revenuecat.purchases.hybridcommon.ui.PaywallSource
@@ -22,6 +24,8 @@ import org.json.JSONObject
22
24
  @CapacitorPlugin(name = "RevenueCatUI")
23
25
  class RevenueCatUIPlugin : Plugin(), PaywallResultListener {
24
26
 
27
+ @Volatile private var destroyed = false
28
+
25
29
  private var savedCall: PluginCall? = null
26
30
  private var customerCenterLauncher: ActivityResultLauncher<Intent>? = null
27
31
 
@@ -38,6 +42,53 @@ class RevenueCatUIPlugin : Plugin(), PaywallResultListener {
38
42
  }
39
43
  }
40
44
 
45
+ @PluginMethod
46
+ fun checkpoint(call: PluginCall) {
47
+ val identifier = call.getString("identifier")
48
+ val callId = call.getString("callId")
49
+ if (identifier == null || callId == null) {
50
+ call.reject("Missing checkpoint identifier or callId", "BAD_ARGS")
51
+ return
52
+ }
53
+ val currentActivity = activity
54
+ if (currentActivity == null) {
55
+ call.reject("No activity available for checkpoint presentation", "MISSING_ACTIVITY")
56
+ return
57
+ }
58
+ currentActivity.runOnUiThread {
59
+ if (destroyed) {
60
+ call.reject("Plugin was destroyed", "CHECKPOINT_ERROR")
61
+ return@runOnUiThread
62
+ }
63
+ val variables = call.getObject("customVariables")?.let { values ->
64
+ values.keys().asSequence().associateWith { values.opt(it) }
65
+ }
66
+ var setupFailed = false
67
+ presentCheckpoint(identifier, variables, call.getString("presentationMode"), object : CheckpointListener {
68
+ override fun onCheckpointPassed(checkpointResult: Map<String, Any?>) {
69
+ if (!destroyed) {
70
+ notifyListeners("checkpointPassed", JSObject().apply {
71
+ put("callId", callId)
72
+ put("result", JSONObject(checkpointResult))
73
+ })
74
+ }
75
+ }
76
+
77
+ override fun onCheckpointError(code: String, message: String) {
78
+ setupFailed = true
79
+ call.reject(message, code)
80
+ }
81
+ })
82
+ // PHC reports startup failures synchronously. Passing the checkpoint is a separate event.
83
+ if (!setupFailed) call.resolve()
84
+ }
85
+ }
86
+
87
+ override fun handleOnDestroy() {
88
+ destroyed = true
89
+ super.handleOnDestroy()
90
+ }
91
+
41
92
  @PluginMethod
42
93
  fun presentPaywall(call: PluginCall) {
43
94
  val offering = call.getObject("offering")
@@ -1,7 +1,68 @@
1
1
  import type { PluginListenerHandle } from '@capacitor/core';
2
- import type { CustomerInfo, PaywallInteractionEvent, PurchasesError, PurchasesOffering, PurchasesPackage, PurchasesStoreTransaction } from '@revenuecat/purchases-typescript-internal-esm';
2
+ import type { CustomerInfo, PaywallInteractionEvent, PurchasesError, PurchasesOffering, PurchasesPackage, PurchasesStoreTransaction, PurchasesEntitlementInfo, PurchasesStoreProduct } from '@revenuecat/purchases-typescript-internal-esm';
3
3
  import { PAYWALL_RESULT } from '@revenuecat/purchases-typescript-internal-esm';
4
+ /** How the native SDK presents the flow selected by a checkpoint. */
5
+ export declare enum FLOW_PRESENTATION_MODE {
6
+ /** Let the native SDK choose how to present the flow. */
7
+ DEFAULT = "DEFAULT",
8
+ /** Present the flow as a modal that covers the whole screen. */
9
+ MODAL_FULL_SCREEN = "MODAL_FULL_SCREEN",
10
+ /** Present the flow as a modal sheet over the app's content. */
11
+ MODAL_SHEET = "MODAL_SHEET"
12
+ }
13
+ /** An entitlement that became active during a checkpoint flow. */
14
+ export interface ObtainedEntitlement {
15
+ /** Details of the entitlement that became active. */
16
+ entitlementInfo: PurchasesEntitlementInfo;
17
+ }
18
+ /** A product whose purchase was newly reported during a checkpoint flow. */
19
+ export interface ObtainedProduct {
20
+ /** Store details of the product. */
21
+ product: PurchasesStoreProduct;
22
+ }
23
+ /** Entitlements and products obtained during a completed checkpoint flow. */
24
+ export interface FlowResult {
25
+ /** Entitlements active after the flow that were not active before it started. */
26
+ obtainedEntitlements: ObtainedEntitlement[];
27
+ /** Products from the flow's offerings with new purchases reported, including renewals and repeat purchases. */
28
+ obtainedProducts: ObtainedProduct[];
29
+ }
30
+ /** The flow result and customer information delivered when a checkpoint passes. */
31
+ export interface CheckpointResult {
32
+ /** Result of the completed flow, or null if no flow needed to be presented. */
33
+ flow: FlowResult | null;
34
+ /** Customer information after passing the checkpoint. */
35
+ customer: CustomerInfo;
36
+ }
37
+ /** Optional settings for a checkpoint flow. */
38
+ export interface CheckpointParams {
39
+ /** Custom values for checkpoint targeting and the presented flow. Supports strings, numbers and booleans. */
40
+ customVariables?: Record<string, string | number | boolean>;
41
+ /** How to present the flow. Defaults to FLOW_PRESENTATION_MODE.DEFAULT. */
42
+ presentationMode?: FLOW_PRESENTATION_MODE;
43
+ }
4
44
  export interface RevenueCatUIPlugin {
45
+ /**
46
+ * **Experimental, invite-only API.**
47
+ *
48
+ * Starts a checkpoint configured in the RevenueCat dashboard.
49
+ * Requires Purchases to be configured and a native iOS 15+ or Android build.
50
+ *
51
+ * Continue your app inside the callback passed as the second argument.
52
+ * The callback runs at most once, when the checkpoint lets the user continue.
53
+ * It is not called if the user dismisses the flow, an error blocks it, or another checkpoint is already presenting.
54
+ * The native SDK shows errors in its own dialogs.
55
+ *
56
+ * Await this method to finish setup and receive a function that stops listening for the callback.
57
+ * Call that function when the screen closes. It is safe to call more than once.
58
+ * Stopping the callback does not dismiss the flow or pass the checkpoint. Setup errors reject the promise.
59
+ *
60
+ * @param identifier - Checkpoint identifier configured in the RevenueCat dashboard.
61
+ * @param onPassed - Callback to continue the app, with customer information and any completed flow result.
62
+ * @param params - Optional custom variables and presentation mode.
63
+ * @returns A promise that resolves after setup with an async function to stop listening for the callback.
64
+ */
65
+ checkpoint(identifier: string, onPassed: (result: CheckpointResult) => void, params?: CheckpointParams): Promise<() => Promise<void>>;
5
66
  /**
6
67
  * Presents a paywall configured in the RevenueCat dashboard.
7
68
  * @param options The options for presenting the paywall.
@@ -1,4 +1,14 @@
1
1
  import { PAYWALL_RESULT } from '@revenuecat/purchases-typescript-internal-esm';
2
+ /** How the native SDK presents the flow selected by a checkpoint. */
3
+ export var FLOW_PRESENTATION_MODE;
4
+ (function (FLOW_PRESENTATION_MODE) {
5
+ /** Let the native SDK choose how to present the flow. */
6
+ FLOW_PRESENTATION_MODE["DEFAULT"] = "DEFAULT";
7
+ /** Present the flow as a modal that covers the whole screen. */
8
+ FLOW_PRESENTATION_MODE["MODAL_FULL_SCREEN"] = "MODAL_FULL_SCREEN";
9
+ /** Present the flow as a modal sheet over the app's content. */
10
+ FLOW_PRESENTATION_MODE["MODAL_SHEET"] = "MODAL_SHEET";
11
+ })(FLOW_PRESENTATION_MODE || (FLOW_PRESENTATION_MODE = {}));
2
12
  /**
3
13
  * Possible outcomes from a custom {@link PurchaseLogic} operation.
4
14
  */
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAC;AA+H/E;;GAEG;AACH,MAAM,CAAN,IAAY,qBAOX;AAPD,WAAY,qBAAqB;IAC/B,sDAAsD;IACtD,4CAAmB,CAAA;IACnB,kDAAkD;IAClD,sDAA6B,CAAA;IAC7B,oDAAoD;IACpD,wCAAe,CAAA;AACjB,CAAC,EAPW,qBAAqB,KAArB,qBAAqB,QAOhC;AAKD,+CAA+C;AAC/C,MAAM,CAAC,MAAM,8BAA8B,GAAG;IAC5C,gDAAgD;IAChD,WAAW,EAAE,aAAa;IAC1B,mEAAmE;IACnE,KAAK,EAAE,OAAO;CACN,CAAC;AAKX,mDAAmD;AACnD,MAAM,CAAC,MAAM,kCAAkC,GAAG;IAChD,gFAAgF;IAChF,WAAW,EAAE,aAAa;CAClB,CAAC;AAeX,wEAAwE;AACxE,MAAM,CAAC,MAAM,gCAAgC,GAAG;IAC9C,iDAAiD;IACjD,WAAW,EAAE;QACX,GAAG,EAAE,8BAA8B,CAAC,WAAW;QAC/C,OAAO,EAAE,kCAAkC,CAAC,WAAW;KACpB;IACrC,kEAAkE;IAClE,OAAO,EAAE;QACP,GAAG,EAAE,8BAA8B,CAAC,KAAK;QACzC,OAAO,EAAE,kCAAkC,CAAC,WAAW;KACpB;CAC7B,CAAC;AAmDX,oFAAoF;AACpF,OAAO,EAAE,cAAc,IAAI,iBAAiB,EAAE,CAAC","sourcesContent":["import type { PluginListenerHandle } from '@capacitor/core';\nimport type {\n CustomerInfo,\n PaywallInteractionEvent,\n PurchasesError,\n PurchasesOffering,\n PurchasesPackage,\n PurchasesStoreTransaction,\n} from '@revenuecat/purchases-typescript-internal-esm';\nimport { PAYWALL_RESULT } from '@revenuecat/purchases-typescript-internal-esm';\n\nexport interface RevenueCatUIPlugin {\n /**\n * Presents a paywall configured in the RevenueCat dashboard.\n * @param options The options for presenting the paywall.\n * @returns A PaywallResult indicating what happened during the paywall presentation.\n */\n presentPaywall(options?: PresentPaywallOptions): Promise<PaywallResult>;\n\n /**\n * Presents a paywall only if the user does not have the specified entitlement.\n * @param options The options for presenting the paywall if needed.\n * @returns A PaywallResult indicating what happened during the paywall presentation.\n */\n presentPaywallIfNeeded(options: PresentPaywallIfNeededOptions): Promise<PaywallResult>;\n\n /**\n * Presents the customer center where users can manage their subscriptions.\n */\n presentCustomerCenter(): Promise<void>;\n\n /**\n * Used for web only. Enables or disables returning mock results instead of rejecting promises with \"not supported\".\n * For testing purposes only.\n * @param options Options for mock web results\n */\n setMockWebResults?(options: { shouldMockWebResults: boolean }): Promise<void>;\n\n /**\n * Listen for when a paywall is displayed or dismissed.\n * @param eventName The event to listen for\n * @param listener The listener to call when the event is triggered\n */\n addListener(eventName: 'paywallDisplayed' | 'paywallDismissed', listener: () => void): Promise<PluginListenerHandle>;\n\n /**\n * Remove all listeners for this plugin.\n */\n removeAllListeners(): Promise<void>;\n}\n\n/**\n * Object passed to onPurchaseInitiated that allows the developer to\n * control when (and whether) the purchase flow continues.\n * The developer can store this and call resume() asynchronously\n * (e.g., after an auth flow on a different screen).\n */\nexport interface PurchaseResumable {\n /** Call to proceed with or cancel the purchase. Defaults to true (proceed). */\n resume(shouldProceed?: boolean): void;\n}\n\n/**\n * Callbacks for observing paywall lifecycle events such as purchases,\n * restores, and errors. All callbacks are optional.\n *\n * Pass as `listener` in {@link PresentPaywallOptions} to receive events\n * while the paywall is displayed.\n */\nexport interface PaywallListener {\n /** Called when a purchase begins for a package. */\n onPurchaseStarted?: (args: { packageBeingPurchased: PurchasesPackage }) => void;\n /** Called when a purchase completes successfully. */\n onPurchaseCompleted?: (args: { customerInfo: CustomerInfo; storeTransaction: PurchasesStoreTransaction }) => void;\n /** Called when a purchase fails with an error. */\n onPurchaseError?: (args: { error: PurchasesError }) => void;\n /** Called when the user cancels a purchase. */\n onPurchaseCancelled?: () => void;\n /** Called when a restore operation begins. */\n onRestoreStarted?: () => void;\n /** Called when a restore operation completes successfully. */\n onRestoreCompleted?: (args: { customerInfo: CustomerInfo }) => void;\n /** Called when a restore operation fails with an error. */\n onRestoreError?: (args: { error: PurchasesError }) => void;\n /** Called when the user taps a web checkout CTA and leaves the app to complete payment externally. */\n onWebCheckoutOpened?: () => void;\n /** Called when the paywall opens a URL from a button destination or a text link. Not called for web checkout. */\n onUrlOpened?: (args: { url: string }) => void;\n /**\n * Called when the user interacts with a paywall control such as a tab, a package or the purchase\n * button. The event carries the documented snake_case `paywall_component_interacted` properties.\n * See https://rev.cat/paywall-interaction-events for the keys each component type sends.\n */\n onInteraction?: (event: PaywallInteractionEvent) => void;\n /**\n * Called before the payment sheet is displayed, allowing the app to gate\n * the purchase flow (e.g., require authentication first).\n *\n * The developer receives a {@link PurchaseResumable} that can be stored\n * and called asynchronously. Call `resumable.resume(true)` to proceed\n * with the purchase, or `resumable.resume(false)` to cancel it.\n *\n * If this callback is not provided, the purchase proceeds automatically.\n */\n onPurchaseInitiated?: (args: { packageBeingPurchased: PurchasesPackage; resumable: PurchaseResumable }) => void;\n}\n\n/**\n * Custom purchase and restore handlers for apps that manage their own\n * purchase flow (`purchasesAreCompletedBy: MY_APP`).\n *\n * When provided in {@link PresentPaywallOptions}, the paywall delegates\n * purchase and restore operations to these handlers instead of using\n * RevenueCat's built-in purchase flow.\n */\nexport interface PurchaseLogic {\n /**\n * Called when the user initiates a purchase from the paywall.\n * Perform the purchase using your own payment system and return the result.\n */\n performPurchase: (args: { packageToPurchase: PurchasesPackage }) => Promise<PurchaseLogicResult>;\n /**\n * Called when the user initiates a restore from the paywall.\n * Perform the restore using your own system and return the result.\n */\n performRestore: () => Promise<PurchaseLogicResult>;\n}\n\n/**\n * The result of a custom purchase or restore operation performed by {@link PurchaseLogic}.\n */\nexport type PurchaseLogicResult =\n | { result: PURCHASE_LOGIC_RESULT.SUCCESS }\n | { result: PURCHASE_LOGIC_RESULT.CANCELLATION }\n | { result: PURCHASE_LOGIC_RESULT.ERROR; error?: PurchasesError };\n\n/**\n * Possible outcomes from a custom {@link PurchaseLogic} operation.\n */\nexport enum PURCHASE_LOGIC_RESULT {\n /** The purchase or restore completed successfully. */\n SUCCESS = 'SUCCESS',\n /** The user cancelled the purchase or restore. */\n CANCELLATION = 'CANCELLATION',\n /** The purchase or restore failed with an error. */\n ERROR = 'ERROR',\n}\n\n/** Presentation styles available for paywalls on iOS. */\nexport type IOSPaywallPresentationStyle =\n (typeof IOS_PAYWALL_PRESENTATION_STYLE)[keyof typeof IOS_PAYWALL_PRESENTATION_STYLE];\n/** @see {@link IOSPaywallPresentationStyle} */\nexport const IOS_PAYWALL_PRESENTATION_STYLE = {\n /** Presents the paywall in full-screen mode. */\n FULL_SCREEN: 'FULL_SCREEN',\n /** Presents the paywall as a sheet. This is the default on iOS. */\n SHEET: 'SHEET',\n} as const;\n\n/** Presentation styles available for paywalls on Android. */\nexport type AndroidPaywallPresentationStyle =\n (typeof ANDROID_PAYWALL_PRESENTATION_STYLE)[keyof typeof ANDROID_PAYWALL_PRESENTATION_STYLE];\n/** @see {@link AndroidPaywallPresentationStyle} */\nexport const ANDROID_PAYWALL_PRESENTATION_STYLE = {\n /** Presents the paywall in full-screen mode. This is the default on Android. */\n FULL_SCREEN: 'FULL_SCREEN',\n} as const;\n\n/**\n * Per-platform configuration for how a paywall is presented.\n * Use the convenience presets {@link PaywallPresentationConfiguration.FULL_SCREEN}\n * or {@link PaywallPresentationConfiguration.DEFAULT}, or provide a custom\n * configuration with per-platform styles.\n */\nexport interface PaywallPresentationConfiguration {\n /** Presentation style on iOS. Defaults to sheet if not specified. */\n ios?: IOSPaywallPresentationStyle;\n /** Presentation style on Android. Defaults to full-screen if not specified. */\n android?: AndroidPaywallPresentationStyle;\n}\n\n/** Convenience presets for {@link PaywallPresentationConfiguration}. */\nexport const PaywallPresentationConfiguration = {\n /** Full-screen presentation on all platforms. */\n FULL_SCREEN: {\n ios: IOS_PAYWALL_PRESENTATION_STYLE.FULL_SCREEN,\n android: ANDROID_PAYWALL_PRESENTATION_STYLE.FULL_SCREEN,\n } as PaywallPresentationConfiguration,\n /** Default presentation: sheet on iOS, full-screen on Android. */\n DEFAULT: {\n ios: IOS_PAYWALL_PRESENTATION_STYLE.SHEET,\n android: ANDROID_PAYWALL_PRESENTATION_STYLE.FULL_SCREEN,\n } as PaywallPresentationConfiguration,\n} as const;\n\nexport interface PresentPaywallOptions {\n /**\n * The offering to present.\n * If not provided, the current offering will be used.\n */\n offering?: PurchasesOffering;\n\n /**\n * Controls how the paywall is presented on each platform.\n * Use `PaywallPresentationConfiguration.FULL_SCREEN` for full-screen on all platforms,\n * or provide a custom configuration with per-platform styles.\n * Defaults to sheet on iOS and full-screen on Android.\n */\n presentationConfiguration?: PaywallPresentationConfiguration;\n\n /**\n * Whether to display a close button on the paywall.\n * Only applicable for original template paywalls, ignored for V2 Paywalls.\n */\n displayCloseButton?: boolean;\n\n /**\n * Optional listener for paywall lifecycle events such as purchase\n * completion, restoration, and errors.\n */\n listener?: PaywallListener;\n\n /**\n * Optional custom purchase/restore logic for when\n * `purchasesAreCompletedBy` is set to `MY_APP`.\n */\n purchaseLogic?: PurchaseLogic;\n\n /**\n * Optional custom variables for paywall text substitution.\n * Variables can be referenced in paywalls using the `{{ custom.variable_name }}` syntax.\n * Keys must start with a letter and contain only alphanumeric characters and underscores.\n */\n customVariables?: Record<string, string | number | boolean>;\n}\n\nexport interface PresentPaywallIfNeededOptions extends PresentPaywallOptions {\n /**\n * The identifier of the entitlement that is required.\n * The paywall will only be presented if the user doesn't have this entitlement.\n */\n requiredEntitlementIdentifier: string;\n}\n\n// Using the enum from purchases-typescript-internal-esm instead of defining our own\nexport { PAYWALL_RESULT as PaywallResultEnum };\nexport type { PaywallInteractionEvent } from '@revenuecat/purchases-typescript-internal-esm';\n\nexport interface PaywallResult {\n /**\n * The result of the paywall presentation.\n */\n result: PAYWALL_RESULT;\n}\n"]}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAC;AAE/E,qEAAqE;AACrE,MAAM,CAAN,IAAY,sBAOX;AAPD,WAAY,sBAAsB;IAChC,yDAAyD;IACzD,6CAAmB,CAAA;IACnB,gEAAgE;IAChE,iEAAuC,CAAA;IACvC,gEAAgE;IAChE,qDAA2B,CAAA;AAC7B,CAAC,EAPW,sBAAsB,KAAtB,sBAAsB,QAOjC;AA6LD;;GAEG;AACH,MAAM,CAAN,IAAY,qBAOX;AAPD,WAAY,qBAAqB;IAC/B,sDAAsD;IACtD,4CAAmB,CAAA;IACnB,kDAAkD;IAClD,sDAA6B,CAAA;IAC7B,oDAAoD;IACpD,wCAAe,CAAA;AACjB,CAAC,EAPW,qBAAqB,KAArB,qBAAqB,QAOhC;AAKD,+CAA+C;AAC/C,MAAM,CAAC,MAAM,8BAA8B,GAAG;IAC5C,gDAAgD;IAChD,WAAW,EAAE,aAAa;IAC1B,mEAAmE;IACnE,KAAK,EAAE,OAAO;CACN,CAAC;AAKX,mDAAmD;AACnD,MAAM,CAAC,MAAM,kCAAkC,GAAG;IAChD,gFAAgF;IAChF,WAAW,EAAE,aAAa;CAClB,CAAC;AAeX,wEAAwE;AACxE,MAAM,CAAC,MAAM,gCAAgC,GAAG;IAC9C,iDAAiD;IACjD,WAAW,EAAE;QACX,GAAG,EAAE,8BAA8B,CAAC,WAAW;QAC/C,OAAO,EAAE,kCAAkC,CAAC,WAAW;KACpB;IACrC,kEAAkE;IAClE,OAAO,EAAE;QACP,GAAG,EAAE,8BAA8B,CAAC,KAAK;QACzC,OAAO,EAAE,kCAAkC,CAAC,WAAW;KACpB;CAC7B,CAAC;AAmDX,oFAAoF;AACpF,OAAO,EAAE,cAAc,IAAI,iBAAiB,EAAE,CAAC","sourcesContent":["import type { PluginListenerHandle } from '@capacitor/core';\nimport type {\n CustomerInfo,\n PaywallInteractionEvent,\n PurchasesError,\n PurchasesOffering,\n PurchasesPackage,\n PurchasesStoreTransaction,\n PurchasesEntitlementInfo,\n PurchasesStoreProduct,\n} from '@revenuecat/purchases-typescript-internal-esm';\nimport { PAYWALL_RESULT } from '@revenuecat/purchases-typescript-internal-esm';\n\n/** How the native SDK presents the flow selected by a checkpoint. */\nexport enum FLOW_PRESENTATION_MODE {\n /** Let the native SDK choose how to present the flow. */\n DEFAULT = 'DEFAULT',\n /** Present the flow as a modal that covers the whole screen. */\n MODAL_FULL_SCREEN = 'MODAL_FULL_SCREEN',\n /** Present the flow as a modal sheet over the app's content. */\n MODAL_SHEET = 'MODAL_SHEET',\n}\n\n/** An entitlement that became active during a checkpoint flow. */\nexport interface ObtainedEntitlement {\n /** Details of the entitlement that became active. */\n entitlementInfo: PurchasesEntitlementInfo;\n}\n\n/** A product whose purchase was newly reported during a checkpoint flow. */\nexport interface ObtainedProduct {\n /** Store details of the product. */\n product: PurchasesStoreProduct;\n}\n\n/** Entitlements and products obtained during a completed checkpoint flow. */\nexport interface FlowResult {\n /** Entitlements active after the flow that were not active before it started. */\n obtainedEntitlements: ObtainedEntitlement[];\n /** Products from the flow's offerings with new purchases reported, including renewals and repeat purchases. */\n obtainedProducts: ObtainedProduct[];\n}\n\n/** The flow result and customer information delivered when a checkpoint passes. */\nexport interface CheckpointResult {\n /** Result of the completed flow, or null if no flow needed to be presented. */\n flow: FlowResult | null;\n /** Customer information after passing the checkpoint. */\n customer: CustomerInfo;\n}\n\n/** Optional settings for a checkpoint flow. */\nexport interface CheckpointParams {\n /** Custom values for checkpoint targeting and the presented flow. Supports strings, numbers and booleans. */\n customVariables?: Record<string, string | number | boolean>;\n /** How to present the flow. Defaults to FLOW_PRESENTATION_MODE.DEFAULT. */\n presentationMode?: FLOW_PRESENTATION_MODE;\n}\n\nexport interface RevenueCatUIPlugin {\n /**\n * **Experimental, invite-only API.**\n *\n * Starts a checkpoint configured in the RevenueCat dashboard.\n * Requires Purchases to be configured and a native iOS 15+ or Android build.\n *\n * Continue your app inside the callback passed as the second argument.\n * The callback runs at most once, when the checkpoint lets the user continue.\n * It is not called if the user dismisses the flow, an error blocks it, or another checkpoint is already presenting.\n * The native SDK shows errors in its own dialogs.\n *\n * Await this method to finish setup and receive a function that stops listening for the callback.\n * Call that function when the screen closes. It is safe to call more than once.\n * Stopping the callback does not dismiss the flow or pass the checkpoint. Setup errors reject the promise.\n *\n * @param identifier - Checkpoint identifier configured in the RevenueCat dashboard.\n * @param onPassed - Callback to continue the app, with customer information and any completed flow result.\n * @param params - Optional custom variables and presentation mode.\n * @returns A promise that resolves after setup with an async function to stop listening for the callback.\n */\n checkpoint(\n identifier: string,\n onPassed: (result: CheckpointResult) => void,\n params?: CheckpointParams,\n ): Promise<() => Promise<void>>;\n\n /**\n * Presents a paywall configured in the RevenueCat dashboard.\n * @param options The options for presenting the paywall.\n * @returns A PaywallResult indicating what happened during the paywall presentation.\n */\n presentPaywall(options?: PresentPaywallOptions): Promise<PaywallResult>;\n\n /**\n * Presents a paywall only if the user does not have the specified entitlement.\n * @param options The options for presenting the paywall if needed.\n * @returns A PaywallResult indicating what happened during the paywall presentation.\n */\n presentPaywallIfNeeded(options: PresentPaywallIfNeededOptions): Promise<PaywallResult>;\n\n /**\n * Presents the customer center where users can manage their subscriptions.\n */\n presentCustomerCenter(): Promise<void>;\n\n /**\n * Used for web only. Enables or disables returning mock results instead of rejecting promises with \"not supported\".\n * For testing purposes only.\n * @param options Options for mock web results\n */\n setMockWebResults?(options: { shouldMockWebResults: boolean }): Promise<void>;\n\n /**\n * Listen for when a paywall is displayed or dismissed.\n * @param eventName The event to listen for\n * @param listener The listener to call when the event is triggered\n */\n addListener(eventName: 'paywallDisplayed' | 'paywallDismissed', listener: () => void): Promise<PluginListenerHandle>;\n\n /**\n * Remove all listeners for this plugin.\n */\n removeAllListeners(): Promise<void>;\n}\n\n/**\n * Object passed to onPurchaseInitiated that allows the developer to\n * control when (and whether) the purchase flow continues.\n * The developer can store this and call resume() asynchronously\n * (e.g., after an auth flow on a different screen).\n */\nexport interface PurchaseResumable {\n /** Call to proceed with or cancel the purchase. Defaults to true (proceed). */\n resume(shouldProceed?: boolean): void;\n}\n\n/**\n * Callbacks for observing paywall lifecycle events such as purchases,\n * restores, and errors. All callbacks are optional.\n *\n * Pass as `listener` in {@link PresentPaywallOptions} to receive events\n * while the paywall is displayed.\n */\nexport interface PaywallListener {\n /** Called when a purchase begins for a package. */\n onPurchaseStarted?: (args: { packageBeingPurchased: PurchasesPackage }) => void;\n /** Called when a purchase completes successfully. */\n onPurchaseCompleted?: (args: { customerInfo: CustomerInfo; storeTransaction: PurchasesStoreTransaction }) => void;\n /** Called when a purchase fails with an error. */\n onPurchaseError?: (args: { error: PurchasesError }) => void;\n /** Called when the user cancels a purchase. */\n onPurchaseCancelled?: () => void;\n /** Called when a restore operation begins. */\n onRestoreStarted?: () => void;\n /** Called when a restore operation completes successfully. */\n onRestoreCompleted?: (args: { customerInfo: CustomerInfo }) => void;\n /** Called when a restore operation fails with an error. */\n onRestoreError?: (args: { error: PurchasesError }) => void;\n /** Called when the user taps a web checkout CTA and leaves the app to complete payment externally. */\n onWebCheckoutOpened?: () => void;\n /** Called when the paywall opens a URL from a button destination or a text link. Not called for web checkout. */\n onUrlOpened?: (args: { url: string }) => void;\n /**\n * Called when the user interacts with a paywall control such as a tab, a package or the purchase\n * button. The event carries the documented snake_case `paywall_component_interacted` properties.\n * See https://rev.cat/paywall-interaction-events for the keys each component type sends.\n */\n onInteraction?: (event: PaywallInteractionEvent) => void;\n /**\n * Called before the payment sheet is displayed, allowing the app to gate\n * the purchase flow (e.g., require authentication first).\n *\n * The developer receives a {@link PurchaseResumable} that can be stored\n * and called asynchronously. Call `resumable.resume(true)` to proceed\n * with the purchase, or `resumable.resume(false)` to cancel it.\n *\n * If this callback is not provided, the purchase proceeds automatically.\n */\n onPurchaseInitiated?: (args: { packageBeingPurchased: PurchasesPackage; resumable: PurchaseResumable }) => void;\n}\n\n/**\n * Custom purchase and restore handlers for apps that manage their own\n * purchase flow (`purchasesAreCompletedBy: MY_APP`).\n *\n * When provided in {@link PresentPaywallOptions}, the paywall delegates\n * purchase and restore operations to these handlers instead of using\n * RevenueCat's built-in purchase flow.\n */\nexport interface PurchaseLogic {\n /**\n * Called when the user initiates a purchase from the paywall.\n * Perform the purchase using your own payment system and return the result.\n */\n performPurchase: (args: { packageToPurchase: PurchasesPackage }) => Promise<PurchaseLogicResult>;\n /**\n * Called when the user initiates a restore from the paywall.\n * Perform the restore using your own system and return the result.\n */\n performRestore: () => Promise<PurchaseLogicResult>;\n}\n\n/**\n * The result of a custom purchase or restore operation performed by {@link PurchaseLogic}.\n */\nexport type PurchaseLogicResult =\n | { result: PURCHASE_LOGIC_RESULT.SUCCESS }\n | { result: PURCHASE_LOGIC_RESULT.CANCELLATION }\n | { result: PURCHASE_LOGIC_RESULT.ERROR; error?: PurchasesError };\n\n/**\n * Possible outcomes from a custom {@link PurchaseLogic} operation.\n */\nexport enum PURCHASE_LOGIC_RESULT {\n /** The purchase or restore completed successfully. */\n SUCCESS = 'SUCCESS',\n /** The user cancelled the purchase or restore. */\n CANCELLATION = 'CANCELLATION',\n /** The purchase or restore failed with an error. */\n ERROR = 'ERROR',\n}\n\n/** Presentation styles available for paywalls on iOS. */\nexport type IOSPaywallPresentationStyle =\n (typeof IOS_PAYWALL_PRESENTATION_STYLE)[keyof typeof IOS_PAYWALL_PRESENTATION_STYLE];\n/** @see {@link IOSPaywallPresentationStyle} */\nexport const IOS_PAYWALL_PRESENTATION_STYLE = {\n /** Presents the paywall in full-screen mode. */\n FULL_SCREEN: 'FULL_SCREEN',\n /** Presents the paywall as a sheet. This is the default on iOS. */\n SHEET: 'SHEET',\n} as const;\n\n/** Presentation styles available for paywalls on Android. */\nexport type AndroidPaywallPresentationStyle =\n (typeof ANDROID_PAYWALL_PRESENTATION_STYLE)[keyof typeof ANDROID_PAYWALL_PRESENTATION_STYLE];\n/** @see {@link AndroidPaywallPresentationStyle} */\nexport const ANDROID_PAYWALL_PRESENTATION_STYLE = {\n /** Presents the paywall in full-screen mode. This is the default on Android. */\n FULL_SCREEN: 'FULL_SCREEN',\n} as const;\n\n/**\n * Per-platform configuration for how a paywall is presented.\n * Use the convenience presets {@link PaywallPresentationConfiguration.FULL_SCREEN}\n * or {@link PaywallPresentationConfiguration.DEFAULT}, or provide a custom\n * configuration with per-platform styles.\n */\nexport interface PaywallPresentationConfiguration {\n /** Presentation style on iOS. Defaults to sheet if not specified. */\n ios?: IOSPaywallPresentationStyle;\n /** Presentation style on Android. Defaults to full-screen if not specified. */\n android?: AndroidPaywallPresentationStyle;\n}\n\n/** Convenience presets for {@link PaywallPresentationConfiguration}. */\nexport const PaywallPresentationConfiguration = {\n /** Full-screen presentation on all platforms. */\n FULL_SCREEN: {\n ios: IOS_PAYWALL_PRESENTATION_STYLE.FULL_SCREEN,\n android: ANDROID_PAYWALL_PRESENTATION_STYLE.FULL_SCREEN,\n } as PaywallPresentationConfiguration,\n /** Default presentation: sheet on iOS, full-screen on Android. */\n DEFAULT: {\n ios: IOS_PAYWALL_PRESENTATION_STYLE.SHEET,\n android: ANDROID_PAYWALL_PRESENTATION_STYLE.FULL_SCREEN,\n } as PaywallPresentationConfiguration,\n} as const;\n\nexport interface PresentPaywallOptions {\n /**\n * The offering to present.\n * If not provided, the current offering will be used.\n */\n offering?: PurchasesOffering;\n\n /**\n * Controls how the paywall is presented on each platform.\n * Use `PaywallPresentationConfiguration.FULL_SCREEN` for full-screen on all platforms,\n * or provide a custom configuration with per-platform styles.\n * Defaults to sheet on iOS and full-screen on Android.\n */\n presentationConfiguration?: PaywallPresentationConfiguration;\n\n /**\n * Whether to display a close button on the paywall.\n * Only applicable for original template paywalls, ignored for V2 Paywalls.\n */\n displayCloseButton?: boolean;\n\n /**\n * Optional listener for paywall lifecycle events such as purchase\n * completion, restoration, and errors.\n */\n listener?: PaywallListener;\n\n /**\n * Optional custom purchase/restore logic for when\n * `purchasesAreCompletedBy` is set to `MY_APP`.\n */\n purchaseLogic?: PurchaseLogic;\n\n /**\n * Optional custom variables for paywall text substitution.\n * Variables can be referenced in paywalls using the `{{ custom.variable_name }}` syntax.\n * Keys must start with a letter and contain only alphanumeric characters and underscores.\n */\n customVariables?: Record<string, string | number | boolean>;\n}\n\nexport interface PresentPaywallIfNeededOptions extends PresentPaywallOptions {\n /**\n * The identifier of the entitlement that is required.\n * The paywall will only be presented if the user doesn't have this entitlement.\n */\n requiredEntitlementIdentifier: string;\n}\n\n// Using the enum from purchases-typescript-internal-esm instead of defining our own\nexport { PAYWALL_RESULT as PaywallResultEnum };\nexport type { PaywallInteractionEvent } from '@revenuecat/purchases-typescript-internal-esm';\n\nexport interface PaywallResult {\n /**\n * The result of the paywall presentation.\n */\n result: PAYWALL_RESULT;\n}\n"]}
package/dist/esm/index.js CHANGED
@@ -9,9 +9,9 @@ var __rest = (this && this.__rest) || function (s, e) {
9
9
  }
10
10
  return t;
11
11
  };
12
- import { registerPlugin } from '@capacitor/core';
12
+ import { Capacitor, registerPlugin } from '@capacitor/core';
13
13
  import { normalizePurchasesError } from '@revenuecat/purchases-typescript-internal-esm';
14
- import { IOS_PAYWALL_PRESENTATION_STYLE, ANDROID_PAYWALL_PRESENTATION_STYLE, PURCHASE_LOGIC_RESULT, } from './definitions';
14
+ import { FLOW_PRESENTATION_MODE, IOS_PAYWALL_PRESENTATION_STYLE, ANDROID_PAYWALL_PRESENTATION_STYLE, PURCHASE_LOGIC_RESULT, } from './definitions';
15
15
  const nativePlugin = registerPlugin('RevenueCatUI', {
16
16
  web: () => import('./web').then((m) => new m.RevenueCatUIWeb()),
17
17
  });
@@ -197,7 +197,40 @@ async function presentWithListenerSupport(nativeMethod, options, listener, purch
197
197
  }
198
198
  }
199
199
  }
200
+ const checkpointCallIdPrefix = `${Date.now()}-${Math.random()}`;
201
+ let nextCheckpointCallId = 0;
200
202
  const RevenueCatUI = {
203
+ async checkpoint(identifier, onPassed, params = {}) {
204
+ var _a;
205
+ if (Capacitor.getPlatform() !== 'ios' && Capacitor.getPlatform() !== 'android') {
206
+ throw new Error('[RevenueCatUI] Checkpoints require a native iOS or Android build.');
207
+ }
208
+ const callId = `${checkpointCallIdPrefix}-${++nextCheckpointCallId}`;
209
+ let active = true;
210
+ let removal;
211
+ // Register before starting: an unconfigured checkpoint identifier may pass immediately.
212
+ const handle = await nativePlugin.addListener('checkpointPassed', (event) => {
213
+ if (!active || event.callId !== callId)
214
+ return;
215
+ active = false;
216
+ removal = handle.remove();
217
+ void removal.catch((error) => console.warn('[RevenueCatUI] Failed to remove checkpoint listener:', error));
218
+ onPassed(event.result);
219
+ });
220
+ const remove = () => {
221
+ active = false;
222
+ return (removal !== null && removal !== void 0 ? removal : (removal = handle.remove()));
223
+ };
224
+ try {
225
+ await nativePlugin.checkpoint(Object.assign(Object.assign({ identifier,
226
+ callId }, (params.customVariables !== undefined ? { customVariables: params.customVariables } : {})), { presentationMode: (_a = params.presentationMode) !== null && _a !== void 0 ? _a : FLOW_PRESENTATION_MODE.DEFAULT }));
227
+ }
228
+ catch (error) {
229
+ await remove().catch((cleanupError) => console.warn('[RevenueCatUI] Failed to remove checkpoint listener:', cleanupError));
230
+ throw error;
231
+ }
232
+ return remove;
233
+ },
201
234
  async presentPaywall(options) {
202
235
  assertValidPresentationConfiguration(options === null || options === void 0 ? void 0 : options.presentationConfiguration);
203
236
  const _a = options !== null && options !== void 0 ? options : {}, { presentationConfiguration, listener, purchaseLogic } = _a, rest = __rest(_a, ["presentationConfiguration", "listener", "purchaseLogic"]);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"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,CAAE,yBAAyB,CAAC,CAAC;QAEzE,MAAM,EAAE,yBAAyB,EAAE,QAAQ,EAAE,aAAa,KAAc,OAAO,EAAhB,IAAI,UAAK,OAAO,EAAzE,0DAA+D,CAAU,CAAC;QAChF,MAAM,UAAU,mCACX,IAAI,GACJ,gCAAgC,CAAC,yBAAyB,CAAC,CAC/D,CAAC;QAEF,IAAI,CAAC,QAAQ,IAAI,CAAC,aAAa,EAAE,CAAC;YAChC,OAAO,YAAY,CAAC,sBAAsB,CAAC,UAAU,CAAC,CAAC;QACzD,CAAC;QAED,OAAO,0BAA0B,CAC/B,CAAC,IAAI,EAAE,EAAE,CAAC,YAAY,CAAC,sBAAsB,CAAC,IAAI,CAAC,EACnD,UAAU,EACV,QAAQ,EACR,aAAa,CACd,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,qBAAqB;QACzB,OAAO,YAAY,CAAC,qBAAqB,EAAE,CAAC;IAC9C,CAAC;IAED,iBAAiB,EAAE,YAAY,CAAC,iBAAiB;QAC/C,CAAC,CAAC,KAAK,EAAE,OAA0C,EAAiB,EAAE;YAClE,OAAO,YAAY,CAAC,iBAAkB,CAAC,OAAO,CAAC,CAAC;QAClD,CAAC;QACH,CAAC,CAAC,SAAS;IAEb,WAAW,CAAC,SAAkD,EAAE,QAAoB;QAClF,OAAO,YAAY,CAAC,WAAW,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IACvD,CAAC;IAED,kBAAkB;QAChB,OAAO,YAAY,CAAC,kBAAkB,EAAE,CAAC;IAC3C,CAAC;CACF,CAAC;AAEF,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAC;AAC/E,OAAO,EAAE,YAAY,EAAE,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\nimport type { PluginListenerHandle } from '@capacitor/core';\nimport { normalizePurchasesError } from '@revenuecat/purchases-typescript-internal-esm';\nimport type { PurchasesError } from '@revenuecat/purchases-typescript-internal-esm';\n\nimport type {\n PaywallListener,\n PaywallPresentationConfiguration,\n PaywallResult,\n PresentPaywallIfNeededOptions,\n PresentPaywallOptions,\n PurchaseLogic,\n PurchaseLogicResult,\n RevenueCatUIPlugin,\n} from './definitions';\nimport {\n IOS_PAYWALL_PRESENTATION_STYLE,\n ANDROID_PAYWALL_PRESENTATION_STYLE,\n PURCHASE_LOGIC_RESULT,\n} from './definitions';\n\n/**\n * Internal native plugin interface with native-only methods and events.\n * This is not exported to consumers.\n */\ninterface RevenueCatUINativePlugin {\n presentPaywall(options: {\n offering?: any;\n useFullScreenPresentation?: boolean;\n displayCloseButton?: boolean;\n hasPaywallListener?: boolean;\n hasPurchaseLogic?: boolean;\n customVariables?: Record<string, string | number | boolean>;\n }): Promise<PaywallResult>;\n presentPaywallIfNeeded(options: {\n offering?: any;\n useFullScreenPresentation?: boolean;\n displayCloseButton?: boolean;\n requiredEntitlementIdentifier: string;\n hasPaywallListener?: boolean;\n hasPurchaseLogic?: boolean;\n customVariables?: Record<string, string | number | boolean>;\n }): Promise<PaywallResult>;\n presentCustomerCenter(): Promise<void>;\n setMockWebResults?(options: { shouldMockWebResults: boolean }): Promise<void>;\n\n resumePurchaseInitiated(options: { requestId: string; shouldProceed: boolean }): Promise<void>;\n resumePurchaseLogicPurchase(options: {\n requestId: string;\n result: string;\n error?: { code?: string; message?: string };\n }): Promise<void>;\n resumePurchaseLogicRestore(options: {\n requestId: string;\n result: string;\n error?: { code?: string; message?: string };\n }): Promise<void>;\n\n addListener(eventName: string, listener: (data: any) => void): Promise<PluginListenerHandle>;\n removeAllListeners(): Promise<void>;\n}\n\nconst nativePlugin = registerPlugin<RevenueCatUINativePlugin>('RevenueCatUI', {\n web: () => import('./web').then((m) => new m.RevenueCatUIWeb()),\n});\n\nfunction assertValidPresentationConfiguration(\n config: unknown,\n): asserts config is PaywallPresentationConfiguration | undefined {\n if (config === undefined) {\n return;\n }\n if (typeof config !== 'object' || config === null) {\n throw new Error(`Invalid presentationConfiguration: expected an object or undefined.`);\n }\n const { ios, android } = config as Record<string, unknown>;\n const validIos = Object.values(IOS_PAYWALL_PRESENTATION_STYLE) as string[];\n const validAndroid = Object.values(ANDROID_PAYWALL_PRESENTATION_STYLE) as string[];\n if (ios !== undefined && !validIos.includes(ios as string)) {\n throw new Error(`Invalid presentationConfiguration.ios \"${String(ios)}\". Expected one of: ${validIos.join(', ')}.`);\n }\n if (android !== undefined && !validAndroid.includes(android as string)) {\n throw new Error(\n `Invalid presentationConfiguration.android \"${String(android)}\". Expected one of: ${validAndroid.join(', ')}.`,\n );\n }\n}\n\nfunction resolveNativePresentationOptions(config?: PaywallPresentationConfiguration): {\n useFullScreenPresentation?: boolean;\n} {\n if (!config) {\n return {};\n }\n // iOS full-screen takes precedence as the flag that the native bridge understands\n if (config.ios === IOS_PAYWALL_PRESENTATION_STYLE.FULL_SCREEN) {\n return { useFullScreenPresentation: true };\n }\n return {};\n}\n\nfunction serializeResultForNative(result: PurchaseLogicResult): {\n result: string;\n error?: { code?: string; message?: string };\n} {\n if (result.result === PURCHASE_LOGIC_RESULT.ERROR && 'error' in result && result.error) {\n return {\n result: result.result,\n error: {\n code: result.error.code,\n message: result.error.message,\n },\n };\n }\n return { result: result.result };\n}\n\nasync function presentWithListenerSupport(\n nativeMethod: (options: any) => Promise<PaywallResult>,\n options: any,\n listener?: PaywallListener,\n purchaseLogic?: PurchaseLogic,\n): Promise<PaywallResult> {\n const handles: PluginListenerHandle[] = [];\n\n try {\n // Register PaywallListener event handlers\n if (listener) {\n if (listener.onPurchaseStarted) {\n const cb = listener.onPurchaseStarted;\n handles.push(\n await nativePlugin.addListener('onPurchaseStarted', (data: any) => {\n cb({ packageBeingPurchased: data.packageBeingPurchased ?? data });\n }),\n );\n }\n if (listener.onPurchaseCompleted) {\n const cb = listener.onPurchaseCompleted;\n handles.push(\n await nativePlugin.addListener('onPurchaseCompleted', (data: any) => {\n cb({\n customerInfo: data.customerInfo,\n storeTransaction: data.storeTransaction,\n });\n }),\n );\n }\n if (listener.onPurchaseError) {\n const cb = listener.onPurchaseError;\n handles.push(\n await nativePlugin.addListener('onPurchaseError', (data: any) => {\n cb({ error: normalizePurchasesError(data.error ?? data) as PurchasesError });\n }),\n );\n }\n if (listener.onPurchaseCancelled) {\n const cb = listener.onPurchaseCancelled;\n handles.push(\n await nativePlugin.addListener('onPurchaseCancelled', () => {\n cb();\n }),\n );\n }\n if (listener.onRestoreStarted) {\n const cb = listener.onRestoreStarted;\n handles.push(\n await nativePlugin.addListener('onRestoreStarted', () => {\n cb();\n }),\n );\n }\n if (listener.onRestoreCompleted) {\n const cb = listener.onRestoreCompleted;\n handles.push(\n await nativePlugin.addListener('onRestoreCompleted', (data: any) => {\n cb({ customerInfo: data.customerInfo ?? data });\n }),\n );\n }\n if (listener.onRestoreError) {\n const cb = listener.onRestoreError;\n handles.push(\n await nativePlugin.addListener('onRestoreError', (data: any) => {\n cb({ error: normalizePurchasesError(data.error ?? data) as PurchasesError });\n }),\n );\n }\n if (listener.onWebCheckoutOpened) {\n const cb = listener.onWebCheckoutOpened;\n handles.push(\n await nativePlugin.addListener('onWebCheckoutOpened', () => {\n cb();\n }),\n );\n }\n if (listener.onUrlOpened) {\n const cb = listener.onUrlOpened;\n handles.push(\n await nativePlugin.addListener('onUrlOpened', (data: any) => {\n cb({ url: data.url });\n }),\n );\n }\n if (listener.onInteraction) {\n handles.push(await nativePlugin.addListener('onInteraction', listener.onInteraction));\n }\n }\n\n // Always register onPurchaseInitiated so we auto-resume when the user\n // doesn't provide an onPurchaseInitiated callback — otherwise the\n // purchase flow hangs waiting for a resume that never comes.\n // This must be outside the `if (listener)` block because the native\n // delegate adapter always fires this event (even with purchaseLogic only).\n const onPurchaseInitiatedCb = listener?.onPurchaseInitiated;\n handles.push(\n await nativePlugin.addListener('onPurchaseInitiated', (data: any) => {\n const requestId: string = data.requestId;\n const packageBeingPurchased = data.package ?? data.packageBeingPurchased;\n if (onPurchaseInitiatedCb) {\n onPurchaseInitiatedCb({\n packageBeingPurchased,\n resumable: {\n resume(shouldProceed = true) {\n nativePlugin.resumePurchaseInitiated({ requestId, shouldProceed });\n },\n },\n });\n } else {\n // No callback provided — auto-proceed with the purchase.\n nativePlugin.resumePurchaseInitiated({ requestId, shouldProceed: true });\n }\n }),\n );\n\n // Register PurchaseLogic event handlers\n if (purchaseLogic) {\n handles.push(\n await nativePlugin.addListener('onPerformPurchaseRequest', async (data: any) => {\n const requestId: string = data.requestId;\n const packageToPurchase = data.package ?? data.packageBeingPurchased ?? data.packageToPurchase;\n try {\n const result = await purchaseLogic.performPurchase({ packageToPurchase });\n await nativePlugin.resumePurchaseLogicPurchase({\n requestId,\n ...serializeResultForNative(result),\n });\n } catch (e: any) {\n await nativePlugin.resumePurchaseLogicPurchase({\n requestId,\n result: PURCHASE_LOGIC_RESULT.ERROR,\n error: { message: e?.message ?? 'Unknown error' },\n });\n }\n }),\n );\n handles.push(\n await nativePlugin.addListener('onPerformRestoreRequest', async (data: any) => {\n const requestId: string = data.requestId;\n try {\n const result = await purchaseLogic.performRestore();\n await nativePlugin.resumePurchaseLogicRestore({\n requestId,\n ...serializeResultForNative(result),\n });\n } catch (e: any) {\n await nativePlugin.resumePurchaseLogicRestore({\n requestId,\n result: PURCHASE_LOGIC_RESULT.ERROR,\n error: { message: e?.message ?? 'Unknown error' },\n });\n }\n }),\n );\n }\n\n // Call native with serializable-only options\n const nativeOptions = {\n ...options,\n hasPaywallListener: !!listener,\n hasPurchaseLogic: !!purchaseLogic,\n };\n // Remove non-serializable fields\n delete nativeOptions.listener;\n delete nativeOptions.purchaseLogic;\n\n return await nativeMethod(nativeOptions);\n } finally {\n // Clean up all registered listeners\n for (const handle of handles) {\n await handle.remove();\n }\n }\n}\n\nconst RevenueCatUI: RevenueCatUIPlugin = {\n async presentPaywall(options?: PresentPaywallOptions): Promise<PaywallResult> {\n assertValidPresentationConfiguration(options?.presentationConfiguration);\n\n const { presentationConfiguration, listener, purchaseLogic, ...rest } = options ?? {};\n const nativeOpts = {\n ...rest,\n ...resolveNativePresentationOptions(presentationConfiguration),\n };\n\n if (!listener && !purchaseLogic) {\n return nativePlugin.presentPaywall(nativeOpts);\n }\n\n return presentWithListenerSupport((opts) => nativePlugin.presentPaywall(opts), nativeOpts, listener, purchaseLogic);\n },\n\n async presentPaywallIfNeeded(options: PresentPaywallIfNeededOptions): Promise<PaywallResult> {\n assertValidPresentationConfiguration(options?.presentationConfiguration);\n\n const { presentationConfiguration, listener, purchaseLogic, ...rest } = options;\n const nativeOpts = {\n ...rest,\n ...resolveNativePresentationOptions(presentationConfiguration),\n };\n\n if (!listener && !purchaseLogic) {\n return nativePlugin.presentPaywallIfNeeded(nativeOpts);\n }\n\n return presentWithListenerSupport(\n (opts) => nativePlugin.presentPaywallIfNeeded(opts),\n nativeOpts,\n listener,\n purchaseLogic,\n );\n },\n\n async presentCustomerCenter(): Promise<void> {\n return nativePlugin.presentCustomerCenter();\n },\n\n setMockWebResults: nativePlugin.setMockWebResults\n ? async (options: { shouldMockWebResults: boolean }): Promise<void> => {\n return nativePlugin.setMockWebResults!(options);\n }\n : undefined,\n\n addListener(eventName: 'paywallDisplayed' | 'paywallDismissed', listener: () => void): Promise<PluginListenerHandle> {\n return nativePlugin.addListener(eventName, listener);\n },\n\n removeAllListeners(): Promise<void> {\n return nativePlugin.removeAllListeners();\n },\n};\n\nexport * from './definitions';\nexport { PAYWALL_RESULT } from '@revenuecat/purchases-typescript-internal-esm';\nexport { RevenueCatUI };\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAE5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,+CAA+C,CAAC;AAexF,OAAO,EACL,sBAAsB,EACtB,8BAA8B,EAC9B,kCAAkC,EAClC,qBAAqB,GACtB,MAAM,eAAe,CAAC;AAiDvB,MAAM,YAAY,GAAG,cAAc,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C,CAAC;AAC/E,OAAO,EAAE,YAAY,EAAE,CAAC","sourcesContent":["import { Capacitor, registerPlugin } from '@capacitor/core';\nimport type { PluginListenerHandle } from '@capacitor/core';\nimport { normalizePurchasesError } from '@revenuecat/purchases-typescript-internal-esm';\nimport type { PurchasesError } from '@revenuecat/purchases-typescript-internal-esm';\n\nimport type {\n CheckpointParams,\n CheckpointResult,\n PaywallListener,\n PaywallPresentationConfiguration,\n PaywallResult,\n PresentPaywallIfNeededOptions,\n PresentPaywallOptions,\n PurchaseLogic,\n PurchaseLogicResult,\n RevenueCatUIPlugin,\n} from './definitions';\nimport {\n FLOW_PRESENTATION_MODE,\n IOS_PAYWALL_PRESENTATION_STYLE,\n ANDROID_PAYWALL_PRESENTATION_STYLE,\n PURCHASE_LOGIC_RESULT,\n} from './definitions';\n\n/**\n * Internal native plugin interface with native-only methods and events.\n * This is not exported to consumers.\n */\ninterface RevenueCatUINativePlugin {\n checkpoint(options: {\n identifier: string;\n callId: string;\n customVariables?: Record<string, string | number | boolean>;\n presentationMode: FLOW_PRESENTATION_MODE;\n }): Promise<void>;\n presentPaywall(options: {\n offering?: any;\n useFullScreenPresentation?: boolean;\n displayCloseButton?: boolean;\n hasPaywallListener?: boolean;\n hasPurchaseLogic?: boolean;\n customVariables?: Record<string, string | number | boolean>;\n }): Promise<PaywallResult>;\n presentPaywallIfNeeded(options: {\n offering?: any;\n useFullScreenPresentation?: boolean;\n displayCloseButton?: boolean;\n requiredEntitlementIdentifier: string;\n hasPaywallListener?: boolean;\n hasPurchaseLogic?: boolean;\n customVariables?: Record<string, string | number | boolean>;\n }): Promise<PaywallResult>;\n presentCustomerCenter(): Promise<void>;\n setMockWebResults?(options: { shouldMockWebResults: boolean }): Promise<void>;\n\n resumePurchaseInitiated(options: { requestId: string; shouldProceed: boolean }): Promise<void>;\n resumePurchaseLogicPurchase(options: {\n requestId: string;\n result: string;\n error?: { code?: string; message?: string };\n }): Promise<void>;\n resumePurchaseLogicRestore(options: {\n requestId: string;\n result: string;\n error?: { code?: string; message?: string };\n }): Promise<void>;\n\n addListener(eventName: string, listener: (data: any) => void): Promise<PluginListenerHandle>;\n removeAllListeners(): Promise<void>;\n}\n\nconst nativePlugin = registerPlugin<RevenueCatUINativePlugin>('RevenueCatUI', {\n web: () => import('./web').then((m) => new m.RevenueCatUIWeb()),\n});\n\nfunction assertValidPresentationConfiguration(\n config: unknown,\n): asserts config is PaywallPresentationConfiguration | undefined {\n if (config === undefined) {\n return;\n }\n if (typeof config !== 'object' || config === null) {\n throw new Error(`Invalid presentationConfiguration: expected an object or undefined.`);\n }\n const { ios, android } = config as Record<string, unknown>;\n const validIos = Object.values(IOS_PAYWALL_PRESENTATION_STYLE) as string[];\n const validAndroid = Object.values(ANDROID_PAYWALL_PRESENTATION_STYLE) as string[];\n if (ios !== undefined && !validIos.includes(ios as string)) {\n throw new Error(`Invalid presentationConfiguration.ios \"${String(ios)}\". Expected one of: ${validIos.join(', ')}.`);\n }\n if (android !== undefined && !validAndroid.includes(android as string)) {\n throw new Error(\n `Invalid presentationConfiguration.android \"${String(android)}\". Expected one of: ${validAndroid.join(', ')}.`,\n );\n }\n}\n\nfunction resolveNativePresentationOptions(config?: PaywallPresentationConfiguration): {\n useFullScreenPresentation?: boolean;\n} {\n if (!config) {\n return {};\n }\n // iOS full-screen takes precedence as the flag that the native bridge understands\n if (config.ios === IOS_PAYWALL_PRESENTATION_STYLE.FULL_SCREEN) {\n return { useFullScreenPresentation: true };\n }\n return {};\n}\n\nfunction serializeResultForNative(result: PurchaseLogicResult): {\n result: string;\n error?: { code?: string; message?: string };\n} {\n if (result.result === PURCHASE_LOGIC_RESULT.ERROR && 'error' in result && result.error) {\n return {\n result: result.result,\n error: {\n code: result.error.code,\n message: result.error.message,\n },\n };\n }\n return { result: result.result };\n}\n\nasync function presentWithListenerSupport(\n nativeMethod: (options: any) => Promise<PaywallResult>,\n options: any,\n listener?: PaywallListener,\n purchaseLogic?: PurchaseLogic,\n): Promise<PaywallResult> {\n const handles: PluginListenerHandle[] = [];\n\n try {\n // Register PaywallListener event handlers\n if (listener) {\n if (listener.onPurchaseStarted) {\n const cb = listener.onPurchaseStarted;\n handles.push(\n await nativePlugin.addListener('onPurchaseStarted', (data: any) => {\n cb({ packageBeingPurchased: data.packageBeingPurchased ?? data });\n }),\n );\n }\n if (listener.onPurchaseCompleted) {\n const cb = listener.onPurchaseCompleted;\n handles.push(\n await nativePlugin.addListener('onPurchaseCompleted', (data: any) => {\n cb({\n customerInfo: data.customerInfo,\n storeTransaction: data.storeTransaction,\n });\n }),\n );\n }\n if (listener.onPurchaseError) {\n const cb = listener.onPurchaseError;\n handles.push(\n await nativePlugin.addListener('onPurchaseError', (data: any) => {\n cb({ error: normalizePurchasesError(data.error ?? data) as PurchasesError });\n }),\n );\n }\n if (listener.onPurchaseCancelled) {\n const cb = listener.onPurchaseCancelled;\n handles.push(\n await nativePlugin.addListener('onPurchaseCancelled', () => {\n cb();\n }),\n );\n }\n if (listener.onRestoreStarted) {\n const cb = listener.onRestoreStarted;\n handles.push(\n await nativePlugin.addListener('onRestoreStarted', () => {\n cb();\n }),\n );\n }\n if (listener.onRestoreCompleted) {\n const cb = listener.onRestoreCompleted;\n handles.push(\n await nativePlugin.addListener('onRestoreCompleted', (data: any) => {\n cb({ customerInfo: data.customerInfo ?? data });\n }),\n );\n }\n if (listener.onRestoreError) {\n const cb = listener.onRestoreError;\n handles.push(\n await nativePlugin.addListener('onRestoreError', (data: any) => {\n cb({ error: normalizePurchasesError(data.error ?? data) as PurchasesError });\n }),\n );\n }\n if (listener.onWebCheckoutOpened) {\n const cb = listener.onWebCheckoutOpened;\n handles.push(\n await nativePlugin.addListener('onWebCheckoutOpened', () => {\n cb();\n }),\n );\n }\n if (listener.onUrlOpened) {\n const cb = listener.onUrlOpened;\n handles.push(\n await nativePlugin.addListener('onUrlOpened', (data: any) => {\n cb({ url: data.url });\n }),\n );\n }\n if (listener.onInteraction) {\n handles.push(await nativePlugin.addListener('onInteraction', listener.onInteraction));\n }\n }\n\n // Always register onPurchaseInitiated so we auto-resume when the user\n // doesn't provide an onPurchaseInitiated callback — otherwise the\n // purchase flow hangs waiting for a resume that never comes.\n // This must be outside the `if (listener)` block because the native\n // delegate adapter always fires this event (even with purchaseLogic only).\n const onPurchaseInitiatedCb = listener?.onPurchaseInitiated;\n handles.push(\n await nativePlugin.addListener('onPurchaseInitiated', (data: any) => {\n const requestId: string = data.requestId;\n const packageBeingPurchased = data.package ?? data.packageBeingPurchased;\n if (onPurchaseInitiatedCb) {\n onPurchaseInitiatedCb({\n packageBeingPurchased,\n resumable: {\n resume(shouldProceed = true) {\n nativePlugin.resumePurchaseInitiated({ requestId, shouldProceed });\n },\n },\n });\n } else {\n // No callback provided — auto-proceed with the purchase.\n nativePlugin.resumePurchaseInitiated({ requestId, shouldProceed: true });\n }\n }),\n );\n\n // Register PurchaseLogic event handlers\n if (purchaseLogic) {\n handles.push(\n await nativePlugin.addListener('onPerformPurchaseRequest', async (data: any) => {\n const requestId: string = data.requestId;\n const packageToPurchase = data.package ?? data.packageBeingPurchased ?? data.packageToPurchase;\n try {\n const result = await purchaseLogic.performPurchase({ packageToPurchase });\n await nativePlugin.resumePurchaseLogicPurchase({\n requestId,\n ...serializeResultForNative(result),\n });\n } catch (e: any) {\n await nativePlugin.resumePurchaseLogicPurchase({\n requestId,\n result: PURCHASE_LOGIC_RESULT.ERROR,\n error: { message: e?.message ?? 'Unknown error' },\n });\n }\n }),\n );\n handles.push(\n await nativePlugin.addListener('onPerformRestoreRequest', async (data: any) => {\n const requestId: string = data.requestId;\n try {\n const result = await purchaseLogic.performRestore();\n await nativePlugin.resumePurchaseLogicRestore({\n requestId,\n ...serializeResultForNative(result),\n });\n } catch (e: any) {\n await nativePlugin.resumePurchaseLogicRestore({\n requestId,\n result: PURCHASE_LOGIC_RESULT.ERROR,\n error: { message: e?.message ?? 'Unknown error' },\n });\n }\n }),\n );\n }\n\n // Call native with serializable-only options\n const nativeOptions = {\n ...options,\n hasPaywallListener: !!listener,\n hasPurchaseLogic: !!purchaseLogic,\n };\n // Remove non-serializable fields\n delete nativeOptions.listener;\n delete nativeOptions.purchaseLogic;\n\n return await nativeMethod(nativeOptions);\n } finally {\n // Clean up all registered listeners\n for (const handle of handles) {\n await handle.remove();\n }\n }\n}\n\nconst checkpointCallIdPrefix = `${Date.now()}-${Math.random()}`;\nlet nextCheckpointCallId = 0;\n\nconst RevenueCatUI: RevenueCatUIPlugin = {\n async checkpoint(\n identifier: string,\n onPassed: (result: CheckpointResult) => void,\n params: CheckpointParams = {},\n ): Promise<() => Promise<void>> {\n if (Capacitor.getPlatform() !== 'ios' && Capacitor.getPlatform() !== 'android') {\n throw new Error('[RevenueCatUI] Checkpoints require a native iOS or Android build.');\n }\n const callId = `${checkpointCallIdPrefix}-${++nextCheckpointCallId}`;\n let active = true;\n let removal: Promise<void> | undefined;\n // Register before starting: an unconfigured checkpoint identifier may pass immediately.\n const handle = await nativePlugin.addListener(\n 'checkpointPassed',\n (event: { callId: string; result: CheckpointResult }) => {\n if (!active || event.callId !== callId) return;\n active = false;\n removal = handle.remove();\n void removal.catch((error) => console.warn('[RevenueCatUI] Failed to remove checkpoint listener:', error));\n onPassed(event.result);\n },\n );\n const remove = (): Promise<void> => {\n active = false;\n return (removal ??= handle.remove());\n };\n try {\n await nativePlugin.checkpoint({\n identifier,\n callId,\n ...(params.customVariables !== undefined ? { customVariables: params.customVariables } : {}),\n presentationMode: params.presentationMode ?? FLOW_PRESENTATION_MODE.DEFAULT,\n });\n } catch (error) {\n await remove().catch((cleanupError) =>\n console.warn('[RevenueCatUI] Failed to remove checkpoint listener:', cleanupError),\n );\n throw error;\n }\n return remove;\n },\n\n async presentPaywall(options?: PresentPaywallOptions): Promise<PaywallResult> {\n assertValidPresentationConfiguration(options?.presentationConfiguration);\n\n const { presentationConfiguration, listener, purchaseLogic, ...rest } = options ?? {};\n const nativeOpts = {\n ...rest,\n ...resolveNativePresentationOptions(presentationConfiguration),\n };\n\n if (!listener && !purchaseLogic) {\n return nativePlugin.presentPaywall(nativeOpts);\n }\n\n return presentWithListenerSupport((opts) => nativePlugin.presentPaywall(opts), nativeOpts, listener, purchaseLogic);\n },\n\n async presentPaywallIfNeeded(options: PresentPaywallIfNeededOptions): Promise<PaywallResult> {\n assertValidPresentationConfiguration(options?.presentationConfiguration);\n\n const { presentationConfiguration, listener, purchaseLogic, ...rest } = options;\n const nativeOpts = {\n ...rest,\n ...resolveNativePresentationOptions(presentationConfiguration),\n };\n\n if (!listener && !purchaseLogic) {\n return nativePlugin.presentPaywallIfNeeded(nativeOpts);\n }\n\n return presentWithListenerSupport(\n (opts) => nativePlugin.presentPaywallIfNeeded(opts),\n nativeOpts,\n listener,\n purchaseLogic,\n );\n },\n\n async presentCustomerCenter(): Promise<void> {\n return nativePlugin.presentCustomerCenter();\n },\n\n setMockWebResults: nativePlugin.setMockWebResults\n ? async (options: { shouldMockWebResults: boolean }): Promise<void> => {\n return nativePlugin.setMockWebResults!(options);\n }\n : undefined,\n\n addListener(eventName: 'paywallDisplayed' | 'paywallDismissed', listener: () => void): Promise<PluginListenerHandle> {\n return nativePlugin.addListener(eventName, listener);\n },\n\n removeAllListeners(): Promise<void> {\n return nativePlugin.removeAllListeners();\n },\n};\n\nexport * from './definitions';\nexport { PAYWALL_RESULT } from '@revenuecat/purchases-typescript-internal-esm';\nexport { RevenueCatUI };\n"]}
package/dist/esm/web.d.ts CHANGED
@@ -1,10 +1,11 @@
1
1
  import { WebPlugin } from '@capacitor/core';
2
2
  import type { PluginListenerHandle } from '@capacitor/core';
3
- import type { PaywallResult, PresentPaywallIfNeededOptions, PresentPaywallOptions, RevenueCatUIPlugin } from './definitions';
3
+ import type { CheckpointParams, CheckpointResult, PaywallResult, PresentPaywallIfNeededOptions, PresentPaywallOptions, RevenueCatUIPlugin } from './definitions';
4
4
  export declare class RevenueCatUIWeb extends WebPlugin implements RevenueCatUIPlugin {
5
5
  private shouldMockWebResults;
6
6
  private webNotSupportedErrorMessage;
7
7
  constructor();
8
+ checkpoint(_identifier: string, _onPassed: (result: CheckpointResult) => void, _params?: CheckpointParams): Promise<() => Promise<void>>;
8
9
  setMockWebResults(options: {
9
10
  shouldMockWebResults: boolean;
10
11
  }): Promise<void>;
package/dist/esm/web.js CHANGED
@@ -6,6 +6,9 @@ export class RevenueCatUIWeb extends WebPlugin {
6
6
  this.shouldMockWebResults = false;
7
7
  this.webNotSupportedErrorMessage = 'RevenueCatUI is not supported on web platforms.';
8
8
  }
9
+ async checkpoint(_identifier, _onPassed, _params) {
10
+ throw this.unimplemented('Checkpoints require a native iOS or Android build.');
11
+ }
9
12
  async setMockWebResults(options) {
10
13
  this.shouldMockWebResults = options.shouldMockWebResults;
11
14
  return Promise.resolve();
@@ -1 +1 @@
1
- {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAC;AAS/E,MAAM,OAAO,eAAgB,SAAQ,SAAS;IAI5C;QACE,KAAK,EAAE,CAAC;QAJF,yBAAoB,GAAG,KAAK,CAAC;QAC7B,gCAA2B,GAAG,iDAAiD,CAAC;IAIxF,CAAC;IAED,KAAK,CAAC,iBAAiB,CAAC,OAA0C;QAChE,IAAI,CAAC,oBAAoB,GAAG,OAAO,CAAC,oBAAoB,CAAC;QACzD,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,OAA+B;QAClD,OAAO,IAAI,CAAC,8BAA8B,CACxC,gBAAgB,EAChB;YACE,MAAM,EAAE,cAAc,CAAC,aAAa;SACrC,EACD,OAAO,CACR,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,sBAAsB,CAAC,OAAsC;QACjE,OAAO,IAAI,CAAC,8BAA8B,CACxC,wBAAwB,EACxB;YACE,MAAM,EAAE,cAAc,CAAC,aAAa;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AA2B,CAAC,CAAC;QAC1D,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,GAAG,YAAY,6DAA6D,EAAE,OAAO,CAAC,CAAC;QACnG,OAAO,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IACtC,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\nimport type { PluginListenerHandle } from '@capacitor/core';\nimport { PAYWALL_RESULT } from '@revenuecat/purchases-typescript-internal-esm';\n\nimport type {\n PaywallResult,\n PresentPaywallIfNeededOptions,\n PresentPaywallOptions,\n RevenueCatUIPlugin,\n} from './definitions';\n\nexport class RevenueCatUIWeb extends WebPlugin implements RevenueCatUIPlugin {\n private shouldMockWebResults = false;\n private webNotSupportedErrorMessage = 'RevenueCatUI is not supported on web platforms.';\n\n constructor() {\n super();\n }\n\n async setMockWebResults(options: { shouldMockWebResults: boolean }): Promise<void> {\n this.shouldMockWebResults = options.shouldMockWebResults;\n return Promise.resolve();\n }\n\n async presentPaywall(options?: PresentPaywallOptions): Promise<PaywallResult> {\n return this.mockReturningFunctionIfEnabled(\n 'presentPaywall',\n {\n result: PAYWALL_RESULT.NOT_PRESENTED,\n },\n options,\n );\n }\n\n async presentPaywallIfNeeded(options: PresentPaywallIfNeededOptions): Promise<PaywallResult> {\n return this.mockReturningFunctionIfEnabled(\n 'presentPaywallIfNeeded',\n {\n result: PAYWALL_RESULT.NOT_PRESENTED,\n },\n options,\n );\n }\n\n async presentCustomerCenter(): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('presentCustomerCenter');\n }\n\n async resumePurchaseInitiated(_options: { requestId: string; shouldProceed: boolean }): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('resumePurchaseInitiated');\n }\n\n async resumePurchaseLogicPurchase(_options: {\n requestId: string;\n result: string;\n error?: { code?: string; message?: string };\n }): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('resumePurchaseLogicPurchase');\n }\n\n async resumePurchaseLogicRestore(_options: {\n requestId: string;\n result: string;\n error?: { code?: string; message?: string };\n }): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('resumePurchaseLogicRestore');\n }\n\n addListener(eventName: string, listener: (...args: any[]) => void): Promise<PluginListenerHandle> {\n if (eventName !== 'paywallDisplayed' && eventName !== 'paywallDismissed') {\n console.warn(`Unsupported event: ${eventName}`);\n }\n return super.addListener(eventName, listener);\n }\n\n removeAllListeners(): Promise<void> {\n return super.removeAllListeners();\n }\n\n private mockNonReturningFunctionIfEnabled(functionName: string): Promise<void> {\n if (!this.shouldMockWebResults) {\n return Promise.reject(this.webNotSupportedErrorMessage);\n }\n console.log(`${functionName} called on web with mocking enabled. No-op`);\n return Promise.resolve();\n }\n\n private mockReturningFunctionIfEnabled<T>(functionName: string, returnValue: T, options?: any): Promise<T> {\n if (!this.shouldMockWebResults) {\n return Promise.reject(this.webNotSupportedErrorMessage);\n }\n console.log(`${functionName} called on web with mocking enabled. Returning mocked value`, options);\n return Promise.resolve(returnValue);\n }\n}\n"]}
1
+ {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAC;AAW/E,MAAM,OAAO,eAAgB,SAAQ,SAAS;IAI5C;QACE,KAAK,EAAE,CAAC;QAJF,yBAAoB,GAAG,KAAK,CAAC;QAC7B,gCAA2B,GAAG,iDAAiD,CAAC;IAIxF,CAAC;IAED,KAAK,CAAC,UAAU,CACd,WAAmB,EACnB,SAA6C,EAC7C,OAA0B;QAE1B,MAAM,IAAI,CAAC,aAAa,CAAC,oDAAoD,CAAC,CAAC;IACjF,CAAC;IAED,KAAK,CAAC,iBAAiB,CAAC,OAA0C;QAChE,IAAI,CAAC,oBAAoB,GAAG,OAAO,CAAC,oBAAoB,CAAC;QACzD,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;IAED,KAAK,C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CAAC;QACD,OAAO,CAAC,GAAG,CAAC,GAAG,YAAY,4CAA4C,CAAC,CAAC;QACzE,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;IAEO,8BAA8B,CAAI,YAAoB,EAAE,WAAc,EAAE,OAAa;QAC3F,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC;YAC/B,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;QAC1D,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,GAAG,YAAY,6DAA6D,EAAE,OAAO,CAAC,CAAC;QACnG,OAAO,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IACtC,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\nimport type { PluginListenerHandle } from '@capacitor/core';\nimport { PAYWALL_RESULT } from '@revenuecat/purchases-typescript-internal-esm';\n\nimport type {\n CheckpointParams,\n CheckpointResult,\n PaywallResult,\n PresentPaywallIfNeededOptions,\n PresentPaywallOptions,\n RevenueCatUIPlugin,\n} from './definitions';\n\nexport class RevenueCatUIWeb extends WebPlugin implements RevenueCatUIPlugin {\n private shouldMockWebResults = false;\n private webNotSupportedErrorMessage = 'RevenueCatUI is not supported on web platforms.';\n\n constructor() {\n super();\n }\n\n async checkpoint(\n _identifier: string,\n _onPassed: (result: CheckpointResult) => void,\n _params?: CheckpointParams,\n ): Promise<() => Promise<void>> {\n throw this.unimplemented('Checkpoints require a native iOS or Android build.');\n }\n\n async setMockWebResults(options: { shouldMockWebResults: boolean }): Promise<void> {\n this.shouldMockWebResults = options.shouldMockWebResults;\n return Promise.resolve();\n }\n\n async presentPaywall(options?: PresentPaywallOptions): Promise<PaywallResult> {\n return this.mockReturningFunctionIfEnabled(\n 'presentPaywall',\n {\n result: PAYWALL_RESULT.NOT_PRESENTED,\n },\n options,\n );\n }\n\n async presentPaywallIfNeeded(options: PresentPaywallIfNeededOptions): Promise<PaywallResult> {\n return this.mockReturningFunctionIfEnabled(\n 'presentPaywallIfNeeded',\n {\n result: PAYWALL_RESULT.NOT_PRESENTED,\n },\n options,\n );\n }\n\n async presentCustomerCenter(): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('presentCustomerCenter');\n }\n\n async resumePurchaseInitiated(_options: { requestId: string; shouldProceed: boolean }): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('resumePurchaseInitiated');\n }\n\n async resumePurchaseLogicPurchase(_options: {\n requestId: string;\n result: string;\n error?: { code?: string; message?: string };\n }): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('resumePurchaseLogicPurchase');\n }\n\n async resumePurchaseLogicRestore(_options: {\n requestId: string;\n result: string;\n error?: { code?: string; message?: string };\n }): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('resumePurchaseLogicRestore');\n }\n\n addListener(eventName: string, listener: (...args: any[]) => void): Promise<PluginListenerHandle> {\n if (eventName !== 'paywallDisplayed' && eventName !== 'paywallDismissed') {\n console.warn(`Unsupported event: ${eventName}`);\n }\n return super.addListener(eventName, listener);\n }\n\n removeAllListeners(): Promise<void> {\n return super.removeAllListeners();\n }\n\n private mockNonReturningFunctionIfEnabled(functionName: string): Promise<void> {\n if (!this.shouldMockWebResults) {\n return Promise.reject(this.webNotSupportedErrorMessage);\n }\n console.log(`${functionName} called on web with mocking enabled. No-op`);\n return Promise.resolve();\n }\n\n private mockReturningFunctionIfEnabled<T>(functionName: string, returnValue: T, options?: any): Promise<T> {\n if (!this.shouldMockWebResults) {\n return Promise.reject(this.webNotSupportedErrorMessage);\n }\n console.log(`${functionName} called on web with mocking enabled. Returning mocked value`, options);\n return Promise.resolve(returnValue);\n }\n}\n"]}
package/dist/plugin.js CHANGED
@@ -722,6 +722,16 @@ var capacitorPlugin = (function (exports, core) {
722
722
  WebPurchaseRedemptionResultType["EXPIRED"] = "EXPIRED";
723
723
  })(WebPurchaseRedemptionResultType || (WebPurchaseRedemptionResultType = {}));
724
724
 
725
+ /** How the native SDK presents the flow selected by a checkpoint. */
726
+ exports.FLOW_PRESENTATION_MODE = void 0;
727
+ (function (FLOW_PRESENTATION_MODE) {
728
+ /** Let the native SDK choose how to present the flow. */
729
+ FLOW_PRESENTATION_MODE["DEFAULT"] = "DEFAULT";
730
+ /** Present the flow as a modal that covers the whole screen. */
731
+ FLOW_PRESENTATION_MODE["MODAL_FULL_SCREEN"] = "MODAL_FULL_SCREEN";
732
+ /** Present the flow as a modal sheet over the app's content. */
733
+ FLOW_PRESENTATION_MODE["MODAL_SHEET"] = "MODAL_SHEET";
734
+ })(exports.FLOW_PRESENTATION_MODE || (exports.FLOW_PRESENTATION_MODE = {}));
725
735
  /**
726
736
  * Possible outcomes from a custom {@link PurchaseLogic} operation.
727
737
  */
@@ -956,7 +966,40 @@ var capacitorPlugin = (function (exports, core) {
956
966
  }
957
967
  }
958
968
  }
969
+ const checkpointCallIdPrefix = `${Date.now()}-${Math.random()}`;
970
+ let nextCheckpointCallId = 0;
959
971
  const RevenueCatUI = {
972
+ async checkpoint(identifier, onPassed, params = {}) {
973
+ var _a;
974
+ if (core.Capacitor.getPlatform() !== 'ios' && core.Capacitor.getPlatform() !== 'android') {
975
+ throw new Error('[RevenueCatUI] Checkpoints require a native iOS or Android build.');
976
+ }
977
+ const callId = `${checkpointCallIdPrefix}-${++nextCheckpointCallId}`;
978
+ let active = true;
979
+ let removal;
980
+ // Register before starting: an unconfigured checkpoint identifier may pass immediately.
981
+ const handle = await nativePlugin.addListener('checkpointPassed', (event) => {
982
+ if (!active || event.callId !== callId)
983
+ return;
984
+ active = false;
985
+ removal = handle.remove();
986
+ void removal.catch((error) => console.warn('[RevenueCatUI] Failed to remove checkpoint listener:', error));
987
+ onPassed(event.result);
988
+ });
989
+ const remove = () => {
990
+ active = false;
991
+ return (removal !== null && removal !== void 0 ? removal : (removal = handle.remove()));
992
+ };
993
+ try {
994
+ await nativePlugin.checkpoint(Object.assign(Object.assign({ identifier,
995
+ callId }, (params.customVariables !== undefined ? { customVariables: params.customVariables } : {})), { presentationMode: (_a = params.presentationMode) !== null && _a !== void 0 ? _a : exports.FLOW_PRESENTATION_MODE.DEFAULT }));
996
+ }
997
+ catch (error) {
998
+ await remove().catch((cleanupError) => console.warn('[RevenueCatUI] Failed to remove checkpoint listener:', cleanupError));
999
+ throw error;
1000
+ }
1001
+ return remove;
1002
+ },
960
1003
  async presentPaywall(options) {
961
1004
  assertValidPresentationConfiguration(options === null || options === void 0 ? void 0 : options.presentationConfiguration);
962
1005
  const _a = options !== null && options !== void 0 ? options : {}, { presentationConfiguration, listener, purchaseLogic } = _a, rest = __rest(_a, ["presentationConfiguration", "listener", "purchaseLogic"]);
@@ -997,6 +1040,9 @@ var capacitorPlugin = (function (exports, core) {
997
1040
  this.shouldMockWebResults = false;
998
1041
  this.webNotSupportedErrorMessage = 'RevenueCatUI is not supported on web platforms.';
999
1042
  }
1043
+ async checkpoint(_identifier, _onPassed, _params) {
1044
+ throw this.unimplemented('Checkpoints require a native iOS or Android build.');
1045
+ }
1000
1046
  async setMockWebResults(options) {
1001
1047
  this.shouldMockWebResults = options.shouldMockWebResults;
1002
1048
  return Promise.resolve();
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sources":["../node_modules/@revenuecat/purchases-typescript-internal-esm/dist/generated/error-codes.js","../node_modules/@revenuecat/purchases-typescript-internal-esm/dist/errors.js","../node_modules/@revenuecat/purchases-typescript-internal-esm/dist/errorNormalizer.js","../node_modules/@revenuecat/purchases-typescript-internal-esm/dist/offerings.js","../node_modules/@revenuecat/purchases-typescript-internal-esm/dist/enums.js","../node_modules/@revenuecat/purchases-typescript-internal-esm/dist/webRedemption.js","esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["// @generated\n// DO NOT EDIT THIS FILE — generated from https://github.com/RevenueCat/purchases-error-codes\n/**\n * Error codes indicating the reason for an error.\n * @public\n */\nexport var PURCHASES_ERROR_CODE;\n(function (PURCHASES_ERROR_CODE) {\n PURCHASES_ERROR_CODE[\"UNKNOWN_ERROR\"] = \"0\";\n PURCHASES_ERROR_CODE[\"PURCHASE_CANCELLED_ERROR\"] = \"1\";\n PURCHASES_ERROR_CODE[\"STORE_PROBLEM_ERROR\"] = \"2\";\n PURCHASES_ERROR_CODE[\"PURCHASE_NOT_ALLOWED_ERROR\"] = \"3\";\n PURCHASES_ERROR_CODE[\"PURCHASE_INVALID_ERROR\"] = \"4\";\n PURCHASES_ERROR_CODE[\"PRODUCT_NOT_AVAILABLE_FOR_PURCHASE_ERROR\"] = \"5\";\n PURCHASES_ERROR_CODE[\"PRODUCT_ALREADY_PURCHASED_ERROR\"] = \"6\";\n PURCHASES_ERROR_CODE[\"RECEIPT_ALREADY_IN_USE_ERROR\"] = \"7\";\n PURCHASES_ERROR_CODE[\"INVALID_RECEIPT_ERROR\"] = \"8\";\n PURCHASES_ERROR_CODE[\"MISSING_RECEIPT_FILE_ERROR\"] = \"9\";\n PURCHASES_ERROR_CODE[\"NETWORK_ERROR\"] = \"10\";\n PURCHASES_ERROR_CODE[\"INVALID_CREDENTIALS_ERROR\"] = \"11\";\n PURCHASES_ERROR_CODE[\"UNEXPECTED_BACKEND_RESPONSE_ERROR\"] = \"12\";\n PURCHASES_ERROR_CODE[\"RECEIPT_IN_USE_BY_OTHER_SUBSCRIBER_ERROR\"] = \"13\";\n PURCHASES_ERROR_CODE[\"INVALID_APP_USER_ID_ERROR\"] = \"14\";\n PURCHASES_ERROR_CODE[\"OPERATION_ALREADY_IN_PROGRESS_ERROR\"] = \"15\";\n PURCHASES_ERROR_CODE[\"UNKNOWN_BACKEND_ERROR\"] = \"16\";\n PURCHASES_ERROR_CODE[\"INVALID_APPLE_SUBSCRIPTION_KEY_ERROR\"] = \"17\";\n PURCHASES_ERROR_CODE[\"INELIGIBLE_ERROR\"] = \"18\";\n PURCHASES_ERROR_CODE[\"INSUFFICIENT_PERMISSIONS_ERROR\"] = \"19\";\n PURCHASES_ERROR_CODE[\"PAYMENT_PENDING_ERROR\"] = \"20\";\n PURCHASES_ERROR_CODE[\"INVALID_SUBSCRIBER_ATTRIBUTES_ERROR\"] = \"21\";\n PURCHASES_ERROR_CODE[\"LOG_OUT_ANONYMOUS_USER_ERROR\"] = \"22\";\n PURCHASES_ERROR_CODE[\"CONFIGURATION_ERROR\"] = \"23\";\n PURCHASES_ERROR_CODE[\"UNSUPPORTED_ERROR\"] = \"24\";\n PURCHASES_ERROR_CODE[\"EMPTY_SUBSCRIBER_ATTRIBUTES_ERROR\"] = \"25\";\n PURCHASES_ERROR_CODE[\"PRODUCT_DISCOUNT_MISSING_IDENTIFIER_ERROR\"] = \"26\";\n PURCHASES_ERROR_CODE[\"PRODUCT_DISCOUNT_MISSING_SUBSCRIPTION_GROUP_IDENTIFIER_ERROR\"] = \"28\";\n PURCHASES_ERROR_CODE[\"CUSTOMER_INFO_ERROR\"] = \"29\";\n PURCHASES_ERROR_CODE[\"SYSTEM_INFO_ERROR\"] = \"30\";\n PURCHASES_ERROR_CODE[\"BEGIN_REFUND_REQUEST_ERROR\"] = \"31\";\n PURCHASES_ERROR_CODE[\"PRODUCT_REQUEST_TIMED_OUT_ERROR\"] = \"32\";\n PURCHASES_ERROR_CODE[\"API_ENDPOINT_BLOCKED\"] = \"33\";\n PURCHASES_ERROR_CODE[\"INVALID_PROMOTIONAL_OFFER_ERROR\"] = \"34\";\n PURCHASES_ERROR_CODE[\"OFFLINE_CONNECTION_ERROR\"] = \"35\";\n PURCHASES_ERROR_CODE[\"FEATURE_NOT_AVAILABLE_IN_CUSTOM_ENTITLEMENTS_COMPUTATION_MODE\"] = \"36\";\n PURCHASES_ERROR_CODE[\"SIGNATURE_VERIFICATION_ERROR\"] = \"37\";\n PURCHASES_ERROR_CODE[\"FEATURE_NOT_SUPPORTED_WITH_STORE_KIT_1\"] = \"38\";\n PURCHASES_ERROR_CODE[\"INVALID_WEB_PURCHASE_TOKEN\"] = \"39\";\n PURCHASES_ERROR_CODE[\"PURCHASE_BELONGS_TO_OTHER_USER\"] = \"40\";\n PURCHASES_ERROR_CODE[\"EXPIRED_WEB_PURCHASE_TOKEN\"] = \"41\";\n PURCHASES_ERROR_CODE[\"TEST_STORE_SIMULATED_PURCHASE_ERROR\"] = \"42\";\n})(PURCHASES_ERROR_CODE || (PURCHASES_ERROR_CODE = {}));\n","var __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n/* tslint:disable:max-classes-per-file */\nimport { PURCHASES_ERROR_CODE } from \"./generated/error-codes\";\nexport { PURCHASES_ERROR_CODE };\n/**\n * @internal\n */\nvar UninitializedPurchasesError = /** @class */ (function (_super) {\n __extends(UninitializedPurchasesError, _super);\n function UninitializedPurchasesError() {\n var _this = _super.call(this, \"There is no singleton instance. \" +\n \"Make sure you configure Purchases before trying to get the default instance. \" +\n \"More info here: https://errors.rev.cat/configuring-sdk\") || this;\n // Set the prototype explicitly.\n Object.setPrototypeOf(_this, UninitializedPurchasesError.prototype);\n return _this;\n }\n return UninitializedPurchasesError;\n}(Error));\nexport { UninitializedPurchasesError };\n/**\n * @internal\n */\nvar UnsupportedPlatformError = /** @class */ (function (_super) {\n __extends(UnsupportedPlatformError, _super);\n function UnsupportedPlatformError() {\n var _this = _super.call(this, \"This method is not available in the current platform.\") || this;\n // Set the prototype explicitly.\n Object.setPrototypeOf(_this, UnsupportedPlatformError.prototype);\n return _this;\n }\n return UnsupportedPlatformError;\n}(Error));\nexport { UnsupportedPlatformError };\n/**\n * Returns whether the given value is a {@link PurchasesError} thrown by the SDK.\n *\n * A value qualifies when its schema matches {@link PurchasesError} and its `code` is one of the\n * {@link PURCHASES_ERROR_CODE} values.\n *\n * @public\n */\nexport function isPurchasesError(error) {\n if (typeof error !== \"object\" || error === null) {\n return false;\n }\n if (!(\"code\" in error) || typeof error.code !== \"string\") {\n return false;\n }\n if (!(\"message\" in error) || typeof error.message !== \"string\") {\n return false;\n }\n if (!(\"userInfo\" in error) || typeof error.userInfo !== \"object\" || error.userInfo == null) {\n return false;\n }\n if (!((\"readableErrorCode\") in error.userInfo) || typeof error.userInfo.readableErrorCode !== \"string\") {\n return false;\n }\n if (!(\"underlyingErrorMessage\" in error) || typeof error.underlyingErrorMessage !== \"string\") {\n return false;\n }\n var code = error.code;\n var knownErrorCodes = new Set(Object.values(PURCHASES_ERROR_CODE));\n return typeof code === \"string\" && knownErrorCodes.has(code);\n}\n","var __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nimport { PURCHASES_ERROR_CODE } from \"./generated/error-codes\";\n/**\n * React Native nests `ErrorContainer.info` under `userInfo`, Capacitor under `data`,\n * and `purchases-js-hybrid-mappings` under `info`.\n */\nvar PAYLOAD_KEYS = [\"userInfo\", \"data\", \"info\"];\nfunction isRecord(value) {\n return typeof value === \"object\" && value !== null;\n}\nfunction readPayload(error) {\n for (var _i = 0, PAYLOAD_KEYS_1 = PAYLOAD_KEYS; _i < PAYLOAD_KEYS_1.length; _i++) {\n var key = PAYLOAD_KEYS_1[_i];\n var candidate = error[key];\n if (isRecord(candidate)) {\n return candidate;\n }\n }\n return {};\n}\nfunction firstString() {\n var values = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n values[_i] = arguments[_i];\n }\n for (var _a = 0, values_1 = values; _a < values_1.length; _a++) {\n var value = values_1[_a];\n if (typeof value === \"string\") {\n return value;\n }\n }\n return \"\";\n}\n/**\n * Every code the SDK emits is a PURCHASES_ERROR_CODE value, which is always numeric.\n * Plugin level rejections use names such as \"UNIMPLEMENTED\" or \"PAYWALL_ERROR\" and are\n * not ours to touch.\n *\n * Deliberately looser than PURCHASES_ERROR_CODE membership: that enum omits codes the\n * native SDKs emit (36 to 41), and Android and iOS disagree on 28 and 36, so matching\n * against it would reject genuine errors.\n */\nfunction readCode(error, payload) {\n var _a;\n var candidate = (_a = error.code) !== null && _a !== void 0 ? _a : payload.code;\n var code = String(candidate);\n return /^\\d+$/.test(code) ? code : undefined;\n}\n/**\n * Fills in the fields {@link PurchasesError} declares but the platform bridges\n * leave nested.\n *\n * Hybrid SDKs should call this on every error rejected by the native module,\n * then rethrow the returned value.\n *\n * The error is mutated in place and returned. Copying it into a new object\n * would discard its prototype and stack, which would break `instanceof Error`\n * for consumers and `instanceof CapacitorException` on Capacitor.\n *\n * Values the bridge did not send fall back to the same defaults the native\n * layer already applies, so the result always satisfies {@link PurchasesError}.\n *\n * Anything that is not an object, or that carries no error code, is returned\n * untouched.\n *\n * @public\n */\nexport function normalizePurchasesError(error) {\n if (!isRecord(error)) {\n return error;\n }\n var payload = readPayload(error);\n var code = readCode(error, payload);\n if (code === undefined) {\n return error;\n }\n error.code = code;\n var userInfo = __assign({}, payload);\n if (typeof userInfo.readableErrorCode !== \"string\") {\n userInfo.readableErrorCode = firstString(payload.readableErrorCode, error.readableErrorCode);\n }\n error.userInfo = userInfo;\n if (typeof error.message !== \"string\" || error.message === \"\") {\n error.message = firstString(payload.message);\n }\n if (typeof error.readableErrorCode !== \"string\") {\n error.readableErrorCode = userInfo.readableErrorCode;\n }\n if (typeof error.underlyingErrorMessage !== \"string\") {\n error.underlyingErrorMessage = firstString(payload.underlyingErrorMessage);\n }\n // The bridges only send a userCancelled flag on purchase flows, derived from this code.\n error.userCancelled = code === PURCHASES_ERROR_CODE.PURCHASE_CANCELLED_ERROR;\n return error;\n}\n","/**\n * Enum indicating possible package types.\n * @public\n */\nexport var PACKAGE_TYPE;\n(function (PACKAGE_TYPE) {\n /**\n * A package that was defined with a custom identifier.\n */\n PACKAGE_TYPE[\"UNKNOWN\"] = \"UNKNOWN\";\n /**\n * A package that was defined with a custom identifier.\n */\n PACKAGE_TYPE[\"CUSTOM\"] = \"CUSTOM\";\n /**\n * A package configured with the predefined lifetime identifier.\n */\n PACKAGE_TYPE[\"LIFETIME\"] = \"LIFETIME\";\n /**\n * A package configured with the predefined annual identifier.\n */\n PACKAGE_TYPE[\"ANNUAL\"] = \"ANNUAL\";\n /**\n * A package configured with the predefined six month identifier.\n */\n PACKAGE_TYPE[\"SIX_MONTH\"] = \"SIX_MONTH\";\n /**\n * A package configured with the predefined three month identifier.\n */\n PACKAGE_TYPE[\"THREE_MONTH\"] = \"THREE_MONTH\";\n /**\n * A package configured with the predefined two month identifier.\n */\n PACKAGE_TYPE[\"TWO_MONTH\"] = \"TWO_MONTH\";\n /**\n * A package configured with the predefined monthly identifier.\n */\n PACKAGE_TYPE[\"MONTHLY\"] = \"MONTHLY\";\n /**\n * A package configured with the predefined weekly identifier.\n */\n PACKAGE_TYPE[\"WEEKLY\"] = \"WEEKLY\";\n})(PACKAGE_TYPE || (PACKAGE_TYPE = {}));\n/**\n * Enum indicating possible eligibility status for introductory pricing.\n * @public\n */\nexport var INTRO_ELIGIBILITY_STATUS;\n(function (INTRO_ELIGIBILITY_STATUS) {\n /**\n * RevenueCat doesn't have enough information to determine eligibility.\n */\n INTRO_ELIGIBILITY_STATUS[INTRO_ELIGIBILITY_STATUS[\"INTRO_ELIGIBILITY_STATUS_UNKNOWN\"] = 0] = \"INTRO_ELIGIBILITY_STATUS_UNKNOWN\";\n /**\n * The user is not eligible for a free trial or intro pricing for this product.\n */\n INTRO_ELIGIBILITY_STATUS[INTRO_ELIGIBILITY_STATUS[\"INTRO_ELIGIBILITY_STATUS_INELIGIBLE\"] = 1] = \"INTRO_ELIGIBILITY_STATUS_INELIGIBLE\";\n /**\n * The user is eligible for a free trial or intro pricing for this product.\n */\n INTRO_ELIGIBILITY_STATUS[INTRO_ELIGIBILITY_STATUS[\"INTRO_ELIGIBILITY_STATUS_ELIGIBLE\"] = 2] = \"INTRO_ELIGIBILITY_STATUS_ELIGIBLE\";\n /**\n * There is no free trial or intro pricing for this product.\n */\n INTRO_ELIGIBILITY_STATUS[INTRO_ELIGIBILITY_STATUS[\"INTRO_ELIGIBILITY_STATUS_NO_INTRO_OFFER_EXISTS\"] = 3] = \"INTRO_ELIGIBILITY_STATUS_NO_INTRO_OFFER_EXISTS\";\n})(INTRO_ELIGIBILITY_STATUS || (INTRO_ELIGIBILITY_STATUS = {}));\n/**\n * Enum indicating possible product categories.\n * @public\n */\nexport var PRODUCT_CATEGORY;\n(function (PRODUCT_CATEGORY) {\n /**\n * A type of product for non-subscription.\n */\n PRODUCT_CATEGORY[\"NON_SUBSCRIPTION\"] = \"NON_SUBSCRIPTION\";\n /**\n * A type of product for subscriptions.\n */\n PRODUCT_CATEGORY[\"SUBSCRIPTION\"] = \"SUBSCRIPTION\";\n /**\n * A type of product for unknowns.\n */\n PRODUCT_CATEGORY[\"UNKNOWN\"] = \"UNKNOWN\";\n})(PRODUCT_CATEGORY || (PRODUCT_CATEGORY = {}));\n/**\n * Enum indicating possible product types.\n * @public\n */\nexport var PRODUCT_TYPE;\n(function (PRODUCT_TYPE) {\n /**\n * A consumable in-app purchase.\n */\n PRODUCT_TYPE[\"CONSUMABLE\"] = \"CONSUMABLE\";\n /**\n * A non-consumable in-app purchase. Only applies to Apple Store products.\n */\n PRODUCT_TYPE[\"NON_CONSUMABLE\"] = \"NON_CONSUMABLE\";\n /**\n * A non-renewing subscription. Only applies to Apple Store products.\n */\n PRODUCT_TYPE[\"NON_RENEWABLE_SUBSCRIPTION\"] = \"NON_RENEWABLE_SUBSCRIPTION\";\n /**\n * An auto-renewable subscription.\n */\n PRODUCT_TYPE[\"AUTO_RENEWABLE_SUBSCRIPTION\"] = \"AUTO_RENEWABLE_SUBSCRIPTION\";\n /**\n * A subscription that is pre-paid. Only applies to Google Play products.\n */\n PRODUCT_TYPE[\"PREPAID_SUBSCRIPTION\"] = \"PREPAID_SUBSCRIPTION\";\n /**\n * Unable to determine product type.\n */\n PRODUCT_TYPE[\"UNKNOWN\"] = \"UNKNOWN\";\n})(PRODUCT_TYPE || (PRODUCT_TYPE = {}));\n/**\n * Enum with possible proration modes in a subscription upgrade or downgrade in the Play Store. Used only for Google.\n * @deprecated Use STORE_REPLACEMENT_MODE\n * @public\n */\nexport var PRORATION_MODE;\n(function (PRORATION_MODE) {\n PRORATION_MODE[PRORATION_MODE[\"UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY\"] = 0] = \"UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY\";\n /**\n * Replacement takes effect immediately, and the remaining time will be\n * prorated and credited to the user.\n */\n PRORATION_MODE[PRORATION_MODE[\"IMMEDIATE_WITH_TIME_PRORATION\"] = 1] = \"IMMEDIATE_WITH_TIME_PRORATION\";\n /**\n * Replacement takes effect immediately, and the billing cycle remains the\n * same. The price for the remaining period will be charged. This option is\n * only available for subscription upgrade.\n */\n PRORATION_MODE[PRORATION_MODE[\"IMMEDIATE_AND_CHARGE_PRORATED_PRICE\"] = 2] = \"IMMEDIATE_AND_CHARGE_PRORATED_PRICE\";\n /**\n * Replacement takes effect immediately, and the new price will be charged on\n * next recurrence time. The billing cycle stays the same.\n *\n * This is the current default behavior.\n */\n PRORATION_MODE[PRORATION_MODE[\"IMMEDIATE_WITHOUT_PRORATION\"] = 3] = \"IMMEDIATE_WITHOUT_PRORATION\";\n /**\n * Replacement takes effect when the old plan expires, and the new price will\n * be charged at the same time.\n */\n PRORATION_MODE[PRORATION_MODE[\"DEFERRED\"] = 6] = \"DEFERRED\";\n /**\n * Replacement takes effect immediately, and the user is charged full price\n * of new plan and is given a full billing cycle of subscription,\n * plus remaining prorated time from the old plan.\n */\n PRORATION_MODE[PRORATION_MODE[\"IMMEDIATE_AND_CHARGE_FULL_PRICE\"] = 5] = \"IMMEDIATE_AND_CHARGE_FULL_PRICE\";\n})(PRORATION_MODE || (PRORATION_MODE = {}));\n/**\n * Enum with possible proration modes in a subscription upgrade or downgrade in the Play Store or Galaxy Store. Used only on Android.\n * @public\n */\nexport var STORE_REPLACEMENT_MODE;\n(function (STORE_REPLACEMENT_MODE) {\n /**\n * Old subscription is cancelled, and new subscription takes effect immediately.\n * User is charged for the full price of the new subscription on the old subscription's expiration date.\n *\n * This is the default behavior for the Galaxy and Play stores.\n */\n STORE_REPLACEMENT_MODE[\"WITHOUT_PRORATION\"] = \"WITHOUT_PRORATION\";\n /**\n * Replacement takes effect immediately, and the remaining time will be\n * prorated and credited to the user. This is the current default behavior.\n */\n STORE_REPLACEMENT_MODE[\"WITH_TIME_PRORATION\"] = \"WITH_TIME_PRORATION\";\n /**\n * Replacement takes effect immediately, and the user is charged full price of new plan and is\n * given a full billing cycle of subscription, plus remaining prorated time from the old plan.\n *\n * This mode is not supported by the Galaxy Store. If it is passed to the Galaxy Store, an error will be thrown.\n */\n STORE_REPLACEMENT_MODE[\"CHARGE_FULL_PRICE\"] = \"CHARGE_FULL_PRICE\";\n /**\n * Replacement takes effect immediately, and the billing cycle remains the\n * same. The price for the remaining period will be charged. This option is\n * only available for subscription upgrade.\n */\n STORE_REPLACEMENT_MODE[\"CHARGE_PRORATED_PRICE\"] = \"CHARGE_PRORATED_PRICE\";\n /**\n * Replacement takes effect when the old plan expires, and the new price will be charged at the same time.\n */\n STORE_REPLACEMENT_MODE[\"DEFERRED\"] = \"DEFERRED\";\n})(STORE_REPLACEMENT_MODE || (STORE_REPLACEMENT_MODE = {}));\n/**\n * Enum indicating the billing plan type of an installment subscription. iOS only.\n * @public\n */\nexport var BILLING_PLAN_TYPE;\n(function (BILLING_PLAN_TYPE) {\n /**\n * The customer pays in full when purchasing the product.\n */\n BILLING_PLAN_TYPE[\"UP_FRONT\"] = \"UP_FRONT\";\n /**\n * The customer pays in monthly installments.\n */\n BILLING_PLAN_TYPE[\"MONTHLY\"] = \"MONTHLY\";\n /**\n * Unable to determine the billing plan type.\n */\n BILLING_PLAN_TYPE[\"UNKNOWN\"] = \"UNKNOWN\";\n})(BILLING_PLAN_TYPE || (BILLING_PLAN_TYPE = {}));\n/**\n * Recurrence mode for a pricing phase\n * @public\n */\nexport var RECURRENCE_MODE;\n(function (RECURRENCE_MODE) {\n /**\n * Pricing phase repeats infinitely until cancellation\n */\n RECURRENCE_MODE[RECURRENCE_MODE[\"INFINITE_RECURRING\"] = 1] = \"INFINITE_RECURRING\";\n /**\n * Pricing phase repeats for a fixed number of billing periods\n */\n RECURRENCE_MODE[RECURRENCE_MODE[\"FINITE_RECURRING\"] = 2] = \"FINITE_RECURRING\";\n /**\n * Pricing phase does not repeat\n */\n RECURRENCE_MODE[RECURRENCE_MODE[\"NON_RECURRING\"] = 3] = \"NON_RECURRING\";\n})(RECURRENCE_MODE || (RECURRENCE_MODE = {}));\n/**\n * Payment mode for offer pricing phases. Google Play only.\n * @public\n */\nexport var OFFER_PAYMENT_MODE;\n(function (OFFER_PAYMENT_MODE) {\n /**\n * Subscribers don't pay until the specified period ends\n */\n OFFER_PAYMENT_MODE[\"FREE_TRIAL\"] = \"FREE_TRIAL\";\n /**\n * Subscribers pay up front for a specified period\n */\n OFFER_PAYMENT_MODE[\"SINGLE_PAYMENT\"] = \"SINGLE_PAYMENT\";\n /**\n * Subscribers pay a discounted amount for a specified number of periods\n */\n OFFER_PAYMENT_MODE[\"DISCOUNTED_RECURRING_PAYMENT\"] = \"DISCOUNTED_RECURRING_PAYMENT\";\n})(OFFER_PAYMENT_MODE || (OFFER_PAYMENT_MODE = {}));\n/**\n * Time duration unit for Period.\n * @public\n */\nexport var PERIOD_UNIT;\n(function (PERIOD_UNIT) {\n PERIOD_UNIT[\"DAY\"] = \"DAY\";\n PERIOD_UNIT[\"WEEK\"] = \"WEEK\";\n PERIOD_UNIT[\"MONTH\"] = \"MONTH\";\n PERIOD_UNIT[\"YEAR\"] = \"YEAR\";\n PERIOD_UNIT[\"UNKNOWN\"] = \"UNKNOWN\";\n})(PERIOD_UNIT || (PERIOD_UNIT = {}));\n","/**\n * @deprecated Use PRODUCT_CATEGORY\n * @public\n */\nexport var PURCHASE_TYPE;\n(function (PURCHASE_TYPE) {\n /**\n * A type of SKU for in-app products.\n */\n PURCHASE_TYPE[\"INAPP\"] = \"inapp\";\n /**\n * A type of SKU for subscriptions.\n */\n PURCHASE_TYPE[\"SUBS\"] = \"subs\";\n})(PURCHASE_TYPE || (PURCHASE_TYPE = {}));\n/**\n * Enum for billing features.\n * Currently, these are only relevant for Google Play Android users:\n * https://developer.android.com/reference/com/android/billingclient/api/BillingClient.FeatureType\n * @public\n */\nexport var BILLING_FEATURE;\n(function (BILLING_FEATURE) {\n /**\n * Purchase/query for subscriptions.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"SUBSCRIPTIONS\"] = 0] = \"SUBSCRIPTIONS\";\n /**\n * Subscriptions update/replace.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"SUBSCRIPTIONS_UPDATE\"] = 1] = \"SUBSCRIPTIONS_UPDATE\";\n /**\n * Purchase/query for in-app items on VR.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"IN_APP_ITEMS_ON_VR\"] = 2] = \"IN_APP_ITEMS_ON_VR\";\n /**\n * Purchase/query for subscriptions on VR.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"SUBSCRIPTIONS_ON_VR\"] = 3] = \"SUBSCRIPTIONS_ON_VR\";\n /**\n * Launch a price change confirmation flow.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"PRICE_CHANGE_CONFIRMATION\"] = 4] = \"PRICE_CHANGE_CONFIRMATION\";\n})(BILLING_FEATURE || (BILLING_FEATURE = {}));\n/**\n * Enum for possible refund request results.\n * @public\n */\nexport var REFUND_REQUEST_STATUS;\n(function (REFUND_REQUEST_STATUS) {\n /**\n * Apple has received the refund request.\n */\n REFUND_REQUEST_STATUS[REFUND_REQUEST_STATUS[\"SUCCESS\"] = 0] = \"SUCCESS\";\n /**\n * User canceled submission of the refund request.\n */\n REFUND_REQUEST_STATUS[REFUND_REQUEST_STATUS[\"USER_CANCELLED\"] = 1] = \"USER_CANCELLED\";\n /**\n * There was an error with the request. See message for more details.\n */\n REFUND_REQUEST_STATUS[REFUND_REQUEST_STATUS[\"ERROR\"] = 2] = \"ERROR\";\n})(REFUND_REQUEST_STATUS || (REFUND_REQUEST_STATUS = {}));\n/**\n * Enum for possible log levels to print.\n * @public\n */\nexport var LOG_LEVEL;\n(function (LOG_LEVEL) {\n LOG_LEVEL[\"VERBOSE\"] = \"VERBOSE\";\n LOG_LEVEL[\"DEBUG\"] = \"DEBUG\";\n LOG_LEVEL[\"INFO\"] = \"INFO\";\n LOG_LEVEL[\"WARN\"] = \"WARN\";\n LOG_LEVEL[\"ERROR\"] = \"ERROR\";\n})(LOG_LEVEL || (LOG_LEVEL = {}));\n/**\n * Enum for in-app message types.\n * This can be used if you disable automatic in-app message from showing automatically.\n * Then, you can pass what type of messages you want to show in the `showInAppMessages`\n * method in Purchases.\n * @public\n */\nexport var IN_APP_MESSAGE_TYPE;\n(function (IN_APP_MESSAGE_TYPE) {\n // Make sure the enum values are in sync with those defined in iOS/Android\n /**\n * In-app messages to indicate there has been a billing issue charging the user.\n */\n IN_APP_MESSAGE_TYPE[IN_APP_MESSAGE_TYPE[\"BILLING_ISSUE\"] = 0] = \"BILLING_ISSUE\";\n /**\n * iOS-only. This message will show if you increase the price of a subscription and\n * the user needs to opt-in to the increase.\n */\n IN_APP_MESSAGE_TYPE[IN_APP_MESSAGE_TYPE[\"PRICE_INCREASE_CONSENT\"] = 1] = \"PRICE_INCREASE_CONSENT\";\n /**\n * iOS-only. StoreKit generic messages.\n */\n IN_APP_MESSAGE_TYPE[IN_APP_MESSAGE_TYPE[\"GENERIC\"] = 2] = \"GENERIC\";\n /**\n * iOS-only. This message will show if the subscriber is eligible for an iOS win-back\n * offer and will allow the subscriber to redeem the offer.\n */\n IN_APP_MESSAGE_TYPE[IN_APP_MESSAGE_TYPE[\"WIN_BACK_OFFER\"] = 3] = \"WIN_BACK_OFFER\";\n})(IN_APP_MESSAGE_TYPE || (IN_APP_MESSAGE_TYPE = {}));\n/**\n * Enum of entitlement verification modes.\n * @public\n */\nexport var ENTITLEMENT_VERIFICATION_MODE;\n(function (ENTITLEMENT_VERIFICATION_MODE) {\n /**\n * The SDK will not perform any entitlement verification.\n */\n ENTITLEMENT_VERIFICATION_MODE[\"DISABLED\"] = \"DISABLED\";\n /**\n * Enable entitlement verification.\n *\n * If verification fails, this will be indicated with [VerificationResult.FAILED] in\n * the [EntitlementInfos.verification] and [EntitlementInfo.verification] properties but parsing will not fail\n * (i.e. Entitlements will still be granted).\n *\n * This can be useful if you want to handle verification failures to display an error/warning to the user\n * or to track this situation but still grant access.\n */\n ENTITLEMENT_VERIFICATION_MODE[\"INFORMATIONAL\"] = \"INFORMATIONAL\";\n // Add ENFORCED mode once we're ready to ship it.\n // ENFORCED = \"ENFORCED\"\n})(ENTITLEMENT_VERIFICATION_MODE || (ENTITLEMENT_VERIFICATION_MODE = {}));\n/**\n * The result of the verification process. For more details check: http://rev.cat/trusted-entitlements\n *\n * This is accomplished by preventing MiTM attacks between the SDK and the RevenueCat server.\n * With verification enabled, the SDK ensures that the response created by the server was not\n * modified by a third-party, and the response received is exactly what was sent.\n *\n * - Note: Verification is only performed if enabled using PurchasesConfiguration's\n * entitlementVerificationMode property. This is disabled by default.\n *\n * @public\n */\nexport var VERIFICATION_RESULT;\n(function (VERIFICATION_RESULT) {\n /**\n * No verification was done.\n *\n * This value is returned when verification is not enabled in PurchasesConfiguration\n */\n VERIFICATION_RESULT[\"NOT_REQUESTED\"] = \"NOT_REQUESTED\";\n /**\n * Verification with our server was performed successfully.\n */\n VERIFICATION_RESULT[\"VERIFIED\"] = \"VERIFIED\";\n /**\n * Verification failed, possibly due to a MiTM attack.\n */\n VERIFICATION_RESULT[\"FAILED\"] = \"FAILED\";\n /**\n * Verification was performed on device.\n */\n VERIFICATION_RESULT[\"VERIFIED_ON_DEVICE\"] = \"VERIFIED_ON_DEVICE\";\n})(VERIFICATION_RESULT || (VERIFICATION_RESULT = {}));\n/**\n * The result of presenting a paywall. This will be the last situation the user experienced before the\n * paywall closed.\n *\n * @public\n */\nexport var PAYWALL_RESULT;\n(function (PAYWALL_RESULT) {\n /**\n * If the paywall wasn't presented. Only returned when using \"presentPaywallIfNeeded\"\n */\n PAYWALL_RESULT[\"NOT_PRESENTED\"] = \"NOT_PRESENTED\";\n /**\n * If an error happened during purchase/restoration.\n */\n PAYWALL_RESULT[\"ERROR\"] = \"ERROR\";\n /**\n * If the paywall was closed without performing an operation\n */\n PAYWALL_RESULT[\"CANCELLED\"] = \"CANCELLED\";\n /**\n * If a successful purchase happened inside the paywall\n */\n PAYWALL_RESULT[\"PURCHASED\"] = \"PURCHASED\";\n /**\n * If a successful restore happened inside the paywall\n */\n PAYWALL_RESULT[\"RESTORED\"] = \"RESTORED\";\n})(PAYWALL_RESULT || (PAYWALL_RESULT = {}));\n/**\n * Defines which version of StoreKit may be used\n * @public\n */\nexport var STOREKIT_VERSION;\n(function (STOREKIT_VERSION) {\n /**\n * Always use StoreKit 1.\n */\n STOREKIT_VERSION[\"STOREKIT_1\"] = \"STOREKIT_1\";\n /**\n * Always use StoreKit 2 (StoreKit 1 will be used if StoreKit 2 is not available in the current device.)\n * - Warning: Make sure you have an In-App Purchase Key configured in your app.\n * Please see https://rev.cat/in-app-purchase-key-configuration for more info.\n */\n STOREKIT_VERSION[\"STOREKIT_2\"] = \"STOREKIT_2\";\n /**\n * Let RevenueCat use the most appropriate version of StoreKit\n */\n STOREKIT_VERSION[\"DEFAULT\"] = \"DEFAULT\";\n})(STOREKIT_VERSION || (STOREKIT_VERSION = {}));\n/**\n * Modes for completing the purchase process.\n * @public\n */\nexport var PURCHASES_ARE_COMPLETED_BY_TYPE;\n(function (PURCHASES_ARE_COMPLETED_BY_TYPE) {\n /**\n * RevenueCat will **not** automatically acknowledge any purchases. You will have to do so manually.\n *\n * **Note:** failing to acknowledge a purchase within 3 days will lead to Google Play automatically issuing a\n * refund to the user.\n *\n * For more info, see [revenuecat.com](https://docs.revenuecat.com/docs/observer-mode#option-2-client-side).\n */\n PURCHASES_ARE_COMPLETED_BY_TYPE[\"MY_APP\"] = \"MY_APP\";\n /**\n * RevenueCat will automatically acknowledge verified purchases. No action is required by you.\n */\n PURCHASES_ARE_COMPLETED_BY_TYPE[\"REVENUECAT\"] = \"REVENUECAT\";\n})(PURCHASES_ARE_COMPLETED_BY_TYPE || (PURCHASES_ARE_COMPLETED_BY_TYPE = {}));\n","/**\n * The result type of a Redemption Link redemption attempt.\n * @public\n */\nexport var WebPurchaseRedemptionResultType;\n(function (WebPurchaseRedemptionResultType) {\n /**\n * The redemption was successful.\n */\n WebPurchaseRedemptionResultType[\"SUCCESS\"] = \"SUCCESS\";\n /**\n * The redemption failed.\n */\n WebPurchaseRedemptionResultType[\"ERROR\"] = \"ERROR\";\n /**\n * The purchase associated to the link belongs to another user.\n */\n WebPurchaseRedemptionResultType[\"PURCHASE_BELONGS_TO_OTHER_USER\"] = \"PURCHASE_BELONGS_TO_OTHER_USER\";\n /**\n * The token is invalid.\n */\n WebPurchaseRedemptionResultType[\"INVALID_TOKEN\"] = \"INVALID_TOKEN\";\n /**\n * The token has expired. A new Redemption Link will be sent to the email used during purchase.\n */\n WebPurchaseRedemptionResultType[\"EXPIRED\"] = \"EXPIRED\";\n})(WebPurchaseRedemptionResultType || (WebPurchaseRedemptionResultType = {}));\n","import { PAYWALL_RESULT } from '@revenuecat/purchases-typescript-internal-esm';\n/**\n * Possible outcomes from a custom {@link PurchaseLogic} operation.\n */\nexport var PURCHASE_LOGIC_RESULT;\n(function (PURCHASE_LOGIC_RESULT) {\n /** The purchase or restore completed successfully. */\n PURCHASE_LOGIC_RESULT[\"SUCCESS\"] = \"SUCCESS\";\n /** The user cancelled the purchase or restore. */\n PURCHASE_LOGIC_RESULT[\"CANCELLATION\"] = \"CANCELLATION\";\n /** The purchase or restore failed with an error. */\n PURCHASE_LOGIC_RESULT[\"ERROR\"] = \"ERROR\";\n})(PURCHASE_LOGIC_RESULT || (PURCHASE_LOGIC_RESULT = {}));\n/** @see {@link IOSPaywallPresentationStyle} */\nexport const IOS_PAYWALL_PRESENTATION_STYLE = {\n /** Presents the paywall in full-screen mode. */\n FULL_SCREEN: 'FULL_SCREEN',\n /** Presents the paywall as a sheet. This is the default on iOS. */\n SHEET: 'SHEET',\n};\n/** @see {@link AndroidPaywallPresentationStyle} */\nexport const ANDROID_PAYWALL_PRESENTATION_STYLE = {\n /** Presents the paywall in full-screen mode. This is the default on Android. */\n FULL_SCREEN: 'FULL_SCREEN',\n};\n/** Convenience presets for {@link PaywallPresentationConfiguration}. */\nexport const PaywallPresentationConfiguration = {\n /** Full-screen presentation on all platforms. */\n FULL_SCREEN: {\n ios: IOS_PAYWALL_PRESENTATION_STYLE.FULL_SCREEN,\n android: ANDROID_PAYWALL_PRESENTATION_STYLE.FULL_SCREEN,\n },\n /** Default presentation: sheet on iOS, full-screen on Android. */\n DEFAULT: {\n ios: IOS_PAYWALL_PRESENTATION_STYLE.SHEET,\n android: ANDROID_PAYWALL_PRESENTATION_STYLE.FULL_SCREEN,\n },\n};\n// Using the enum from purchases-typescript-internal-esm instead of defining our own\nexport { PAYWALL_RESULT as PaywallResultEnum };\n//# sourceMappingURL=definitions.js.map","var __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\nimport { registerPlugin } from '@capacitor/core';\nimport { normalizePurchasesError } from '@revenuecat/purchases-typescript-internal-esm';\nimport { IOS_PAYWALL_PRESENTATION_STYLE, ANDROID_PAYWALL_PRESENTATION_STYLE, PURCHASE_LOGIC_RESULT, } from './definitions';\nconst nativePlugin = registerPlugin('RevenueCatUI', {\n web: () => import('./web').then((m) => new m.RevenueCatUIWeb()),\n});\nfunction assertValidPresentationConfiguration(config) {\n if (config === undefined) {\n return;\n }\n if (typeof config !== 'object' || config === null) {\n throw new Error(`Invalid presentationConfiguration: expected an object or undefined.`);\n }\n const { ios, android } = config;\n const validIos = Object.values(IOS_PAYWALL_PRESENTATION_STYLE);\n const validAndroid = Object.values(ANDROID_PAYWALL_PRESENTATION_STYLE);\n if (ios !== undefined && !validIos.includes(ios)) {\n throw new Error(`Invalid presentationConfiguration.ios \"${String(ios)}\". Expected one of: ${validIos.join(', ')}.`);\n }\n if (android !== undefined && !validAndroid.includes(android)) {\n throw new Error(`Invalid presentationConfiguration.android \"${String(android)}\". Expected one of: ${validAndroid.join(', ')}.`);\n }\n}\nfunction resolveNativePresentationOptions(config) {\n if (!config) {\n return {};\n }\n // iOS full-screen takes precedence as the flag that the native bridge understands\n if (config.ios === IOS_PAYWALL_PRESENTATION_STYLE.FULL_SCREEN) {\n return { useFullScreenPresentation: true };\n }\n return {};\n}\nfunction serializeResultForNative(result) {\n if (result.result === PURCHASE_LOGIC_RESULT.ERROR && 'error' in result && result.error) {\n return {\n result: result.result,\n error: {\n code: result.error.code,\n message: result.error.message,\n },\n };\n }\n return { result: result.result };\n}\nasync function presentWithListenerSupport(nativeMethod, options, listener, purchaseLogic) {\n const handles = [];\n try {\n // Register PaywallListener event handlers\n if (listener) {\n if (listener.onPurchaseStarted) {\n const cb = listener.onPurchaseStarted;\n handles.push(await nativePlugin.addListener('onPurchaseStarted', (data) => {\n var _a;\n cb({ packageBeingPurchased: (_a = data.packageBeingPurchased) !== null && _a !== void 0 ? _a : data });\n }));\n }\n if (listener.onPurchaseCompleted) {\n const cb = listener.onPurchaseCompleted;\n handles.push(await nativePlugin.addListener('onPurchaseCompleted', (data) => {\n cb({\n customerInfo: data.customerInfo,\n storeTransaction: data.storeTransaction,\n });\n }));\n }\n if (listener.onPurchaseError) {\n const cb = listener.onPurchaseError;\n handles.push(await nativePlugin.addListener('onPurchaseError', (data) => {\n var _a;\n cb({ error: normalizePurchasesError((_a = data.error) !== null && _a !== void 0 ? _a : data) });\n }));\n }\n if (listener.onPurchaseCancelled) {\n const cb = listener.onPurchaseCancelled;\n handles.push(await nativePlugin.addListener('onPurchaseCancelled', () => {\n cb();\n }));\n }\n if (listener.onRestoreStarted) {\n const cb = listener.onRestoreStarted;\n handles.push(await nativePlugin.addListener('onRestoreStarted', () => {\n cb();\n }));\n }\n if (listener.onRestoreCompleted) {\n const cb = listener.onRestoreCompleted;\n handles.push(await nativePlugin.addListener('onRestoreCompleted', (data) => {\n var _a;\n cb({ customerInfo: (_a = data.customerInfo) !== null && _a !== void 0 ? _a : data });\n }));\n }\n if (listener.onRestoreError) {\n const cb = listener.onRestoreError;\n handles.push(await nativePlugin.addListener('onRestoreError', (data) => {\n var _a;\n cb({ error: normalizePurchasesError((_a = data.error) !== null && _a !== void 0 ? _a : data) });\n }));\n }\n if (listener.onWebCheckoutOpened) {\n const cb = listener.onWebCheckoutOpened;\n handles.push(await nativePlugin.addListener('onWebCheckoutOpened', () => {\n cb();\n }));\n }\n if (listener.onUrlOpened) {\n const cb = listener.onUrlOpened;\n handles.push(await nativePlugin.addListener('onUrlOpened', (data) => {\n cb({ url: data.url });\n }));\n }\n if (listener.onInteraction) {\n handles.push(await nativePlugin.addListener('onInteraction', listener.onInteraction));\n }\n }\n // Always register onPurchaseInitiated so we auto-resume when the user\n // doesn't provide an onPurchaseInitiated callback — otherwise the\n // purchase flow hangs waiting for a resume that never comes.\n // This must be outside the `if (listener)` block because the native\n // delegate adapter always fires this event (even with purchaseLogic only).\n const onPurchaseInitiatedCb = listener === null || listener === void 0 ? void 0 : listener.onPurchaseInitiated;\n handles.push(await nativePlugin.addListener('onPurchaseInitiated', (data) => {\n var _a;\n const requestId = data.requestId;\n const packageBeingPurchased = (_a = data.package) !== null && _a !== void 0 ? _a : data.packageBeingPurchased;\n if (onPurchaseInitiatedCb) {\n onPurchaseInitiatedCb({\n packageBeingPurchased,\n resumable: {\n resume(shouldProceed = true) {\n nativePlugin.resumePurchaseInitiated({ requestId, shouldProceed });\n },\n },\n });\n }\n else {\n // No callback provided — auto-proceed with the purchase.\n nativePlugin.resumePurchaseInitiated({ requestId, shouldProceed: true });\n }\n }));\n // Register PurchaseLogic event handlers\n if (purchaseLogic) {\n handles.push(await nativePlugin.addListener('onPerformPurchaseRequest', async (data) => {\n var _a, _b, _c;\n const requestId = data.requestId;\n const packageToPurchase = (_b = (_a = data.package) !== null && _a !== void 0 ? _a : data.packageBeingPurchased) !== null && _b !== void 0 ? _b : data.packageToPurchase;\n try {\n const result = await purchaseLogic.performPurchase({ packageToPurchase });\n await nativePlugin.resumePurchaseLogicPurchase(Object.assign({ requestId }, serializeResultForNative(result)));\n }\n catch (e) {\n await nativePlugin.resumePurchaseLogicPurchase({\n requestId,\n result: PURCHASE_LOGIC_RESULT.ERROR,\n error: { message: (_c = e === null || e === void 0 ? void 0 : e.message) !== null && _c !== void 0 ? _c : 'Unknown error' },\n });\n }\n }));\n handles.push(await nativePlugin.addListener('onPerformRestoreRequest', async (data) => {\n var _a;\n const requestId = data.requestId;\n try {\n const result = await purchaseLogic.performRestore();\n await nativePlugin.resumePurchaseLogicRestore(Object.assign({ requestId }, serializeResultForNative(result)));\n }\n catch (e) {\n await nativePlugin.resumePurchaseLogicRestore({\n requestId,\n result: PURCHASE_LOGIC_RESULT.ERROR,\n error: { message: (_a = e === null || e === void 0 ? void 0 : e.message) !== null && _a !== void 0 ? _a : 'Unknown error' },\n });\n }\n }));\n }\n // Call native with serializable-only options\n const nativeOptions = Object.assign(Object.assign({}, options), { hasPaywallListener: !!listener, hasPurchaseLogic: !!purchaseLogic });\n // Remove non-serializable fields\n delete nativeOptions.listener;\n delete nativeOptions.purchaseLogic;\n return await nativeMethod(nativeOptions);\n }\n finally {\n // Clean up all registered listeners\n for (const handle of handles) {\n await handle.remove();\n }\n }\n}\nconst RevenueCatUI = {\n async presentPaywall(options) {\n assertValidPresentationConfiguration(options === null || options === void 0 ? void 0 : options.presentationConfiguration);\n const _a = options !== null && options !== void 0 ? options : {}, { presentationConfiguration, listener, purchaseLogic } = _a, rest = __rest(_a, [\"presentationConfiguration\", \"listener\", \"purchaseLogic\"]);\n const nativeOpts = Object.assign(Object.assign({}, rest), resolveNativePresentationOptions(presentationConfiguration));\n if (!listener && !purchaseLogic) {\n return nativePlugin.presentPaywall(nativeOpts);\n }\n return presentWithListenerSupport((opts) => nativePlugin.presentPaywall(opts), nativeOpts, listener, purchaseLogic);\n },\n async presentPaywallIfNeeded(options) {\n assertValidPresentationConfiguration(options === null || options === void 0 ? void 0 : options.presentationConfiguration);\n const { presentationConfiguration, listener, purchaseLogic } = options, rest = __rest(options, [\"presentationConfiguration\", \"listener\", \"purchaseLogic\"]);\n const nativeOpts = Object.assign(Object.assign({}, rest), resolveNativePresentationOptions(presentationConfiguration));\n if (!listener && !purchaseLogic) {\n return nativePlugin.presentPaywallIfNeeded(nativeOpts);\n }\n return presentWithListenerSupport((opts) => nativePlugin.presentPaywallIfNeeded(opts), nativeOpts, listener, purchaseLogic);\n },\n async presentCustomerCenter() {\n return nativePlugin.presentCustomerCenter();\n },\n setMockWebResults: nativePlugin.setMockWebResults\n ? async (options) => {\n return nativePlugin.setMockWebResults(options);\n }\n : undefined,\n addListener(eventName, listener) {\n return nativePlugin.addListener(eventName, listener);\n },\n removeAllListeners() {\n return nativePlugin.removeAllListeners();\n },\n};\nexport * from './definitions';\nexport { PAYWALL_RESULT } from '@revenuecat/purchases-typescript-internal-esm';\nexport { RevenueCatUI };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nimport { PAYWALL_RESULT } from '@revenuecat/purchases-typescript-internal-esm';\nexport class RevenueCatUIWeb extends WebPlugin {\n constructor() {\n super();\n this.shouldMockWebResults = false;\n this.webNotSupportedErrorMessage = 'RevenueCatUI is not supported on web platforms.';\n }\n async setMockWebResults(options) {\n this.shouldMockWebResults = options.shouldMockWebResults;\n return Promise.resolve();\n }\n async presentPaywall(options) {\n return this.mockReturningFunctionIfEnabled('presentPaywall', {\n result: PAYWALL_RESULT.NOT_PRESENTED,\n }, options);\n }\n async presentPaywallIfNeeded(options) {\n return this.mockReturningFunctionIfEnabled('presentPaywallIfNeeded', {\n result: PAYWALL_RESULT.NOT_PRESENTED,\n }, options);\n }\n async presentCustomerCenter() {\n return this.mockNonReturningFunctionIfEnabled('presentCustomerCenter');\n }\n async resumePurchaseInitiated(_options) {\n return this.mockNonReturningFunctionIfEnabled('resumePurchaseInitiated');\n }\n async resumePurchaseLogicPurchase(_options) {\n return this.mockNonReturningFunctionIfEnabled('resumePurchaseLogicPurchase');\n }\n async resumePurchaseLogicRestore(_options) {\n return this.mockNonReturningFunctionIfEnabled('resumePurchaseLogicRestore');\n }\n addListener(eventName, listener) {\n if (eventName !== 'paywallDisplayed' && eventName !== 'paywallDismissed') {\n console.warn(`Unsupported event: ${eventName}`);\n }\n return super.addListener(eventName, listener);\n }\n removeAllListeners() {\n return super.removeAllListeners();\n }\n mockNonReturningFunctionIfEnabled(functionName) {\n if (!this.shouldMockWebResults) {\n return Promise.reject(this.webNotSupportedErrorMessage);\n }\n console.log(`${functionName} called on web with mocking enabled. No-op`);\n return Promise.resolve();\n }\n mockReturningFunctionIfEnabled(functionName, returnValue, options) {\n if (!this.shouldMockWebResults) {\n return Promise.reject(this.webNotSupportedErrorMessage);\n }\n console.log(`${functionName} called on web with mocking enabled. Returning mocked value`, options);\n return Promise.resolve(returnValue);\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["this","PAYWALL_RESULT","PURCHASE_LOGIC_RESULT","registerPlugin","WebPlugin"],"mappings":";;;IAAA;IACA;IACA;IACA;IACA;IACA;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CAA0C,CAAC,CAAC;IAChF,QAAQ,OAAO,OAAO,CAAC,OAAO,EAAE;IAChC,IAAI;IACJ,IAAI,8BAA8B,CAAC,YAAY,EAAE,WAAW,EAAE,OAAO,EAAE;IACvE,QAAQ,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE;IACxC,YAAY,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,2BAA2B,CAAC;IACnE,QAAQ;IACR,QAAQ,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,YAAY,CAAC,2DAA2D,CAAC,EAAE,OAAO,CAAC;IAC1G,QAAQ,OAAO,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC;IAC3C,IAAI;IACJ;;;;;;;;;;;;;;;;;;;","x_google_ignoreList":[0,1,2,3,4,5]}
1
+ {"version":3,"file":"plugin.js","sources":["../node_modules/@revenuecat/purchases-typescript-internal-esm/dist/generated/error-codes.js","../node_modules/@revenuecat/purchases-typescript-internal-esm/dist/errors.js","../node_modules/@revenuecat/purchases-typescript-internal-esm/dist/errorNormalizer.js","../node_modules/@revenuecat/purchases-typescript-internal-esm/dist/offerings.js","../node_modules/@revenuecat/purchases-typescript-internal-esm/dist/enums.js","../node_modules/@revenuecat/purchases-typescript-internal-esm/dist/webRedemption.js","esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["// @generated\n// DO NOT EDIT THIS FILE — generated from https://github.com/RevenueCat/purchases-error-codes\n/**\n * Error codes indicating the reason for an error.\n * @public\n */\nexport var PURCHASES_ERROR_CODE;\n(function (PURCHASES_ERROR_CODE) {\n PURCHASES_ERROR_CODE[\"UNKNOWN_ERROR\"] = \"0\";\n PURCHASES_ERROR_CODE[\"PURCHASE_CANCELLED_ERROR\"] = \"1\";\n PURCHASES_ERROR_CODE[\"STORE_PROBLEM_ERROR\"] = \"2\";\n PURCHASES_ERROR_CODE[\"PURCHASE_NOT_ALLOWED_ERROR\"] = \"3\";\n PURCHASES_ERROR_CODE[\"PURCHASE_INVALID_ERROR\"] = \"4\";\n PURCHASES_ERROR_CODE[\"PRODUCT_NOT_AVAILABLE_FOR_PURCHASE_ERROR\"] = \"5\";\n PURCHASES_ERROR_CODE[\"PRODUCT_ALREADY_PURCHASED_ERROR\"] = \"6\";\n PURCHASES_ERROR_CODE[\"RECEIPT_ALREADY_IN_USE_ERROR\"] = \"7\";\n PURCHASES_ERROR_CODE[\"INVALID_RECEIPT_ERROR\"] = \"8\";\n PURCHASES_ERROR_CODE[\"MISSING_RECEIPT_FILE_ERROR\"] = \"9\";\n PURCHASES_ERROR_CODE[\"NETWORK_ERROR\"] = \"10\";\n PURCHASES_ERROR_CODE[\"INVALID_CREDENTIALS_ERROR\"] = \"11\";\n PURCHASES_ERROR_CODE[\"UNEXPECTED_BACKEND_RESPONSE_ERROR\"] = \"12\";\n PURCHASES_ERROR_CODE[\"RECEIPT_IN_USE_BY_OTHER_SUBSCRIBER_ERROR\"] = \"13\";\n PURCHASES_ERROR_CODE[\"INVALID_APP_USER_ID_ERROR\"] = \"14\";\n PURCHASES_ERROR_CODE[\"OPERATION_ALREADY_IN_PROGRESS_ERROR\"] = \"15\";\n PURCHASES_ERROR_CODE[\"UNKNOWN_BACKEND_ERROR\"] = \"16\";\n PURCHASES_ERROR_CODE[\"INVALID_APPLE_SUBSCRIPTION_KEY_ERROR\"] = \"17\";\n PURCHASES_ERROR_CODE[\"INELIGIBLE_ERROR\"] = \"18\";\n PURCHASES_ERROR_CODE[\"INSUFFICIENT_PERMISSIONS_ERROR\"] = \"19\";\n PURCHASES_ERROR_CODE[\"PAYMENT_PENDING_ERROR\"] = \"20\";\n PURCHASES_ERROR_CODE[\"INVALID_SUBSCRIBER_ATTRIBUTES_ERROR\"] = \"21\";\n PURCHASES_ERROR_CODE[\"LOG_OUT_ANONYMOUS_USER_ERROR\"] = \"22\";\n PURCHASES_ERROR_CODE[\"CONFIGURATION_ERROR\"] = \"23\";\n PURCHASES_ERROR_CODE[\"UNSUPPORTED_ERROR\"] = \"24\";\n PURCHASES_ERROR_CODE[\"EMPTY_SUBSCRIBER_ATTRIBUTES_ERROR\"] = \"25\";\n PURCHASES_ERROR_CODE[\"PRODUCT_DISCOUNT_MISSING_IDENTIFIER_ERROR\"] = \"26\";\n PURCHASES_ERROR_CODE[\"PRODUCT_DISCOUNT_MISSING_SUBSCRIPTION_GROUP_IDENTIFIER_ERROR\"] = \"28\";\n PURCHASES_ERROR_CODE[\"CUSTOMER_INFO_ERROR\"] = \"29\";\n PURCHASES_ERROR_CODE[\"SYSTEM_INFO_ERROR\"] = \"30\";\n PURCHASES_ERROR_CODE[\"BEGIN_REFUND_REQUEST_ERROR\"] = \"31\";\n PURCHASES_ERROR_CODE[\"PRODUCT_REQUEST_TIMED_OUT_ERROR\"] = \"32\";\n PURCHASES_ERROR_CODE[\"API_ENDPOINT_BLOCKED\"] = \"33\";\n PURCHASES_ERROR_CODE[\"INVALID_PROMOTIONAL_OFFER_ERROR\"] = \"34\";\n PURCHASES_ERROR_CODE[\"OFFLINE_CONNECTION_ERROR\"] = \"35\";\n PURCHASES_ERROR_CODE[\"FEATURE_NOT_AVAILABLE_IN_CUSTOM_ENTITLEMENTS_COMPUTATION_MODE\"] = \"36\";\n PURCHASES_ERROR_CODE[\"SIGNATURE_VERIFICATION_ERROR\"] = \"37\";\n PURCHASES_ERROR_CODE[\"FEATURE_NOT_SUPPORTED_WITH_STORE_KIT_1\"] = \"38\";\n PURCHASES_ERROR_CODE[\"INVALID_WEB_PURCHASE_TOKEN\"] = \"39\";\n PURCHASES_ERROR_CODE[\"PURCHASE_BELONGS_TO_OTHER_USER\"] = \"40\";\n PURCHASES_ERROR_CODE[\"EXPIRED_WEB_PURCHASE_TOKEN\"] = \"41\";\n PURCHASES_ERROR_CODE[\"TEST_STORE_SIMULATED_PURCHASE_ERROR\"] = \"42\";\n})(PURCHASES_ERROR_CODE || (PURCHASES_ERROR_CODE = {}));\n","var __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n/* tslint:disable:max-classes-per-file */\nimport { PURCHASES_ERROR_CODE } from \"./generated/error-codes\";\nexport { PURCHASES_ERROR_CODE };\n/**\n * @internal\n */\nvar UninitializedPurchasesError = /** @class */ (function (_super) {\n __extends(UninitializedPurchasesError, _super);\n function UninitializedPurchasesError() {\n var _this = _super.call(this, \"There is no singleton instance. \" +\n \"Make sure you configure Purchases before trying to get the default instance. \" +\n \"More info here: https://errors.rev.cat/configuring-sdk\") || this;\n // Set the prototype explicitly.\n Object.setPrototypeOf(_this, UninitializedPurchasesError.prototype);\n return _this;\n }\n return UninitializedPurchasesError;\n}(Error));\nexport { UninitializedPurchasesError };\n/**\n * @internal\n */\nvar UnsupportedPlatformError = /** @class */ (function (_super) {\n __extends(UnsupportedPlatformError, _super);\n function UnsupportedPlatformError() {\n var _this = _super.call(this, \"This method is not available in the current platform.\") || this;\n // Set the prototype explicitly.\n Object.setPrototypeOf(_this, UnsupportedPlatformError.prototype);\n return _this;\n }\n return UnsupportedPlatformError;\n}(Error));\nexport { UnsupportedPlatformError };\n/**\n * Returns whether the given value is a {@link PurchasesError} thrown by the SDK.\n *\n * A value qualifies when its schema matches {@link PurchasesError} and its `code` is one of the\n * {@link PURCHASES_ERROR_CODE} values.\n *\n * @public\n */\nexport function isPurchasesError(error) {\n if (typeof error !== \"object\" || error === null) {\n return false;\n }\n if (!(\"code\" in error) || typeof error.code !== \"string\") {\n return false;\n }\n if (!(\"message\" in error) || typeof error.message !== \"string\") {\n return false;\n }\n if (!(\"userInfo\" in error) || typeof error.userInfo !== \"object\" || error.userInfo == null) {\n return false;\n }\n if (!((\"readableErrorCode\") in error.userInfo) || typeof error.userInfo.readableErrorCode !== \"string\") {\n return false;\n }\n if (!(\"underlyingErrorMessage\" in error) || typeof error.underlyingErrorMessage !== \"string\") {\n return false;\n }\n var code = error.code;\n var knownErrorCodes = new Set(Object.values(PURCHASES_ERROR_CODE));\n return typeof code === \"string\" && knownErrorCodes.has(code);\n}\n","var __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nimport { PURCHASES_ERROR_CODE } from \"./generated/error-codes\";\n/**\n * React Native nests `ErrorContainer.info` under `userInfo`, Capacitor under `data`,\n * and `purchases-js-hybrid-mappings` under `info`.\n */\nvar PAYLOAD_KEYS = [\"userInfo\", \"data\", \"info\"];\nfunction isRecord(value) {\n return typeof value === \"object\" && value !== null;\n}\nfunction readPayload(error) {\n for (var _i = 0, PAYLOAD_KEYS_1 = PAYLOAD_KEYS; _i < PAYLOAD_KEYS_1.length; _i++) {\n var key = PAYLOAD_KEYS_1[_i];\n var candidate = error[key];\n if (isRecord(candidate)) {\n return candidate;\n }\n }\n return {};\n}\nfunction firstString() {\n var values = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n values[_i] = arguments[_i];\n }\n for (var _a = 0, values_1 = values; _a < values_1.length; _a++) {\n var value = values_1[_a];\n if (typeof value === \"string\") {\n return value;\n }\n }\n return \"\";\n}\n/**\n * Every code the SDK emits is a PURCHASES_ERROR_CODE value, which is always numeric.\n * Plugin level rejections use names such as \"UNIMPLEMENTED\" or \"PAYWALL_ERROR\" and are\n * not ours to touch.\n *\n * Deliberately looser than PURCHASES_ERROR_CODE membership: that enum omits codes the\n * native SDKs emit (36 to 41), and Android and iOS disagree on 28 and 36, so matching\n * against it would reject genuine errors.\n */\nfunction readCode(error, payload) {\n var _a;\n var candidate = (_a = error.code) !== null && _a !== void 0 ? _a : payload.code;\n var code = String(candidate);\n return /^\\d+$/.test(code) ? code : undefined;\n}\n/**\n * Fills in the fields {@link PurchasesError} declares but the platform bridges\n * leave nested.\n *\n * Hybrid SDKs should call this on every error rejected by the native module,\n * then rethrow the returned value.\n *\n * The error is mutated in place and returned. Copying it into a new object\n * would discard its prototype and stack, which would break `instanceof Error`\n * for consumers and `instanceof CapacitorException` on Capacitor.\n *\n * Values the bridge did not send fall back to the same defaults the native\n * layer already applies, so the result always satisfies {@link PurchasesError}.\n *\n * Anything that is not an object, or that carries no error code, is returned\n * untouched.\n *\n * @public\n */\nexport function normalizePurchasesError(error) {\n if (!isRecord(error)) {\n return error;\n }\n var payload = readPayload(error);\n var code = readCode(error, payload);\n if (code === undefined) {\n return error;\n }\n error.code = code;\n var userInfo = __assign({}, payload);\n if (typeof userInfo.readableErrorCode !== \"string\") {\n userInfo.readableErrorCode = firstString(payload.readableErrorCode, error.readableErrorCode);\n }\n error.userInfo = userInfo;\n if (typeof error.message !== \"string\" || error.message === \"\") {\n error.message = firstString(payload.message);\n }\n if (typeof error.readableErrorCode !== \"string\") {\n error.readableErrorCode = userInfo.readableErrorCode;\n }\n if (typeof error.underlyingErrorMessage !== \"string\") {\n error.underlyingErrorMessage = firstString(payload.underlyingErrorMessage);\n }\n // The bridges only send a userCancelled flag on purchase flows, derived from this code.\n error.userCancelled = code === PURCHASES_ERROR_CODE.PURCHASE_CANCELLED_ERROR;\n return error;\n}\n","/**\n * Enum indicating possible package types.\n * @public\n */\nexport var PACKAGE_TYPE;\n(function (PACKAGE_TYPE) {\n /**\n * A package that was defined with a custom identifier.\n */\n PACKAGE_TYPE[\"UNKNOWN\"] = \"UNKNOWN\";\n /**\n * A package that was defined with a custom identifier.\n */\n PACKAGE_TYPE[\"CUSTOM\"] = \"CUSTOM\";\n /**\n * A package configured with the predefined lifetime identifier.\n */\n PACKAGE_TYPE[\"LIFETIME\"] = \"LIFETIME\";\n /**\n * A package configured with the predefined annual identifier.\n */\n PACKAGE_TYPE[\"ANNUAL\"] = \"ANNUAL\";\n /**\n * A package configured with the predefined six month identifier.\n */\n PACKAGE_TYPE[\"SIX_MONTH\"] = \"SIX_MONTH\";\n /**\n * A package configured with the predefined three month identifier.\n */\n PACKAGE_TYPE[\"THREE_MONTH\"] = \"THREE_MONTH\";\n /**\n * A package configured with the predefined two month identifier.\n */\n PACKAGE_TYPE[\"TWO_MONTH\"] = \"TWO_MONTH\";\n /**\n * A package configured with the predefined monthly identifier.\n */\n PACKAGE_TYPE[\"MONTHLY\"] = \"MONTHLY\";\n /**\n * A package configured with the predefined weekly identifier.\n */\n PACKAGE_TYPE[\"WEEKLY\"] = \"WEEKLY\";\n})(PACKAGE_TYPE || (PACKAGE_TYPE = {}));\n/**\n * Enum indicating possible eligibility status for introductory pricing.\n * @public\n */\nexport var INTRO_ELIGIBILITY_STATUS;\n(function (INTRO_ELIGIBILITY_STATUS) {\n /**\n * RevenueCat doesn't have enough information to determine eligibility.\n */\n INTRO_ELIGIBILITY_STATUS[INTRO_ELIGIBILITY_STATUS[\"INTRO_ELIGIBILITY_STATUS_UNKNOWN\"] = 0] = \"INTRO_ELIGIBILITY_STATUS_UNKNOWN\";\n /**\n * The user is not eligible for a free trial or intro pricing for this product.\n */\n INTRO_ELIGIBILITY_STATUS[INTRO_ELIGIBILITY_STATUS[\"INTRO_ELIGIBILITY_STATUS_INELIGIBLE\"] = 1] = \"INTRO_ELIGIBILITY_STATUS_INELIGIBLE\";\n /**\n * The user is eligible for a free trial or intro pricing for this product.\n */\n INTRO_ELIGIBILITY_STATUS[INTRO_ELIGIBILITY_STATUS[\"INTRO_ELIGIBILITY_STATUS_ELIGIBLE\"] = 2] = \"INTRO_ELIGIBILITY_STATUS_ELIGIBLE\";\n /**\n * There is no free trial or intro pricing for this product.\n */\n INTRO_ELIGIBILITY_STATUS[INTRO_ELIGIBILITY_STATUS[\"INTRO_ELIGIBILITY_STATUS_NO_INTRO_OFFER_EXISTS\"] = 3] = \"INTRO_ELIGIBILITY_STATUS_NO_INTRO_OFFER_EXISTS\";\n})(INTRO_ELIGIBILITY_STATUS || (INTRO_ELIGIBILITY_STATUS = {}));\n/**\n * Enum indicating possible product categories.\n * @public\n */\nexport var PRODUCT_CATEGORY;\n(function (PRODUCT_CATEGORY) {\n /**\n * A type of product for non-subscription.\n */\n PRODUCT_CATEGORY[\"NON_SUBSCRIPTION\"] = \"NON_SUBSCRIPTION\";\n /**\n * A type of product for subscriptions.\n */\n PRODUCT_CATEGORY[\"SUBSCRIPTION\"] = \"SUBSCRIPTION\";\n /**\n * A type of product for unknowns.\n */\n PRODUCT_CATEGORY[\"UNKNOWN\"] = \"UNKNOWN\";\n})(PRODUCT_CATEGORY || (PRODUCT_CATEGORY = {}));\n/**\n * Enum indicating possible product types.\n * @public\n */\nexport var PRODUCT_TYPE;\n(function (PRODUCT_TYPE) {\n /**\n * A consumable in-app purchase.\n */\n PRODUCT_TYPE[\"CONSUMABLE\"] = \"CONSUMABLE\";\n /**\n * A non-consumable in-app purchase. Only applies to Apple Store products.\n */\n PRODUCT_TYPE[\"NON_CONSUMABLE\"] = \"NON_CONSUMABLE\";\n /**\n * A non-renewing subscription. Only applies to Apple Store products.\n */\n PRODUCT_TYPE[\"NON_RENEWABLE_SUBSCRIPTION\"] = \"NON_RENEWABLE_SUBSCRIPTION\";\n /**\n * An auto-renewable subscription.\n */\n PRODUCT_TYPE[\"AUTO_RENEWABLE_SUBSCRIPTION\"] = \"AUTO_RENEWABLE_SUBSCRIPTION\";\n /**\n * A subscription that is pre-paid. Only applies to Google Play products.\n */\n PRODUCT_TYPE[\"PREPAID_SUBSCRIPTION\"] = \"PREPAID_SUBSCRIPTION\";\n /**\n * Unable to determine product type.\n */\n PRODUCT_TYPE[\"UNKNOWN\"] = \"UNKNOWN\";\n})(PRODUCT_TYPE || (PRODUCT_TYPE = {}));\n/**\n * Enum with possible proration modes in a subscription upgrade or downgrade in the Play Store. Used only for Google.\n * @deprecated Use STORE_REPLACEMENT_MODE\n * @public\n */\nexport var PRORATION_MODE;\n(function (PRORATION_MODE) {\n PRORATION_MODE[PRORATION_MODE[\"UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY\"] = 0] = \"UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY\";\n /**\n * Replacement takes effect immediately, and the remaining time will be\n * prorated and credited to the user.\n */\n PRORATION_MODE[PRORATION_MODE[\"IMMEDIATE_WITH_TIME_PRORATION\"] = 1] = \"IMMEDIATE_WITH_TIME_PRORATION\";\n /**\n * Replacement takes effect immediately, and the billing cycle remains the\n * same. The price for the remaining period will be charged. This option is\n * only available for subscription upgrade.\n */\n PRORATION_MODE[PRORATION_MODE[\"IMMEDIATE_AND_CHARGE_PRORATED_PRICE\"] = 2] = \"IMMEDIATE_AND_CHARGE_PRORATED_PRICE\";\n /**\n * Replacement takes effect immediately, and the new price will be charged on\n * next recurrence time. The billing cycle stays the same.\n *\n * This is the current default behavior.\n */\n PRORATION_MODE[PRORATION_MODE[\"IMMEDIATE_WITHOUT_PRORATION\"] = 3] = \"IMMEDIATE_WITHOUT_PRORATION\";\n /**\n * Replacement takes effect when the old plan expires, and the new price will\n * be charged at the same time.\n */\n PRORATION_MODE[PRORATION_MODE[\"DEFERRED\"] = 6] = \"DEFERRED\";\n /**\n * Replacement takes effect immediately, and the user is charged full price\n * of new plan and is given a full billing cycle of subscription,\n * plus remaining prorated time from the old plan.\n */\n PRORATION_MODE[PRORATION_MODE[\"IMMEDIATE_AND_CHARGE_FULL_PRICE\"] = 5] = \"IMMEDIATE_AND_CHARGE_FULL_PRICE\";\n})(PRORATION_MODE || (PRORATION_MODE = {}));\n/**\n * Enum with possible proration modes in a subscription upgrade or downgrade in the Play Store or Galaxy Store. Used only on Android.\n * @public\n */\nexport var STORE_REPLACEMENT_MODE;\n(function (STORE_REPLACEMENT_MODE) {\n /**\n * Old subscription is cancelled, and new subscription takes effect immediately.\n * User is charged for the full price of the new subscription on the old subscription's expiration date.\n *\n * This is the default behavior for the Galaxy and Play stores.\n */\n STORE_REPLACEMENT_MODE[\"WITHOUT_PRORATION\"] = \"WITHOUT_PRORATION\";\n /**\n * Replacement takes effect immediately, and the remaining time will be\n * prorated and credited to the user. This is the current default behavior.\n */\n STORE_REPLACEMENT_MODE[\"WITH_TIME_PRORATION\"] = \"WITH_TIME_PRORATION\";\n /**\n * Replacement takes effect immediately, and the user is charged full price of new plan and is\n * given a full billing cycle of subscription, plus remaining prorated time from the old plan.\n *\n * This mode is not supported by the Galaxy Store. If it is passed to the Galaxy Store, an error will be thrown.\n */\n STORE_REPLACEMENT_MODE[\"CHARGE_FULL_PRICE\"] = \"CHARGE_FULL_PRICE\";\n /**\n * Replacement takes effect immediately, and the billing cycle remains the\n * same. The price for the remaining period will be charged. This option is\n * only available for subscription upgrade.\n */\n STORE_REPLACEMENT_MODE[\"CHARGE_PRORATED_PRICE\"] = \"CHARGE_PRORATED_PRICE\";\n /**\n * Replacement takes effect when the old plan expires, and the new price will be charged at the same time.\n */\n STORE_REPLACEMENT_MODE[\"DEFERRED\"] = \"DEFERRED\";\n})(STORE_REPLACEMENT_MODE || (STORE_REPLACEMENT_MODE = {}));\n/**\n * Enum indicating the billing plan type of an installment subscription. iOS only.\n * @public\n */\nexport var BILLING_PLAN_TYPE;\n(function (BILLING_PLAN_TYPE) {\n /**\n * The customer pays in full when purchasing the product.\n */\n BILLING_PLAN_TYPE[\"UP_FRONT\"] = \"UP_FRONT\";\n /**\n * The customer pays in monthly installments.\n */\n BILLING_PLAN_TYPE[\"MONTHLY\"] = \"MONTHLY\";\n /**\n * Unable to determine the billing plan type.\n */\n BILLING_PLAN_TYPE[\"UNKNOWN\"] = \"UNKNOWN\";\n})(BILLING_PLAN_TYPE || (BILLING_PLAN_TYPE = {}));\n/**\n * Recurrence mode for a pricing phase\n * @public\n */\nexport var RECURRENCE_MODE;\n(function (RECURRENCE_MODE) {\n /**\n * Pricing phase repeats infinitely until cancellation\n */\n RECURRENCE_MODE[RECURRENCE_MODE[\"INFINITE_RECURRING\"] = 1] = \"INFINITE_RECURRING\";\n /**\n * Pricing phase repeats for a fixed number of billing periods\n */\n RECURRENCE_MODE[RECURRENCE_MODE[\"FINITE_RECURRING\"] = 2] = \"FINITE_RECURRING\";\n /**\n * Pricing phase does not repeat\n */\n RECURRENCE_MODE[RECURRENCE_MODE[\"NON_RECURRING\"] = 3] = \"NON_RECURRING\";\n})(RECURRENCE_MODE || (RECURRENCE_MODE = {}));\n/**\n * Payment mode for offer pricing phases. Google Play only.\n * @public\n */\nexport var OFFER_PAYMENT_MODE;\n(function (OFFER_PAYMENT_MODE) {\n /**\n * Subscribers don't pay until the specified period ends\n */\n OFFER_PAYMENT_MODE[\"FREE_TRIAL\"] = \"FREE_TRIAL\";\n /**\n * Subscribers pay up front for a specified period\n */\n OFFER_PAYMENT_MODE[\"SINGLE_PAYMENT\"] = \"SINGLE_PAYMENT\";\n /**\n * Subscribers pay a discounted amount for a specified number of periods\n */\n OFFER_PAYMENT_MODE[\"DISCOUNTED_RECURRING_PAYMENT\"] = \"DISCOUNTED_RECURRING_PAYMENT\";\n})(OFFER_PAYMENT_MODE || (OFFER_PAYMENT_MODE = {}));\n/**\n * Time duration unit for Period.\n * @public\n */\nexport var PERIOD_UNIT;\n(function (PERIOD_UNIT) {\n PERIOD_UNIT[\"DAY\"] = \"DAY\";\n PERIOD_UNIT[\"WEEK\"] = \"WEEK\";\n PERIOD_UNIT[\"MONTH\"] = \"MONTH\";\n PERIOD_UNIT[\"YEAR\"] = \"YEAR\";\n PERIOD_UNIT[\"UNKNOWN\"] = \"UNKNOWN\";\n})(PERIOD_UNIT || (PERIOD_UNIT = {}));\n","/**\n * @deprecated Use PRODUCT_CATEGORY\n * @public\n */\nexport var PURCHASE_TYPE;\n(function (PURCHASE_TYPE) {\n /**\n * A type of SKU for in-app products.\n */\n PURCHASE_TYPE[\"INAPP\"] = \"inapp\";\n /**\n * A type of SKU for subscriptions.\n */\n PURCHASE_TYPE[\"SUBS\"] = \"subs\";\n})(PURCHASE_TYPE || (PURCHASE_TYPE = {}));\n/**\n * Enum for billing features.\n * Currently, these are only relevant for Google Play Android users:\n * https://developer.android.com/reference/com/android/billingclient/api/BillingClient.FeatureType\n * @public\n */\nexport var BILLING_FEATURE;\n(function (BILLING_FEATURE) {\n /**\n * Purchase/query for subscriptions.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"SUBSCRIPTIONS\"] = 0] = \"SUBSCRIPTIONS\";\n /**\n * Subscriptions update/replace.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"SUBSCRIPTIONS_UPDATE\"] = 1] = \"SUBSCRIPTIONS_UPDATE\";\n /**\n * Purchase/query for in-app items on VR.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"IN_APP_ITEMS_ON_VR\"] = 2] = \"IN_APP_ITEMS_ON_VR\";\n /**\n * Purchase/query for subscriptions on VR.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"SUBSCRIPTIONS_ON_VR\"] = 3] = \"SUBSCRIPTIONS_ON_VR\";\n /**\n * Launch a price change confirmation flow.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"PRICE_CHANGE_CONFIRMATION\"] = 4] = \"PRICE_CHANGE_CONFIRMATION\";\n})(BILLING_FEATURE || (BILLING_FEATURE = {}));\n/**\n * Enum for possible refund request results.\n * @public\n */\nexport var REFUND_REQUEST_STATUS;\n(function (REFUND_REQUEST_STATUS) {\n /**\n * Apple has received the refund request.\n */\n REFUND_REQUEST_STATUS[REFUND_REQUEST_STATUS[\"SUCCESS\"] = 0] = \"SUCCESS\";\n /**\n * User canceled submission of the refund request.\n */\n REFUND_REQUEST_STATUS[REFUND_REQUEST_STATUS[\"USER_CANCELLED\"] = 1] = \"USER_CANCELLED\";\n /**\n * There was an error with the request. See message for more details.\n */\n REFUND_REQUEST_STATUS[REFUND_REQUEST_STATUS[\"ERROR\"] = 2] = \"ERROR\";\n})(REFUND_REQUEST_STATUS || (REFUND_REQUEST_STATUS = {}));\n/**\n * Enum for possible log levels to print.\n * @public\n */\nexport var LOG_LEVEL;\n(function (LOG_LEVEL) {\n LOG_LEVEL[\"VERBOSE\"] = \"VERBOSE\";\n LOG_LEVEL[\"DEBUG\"] = \"DEBUG\";\n LOG_LEVEL[\"INFO\"] = \"INFO\";\n LOG_LEVEL[\"WARN\"] = \"WARN\";\n LOG_LEVEL[\"ERROR\"] = \"ERROR\";\n})(LOG_LEVEL || (LOG_LEVEL = {}));\n/**\n * Enum for in-app message types.\n * This can be used if you disable automatic in-app message from showing automatically.\n * Then, you can pass what type of messages you want to show in the `showInAppMessages`\n * method in Purchases.\n * @public\n */\nexport var IN_APP_MESSAGE_TYPE;\n(function (IN_APP_MESSAGE_TYPE) {\n // Make sure the enum values are in sync with those defined in iOS/Android\n /**\n * In-app messages to indicate there has been a billing issue charging the user.\n */\n IN_APP_MESSAGE_TYPE[IN_APP_MESSAGE_TYPE[\"BILLING_ISSUE\"] = 0] = \"BILLING_ISSUE\";\n /**\n * iOS-only. This message will show if you increase the price of a subscription and\n * the user needs to opt-in to the increase.\n */\n IN_APP_MESSAGE_TYPE[IN_APP_MESSAGE_TYPE[\"PRICE_INCREASE_CONSENT\"] = 1] = \"PRICE_INCREASE_CONSENT\";\n /**\n * iOS-only. StoreKit generic messages.\n */\n IN_APP_MESSAGE_TYPE[IN_APP_MESSAGE_TYPE[\"GENERIC\"] = 2] = \"GENERIC\";\n /**\n * iOS-only. This message will show if the subscriber is eligible for an iOS win-back\n * offer and will allow the subscriber to redeem the offer.\n */\n IN_APP_MESSAGE_TYPE[IN_APP_MESSAGE_TYPE[\"WIN_BACK_OFFER\"] = 3] = \"WIN_BACK_OFFER\";\n})(IN_APP_MESSAGE_TYPE || (IN_APP_MESSAGE_TYPE = {}));\n/**\n * Enum of entitlement verification modes.\n * @public\n */\nexport var ENTITLEMENT_VERIFICATION_MODE;\n(function (ENTITLEMENT_VERIFICATION_MODE) {\n /**\n * The SDK will not perform any entitlement verification.\n */\n ENTITLEMENT_VERIFICATION_MODE[\"DISABLED\"] = \"DISABLED\";\n /**\n * Enable entitlement verification.\n *\n * If verification fails, this will be indicated with [VerificationResult.FAILED] in\n * the [EntitlementInfos.verification] and [EntitlementInfo.verification] properties but parsing will not fail\n * (i.e. Entitlements will still be granted).\n *\n * This can be useful if you want to handle verification failures to display an error/warning to the user\n * or to track this situation but still grant access.\n */\n ENTITLEMENT_VERIFICATION_MODE[\"INFORMATIONAL\"] = \"INFORMATIONAL\";\n // Add ENFORCED mode once we're ready to ship it.\n // ENFORCED = \"ENFORCED\"\n})(ENTITLEMENT_VERIFICATION_MODE || (ENTITLEMENT_VERIFICATION_MODE = {}));\n/**\n * The result of the verification process. For more details check: http://rev.cat/trusted-entitlements\n *\n * This is accomplished by preventing MiTM attacks between the SDK and the RevenueCat server.\n * With verification enabled, the SDK ensures that the response created by the server was not\n * modified by a third-party, and the response received is exactly what was sent.\n *\n * - Note: Verification is only performed if enabled using PurchasesConfiguration's\n * entitlementVerificationMode property. This is disabled by default.\n *\n * @public\n */\nexport var VERIFICATION_RESULT;\n(function (VERIFICATION_RESULT) {\n /**\n * No verification was done.\n *\n * This value is returned when verification is not enabled in PurchasesConfiguration\n */\n VERIFICATION_RESULT[\"NOT_REQUESTED\"] = \"NOT_REQUESTED\";\n /**\n * Verification with our server was performed successfully.\n */\n VERIFICATION_RESULT[\"VERIFIED\"] = \"VERIFIED\";\n /**\n * Verification failed, possibly due to a MiTM attack.\n */\n VERIFICATION_RESULT[\"FAILED\"] = \"FAILED\";\n /**\n * Verification was performed on device.\n */\n VERIFICATION_RESULT[\"VERIFIED_ON_DEVICE\"] = \"VERIFIED_ON_DEVICE\";\n})(VERIFICATION_RESULT || (VERIFICATION_RESULT = {}));\n/**\n * The result of presenting a paywall. This will be the last situation the user experienced before the\n * paywall closed.\n *\n * @public\n */\nexport var PAYWALL_RESULT;\n(function (PAYWALL_RESULT) {\n /**\n * If the paywall wasn't presented. Only returned when using \"presentPaywallIfNeeded\"\n */\n PAYWALL_RESULT[\"NOT_PRESENTED\"] = \"NOT_PRESENTED\";\n /**\n * If an error happened during purchase/restoration.\n */\n PAYWALL_RESULT[\"ERROR\"] = \"ERROR\";\n /**\n * If the paywall was closed without performing an operation\n */\n PAYWALL_RESULT[\"CANCELLED\"] = \"CANCELLED\";\n /**\n * If a successful purchase happened inside the paywall\n */\n PAYWALL_RESULT[\"PURCHASED\"] = \"PURCHASED\";\n /**\n * If a successful restore happened inside the paywall\n */\n PAYWALL_RESULT[\"RESTORED\"] = \"RESTORED\";\n})(PAYWALL_RESULT || (PAYWALL_RESULT = {}));\n/**\n * Defines which version of StoreKit may be used\n * @public\n */\nexport var STOREKIT_VERSION;\n(function (STOREKIT_VERSION) {\n /**\n * Always use StoreKit 1.\n */\n STOREKIT_VERSION[\"STOREKIT_1\"] = \"STOREKIT_1\";\n /**\n * Always use StoreKit 2 (StoreKit 1 will be used if StoreKit 2 is not available in the current device.)\n * - Warning: Make sure you have an In-App Purchase Key configured in your app.\n * Please see https://rev.cat/in-app-purchase-key-configuration for more info.\n */\n STOREKIT_VERSION[\"STOREKIT_2\"] = \"STOREKIT_2\";\n /**\n * Let RevenueCat use the most appropriate version of StoreKit\n */\n STOREKIT_VERSION[\"DEFAULT\"] = \"DEFAULT\";\n})(STOREKIT_VERSION || (STOREKIT_VERSION = {}));\n/**\n * Modes for completing the purchase process.\n * @public\n */\nexport var PURCHASES_ARE_COMPLETED_BY_TYPE;\n(function (PURCHASES_ARE_COMPLETED_BY_TYPE) {\n /**\n * RevenueCat will **not** automatically acknowledge any purchases. You will have to do so manually.\n *\n * **Note:** failing to acknowledge a purchase within 3 days will lead to Google Play automatically issuing a\n * refund to the user.\n *\n * For more info, see [revenuecat.com](https://docs.revenuecat.com/docs/observer-mode#option-2-client-side).\n */\n PURCHASES_ARE_COMPLETED_BY_TYPE[\"MY_APP\"] = \"MY_APP\";\n /**\n * RevenueCat will automatically acknowledge verified purchases. No action is required by you.\n */\n PURCHASES_ARE_COMPLETED_BY_TYPE[\"REVENUECAT\"] = \"REVENUECAT\";\n})(PURCHASES_ARE_COMPLETED_BY_TYPE || (PURCHASES_ARE_COMPLETED_BY_TYPE = {}));\n","/**\n * The result type of a Redemption Link redemption attempt.\n * @public\n */\nexport var WebPurchaseRedemptionResultType;\n(function (WebPurchaseRedemptionResultType) {\n /**\n * The redemption was successful.\n */\n WebPurchaseRedemptionResultType[\"SUCCESS\"] = \"SUCCESS\";\n /**\n * The redemption failed.\n */\n WebPurchaseRedemptionResultType[\"ERROR\"] = \"ERROR\";\n /**\n * The purchase associated to the link belongs to another user.\n */\n WebPurchaseRedemptionResultType[\"PURCHASE_BELONGS_TO_OTHER_USER\"] = \"PURCHASE_BELONGS_TO_OTHER_USER\";\n /**\n * The token is invalid.\n */\n WebPurchaseRedemptionResultType[\"INVALID_TOKEN\"] = \"INVALID_TOKEN\";\n /**\n * The token has expired. A new Redemption Link will be sent to the email used during purchase.\n */\n WebPurchaseRedemptionResultType[\"EXPIRED\"] = \"EXPIRED\";\n})(WebPurchaseRedemptionResultType || (WebPurchaseRedemptionResultType = {}));\n","import { PAYWALL_RESULT } from '@revenuecat/purchases-typescript-internal-esm';\n/** How the native SDK presents the flow selected by a checkpoint. */\nexport var FLOW_PRESENTATION_MODE;\n(function (FLOW_PRESENTATION_MODE) {\n /** Let the native SDK choose how to present the flow. */\n FLOW_PRESENTATION_MODE[\"DEFAULT\"] = \"DEFAULT\";\n /** Present the flow as a modal that covers the whole screen. */\n FLOW_PRESENTATION_MODE[\"MODAL_FULL_SCREEN\"] = \"MODAL_FULL_SCREEN\";\n /** Present the flow as a modal sheet over the app's content. */\n FLOW_PRESENTATION_MODE[\"MODAL_SHEET\"] = \"MODAL_SHEET\";\n})(FLOW_PRESENTATION_MODE || (FLOW_PRESENTATION_MODE = {}));\n/**\n * Possible outcomes from a custom {@link PurchaseLogic} operation.\n */\nexport var PURCHASE_LOGIC_RESULT;\n(function (PURCHASE_LOGIC_RESULT) {\n /** The purchase or restore completed successfully. */\n PURCHASE_LOGIC_RESULT[\"SUCCESS\"] = \"SUCCESS\";\n /** The user cancelled the purchase or restore. */\n PURCHASE_LOGIC_RESULT[\"CANCELLATION\"] = \"CANCELLATION\";\n /** The purchase or restore failed with an error. */\n PURCHASE_LOGIC_RESULT[\"ERROR\"] = \"ERROR\";\n})(PURCHASE_LOGIC_RESULT || (PURCHASE_LOGIC_RESULT = {}));\n/** @see {@link IOSPaywallPresentationStyle} */\nexport const IOS_PAYWALL_PRESENTATION_STYLE = {\n /** Presents the paywall in full-screen mode. */\n FULL_SCREEN: 'FULL_SCREEN',\n /** Presents the paywall as a sheet. This is the default on iOS. */\n SHEET: 'SHEET',\n};\n/** @see {@link AndroidPaywallPresentationStyle} */\nexport const ANDROID_PAYWALL_PRESENTATION_STYLE = {\n /** Presents the paywall in full-screen mode. This is the default on Android. */\n FULL_SCREEN: 'FULL_SCREEN',\n};\n/** Convenience presets for {@link PaywallPresentationConfiguration}. */\nexport const PaywallPresentationConfiguration = {\n /** Full-screen presentation on all platforms. */\n FULL_SCREEN: {\n ios: IOS_PAYWALL_PRESENTATION_STYLE.FULL_SCREEN,\n android: ANDROID_PAYWALL_PRESENTATION_STYLE.FULL_SCREEN,\n },\n /** Default presentation: sheet on iOS, full-screen on Android. */\n DEFAULT: {\n ios: IOS_PAYWALL_PRESENTATION_STYLE.SHEET,\n android: ANDROID_PAYWALL_PRESENTATION_STYLE.FULL_SCREEN,\n },\n};\n// Using the enum from purchases-typescript-internal-esm instead of defining our own\nexport { PAYWALL_RESULT as PaywallResultEnum };\n//# sourceMappingURL=definitions.js.map","var __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\nimport { Capacitor, registerPlugin } from '@capacitor/core';\nimport { normalizePurchasesError } from '@revenuecat/purchases-typescript-internal-esm';\nimport { FLOW_PRESENTATION_MODE, IOS_PAYWALL_PRESENTATION_STYLE, ANDROID_PAYWALL_PRESENTATION_STYLE, PURCHASE_LOGIC_RESULT, } from './definitions';\nconst nativePlugin = registerPlugin('RevenueCatUI', {\n web: () => import('./web').then((m) => new m.RevenueCatUIWeb()),\n});\nfunction assertValidPresentationConfiguration(config) {\n if (config === undefined) {\n return;\n }\n if (typeof config !== 'object' || config === null) {\n throw new Error(`Invalid presentationConfiguration: expected an object or undefined.`);\n }\n const { ios, android } = config;\n const validIos = Object.values(IOS_PAYWALL_PRESENTATION_STYLE);\n const validAndroid = Object.values(ANDROID_PAYWALL_PRESENTATION_STYLE);\n if (ios !== undefined && !validIos.includes(ios)) {\n throw new Error(`Invalid presentationConfiguration.ios \"${String(ios)}\". Expected one of: ${validIos.join(', ')}.`);\n }\n if (android !== undefined && !validAndroid.includes(android)) {\n throw new Error(`Invalid presentationConfiguration.android \"${String(android)}\". Expected one of: ${validAndroid.join(', ')}.`);\n }\n}\nfunction resolveNativePresentationOptions(config) {\n if (!config) {\n return {};\n }\n // iOS full-screen takes precedence as the flag that the native bridge understands\n if (config.ios === IOS_PAYWALL_PRESENTATION_STYLE.FULL_SCREEN) {\n return { useFullScreenPresentation: true };\n }\n return {};\n}\nfunction serializeResultForNative(result) {\n if (result.result === PURCHASE_LOGIC_RESULT.ERROR && 'error' in result && result.error) {\n return {\n result: result.result,\n error: {\n code: result.error.code,\n message: result.error.message,\n },\n };\n }\n return { result: result.result };\n}\nasync function presentWithListenerSupport(nativeMethod, options, listener, purchaseLogic) {\n const handles = [];\n try {\n // Register PaywallListener event handlers\n if (listener) {\n if (listener.onPurchaseStarted) {\n const cb = listener.onPurchaseStarted;\n handles.push(await nativePlugin.addListener('onPurchaseStarted', (data) => {\n var _a;\n cb({ packageBeingPurchased: (_a = data.packageBeingPurchased) !== null && _a !== void 0 ? _a : data });\n }));\n }\n if (listener.onPurchaseCompleted) {\n const cb = listener.onPurchaseCompleted;\n handles.push(await nativePlugin.addListener('onPurchaseCompleted', (data) => {\n cb({\n customerInfo: data.customerInfo,\n storeTransaction: data.storeTransaction,\n });\n }));\n }\n if (listener.onPurchaseError) {\n const cb = listener.onPurchaseError;\n handles.push(await nativePlugin.addListener('onPurchaseError', (data) => {\n var _a;\n cb({ error: normalizePurchasesError((_a = data.error) !== null && _a !== void 0 ? _a : data) });\n }));\n }\n if (listener.onPurchaseCancelled) {\n const cb = listener.onPurchaseCancelled;\n handles.push(await nativePlugin.addListener('onPurchaseCancelled', () => {\n cb();\n }));\n }\n if (listener.onRestoreStarted) {\n const cb = listener.onRestoreStarted;\n handles.push(await nativePlugin.addListener('onRestoreStarted', () => {\n cb();\n }));\n }\n if (listener.onRestoreCompleted) {\n const cb = listener.onRestoreCompleted;\n handles.push(await nativePlugin.addListener('onRestoreCompleted', (data) => {\n var _a;\n cb({ customerInfo: (_a = data.customerInfo) !== null && _a !== void 0 ? _a : data });\n }));\n }\n if (listener.onRestoreError) {\n const cb = listener.onRestoreError;\n handles.push(await nativePlugin.addListener('onRestoreError', (data) => {\n var _a;\n cb({ error: normalizePurchasesError((_a = data.error) !== null && _a !== void 0 ? _a : data) });\n }));\n }\n if (listener.onWebCheckoutOpened) {\n const cb = listener.onWebCheckoutOpened;\n handles.push(await nativePlugin.addListener('onWebCheckoutOpened', () => {\n cb();\n }));\n }\n if (listener.onUrlOpened) {\n const cb = listener.onUrlOpened;\n handles.push(await nativePlugin.addListener('onUrlOpened', (data) => {\n cb({ url: data.url });\n }));\n }\n if (listener.onInteraction) {\n handles.push(await nativePlugin.addListener('onInteraction', listener.onInteraction));\n }\n }\n // Always register onPurchaseInitiated so we auto-resume when the user\n // doesn't provide an onPurchaseInitiated callback — otherwise the\n // purchase flow hangs waiting for a resume that never comes.\n // This must be outside the `if (listener)` block because the native\n // delegate adapter always fires this event (even with purchaseLogic only).\n const onPurchaseInitiatedCb = listener === null || listener === void 0 ? void 0 : listener.onPurchaseInitiated;\n handles.push(await nativePlugin.addListener('onPurchaseInitiated', (data) => {\n var _a;\n const requestId = data.requestId;\n const packageBeingPurchased = (_a = data.package) !== null && _a !== void 0 ? _a : data.packageBeingPurchased;\n if (onPurchaseInitiatedCb) {\n onPurchaseInitiatedCb({\n packageBeingPurchased,\n resumable: {\n resume(shouldProceed = true) {\n nativePlugin.resumePurchaseInitiated({ requestId, shouldProceed });\n },\n },\n });\n }\n else {\n // No callback provided — auto-proceed with the purchase.\n nativePlugin.resumePurchaseInitiated({ requestId, shouldProceed: true });\n }\n }));\n // Register PurchaseLogic event handlers\n if (purchaseLogic) {\n handles.push(await nativePlugin.addListener('onPerformPurchaseRequest', async (data) => {\n var _a, _b, _c;\n const requestId = data.requestId;\n const packageToPurchase = (_b = (_a = data.package) !== null && _a !== void 0 ? _a : data.packageBeingPurchased) !== null && _b !== void 0 ? _b : data.packageToPurchase;\n try {\n const result = await purchaseLogic.performPurchase({ packageToPurchase });\n await nativePlugin.resumePurchaseLogicPurchase(Object.assign({ requestId }, serializeResultForNative(result)));\n }\n catch (e) {\n await nativePlugin.resumePurchaseLogicPurchase({\n requestId,\n result: PURCHASE_LOGIC_RESULT.ERROR,\n error: { message: (_c = e === null || e === void 0 ? void 0 : e.message) !== null && _c !== void 0 ? _c : 'Unknown error' },\n });\n }\n }));\n handles.push(await nativePlugin.addListener('onPerformRestoreRequest', async (data) => {\n var _a;\n const requestId = data.requestId;\n try {\n const result = await purchaseLogic.performRestore();\n await nativePlugin.resumePurchaseLogicRestore(Object.assign({ requestId }, serializeResultForNative(result)));\n }\n catch (e) {\n await nativePlugin.resumePurchaseLogicRestore({\n requestId,\n result: PURCHASE_LOGIC_RESULT.ERROR,\n error: { message: (_a = e === null || e === void 0 ? void 0 : e.message) !== null && _a !== void 0 ? _a : 'Unknown error' },\n });\n }\n }));\n }\n // Call native with serializable-only options\n const nativeOptions = Object.assign(Object.assign({}, options), { hasPaywallListener: !!listener, hasPurchaseLogic: !!purchaseLogic });\n // Remove non-serializable fields\n delete nativeOptions.listener;\n delete nativeOptions.purchaseLogic;\n return await nativeMethod(nativeOptions);\n }\n finally {\n // Clean up all registered listeners\n for (const handle of handles) {\n await handle.remove();\n }\n }\n}\nconst checkpointCallIdPrefix = `${Date.now()}-${Math.random()}`;\nlet nextCheckpointCallId = 0;\nconst RevenueCatUI = {\n async checkpoint(identifier, onPassed, params = {}) {\n var _a;\n if (Capacitor.getPlatform() !== 'ios' && Capacitor.getPlatform() !== 'android') {\n throw new Error('[RevenueCatUI] Checkpoints require a native iOS or Android build.');\n }\n const callId = `${checkpointCallIdPrefix}-${++nextCheckpointCallId}`;\n let active = true;\n let removal;\n // Register before starting: an unconfigured checkpoint identifier may pass immediately.\n const handle = await nativePlugin.addListener('checkpointPassed', (event) => {\n if (!active || event.callId !== callId)\n return;\n active = false;\n removal = handle.remove();\n void removal.catch((error) => console.warn('[RevenueCatUI] Failed to remove checkpoint listener:', error));\n onPassed(event.result);\n });\n const remove = () => {\n active = false;\n return (removal !== null && removal !== void 0 ? removal : (removal = handle.remove()));\n };\n try {\n await nativePlugin.checkpoint(Object.assign(Object.assign({ identifier,\n callId }, (params.customVariables !== undefined ? { customVariables: params.customVariables } : {})), { presentationMode: (_a = params.presentationMode) !== null && _a !== void 0 ? _a : FLOW_PRESENTATION_MODE.DEFAULT }));\n }\n catch (error) {\n await remove().catch((cleanupError) => console.warn('[RevenueCatUI] Failed to remove checkpoint listener:', cleanupError));\n throw error;\n }\n return remove;\n },\n async presentPaywall(options) {\n assertValidPresentationConfiguration(options === null || options === void 0 ? void 0 : options.presentationConfiguration);\n const _a = options !== null && options !== void 0 ? options : {}, { presentationConfiguration, listener, purchaseLogic } = _a, rest = __rest(_a, [\"presentationConfiguration\", \"listener\", \"purchaseLogic\"]);\n const nativeOpts = Object.assign(Object.assign({}, rest), resolveNativePresentationOptions(presentationConfiguration));\n if (!listener && !purchaseLogic) {\n return nativePlugin.presentPaywall(nativeOpts);\n }\n return presentWithListenerSupport((opts) => nativePlugin.presentPaywall(opts), nativeOpts, listener, purchaseLogic);\n },\n async presentPaywallIfNeeded(options) {\n assertValidPresentationConfiguration(options === null || options === void 0 ? void 0 : options.presentationConfiguration);\n const { presentationConfiguration, listener, purchaseLogic } = options, rest = __rest(options, [\"presentationConfiguration\", \"listener\", \"purchaseLogic\"]);\n const nativeOpts = Object.assign(Object.assign({}, rest), resolveNativePresentationOptions(presentationConfiguration));\n if (!listener && !purchaseLogic) {\n return nativePlugin.presentPaywallIfNeeded(nativeOpts);\n }\n return presentWithListenerSupport((opts) => nativePlugin.presentPaywallIfNeeded(opts), nativeOpts, listener, purchaseLogic);\n },\n async presentCustomerCenter() {\n return nativePlugin.presentCustomerCenter();\n },\n setMockWebResults: nativePlugin.setMockWebResults\n ? async (options) => {\n return nativePlugin.setMockWebResults(options);\n }\n : undefined,\n addListener(eventName, listener) {\n return nativePlugin.addListener(eventName, listener);\n },\n removeAllListeners() {\n return nativePlugin.removeAllListeners();\n },\n};\nexport * from './definitions';\nexport { PAYWALL_RESULT } from '@revenuecat/purchases-typescript-internal-esm';\nexport { RevenueCatUI };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nimport { PAYWALL_RESULT } from '@revenuecat/purchases-typescript-internal-esm';\nexport class RevenueCatUIWeb extends WebPlugin {\n constructor() {\n super();\n this.shouldMockWebResults = false;\n this.webNotSupportedErrorMessage = 'RevenueCatUI is not supported on web platforms.';\n }\n async checkpoint(_identifier, _onPassed, _params) {\n throw this.unimplemented('Checkpoints require a native iOS or Android build.');\n }\n async setMockWebResults(options) {\n this.shouldMockWebResults = options.shouldMockWebResults;\n return Promise.resolve();\n }\n async presentPaywall(options) {\n return this.mockReturningFunctionIfEnabled('presentPaywall', {\n result: PAYWALL_RESULT.NOT_PRESENTED,\n }, options);\n }\n async presentPaywallIfNeeded(options) {\n return this.mockReturningFunctionIfEnabled('presentPaywallIfNeeded', {\n result: PAYWALL_RESULT.NOT_PRESENTED,\n }, options);\n }\n async presentCustomerCenter() {\n return this.mockNonReturningFunctionIfEnabled('presentCustomerCenter');\n }\n async resumePurchaseInitiated(_options) {\n return this.mockNonReturningFunctionIfEnabled('resumePurchaseInitiated');\n }\n async resumePurchaseLogicPurchase(_options) {\n return this.mockNonReturningFunctionIfEnabled('resumePurchaseLogicPurchase');\n }\n async resumePurchaseLogicRestore(_options) {\n return this.mockNonReturningFunctionIfEnabled('resumePurchaseLogicRestore');\n }\n addListener(eventName, listener) {\n if (eventName !== 'paywallDisplayed' && eventName !== 'paywallDismissed') {\n console.warn(`Unsupported event: ${eventName}`);\n }\n return super.addListener(eventName, listener);\n }\n removeAllListeners() {\n return super.removeAllListeners();\n }\n mockNonReturningFunctionIfEnabled(functionName) {\n if (!this.shouldMockWebResults) {\n return Promise.reject(this.webNotSupportedErrorMessage);\n }\n console.log(`${functionName} called on web with mocking enabled. No-op`);\n return Promise.resolve();\n }\n mockReturningFunctionIfEnabled(functionName, returnValue, options) {\n if (!this.shouldMockWebResults) {\n return Promise.reject(this.webNotSupportedErrorMessage);\n }\n console.log(`${functionName} called on web with mocking enabled. Returning mocked value`, options);\n return Promise.resolve(returnValue);\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["this","PAYWALL_RESULT","FLOW_PRESENTATION_MODE","PURCHASE_LOGIC_RESULT","registerPlugin","Capacitor","WebPlugin"],"mappings":";;;IAAA;IACA;IACA;IACA;IACA;IACA;IACO,IAAI,oBAAoB;IAC/B,CAAC,UAAU,oBAAoB,EAAE;IACjC,IAAI,oBAAoB,CAAC,eAAe,CAAC,GAAG,GAAG;IAC/C,IAAI,oBAAoB,CAAC,0BAA0B,CAAC,GAAG,GAAG;IAC1D,IAAI,oBAAoB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Y,CAAC,2DAA2D,CAAC,EAAE,OAAO,CAAC;IAC1G,QAAQ,OAAO,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC;IAC3C,IAAI;IACJ;;;;;;;;;;;;;;;;;;;","x_google_ignoreList":[0,1,2,3,4,5]}
@@ -0,0 +1,39 @@
1
+ import Foundation
2
+ import Capacitor
3
+ import PurchasesHybridCommonUI
4
+
5
+ extension RevenueCatUIPlugin {
6
+ @objc func checkpoint(_ call: CAPPluginCall) {
7
+ DispatchQueue.main.async { [weak self] in
8
+ guard let self else {
9
+ call.reject("Plugin instance was deallocated", "CHECKPOINT_ERROR")
10
+ return
11
+ }
12
+ guard let identifier = call.getString("identifier"),
13
+ let callId = call.getString("callId") else {
14
+ call.reject("Missing checkpoint identifier or callId", "BAD_ARGS")
15
+ return
16
+ }
17
+ #if targetEnvironment(macCatalyst)
18
+ call.reject("Checkpoints require iOS", "UNSUPPORTED_PLATFORM")
19
+ return
20
+ #else
21
+ var setupFailed = false
22
+ CheckpointProxy.present(
23
+ identifier: identifier,
24
+ customVariables: call.getObject("customVariables"),
25
+ presentationMode: call.getString("presentationMode"),
26
+ onPassed: { [weak self] result in
27
+ self?.notifyListeners("checkpointPassed", data: ["callId": callId, "result": result])
28
+ },
29
+ onError: { code, message in
30
+ setupFailed = true
31
+ call.reject(message, code)
32
+ }
33
+ )
34
+ // PHC reports startup failures synchronously. Passing the checkpoint is a separate event.
35
+ if !setupFailed { call.resolve() }
36
+ #endif
37
+ }
38
+ }
39
+ }
@@ -12,6 +12,7 @@ public class RevenueCatUIPlugin: CAPPlugin, CAPBridgedPlugin {
12
12
  public let identifier = "RevenueCatUIPlugin"
13
13
  public let jsName = "RevenueCatUI"
14
14
  public let pluginMethods: [CAPPluginMethod] = [
15
+ CAPPluginMethod(name: "checkpoint", returnType: CAPPluginReturnPromise),
15
16
  CAPPluginMethod(name: "presentPaywall", returnType: CAPPluginReturnPromise),
16
17
  CAPPluginMethod(name: "presentPaywallIfNeeded", returnType: CAPPluginReturnPromise),
17
18
  CAPPluginMethod(name: "presentCustomerCenter", returnType: CAPPluginReturnPromise),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@revenuecat/purchases-capacitor-ui",
3
- "version": "14.0.0",
3
+ "version": "14.1.0",
4
4
  "packageManager": "yarn@1.22.22",
5
5
  "description": "UI components for RevenueCat Capacitor SDK",
6
6
  "main": "dist/esm/index.js",
@@ -66,11 +66,11 @@
66
66
  },
67
67
  "dependencies": {
68
68
  "@capacitor/core": "^8.0.0",
69
- "@revenuecat/purchases-typescript-internal-esm": "20.0.0"
69
+ "@revenuecat/purchases-typescript-internal-esm": "20.1.0"
70
70
  },
71
71
  "peerDependencies": {
72
72
  "@capacitor/core": ">=8.0.0",
73
- "@revenuecat/purchases-capacitor": "14.0.0"
73
+ "@revenuecat/purchases-capacitor": "14.1.0"
74
74
  },
75
75
  "lint-staged": {
76
76
  "*.{ts,tsx}": [