@chipmobilesdk/rn-payment 0.6.0 → 0.7.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 (295) hide show
  1. package/CHANGELOG.md +111 -0
  2. package/README.md +1 -1
  3. package/lib/commonjs/adapter/createStoreProvider.js +110 -0
  4. package/lib/commonjs/adapter/createStoreProvider.js.map +1 -0
  5. package/lib/commonjs/adapter/iap-adapter.js +393 -0
  6. package/lib/commonjs/adapter/iap-adapter.js.map +1 -0
  7. package/lib/commonjs/adapter/iapShapes.js +169 -0
  8. package/lib/commonjs/adapter/iapShapes.js.map +1 -0
  9. package/lib/commonjs/adapter/port.js +6 -0
  10. package/lib/commonjs/adapter/port.js.map +1 -0
  11. package/lib/commonjs/config/types.js +2 -0
  12. package/lib/commonjs/config/types.js.map +1 -0
  13. package/lib/commonjs/config/validate.js +181 -0
  14. package/lib/commonjs/config/validate.js.map +1 -0
  15. package/lib/commonjs/core/mutex.js +31 -0
  16. package/lib/commonjs/core/mutex.js.map +1 -0
  17. package/lib/commonjs/core/retry.js +37 -0
  18. package/lib/commonjs/core/retry.js.map +1 -0
  19. package/lib/commonjs/core/timers.js +207 -0
  20. package/lib/commonjs/core/timers.js.map +1 -0
  21. package/lib/commonjs/diagnostics/errors.js +83 -0
  22. package/lib/commonjs/diagnostics/errors.js.map +1 -0
  23. package/lib/commonjs/diagnostics/events.js +126 -0
  24. package/lib/commonjs/diagnostics/events.js.map +1 -0
  25. package/lib/commonjs/diagnostics/messageKeys.js +70 -0
  26. package/lib/commonjs/diagnostics/messageKeys.js.map +1 -0
  27. package/lib/commonjs/engine/connection.js +189 -0
  28. package/lib/commonjs/engine/connection.js.map +1 -0
  29. package/lib/commonjs/engine/engine.js +279 -0
  30. package/lib/commonjs/engine/engine.js.map +1 -0
  31. package/lib/commonjs/engine/finalize.js +325 -0
  32. package/lib/commonjs/engine/finalize.js.map +1 -0
  33. package/lib/commonjs/engine/foreground.js +26 -0
  34. package/lib/commonjs/engine/foreground.js.map +1 -0
  35. package/lib/commonjs/engine/internals.js +31 -0
  36. package/lib/commonjs/engine/internals.js.map +1 -0
  37. package/lib/commonjs/engine/pending.js +102 -0
  38. package/lib/commonjs/engine/pending.js.map +1 -0
  39. package/lib/commonjs/engine/products.js +198 -0
  40. package/lib/commonjs/engine/products.js.map +1 -0
  41. package/lib/commonjs/engine/purchase.js +395 -0
  42. package/lib/commonjs/engine/purchase.js.map +1 -0
  43. package/lib/commonjs/engine/purchaseFailure.js +77 -0
  44. package/lib/commonjs/engine/purchaseFailure.js.map +1 -0
  45. package/lib/commonjs/engine/receiptValidation.js +90 -0
  46. package/lib/commonjs/engine/receiptValidation.js.map +1 -0
  47. package/lib/commonjs/engine/state.js +201 -0
  48. package/lib/commonjs/engine/state.js.map +1 -0
  49. package/lib/commonjs/engine/subscriptions.js +122 -0
  50. package/lib/commonjs/engine/subscriptions.js.map +1 -0
  51. package/lib/commonjs/engine/sync.js +163 -0
  52. package/lib/commonjs/engine/sync.js.map +1 -0
  53. package/lib/commonjs/entitlements/aggregate.js +212 -0
  54. package/lib/commonjs/entitlements/aggregate.js.map +1 -0
  55. package/lib/commonjs/entitlements/mapping.js +41 -0
  56. package/lib/commonjs/entitlements/mapping.js.map +1 -0
  57. package/lib/commonjs/entitlements/policy.js +110 -0
  58. package/lib/commonjs/entitlements/policy.js.map +1 -0
  59. package/lib/commonjs/index.js +266 -0
  60. package/lib/commonjs/index.js.map +1 -0
  61. package/lib/commonjs/package.json +1 -0
  62. package/lib/commonjs/persistence/mmkv-store.js +149 -0
  63. package/lib/commonjs/persistence/mmkv-store.js.map +1 -0
  64. package/lib/commonjs/persistence/snapshot.js +229 -0
  65. package/lib/commonjs/persistence/snapshot.js.map +1 -0
  66. package/lib/commonjs/react/PaymentProvider.js +96 -0
  67. package/lib/commonjs/react/PaymentProvider.js.map +1 -0
  68. package/lib/commonjs/react/hooks.js +202 -0
  69. package/lib/commonjs/react/hooks.js.map +1 -0
  70. package/lib/commonjs/testing/conformance.js +136 -0
  71. package/lib/commonjs/testing/conformance.js.map +1 -0
  72. package/lib/commonjs/testing/fakeStore.js +281 -0
  73. package/lib/commonjs/testing/fakeStore.js.map +1 -0
  74. package/lib/commonjs/testing/index.js +45 -0
  75. package/lib/commonjs/testing/index.js.map +1 -0
  76. package/lib/module/adapter/createStoreProvider.js +106 -0
  77. package/lib/module/adapter/createStoreProvider.js.map +1 -0
  78. package/lib/module/adapter/iap-adapter.js +383 -0
  79. package/lib/module/adapter/iap-adapter.js.map +1 -0
  80. package/lib/module/adapter/iapShapes.js +160 -0
  81. package/lib/module/adapter/iapShapes.js.map +1 -0
  82. package/lib/module/adapter/port.js +4 -0
  83. package/lib/module/adapter/port.js.map +1 -0
  84. package/lib/module/config/types.js +2 -0
  85. package/lib/module/config/types.js.map +1 -0
  86. package/lib/module/config/validate.js +175 -0
  87. package/lib/module/config/validate.js.map +1 -0
  88. package/lib/module/core/mutex.js +22 -0
  89. package/lib/module/core/mutex.js.map +1 -0
  90. package/lib/module/core/retry.js +33 -0
  91. package/lib/module/core/retry.js.map +1 -0
  92. package/lib/module/core/timers.js +198 -0
  93. package/lib/module/core/timers.js.map +1 -0
  94. package/lib/module/diagnostics/errors.js +76 -0
  95. package/lib/module/diagnostics/errors.js.map +1 -0
  96. package/lib/module/diagnostics/events.js +117 -0
  97. package/lib/module/diagnostics/events.js.map +1 -0
  98. package/lib/module/diagnostics/messageKeys.js +64 -0
  99. package/lib/module/diagnostics/messageKeys.js.map +1 -0
  100. package/lib/module/engine/connection.js +185 -0
  101. package/lib/module/engine/connection.js.map +1 -0
  102. package/lib/module/engine/engine.js +274 -0
  103. package/lib/module/engine/engine.js.map +1 -0
  104. package/lib/module/engine/finalize.js +322 -0
  105. package/lib/module/engine/finalize.js.map +1 -0
  106. package/lib/module/engine/foreground.js +21 -0
  107. package/lib/module/engine/foreground.js.map +1 -0
  108. package/lib/module/engine/internals.js +26 -0
  109. package/lib/module/engine/internals.js.map +1 -0
  110. package/lib/module/engine/pending.js +95 -0
  111. package/lib/module/engine/pending.js.map +1 -0
  112. package/lib/module/engine/products.js +195 -0
  113. package/lib/module/engine/products.js.map +1 -0
  114. package/lib/module/engine/purchase.js +390 -0
  115. package/lib/module/engine/purchase.js.map +1 -0
  116. package/lib/module/engine/purchaseFailure.js +72 -0
  117. package/lib/module/engine/purchaseFailure.js.map +1 -0
  118. package/lib/module/engine/receiptValidation.js +87 -0
  119. package/lib/module/engine/receiptValidation.js.map +1 -0
  120. package/lib/module/engine/state.js +196 -0
  121. package/lib/module/engine/state.js.map +1 -0
  122. package/lib/module/engine/subscriptions.js +119 -0
  123. package/lib/module/engine/subscriptions.js.map +1 -0
  124. package/lib/module/engine/sync.js +158 -0
  125. package/lib/module/engine/sync.js.map +1 -0
  126. package/lib/module/entitlements/aggregate.js +204 -0
  127. package/lib/module/entitlements/aggregate.js.map +1 -0
  128. package/lib/module/entitlements/mapping.js +35 -0
  129. package/lib/module/entitlements/mapping.js.map +1 -0
  130. package/lib/module/entitlements/policy.js +104 -0
  131. package/lib/module/entitlements/policy.js.map +1 -0
  132. package/lib/module/index.js +59 -0
  133. package/lib/module/index.js.map +1 -0
  134. package/lib/module/package.json +1 -0
  135. package/lib/module/persistence/mmkv-store.js +144 -0
  136. package/lib/module/persistence/mmkv-store.js.map +1 -0
  137. package/lib/module/persistence/snapshot.js +221 -0
  138. package/lib/module/persistence/snapshot.js.map +1 -0
  139. package/lib/module/react/PaymentProvider.js +90 -0
  140. package/lib/module/react/PaymentProvider.js.map +1 -0
  141. package/lib/module/react/hooks.js +192 -0
  142. package/lib/module/react/hooks.js.map +1 -0
  143. package/lib/module/testing/conformance.js +130 -0
  144. package/lib/module/testing/conformance.js.map +1 -0
  145. package/lib/module/testing/fakeStore.js +276 -0
  146. package/lib/module/testing/fakeStore.js.map +1 -0
  147. package/lib/module/testing/index.js +13 -0
  148. package/lib/module/testing/index.js.map +1 -0
  149. package/lib/typescript/commonjs/adapter/createStoreProvider.d.ts +45 -0
  150. package/lib/typescript/commonjs/adapter/createStoreProvider.d.ts.map +1 -0
  151. package/lib/typescript/commonjs/adapter/iap-adapter.d.ts +80 -0
  152. package/lib/typescript/commonjs/adapter/iap-adapter.d.ts.map +1 -0
  153. package/lib/typescript/commonjs/adapter/iapShapes.d.ts +94 -0
  154. package/lib/typescript/commonjs/adapter/iapShapes.d.ts.map +1 -0
  155. package/lib/typescript/commonjs/adapter/port.d.ts +184 -0
  156. package/lib/typescript/commonjs/adapter/port.d.ts.map +1 -0
  157. package/lib/typescript/commonjs/config/types.d.ts +326 -0
  158. package/lib/typescript/commonjs/config/types.d.ts.map +1 -0
  159. package/lib/typescript/commonjs/config/validate.d.ts +63 -0
  160. package/lib/typescript/commonjs/config/validate.d.ts.map +1 -0
  161. package/lib/typescript/commonjs/core/mutex.d.ts +17 -0
  162. package/lib/typescript/commonjs/core/mutex.d.ts.map +1 -0
  163. package/lib/typescript/commonjs/core/retry.d.ts +19 -0
  164. package/lib/typescript/commonjs/core/retry.d.ts.map +1 -0
  165. package/lib/typescript/commonjs/core/timers.d.ts +142 -0
  166. package/lib/typescript/commonjs/core/timers.d.ts.map +1 -0
  167. package/lib/typescript/commonjs/diagnostics/errors.d.ts +55 -0
  168. package/lib/typescript/commonjs/diagnostics/errors.d.ts.map +1 -0
  169. package/lib/typescript/commonjs/diagnostics/events.d.ts +158 -0
  170. package/lib/typescript/commonjs/diagnostics/events.d.ts.map +1 -0
  171. package/lib/typescript/commonjs/diagnostics/messageKeys.d.ts +54 -0
  172. package/lib/typescript/commonjs/diagnostics/messageKeys.d.ts.map +1 -0
  173. package/lib/typescript/commonjs/engine/connection.d.ts +30 -0
  174. package/lib/typescript/commonjs/engine/connection.d.ts.map +1 -0
  175. package/lib/typescript/commonjs/engine/engine.d.ts +93 -0
  176. package/lib/typescript/commonjs/engine/engine.d.ts.map +1 -0
  177. package/lib/typescript/commonjs/engine/finalize.d.ts +53 -0
  178. package/lib/typescript/commonjs/engine/finalize.d.ts.map +1 -0
  179. package/lib/typescript/commonjs/engine/foreground.d.ts +15 -0
  180. package/lib/typescript/commonjs/engine/foreground.d.ts.map +1 -0
  181. package/lib/typescript/commonjs/engine/internals.d.ts +28 -0
  182. package/lib/typescript/commonjs/engine/internals.d.ts.map +1 -0
  183. package/lib/typescript/commonjs/engine/pending.d.ts +51 -0
  184. package/lib/typescript/commonjs/engine/pending.d.ts.map +1 -0
  185. package/lib/typescript/commonjs/engine/products.d.ts +82 -0
  186. package/lib/typescript/commonjs/engine/products.d.ts.map +1 -0
  187. package/lib/typescript/commonjs/engine/purchase.d.ts +61 -0
  188. package/lib/typescript/commonjs/engine/purchase.d.ts.map +1 -0
  189. package/lib/typescript/commonjs/engine/purchaseFailure.d.ts +15 -0
  190. package/lib/typescript/commonjs/engine/purchaseFailure.d.ts.map +1 -0
  191. package/lib/typescript/commonjs/engine/receiptValidation.d.ts +42 -0
  192. package/lib/typescript/commonjs/engine/receiptValidation.d.ts.map +1 -0
  193. package/lib/typescript/commonjs/engine/state.d.ts +46 -0
  194. package/lib/typescript/commonjs/engine/state.d.ts.map +1 -0
  195. package/lib/typescript/commonjs/engine/subscriptions.d.ts +61 -0
  196. package/lib/typescript/commonjs/engine/subscriptions.d.ts.map +1 -0
  197. package/lib/typescript/commonjs/engine/sync.d.ts +36 -0
  198. package/lib/typescript/commonjs/engine/sync.d.ts.map +1 -0
  199. package/lib/typescript/commonjs/entitlements/aggregate.d.ts +97 -0
  200. package/lib/typescript/commonjs/entitlements/aggregate.d.ts.map +1 -0
  201. package/lib/typescript/commonjs/entitlements/mapping.d.ts +27 -0
  202. package/lib/typescript/commonjs/entitlements/mapping.d.ts.map +1 -0
  203. package/lib/typescript/commonjs/entitlements/policy.d.ts +75 -0
  204. package/lib/typescript/commonjs/entitlements/policy.d.ts.map +1 -0
  205. package/lib/typescript/commonjs/index.d.ts +44 -0
  206. package/lib/typescript/commonjs/index.d.ts.map +1 -0
  207. package/lib/typescript/commonjs/package.json +1 -0
  208. package/lib/typescript/commonjs/persistence/mmkv-store.d.ts +45 -0
  209. package/lib/typescript/commonjs/persistence/mmkv-store.d.ts.map +1 -0
  210. package/lib/typescript/commonjs/persistence/snapshot.d.ts +106 -0
  211. package/lib/typescript/commonjs/persistence/snapshot.d.ts.map +1 -0
  212. package/lib/typescript/commonjs/react/PaymentProvider.d.ts +57 -0
  213. package/lib/typescript/commonjs/react/PaymentProvider.d.ts.map +1 -0
  214. package/lib/typescript/commonjs/react/hooks.d.ts +80 -0
  215. package/lib/typescript/commonjs/react/hooks.d.ts.map +1 -0
  216. package/lib/typescript/commonjs/testing/conformance.d.ts +41 -0
  217. package/lib/typescript/commonjs/testing/conformance.d.ts.map +1 -0
  218. package/lib/typescript/commonjs/testing/fakeStore.d.ts +69 -0
  219. package/lib/typescript/commonjs/testing/fakeStore.d.ts.map +1 -0
  220. package/lib/typescript/commonjs/testing/index.d.ts +12 -0
  221. package/lib/typescript/commonjs/testing/index.d.ts.map +1 -0
  222. package/lib/typescript/module/adapter/createStoreProvider.d.ts +45 -0
  223. package/lib/typescript/module/adapter/createStoreProvider.d.ts.map +1 -0
  224. package/lib/typescript/module/adapter/iap-adapter.d.ts +80 -0
  225. package/lib/typescript/module/adapter/iap-adapter.d.ts.map +1 -0
  226. package/lib/typescript/module/adapter/iapShapes.d.ts +94 -0
  227. package/lib/typescript/module/adapter/iapShapes.d.ts.map +1 -0
  228. package/lib/typescript/module/adapter/port.d.ts +184 -0
  229. package/lib/typescript/module/adapter/port.d.ts.map +1 -0
  230. package/lib/typescript/module/config/types.d.ts +326 -0
  231. package/lib/typescript/module/config/types.d.ts.map +1 -0
  232. package/lib/typescript/module/config/validate.d.ts +63 -0
  233. package/lib/typescript/module/config/validate.d.ts.map +1 -0
  234. package/lib/typescript/module/core/mutex.d.ts +17 -0
  235. package/lib/typescript/module/core/mutex.d.ts.map +1 -0
  236. package/lib/typescript/module/core/retry.d.ts +19 -0
  237. package/lib/typescript/module/core/retry.d.ts.map +1 -0
  238. package/lib/typescript/module/core/timers.d.ts +142 -0
  239. package/lib/typescript/module/core/timers.d.ts.map +1 -0
  240. package/lib/typescript/module/diagnostics/errors.d.ts +55 -0
  241. package/lib/typescript/module/diagnostics/errors.d.ts.map +1 -0
  242. package/lib/typescript/module/diagnostics/events.d.ts +158 -0
  243. package/lib/typescript/module/diagnostics/events.d.ts.map +1 -0
  244. package/lib/typescript/module/diagnostics/messageKeys.d.ts +54 -0
  245. package/lib/typescript/module/diagnostics/messageKeys.d.ts.map +1 -0
  246. package/lib/typescript/module/engine/connection.d.ts +30 -0
  247. package/lib/typescript/module/engine/connection.d.ts.map +1 -0
  248. package/lib/typescript/module/engine/engine.d.ts +93 -0
  249. package/lib/typescript/module/engine/engine.d.ts.map +1 -0
  250. package/lib/typescript/module/engine/finalize.d.ts +53 -0
  251. package/lib/typescript/module/engine/finalize.d.ts.map +1 -0
  252. package/lib/typescript/module/engine/foreground.d.ts +15 -0
  253. package/lib/typescript/module/engine/foreground.d.ts.map +1 -0
  254. package/lib/typescript/module/engine/internals.d.ts +28 -0
  255. package/lib/typescript/module/engine/internals.d.ts.map +1 -0
  256. package/lib/typescript/module/engine/pending.d.ts +51 -0
  257. package/lib/typescript/module/engine/pending.d.ts.map +1 -0
  258. package/lib/typescript/module/engine/products.d.ts +82 -0
  259. package/lib/typescript/module/engine/products.d.ts.map +1 -0
  260. package/lib/typescript/module/engine/purchase.d.ts +61 -0
  261. package/lib/typescript/module/engine/purchase.d.ts.map +1 -0
  262. package/lib/typescript/module/engine/purchaseFailure.d.ts +15 -0
  263. package/lib/typescript/module/engine/purchaseFailure.d.ts.map +1 -0
  264. package/lib/typescript/module/engine/receiptValidation.d.ts +42 -0
  265. package/lib/typescript/module/engine/receiptValidation.d.ts.map +1 -0
  266. package/lib/typescript/module/engine/state.d.ts +46 -0
  267. package/lib/typescript/module/engine/state.d.ts.map +1 -0
  268. package/lib/typescript/module/engine/subscriptions.d.ts +61 -0
  269. package/lib/typescript/module/engine/subscriptions.d.ts.map +1 -0
  270. package/lib/typescript/module/engine/sync.d.ts +36 -0
  271. package/lib/typescript/module/engine/sync.d.ts.map +1 -0
  272. package/lib/typescript/module/entitlements/aggregate.d.ts +97 -0
  273. package/lib/typescript/module/entitlements/aggregate.d.ts.map +1 -0
  274. package/lib/typescript/module/entitlements/mapping.d.ts +27 -0
  275. package/lib/typescript/module/entitlements/mapping.d.ts.map +1 -0
  276. package/lib/typescript/module/entitlements/policy.d.ts +75 -0
  277. package/lib/typescript/module/entitlements/policy.d.ts.map +1 -0
  278. package/lib/typescript/module/index.d.ts +44 -0
  279. package/lib/typescript/module/index.d.ts.map +1 -0
  280. package/lib/typescript/module/package.json +1 -0
  281. package/lib/typescript/module/persistence/mmkv-store.d.ts +45 -0
  282. package/lib/typescript/module/persistence/mmkv-store.d.ts.map +1 -0
  283. package/lib/typescript/module/persistence/snapshot.d.ts +106 -0
  284. package/lib/typescript/module/persistence/snapshot.d.ts.map +1 -0
  285. package/lib/typescript/module/react/PaymentProvider.d.ts +57 -0
  286. package/lib/typescript/module/react/PaymentProvider.d.ts.map +1 -0
  287. package/lib/typescript/module/react/hooks.d.ts +80 -0
  288. package/lib/typescript/module/react/hooks.d.ts.map +1 -0
  289. package/lib/typescript/module/testing/conformance.d.ts +41 -0
  290. package/lib/typescript/module/testing/conformance.d.ts.map +1 -0
  291. package/lib/typescript/module/testing/fakeStore.d.ts +69 -0
  292. package/lib/typescript/module/testing/fakeStore.d.ts.map +1 -0
  293. package/lib/typescript/module/testing/index.d.ts +12 -0
  294. package/lib/typescript/module/testing/index.d.ts.map +1 -0
  295. package/package.json +49 -13
@@ -0,0 +1,326 @@
1
+ /**
2
+ * Public configuration and catalog types.
3
+ *
4
+ * Nothing here names Google Play Billing, `react-native-iap`, or any store
5
+ * concept (FR-002). Apps speak in **product keys** and **entitlement keys** they
6
+ * chose themselves; store product identifiers appear only inside catalog
7
+ * configuration, never in app logic (FR-003).
8
+ */
9
+ /** An app-chosen logical entitlement, e.g. `no_ads`. What business logic asks about. */
10
+ export type EntitlementKey = string;
11
+ /** An app-chosen logical product, e.g. `premium_yearly`. Never a store identifier. */
12
+ export type ProductKey = string;
13
+ /**
14
+ * How a product behaves once bought.
15
+ *
16
+ * `one_time_permanent` — bought once, kept forever.
17
+ * `one_time_consumable` — bought, used up by the app, buyable again (FR-043).
18
+ * `subscription` — recurring, with its own lifecycle (FR-048).
19
+ */
20
+ export type ProductType = 'one_time_permanent' | 'one_time_consumable' | 'subscription';
21
+ /** Store identifiers per platform. iOS is optional and additive (FR-007). */
22
+ export interface StoreProductIds {
23
+ android?: string;
24
+ ios?: string;
25
+ }
26
+ /** One product the app sells, and what it unlocks. */
27
+ export interface CatalogEntry {
28
+ productKey: ProductKey;
29
+ productType: ProductType;
30
+ storeProductIds: StoreProductIds;
31
+ /** Entitlement keys this product confers. Many-to-many is supported (FR-010). */
32
+ grants: EntitlementKey[];
33
+ }
34
+ /** Separately configurable, and the basis of the production-transaction guard. */
35
+ export type Environment = 'development' | 'test' | 'production';
36
+ /**
37
+ * Entitlement policy for a subscription whose renewal payment failed.
38
+ *
39
+ * Kept configurable because it is a business decision, not a technical constant
40
+ * (FR-049). See `entitlements/policy.ts` for the defaults and why.
41
+ */
42
+ export type LapsePolicy = 'grant' | 'withhold';
43
+ /** What to do when a configured validation hook cannot be reached (FR-072). */
44
+ export type ValidationUnavailablePolicy = 'grant_and_queue' | 'withhold';
45
+ /** Returned by every subscribe call. Idempotent and safe to call twice (FR-006). */
46
+ export type Unsubscribe = () => void;
47
+ export interface TimeoutConfig {
48
+ connectMs?: number;
49
+ productQueryMs?: number;
50
+ syncMs?: number;
51
+ /** Covers opening the store surface only. Time the user spends in it is not counted (FR-035). */
52
+ purchaseLaunchMs?: number;
53
+ /** Bounds each acknowledge or consume call; a timed-out attempt is retried. */
54
+ finalizeAttemptMs?: number;
55
+ /**
56
+ * Bounds the app's `validateTransaction` hook. A hook that does not answer in
57
+ * time is treated as unavailable, exactly like one that throws (FR-072b).
58
+ * Added in 0.3.2.
59
+ */
60
+ validateMs?: number;
61
+ }
62
+ export interface RetryConfig {
63
+ reconnect?: BackoffConfig;
64
+ finalize?: BackoffConfig;
65
+ }
66
+ export interface BackoffConfig {
67
+ initialDelayMs?: number;
68
+ maxDelayMs?: number;
69
+ factor?: number;
70
+ /** Attempts per session. Finalize is resumed next session rather than abandoned (FR-045). */
71
+ maxAttempts?: number;
72
+ jitter?: boolean;
73
+ }
74
+ /** What the app's backend is asked to decide about (FR-069). */
75
+ export interface ValidationCandidate {
76
+ productKey: ProductKey;
77
+ productType: ProductType;
78
+ /** Opaque verification material for the backend. Never logged (FR-074). */
79
+ verificationPayload: string;
80
+ /** Ties this decision to one purchase cycle in the event stream (FR-076). */
81
+ correlationId: string;
82
+ /**
83
+ * The store's identifier for this transaction (Play's order id). Not a secret,
84
+ * and the only handle a backend has on re-validation, where
85
+ * `verificationPayload` is empty because it is never persisted. Added in 0.3.2.
86
+ */
87
+ transactionId: string;
88
+ /** Which store issued the transaction, so a backend picks the right API. Added in 0.3.2. */
89
+ platform: 'android' | 'ios';
90
+ }
91
+ export interface ValidationDecision {
92
+ approved: boolean;
93
+ /** Optional app-supplied reason, surfaced as a distinguishable outcome (FR-071). */
94
+ reason?: string;
95
+ }
96
+ export type ValidationHook = (candidate: ValidationCandidate) => Promise<ValidationDecision>;
97
+ /** Diagnostics sink. Deliberately not tied to any analytics vendor (FR-080). */
98
+ export interface LoggerAdapter {
99
+ debug?(message: string, meta?: Record<string, unknown>): void;
100
+ warn?(message: string, meta?: Record<string, unknown>): void;
101
+ error?(message: string, meta?: Record<string, unknown>): void;
102
+ }
103
+ export interface PaymentConfig {
104
+ catalog: CatalogEntry[];
105
+ /** Entitlement keys the app intends to query. Used for orphan detection (FR-011). */
106
+ entitlements: EntitlementKey[];
107
+ environment: Environment;
108
+ /**
109
+ * Whether the running binary is a production build.
110
+ *
111
+ * Supplied by the app because only the app knows how it was built. Drives the
112
+ * fail-closed guard: a non-production build declaring `production` must not
113
+ * proceed (FR-015).
114
+ */
115
+ isProductionBuild: boolean;
116
+ /**
117
+ * Lets a non-production build complete purchases through the real store, so a
118
+ * Play license tester can buy on a debug build (PAY-16). Accepted only with
119
+ * `environment: 'test'`; any other environment rejects it at startup. License
120
+ * testers are not charged; any other account on the device would be, so keep
121
+ * it out of builds that reach real users.
122
+ */
123
+ allowStoreTestPurchases?: boolean;
124
+ /**
125
+ * Global sell switch. When false, purchases report `disabled` but entitlements
126
+ * already held stay readable — turning off selling is not the same as taking
127
+ * away what someone bought (FR-012).
128
+ */
129
+ enabled?: boolean;
130
+ gracePolicy?: LapsePolicy;
131
+ holdPolicy?: LapsePolicy;
132
+ staleAfterMs?: number;
133
+ productCacheTtlMs?: number;
134
+ foregroundSyncMinIntervalMs?: number;
135
+ timeouts?: TimeoutConfig;
136
+ retry?: RetryConfig;
137
+ /**
138
+ * Opaque cache-partition key (FR-057a).
139
+ *
140
+ * Not a user identifier: the package never interprets it, transmits it, or
141
+ * attaches it to a transaction. Changing it makes the previous snapshot
142
+ * unreadable, so a second app-account user cannot inherit the first one's
143
+ * entitlements even if the app forgets to call `clearLocalData`.
144
+ */
145
+ scopeToken?: string;
146
+ validateTransaction?: ValidationHook;
147
+ onValidationUnavailable?: ValidationUnavailablePolicy;
148
+ logger?: LoggerAdapter;
149
+ }
150
+ /** Opaque handle for a transaction. Exposes no raw store record (FR-051). */
151
+ export interface TransactionRef {
152
+ readonly transactionId: string;
153
+ readonly productKey: ProductKey;
154
+ }
155
+ export interface PurchaseOptions {
156
+ /**
157
+ * The app's obfuscated account identifier, passed straight through to the
158
+ * store for fraud prevention. Never generated, inferred, or persisted by the
159
+ * package (FR-034), and distinct from `scopeToken`.
160
+ */
161
+ obfuscatedAccountId?: string;
162
+ /** Which pricing option to buy, for a subscription with several offers. */
163
+ offerKey?: string;
164
+ }
165
+ /**
166
+ * Every way a purchase can end (FR-005).
167
+ *
168
+ * A discriminated union rather than a boolean plus an error, because the app has
169
+ * to tell these apart: `user_cancelled` is a normal outcome to stay quiet about,
170
+ * `pending` means wait, `already_owned` means re-sync, and `store_error` means
171
+ * show something. Collapsing them is how apps end up reporting a cancellation as
172
+ * a failure.
173
+ */
174
+ export type PurchaseResult = {
175
+ kind: 'success';
176
+ productKey: ProductKey;
177
+ transaction: TransactionRef;
178
+ }
179
+ /** Money has not arrived. No entitlement is granted (FR-037). */
180
+ | {
181
+ kind: 'pending';
182
+ productKey: ProductKey;
183
+ transaction: TransactionRef;
184
+ }
185
+ /** Normal, not an error. Must never be recorded as a technical failure (FR-032). */
186
+ | {
187
+ kind: 'user_cancelled';
188
+ productKey: ProductKey;
189
+ }
190
+ /** Triggers a re-sync: this is how a reinstall repairs itself (FR-033). */
191
+ | {
192
+ kind: 'already_owned';
193
+ productKey: ProductKey;
194
+ } | {
195
+ kind: 'ineligible';
196
+ productKey: ProductKey;
197
+ } | {
198
+ kind: 'unknown_product';
199
+ productKey: ProductKey;
200
+ } | {
201
+ kind: 'product_unavailable_in_region';
202
+ productKey: ProductKey;
203
+ }
204
+ /** Global sell switch is off (FR-012). */
205
+ | {
206
+ kind: 'disabled';
207
+ } | {
208
+ kind: 'not_ready';
209
+ status: PaymentStatusKind;
210
+ } | {
211
+ kind: 'unsupported';
212
+ }
213
+ /** A second purchase while one is open. Refused, never queued (FR-031). */
214
+ | {
215
+ kind: 'purchase_in_progress';
216
+ }
217
+ /** Refused because this build may not create a production transaction (FR-014). */
218
+ | {
219
+ kind: 'environment_blocked';
220
+ productKey: ProductKey;
221
+ environment: Environment;
222
+ }
223
+ /** The app's backend said no (FR-071). Distinguishable from a network failure. */
224
+ | {
225
+ kind: 'validation_rejected';
226
+ productKey: ProductKey;
227
+ reason?: string;
228
+ } | {
229
+ kind: 'timeout';
230
+ productKey: ProductKey;
231
+ } | {
232
+ kind: 'network_error';
233
+ productKey: ProductKey;
234
+ } | {
235
+ kind: 'store_error';
236
+ productKey: ProductKey;
237
+ code: string;
238
+ };
239
+ /**
240
+ * A purchase whose money has not arrived yet (FR-101), added in 0.2.0.
241
+ *
242
+ * One entry per product key, whatever number of pending transactions the store
243
+ * reports for it. Carries no transaction id, token, or store object (FR-051) —
244
+ * enough to render "payment pending" and to withhold Buy, nothing to act on.
245
+ */
246
+ export interface PendingPurchase {
247
+ readonly productKey: ProductKey;
248
+ /** When the store reports the purchase was made, in epoch milliseconds. Earliest if several. */
249
+ readonly since: number;
250
+ }
251
+ /**
252
+ * The pending set, with how far it can be trusted (FR-101, FR-103).
253
+ *
254
+ * Read `status` first. `unknown` follows the entitlement rule exactly: never
255
+ * synced, or synced longer ago than `staleAfterMs`. Under `unknown`, `purchases`
256
+ * still lists what the last good sync saw, but an empty list there does **not**
257
+ * mean "nothing is pending" — the same reason an `unknown` entitlement is not
258
+ * `not_entitled`.
259
+ */
260
+ export interface PendingPurchasesState {
261
+ readonly status: 'known' | 'unknown';
262
+ readonly purchases: readonly PendingPurchase[];
263
+ /** True once the snapshot is older than `staleAfterMs`; `status` is then `unknown`. */
264
+ readonly isStale: boolean;
265
+ }
266
+ /**
267
+ * How a pending purchase ended (FR-102).
268
+ *
269
+ * `settled` — the money arrived; an entitlement grant, if the product confers one,
270
+ * follows. `expired` — the store reported that the pending window ran out.
271
+ * `cancelled` — it ended without payment for any other reason, **including when
272
+ * the store gives none**: Play simply stops reporting a declined or abandoned
273
+ * pending purchase, so on Android every unpaid end is `cancelled`.
274
+ */
275
+ export type PendingResolution = 'settled' | 'cancelled' | 'expired';
276
+ /** Outcome of finalizing or consuming a transaction (FR-044). */
277
+ export type FinalizeResult = {
278
+ kind: 'finalized';
279
+ }
280
+ /** Already done. Idempotent by design, so this is a success, not an error. */
281
+ | {
282
+ kind: 'already_finalized';
283
+ } | {
284
+ kind: 'unknown_transaction';
285
+ }
286
+ /** Queued for bounded retry; the condition stays observable (FR-045). */
287
+ | {
288
+ kind: 'retry_scheduled';
289
+ attempts: number;
290
+ } | {
291
+ kind: 'failed';
292
+ code: string;
293
+ };
294
+ /** A paid transaction not yet settled with the store, surfaced so it is not swallowed. */
295
+ export interface UnfinalizedSummary {
296
+ productKey: ProductKey;
297
+ transactionId: string;
298
+ attempts: number;
299
+ purchasedAt: number;
300
+ }
301
+ /** Observable package status (FR-019). */
302
+ export type PaymentStatusKind = 'not_started' | 'connecting' | 'ready' | 'disabled' | 'unavailable' | 'failed';
303
+ /** Why selling is impossible here, kept distinguishable so apps can tell users why (FR-021). */
304
+ export type UnavailableReason = 'no_billing_service' | 'billing_service_outdated' | 'platform_unsupported';
305
+ /**
306
+ * A purchase the package refused because it could have been a real charge
307
+ * outside production (FR-014).
308
+ *
309
+ * Exposed in status rather than only logged so an automated test can assert the
310
+ * block happened, which is the difference between a guarantee and a hope.
311
+ */
312
+ export interface BlockedOperation {
313
+ productKey: ProductKey;
314
+ environment: Environment;
315
+ at: number;
316
+ }
317
+ export interface PaymentStatus {
318
+ kind: PaymentStatusKind;
319
+ unavailableReason?: UnavailableReason;
320
+ /** Whether retrying initialization could plausibly help (FR-024). */
321
+ retryable?: boolean;
322
+ /** Reconnect attempts made in this session, so a retry storm is visible (FR-020). */
323
+ reconnectAttempts?: number;
324
+ blockedOperations: BlockedOperation[];
325
+ }
326
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/config/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,wFAAwF;AACxF,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC;AAEpC,sFAAsF;AACtF,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC;AAEhC;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GAAG,oBAAoB,GAAG,qBAAqB,GAAG,cAAc,CAAC;AAExF,6EAA6E;AAC7E,MAAM,WAAW,eAAe;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;CACb;AAED,sDAAsD;AACtD,MAAM,WAAW,YAAY;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AE;AACvB,8EAA8E;GAC5E;IAAE,IAAI,EAAE,mBAAmB,CAAA;CAAE,GAC7B;IAAE,IAAI,EAAE,qBAAqB,CAAA;CAAE;AACjC,yEAAyE;GACvE;IAAE,IAAI,EAAE,iBAAiB,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAC7C;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAEpC,0FAA0F;AAC1F,MAAM,WAAW,kBAAkB;IAClC,UAAU,EAAE,UAAU,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;CACpB;AAED,0CAA0C;AAC1C,MAAM,MAAM,iBAAiB,GAC5B,aAAa,GAAG,YAAY,GAAG,OAAO,GAAG,UAAU,GAAG,aAAa,GAAG,QAAQ,CAAC;AAEhF,gGAAgG;AAChG,MAAM,MAAM,iBAAiB,GAC5B,oBAAoB,GAAG,0BAA0B,GAAG,sBAAsB,CAAC;AAE5E;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAChC,UAAU,EAAE,UAAU,CAAC;IACvB,WAAW,EAAE,WAAW,CAAC;IACzB,EAAE,EAAE,MAAM,CAAC;CACX;AAED,MAAM,WAAW,aAAa;IAC7B,IAAI,EAAE,iBAAiB,CAAC;IACxB,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC,qEAAqE;IACrE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,qFAAqF;IACrF,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,iBAAiB,EAAE,gBAAgB,EAAE,CAAC;CACtC"}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Catalog validation (FR-011).
3
+ *
4
+ * Runs at `configure`, before any connection is opened, so a bad catalog fails
5
+ * at configuration time rather than at the moment a user taps Buy. Every failure
6
+ * **names the offending entry** — "invalid catalog" alone is useless in an app
7
+ * with thirty products.
8
+ *
9
+ * All problems are collected rather than thrown one at a time, so a developer
10
+ * fixes the catalog in one pass instead of rerunning to find the next fault.
11
+ */
12
+ import { type ResolvedRetry, type ResolvedTimeouts } from '../core/timers.js';
13
+ import type { CatalogEntry, EntitlementKey, LapsePolicy, PaymentConfig, ProductKey, ValidationUnavailablePolicy } from './types.js';
14
+ /** The platform whose store identifiers a catalog must supply. */
15
+ export type TargetPlatform = 'android' | 'ios';
16
+ /**
17
+ * A validated, indexed catalog plus every resolved policy value.
18
+ *
19
+ * Produced once so the hot paths never re-derive it, and so `getEntitlement` can
20
+ * stay a synchronous in-memory read (PERF-001).
21
+ */
22
+ export interface ResolvedConfig {
23
+ readonly entries: ReadonlyMap<ProductKey, CatalogEntry>;
24
+ /** productKey → entitlement keys it grants. */
25
+ readonly grants: ReadonlyMap<ProductKey, readonly EntitlementKey[]>;
26
+ /** entitlementKey → product keys that can grant it (FR-051, FR-052). */
27
+ readonly sources: ReadonlyMap<EntitlementKey, readonly ProductKey[]>;
28
+ /** storeProductId → productKey, for translating store callbacks back (FR-003). */
29
+ readonly byStoreId: ReadonlyMap<string, ProductKey>;
30
+ readonly entitlementKeys: readonly EntitlementKey[];
31
+ readonly platform: TargetPlatform;
32
+ readonly enabled: boolean;
33
+ readonly gracePolicy: LapsePolicy;
34
+ readonly holdPolicy: LapsePolicy;
35
+ readonly staleAfterMs: number;
36
+ readonly productCacheTtlMs: number;
37
+ readonly foregroundSyncMinIntervalMs: number;
38
+ readonly timeouts: ResolvedTimeouts;
39
+ readonly retry: ResolvedRetry;
40
+ readonly onValidationUnavailable: ValidationUnavailablePolicy;
41
+ }
42
+ export declare function validateConfig(config: PaymentConfig, platform?: TargetPlatform): ResolvedConfig;
43
+ /**
44
+ * The fail-closed environment guard (FR-015).
45
+ *
46
+ * Separate from catalog validation because it is not about the catalog's shape
47
+ * but about whether this binary is allowed to move real money at all. Checked
48
+ * before connecting, and it refuses rather than warns: a non-production build
49
+ * that declares `production` is one tap away from charging a real card, and
50
+ * continuing silently is exactly the failure this package exists to prevent.
51
+ */
52
+ export declare function assertEnvironmentSafe(config: PaymentConfig): void;
53
+ /**
54
+ * Whether this configuration may hand a purchase to a real store (FR-014).
55
+ *
56
+ * True in a production build configured for production, and in a `test`
57
+ * environment that opted in with `allowStoreTestPurchases` (PAY-16). False
58
+ * everywhere else. The engine records each refusal in observable status so a
59
+ * test can assert the block happened — the difference between a guarantee and a
60
+ * hope.
61
+ */
62
+ export declare function mayCreateRealTransaction(config: PaymentConfig): boolean;
63
+ //# sourceMappingURL=validate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../../src/config/validate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAMN,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,MAAM,mBAAgB,CAAC;AACxB,OAAO,KAAK,EACX,YAAY,EACZ,cAAc,EACd,WAAW,EACX,aAAa,EACb,UAAU,EAEV,2BAA2B,EAC3B,MAAM,YAAS,CAAC;AAQjB,kEAAkE;AAClE,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,KAAK,CAAC;AAE/C;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC9B,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;IACxD,+CAA+C;IAC/C,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC,UAAU,EAAE,SAAS,cAAc,EAAE,CAAC,CAAC;IACpE,wEAAwE;IACxE,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,cAAc,EAAE,SAAS,UAAU,EAAE,CAAC,CAAC;IACrE,kFAAkF;IAClF,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACpD,QAAQ,CAAC,eAAe,EAAE,SAAS,cAAc,EAAE,CAAC;IACpD,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAClC,QAAQ,CAAC,UAAU,EAAE,WAAW,CAAC;IACjC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,2BAA2B,EAAE,MAAM,CAAC;IAC7C,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;IACpC,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAC9B,QAAQ,CAAC,uBAAuB,EAAE,2BAA2B,CAAC;CAC9D;AAED,wBAAgB,cAAc,CAC7B,MAAM,EAAE,aAAa,EACrB,QAAQ,GAAE,cAA0B,GAClC,cAAc,CAsHhB;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI,CAsBjE;AAED;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAKvE"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Concurrency primitives.
3
+ *
4
+ * These are what make three of the specification's guarantees structurally true
5
+ * rather than hoped for: concurrent initialization opens exactly one connection
6
+ * (FR-018), concurrent syncs make exactly one store request (FR-063), and a
7
+ * second purchase while one is open is refused rather than queued (FR-031).
8
+ *
9
+ * The distinction between the two primitives matters. `singleFlight` **joins**
10
+ * concurrent callers onto one operation — correct for init and sync, where every
11
+ * caller wants the same answer. `exclusive` **refuses** the second caller —
12
+ * correct for purchase, where joining would silently give two callers one
13
+ * transaction, and queueing would open a store surface the user no longer
14
+ * expects.
15
+ */
16
+ export { createExclusive, createRateLimiter, createSingleFlight, withTimeout, type ExclusiveOutcome, } from '@chipmobilesdk/rn-core';
17
+ //# sourceMappingURL=mutex.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mutex.d.ts","sourceRoot":"","sources":["../../../../src/core/mutex.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,EACN,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,WAAW,EACX,KAAK,gBAAgB,GACrB,MAAM,wBAAwB,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Bounded backoff.
3
+ *
4
+ * "Bounded" is the whole point (FR-020, FR-045): an unbounded reconnect loop
5
+ * against a billing service that is down drains battery and hammers a system
6
+ * service, and an unbounded finalize loop hides a real failure behind noise.
7
+ *
8
+ * Delay computation is pure and separated from waiting so tests can assert the
9
+ * schedule without burning real time.
10
+ */
11
+ import type { BackoffConfig } from '../config/types.js';
12
+ /**
13
+ * Delay before `attempt` (1-based), capped and optionally jittered.
14
+ *
15
+ * Jitter is full jitter over [0, capped]: several devices that lost the billing
16
+ * connection at the same moment should not retry in lockstep.
17
+ */
18
+ export declare function backoffDelayMs(attempt: number, config: Required<BackoffConfig>, random?: () => number): number;
19
+ //# sourceMappingURL=retry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../../../../src/core/retry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAiB,CAAC;AAErD;;;;;GAKG;AACH,wBAAgB,cAAc,CAC7B,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,QAAQ,CAAC,aAAa,CAAC,EAC/B,MAAM,GAAE,MAAM,MAAoB,GAChC,MAAM,CAER"}
@@ -0,0 +1,142 @@
1
+ /**
2
+ * Timeout, retry, and cache policy.
3
+ *
4
+ * Defaults and bounds live here rather than at each call site so there is one
5
+ * place to read what the package will wait for, and so consumers can read the
6
+ * values they are bound by instead of discovering them from a timeout in
7
+ * production.
8
+ *
9
+ * Out-of-band values are a configuration error rather than being silently
10
+ * clamped: quietly turning a 1-second timeout into 3 seconds would tell the app
11
+ * it configured something it did not.
12
+ */
13
+ import type { BackoffConfig, RetryConfig, TimeoutConfig } from '../config/types.js';
14
+ /** Local IPC to Play Services. Slower than this means unavailable, not busy. */
15
+ export declare const DEFAULT_CONNECT_TIMEOUT_MS = 10000;
16
+ /** A network round trip; a paywall that hangs longer should show its error state. */
17
+ export declare const DEFAULT_PRODUCT_QUERY_TIMEOUT_MS = 15000;
18
+ /** Runs at startup, so it must not hold the first render hostage. */
19
+ export declare const DEFAULT_SYNC_TIMEOUT_MS = 20000;
20
+ /**
21
+ * Covers opening the store surface only.
22
+ *
23
+ * Time the user spends *inside* the store's own UI is deliberately excluded
24
+ * (FR-035): a user reading the terms, switching to their banking app for an OTP,
25
+ * or simply hesitating must never have their purchase cancelled by our clock.
26
+ */
27
+ export declare const DEFAULT_PURCHASE_LAUNCH_TIMEOUT_MS = 30000;
28
+ /** Per finalize attempt, not per transaction — the queue owns overall persistence. */
29
+ export declare const DEFAULT_FINALIZE_ATTEMPT_TIMEOUT_MS = 15000;
30
+ /** The app's backend hook. A user is waiting on a purchase result behind it. */
31
+ export declare const DEFAULT_VALIDATE_TIMEOUT_MS = 15000;
32
+ /**
33
+ * The ceiling on a purchase flow whose outcome includes the user's own time in
34
+ * the store UI, so is otherwise untimed (FR-035). Not a timeout on the user: it
35
+ * exists only so a binding that never answers cannot hold the purchase lock for
36
+ * the rest of the session. A purchase that completes later still arrives through
37
+ * the store update channel and is granted then.
38
+ */
39
+ export declare const PURCHASE_FLOW_CEILING_MS: number;
40
+ export declare const CONNECT_TIMEOUT_BOUNDS: {
41
+ readonly min: 3000;
42
+ readonly max: 60000;
43
+ };
44
+ export declare const PRODUCT_QUERY_TIMEOUT_BOUNDS: {
45
+ readonly min: 3000;
46
+ readonly max: 60000;
47
+ };
48
+ export declare const SYNC_TIMEOUT_BOUNDS: {
49
+ readonly min: 5000;
50
+ readonly max: 120000;
51
+ };
52
+ export declare const PURCHASE_LAUNCH_TIMEOUT_BOUNDS: {
53
+ readonly min: 5000;
54
+ readonly max: 120000;
55
+ };
56
+ export declare const FINALIZE_ATTEMPT_TIMEOUT_BOUNDS: {
57
+ readonly min: 3000;
58
+ readonly max: 60000;
59
+ };
60
+ export declare const VALIDATE_TIMEOUT_BOUNDS: {
61
+ readonly min: 3000;
62
+ readonly max: 120000;
63
+ };
64
+ /**
65
+ * Prices and offer eligibility are shown at the moment of purchase, so a short
66
+ * TTL with on-demand refresh beats a long one (FR-029).
67
+ */
68
+ export declare const DEFAULT_PRODUCT_CACHE_TTL_MS = 900000;
69
+ export declare const PRODUCT_CACHE_TTL_BOUNDS: {
70
+ readonly min: 60000;
71
+ readonly max: 86400000;
72
+ };
73
+ /**
74
+ * How long a successful sync keeps entitlements trustworthy offline: **7 days**.
75
+ *
76
+ * Fixed by the specification (FR-055) after weighing both failure directions.
77
+ * The realistic offline cases — travel, poor coverage, a device left unused —
78
+ * resolve within days. Seven days covers a holiday without connectivity while
79
+ * bounding how long a refunded entitlement can outlive its refund to one week.
80
+ *
81
+ * Past this the entitlement becomes `unknown`, never `not_entitled` (FR-055a):
82
+ * the package stops asserting rather than telling a paying customer they did not
83
+ * pay.
84
+ */
85
+ export declare const DEFAULT_STALE_AFTER_MS = 604800000;
86
+ export declare const STALE_AFTER_BOUNDS: {
87
+ readonly min: 3600000;
88
+ readonly max: 7776000000;
89
+ };
90
+ /** Keeps rapid app switching from becoming a request storm (PERF-002). */
91
+ export declare const DEFAULT_FOREGROUND_SYNC_MIN_INTERVAL_MS = 60000;
92
+ export declare const FOREGROUND_SYNC_MIN_INTERVAL_BOUNDS: {
93
+ readonly min: 0;
94
+ readonly max: 3600000;
95
+ };
96
+ /** Bounded so a dropped billing connection cannot become a retry storm (FR-020). */
97
+ export declare const DEFAULT_RECONNECT_BACKOFF: Required<BackoffConfig>;
98
+ /**
99
+ * Finalize retry.
100
+ *
101
+ * Bounded **per session** but never permanently abandoned: Google auto-refunds
102
+ * an unacknowledged purchase after three days, so exhausting this session's
103
+ * attempts must leave the transaction queued for the next launch, not dropped
104
+ * (FR-045).
105
+ */
106
+ export declare const DEFAULT_FINALIZE_BACKOFF: Required<BackoffConfig>;
107
+ export declare const BACKOFF_MAX_DELAY_BOUNDS: {
108
+ readonly min: 5000;
109
+ readonly max: 600000;
110
+ };
111
+ export declare const BACKOFF_ATTEMPT_BOUNDS: {
112
+ readonly min: 1;
113
+ readonly max: 10;
114
+ };
115
+ /** A first retry sooner than this is a storm; later than this, the user has given up. */
116
+ export declare const BACKOFF_INITIAL_DELAY_BOUNDS: {
117
+ readonly min: 100;
118
+ readonly max: 60000;
119
+ };
120
+ /** 1 is a constant delay; 0 or below would retry at once, forever (CORE-05). */
121
+ export declare const BACKOFF_FACTOR_BOUNDS: {
122
+ readonly min: 1;
123
+ readonly max: 10;
124
+ };
125
+ export interface ResolvedTimeouts {
126
+ connectMs: number;
127
+ productQueryMs: number;
128
+ syncMs: number;
129
+ purchaseLaunchMs: number;
130
+ finalizeAttemptMs: number;
131
+ validateMs: number;
132
+ }
133
+ export declare function resolveTimeouts(config?: TimeoutConfig): ResolvedTimeouts;
134
+ export interface ResolvedRetry {
135
+ reconnect: Required<BackoffConfig>;
136
+ finalize: Required<BackoffConfig>;
137
+ }
138
+ export declare function resolveRetry(config?: RetryConfig): ResolvedRetry;
139
+ export declare function resolveStaleAfterMs(value?: number): number;
140
+ export declare function resolveProductCacheTtlMs(value?: number): number;
141
+ export declare function resolveForegroundSyncMinIntervalMs(value?: number): number;
142
+ //# sourceMappingURL=timers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timers.d.ts","sourceRoot":"","sources":["../../../../src/core/timers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAKH,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,oBAAiB,CAAC;AAEjF,gFAAgF;AAChF,eAAO,MAAM,0BAA0B,QAAS,CAAC;AACjD,qFAAqF;AACrF,eAAO,MAAM,gCAAgC,QAAS,CAAC;AACvD,qEAAqE;AACrE,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,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,EAAE,MAAM,CAAC;IACzB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,eAAe,CAAC,MAAM,CAAC,EAAE,aAAa,GAAG,gBAAgB,CAuCxE;AA+CD,MAAM,WAAW,aAAa;IAC7B,SAAS,EAAE,QAAQ,CAAC,aAAa,CAAC,CAAC;IACnC,QAAQ,EAAE,QAAQ,CAAC,aAAa,CAAC,CAAC;CAClC;AAED,wBAAgB,YAAY,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,aAAa,CAKhE;AAED,wBAAgB,mBAAmB,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAE1D;AAED,wBAAgB,wBAAwB,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAO/D;AAED,wBAAgB,kCAAkC,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAOzE"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Normalized public errors.
3
+ *
4
+ * Error codes are **public API**: renaming one is a breaking change (FR-078,
5
+ * LIB-008). They are the vocabulary an app branches on, so they must outlive any
6
+ * internal refactor and must never leak a store's own code.
7
+ */
8
+ import { SdkError } from '@chipmobilesdk/rn-core';
9
+ export declare const PAYMENT_ERROR_CODES: readonly ["PAYMENT_NOT_CONFIGURED", "PAYMENT_INVALID_CATALOG", "PAYMENT_NOT_READY", "PAYMENT_DISABLED", "PAYMENT_UNAVAILABLE", "PAYMENT_UNSUPPORTED_PLATFORM", "PAYMENT_ENVIRONMENT_BLOCKED", "PAYMENT_PRODUCTION_CONFIG_IN_NON_PRODUCTION_BUILD", "PAYMENT_PURCHASE_IN_PROGRESS", "PAYMENT_USER_CANCELLED", "PAYMENT_PENDING", "PAYMENT_ALREADY_OWNED", "PAYMENT_INELIGIBLE", "PAYMENT_UNKNOWN_PRODUCT", "PAYMENT_PRODUCT_UNAVAILABLE_IN_REGION", "PAYMENT_TIMEOUT", "PAYMENT_NETWORK_ERROR", "PAYMENT_STORE_ERROR", "PAYMENT_FINALIZE_FAILED", "PAYMENT_VALIDATION_REJECTED", "PAYMENT_VALIDATION_UNAVAILABLE", "PAYMENT_STORAGE_UNAVAILABLE", "PAYMENT_NOT_CONSUMABLE", "PAYMENT_INVALID_CONFIG"];
10
+ export type PaymentErrorCode = (typeof PAYMENT_ERROR_CODES)[number];
11
+ /** Which operation produced an error. Part of the public error shape (FR-078). */
12
+ export type PaymentOperation = 'configure' | 'initialize' | 'getProducts' | 'purchase' | 'finalize' | 'consume' | 'sync' | 'restore' | 'changePlan' | 'validate' | 'persist';
13
+ /** The package's error; an `SdkError` (`@chipmobilesdk/rn-core`) with `pkg: 'rn-payment'`. */
14
+ export declare class PaymentError extends SdkError<PaymentErrorCode> {
15
+ readonly operation: PaymentOperation;
16
+ /** Redacted where appropriate — never a raw receipt, token, or store object (FR-074). */
17
+ readonly cause?: string;
18
+ constructor(init: {
19
+ code: PaymentErrorCode;
20
+ message: string;
21
+ operation: PaymentOperation;
22
+ retryable?: boolean;
23
+ cause?: string;
24
+ });
25
+ }
26
+ /**
27
+ * A configuration problem the app can act on.
28
+ *
29
+ * Separate from `PaymentError` because configuration faults are developer-facing
30
+ * and must never be shown to an end user — the message-key map keeps that
31
+ * separation explicit (FR-085).
32
+ */
33
+ export declare class PaymentConfigError extends PaymentError {
34
+ /** The offending catalog entries or entitlement keys, named (FR-011). */
35
+ readonly offenders: string[];
36
+ constructor(init: {
37
+ code: PaymentErrorCode;
38
+ message: string;
39
+ operation: PaymentOperation;
40
+ offenders?: string[];
41
+ });
42
+ }
43
+ /**
44
+ * Strips anything that must never reach a log or event.
45
+ *
46
+ * Applied at the boundary rather than trusted to call sites: a single forgotten
47
+ * interpolation is how receipts end up in logs (NFR-006).
48
+ *
49
+ * Identifier-only: what survives is what code defined, never what data carried.
50
+ * A `PaymentError` keeps its code and an `Error` its class name; every message
51
+ * and every string is dropped, because a store or consumer message can embed a
52
+ * purchase token or an account id and nothing here can tell which.
53
+ */
54
+ export declare function redact(value: unknown): string;
55
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../../src/diagnostics/errors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAY,QAAQ,EAAkB,MAAM,wBAAwB,CAAC;AAI5E,eAAO,MAAM,mBAAmB,sqBA8BtB,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEpE,kFAAkF;AAClF,MAAM,MAAM,gBAAgB,GACzB,WAAW,GACX,YAAY,GACZ,aAAa,GACb,UAAU,GACV,UAAU,GACV,SAAS,GACT,MAAM,GACN,SAAS,GACT,YAAY,GACZ,UAAU,GACV,SAAS,CAAC;AAEb,8FAA8F;AAC9F,qBAAa,YAAa,SAAQ,QAAQ,CAAC,gBAAgB,CAAC;IAC3D,QAAQ,CAAC,SAAS,EAAE,gBAAgB,CAAC;IACrC,yFAAyF;IACzF,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;gBAEZ,IAAI,EAAE;QACjB,IAAI,EAAE,gBAAgB,CAAC;QACvB,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,EAAE,gBAAgB,CAAC;QAC5B,SAAS,CAAC,EAAE,OAAO,CAAC;QACpB,KAAK,CAAC,EAAE,MAAM,CAAC;KACf;CAUD;AAED;;;;;;GAMG;AACH,qBAAa,kBAAmB,SAAQ,YAAY;IACnD,yEAAyE;IACzE,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,CAAC;gBAEjB,IAAI,EAAE;QACjB,IAAI,EAAE,gBAAgB,CAAC;QACvB,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,EAAE,gBAAgB,CAAC;QAC5B,SAAS,CAAC,EAAE,MAAM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