@fantastic.dev/better-stripe 0.7.0 → 0.8.1

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 (359) hide show
  1. package/CHANGELOG.md +29 -18
  2. package/README.md +123 -91
  3. package/dist/client/billing/checkout.d.ts +1 -1
  4. package/dist/client/billing/checkout.d.ts.map +1 -1
  5. package/dist/client/billing/checkout.js +7 -2
  6. package/dist/client/billing/checkout.js.map +1 -1
  7. package/dist/client/connect/disputes.d.ts +1 -1
  8. package/dist/client/connect/disputes.d.ts.map +1 -1
  9. package/dist/client/connect/disputes.js +12 -6
  10. package/dist/client/connect/disputes.js.map +1 -1
  11. package/dist/client/connect/paymentMethods.d.ts.map +1 -1
  12. package/dist/client/connect/paymentMethods.js.map +1 -1
  13. package/dist/client/connect/refundActor.d.ts.map +1 -1
  14. package/dist/client/connect/refundActor.js.map +1 -1
  15. package/dist/client/connect/refunds.d.ts.map +1 -1
  16. package/dist/client/connect/refunds.js.map +1 -1
  17. package/dist/client/connect/transfers.d.ts.map +1 -1
  18. package/dist/client/connect/transfers.js +15 -4
  19. package/dist/client/connect/transfers.js.map +1 -1
  20. package/dist/client/core/accountDefaults.d.ts +6 -0
  21. package/dist/client/core/accountDefaults.d.ts.map +1 -0
  22. package/dist/client/core/accountDefaults.js +15 -0
  23. package/dist/client/core/accountDefaults.js.map +1 -0
  24. package/dist/client/core/accounts.d.ts +1 -5
  25. package/dist/client/core/accounts.d.ts.map +1 -1
  26. package/dist/client/core/accounts.js +2 -14
  27. package/dist/client/core/accounts.js.map +1 -1
  28. package/dist/client/core/fees.d.ts.map +1 -1
  29. package/dist/client/core/fees.js +7 -2
  30. package/dist/client/core/fees.js.map +1 -1
  31. package/dist/client/index.d.ts +1 -1
  32. package/dist/client/index.d.ts.map +1 -1
  33. package/dist/client/products/prices.d.ts.map +1 -1
  34. package/dist/client/products/prices.js.map +1 -1
  35. package/dist/client/products/products.d.ts.map +1 -1
  36. package/dist/client/products/products.js +3 -1
  37. package/dist/client/products/products.js.map +1 -1
  38. package/dist/client/utils/owner.d.ts.map +1 -1
  39. package/dist/client/utils/owner.js +3 -1
  40. package/dist/client/utils/owner.js.map +1 -1
  41. package/dist/client/utils/stripeDashboardUrl.d.ts.map +1 -1
  42. package/dist/client/utils/stripeDashboardUrl.js.map +1 -1
  43. package/dist/client/webhooks/helpers.d.ts +10 -0
  44. package/dist/client/webhooks/helpers.d.ts.map +1 -1
  45. package/dist/client/webhooks/helpers.js +18 -0
  46. package/dist/client/webhooks/helpers.js.map +1 -1
  47. package/dist/client/webhooks/processors.d.ts.map +1 -1
  48. package/dist/client/webhooks/processors.js +1 -19
  49. package/dist/client/webhooks/processors.js.map +1 -1
  50. package/dist/component/connect/mutations.d.ts.map +1 -1
  51. package/dist/component/connect/mutations.js +4 -33
  52. package/dist/component/connect/mutations.js.map +1 -1
  53. package/dist/component/connect/schema.d.ts.map +1 -1
  54. package/dist/component/connect/schema.js.map +1 -1
  55. package/dist/component/lib/paymentSeller.d.ts +3 -0
  56. package/dist/component/lib/paymentSeller.d.ts.map +1 -0
  57. package/dist/component/lib/paymentSeller.js +10 -0
  58. package/dist/component/lib/paymentSeller.js.map +1 -0
  59. package/dist/component/lib/reversals.d.ts +10 -0
  60. package/dist/component/lib/reversals.d.ts.map +1 -1
  61. package/dist/component/lib/reversals.js +17 -0
  62. package/dist/component/lib/reversals.js.map +1 -1
  63. package/dist/react/components/ConnectProvider.d.ts +1 -1
  64. package/dist/react/components/ConnectProvider.d.ts.map +1 -1
  65. package/dist/react/components/ConnectProvider.js +18 -4
  66. package/dist/react/components/ConnectProvider.js.map +1 -1
  67. package/dist/react/components/ConnectStatusBadge.d.ts.map +1 -1
  68. package/dist/react/components/ConnectStatusBadge.js.map +1 -1
  69. package/dist/react/components/DisputeDetail.d.ts +4 -1
  70. package/dist/react/components/DisputeDetail.d.ts.map +1 -1
  71. package/dist/react/components/DisputeDetail.js +12 -6
  72. package/dist/react/components/DisputeDetail.js.map +1 -1
  73. package/dist/react/components/DisputesList.d.ts.map +1 -1
  74. package/dist/react/components/DisputesList.js +2 -1
  75. package/dist/react/components/DisputesList.js.map +1 -1
  76. package/dist/react/components/EmbeddedDisputes.d.ts +1 -1
  77. package/dist/react/components/EmbeddedDisputes.d.ts.map +1 -1
  78. package/dist/react/components/EmbeddedDisputes.js +1 -1
  79. package/dist/react/components/EmbeddedDisputes.js.map +1 -1
  80. package/dist/react/components/SplitBreakdown.d.ts.map +1 -1
  81. package/dist/react/components/SplitBreakdown.js +12 -2
  82. package/dist/react/components/SplitBreakdown.js.map +1 -1
  83. package/dist/react/hooks/useCheckoutSession.d.ts.map +1 -1
  84. package/dist/react/hooks/useCheckoutSession.js.map +1 -1
  85. package/dist/react/hooks/useConfirmPayment.d.ts.map +1 -1
  86. package/dist/react/hooks/useConfirmPayment.js.map +1 -1
  87. package/dist/react/index.d.ts +2 -1
  88. package/dist/react/index.d.ts.map +1 -1
  89. package/dist/react/index.js +3 -1
  90. package/dist/react/index.js.map +1 -1
  91. package/dist/react/workflows/Account.d.ts +67 -0
  92. package/dist/react/workflows/Account.d.ts.map +1 -0
  93. package/dist/react/workflows/Account.js +74 -0
  94. package/dist/react/workflows/Account.js.map +1 -0
  95. package/dist/react/workflows/Billing.d.ts +60 -0
  96. package/dist/react/workflows/Billing.d.ts.map +1 -0
  97. package/dist/react/workflows/Billing.js +84 -0
  98. package/dist/react/workflows/Billing.js.map +1 -0
  99. package/dist/react/workflows/BillingPlans.d.ts +45 -0
  100. package/dist/react/workflows/BillingPlans.d.ts.map +1 -0
  101. package/dist/react/workflows/BillingPlans.js +51 -0
  102. package/dist/react/workflows/BillingPlans.js.map +1 -0
  103. package/dist/react/workflows/Checkout.d.ts +46 -0
  104. package/dist/react/workflows/Checkout.d.ts.map +1 -0
  105. package/dist/react/workflows/Checkout.js +61 -0
  106. package/dist/react/workflows/Checkout.js.map +1 -0
  107. package/dist/react/workflows/CheckoutChooser.d.ts +20 -0
  108. package/dist/react/workflows/CheckoutChooser.d.ts.map +1 -0
  109. package/dist/react/workflows/CheckoutChooser.js +24 -0
  110. package/dist/react/workflows/CheckoutChooser.js.map +1 -0
  111. package/dist/react/workflows/CheckoutForms.d.ts +26 -0
  112. package/dist/react/workflows/CheckoutForms.d.ts.map +1 -0
  113. package/dist/react/workflows/CheckoutForms.js +126 -0
  114. package/dist/react/workflows/CheckoutForms.js.map +1 -0
  115. package/dist/react/workflows/ClipboardButton.d.ts +17 -0
  116. package/dist/react/workflows/ClipboardButton.d.ts.map +1 -0
  117. package/dist/react/workflows/ClipboardButton.js +35 -0
  118. package/dist/react/workflows/ClipboardButton.js.map +1 -0
  119. package/dist/react/workflows/Collection.d.ts +30 -0
  120. package/dist/react/workflows/Collection.d.ts.map +1 -0
  121. package/dist/react/workflows/Collection.js +25 -0
  122. package/dist/react/workflows/Collection.js.map +1 -0
  123. package/dist/react/workflows/Collections.d.ts +56 -0
  124. package/dist/react/workflows/Collections.d.ts.map +1 -0
  125. package/dist/react/workflows/Collections.js +111 -0
  126. package/dist/react/workflows/Collections.js.map +1 -0
  127. package/dist/react/workflows/Connect.d.ts +19 -0
  128. package/dist/react/workflows/Connect.d.ts.map +1 -0
  129. package/dist/react/workflows/Connect.js +43 -0
  130. package/dist/react/workflows/Connect.js.map +1 -0
  131. package/dist/react/workflows/Costs.d.ts +48 -0
  132. package/dist/react/workflows/Costs.d.ts.map +1 -0
  133. package/dist/react/workflows/Costs.js +66 -0
  134. package/dist/react/workflows/Costs.js.map +1 -0
  135. package/dist/react/workflows/Disputes.d.ts +36 -0
  136. package/dist/react/workflows/Disputes.d.ts.map +1 -0
  137. package/dist/react/workflows/Disputes.js +74 -0
  138. package/dist/react/workflows/Disputes.js.map +1 -0
  139. package/dist/react/workflows/Earnings.d.ts +42 -0
  140. package/dist/react/workflows/Earnings.d.ts.map +1 -0
  141. package/dist/react/workflows/Earnings.js +38 -0
  142. package/dist/react/workflows/Earnings.js.map +1 -0
  143. package/dist/react/workflows/Financials.d.ts +43 -0
  144. package/dist/react/workflows/Financials.d.ts.map +1 -0
  145. package/dist/react/workflows/Financials.js +57 -0
  146. package/dist/react/workflows/Financials.js.map +1 -0
  147. package/dist/react/workflows/IntegrationSwitch.d.ts +23 -0
  148. package/dist/react/workflows/IntegrationSwitch.d.ts.map +1 -0
  149. package/dist/react/workflows/IntegrationSwitch.js +31 -0
  150. package/dist/react/workflows/IntegrationSwitch.js.map +1 -0
  151. package/dist/react/workflows/Onboarding.d.ts +56 -0
  152. package/dist/react/workflows/Onboarding.d.ts.map +1 -0
  153. package/dist/react/workflows/Onboarding.js +86 -0
  154. package/dist/react/workflows/Onboarding.js.map +1 -0
  155. package/dist/react/workflows/Overview.d.ts +51 -0
  156. package/dist/react/workflows/Overview.d.ts.map +1 -0
  157. package/dist/react/workflows/Overview.js +63 -0
  158. package/dist/react/workflows/Overview.js.map +1 -0
  159. package/dist/react/workflows/PaymentMethods.d.ts +35 -0
  160. package/dist/react/workflows/PaymentMethods.d.ts.map +1 -0
  161. package/dist/react/workflows/PaymentMethods.js +63 -0
  162. package/dist/react/workflows/PaymentMethods.js.map +1 -0
  163. package/dist/react/workflows/PaymentReceipt.d.ts +20 -0
  164. package/dist/react/workflows/PaymentReceipt.d.ts.map +1 -0
  165. package/dist/react/workflows/PaymentReceipt.js +24 -0
  166. package/dist/react/workflows/PaymentReceipt.js.map +1 -0
  167. package/dist/react/workflows/Payouts.d.ts +48 -0
  168. package/dist/react/workflows/Payouts.d.ts.map +1 -0
  169. package/dist/react/workflows/Payouts.js +88 -0
  170. package/dist/react/workflows/Payouts.js.map +1 -0
  171. package/dist/react/workflows/Products.d.ts +92 -0
  172. package/dist/react/workflows/Products.d.ts.map +1 -0
  173. package/dist/react/workflows/Products.js +179 -0
  174. package/dist/react/workflows/Products.js.map +1 -0
  175. package/dist/react/workflows/ReferralLinks.d.ts +26 -0
  176. package/dist/react/workflows/ReferralLinks.d.ts.map +1 -0
  177. package/dist/react/workflows/ReferralLinks.js +30 -0
  178. package/dist/react/workflows/ReferralLinks.js.map +1 -0
  179. package/dist/react/workflows/Refunds.d.ts +72 -0
  180. package/dist/react/workflows/Refunds.d.ts.map +1 -0
  181. package/dist/react/workflows/Refunds.js +95 -0
  182. package/dist/react/workflows/Refunds.js.map +1 -0
  183. package/dist/react/workflows/Setup.d.ts +50 -0
  184. package/dist/react/workflows/Setup.d.ts.map +1 -0
  185. package/dist/react/workflows/Setup.js +59 -0
  186. package/dist/react/workflows/Setup.js.map +1 -0
  187. package/dist/react/workflows/Storefront.d.ts +53 -0
  188. package/dist/react/workflows/Storefront.d.ts.map +1 -0
  189. package/dist/react/workflows/Storefront.js +44 -0
  190. package/dist/react/workflows/Storefront.js.map +1 -0
  191. package/dist/react/workflows/SubscriptionOverview.d.ts +13 -0
  192. package/dist/react/workflows/SubscriptionOverview.d.ts.map +1 -0
  193. package/dist/react/workflows/SubscriptionOverview.js +26 -0
  194. package/dist/react/workflows/SubscriptionOverview.js.map +1 -0
  195. package/dist/react/workflows/Subscriptions.d.ts +92 -0
  196. package/dist/react/workflows/Subscriptions.d.ts.map +1 -0
  197. package/dist/react/workflows/Subscriptions.js +149 -0
  198. package/dist/react/workflows/Subscriptions.js.map +1 -0
  199. package/dist/react/workflows/Tasks.d.ts +40 -0
  200. package/dist/react/workflows/Tasks.d.ts.map +1 -0
  201. package/dist/react/workflows/Tasks.js +113 -0
  202. package/dist/react/workflows/Tasks.js.map +1 -0
  203. package/dist/react/workflows/checkout-options.d.ts +37 -0
  204. package/dist/react/workflows/checkout-options.d.ts.map +1 -0
  205. package/dist/react/workflows/checkout-options.js +43 -0
  206. package/dist/react/workflows/checkout-options.js.map +1 -0
  207. package/dist/react/workflows/current-subscription.d.ts +11 -0
  208. package/dist/react/workflows/current-subscription.d.ts.map +1 -0
  209. package/dist/react/workflows/current-subscription.js +14 -0
  210. package/dist/react/workflows/current-subscription.js.map +1 -0
  211. package/dist/react/workflows/filters.d.ts +17 -0
  212. package/dist/react/workflows/filters.d.ts.map +1 -0
  213. package/dist/react/workflows/filters.js +23 -0
  214. package/dist/react/workflows/filters.js.map +1 -0
  215. package/dist/react/workflows/index.d.ts +70 -0
  216. package/dist/react/workflows/index.d.ts.map +1 -0
  217. package/dist/react/workflows/index.js +38 -0
  218. package/dist/react/workflows/index.js.map +1 -0
  219. package/dist/react/workflows/useWorkflowAction.d.ts +11 -0
  220. package/dist/react/workflows/useWorkflowAction.d.ts.map +1 -0
  221. package/dist/react/workflows/useWorkflowAction.js +68 -0
  222. package/dist/react/workflows/useWorkflowAction.js.map +1 -0
  223. package/dist/react/workflows/useWorkflowResource.d.ts +9 -0
  224. package/dist/react/workflows/useWorkflowResource.d.ts.map +1 -0
  225. package/dist/react/workflows/useWorkflowResource.js +67 -0
  226. package/dist/react/workflows/useWorkflowResource.js.map +1 -0
  227. package/docs/react-workflows-audit.md +88 -0
  228. package/docs/react-workflows.md +234 -0
  229. package/package.json +19 -3
  230. package/src/client/billing/checkout-ui-modes.test.ts +49 -0
  231. package/src/client/billing/checkout.ts +8 -3
  232. package/src/client/billing/invoices.test.ts +12 -6
  233. package/src/client/connect/disputes.test.ts +15 -0
  234. package/src/client/connect/disputes.ts +13 -7
  235. package/src/client/connect/paymentMethods.test.ts +3 -1
  236. package/src/client/connect/paymentMethods.ts +4 -1
  237. package/src/client/connect/refundActor.ts +1 -2
  238. package/src/client/connect/refunds.test.ts +35 -10
  239. package/src/client/connect/refunds.ts +4 -1
  240. package/src/client/connect/transfers.test.ts +66 -12
  241. package/src/client/connect/transfers.ts +32 -8
  242. package/src/client/core/accountDefaults.ts +15 -0
  243. package/src/client/core/accounts.ts +14 -17
  244. package/src/client/core/config.test.ts +2 -1
  245. package/src/client/core/descriptors.test.ts +6 -4
  246. package/src/client/core/fees.test.ts +20 -28
  247. package/src/client/core/fees.ts +9 -2
  248. package/src/client/index.test.ts +22 -22
  249. package/src/client/index.ts +1 -1
  250. package/src/client/products/prices.test.ts +8 -2
  251. package/src/client/products/prices.ts +4 -1
  252. package/src/client/products/products.test.ts +61 -20
  253. package/src/client/products/products.ts +3 -1
  254. package/src/client/utils/data.test.ts +3 -1
  255. package/src/client/utils/owner.test.ts +4 -1
  256. package/src/client/utils/owner.ts +5 -1
  257. package/src/client/utils/stripeDashboardUrl.ts +1 -4
  258. package/src/client/webhooks/handler.test.ts +16 -19
  259. package/src/client/webhooks/helpers.test.ts +26 -13
  260. package/src/client/webhooks/helpers.ts +23 -0
  261. package/src/client/webhooks/hooks.test.ts +1 -2
  262. package/src/client/webhooks/processors.test.ts +18 -34
  263. package/src/client/webhooks/processors.ts +1 -23
  264. package/src/client/webhooks.test.ts +1 -2
  265. package/src/component/_generated/api.ts +2 -0
  266. package/src/component/connect/mutations.ts +5 -46
  267. package/src/component/connect/schema.ts +4 -3
  268. package/src/component/connect.test.ts +1 -5
  269. package/src/component/lib/paymentSeller.ts +15 -0
  270. package/src/component/lib/reversals.ts +30 -2
  271. package/src/component/subscription-scoping.test.ts +5 -1
  272. package/src/component/triggers.test.ts +7 -4
  273. package/src/react/components/BuyerBillingView.render.test.tsx +7 -2
  274. package/src/react/components/ConnectProvider.live.test.tsx +61 -0
  275. package/src/react/components/ConnectProvider.tsx +18 -4
  276. package/src/react/components/ConnectStatusBadge.tsx +1 -4
  277. package/src/react/components/DisputeDetail.render.test.tsx +5 -1
  278. package/src/react/components/DisputeDetail.tsx +14 -5
  279. package/src/react/components/DisputesList.render.test.tsx +21 -0
  280. package/src/react/components/DisputesList.tsx +2 -1
  281. package/src/react/components/EarningsSummary.render.test.tsx +2 -6
  282. package/src/react/components/EmbeddedDisputes.render.test.tsx +7 -5
  283. package/src/react/components/EmbeddedDisputes.tsx +4 -1
  284. package/src/react/components/EvidenceForm.render.test.tsx +3 -10
  285. package/src/react/components/SplitBreakdown.render.test.tsx +28 -5
  286. package/src/react/components/SplitBreakdown.tsx +12 -2
  287. package/src/react/hooks/useCheckoutSession.ts +1 -2
  288. package/src/react/hooks/useConfirmPayment.ts +1 -2
  289. package/src/react/hooks/useEarnings.test.ts +43 -8
  290. package/src/react/hooks/useStripeMode.test.ts +5 -8
  291. package/src/react/index.ts +7 -1
  292. package/src/react/workflows/Account.test.tsx +31 -0
  293. package/src/react/workflows/Account.tsx +183 -0
  294. package/src/react/workflows/Billing.test.tsx +45 -0
  295. package/src/react/workflows/Billing.tsx +213 -0
  296. package/src/react/workflows/BillingPlans.test.tsx +31 -0
  297. package/src/react/workflows/BillingPlans.tsx +130 -0
  298. package/src/react/workflows/Checkout.test.tsx +118 -0
  299. package/src/react/workflows/Checkout.tsx +135 -0
  300. package/src/react/workflows/CheckoutChooser.test.tsx +44 -0
  301. package/src/react/workflows/CheckoutChooser.tsx +77 -0
  302. package/src/react/workflows/CheckoutForm.test.tsx +66 -0
  303. package/src/react/workflows/CheckoutForms.test.tsx +123 -0
  304. package/src/react/workflows/CheckoutForms.tsx +247 -0
  305. package/src/react/workflows/ClipboardButton.test.tsx +34 -0
  306. package/src/react/workflows/ClipboardButton.tsx +67 -0
  307. package/src/react/workflows/Collection.tsx +76 -0
  308. package/src/react/workflows/Collections.test.tsx +86 -0
  309. package/src/react/workflows/Collections.tsx +213 -0
  310. package/src/react/workflows/Connect.test.tsx +50 -0
  311. package/src/react/workflows/Connect.tsx +107 -0
  312. package/src/react/workflows/Costs.test.tsx +41 -0
  313. package/src/react/workflows/Costs.tsx +133 -0
  314. package/src/react/workflows/Disputes.test.tsx +64 -0
  315. package/src/react/workflows/Disputes.tsx +173 -0
  316. package/src/react/workflows/Earnings.test.ts +19 -0
  317. package/src/react/workflows/Earnings.tsx +84 -0
  318. package/src/react/workflows/Financials.test.tsx +35 -0
  319. package/src/react/workflows/Financials.tsx +117 -0
  320. package/src/react/workflows/IntegrationSwitch.test.tsx +36 -0
  321. package/src/react/workflows/IntegrationSwitch.tsx +63 -0
  322. package/src/react/workflows/Onboarding.test.tsx +75 -0
  323. package/src/react/workflows/Onboarding.tsx +171 -0
  324. package/src/react/workflows/Overview.test.tsx +57 -0
  325. package/src/react/workflows/Overview.tsx +123 -0
  326. package/src/react/workflows/PaymentMethods.test.tsx +60 -0
  327. package/src/react/workflows/PaymentMethods.tsx +117 -0
  328. package/src/react/workflows/PaymentReceipt.test.tsx +24 -0
  329. package/src/react/workflows/PaymentReceipt.tsx +46 -0
  330. package/src/react/workflows/Payouts.test.tsx +112 -0
  331. package/src/react/workflows/Payouts.tsx +215 -0
  332. package/src/react/workflows/Products.test.tsx +90 -0
  333. package/src/react/workflows/Products.tsx +377 -0
  334. package/src/react/workflows/ReferralLinks.test.tsx +39 -0
  335. package/src/react/workflows/ReferralLinks.tsx +75 -0
  336. package/src/react/workflows/Refunds.test.tsx +75 -0
  337. package/src/react/workflows/Refunds.tsx +223 -0
  338. package/src/react/workflows/Setup.test.tsx +25 -0
  339. package/src/react/workflows/Setup.tsx +166 -0
  340. package/src/react/workflows/Storefront.test.tsx +82 -0
  341. package/src/react/workflows/Storefront.tsx +138 -0
  342. package/src/react/workflows/SubscriptionOverview.test.tsx +27 -0
  343. package/src/react/workflows/SubscriptionOverview.tsx +48 -0
  344. package/src/react/workflows/Subscriptions.test.tsx +61 -0
  345. package/src/react/workflows/Subscriptions.tsx +282 -0
  346. package/src/react/workflows/Tasks.test.tsx +23 -0
  347. package/src/react/workflows/Tasks.tsx +199 -0
  348. package/src/react/workflows/checkout-options.ts +42 -0
  349. package/src/react/workflows/current-subscription.test.ts +29 -0
  350. package/src/react/workflows/current-subscription.ts +25 -0
  351. package/src/react/workflows/filters.test.ts +12 -0
  352. package/src/react/workflows/filters.ts +22 -0
  353. package/src/react/workflows/index.ts +238 -0
  354. package/src/react/workflows/native-interactions.test.tsx +73 -0
  355. package/src/react/workflows/public-workflows.test.tsx +216 -0
  356. package/src/react/workflows/useWorkflowAction.test.tsx +54 -0
  357. package/src/react/workflows/useWorkflowAction.ts +75 -0
  358. package/src/react/workflows/useWorkflowResource.test.tsx +41 -0
  359. package/src/react/workflows/useWorkflowResource.ts +78 -0
@@ -0,0 +1,113 @@
1
+ "use client";
2
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useId, useState } from "react";
4
+ import { useWorkflowAction } from "./useWorkflowAction.js";
5
+ export function useTaskRunner({ scopeKey = "tasks", maxEntries = 100, formatResult = () => "Completed", } = {}) {
6
+ const initial = {
7
+ scope: scopeKey,
8
+ log: [],
9
+ results: {},
10
+ errors: {},
11
+ };
12
+ const [state, setState] = useState(initial);
13
+ if (state.scope !== scopeKey)
14
+ setState(initial);
15
+ const [pendingOperation, setPendingOperation] = useState(null);
16
+ const operation = useWorkflowAction(async (name, task) => {
17
+ setPendingOperation(name);
18
+ try {
19
+ return {
20
+ name,
21
+ status: "success",
22
+ value: await task(),
23
+ error: null,
24
+ };
25
+ }
26
+ catch (error) {
27
+ return {
28
+ name,
29
+ status: "error",
30
+ value: undefined,
31
+ error: error instanceof Error ? error.message : String(error),
32
+ };
33
+ }
34
+ }, scopeKey);
35
+ const run = async (name, task) => {
36
+ const result = await operation.run(name, task);
37
+ if (!result)
38
+ return undefined;
39
+ let message;
40
+ try {
41
+ message =
42
+ result.status === "error" ? result.error : formatResult(result.value);
43
+ }
44
+ catch {
45
+ message = "Completed";
46
+ }
47
+ setState((previous) => ({
48
+ ...previous,
49
+ log: [
50
+ {
51
+ id: (previous.log[0]?.id ?? 0) + 1,
52
+ timestamp: new Date().toLocaleTimeString(),
53
+ action: name,
54
+ result: message,
55
+ status: result.status,
56
+ },
57
+ ...previous.log,
58
+ ].slice(0, Math.max(1, maxEntries)),
59
+ results: result.status === "success"
60
+ ? { ...previous.results, [name]: message }
61
+ : previous.results,
62
+ errors: {
63
+ ...previous.errors,
64
+ [name]: result.status === "error" ? message : "",
65
+ },
66
+ }));
67
+ return result.status === "success" ? result.value : undefined;
68
+ };
69
+ return {
70
+ log: state.log,
71
+ results: state.results,
72
+ errors: state.errors,
73
+ isPending: operation.isPending,
74
+ pendingOperation: operation.isPending ? pendingOperation : null,
75
+ run,
76
+ appendLog: (action, result, status = "success") => setState((previous) => ({
77
+ ...previous,
78
+ log: [
79
+ {
80
+ id: (previous.log[0]?.id ?? 0) + 1,
81
+ timestamp: new Date().toLocaleTimeString(),
82
+ action,
83
+ result,
84
+ status,
85
+ },
86
+ ...previous.log,
87
+ ].slice(0, Math.max(1, maxEntries)),
88
+ })),
89
+ clearLog: () => setState((previous) => ({ ...previous, log: [] })),
90
+ };
91
+ }
92
+ /** Unstyled administration/sandbox operations. Authorization and test-mode enforcement belong to the server callbacks. */
93
+ export function WorkflowTasks(props) {
94
+ const state = useTaskRunner(props);
95
+ const [confirmed, setConfirmed] = useState({});
96
+ const id = useId();
97
+ if (props.children)
98
+ return _jsx(_Fragment, { children: props.children(state) });
99
+ return (_jsxs("section", { "data-better-stripe": "workflow-tasks", "aria-busy": state.isPending, children: [_jsx("h2", { children: props.title ?? "Stripe operations" }), props.tasks.map((task) => (_jsxs("div", { children: [_jsx("h3", { children: task.label }), task.description && _jsx("p", { children: task.description }), task.requiresConfirmation && (_jsxs("label", { htmlFor: `${id}-${task.id}`, children: [_jsx("input", { id: `${id}-${task.id}`, type: "checkbox", checked: !!confirmed[task.id], onChange: (event) => setConfirmed((previous) => ({
100
+ ...previous,
101
+ [task.id]: event.target.checked,
102
+ })) }), "I understand and confirm this action."] })), _jsx("button", { type: "button", disabled: state.isPending ||
103
+ (task.requiresConfirmation && !confirmed[task.id]), onClick: () => {
104
+ void state.run(task.id, task.run);
105
+ }, children: state.pendingOperation === task.id ? "Processing…" : task.label }), state.errors[task.id] ? (_jsx("p", { role: "alert", children: state.errors[task.id] })) : (state.results[task.id] && (_jsx("p", { role: "status", children: state.results[task.id] })))] }, task.id))), _jsx("h3", { children: "Activity" }), !state.log.length ? (_jsx("p", { children: "No operations yet." })) : (_jsx("ol", { children: state.log.map((entry) => (_jsxs("li", { children: [entry.timestamp, " \u00B7 ", entry.action, " \u00B7 ", entry.result] }, entry.id))) }))] }));
106
+ }
107
+ export function StripeSetup(props) {
108
+ return _jsx(WorkflowTasks, { ...props, title: "Stripe setup" });
109
+ }
110
+ export function SandboxTesting(props) {
111
+ return _jsx(WorkflowTasks, { ...props, title: "Sandbox testing" });
112
+ }
113
+ //# sourceMappingURL=Tasks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Tasks.js","sourceRoot":"","sources":["../../../src/react/workflows/Tasks.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAe3D,MAAM,UAAU,aAAa,CAAC,EAC5B,QAAQ,GAAG,OAAO,EAClB,UAAU,GAAG,GAAG,EAChB,YAAY,GAAG,GAAG,EAAE,CAAC,WAAW,GACjC,GAAsB,EAAE;IACvB,MAAM,OAAO,GAAG;QACd,KAAK,EAAE,QAAQ;QACf,GAAG,EAAE,EAAwB;QAC7B,OAAO,EAAE,EAA4B;QACrC,MAAM,EAAE,EAA4B;KACrC,CAAC;IACF,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC;IAC5C,IAAI,KAAK,CAAC,KAAK,KAAK,QAAQ;QAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;IAChD,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAC;IAC9E,MAAM,SAAS,GAAG,iBAAiB,CACjC,KAAK,EAAE,IAAY,EAAE,IAA4B,EAAE,EAAE;QACnD,mBAAmB,CAAC,IAAI,CAAC,CAAC;QAC1B,IAAI,CAAC;YACH,OAAO;gBACL,IAAI;gBACJ,MAAM,EAAE,SAAkB;gBAC1B,KAAK,EAAE,MAAM,IAAI,EAAE;gBACnB,KAAK,EAAE,IAAI;aACZ,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO;gBAC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EAAE,KAAK,EAAC,cAAc,GAAG,CAAC;AAC3D,CAAC;AACD,MAAM,UAAU,cAAc,CAAC,KAAwC;IACrE,OAAO,KAAC,aAAa,OAAK,KAAK,EAAE,KAAK,EAAC,iBAAiB,GAAG,CAAC;AAC9D,CAAC"}
@@ -0,0 +1,37 @@
1
+ export declare const CHECKOUT_OPTIONS: readonly [{
2
+ readonly id: "redirect";
3
+ readonly title: "Hosted Checkout";
4
+ readonly api: "Checkout Sessions";
5
+ readonly pros: "Fastest setup. Stripe owns the payment page, order summary, subscriptions, and payment-method UI.";
6
+ readonly cons: "Redirects away from your app. Layout customization is limited.";
7
+ readonly docs: "https://docs.stripe.com/payments/checkout";
8
+ }, {
9
+ readonly id: "embedded";
10
+ readonly title: "Embedded Checkout";
11
+ readonly api: "Checkout Sessions · embedded_page";
12
+ readonly pros: "Stripe's complete checkout stays inside your app. Less custom checkout code to maintain.";
13
+ readonly cons: "Stripe controls the form layout. The page embeds a Stripe iframe.";
14
+ readonly docs: "https://docs.stripe.com/payments/checkout";
15
+ }, {
16
+ readonly id: "custom";
17
+ readonly title: "Payment Element + Checkout Sessions";
18
+ readonly api: "Checkout Sessions · elements";
19
+ readonly pros: "Custom page layout with Stripe handling the checkout session and payment state. Recommended for most custom checkouts.";
20
+ readonly cons: "You build the order summary, form controls, and confirmation UI.";
21
+ readonly docs: "https://docs.stripe.com/payments/payment-element";
22
+ }, {
23
+ readonly id: "payment-intent";
24
+ readonly title: "Payment Element + Payment Intents";
25
+ readonly api: "Payment Intents · Stripe.js";
26
+ readonly pros: "Low-level control over the payment lifecycle, capture, and your own checkout state.";
27
+ readonly cons: "You build pricing, tax, shipping, discounts, and subscription orchestration. This example supports one-time purchases.";
28
+ readonly docs: "https://docs.stripe.com/payments/payment-intents";
29
+ }, {
30
+ readonly id: "form";
31
+ readonly title: "Embedded Checkout Form";
32
+ readonly api: "Checkout Sessions · form · public preview";
33
+ readonly pros: "Stripe's compact prebuilt checkout form with Appearance API customization.";
34
+ readonly cons: "Preview availability can vary by sandbox. Less layout control than individual Elements.";
35
+ readonly docs: "https://docs.stripe.com/payments/checkout/how-checkout-works?payment-ui=checkout-form";
36
+ }];
37
+ //# sourceMappingURL=checkout-options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkout-options.d.ts","sourceRoot":"","sources":["../../../src/react/workflows/checkout-options.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB;aAEzB,EAAE,EAAE,UAAU;aACd,KAAK,EAAE,iBAAiB;aACxB,GAAG,EAAE,mBAAmB;aACxB,IAAI,EAAE,mGAAmG;aACzG,IAAI,EAAE,gEAAgE;aACtE,IAAI,EAAE,2CAA2C;;aAGjD,EAAE,EAAE,UAAU;aACd,KAAK,EAAE,mBAAmB;aAC1B,GAAG,EAAE,mCAAmC;aACxC,IAAI,EAAE,0FAA0F;aAChG,IAAI,EAAE,mEAAmE;aACzE,IAAI,EAAE,2CAA2C;;aAGjD,EAAE,EAAE,QAAQ;aACZ,KAAK,EAAE,qCAAqC;aAC5C,GAAG,EAAE,8BAA8B;aACnC,IAAI,EAAE,wHAAwH;aAC9H,IAAI,EAAE,kEAAkE;aACxE,IAAI,EAAE,kDAAkD;;aAGxD,EAAE,EAAE,gBAAgB;aACpB,KAAK,EAAE,mCAAmC;aAC1C,GAAG,EAAE,6BAA6B;aAClC,IAAI,EAAE,qFAAqF;aAC3F,IAAI,EAAE,wHAAwH;aAC9H,IAAI,EAAE,kDAAkD;;aAGxD,EAAE,EAAE,MAAM;aACV,KAAK,EAAE,wBAAwB;aAC/B,GAAG,EAAE,2CAA2C;aAChD,IAAI,EAAE,4EAA4E;aAClF,IAAI,EAAE,yFAAyF;aAC/F,IAAI,EAAE,uFAAuF;EAEvF,CAAC"}
@@ -0,0 +1,43 @@
1
+ export const CHECKOUT_OPTIONS = [
2
+ {
3
+ id: "redirect",
4
+ title: "Hosted Checkout",
5
+ api: "Checkout Sessions",
6
+ pros: "Fastest setup. Stripe owns the payment page, order summary, subscriptions, and payment-method UI.",
7
+ cons: "Redirects away from your app. Layout customization is limited.",
8
+ docs: "https://docs.stripe.com/payments/checkout",
9
+ },
10
+ {
11
+ id: "embedded",
12
+ title: "Embedded Checkout",
13
+ api: "Checkout Sessions · embedded_page",
14
+ pros: "Stripe's complete checkout stays inside your app. Less custom checkout code to maintain.",
15
+ cons: "Stripe controls the form layout. The page embeds a Stripe iframe.",
16
+ docs: "https://docs.stripe.com/payments/checkout",
17
+ },
18
+ {
19
+ id: "custom",
20
+ title: "Payment Element + Checkout Sessions",
21
+ api: "Checkout Sessions · elements",
22
+ pros: "Custom page layout with Stripe handling the checkout session and payment state. Recommended for most custom checkouts.",
23
+ cons: "You build the order summary, form controls, and confirmation UI.",
24
+ docs: "https://docs.stripe.com/payments/payment-element",
25
+ },
26
+ {
27
+ id: "payment-intent",
28
+ title: "Payment Element + Payment Intents",
29
+ api: "Payment Intents · Stripe.js",
30
+ pros: "Low-level control over the payment lifecycle, capture, and your own checkout state.",
31
+ cons: "You build pricing, tax, shipping, discounts, and subscription orchestration. This example supports one-time purchases.",
32
+ docs: "https://docs.stripe.com/payments/payment-intents",
33
+ },
34
+ {
35
+ id: "form",
36
+ title: "Embedded Checkout Form",
37
+ api: "Checkout Sessions · form · public preview",
38
+ pros: "Stripe's compact prebuilt checkout form with Appearance API customization.",
39
+ cons: "Preview availability can vary by sandbox. Less layout control than individual Elements.",
40
+ docs: "https://docs.stripe.com/payments/checkout/how-checkout-works?payment-ui=checkout-form",
41
+ },
42
+ ];
43
+ //# sourceMappingURL=checkout-options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkout-options.js","sourceRoot":"","sources":["../../../src/react/workflows/checkout-options.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B;QACE,EAAE,EAAE,UAAU;QACd,KAAK,EAAE,iBAAiB;QACxB,GAAG,EAAE,mBAAmB;QACxB,IAAI,EAAE,mGAAmG;QACzG,IAAI,EAAE,gEAAgE;QACtE,IAAI,EAAE,2CAA2C;KAClD;IACD;QACE,EAAE,EAAE,UAAU;QACd,KAAK,EAAE,mBAAmB;QAC1B,GAAG,EAAE,mCAAmC;QACxC,IAAI,EAAE,0FAA0F;QAChG,IAAI,EAAE,mEAAmE;QACzE,IAAI,EAAE,2CAA2C;KAClD;IACD;QACE,EAAE,EAAE,QAAQ;QACZ,KAAK,EAAE,qCAAqC;QAC5C,GAAG,EAAE,8BAA8B;QACnC,IAAI,EAAE,wHAAwH;QAC9H,IAAI,EAAE,kEAAkE;QACxE,IAAI,EAAE,kDAAkD;KACzD;IACD;QACE,EAAE,EAAE,gBAAgB;QACpB,KAAK,EAAE,mCAAmC;QAC1C,GAAG,EAAE,6BAA6B;QAClC,IAAI,EAAE,qFAAqF;QAC3F,IAAI,EAAE,wHAAwH;QAC9H,IAAI,EAAE,kDAAkD;KACzD;IACD;QACE,EAAE,EAAE,MAAM;QACV,KAAK,EAAE,wBAAwB;QAC/B,GAAG,EAAE,2CAA2C;QAChD,IAAI,EAAE,4EAA4E;QAClF,IAAI,EAAE,yFAAyF;QAC/F,IAAI,EAAE,uFAAuF;KAC9F;CACO,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Picks the subscription that best represents a buyer's "current plan" for
3
+ * display (`billing.tsx`). A `cancelAtPeriodEnd` sub is only preferred while
4
+ * it's still active/trialing, so a re-subscribed buyer's new subscription
5
+ * wins over a stale canceled one.
6
+ */
7
+ export declare function currentSubscriptionFrom<T extends {
8
+ status: string;
9
+ cancelAtPeriodEnd: boolean;
10
+ }>(subscriptions: T[]): T;
11
+ //# sourceMappingURL=current-subscription.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"current-subscription.d.ts","sourceRoot":"","sources":["../../../src/react/workflows/current-subscription.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,CAAC,SAAS;IACR,MAAM,EAAE,MAAM,CAAC;IACf,iBAAiB,EAAE,OAAO,CAAC;CAC5B,EACD,aAAa,EAAE,CAAC,EAAE,KAanB"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Picks the subscription that best represents a buyer's "current plan" for
3
+ * display (`billing.tsx`). A `cancelAtPeriodEnd` sub is only preferred while
4
+ * it's still active/trialing, so a re-subscribed buyer's new subscription
5
+ * wins over a stale canceled one.
6
+ */
7
+ export function currentSubscriptionFrom(subscriptions) {
8
+ return (subscriptions.find((s) => s.cancelAtPeriodEnd &&
9
+ (s.status === "active" || s.status === "trialing")) ??
10
+ subscriptions.find((s) => ["trialing", "active", "paused", "past_due", "unpaid"].includes(s.status)) ??
11
+ subscriptions[0] ??
12
+ null);
13
+ }
14
+ //# sourceMappingURL=current-subscription.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"current-subscription.js","sourceRoot":"","sources":["../../../src/react/workflows/current-subscription.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CAKrC,aAAkB;IAClB,OAAO,CACL,aAAa,CAAC,IAAI,CAChB,CAAC,CAAC,EAAE,EAAE,CACJ,CAAC,CAAC,iBAAiB;QACnB,CAAC,CAAC,CAAC,MAAM,KAAK,QAAQ,IAAI,CAAC,CAAC,MAAM,KAAK,UAAU,CAAC,CACrD;QACD,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CACvB,CAAC,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAC1E;QACD,aAAa,CAAC,CAAC,CAAC;QAChB,IAAI,CACL,CAAC;AACJ,CAAC"}
@@ -0,0 +1,17 @@
1
+ export declare function webhookQueryArgs(eventType: string, status: string): {
2
+ eventType: string | undefined;
3
+ status: string | undefined;
4
+ };
5
+ export declare function useWebhookFilters(): {
6
+ typeFilter: string;
7
+ setTypeFilter: import("react").Dispatch<import("react").SetStateAction<string>>;
8
+ statusFilter: string;
9
+ setStatusFilter: import("react").Dispatch<import("react").SetStateAction<string>>;
10
+ expandedEvent: string | null;
11
+ setExpandedEvent: import("react").Dispatch<import("react").SetStateAction<string | null>>;
12
+ queryArgs: {
13
+ eventType: string | undefined;
14
+ status: string | undefined;
15
+ };
16
+ };
17
+ //# sourceMappingURL=filters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filters.d.ts","sourceRoot":"","sources":["../../../src/react/workflows/filters.ts"],"names":[],"mappings":"AAEA,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAE9D,SAAS;IACT,MAAM;EAET;AACD,wBAAgB,iBAAiB;;;;;;;;;;;EAahC"}
@@ -0,0 +1,23 @@
1
+ "use client";
2
+ import { useState } from "react";
3
+ export function webhookQueryArgs(eventType, status) {
4
+ return {
5
+ eventType: eventType === "all" ? undefined : eventType,
6
+ status: status === "all" ? undefined : status,
7
+ };
8
+ }
9
+ export function useWebhookFilters() {
10
+ const [typeFilter, setTypeFilter] = useState("all");
11
+ const [statusFilter, setStatusFilter] = useState("all");
12
+ const [expandedEvent, setExpandedEvent] = useState(null);
13
+ return {
14
+ typeFilter,
15
+ setTypeFilter,
16
+ statusFilter,
17
+ setStatusFilter,
18
+ expandedEvent,
19
+ setExpandedEvent,
20
+ queryArgs: webhookQueryArgs(typeFilter, statusFilter),
21
+ };
22
+ }
23
+ //# sourceMappingURL=filters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filters.js","sourceRoot":"","sources":["../../../src/react/workflows/filters.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AACb,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,MAAM,UAAU,gBAAgB,CAAC,SAAiB,EAAE,MAAc;IAChE,OAAO;QACL,SAAS,EAAE,SAAS,KAAK,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS;QACtD,MAAM,EAAE,MAAM,KAAK,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM;KAC9C,CAAC;AACJ,CAAC;AACD,MAAM,UAAU,iBAAiB;IAC/B,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACpD,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACxD,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAC;IACxE,OAAO;QACL,UAAU;QACV,aAAa;QACb,YAAY;QACZ,eAAe;QACf,aAAa;QACb,gBAAgB;QAChB,SAAS,EAAE,gBAAgB,CAAC,UAAU,EAAE,YAAY,CAAC;KACtD,CAAC;AACJ,CAAC"}
@@ -0,0 +1,70 @@
1
+ export { useWorkflowAction } from "./useWorkflowAction.js";
2
+ export type { WorkflowActionState } from "./useWorkflowAction.js";
3
+ export { useWorkflowResource } from "./useWorkflowResource.js";
4
+ export { Checkout } from "./Checkout.js";
5
+ export type { CheckoutProps, CheckoutMode, CheckoutRequest, CheckoutSessionResult, CheckoutIntentResult, CheckoutRenderProps, } from "./Checkout.js";
6
+ export { CheckoutElementsForm, PaymentIntentForm, CheckoutForm, } from "./CheckoutForms.js";
7
+ export type { CheckoutFormState, CheckoutFormOptions, CheckoutFormProps, } from "./CheckoutForms.js";
8
+ export { Connect } from "./Connect.js";
9
+ export type { ConnectProps, ConnectComponent, ConnectRenderProps, } from "./Connect.js";
10
+ export { Payouts } from "./Payouts.js";
11
+ export type { PayoutsProps, HeadlessPayoutsProps, PayoutsRenderProps, PayoutSnapshot, PayoutRow, } from "./Payouts.js";
12
+ export { Refunds, useRefunds, parseAmountCents } from "./Refunds.js";
13
+ export type { RefundsProps, RefundsRenderProps, RefundActionsProps, RefundRequest, ReversalRequest, RefundResult, ReversalResult, } from "./Refunds.js";
14
+ export { Collection } from "./Collection.js";
15
+ export type { CollectionProps, CollectionRenderProps, WorkflowColumn, } from "./Collection.js";
16
+ export { Sales, Invoices, RefundHistory, ReferredSales, WebhookEvents, } from "./Collections.js";
17
+ export type { ResourceCollectionProps, SaleRow, InvoiceRow, RefundRow, ReferredSaleRow, WebhookEventRow, } from "./Collections.js";
18
+ export { Products, useProductManager } from "./Products.js";
19
+ export type { ProductsProps, ProductsRenderProps, ProductActions, CatalogProduct, ProductInput, PriceInput, ProductEdit, } from "./Products.js";
20
+ export { Onboarding, useOnboarding } from "./Onboarding.js";
21
+ export type { OnboardingProps, OnboardingActions, OnboardingAccount, OnboardingRenderProps, } from "./Onboarding.js";
22
+ export { Disputes, useDisputeResponse } from "./Disputes.js";
23
+ export type { DisputesProps, HeadlessDisputesProps, DisputesRenderProps, DisputeResponseOptions, } from "./Disputes.js";
24
+ export { InvoiceEstimate, useInvoiceEstimate, BalancePaymentSource, useBalanceFunding, BillingPortal, } from "./Billing.js";
25
+ export type { InvoiceEstimateProps, EstimatedInvoice, BalanceFundingActions, BalancePaymentSourceProps, BillingPortalProps, } from "./Billing.js";
26
+ export { SubscriptionManager, useSubscriptionManager, Subscriptions, useSubscriptionFilter, SUBSCRIPTION_FILTERS, } from "./Subscriptions.js";
27
+ export type { SubscriptionManagerProps, SubscriptionManagerOptions, SubscriptionActionType, SubscriptionCommand, SubscriptionRow, SubscriptionsProps, } from "./Subscriptions.js";
28
+ export { PaymentMethods, usePaymentMethodsManager, toPaymentMethodItem, } from "./PaymentMethods.js";
29
+ export type { PaymentMethodsProps, PaymentMethodsActions, } from "./PaymentMethods.js";
30
+ export { ReferralLinks, useReferralLinks } from "./ReferralLinks.js";
31
+ export type { ReferralLink, ReferralLinksProps } from "./ReferralLinks.js";
32
+ export { IntegrationSwitch } from "./IntegrationSwitch.js";
33
+ export type { IntegrationSwitchProps, IntegrationSwitchState, IntegrationMode, } from "./IntegrationSwitch.js";
34
+ export { CHECKOUT_OPTIONS } from "./checkout-options.js";
35
+ export { Account, useAccountManager } from "./Account.js";
36
+ export type { AccountProps, HeadlessAccountProps, AccountSummary, AccountConfiguration, AccountManagerOptions, } from "./Account.js";
37
+ export { WorkflowTasks, StripeSetup, SandboxTesting, useTaskRunner, } from "./Tasks.js";
38
+ export type { WorkflowTasksProps, WorkflowTask, WorkflowLogEntry, TaskRunnerOptions, } from "./Tasks.js";
39
+ export { WebhookSetup, useWebhookSetup, EnvironmentStatus, FixtureProgress, } from "./Setup.js";
40
+ export type { WebhookSetupOptions, EnvironmentCheck, FixtureProgressState, } from "./Setup.js";
41
+ export { BillingPlans, usePlanBilling } from "./BillingPlans.js";
42
+ export type { BillingPlansProps, BillingPlan, PlanBillingOptions, } from "./BillingPlans.js";
43
+ export { CostRecovery, ChargebackLedger } from "./Costs.js";
44
+ export type { CostRecoveryRow, ChargebackSummary, ChargebackTransfer, ChargebackLedgerRenderProps, } from "./Costs.js";
45
+ export { Storefront } from "./Storefront.js";
46
+ export type { StorefrontProps, StorefrontRenderProps, StorefrontCard, StorefrontSelection, StorefrontPrice, StorefrontProduct, StorefrontStore, } from "./Storefront.js";
47
+ export { PaymentReceipt } from "./PaymentReceipt.js";
48
+ export type { PaymentReceiptProps, PaymentReceiptState, ReceiptPayment, } from "./PaymentReceipt.js";
49
+ export { Earnings, earningsFromBalance } from "./Earnings.js";
50
+ export type { EarningsProps, HeadlessEarningsProps, EarningsRenderProps, EarningsMetric, BalanceSnapshot, StoreEarnings, } from "./Earnings.js";
51
+ export { ClipboardButton } from "./ClipboardButton.js";
52
+ export type { ClipboardButtonProps } from "./ClipboardButton.js";
53
+ export { useWebhookFilters, webhookQueryArgs } from "./filters.js";
54
+ export { AccountConfigurations } from "./Account.js";
55
+ export type { AccountConfigurationsProps } from "./Account.js";
56
+ export { Overview, getPayoutTotals } from "./Overview.js";
57
+ export type { OverviewProps, OverviewState } from "./Overview.js";
58
+ export { currentSubscriptionFrom } from "./current-subscription.js";
59
+ export { CheckoutChooser } from "./CheckoutChooser.js";
60
+ export type { CheckoutChooserProps, CheckoutChooserState, CheckoutOption, } from "./CheckoutChooser.js";
61
+ export { SubscriptionOverview } from "./SubscriptionOverview.js";
62
+ export type { SubscriptionOverviewProps, SubscriptionOverviewState, } from "./SubscriptionOverview.js";
63
+ export { DEFAULT_CONNECT_COUNTRIES } from "./Onboarding.js";
64
+ export { PayoutHistory } from "./Payouts.js";
65
+ export type { PayoutHistoryProps, PayoutHistoryRow } from "./Payouts.js";
66
+ export { PayoutOverview } from "./Overview.js";
67
+ export type { PayoutOverviewProps, PayoutOverviewRow } from "./Overview.js";
68
+ export { ChargeSummary, PaymentDetails } from "./Financials.js";
69
+ export type { ChargeSummaryProps, PaymentDetailsProps, PaymentDetailsPayment, PaymentDetailsState, } from "./Financials.js";
70
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/react/workflows/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,YAAY,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,YAAY,EACV,aAAa,EACb,YAAY,EACZ,eAAe,EACf,qBAAqB,EACrB,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,YAAY,GACb,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACV,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,YAAY,EACV,YAAY,EACZ,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,OAAO,EAAE,MAAM,cAA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,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,YAAY,EACV,oBAAoB,EACpB,oBAAoB,EACpB,cAAc,GACf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,YAAY,EACV,yBAAyB,EACzB,yBAAyB,GAC1B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,YAAY,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,YAAY,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAChE,YAAY,EACV,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,38 @@
1
+ export { useWorkflowAction } from "./useWorkflowAction.js";
2
+ export { useWorkflowResource } from "./useWorkflowResource.js";
3
+ export { Checkout } from "./Checkout.js";
4
+ export { CheckoutElementsForm, PaymentIntentForm, CheckoutForm, } from "./CheckoutForms.js";
5
+ export { Connect } from "./Connect.js";
6
+ export { Payouts } from "./Payouts.js";
7
+ export { Refunds, useRefunds, parseAmountCents } from "./Refunds.js";
8
+ export { Collection } from "./Collection.js";
9
+ export { Sales, Invoices, RefundHistory, ReferredSales, WebhookEvents, } from "./Collections.js";
10
+ export { Products, useProductManager } from "./Products.js";
11
+ export { Onboarding, useOnboarding } from "./Onboarding.js";
12
+ export { Disputes, useDisputeResponse } from "./Disputes.js";
13
+ export { InvoiceEstimate, useInvoiceEstimate, BalancePaymentSource, useBalanceFunding, BillingPortal, } from "./Billing.js";
14
+ export { SubscriptionManager, useSubscriptionManager, Subscriptions, useSubscriptionFilter, SUBSCRIPTION_FILTERS, } from "./Subscriptions.js";
15
+ export { PaymentMethods, usePaymentMethodsManager, toPaymentMethodItem, } from "./PaymentMethods.js";
16
+ export { ReferralLinks, useReferralLinks } from "./ReferralLinks.js";
17
+ export { IntegrationSwitch } from "./IntegrationSwitch.js";
18
+ export { CHECKOUT_OPTIONS } from "./checkout-options.js";
19
+ export { Account, useAccountManager } from "./Account.js";
20
+ export { WorkflowTasks, StripeSetup, SandboxTesting, useTaskRunner, } from "./Tasks.js";
21
+ export { WebhookSetup, useWebhookSetup, EnvironmentStatus, FixtureProgress, } from "./Setup.js";
22
+ export { BillingPlans, usePlanBilling } from "./BillingPlans.js";
23
+ export { CostRecovery, ChargebackLedger } from "./Costs.js";
24
+ export { Storefront } from "./Storefront.js";
25
+ export { PaymentReceipt } from "./PaymentReceipt.js";
26
+ export { Earnings, earningsFromBalance } from "./Earnings.js";
27
+ export { ClipboardButton } from "./ClipboardButton.js";
28
+ export { useWebhookFilters, webhookQueryArgs } from "./filters.js";
29
+ export { AccountConfigurations } from "./Account.js";
30
+ export { Overview, getPayoutTotals } from "./Overview.js";
31
+ export { currentSubscriptionFrom } from "./current-subscription.js";
32
+ export { CheckoutChooser } from "./CheckoutChooser.js";
33
+ export { SubscriptionOverview } from "./SubscriptionOverview.js";
34
+ export { DEFAULT_CONNECT_COUNTRIES } from "./Onboarding.js";
35
+ export { PayoutHistory } from "./Payouts.js";
36
+ export { PayoutOverview } from "./Overview.js";
37
+ export { ChargeSummary, PaymentDetails } from "./Financials.js";
38
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/react/workflows/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,OAAO,EAAE,mBAAmB,EAAE,MA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,aAAa,GACd,MAAM,YAAY,CAAC;AAOpB,OAAO,EACL,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,eAAe,GAChB,MAAM,YAAY,CAAC;AAMpB,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAMjE,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAO5D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAU7C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAMrD,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAS9D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAErD,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAE1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAMvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAKjE,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,11 @@
1
+ export type WorkflowActionState<T, Args extends unknown[]> = {
2
+ isPending: boolean;
3
+ error: string | null;
4
+ result: T | undefined;
5
+ /** Errors are exposed in state; failed and duplicate calls return undefined. */
6
+ run: (...args: Args) => Promise<T | undefined>;
7
+ reset: () => void;
8
+ };
9
+ /** Shared async action lifecycle. Scope identifies the authenticated account/resource, not authorization. */
10
+ export declare function useWorkflowAction<T, Args extends unknown[]>(action: (...args: Args) => Promise<T>, scope?: string): WorkflowActionState<T, Args>;
11
+ //# sourceMappingURL=useWorkflowAction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useWorkflowAction.d.ts","sourceRoot":"","sources":["../../../src/react/workflows/useWorkflowAction.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,mBAAmB,CAAC,CAAC,EAAE,IAAI,SAAS,OAAO,EAAE,IAAI;IAC3D,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,MAAM,EAAE,CAAC,GAAG,SAAS,CAAC;IACtB,gFAAgF;IAChF,GAAG,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC;IAC/C,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB,CAAC;AACF,6GAA6G;AAC7G,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,IAAI,SAAS,OAAO,EAAE,EACzD,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,EACrC,KAAK,GAAE,MAAkB,GACxB,mBAAmB,CAAC,CAAC,EAAE,IAAI,CAAC,CA4D9B"}
@@ -0,0 +1,68 @@
1
+ "use client";
2
+ import { useCallback, useEffect, useRef, useState } from "react";
3
+ /** Shared async action lifecycle. Scope identifies the authenticated account/resource, not authorization. */
4
+ export function useWorkflowAction(action, scope = "default") {
5
+ const initial = {
6
+ scope,
7
+ isPending: false,
8
+ error: null,
9
+ result: undefined,
10
+ };
11
+ const [state, setState] = useState(initial);
12
+ if (state.scope !== scope)
13
+ setState(initial);
14
+ const callback = useRef(action);
15
+ const lifecycle = useRef({ version: 0, mounted: false });
16
+ const lock = useRef(null);
17
+ useEffect(() => {
18
+ callback.current = action;
19
+ }, [action]);
20
+ useEffect(() => {
21
+ const version = ++lifecycle.current.version;
22
+ lifecycle.current.mounted = true;
23
+ lock.current = null;
24
+ return () => {
25
+ if (lifecycle.current.version === version) {
26
+ lifecycle.current.mounted = false;
27
+ lifecycle.current.version++;
28
+ lock.current = null;
29
+ }
30
+ };
31
+ }, [scope]);
32
+ const reset = useCallback(() => {
33
+ if (lock.current !== null)
34
+ return;
35
+ setState({ scope, isPending: false, error: null, result: undefined });
36
+ }, [scope]);
37
+ const run = useCallback(async (...args) => {
38
+ if (lock.current !== null)
39
+ return undefined;
40
+ const version = lifecycle.current.version;
41
+ lock.current = version;
42
+ setState({ scope, isPending: true, error: null, result: undefined });
43
+ const current = () => lifecycle.current.mounted && lifecycle.current.version === version;
44
+ try {
45
+ const result = await callback.current(...args);
46
+ if (!current())
47
+ return undefined;
48
+ setState({ scope, isPending: false, error: null, result });
49
+ return result;
50
+ }
51
+ catch (error) {
52
+ if (current())
53
+ setState({
54
+ scope,
55
+ isPending: false,
56
+ error: error instanceof Error ? error.message : String(error),
57
+ result: undefined,
58
+ });
59
+ return undefined;
60
+ }
61
+ finally {
62
+ if (lock.current === version)
63
+ lock.current = null;
64
+ }
65
+ }, [scope]);
66
+ return { ...state, run, reset };
67
+ }
68
+ //# sourceMappingURL=useWorkflowAction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useWorkflowAction.js","sourceRoot":"","sources":["../../../src/react/workflows/useWorkflowAction.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AACb,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AASjE,6GAA6G;AAC7G,MAAM,UAAU,iBAAiB,CAC/B,MAAqC,EACrC,KAAK,GAAW,SAAS;IAEzB,MAAM,OAAO,GAAG;QACd,KAAK;QACL,SAAS,EAAE,KAAK;QAChB,KAAK,EAAE,IAAqB;QAC5B,MAAM,EAAE,SAA0B;KACnC,CAAC;IACF,MAAM,CAAC,KAAK,EAAE,Q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D,CAAC,KAAK,CAAC,CACR,CAAC;IACF,OAAO,EAAE,GAAG,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;AAClC,CAAC"}
@@ -0,0 +1,9 @@
1
+ /** Loads once per scope/refresh, including under React StrictMode. Stale requests cannot update another scope. */
2
+ export declare function useWorkflowResource<T>(load: () => Promise<T>, scope?: string): {
3
+ revision: number;
4
+ data: T | undefined;
5
+ error: string | null;
6
+ isLoading: boolean;
7
+ refresh: () => void;
8
+ };
9
+ //# sourceMappingURL=useWorkflowResource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useWorkflowResource.d.ts","sourceRoot":"","sources":["../../../src/react/workflows/useWorkflowResource.ts"],"names":[],"mappings":"AAEA,kHAAkH;AAClH,wBAAgB,mBAAmB,CAAC,CAAC,EACnC,IAAI,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACtB,KAAK,SAAY;;;;;;EAwElB"}
@@ -0,0 +1,67 @@
1
+ "use client";
2
+ import { useCallback, useEffect, useRef, useState } from "react";
3
+ /** Loads once per scope/refresh, including under React StrictMode. Stale requests cannot update another scope. */
4
+ export function useWorkflowResource(load, scope = "default") {
5
+ const initial = {
6
+ scope,
7
+ attempt: 0,
8
+ data: undefined,
9
+ error: null,
10
+ isLoading: true,
11
+ };
12
+ const [state, setState] = useState(initial);
13
+ if (state.scope !== scope)
14
+ setState(initial);
15
+ const loader = useRef(load);
16
+ const request = useRef(null);
17
+ useEffect(() => {
18
+ loader.current = load;
19
+ }, [load]);
20
+ useEffect(() => {
21
+ let active = true;
22
+ if (!request.current ||
23
+ request.current.scope !== scope ||
24
+ request.current.attempt !== state.attempt) {
25
+ request.current = {
26
+ scope,
27
+ attempt: state.attempt,
28
+ promise: Promise.resolve().then(() => loader.current()),
29
+ };
30
+ }
31
+ void request.current.promise
32
+ .then((data) => {
33
+ if (active)
34
+ setState((previous) => ({
35
+ ...previous,
36
+ data,
37
+ error: null,
38
+ isLoading: false,
39
+ }));
40
+ })
41
+ .catch((error) => {
42
+ if (active)
43
+ setState((previous) => ({
44
+ ...previous,
45
+ error: error instanceof Error ? error.message : String(error),
46
+ isLoading: false,
47
+ }));
48
+ });
49
+ return () => {
50
+ active = false;
51
+ };
52
+ }, [scope, state.attempt]);
53
+ const refresh = useCallback(() => setState((previous) => ({
54
+ ...previous,
55
+ attempt: previous.attempt + 1,
56
+ isLoading: true,
57
+ error: null,
58
+ })), []);
59
+ return {
60
+ revision: state.attempt,
61
+ data: state.data,
62
+ error: state.error,
63
+ isLoading: state.isLoading,
64
+ refresh,
65
+ };
66
+ }
67
+ //# sourceMappingURL=useWorkflowResource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useWorkflowResource.js","sourceRoot":"","sources":["../../../src/react/workflows/useWorkflowResource.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AACb,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjE,kHAAkH;AAClH,MAAM,UAAU,mBAAmB,CACjC,IAAsB,EACtB,KAAK,GAAG,SAAS;IAEjB,MAAM,OAAO,GAAG;QACd,KAAK;QACL,OAAO,EAAE,CAAC;QACV,IAAI,EAAE,SAA0B;QAChC,KAAK,EAAE,IAAqB;QAC5B,SAAS,EAAE,IAAI;KAChB,CAAC;IACF,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC;IAC5C,IAAI,KAAK,CAAC,KAAK,KAAK,KAAK;QAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;IAC7C,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;IAC5B,MAAM,OAAO,GAAG,MAAM,CAIZ,IAAI,CAAC,CAAC;IAChB,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC;IACxB,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IACX,SA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