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,