@virex-tech/paywallo-sdk 2.4.1 → 2.5.1
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/PaywalloSdk.podspec +1 -1
- package/README.md +45 -4
- package/android/build.gradle +0 -1
- package/android/src/main/java/com/paywallo/sdk/PaywalloFBBridgeModule.kt +7 -0
- package/android/src/main/java/com/paywallo/sdk/PaywalloSdkPackage.kt +1 -2
- package/dist/index.d.mts +298 -176
- package/dist/index.d.ts +298 -176
- package/dist/index.js +977 -912
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +925 -862
- package/dist/index.mjs.map +1 -1
- package/ios/PaywalloFBBridge.m +3 -0
- package/ios/PaywalloFBBridge.swift +20 -0
- package/package.json +4 -1
- package/android/src/main/java/com/paywallo/sdk/PaywalloDeviceModule.kt +0 -148
- package/ios/PaywalloDevice.m +0 -8
- package/ios/PaywalloDevice.swift +0 -119
package/PaywalloSdk.podspec
CHANGED
|
@@ -12,7 +12,7 @@ Pod::Spec.new do |s|
|
|
|
12
12
|
s.platforms = { :ios => "15.0" }
|
|
13
13
|
s.source = { :git => "https://github.com/paywallo/sdk-react-native.git", :tag => "v#{s.version}" }
|
|
14
14
|
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
15
|
-
s.frameworks = "Security", "StoreKit", "
|
|
15
|
+
s.frameworks = "Security", "StoreKit", "AVFoundation", "UserNotifications"
|
|
16
16
|
s.swift_version = "5.5"
|
|
17
17
|
|
|
18
18
|
s.dependency "React-Core"
|
package/README.md
CHANGED
|
@@ -195,6 +195,44 @@ Intro offers are synced automatically from App Store Connect and Google Play —
|
|
|
195
195
|
|
|
196
196
|
---
|
|
197
197
|
|
|
198
|
+
## What you integrate (and what you don't)
|
|
199
|
+
|
|
200
|
+
The SDK is designed so the app wires the minimum. Wrap once with `<PaywalloProvider>` and the SDK initializes itself (no `init()` call) and tracks lifecycle automatically.
|
|
201
|
+
|
|
202
|
+
| Concern | Who handles it |
|
|
203
|
+
|---|---|
|
|
204
|
+
| **App lifecycle** (`session_start/end`, `app_opened`, `cold_start`, install) | **Automatic** — just mount the Provider |
|
|
205
|
+
| **Paywall** (`paywall_viewed`/`closed`) | **Automatic** |
|
|
206
|
+
| **Screen views** | Opt-in helper (one line, see below) |
|
|
207
|
+
| **Onboarding steps** | **You declare** them (with explicit `order`) |
|
|
208
|
+
| **User identity** (`identify`) | **Optional** — never required for attribution |
|
|
209
|
+
| **Sales / subscriptions** | **Server webhooks** (Apple/Google/Superwall/RevenueCat) — the SDK does **not** send purchases |
|
|
210
|
+
|
|
211
|
+
### Onboarding tracking
|
|
212
|
+
|
|
213
|
+
Declare each step with an explicit `order` — the funnel respects it instead of guessing by timestamp. Use decimals for A/B variants of the same step (e.g. `2` and `2.1`).
|
|
214
|
+
|
|
215
|
+
```tsx
|
|
216
|
+
import { PaywalloClient } from '@virex-tech/paywallo-sdk';
|
|
217
|
+
|
|
218
|
+
await PaywalloClient.onboardingStep(1, 'welcome');
|
|
219
|
+
await PaywalloClient.onboardingStep(2, 'goals');
|
|
220
|
+
await PaywalloClient.onboardingStep(2.1, 'goals_variant_b'); // A/B variant of step 2
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
### Screen tracking (opt-in, one line)
|
|
224
|
+
|
|
225
|
+
Plug the helper into your `NavigationContainer` once — every screen change emits `screen_view` automatically, with no per-screen `track` calls:
|
|
226
|
+
|
|
227
|
+
```tsx
|
|
228
|
+
import { usePaywalloScreenTracking } from '@virex-tech/paywallo-sdk';
|
|
229
|
+
|
|
230
|
+
const onStateChange = usePaywalloScreenTracking();
|
|
231
|
+
<NavigationContainer onStateChange={onStateChange}>...</NavigationContainer>
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
Works with React Navigation v6/v7 (no extra peer dependency).
|
|
235
|
+
|
|
198
236
|
## Imperative API
|
|
199
237
|
|
|
200
238
|
For use outside React components:
|
|
@@ -202,11 +240,12 @@ For use outside React components:
|
|
|
202
240
|
```tsx
|
|
203
241
|
import { PaywalloClient } from '@virex-tech/paywallo-sdk';
|
|
204
242
|
|
|
205
|
-
// Identify user
|
|
206
|
-
|
|
243
|
+
// Identify the user (optional — attribution works without it).
|
|
244
|
+
// Model fields: email, firstName, lastName, dateOfBirth, gender, phone, properties.
|
|
245
|
+
await PaywalloClient.identify({ email: 'user@example.com', firstName: 'Ana' });
|
|
207
246
|
|
|
208
|
-
//
|
|
209
|
-
await PaywalloClient.track('
|
|
247
|
+
// Custom events
|
|
248
|
+
await PaywalloClient.track('my_event', { properties: { plan: 'premium' } });
|
|
210
249
|
|
|
211
250
|
// Feature flags
|
|
212
251
|
const variant = await PaywalloClient.getVariant('new_feature');
|
|
@@ -215,6 +254,8 @@ const variant = await PaywalloClient.getVariant('new_feature');
|
|
|
215
254
|
const hasAccess = await PaywalloClient.requireSubscriptionWithCampaign('premium');
|
|
216
255
|
```
|
|
217
256
|
|
|
257
|
+
> Purchases are **not** sent from the SDK. Validate the receipt to unlock access (`usePurchase`/`requireSubscriptionWithCampaign` do this), and the sale is recorded from the store webhook on the server.
|
|
258
|
+
|
|
218
259
|
## Config options
|
|
219
260
|
|
|
220
261
|
```tsx
|
package/android/build.gradle
CHANGED
|
@@ -57,5 +57,4 @@ dependencies {
|
|
|
57
57
|
// 1.1.0+ required for MasterKey.Builder API used in PaywalloStorageModule.
|
|
58
58
|
// 1.0.0 only ships the deprecated MasterKeys.getOrCreate(...) static helper.
|
|
59
59
|
implementation "androidx.security:security-crypto:1.1.0"
|
|
60
|
-
implementation "com.android.installreferrer:installreferrer:2.2"
|
|
61
60
|
}
|
|
@@ -70,6 +70,13 @@ class PaywalloFBBridgeModule(private val reactContext: ReactApplicationContext)
|
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
+
@ReactMethod
|
|
74
|
+
fun fetchDeferredAppLink(promise: Promise) {
|
|
75
|
+
// Android usa Play Install Referrer (determinístico) para o fbclid;
|
|
76
|
+
// o deferred app link do FB é redundante aqui. Stub resolve null.
|
|
77
|
+
promise.resolve(null)
|
|
78
|
+
}
|
|
79
|
+
|
|
73
80
|
private fun toBundle(map: ReadableMap): Bundle {
|
|
74
81
|
val bundle = Bundle()
|
|
75
82
|
val iterator = map.keySetIterator()
|
|
@@ -11,8 +11,7 @@ class PaywalloSdkPackage : ReactPackage {
|
|
|
11
11
|
PaywalloStoreKitModule(reactContext),
|
|
12
12
|
PaywalloFBBridgeModule(reactContext),
|
|
13
13
|
PaywalloStorageModule(reactContext),
|
|
14
|
-
|
|
15
|
-
PaywalloNotificationsModule(reactContext),
|
|
14
|
+
PaywalloNotificationsModule(reactContext),
|
|
16
15
|
PaywalloEnvModule(reactContext)
|
|
17
16
|
)
|
|
18
17
|
}
|