@rocapine/react-native-onboarding 1.60.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.
Files changed (173) hide show
  1. package/dist/OnboardingStudioClient.d.ts +23 -5
  2. package/dist/OnboardingStudioClient.d.ts.map +1 -1
  3. package/dist/OnboardingStudioClient.js +82 -6
  4. package/dist/OnboardingStudioClient.js.map +1 -1
  5. package/dist/index.d.ts +6 -0
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +8 -1
  8. package/dist/index.js.map +1 -1
  9. package/dist/infra/provider/OnboardingProvider.d.ts +37 -1
  10. package/dist/infra/provider/OnboardingProvider.d.ts.map +1 -1
  11. package/dist/infra/provider/OnboardingProvider.js +76 -2
  12. package/dist/infra/provider/OnboardingProvider.js.map +1 -1
  13. package/dist/infra/queries/cacheKey.d.ts +22 -4
  14. package/dist/infra/queries/cacheKey.d.ts.map +1 -1
  15. package/dist/infra/queries/cacheKey.js +26 -5
  16. package/dist/infra/queries/cacheKey.js.map +1 -1
  17. package/dist/paywalls/PaywallProvider.d.ts +66 -0
  18. package/dist/paywalls/PaywallProvider.d.ts.map +1 -0
  19. package/dist/paywalls/PaywallProvider.js +227 -0
  20. package/dist/paywalls/PaywallProvider.js.map +1 -0
  21. package/dist/paywalls/getPaywalls.query.d.ts +37 -0
  22. package/dist/paywalls/getPaywalls.query.d.ts.map +1 -0
  23. package/dist/paywalls/getPaywalls.query.js +114 -0
  24. package/dist/paywalls/getPaywalls.query.js.map +1 -0
  25. package/dist/paywalls/present.d.ts +100 -0
  26. package/dist/paywalls/present.d.ts.map +1 -0
  27. package/dist/paywalls/present.js +113 -0
  28. package/dist/paywalls/present.js.map +1 -0
  29. package/dist/paywalls/types.d.ts +95 -0
  30. package/dist/paywalls/types.d.ts.map +1 -0
  31. package/dist/paywalls/types.js +10 -0
  32. package/dist/paywalls/types.js.map +1 -0
  33. package/dist/paywalls/usePaywall.d.ts +29 -0
  34. package/dist/paywalls/usePaywall.d.ts.map +1 -0
  35. package/dist/paywalls/usePaywall.js +17 -0
  36. package/dist/paywalls/usePaywall.js.map +1 -0
  37. package/dist/products/ProductRuntimeContext.d.ts +15 -0
  38. package/dist/products/ProductRuntimeContext.d.ts.map +1 -0
  39. package/dist/products/ProductRuntimeContext.js +19 -0
  40. package/dist/products/ProductRuntimeContext.js.map +1 -0
  41. package/dist/products/adapters/expoIap.d.ts +4 -0
  42. package/dist/products/adapters/expoIap.d.ts.map +1 -0
  43. package/dist/products/adapters/expoIap.js +95 -0
  44. package/dist/products/adapters/expoIap.js.map +1 -0
  45. package/dist/products/adapters/revenueCat.d.ts +7 -0
  46. package/dist/products/adapters/revenueCat.d.ts.map +1 -0
  47. package/dist/products/adapters/revenueCat.js +116 -0
  48. package/dist/products/adapters/revenueCat.js.map +1 -0
  49. package/dist/products/adapters/stub.d.ts +8 -0
  50. package/dist/products/adapters/stub.d.ts.map +1 -0
  51. package/dist/products/adapters/stub.js +21 -0
  52. package/dist/products/adapters/stub.js.map +1 -0
  53. package/dist/products/derive.d.ts +19 -0
  54. package/dist/products/derive.d.ts.map +1 -0
  55. package/dist/products/derive.js +79 -0
  56. package/dist/products/derive.js.map +1 -0
  57. package/dist/products/duration.d.ts +3 -0
  58. package/dist/products/duration.d.ts.map +1 -0
  59. package/dist/products/duration.js +25 -0
  60. package/dist/products/duration.js.map +1 -0
  61. package/dist/products/index.d.ts +10 -0
  62. package/dist/products/index.d.ts.map +1 -0
  63. package/dist/products/index.js +23 -0
  64. package/dist/products/index.js.map +1 -0
  65. package/dist/products/mergeProductRuntimes.d.ts +55 -0
  66. package/dist/products/mergeProductRuntimes.d.ts.map +1 -0
  67. package/dist/products/mergeProductRuntimes.js +79 -0
  68. package/dist/products/mergeProductRuntimes.js.map +1 -0
  69. package/dist/products/toVariables.d.ts +18 -0
  70. package/dist/products/toVariables.d.ts.map +1 -0
  71. package/dist/products/toVariables.js +52 -0
  72. package/dist/products/toVariables.js.map +1 -0
  73. package/dist/products/types.d.ts +96 -0
  74. package/dist/products/types.d.ts.map +1 -0
  75. package/dist/products/types.js +3 -0
  76. package/dist/products/types.js.map +1 -0
  77. package/dist/products/useProducts.d.ts +12 -0
  78. package/dist/products/useProducts.d.ts.map +1 -0
  79. package/dist/products/useProducts.js +90 -0
  80. package/dist/products/useProducts.js.map +1 -0
  81. package/dist/screens/elements/AnimatedTextElement.d.ts +1 -24
  82. package/dist/screens/elements/AnimatedTextElement.d.ts.map +1 -1
  83. package/dist/screens/elements/BaseBoxProps.d.ts +1 -24
  84. package/dist/screens/elements/BaseBoxProps.d.ts.map +1 -1
  85. package/dist/screens/elements/ButtonElement.d.ts +6 -121
  86. package/dist/screens/elements/ButtonElement.d.ts.map +1 -1
  87. package/dist/screens/elements/CarouselElement.d.ts +1 -24
  88. package/dist/screens/elements/CarouselElement.d.ts.map +1 -1
  89. package/dist/screens/elements/CheckboxGroupElement.d.ts +1 -24
  90. package/dist/screens/elements/CheckboxGroupElement.d.ts.map +1 -1
  91. package/dist/screens/elements/DatePickerElement.d.ts +1 -24
  92. package/dist/screens/elements/DatePickerElement.d.ts.map +1 -1
  93. package/dist/screens/elements/DrawingPadElement.d.ts +1 -24
  94. package/dist/screens/elements/DrawingPadElement.d.ts.map +1 -1
  95. package/dist/screens/elements/IconElement.d.ts +1 -24
  96. package/dist/screens/elements/IconElement.d.ts.map +1 -1
  97. package/dist/screens/elements/ImageElement.d.ts +1 -24
  98. package/dist/screens/elements/ImageElement.d.ts.map +1 -1
  99. package/dist/screens/elements/InputElement.d.ts +1 -24
  100. package/dist/screens/elements/InputElement.d.ts.map +1 -1
  101. package/dist/screens/elements/KeyboardAvoidingViewElement.d.ts +1 -24
  102. package/dist/screens/elements/KeyboardAvoidingViewElement.d.ts.map +1 -1
  103. package/dist/screens/elements/LottieElement.d.ts +1 -24
  104. package/dist/screens/elements/LottieElement.d.ts.map +1 -1
  105. package/dist/screens/elements/ProgressIndicatorElement.d.ts +1 -24
  106. package/dist/screens/elements/ProgressIndicatorElement.d.ts.map +1 -1
  107. package/dist/screens/elements/ProgressiveBlurImageElement.d.ts +1 -24
  108. package/dist/screens/elements/ProgressiveBlurImageElement.d.ts.map +1 -1
  109. package/dist/screens/elements/RadioGroupElement.d.ts +1 -24
  110. package/dist/screens/elements/RadioGroupElement.d.ts.map +1 -1
  111. package/dist/screens/elements/RichTextElement.d.ts +1 -24
  112. package/dist/screens/elements/RichTextElement.d.ts.map +1 -1
  113. package/dist/screens/elements/RiveElement.d.ts +1 -24
  114. package/dist/screens/elements/RiveElement.d.ts.map +1 -1
  115. package/dist/screens/elements/SafeAreaViewElement.d.ts +1 -24
  116. package/dist/screens/elements/SafeAreaViewElement.d.ts.map +1 -1
  117. package/dist/screens/elements/ScrollViewElement.d.ts +1 -24
  118. package/dist/screens/elements/ScrollViewElement.d.ts.map +1 -1
  119. package/dist/screens/elements/SliderElement.d.ts +1 -24
  120. package/dist/screens/elements/SliderElement.d.ts.map +1 -1
  121. package/dist/screens/elements/StackElement.d.ts +1 -24
  122. package/dist/screens/elements/StackElement.d.ts.map +1 -1
  123. package/dist/screens/elements/TextElement.d.ts +1 -24
  124. package/dist/screens/elements/TextElement.d.ts.map +1 -1
  125. package/dist/screens/elements/TypewriterTextElement.d.ts +1 -24
  126. package/dist/screens/elements/TypewriterTextElement.d.ts.map +1 -1
  127. package/dist/screens/elements/VideoElement.d.ts +1 -24
  128. package/dist/screens/elements/VideoElement.d.ts.map +1 -1
  129. package/dist/screens/elements/WheelPickerElement.d.ts +1 -24
  130. package/dist/screens/elements/WheelPickerElement.d.ts.map +1 -1
  131. package/dist/screens/elements/ZStackElement.d.ts +1 -24
  132. package/dist/screens/elements/ZStackElement.d.ts.map +1 -1
  133. package/dist/steps/Carousel/types.d.ts +1 -1
  134. package/dist/steps/Commitment/types.d.ts +1 -1
  135. package/dist/steps/ComposableScreen/types.d.ts +1 -1
  136. package/dist/steps/Loader/types.d.ts +1 -1
  137. package/dist/steps/MediaContent/types.d.ts +1 -1
  138. package/dist/steps/Picker/types.d.ts +1 -1
  139. package/dist/steps/Question/types.d.ts +1 -1
  140. package/dist/steps/Ratings/types.d.ts +1 -1
  141. package/dist/steps/common.types.d.ts +44 -30
  142. package/dist/steps/common.types.d.ts.map +1 -1
  143. package/dist/steps/common.types.js +27 -3
  144. package/dist/steps/common.types.js.map +1 -1
  145. package/package.json +1 -1
  146. package/src/OnboardingStudioClient.ts +110 -7
  147. package/src/__tests__/mergeProductRuntimes.test.ts +172 -0
  148. package/src/__tests__/productAdapters.test.ts +58 -0
  149. package/src/__tests__/productDerive.test.ts +111 -0
  150. package/src/__tests__/productVariables.test.ts +109 -0
  151. package/src/__tests__/resolveLocalProductArgs.test.ts +41 -0
  152. package/src/index.ts +14 -0
  153. package/src/infra/provider/OnboardingProvider.tsx +101 -2
  154. package/src/infra/queries/cacheKey.ts +27 -4
  155. package/src/paywalls/PaywallProvider.tsx +342 -0
  156. package/src/paywalls/__tests__/getPaywalls.test.ts +334 -0
  157. package/src/paywalls/__tests__/present.test.ts +190 -0
  158. package/src/paywalls/getPaywalls.query.ts +123 -0
  159. package/src/paywalls/present.ts +141 -0
  160. package/src/paywalls/types.ts +99 -0
  161. package/src/paywalls/usePaywall.ts +35 -0
  162. package/src/products/ProductRuntimeContext.tsx +17 -0
  163. package/src/products/adapters/expoIap.ts +93 -0
  164. package/src/products/adapters/revenueCat.ts +108 -0
  165. package/src/products/adapters/stub.ts +20 -0
  166. package/src/products/derive.ts +93 -0
  167. package/src/products/duration.ts +21 -0
  168. package/src/products/index.ts +20 -0
  169. package/src/products/mergeProductRuntimes.ts +78 -0
  170. package/src/products/toVariables.ts +54 -0
  171. package/src/products/types.ts +88 -0
  172. package/src/products/useProducts.ts +106 -0
  173. package/src/steps/common.types.ts +83 -6
@@ -0,0 +1,95 @@
1
+ /**
2
+ * Response types for `OnboardingStudioClient.getPaywalls()` (spec §6.1). The
3
+ * endpoint returns every placement for the project/audience/locale in one
4
+ * payload — a paywall must render the instant the user taps upgrade, and a
5
+ * network round-trip at that moment is a conversion bug, so there is no
6
+ * per-placement fetch in the common path (see `PaywallOptions.placement`).
7
+ */
8
+ /** A single studio-authored paywall, keyed by `placement` in `PaywallCatalog.paywalls`. */
9
+ export type Paywall = {
10
+ id: string;
11
+ name: string;
12
+ placement: string;
13
+ /** UIElement[] — parsed by the UI adapter (Task 7's `ScreenElementsSchema`), not here. */
14
+ elements: unknown[];
15
+ products: Array<{
16
+ key: string;
17
+ ios?: string;
18
+ android?: string;
19
+ compareTo?: string;
20
+ }>;
21
+ configuration: Record<string, unknown> | null;
22
+ };
23
+ /** Full response body of `GET get-paywalls`. */
24
+ export type PaywallCatalog = {
25
+ metadata: {
26
+ audienceId: number | null;
27
+ audienceName: string | null;
28
+ locale: string | null;
29
+ draft: boolean;
30
+ };
31
+ /** Keyed by placement, not by paywall id. */
32
+ paywalls: Record<string, Paywall>;
33
+ fonts: Record<string, unknown> | null;
34
+ };
35
+ /**
36
+ * Options for `OnboardingStudioClient.getPaywalls()`.
37
+ *
38
+ * `placement` narrows the response to a single paywall — the exception, not
39
+ * the default. Omit it to get every placement in one round-trip, which is
40
+ * what lets a paywall render instantly at buy-tap time (see the module doc
41
+ * above).
42
+ */
43
+ export type PaywallOptions = {
44
+ locale?: string;
45
+ placement?: string;
46
+ };
47
+ /**
48
+ * Response headers for `get-paywalls`. Deliberately **not** the onboarding
49
+ * trio (`ONBS-Onboarding-Id` / `ONBS-Audience-Id` / `ONBS-Onboarding-Name`) —
50
+ * the paywall endpoint has no single onboarding/audience-name concept and
51
+ * instead reports which paywall ids came back.
52
+ */
53
+ export interface GetPaywallsResponseHeaders {
54
+ "ONBS-Audience-Id": string | null;
55
+ "ONBS-Paywall-Ids": string | null;
56
+ }
57
+ /**
58
+ * Resolved outcome of a `usePaywall().present(placement)` call (spec §7).
59
+ * Closed union, not the open-ended `ScreenHost.CompleteOutcome` — a
60
+ * presentation ends in exactly one of these four ways, and `present()`'s
61
+ * caller (typically an `await`) should be able to switch over it exhaustively.
62
+ *
63
+ * `"error"` covers both: (a) `placement` is absent from the catalog (or the
64
+ * catalog hasn't resolved yet), and (b) `present()` was called while another
65
+ * paywall is already being presented. Both resolve rather than throw — a
66
+ * missing placement or a mistimed call must not crash a host app mid-flow.
67
+ * See `resolvePresentDecision` in `present.ts` for the exact decision logic.
68
+ *
69
+ * `"purchased"` / `"cancelled"` are NOT produced by any ButtonAction directly
70
+ * — `dismiss` (the only in-content closing action) always reports
71
+ * `{status:"dismissed"}`, on purpose, since it doesn't know anything about
72
+ * purchase state. `PaywallProvider` instead tracks what the store actually
73
+ * did during the active presentation (`purchaseOutcomeFromResult` in
74
+ * `present.ts`) and `resolvePresentedOutcome` upgrades a bare `"dismissed"`
75
+ * to whichever of these occurred, if any — so spec §4.6's canonical authoring
76
+ * shape (`{type:"purchase", onSuccess:[{type:"dismiss"}]}`) resolves
77
+ * `"purchased"` even though `dismiss` itself never says so.
78
+ */
79
+ /**
80
+ * How a presentation ENDED — not what the user is entitled to.
81
+ *
82
+ * `"purchased"` means a purchase succeeded while this paywall was showing, and
83
+ * is the honest report in the common case. But it is deliberately not an
84
+ * entitlement signal: a purchase followed by a render crash resolves `"error"`
85
+ * (the boundary settles the promise so the user is not trapped), so a host that
86
+ * keys entitlement off `status === "purchased"` would under-grant a user who
87
+ * genuinely paid.
88
+ *
89
+ * Entitlement belongs to the store — read it from the `ProductProvider` /
90
+ * billing SDK, and use this only to decide what the UI does next.
91
+ */
92
+ export type PresentResult = {
93
+ status: "purchased" | "dismissed" | "cancelled" | "error";
94
+ };
95
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/paywalls/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,2FAA2F;AAC3F,MAAM,MAAM,OAAO,GAAG;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EA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ingStudioClient.getPaywalls()` (spec §6.1). The
4
+ * endpoint returns every placement for the project/audience/locale in one
5
+ * payload — a paywall must render the instant the user taps upgrade, and a
6
+ * network round-trip at that moment is a conversion bug, so there is no
7
+ * per-placement fetch in the common path (see `PaywallOptions.placement`).
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/paywalls/types.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG"}
@@ -0,0 +1,29 @@
1
+ import { PaywallCatalog, PresentResult } from "./types";
2
+ export type UsePaywallResult = {
3
+ /**
4
+ * Present a paywall by placement. Never fetches — the catalog and its
5
+ * products are already resolved (or resolving) from `PaywallProvider`
6
+ * mount, which is the whole point: a paywall must render the instant the
7
+ * user taps upgrade.
8
+ *
9
+ * Resolves `{ status: "error" }` — never throws — when `placement` is
10
+ * absent from the catalog, or when another paywall is already being
11
+ * presented. See `resolvePresentDecision` in `present.ts`.
12
+ */
13
+ present: (placement: string) => Promise<PresentResult>;
14
+ /**
15
+ * `true` once BOTH the catalog and its products have resolved — the one
16
+ * flag meaning "calling `present()` now will not show a spinner".
17
+ */
18
+ isReady: boolean;
19
+ /** The full resolved catalog (every placement), or `null` before it loads. */
20
+ catalog: PaywallCatalog | null;
21
+ };
22
+ /**
23
+ * Read the paywall runtime published by an ancestor `PaywallProvider`.
24
+ * Outside one, returns inert defaults (`present` resolves `"error"`,
25
+ * `isReady: false`, `catalog: null`) rather than throwing — mirrors how
26
+ * `useProductRuntime()` degrades to `null` with no ancestor.
27
+ */
28
+ export declare const usePaywall: () => UsePaywallResult;
29
+ //# sourceMappingURL=usePaywall.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePaywall.d.ts","sourceRoot":"","sources":["../../src/paywalls/usePaywall.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExD,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;;;;;;;;OASG;IACH,OAAO,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC;IACvD;;;OAGG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB,8EAA8E;IAC9E,OAAO,EAAE,cAAc,GAAG,IAAI,CAAC;CAChC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,UAAU,QAAO,gBAG7B,CAAC"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.usePaywall = void 0;
4
+ const react_1 = require("react");
5
+ const PaywallProvider_1 = require("./PaywallProvider");
6
+ /**
7
+ * Read the paywall runtime published by an ancestor `PaywallProvider`.
8
+ * Outside one, returns inert defaults (`present` resolves `"error"`,
9
+ * `isReady: false`, `catalog: null`) rather than throwing — mirrors how
10
+ * `useProductRuntime()` degrades to `null` with no ancestor.
11
+ */
12
+ const usePaywall = () => {
13
+ const { present, isReady, catalog } = (0, react_1.useContext)(PaywallProvider_1.PaywallContext);
14
+ return { present, isReady, catalog };
15
+ };
16
+ exports.usePaywall = usePaywall;
17
+ //# sourceMappingURL=usePaywall.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePaywall.js","sourceRoot":"","sources":["../../src/paywalls/usePaywall.ts"],"names":[],"mappings":";;;AAAA,iCAAmC;AACnC,uDAAmD;AAwBnD;;;;;GAKG;AACI,MAAM,UAAU,GAAG,GAAqB,EAAE;IAC/C,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,IAAA,kBAAU,EAAC,gCAAc,CAAC,CAAC;IACjE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;AACvC,CAAC,CAAC;AAHW,QAAA,UAAU,cAGrB"}
@@ -0,0 +1,15 @@
1
+ import type { ProductRuntime } from "./types";
2
+ /**
3
+ * Publishes one `ProductRuntime` above both `PaywallProvider` and
4
+ * `OnboardingProvider`, so a `PaywallProvider` mounted around an
5
+ * `OnboardingProvider` (Phase 5's `presentPaywall` arrangement) gives them one
6
+ * shared product catalog instead of each mounting its own `useProducts` — one
7
+ * store round-trip, one `purchasing` flag, for both.
8
+ *
9
+ * `null` by default: nothing above publishes a runtime, which is the normal
10
+ * case for an app that mounts only `OnboardingProvider`.
11
+ */
12
+ export declare const ProductRuntimeContext: import("react").Context<ProductRuntime | null>;
13
+ /** The ancestor `ProductRuntime`, or `null` when no provider publishes one. */
14
+ export declare const useProductRuntime: () => ProductRuntime | null;
15
+ //# sourceMappingURL=ProductRuntimeContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProductRuntimeContext.d.ts","sourceRoot":"","sources":["../../src/products/ProductRuntimeContext.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C;;;;;;;;;GASG;AACH,eAAO,MAAM,qBAAqB,gDAA6C,CAAC;AAEhF,+EAA+E;AAC/E,eAAO,MAAM,iBAAiB,QAAO,cAAc,GAAG,IAAyC,CAAC"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useProductRuntime = exports.ProductRuntimeContext = void 0;
4
+ const react_1 = require("react");
5
+ /**
6
+ * Publishes one `ProductRuntime` above both `PaywallProvider` and
7
+ * `OnboardingProvider`, so a `PaywallProvider` mounted around an
8
+ * `OnboardingProvider` (Phase 5's `presentPaywall` arrangement) gives them one
9
+ * shared product catalog instead of each mounting its own `useProducts` — one
10
+ * store round-trip, one `purchasing` flag, for both.
11
+ *
12
+ * `null` by default: nothing above publishes a runtime, which is the normal
13
+ * case for an app that mounts only `OnboardingProvider`.
14
+ */
15
+ exports.ProductRuntimeContext = (0, react_1.createContext)(null);
16
+ /** The ancestor `ProductRuntime`, or `null` when no provider publishes one. */
17
+ const useProductRuntime = () => (0, react_1.useContext)(exports.ProductRuntimeContext);
18
+ exports.useProductRuntime = useProductRuntime;
19
+ //# sourceMappingURL=ProductRuntimeContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProductRuntimeContext.js","sourceRoot":"","sources":["../../src/products/ProductRuntimeContext.tsx"],"names":[],"mappings":";;;AAAA,iCAAkD;AAGlD;;;;;;;;;GASG;AACU,QAAA,qBAAqB,GAAG,IAAA,qBAAa,EAAwB,IAAI,CAAC,CAAC;AAEhF,+EAA+E;AACxE,MAAM,iBAAiB,GAAG,GAA0B,EAAE,CAAC,IAAA,kBAAU,EAAC,6BAAqB,CAAC,CAAC;AAAnF,QAAA,iBAAiB,qBAAkE"}
@@ -0,0 +1,4 @@
1
+ import type { ProductProvider } from "../types";
2
+ /** Direct StoreKit / Play Billing provider, no vendor in the path. */
3
+ export declare const expoIapProductProvider: (Iap?: any) => ProductProvider;
4
+ //# sourceMappingURL=expoIap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expoIap.d.ts","sourceRoot":"","sources":["../../../src/products/adapters/expoIap.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAA8C,MAAM,UAAU,CAAC;AAyB5F,sEAAsE;AACtE,eAAO,MAAM,sBAAsB,GAAI,MAAK,GAAS,KAAG,eAiEvD,CAAC"}
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.expoIapProductProvider = void 0;
4
+ const react_native_1 = require("react-native");
5
+ // Optional peer: expo-iap. Same dynamic-require pattern as elements/haptics.ts.
6
+ let IAP;
7
+ try {
8
+ IAP = require("expo-iap");
9
+ }
10
+ catch (_a) {
11
+ IAP = null;
12
+ }
13
+ const toPeriod = (iso) => {
14
+ var _a;
15
+ if (!iso)
16
+ return { period: null, count: 0 };
17
+ const m = /^P(\d+)([DWMY])$/.exec(iso);
18
+ if (!m)
19
+ return { period: null, count: 0 };
20
+ const map = { D: "week", W: "week", M: "month", Y: "year" };
21
+ return { period: (_a = map[m[2]]) !== null && _a !== void 0 ? _a : null, count: Number(m[1]) };
22
+ };
23
+ // expo-iap surfaces a user cancellation as a code rather than a typed error.
24
+ const isCancellation = (e) => (e === null || e === void 0 ? void 0 : e.code) === "E_USER_CANCELLED" || (e === null || e === void 0 ? void 0 : e.code) === "USER_CANCELED" || (e === null || e === void 0 ? void 0 : e.userCancelled) === true;
25
+ const idFor = (ref) => react_native_1.Platform.OS === "ios" ? ref.ios : ref.android;
26
+ /** Direct StoreKit / Play Billing provider, no vendor in the path. */
27
+ const expoIapProductProvider = (Iap = IAP) => {
28
+ const required = () => {
29
+ if (!Iap) {
30
+ throw new Error("expoIapProductProvider: expo-iap is not installed. Install it, or pass a different ProductProvider.");
31
+ }
32
+ return Iap;
33
+ };
34
+ return {
35
+ async getProducts(refs) {
36
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
37
+ const M = required();
38
+ const wanted = refs.map((r) => ({ ref: r, id: idFor(r) })).filter((x) => !!x.id);
39
+ if (wanted.length === 0)
40
+ return [];
41
+ const skus = wanted.map((w) => w.id);
42
+ const store = await M.getProducts(skus);
43
+ const byId = new Map(store.map((s) => { var _a; return [(_a = s.id) !== null && _a !== void 0 ? _a : s.productId, s]; }));
44
+ const out = [];
45
+ for (const { ref, id } of wanted) {
46
+ const s = byId.get(id);
47
+ if (!s)
48
+ continue;
49
+ const iso = (_b = (_a = s.subscriptionPeriodISO) !== null && _a !== void 0 ? _a : s.subscriptionPeriod) !== null && _b !== void 0 ? _b : null;
50
+ const { period, count } = toPeriod(iso);
51
+ out.push({
52
+ key: ref.key,
53
+ productId: (_c = s.id) !== null && _c !== void 0 ? _c : s.productId,
54
+ store: react_native_1.Platform.OS === "ios" ? "app_store" : "play_store",
55
+ title: (_d = s.title) !== null && _d !== void 0 ? _d : "",
56
+ description: (_e = s.description) !== null && _e !== void 0 ? _e : "",
57
+ price: (_g = (_f = s.displayPrice) !== null && _f !== void 0 ? _f : s.localizedPrice) !== null && _g !== void 0 ? _g : "",
58
+ priceAmount: Number((_h = s.price) !== null && _h !== void 0 ? _h : 0),
59
+ currencyCode: (_k = (_j = s.currency) !== null && _j !== void 0 ? _j : s.currencyCode) !== null && _k !== void 0 ? _k : "",
60
+ period,
61
+ periodCount: count,
62
+ periodIso: iso,
63
+ });
64
+ }
65
+ return out;
66
+ },
67
+ async purchase(product) {
68
+ const M = required();
69
+ try {
70
+ await M.requestPurchase({ request: { sku: product.productId } });
71
+ return { status: "purchased", productKey: product.key };
72
+ }
73
+ catch (e) {
74
+ if (isCancellation(e))
75
+ return { status: "cancelled" };
76
+ return { status: "error", error: e instanceof Error ? e : new Error(String(e)) };
77
+ }
78
+ },
79
+ async restore() {
80
+ const M = required();
81
+ try {
82
+ const purchases = await M.getAvailablePurchases();
83
+ const ids = (purchases !== null && purchases !== void 0 ? purchases : []).map((p) => { var _a; return (_a = p.id) !== null && _a !== void 0 ? _a : p.productId; }).filter(Boolean);
84
+ return ids.length > 0
85
+ ? { status: "restored", entitlements: ids }
86
+ : { status: "nothing_to_restore" };
87
+ }
88
+ catch (e) {
89
+ return { status: "error", error: e instanceof Error ? e : new Error(String(e)) };
90
+ }
91
+ },
92
+ };
93
+ };
94
+ exports.expoIapProductProvider = expoIapProductProvider;
95
+ //# sourceMappingURL=expoIap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expoIap.js","sourceRoot":"","sources":["../../../src/products/adapters/expoIap.ts"],"names":[],"mappings":";;;AAAA,+CAAwC;AAGxC,gFAAgF;AAChF,IAAI,GAAQ,CAAC;AACb,IAAI,CAAC;IACH,GAAG,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAC5B,CAAC;AAAC,WAAM,CAAC;IACP,GAAG,GAAG,IAAI,CAAC;AACb,CAAC;AAED,MAAM,QAAQ,GAAG,CAAC,GAA8B,EAAmD,EAAE;;IACnG,IAAI,CAAC,GAAG;QAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,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AC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YACnF,CAAC;QACH,CAAC;QAED,KAAK,CAAC,OAAO;YACX,MAAM,CAAC,GAAG,QAAQ,EAAE,CAAC;YACrB,IAAI,CAAC;gBACH,MAAM,SAAS,GAAG,MAAM,CAAC,CAAC,qBAAqB,EAAE,CAAC;gBAClD,MAAM,GAAG,GAAa,CAAC,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAM,EAAE,EAAE,WAAC,OAAA,MAAA,CAAC,CAAC,EAAE,mCAAI,CAAC,CAAC,SAAS,CAAA,EAAA,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;gBAC7F,OAAO,GAAG,CAAC,MAAM,GAAG,CAAC;oBACnB,CAAC,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,GAAG,EAAE;oBAC3C,CAAC,CAAC,EAAE,MAAM,EAAE,oBAAoB,EAAE,CAAC;YACvC,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YACnF,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAjEW,QAAA,sBAAsB,0BAiEjC"}
@@ -0,0 +1,7 @@
1
+ import type { ProductProvider } from "../types";
2
+ /**
3
+ * RevenueCat-backed provider. Pass the `Purchases` module explicitly if you have
4
+ * a custom instance; otherwise the installed one is used.
5
+ */
6
+ export declare const revenueCatProductProvider: (Purchases?: any) => ProductProvider;
7
+ //# sourceMappingURL=revenueCat.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"revenueCat.d.ts","sourceRoot":"","sources":["../../../src/products/adapters/revenueCat.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAA8C,MAAM,UAAU,CAAC;AA0B5F;;;GAGG;AACH,eAAO,MAAM,yBAAyB,GAAI,YAAW,GAAuB,KAAG,eA4E9E,CAAC"}
@@ -0,0 +1,116 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.revenueCatProductProvider = void 0;
4
+ const react_native_1 = require("react-native");
5
+ // Optional peer: react-native-purchases. Same dynamic-require pattern as
6
+ // elements/haptics.ts — absent is not a crash, it is a clear error at call time.
7
+ let RC;
8
+ try {
9
+ RC = require("react-native-purchases");
10
+ }
11
+ catch (_a) {
12
+ RC = null;
13
+ }
14
+ const PERIOD_UNIT = {
15
+ DAY: "week", WEEK: "week", MONTH: "month", YEAR: "year",
16
+ };
17
+ const toPeriod = (iso) => {
18
+ var _a;
19
+ if (!iso)
20
+ return { period: null, count: 0 };
21
+ const m = /^P(\d+)([DWMY])$/.exec(iso);
22
+ if (!m)
23
+ return { period: null, count: 0 };
24
+ const unit = { D: "DAY", W: "WEEK", M: "MONTH", Y: "YEAR" }[m[2]];
25
+ return { period: (_a = PERIOD_UNIT[unit]) !== null && _a !== void 0 ? _a : null, count: Number(m[1]) };
26
+ };
27
+ const idFor = (ref) => react_native_1.Platform.OS === "ios" ? ref.ios : ref.android;
28
+ /**
29
+ * RevenueCat-backed provider. Pass the `Purchases` module explicitly if you have
30
+ * a custom instance; otherwise the installed one is used.
31
+ */
32
+ const revenueCatProductProvider = (Purchases) => {
33
+ var _a;
34
+ if (Purchases === void 0) { Purchases = (_a = RC === null || RC === void 0 ? void 0 : RC.default) !== null && _a !== void 0 ? _a : RC; }
35
+ const required = () => {
36
+ if (!Purchases) {
37
+ throw new Error("revenueCatProductProvider: react-native-purchases is not installed. Install it, or pass a different ProductProvider.");
38
+ }
39
+ return Purchases;
40
+ };
41
+ return {
42
+ async getProducts(refs) {
43
+ var _a, _b, _c, _d;
44
+ const P = required();
45
+ const wanted = refs.map((r) => ({ ref: r, id: idFor(r) })).filter((x) => !!x.id);
46
+ if (wanted.length === 0)
47
+ return [];
48
+ const store = await P.getProducts(wanted.map((w) => w.id));
49
+ const byId = new Map(store.map((s) => [s.identifier, s]));
50
+ const out = [];
51
+ for (const { ref, id } of wanted) {
52
+ const s = byId.get(id);
53
+ if (!s)
54
+ continue;
55
+ const { period, count } = toPeriod(s.subscriptionPeriod);
56
+ out.push({
57
+ key: ref.key,
58
+ productId: s.identifier,
59
+ store: react_native_1.Platform.OS === "ios" ? "app_store" : "play_store",
60
+ title: (_a = s.title) !== null && _a !== void 0 ? _a : "",
61
+ description: (_b = s.description) !== null && _b !== void 0 ? _b : "",
62
+ price: s.priceString,
63
+ priceAmount: s.price,
64
+ currencyCode: s.currencyCode,
65
+ period,
66
+ periodCount: count,
67
+ periodIso: (_c = s.subscriptionPeriod) !== null && _c !== void 0 ? _c : null,
68
+ trial: s.introPrice && s.introPrice.price === 0
69
+ ? {
70
+ period: (_d = toPeriod(s.introPrice.periodISO).period) !== null && _d !== void 0 ? _d : "week",
71
+ periodCount: toPeriod(s.introPrice.periodISO).count,
72
+ days: 0,
73
+ }
74
+ : undefined,
75
+ });
76
+ }
77
+ return out;
78
+ },
79
+ async purchase(product) {
80
+ var _a, _b, _c;
81
+ const P = required();
82
+ try {
83
+ const store = await P.getProducts([product.productId]);
84
+ if (!store[0])
85
+ return { status: "error", error: new Error(`Unknown product ${product.productId}`) };
86
+ const res = await P.purchaseStoreProduct(store[0]);
87
+ return {
88
+ status: "purchased",
89
+ productKey: product.key,
90
+ entitlements: Object.keys((_c = (_b = (_a = res === null || res === void 0 ? void 0 : res.customerInfo) === null || _a === void 0 ? void 0 : _a.entitlements) === null || _b === void 0 ? void 0 : _b.active) !== null && _c !== void 0 ? _c : {}),
91
+ };
92
+ }
93
+ catch (e) {
94
+ if (e === null || e === void 0 ? void 0 : e.userCancelled)
95
+ return { status: "cancelled" };
96
+ return { status: "error", error: e instanceof Error ? e : new Error(String(e)) };
97
+ }
98
+ },
99
+ async restore() {
100
+ var _a, _b;
101
+ const P = required();
102
+ try {
103
+ const info = await P.restorePurchases();
104
+ const ents = Object.keys((_b = (_a = info === null || info === void 0 ? void 0 : info.entitlements) === null || _a === void 0 ? void 0 : _a.active) !== null && _b !== void 0 ? _b : {});
105
+ return ents.length > 0
106
+ ? { status: "restored", entitlements: ents }
107
+ : { status: "nothing_to_restore" };
108
+ }
109
+ catch (e) {
110
+ return { status: "error", error: e instanceof Error ? e : new Error(String(e)) };
111
+ }
112
+ },
113
+ };
114
+ };
115
+ exports.revenueCatProductProvider = revenueCatProductProvider;
116
+ //# sourceMappingURL=revenueCat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"revenueCat.js","sourceRoot":"","sources":["../../../src/products/adapters/revenueCat.ts"],"names":[],"mappings":";;;AAAA,+CAAwC;AAGxC,yEAAyE;AACzE,iFAAiF;AACjF,IAAI,EAAO,CAAC;AACZ,IAAI,CAAC;IACH,EAAE,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAC;AACzC,CAAC;AAAC,WAAM,CAAC;IACP,EAAE,GAAG,IAAI,CAAC;AACZ,CAAC;AAED,MAAM,WAAW,GAAkC;IACjD,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM;CACxD,CAAC;AAEF,MAAM,QAAQ,GAAG,CAAC,GAA8B,EAAmD,EAAE;;IACnG,IAAI,CAAC,GAAG;QAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;IAC5C,MAAM,CAAC,GAAG,kBAAkB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACvC,IAAI,CAAC,CAAC;QAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;IAC1C,MAAM,IAAI,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,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M,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YACnF,CAAC;QACH,CAAC;QAED,KAAK,CAAC,OAAO;;YACX,MAAM,CAAC,GAAG,QAAQ,EAAE,CAAC;YACrB,IAAI,CAAC;gBACH,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,gBAAgB,EAAE,CAAC;gBACxC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,MAAA,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,YAAY,0CAAE,MAAM,mCAAI,EAAE,CAAC,CAAC;gBAC3D,OAAO,IAAI,CAAC,MAAM,GAAG,CAAC;oBACpB,CAAC,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,IAAI,EAAE;oBAC5C,CAAC,CAAC,EAAE,MAAM,EAAE,oBAAoB,EAAE,CAAC;YACvC,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YACnF,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AA5EW,QAAA,yBAAyB,6BA4EpC"}
@@ -0,0 +1,8 @@
1
+ import type { ProductProvider, ResolvedProduct } from "../types";
2
+ /**
3
+ * In-memory provider for demos, tests, and studio previews. NEVER ship a paywall
4
+ * backed by this — its prices are invented, and App Review rejects a paywall
5
+ * whose displayed price does not match the store.
6
+ */
7
+ export declare const stubProductProvider: (catalog: Record<string, Omit<ResolvedProduct, "key">>) => ProductProvider;
8
+ //# sourceMappingURL=stub.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stub.d.ts","sourceRoot":"","sources":["../../../src/products/adapters/stub.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAc,eAAe,EAAE,MAAM,UAAU,CAAC;AAE7E;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAC9B,SAAS,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC,KACpD,eAUD,CAAC"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.stubProductProvider = void 0;
4
+ /**
5
+ * In-memory provider for demos, tests, and studio previews. NEVER ship a paywall
6
+ * backed by this — its prices are invented, and App Review rejects a paywall
7
+ * whose displayed price does not match the store.
8
+ */
9
+ const stubProductProvider = (catalog) => ({
10
+ async getProducts(refs) {
11
+ return refs.filter((r) => catalog[r.key]).map((r) => (Object.assign({ key: r.key }, catalog[r.key])));
12
+ },
13
+ async purchase(product) {
14
+ return { status: "purchased", productKey: product.key };
15
+ },
16
+ async restore() {
17
+ return { status: "nothing_to_restore" };
18
+ },
19
+ });
20
+ exports.stubProductProvider = stubProductProvider;
21
+ //# sourceMappingURL=stub.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stub.js","sourceRoot":"","sources":["../../../src/products/adapters/stub.ts"],"names":[],"mappings":";;;AAEA;;;;GAIG;AACI,MAAM,mBAAmB,GAAG,CACjC,OAAqD,EACpC,EAAE,CAAC,CAAC;IACrB,KAAK,CAAC,WAAW,CAAC,IAAkB;QAClC,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,iBAAG,GAAG,EAAE,CAAC,CAAC,GAAG,IAAK,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,EAAG,CAAC,CAAC;IAC5F,CAAC;IACD,KAAK,CAAC,QAAQ,CAAC,OAAO;QACpB,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC;IAC1D,CAAC;IACD,KAAK,CAAC,OAAO;QACX,OAAO,EAAE,MAAM,EAAE,oBAAoB,EAAE,CAAC;IAC1C,CAAC;CACF,CAAC,CAAC;AAZU,QAAA,mBAAmB,uBAY7B"}
@@ -0,0 +1,19 @@
1
+ import type { DerivedProductFields, ProductRef, ProductWithDerived, ResolvedProduct } from "./types";
2
+ /**
3
+ * Format in the PRODUCT's currency, not the device's. Falls back to a plain
4
+ * `amount currencyCode` string if Intl rejects the code, so a bad code degrades
5
+ * to something readable instead of throwing mid-render.
6
+ */
7
+ export declare const formatCurrency: (amount: number, currencyCode: string, locale?: string) => string;
8
+ /**
9
+ * Derived fields for one product. `compareTo` enables `savingsPct`, computed on
10
+ * a normalized per-day basis so a yearly plan can be compared to a monthly one.
11
+ * These are FRAMING values ("$1.15/week"), never presented as the charged amount.
12
+ */
13
+ export declare const deriveProductFields: (p: ResolvedProduct, opts?: {
14
+ compareTo?: ResolvedProduct;
15
+ locale?: string;
16
+ }) => DerivedProductFields;
17
+ /** Derive every product, keyed by its ref key, resolving `compareTo` between them. */
18
+ export declare const deriveAll: (products: ResolvedProduct[], refs: ProductRef[], locale?: string) => Record<string, ProductWithDerived>;
19
+ //# sourceMappingURL=derive.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"derive.d.ts","sourceRoot":"","sources":["../../src/products/derive.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,oBAAoB,EACpB,UAAU,EACV,kBAAkB,EAClB,eAAe,EAChB,MAAM,SAAS,CAAC;AAEjB;;;;GAIG;AACH,eAAO,MAAM,cAAc,GACzB,QAAQ,MAAM,EACd,cAAc,MAAM,EACpB,SAAS,MAAM,KACd,MASF,CAAC;AAQF;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAC9B,GAAG,eAAe,EAClB,OAAM;IAAE,SAAS,CAAC,EAAE,eAAe,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAO,KAC1D,oBAiCF,CAAC;AAEF,sFAAsF;AACtF,eAAO,MAAM,SAAS,GACpB,UAAU,eAAe,EAAE,EAC3B,MAAM,UAAU,EAAE,EAClB,SAAS,MAAM,KACd,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAUnC,CAAC"}
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deriveAll = exports.deriveProductFields = exports.formatCurrency = void 0;
4
+ const duration_1 = require("./duration");
5
+ /**
6
+ * Format in the PRODUCT's currency, not the device's. Falls back to a plain
7
+ * `amount currencyCode` string if Intl rejects the code, so a bad code degrades
8
+ * to something readable instead of throwing mid-render.
9
+ */
10
+ const formatCurrency = (amount, currencyCode, locale) => {
11
+ try {
12
+ return new Intl.NumberFormat(locale, {
13
+ style: "currency",
14
+ currency: currencyCode,
15
+ }).format(amount);
16
+ }
17
+ catch (_a) {
18
+ return `${amount.toFixed(2)} ${currencyCode}`;
19
+ }
20
+ };
21
+ exports.formatCurrency = formatCurrency;
22
+ const perDay = (p) => {
23
+ const days = (0, duration_1.parseIsoDuration)(p.periodIso);
24
+ if (!days || days <= 0)
25
+ return null;
26
+ return p.priceAmount / days;
27
+ };
28
+ /**
29
+ * Derived fields for one product. `compareTo` enables `savingsPct`, computed on
30
+ * a normalized per-day basis so a yearly plan can be compared to a monthly one.
31
+ * These are FRAMING values ("$1.15/week"), never presented as the charged amount.
32
+ */
33
+ const deriveProductFields = (p, opts = {}) => {
34
+ var _a;
35
+ const { compareTo, locale } = opts;
36
+ const out = {};
37
+ const daily = perDay(p);
38
+ if (daily != null) {
39
+ const week = daily * 7;
40
+ const month = daily * 30;
41
+ const year = daily * 365;
42
+ out.pricePerWeekAmount = week;
43
+ out.pricePerWeek = (0, exports.formatCurrency)(week, p.currencyCode, locale);
44
+ out.pricePerMonthAmount = month;
45
+ out.pricePerMonth = (0, exports.formatCurrency)(month, p.currencyCode, locale);
46
+ out.pricePerYearAmount = year;
47
+ out.pricePerYear = (0, exports.formatCurrency)(year, p.currencyCode, locale);
48
+ }
49
+ if (compareTo) {
50
+ const otherDaily = perDay(compareTo);
51
+ if (daily != null && otherDaily != null && otherDaily > 0 && daily < otherDaily) {
52
+ out.savingsPct = Math.round((1 - daily / otherDaily) * 100);
53
+ }
54
+ }
55
+ if (p.trial) {
56
+ const days = p.trial.days > 0
57
+ ? p.trial.days
58
+ : ((_a = (0, duration_1.parseIsoDuration)(`P${p.trial.periodCount}${p.trial.period === "week" ? "W" : p.trial.period === "month" ? "M" : p.trial.period === "year" ? "Y" : "D"}`)) !== null && _a !== void 0 ? _a : 0);
59
+ if (days > 0)
60
+ out.trialDays = days;
61
+ }
62
+ return out;
63
+ };
64
+ exports.deriveProductFields = deriveProductFields;
65
+ /** Derive every product, keyed by its ref key, resolving `compareTo` between them. */
66
+ const deriveAll = (products, refs, locale) => {
67
+ const byKey = new Map(products.map((p) => [p.key, p]));
68
+ const out = {};
69
+ for (const ref of refs) {
70
+ const p = byKey.get(ref.key);
71
+ if (!p)
72
+ continue;
73
+ const compareTo = ref.compareTo ? byKey.get(ref.compareTo) : undefined;
74
+ out[ref.key] = Object.assign(Object.assign({}, p), (0, exports.deriveProductFields)(p, { compareTo, locale }));
75
+ }
76
+ return out;
77
+ };
78
+ exports.deriveAll = deriveAll;
79
+ //# sourceMappingURL=derive.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"derive.js","sourceRoot":"","sources":["../../src/products/derive.ts"],"names":[],"mappings":";;;AAAA,yCAA8C;AAQ9C;;;;GAIG;AACI,MAAM,cAAc,GAAG,CAC5B,MAAc,EACd,YAAoB,EACpB,MAAe,EACP,EAAE;IACV,IAAI,CAAC;QACH,OAAO,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE;YACnC,KAAK,EAAE,UAAU;YACjB,QAAQ,EAAE,YAAY;SACvB,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACpB,CAAC;IAAC,WAAM,CAAC;QACP,OAAO,GAAG,MAA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,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IACvD,MAAM,GAAG,GAAuC,EAAE,CAAC;IACnD,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,MAAM,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC7B,IAAI,CAAC,CAAC;YAAE,SAAS;QACjB,MAAM,SAAS,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QACvE,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,mCAAQ,CAAC,GAAK,IAAA,2BAAmB,EAAC,CAAC,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC,CAAE,CAAC;IAC5E,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AAdW,QAAA,SAAS,aAcpB"}
@@ -0,0 +1,3 @@
1
+ /** ISO-8601 period → whole days. `null` when unparseable or empty (bare "P"). */
2
+ export declare const parseIsoDuration: (iso: string | null | undefined) => number | null;
3
+ //# sourceMappingURL=duration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"duration.d.ts","sourceRoot":"","sources":["../../src/products/duration.ts"],"names":[],"mappings":"AAOA,iFAAiF;AACjF,eAAO,MAAM,gBAAgB,GAAI,KAAK,MAAM,GAAG,IAAI,GAAG,SAAS,KAAG,MAAM,GAAG,IAY1E,CAAC"}