expo-superwall 0.0.11 → 0.0.12

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.0.12
4
+
5
+ ### Patch Changes
6
+
7
+ - 4751b75: Fixes issues with identify on Android, updates Android SDK to 2.2.3
8
+
3
9
  ## 0.0.11
4
10
 
5
11
  ### Patch Changes
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  <p align="center">
2
2
  <br />
3
- <img src="https://i.imgur.com/7y68VTw.png" alt="logo" height="150px" />
3
+ <img src=https://user-images.githubusercontent.com/3296904/158817914-144c66d0-572d-43a4-9d47-d7d0b711c6d7.png alt="logo" height="100px" />
4
4
  <h3 style="font-size:26" align="center">In-App Paywalls Made Easy 💸</h3>
5
5
  <br />
6
6
  </p>
@@ -15,129 +15,379 @@
15
15
 
16
16
  This repository contains two SDKs for integrating Superwall with your Expo app:
17
17
 
18
- * **For new projects:** We recommend using our new **Hooks-based SDK**. Get started with the [Expo Superwall Hooks SDK Guide](./HOOK_SDK_GETTING_STARTED.md).
19
- * **For migrating from the Superwall React Native SDK:** Get setup in minutes with the **legacy/compat SDK (`expo-superwall/compat`)** below
18
+ * **For new projects:** We recommend using our new **Hooks-based SDK**. See the guide below.
19
+ * **For migrating from the Superwall React Native SDK:** Get setup in minutes with the [legacy/compat SDK (`expo-superwall/compat`) guide](./COMPAT_SDK_GETTING_STARTED.md).
20
20
  * **For older Expo SDKs:** Please refer to our [legacy React Native SDK](https://github.com/superwall/react-native-superwall).
21
21
 
22
- The documentation below primarily covers the **legacy/compat SDK (`expo-superwall/compat`)**. If you are using the new Hooks SDK, please refer to its specific [getting started guide](./HOOK_SDK_GETTING_STARTED.md).
23
-
24
- [Superwall](https://superwall.com/) lets you remotely configure every aspect of your paywall — helping you find winners quickly.
25
-
26
- ## Superwall
27
-
28
- **Superwall** is an open source framework that provides a wrapper for presenting and creating paywalls. It interacts with the Superwall backend letting you easily iterate paywalls on the fly in `React Native`!
29
-
30
- ## Features
31
- | | Superwall |
32
- | --- | --- |
33
- ✅ | Server-side paywall iteration
34
- 🎯 | Paywall conversion rate tracking - know whether a user converted after seeing a paywall
35
- 🆓 | Trial start rate tracking - know and measure your trial start rate out of the box
36
- 📊 | Analytics - automatic calculation of metrics like conversion and views
37
- ✏️ | A/B Testing - automatically calculate metrics for different paywalls
38
- 📝 | [Online documentation](https://superwall.com/docs/home) up to date
39
- 🔀 | [Integrations](https://superwall.com/docs/home) - over a dozen integrations to easily send conversion data where you need it
40
- 💯 | Well maintained - [frequent releases](https://superwall.com/docs/home)
41
- 📮 | Great support - email a founder: jake@superwall.com
42
-
22
+ ---
43
23
 
44
- ## Getting Started
24
+ # Getting Started with Expo Superwall SDK
45
25
 
46
- [Sign up for a free account on Superwall](https://superwall.com/sign-up) and [read our docs](https://superwall.com/docs/home).
26
+ This guide will help you integrate the Expo Superwall Hooks SDK into your React Native application, allowing you to easily manage users and display paywalls.
47
27
 
28
+ **Warning**: This SDK only supports Expo SDK Version >= 53. If you'd like to use older versions, please use our [legacy react-native sdk](https://github.com/superwall/react-native-superwall).
48
29
 
49
30
  ## Installation
50
31
 
32
+ First, you need to install the `expo-superwall` package. You can do this using npm or yarn:
33
+
51
34
  ```bash
52
35
  npx expo install expo-superwall
53
36
  # or
54
37
  bunx expo install expo-superwall
55
38
  ```
56
39
 
57
- > [!WARNING]
58
- > **Important: Expo SDK 53+ Required**
59
- >
60
- > This SDK is exclusively compatible with Expo SDK version 53 and newer.
61
- > For projects using older Expo versions, please use our [legacy React Native SDK](https://github.com/superwall/react-native-superwall).
40
+ ## Setup
62
41
 
63
- ### Basic Setup
42
+ To use the Superwall SDK, you need to wrap your application (or the relevant part of it) with the `<SuperwallProvider />`. This provider initializes the SDK with your API key.
64
43
 
65
44
  ```tsx
66
- import Superwall from "expo-superwall/compat"
67
- import { useEffect, useState } from "react"
68
- import { Platform } from "react-native"
69
-
70
- // Initialize Superwall
71
- useEffect(()=> {
72
- const apiKey = Platform.OS === "ios"
73
- ? "yourSuperwall_iOSKey"
74
- : "yourSuperwall_androidKey"
75
- await Superwall.configure({
76
- apiKey,
77
- })
78
- })
45
+ import { SuperwallProvider } from "expo-superwall";
46
+
47
+ // Replace with your actual Superwall API key
48
+ export default function App() {
49
+ return (
50
+ <SuperwallProvider apiKeys={{ ios: "YOUR_SUPERWALL_API_KEY" /* android: API_KEY */ }}>
51
+ {/* Your app content goes here */}
52
+ </SuperwallProvider>
53
+ );
54
+ }
79
55
  ```
80
56
 
81
- ### Identify User
57
+ **Note:** You can find your API key in your Superwall dashboard.
58
+
59
+ ## Basic Usage
60
+
61
+ The SDK provides hooks to interact with Superwall's features.
62
+
63
+ ### Handling Loading States
64
+
65
+ While the SDK is initializing, you can display a loading indicator. The `<SuperwallLoading />` and `<SuperwallLoaded />` components help manage this.
82
66
 
83
67
  ```tsx
84
- // Identify a user
85
- await Superwall.shared.identify({ userId })
86
-
87
- // Set User Attributes
88
- await Superwall.shared.setUserAttributes({
89
- someCustomVal: "abc",
90
- platform: Platform.OS,
91
- timestamp: new Date().toISOString(),
92
- })
68
+ import {
69
+ SuperwallProvider,
70
+ SuperwallLoading,
71
+ SuperwallLoaded,
72
+ } from "expo-superwall";
73
+ import { ActivityIndicator, View, Text } from "react-native";
74
+
75
+ const API_KEY = "YOUR_SUPERWALL_API_KEY";
76
+
77
+ export default function App() {
78
+ return (
79
+ <SuperwallProvider apiKeys={{ ios: API_KEY }}>
80
+ <SuperwallLoading>
81
+ <ActivityIndicator style={{ flex: 1 }} />
82
+ </SuperwallLoading>
83
+ <SuperwallLoaded>
84
+ {/* Your main app screen or component */}
85
+ <MainAppScreen />
86
+ </SuperwallLoaded>
87
+ </SuperwallProvider>
88
+ );
89
+ }
90
+
91
+ function MainAppScreen() {
92
+ return (
93
+ <View style={{ flex: 1, alignItems: "center", justifyContent: "center" }}>
94
+ <Text>Superwall SDK is ready!</Text>
95
+ {/* Rest of your app's UI */}
96
+ </View>
97
+ );
98
+ }
93
99
  ```
94
100
 
101
+ ### Managing Users with `useUser`
95
102
 
96
- ### Present a Paywall
103
+ The `useUser` hook provides functions to identify users, sign them out, update their attributes, and access user and subscription status information.
97
104
 
98
105
  ```tsx
99
- // Present a paywall
100
- Superwall.shared.register({
101
- "yourPlacementName",
106
+ import { useUser } from "expo-superwall";
107
+ import { Button, Text, View } from "react-native";
108
+
109
+ function UserManagementScreen() {
110
+ const { identify, user, signOut, update, subscriptionStatus } = useUser();
111
+
112
+ const handleLogin = async () => {
113
+ // Identify the user with a unique ID
114
+ await identify(`user_${Date.now()}`);
115
+ };
116
+
117
+ const handleSignOut = async () => {
118
+ await signOut();
119
+ };
120
+
121
+ const handleUpdateUserAttributes = async () => {
122
+ // Update custom user attributes
123
+ await update((oldAttributes) => ({
124
+ ...oldAttributes,
125
+ customProperty: "new_value",
126
+ counter: (oldAttributes.counter || 0) + 1,
127
+ }));
128
+ };
129
+
130
+ return (
131
+ <View style={{ padding: 20 }}>
132
+ <Text>Subscription Status: {subscriptionStatus?.status ?? "unknown"}</Text>
133
+ {user && <Text>User ID: {user.appUserId}</Text>}
134
+ {user && <Text>User Attributes: {JSON.stringify(user, null, 2)}</Text>}
135
+
136
+ <Button title="Login" onPress={handleLogin} />
137
+ <Button title="Sign Out" onPress={handleSignOut} />
138
+ <Button title="Update Attributes" onPress={handleUpdateUserAttributes} />
139
+ </View>
140
+ );
141
+ }
142
+ ```
143
+
144
+ Key functions from `useUser`:
145
+ - `identify(userId)`: Identifies the current user with Superwall. This is typically called when a user logs in.
146
+ - `signOut()`: Signs the current user out. Call this when a user logs out.
147
+ - `update(attributesUpdater)`: Updates the user's attributes. You can provide a function that receives the old attributes and returns the new ones.
148
+ - `user`: An object containing the user's `appUserId` and other attributes.
149
+ - `subscriptionStatus`: An object indicating the user's subscription status (e.g., `active`, `inactive`).
150
+
151
+ ### Triggering Paywalls with `usePlacement`
152
+
153
+ The `usePlacement` hook allows you to register and trigger paywalls (placements) that you've configured in your Superwall dashboard.
154
+
155
+ ```tsx
156
+ import { usePlacement, useUser } from "expo-superwall";
157
+ import { Alert, Button, Text, View } from "react-native";
158
+
159
+ function PaywallScreen() {
160
+ const { registerPlacement, state: placementState } = usePlacement({
161
+ onError: (err) => console.error("Placement Error:", err),
162
+ onPresent: (info) => console.log("Paywall Presented:", info),
163
+ onDismiss: (info, result) =>
164
+ console.log("Paywall Dismissed:", info, "Result:", result),
165
+ });
166
+
167
+ const handleTriggerPlacement = async () => {
168
+ await registerPlacement({
169
+ placement: "your_placement_id", // Replace with your actual placement ID
102
170
  feature() {
103
- console.log(`Feature called!`)
171
+ // This function is called if the user is already subscribed
172
+ // or successfully subscribes through the paywall.
173
+ console.log("Feature unlocked!");
174
+ Alert.alert("Feature Unlocked!", "You can now access this feature.");
104
175
  },
105
- })
176
+ });
177
+ };
178
+
179
+ return (
180
+ <View style={{ padding: 20 }}>
181
+ <Button title="Show Paywall for 'your_placement_id'" onPress={handleTriggerPlacement} />
182
+ {placementState && (
183
+ <Text>Last Paywall Result: {JSON.stringify(placementState)}</Text>
184
+ )}
185
+ </View>
186
+ );
187
+ }
106
188
  ```
107
189
 
190
+ Key aspects of `usePlacement`:
191
+ - `registerPlacement(options)`: Registers and potentially presents a paywall.
192
+ - `options.placement`: The ID of the placement you want to show (e.g., "fishing" from the example, or "onboarding_paywall").
193
+ - `options.feature()`: A callback function that is executed if the user has access to the feature (either by already being subscribed or by purchasing through the presented paywall).
194
+ - Callbacks (passed as options to `usePlacement`):
195
+ - `onError`: Handles errors during paywall presentation.
196
+ - `onPresent`: Called when a paywall is presented.
197
+ - `onDismiss`: Called when a paywall is dismissed.
198
+ - `state`: An object returned by the hook, containing information about the last paywall presentation attempt (e.g., `presented`, `purchased`, `cancelled`, `skipped`).
199
+
200
+ This covers the basic setup and usage of the `expo-superwall` Hooks SDK. For more advanced scenarios and detailed API information, refer to the official Superwall documentation.
108
201
 
109
- ### Listen to Events
202
+ ---
203
+
204
+ ## Hooks API Reference
205
+
206
+ This section provides a detailed reference for each hook available in the `expo-superwall` SDK.
207
+
208
+ ### `useSuperwall`
209
+
210
+ **Purpose:**
211
+ The `useSuperwall` hook is the core hook that provides access to the Superwall store and underlying SDK functionality. It's generally used internally by other more specific hooks like `useUser` and `usePlacement`, but can be used directly for advanced scenarios. It ensures that native event listeners are set up on first use.
212
+
213
+ **Returned Values (Store State and Actions):**
214
+
215
+ The hook returns an object representing the Superwall store. If a `selector` function is provided, it returns the selected slice of the store.
216
+
217
+ - **State:**
218
+ - `isConfigured: boolean`: True if the Superwall SDK has been configured with an API key.
219
+ - `isLoading: boolean`: True when the SDK is performing an asynchronous operation like configuration.
220
+ - `listenersInitialized: boolean`: True if native event listeners have been initialized.
221
+ - `user?: UserAttributes | null`: An object containing the current user's attributes.
222
+ - `UserAttributes`:
223
+ - `aliasId: string`: The alias ID of the user.
224
+ - `appUserId: string`: The application-specific user ID.
225
+ - `applicationInstalledAt: string`: ISO date string of when the application was installed.
226
+ - `seed: number`: A seed value for the user.
227
+ - `[key: string]: any`: Other custom user attributes.
228
+ - `subscriptionStatus?: SubscriptionStatus`: The current subscription status of the user.
229
+ - `SubscriptionStatus` (see `SuperwallExpoModule.types.ts` for full details):
230
+ - `status: "UNKNOWN" | "INACTIVE" | "ACTIVE"`
231
+ - `entitlements?: Entitlement[]` (if status is "ACTIVE")
232
+ - `Entitlement`: `{ id: string, type: EntitlementType }`
233
+
234
+ - **Actions (Functions):**
235
+ - `configure: (apiKey: string, options?: Record<string, any>) => Promise<void>`: Initializes the Superwall SDK with the provided API key and optional configuration options.
236
+ - `identify: (userId: string, options?: IdentifyOptions) => Promise<void>`: Identifies the user with the given `userId`.
237
+ - `IdentifyOptions`:
238
+ - `restorePaywallAssignments?: boolean`: If true, restores paywall assignments from a previous session.
239
+ - `reset: () => Promise<void>`: Resets the user's identity and clears any stored user-specific data. This is equivalent to logging out the user.
240
+ - `registerPlacement: (placement: string, params?: Record<string, any>, handlerId?: string | null) => Promise<void>`: Registers a placement. This may or may not present a paywall depending on campaign rules. `handlerId` is used internally by `usePlacement` to associate events.
241
+ - `getPresentationResult: (placement: string, params?: Record<string, any>) => Promise<any>`: Gets the presentation result for a given placement.
242
+ - `dismiss: () => Promise<void>`: Dismisses any currently presented paywall.
243
+ - `preloadAllPaywalls: () => Promise<void>`: Preloads all paywalls.
244
+ - `preloadPaywalls: (placements: string[]) => Promise<void>`: Preloads paywalls for the specified placement IDs.
245
+ - `setUserAttributes: (attrs: Record<string, any>) => Promise<void>`: Sets custom attributes for the current user.
246
+ - `getUserAttributes: () => Promise<Record<string, any>>`: Retrieves the attributes of the current user.
247
+ - `setLogLevel: (level: string) => Promise<void>`: Sets the log level for the SDK. `level` can be one of: `"debug"`, `"info"`, `"warn"`, `"error"`, `"none"`.
248
+
249
+ **Selector (Optional Parameter):**
250
+
251
+ - `selector?: (state: SuperwallStore) => T`: A function that receives the entire `SuperwallStore` state and returns a selected part of it. Useful for performance optimization by only re-rendering components when the selected state changes. Uses `zustand/shallow` for shallow equality checking.
252
+
253
+ **Example (Direct Usage - Advanced):**
110
254
 
111
255
  ```tsx
112
- // 1. Define your superwall Delegat
113
- import {
114
- EventType,
115
- type PaywallInfo,
116
- type RedemptionResult,
117
- type SubscriptionStatus,
118
- SuperwallDelegate,
119
- type SuperwallEventInfo,
120
- } from "expo-superwall/compat"
121
-
122
- export class MyDelegate extends SuperwallDelegate {
123
- handleSuperwallEvent(eventInfo) {
124
- switch (eventInfo.event.type) {
125
- case EventType.paywallOpen:
126
- console.log("Paywall opened");
127
- break;
128
- case EventType.paywallClose:
129
- console.log("Paywall closed");
130
- break;
131
- }
256
+ import { useSuperwall } from 'expo-superwall';
257
+
258
+ function MyAdvancedComponent() {
259
+ const { isConfigured, configure, setUserAttributes } = useSuperwall();
260
+
261
+ if (!isConfigured) {
262
+ return <Text>SDK not configured yet.</Text>;
132
263
  }
264
+
265
+ const handleSetCustomAttribute = () => {
266
+ setUserAttributes({ myCustomFlag: true });
267
+ };
268
+
269
+ return <Button title="Set Custom Flag" onPress={handleSetCustomAttribute} />;
133
270
  }
271
+ ```
134
272
 
135
- // 2. Simply set the delegate
136
- const delegate = new MySuperwallDelegate()
137
- await Superwall.shared.setDelegate(delegate)
273
+ ### `useUser`
274
+
275
+ **Purpose:**
276
+ The `useUser` hook provides a convenient way to manage user identity and attributes, and access user-specific information like subscription status.
277
+
278
+ **Returned Values:**
279
+
280
+ An object containing:
281
+
282
+ - `identify: (userId: string, options?: IdentifyOptions) => Promise<void>`: Identifies the user with Superwall.
283
+ - `userId: string`: The unique identifier for the user.
284
+ - `options?: IdentifyOptions`: Optional parameters for identification.
285
+ - `restorePaywallAssignments?: boolean`: If true, attempts to restore paywall assignments for this user.
286
+ - `update: (attributes: Record<string, any> | ((old: Record<string, any>) => Record<string, any>)) => Promise<void>`: Updates the current user's attributes.
287
+ - `attributes`: Either an object of attributes to set/update, or a function that takes the old attributes and returns the new attributes.
288
+ - `signOut: () => void`: Resets the user's identity, effectively signing them out from Superwall's perspective.
289
+ - `refresh: () => Promise<Record<string, any>>`: Manually refreshes the user's attributes and subscription status from the Superwall servers. Returns the refreshed user attributes.
290
+ - `subscriptionStatus?: SubscriptionStatus`: The current subscription status of the user.
291
+ - `SubscriptionStatus`: (As defined in `useSuperwall` and `SuperwallExpoModule.types.ts`)
292
+ - `status: "UNKNOWN" | "INACTIVE" | "ACTIVE"`
293
+ - `entitlements?: Entitlement[]` (if status is "ACTIVE")
294
+ - `user?: UserAttributes | null`: An object containing the current user's attributes (e.g., `appUserId`, `aliasId`, custom attributes).
295
+ - `UserAttributes`: (As defined in `useSuperwall`)
296
+
297
+ **Example:**
298
+ (Covered in the Basic Usage section)
299
+
300
+ ### `usePlacement`
301
+
302
+ **Purpose:**
303
+ The `usePlacement` hook is designed to handle the presentation of paywalls based on placements configured in your Superwall dashboard. It manages the state of paywall presentation and provides callbacks for various events.
304
+
305
+ **Parameters:**
306
+
307
+ - `callbacks?: usePlacementCallbacks`: An optional object containing callback functions for different paywall events.
308
+ - `usePlacementCallbacks`:
309
+ - `onPresent?: (paywallInfo: PaywallInfo) => void`: Called when a paywall is presented.
310
+ - `paywallInfo: PaywallInfo`: Detailed information about the presented paywall (see `SuperwallExpoModule.types.ts`).
311
+ - `onDismiss?: (paywallInfo: PaywallInfo, result: PaywallResult) => void`: Called when a paywall is dismissed.
312
+ - `paywallInfo: PaywallInfo`: Information about the dismissed paywall.
313
+ - `result: PaywallResult`: The result of the paywall interaction (e.g., `purchased`, `declined`, `restored`). See `SuperwallExpoModule.types.ts`.
314
+ - `onSkip?: (reason: PaywallSkippedReason) => void`: Called when a paywall is skipped (e.g., due to holdout group, no audience match).
315
+ - `reason: PaywallSkippedReason`: The reason why the paywall was skipped. See `SuperwallExpoModule.types.ts`.
316
+ - `onError?: (error: string) => void`: Called when an error occurs during paywall presentation or other SDK operations related to this placement.
317
+ - `error: string`: The error message.
318
+
319
+ **Returned Values:**
320
+
321
+ An object containing:
322
+
323
+ - `registerPlacement: (args: RegisterPlacementArgs) => Promise<void>`: A function to register a placement and potentially trigger a paywall.
324
+ - `RegisterPlacementArgs`:
325
+ - `placement: string`: The placement name as defined on the Superwall dashboard.
326
+ - `params?: Record<string, any>`: Optional parameters to pass to the placement.
327
+ - `feature?: () => void`: An optional function to execute if the placement does *not* result in a paywall presentation (i.e., the user is allowed through, or is already subscribed).
328
+ - `state: PaywallState`: An object representing the current state of the paywall associated with this hook instance.
329
+ - `PaywallState`:
330
+ - `{ status: "idle" }`
331
+ - `{ status: "presented"; paywallInfo: PaywallInfo }`
332
+ - `{ status: "dismissed"; result: PaywallResult }`
333
+ - `{ status: "skipped"; reason: PaywallSkippedReason }`
334
+ - `{ status: "error"; error: string }`
335
+
336
+ **Example:**
337
+ (Covered in the Basic Usage section)
338
+
339
+ ### `useSuperwallEvents`
340
+
341
+ **Purpose:**
342
+ The `useSuperwallEvents` hook provides a low-level way to subscribe to *any* native Superwall event. This is useful for advanced use cases or for events not covered by the more specific hooks. Listeners are automatically cleaned up when the component using this hook unmounts.
343
+
344
+ **Parameters:**
345
+
346
+ - `callbacks?: SuperwallEventCallbacks`: An object where keys are event names and values are the corresponding callback functions.
347
+ - `SuperwallEventCallbacks`: (Refer to `src/useSuperwallEvents.ts` and `src/SuperwallExpoModule.types.ts` for a full list of subscribable events and their payload types. Common events include):
348
+ - `onPaywallPresent?: (info: PaywallInfo) => void`
349
+ - `onPaywallDismiss?: (info: PaywallInfo, result: PaywallResult) => void`
350
+ - `onPaywallSkip?: (reason: PaywallSkippedReason) => void`
351
+ - `onPaywallError?: (error: string) => void`
352
+ - `onSubscriptionStatusChange?: (status: SubscriptionStatus) => void`
353
+ - `onSuperwallEvent?: (eventInfo: SuperwallEventInfo) => void`: For generic Superwall events.
354
+ - `SuperwallEventInfo`: `{ event: SuperwallEvent, params: Record<string, any> }`
355
+ - `onCustomPaywallAction?: (name: string) => void`: When a custom action is triggered from a paywall.
356
+ - `willDismissPaywall?: (info: PaywallInfo) => void`
357
+ - `willPresentPaywall?: (info: PaywallInfo) => void`
358
+ - `didDismissPaywall?: (info: PaywallInfo) => void`
359
+ - `didPresentPaywall?: (info: PaywallInfo) => void`
360
+ - `onPaywallWillOpenURL?: (url: string) => void`
361
+ - `onPaywallWillOpenDeepLink?: (url: string) => void`
362
+ - `onLog?: (params: { level: LogLevel, scope: LogScope, message: string | null, info: Record<string, any> | null, error: string | null }) => void`
363
+ - `handlerId?: string`: (Optional) If provided, some events like `onPaywallPresent`, `onPaywallDismiss`, `onPaywallSkip` will only be triggered if the event originated from a `registerPlacement` call associated with the same `handlerId`. This is used internally by `usePlacement`.
364
+
365
+ **Returned Values:**
366
+
367
+ This hook does not return any values (`void`). Its purpose is to set up and tear down event listeners.
368
+
369
+ **Example:**
138
370
 
371
+ ```tsx
372
+ import { useSuperwallEvents } from 'expo-superwall';
373
+
374
+ function EventLogger() {
375
+ useSuperwallEvents({
376
+ onSuperwallEvent: (eventInfo) => {
377
+ console.log('Superwall Event:', eventInfo.event.event, eventInfo.params);
378
+ },
379
+ onSubscriptionStatusChange: (newStatus) => {
380
+ console.log('Subscription Status Changed:', newStatus.status);
381
+ },
382
+ onPaywallPresent: (info) => {
383
+ console.log('Paywall Presented (via useSuperwallEvents):', info.name);
384
+ }
385
+ });
386
+
387
+ }
139
388
  ```
140
389
 
390
+ For detailed type information on `PaywallInfo`, `PaywallResult`, `PaywallSkippedReason`, `SubscriptionStatus`, `SuperwallEventInfo`, and other types, please refer to the `SuperwallExpoModule.types.ts` file in the `expo-superwall` package.
141
391
 
142
392
  ## Resources
143
393
 
@@ -43,7 +43,7 @@ android {
43
43
  }
44
44
 
45
45
  dependencies {
46
- implementation "com.superwall.sdk:superwall-android:2.1.2"
46
+ implementation "com.superwall.sdk:superwall-android:2.2.3"
47
47
  implementation 'com.android.billingclient:billing:6.1.0'
48
48
  implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.2'
49
49
  }
@@ -106,9 +106,9 @@ class SuperwallExpoModule : Module() {
106
106
  return@Function applicationInfo?.metaData?.getString("SUPERWALL_API_KEY")
107
107
  }
108
108
 
109
- Function("identify") { userId: String, options: Map<String, Any> ->
109
+ Function("identify") { userId: String, options: Map<String, Any>? ->
110
110
  try {
111
- val options = identityOptionsFromJson(options)
111
+ val options = options?.let { identityOptionsFromJson(options) }
112
112
  Superwall.instance.identify(userId = userId, options = options)
113
113
  } catch (error: Exception) {
114
114
  error.printStackTrace()
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-superwall",
3
- "version": "0.0.11",
3
+ "version": "0.0.12",
4
4
  "description": "Offical Expo Integration for Superwall",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-superwall",
3
- "version": "0.0.11",
3
+ "version": "0.0.12",
4
4
  "description": "Offical Expo Integration for Superwall",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",