@rocapine/react-native-onboarding 1.69.0 → 1.70.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 (49) hide show
  1. package/dist/OnboardingStudioClient.d.ts +4 -4
  2. package/dist/OnboardingStudioClient.js +7 -7
  3. package/dist/OnboardingStudioClient.js.map +1 -1
  4. package/dist/paywalls/PaywallProvider.d.ts +24 -7
  5. package/dist/paywalls/PaywallProvider.d.ts.map +1 -1
  6. package/dist/paywalls/PaywallProvider.js +80 -42
  7. package/dist/paywalls/PaywallProvider.js.map +1 -1
  8. package/dist/paywalls/present.d.ts +60 -14
  9. package/dist/paywalls/present.d.ts.map +1 -1
  10. package/dist/paywalls/present.js +67 -18
  11. package/dist/paywalls/present.js.map +1 -1
  12. package/dist/paywalls/types.d.ts +48 -23
  13. package/dist/paywalls/types.d.ts.map +1 -1
  14. package/dist/paywalls/types.js +0 -7
  15. package/dist/paywalls/types.js.map +1 -1
  16. package/dist/paywalls/usePaywall.d.ts +5 -5
  17. package/dist/paywalls/usePaywall.d.ts.map +1 -1
  18. package/dist/products/adapters/stripeLink.d.ts +57 -0
  19. package/dist/products/adapters/stripeLink.d.ts.map +1 -0
  20. package/dist/products/adapters/stripeLink.js +158 -0
  21. package/dist/products/adapters/stripeLink.js.map +1 -0
  22. package/dist/products/index.d.ts +4 -1
  23. package/dist/products/index.d.ts.map +1 -1
  24. package/dist/products/index.js +5 -1
  25. package/dist/products/index.js.map +1 -1
  26. package/dist/products/refIdentity.d.ts +3 -0
  27. package/dist/products/refIdentity.d.ts.map +1 -0
  28. package/dist/products/refIdentity.js +37 -0
  29. package/dist/products/refIdentity.js.map +1 -0
  30. package/dist/products/types.d.ts +29 -1
  31. package/dist/products/types.d.ts.map +1 -1
  32. package/dist/products/useProducts.d.ts.map +1 -1
  33. package/dist/products/useProducts.js +7 -1
  34. package/dist/products/useProducts.js.map +1 -1
  35. package/package.json +1 -1
  36. package/src/OnboardingStudioClient.ts +7 -7
  37. package/src/paywalls/PaywallProvider.tsx +109 -46
  38. package/src/paywalls/__tests__/getPaywalls.test.ts +15 -12
  39. package/src/paywalls/__tests__/present.test.ts +149 -28
  40. package/src/paywalls/present.ts +74 -21
  41. package/src/paywalls/types.ts +49 -23
  42. package/src/paywalls/usePaywall.ts +5 -5
  43. package/src/products/__tests__/refIdentity.test.ts +44 -0
  44. package/src/products/adapters/__tests__/stripeLink.test.ts +179 -0
  45. package/src/products/adapters/stripeLink.ts +245 -0
  46. package/src/products/index.ts +4 -0
  47. package/src/products/refIdentity.ts +33 -0
  48. package/src/products/types.ts +30 -1
  49. package/src/products/useProducts.ts +7 -4
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.expoIapProductProvider = exports.revenueCatProductProvider = exports.stubProductProvider = exports.useProductRuntime = exports.ProductRuntimeContext = exports.useProducts = exports.productVariables = exports.deriveAll = exports.deriveProductFields = exports.formatCurrency = exports.parseIsoDuration = void 0;
3
+ exports.stripeLinkProductProvider = exports.expoIapProductProvider = exports.revenueCatProductProvider = exports.stubProductProvider = exports.useProductRuntime = exports.ProductRuntimeContext = exports.useProducts = exports.productRefIdentity = exports.productVariables = exports.deriveAll = exports.deriveProductFields = exports.formatCurrency = exports.parseIsoDuration = void 0;
4
4
  var duration_1 = require("./duration");
5
5
  Object.defineProperty(exports, "parseIsoDuration", { enumerable: true, get: function () { return duration_1.parseIsoDuration; } });
6
6
  var derive_1 = require("./derive");
@@ -9,6 +9,8 @@ Object.defineProperty(exports, "deriveProductFields", { enumerable: true, get: f
9
9
  Object.defineProperty(exports, "deriveAll", { enumerable: true, get: function () { return derive_1.deriveAll; } });
10
10
  var toVariables_1 = require("./toVariables");
11
11
  Object.defineProperty(exports, "productVariables", { enumerable: true, get: function () { return toVariables_1.productVariables; } });
12
+ var refIdentity_1 = require("./refIdentity");
13
+ Object.defineProperty(exports, "productRefIdentity", { enumerable: true, get: function () { return refIdentity_1.productRefIdentity; } });
12
14
  var useProducts_1 = require("./useProducts");
13
15
  Object.defineProperty(exports, "useProducts", { enumerable: true, get: function () { return useProducts_1.useProducts; } });
14
16
  var ProductRuntimeContext_1 = require("./ProductRuntimeContext");
@@ -20,4 +22,6 @@ var revenueCat_1 = require("./adapters/revenueCat");
20
22
  Object.defineProperty(exports, "revenueCatProductProvider", { enumerable: true, get: function () { return revenueCat_1.revenueCatProductProvider; } });
21
23
  var expoIap_1 = require("./adapters/expoIap");
22
24
  Object.defineProperty(exports, "expoIapProductProvider", { enumerable: true, get: function () { return expoIap_1.expoIapProductProvider; } });
25
+ var stripeLink_1 = require("./adapters/stripeLink");
26
+ Object.defineProperty(exports, "stripeLinkProductProvider", { enumerable: true, get: function () { return stripeLink_1.stripeLinkProductProvider; } });
23
27
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/products/index.ts"],"names":[],"mappings":";;;AAYA,uCAA8C;AAArC,4GAAA,gBAAgB,OAAA;AACzB,mCAA0E;AAAjE,wGAAA,cAAc,OAAA;AAAE,6GAAA,mBAAmB,OAAA;AAAE,mGAAA,SAAS,OAAA;AACvD,6CAAiD;AAAxC,+GAAA,gBAAgB,OAAA;AACzB,6CAA4C;AAAnC,0GAAA,WAAW,OAAA;AACpB,iEAAmF;AAA1E,8HAAA,qBAAqB,OAAA;AAAE,0HAAA,iBAAiB,OAAA;AACjD,wCAAsD;AAA7C,2GAAA,mBAAmB,OAAA;AAC5B,oDAAkE;AAAzD,uHAAA,yBAAyB,OAAA;AAClC,8CAA4D;AAAnD,iHAAA,sBAAsB,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/products/index.ts"],"names":[],"mappings":";;;AAaA,uCAA8C;AAArC,4GAAA,gBAAgB,OAAA;AACzB,mCAA0E;AAAjE,wGAAA,cAAc,OAAA;AAAE,6GAAA,mBAAmB,OAAA;AAAE,mGAAA,SAAS,OAAA;AACvD,6CAAiD;AAAxC,+GAAA,gBAAgB,OAAA;AACzB,6CAAmD;AAA1C,iHAAA,kBAAkB,OAAA;AAC3B,6CAA4C;AAAnC,0GAAA,WAAW,OAAA;AACpB,iEAAmF;AAA1E,8HAAA,qBAAqB,OAAA;AAAE,0HAAA,iBAAiB,OAAA;AACjD,wCAAsD;AAA7C,2GAAA,mBAAmB,OAAA;AAC5B,oDAAkE;AAAzD,uHAAA,yBAAyB,OAAA;AAClC,8CAA4D;AAAnD,iHAAA,sBAAsB,OAAA;AAC/B,oDAAkE;AAAzD,uHAAA,yBAAyB,OAAA"}
@@ -0,0 +1,3 @@
1
+ import type { ProductRef } from "./types";
2
+ export declare const productRefIdentity: (ref: ProductRef) => string;
3
+ //# sourceMappingURL=refIdentity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"refIdentity.d.ts","sourceRoot":"","sources":["../../src/products/refIdentity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAoB1C,eAAO,MAAM,kBAAkB,GAAI,KAAK,UAAU,KAAG,MAYxC,CAAC"}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.productRefIdentity = void 0;
4
+ /**
5
+ * The content identity of a `ProductRef` — the ONE place its fields are
6
+ * enumerated.
7
+ *
8
+ * Two callers depend on this and neither fails loudly when it is wrong:
9
+ * `useProducts`'s `refsKey` (a stale identity means a changed ref never
10
+ * refetches) and `collectProductRefs`'s dedup (a colliding identity means two
11
+ * distinct refs collapse into one and the second is never resolved). Both used
12
+ * to hand-roll the same template string, so adding a field to `ProductRef`
13
+ * meant remembering two places. Add new fields HERE and both callers follow.
14
+ *
15
+ * A unit separator (U+001F) rather than a printable one: a Play id is
16
+ * `productId:basePlanId` and a Payment Link is a URL, both of which can
17
+ * contain almost any printable character, so a printable separator risks
18
+ * `{ios:"a",android:"b"}` and `{ios:"a|b"}` hashing alike.
19
+ */
20
+ const SEP = "\u001F";
21
+ const productRefIdentity = (ref) => {
22
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
23
+ return [
24
+ ref.key,
25
+ (_a = ref.ios) !== null && _a !== void 0 ? _a : "",
26
+ (_b = ref.android) !== null && _b !== void 0 ? _b : "",
27
+ (_c = ref.compareTo) !== null && _c !== void 0 ? _c : "",
28
+ (_e = (_d = ref.stripe) === null || _d === void 0 ? void 0 : _d.paymentLink) !== null && _e !== void 0 ? _e : "",
29
+ (_g = (_f = ref.stripe) === null || _f === void 0 ? void 0 : _f.priceId) !== null && _g !== void 0 ? _g : "",
30
+ (_j = (_h = ref.stripe) === null || _h === void 0 ? void 0 : _h.amount) !== null && _j !== void 0 ? _j : "",
31
+ (_l = (_k = ref.stripe) === null || _k === void 0 ? void 0 : _k.currency) !== null && _l !== void 0 ? _l : "",
32
+ (_o = (_m = ref.stripe) === null || _m === void 0 ? void 0 : _m.periodIso) !== null && _o !== void 0 ? _o : "",
33
+ (_q = (_p = ref.stripe) === null || _p === void 0 ? void 0 : _p.trialDays) !== null && _q !== void 0 ? _q : "",
34
+ ].join(SEP);
35
+ };
36
+ exports.productRefIdentity = productRefIdentity;
37
+ //# sourceMappingURL=refIdentity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"refIdentity.js","sourceRoot":"","sources":["../../src/products/refIdentity.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,GAAG,GAAG,QAAQ,CAAC;AAEd,MAAM,kBAAkB,GAAG,CAAC,GAAe,EAAU,EAAE;;IAC5D,OAAA;QACE,GAAG,CAAC,GAAG;QACP,MAAA,GAAG,CAAC,GAAG,mCAAI,EAAE;QACb,MAAA,GAAG,CAAC,OAAO,mCAAI,EAAE;QACjB,MAAA,GAAG,CAAC,SAAS,mCAAI,EAAE;QACnB,MAAA,MAAA,GAAG,CAAC,MAAM,0CAAE,WAAW,mCAAI,EAAE;QAC7B,MAAA,MAAA,GAAG,CAAC,MAAM,0CAAE,OAAO,mCAAI,EAAE;QACzB,MAAA,MAAA,GAAG,CAAC,MAAM,0CAAE,MAAM,mCAAI,EAAE;QACxB,MAAA,MAAA,GAAG,CAAC,MAAM,0CAAE,QAAQ,mCAAI,EAAE;QAC1B,MAAA,MAAA,GAAG,CAAC,MAAM,0CAAE,SAAS,mCAAI,EAAE;QAC3B,MAAA,MAAA,GAAG,CAAC,MAAM,0CAAE,SAAS,mCAAI,EAAE;KAC5B,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;CAAA,CAAC;AAZD,QAAA,kBAAkB,sBAYjB"}
@@ -1,3 +1,29 @@
1
+ /**
2
+ * A Stripe Payment Link and the price to render beside it.
3
+ *
4
+ * Unlike `ios`/`android` — which are ids a store resolves at runtime — this
5
+ * block is the RESOLVED product. There is no Stripe runtime to ask: listing a
6
+ * price needs a secret key, and by design nobody in this system holds one
7
+ * (not the host, not Onboarding Studio). So the studio copies the authored
8
+ * price onto the ref, and `stripeLinkProductProvider` synthesises a
9
+ * `ResolvedProduct` from it without any network call.
10
+ *
11
+ * Consequence the author owns: this price can DRIFT from Stripe. Nothing
12
+ * reconciles them.
13
+ */
14
+ export type StripeProductRef = {
15
+ /** `https://buy.stripe.com/...`, pre-created in Stripe. Required — nothing to open without it. */
16
+ paymentLink: string;
17
+ /** `price_...`. Informational in this version; kept for reconciliation and a future proxy mode. */
18
+ priceId?: string;
19
+ /** Major units (79, not 7900), matching `project_products.stripe_price.amount`. */
20
+ amount: number;
21
+ /** ISO-4217, e.g. "USD". */
22
+ currency: string;
23
+ /** ISO-8601, e.g. "P1Y". Drives `pricePerWeek` and friends via `deriveProductFields`. */
24
+ periodIso?: string | null;
25
+ trialDays?: number;
26
+ };
1
27
  /** A product slot declared by the author: a stable key plus per-store ids. */
2
28
  export type ProductRef = {
3
29
  /** Author-chosen slot name used in variables, e.g. "yearly" → product.yearly.price */
@@ -6,6 +32,8 @@ export type ProductRef = {
6
32
  ios?: string;
7
33
  /** Play product identifier. `productId:basePlanId` — RevenueCat's convention. */
8
34
  android?: string;
35
+ /** Stripe Payment Link + authored price. Present only on a `billing: "stripe"` paywall's refs. */
36
+ stripe?: StripeProductRef;
9
37
  /** Another slot's key; savingsPct is computed against it. */
10
38
  compareTo?: string;
11
39
  };
@@ -15,7 +43,7 @@ export type ResolvedProduct = {
15
43
  key: string;
16
44
  /** The identifier resolved for THIS platform. */
17
45
  productId: string;
18
- store: "app_store" | "play_store";
46
+ store: "app_store" | "play_store" | "stripe";
19
47
  title: string;
20
48
  description: string;
21
49
  /** Store-localized, pre-formatted, e.g. "$59.99". Display this. */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/products/types.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,MAAM,MAAM,UAAU,GAAG;IACvB,sFAAsF;IACtF,GAAG,EAAE,MAAM,CAAC;IACZ,oCAAoC;IACpC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,iFAAiF;IACjF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6DAA6D;IAC7D,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,UAAU,CAAC;AAEnE,wEAAwE;AACxE,MAAM,MAAM,eAAe,GAAG;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,iDAAiD;IACjD,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,WAAW,GAAG,YAAY,CAAC;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,mEAAmE;IACnE,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,aAAa,GAAG,IAAI,CAAC;IAC7B,WAAW,EAAE,MAAM,CAAC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C,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAC5D,OAAO,IAAI,OAAO,CAAC,aAAa,CAAC,CAAC;CACnC;AAED,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,CAAC;AAEnE,oFAAoF;AACpF,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;IAC7C,MAAM,EAAE,aAAa,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gFAAgF;IAChF,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;IACnD,OAAO,EAAE,MAAM,OAAO,CAAC,aAAa,CAAC,CAAC;CACvC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"useProducts.d.ts","sourceRoot":"","sources":["../../src/products/useProducts.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,eAAe,EACf,UAAU,EACV,cAAc,EAKf,MAAM,SAAS,CAAC;AAIjB;;;;;;;;GAQG;AACH,eAAO,MAAM,WAAW,GACtB,MAAM,UAAU,EAAE,GAAG,SAAS,EAC9B,UAAU,eAAe,GAAG,SAAS,EACrC,SAAS,MAAM,KACd,cA8EF,CAAC"}
1
+ {"version":3,"file":"useProducts.d.ts","sourceRoot":"","sources":["../../src/products/useProducts.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,eAAe,EACf,UAAU,EACV,cAAc,EAKf,MAAM,SAAS,CAAC;AAIjB;;;;;;;;GAQG;AACH,eAAO,MAAM,WAAW,GACtB,MAAM,UAAU,EAAE,GAAG,SAAS,EAC9B,UAAU,eAAe,GAAG,SAAS,EACrC,SAAS,MAAM,KACd,cAgFF,CAAC"}
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useProducts = void 0;
4
4
  const react_1 = require("react");
5
5
  const derive_1 = require("./derive");
6
+ const refIdentity_1 = require("./refIdentity");
6
7
  const EMPTY_PRODUCTS = {};
7
8
  /**
8
9
  * Resolves `refs` through `provider` once per (refs, provider) pair and exposes
@@ -25,7 +26,12 @@ const useProducts = (refs, provider, locale) => {
25
26
  providerRef.current = provider;
26
27
  // Key the effect on the refs' identity CONTENT, not the array identity — a
27
28
  // host passing an inline array literal would otherwise refetch every render.
28
- const refsKey = (0, react_1.useMemo)(() => (refs !== null && refs !== void 0 ? refs : []).map((r) => { var _a, _b, _c; return `${r.key}|${(_a = r.ios) !== null && _a !== void 0 ? _a : ""}|${(_b = r.android) !== null && _b !== void 0 ? _b : ""}|${(_c = r.compareTo) !== null && _c !== void 0 ? _c : ""}`; }).join(","), [refs]);
29
+ // `productRefIdentity` owns the field list; see its doc for why it is shared
30
+ // with `collectProductRefs` rather than duplicated here.
31
+ // "\u001E" (record separator) BETWEEN refs, distinct from the "\u001F"
32
+ // `productRefIdentity` puts between FIELDS — one separator for each nesting
33
+ // level, so no arrangement of ids can produce two identical keys.
34
+ const refsKey = (0, react_1.useMemo)(() => (refs !== null && refs !== void 0 ? refs : []).map(refIdentity_1.productRefIdentity).join("\u001E"), [refs]);
29
35
  const refsRef = (0, react_1.useRef)(refs);
30
36
  refsRef.current = refs;
31
37
  (0, react_1.useEffect)(() => {
@@ -1 +1 @@
1
- {"version":3,"file":"useProducts.js","sourceRoot":"","sources":["../../src/products/useProducts.ts"],"names":[],"mappings":";;;AAAA,iCAA0E;AAC1E,qCAAqC;AAWrC,MAAM,cAAc,GAAuC,EAAE,CAAC;AAE9D;;;;;;;;GAQG;AACI,MAAM,WAAW,GAAG,CACzB,IAA8B,EAC9B,QAAqC,EACrC,MAAe,EACC,EAAE;IAClB,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,IAAA,gBAAQ,EAAqC,cAAc,CAAC,CAAC;IAC7F,MAAM,CAAC,MAAM,EAAE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IAAA,eAAO,EACZ,GAAG,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,EAClE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,CAAC,CACzD,CAAC;AACJ,CAAC,CAAC;AApFW,QAAA,WAAW,eAoFtB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rocapine/react-native-onboarding",
3
- "version": "1.69.0",
3
+ "version": "1.70.0",
4
4
  "description": "Headless React Native SDK for Rocapine Onboarding Studio - Data fetching, state management, and hooks",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -130,11 +130,11 @@ export class OnboardingStudioClient {
130
130
 
131
131
  /**
132
132
  * Fetches the paywall catalog for this project/audience/locale from
133
- * `get-paywalls`. By design **omits `placement` by default** — the endpoint
134
- * deliberately returns every placement in one round-trip so a paywall can
133
+ * `get-paywalls`. By design **omits `moment` by default** — the endpoint
134
+ * deliberately returns every moment in one round-trip so a paywall can
135
135
  * be presented the instant the user taps upgrade, without a network call at
136
- * that moment (spec §6.1). Pass `paywallOptions.placement` only when a
137
- * single placement is genuinely all that's needed.
136
+ * that moment (spec §6.1). Pass `paywallOptions.moment` only when a
137
+ * single moment is genuinely all that's needed.
138
138
  *
139
139
  * Unlike `getSteps`, there is no fallback-payload option here: a
140
140
  * non-`ok` response or a network failure always rejects rather than
@@ -174,8 +174,8 @@ export class OnboardingStudioClient {
174
174
 
175
175
  // Narrows the response to a single paywall. Omitted unless explicitly
176
176
  // requested — see the method doc above.
177
- if (paywallOptions?.placement) {
178
- urlParams.append("placement", paywallOptions.placement);
177
+ if (paywallOptions?.moment) {
178
+ urlParams.append("moment", paywallOptions.moment);
179
179
  }
180
180
 
181
181
  // Deliberately NOT sending spec §6.1's `omitNulls=true`: it's a
@@ -209,7 +209,7 @@ export class OnboardingStudioClient {
209
209
  return {
210
210
  data,
211
211
  headers: {
212
- "ONBS-Audience-Id": response.headers.get("ONBS-Audience-Id"),
212
+ "ONBS-Audience-Ids": response.headers.get("ONBS-Audience-Ids"),
213
213
  "ONBS-Paywall-Ids": response.headers.get("ONBS-Paywall-Ids"),
214
214
  },
215
215
  };
@@ -10,6 +10,7 @@ import {
10
10
  computeCatalogStatus,
11
11
  type CatalogStatus,
12
12
  resolvePresentDecision,
13
+ selectActiveProductRuntime,
13
14
  shouldBreakPresentationWedge,
14
15
  resolvePresentedOutcome,
15
16
  shouldRecordPurchaseOutcome,
@@ -50,13 +51,13 @@ const EMPTY_CUSTOM_ACTIONS: CustomActions = Object.freeze({});
50
51
  * `infra/hooks/` slicing `OnboardingProgressContext`.
51
52
  */
52
53
  export type PaywallContextValue = {
53
- present: (placement: string) => Promise<PresentResult>;
54
+ present: (moment: string) => Promise<PresentResult>;
54
55
  isReady: boolean;
55
56
  catalog: PaywallCatalog | null;
56
57
  /**
57
58
  * What the catalog is doing — the states `isReady` collapses into one
58
59
  * boolean. See `CatalogStatus`; `"revalidating"` in particular means the
59
- * catalog on hand may be superseded within moments, so a missing placement
60
+ * catalog on hand may be superseded within moments, so a missing moment
60
61
  * does not yet mean an absent one.
61
62
  */
62
63
  catalogStatus: CatalogStatus;
@@ -69,7 +70,7 @@ export type PaywallContextValue = {
69
70
  /** The paywall currently being presented, or null. Read by `usePaywallHost()` — not by `usePaywall()`. */
70
71
  activePaywall: Paywall | null;
71
72
  /**
72
- * Resolve the pending `present()` call and clear the active placement.
73
+ * Resolve the pending `present()` call and clear the active moment.
73
74
  * Call this from the presented paywall's `ScreenHost.complete` (Task 7's
74
75
  * `PaywallHost`) — never from an ordinary consumer.
75
76
  */
@@ -90,7 +91,7 @@ export type PaywallContextValue = {
90
91
  const EMPTY_PAYWALL_CONTEXT: PaywallContextValue = {
91
92
  // No provider above: there is no catalog at all, which is the same answer
92
93
  // `resolvePresentDecision` gives for an unresolved one.
93
- present: async () => ({ status: "error", reason: "unknown-placement" }),
94
+ present: async () => ({ status: "error", reason: "unknown-moment" }),
94
95
  isReady: false,
95
96
  catalog: null,
96
97
  // No provider above: nothing is loading and nothing will arrive.
@@ -134,13 +135,30 @@ interface PaywallProviderProps {
134
135
  locale?: string;
135
136
  customAudienceParams?: Record<string, any>;
136
137
  /**
137
- * Billing adapter. Products are resolved once, over the union of every
138
- * `paywall.products[]` in the catalog (deduplicated), and published via
138
+ * Billing adapter for `billing: "store"` paywalls — also the default while
139
+ * no paywall is active, and the fallback for `"stripe"` when
140
+ * `stripeProductProvider` (see that prop) was not passed. Resolved once,
141
+ * over the union of every `paywall.products[]` in the catalog
142
+ * (deduplicated).
143
+ *
144
+ * This adapter's result is NOT unconditionally what gets published: which
145
+ * of `productProvider`'s and `stripeProductProvider`'s resolution reaches
146
+ * `ProductRuntimeContext` depends on the active paywall's `billing` (see
147
+ * `selectActiveProductRuntime`). Whichever one is live, it is published via
139
148
  * `ProductRuntimeContext` — an `OnboardingProvider` mounted anywhere inside
140
- * this tree picks up the SAME runtime instead of resolving its own, so
149
+ * this tree picks up that SAME runtime instead of resolving its own, so
141
150
  * there is one store round-trip and one `purchasing` flag for both.
142
151
  */
143
152
  productProvider?: ProductProvider;
153
+ /**
154
+ * Billing adapter for `billing: "stripe"` paywalls — normally
155
+ * `stripeLinkProductProvider`. The catalog's product union is resolved
156
+ * through BOTH this and `productProvider`, and the runtime published is the
157
+ * one matching the presented paywall's `billing` (see
158
+ * `selectActiveProductRuntime`). Omit it and every paywall uses
159
+ * `productProvider`, exactly as before this prop existed.
160
+ */
161
+ stripeProductProvider?: ProductProvider;
144
162
  /** Handlers for `{ type: "custom" }` ButtonActions inside a paywall's elements. */
145
163
  customActions?: CustomActions;
146
164
  /**
@@ -161,6 +179,7 @@ interface PaywallProviderInnerProps {
161
179
  locale: string;
162
180
  customAudienceParams: Record<string, any>;
163
181
  productProvider?: ProductProvider;
182
+ stripeProductProvider?: ProductProvider;
164
183
  customActions: CustomActions;
165
184
  presentAckTimeoutMs: number | null;
166
185
  }
@@ -171,6 +190,7 @@ const PaywallProviderInner = ({
171
190
  locale,
172
191
  customAudienceParams,
173
192
  productProvider,
193
+ stripeProductProvider,
174
194
  customActions,
175
195
  presentAckTimeoutMs,
176
196
  }: PaywallProviderInnerProps) => {
@@ -198,17 +218,68 @@ const PaywallProviderInner = ({
198
218
  // but `PaywallProvider` wraps the WHOLE app (spec §7:
199
219
  // `<PaywallProvider><App/><PaywallHost/></PaywallProvider>`), so throwing
200
220
  // here would crash every screen over a paywall-catalog failure alone.
201
- // Instead: `catalog` simply stays null, `present()` on any placement
221
+ // Instead: `catalog` simply stays null, `present()` on any moment
202
222
  // resolves "error" (see `resolvePresentDecision` — an unresolved catalog
203
- // looks identical to an unknown placement), and `isReady` stays false.
223
+ // looks identical to an unknown moment), and `isReady` stays false.
204
224
  console.warn("[paywalls] Failed to load paywall catalog:", error);
205
225
  }, [error]);
206
226
 
207
- // Union of every placement's products, deduplicated, resolved ONCE — never
227
+ // Hoisted above `productRefs`/the product runtimes below: `activeMoment`
228
+ // (state) and `activePaywall` (derived from it) are read by the runtime
229
+ // selection that follows. Bare `useState(null)` with no dependencies, so
230
+ // hoisting past the effects and refs below it changes nothing about hook
231
+ // order.
232
+ const [activeMoment, setActiveMoment] = useState<string | null>(null);
233
+ // Finding 6, 2026-08-17 final review, widened by N2 (round 2): a background
234
+ // catalog revalidation (see `getPaywalls.query.ts`) can push a fresh catalog
235
+ // that no longer contains the moment currently on screen (a studio
236
+ // publish renamed or removed it mid-session) — OR the query KEY itself can
237
+ // change while a paywall is showing (`locale`/`customAudienceParams`
238
+ // changed as a prop), which makes react-query report `data: undefined`
239
+ // while the new key is fetching (Finding 1's fix reads `catalog` straight
240
+ // from that `data`). Both collapse `activePaywall` to null the same way, so
241
+ // guarding on THAT — not on `catalog` being non-null — catches both: the
242
+ // original guard (`!catalog` check) missed the query-key case entirely,
243
+ // because a null `catalog` made it bail out before ever checking whether
244
+ // the moment was still present.
245
+ const activePaywall = activeMoment ? catalog?.paywalls[activeMoment] ?? null : null;
246
+
247
+ // Union of every moment's products, deduplicated, resolved ONCE — never
208
248
  // re-keyed per presented paywall. See `present.ts`'s `collectProductRefs`
209
249
  // doc for why (spec §6.1's "render instantly on tap" requirement).
210
250
  const productRefs = useMemo(() => collectProductRefs(catalog), [catalog]);
211
- const productRuntime = useProducts(productRefs, productProvider, locale);
251
+ // Resolved TWICE — once per billing adapter — because the runtime is
252
+ // published as one map keyed by product key, and a `store` paywall and a
253
+ // `stripe` paywall declaring the same key would otherwise fight over
254
+ // `product.<key>.price`. See `selectActiveProductRuntime`'s doc for why
255
+ // this is cheap rather than wasteful, and why the statuses must not merge.
256
+ const storeRuntime = useProducts(productRefs, productProvider, locale);
257
+ // Free in practice: `stripeLinkProductProvider.getProducts` makes no network
258
+ // call, and refs without a `stripe` block are dropped.
259
+ const stripeRuntime = useProducts(productRefs, stripeProductProvider, locale);
260
+ const productRuntime = selectActiveProductRuntime({
261
+ storeRuntime,
262
+ stripeRuntime,
263
+ billing: activePaywall?.billing,
264
+ hasStripeProvider: stripeProductProvider !== undefined,
265
+ // Lets `selectActiveProductRuntime` prefer the stripe runtime while no
266
+ // paywall is active yet, for a host that passed ONLY
267
+ // `stripeProductProvider` — see that function's doc.
268
+ hasStoreProvider: productProvider !== undefined,
269
+ });
270
+
271
+ // A studio author can set `billing: "stripe"` on a paywall before the host
272
+ // ships the adapter. Loud, because the symptom otherwise is a paywall that
273
+ // charges through the store while the dashboard says Stripe.
274
+ useEffect(() => {
275
+ if (activePaywall?.billing === "stripe" && !stripeProductProvider) {
276
+ console.warn(
277
+ `[paywalls] "${activePaywall.name}" is set to Stripe billing, but no ` +
278
+ "`stripeProductProvider` was passed to PaywallProvider — falling back to the store " +
279
+ "adapter. Pass `stripeLinkProductProvider({ clientReferenceId })` to honour it.",
280
+ );
281
+ }
282
+ }, [activePaywall, stripeProductProvider]);
212
283
 
213
284
  // Tracks what a purchase attempt resolved to during the CURRENT
214
285
  // presentation — read by `complete()` to upgrade a generic "dismissed"
@@ -252,7 +323,8 @@ const PaywallProviderInner = ({
252
323
  [productRuntime, purchase]
253
324
  );
254
325
 
255
- const [activePlacement, setActivePlacement] = useState<string | null>(null);
326
+ // `activeMoment`'s `useState` was hoisted above `productRefs` — see the
327
+ // comment there. Only `hostAcknowledged` is declared here.
256
328
  // Whether the host has confirmed THIS presentation is on screen. State, not
257
329
  // a ref, because the timeout effect below must re-run (and cancel) the moment
258
330
  // it flips.
@@ -262,7 +334,7 @@ const PaywallProviderInner = ({
262
334
  // `purchase`/`restore` callbacks.
263
335
  const catalogRef = useRef(catalog);
264
336
  catalogRef.current = catalog;
265
- // `activePlacementRef` is made AUTHORITATIVE below — assigned inside
337
+ // `activeMomentRef` is made AUTHORITATIVE below — assigned inside
266
338
  // `present()`'s start branch and inside `complete()`, not just here. Finding
267
339
  // 4, 2026-08-17 final review: this line alone only resyncs the ref from
268
340
  // state AFTER React commits, so between a `present()` call and the next
@@ -274,17 +346,17 @@ const PaywallProviderInner = ({
274
346
  // orphaning this whole ref/resolver scheme exists to prevent. Assigning
275
347
  // synchronously inside `present`/`complete` closes that window; this
276
348
  // render-body line stays only as a resync for the (rare) case something
277
- // external changes `activePlacement` state without going through either
349
+ // external changes `activeMoment` state without going through either
278
350
  // callback.
279
- const activePlacementRef = useRef(activePlacement);
280
- activePlacementRef.current = activePlacement;
351
+ const activeMomentRef = useRef(activeMoment);
352
+ activeMomentRef.current = activeMoment;
281
353
  const pendingResolveRef = useRef<((result: PresentResult) => void) | null>(null);
282
354
 
283
355
  // present() must not fetch anything — the catalog and products are already
284
356
  // resolved (or resolving) from mount. It only decides, synchronously,
285
357
  // whether to show the Modal.
286
- const present = useCallback((placement: string): Promise<PresentResult> => {
287
- const decision = resolvePresentDecision(catalogRef.current, activePlacementRef.current, placement);
358
+ const present = useCallback((moment: string): Promise<PresentResult> => {
359
+ const decision = resolvePresentDecision(catalogRef.current, activeMomentRef.current, moment);
288
360
  if (decision.type === "immediate") {
289
361
  return Promise.resolve(decision.result);
290
362
  }
@@ -296,20 +368,20 @@ const PaywallProviderInner = ({
296
368
  // Authoritative NOW, synchronously — see the ref's doc above. A second
297
369
  // `present()` call before React commits reads this value, not the stale
298
370
  // pre-commit state, and correctly takes the "already showing" branch.
299
- activePlacementRef.current = placement;
371
+ activeMomentRef.current = moment;
300
372
  return new Promise<PresentResult>((resolve) => {
301
373
  pendingResolveRef.current = resolve;
302
374
  // A new presentation is unacknowledged until the host says otherwise —
303
375
  // reset before it starts, or the previous presentation's confirmation
304
376
  // would vouch for this one and disable the recovery.
305
377
  setHostAcknowledged(false);
306
- setActivePlacement(placement);
378
+ setActiveMoment(moment);
307
379
  });
308
380
  }, []);
309
381
 
310
382
  // Called by PaywallHost (Task 7) from the presented paywall's
311
383
  // `ScreenHost.complete`. Resolves whatever `present()` call is pending and
312
- // clears the active placement, hiding the Modal and allowing a new
384
+ // clears the active moment, hiding the Modal and allowing a new
313
385
  // `present()` to start. Safe to call with nothing pending (no-ops).
314
386
  //
315
387
  // `resolvePresentedOutcome` upgrades a bare "dismissed" to "purchased" (or
@@ -325,8 +397,8 @@ const PaywallProviderInner = ({
325
397
  // opening from the previous paywall's resolution is a canonical pattern,
326
398
  // spec §4.5) must see "nothing showing" immediately, not wait for the
327
399
  // next commit.
328
- activePlacementRef.current = null;
329
- setActivePlacement(null);
400
+ activeMomentRef.current = null;
401
+ setActiveMoment(null);
330
402
  setHostAcknowledged(false);
331
403
  resolve?.(resolvePresentedOutcome(result, lastPurchaseOutcomeRef.current));
332
404
  }, []);
@@ -337,31 +409,20 @@ const PaywallProviderInner = ({
337
409
  setHostAcknowledged(true);
338
410
  }, []);
339
411
 
340
- const activePaywall = activePlacement ? catalog?.paywalls[activePlacement] ?? null : null;
341
-
342
- // Finding 6, 2026-08-17 final review, widened by N2 (round 2): a background
343
- // catalog revalidation (see `getPaywalls.query.ts`) can push a fresh catalog
344
- // that no longer contains the placement currently on screen (a studio
345
- // publish renamed or removed it mid-session) — OR the query KEY itself can
346
- // change while a paywall is showing (`locale`/`customAudienceParams`
347
- // changed as a prop), which makes react-query report `data: undefined`
348
- // while the new key is fetching (Finding 1's fix reads `catalog` straight
349
- // from that `data`). Both collapse `activePaywall` to null the same way, so
350
- // guarding on THAT — not on `catalog` being non-null — catches both: the
351
- // original guard (`!catalog` check) missed the query-key case entirely,
352
- // because a null `catalog` made it bail out before ever checking whether
353
- // the placement was still present.
412
+ // `activePaywall` was hoisted above `productRefs` — see the comment there
413
+ // (Finding 6, 2026-08-17 final review) for why it is derived from
414
+ // `activeMoment` rather than guarded on `catalog` alone.
354
415
  //
355
416
  // Either way, the Modal closes itself WITHOUT going through `complete()`,
356
417
  // so the pending `present()` promise would never settle and
357
- // `activePlacement` would stay set forever, silently failing every later
418
+ // `activeMoment` would stay set forever, silently failing every later
358
419
  // `present()` call with `"error"` for the rest of the app's life.
359
- // `complete()` always clears `activePlacement` together with resolving the
420
+ // `complete()` always clears `activeMoment` together with resolving the
360
421
  // pending promise, so it cannot race with or double-resolve this branch.
361
422
  useEffect(() => {
362
- if (!activePlacement || activePaywall) return;
423
+ if (!activeMoment || activePaywall) return;
363
424
  complete({ status: "error", reason: "paywall-disappeared" });
364
- }, [activePlacement, activePaywall, complete]);
425
+ }, [activeMoment, activePaywall, complete]);
365
426
 
366
427
  // The OTHER way a presentation never completes, and the one the guard above
367
428
  // structurally cannot catch: `activePaywall` is perfectly non-null — the
@@ -370,8 +431,8 @@ const PaywallProviderInner = ({
370
431
  // already-presenting view controller: another Modal, a
371
432
  // `presentation: "modal"` route, a StoreKit alert). Nothing calls
372
433
  // `complete()`, so without this the pending promise never settles,
373
- // `activePlacement` stays set for the life of the process, and every later
374
- // `present()` — for any placement — resolves "already-presenting" with no
434
+ // `activeMoment` stays set for the life of the process, and every later
435
+ // `present()` — for any moment — resolves "already-presenting" with no
375
436
  // error and no log. Confirmed in production on a monetisation surface, which
376
437
  // is why this recovers rather than merely reports.
377
438
  //
@@ -379,10 +440,10 @@ const PaywallProviderInner = ({
379
440
  // reading is never torn down; see `shouldBreakPresentationWedge`.
380
441
  useEffect(() => {
381
442
  if (presentAckTimeoutMs === null) return;
382
- if (!shouldBreakPresentationWedge(activePlacement, hostAcknowledged, true)) return;
443
+ if (!shouldBreakPresentationWedge(activeMoment, hostAcknowledged, true)) return;
383
444
  const timer = setTimeout(() => {
384
445
  console.warn(
385
- `[paywalls] "${activePlacement}" was never confirmed on screen within ` +
446
+ `[paywalls] "${activeMoment}" was never confirmed on screen within ` +
386
447
  `${presentAckTimeoutMs}ms and has been abandoned, so later present() calls keep working. ` +
387
448
  "The platform most likely refused to present it — on iOS, something else was already " +
388
449
  "presenting (another Modal, a `presentation: \"modal\"` route, or a StoreKit alert).",
@@ -390,7 +451,7 @@ const PaywallProviderInner = ({
390
451
  complete({ status: "error", reason: "host-never-presented" });
391
452
  }, presentAckTimeoutMs);
392
453
  return () => clearTimeout(timer);
393
- }, [activePlacement, hostAcknowledged, presentAckTimeoutMs, complete]);
454
+ }, [activeMoment, hostAcknowledged, presentAckTimeoutMs, complete]);
394
455
 
395
456
  const isReady = useMemo(
396
457
  () => computeIsReady(catalog, productRefs, productRuntime.status),
@@ -447,6 +508,7 @@ export const PaywallProvider = ({
447
508
  locale = "en",
448
509
  customAudienceParams = {},
449
510
  productProvider,
511
+ stripeProductProvider,
450
512
  customActions = EMPTY_CUSTOM_ACTIONS,
451
513
  presentAckTimeoutMs = DEFAULT_PRESENT_ACK_TIMEOUT_MS,
452
514
  }: PaywallProviderProps) => {
@@ -457,6 +519,7 @@ export const PaywallProvider = ({
457
519
  locale={locale}
458
520
  customAudienceParams={customAudienceParams}
459
521
  productProvider={productProvider}
522
+ stripeProductProvider={stripeProductProvider}
460
523
  customActions={customActions}
461
524
  presentAckTimeoutMs={presentAckTimeoutMs}
462
525
  >