From d01756833be13f23602f8c2f2e6d283a5596be6d Mon Sep 17 00:00:00 2001 From: Toni Rico Date: Thu, 13 Nov 2025 11:35:38 +0100 Subject: [PATCH] Use new presentPaywall in purchases-js-hybrid-mappings --- .../src/preview/nativeModules.ts | 27 ++++++++++++++++--- react-native-purchases-ui/tsconfig.json | 2 +- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/react-native-purchases-ui/src/preview/nativeModules.ts b/react-native-purchases-ui/src/preview/nativeModules.ts index b80b85436..52b9cf470 100644 --- a/react-native-purchases-ui/src/preview/nativeModules.ts +++ b/react-native-purchases-ui/src/preview/nativeModules.ts @@ -1,3 +1,4 @@ +import { PurchasesCommon } from "@revenuecat/purchases-js-hybrid-mappings" import { PAYWALL_RESULT } from "@revenuecat/purchases-typescript-internal" /** @@ -6,12 +7,30 @@ import { PAYWALL_RESULT } from "@revenuecat/purchases-typescript-internal" */ export const previewNativeModuleRNPaywalls = { - presentPaywall: () => { - return PAYWALL_RESULT.NOT_PRESENTED + presentPaywall: async ( + offeringIdentifier?: string, + presentedOfferingContext?: Record, + _displayCloseButton?: boolean, + _fontFamily?: string | null, + ): Promise => { + return await PurchasesCommon.getInstance().presentPaywall({ + offeringIdentifier, + presentedOfferingContext, + }) as PAYWALL_RESULT; }, - presentPaywallIfNeeded: () => { - return PAYWALL_RESULT.NOT_PRESENTED + presentPaywallIfNeeded: async ( + requiredEntitlementIdentifier: string, + offeringIdentifier?: string, + presentedOfferingContext?: Record, + _displayCloseButton?: boolean, + _fontFamily?: string | null, + ) => { + return await PurchasesCommon.getInstance().presentPaywall({ + requiredEntitlementIdentifier, + offeringIdentifier, + presentedOfferingContext, + }) as PAYWALL_RESULT; }, } diff --git a/react-native-purchases-ui/tsconfig.json b/react-native-purchases-ui/tsconfig.json index 47bda6df7..9c8fc277d 100644 --- a/react-native-purchases-ui/tsconfig.json +++ b/react-native-purchases-ui/tsconfig.json @@ -9,7 +9,7 @@ "esModuleInterop": true, "forceConsistentCasingInFileNames": true, "jsx": "react", - "lib": ["esnext"], + "lib": ["esnext", "dom"], "module": "esnext", "moduleResolution": "node", "noFallthroughCasesInSwitch": true,