@rocapine/react-native-onboarding 1.73.0 → 1.74.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/README.md +164 -3
- package/dist/OnboardingStudio.d.ts +82 -0
- package/dist/OnboardingStudio.d.ts.map +1 -0
- package/dist/OnboardingStudio.js +91 -0
- package/dist/OnboardingStudio.js.map +1 -0
- package/dist/OnboardingStudioClient.d.ts +14 -5
- package/dist/OnboardingStudioClient.d.ts.map +1 -1
- package/dist/OnboardingStudioClient.js +24 -9
- package/dist/OnboardingStudioClient.js.map +1 -1
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +40 -4
- package/dist/index.js.map +1 -1
- package/dist/infra/provider/OnboardingProvider.d.ts +15 -2
- package/dist/infra/provider/OnboardingProvider.d.ts.map +1 -1
- package/dist/infra/provider/OnboardingProvider.js +66 -6
- package/dist/infra/provider/OnboardingProvider.js.map +1 -1
- package/dist/infra/queries/cacheKey.d.ts +41 -3
- package/dist/infra/queries/cacheKey.d.ts.map +1 -1
- package/dist/infra/queries/cacheKey.js +44 -8
- package/dist/infra/queries/cacheKey.js.map +1 -1
- package/dist/infra/queries/getOnboarding.query.d.ts.map +1 -1
- package/dist/infra/queries/getOnboarding.query.js +6 -1
- package/dist/infra/queries/getOnboarding.query.js.map +1 -1
- package/dist/paywalls/PaywallProvider.d.ts +52 -4
- package/dist/paywalls/PaywallProvider.d.ts.map +1 -1
- package/dist/paywalls/PaywallProvider.js +105 -7
- package/dist/paywalls/PaywallProvider.js.map +1 -1
- package/dist/paywalls/catalogSettleWaiter.d.ts +31 -0
- package/dist/paywalls/catalogSettleWaiter.d.ts.map +1 -0
- package/dist/paywalls/catalogSettleWaiter.js +58 -0
- package/dist/paywalls/catalogSettleWaiter.js.map +1 -0
- package/dist/paywalls/getPaywalls.query.d.ts.map +1 -1
- package/dist/paywalls/getPaywalls.query.js +6 -1
- package/dist/paywalls/getPaywalls.query.js.map +1 -1
- package/dist/paywalls/register.d.ts +105 -0
- package/dist/paywalls/register.d.ts.map +1 -0
- package/dist/paywalls/register.js +112 -0
- package/dist/paywalls/register.js.map +1 -0
- package/dist/paywalls/usePaywall.d.ts +29 -0
- package/dist/paywalls/usePaywall.d.ts.map +1 -1
- package/dist/paywalls/usePaywall.js +2 -1
- package/dist/paywalls/usePaywall.js.map +1 -1
- package/dist/userProperties/applyPatch.d.ts +18 -0
- package/dist/userProperties/applyPatch.d.ts.map +1 -0
- package/dist/userProperties/applyPatch.js +57 -0
- package/dist/userProperties/applyPatch.js.map +1 -0
- package/dist/userProperties/effectiveParams.d.ts +29 -0
- package/dist/userProperties/effectiveParams.d.ts.map +1 -0
- package/dist/userProperties/effectiveParams.js +56 -0
- package/dist/userProperties/effectiveParams.js.map +1 -0
- package/dist/userProperties/index.d.ts +9 -0
- package/dist/userProperties/index.d.ts.map +1 -0
- package/dist/userProperties/index.js +21 -0
- package/dist/userProperties/index.js.map +1 -0
- package/dist/userProperties/reserved.d.ts +33 -0
- package/dist/userProperties/reserved.d.ts.map +1 -0
- package/dist/userProperties/reserved.js +45 -0
- package/dist/userProperties/reserved.js.map +1 -0
- package/dist/userProperties/serialize.d.ts +38 -0
- package/dist/userProperties/serialize.d.ts.map +1 -0
- package/dist/userProperties/serialize.js +67 -0
- package/dist/userProperties/serialize.js.map +1 -0
- package/dist/userProperties/store.d.ts +65 -0
- package/dist/userProperties/store.d.ts.map +1 -0
- package/dist/userProperties/store.js +155 -0
- package/dist/userProperties/store.js.map +1 -0
- package/dist/userProperties/types.d.ts +21 -0
- package/dist/userProperties/types.d.ts.map +1 -0
- package/dist/userProperties/types.js +3 -0
- package/dist/userProperties/types.js.map +1 -0
- package/dist/userProperties/useUserProperties.d.ts +20 -0
- package/dist/userProperties/useUserProperties.d.ts.map +1 -0
- package/dist/userProperties/useUserProperties.js +30 -0
- package/dist/userProperties/useUserProperties.js.map +1 -0
- package/package.json +5 -1
- package/src/OnboardingStudio.ts +147 -0
- package/src/OnboardingStudioClient.ts +27 -11
- package/src/__tests__/OnboardingDataGate.test.tsx +445 -0
- package/src/__tests__/OnboardingStudio.test.ts +208 -0
- package/src/__tests__/cacheKey.test.ts +71 -0
- package/src/__tests__/getOnboarding.query.test.ts +47 -8
- package/src/index.ts +43 -0
- package/src/infra/provider/OnboardingProvider.tsx +98 -10
- package/src/infra/queries/cacheKey.ts +54 -9
- package/src/infra/queries/getOnboarding.query.ts +9 -1
- package/src/paywalls/PaywallProvider.tsx +162 -6
- package/src/paywalls/__tests__/catalogSettleWaiter.test.ts +134 -0
- package/src/paywalls/__tests__/getPaywalls.test.ts +29 -11
- package/src/paywalls/__tests__/register.test.ts +266 -0
- package/src/paywalls/catalogSettleWaiter.ts +72 -0
- package/src/paywalls/getPaywalls.query.ts +9 -1
- package/src/paywalls/register.ts +169 -0
- package/src/paywalls/usePaywall.ts +40 -2
- package/src/userProperties/__tests__/effectiveParams.test.ts +51 -0
- package/src/userProperties/__tests__/primitives.test.ts +96 -0
- package/src/userProperties/__tests__/store.test.ts +181 -0
- package/src/userProperties/applyPatch.ts +68 -0
- package/src/userProperties/effectiveParams.ts +60 -0
- package/src/userProperties/index.ts +11 -0
- package/src/userProperties/reserved.ts +44 -0
- package/src/userProperties/serialize.ts +61 -0
- package/src/userProperties/store.ts +179 -0
- package/src/userProperties/types.ts +22 -0
- package/src/userProperties/useUserProperties.ts +26 -0
package/README.md
CHANGED
|
@@ -35,18 +35,19 @@ npx expo install expo-router
|
|
|
35
35
|
```typescript
|
|
36
36
|
import {
|
|
37
37
|
OnboardingProvider,
|
|
38
|
-
|
|
38
|
+
OnboardingStudio,
|
|
39
39
|
ProgressBar,
|
|
40
40
|
} from "@rocapine/react-native-onboarding";
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
// Once, at module scope — before anything renders.
|
|
43
|
+
OnboardingStudio.init({
|
|
44
|
+
projectId: "your-project-id",
|
|
43
45
|
appVersion: "1.0.0",
|
|
44
46
|
});
|
|
45
47
|
|
|
46
48
|
export default function RootLayout() {
|
|
47
49
|
return (
|
|
48
50
|
<OnboardingProvider
|
|
49
|
-
client={client}
|
|
50
51
|
locale="en"
|
|
51
52
|
customAudienceParams={{ onboardingId: "your-onboarding-id" }}
|
|
52
53
|
>
|
|
@@ -57,6 +58,10 @@ export default function RootLayout() {
|
|
|
57
58
|
}
|
|
58
59
|
```
|
|
59
60
|
|
|
61
|
+
`init` returns the client it built, if you want it for `clearCache()`. You can
|
|
62
|
+
also still construct one yourself and pass it as a `client` prop — an explicit
|
|
63
|
+
prop always wins over `init`.
|
|
64
|
+
|
|
60
65
|
### Use in Your Screens
|
|
61
66
|
|
|
62
67
|
```typescript
|
|
@@ -84,6 +89,162 @@ That's it! 🎉
|
|
|
84
89
|
|
|
85
90
|
---
|
|
86
91
|
|
|
92
|
+
## 👤 User Properties
|
|
93
|
+
|
|
94
|
+
Audience targeting reads a `key: value` map of user properties. `OnboardingStudio`
|
|
95
|
+
is a module-level object, so a login handler or an analytics service can write to
|
|
96
|
+
it — no hook, no provider:
|
|
97
|
+
|
|
98
|
+
```typescript
|
|
99
|
+
import { OnboardingStudio } from "@rocapine/react-native-onboarding";
|
|
100
|
+
|
|
101
|
+
OnboardingStudio.setUserProperty("plan", "free");
|
|
102
|
+
OnboardingStudio.setUserProperties({ daysSinceInstall: 3, hasTeam: true });
|
|
103
|
+
|
|
104
|
+
OnboardingStudio.setUserProperty("plan", null); // null DELETES a key
|
|
105
|
+
OnboardingStudio.removeUserProperty("plan"); // same thing
|
|
106
|
+
OnboardingStudio.getUserProperties();
|
|
107
|
+
OnboardingStudio.reset(); // forget the user — e.g. on logout
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
`setUserProperties` **merges**, so independent writers don't clobber each other.
|
|
111
|
+
Values may be `string`, `number` or `boolean`. To read them in a component:
|
|
112
|
+
|
|
113
|
+
```typescript
|
|
114
|
+
const { properties, status } = useUserProperties();
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
`reset()` clears user properties only — it deliberately leaves the payload cache
|
|
118
|
+
alone, because logging out shouldn't force a refetch of content that hasn't
|
|
119
|
+
changed. Use `OnboardingStudio.getClient()?.clearCache()` if you want both.
|
|
120
|
+
|
|
121
|
+
### Getting the first launch right
|
|
122
|
+
|
|
123
|
+
Properties are only *hydrated* from disk, so a first-ever install has nothing to
|
|
124
|
+
hydrate. Seed them in `init` — which runs before anything renders — and even that
|
|
125
|
+
first launch is targeted correctly:
|
|
126
|
+
|
|
127
|
+
```typescript
|
|
128
|
+
OnboardingStudio.init({
|
|
129
|
+
projectId: "your-project-id",
|
|
130
|
+
userProperties: { plan: "free" },
|
|
131
|
+
});
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
**Properties persist** to AsyncStorage and are hydrated before the first
|
|
135
|
+
fetch, so a returning user is targeted correctly on the very first launch-frame
|
|
136
|
+
with no host code. A first-ever install has nothing to hydrate: its first
|
|
137
|
+
onboarding matches your catch-all audience — see
|
|
138
|
+
[Getting the first launch right](#getting-the-first-launch-right) to avoid even
|
|
139
|
+
that.
|
|
140
|
+
|
|
141
|
+
### When a change applies
|
|
142
|
+
|
|
143
|
+
**Audience resolution happens at serve time, and a served payload is frozen for
|
|
144
|
+
that presentation.** A property you set applies to the *next* serve, never
|
|
145
|
+
retroactively:
|
|
146
|
+
|
|
147
|
+
- **Onboarding** — served once, when `OnboardingProvider` mounts. A
|
|
148
|
+
`setUserProperty` during the flow (or a change to the `customAudienceParams`
|
|
149
|
+
prop) does not refetch, re-key or swap the onboarding under the user, and
|
|
150
|
+
does not blank the screen; it is picked up the next time an onboarding is
|
|
151
|
+
served — the next mount, or the next launch. So write a property the moment
|
|
152
|
+
you compute it, even mid-onboarding. The corollary: anything *this* serve
|
|
153
|
+
must target on has to be set **before the provider mounts** — a property that
|
|
154
|
+
resolves asynchronously during startup (attribution, a score fetched over the
|
|
155
|
+
network) and lands after mount targets the next serve, silently.
|
|
156
|
+
- **Paywall** — served at `register(moment)` / `present(moment)`. The catalog
|
|
157
|
+
follows the store until then, so a property set before the call is honoured
|
|
158
|
+
by it; one set after applies to the next call.
|
|
159
|
+
- **`reset()`** follows the same rule: it clears the properties for the *next*
|
|
160
|
+
serve. An onboarding already on screen keeps the audience it was served with
|
|
161
|
+
— on logout mid-flow, leave the flow (unmount the provider) rather than
|
|
162
|
+
expecting it to re-target in place.
|
|
163
|
+
|
|
164
|
+
To re-serve an onboarding with the current properties, present it again — a
|
|
165
|
+
remount of the provider (e.g. a `key`) is a new serve. It is also a full
|
|
166
|
+
teardown of everything under the provider (in a host that wraps the router:
|
|
167
|
+
the router), so do it at a flow boundary, never mid-onboarding.
|
|
168
|
+
|
|
169
|
+
### Values reach audience filters as strings
|
|
170
|
+
|
|
171
|
+
Everything crosses the wire on a querystring. The normal authoring shape works as
|
|
172
|
+
you'd expect, because the filter's literal is a number and JavaScript coerces:
|
|
173
|
+
|
|
174
|
+
```jsonc
|
|
175
|
+
{ ">=": [{ "var": "daysSinceInstall" }, 3] } // "3" >= 3 → true ✅
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
Watch for a filter whose literal is itself a **string** — that comparison is
|
|
179
|
+
lexicographic, so `"10"` is *not* greater than `"9"`:
|
|
180
|
+
|
|
181
|
+
```jsonc
|
|
182
|
+
{ ">": [{ "var": "daysSinceInstall" }, "9"] } // "10" > "9" → false ⚠️
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### Reserved names
|
|
186
|
+
|
|
187
|
+
These are refused with a warning, because the SDK puts them on the request
|
|
188
|
+
querystring itself and a duplicate silently breaks the request:
|
|
189
|
+
|
|
190
|
+
`projectId`, `platform`, `appVersion`, `draft`, `locale`, `omitNulls`, `moment`,
|
|
191
|
+
`now`
|
|
192
|
+
|
|
193
|
+
### Relationship to `customAudienceParams`
|
|
194
|
+
|
|
195
|
+
The prop still works and is not deprecated. Treat it as the **static** baseline
|
|
196
|
+
(build-time facts like an `onboardingId`) and the store as the **runtime** half.
|
|
197
|
+
Where both define a key, **the store wins**.
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
201
|
+
## 🔓 Gating a Feature with `register`
|
|
202
|
+
|
|
203
|
+
`register` shows the paywall for a moment and runs your feature only if the user
|
|
204
|
+
buys:
|
|
205
|
+
|
|
206
|
+
```typescript
|
|
207
|
+
const { register } = usePaywall();
|
|
208
|
+
|
|
209
|
+
await register("unlock_stats", () => router.push("/stats"));
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
| Situation | What happens |
|
|
213
|
+
|---|---|
|
|
214
|
+
| The moment has a paywall | It's presented; the feature runs **only** on a purchase |
|
|
215
|
+
| The moment has no paywall | The feature runs immediately (`reason: "no-paywall"`) |
|
|
216
|
+
| No catalog reachable | The feature runs, with a warning (`reason: "catalog-unavailable"`) |
|
|
217
|
+
| Another paywall is already showing | The feature is withheld; the live paywall is untouched |
|
|
218
|
+
|
|
219
|
+
It returns `{ ran, presented, reason, outcome? }`, so you can log how often you're
|
|
220
|
+
giving a feature away:
|
|
221
|
+
|
|
222
|
+
```typescript
|
|
223
|
+
const result = await register("unlock_stats", unlock);
|
|
224
|
+
if (result.reason === "catalog-unavailable") analytics.track("gate_failed_open");
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
**`register` fails open.** When the catalog can't be reached — offline, or still
|
|
228
|
+
loading after `registerTimeoutMs` (default 3000) — it runs the feature rather than
|
|
229
|
+
blocking it. Failing closed would make your gated features silently dead on an
|
|
230
|
+
offline launch, with no paywall on screen to explain why. Tune the wait with
|
|
231
|
+
`<PaywallProvider registerTimeoutMs={...}>`.
|
|
232
|
+
|
|
233
|
+
**There is no entitlement check.** `register` gates on the moment alone. To stop
|
|
234
|
+
charging an existing subscriber, set a property and author an audience filter on
|
|
235
|
+
it:
|
|
236
|
+
|
|
237
|
+
```typescript
|
|
238
|
+
OnboardingStudio.setUserProperty("plan", "pro"); // audience: plan != "pro"
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
> ⚠️ **A Stripe-billed paywall never runs the feature**, even after a successful
|
|
242
|
+
> checkout: a Payment Link's entitlement arrives out-of-band through RevenueCat, so
|
|
243
|
+
> the presentation never reports `"purchased"`. Grant access from your RevenueCat
|
|
244
|
+
> entitlement webhook instead. `register` warns when it presents one.
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
87
248
|
## 📚 Documentation
|
|
88
249
|
|
|
89
250
|
### For SDK Users
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { OnboardingStudioClient } from "./OnboardingStudioClient";
|
|
2
|
+
import type { OnboardingStudioClientOptions } from "./types";
|
|
3
|
+
import type { UserPropertyStore } from "./userProperties/store";
|
|
4
|
+
import type { UserProperties, UserPropertyPatch, UserPropertyValue } from "./userProperties/types";
|
|
5
|
+
/**
|
|
6
|
+
* What `OnboardingStudio.init` takes: everything `new OnboardingStudioClient()`
|
|
7
|
+
* takes, plus the project id it takes positionally, plus optional initial user
|
|
8
|
+
* properties.
|
|
9
|
+
*
|
|
10
|
+
* `userProperties` here is a genuine convenience rather than sugar. Audience
|
|
11
|
+
* targeting is evaluated against the property map, and persisted properties are
|
|
12
|
+
* only hydrated from disk — so on a first-EVER install there is nothing to
|
|
13
|
+
* hydrate and the first catalog fetch matches the catch-all audience. Seeding at
|
|
14
|
+
* `init`, which runs before any provider mounts, is the only way to be targeted
|
|
15
|
+
* correctly on that first launch.
|
|
16
|
+
*/
|
|
17
|
+
export type OnboardingStudioConfig = {
|
|
18
|
+
projectId: string;
|
|
19
|
+
} & OnboardingStudioClientOptions & {
|
|
20
|
+
userProperties?: UserPropertyPatch;
|
|
21
|
+
};
|
|
22
|
+
export type OnboardingStudioFacade = {
|
|
23
|
+
/**
|
|
24
|
+
* Configure the SDK. Returns the client it built, so a host that needs
|
|
25
|
+
* `clearCache()` (or wants to pass it explicitly) can keep hold of it.
|
|
26
|
+
*
|
|
27
|
+
* Idempotent for an unchanged config — Fast Refresh re-runs module scope, and
|
|
28
|
+
* rebuilding the client there would orphan the one the providers already hold.
|
|
29
|
+
* A genuinely CHANGED config replaces the client and warns, because silently
|
|
30
|
+
* ignoring it would be worse than either alternative.
|
|
31
|
+
*/
|
|
32
|
+
init: (config: OnboardingStudioConfig) => OnboardingStudioClient;
|
|
33
|
+
/** The configured client, or `null` before `init`. */
|
|
34
|
+
getClient: () => OnboardingStudioClient | null;
|
|
35
|
+
isInitialized: () => boolean;
|
|
36
|
+
/** Set one property. `null` deletes it. */
|
|
37
|
+
setUserProperty: (key: string, value: UserPropertyValue | null) => void;
|
|
38
|
+
/** Set several at once. Merges; a `null` value deletes that key. */
|
|
39
|
+
setUserProperties: (patch: UserPropertyPatch) => void;
|
|
40
|
+
removeUserProperty: (key: string) => void;
|
|
41
|
+
getUserProperties: () => UserProperties;
|
|
42
|
+
/**
|
|
43
|
+
* Forget the user: clears every user property, in memory and on disk. Call it
|
|
44
|
+
* on logout.
|
|
45
|
+
*
|
|
46
|
+
* Deliberately does NOT clear the payload cache or the configuration. Logging
|
|
47
|
+
* out should forget who someone is, not force a refetch of content that has
|
|
48
|
+
* not changed — `getClient()?.clearCache()` is right there if both are wanted.
|
|
49
|
+
*/
|
|
50
|
+
reset: () => void;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* The SDK's front door, in the shape the SDKs it sits alongside use
|
|
54
|
+
* (`Superwall.configure` / `Purchases.configure` / `amplitude.init`): one
|
|
55
|
+
* module-level object that owns configuration and user identity.
|
|
56
|
+
*
|
|
57
|
+
* A factory with the store injected, so its tests need a fake store rather than
|
|
58
|
+
* a module mock — the same reason `createUserPropertyStore` is a factory.
|
|
59
|
+
*
|
|
60
|
+
* `register`/`present` deliberately do NOT live here. Presenting needs the
|
|
61
|
+
* mounted provider's catalog and presentation state, so they stay on
|
|
62
|
+
* `usePaywall()`, where that state is reachable and where a call cannot be made
|
|
63
|
+
* before a provider exists.
|
|
64
|
+
*/
|
|
65
|
+
export declare const createOnboardingStudio: (store: UserPropertyStore) => OnboardingStudioFacade;
|
|
66
|
+
/** The facade every host uses. */
|
|
67
|
+
export declare const OnboardingStudio: OnboardingStudioFacade;
|
|
68
|
+
/**
|
|
69
|
+
* Which client a provider should use: an explicit `client` prop wins, otherwise
|
|
70
|
+
* the one `OnboardingStudio.init()` built.
|
|
71
|
+
*
|
|
72
|
+
* The prop keeps winning so every host that already passes one is untouched by
|
|
73
|
+
* `init` existing.
|
|
74
|
+
*/
|
|
75
|
+
export declare const resolveProviderClient: (prop: OnboardingStudioClient | undefined, fromStudio: OnboardingStudioClient | null) => OnboardingStudioClient | null;
|
|
76
|
+
/**
|
|
77
|
+
* Shared by both providers, because a host hitting this has exactly two fixes
|
|
78
|
+
* and should be told both rather than left to guess which one this provider
|
|
79
|
+
* wanted.
|
|
80
|
+
*/
|
|
81
|
+
export declare const MISSING_CLIENT_MESSAGE: string;
|
|
82
|
+
//# sourceMappingURL=OnboardingStudio.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OnboardingStudio.d.ts","sourceRoot":"","sources":["../src/OnboardingStudio.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,SAAS,CAAC;AAE7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EACV,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,wBAAwB,CAAC;AAEhC;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,sBAAsB,GAAG;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,GAAG,6BAA6B,GAAG;IACzF,cAAc,CAAC,EAAE,iBAAiB,CAAC;CACpC,CAAC;AAEJ,MAAM,MAAM,sBAAsB,GAAG;IACnC;;;;;;;;OAQG;IACH,IAAI,EAAE,CAAC,MAAM,EAAE,sBAAsB,KAAK,sBAAsB,CAAC;IACjE,sDAAsD;IACtD,SAAS,EAAE,MAAM,sBAAsB,GAAG,IAAI,CAAC;IAC/C,aAAa,EAAE,MAAM,OAAO,CAAC;IAC7B,2CAA2C;IAC3C,eAAe,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB,GAAG,IAAI,KAAK,IAAI,CAAC;IACxE,oEAAoE;IACpE,iBAAiB,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;IACtD,kBAAkB,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,iBAAiB,EAAE,MAAM,cAAc,CAAC;IACxC;;;;;;;OAOG;IACH,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB,CAAC;AAMF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,sBAAsB,GAAI,OAAO,iBAAiB,KAAG,sBA+CjE,CAAC;AAEF,kCAAkC;AAClC,eAAO,MAAM,gBAAgB,wBAA4C,CAAC;AAE1E;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,GAChC,MAAM,sBAAsB,GAAG,SAAS,EACxC,YAAY,sBAAsB,GAAG,IAAI,KACxC,sBAAsB,GAAG,IAA0B,CAAC;AAEvD;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,QAGkB,CAAC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.MISSING_CLIENT_MESSAGE = exports.resolveProviderClient = exports.OnboardingStudio = exports.createOnboardingStudio = void 0;
|
|
15
|
+
const OnboardingStudioClient_1 = require("./OnboardingStudioClient");
|
|
16
|
+
const store_1 = require("./userProperties/store");
|
|
17
|
+
/** Stable signature of a config, for the idempotency check in `init`. */
|
|
18
|
+
const configSignature = (projectId, options) => `${projectId}::${JSON.stringify(options)}`;
|
|
19
|
+
/**
|
|
20
|
+
* The SDK's front door, in the shape the SDKs it sits alongside use
|
|
21
|
+
* (`Superwall.configure` / `Purchases.configure` / `amplitude.init`): one
|
|
22
|
+
* module-level object that owns configuration and user identity.
|
|
23
|
+
*
|
|
24
|
+
* A factory with the store injected, so its tests need a fake store rather than
|
|
25
|
+
* a module mock — the same reason `createUserPropertyStore` is a factory.
|
|
26
|
+
*
|
|
27
|
+
* `register`/`present` deliberately do NOT live here. Presenting needs the
|
|
28
|
+
* mounted provider's catalog and presentation state, so they stay on
|
|
29
|
+
* `usePaywall()`, where that state is reachable and where a call cannot be made
|
|
30
|
+
* before a provider exists.
|
|
31
|
+
*/
|
|
32
|
+
const createOnboardingStudio = (store) => {
|
|
33
|
+
let client = null;
|
|
34
|
+
let signature = null;
|
|
35
|
+
return {
|
|
36
|
+
init: (config) => {
|
|
37
|
+
const { projectId, userProperties: initialProperties } = config, options = __rest(config, ["projectId", "userProperties"]);
|
|
38
|
+
const next = configSignature(projectId, options);
|
|
39
|
+
if (client && signature === next) {
|
|
40
|
+
// Same config: hand back the same client. Seeding the same properties
|
|
41
|
+
// again would be a no-op anyway (`applyUserPropertyPatch` returns the
|
|
42
|
+
// same object when nothing changed), so there is nothing else to do.
|
|
43
|
+
return client;
|
|
44
|
+
}
|
|
45
|
+
if (client) {
|
|
46
|
+
console.warn(`[onboarding-studio] init() was called again with a DIFFERENT config ` +
|
|
47
|
+
`(projectId "${projectId}"). The previous client has been replaced. ` +
|
|
48
|
+
"Providers already holding the old client keep using it until they " +
|
|
49
|
+
"re-render — call init() once, at module scope.");
|
|
50
|
+
}
|
|
51
|
+
client = new OnboardingStudioClient_1.OnboardingStudioClient(projectId, options);
|
|
52
|
+
signature = next;
|
|
53
|
+
// Before hydration on purpose: the store merges disk UNDER memory, so a
|
|
54
|
+
// property the host states here beats a stale one from a previous launch.
|
|
55
|
+
if (initialProperties)
|
|
56
|
+
store.set(initialProperties);
|
|
57
|
+
// Start reading the persisted map now rather than at the first provider
|
|
58
|
+
// mount, so it is ready before anything queries.
|
|
59
|
+
void store.ensureHydrated();
|
|
60
|
+
return client;
|
|
61
|
+
},
|
|
62
|
+
getClient: () => client,
|
|
63
|
+
isInitialized: () => client !== null,
|
|
64
|
+
setUserProperty: (key, value) => store.set({ [key]: value }),
|
|
65
|
+
setUserProperties: (patch) => store.set(patch),
|
|
66
|
+
removeUserProperty: (key) => store.remove(key),
|
|
67
|
+
getUserProperties: () => store.get(),
|
|
68
|
+
reset: () => store.reset(),
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
exports.createOnboardingStudio = createOnboardingStudio;
|
|
72
|
+
/** The facade every host uses. */
|
|
73
|
+
exports.OnboardingStudio = (0, exports.createOnboardingStudio)(store_1.userPropertyStore);
|
|
74
|
+
/**
|
|
75
|
+
* Which client a provider should use: an explicit `client` prop wins, otherwise
|
|
76
|
+
* the one `OnboardingStudio.init()` built.
|
|
77
|
+
*
|
|
78
|
+
* The prop keeps winning so every host that already passes one is untouched by
|
|
79
|
+
* `init` existing.
|
|
80
|
+
*/
|
|
81
|
+
const resolveProviderClient = (prop, fromStudio) => prop !== null && prop !== void 0 ? prop : fromStudio;
|
|
82
|
+
exports.resolveProviderClient = resolveProviderClient;
|
|
83
|
+
/**
|
|
84
|
+
* Shared by both providers, because a host hitting this has exactly two fixes
|
|
85
|
+
* and should be told both rather than left to guess which one this provider
|
|
86
|
+
* wanted.
|
|
87
|
+
*/
|
|
88
|
+
exports.MISSING_CLIENT_MESSAGE = "[onboarding-studio] No client. Either call OnboardingStudio.init({ projectId }) " +
|
|
89
|
+
"once at module scope, or pass a `client` prop built with " +
|
|
90
|
+
"`new OnboardingStudioClient(projectId, options)`.";
|
|
91
|
+
//# sourceMappingURL=OnboardingStudio.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OnboardingStudio.js","sourceRoot":"","sources":["../src/OnboardingStudio.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,qEAAkE;AAElE,kDAA2D;AAuD3D,yEAAyE;AACzE,MAAM,eAAe,GAAG,CAAC,SAAiB,EAAE,OAAgC,EAAU,EAAE,CACtF,GAAG,SAAS,KAAK,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;AAE7C;;;;;;;;;;;;GAYG;AACI,MAAM,sBAAsB,GAAG,CAAC,KAAwB,EAA0B,EAAE;IACzF,IAAI,MAAM,GAAkC,IAAI,CAAC;IACjD,IAAI,SAAS,GAAkB,IAAI,CAAC;IAEpC,OAAO;QACL,IAAI,EAAE,CAAC,MAAM,EAAE,EAAE;YACf,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,iBAAiB,KAAiB,MAAM,EAAlB,OAAO,UAAK,MAAM,EAArE,+BAA4D,CAAS,CAAC;YAC5E,MAAM,IAAI,GAAG,eAAe,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;YAEjD,IAAI,MAAM,IAAI,SAAS,KAAK,IAAI,EAAE,CAAC;gBACjC,sEAAsE;gBACtE,sEAAsE;gBACtE,qEAAqE;gBACrE,OAAO,MAAM,CAAC;YAChB,CAAC;YAED,IAAI,MAAM,EAAE,CAAC;gBACX,OAAO,CAAC,IAAI,CACV,sEAAsE;oBACpE,eAAe,SAAS,6CAA6C;oBACrE,oEAAoE;oBACpE,gDAAgD,CACnD,CAAC;YACJ,CAAC;YAED,MAAM,GAAG,IAAI,+CAAsB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;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OnboardingStudioClientOptions;
|
|
8
8
|
constructor(projectId: string, options: OnboardingStudioClientOptions);
|
|
9
9
|
/**
|
|
10
|
-
* Removes
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* invalidate the React Query keys `["onboardingQuestions", ...]` and
|
|
10
|
+
* Removes EVERY cached onboarding payload and paywall catalog this SDK wrote,
|
|
11
|
+
* across all audience-param variants. The next query mount or app launch is
|
|
12
|
+
* then a cache miss and refetches. To force an in-session refetch as well,
|
|
13
|
+
* also invalidate the React Query keys `["onboardingQuestions", ...]` and
|
|
15
14
|
* `["paywallCatalog", ...]`.
|
|
15
|
+
*
|
|
16
|
+
* Scans `getAllKeys()` by prefix rather than naming two keys, because the keys
|
|
17
|
+
* are now scoped by a hash of the resolved audience params (see
|
|
18
|
+
* `infra/queries/cacheKey.ts`) — so there is no longer one key per domain to
|
|
19
|
+
* name. This also picks up entries written before that scoping existed, which
|
|
20
|
+
* would otherwise be orphaned forever.
|
|
21
|
+
*
|
|
22
|
+
* It does NOT clear user properties: `USER_PROPERTIES_STORAGE_KEY` matches
|
|
23
|
+
* neither prefix, deliberately. Clearing a payload cache must not forget who
|
|
24
|
+
* the user is — that is what `OnboardingStudio.reset()` is for.
|
|
16
25
|
*/
|
|
17
26
|
clearCache(): Promise<void>;
|
|
18
27
|
getSteps<StepType extends BaseStepType = OnboardingStepType>(onboardingOptions?: OnboardingOptions, userDefinedParams?: UserDefinedParams): Promise<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OnboardingStudioClient.d.ts","sourceRoot":"","sources":["../src/OnboardingStudioClient.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EACL,UAAU,EACV,uBAAuB,EACvB,iBAAiB,EACjB,6BAA6B,EAC7B,iBAAiB,EACjB,YAAY,EACb,MAAM,SAAS,CAAC;AAKjB,OAAO,EACL,cAAc,EACd,cAAc,EACd,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@ -17,18 +17,33 @@ class OnboardingStudioClient {
|
|
|
17
17
|
"https://takbcvjljqialzqyksic.supabase.co/functions/v1";
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
|
-
* Removes
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* invalidate the React Query keys `["onboardingQuestions", ...]` and
|
|
20
|
+
* Removes EVERY cached onboarding payload and paywall catalog this SDK wrote,
|
|
21
|
+
* across all audience-param variants. The next query mount or app launch is
|
|
22
|
+
* then a cache miss and refetches. To force an in-session refetch as well,
|
|
23
|
+
* also invalidate the React Query keys `["onboardingQuestions", ...]` and
|
|
25
24
|
* `["paywallCatalog", ...]`.
|
|
25
|
+
*
|
|
26
|
+
* Scans `getAllKeys()` by prefix rather than naming two keys, because the keys
|
|
27
|
+
* are now scoped by a hash of the resolved audience params (see
|
|
28
|
+
* `infra/queries/cacheKey.ts`) — so there is no longer one key per domain to
|
|
29
|
+
* name. This also picks up entries written before that scoping existed, which
|
|
30
|
+
* would otherwise be orphaned forever.
|
|
31
|
+
*
|
|
32
|
+
* It does NOT clear user properties: `USER_PROPERTIES_STORAGE_KEY` matches
|
|
33
|
+
* neither prefix, deliberately. Clearing a payload cache must not forget who
|
|
34
|
+
* the user is — that is what `OnboardingStudio.reset()` is for.
|
|
26
35
|
*/
|
|
27
36
|
async clearCache() {
|
|
28
|
-
|
|
29
|
-
async_storage_1.default.
|
|
30
|
-
|
|
31
|
-
|
|
37
|
+
try {
|
|
38
|
+
const keys = await async_storage_1.default.getAllKeys();
|
|
39
|
+
const ours = keys.filter((key) => key.startsWith(cacheKey_1.ONBOARDING_CACHE_KEY_PREFIX) ||
|
|
40
|
+
key.startsWith(cacheKey_1.PAYWALLS_CACHE_KEY_PREFIX));
|
|
41
|
+
if (ours.length > 0)
|
|
42
|
+
await async_storage_1.default.multiRemove(ours);
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
console.warn("Failed to clear SDK caches:", error);
|
|
46
|
+
}
|
|
32
47
|
}
|
|
33
48
|
async getSteps(onboardingOptions, userDefinedParams) {
|
|
34
49
|
console.info("OnboardingStudioClient getSteps");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OnboardingStudioClient.js","sourceRoot":"","sources":["../src/OnboardingStudioClient.ts"],"names":[],"mappings":";;;;;;AAAA,8FAAqE;AAUrE,uDAGkC;AAOlC,+CAAwC;AAExC,MAAa,sBAAsB;IAKjC,YAAY,SAAiB,EAAE,OAAsC;QACnE,OAAO,CAAC,IAAI,CAAC,yCAAyC,EAAE,SAAS,CAAC,CAAC;QACnE,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO;YACV,OAAO,CAAC,OAAO;gBACf,uDAAuD,CAAC;IAC5D,CAAC;IAED
|
|
1
|
+
{"version":3,"file":"OnboardingStudioClient.js","sourceRoot":"","sources":["../src/OnboardingStudioClient.ts"],"names":[],"mappings":";;;;;;AAAA,8FAAqE;AAUrE,uDAGkC;AAOlC,+CAAwC;AAExC,MAAa,sBAAsB;IAKjC,YAAY,SAAiB,EAAE,OAAsC;QACnE,OAAO,CAAC,IAAI,CAAC,yCAAyC,EAAE,SAAS,CAAC,CAAC;QACnE,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO;YACV,OAAO,CAAC,OAAO;gBACf,uDAAuD,CAAC;IAC5D,CAAC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,KAAK,CAAC,UAAU;QACd,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,MAAM,uBAAY,CAAC,UAAU,EAAE,CAAC;YAC7C,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CACtB,CAAC,GAAG,EAAE,EAAE,CACN,GAAG,CAAC,UAAU,CAAC,sCAA2B,CAAC;gBAC3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CAAC,UAAU,EAAE,CACtE,CAAC;YACJ,CAAC;YACD,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;YACnC,OAAO;gBACL,IAAI;gBACJ,OAAO,EAAE;oBACP,mBAAmB,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC;oBAC9D,kBAAkB,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC;iBAC7D;aACF,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,0CAA0C,EAAE,KAAK,CAAC,CAAC;YACjE,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF;AAtND,wDAsNC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,13 @@ export * from "./onboarding-example";
|
|
|
4
4
|
export { getOnboardingCacheKey, DEFAULT_ONBOARDING_CACHE_KEY, } from "./infra/queries/cacheKey";
|
|
5
5
|
export type { ButtonAction, CustomButtonAction, SetVariableButtonAction, ComposableVariableEntry, ComposableVariableKind, WheelPickerElementProps, WheelPickerItem, WheelPickerRange, RichTextElementProps, ProgressiveBlurImageElementProps, BlurMask, LinearBlurMask, RadialBlurMask, BlurMaskStop, BlurAppear, ProgressIndicatorElementProps, ProgressEasing, AnimationEasing, SpringConfig, EnteringPreset, ExitingPreset, LayoutPreset, EffectPreset, EnteringAnimation, ExitingAnimation, LayoutAnimation, ElementEffect, ElementAnimation, ElementTransform, } from "./steps/ComposableScreen/types";
|
|
6
6
|
export { ButtonActionSchema, CustomButtonActionSchema, SetVariableButtonActionSchema, WheelPickerElementPropsSchema, generateWheelPickerRangeItems, resolveWheelPickerItems, } from "./steps/ComposableScreen/types";
|
|
7
|
+
export { OnboardingStudio } from "./OnboardingStudio";
|
|
8
|
+
export type { OnboardingStudioConfig, OnboardingStudioFacade } from "./OnboardingStudio";
|
|
9
|
+
export { useUserProperties, createUserPropertyStore, USER_PROPERTIES_STORAGE_KEY, RESERVED_USER_PROPERTY_KEYS, isReservedUserPropertyKey, } from "./userProperties";
|
|
10
|
+
export type { UserProperties, UserPropertyPatch, UserPropertyValue, UserPropertySnapshot, UserPropertyStorage, UserPropertyStore, } from "./userProperties";
|
|
11
|
+
export { resolveRegisterDecision, shouldRunFeature } from "./paywalls/register";
|
|
12
|
+
export type { RegisterDecision, RegisterFeature, RegisterResult } from "./paywalls/register";
|
|
13
|
+
export { DEFAULT_REGISTER_TIMEOUT_MS } from "./paywalls/PaywallProvider";
|
|
7
14
|
export type { PaywallStepType } from "./steps/Paywall/types";
|
|
8
15
|
export { PaywallStepTypeSchema, PaywallStepPayloadSchema } from "./steps/Paywall/types";
|
|
9
16
|
export { collectUnknownElementKeys, collectUnknownKeysInSteps, formatUnknownElementKeys, } from "./screens/unknownKeys";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,cAAc,SAAS,CAAC;AACxB,cAAc,sBAAsB,CAAC;AAErC,OAAO,EACL,qBAAqB,EACrB,4BAA4B,GAC7B,MAAM,0BAA0B,CAAC;AAElC,YAAY,EACV,YAAY,EACZ,kBAAkB,EAClB,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,uBAAuB,EACvB,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,gCAAgC,EAChC,QAAQ,EACR,cAAc,EACd,cAAc,EACd,YAAY,EACZ,UAAU,EACV,6BAA6B,EAC7B,cAAc,EACd,eAAe,EACf,YAAY,EACZ,cAAc,EACd,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,gCAAgC,CAAC;AACx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0B,EAC1B,aAAa,EAGb,kBAAkB,GACnB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAI7E,YAAY,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAC/F,YAAY,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAGnD,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,YAAY,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.usePaywall = exports.usePaywallHost = exports.PaywallProvider = exports.ONBOARDING_END_STEP_ID = exports.isUnaryConditionOperator = exports.UNARY_CONDITION_OPERATORS = exports.ConditionValueSchema = exports.ConditionOperatorSchema = exports.NextStepSchema = exports.BranchSchema = exports.ConditionGroupSchema = exports.LeafConditionSchema = exports.BaseStepTypeSchema = exports.isConditionGroup = exports.evaluateLeaf = exports.evaluateCondition = exports.resolveStartStepNumber = exports.resolveNextStepNumber = exports.expoRouterAdapter = exports.formatUnknownElementKeys = exports.collectUnknownKeysInSteps = exports.collectUnknownElementKeys = exports.PaywallStepPayloadSchema = exports.PaywallStepTypeSchema = exports.resolveWheelPickerItems = exports.generateWheelPickerRangeItems = exports.WheelPickerElementPropsSchema = exports.SetVariableButtonActionSchema = exports.CustomButtonActionSchema = exports.ButtonActionSchema = exports.DEFAULT_ONBOARDING_CACHE_KEY = exports.getOnboardingCacheKey = exports.OnboardingStudioClient = void 0;
|
|
17
|
+
exports.usePaywall = exports.usePaywallHost = exports.PaywallProvider = exports.ONBOARDING_END_STEP_ID = exports.isUnaryConditionOperator = exports.UNARY_CONDITION_OPERATORS = exports.ConditionValueSchema = exports.ConditionOperatorSchema = exports.NextStepSchema = exports.BranchSchema = exports.ConditionGroupSchema = exports.LeafConditionSchema = exports.BaseStepTypeSchema = exports.isConditionGroup = exports.evaluateLeaf = exports.evaluateCondition = exports.resolveStartStepNumber = exports.resolveNextStepNumber = exports.expoRouterAdapter = exports.formatUnknownElementKeys = exports.collectUnknownKeysInSteps = exports.collectUnknownElementKeys = exports.PaywallStepPayloadSchema = exports.PaywallStepTypeSchema = exports.DEFAULT_REGISTER_TIMEOUT_MS = exports.shouldRunFeature = exports.resolveRegisterDecision = exports.isReservedUserPropertyKey = exports.RESERVED_USER_PROPERTY_KEYS = exports.USER_PROPERTIES_STORAGE_KEY = exports.createUserPropertyStore = exports.useUserProperties = exports.OnboardingStudio = exports.resolveWheelPickerItems = exports.generateWheelPickerRangeItems = exports.WheelPickerElementPropsSchema = exports.SetVariableButtonActionSchema = exports.CustomButtonActionSchema = exports.ButtonActionSchema = exports.DEFAULT_ONBOARDING_CACHE_KEY = exports.getOnboardingCacheKey = exports.OnboardingStudioClient = void 0;
|
|
18
18
|
// Core client and types
|
|
19
19
|
var OnboardingStudioClient_1 = require("./OnboardingStudioClient");
|
|
20
20
|
Object.defineProperty(exports, "OnboardingStudioClient", { enumerable: true, get: function () { return OnboardingStudioClient_1.OnboardingStudioClient; } });
|
|
@@ -31,6 +31,42 @@ Object.defineProperty(exports, "SetVariableButtonActionSchema", { enumerable: tr
|
|
|
31
31
|
Object.defineProperty(exports, "WheelPickerElementPropsSchema", { enumerable: true, get: function () { return types_1.WheelPickerElementPropsSchema; } });
|
|
32
32
|
Object.defineProperty(exports, "generateWheelPickerRangeItems", { enumerable: true, get: function () { return types_1.generateWheelPickerRangeItems; } });
|
|
33
33
|
Object.defineProperty(exports, "resolveWheelPickerItems", { enumerable: true, get: function () { return types_1.resolveWheelPickerItems; } });
|
|
34
|
+
// The SDK's front door: configuration (`init`) and user identity
|
|
35
|
+
// (`setUserProperty`, `reset`), in the shape of the SDKs it sits alongside —
|
|
36
|
+
// `Superwall.configure`, `Purchases.configure`, `amplitude.init`.
|
|
37
|
+
//
|
|
38
|
+
// User properties feed audience resolution for BOTH onboardings and paywalls.
|
|
39
|
+
// This is a module-level object rather than a provider so non-React code — a
|
|
40
|
+
// login handler, an analytics service — can write to it; see
|
|
41
|
+
// `userProperties/store.ts` for why that one departure from the package's
|
|
42
|
+
// provider+context pattern is the point rather than an oversight.
|
|
43
|
+
//
|
|
44
|
+
// `register`/`present` are NOT here: presenting needs the mounted provider's
|
|
45
|
+
// state, so they stay on `usePaywall()`.
|
|
46
|
+
var OnboardingStudio_1 = require("./OnboardingStudio");
|
|
47
|
+
Object.defineProperty(exports, "OnboardingStudio", { enumerable: true, get: function () { return OnboardingStudio_1.OnboardingStudio; } });
|
|
48
|
+
// `useUserProperties()` is the React READ path; the write path is the facade.
|
|
49
|
+
//
|
|
50
|
+
// The internal helpers (`toQueryParams`, `paramsHash`, `applyUserPropertyPatch`,
|
|
51
|
+
// `resolveEffectiveParams`, `userPropertyStore`) are deliberately NOT exported:
|
|
52
|
+
// they are implementation detail, and `paramsHash` in particular is a cache-key
|
|
53
|
+
// concern a host reproducing it would only drift from.
|
|
54
|
+
var userProperties_1 = require("./userProperties");
|
|
55
|
+
Object.defineProperty(exports, "useUserProperties", { enumerable: true, get: function () { return userProperties_1.useUserProperties; } });
|
|
56
|
+
Object.defineProperty(exports, "createUserPropertyStore", { enumerable: true, get: function () { return userProperties_1.createUserPropertyStore; } });
|
|
57
|
+
Object.defineProperty(exports, "USER_PROPERTIES_STORAGE_KEY", { enumerable: true, get: function () { return userProperties_1.USER_PROPERTIES_STORAGE_KEY; } });
|
|
58
|
+
Object.defineProperty(exports, "RESERVED_USER_PROPERTY_KEYS", { enumerable: true, get: function () { return userProperties_1.RESERVED_USER_PROPERTY_KEYS; } });
|
|
59
|
+
Object.defineProperty(exports, "isReservedUserPropertyKey", { enumerable: true, get: function () { return userProperties_1.isReservedUserPropertyKey; } });
|
|
60
|
+
// `register(moment, feature)` — gate a feature on a moment. The decision helpers
|
|
61
|
+
// are exported because they are pure: a host building its own gating on top of
|
|
62
|
+
// `catalog` can reuse the SDK's exact rules rather than reimplement them slightly
|
|
63
|
+
// differently. `runRegister` and `RegisterDeps` stay internal — that seam exists
|
|
64
|
+
// for its own test.
|
|
65
|
+
var register_1 = require("./paywalls/register");
|
|
66
|
+
Object.defineProperty(exports, "resolveRegisterDecision", { enumerable: true, get: function () { return register_1.resolveRegisterDecision; } });
|
|
67
|
+
Object.defineProperty(exports, "shouldRunFeature", { enumerable: true, get: function () { return register_1.shouldRunFeature; } });
|
|
68
|
+
var PaywallProvider_1 = require("./paywalls/PaywallProvider");
|
|
69
|
+
Object.defineProperty(exports, "DEFAULT_REGISTER_TIMEOUT_MS", { enumerable: true, get: function () { return PaywallProvider_1.DEFAULT_REGISTER_TIMEOUT_MS; } });
|
|
34
70
|
var types_2 = require("./steps/Paywall/types");
|
|
35
71
|
Object.defineProperty(exports, "PaywallStepTypeSchema", { enumerable: true, get: function () { return types_2.PaywallStepTypeSchema; } });
|
|
36
72
|
Object.defineProperty(exports, "PaywallStepPayloadSchema", { enumerable: true, get: function () { return types_2.PaywallStepPayloadSchema; } });
|
|
@@ -66,9 +102,9 @@ Object.defineProperty(exports, "isUnaryConditionOperator", { enumerable: true, g
|
|
|
66
102
|
Object.defineProperty(exports, "ONBOARDING_END_STEP_ID", { enumerable: true, get: function () { return common_types_1.ONBOARDING_END_STEP_ID; } });
|
|
67
103
|
// Product runtime (paywall phase 3) — vendor-neutral store products
|
|
68
104
|
__exportStar(require("./products"), exports);
|
|
69
|
-
var
|
|
70
|
-
Object.defineProperty(exports, "PaywallProvider", { enumerable: true, get: function () { return
|
|
71
|
-
Object.defineProperty(exports, "usePaywallHost", { enumerable: true, get: function () { return
|
|
105
|
+
var PaywallProvider_2 = require("./paywalls/PaywallProvider");
|
|
106
|
+
Object.defineProperty(exports, "PaywallProvider", { enumerable: true, get: function () { return PaywallProvider_2.PaywallProvider; } });
|
|
107
|
+
Object.defineProperty(exports, "usePaywallHost", { enumerable: true, get: function () { return PaywallProvider_2.usePaywallHost; } });
|
|
72
108
|
var usePaywall_1 = require("./paywalls/usePaywall");
|
|
73
109
|
Object.defineProperty(exports, "usePaywall", { enumerable: true, get: function () { return usePaywall_1.usePaywall; } });
|
|
74
110
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,wBAAwB;AACxB,mEAAkE;AAAzD,gIAAA,sBAAsB,OAAA;AAC/B,0CAAwB;AACxB,uDAAqC;AACrC,8EAA8E;AAC9E,qDAGkC;AAFhC,iHAAA,qBAAqB,OAAA;AACrB,wHAAA,4BAA4B,OAAA;AAkC9B,wDAOwC;AANtC,2GAAA,kBAAkB,OAAA;AAClB,iHAAA,wBAAwB,OAAA;AACxB,sHAAA,6BAA6B,OAAA;AAC7B,sHAAA,6BAA6B,OAAA;AAC7B,sHAAA,6BAA6B,OAAA;AAC7B,gHAAA,uBAAuB,OAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,wBAAwB;AACxB,mEAAkE;AAAzD,gIAAA,sBAAsB,OAAA;AAC/B,0CAAwB;AACxB,uDAAqC;AACrC,8EAA8E;AAC9E,qDAGkC;AAFhC,iHAAA,qBAAqB,OAAA;AACrB,wHAAA,4BAA4B,OAAA;AAkC9B,wDAOwC;AANtC,2GAAA,kBAAkB,OAAA;AAClB,iHAAA,wBAAwB,OAAA;AACxB,sHAAA,6BAA6B,OAAA;AAC7B,sHAAA,6BAA6B,OAAA;AAC7B,s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AAmB,OAAA;AACnB,oHAAA,oBAAoB,OAAA;AACpB,4GAAA,YAAY,OAAA;AACZ,8GAAA,cAAc,OAAA;AACd,uHAAA,uBAAuB,OAAA;AACvB,oHAAA,oBAAoB,OAAA;AACpB,yHAAA,yBAAyB,OAAA;AACzB,wHAAA,wBAAwB,OAAA;AACxB,sHAAA,sBAAsB,OAAA;AAExB,oEAAoE;AACpE,6CAA2B;AAe3B,8DAA6E;AAApE,kHAAA,eAAe,OAAA;AAAE,iHAAA,cAAc,OAAA;AAMxC,oDAAmD;AAA1C,wGAAA,UAAU,OAAA"}
|
|
@@ -53,8 +53,21 @@ export type OnboardingCompletionContext = {
|
|
|
53
53
|
export type OnboardingCompleteHandler = (ctx: OnboardingCompletionContext) => void | Promise<void>;
|
|
54
54
|
interface OnboardingProviderProps {
|
|
55
55
|
children: React.ReactNode;
|
|
56
|
-
|
|
56
|
+
/**
|
|
57
|
+
* The studio client. Optional: omit it and the provider uses the client
|
|
58
|
+
* `OnboardingStudio.init({ projectId })` built. Passing one explicitly still
|
|
59
|
+
* wins, so an existing host is unaffected.
|
|
60
|
+
*
|
|
61
|
+
* With neither, this provider THROWS — an onboarding with no client has
|
|
62
|
+
* nothing to render, and a host `ErrorBoundary` gets a message naming both
|
|
63
|
+
* fixes.
|
|
64
|
+
*/
|
|
65
|
+
client?: OnboardingStudioClient;
|
|
57
66
|
locale?: string;
|
|
67
|
+
/**
|
|
68
|
+
* Static audience params (build-time facts). Merged under the user-property
|
|
69
|
+
* store and read once, when the onboarding is served — see `useAudienceParams`.
|
|
70
|
+
*/
|
|
58
71
|
customAudienceParams?: Record<string, any>;
|
|
59
72
|
/**
|
|
60
73
|
* Map of named handlers invokable from ComposableScreen Button `actions`
|
|
@@ -95,7 +108,7 @@ interface OnboardingProviderProps {
|
|
|
95
108
|
*/
|
|
96
109
|
productRefs?: ProductRef[];
|
|
97
110
|
}
|
|
98
|
-
export declare const OnboardingProvider: ({ children, client, locale, customAudienceParams, customActions, fontsFallback, navigation, onComplete, productProvider, productRefs, }: OnboardingProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
111
|
+
export declare const OnboardingProvider: ({ children, client: clientProp, locale, customAudienceParams, customActions, fontsFallback, navigation, onComplete, productProvider, productRefs, }: OnboardingProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
99
112
|
export declare const OnboardingProgressContext: import("react").Context<{
|
|
100
113
|
activeStep: {
|
|
101
114
|
number: number;
|