@chipmobilesdk/rn-payment 0.5.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 (317) hide show
  1. package/CHANGELOG.md +172 -0
  2. package/README.md +47 -16
  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
  296. package/skills/sdk-rn-payment/SKILL.md +4 -4
  297. package/src/adapter/iap-adapter.ts +12 -216
  298. package/src/adapter/iapShapes.ts +232 -0
  299. package/src/config/types.ts +8 -0
  300. package/src/config/validate.ts +19 -4
  301. package/src/core/retry.ts +1 -58
  302. package/src/diagnostics/events.ts +1 -1
  303. package/src/engine/connection.ts +194 -0
  304. package/src/engine/engine.ts +140 -700
  305. package/src/engine/internals.ts +40 -0
  306. package/src/engine/products.ts +39 -17
  307. package/src/engine/purchase.ts +22 -130
  308. package/src/engine/purchaseFailure.ts +48 -0
  309. package/src/engine/receiptValidation.ts +101 -0
  310. package/src/engine/state.ts +253 -0
  311. package/src/engine/sync.ts +161 -0
  312. package/src/entitlements/aggregate.ts +3 -5
  313. package/src/entitlements/mapping.ts +0 -22
  314. package/src/persistence/mmkv-store.ts +10 -3
  315. package/src/persistence/snapshot.ts +102 -27
  316. package/src/react/PaymentProvider.tsx +73 -24
  317. package/src/react/hooks.ts +13 -3
@@ -0,0 +1,126 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.FORBIDDEN_EVENT_FIELDS = void 0;
7
+ exports.createCorrelationId = createCorrelationId;
8
+ exports.createEmitter = createEmitter;
9
+ Object.defineProperty(exports, "redact", {
10
+ enumerable: true,
11
+ get: function () {
12
+ return _errors.redact;
13
+ }
14
+ });
15
+ var _rnCore = require("@chipmobilesdk/rn-core");
16
+ var _errors = require("./errors.js");
17
+ /**
18
+ * Typed events and the emitter.
19
+ *
20
+ * The bar is FR-077: the event stream **alone** must be enough to reconstruct a
21
+ * transaction's full lifecycle, so that "the user says they paid but has no
22
+ * entitlement" can be investigated from logs without a reproduction.
23
+ *
24
+ * Forbidden in every payload, without exception (FR-076, FR-074): store objects,
25
+ * raw receipts, verification payloads, backend tokens, payment details, the
26
+ * obfuscated account identifier, and the cache-scope token.
27
+ */
28
+
29
+ /** Every delivered event also goes to the app's SDK sinks (`installSdkSink`, CORE-08). */
30
+ const channel = (0, _rnCore.createDiagnosticChannel)('rn-payment');
31
+ /**
32
+ * A `PaymentEvent` with the timestamp left to the emitter.
33
+ *
34
+ * Distributive on purpose: a plain `Omit<PaymentEvent, 'timestamp'>` collapses the
35
+ * discriminated union into one object type with only the shared keys, which would
36
+ * reject every variant-specific field. `T extends unknown` forces the mapping to
37
+ * apply per member and keeps the union discriminated.
38
+ */
39
+
40
+ /**
41
+ * Creates the emitter.
42
+ *
43
+ * Two properties are deliberate:
44
+ *
45
+ * 1. **A throwing listener cannot break anything** (FR-081). Each listener is
46
+ * invoked defensively, the throw is handed to `onListenerError`, and delivery
47
+ * continues to the remaining listeners. One app's broken analytics callback
48
+ * must not stop the package granting an entitlement or stop another listener
49
+ * hearing about it.
50
+ *
51
+ * The failure is **not** re-emitted as an event, deliberately. A consumer's own
52
+ * bug is not a payment-lifecycle event, and reporting it through the channel
53
+ * that just failed would both invite recursion and double event traffic for
54
+ * every event while that listener stays broken. It goes to the logger instead.
55
+ *
56
+ * 2. **After `dispose`, nothing is emitted** (FR-082). A store callback can
57
+ * arrive after cleanup; it must be dropped silently rather than reach a
58
+ * listener whose component is gone.
59
+ */
60
+ function createEmitter(onListenerError) {
61
+ // The event whose listeners are running, so a failure is reported against it.
62
+ let dispatching = null;
63
+ let isDisposed = false;
64
+ // rn-core's emitter: a snapshot per emit, each listener isolated, idempotent
65
+ // unsubscribe. Even the error reporter is isolated: if it throws, rn-core
66
+ // rethrows that on a fresh task rather than into the emit.
67
+ const emitter = (0, _rnCore.createEmitter)({
68
+ onListenerError: error => {
69
+ if (!dispatching) return;
70
+ try {
71
+ onListenerError?.(error, dispatching);
72
+ } catch {
73
+ // The app's own reporter failed: nothing in the app is left to tell, so
74
+ // the failure goes to the SDK sinks rather than becoming an uncaught
75
+ // error on some later tick (FR-080).
76
+ channel.emit('listener_reporter_failed', 'error', {
77
+ eventType: dispatching.type
78
+ });
79
+ }
80
+ }
81
+ });
82
+ return {
83
+ emit(event) {
84
+ if (isDisposed) {
85
+ return;
86
+ }
87
+ const previous = dispatching;
88
+ dispatching = event;
89
+ try {
90
+ if (emitter.emit(event)) {
91
+ // The type and the cycle only: payment events carry product and
92
+ // entitlement keys an app may treat as personal.
93
+ channel.emit(event.type, /failed|error|blocked|rejected|revoked/.test(event.type) ? 'warn' : 'info', undefined, event.correlationId);
94
+ }
95
+ } finally {
96
+ dispatching = previous;
97
+ }
98
+ },
99
+ subscribe(listener) {
100
+ return isDisposed ? () => undefined : emitter.subscribe(listener);
101
+ },
102
+ dispose() {
103
+ isDisposed = true;
104
+ emitter.dispose();
105
+ },
106
+ listenerCount: () => emitter.listenerCount(),
107
+ disposed: () => isDisposed
108
+ };
109
+ }
110
+
111
+ /**
112
+ * Fields that must never appear in an event payload.
113
+ *
114
+ * Used by `__tests__/diagnostics.test.ts` to walk every emitted event across the
115
+ * whole suite. Enumerating the ban here rather than in the test keeps the rule
116
+ * next to the type it constrains.
117
+ */
118
+ const FORBIDDEN_EVENT_FIELDS = exports.FORBIDDEN_EVENT_FIELDS = ['verificationPayload', 'receipt', 'purchaseToken', 'transactionReceipt', 'obfuscatedAccountId', 'scopeToken', 'token', 'signature'];
119
+
120
+ /** Correlation ids tie one purchase cycle together; no user data goes into them. */
121
+ function createCorrelationId(counter, prefix = 'pc') {
122
+ const id = `${prefix}_${counter.next.toString(36)}`;
123
+ counter.next += 1;
124
+ return id;
125
+ }
126
+ //# sourceMappingURL=events.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_rnCore","require","_errors","channel","createDiagnosticChannel","createEmitter","onListenerError","dispatching","isDisposed","emitter","createCoreEmitter","error","emit","eventType","type","event","previous","test","undefined","correlationId","subscribe","listener","dispose","listenerCount","disposed","FORBIDDEN_EVENT_FIELDS","exports","createCorrelationId","counter","prefix","id","next","toString"],"sourceRoot":"../../../src","sources":["diagnostics/events.ts"],"mappings":";;;;;;;;;;;;;;AAYA,IAAAA,OAAA,GAAAC,OAAA;AAUA,IAAAC,OAAA,GAAAD,OAAA;AAtBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAOA;AACA,MAAME,OAAO,GAAG,IAAAC,+BAAuB,EACtC,YACD,CAAC;AAsID;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAgBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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d,OAAO,CAACc,aAAa,CAAC,CAAC;IAC5CC,QAAQ,EAAEA,CAAA,KAAMhB;EACjB,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMiB,sBAAyC,GAAAC,OAAA,CAAAD,sBAAA,GAAG,CACxD,qBAAqB,EACrB,SAAS,EACT,eAAe,EACf,oBAAoB,EACpB,qBAAqB,EACrB,YAAY,EACZ,OAAO,EACP,WAAW,CACX;;AAED;AACO,SAASE,mBAAmBA,CAACC,OAAyB,EAAEC,MAAM,GAAG,IAAI,EAAU;EACrF,MAAMC,EAAE,GAAG,GAAGD,MAAM,IAAID,OAAO,CAACG,IAAI,CAACC,QAAQ,CAAC,EAAE,CAAC,EAAE;EACnDJ,OAAO,CAACG,IAAI,IAAI,CAAC;EACjB,OAAOD,EAAE;AACV","ignoreList":[]}
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.USER_MESSAGE_KEYS = exports.DEVELOPER_MESSAGE_KEYS = exports.DEFAULT_USER_MESSAGES = exports.DEFAULT_MESSAGES = exports.DEFAULT_DEVELOPER_MESSAGES = void 0;
7
+ exports.isUserMessageKey = isUserMessageKey;
8
+ exports.paymentMessages = void 0;
9
+ var _rnCore = require("@chipmobilesdk/rn-core");
10
+ /**
11
+ * Stable, localizable message keys with English default copy (FR-084, FR-085).
12
+ *
13
+ * The package takes no i18n runtime dependency: consuming apps map these keys to
14
+ * localized strings through whatever i18n system they already run. This is plain
15
+ * data, and the package never resolves or renders it.
16
+ *
17
+ * Message keys are **public API**: renaming one is a breaking change, on the
18
+ * same footing as an error code (FR-078).
19
+ *
20
+ * User-actionable copy and developer/configuration copy are kept in separate
21
+ * maps so an app cannot accidentally show "Payment catalog is invalid" to a
22
+ * customer — a configuration fault is a developer's problem, not a user's.
23
+ */
24
+
25
+ /** Copy an end user may reasonably be shown. */
26
+
27
+ /** Copy for developers and operators. **Never** surfaced to an end user. */
28
+
29
+ const DEFAULT_USER_MESSAGES = exports.DEFAULT_USER_MESSAGES = {
30
+ 'payment.state.pending': 'Waiting for your payment to complete',
31
+ 'payment.state.alreadyOwned': 'You already own this',
32
+ 'payment.action.restore': 'Restore purchases',
33
+ 'payment.restore.succeeded': 'Your purchases have been restored',
34
+ 'payment.restore.nothingFound': 'No previous purchases found',
35
+ 'payment.error.cancelled': 'Purchase cancelled',
36
+ 'payment.error.network': "Couldn't reach the store. Check your connection and try again.",
37
+ 'payment.error.unavailable': "Purchases aren't available on this device",
38
+ 'payment.error.disabled': 'Purchases are currently unavailable',
39
+ 'payment.subscription.grace': "There's a problem with your payment method",
40
+ 'payment.subscription.hold': 'Your subscription is paused until payment is updated'
41
+ };
42
+ const DEFAULT_DEVELOPER_MESSAGES = exports.DEFAULT_DEVELOPER_MESSAGES = {
43
+ 'payment.config.invalidCatalog': 'Payment catalog is invalid',
44
+ 'payment.config.missingStoreId': 'Product is missing a store identifier for this platform',
45
+ 'payment.config.productionInNonProductionBuild': 'Production payment configuration in a non-production build',
46
+ 'payment.config.storageUnavailable': 'Local storage unavailable; entitlements will not survive restart',
47
+ 'payment.config.environmentBlocked': 'Purchase blocked: this environment may not create a real transaction'
48
+ };
49
+
50
+ /**
51
+ * The catalog as an rn-core message set. Register `paymentMessages.user` with
52
+ * rn-i18n to translate it like app copy; the developer copy stays out of bundles.
53
+ */
54
+ const paymentMessages = exports.paymentMessages = (0, _rnCore.defineMessages)({
55
+ user: DEFAULT_USER_MESSAGES,
56
+ developer: DEFAULT_DEVELOPER_MESSAGES
57
+ });
58
+ const DEFAULT_MESSAGES = exports.DEFAULT_MESSAGES = paymentMessages.defaults;
59
+
60
+ /** Every user-actionable key, for an app building its translation resource. */
61
+ const USER_MESSAGE_KEYS = exports.USER_MESSAGE_KEYS = paymentMessages.userKeys;
62
+
63
+ /** Every developer-facing key, so an app can exclude them from user-visible bundles. */
64
+ const DEVELOPER_MESSAGE_KEYS = exports.DEVELOPER_MESSAGE_KEYS = paymentMessages.developerKeys;
65
+
66
+ /** True for keys safe to show an end user. Lets an app assert that at its boundary. */
67
+ function isUserMessageKey(key) {
68
+ return paymentMessages.audienceOf(key) === 'user';
69
+ }
70
+ //# sourceMappingURL=messageKeys.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_rnCore","require","DEFAULT_USER_MESSAGES","exports","DEFAULT_DEVELOPER_MESSAGES","paymentMessages","defineMessages","user","developer","DEFAULT_MESSAGES","defaults","USER_MESSAGE_KEYS","userKeys","DEVELOPER_MESSAGE_KEYS","developerKeys","isUserMessageKey","key","audienceOf"],"sourceRoot":"../../../src","sources":["diagnostics/messageKeys.ts"],"mappings":";;;;;;;;AAgBA,IAAAA,OAAA,GAAAC,OAAA;AAhBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAiBA;;AAeO,MAAMC,qBAA4C,GAAAC,OAAA,CAAAD,qBAAA,GAAG;EAC3D,uBAAuB,EAAE,sCAAsC;EAC/D,4BAA4B,EAAE,sBAAsB;EACpD,wBAAwB,EAAE,mBAAmB;EAC7C,2BAA2B,EAAE,mCAAmC;EAChE,8BAA8B,EAAE,6BAA6B;EAC7D,yBAAyB,EAAE,oBAAoB;EAC/C,uBAAuB,EAAE,gEAAgE;EACzF,2BAA2B,EAAE,2CAA2C;EACxE,wBAAwB,EAAE,qCAAqC;EAC/D,4BAA4B,EAAE,4CAA4C;EAC1E,2BAA2B,EAAE;AAC9B,CAAC;AAEM,MAAME,0BAAsD,GAAAD,OAAA,CAAAC,0BAAA,GAAG;EACrE,+BAA+B,EAAE,4BAA4B;EAC7D,+BAA+B,EAAE,yDAAyD;EAC1F,+CAA+C,EAC9C,4DAA4D;EAC7D,mCAAmC,EAClC,kEAAkE;EACnE,mCAAmC,EAClC;AACF,CAAC;;AAED;AACA;AACA;AACA;AACO,MAAMC,eAAe,GAAAF,OAAA,CAAAE,eAAA,GAAG,IAAAC,sBAAc,EAAC;EAC7CC,IAAI,EAAEL,qBAAqB;EAC3BM,SAAS,EAAEJ;AACZ,CAAC,CAAC;AAEK,MAAMK,gBAAmC,GAAAN,OAAA,CAAAM,gBAAA,GAAGJ,eAAe,CAACK,QAAQ;;AAE3E;AACO,MAAMC,iBAAiB,GAAAR,OAAA,CAAAQ,iBAAA,GAAGN,eAAe,CAACO,QAAmC;;AAEpF;AACO,MAAMC,sBAAsB,GAAAV,OAAA,CAAAU,sBAAA,GAAGR,eAAe,CAACS,aAA6C;;AAEnG;AACO,SAASC,gBAAgBA,CAACC,GAAsB,EAAgC;EACtF,OAAOX,eAAe,CAACY,UAAU,CAACD,GAAG,CAAC,KAAK,MAAM;AAClD","ignoreList":[]}
@@ -0,0 +1,189 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createConnection = createConnection;
7
+ var _retry = require("../core/retry.js");
8
+ var _mutex = require("../core/mutex.js");
9
+ var _errors = require("../diagnostics/errors.js");
10
+ /**
11
+ * The billing connection: connecting, watching it, and reconnecting with bounded
12
+ * backoff (FR-018 – FR-024, PAY-10).
13
+ *
14
+ * A reconnect is always a full teardown-then-connect cycle. The upstream
15
+ * binding's own `reconnect()` has reported success without rebuilding anything
16
+ * (openiap#408), so no shortcut is trusted here.
17
+ */
18
+
19
+ function createConnection(state, onPurchase) {
20
+ const {
21
+ provider,
22
+ resolved
23
+ } = state;
24
+ let connectionSub;
25
+ let purchaseSub;
26
+ let reconnectTimer;
27
+ let reconnectAttempts = 0;
28
+ /**
29
+ * Set once a connection succeeded. Recovery after an exhausted budget is only
30
+ * meaningful from there; a first connection that failed is the app's to retry
31
+ * through `initialize`.
32
+ */
33
+ let everConnected = false;
34
+ function scheduleReconnect() {
35
+ if (state.disposed) {
36
+ return;
37
+ }
38
+ if (reconnectAttempts >= resolved.retry.reconnect.maxAttempts) {
39
+ // Out of budget for now, not for good: a retryable failure rather than a
40
+ // `connecting` that promised a reconnect nobody was going to make.
41
+ state.setStatus({
42
+ kind: 'failed',
43
+ retryable: true,
44
+ reconnectAttempts
45
+ });
46
+ return;
47
+ }
48
+ const attempt = reconnectAttempts + 1;
49
+ reconnectTimer = setTimeout(() => {
50
+ reconnectTimer = undefined;
51
+ if (state.disposed) {
52
+ return;
53
+ }
54
+ reconnectAttempts = attempt;
55
+ state.setStatus({
56
+ kind: 'connecting',
57
+ reconnectAttempts
58
+ });
59
+ reconnectOnce().catch(() => undefined);
60
+ }, (0, _retry.backoffDelayMs)(attempt, resolved.retry.reconnect));
61
+ }
62
+ async function reconnectOnce() {
63
+ try {
64
+ await provider.disconnect();
65
+ } catch {
66
+ // Already down; nothing to tear down.
67
+ }
68
+ const outcome = await provider.connect();
69
+ if (state.disposed) {
70
+ return;
71
+ }
72
+ if (outcome.ok) {
73
+ reconnectAttempts = 0;
74
+ state.setStatus({
75
+ kind: 'ready',
76
+ reconnectAttempts: 0
77
+ });
78
+ } else {
79
+ scheduleReconnect();
80
+ }
81
+ }
82
+
83
+ /** Replaced, never stacked: a second subscription would hear everything twice. */
84
+ function watch() {
85
+ connectionSub?.();
86
+ connectionSub = provider.observeConnection((connected, reason) => {
87
+ if (state.disposed) {
88
+ return;
89
+ }
90
+ state.emit({
91
+ type: 'connection_changed',
92
+ connected,
93
+ reason,
94
+ attempt: reconnectAttempts
95
+ });
96
+ if (!connected && state.status.kind === 'ready') {
97
+ state.setStatus({
98
+ kind: 'connecting'
99
+ });
100
+ scheduleReconnect();
101
+ }
102
+ });
103
+ // Session-long: a pending purchase settling between sessions arrives here
104
+ // (FR-039), not only while a purchase is open.
105
+ purchaseSub?.();
106
+ purchaseSub = provider.observePurchases(purchase => {
107
+ if (!state.disposed) {
108
+ onPurchase(purchase);
109
+ }
110
+ });
111
+ }
112
+ return {
113
+ async connect() {
114
+ const outcome = await (0, _mutex.withTimeout)(provider.connect(), resolved.timeouts.connectMs, () => new _errors.PaymentError({
115
+ code: 'PAYMENT_TIMEOUT',
116
+ message: 'Connecting to the billing service timed out',
117
+ operation: 'initialize',
118
+ retryable: true
119
+ })).catch(error => ({
120
+ ok: false,
121
+ reason: 'store_error',
122
+ retryable: error.retryable
123
+ }));
124
+ if (!outcome.ok) {
125
+ if (outcome.reason === 'store_error') {
126
+ state.setStatus({
127
+ kind: 'failed',
128
+ retryable: outcome.retryable
129
+ });
130
+ return {
131
+ ok: false,
132
+ error: new _errors.PaymentError({
133
+ code: 'PAYMENT_STORE_ERROR',
134
+ message: 'Could not connect to the billing service',
135
+ operation: 'initialize',
136
+ retryable: outcome.retryable
137
+ })
138
+ };
139
+ }
140
+ // No billing service, an outdated one, or an unsupported platform: each
141
+ // distinguishable, and none of them may break the host app (FR-021, FR-023).
142
+ state.setStatus({
143
+ kind: 'unavailable',
144
+ unavailableReason: outcome.reason,
145
+ retryable: outcome.retryable
146
+ });
147
+ return {
148
+ ok: false,
149
+ error: new _errors.PaymentError({
150
+ code: outcome.reason === 'platform_unsupported' ? 'PAYMENT_UNSUPPORTED_PLATFORM' : 'PAYMENT_UNAVAILABLE',
151
+ message: `Billing unavailable: ${outcome.reason}`,
152
+ operation: 'initialize',
153
+ retryable: outcome.retryable
154
+ })
155
+ };
156
+ }
157
+ watch();
158
+ everConnected = true;
159
+ state.setStatus({
160
+ kind: 'ready',
161
+ reconnectAttempts: 0
162
+ });
163
+ return {
164
+ ok: true
165
+ };
166
+ },
167
+ async recover() {
168
+ if (everConnected && !state.disposed && state.status.kind === 'failed' && reconnectTimer === undefined) {
169
+ reconnectAttempts = 0;
170
+ state.setStatus({
171
+ kind: 'connecting',
172
+ reconnectAttempts: 0
173
+ });
174
+ await reconnectOnce().catch(() => undefined);
175
+ }
176
+ },
177
+ dispose() {
178
+ connectionSub?.();
179
+ connectionSub = undefined;
180
+ purchaseSub?.();
181
+ purchaseSub = undefined;
182
+ if (reconnectTimer !== undefined) {
183
+ clearTimeout(reconnectTimer);
184
+ reconnectTimer = undefined;
185
+ }
186
+ }
187
+ };
188
+ }
189
+ //# sourceMappingURL=connection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_retry","require","_mutex","_errors","createConnection","state","onPurchase","provider","resolved","connectionSub","purchaseSub","reconnectTimer","reconnectAttempts","everConnected","scheduleReconnect","disposed","retry","reconnect","maxAttempts","setStatus","kind","retryable","attempt","setTimeout","undefined","reconnectOnce","catch","backoffDelayMs","disconnect","outcome","connect","ok","watch","observeConnection","connected","reason","emit","type","status","observePurchases","purchase","withTimeout","timeouts","connectMs","PaymentError","code","message","operation","error","unavailableReason","recover","dispose","clearTimeout"],"sourceRoot":"../../../src","sources":["engine/connection.ts"],"mappings":";;;;;;AAUA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAsBO,SAASG,gBAAgBA,CAC/BC,KAAkB,EAClBC,UAAgD,EACnC;EACb,MAAM;IAAEC,QAAQ;IAAEC;EAAS,CAAC,GAAGH,KAAK;EACpC,IAAII,aAAsC;EAC1C,IAAIC,WAAoC;EACxC,IAAIC,cAAyD;EAC7D,IAAIC,iBAAiB,GAAG,CAAC;EACzB;AACD;AACA;AACA;AACA;EACC,IAAIC,aAAa,GAAG,KAAK;EAEzB,SAASC,iBAAiBA,CAAA,EAAS;IAClC,IAAIT,KAAK,CAACU,QAAQ,EAAE;MACnB;IACD;IACA,IAAIH,iBAAiB,IAAIJ,QAAQ,CAACQ,KAAK,CAACC,SAAS,CAACC,WAAW,EAAE;MAC9D;MACA;MACAb,KAAK,CAACc,SAAS,CAAC;QAAEC,IAAI,EAAE,QAAQ;QAAEC,SAAS,EAAE,IAAI;QAAET;MAAkB,CAAC,CAAC;MACvE;IACD;IACA,MAAMU,OAAO,GAAGV,iBAAiB,GAAG,CAAC;IACrCD,cAAc,GAAGY,UAAU,CAC1B,MAAM;MACLZ,cAAc,GAAGa,SAAS;MAC1B,IAAInB,KAAK,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