@fantastic.dev/better-stripe 0.7.0 → 0.8.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 (343) hide show
  1. package/CHANGELOG.md +23 -18
  2. package/README.md +122 -90
  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/paymentMethods.d.ts.map +1 -1
  8. package/dist/client/connect/paymentMethods.js.map +1 -1
  9. package/dist/client/connect/refundActor.d.ts.map +1 -1
  10. package/dist/client/connect/refundActor.js.map +1 -1
  11. package/dist/client/connect/refunds.d.ts.map +1 -1
  12. package/dist/client/connect/refunds.js.map +1 -1
  13. package/dist/client/connect/transfers.d.ts.map +1 -1
  14. package/dist/client/connect/transfers.js +15 -4
  15. package/dist/client/connect/transfers.js.map +1 -1
  16. package/dist/client/core/accountDefaults.d.ts +6 -0
  17. package/dist/client/core/accountDefaults.d.ts.map +1 -0
  18. package/dist/client/core/accountDefaults.js +15 -0
  19. package/dist/client/core/accountDefaults.js.map +1 -0
  20. package/dist/client/core/accounts.d.ts +1 -5
  21. package/dist/client/core/accounts.d.ts.map +1 -1
  22. package/dist/client/core/accounts.js +2 -14
  23. package/dist/client/core/accounts.js.map +1 -1
  24. package/dist/client/core/fees.d.ts.map +1 -1
  25. package/dist/client/core/fees.js +7 -2
  26. package/dist/client/core/fees.js.map +1 -1
  27. package/dist/client/index.d.ts +1 -1
  28. package/dist/client/index.d.ts.map +1 -1
  29. package/dist/client/products/prices.d.ts.map +1 -1
  30. package/dist/client/products/prices.js.map +1 -1
  31. package/dist/client/products/products.d.ts.map +1 -1
  32. package/dist/client/products/products.js +3 -1
  33. package/dist/client/products/products.js.map +1 -1
  34. package/dist/client/utils/owner.d.ts.map +1 -1
  35. package/dist/client/utils/owner.js +3 -1
  36. package/dist/client/utils/owner.js.map +1 -1
  37. package/dist/client/utils/stripeDashboardUrl.d.ts.map +1 -1
  38. package/dist/client/utils/stripeDashboardUrl.js.map +1 -1
  39. package/dist/client/webhooks/helpers.d.ts +10 -0
  40. package/dist/client/webhooks/helpers.d.ts.map +1 -1
  41. package/dist/client/webhooks/helpers.js +18 -0
  42. package/dist/client/webhooks/helpers.js.map +1 -1
  43. package/dist/client/webhooks/processors.d.ts.map +1 -1
  44. package/dist/client/webhooks/processors.js +1 -19
  45. package/dist/client/webhooks/processors.js.map +1 -1
  46. package/dist/component/connect/mutations.d.ts.map +1 -1
  47. package/dist/component/connect/mutations.js +4 -33
  48. package/dist/component/connect/mutations.js.map +1 -1
  49. package/dist/component/connect/schema.d.ts.map +1 -1
  50. package/dist/component/connect/schema.js.map +1 -1
  51. package/dist/component/lib/paymentSeller.d.ts +3 -0
  52. package/dist/component/lib/paymentSeller.d.ts.map +1 -0
  53. package/dist/component/lib/paymentSeller.js +10 -0
  54. package/dist/component/lib/paymentSeller.js.map +1 -0
  55. package/dist/component/lib/reversals.d.ts +10 -0
  56. package/dist/component/lib/reversals.d.ts.map +1 -1
  57. package/dist/component/lib/reversals.js +17 -0
  58. package/dist/component/lib/reversals.js.map +1 -1
  59. package/dist/react/components/ConnectProvider.d.ts +1 -1
  60. package/dist/react/components/ConnectProvider.d.ts.map +1 -1
  61. package/dist/react/components/ConnectProvider.js +18 -4
  62. package/dist/react/components/ConnectProvider.js.map +1 -1
  63. package/dist/react/components/ConnectStatusBadge.d.ts.map +1 -1
  64. package/dist/react/components/ConnectStatusBadge.js.map +1 -1
  65. package/dist/react/components/EmbeddedDisputes.d.ts +1 -1
  66. package/dist/react/components/EmbeddedDisputes.d.ts.map +1 -1
  67. package/dist/react/components/EmbeddedDisputes.js +1 -1
  68. package/dist/react/components/EmbeddedDisputes.js.map +1 -1
  69. package/dist/react/components/SplitBreakdown.d.ts.map +1 -1
  70. package/dist/react/components/SplitBreakdown.js +12 -2
  71. package/dist/react/components/SplitBreakdown.js.map +1 -1
  72. package/dist/react/hooks/useCheckoutSession.d.ts.map +1 -1
  73. package/dist/react/hooks/useCheckoutSession.js.map +1 -1
  74. package/dist/react/hooks/useConfirmPayment.d.ts.map +1 -1
  75. package/dist/react/hooks/useConfirmPayment.js.map +1 -1
  76. package/dist/react/index.d.ts +1 -0
  77. package/dist/react/index.d.ts.map +1 -1
  78. package/dist/react/index.js +2 -0
  79. package/dist/react/index.js.map +1 -1
  80. package/dist/react/workflows/Account.d.ts +67 -0
  81. package/dist/react/workflows/Account.d.ts.map +1 -0
  82. package/dist/react/workflows/Account.js +74 -0
  83. package/dist/react/workflows/Account.js.map +1 -0
  84. package/dist/react/workflows/Billing.d.ts +60 -0
  85. package/dist/react/workflows/Billing.d.ts.map +1 -0
  86. package/dist/react/workflows/Billing.js +84 -0
  87. package/dist/react/workflows/Billing.js.map +1 -0
  88. package/dist/react/workflows/BillingPlans.d.ts +45 -0
  89. package/dist/react/workflows/BillingPlans.d.ts.map +1 -0
  90. package/dist/react/workflows/BillingPlans.js +51 -0
  91. package/dist/react/workflows/BillingPlans.js.map +1 -0
  92. package/dist/react/workflows/Checkout.d.ts +46 -0
  93. package/dist/react/workflows/Checkout.d.ts.map +1 -0
  94. package/dist/react/workflows/Checkout.js +61 -0
  95. package/dist/react/workflows/Checkout.js.map +1 -0
  96. package/dist/react/workflows/CheckoutChooser.d.ts +20 -0
  97. package/dist/react/workflows/CheckoutChooser.d.ts.map +1 -0
  98. package/dist/react/workflows/CheckoutChooser.js +24 -0
  99. package/dist/react/workflows/CheckoutChooser.js.map +1 -0
  100. package/dist/react/workflows/CheckoutForms.d.ts +26 -0
  101. package/dist/react/workflows/CheckoutForms.d.ts.map +1 -0
  102. package/dist/react/workflows/CheckoutForms.js +126 -0
  103. package/dist/react/workflows/CheckoutForms.js.map +1 -0
  104. package/dist/react/workflows/ClipboardButton.d.ts +17 -0
  105. package/dist/react/workflows/ClipboardButton.d.ts.map +1 -0
  106. package/dist/react/workflows/ClipboardButton.js +35 -0
  107. package/dist/react/workflows/ClipboardButton.js.map +1 -0
  108. package/dist/react/workflows/Collection.d.ts +30 -0
  109. package/dist/react/workflows/Collection.d.ts.map +1 -0
  110. package/dist/react/workflows/Collection.js +25 -0
  111. package/dist/react/workflows/Collection.js.map +1 -0
  112. package/dist/react/workflows/Collections.d.ts +56 -0
  113. package/dist/react/workflows/Collections.d.ts.map +1 -0
  114. package/dist/react/workflows/Collections.js +111 -0
  115. package/dist/react/workflows/Collections.js.map +1 -0
  116. package/dist/react/workflows/Connect.d.ts +19 -0
  117. package/dist/react/workflows/Connect.d.ts.map +1 -0
  118. package/dist/react/workflows/Connect.js +43 -0
  119. package/dist/react/workflows/Connect.js.map +1 -0
  120. package/dist/react/workflows/Costs.d.ts +48 -0
  121. package/dist/react/workflows/Costs.d.ts.map +1 -0
  122. package/dist/react/workflows/Costs.js +66 -0
  123. package/dist/react/workflows/Costs.js.map +1 -0
  124. package/dist/react/workflows/Disputes.d.ts +36 -0
  125. package/dist/react/workflows/Disputes.d.ts.map +1 -0
  126. package/dist/react/workflows/Disputes.js +74 -0
  127. package/dist/react/workflows/Disputes.js.map +1 -0
  128. package/dist/react/workflows/Earnings.d.ts +42 -0
  129. package/dist/react/workflows/Earnings.d.ts.map +1 -0
  130. package/dist/react/workflows/Earnings.js +38 -0
  131. package/dist/react/workflows/Earnings.js.map +1 -0
  132. package/dist/react/workflows/Financials.d.ts +43 -0
  133. package/dist/react/workflows/Financials.d.ts.map +1 -0
  134. package/dist/react/workflows/Financials.js +57 -0
  135. package/dist/react/workflows/Financials.js.map +1 -0
  136. package/dist/react/workflows/IntegrationSwitch.d.ts +23 -0
  137. package/dist/react/workflows/IntegrationSwitch.d.ts.map +1 -0
  138. package/dist/react/workflows/IntegrationSwitch.js +31 -0
  139. package/dist/react/workflows/IntegrationSwitch.js.map +1 -0
  140. package/dist/react/workflows/Onboarding.d.ts +56 -0
  141. package/dist/react/workflows/Onboarding.d.ts.map +1 -0
  142. package/dist/react/workflows/Onboarding.js +86 -0
  143. package/dist/react/workflows/Onboarding.js.map +1 -0
  144. package/dist/react/workflows/Overview.d.ts +51 -0
  145. package/dist/react/workflows/Overview.d.ts.map +1 -0
  146. package/dist/react/workflows/Overview.js +63 -0
  147. package/dist/react/workflows/Overview.js.map +1 -0
  148. package/dist/react/workflows/PaymentMethods.d.ts +35 -0
  149. package/dist/react/workflows/PaymentMethods.d.ts.map +1 -0
  150. package/dist/react/workflows/PaymentMethods.js +63 -0
  151. package/dist/react/workflows/PaymentMethods.js.map +1 -0
  152. package/dist/react/workflows/PaymentReceipt.d.ts +20 -0
  153. package/dist/react/workflows/PaymentReceipt.d.ts.map +1 -0
  154. package/dist/react/workflows/PaymentReceipt.js +24 -0
  155. package/dist/react/workflows/PaymentReceipt.js.map +1 -0
  156. package/dist/react/workflows/Payouts.d.ts +47 -0
  157. package/dist/react/workflows/Payouts.d.ts.map +1 -0
  158. package/dist/react/workflows/Payouts.js +87 -0
  159. package/dist/react/workflows/Payouts.js.map +1 -0
  160. package/dist/react/workflows/Products.d.ts +92 -0
  161. package/dist/react/workflows/Products.d.ts.map +1 -0
  162. package/dist/react/workflows/Products.js +179 -0
  163. package/dist/react/workflows/Products.js.map +1 -0
  164. package/dist/react/workflows/ReferralLinks.d.ts +26 -0
  165. package/dist/react/workflows/ReferralLinks.d.ts.map +1 -0
  166. package/dist/react/workflows/ReferralLinks.js +30 -0
  167. package/dist/react/workflows/ReferralLinks.js.map +1 -0
  168. package/dist/react/workflows/Refunds.d.ts +72 -0
  169. package/dist/react/workflows/Refunds.d.ts.map +1 -0
  170. package/dist/react/workflows/Refunds.js +95 -0
  171. package/dist/react/workflows/Refunds.js.map +1 -0
  172. package/dist/react/workflows/Setup.d.ts +50 -0
  173. package/dist/react/workflows/Setup.d.ts.map +1 -0
  174. package/dist/react/workflows/Setup.js +59 -0
  175. package/dist/react/workflows/Setup.js.map +1 -0
  176. package/dist/react/workflows/Storefront.d.ts +53 -0
  177. package/dist/react/workflows/Storefront.d.ts.map +1 -0
  178. package/dist/react/workflows/Storefront.js +44 -0
  179. package/dist/react/workflows/Storefront.js.map +1 -0
  180. package/dist/react/workflows/SubscriptionOverview.d.ts +13 -0
  181. package/dist/react/workflows/SubscriptionOverview.d.ts.map +1 -0
  182. package/dist/react/workflows/SubscriptionOverview.js +26 -0
  183. package/dist/react/workflows/SubscriptionOverview.js.map +1 -0
  184. package/dist/react/workflows/Subscriptions.d.ts +92 -0
  185. package/dist/react/workflows/Subscriptions.d.ts.map +1 -0
  186. package/dist/react/workflows/Subscriptions.js +149 -0
  187. package/dist/react/workflows/Subscriptions.js.map +1 -0
  188. package/dist/react/workflows/Tasks.d.ts +40 -0
  189. package/dist/react/workflows/Tasks.d.ts.map +1 -0
  190. package/dist/react/workflows/Tasks.js +113 -0
  191. package/dist/react/workflows/Tasks.js.map +1 -0
  192. package/dist/react/workflows/checkout-options.d.ts +37 -0
  193. package/dist/react/workflows/checkout-options.d.ts.map +1 -0
  194. package/dist/react/workflows/checkout-options.js +43 -0
  195. package/dist/react/workflows/checkout-options.js.map +1 -0
  196. package/dist/react/workflows/current-subscription.d.ts +11 -0
  197. package/dist/react/workflows/current-subscription.d.ts.map +1 -0
  198. package/dist/react/workflows/current-subscription.js +14 -0
  199. package/dist/react/workflows/current-subscription.js.map +1 -0
  200. package/dist/react/workflows/filters.d.ts +17 -0
  201. package/dist/react/workflows/filters.d.ts.map +1 -0
  202. package/dist/react/workflows/filters.js +23 -0
  203. package/dist/react/workflows/filters.js.map +1 -0
  204. package/dist/react/workflows/index.d.ts +70 -0
  205. package/dist/react/workflows/index.d.ts.map +1 -0
  206. package/dist/react/workflows/index.js +38 -0
  207. package/dist/react/workflows/index.js.map +1 -0
  208. package/dist/react/workflows/useWorkflowAction.d.ts +11 -0
  209. package/dist/react/workflows/useWorkflowAction.d.ts.map +1 -0
  210. package/dist/react/workflows/useWorkflowAction.js +68 -0
  211. package/dist/react/workflows/useWorkflowAction.js.map +1 -0
  212. package/dist/react/workflows/useWorkflowResource.d.ts +9 -0
  213. package/dist/react/workflows/useWorkflowResource.d.ts.map +1 -0
  214. package/dist/react/workflows/useWorkflowResource.js +67 -0
  215. package/dist/react/workflows/useWorkflowResource.js.map +1 -0
  216. package/docs/react-workflows-audit.md +66 -0
  217. package/docs/react-workflows.md +231 -0
  218. package/package.json +19 -3
  219. package/src/client/billing/checkout-ui-modes.test.ts +49 -0
  220. package/src/client/billing/checkout.ts +8 -3
  221. package/src/client/billing/invoices.test.ts +12 -6
  222. package/src/client/connect/paymentMethods.test.ts +3 -1
  223. package/src/client/connect/paymentMethods.ts +4 -1
  224. package/src/client/connect/refundActor.ts +1 -2
  225. package/src/client/connect/refunds.test.ts +35 -10
  226. package/src/client/connect/refunds.ts +4 -1
  227. package/src/client/connect/transfers.test.ts +66 -12
  228. package/src/client/connect/transfers.ts +32 -8
  229. package/src/client/core/accountDefaults.ts +15 -0
  230. package/src/client/core/accounts.ts +14 -17
  231. package/src/client/core/config.test.ts +2 -1
  232. package/src/client/core/descriptors.test.ts +6 -4
  233. package/src/client/core/fees.test.ts +20 -28
  234. package/src/client/core/fees.ts +9 -2
  235. package/src/client/index.test.ts +22 -22
  236. package/src/client/index.ts +1 -1
  237. package/src/client/products/prices.test.ts +8 -2
  238. package/src/client/products/prices.ts +4 -1
  239. package/src/client/products/products.test.ts +61 -20
  240. package/src/client/products/products.ts +3 -1
  241. package/src/client/utils/data.test.ts +3 -1
  242. package/src/client/utils/owner.test.ts +4 -1
  243. package/src/client/utils/owner.ts +5 -1
  244. package/src/client/utils/stripeDashboardUrl.ts +1 -4
  245. package/src/client/webhooks/handler.test.ts +16 -19
  246. package/src/client/webhooks/helpers.test.ts +26 -13
  247. package/src/client/webhooks/helpers.ts +23 -0
  248. package/src/client/webhooks/hooks.test.ts +1 -2
  249. package/src/client/webhooks/processors.test.ts +18 -34
  250. package/src/client/webhooks/processors.ts +1 -23
  251. package/src/client/webhooks.test.ts +1 -2
  252. package/src/component/_generated/api.ts +2 -0
  253. package/src/component/connect/mutations.ts +5 -46
  254. package/src/component/connect/schema.ts +4 -3
  255. package/src/component/connect.test.ts +1 -5
  256. package/src/component/lib/paymentSeller.ts +15 -0
  257. package/src/component/lib/reversals.ts +30 -2
  258. package/src/component/subscription-scoping.test.ts +5 -1
  259. package/src/component/triggers.test.ts +7 -4
  260. package/src/react/components/BuyerBillingView.render.test.tsx +7 -2
  261. package/src/react/components/ConnectProvider.live.test.tsx +61 -0
  262. package/src/react/components/ConnectProvider.tsx +18 -4
  263. package/src/react/components/ConnectStatusBadge.tsx +1 -4
  264. package/src/react/components/DisputeDetail.render.test.tsx +5 -1
  265. package/src/react/components/EarningsSummary.render.test.tsx +2 -6
  266. package/src/react/components/EmbeddedDisputes.render.test.tsx +7 -5
  267. package/src/react/components/EmbeddedDisputes.tsx +4 -1
  268. package/src/react/components/EvidenceForm.render.test.tsx +2 -8
  269. package/src/react/components/SplitBreakdown.render.test.tsx +28 -5
  270. package/src/react/components/SplitBreakdown.tsx +12 -2
  271. package/src/react/hooks/useCheckoutSession.ts +1 -2
  272. package/src/react/hooks/useConfirmPayment.ts +1 -2
  273. package/src/react/hooks/useEarnings.test.ts +43 -8
  274. package/src/react/hooks/useStripeMode.test.ts +5 -8
  275. package/src/react/index.ts +3 -0
  276. package/src/react/workflows/Account.test.tsx +31 -0
  277. package/src/react/workflows/Account.tsx +183 -0
  278. package/src/react/workflows/Billing.test.tsx +45 -0
  279. package/src/react/workflows/Billing.tsx +213 -0
  280. package/src/react/workflows/BillingPlans.test.tsx +31 -0
  281. package/src/react/workflows/BillingPlans.tsx +130 -0
  282. package/src/react/workflows/Checkout.test.tsx +118 -0
  283. package/src/react/workflows/Checkout.tsx +135 -0
  284. package/src/react/workflows/CheckoutChooser.test.tsx +44 -0
  285. package/src/react/workflows/CheckoutChooser.tsx +77 -0
  286. package/src/react/workflows/CheckoutForm.test.tsx +66 -0
  287. package/src/react/workflows/CheckoutForms.test.tsx +123 -0
  288. package/src/react/workflows/CheckoutForms.tsx +247 -0
  289. package/src/react/workflows/ClipboardButton.test.tsx +34 -0
  290. package/src/react/workflows/ClipboardButton.tsx +67 -0
  291. package/src/react/workflows/Collection.tsx +76 -0
  292. package/src/react/workflows/Collections.test.tsx +86 -0
  293. package/src/react/workflows/Collections.tsx +213 -0
  294. package/src/react/workflows/Connect.test.tsx +50 -0
  295. package/src/react/workflows/Connect.tsx +107 -0
  296. package/src/react/workflows/Costs.test.tsx +41 -0
  297. package/src/react/workflows/Costs.tsx +133 -0
  298. package/src/react/workflows/Disputes.test.tsx +25 -0
  299. package/src/react/workflows/Disputes.tsx +164 -0
  300. package/src/react/workflows/Earnings.test.ts +19 -0
  301. package/src/react/workflows/Earnings.tsx +84 -0
  302. package/src/react/workflows/Financials.test.tsx +35 -0
  303. package/src/react/workflows/Financials.tsx +117 -0
  304. package/src/react/workflows/IntegrationSwitch.test.tsx +36 -0
  305. package/src/react/workflows/IntegrationSwitch.tsx +63 -0
  306. package/src/react/workflows/Onboarding.test.tsx +75 -0
  307. package/src/react/workflows/Onboarding.tsx +171 -0
  308. package/src/react/workflows/Overview.test.tsx +57 -0
  309. package/src/react/workflows/Overview.tsx +123 -0
  310. package/src/react/workflows/PaymentMethods.test.tsx +60 -0
  311. package/src/react/workflows/PaymentMethods.tsx +117 -0
  312. package/src/react/workflows/PaymentReceipt.test.tsx +24 -0
  313. package/src/react/workflows/PaymentReceipt.tsx +46 -0
  314. package/src/react/workflows/Payouts.test.tsx +82 -0
  315. package/src/react/workflows/Payouts.tsx +212 -0
  316. package/src/react/workflows/Products.test.tsx +90 -0
  317. package/src/react/workflows/Products.tsx +377 -0
  318. package/src/react/workflows/ReferralLinks.test.tsx +39 -0
  319. package/src/react/workflows/ReferralLinks.tsx +75 -0
  320. package/src/react/workflows/Refunds.test.tsx +75 -0
  321. package/src/react/workflows/Refunds.tsx +223 -0
  322. package/src/react/workflows/Setup.test.tsx +25 -0
  323. package/src/react/workflows/Setup.tsx +166 -0
  324. package/src/react/workflows/Storefront.test.tsx +82 -0
  325. package/src/react/workflows/Storefront.tsx +138 -0
  326. package/src/react/workflows/SubscriptionOverview.test.tsx +27 -0
  327. package/src/react/workflows/SubscriptionOverview.tsx +48 -0
  328. package/src/react/workflows/Subscriptions.test.tsx +61 -0
  329. package/src/react/workflows/Subscriptions.tsx +282 -0
  330. package/src/react/workflows/Tasks.test.tsx +23 -0
  331. package/src/react/workflows/Tasks.tsx +199 -0
  332. package/src/react/workflows/checkout-options.ts +42 -0
  333. package/src/react/workflows/current-subscription.test.ts +29 -0
  334. package/src/react/workflows/current-subscription.ts +25 -0
  335. package/src/react/workflows/filters.test.ts +12 -0
  336. package/src/react/workflows/filters.ts +22 -0
  337. package/src/react/workflows/index.ts +238 -0
  338. package/src/react/workflows/native-interactions.test.tsx +73 -0
  339. package/src/react/workflows/public-workflows.test.tsx +216 -0
  340. package/src/react/workflows/useWorkflowAction.test.tsx +54 -0
  341. package/src/react/workflows/useWorkflowAction.ts +75 -0
  342. package/src/react/workflows/useWorkflowResource.test.tsx +41 -0
  343. package/src/react/workflows/useWorkflowResource.ts +78 -0
@@ -0,0 +1,149 @@
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
+ import { Collection, } from "./Collection.js";
6
+ import { SubscriptionCard } from "../components/SubscriptionCard.js";
7
+ const labels = {
8
+ pause: "pause subscription",
9
+ resume: "resume subscription",
10
+ reactivate: "reactivate subscription",
11
+ cancel: "cancel subscription",
12
+ price: "change plan",
13
+ quantity: "update quantity",
14
+ trial: "update trial end",
15
+ endTrial: "end trial now",
16
+ };
17
+ export function useSubscriptionManager(props) {
18
+ const scope = `${props.scopeKey}:${props.subscription?.stripeSubscriptionId ?? ""}`;
19
+ const initial = { scope, quantity: "1", selectedPriceId: "", trialEnd: "" };
20
+ const [fields, setFields] = useState(initial);
21
+ if (fields.scope !== scope)
22
+ setFields(initial);
23
+ const [operation, setOperation] = useState("pause");
24
+ const action = useWorkflowAction(async (type) => {
25
+ setOperation(type);
26
+ if (!props.subscription)
27
+ throw new Error("Select a subscription first.");
28
+ const request = {
29
+ type,
30
+ stripeSubscriptionId: props.subscription.stripeSubscriptionId,
31
+ };
32
+ if (type === "quantity") {
33
+ const quantity = Number(fields.quantity);
34
+ if (!/^\d+$/.test(fields.quantity) ||
35
+ !Number.isSafeInteger(quantity) ||
36
+ quantity < 1)
37
+ throw new Error("Enter a positive integer quantity.");
38
+ request.quantity = quantity;
39
+ }
40
+ if (type === "price") {
41
+ if (!fields.selectedPriceId)
42
+ throw new Error("Choose a price first.");
43
+ request.stripePriceId = fields.selectedPriceId;
44
+ }
45
+ if (type === "trial") {
46
+ if (!fields.trialEnd || Number.isNaN(new Date(fields.trialEnd).getTime()))
47
+ throw new Error("Enter a valid trial end date.");
48
+ request.trialEnd = fields.trialEnd;
49
+ }
50
+ if (type === "endTrial")
51
+ request.trialEnd = "now";
52
+ await props.onAction(request);
53
+ return `${labels[type]} requested. Waiting for Stripe webhook sync.`;
54
+ }, scope);
55
+ const active = props.subscription?.status === "active" ||
56
+ props.subscription?.status === "trialing";
57
+ return {
58
+ ...fields,
59
+ setQuantity: (quantity) => setFields((previous) => ({ ...previous, quantity })),
60
+ setSelectedPriceId: (selectedPriceId) => setFields((previous) => ({ ...previous, selectedPriceId })),
61
+ setTrialEnd: (trialEnd) => setFields((previous) => ({ ...previous, trialEnd })),
62
+ pendingAction: action.isPending ? labels[operation] : null,
63
+ isPending: action.isPending,
64
+ message: action.error ?? action.result ?? null,
65
+ error: action.error,
66
+ canPause: active && !props.subscription?.isCollectionPaused,
67
+ canResume: !!props.subscription?.isCollectionPaused,
68
+ canReactivate: active && !!props.subscription?.cancelAtPeriodEnd,
69
+ run: action.run,
70
+ };
71
+ }
72
+ export function SubscriptionManager(props) {
73
+ const state = useSubscriptionManager(props);
74
+ const id = useId();
75
+ if (props.children)
76
+ return _jsx(_Fragment, { children: props.children(state) });
77
+ if (!props.subscription)
78
+ return _jsx("p", { children: "No subscription selected." });
79
+ return (_jsxs("section", { "data-better-stripe": "subscription-manager", "aria-busy": state.isPending, children: [_jsx(SubscriptionCard, { subscription: {
80
+ ...props.subscription,
81
+ isTrialing: props.subscription.isTrialing ?? false,
82
+ cancelAtPeriodEnd: props.subscription.cancelAtPeriodEnd ?? false,
83
+ } }), state.message && (_jsx("p", { role: state.error ? "alert" : "status", children: state.message })), [
84
+ ["pause", state.canPause],
85
+ ["resume", state.canResume],
86
+ ["reactivate", state.canReactivate],
87
+ [
88
+ "cancel",
89
+ !props.subscription.cancelAtPeriodEnd &&
90
+ props.subscription.status !== "canceled",
91
+ ],
92
+ ].map(([type, enabled]) => (_jsx("button", { type: "button", disabled: !enabled || state.isPending, onClick: () => {
93
+ void state.run(type);
94
+ }, children: state.pendingAction === labels[type] ? "Processing…" : labels[type] }, type))), _jsxs("form", { onSubmit: (event) => {
95
+ event.preventDefault();
96
+ void state.run("price");
97
+ }, children: [_jsx("label", { htmlFor: `${id}-price`, children: "Price ID" }), _jsx("input", { id: `${id}-price`, required: true, value: state.selectedPriceId, onChange: (event) => state.setSelectedPriceId(event.target.value) }), _jsx("button", { type: "submit", disabled: state.isPending, children: "Change plan" })] }), _jsxs("form", { onSubmit: (event) => {
98
+ event.preventDefault();
99
+ void state.run("quantity");
100
+ }, children: [_jsx("label", { htmlFor: `${id}-quantity`, children: "Quantity" }), _jsx("input", { id: `${id}-quantity`, type: "number", min: "1", step: "1", required: true, value: state.quantity, onChange: (event) => state.setQuantity(event.target.value) }), _jsx("button", { type: "submit", disabled: state.isPending, children: "Update quantity" })] }), _jsxs("form", { onSubmit: (event) => {
101
+ event.preventDefault();
102
+ void state.run("trial");
103
+ }, children: [_jsx("label", { htmlFor: `${id}-trial`, children: "Trial end" }), _jsx("input", { id: `${id}-trial`, type: "datetime-local", required: true, value: state.trialEnd, onChange: (event) => state.setTrialEnd(event.target.value) }), _jsx("button", { type: "submit", disabled: state.isPending, children: "Set trial end" })] }), _jsx("button", { type: "button", disabled: state.isPending, onClick: () => {
104
+ void state.run("endTrial");
105
+ }, children: "End trial now" })] }));
106
+ }
107
+ export const SUBSCRIPTION_FILTERS = [
108
+ { label: "All", value: "all" },
109
+ { label: "Active", value: "active" },
110
+ { label: "Trialing", value: "trialing" },
111
+ { label: "Past Due", value: "past_due" },
112
+ { label: "Canceled", value: "canceled" },
113
+ ];
114
+ export function useSubscriptionFilter(subscriptions) {
115
+ const [filter, setFilter] = useState("all");
116
+ return {
117
+ filter,
118
+ setFilter,
119
+ filtered: filter === "all"
120
+ ? (subscriptions ?? [])
121
+ : (subscriptions?.filter((row) => row.status === filter) ?? []),
122
+ countByStatus: (status) => subscriptions?.filter((row) => row.status === status).length ?? 0,
123
+ tabs: SUBSCRIPTION_FILTERS,
124
+ };
125
+ }
126
+ export function Subscriptions(props) {
127
+ const columns = [
128
+ {
129
+ id: "id",
130
+ label: "Subscription",
131
+ cell: (row) => row.stripeSubscriptionId,
132
+ },
133
+ { id: "status", label: "Status", cell: (row) => row.status },
134
+ {
135
+ id: "period",
136
+ label: "Current period end",
137
+ cell: (row) => row.currentPeriodEnd
138
+ ? new Date(row.currentPeriodEnd).toLocaleDateString()
139
+ : "Not supplied",
140
+ },
141
+ {
142
+ id: "trial",
143
+ label: "Trial end",
144
+ cell: (row) => row.trialEnd ? new Date(row.trialEnd).toLocaleDateString() : "None",
145
+ },
146
+ ];
147
+ return (_jsx(Collection, { emptyLabel: "No subscriptions yet.", ...props, columns: props.columns ?? columns, getKey: (row) => row.stripeSubscriptionId }));
148
+ }
149
+ //# sourceMappingURL=Subscriptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Subscriptions.js","sourceRoot":"","sources":["../../../src/react/workflows/Subscriptions.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;A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"react";
2
+ export type WorkflowLogEntry = {
3
+ id: number;
4
+ timestamp: string;
5
+ action: string;
6
+ result: string;
7
+ status: "success" | "error";
8
+ };
9
+ export type TaskRunnerOptions = {
10
+ scopeKey?: string;
11
+ maxEntries?: number;
12
+ /** Explicitly select safe fields for display. Default never serializes returned secrets. */ formatResult?: (value: unknown) => string;
13
+ };
14
+ export declare function useTaskRunner({ scopeKey, maxEntries, formatResult, }?: TaskRunnerOptions): {
15
+ log: WorkflowLogEntry[];
16
+ results: Record<string, string>;
17
+ errors: Record<string, string>;
18
+ isPending: boolean;
19
+ pendingOperation: string | null;
20
+ run: <T>(name: string, task: () => Promise<T>) => Promise<T | undefined>;
21
+ appendLog: (action: string, result: string, status?: "success" | "error") => void;
22
+ clearLog: () => void;
23
+ };
24
+ export type WorkflowTask = {
25
+ id: string;
26
+ label: string;
27
+ description?: string;
28
+ run: () => Promise<unknown>;
29
+ requiresConfirmation?: boolean;
30
+ };
31
+ export type WorkflowTasksProps = TaskRunnerOptions & {
32
+ title?: string;
33
+ tasks: WorkflowTask[];
34
+ children?: (state: ReturnType<typeof useTaskRunner>) => ReactNode;
35
+ };
36
+ /** Unstyled administration/sandbox operations. Authorization and test-mode enforcement belong to the server callbacks. */
37
+ export declare function WorkflowTasks(props: WorkflowTasksProps): import("react").JSX.Element;
38
+ export declare function StripeSetup(props: Omit<WorkflowTasksProps, "title">): import("react").JSX.Element;
39
+ export declare function SandboxTesting(props: Omit<WorkflowTasksProps, "title">): import("react").JSX.Element;
40
+ //# sourceMappingURL=Tasks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Tasks.d.ts","sourceRoot":"","sources":["../../../src/react/workflows/Tasks.tsx"],"names":[],"mappings":"AACA,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAExD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,M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"}
@@ -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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Aa,OAAK,KAAK,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,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