diff --git a/content/docs/expo/changelog.mdx b/content/docs/expo/changelog.mdx index b23b01e0..a2183450 100644 --- a/content/docs/expo/changelog.mdx +++ b/content/docs/expo/changelog.mdx @@ -5,6 +5,13 @@ description: "Release notes for the Superwall Expo SDK" # Changelog +## 1.0.3 + +### Patch Changes + +- Update Android & iOS SDKs, add Custom callbacks +- Update Android to 2.7.2, fixing experimental properties option + ## 1.0.2 ### Patch Changes diff --git a/content/docs/expo/index.mdx b/content/docs/expo/index.mdx index 4ad70b61..453727ed 100644 --- a/content/docs/expo/index.mdx +++ b/content/docs/expo/index.mdx @@ -39,4 +39,4 @@ If you have feedback on any of our docs, please leave a rating and message at th If you have any issues please [open an issue on GitHub](https://github.com/superwall/expo-superwall/issues). - + diff --git a/content/docs/expo/sdk-reference/hooks/usePlacement.mdx b/content/docs/expo/sdk-reference/hooks/usePlacement.mdx index 7607bd5b..9cfc4d0e 100644 --- a/content/docs/expo/sdk-reference/hooks/usePlacement.mdx +++ b/content/docs/expo/sdk-reference/hooks/usePlacement.mdx @@ -48,6 +48,10 @@ function usePlacement( type: "(error: string) => void", description: "Called when the paywall fails to present or another SDK error occurs.", }, + onCustomCallback: { + type: "(callback: CustomCallback) => Promise | CustomCallbackResult", + description: "Called when a custom callback is invoked from a paywall. Return a result to send back to the paywall.", + }, }} /> @@ -112,6 +116,36 @@ function usePlacement( }} /> +### CustomCallback +?", + description: "Optional variables passed from the paywall.", + }, + }} +/> + +### CustomCallbackResult +?", + description: "Optional key-value pairs to return to the paywall.", + }, + }} +/> + ## Usage ```tsx import { Button, Text } from "react-native" @@ -125,6 +159,11 @@ export default function PremiumButton() { onSkip: (reason) => console.log("Paywall skipped:", reason.type), onError: (error) => console.error("Paywall error:", error), + onCustomCallback: async (callback) => { + // Handle custom callbacks from the paywall + console.log("Custom callback:", callback.name, callback.variables) + return { status: "success", data: { validated: true } } + }, }) const unlockFeature = async () => { diff --git a/content/docs/expo/sdk-reference/hooks/useSuperwallEvents.mdx b/content/docs/expo/sdk-reference/hooks/useSuperwallEvents.mdx index b91ecaf6..c261e7e5 100644 --- a/content/docs/expo/sdk-reference/hooks/useSuperwallEvents.mdx +++ b/content/docs/expo/sdk-reference/hooks/useSuperwallEvents.mdx @@ -99,6 +99,10 @@ The `useSuperwallEvents` hook provides a low-level way to subscribe to *any* nat type: "(paywallInfo: PaywallInfo) => boolean", description: "Android only. Triggered when a rerouted paywall back button is pressed. Return true to consume the event.", }, + onCustomCallback: { + type: "(callback: CustomCallback) => Promise | CustomCallbackResult", + description: "Called when a custom callback is invoked from a paywall. Custom callbacks allow paywalls to communicate with the app to perform operations like validation or data fetching. Return a result to send back to the paywall.", + }, handlerId: { type: "string?", description: "Optional scope for paywall events from a specific registerPlacement handler.", diff --git a/content/docs/expo/sdk-reference/index.mdx b/content/docs/expo/sdk-reference/index.mdx index 21c55bdc..6f28d3d5 100644 --- a/content/docs/expo/sdk-reference/index.mdx +++ b/content/docs/expo/sdk-reference/index.mdx @@ -15,4 +15,4 @@ If you have feedback on any of our docs, please leave a rating and message at th If you have any issues with the SDK, please [open an issue on GitHub](https://github.com/superwall/expo-superwall/issues). - +