@rocapine/react-native-onboarding 1.61.0 → 1.62.0
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/dist/OnboardingStudioClient.d.ts +23 -5
- package/dist/OnboardingStudioClient.d.ts.map +1 -1
- package/dist/OnboardingStudioClient.js +82 -6
- package/dist/OnboardingStudioClient.js.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/infra/provider/OnboardingProvider.d.ts +25 -0
- package/dist/infra/provider/OnboardingProvider.d.ts.map +1 -1
- package/dist/infra/provider/OnboardingProvider.js +63 -3
- package/dist/infra/provider/OnboardingProvider.js.map +1 -1
- package/dist/infra/queries/cacheKey.d.ts +22 -4
- package/dist/infra/queries/cacheKey.d.ts.map +1 -1
- package/dist/infra/queries/cacheKey.js +26 -5
- package/dist/infra/queries/cacheKey.js.map +1 -1
- package/dist/paywalls/PaywallProvider.d.ts +66 -0
- package/dist/paywalls/PaywallProvider.d.ts.map +1 -0
- package/dist/paywalls/PaywallProvider.js +227 -0
- package/dist/paywalls/PaywallProvider.js.map +1 -0
- package/dist/paywalls/getPaywalls.query.d.ts +37 -0
- package/dist/paywalls/getPaywalls.query.d.ts.map +1 -0
- package/dist/paywalls/getPaywalls.query.js +114 -0
- package/dist/paywalls/getPaywalls.query.js.map +1 -0
- package/dist/paywalls/present.d.ts +100 -0
- package/dist/paywalls/present.d.ts.map +1 -0
- package/dist/paywalls/present.js +113 -0
- package/dist/paywalls/present.js.map +1 -0
- package/dist/paywalls/types.d.ts +95 -0
- package/dist/paywalls/types.d.ts.map +1 -0
- package/dist/paywalls/types.js +10 -0
- package/dist/paywalls/types.js.map +1 -0
- package/dist/paywalls/usePaywall.d.ts +29 -0
- package/dist/paywalls/usePaywall.d.ts.map +1 -0
- package/dist/paywalls/usePaywall.js +17 -0
- package/dist/paywalls/usePaywall.js.map +1 -0
- package/dist/products/ProductRuntimeContext.d.ts +15 -0
- package/dist/products/ProductRuntimeContext.d.ts.map +1 -0
- package/dist/products/ProductRuntimeContext.js +19 -0
- package/dist/products/ProductRuntimeContext.js.map +1 -0
- package/dist/products/index.d.ts +1 -0
- package/dist/products/index.d.ts.map +1 -1
- package/dist/products/index.js +4 -1
- package/dist/products/index.js.map +1 -1
- package/dist/products/mergeProductRuntimes.d.ts +55 -0
- package/dist/products/mergeProductRuntimes.d.ts.map +1 -0
- package/dist/products/mergeProductRuntimes.js +79 -0
- package/dist/products/mergeProductRuntimes.js.map +1 -0
- package/dist/steps/common.types.d.ts +22 -1
- package/dist/steps/common.types.d.ts.map +1 -1
- package/dist/steps/common.types.js +10 -1
- package/dist/steps/common.types.js.map +1 -1
- package/package.json +1 -1
- package/src/OnboardingStudioClient.ts +110 -7
- package/src/__tests__/mergeProductRuntimes.test.ts +172 -0
- package/src/__tests__/resolveLocalProductArgs.test.ts +41 -0
- package/src/index.ts +12 -0
- package/src/infra/provider/OnboardingProvider.tsx +73 -3
- package/src/infra/queries/cacheKey.ts +27 -4
- package/src/paywalls/PaywallProvider.tsx +342 -0
- package/src/paywalls/__tests__/getPaywalls.test.ts +334 -0
- package/src/paywalls/__tests__/present.test.ts +190 -0
- package/src/paywalls/getPaywalls.query.ts +123 -0
- package/src/paywalls/present.ts +141 -0
- package/src/paywalls/types.ts +99 -0
- package/src/paywalls/usePaywall.ts +35 -0
- package/src/products/ProductRuntimeContext.tsx +17 -0
- package/src/products/index.ts +1 -0
- package/src/products/mergeProductRuntimes.ts +78 -0
- package/src/steps/common.types.ts +34 -1
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PaywallProvider = exports.usePaywallHost = exports.PaywallContext = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const react_query_1 = require("@tanstack/react-query");
|
|
7
|
+
const getPaywalls_query_1 = require("./getPaywalls.query");
|
|
8
|
+
const present_1 = require("./present");
|
|
9
|
+
const useProducts_1 = require("../products/useProducts");
|
|
10
|
+
const ProductRuntimeContext_1 = require("../products/ProductRuntimeContext");
|
|
11
|
+
// Module-scope, private to this file — mirrors `OnboardingProvider.tsx:17-23`.
|
|
12
|
+
// `OnboardingProvider`'s QueryClient is not exported, so it cannot be reused
|
|
13
|
+
// here; a second, independent cache is intentional, not an oversight — the
|
|
14
|
+
// paywall catalog and the onboarding step payload are different resources
|
|
15
|
+
// with different lifetimes and different AsyncStorage namespaces
|
|
16
|
+
// (`rocapine-paywalls-*` vs `rocapine-onboarding-*`, see
|
|
17
|
+
// `infra/queries/cacheKey.ts`).
|
|
18
|
+
const paywallQueryClient = new react_query_1.QueryClient({
|
|
19
|
+
defaultOptions: {
|
|
20
|
+
queries: {
|
|
21
|
+
staleTime: Infinity,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
// Frozen at module scope, not a default PARAMETER — a default parameter
|
|
26
|
+
// re-allocates on every render, and `customActions` sits in the published
|
|
27
|
+
// context value (read by `usePaywallHost()` to build the presented paywall's
|
|
28
|
+
// `ScreenHost`), so an unstable identity would defeat memoization the same
|
|
29
|
+
// way `EMPTY_CUSTOM_ACTIONS` in `OnboardingProvider.tsx` documents.
|
|
30
|
+
const EMPTY_CUSTOM_ACTIONS = Object.freeze({});
|
|
31
|
+
const EMPTY_PAYWALL_CONTEXT = {
|
|
32
|
+
present: async () => ({ status: "error" }),
|
|
33
|
+
isReady: false,
|
|
34
|
+
catalog: null,
|
|
35
|
+
activePaywall: null,
|
|
36
|
+
complete: () => { },
|
|
37
|
+
customActions: EMPTY_CUSTOM_ACTIONS,
|
|
38
|
+
};
|
|
39
|
+
exports.PaywallContext = (0, react_1.createContext)(EMPTY_PAYWALL_CONTEXT);
|
|
40
|
+
/**
|
|
41
|
+
* The seam a paywall HOST (Task 7's `PaywallHost`) reads from — analogous to
|
|
42
|
+
* `ScreenHost` being the seam the rendering engine reads from. Kept out of
|
|
43
|
+
* `usePaywall()`'s return so an ordinary caller never sees presentation
|
|
44
|
+
* internals it has no reason to touch (which paywall is active, how to
|
|
45
|
+
* resolve it).
|
|
46
|
+
*/
|
|
47
|
+
const usePaywallHost = () => {
|
|
48
|
+
const { activePaywall, complete, customActions } = (0, react_1.useContext)(exports.PaywallContext);
|
|
49
|
+
return { activePaywall, complete, customActions };
|
|
50
|
+
};
|
|
51
|
+
exports.usePaywallHost = usePaywallHost;
|
|
52
|
+
const PaywallProviderInner = ({ children, client, locale, customAudienceParams, productProvider, customActions, }) => {
|
|
53
|
+
var _a;
|
|
54
|
+
// `data` straight off `useQuery` is the single source of truth (Finding 1,
|
|
55
|
+
// 2026-08-17 final review) — react-query's own cache already gets both a
|
|
56
|
+
// provider remount and a locale/customAudienceParams round-trip right; a
|
|
57
|
+
// mirrored `useState` populated from inside `queryFn` does not (it only
|
|
58
|
+
// gets written on a cache MISS). See `getPaywalls.query.ts`'s module doc
|
|
59
|
+
// for why the query still needs `paywallQueryClient` for the ONE case
|
|
60
|
+
// `data` alone can't cover: a background revalidation pushing a fresh
|
|
61
|
+
// payload while this query call already resolved with the cached one.
|
|
62
|
+
const { data, error } = (0, react_query_1.useQuery)((0, getPaywalls_query_1.getPaywallsQuery)(client, locale, customAudienceParams, paywallQueryClient));
|
|
63
|
+
const catalog = data !== null && data !== void 0 ? data : null;
|
|
64
|
+
(0, react_1.useEffect)(() => {
|
|
65
|
+
if (!error)
|
|
66
|
+
return;
|
|
67
|
+
// Deliberately NOT thrown. `OnboardingProvider` throws its query error so
|
|
68
|
+
// a host `ErrorBoundary` around a single onboarding screen catches it —
|
|
69
|
+
// but `PaywallProvider` wraps the WHOLE app (spec §7:
|
|
70
|
+
// `<PaywallProvider><App/><PaywallHost/></PaywallProvider>`), so throwing
|
|
71
|
+
// here would crash every screen over a paywall-catalog failure alone.
|
|
72
|
+
// Instead: `catalog` simply stays null, `present()` on any placement
|
|
73
|
+
// resolves "error" (see `resolvePresentDecision` — an unresolved catalog
|
|
74
|
+
// looks identical to an unknown placement), and `isReady` stays false.
|
|
75
|
+
console.warn("[paywalls] Failed to load paywall catalog:", error);
|
|
76
|
+
}, [error]);
|
|
77
|
+
// Union of every placement's products, deduplicated, resolved ONCE — never
|
|
78
|
+
// re-keyed per presented paywall. See `present.ts`'s `collectProductRefs`
|
|
79
|
+
// doc for why (spec §6.1's "render instantly on tap" requirement).
|
|
80
|
+
const productRefs = (0, react_1.useMemo)(() => (0, present_1.collectProductRefs)(catalog), [catalog]);
|
|
81
|
+
const productRuntime = (0, useProducts_1.useProducts)(productRefs, productProvider, locale);
|
|
82
|
+
// Tracks what a purchase attempt resolved to during the CURRENT
|
|
83
|
+
// presentation — read by `complete()` to upgrade a generic "dismissed"
|
|
84
|
+
// outcome (see `resolvePresentedOutcome`), reset when a new presentation
|
|
85
|
+
// starts (`present()`'s "start" branch) so one presentation's purchase
|
|
86
|
+
// can never leak into the next.
|
|
87
|
+
const lastPurchaseOutcomeRef = (0, react_1.useRef)(null);
|
|
88
|
+
// Monotonic, incremented every time a presentation actually starts (never
|
|
89
|
+
// on the "immediate" no-op branch). Resetting `lastPurchaseOutcomeRef` at
|
|
90
|
+
// that same moment is NOT enough to stop a stale write: paywall A's
|
|
91
|
+
// `purchase()` can still be in flight when the user dismisses A and
|
|
92
|
+
// paywall B is presented (which resets the ref); if A's promise settles
|
|
93
|
+
// AFTER that reset, an unconditional write would land "purchased" in what
|
|
94
|
+
// is now B's tracker. `purchase()` below captures the generation it
|
|
95
|
+
// started in and only writes if that generation is still current — see
|
|
96
|
+
// `shouldRecordPurchaseOutcome`. DO NOT remove the guard because the write
|
|
97
|
+
// "looks" unconditional; that is exactly the race it closes.
|
|
98
|
+
const presentationGenerationRef = (0, react_1.useRef)(0);
|
|
99
|
+
// Wraps `productRuntime.purchase` to record the outcome above (race-guarded
|
|
100
|
+
// — see `presentationGenerationRef`); every other field (and — critically —
|
|
101
|
+
// the object's change cadence, since `products.purchasing` flips must
|
|
102
|
+
// still propagate) is untouched. `productRuntime.purchase` is itself
|
|
103
|
+
// `useCallback(…, [])`-stable (`useProducts.ts`), so this wrapper never
|
|
104
|
+
// changes identity either.
|
|
105
|
+
const purchase = (0, react_1.useCallback)(async (key) => {
|
|
106
|
+
const startedInGeneration = presentationGenerationRef.current;
|
|
107
|
+
const result = await productRuntime.purchase(key);
|
|
108
|
+
const outcome = (0, present_1.purchaseOutcomeFromResult)(result);
|
|
109
|
+
if (outcome && (0, present_1.shouldRecordPurchaseOutcome)(startedInGeneration, presentationGenerationRef.current)) {
|
|
110
|
+
lastPurchaseOutcomeRef.current = outcome;
|
|
111
|
+
}
|
|
112
|
+
return result;
|
|
113
|
+
}, [productRuntime.purchase]);
|
|
114
|
+
const productRuntimeWithPurchaseTracking = (0, react_1.useMemo)(() => (Object.assign(Object.assign({}, productRuntime), { purchase })), [productRuntime, purchase]);
|
|
115
|
+
const [activePlacement, setActivePlacement] = (0, react_1.useState)(null);
|
|
116
|
+
// Refs so `present`/`complete` stay referentially stable (empty deps) while
|
|
117
|
+
// still reading current state — same pattern `useProducts.ts` uses for its
|
|
118
|
+
// `purchase`/`restore` callbacks.
|
|
119
|
+
const catalogRef = (0, react_1.useRef)(catalog);
|
|
120
|
+
catalogRef.current = catalog;
|
|
121
|
+
// `activePlacementRef` is made AUTHORITATIVE below — assigned inside
|
|
122
|
+
// `present()`'s start branch and inside `complete()`, not just here. Finding
|
|
123
|
+
// 4, 2026-08-17 final review: this line alone only resyncs the ref from
|
|
124
|
+
// state AFTER React commits, so between a `present()` call and the next
|
|
125
|
+
// commit the ref still holds the PREVIOUS value. Two `present()` calls
|
|
126
|
+
// issued in the same tick (`Promise.all([present("a"), present("b")])`, or
|
|
127
|
+
// two `presentPaywall` actions in one action list) both read the stale ref,
|
|
128
|
+
// both take the "start" branch, and the second overwrites
|
|
129
|
+
// `pendingResolveRef` — the first promise then never settles, exactly the
|
|
130
|
+
// orphaning this whole ref/resolver scheme exists to prevent. Assigning
|
|
131
|
+
// synchronously inside `present`/`complete` closes that window; this
|
|
132
|
+
// render-body line stays only as a resync for the (rare) case something
|
|
133
|
+
// external changes `activePlacement` state without going through either
|
|
134
|
+
// callback.
|
|
135
|
+
const activePlacementRef = (0, react_1.useRef)(activePlacement);
|
|
136
|
+
activePlacementRef.current = activePlacement;
|
|
137
|
+
const pendingResolveRef = (0, react_1.useRef)(null);
|
|
138
|
+
// present() must not fetch anything — the catalog and products are already
|
|
139
|
+
// resolved (or resolving) from mount. It only decides, synchronously,
|
|
140
|
+
// whether to show the Modal.
|
|
141
|
+
const present = (0, react_1.useCallback)((placement) => {
|
|
142
|
+
const decision = (0, present_1.resolvePresentDecision)(catalogRef.current, activePlacementRef.current, placement);
|
|
143
|
+
if (decision.type === "immediate") {
|
|
144
|
+
return Promise.resolve(decision.result);
|
|
145
|
+
}
|
|
146
|
+
// Fresh presentation: no purchase has happened under it yet, and any
|
|
147
|
+
// still-in-flight purchase from a PREVIOUS presentation must not be
|
|
148
|
+
// allowed to write into this one — see `presentationGenerationRef`.
|
|
149
|
+
lastPurchaseOutcomeRef.current = null;
|
|
150
|
+
presentationGenerationRef.current += 1;
|
|
151
|
+
// Authoritative NOW, synchronously — see the ref's doc above. A second
|
|
152
|
+
// `present()` call before React commits reads this value, not the stale
|
|
153
|
+
// pre-commit state, and correctly takes the "already showing" branch.
|
|
154
|
+
activePlacementRef.current = placement;
|
|
155
|
+
return new Promise((resolve) => {
|
|
156
|
+
pendingResolveRef.current = resolve;
|
|
157
|
+
setActivePlacement(placement);
|
|
158
|
+
});
|
|
159
|
+
}, []);
|
|
160
|
+
// Called by PaywallHost (Task 7) from the presented paywall's
|
|
161
|
+
// `ScreenHost.complete`. Resolves whatever `present()` call is pending and
|
|
162
|
+
// clears the active placement, hiding the Modal and allowing a new
|
|
163
|
+
// `present()` to start. Safe to call with nothing pending (no-ops).
|
|
164
|
+
//
|
|
165
|
+
// `resolvePresentedOutcome` upgrades a bare "dismissed" to "purchased" (or
|
|
166
|
+
// "cancelled") when the store actually did something during this
|
|
167
|
+
// presentation — see its doc for why `dismiss`'s own `{status:"dismissed"}`
|
|
168
|
+
// isn't treated as an unoverridable explicit answer.
|
|
169
|
+
const complete = (0, react_1.useCallback)((result) => {
|
|
170
|
+
const resolve = pendingResolveRef.current;
|
|
171
|
+
pendingResolveRef.current = null;
|
|
172
|
+
// Authoritative NOW, synchronously — same reasoning as `present()`'s
|
|
173
|
+
// assignment above: a `present()` issued from the resolution continuation
|
|
174
|
+
// (`const r = await present("a"); … present("downsell")` — a downsell
|
|
175
|
+
// opening from the previous paywall's resolution is a canonical pattern,
|
|
176
|
+
// spec §4.5) must see "nothing showing" immediately, not wait for the
|
|
177
|
+
// next commit.
|
|
178
|
+
activePlacementRef.current = null;
|
|
179
|
+
setActivePlacement(null);
|
|
180
|
+
resolve === null || resolve === void 0 ? void 0 : resolve((0, present_1.resolvePresentedOutcome)(result, lastPurchaseOutcomeRef.current));
|
|
181
|
+
}, []);
|
|
182
|
+
const activePaywall = activePlacement ? (_a = catalog === null || catalog === void 0 ? void 0 : catalog.paywalls[activePlacement]) !== null && _a !== void 0 ? _a : null : null;
|
|
183
|
+
// Finding 6, 2026-08-17 final review, widened by N2 (round 2): a background
|
|
184
|
+
// catalog revalidation (see `getPaywalls.query.ts`) can push a fresh catalog
|
|
185
|
+
// that no longer contains the placement currently on screen (a studio
|
|
186
|
+
// publish renamed or removed it mid-session) — OR the query KEY itself can
|
|
187
|
+
// change while a paywall is showing (`locale`/`customAudienceParams`
|
|
188
|
+
// changed as a prop), which makes react-query report `data: undefined`
|
|
189
|
+
// while the new key is fetching (Finding 1's fix reads `catalog` straight
|
|
190
|
+
// from that `data`). Both collapse `activePaywall` to null the same way, so
|
|
191
|
+
// guarding on THAT — not on `catalog` being non-null — catches both: the
|
|
192
|
+
// original guard (`!catalog` check) missed the query-key case entirely,
|
|
193
|
+
// because a null `catalog` made it bail out before ever checking whether
|
|
194
|
+
// the placement was still present.
|
|
195
|
+
//
|
|
196
|
+
// Either way, the Modal closes itself WITHOUT going through `complete()`,
|
|
197
|
+
// so the pending `present()` promise would never settle and
|
|
198
|
+
// `activePlacement` would stay set forever, silently failing every later
|
|
199
|
+
// `present()` call with `"error"` for the rest of the app's life.
|
|
200
|
+
// `complete()` always clears `activePlacement` together with resolving the
|
|
201
|
+
// pending promise, so it cannot race with or double-resolve this branch.
|
|
202
|
+
(0, react_1.useEffect)(() => {
|
|
203
|
+
if (!activePlacement || activePaywall)
|
|
204
|
+
return;
|
|
205
|
+
complete({ status: "error" });
|
|
206
|
+
}, [activePlacement, activePaywall, complete]);
|
|
207
|
+
const isReady = (0, react_1.useMemo)(() => (0, present_1.computeIsReady)(catalog, productRefs, productRuntime.status), [catalog, productRefs, productRuntime.status]);
|
|
208
|
+
const contextValue = (0, react_1.useMemo)(() => ({ present, isReady, catalog, activePaywall, complete, customActions }), [present, isReady, catalog, activePaywall, complete, customActions]);
|
|
209
|
+
return ((0, jsx_runtime_1.jsx)(ProductRuntimeContext_1.ProductRuntimeContext.Provider, { value: productRuntimeWithPurchaseTracking, children: (0, jsx_runtime_1.jsx)(exports.PaywallContext.Provider, { value: contextValue, children: children }) }));
|
|
210
|
+
};
|
|
211
|
+
/**
|
|
212
|
+
* App-level ancestor. Renders ABOVE `OnboardingProvider`, not inside it —
|
|
213
|
+
* that is what lets both share one `ProductRuntimeContext` (React context
|
|
214
|
+
* only flows to descendants; two true siblings could not share one runtime).
|
|
215
|
+
*
|
|
216
|
+
* ```tsx
|
|
217
|
+
* <PaywallProvider client={client} productProvider={revenueCatProductProvider(Purchases)}>
|
|
218
|
+
* <App />
|
|
219
|
+
* <PaywallHost /> // Task 7: renders the active paywall in a fullScreen RN Modal
|
|
220
|
+
* </PaywallProvider>
|
|
221
|
+
* ```
|
|
222
|
+
*/
|
|
223
|
+
const PaywallProvider = ({ children, client, locale = "en", customAudienceParams = {}, productProvider, customActions = EMPTY_CUSTOM_ACTIONS, }) => {
|
|
224
|
+
return ((0, jsx_runtime_1.jsx)(react_query_1.QueryClientProvider, { client: paywallQueryClient, children: (0, jsx_runtime_1.jsx)(PaywallProviderInner, { client: client, locale: locale, customAudienceParams: customAudienceParams, productProvider: productProvider, customActions: customActions, children: children }) }));
|
|
225
|
+
};
|
|
226
|
+
exports.PaywallProvider = PaywallProvider;
|
|
227
|
+
//# sourceMappingURL=PaywallProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PaywallProvider.js","sourceRoot":"","sources":["../../src/paywalls/PaywallProvider.tsx"],"names":[],"mappings":";;;;AAAA,iCAAqG;AACrG,uDAAmF;AAEnF,2DAAuD;AAEvD,uCAQmB;AACnB,yDAAsD;AAEtD,6EAA0E;AAG1E,+EAA+E;AAC/E,6EAA6E;AAC7E,2EAA2E;AAC3E,0EAA0E;AAC1E,iEAAiE;AACjE,yDAAyD;AACzD,gCAAgC;AAChC,MAAM,kBAAkB,GAAG,IAAI,yBAAW,CAAC;IACzC,cAAc,EAAE;QACd,OAAO,EAAE;YACP,SAAS,EAAE,QAAQ;SACpB;KACF;CACF,CAAC,CAAC;AAEH,wEAAwE;AACxE,0EAA0E;AAC1E,6EAA6E;AAC7E,2EAA2E;AAC3E,oEAAoE;AACpE,MAAM,oBAAoB,GAAkB,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAyB9D,MAAM,qBAAqB,GAAwB;IACjD,OAAO,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;IAC1C,OAAO,EAAE,KAAK;IACd,OAAO,EAAE,IAAI;IACb,aAAa,EAAE,IAAI;IACnB,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC;IAClB,aAAa,EAAE,oBAAoB;CACpC,CAAC;AAEW,QAAA,cAAc,GAAG,IAAA,qBAAa,EAAsB,qBAAqB,CAAC,CAAC;AAEx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eAAe,mBAqB1B"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { QueryClient } from "@tanstack/react-query";
|
|
2
|
+
import { OnboardingStudioClient } from "../OnboardingStudioClient";
|
|
3
|
+
import { PaywallCatalog } from "./types";
|
|
4
|
+
/**
|
|
5
|
+
* Mirrors `getOnboarding.query.ts`'s cache-first / background-revalidate /
|
|
6
|
+
* custom-key behaviour exactly (same `staleTime: Infinity`, same
|
|
7
|
+
* production-vs-sandbox split, same "no background refetch under a custom
|
|
8
|
+
* key" rule) so a paywall does not revalidate differently from an
|
|
9
|
+
* onboarding.
|
|
10
|
+
*
|
|
11
|
+
* Deliberate difference: `getOnboardingQuery`'s `fetchAndCache` special-cases
|
|
12
|
+
* the client's offline-fallback payload (`ONBS-Onboarding-Id === "fallback"`)
|
|
13
|
+
* and skips caching it. `OnboardingStudioClient.getPaywalls` has no fallback
|
|
14
|
+
* option — it always throws on a network/response error instead of returning
|
|
15
|
+
* a stand-in payload — so there is no fallback case to special-case here:
|
|
16
|
+
* every resolved catalog is a real one and is always cached.
|
|
17
|
+
*
|
|
18
|
+
* `catalog` consumption used to be a `setCatalog` callback mirrored into a
|
|
19
|
+
* component `useState` — but `queryFn` only re-runs on a cache MISS
|
|
20
|
+
* (`staleTime: Infinity`), so that mirror went stale on a provider remount
|
|
21
|
+
* (module-scope `QueryClient`, cache outlives the provider) and on a
|
|
22
|
+
* query-key round-trip (`locale` switched away and back) — Finding 1, 2026-
|
|
23
|
+
* 08-17 final review. The fix: `PaywallProviderInner` now reads `data`
|
|
24
|
+
* straight off `useQuery` as the single source of truth — react-query's own
|
|
25
|
+
* cache already gets this right on both a remount and a key round-trip. The
|
|
26
|
+
* ONE case `data` alone can't cover is the BACKGROUND revalidation below:
|
|
27
|
+
* `fetchAndCache()` there runs detached from the pending query call (its
|
|
28
|
+
* return value is discarded, not observed by react-query), so it must push
|
|
29
|
+
* the fresh payload into the query cache directly via `queryClient.
|
|
30
|
+
* setQueryData` — there is no mirrored component state left to keep in sync.
|
|
31
|
+
*/
|
|
32
|
+
export declare const getPaywallsQuery: (client: OnboardingStudioClient, locale: string, customAudienceParams: Record<string, any>, queryClient?: QueryClient) => {
|
|
33
|
+
queryKey: (string | boolean | undefined)[];
|
|
34
|
+
queryFn: () => Promise<PaywallCatalog>;
|
|
35
|
+
staleTime: number;
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=getPaywalls.query.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getPaywalls.query.d.ts","sourceRoot":"","sources":["../../src/paywalls/getPaywalls.query.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAGzC;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,gBAAgB,GAC3B,QAAQ,sBAAsB,EAC9B,QAAQ,MAAM,EACd,sBAAsB,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACzC,cAAc,WAAW;;mBAcJ,OAAO,CAAC,cAAc,CAAC;;CAsE7C,CAAC"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getPaywallsQuery = void 0;
|
|
7
|
+
const async_storage_1 = __importDefault(require("@react-native-async-storage/async-storage"));
|
|
8
|
+
const cacheKey_1 = require("../infra/queries/cacheKey");
|
|
9
|
+
/**
|
|
10
|
+
* Mirrors `getOnboarding.query.ts`'s cache-first / background-revalidate /
|
|
11
|
+
* custom-key behaviour exactly (same `staleTime: Infinity`, same
|
|
12
|
+
* production-vs-sandbox split, same "no background refetch under a custom
|
|
13
|
+
* key" rule) so a paywall does not revalidate differently from an
|
|
14
|
+
* onboarding.
|
|
15
|
+
*
|
|
16
|
+
* Deliberate difference: `getOnboardingQuery`'s `fetchAndCache` special-cases
|
|
17
|
+
* the client's offline-fallback payload (`ONBS-Onboarding-Id === "fallback"`)
|
|
18
|
+
* and skips caching it. `OnboardingStudioClient.getPaywalls` has no fallback
|
|
19
|
+
* option — it always throws on a network/response error instead of returning
|
|
20
|
+
* a stand-in payload — so there is no fallback case to special-case here:
|
|
21
|
+
* every resolved catalog is a real one and is always cached.
|
|
22
|
+
*
|
|
23
|
+
* `catalog` consumption used to be a `setCatalog` callback mirrored into a
|
|
24
|
+
* component `useState` — but `queryFn` only re-runs on a cache MISS
|
|
25
|
+
* (`staleTime: Infinity`), so that mirror went stale on a provider remount
|
|
26
|
+
* (module-scope `QueryClient`, cache outlives the provider) and on a
|
|
27
|
+
* query-key round-trip (`locale` switched away and back) — Finding 1, 2026-
|
|
28
|
+
* 08-17 final review. The fix: `PaywallProviderInner` now reads `data`
|
|
29
|
+
* straight off `useQuery` as the single source of truth — react-query's own
|
|
30
|
+
* cache already gets this right on both a remount and a key round-trip. The
|
|
31
|
+
* ONE case `data` alone can't cover is the BACKGROUND revalidation below:
|
|
32
|
+
* `fetchAndCache()` there runs detached from the pending query call (its
|
|
33
|
+
* return value is discarded, not observed by react-query), so it must push
|
|
34
|
+
* the fresh payload into the query cache directly via `queryClient.
|
|
35
|
+
* setQueryData` — there is no mirrored component state left to keep in sync.
|
|
36
|
+
*/
|
|
37
|
+
const getPaywallsQuery = (client, locale, customAudienceParams, queryClient) => {
|
|
38
|
+
const queryKey = [
|
|
39
|
+
"paywallCatalog",
|
|
40
|
+
client.projectId,
|
|
41
|
+
client.options.isSandbox,
|
|
42
|
+
client.options.baseUrl,
|
|
43
|
+
client.options.cacheKey,
|
|
44
|
+
locale,
|
|
45
|
+
JSON.stringify(customAudienceParams),
|
|
46
|
+
];
|
|
47
|
+
return {
|
|
48
|
+
queryKey,
|
|
49
|
+
queryFn: async () => {
|
|
50
|
+
var _a;
|
|
51
|
+
const isProduction = !(((_a = client === null || client === void 0 ? void 0 : client.options) === null || _a === void 0 ? void 0 : _a.isSandbox) || false);
|
|
52
|
+
// A custom key opts into app-controlled caching: persist cache-first
|
|
53
|
+
// with NO background revalidation, so a pinned version survives across
|
|
54
|
+
// launches. The default key keeps stale-while-revalidate.
|
|
55
|
+
const hasCustomKey = Boolean(client.options.cacheKey);
|
|
56
|
+
const cacheKey = (0, cacheKey_1.getPaywallsCacheKey)(client.options.cacheKey);
|
|
57
|
+
// Fetches the live catalog, caches it, and pushes it into the query
|
|
58
|
+
// cache directly — see the module doc above for why that push is
|
|
59
|
+
// needed even though `queryFn`'s own return value already becomes
|
|
60
|
+
// `data` for a LIVE call: this same function also runs detached, as a
|
|
61
|
+
// background revalidation, whose return value nothing observes.
|
|
62
|
+
// Unlike `getOnboardingQuery`, there is no fallback payload to exclude
|
|
63
|
+
// from caching — a rejection here propagates as-is (error-surfacing,
|
|
64
|
+
// not a resolved fallback).
|
|
65
|
+
const fetchAndCache = async () => {
|
|
66
|
+
const { data } = await client.getPaywalls({ locale }, customAudienceParams);
|
|
67
|
+
queryClient === null || queryClient === void 0 ? void 0 : queryClient.setQueryData(queryKey, data);
|
|
68
|
+
try {
|
|
69
|
+
await async_storage_1.default.setItem(cacheKey, JSON.stringify(data));
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
console.warn("Failed to cache paywalls:", error);
|
|
73
|
+
}
|
|
74
|
+
return data;
|
|
75
|
+
};
|
|
76
|
+
// Sandbox / draft: always fetch fresh, no caching.
|
|
77
|
+
if (!isProduction) {
|
|
78
|
+
return fetchAndCache();
|
|
79
|
+
}
|
|
80
|
+
// Production: serve the cached catalog instantly (fast first paint,
|
|
81
|
+
// offline-resilient). With the default key this is stale-while-revalidate
|
|
82
|
+
// (also refresh in the background so studio re-deploys propagate and a
|
|
83
|
+
// stale cache heals). With a custom key it's persist-only — no background
|
|
84
|
+
// refetch — so a pinned version is never swapped out from under the host.
|
|
85
|
+
let cached = null;
|
|
86
|
+
try {
|
|
87
|
+
const cachedData = await async_storage_1.default.getItem(cacheKey);
|
|
88
|
+
if (cachedData)
|
|
89
|
+
cached = JSON.parse(cachedData);
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
console.warn("Failed to load cached paywalls:", error);
|
|
93
|
+
}
|
|
94
|
+
if (cached) {
|
|
95
|
+
if (!hasCustomKey) {
|
|
96
|
+
// Background revalidation — updates the cache + query state when a
|
|
97
|
+
// fresh real payload arrives via `queryClient.setQueryData` above.
|
|
98
|
+
// Errors are swallowed: the cache already painted, so an offline
|
|
99
|
+
// revalidation must not surface as a query error.
|
|
100
|
+
void fetchAndCache().catch((error) => {
|
|
101
|
+
console.warn("Background paywalls revalidation failed:", error);
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
return cached;
|
|
105
|
+
}
|
|
106
|
+
// No cache yet: await the network. A rejection here surfaces as the
|
|
107
|
+
// query's error (there is no fallback to fall back to).
|
|
108
|
+
return fetchAndCache();
|
|
109
|
+
},
|
|
110
|
+
staleTime: Infinity,
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
exports.getPaywallsQuery = getPaywallsQuery;
|
|
114
|
+
//# sourceMappingURL=getPaywalls.query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getPaywalls.query.js","sourceRoot":"","sources":["../../src/paywalls/getPaywalls.query.ts"],"names":[],"mappings":";;;;;;AAAA,8FAAqE;AAIrE,wDAAgE;AAEhE;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACI,MAAM,gBAAgB,GAAG,CAC9B,MAA8B,EAC9B,MAAc,EACd,oBAAyC,EACzC,WAAyB,EACzB,EAAE;IACF,MAAM,QAAQ,GAAG;QACf,gBAAgB;QAChB,MAAM,CAAC,SAAS;QAChB,MAAM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D,IAAI,CAAC,YAAY,EAAE,CAAC;gBAClB,OAAO,aAAa,EAAE,CAAC;YACzB,CAAC;YAED,oEAAoE;YACpE,0EAA0E;YAC1E,uEAAuE;YACvE,0EAA0E;YAC1E,0EAA0E;YAC1E,IAAI,MAAM,GAA0B,IAAI,CAAC;YACzC,IAAI,CAAC;gBACH,MAAM,UAAU,GAAG,MAAM,uBAAY,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;gBACxD,IAAI,UAAU;oBAAE,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAmB,CAAC;YACpE,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,IAAI,CAAC,iCAAiC,EAAE,KAAK,CAAC,CAAC;YACzD,CAAC;YAED,IAAI,MAAM,EAAE,CAAC;gBACX,IAAI,CAAC,YAAY,EAAE,CAAC;oBAClB,mEAAmE;oBACnE,mEAAmE;oBACnE,iEAAiE;oBACjE,kDAAkD;oBAClD,KAAK,aAAa,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;wBACnC,OAAO,CAAC,IAAI,CAAC,0CAA0C,EAAE,KAAK,CAAC,CAAC;oBAClE,CAAC,CAAC,CAAC;gBACL,CAAC;gBACD,OAAO,MAAM,CAAC;YAChB,CAAC;YAED,oEAAoE;YACpE,wDAAwD;YACxD,OAAO,aAAa,EAAE,CAAC;QACzB,CAAC;QACD,SAAS,EAAE,QAAQ;KACpB,CAAC;AACJ,CAAC,CAAC;AAxFW,QAAA,gBAAgB,oBAwF3B"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import type { Paywall, PaywallCatalog, PresentResult } from "./types";
|
|
2
|
+
import type { ProductRef, ProductStatus, PurchaseResult } from "../products/types";
|
|
3
|
+
/**
|
|
4
|
+
* Union of every `paywall.products[]` across the WHOLE catalog, deduplicated
|
|
5
|
+
* by content — the same identity notion `useProducts`' `refsKey` uses
|
|
6
|
+
* (`products/useProducts.ts:41-45`: keyed on ref CONTENT, not array
|
|
7
|
+
* identity), so this array is exactly as cheap to pass as a hand-written one:
|
|
8
|
+
* `useProducts` resolves it once and does not refetch on every render.
|
|
9
|
+
*
|
|
10
|
+
* Resolving the whole catalog's union ONCE at load — rather than re-keying
|
|
11
|
+
* `useProducts` per presented paywall — is the deliberate design decision:
|
|
12
|
+
* a paywall must render the instant the user taps upgrade (spec §6.1), and a
|
|
13
|
+
* store round-trip at that moment is exactly the latency this avoids. Cost
|
|
14
|
+
* accepted: an app resolves products for paywalls it may never show.
|
|
15
|
+
*/
|
|
16
|
+
export declare const collectProductRefs: (catalog: PaywallCatalog | null) => ProductRef[];
|
|
17
|
+
/** What `present()` should do, decided as a pure function of current state. */
|
|
18
|
+
export type PresentDecision = {
|
|
19
|
+
type: "start";
|
|
20
|
+
paywall: Paywall;
|
|
21
|
+
} | {
|
|
22
|
+
type: "immediate";
|
|
23
|
+
result: PresentResult;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* `present(placement)`'s edge-case decision, extracted so both documented
|
|
27
|
+
* edge cases are covered by an importable test rather than only inspection:
|
|
28
|
+
*
|
|
29
|
+
* - **Unknown placement** (absent from the catalog, or the catalog hasn't
|
|
30
|
+
* resolved yet — both look identical here: `catalog?.paywalls[placement]`
|
|
31
|
+
* is `undefined` either way) → resolves `"error"`, never throws. A missing
|
|
32
|
+
* placement must not crash a host app mid-flow.
|
|
33
|
+
* - **`present()` called while another paywall is already showing** → also
|
|
34
|
+
* resolves `"error"` immediately, leaving the in-progress presentation
|
|
35
|
+
* untouched. This SDK shows one paywall at a time. Silently replacing the
|
|
36
|
+
* active paywall would orphan its pending `present()` promise (never
|
|
37
|
+
* resolved — that caller hangs forever); queueing the new request would
|
|
38
|
+
* need its own cancellation/timeout story that nothing here asks for.
|
|
39
|
+
* Resolving the new call immediately applies the same "resolve, don't
|
|
40
|
+
* throw" contract as the unknown-placement case, consistently.
|
|
41
|
+
*/
|
|
42
|
+
export declare const resolvePresentDecision: (catalog: PaywallCatalog | null, activePlacement: string | null, placement: string) => PresentDecision;
|
|
43
|
+
/**
|
|
44
|
+
* `isReady` = catalog resolved AND products resolved — the one flag a caller
|
|
45
|
+
* needs to know "presenting now will not show a spinner".
|
|
46
|
+
*
|
|
47
|
+
* The `productRefs.length === 0` branch handles a real edge case:
|
|
48
|
+
* `useProducts` never leaves status `"idle"` when its ref set is empty
|
|
49
|
+
* (`products/useProducts.ts:49-54` bails out before ever calling the
|
|
50
|
+
* provider) — a catalog whose paywalls declare no products at all would
|
|
51
|
+
* otherwise report `isReady: false` forever, with nothing to actually wait
|
|
52
|
+
* for.
|
|
53
|
+
*/
|
|
54
|
+
export declare const computeIsReady: (catalog: PaywallCatalog | null, productRefs: ProductRef[], productsStatus: ProductStatus) => boolean;
|
|
55
|
+
/**
|
|
56
|
+
* What a purchase attempt resolved to during the current presentation, or
|
|
57
|
+
* `null` if none did. Only the two `PurchaseResult` statuses that describe a
|
|
58
|
+
* completed store interaction are tracked — `"pending"` (e.g. Ask-to-Buy) and
|
|
59
|
+
* `"error"` are not: they don't describe what happened to the STORE PURCHASE
|
|
60
|
+
* in a way that should override how the paywall itself reports closing (an
|
|
61
|
+
* `"error"` here would collide with `PresentResult`'s existing `"error"`,
|
|
62
|
+
* which means something structurally different — an unknown placement or a
|
|
63
|
+
* mistimed `present()` call, not a failed purchase attempt).
|
|
64
|
+
*/
|
|
65
|
+
export type PurchaseOutcomeDuringPresentation = "purchased" | "cancelled" | null;
|
|
66
|
+
/** Narrows a `PurchaseResult` to the subset `PurchaseOutcomeDuringPresentation` tracks. */
|
|
67
|
+
export declare const purchaseOutcomeFromResult: (result: PurchaseResult) => PurchaseOutcomeDuringPresentation;
|
|
68
|
+
/**
|
|
69
|
+
* Reconciles what the closing action REPORTED with what actually happened at
|
|
70
|
+
* the store during this presentation. `dismiss` (spec §4.5) always reports
|
|
71
|
+
* `{status:"dismissed"}` — it is the generic "this screen is done" signal and
|
|
72
|
+
* knows nothing about purchases, which is exactly the gap spec §4.6's own
|
|
73
|
+
* canonical authoring shape falls into: `{type:"purchase", onSuccess:
|
|
74
|
+
* [{type:"dismiss"}]}` closes a successful purchase through the SAME generic
|
|
75
|
+
* signal a user backing out would produce. So a bare `"dismissed"` is treated
|
|
76
|
+
* as "the caller didn't have anything more specific to say" and gets upgraded
|
|
77
|
+
* to whatever the store actually did (if anything). Any other reported
|
|
78
|
+
* status is assumed to mean something deliberate and passes through
|
|
79
|
+
* unchanged — this only fills in the generic default, never overrides a
|
|
80
|
+
* caller that already said something more specific.
|
|
81
|
+
*/
|
|
82
|
+
export declare const resolvePresentedOutcome: (reported: PresentResult, purchaseOutcome: PurchaseOutcomeDuringPresentation) => PresentResult;
|
|
83
|
+
/**
|
|
84
|
+
* Guards the purchase-outcome WRITE against a race that resetting the ref at
|
|
85
|
+
* `present()`'s start does not, by itself, prevent: paywall A is showing,
|
|
86
|
+
* `purchase()` is in flight; the user dismisses A (nothing tracked yet, so A
|
|
87
|
+
* correctly resolves `"dismissed"`); paywall B is presented, resetting the
|
|
88
|
+
* tracked outcome; THEN A's stale promise finally settles and would write
|
|
89
|
+
* `"purchased"` into what is now B's tracker — B later reports a purchase
|
|
90
|
+
* the user never made on it. `purchase()` must capture the current
|
|
91
|
+
* generation BEFORE awaiting the store and compare it against the current
|
|
92
|
+
* generation again after — only an unchanged generation means the write is
|
|
93
|
+
* still for the presentation that started it.
|
|
94
|
+
*
|
|
95
|
+
* A monotonic counter, not the placement string: the same placement can
|
|
96
|
+
* legitimately be presented twice in a row, and a string comparison would
|
|
97
|
+
* let a stale write from the FIRST of those two land in the second.
|
|
98
|
+
*/
|
|
99
|
+
export declare const shouldRecordPurchaseOutcome: (startedInGeneration: number, currentGeneration: number) => boolean;
|
|
100
|
+
//# sourceMappingURL=present.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"present.d.ts","sourceRoot":"","sources":["../../src/paywalls/present.ts"],"names":[],"mappings":"AAAA,OAAO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
|
|
3
|
+
exports.shouldRecordPurchaseOutcome = exports.resolvePresentedOutcome = exports.purchaseOutcomeFromResult = exports.computeIsReady = exports.resolvePresentDecision = exports.collectProductRefs = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Union of every `paywall.products[]` across the WHOLE catalog, deduplicated
|
|
6
|
+
* by content — the same identity notion `useProducts`' `refsKey` uses
|
|
7
|
+
* (`products/useProducts.ts:41-45`: keyed on ref CONTENT, not array
|
|
8
|
+
* identity), so this array is exactly as cheap to pass as a hand-written one:
|
|
9
|
+
* `useProducts` resolves it once and does not refetch on every render.
|
|
10
|
+
*
|
|
11
|
+
* Resolving the whole catalog's union ONCE at load — rather than re-keying
|
|
12
|
+
* `useProducts` per presented paywall — is the deliberate design decision:
|
|
13
|
+
* a paywall must render the instant the user taps upgrade (spec §6.1), and a
|
|
14
|
+
* store round-trip at that moment is exactly the latency this avoids. Cost
|
|
15
|
+
* accepted: an app resolves products for paywalls it may never show.
|
|
16
|
+
*/
|
|
17
|
+
const collectProductRefs = (catalog) => {
|
|
18
|
+
var _a, _b, _c;
|
|
19
|
+
if (!catalog)
|
|
20
|
+
return [];
|
|
21
|
+
const seen = new Set();
|
|
22
|
+
const refs = [];
|
|
23
|
+
for (const paywall of Object.values(catalog.paywalls)) {
|
|
24
|
+
for (const ref of paywall.products) {
|
|
25
|
+
const identity = `${ref.key}|${(_a = ref.ios) !== null && _a !== void 0 ? _a : ""}|${(_b = ref.android) !== null && _b !== void 0 ? _b : ""}|${(_c = ref.compareTo) !== null && _c !== void 0 ? _c : ""}`;
|
|
26
|
+
if (seen.has(identity))
|
|
27
|
+
continue;
|
|
28
|
+
seen.add(identity);
|
|
29
|
+
refs.push(ref);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return refs;
|
|
33
|
+
};
|
|
34
|
+
exports.collectProductRefs = collectProductRefs;
|
|
35
|
+
/**
|
|
36
|
+
* `present(placement)`'s edge-case decision, extracted so both documented
|
|
37
|
+
* edge cases are covered by an importable test rather than only inspection:
|
|
38
|
+
*
|
|
39
|
+
* - **Unknown placement** (absent from the catalog, or the catalog hasn't
|
|
40
|
+
* resolved yet — both look identical here: `catalog?.paywalls[placement]`
|
|
41
|
+
* is `undefined` either way) → resolves `"error"`, never throws. A missing
|
|
42
|
+
* placement must not crash a host app mid-flow.
|
|
43
|
+
* - **`present()` called while another paywall is already showing** → also
|
|
44
|
+
* resolves `"error"` immediately, leaving the in-progress presentation
|
|
45
|
+
* untouched. This SDK shows one paywall at a time. Silently replacing the
|
|
46
|
+
* active paywall would orphan its pending `present()` promise (never
|
|
47
|
+
* resolved — that caller hangs forever); queueing the new request would
|
|
48
|
+
* need its own cancellation/timeout story that nothing here asks for.
|
|
49
|
+
* Resolving the new call immediately applies the same "resolve, don't
|
|
50
|
+
* throw" contract as the unknown-placement case, consistently.
|
|
51
|
+
*/
|
|
52
|
+
const resolvePresentDecision = (catalog, activePlacement, placement) => {
|
|
53
|
+
if (activePlacement !== null) {
|
|
54
|
+
return { type: "immediate", result: { status: "error" } };
|
|
55
|
+
}
|
|
56
|
+
const paywall = catalog === null || catalog === void 0 ? void 0 : catalog.paywalls[placement];
|
|
57
|
+
if (!paywall) {
|
|
58
|
+
return { type: "immediate", result: { status: "error" } };
|
|
59
|
+
}
|
|
60
|
+
return { type: "start", paywall };
|
|
61
|
+
};
|
|
62
|
+
exports.resolvePresentDecision = resolvePresentDecision;
|
|
63
|
+
/**
|
|
64
|
+
* `isReady` = catalog resolved AND products resolved — the one flag a caller
|
|
65
|
+
* needs to know "presenting now will not show a spinner".
|
|
66
|
+
*
|
|
67
|
+
* The `productRefs.length === 0` branch handles a real edge case:
|
|
68
|
+
* `useProducts` never leaves status `"idle"` when its ref set is empty
|
|
69
|
+
* (`products/useProducts.ts:49-54` bails out before ever calling the
|
|
70
|
+
* provider) — a catalog whose paywalls declare no products at all would
|
|
71
|
+
* otherwise report `isReady: false` forever, with nothing to actually wait
|
|
72
|
+
* for.
|
|
73
|
+
*/
|
|
74
|
+
const computeIsReady = (catalog, productRefs, productsStatus) => catalog !== null && (productRefs.length === 0 || productsStatus === "ready");
|
|
75
|
+
exports.computeIsReady = computeIsReady;
|
|
76
|
+
/** Narrows a `PurchaseResult` to the subset `PurchaseOutcomeDuringPresentation` tracks. */
|
|
77
|
+
const purchaseOutcomeFromResult = (result) => result.status === "purchased" || result.status === "cancelled" ? result.status : null;
|
|
78
|
+
exports.purchaseOutcomeFromResult = purchaseOutcomeFromResult;
|
|
79
|
+
/**
|
|
80
|
+
* Reconciles what the closing action REPORTED with what actually happened at
|
|
81
|
+
* the store during this presentation. `dismiss` (spec §4.5) always reports
|
|
82
|
+
* `{status:"dismissed"}` — it is the generic "this screen is done" signal and
|
|
83
|
+
* knows nothing about purchases, which is exactly the gap spec §4.6's own
|
|
84
|
+
* canonical authoring shape falls into: `{type:"purchase", onSuccess:
|
|
85
|
+
* [{type:"dismiss"}]}` closes a successful purchase through the SAME generic
|
|
86
|
+
* signal a user backing out would produce. So a bare `"dismissed"` is treated
|
|
87
|
+
* as "the caller didn't have anything more specific to say" and gets upgraded
|
|
88
|
+
* to whatever the store actually did (if anything). Any other reported
|
|
89
|
+
* status is assumed to mean something deliberate and passes through
|
|
90
|
+
* unchanged — this only fills in the generic default, never overrides a
|
|
91
|
+
* caller that already said something more specific.
|
|
92
|
+
*/
|
|
93
|
+
const resolvePresentedOutcome = (reported, purchaseOutcome) => reported.status === "dismissed" && purchaseOutcome ? { status: purchaseOutcome } : reported;
|
|
94
|
+
exports.resolvePresentedOutcome = resolvePresentedOutcome;
|
|
95
|
+
/**
|
|
96
|
+
* Guards the purchase-outcome WRITE against a race that resetting the ref at
|
|
97
|
+
* `present()`'s start does not, by itself, prevent: paywall A is showing,
|
|
98
|
+
* `purchase()` is in flight; the user dismisses A (nothing tracked yet, so A
|
|
99
|
+
* correctly resolves `"dismissed"`); paywall B is presented, resetting the
|
|
100
|
+
* tracked outcome; THEN A's stale promise finally settles and would write
|
|
101
|
+
* `"purchased"` into what is now B's tracker — B later reports a purchase
|
|
102
|
+
* the user never made on it. `purchase()` must capture the current
|
|
103
|
+
* generation BEFORE awaiting the store and compare it against the current
|
|
104
|
+
* generation again after — only an unchanged generation means the write is
|
|
105
|
+
* still for the presentation that started it.
|
|
106
|
+
*
|
|
107
|
+
* A monotonic counter, not the placement string: the same placement can
|
|
108
|
+
* legitimately be presented twice in a row, and a string comparison would
|
|
109
|
+
* let a stale write from the FIRST of those two land in the second.
|
|
110
|
+
*/
|
|
111
|
+
const shouldRecordPurchaseOutcome = (startedInGeneration, currentGeneration) => startedInGeneration === currentGeneration;
|
|
112
|
+
exports.shouldRecordPurchaseOutcome = shouldRecordPurchaseOutcome;
|
|
113
|
+
//# sourceMappingURL=present.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"present.js","sourceRoot":"","sources":["../../src/paywalls/present.ts"],"names":[],"mappings":";;;AAGA;;;;;;;;;;;;GAYG;AACI,MAAM,kBAAkB,GAAG,CAAC,OAA8B,EAAgB,EAAE;;IACjF,IAAI,CAAC,OAAO;QAAE,OAAO,EAAE,CAAC;IACxB,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,MAAM,IAAI,GAAiB,EAAE,CAAC;IAC9B,KAAK,MAAM,OAAO,IAAI,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QACtD,KAAK,MAAM,GAAG,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;YACnC,MAAM,QAAQ,GAAG,GAAG,GAAG,CAAC,GAAG,IAAI,MAAA,GAAG,CAAC,GAAG,mCAAI,EAAE,IAAI,MAAA,GAAG,CAAC,OAAO,mCAAI,EAAE,IAAI,MAAA,GAAG,CAAC,SAAS,mCAAI,EAAE,EAAE,CAAC;YAC3F,IAAI,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC;gBAAE,SAAS;YACjC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,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