@rocapine/react-native-onboarding 1.75.0 → 1.76.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.
Files changed (87) hide show
  1. package/dist/index.d.ts +5 -3
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +16 -2
  4. package/dist/index.js.map +1 -1
  5. package/dist/onboarding-example.d.ts +140 -0
  6. package/dist/onboarding-example.d.ts.map +1 -1
  7. package/dist/onboarding-example.js +41 -1
  8. package/dist/onboarding-example.js.map +1 -1
  9. package/dist/paywalls/PaywallProvider.d.ts +71 -5
  10. package/dist/paywalls/PaywallProvider.d.ts.map +1 -1
  11. package/dist/paywalls/PaywallProvider.js +237 -57
  12. package/dist/paywalls/PaywallProvider.js.map +1 -1
  13. package/dist/paywalls/customScreens.d.ts +31 -0
  14. package/dist/paywalls/customScreens.d.ts.map +1 -1
  15. package/dist/paywalls/observer.d.ts +129 -0
  16. package/dist/paywalls/observer.d.ts.map +1 -0
  17. package/dist/paywalls/observer.js +211 -0
  18. package/dist/paywalls/observer.js.map +1 -0
  19. package/dist/paywalls/present.d.ts +19 -15
  20. package/dist/paywalls/present.d.ts.map +1 -1
  21. package/dist/paywalls/present.js +21 -17
  22. package/dist/paywalls/present.js.map +1 -1
  23. package/dist/paywalls/types.d.ts +3 -1
  24. package/dist/paywalls/types.d.ts.map +1 -1
  25. package/dist/products/adapters/expoIap.d.ts +38 -1
  26. package/dist/products/adapters/expoIap.d.ts.map +1 -1
  27. package/dist/products/adapters/expoIap.js +509 -75
  28. package/dist/products/adapters/expoIap.js.map +1 -1
  29. package/dist/products/index.d.ts +1 -0
  30. package/dist/products/index.d.ts.map +1 -1
  31. package/dist/products/index.js.map +1 -1
  32. package/dist/products/types.d.ts +13 -0
  33. package/dist/products/types.d.ts.map +1 -1
  34. package/dist/screens/completingActions.d.ts +55 -3
  35. package/dist/screens/completingActions.d.ts.map +1 -1
  36. package/dist/screens/completingActions.js +209 -15
  37. package/dist/screens/completingActions.js.map +1 -1
  38. package/dist/screens/elementTypeRegistry.d.ts +14 -0
  39. package/dist/screens/elementTypeRegistry.d.ts.map +1 -1
  40. package/dist/screens/elementTypeRegistry.js +38 -1
  41. package/dist/screens/elementTypeRegistry.js.map +1 -1
  42. package/dist/screens/elements/ButtonElement.d.ts +3 -2
  43. package/dist/screens/elements/ButtonElement.d.ts.map +1 -1
  44. package/dist/screens/elements/ButtonElement.js +5 -1
  45. package/dist/screens/elements/ButtonElement.js.map +1 -1
  46. package/dist/screens/types.d.ts +2 -2
  47. package/dist/screens/types.d.ts.map +1 -1
  48. package/dist/screens/types.js +5 -1
  49. package/dist/screens/types.js.map +1 -1
  50. package/dist/screens/unknownKeys.d.ts +25 -4
  51. package/dist/screens/unknownKeys.d.ts.map +1 -1
  52. package/dist/screens/unknownKeys.js +81 -2
  53. package/dist/screens/unknownKeys.js.map +1 -1
  54. package/dist/steps/common.types.d.ts +178 -6
  55. package/dist/steps/common.types.d.ts.map +1 -1
  56. package/dist/steps/common.types.js +64 -3
  57. package/dist/steps/common.types.js.map +1 -1
  58. package/package.json +1 -1
  59. package/src/__tests__/authoringDocEscapes.test.ts +59 -0
  60. package/src/__tests__/completingActions.test.ts +371 -1
  61. package/src/__tests__/customActionHooks.test.ts +224 -0
  62. package/src/__tests__/onboardingExampleElements.test.ts +47 -0
  63. package/src/__tests__/requestPermissionAction.test.ts +138 -0
  64. package/src/__tests__/retryIdempotencyDocs.test.ts +57 -0
  65. package/src/__tests__/unknownKeys.test.ts +110 -0
  66. package/src/index.ts +33 -1
  67. package/src/onboarding-example.ts +41 -1
  68. package/src/paywalls/PaywallProvider.tsx +370 -66
  69. package/src/paywalls/__tests__/PaywallProvider.observer.test.tsx +866 -0
  70. package/src/paywalls/__tests__/observer.test.ts +401 -0
  71. package/src/paywalls/__tests__/present.test.ts +0 -18
  72. package/src/paywalls/customScreens.ts +34 -1
  73. package/src/paywalls/observer.ts +308 -0
  74. package/src/paywalls/present.ts +24 -18
  75. package/src/paywalls/types.ts +3 -1
  76. package/src/products/adapters/__tests__/expoIap.contract.test.ts +648 -0
  77. package/src/products/adapters/__tests__/expoIap.test.ts +25 -11
  78. package/src/products/adapters/__tests__/expoIap5Fake.ts +288 -0
  79. package/src/products/adapters/expoIap.ts +609 -78
  80. package/src/products/index.ts +1 -0
  81. package/src/products/types.ts +13 -0
  82. package/src/screens/completingActions.ts +223 -15
  83. package/src/screens/elementTypeRegistry.ts +34 -0
  84. package/src/screens/elements/ButtonElement.ts +9 -1
  85. package/src/screens/types.ts +2 -2
  86. package/src/screens/unknownKeys.ts +113 -7
  87. package/src/steps/common.types.ts +213 -6
@@ -5,6 +5,7 @@ import { ProductProvider, ProductStatus } from "../products/types";
5
5
  import type { CustomActions } from "../infra/provider/OnboardingProvider";
6
6
  import type { CustomPaywallScreens } from "./customScreens";
7
7
  import { type RegisterFeature, type RegisterResult } from "./register";
8
+ import { type PaywallObserver, type PaywallPresentation, type PaywallPresentationSource, type PaywallTransactionInfo } from "./observer";
8
9
  /**
9
10
  * Everything a paywall consumer or a paywall HOST needs. Deliberately one
10
11
  * context carrying both, mirroring how `OnboardingProgressContext` bundles
@@ -65,15 +66,49 @@ export type PaywallContextValue = {
65
66
  * Resolve the pending `present()` call and clear the active moment.
66
67
  * Call this from the presented paywall's `ScreenHost.complete` (Task 7's
67
68
  * `PaywallHost`) — never from an ordinary consumer.
69
+ *
70
+ * BOUND to the presentation on screen when it was rendered: its identity
71
+ * changes once per presentation, and a stale copy (a previous paywall's
72
+ * action chain finishing late) is a no-op rather than closing whatever is on
73
+ * screen now. Call the `complete` from the CURRENT render; one stashed
74
+ * across presentations does nothing.
75
+ *
76
+ * `transaction` is what a custom paywall screen passed to its own
77
+ * `complete()` (#287): forwarded to the observer's `end()`, sanitized, and
78
+ * only when `result.status` is `"purchased"`. It never changes what
79
+ * `present()` resolves. Omit it and nothing changes.
68
80
  */
69
- complete: (result: PresentResult) => void;
81
+ complete: (result: PresentResult, transaction?: PaywallTransactionInfo) => void;
70
82
  /**
71
- * Called by the paywall HOST once the paywall is actually on screen (the UI
72
- * host wires this to its Modal's `onShow`) — never by an ordinary consumer.
83
+ * Called by the paywall HOST once the CURRENT presentation is actually on
84
+ * screen — never by an ordinary consumer. The provider never acknowledges a
85
+ * presentation on its own: only the host knows what it renders.
86
+ *
87
+ * The contract for a host of its own (the UI package's `PaywallHost` meets
88
+ * it already):
89
+ * - Call it from the Modal's `onShow`, which fires when the Modal appears
90
+ * and never when the platform refuses to present.
91
+ * - Call it again when a new presentation takes a Modal you kept mounted
92
+ * and `visible` (the previous one ended and the next started in the same
93
+ * commit, e.g. an `await present("a")` continuation): `onShow` does not
94
+ * fire twice, and without the call that paywall is abandoned after
95
+ * `presentAckTimeoutMs` as `host-never-presented`. Only do so if an
96
+ * `onShow` arrived while the Modal was visible, during its current
97
+ * visible stretch.
98
+ * - Ignore an `onShow` that arrives while your Modal is hidden. iOS emits it
99
+ * from the present completion with no visibility check, so a paywall that
100
+ * ended before its slide-in finished delivers it late. Acting on it (or
101
+ * counting it as confirmation) vouches for a presentation nobody saw.
102
+ * - Never call it for a presentation you will not render (a custom screen
103
+ * you do not have, elements that fail to parse): it would report a paywall
104
+ * nobody saw as shown, and disable the recovery below.
105
+ * - A Modal re-keyed per presentation needs none of the above: each one
106
+ * mounts afresh and fires its own `onShow`.
73
107
  *
74
108
  * Without it a presentation the platform silently refused is
75
109
  * indistinguishable from one the user is reading, and the refused case wedges
76
110
  * the surface permanently. See `shouldBreakPresentationWedge` in `present.ts`.
111
+ * Calling it twice for one presentation is harmless.
77
112
  */
78
113
  acknowledgePresentation: () => void;
79
114
  /** Forwarded into the presented paywall's `ScreenHost.customActions`. */
@@ -89,6 +124,16 @@ export type PaywallContextValue = {
89
124
  * already mounts. `PaywallHost`'s own prop still wins for that host.
90
125
  */
91
126
  customScreens: CustomPaywallScreens;
127
+ /**
128
+ * Opens one observed presentation for a surface OTHER than `present()` —
129
+ * today the inline `Paywall` onboarding step, reported as
130
+ * `surface: "paywall_step"`. Calls the provider's `observer.start` now and
131
+ * returns a handle whose `shown`/`end` never throw and reach the observer at
132
+ * most once / exactly once. A no-op handle when no observer was passed.
133
+ *
134
+ * `present()` reports itself; a paywall HOST never calls this for it.
135
+ */
136
+ observePresentation: (paywall: PaywallPresentationSource) => PaywallPresentation;
92
137
  };
93
138
  /**
94
139
  * How long `register()` waits for the catalog to settle before deciding without
@@ -104,7 +149,7 @@ export declare const PaywallContext: import("react").Context<PaywallContextValue
104
149
  * internals it has no reason to touch (which paywall is active, how to
105
150
  * resolve it).
106
151
  */
107
- export declare const usePaywallHost: () => Pick<PaywallContextValue, "activePaywall" | "complete" | "acknowledgePresentation" | "customActions" | "customScreens">;
152
+ export declare const usePaywallHost: () => Pick<PaywallContextValue, "activePaywall" | "complete" | "acknowledgePresentation" | "customActions" | "customScreens" | "observePresentation">;
108
153
  interface PaywallProviderProps {
109
154
  children: React.ReactNode;
110
155
  /**
@@ -178,6 +223,27 @@ interface PaywallProviderProps {
178
223
  * chance to land before a feature is given away.
179
224
  */
180
225
  registerTimeoutMs?: number;
226
+ /**
227
+ * Told about every paywall presentation, so the HOST can send it to its own
228
+ * analytics — this SDK sends nothing anywhere itself. Optional: omit it and
229
+ * nothing changes.
230
+ *
231
+ * `start(info)` runs once a `present()` call is accepted (never for an
232
+ * `unknown-moment` or `already-presenting` refusal) and may return a handle;
233
+ * `handle.shown()` runs when the host confirms the paywall is on screen, and
234
+ * `handle.end(outcome)` exactly once with the final `present()` result —
235
+ * including every post-acceptance error, as `status: "error"` with its
236
+ * `reason`. The inline `Paywall` onboarding step reports through the same
237
+ * observer with `surface: "paywall_step"`.
238
+ *
239
+ * Every call is guarded: an observer that throws, rejects, or returns
240
+ * something that is not a handle is logged and ignored, and never changes
241
+ * what `present()` resolves. The types match rocalytics-sdk's
242
+ * `PaywallObserver`, so its paywall tracker can be passed straight in.
243
+ *
244
+ * Read through a ref, so an inline object is fine.
245
+ */
246
+ observer?: PaywallObserver;
181
247
  }
182
248
  /**
183
249
  * App-level ancestor. Renders ABOVE `OnboardingProvider`, not inside it —
@@ -201,6 +267,6 @@ interface PaywallProviderProps {
201
267
  * then read the default context, where `isProviderMounted` is `false` and both
202
268
  * `present` and `register` resolve their fail-open answers.
203
269
  */
204
- export declare const PaywallProvider: ({ children, client: clientProp, locale, customAudienceParams, productProvider, stripeProductProvider, customActions, customScreens, presentAckTimeoutMs, registerTimeoutMs, }: PaywallProviderProps) => import("react/jsx-runtime").JSX.Element;
270
+ export declare const PaywallProvider: ({ children, client: clientProp, locale, customAudienceParams, productProvider, stripeProductProvider, customActions, customScreens, presentAckTimeoutMs, registerTimeoutMs, observer, }: PaywallProviderProps) => import("react/jsx-runtime").JSX.Element;
205
271
  export {};
206
272
  //# sourceMappingURL=PaywallProvider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PaywallProvider.d.ts","sourceRoot":"","sources":["../../src/paywalls/PaywallProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAEnE,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,EAKL,KAAK,aAAa,EAOnB,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEnE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAC1E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAG5D,OAAO,EAAe,KAAK,eAAe,EAAE,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAuCpF;;;;;;GAMG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC;IACpD;;;;;;;;;;;;OAYG;IACH,QAAQ,EAAE,CAAC,MA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G;IACH,qBAAqB,CAAC,EAAE,eAAe,CAAC;IACxC,mFAAmF;IACnF,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B;;;;;;;;;;;;OAYG;IACH,aAAa,CAAC,EAAE,oBAAoB,CAAC;IACrC;;;;;;;;OAQG;IACH,mBAAmB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC;;;;;;;OAOG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;;;;;;;;;;;;;;;;OAmBG;IACH,QAAQ,CAAC,EAAE,eAAe,CAAC;CAC5B;AA+lBD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,eAAe,GAAI,yLAY7B,oBAAoB,4CAiCtB,CAAC"}
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PaywallProvider = exports.usePaywallHost = exports.PaywallContext = exports.DEFAULT_REGISTER_TIMEOUT_MS = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
+ const react_native_1 = require("react-native");
6
7
  const react_query_1 = require("@tanstack/react-query");
7
8
  const getPaywalls_query_1 = require("./getPaywalls.query");
8
9
  const present_1 = require("./present");
@@ -13,6 +14,7 @@ const effectiveParams_1 = require("../userProperties/effectiveParams");
13
14
  const register_1 = require("./register");
14
15
  const OnboardingStudio_1 = require("../OnboardingStudio");
15
16
  const catalogSettleWaiter_1 = require("./catalogSettleWaiter");
17
+ const observer_1 = require("./observer");
16
18
  // Module-scope, private to this file — mirrors `OnboardingProvider.tsx:17-23`.
17
19
  // `OnboardingProvider`'s QueryClient is not exported, so it cannot be reused
18
20
  // here; a second, independent cache is intentional, not an oversight — the
@@ -63,6 +65,7 @@ const EMPTY_PAYWALL_CONTEXT = {
63
65
  acknowledgePresentation: () => { },
64
66
  customActions: EMPTY_CUSTOM_ACTIONS,
65
67
  customScreens: EMPTY_CUSTOM_SCREENS,
68
+ observePresentation: () => observer_1.NOOP_PAYWALL_PRESENTATION,
66
69
  };
67
70
  /**
68
71
  * How long a presentation may go unacknowledged by the host before it is
@@ -86,11 +89,55 @@ exports.PaywallContext = (0, react_1.createContext)(EMPTY_PAYWALL_CONTEXT);
86
89
  * resolve it).
87
90
  */
88
91
  const usePaywallHost = () => {
89
- const { activePaywall, complete, acknowledgePresentation, customActions, customScreens } = (0, react_1.useContext)(exports.PaywallContext);
90
- return { activePaywall, complete, acknowledgePresentation, customActions, customScreens };
92
+ const { activePaywall, complete, acknowledgePresentation, customActions, customScreens, observePresentation, } = (0, react_1.useContext)(exports.PaywallContext);
93
+ return {
94
+ activePaywall,
95
+ complete,
96
+ acknowledgePresentation,
97
+ customActions,
98
+ customScreens,
99
+ observePresentation,
100
+ };
91
101
  };
92
102
  exports.usePaywallHost = usePaywallHost;
93
- const PaywallProviderInner = ({ children, client, locale, customAudienceParams, productProvider, stripeProductProvider, customActions, customScreens, presentAckTimeoutMs, registerTimeoutMs, }) => {
103
+ /**
104
+ * Whether an off-surface record should wait for its purchases rather than end
105
+ * now: only while one is in flight AND its end is still open. Once a purchase
106
+ * settled `purchased` the end is fixed (`resolveEndedOutcome`), so nothing a
107
+ * pending one settles to could change it.
108
+ */
109
+ const shouldWaitForPurchases = (record) => record.pending > 0 && record.purchaseOutcome !== "purchased";
110
+ /**
111
+ * Keeps an off-surface record open for the purchases still in flight on it:
112
+ * the purchase wrapper ends it when the last one settles, or this bound does,
113
+ * `dismissed`. Never cleared by an unmount, so a purchase that never settles
114
+ * cannot leak it.
115
+ */
116
+ const waitForPurchases = (record) => {
117
+ var _a;
118
+ (_a = record.timer) !== null && _a !== void 0 ? _a : (record.timer = setTimeout(() => endPresentation(record, { status: "dismissed" }), present_1.LATE_PURCHASE_TIMEOUT_MS));
119
+ };
120
+ /**
121
+ * The single end of a `present()` presentation: reports to the observer and
122
+ * resolves `present()` with the same reconciled outcome (`resolveEndedOutcome`:
123
+ * a settled purchase sticks, otherwise `resolvePresentedOutcome` upgrades a bare
124
+ * `dismissed` to what the store did — see its doc for why `dismiss`'s own
125
+ * `{status:"dismissed"}` isn't treated as an unoverridable explicit answer).
126
+ * Reported before resolving. Idempotent.
127
+ */
128
+ const endPresentation = (record, result, reportedTransaction) => {
129
+ if (!record || record.ended)
130
+ return;
131
+ record.ended = true;
132
+ if (record.timer)
133
+ clearTimeout(record.timer);
134
+ record.timer = null;
135
+ const outcome = (0, present_1.resolveEndedOutcome)(result, record.purchaseOutcome);
136
+ // `outcome`, never the transaction, is what `present()` resolves with.
137
+ record.presentation.end(outcome, record.purchasedKey, record.purchasedFrom, reportedTransaction);
138
+ record.resolve(outcome);
139
+ };
140
+ const PaywallProviderInner = ({ children, client, locale, customAudienceParams, productProvider, stripeProductProvider, customActions, customScreens, presentAckTimeoutMs, registerTimeoutMs, observer, }) => {
94
141
  var _a;
95
142
  // `data` straight off `useQuery` is the single source of truth (Finding 1,
96
143
  // 2026-08-17 final review) — react-query's own cache already gets both a
@@ -186,39 +233,84 @@ const PaywallProviderInner = ({ children, client, locale, customAudienceParams,
186
233
  "adapter. Pass `stripeLinkProductProvider({ clientReferenceId })` to honour it.");
187
234
  }
188
235
  }, [activePaywall, stripeProductProvider]);
189
- // Tracks what a purchase attempt resolved to during the CURRENT
190
- // presentation — read by `complete()` to upgrade a generic "dismissed"
191
- // outcome (see `resolvePresentedOutcome`), reset when a new presentation
192
- // starts (`present()`'s "start" branch) so one presentation's purchase
193
- // can never leak into the next.
194
- const lastPurchaseOutcomeRef = (0, react_1.useRef)(null);
195
- // Monotonic, incremented every time a presentation actually starts (never
196
- // on the "immediate" no-op branch). Resetting `lastPurchaseOutcomeRef` at
197
- // that same moment is NOT enough to stop a stale write: paywall A's
198
- // `purchase()` can still be in flight when the user dismisses A and
199
- // paywall B is presented (which resets the ref); if A's promise settles
200
- // AFTER that reset, an unconditional write would land "purchased" in what
201
- // is now B's tracker. `purchase()` below captures the generation it
202
- // started in and only writes if that generation is still current — see
203
- // `shouldRecordPurchaseOutcome`. DO NOT remove the guard because the write
204
- // "looks" unconditional; that is exactly the race it closes.
205
- const presentationGenerationRef = (0, react_1.useRef)(0);
206
- // Wraps `productRuntime.purchase` to record the outcome above (race-guarded
207
- // — see `presentationGenerationRef`); every other field (and — critically —
208
- // the object's change cadence, since `products.purchasing` flips must
209
- // still propagate) is untouched. `productRuntime.purchase` is itself
236
+ // The presentation `present()` has on screen: its observer handle, its
237
+ // resolver and what the store did during it. One record per accepted
238
+ // `present()`, never reused, so its identity is the purchase race guard below.
239
+ const presentationRecordRef = (0, react_1.useRef)(null);
240
+ // The same record as STATE, so the context's `complete` can be bound to the
241
+ // presentation a render showed (see `completeOnSurface`). State, not the
242
+ // ref: a same-moment re-present in one batch leaves `activeMoment` equal, and
243
+ // only a new object identity guarantees the context re-renders with B's
244
+ // `complete` rather than keeping A's.
245
+ const [surfaceRecord, setSurfaceRecord] = (0, react_1.useState)(null);
246
+ const activePaywallRef = (0, react_1.useRef)(activePaywall);
247
+ activePaywallRef.current = activePaywall;
248
+ // Wraps `productRuntime.purchase` to record the outcome on the presentation
249
+ // the purchase STARTED on; every other field (and — critically — the
250
+ // object's change cadence, since `products.purchasing` flips must still
251
+ // propagate) is untouched. `productRuntime.purchase` is itself
210
252
  // `useCallback(…, [])`-stable (`useProducts.ts`), so this wrapper never
211
253
  // changes identity either.
212
- const purchase = (0, react_1.useCallback)(async (key) => {
213
- const startedInGeneration = presentationGenerationRef.current;
254
+ //
255
+ // The race guard: binding to the record captured BEFORE the await is what
256
+ // stops a stale write. Paywall A's purchase can still be in flight when the
257
+ // user dismisses A and B is presented; when A's promise settles it reaches
258
+ // A's record, which has ended, and is dropped — it never lands in B's. DO NOT
259
+ // read `presentationRecordRef` after the await because it "looks" the same;
260
+ // that is exactly the race. A record still waiting after its paywall
261
+ // disappeared has not ended, so its purchase is recorded there and ends it.
262
+ //
263
+ // The paywall a purchase was made ON is read at the start too: a background
264
+ // revalidation can swap the moment's variant mid-presentation, which stays
265
+ // credited to the variant shown first, but the bought slot's store id is the
266
+ // swapped-in variant's, and that id is what joins to revenue.
267
+ //
268
+ // A purchase with no presentation on screen (the inline step's, which tracks
269
+ // its own) is recorded nowhere.
270
+ const purchaseOn = (0, react_1.useCallback)(async (record, key) => {
271
+ // Bound like `complete` (see `completeOnSurface`): a purchase requested
272
+ // through a presentation that is no longer on the surface — a stale
273
+ // action chain resuming after its paywall closed, e.g. a `custom` or
274
+ // `requestPermission` step followed by `purchase` — never opens the
275
+ // store over whatever is showing now, and records nothing anywhere.
276
+ // The action engine never gets here for a stale chain (it checks
277
+ // `presentationEnded` first and ends the chain); this `cancelled` is for
278
+ // a direct caller, such as a custom screen.
279
+ if (record && presentationRecordRef.current !== record) {
280
+ console.warn("[paywalls] A purchase was requested by a paywall that is no longer on screen; " +
281
+ "it was not started and resolves as cancelled.");
282
+ return { status: "cancelled" };
283
+ }
284
+ const madeOn = activePaywallRef.current;
285
+ if (record)
286
+ record.pending += 1;
214
287
  const result = await productRuntime.purchase(key);
288
+ if (!record || record.ended)
289
+ return result;
290
+ record.pending -= 1;
215
291
  const outcome = (0, present_1.purchaseOutcomeFromResult)(result);
216
- if (outcome && (0, present_1.shouldRecordPurchaseOutcome)(startedInGeneration, presentationGenerationRef.current)) {
217
- lastPurchaseOutcomeRef.current = outcome;
292
+ // A settled purchase sticks — see `resolveEndedOutcome`.
293
+ if (outcome && record.purchaseOutcome !== "purchased") {
294
+ record.purchaseOutcome = outcome;
295
+ record.purchasedKey = result.status === "purchased" ? result.productKey : null;
296
+ record.purchasedFrom = result.status === "purchased" ? madeOn : null;
297
+ }
298
+ // Off screen (closed, or its paywall disappeared) and nothing else in
299
+ // flight: this was the purchase it was waiting for.
300
+ if (record.pending === 0 && presentationRecordRef.current !== record) {
301
+ endPresentation(record, { status: "dismissed" });
218
302
  }
219
303
  return result;
220
304
  }, [productRuntime.purchase]);
221
- const productRuntimeWithPurchaseTracking = (0, react_1.useMemo)(() => (Object.assign(Object.assign({}, productRuntime), { purchase })), [productRuntime, purchase]);
305
+ // The runtime every renderer reads, its `purchase` bound to the record on
306
+ // the surface when it was rendered (null with no `present()` showing, which
307
+ // records nothing: the inline step tracks its own).
308
+ //
309
+ // `presentationEnded` is the same test `purchaseOn` refuses on, built from
310
+ // the same captured record, so the action engine's check and the refusal
311
+ // cannot disagree: a stale chain stops at its `purchase` instead of reading
312
+ // the refusal's `cancelled` as the user's and running `onCancel`.
313
+ const productRuntimeWithPurchaseTracking = (0, react_1.useMemo)(() => (Object.assign(Object.assign({}, productRuntime), { purchase: (key) => purchaseOn(surfaceRecord, key), presentationEnded: () => surfaceRecord !== null && presentationRecordRef.current !== surfaceRecord })), [productRuntime, purchaseOn, surfaceRecord]);
222
314
  // `activeMoment`'s `useState` was hoisted above `productRefs` — see the
223
315
  // comment there. Only `hostAcknowledged` is declared here.
224
316
  // Whether the host has confirmed THIS presentation is on screen. State, not
@@ -249,7 +341,7 @@ const PaywallProviderInner = ({ children, client, locale, customAudienceParams,
249
341
  // issued in the same tick (`Promise.all([present("a"), present("b")])`, or
250
342
  // two `presentPaywall` actions in one action list) both read the stale ref,
251
343
  // both take the "start" branch, and the second overwrites
252
- // `pendingResolveRef` — the first promise then never settles, exactly the
344
+ // the first one's record — that promise then never settles, exactly the
253
345
  // orphaning this whole ref/resolver scheme exists to prevent. Assigning
254
346
  // synchronously inside `present`/`complete` closes that window; this
255
347
  // render-body line stays only as a resync for the (rare) case something
@@ -257,7 +349,10 @@ const PaywallProviderInner = ({ children, client, locale, customAudienceParams,
257
349
  // callback.
258
350
  const activeMomentRef = (0, react_1.useRef)(activeMoment);
259
351
  activeMomentRef.current = activeMoment;
260
- const pendingResolveRef = (0, react_1.useRef)(null);
352
+ // Ref so `present`/`complete`/`acknowledgePresentation` keep empty deps while
353
+ // reading the CURRENT prop — hosts will pass an inline object.
354
+ const observerRef = (0, react_1.useRef)(observer);
355
+ observerRef.current = observer;
261
356
  // present() must not fetch anything — the catalog and products are already
262
357
  // resolved (or resolving) from mount. It only decides, synchronously,
263
358
  // whether to show the Modal.
@@ -266,22 +361,40 @@ const PaywallProviderInner = ({ children, client, locale, customAudienceParams,
266
361
  if (decision.type === "immediate") {
267
362
  return Promise.resolve(decision.result);
268
363
  }
269
- // Fresh presentation: no purchase has happened under it yet, and any
270
- // still-in-flight purchase from a PREVIOUS presentation must not be
271
- // allowed to write into this one — see `presentationGenerationRef`.
272
- lastPurchaseOutcomeRef.current = null;
273
- presentationGenerationRef.current += 1;
364
+ // A fresh record: no purchase has happened under it yet, and a purchase
365
+ // still in flight from a PREVIOUS presentation is bound to that one's
366
+ // record, never this — see the `purchase` wrapper. Only the "start"
367
+ // decision reaches here: refusals return above, before anything is
368
+ // reported (contract rule P1). The handle holds its OWN copy of the
369
+ // paywall, because by the end `activePaywall` can already be null — that
370
+ // is exactly the `paywall-disappeared` case.
371
+ const record = {
372
+ presentation: (0, observer_1.openPaywallPresentation)(observerRef.current, decision.paywall, "present", react_native_1.Platform.OS),
373
+ resolve: () => { },
374
+ purchaseOutcome: null,
375
+ purchasedKey: null,
376
+ purchasedFrom: null,
377
+ pending: 0,
378
+ ended: false,
379
+ timer: null,
380
+ };
381
+ presentationRecordRef.current = record;
274
382
  // Authoritative NOW, synchronously — see the ref's doc above. A second
275
383
  // `present()` call before React commits reads this value, not the stale
276
384
  // pre-commit state, and correctly takes the "already showing" branch.
277
385
  activeMomentRef.current = moment;
278
386
  return new Promise((resolve) => {
279
- pendingResolveRef.current = resolve;
387
+ record.resolve = resolve;
280
388
  // A new presentation is unacknowledged until the host says otherwise —
281
389
  // reset before it starts, or the previous presentation's confirmation
282
- // would vouch for this one and disable the recovery.
390
+ // would vouch for this one and disable the recovery. No exception, not
391
+ // even a successor taking a Modal that stays visible in the same commit:
392
+ // only the host knows whether it will render it (an unregistered custom
393
+ // screen or an element list that fails to parse never does), so the
394
+ // host acknowledges that case too — see `acknowledgePresentation`.
283
395
  setHostAcknowledged(false);
284
396
  setActiveMoment(moment);
397
+ setSurfaceRecord(record);
285
398
  });
286
399
  }, []);
287
400
  // Wakes anything parked in `register` as soon as the catalog stops loading.
@@ -312,18 +425,11 @@ const PaywallProviderInner = ({ children, client, locale, customAudienceParams,
312
425
  present,
313
426
  timeoutMs: registerTimeoutMs,
314
427
  }, moment, feature), [present, registerTimeoutMs]);
315
- // Called by PaywallHost (Task 7) from the presented paywall's
316
- // `ScreenHost.complete`. Resolves whatever `present()` call is pending and
317
- // clears the active moment, hiding the Modal and allowing a new
318
- // `present()` to start. Safe to call with nothing pending (no-ops).
319
- //
320
- // `resolvePresentedOutcome` upgrades a bare "dismissed" to "purchased" (or
321
- // "cancelled") when the store actually did something during this
322
- // presentation — see its doc for why `dismiss`'s own `{status:"dismissed"}`
323
- // isn't treated as an unoverridable explicit answer.
324
- const complete = (0, react_1.useCallback)((result) => {
325
- const resolve = pendingResolveRef.current;
326
- pendingResolveRef.current = null;
428
+ // Frees the surface — clears the active moment, hiding the Modal and
429
+ // allowing a new `present()` — and hands back the record that was on it.
430
+ const releaseSurface = (0, react_1.useCallback)(() => {
431
+ const record = presentationRecordRef.current;
432
+ presentationRecordRef.current = null;
327
433
  // Authoritative NOW, synchronously — same reasoning as `present()`'s
328
434
  // assignment above: a `present()` issued from the resolution continuation
329
435
  // (`const r = await present("a"); … present("downsell")` — a downsell
@@ -332,14 +438,67 @@ const PaywallProviderInner = ({ children, client, locale, customAudienceParams,
332
438
  // next commit.
333
439
  activeMomentRef.current = null;
334
440
  setActiveMoment(null);
441
+ setSurfaceRecord(null);
335
442
  setHostAcknowledged(false);
336
- resolve === null || resolve === void 0 ? void 0 : resolve((0, present_1.resolvePresentedOutcome)(result, lastPurchaseOutcomeRef.current));
443
+ return record;
337
444
  }, []);
445
+ // Called by PaywallHost (Task 7) from the presented paywall's
446
+ // `ScreenHost.complete`. Resolves whatever `present()` call is pending and
447
+ // clears the active moment, hiding the Modal and allowing a new
448
+ // `present()` to start. Safe to call with nothing pending (no-ops).
449
+ //
450
+ // The end is reconciled with what the store did during this presentation
451
+ // (`resolveEndedOutcome`, in `endPresentation`).
452
+ const complete = (0, react_1.useCallback)((result, transaction) => {
453
+ // The RECONCILED outcome (`endPresentation`), so a dismiss the store
454
+ // upgraded to a purchase is reported as one. Every post-acceptance error
455
+ // funnels through here too (`host-never-presented`, the host's
456
+ // parse/render errors) — every one but `paywall-disappeared`, whose effect
457
+ // below may wait for a purchase first. Ended with the record already off
458
+ // the surface, so a downsell `present()` issued from the resolution starts
459
+ // a clean presentation.
460
+ //
461
+ // A CLOSE (`dismissed`) with a purchase in flight waits for it, as an
462
+ // inline step's blur does (owner ruling on #286): the surface is freed
463
+ // now, and the record ends with the store outcome when it settles. Any
464
+ // other reported end is the host's explicit answer and ends at once.
465
+ const record = releaseSurface();
466
+ // A transaction counts only when the screen itself reported `purchased`
467
+ // (#287): one passed with `cancelled` stays dropped even if a recorded
468
+ // purchase makes the end `purchased` — the screen tied it to a cancel.
469
+ const reported = result.status === "purchased" ? transaction : undefined;
470
+ if (record && !record.ended && transaction !== undefined && reported === undefined) {
471
+ console.warn(`[paywalls] complete() was given a transaction with status "${result.status}"; it was dropped.`);
472
+ }
473
+ if (record && !record.ended && result.status === "dismissed" && shouldWaitForPurchases(record)) {
474
+ waitForPurchases(record);
475
+ return;
476
+ }
477
+ endPresentation(record, result, reported);
478
+ }, [releaseSurface]);
479
+ // What the context hands the host as `complete`: bound to the record this
480
+ // render showed. A paywall's action chain can outlive its presentation — a
481
+ // `{purchase, onSuccess:[dismiss]}` whose purchase settles after the Modal
482
+ // closed or the paywall disappeared, while a downsell (or the host's
483
+ // `await present()` continuation) has opened the next one — and its trailing
484
+ // `dismiss` must not end THAT one. `ScreenRenderer` reads `complete` at call
485
+ // time, so `PaywallHost` also keys its content per presentation.
486
+ const completeOnSurface = (0, react_1.useCallback)((result, transaction) => {
487
+ // A stale call returns here, before its transaction reaches anything.
488
+ if (!surfaceRecord || presentationRecordRef.current !== surfaceRecord)
489
+ return;
490
+ complete(result, transaction);
491
+ }, [surfaceRecord, complete]);
338
492
  // Stable (empty deps) like `present`/`complete`: the host wires this straight
339
493
  // into a Modal prop, and an identity change per render would churn it.
340
494
  const acknowledgePresentation = (0, react_1.useCallback)(() => {
495
+ var _a;
341
496
  setHostAcknowledged(true);
497
+ // The handle's `shown()` reaches the observer at most once and never
498
+ // throws, so a second acknowledgement of one presentation is harmless.
499
+ (_a = presentationRecordRef.current) === null || _a === void 0 ? void 0 : _a.presentation.shown();
342
500
  }, []);
501
+ const observePresentation = (0, react_1.useCallback)((paywall) => (0, observer_1.openPaywallPresentation)(observerRef.current, paywall, "paywall_step", react_native_1.Platform.OS), []);
343
502
  // `activePaywall` was hoisted above `productRefs` — see the comment there
344
503
  // (Finding 6, 2026-08-17 final review) for why it is derived from
345
504
  // `activeMoment` rather than guarded on `catalog` alone.
@@ -350,11 +509,30 @@ const PaywallProviderInner = ({ children, client, locale, customAudienceParams,
350
509
  // `present()` call with `"error"` for the rest of the app's life.
351
510
  // `complete()` always clears `activeMoment` together with resolving the
352
511
  // pending promise, so it cannot race with or double-resolve this branch.
512
+ //
513
+ // A purchase wins over the disappearance (owner decision on #286) — a host
514
+ // that sets a user property on purchase changes the query key, which is
515
+ // exactly this case. The surface is freed either way (the Modal has nothing
516
+ // to render, and holding `activeMoment` would answer every other
517
+ // `present()` with `already-presenting`), but the record is not ended yet if
518
+ // a purchase is in flight: it waits for it, as an inline step waits after a
519
+ // blur, bounded by `LATE_PURCHASE_TIMEOUT_MS`, then ends with the store's
520
+ // outcome. One that already settled `purchased` ends it `purchased`. Only
521
+ // with neither does it end `paywall-disappeared`, at once.
353
522
  (0, react_1.useEffect)(() => {
354
523
  if (!activeMoment || activePaywall)
355
524
  return;
356
- complete({ status: "error", reason: "paywall-disappeared" });
357
- }, [activeMoment, activePaywall, complete]);
525
+ const record = releaseSurface();
526
+ if (!record || record.ended)
527
+ return;
528
+ if (shouldWaitForPurchases(record)) {
529
+ waitForPurchases(record);
530
+ return;
531
+ }
532
+ // A purchase that already settled turns this into `purchased`
533
+ // (`resolveEndedOutcome`).
534
+ endPresentation(record, { status: "error", reason: "paywall-disappeared" });
535
+ }, [activeMoment, activePaywall, releaseSurface]);
358
536
  // The OTHER way a presentation never completes, and the one the guard above
359
537
  // structurally cannot catch: `activePaywall` is perfectly non-null — the
360
538
  // catalog still holds the paywall — but it never reaches the screen because
@@ -395,10 +573,11 @@ const PaywallProviderInner = ({ children, client, locale, customAudienceParams,
395
573
  isProviderMounted: true,
396
574
  productsStatus: productRuntime.status,
397
575
  activePaywall,
398
- complete,
576
+ complete: completeOnSurface,
399
577
  acknowledgePresentation,
400
578
  customActions,
401
579
  customScreens,
580
+ observePresentation,
402
581
  }), [
403
582
  present,
404
583
  register,
@@ -407,10 +586,11 @@ const PaywallProviderInner = ({ children, client, locale, customAudienceParams,
407
586
  catalogStatus,
408
587
  productRuntime.status,
409
588
  activePaywall,
410
- complete,
589
+ completeOnSurface,
411
590
  acknowledgePresentation,
412
591
  customActions,
413
592
  customScreens,
593
+ observePresentation,
414
594
  ]);
415
595
  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 }) }));
416
596
  };
@@ -436,7 +616,7 @@ const PaywallProviderInner = ({ children, client, locale, customAudienceParams,
436
616
  * then read the default context, where `isProviderMounted` is `false` and both
437
617
  * `present` and `register` resolve their fail-open answers.
438
618
  */
439
- const PaywallProvider = ({ children, client: clientProp, locale = "en", customAudienceParams = {}, productProvider, stripeProductProvider, customActions = EMPTY_CUSTOM_ACTIONS, customScreens = EMPTY_CUSTOM_SCREENS, presentAckTimeoutMs = DEFAULT_PRESENT_ACK_TIMEOUT_MS, registerTimeoutMs = exports.DEFAULT_REGISTER_TIMEOUT_MS, }) => {
619
+ const PaywallProvider = ({ children, client: clientProp, locale = "en", customAudienceParams = {}, productProvider, stripeProductProvider, customActions = EMPTY_CUSTOM_ACTIONS, customScreens = EMPTY_CUSTOM_SCREENS, presentAckTimeoutMs = DEFAULT_PRESENT_ACK_TIMEOUT_MS, registerTimeoutMs = exports.DEFAULT_REGISTER_TIMEOUT_MS, observer, }) => {
440
620
  // Prop wins, else whatever `OnboardingStudio.init()` built. Read during render,
441
621
  // so `init()` must run before the first render — at module scope.
442
622
  const client = (0, OnboardingStudio_1.resolveProviderClient)(clientProp, OnboardingStudio_1.OnboardingStudio.getClient());
@@ -450,7 +630,7 @@ const PaywallProvider = ({ children, client: clientProp, locale = "en", customAu
450
630
  // Degrade rather than throw — see the doc above.
451
631
  if (!client)
452
632
  return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children });
453
- 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, stripeProductProvider: stripeProductProvider, customActions: customActions, customScreens: customScreens, presentAckTimeoutMs: presentAckTimeoutMs, registerTimeoutMs: registerTimeoutMs, children: children }) }));
633
+ 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, stripeProductProvider: stripeProductProvider, customActions: customActions, customScreens: customScreens, presentAckTimeoutMs: presentAckTimeoutMs, registerTimeoutMs: registerTimeoutMs, observer: observer, children: children }) }));
454
634
  };
455
635
  exports.PaywallProvider = PaywallProvider;
456
636
  //# sourceMappingURL=PaywallProvider.js.map