@fantastic.dev/better-stripe 0.23.2 → 0.25.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 (358) hide show
  1. package/CHANGELOG.md +27 -2
  2. package/README.md +46 -5
  3. package/dist/client/affiliateRecovery/disputes.d.ts +18 -0
  4. package/dist/client/affiliateRecovery/disputes.d.ts.map +1 -0
  5. package/dist/client/affiliateRecovery/disputes.js +33 -0
  6. package/dist/client/affiliateRecovery/disputes.js.map +1 -0
  7. package/dist/client/affiliateRecovery/engine.d.ts +29 -0
  8. package/dist/client/affiliateRecovery/engine.d.ts.map +1 -0
  9. package/dist/client/affiliateRecovery/engine.js +116 -0
  10. package/dist/client/affiliateRecovery/engine.js.map +1 -0
  11. package/dist/client/affiliateRecovery/payoutGate.d.ts +24 -0
  12. package/dist/client/affiliateRecovery/payoutGate.d.ts.map +1 -0
  13. package/dist/client/affiliateRecovery/payoutGate.js +30 -0
  14. package/dist/client/affiliateRecovery/payoutGate.js.map +1 -0
  15. package/dist/client/affiliateRecovery/provider.d.ts +14 -0
  16. package/dist/client/affiliateRecovery/provider.d.ts.map +1 -0
  17. package/dist/client/affiliateRecovery/provider.js +96 -0
  18. package/dist/client/affiliateRecovery/provider.js.map +1 -0
  19. package/dist/client/affiliateRecovery/review.d.ts +28 -0
  20. package/dist/client/affiliateRecovery/review.d.ts.map +1 -0
  21. package/dist/client/affiliateRecovery/review.js +86 -0
  22. package/dist/client/affiliateRecovery/review.js.map +1 -0
  23. package/dist/client/affiliateRecovery/validators.d.ts +402 -0
  24. package/dist/client/affiliateRecovery/validators.d.ts.map +1 -0
  25. package/dist/client/affiliateRecovery/validators.js +27 -0
  26. package/dist/client/affiliateRecovery/validators.js.map +1 -0
  27. package/dist/client/affiliateRecovery.d.ts +131 -0
  28. package/dist/client/affiliateRecovery.d.ts.map +1 -0
  29. package/dist/client/affiliateRecovery.js +69 -0
  30. package/dist/client/affiliateRecovery.js.map +1 -0
  31. package/dist/client/billing/checkout.d.ts +3 -43
  32. package/dist/client/billing/checkout.d.ts.map +1 -1
  33. package/dist/client/billing/checkout.js +5 -260
  34. package/dist/client/billing/checkout.js.map +1 -1
  35. package/dist/client/billing/checkoutRequest.d.ts +129 -0
  36. package/dist/client/billing/checkoutRequest.d.ts.map +1 -0
  37. package/dist/client/billing/checkoutRequest.js +263 -0
  38. package/dist/client/billing/checkoutRequest.js.map +1 -0
  39. package/dist/client/billing/preparedCheckout.d.ts +22 -0
  40. package/dist/client/billing/preparedCheckout.d.ts.map +1 -0
  41. package/dist/client/billing/preparedCheckout.js +86 -0
  42. package/dist/client/billing/preparedCheckout.js.map +1 -0
  43. package/dist/client/checkoutRequests.d.ts +80 -0
  44. package/dist/client/checkoutRequests.d.ts.map +1 -0
  45. package/dist/client/checkoutRequests.js +28 -0
  46. package/dist/client/checkoutRequests.js.map +1 -0
  47. package/dist/client/connect/commissionReceipts.d.ts +4 -0
  48. package/dist/client/connect/commissionReceipts.d.ts.map +1 -0
  49. package/dist/client/connect/commissionReceipts.js +17 -0
  50. package/dist/client/connect/commissionReceipts.js.map +1 -0
  51. package/dist/client/connect/payoutAdoptionTestHelpers.d.ts +958 -2
  52. package/dist/client/connect/payoutAdoptionTestHelpers.d.ts.map +1 -1
  53. package/dist/client/connect/payoutCollection.d.ts +21 -0
  54. package/dist/client/connect/payoutCollection.d.ts.map +1 -0
  55. package/dist/client/connect/payoutCollection.js +47 -0
  56. package/dist/client/connect/payoutCollection.js.map +1 -0
  57. package/dist/client/connect/payoutExecutionTestHelpers.d.ts +1805 -0
  58. package/dist/client/connect/payoutExecutionTestHelpers.d.ts.map +1 -0
  59. package/dist/client/connect/payoutExecutionTestHelpers.js +194 -0
  60. package/dist/client/connect/payoutExecutionTestHelpers.js.map +1 -0
  61. package/dist/client/connect/payoutSyncTestHelpers.d.ts +479 -1
  62. package/dist/client/connect/payoutSyncTestHelpers.d.ts.map +1 -1
  63. package/dist/client/connect/payoutWorker.d.ts +48 -0
  64. package/dist/client/connect/payoutWorker.d.ts.map +1 -0
  65. package/dist/client/connect/payoutWorker.js +78 -0
  66. package/dist/client/connect/payoutWorker.js.map +1 -0
  67. package/dist/client/connect/payouts.d.ts +3 -1
  68. package/dist/client/connect/payouts.d.ts.map +1 -1
  69. package/dist/client/connect/payouts.js +45 -12
  70. package/dist/client/connect/payouts.js.map +1 -1
  71. package/dist/client/connect/refundPrincipal.d.ts +4 -0
  72. package/dist/client/connect/refundPrincipal.d.ts.map +1 -0
  73. package/dist/client/connect/refundPrincipal.js +21 -0
  74. package/dist/client/connect/refundPrincipal.js.map +1 -0
  75. package/dist/client/connect/reversalExecution.d.ts +47 -0
  76. package/dist/client/connect/reversalExecution.d.ts.map +1 -0
  77. package/dist/client/connect/reversalExecution.js +84 -0
  78. package/dist/client/connect/reversalExecution.js.map +1 -0
  79. package/dist/client/connect/transfers.d.ts +8 -4
  80. package/dist/client/connect/transfers.d.ts.map +1 -1
  81. package/dist/client/connect/transfers.js +52 -57
  82. package/dist/client/connect/transfers.js.map +1 -1
  83. package/dist/client/index.d.ts +7 -11
  84. package/dist/client/index.d.ts.map +1 -1
  85. package/dist/client/index.js +10 -10
  86. package/dist/client/index.js.map +1 -1
  87. package/dist/client/payoutPolicy.d.ts +67 -0
  88. package/dist/client/payoutPolicy.d.ts.map +1 -1
  89. package/dist/client/payoutPolicy.js +10 -0
  90. package/dist/client/payoutPolicy.js.map +1 -1
  91. package/dist/client/readContracts.d.ts +11 -1
  92. package/dist/client/readContracts.d.ts.map +1 -1
  93. package/dist/client/readContracts.js +10 -0
  94. package/dist/client/readContracts.js.map +1 -1
  95. package/dist/client/settlement/execution.d.ts.map +1 -1
  96. package/dist/client/settlement/execution.js +30 -3
  97. package/dist/client/settlement/execution.js.map +1 -1
  98. package/dist/client/settlement/reconciliation.d.ts.map +1 -1
  99. package/dist/client/settlement/reconciliation.js +16 -2
  100. package/dist/client/settlement/reconciliation.js.map +1 -1
  101. package/dist/client/webhooks/disputeRecovery.d.ts +4 -0
  102. package/dist/client/webhooks/disputeRecovery.d.ts.map +1 -0
  103. package/dist/client/webhooks/disputeRecovery.js +40 -0
  104. package/dist/client/webhooks/disputeRecovery.js.map +1 -0
  105. package/dist/client/webhooks/processors.d.ts.map +1 -1
  106. package/dist/client/webhooks/processors.js +14 -29
  107. package/dist/client/webhooks/processors.js.map +1 -1
  108. package/dist/component/_generated/component.d.ts +784 -0
  109. package/dist/component/_generated/component.d.ts.map +1 -1
  110. package/dist/component/affiliateEarnings/mutations.d.ts +22 -0
  111. package/dist/component/affiliateEarnings/mutations.d.ts.map +1 -0
  112. package/dist/component/affiliateEarnings/mutations.js +160 -0
  113. package/dist/component/affiliateEarnings/mutations.js.map +1 -0
  114. package/dist/component/affiliatePayouts/mutations.d.ts +25 -0
  115. package/dist/component/affiliatePayouts/mutations.d.ts.map +1 -0
  116. package/dist/component/affiliatePayouts/mutations.js +104 -0
  117. package/dist/component/affiliatePayouts/mutations.js.map +1 -0
  118. package/dist/component/affiliatePayouts/queries.d.ts +23 -0
  119. package/dist/component/affiliatePayouts/queries.d.ts.map +1 -0
  120. package/dist/component/affiliatePayouts/queries.js +23 -0
  121. package/dist/component/affiliatePayouts/queries.js.map +1 -0
  122. package/dist/component/affiliatePayouts/recipientGuard.d.ts +12 -0
  123. package/dist/component/affiliatePayouts/recipientGuard.d.ts.map +1 -0
  124. package/dist/component/affiliatePayouts/recipientGuard.js +26 -0
  125. package/dist/component/affiliatePayouts/recipientGuard.js.map +1 -0
  126. package/dist/component/affiliateRecovery/accounting.d.ts +28 -0
  127. package/dist/component/affiliateRecovery/accounting.d.ts.map +1 -0
  128. package/dist/component/affiliateRecovery/accounting.js +71 -0
  129. package/dist/component/affiliateRecovery/accounting.js.map +1 -0
  130. package/dist/component/affiliateRecovery/mutations.d.ts +65 -0
  131. package/dist/component/affiliateRecovery/mutations.d.ts.map +1 -0
  132. package/dist/component/affiliateRecovery/mutations.js +250 -0
  133. package/dist/component/affiliateRecovery/mutations.js.map +1 -0
  134. package/dist/component/affiliateRecovery/queries.d.ts +305 -0
  135. package/dist/component/affiliateRecovery/queries.d.ts.map +1 -0
  136. package/dist/component/affiliateRecovery/queries.js +113 -0
  137. package/dist/component/affiliateRecovery/queries.js.map +1 -0
  138. package/dist/component/affiliateRecovery/schema.d.ts +171 -0
  139. package/dist/component/affiliateRecovery/schema.d.ts.map +1 -0
  140. package/dist/component/affiliateRecovery/schema.js +71 -0
  141. package/dist/component/affiliateRecovery/schema.js.map +1 -0
  142. package/dist/component/connect/mutations.d.ts +36 -23
  143. package/dist/component/connect/mutations.d.ts.map +1 -1
  144. package/dist/component/connect/mutations.js +7 -124
  145. package/dist/component/connect/mutations.js.map +1 -1
  146. package/dist/component/connect/queries.d.ts +10 -0
  147. package/dist/component/connect/queries.d.ts.map +1 -1
  148. package/dist/component/connect/queries.js +3 -40
  149. package/dist/component/connect/queries.js.map +1 -1
  150. package/dist/component/connect/reversalClaims.d.ts +169 -0
  151. package/dist/component/connect/reversalClaims.d.ts.map +1 -0
  152. package/dist/component/connect/reversalClaims.js +176 -0
  153. package/dist/component/connect/reversalClaims.js.map +1 -0
  154. package/dist/component/connect/reversalDiagnostics.d.ts +59 -0
  155. package/dist/component/connect/reversalDiagnostics.d.ts.map +1 -0
  156. package/dist/component/connect/reversalDiagnostics.js +50 -0
  157. package/dist/component/connect/reversalDiagnostics.js.map +1 -0
  158. package/dist/component/connect/reversalReceipts.d.ts +27 -0
  159. package/dist/component/connect/reversalReceipts.d.ts.map +1 -0
  160. package/dist/component/connect/reversalReceipts.js +85 -0
  161. package/dist/component/connect/reversalReceipts.js.map +1 -0
  162. package/dist/component/connect/schema.d.ts +31 -1
  163. package/dist/component/connect/schema.d.ts.map +1 -1
  164. package/dist/component/connect/schema.js +3 -1
  165. package/dist/component/connect/schema.js.map +1 -1
  166. package/dist/component/connect/validators.d.ts +49 -1
  167. package/dist/component/connect/validators.d.ts.map +1 -1
  168. package/dist/component/connect/validators.js +2 -0
  169. package/dist/component/connect/validators.js.map +1 -1
  170. package/dist/component/core/mutations.d.ts.map +1 -1
  171. package/dist/component/core/mutations.js +2 -0
  172. package/dist/component/core/mutations.js.map +1 -1
  173. package/dist/component/core/resetSafety.d.ts +4 -0
  174. package/dist/component/core/resetSafety.d.ts.map +1 -0
  175. package/dist/component/core/resetSafety.js +54 -0
  176. package/dist/component/core/resetSafety.js.map +1 -0
  177. package/dist/component/earnings/triggers.d.ts +828 -2
  178. package/dist/component/earnings/triggers.d.ts.map +1 -1
  179. package/dist/component/earnings/triggers.js +2 -0
  180. package/dist/component/earnings/triggers.js.map +1 -1
  181. package/dist/component/payoutPolicy/schema.d.ts +2 -0
  182. package/dist/component/payoutPolicy/schema.d.ts.map +1 -1
  183. package/dist/component/payoutPolicy/schema.js +3 -1
  184. package/dist/component/payoutPolicy/schema.js.map +1 -1
  185. package/dist/component/payoutRelease/mutations.d.ts.map +1 -1
  186. package/dist/component/payoutRelease/mutations.js +7 -1
  187. package/dist/component/payoutRelease/mutations.js.map +1 -1
  188. package/dist/component/payoutRelease/queries.d.ts.map +1 -1
  189. package/dist/component/payoutRelease/queries.js +3 -1
  190. package/dist/component/payoutRelease/queries.js.map +1 -1
  191. package/dist/component/payoutRelease/schema.d.ts +1 -0
  192. package/dist/component/payoutRelease/schema.d.ts.map +1 -1
  193. package/dist/component/payoutRelease/schema.js +1 -0
  194. package/dist/component/payoutRelease/schema.js.map +1 -1
  195. package/dist/component/payoutSnapshots/localState.d.ts +89 -0
  196. package/dist/component/payoutSnapshots/localState.d.ts.map +1 -0
  197. package/dist/component/payoutSnapshots/localState.js +186 -0
  198. package/dist/component/payoutSnapshots/localState.js.map +1 -0
  199. package/dist/component/payoutSnapshots/mutations.d.ts +108 -0
  200. package/dist/component/payoutSnapshots/mutations.d.ts.map +1 -0
  201. package/dist/component/payoutSnapshots/mutations.js +263 -0
  202. package/dist/component/payoutSnapshots/mutations.js.map +1 -0
  203. package/dist/component/payoutSnapshots/revisions.d.ts +12 -0
  204. package/dist/component/payoutSnapshots/revisions.d.ts.map +1 -0
  205. package/dist/component/payoutSnapshots/revisions.js +173 -0
  206. package/dist/component/payoutSnapshots/revisions.js.map +1 -0
  207. package/dist/component/payoutSnapshots/schema.d.ts +285 -0
  208. package/dist/component/payoutSnapshots/schema.d.ts.map +1 -0
  209. package/dist/component/payoutSnapshots/schema.js +108 -0
  210. package/dist/component/payoutSnapshots/schema.js.map +1 -0
  211. package/dist/component/payoutSnapshots/scope.d.ts +7 -0
  212. package/dist/component/payoutSnapshots/scope.d.ts.map +1 -0
  213. package/dist/component/payoutSnapshots/scope.js +8 -0
  214. package/dist/component/payoutSnapshots/scope.js.map +1 -0
  215. package/dist/component/payoutWorker/helpers.d.ts +30 -0
  216. package/dist/component/payoutWorker/helpers.d.ts.map +1 -0
  217. package/dist/component/payoutWorker/helpers.js +21 -0
  218. package/dist/component/payoutWorker/helpers.js.map +1 -0
  219. package/dist/component/payoutWorker/mutations.d.ts +68 -0
  220. package/dist/component/payoutWorker/mutations.d.ts.map +1 -0
  221. package/dist/component/payoutWorker/mutations.js +161 -0
  222. package/dist/component/payoutWorker/mutations.js.map +1 -0
  223. package/dist/component/payoutWorker/queries.d.ts +123 -0
  224. package/dist/component/payoutWorker/queries.d.ts.map +1 -0
  225. package/dist/component/payoutWorker/queries.js +61 -0
  226. package/dist/component/payoutWorker/queries.js.map +1 -0
  227. package/dist/component/payoutWorker/schema.d.ts +91 -0
  228. package/dist/component/payoutWorker/schema.d.ts.map +1 -0
  229. package/dist/component/payoutWorker/schema.js +27 -0
  230. package/dist/component/payoutWorker/schema.js.map +1 -0
  231. package/dist/component/schema.d.ts +479 -1
  232. package/dist/component/schema.js +19 -0
  233. package/dist/component/schema.js.map +1 -1
  234. package/dist/component/settlement/clawbackSchema.d.ts +161 -0
  235. package/dist/component/settlement/clawbackSchema.d.ts.map +1 -0
  236. package/dist/component/settlement/clawbackSchema.js +73 -0
  237. package/dist/component/settlement/clawbackSchema.js.map +1 -0
  238. package/dist/component/settlement/clawbacks.d.ts +55 -0
  239. package/dist/component/settlement/clawbacks.d.ts.map +1 -0
  240. package/dist/component/settlement/clawbacks.js +146 -0
  241. package/dist/component/settlement/clawbacks.js.map +1 -0
  242. package/dist/component/settlement/mutations.d.ts +16 -0
  243. package/dist/component/settlement/mutations.d.ts.map +1 -1
  244. package/dist/component/settlement/mutations.js +48 -0
  245. package/dist/component/settlement/mutations.js.map +1 -1
  246. package/dist/component/settlement/queries.d.ts +53 -0
  247. package/dist/component/settlement/queries.d.ts.map +1 -1
  248. package/dist/component/settlement/queries.js +26 -0
  249. package/dist/component/settlement/queries.js.map +1 -1
  250. package/dist/react/workflows/AffiliateRecovery.d.ts +46 -0
  251. package/dist/react/workflows/AffiliateRecovery.d.ts.map +1 -0
  252. package/dist/react/workflows/AffiliateRecovery.js +84 -0
  253. package/dist/react/workflows/AffiliateRecovery.js.map +1 -0
  254. package/dist/react/workflows/index.d.ts +2 -0
  255. package/dist/react/workflows/index.d.ts.map +1 -1
  256. package/dist/react/workflows/index.js +1 -0
  257. package/dist/react/workflows/index.js.map +1 -1
  258. package/dist/testing/affiliate-recovery.d.ts +10 -0
  259. package/dist/testing/affiliate-recovery.d.ts.map +1 -0
  260. package/dist/testing/affiliate-recovery.js +126 -0
  261. package/dist/testing/affiliate-recovery.js.map +1 -0
  262. package/dist/testing/index.d.ts +2 -0
  263. package/dist/testing/index.d.ts.map +1 -1
  264. package/dist/testing/index.js +1 -0
  265. package/dist/testing/index.js.map +1 -1
  266. package/docs/affiliate-clawbacks.md +306 -0
  267. package/docs/read-contracts.md +48 -0
  268. package/docs/settlement.md +145 -1
  269. package/package.json +2 -1
  270. package/src/client/affiliateRecovery/disputes.ts +62 -0
  271. package/src/client/affiliateRecovery/engine.ts +196 -0
  272. package/src/client/affiliateRecovery/payoutGate.ts +65 -0
  273. package/src/client/affiliateRecovery/provider.ts +127 -0
  274. package/src/client/affiliateRecovery/review.ts +117 -0
  275. package/src/client/affiliateRecovery/validators.ts +38 -0
  276. package/src/client/affiliateRecovery.ts +173 -0
  277. package/src/client/billing/checkout.ts +11 -359
  278. package/src/client/billing/checkoutRequest.ts +362 -0
  279. package/src/client/billing/prepared-checkout.test.ts +430 -0
  280. package/src/client/billing/preparedCheckout.ts +143 -0
  281. package/src/client/checkoutRequests.ts +40 -0
  282. package/src/client/connect/commissionReceipts.test.ts +157 -0
  283. package/src/client/connect/commissionReceipts.ts +23 -0
  284. package/src/client/connect/payoutCollection.test.ts +74 -0
  285. package/src/client/connect/payoutCollection.ts +82 -0
  286. package/src/client/connect/payoutExecution.test.ts +1 -211
  287. package/src/client/connect/payoutExecutionTestHelpers.ts +213 -0
  288. package/src/client/connect/payoutWorker.test.ts +145 -0
  289. package/src/client/connect/payoutWorker.ts +144 -0
  290. package/src/client/connect/payouts.ts +75 -15
  291. package/src/client/connect/refundPrincipal.test.ts +46 -0
  292. package/src/client/connect/refundPrincipal.ts +26 -0
  293. package/src/client/connect/reversalExecution.ts +130 -0
  294. package/src/client/connect/transfers.test.ts +3 -3
  295. package/src/client/connect/transfers.ts +93 -92
  296. package/src/client/index.ts +16 -28
  297. package/src/client/payoutPolicy.ts +26 -1
  298. package/src/client/readContracts.ts +23 -0
  299. package/src/client/settlement/execution.test.ts +5 -0
  300. package/src/client/settlement/execution.ts +50 -3
  301. package/src/client/settlement/reconciliation.ts +20 -2
  302. package/src/client/webhooks/disputeRecovery.ts +74 -0
  303. package/src/client/webhooks/processors.test.ts +36 -53
  304. package/src/client/webhooks/processors.ts +18 -31
  305. package/src/component/_generated/api.ts +40 -0
  306. package/src/component/_generated/component.ts +975 -1
  307. package/src/component/affiliate-clawbacks.test.ts +370 -0
  308. package/src/component/affiliate-component-pagination.test.ts +83 -0
  309. package/src/component/affiliate-direct-payout.test.ts +160 -0
  310. package/src/component/affiliate-recovery-lifecycle.test.ts +587 -0
  311. package/src/component/affiliateEarnings/mutations.ts +196 -0
  312. package/src/component/affiliatePayouts/mutations.ts +121 -0
  313. package/src/component/affiliatePayouts/queries.ts +28 -0
  314. package/src/component/affiliatePayouts/recipientGuard.ts +42 -0
  315. package/src/component/affiliateRecovery/accounting.ts +111 -0
  316. package/src/component/affiliateRecovery/mutations.ts +275 -0
  317. package/src/component/affiliateRecovery/queries.ts +138 -0
  318. package/src/component/affiliateRecovery/schema.ts +86 -0
  319. package/src/component/connect/mutations.ts +9 -160
  320. package/src/component/connect/queries.ts +4 -47
  321. package/src/component/connect/reversalClaims.ts +232 -0
  322. package/src/component/connect/reversalDiagnostics.ts +61 -0
  323. package/src/component/connect/reversalReceipts.ts +147 -0
  324. package/src/component/connect/schema.ts +3 -3
  325. package/src/component/connect/validators.ts +2 -0
  326. package/src/component/core/mutations.ts +2 -0
  327. package/src/component/core/resetSafety.ts +67 -0
  328. package/src/component/earnings/triggers.ts +2 -0
  329. package/src/component/payout-recovery-integration.test.ts +172 -0
  330. package/src/component/payout-reset-safety.test.ts +148 -0
  331. package/src/component/payout-revisions.test.ts +125 -0
  332. package/src/component/payout-snapshots.test.ts +395 -0
  333. package/src/component/payout-worker.test.ts +165 -0
  334. package/src/component/payoutPolicy/schema.ts +3 -1
  335. package/src/component/payoutRelease/mutations.ts +10 -1
  336. package/src/component/payoutRelease/queries.ts +3 -1
  337. package/src/component/payoutRelease/schema.ts +1 -0
  338. package/src/component/payoutSnapshots/localState.ts +238 -0
  339. package/src/component/payoutSnapshots/mutations.ts +275 -0
  340. package/src/component/payoutSnapshots/revisions.ts +247 -0
  341. package/src/component/payoutSnapshots/schema.ts +125 -0
  342. package/src/component/payoutSnapshots/scope.ts +7 -0
  343. package/src/component/payoutWorker/helpers.ts +30 -0
  344. package/src/component/payoutWorker/mutations.ts +181 -0
  345. package/src/component/payoutWorker/queries.ts +64 -0
  346. package/src/component/payoutWorker/schema.ts +26 -0
  347. package/src/component/public.test.ts +2 -2
  348. package/src/component/schema.ts +36 -0
  349. package/src/component/settlement/clawbackSchema.ts +78 -0
  350. package/src/component/settlement/clawbacks.ts +233 -0
  351. package/src/component/settlement/mutations.ts +54 -0
  352. package/src/component/settlement/queries.ts +35 -0
  353. package/src/component/summary-arithmetic.test.ts +9 -4
  354. package/src/react/workflows/AffiliateRecovery.test.tsx +106 -0
  355. package/src/react/workflows/AffiliateRecovery.tsx +273 -0
  356. package/src/react/workflows/index.ts +9 -0
  357. package/src/testing/affiliate-recovery.ts +137 -0
  358. package/src/testing/index.ts +2 -0
@@ -1,4 +1,449 @@
1
1
  declare const _default: import("convex/server").SchemaDefinition<{
2
+ payoutWorkerJobs: import("convex/server").TableDefinition<import("convex/values").VObject<{
3
+ accountId: string;
4
+ cadenceMs: number;
5
+ completedGeneration?: number | undefined;
6
+ completedOperationKey?: string | undefined;
7
+ currency: string;
8
+ generation: number;
9
+ hasOperation: boolean;
10
+ lastAttemptAt?: number | undefined;
11
+ lastReason?: string | undefined;
12
+ leaseUntil?: number | undefined;
13
+ nextAttemptAt: number;
14
+ operationKey?: string | undefined;
15
+ ownerKey: string;
16
+ sequence: number;
17
+ }, {
18
+ accountId: import("convex/values").VString<string, "required">;
19
+ ownerKey: import("convex/values").VString<string, "required">;
20
+ currency: import("convex/values").VString<string, "required">;
21
+ generation: import("convex/values").VFloat64<number, "required">;
22
+ sequence: import("convex/values").VFloat64<number, "required">;
23
+ cadenceMs: import("convex/values").VFloat64<number, "required">;
24
+ nextAttemptAt: import("convex/values").VFloat64<number, "required">;
25
+ leaseUntil: import("convex/values").VFloat64<number | undefined, "optional">;
26
+ operationKey: import("convex/values").VString<string | undefined, "optional">;
27
+ hasOperation: import("convex/values").VBoolean<boolean, "required">;
28
+ lastReason: import("convex/values").VString<string | undefined, "optional">;
29
+ lastAttemptAt: import("convex/values").VFloat64<number | undefined, "optional">;
30
+ completedGeneration: import("convex/values").VFloat64<number | undefined, "optional">;
31
+ completedOperationKey: import("convex/values").VString<string | undefined, "optional">;
32
+ }, "required", "accountId" | "cadenceMs" | "completedGeneration" | "completedOperationKey" | "currency" | "generation" | "hasOperation" | "lastAttemptAt" | "lastReason" | "leaseUntil" | "nextAttemptAt" | "operationKey" | "ownerKey" | "sequence">, {
33
+ by_account_currency: ["accountId", "currency", "_creationTime"];
34
+ by_operation_pending: ["hasOperation", "nextAttemptAt", "_creationTime"];
35
+ }, {}, {}>;
36
+ payoutFinancialRevisions: import("convex/server").TableDefinition<import("convex/values").VObject<{
37
+ accountId: string;
38
+ revision: number;
39
+ riskRevision: number;
40
+ }, {
41
+ accountId: import("convex/values").VString<string, "required">;
42
+ revision: import("convex/values").VFloat64<number, "required">;
43
+ riskRevision: import("convex/values").VFloat64<number, "required">;
44
+ }, "required", "accountId" | "revision" | "riskRevision">, {
45
+ by_account: ["accountId", "_creationTime"];
46
+ }, {}, {}>;
47
+ payoutRiskEvents: import("convex/server").TableDefinition<import("convex/values").VObject<{
48
+ accountId: string;
49
+ key: string;
50
+ kind: "allocation" | "claim" | "fee" | "provider_payout" | "transfer";
51
+ removed?: boolean | undefined;
52
+ riskRevision: number;
53
+ }, {
54
+ accountId: import("convex/values").VString<string, "required">;
55
+ riskRevision: import("convex/values").VFloat64<number, "required">;
56
+ kind: import("convex/values").VUnion<"allocation" | "claim" | "fee" | "provider_payout" | "transfer", [import("convex/values").VLiteral<"transfer", "required">, import("convex/values").VLiteral<"provider_payout", "required">, import("convex/values").VLiteral<"allocation", "required">, import("convex/values").VLiteral<"claim", "required">, import("convex/values").VLiteral<"fee", "required">], "required", never>;
57
+ key: import("convex/values").VString<string, "required">;
58
+ removed: import("convex/values").VBoolean<boolean | undefined, "optional">;
59
+ }, "required", "accountId" | "key" | "kind" | "removed" | "riskRevision">, {
60
+ by_account_revision: ["accountId", "riskRevision", "_creationTime"];
61
+ }, {}, {}>;
62
+ payoutRiskRevisions: import("convex/server").TableDefinition<import("convex/values").VObject<{
63
+ accountId: string;
64
+ riskRevision: number;
65
+ }, {
66
+ accountId: import("convex/values").VString<string, "required">;
67
+ riskRevision: import("convex/values").VFloat64<number, "required">;
68
+ }, "required", "accountId" | "riskRevision">, {
69
+ by_account: ["accountId", "_creationTime"];
70
+ }, {}, {}>;
71
+ payoutSnapshots: import("convex/server").TableDefinition<import("convex/values").VObject<{
72
+ accountId: string;
73
+ allocationCount: number;
74
+ allocationCursor?: string | undefined;
75
+ claimCount: number;
76
+ claimCursor?: string | undefined;
77
+ deferredPositiveChanges: boolean;
78
+ expectedRevision: number;
79
+ expiresAt: number;
80
+ feeCount: number;
81
+ feeCursor?: string | undefined;
82
+ initialRevision: number;
83
+ initialRiskRevision: number;
84
+ observedRevision: number;
85
+ operationKey: string;
86
+ ownerKey: string;
87
+ phase: "allocations" | "check" | "claims" | "discarding" | "fees" | "invalidated" | "local_ready" | "repair" | "sources";
88
+ policyMode?: string | undefined;
89
+ policyOperationKey?: string | undefined;
90
+ providerChanged: boolean;
91
+ readOnly: boolean;
92
+ reason?: string | undefined;
93
+ riskRevision: number;
94
+ sourceCount: number;
95
+ sourceCursor?: string | undefined;
96
+ sourceFence: number;
97
+ step: number;
98
+ }, {
99
+ readOnly: import("convex/values").VBoolean<boolean, "required">;
100
+ accountId: import("convex/values").VString<string, "required">;
101
+ ownerKey: import("convex/values").VString<string, "required">;
102
+ operationKey: import("convex/values").VString<string, "required">;
103
+ expectedRevision: import("convex/values").VFloat64<number, "required">;
104
+ policyMode: import("convex/values").VString<string | undefined, "optional">;
105
+ policyOperationKey: import("convex/values").VString<string | undefined, "optional">;
106
+ phase: import("convex/values").VUnion<"allocations" | "check" | "claims" | "discarding" | "fees" | "invalidated" | "local_ready" | "repair" | "sources", [import("convex/values").VLiteral<"sources", "required">, import("convex/values").VLiteral<"allocations", "required">, import("convex/values").VLiteral<"fees", "required">, import("convex/values").VLiteral<"claims", "required">, import("convex/values").VLiteral<"repair", "required">, import("convex/values").VLiteral<"check", "required">, import("convex/values").VLiteral<"local_ready", "required">, import("convex/values").VLiteral<"invalidated", "required">, import("convex/values").VLiteral<"discarding", "required">], "required", never>;
107
+ step: import("convex/values").VFloat64<number, "required">;
108
+ sourceFence: import("convex/values").VFloat64<number, "required">;
109
+ sourceCursor: import("convex/values").VString<string | undefined, "optional">;
110
+ allocationCursor: import("convex/values").VString<string | undefined, "optional">;
111
+ feeCursor: import("convex/values").VString<string | undefined, "optional">;
112
+ claimCursor: import("convex/values").VString<string | undefined, "optional">;
113
+ initialRevision: import("convex/values").VFloat64<number, "required">;
114
+ initialRiskRevision: import("convex/values").VFloat64<number, "required">;
115
+ riskRevision: import("convex/values").VFloat64<number, "required">;
116
+ observedRevision: import("convex/values").VFloat64<number, "required">;
117
+ sourceCount: import("convex/values").VFloat64<number, "required">;
118
+ allocationCount: import("convex/values").VFloat64<number, "required">;
119
+ claimCount: import("convex/values").VFloat64<number, "required">;
120
+ feeCount: import("convex/values").VFloat64<number, "required">;
121
+ deferredPositiveChanges: import("convex/values").VBoolean<boolean, "required">;
122
+ providerChanged: import("convex/values").VBoolean<boolean, "required">;
123
+ expiresAt: import("convex/values").VFloat64<number, "required">;
124
+ reason: import("convex/values").VString<string | undefined, "optional">;
125
+ }, "required", "accountId" | "allocationCount" | "allocationCursor" | "claimCount" | "claimCursor" | "deferredPositiveChanges" | "expectedRevision" | "expiresAt" | "feeCount" | "feeCursor" | "initialRevision" | "initialRiskRevision" | "observedRevision" | "operationKey" | "ownerKey" | "phase" | "policyMode" | "policyOperationKey" | "providerChanged" | "readOnly" | "reason" | "riskRevision" | "sourceCount" | "sourceCursor" | "sourceFence" | "step">, {
126
+ by_account_phase: ["accountId", "phase", "_creationTime"];
127
+ by_operation: ["operationKey", "_creationTime"];
128
+ by_read_only: ["readOnly", "_creationTime"];
129
+ }, {}, {}>;
130
+ payoutSnapshotSources: import("convex/server").TableDefinition<import("convex/values").VObject<{
131
+ allocationCurrency?: string | undefined;
132
+ allocationPresent: boolean;
133
+ amount: number;
134
+ currency: string;
135
+ expectedPaid: number;
136
+ expectedReserved: number;
137
+ ledgerFingerprint: string;
138
+ needsCheck: boolean;
139
+ paidAmount: number;
140
+ reinstatement: boolean;
141
+ reservedAmount: number;
142
+ reversalClaimedAmount: number;
143
+ reversedAmount: number;
144
+ role?: string | undefined;
145
+ snapshotId: import("convex/values").GenericId<"payoutSnapshots">;
146
+ sourceChargeId?: string | undefined;
147
+ sourceCreatedAt: number;
148
+ status: string;
149
+ stripeTransferId: string;
150
+ }, {
151
+ snapshotId: import("convex/values").VId<import("convex/values").GenericId<"payoutSnapshots">, "required">;
152
+ stripeTransferId: import("convex/values").VString<string, "required">;
153
+ ledgerFingerprint: import("convex/values").VString<string, "required">;
154
+ sourceCreatedAt: import("convex/values").VFloat64<number, "required">;
155
+ currency: import("convex/values").VString<string, "required">;
156
+ amount: import("convex/values").VFloat64<number, "required">;
157
+ status: import("convex/values").VString<string, "required">;
158
+ role: import("convex/values").VString<string | undefined, "optional">;
159
+ sourceChargeId: import("convex/values").VString<string | undefined, "optional">;
160
+ reversedAmount: import("convex/values").VFloat64<number, "required">;
161
+ reversalClaimedAmount: import("convex/values").VFloat64<number, "required">;
162
+ reinstatement: import("convex/values").VBoolean<boolean, "required">;
163
+ allocationPresent: import("convex/values").VBoolean<boolean, "required">;
164
+ allocationCurrency: import("convex/values").VString<string | undefined, "optional">;
165
+ paidAmount: import("convex/values").VFloat64<number, "required">;
166
+ reservedAmount: import("convex/values").VFloat64<number, "required">;
167
+ expectedPaid: import("convex/values").VFloat64<number, "required">;
168
+ expectedReserved: import("convex/values").VFloat64<number, "required">;
169
+ needsCheck: import("convex/values").VBoolean<boolean, "required">;
170
+ }, "required", "allocationCurrency" | "allocationPresent" | "amount" | "currency" | "expectedPaid" | "expectedReserved" | "ledgerFingerprint" | "needsCheck" | "paidAmount" | "reinstatement" | "reservedAmount" | "reversalClaimedAmount" | "reversedAmount" | "role" | "snapshotId" | "sourceChargeId" | "sourceCreatedAt" | "status" | "stripeTransferId">, {
171
+ by_snapshot: ["snapshotId", "_creationTime"];
172
+ by_snapshot_check: ["snapshotId", "needsCheck", "_creationTime"];
173
+ by_snapshot_transfer: ["snapshotId", "stripeTransferId", "_creationTime"];
174
+ }, {}, {}>;
175
+ payoutSnapshotClaims: import("convex/server").TableDefinition<import("convex/values").VObject<{
176
+ allocations: {
177
+ amount: number;
178
+ role?: string | undefined;
179
+ stripeTransferId: string;
180
+ }[];
181
+ amount: number;
182
+ currency: string;
183
+ fingerprint: string;
184
+ historical?: boolean | undefined;
185
+ operationKey: string;
186
+ providerFee?: number | undefined;
187
+ snapshotId: import("convex/values").GenericId<"payoutSnapshots">;
188
+ status: string;
189
+ stripePayoutId?: string | undefined;
190
+ }, {
191
+ snapshotId: import("convex/values").VId<import("convex/values").GenericId<"payoutSnapshots">, "required">;
192
+ operationKey: import("convex/values").VString<string, "required">;
193
+ fingerprint: import("convex/values").VString<string, "required">;
194
+ currency: import("convex/values").VString<string, "required">;
195
+ amount: import("convex/values").VFloat64<number, "required">;
196
+ status: import("convex/values").VString<string, "required">;
197
+ stripePayoutId: import("convex/values").VString<string | undefined, "optional">;
198
+ historical: import("convex/values").VBoolean<boolean | undefined, "optional">;
199
+ providerFee: import("convex/values").VFloat64<number | undefined, "optional">;
200
+ allocations: import("convex/values").VArray<{
201
+ amount: number;
202
+ role?: string | undefined;
203
+ stripeTransferId: string;
204
+ }[], import("convex/values").VObject<{
205
+ amount: number;
206
+ role?: string | undefined;
207
+ stripeTransferId: string;
208
+ }, {
209
+ stripeTransferId: import("convex/values").VString<string, "required">;
210
+ amount: import("convex/values").VFloat64<number, "required">;
211
+ role: import("convex/values").VString<string | undefined, "optional">;
212
+ }, "required", "amount" | "role" | "stripeTransferId">, "required">;
213
+ }, "required", "allocations" | "amount" | "currency" | "fingerprint" | "historical" | "operationKey" | "providerFee" | "snapshotId" | "status" | "stripePayoutId">, {
214
+ by_snapshot: ["snapshotId", "_creationTime"];
215
+ by_snapshot_operation: ["snapshotId", "operationKey", "_creationTime"];
216
+ }, {}, {}>;
217
+ payoutSnapshotFees: import("convex/server").TableDefinition<import("convex/values").VObject<{
218
+ amount: number;
219
+ currency: string;
220
+ revision: number;
221
+ snapshotId: import("convex/values").GenericId<"payoutSnapshots">;
222
+ }, {
223
+ snapshotId: import("convex/values").VId<import("convex/values").GenericId<"payoutSnapshots">, "required">;
224
+ currency: import("convex/values").VString<string, "required">;
225
+ amount: import("convex/values").VFloat64<number, "required">;
226
+ revision: import("convex/values").VFloat64<number, "required">;
227
+ }, "required", "amount" | "currency" | "revision" | "snapshotId">, {
228
+ by_snapshot: ["snapshotId", "_creationTime"];
229
+ by_snapshot_currency: ["snapshotId", "currency", "_creationTime"];
230
+ }, {}, {}>;
231
+ affiliateObligations: import("convex/server").TableDefinition<import("convex/values").VObject<{
232
+ accounted?: boolean | undefined;
233
+ activeOperationId?: import("convex/values").GenericId<"affiliateRecoveryOperations"> | undefined;
234
+ affiliateAccountId: string;
235
+ chargeAmount: number;
236
+ creditAmount?: number | undefined;
237
+ currency: string;
238
+ debtAmount?: number | undefined;
239
+ debtStatus?: "open" | "settled" | undefined;
240
+ disputeId?: string | undefined;
241
+ disputeState?: "lost" | "open" | "won" | undefined;
242
+ disputedPrincipal: number;
243
+ earningId?: import("convex/values").GenericId<"affiliateEarnings"> | undefined;
244
+ finalizedAmount: number;
245
+ lastError?: string | undefined;
246
+ lastRefundId?: string | undefined;
247
+ lastState?: string | undefined;
248
+ legacyReceiptIds?: string[] | undefined;
249
+ legacyRestorationIds?: string[] | undefined;
250
+ lostPrincipal: number;
251
+ needsReconciliation: boolean;
252
+ offsetAmount?: number | undefined;
253
+ operationSequence?: number | undefined;
254
+ operatorNote?: string | undefined;
255
+ originalCommission: number;
256
+ paymentId?: string | undefined;
257
+ paymentIntentId?: string | undefined;
258
+ provisionalAmount: number;
259
+ recoveredAmount: number;
260
+ refundedPrincipal: number;
261
+ releasedCommission?: number | undefined;
262
+ reservedRecovery?: number | undefined;
263
+ reservedRestoration?: number | undefined;
264
+ restoredAmount?: number | undefined;
265
+ sourceChargeId: string;
266
+ sourceInvoiceId?: string | undefined;
267
+ storeAccountId?: string | undefined;
268
+ stripeTransferId?: string | undefined;
269
+ }, {
270
+ stripeTransferId: import("convex/values").VString<string | undefined, "optional">;
271
+ sourceChargeId: import("convex/values").VString<string, "required">;
272
+ sourceInvoiceId: import("convex/values").VString<string | undefined, "optional">;
273
+ paymentIntentId: import("convex/values").VString<string | undefined, "optional">;
274
+ paymentId: import("convex/values").VString<string | undefined, "optional">;
275
+ storeAccountId: import("convex/values").VString<string | undefined, "optional">;
276
+ lastRefundId: import("convex/values").VString<string | undefined, "optional">;
277
+ affiliateAccountId: import("convex/values").VString<string, "required">;
278
+ currency: import("convex/values").VString<string, "required">;
279
+ chargeAmount: import("convex/values").VFloat64<number, "required">;
280
+ originalCommission: import("convex/values").VFloat64<number, "required">;
281
+ refundedPrincipal: import("convex/values").VFloat64<number, "required">;
282
+ disputedPrincipal: import("convex/values").VFloat64<number, "required">;
283
+ lostPrincipal: import("convex/values").VFloat64<number, "required">;
284
+ finalizedAmount: import("convex/values").VFloat64<number, "required">;
285
+ provisionalAmount: import("convex/values").VFloat64<number, "required">;
286
+ recoveredAmount: import("convex/values").VFloat64<number, "required">;
287
+ needsReconciliation: import("convex/values").VBoolean<boolean, "required">;
288
+ accounted: import("convex/values").VBoolean<boolean | undefined, "optional">;
289
+ legacyReceiptIds: import("convex/values").VArray<string[] | undefined, import("convex/values").VString<string, "required">, "optional">;
290
+ legacyRestorationIds: import("convex/values").VArray<string[] | undefined, import("convex/values").VString<string, "required">, "optional">;
291
+ operatorNote: import("convex/values").VString<string | undefined, "optional">;
292
+ earningId: import("convex/values").VId<import("convex/values").GenericId<"affiliateEarnings"> | undefined, "optional">;
293
+ releasedCommission: import("convex/values").VFloat64<number | undefined, "optional">;
294
+ offsetAmount: import("convex/values").VFloat64<number | undefined, "optional">;
295
+ restoredAmount: import("convex/values").VFloat64<number | undefined, "optional">;
296
+ reservedRecovery: import("convex/values").VFloat64<number | undefined, "optional">;
297
+ reservedRestoration: import("convex/values").VFloat64<number | undefined, "optional">;
298
+ debtAmount: import("convex/values").VFloat64<number | undefined, "optional">;
299
+ creditAmount: import("convex/values").VFloat64<number | undefined, "optional">;
300
+ debtStatus: import("convex/values").VUnion<"open" | "settled" | undefined, [import("convex/values").VLiteral<"open", "required">, import("convex/values").VLiteral<"settled", "required">], "optional", never>;
301
+ disputeState: import("convex/values").VUnion<"lost" | "open" | "won" | undefined, [import("convex/values").VLiteral<"open", "required">, import("convex/values").VLiteral<"lost", "required">, import("convex/values").VLiteral<"won", "required">], "optional", never>;
302
+ disputeId: import("convex/values").VString<string | undefined, "optional">;
303
+ activeOperationId: import("convex/values").VId<import("convex/values").GenericId<"affiliateRecoveryOperations"> | undefined, "optional">;
304
+ lastState: import("convex/values").VString<string | undefined, "optional">;
305
+ lastError: import("convex/values").VString<string | undefined, "optional">;
306
+ operationSequence: import("convex/values").VFloat64<number | undefined, "optional">;
307
+ }, "required", "accounted" | "activeOperationId" | "affiliateAccountId" | "chargeAmount" | "creditAmount" | "currency" | "debtAmount" | "debtStatus" | "disputeId" | "disputeState" | "disputedPrincipal" | "earningId" | "finalizedAmount" | "lastError" | "lastRefundId" | "lastState" | "legacyReceiptIds" | "legacyRestorationIds" | "lostPrincipal" | "needsReconciliation" | "offsetAmount" | "operationSequence" | "operatorNote" | "originalCommission" | "paymentId" | "paymentIntentId" | "provisionalAmount" | "recoveredAmount" | "refundedPrincipal" | "releasedCommission" | "reservedRecovery" | "reservedRestoration" | "restoredAmount" | "sourceChargeId" | "sourceInvoiceId" | "storeAccountId" | "stripeTransferId">, {
308
+ by_affiliate_currency: ["affiliateAccountId", "currency", "_creationTime"];
309
+ by_affiliate_currency_debt: ["affiliateAccountId", "currency", "debtStatus", "_creationTime"];
310
+ by_charge: ["sourceChargeId", "_creationTime"];
311
+ by_transfer: ["stripeTransferId", "_creationTime"];
312
+ }, {}, {}>;
313
+ affiliateRecoveryOperations: import("convex/server").TableDefinition<import("convex/values").VObject<{
314
+ amount: number;
315
+ attempted: boolean;
316
+ createdAt: number;
317
+ error?: string | undefined;
318
+ kind: "recovery" | "restoration";
319
+ obligationId: import("convex/values").GenericId<"affiliateObligations">;
320
+ providerBaseline?: number | undefined;
321
+ receiptId?: string | undefined;
322
+ sourceEventId?: string | undefined;
323
+ state: "canceled" | "failed" | "insufficient_balance" | "pending" | "succeeded" | "unknown" | "unsupported";
324
+ }, {
325
+ obligationId: import("convex/values").VId<import("convex/values").GenericId<"affiliateObligations">, "required">;
326
+ sourceEventId: import("convex/values").VString<string | undefined, "optional">;
327
+ kind: import("convex/values").VUnion<"recovery" | "restoration", [import("convex/values").VLiteral<"recovery", "required">, import("convex/values").VLiteral<"restoration", "required">], "required", never>;
328
+ amount: import("convex/values").VFloat64<number, "required">;
329
+ state: import("convex/values").VUnion<"canceled" | "failed" | "insufficient_balance" | "pending" | "succeeded" | "unknown" | "unsupported", [import("convex/values").VLiteral<"pending", "required">, import("convex/values").VLiteral<"unknown", "required">, import("convex/values").VLiteral<"insufficient_balance", "required">, import("convex/values").VLiteral<"unsupported", "required">, import("convex/values").VLiteral<"failed", "required">, import("convex/values").VLiteral<"succeeded", "required">, import("convex/values").VLiteral<"canceled", "required">], "required", never>;
330
+ receiptId: import("convex/values").VString<string | undefined, "optional">;
331
+ error: import("convex/values").VString<string | undefined, "optional">;
332
+ attempted: import("convex/values").VBoolean<boolean, "required">;
333
+ providerBaseline: import("convex/values").VFloat64<number | undefined, "optional">;
334
+ createdAt: import("convex/values").VFloat64<number, "required">;
335
+ }, "required", "amount" | "attempted" | "createdAt" | "error" | "kind" | "obligationId" | "providerBaseline" | "receiptId" | "sourceEventId" | "state">, {
336
+ by_obligation: ["obligationId", "_creationTime"];
337
+ by_state: ["state", "_creationTime"];
338
+ }, {}, {}>;
339
+ affiliatePayoutReleases: import("convex/server").TableDefinition<import("convex/values").VObject<{
340
+ affiliateAccountId: string;
341
+ amount: number;
342
+ createdAt: number;
343
+ currency: string;
344
+ minimumAmount: number;
345
+ operationKey: string;
346
+ state: "failed" | "pending" | "submitted" | "unknown";
347
+ stripePayoutId?: string | undefined;
348
+ }, {
349
+ affiliateAccountId: import("convex/values").VString<string, "required">;
350
+ currency: import("convex/values").VString<string, "required">;
351
+ operationKey: import("convex/values").VString<string, "required">;
352
+ amount: import("convex/values").VFloat64<number, "required">;
353
+ minimumAmount: import("convex/values").VFloat64<number, "required">;
354
+ state: import("convex/values").VUnion<"failed" | "pending" | "submitted" | "unknown", [import("convex/values").VLiteral<"pending", "required">, import("convex/values").VLiteral<"unknown", "required">, import("convex/values").VLiteral<"submitted", "required">, import("convex/values").VLiteral<"failed", "required">], "required", never>;
355
+ stripePayoutId: import("convex/values").VString<string | undefined, "optional">;
356
+ createdAt: import("convex/values").VFloat64<number, "required">;
357
+ }, "required", "affiliateAccountId" | "amount" | "createdAt" | "currency" | "minimumAmount" | "operationKey" | "state" | "stripePayoutId">, {
358
+ by_key: ["operationKey", "_creationTime"];
359
+ by_state: ["state", "_creationTime"];
360
+ }, {}, {}>;
361
+ affiliateEarnings: import("convex/server").TableDefinition<import("convex/values").VObject<{
362
+ affiliateAccountId: string;
363
+ currency: string;
364
+ originalCommission: number;
365
+ paymentIntentId?: string | undefined;
366
+ releaseAmount: number;
367
+ sourceChargeId: string;
368
+ sourceInvoiceId?: string | undefined;
369
+ status: "paid" | "reserved";
370
+ stripeTransferId?: string | undefined;
371
+ withheldAmount: number;
372
+ }, {
373
+ sourceChargeId: import("convex/values").VString<string, "required">;
374
+ affiliateAccountId: import("convex/values").VString<string, "required">;
375
+ currency: import("convex/values").VString<string, "required">;
376
+ originalCommission: import("convex/values").VFloat64<number, "required">;
377
+ withheldAmount: import("convex/values").VFloat64<number, "required">;
378
+ releaseAmount: import("convex/values").VFloat64<number, "required">;
379
+ sourceInvoiceId: import("convex/values").VString<string | undefined, "optional">;
380
+ paymentIntentId: import("convex/values").VString<string | undefined, "optional">;
381
+ stripeTransferId: import("convex/values").VString<string | undefined, "optional">;
382
+ status: import("convex/values").VUnion<"paid" | "reserved", [import("convex/values").VLiteral<"reserved", "required">, import("convex/values").VLiteral<"paid", "required">], "required", never>;
383
+ }, "required", "affiliateAccountId" | "currency" | "originalCommission" | "paymentIntentId" | "releaseAmount" | "sourceChargeId" | "sourceInvoiceId" | "status" | "stripeTransferId" | "withheldAmount">, {
384
+ by_affiliate_currency: ["affiliateAccountId", "currency", "_creationTime"];
385
+ by_charge_affiliate: ["sourceChargeId", "affiliateAccountId", "_creationTime"];
386
+ }, {}, {}>;
387
+ affiliateOffsets: import("convex/server").TableDefinition<import("convex/values").VObject<{
388
+ amount: number;
389
+ earningId: import("convex/values").GenericId<"affiliateEarnings">;
390
+ obligationId: import("convex/values").GenericId<"affiliateObligations">;
391
+ }, {
392
+ earningId: import("convex/values").VId<import("convex/values").GenericId<"affiliateEarnings">, "required">;
393
+ obligationId: import("convex/values").VId<import("convex/values").GenericId<"affiliateObligations">, "required">;
394
+ amount: import("convex/values").VFloat64<number, "required">;
395
+ }, "required", "amount" | "earningId" | "obligationId">, {
396
+ by_earning: ["earningId", "_creationTime"];
397
+ by_obligation: ["obligationId", "_creationTime"];
398
+ }, {}, {}>;
399
+ affiliateRecoveryBalances: import("convex/server").TableDefinition<import("convex/values").VObject<{
400
+ activePayoutKey?: string | undefined;
401
+ affiliateAccountId: string;
402
+ currency: string;
403
+ netPayable: number;
404
+ offsetAmount: number;
405
+ originalCommission: number;
406
+ outstandingDebt: number;
407
+ pendingPayoutAmount?: number | undefined;
408
+ recoveredAmount: number;
409
+ reservedRecovery: number;
410
+ reservedRestoration: number;
411
+ restorationDue: number;
412
+ restoredAmount: number;
413
+ withheldAmount: number;
414
+ }, {
415
+ activePayoutKey: import("convex/values").VString<string | undefined, "optional">;
416
+ pendingPayoutAmount: import("convex/values").VFloat64<number | undefined, "optional">;
417
+ affiliateAccountId: import("convex/values").VString<string, "required">;
418
+ currency: import("convex/values").VString<string, "required">;
419
+ originalCommission: import("convex/values").VFloat64<number, "required">;
420
+ recoveredAmount: import("convex/values").VFloat64<number, "required">;
421
+ offsetAmount: import("convex/values").VFloat64<number, "required">;
422
+ restoredAmount: import("convex/values").VFloat64<number, "required">;
423
+ outstandingDebt: import("convex/values").VFloat64<number, "required">;
424
+ reservedRecovery: import("convex/values").VFloat64<number, "required">;
425
+ reservedRestoration: import("convex/values").VFloat64<number, "required">;
426
+ restorationDue: import("convex/values").VFloat64<number, "required">;
427
+ withheldAmount: import("convex/values").VFloat64<number, "required">;
428
+ netPayable: import("convex/values").VFloat64<number, "required">;
429
+ }, "required", "activePayoutKey" | "affiliateAccountId" | "currency" | "netPayable" | "offsetAmount" | "originalCommission" | "outstandingDebt" | "pendingPayoutAmount" | "recoveredAmount" | "reservedRecovery" | "reservedRestoration" | "restorationDue" | "restoredAmount" | "withheldAmount">, {
430
+ by_affiliate_currency: ["affiliateAccountId", "currency", "_creationTime"];
431
+ }, {}, {}>;
432
+ affiliateReversalReceipts: import("convex/server").TableDefinition<import("convex/values").VObject<{
433
+ amount: number;
434
+ operationId: string;
435
+ stripeReversalId: string;
436
+ stripeTransferId: string;
437
+ }, {
438
+ stripeReversalId: import("convex/values").VString<string, "required">;
439
+ stripeTransferId: import("convex/values").VString<string, "required">;
440
+ operationId: import("convex/values").VString<string, "required">;
441
+ amount: import("convex/values").VFloat64<number, "required">;
442
+ }, "required", "amount" | "operationId" | "stripeReversalId" | "stripeTransferId">, {
443
+ by_receipt: ["stripeReversalId", "_creationTime"];
444
+ by_transfer: ["stripeTransferId", "_creationTime"];
445
+ by_transfer_operation: ["stripeTransferId", "operationId", "_creationTime"];
446
+ }, {}, {}>;
2
447
  payoutSyncClaims: import("convex/server").TableDefinition<import("convex/values").VObject<{
3
448
  acceptedAt?: number | undefined;
4
449
  acceptedFingerprint?: string | undefined;
@@ -139,6 +584,7 @@ declare const _default: import("convex/server").SchemaDefinition<{
139
584
  by_provider_payout: ["stripePayoutId", "_creationTime"];
140
585
  by_rejection_request: ["rejection.requestId", "_creationTime"];
141
586
  by_return_receipt: ["returnTransactionId", "_creationTime"];
587
+ by_status: ["status", "_creationTime"];
142
588
  }, {}, {}>;
143
589
  payoutSourceAllocations: import("convex/server").TableDefinition<import("convex/values").VObject<{
144
590
  accountId: string;
@@ -207,6 +653,8 @@ declare const _default: import("convex/server").SchemaDefinition<{
207
653
  }, "required", "accountId" | "country" | "holdDeadline" | "mode" | "operationKey" | "ownerKey" | "previousSchedule" | "previousSchedule.interval" | "previousSchedule.monthlyDays" | "previousSchedule.weeklyDays" | "revision" | "status" | "thresholds">, {
208
654
  by_account: ["accountId", "_creationTime"];
209
655
  by_deadline: ["holdDeadline", "_creationTime"];
656
+ by_mode_status: ["mode", "status", "_creationTime"];
657
+ by_status: ["status", "_creationTime"];
210
658
  }, {}, {}>;
211
659
  payoutPolicyOperations: import("convex/server").TableDefinition<import("convex/values").VObject<{
212
660
  accountId: string;
@@ -1119,6 +1567,16 @@ declare const _default: import("convex/server").SchemaDefinition<{
1119
1567
  by_stripe_transfer_id: ["stripeTransferId", "_creationTime"];
1120
1568
  }, {}, {}>;
1121
1569
  transferReversalOps: import("convex/server").TableDefinition<import("convex/values").VObject<{
1570
+ commissionExposure?: {
1571
+ chargeAmount: number;
1572
+ disputeId?: string | undefined;
1573
+ disputeState?: "lost" | "open" | "won" | undefined;
1574
+ finalized: boolean;
1575
+ kind: "dispute" | "refund";
1576
+ principal: number;
1577
+ refundId?: string | undefined;
1578
+ refundedPrincipal?: number | undefined;
1579
+ } | undefined;
1122
1580
  operationId: string;
1123
1581
  slices: {
1124
1582
  from: number;
@@ -1142,8 +1600,28 @@ declare const _default: import("convex/server").SchemaDefinition<{
1142
1600
  from: import("convex/values").VFloat64<number, "required">;
1143
1601
  to: import("convex/values").VFloat64<number, "required">;
1144
1602
  }, "required", "from" | "stripeTransferId" | "to">, "required">;
1145
- }, "required", "operationId" | "slices" | "sourceChargeId">, {
1603
+ commissionExposure: import("convex/values").VObject<{
1604
+ chargeAmount: number;
1605
+ disputeId?: string | undefined;
1606
+ disputeState?: "lost" | "open" | "won" | undefined;
1607
+ finalized: boolean;
1608
+ kind: "dispute" | "refund";
1609
+ principal: number;
1610
+ refundId?: string | undefined;
1611
+ refundedPrincipal?: number | undefined;
1612
+ } | undefined, {
1613
+ kind: import("convex/values").VUnion<"dispute" | "refund", [import("convex/values").VLiteral<"refund", "required">, import("convex/values").VLiteral<"dispute", "required">], "required", never>;
1614
+ chargeAmount: import("convex/values").VFloat64<number, "required">;
1615
+ principal: import("convex/values").VFloat64<number, "required">;
1616
+ finalized: import("convex/values").VBoolean<boolean, "required">;
1617
+ disputeState: import("convex/values").VUnion<"lost" | "open" | "won" | undefined, [import("convex/values").VLiteral<"open", "required">, import("convex/values").VLiteral<"lost", "required">, import("convex/values").VLiteral<"won", "required">], "optional", never>;
1618
+ disputeId: import("convex/values").VString<string | undefined, "optional">;
1619
+ refundedPrincipal: import("convex/values").VFloat64<number | undefined, "optional">;
1620
+ refundId: import("convex/values").VString<string | undefined, "optional">;
1621
+ }, "optional", "chargeAmount" | "disputeId" | "disputeState" | "finalized" | "kind" | "principal" | "refundId" | "refundedPrincipal">;
1622
+ }, "required", "commissionExposure" | "commissionExposure.chargeAmount" | "commissionExposure.disputeId" | "commissionExposure.disputeState" | "commissionExposure.finalized" | "commissionExposure.kind" | "commissionExposure.principal" | "commissionExposure.refundId" | "commissionExposure.refundedPrincipal" | "operationId" | "slices" | "sourceChargeId">, {
1146
1623
  by_operation_id: ["operationId", "_creationTime"];
1624
+ by_source_charge: ["sourceChargeId", "_creationTime"];
1147
1625
  }, {}, {}>;
1148
1626
  webhookEvents: import("convex/server").TableDefinition<import("convex/values").VObject<{
1149
1627
  eventType: string;
@@ -1,4 +1,8 @@
1
+ import { jobsTable as payoutWorkerJobsTable } from "./payoutWorker/schema.js";
2
+ import { financialRevisionsTable, riskEventsTable, riskRevisionsTable, snapshotsTable, snapshotSourcesTable, snapshotClaimsTable, snapshotFeesTable, } from "./payoutSnapshots/schema.js";
1
3
  import { claimsTable as payoutSyncClaimsTable } from "./payoutSync/schema.js";
4
+ import { payoutReleasesTable as affiliatePayoutReleases, operationsTable as affiliateOperations, earningsTable as affiliateEarnings, offsetsTable as affiliateOffsets, balancesTable as affiliateBalances, } from "./affiliateRecovery/schema.js";
5
+ import { affiliateObligationsTable, affiliateReversalReceiptsTable, } from "./settlement/clawbackSchema.js";
2
6
  import { feeBalancesTable as payoutFeeBalancesTable, claimsTable as payoutReleaseClaimsTable, sourcesTable as payoutSourceAllocationsTable, } from "./payoutRelease/schema.js";
3
7
  import { policiesTable, operationsTable } from "./payoutPolicy/schema.js";
4
8
  import { currencyTotalsTable } from "./earnings/schema.js";
@@ -11,6 +15,21 @@ import { accountsTable } from "./core/schema";
11
15
  import { pricesTable, productsTable } from "./products/schema";
12
16
  import { webhookEventsTable } from "./webhooks/schema";
13
17
  export default defineSchema({
18
+ payoutWorkerJobs: payoutWorkerJobsTable,
19
+ payoutFinancialRevisions: financialRevisionsTable,
20
+ payoutRiskEvents: riskEventsTable,
21
+ payoutRiskRevisions: riskRevisionsTable,
22
+ payoutSnapshots: snapshotsTable,
23
+ payoutSnapshotSources: snapshotSourcesTable,
24
+ payoutSnapshotClaims: snapshotClaimsTable,
25
+ payoutSnapshotFees: snapshotFeesTable,
26
+ affiliateObligations: affiliateObligationsTable,
27
+ affiliateRecoveryOperations: affiliateOperations,
28
+ affiliatePayoutReleases,
29
+ affiliateEarnings,
30
+ affiliateOffsets,
31
+ affiliateRecoveryBalances: affiliateBalances,
32
+ affiliateReversalReceipts: affiliateReversalReceiptsTable,
14
33
  payoutSyncClaims: payoutSyncClaimsTable,
15
34
  payoutFeeBalances: payoutFeeBalancesTable,
16
35
  payoutReleaseClaims: payoutReleaseClaimsTable,
@@ -1 +1 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/component/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,IAAI,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC9E,OAAO,EACL,gBAAgB,IAAI,sBAAsB,EAC1C,WAAW,IAAI,wBAAwB,EACvC,YAAY,IAAI,4BAA4B,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