@superwall/paywalls-react 0.1.3 → 0.1.5
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/README.md +30 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -46,6 +46,36 @@ function GoPro() {
|
|
|
46
46
|
}
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
+
### Feature block
|
|
50
|
+
|
|
51
|
+
Pass a `feature` callback to run code when the user is entitled to access the
|
|
52
|
+
feature — i.e. already subscribed, or after a successful purchase/restore.
|
|
53
|
+
Mirrors the feature block in Superwall's native SDKs.
|
|
54
|
+
|
|
55
|
+
```tsx
|
|
56
|
+
function GoPro() {
|
|
57
|
+
const { register, state } = usePlacement();
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<button
|
|
61
|
+
onClick={() =>
|
|
62
|
+
register({
|
|
63
|
+
placement: "campaign_trigger",
|
|
64
|
+
feature: () => router.push("/pro-content"),
|
|
65
|
+
})
|
|
66
|
+
}
|
|
67
|
+
>
|
|
68
|
+
Go Pro {state.type === "presented" && "(open)"}
|
|
69
|
+
</button>
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
`feature()` fires when:
|
|
75
|
+
- The user is already subscribed — paywall is skipped and the feature runs immediately
|
|
76
|
+
- The placement has no audience match / holdout — feature runs without showing a paywall
|
|
77
|
+
- The user completes a purchase or restore through the paywall
|
|
78
|
+
|
|
49
79
|
## Subscription status & user
|
|
50
80
|
|
|
51
81
|
```tsx
|