@mmailaender/convex-creem 0.1.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 (383) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +1176 -0
  3. package/dist/client/helpers.d.ts +17 -0
  4. package/dist/client/helpers.d.ts.map +1 -0
  5. package/dist/client/helpers.js +43 -0
  6. package/dist/client/helpers.js.map +1 -0
  7. package/dist/client/index.d.ts +1041 -0
  8. package/dist/client/index.d.ts.map +1 -0
  9. package/dist/client/index.js +1068 -0
  10. package/dist/client/index.js.map +1 -0
  11. package/dist/client/parsers.d.ts +45 -0
  12. package/dist/client/parsers.d.ts.map +1 -0
  13. package/dist/client/parsers.js +138 -0
  14. package/dist/client/parsers.js.map +1 -0
  15. package/dist/client/polyfill.d.ts +2 -0
  16. package/dist/client/polyfill.d.ts.map +1 -0
  17. package/dist/client/polyfill.js +3 -0
  18. package/dist/client/polyfill.js.map +1 -0
  19. package/dist/component/_generated/api.d.ts +36 -0
  20. package/dist/component/_generated/api.d.ts.map +1 -0
  21. package/dist/component/_generated/api.js +31 -0
  22. package/dist/component/_generated/api.js.map +1 -0
  23. package/dist/component/_generated/component.d.ts +542 -0
  24. package/dist/component/_generated/component.d.ts.map +1 -0
  25. package/dist/component/_generated/component.js +11 -0
  26. package/dist/component/_generated/component.js.map +1 -0
  27. package/dist/component/_generated/dataModel.d.ts +46 -0
  28. package/dist/component/_generated/dataModel.d.ts.map +1 -0
  29. package/dist/component/_generated/dataModel.js +11 -0
  30. package/dist/component/_generated/dataModel.js.map +1 -0
  31. package/dist/component/_generated/server.d.ts +121 -0
  32. package/dist/component/_generated/server.d.ts.map +1 -0
  33. package/dist/component/_generated/server.js +78 -0
  34. package/dist/component/_generated/server.js.map +1 -0
  35. package/dist/component/convex.config.d.ts +3 -0
  36. package/dist/component/convex.config.d.ts.map +1 -0
  37. package/dist/component/convex.config.js +3 -0
  38. package/dist/component/convex.config.js.map +1 -0
  39. package/dist/component/lib.d.ts +1005 -0
  40. package/dist/component/lib.d.ts.map +1 -0
  41. package/dist/component/lib.js +647 -0
  42. package/dist/component/lib.js.map +1 -0
  43. package/dist/component/schema.d.ts +191 -0
  44. package/dist/component/schema.d.ts.map +1 -0
  45. package/dist/component/schema.js +104 -0
  46. package/dist/component/schema.js.map +1 -0
  47. package/dist/component/util.d.ts +61 -0
  48. package/dist/component/util.d.ts.map +1 -0
  49. package/dist/component/util.js +142 -0
  50. package/dist/component/util.js.map +1 -0
  51. package/dist/core/catalog.d.ts +18 -0
  52. package/dist/core/catalog.d.ts.map +1 -0
  53. package/dist/core/catalog.js +82 -0
  54. package/dist/core/catalog.js.map +1 -0
  55. package/dist/core/index.d.ts +9 -0
  56. package/dist/core/index.d.ts.map +1 -0
  57. package/dist/core/index.js +9 -0
  58. package/dist/core/index.js.map +1 -0
  59. package/dist/core/markdown.d.ts +12 -0
  60. package/dist/core/markdown.d.ts.map +1 -0
  61. package/dist/core/markdown.js +26 -0
  62. package/dist/core/markdown.js.map +1 -0
  63. package/dist/core/payments.d.ts +11 -0
  64. package/dist/core/payments.d.ts.map +1 -0
  65. package/dist/core/payments.js +27 -0
  66. package/dist/core/payments.js.map +1 -0
  67. package/dist/core/pendingCheckout.d.ts +15 -0
  68. package/dist/core/pendingCheckout.d.ts.map +1 -0
  69. package/dist/core/pendingCheckout.js +40 -0
  70. package/dist/core/pendingCheckout.js.map +1 -0
  71. package/dist/core/resolver.d.ts +11 -0
  72. package/dist/core/resolver.d.ts.map +1 -0
  73. package/dist/core/resolver.js +106 -0
  74. package/dist/core/resolver.js.map +1 -0
  75. package/dist/core/selectors.d.ts +12 -0
  76. package/dist/core/selectors.d.ts.map +1 -0
  77. package/dist/core/selectors.js +18 -0
  78. package/dist/core/selectors.js.map +1 -0
  79. package/dist/core/subscriptionUpdate.d.ts +20 -0
  80. package/dist/core/subscriptionUpdate.d.ts.map +1 -0
  81. package/dist/core/subscriptionUpdate.js +64 -0
  82. package/dist/core/subscriptionUpdate.js.map +1 -0
  83. package/dist/core/types.d.ts +170 -0
  84. package/dist/core/types.d.ts.map +1 -0
  85. package/dist/core/types.js +15 -0
  86. package/dist/core/types.js.map +1 -0
  87. package/dist/design-system/colors/color-utils.d.ts +10 -0
  88. package/dist/design-system/colors/color-utils.d.ts.map +1 -0
  89. package/dist/design-system/colors/color-utils.js +91 -0
  90. package/dist/design-system/colors/color-utils.js.map +1 -0
  91. package/dist/design-system/colors/config.d.ts +33 -0
  92. package/dist/design-system/colors/config.d.ts.map +1 -0
  93. package/dist/design-system/colors/config.js +224 -0
  94. package/dist/design-system/colors/config.js.map +1 -0
  95. package/dist/design-system/colors/index.d.ts +3 -0
  96. package/dist/design-system/colors/index.d.ts.map +1 -0
  97. package/dist/design-system/colors/index.js +3 -0
  98. package/dist/design-system/colors/index.js.map +1 -0
  99. package/dist/design-system/rounded/config.d.ts +31 -0
  100. package/dist/design-system/rounded/config.d.ts.map +1 -0
  101. package/dist/design-system/rounded/config.js +76 -0
  102. package/dist/design-system/rounded/config.js.map +1 -0
  103. package/dist/design-system/rounded/index.d.ts +2 -0
  104. package/dist/design-system/rounded/index.d.ts.map +1 -0
  105. package/dist/design-system/rounded/index.js +2 -0
  106. package/dist/design-system/rounded/index.js.map +1 -0
  107. package/dist/design-system/typography/config.d.ts +55 -0
  108. package/dist/design-system/typography/config.d.ts.map +1 -0
  109. package/dist/design-system/typography/config.js +308 -0
  110. package/dist/design-system/typography/config.js.map +1 -0
  111. package/dist/design-system/typography/index.d.ts +3 -0
  112. package/dist/design-system/typography/index.d.ts.map +1 -0
  113. package/dist/design-system/typography/index.js +3 -0
  114. package/dist/design-system/typography/index.js.map +1 -0
  115. package/dist/design-system/typography/tokens.d.ts +23 -0
  116. package/dist/design-system/typography/tokens.d.ts.map +1 -0
  117. package/dist/design-system/typography/tokens.js +99 -0
  118. package/dist/design-system/typography/tokens.js.map +1 -0
  119. package/dist/react/hooks/useCheckoutSuccessParams.d.ts +2 -0
  120. package/dist/react/hooks/useCheckoutSuccessParams.d.ts.map +1 -0
  121. package/dist/react/hooks/useCheckoutSuccessParams.js +5 -0
  122. package/dist/react/hooks/useCheckoutSuccessParams.js.map +1 -0
  123. package/dist/react/index.d.ts +25 -0
  124. package/dist/react/index.d.ts.map +1 -0
  125. package/dist/react/index.js +22 -0
  126. package/dist/react/index.js.map +1 -0
  127. package/dist/react/primitives/BillingGate.d.ts +8 -0
  128. package/dist/react/primitives/BillingGate.d.ts.map +1 -0
  129. package/dist/react/primitives/BillingGate.js +13 -0
  130. package/dist/react/primitives/BillingGate.js.map +1 -0
  131. package/dist/react/primitives/BillingToggle.d.ts +8 -0
  132. package/dist/react/primitives/BillingToggle.d.ts.map +1 -0
  133. package/dist/react/primitives/BillingToggle.js +12 -0
  134. package/dist/react/primitives/BillingToggle.js.map +1 -0
  135. package/dist/react/primitives/CheckoutButton.d.ts +11 -0
  136. package/dist/react/primitives/CheckoutButton.d.ts.map +1 -0
  137. package/dist/react/primitives/CheckoutButton.js +21 -0
  138. package/dist/react/primitives/CheckoutButton.js.map +1 -0
  139. package/dist/react/primitives/CheckoutSuccessSummary.d.ts +7 -0
  140. package/dist/react/primitives/CheckoutSuccessSummary.d.ts.map +1 -0
  141. package/dist/react/primitives/CheckoutSuccessSummary.js +11 -0
  142. package/dist/react/primitives/CheckoutSuccessSummary.js.map +1 -0
  143. package/dist/react/primitives/CustomerPortalButton.d.ts +8 -0
  144. package/dist/react/primitives/CustomerPortalButton.d.ts.map +1 -0
  145. package/dist/react/primitives/CustomerPortalButton.js +21 -0
  146. package/dist/react/primitives/CustomerPortalButton.js.map +1 -0
  147. package/dist/react/primitives/NumberInput.d.ts +11 -0
  148. package/dist/react/primitives/NumberInput.d.ts.map +1 -0
  149. package/dist/react/primitives/NumberInput.js +18 -0
  150. package/dist/react/primitives/NumberInput.js.map +1 -0
  151. package/dist/react/primitives/OneTimeCheckoutButton.d.ts +11 -0
  152. package/dist/react/primitives/OneTimeCheckoutButton.d.ts.map +1 -0
  153. package/dist/react/primitives/OneTimeCheckoutButton.js +4 -0
  154. package/dist/react/primitives/OneTimeCheckoutButton.js.map +1 -0
  155. package/dist/react/primitives/OneTimePaymentStatusBadge.d.ts +6 -0
  156. package/dist/react/primitives/OneTimePaymentStatusBadge.d.ts.map +1 -0
  157. package/dist/react/primitives/OneTimePaymentStatusBadge.js +11 -0
  158. package/dist/react/primitives/OneTimePaymentStatusBadge.js.map +1 -0
  159. package/dist/react/primitives/PaymentWarningBanner.d.ts +7 -0
  160. package/dist/react/primitives/PaymentWarningBanner.d.ts.map +1 -0
  161. package/dist/react/primitives/PaymentWarningBanner.js +18 -0
  162. package/dist/react/primitives/PaymentWarningBanner.js.map +1 -0
  163. package/dist/react/primitives/PricingCard.d.ts +37 -0
  164. package/dist/react/primitives/PricingCard.d.ts.map +1 -0
  165. package/dist/react/primitives/PricingCard.js +125 -0
  166. package/dist/react/primitives/PricingCard.js.map +1 -0
  167. package/dist/react/primitives/PricingSection.d.ts +39 -0
  168. package/dist/react/primitives/PricingSection.d.ts.map +1 -0
  169. package/dist/react/primitives/PricingSection.js +24 -0
  170. package/dist/react/primitives/PricingSection.js.map +1 -0
  171. package/dist/react/primitives/ScheduledChangeBanner.d.ts +8 -0
  172. package/dist/react/primitives/ScheduledChangeBanner.d.ts.map +1 -0
  173. package/dist/react/primitives/ScheduledChangeBanner.js +13 -0
  174. package/dist/react/primitives/ScheduledChangeBanner.js.map +1 -0
  175. package/dist/react/primitives/SegmentControl.d.ts +11 -0
  176. package/dist/react/primitives/SegmentControl.d.ts.map +1 -0
  177. package/dist/react/primitives/SegmentControl.js +8 -0
  178. package/dist/react/primitives/SegmentControl.js.map +1 -0
  179. package/dist/react/primitives/SegmentGroup.d.ts +14 -0
  180. package/dist/react/primitives/SegmentGroup.d.ts.map +1 -0
  181. package/dist/react/primitives/SegmentGroup.js +11 -0
  182. package/dist/react/primitives/SegmentGroup.js.map +1 -0
  183. package/dist/react/primitives/TrialLimitBanner.d.ts +7 -0
  184. package/dist/react/primitives/TrialLimitBanner.d.ts.map +1 -0
  185. package/dist/react/primitives/TrialLimitBanner.js +14 -0
  186. package/dist/react/primitives/TrialLimitBanner.js.map +1 -0
  187. package/dist/react/shared.d.ts +28 -0
  188. package/dist/react/shared.d.ts.map +1 -0
  189. package/dist/react/shared.js +109 -0
  190. package/dist/react/shared.js.map +1 -0
  191. package/dist/react/widgets/BillingPortal.d.ts +9 -0
  192. package/dist/react/widgets/BillingPortal.d.ts.map +1 -0
  193. package/dist/react/widgets/BillingPortal.js +30 -0
  194. package/dist/react/widgets/BillingPortal.js.map +1 -0
  195. package/dist/react/widgets/ProductItem.d.ts +8 -0
  196. package/dist/react/widgets/ProductItem.d.ts.map +1 -0
  197. package/dist/react/widgets/ProductItem.js +14 -0
  198. package/dist/react/widgets/ProductItem.js.map +1 -0
  199. package/dist/react/widgets/ProductRoot.d.ts +16 -0
  200. package/dist/react/widgets/ProductRoot.d.ts.map +1 -0
  201. package/dist/react/widgets/ProductRoot.js +171 -0
  202. package/dist/react/widgets/ProductRoot.js.map +1 -0
  203. package/dist/react/widgets/SubscriptionItem.d.ts +27 -0
  204. package/dist/react/widgets/SubscriptionItem.d.ts.map +1 -0
  205. package/dist/react/widgets/SubscriptionItem.js +32 -0
  206. package/dist/react/widgets/SubscriptionItem.js.map +1 -0
  207. package/dist/react/widgets/SubscriptionRoot.d.ts +16 -0
  208. package/dist/react/widgets/SubscriptionRoot.d.ts.map +1 -0
  209. package/dist/react/widgets/SubscriptionRoot.js +405 -0
  210. package/dist/react/widgets/SubscriptionRoot.js.map +1 -0
  211. package/dist/react/widgets/index.d.ts +19 -0
  212. package/dist/react/widgets/index.d.ts.map +1 -0
  213. package/dist/react/widgets/index.js +16 -0
  214. package/dist/react/widgets/index.js.map +1 -0
  215. package/dist/react/widgets/productGroupContext.d.ts +6 -0
  216. package/dist/react/widgets/productGroupContext.d.ts.map +1 -0
  217. package/dist/react/widgets/productGroupContext.js +3 -0
  218. package/dist/react/widgets/productGroupContext.js.map +1 -0
  219. package/dist/react/widgets/subscriptionContext.d.ts +6 -0
  220. package/dist/react/widgets/subscriptionContext.d.ts.map +1 -0
  221. package/dist/react/widgets/subscriptionContext.js +3 -0
  222. package/dist/react/widgets/subscriptionContext.js.map +1 -0
  223. package/dist/react/widgets/types.d.ts +171 -0
  224. package/dist/react/widgets/types.d.ts.map +1 -0
  225. package/dist/react/widgets/types.js +2 -0
  226. package/dist/react/widgets/types.js.map +1 -0
  227. package/dist/svelte/index.d.ts +22 -0
  228. package/dist/svelte/index.d.ts.map +1 -0
  229. package/dist/svelte/index.js +20 -0
  230. package/dist/svelte/index.js.map +1 -0
  231. package/dist/svelte/primitives/BillingGate.svelte +28 -0
  232. package/dist/svelte/primitives/BillingToggle.svelte +27 -0
  233. package/dist/svelte/primitives/CheckoutButton.svelte +60 -0
  234. package/dist/svelte/primitives/CheckoutSuccessSummary.svelte +34 -0
  235. package/dist/svelte/primitives/CustomerPortalButton.svelte +60 -0
  236. package/dist/svelte/primitives/NumberInput.svelte +71 -0
  237. package/dist/svelte/primitives/OneTimeCheckoutButton.svelte +37 -0
  238. package/dist/svelte/primitives/OneTimePaymentStatusBadge.svelte +20 -0
  239. package/dist/svelte/primitives/PaymentWarningBanner.svelte +30 -0
  240. package/dist/svelte/primitives/PricingCard.svelte +356 -0
  241. package/dist/svelte/primitives/PricingSection.svelte +121 -0
  242. package/dist/svelte/primitives/ScheduledChangeBanner.svelte +46 -0
  243. package/dist/svelte/primitives/SegmentControl.svelte +38 -0
  244. package/dist/svelte/primitives/SegmentGroup.svelte +52 -0
  245. package/dist/svelte/primitives/TrialLimitBanner.svelte +32 -0
  246. package/dist/svelte/primitives/shared.d.ts +13 -0
  247. package/dist/svelte/primitives/shared.d.ts.map +1 -0
  248. package/dist/svelte/primitives/shared.js +87 -0
  249. package/dist/svelte/primitives/shared.js.map +1 -0
  250. package/dist/svelte/widgets/BillingPortal.svelte +55 -0
  251. package/dist/svelte/widgets/Product.svelte +35 -0
  252. package/dist/svelte/widgets/ProductRoot.svelte +428 -0
  253. package/dist/svelte/widgets/Subscription.svelte +52 -0
  254. package/dist/svelte/widgets/SubscriptionRoot.svelte +690 -0
  255. package/dist/svelte/widgets/index.d.ts +19 -0
  256. package/dist/svelte/widgets/index.d.ts.map +1 -0
  257. package/dist/svelte/widgets/index.js +16 -0
  258. package/dist/svelte/widgets/index.js.map +1 -0
  259. package/dist/svelte/widgets/productGroupContext.d.ts +6 -0
  260. package/dist/svelte/widgets/productGroupContext.d.ts.map +1 -0
  261. package/dist/svelte/widgets/productGroupContext.js +2 -0
  262. package/dist/svelte/widgets/productGroupContext.js.map +1 -0
  263. package/dist/svelte/widgets/subscriptionContext.d.ts +6 -0
  264. package/dist/svelte/widgets/subscriptionContext.d.ts.map +1 -0
  265. package/dist/svelte/widgets/subscriptionContext.js +2 -0
  266. package/dist/svelte/widgets/subscriptionContext.js.map +1 -0
  267. package/dist/svelte/widgets/types.d.ts +171 -0
  268. package/dist/svelte/widgets/types.d.ts.map +1 -0
  269. package/dist/svelte/widgets/types.js +2 -0
  270. package/dist/svelte/widgets/types.js.map +1 -0
  271. package/package.json +182 -0
  272. package/src/client/helpers.test.ts +139 -0
  273. package/src/client/helpers.ts +51 -0
  274. package/src/client/index.test.ts +1554 -0
  275. package/src/client/index.ts +1504 -0
  276. package/src/client/parsers.test.ts +1017 -0
  277. package/src/client/parsers.ts +182 -0
  278. package/src/client/polyfill.ts +2 -0
  279. package/src/component/_generated/api.ts +52 -0
  280. package/src/component/_generated/component.ts +619 -0
  281. package/src/component/_generated/dataModel.ts +60 -0
  282. package/src/component/_generated/server.ts +156 -0
  283. package/src/component/convex.config.ts +3 -0
  284. package/src/component/lib.test.ts +1359 -0
  285. package/src/component/lib.ts +726 -0
  286. package/src/component/schema.ts +112 -0
  287. package/src/component/util.test.ts +281 -0
  288. package/src/component/util.ts +228 -0
  289. package/src/core/catalog.test.ts +212 -0
  290. package/src/core/catalog.ts +119 -0
  291. package/src/core/index.ts +8 -0
  292. package/src/core/markdown.test.ts +43 -0
  293. package/src/core/markdown.ts +26 -0
  294. package/src/core/payments.test.ts +69 -0
  295. package/src/core/payments.ts +33 -0
  296. package/src/core/pendingCheckout.test.ts +44 -0
  297. package/src/core/pendingCheckout.ts +40 -0
  298. package/src/core/resolver.test.ts +283 -0
  299. package/src/core/resolver.ts +160 -0
  300. package/src/core/selectors.test.ts +119 -0
  301. package/src/core/selectors.ts +35 -0
  302. package/src/core/subscriptionUpdate.test.ts +164 -0
  303. package/src/core/subscriptionUpdate.ts +102 -0
  304. package/src/core/types.ts +220 -0
  305. package/src/design-system/README.md +40 -0
  306. package/src/design-system/base.css +27 -0
  307. package/src/design-system/colors/color-utils.ts +110 -0
  308. package/src/design-system/colors/config.ts +282 -0
  309. package/src/design-system/colors/index.ts +2 -0
  310. package/src/design-system/colors/utilities.css +2328 -0
  311. package/src/design-system/components/badges.css +65 -0
  312. package/src/design-system/components/buttons.css +256 -0
  313. package/src/design-system/components/dialog.css +218 -0
  314. package/src/design-system/components/icon-buttons.css +115 -0
  315. package/src/design-system/components/inputs.css +94 -0
  316. package/src/design-system/components/links.css +53 -0
  317. package/src/design-system/components/prose.css +67 -0
  318. package/src/design-system/components/segment-control.css +303 -0
  319. package/src/design-system/index.css +21 -0
  320. package/src/design-system/rounded/config.ts +91 -0
  321. package/src/design-system/rounded/index.ts +1 -0
  322. package/src/design-system/rounded/utilities.css +37 -0
  323. package/src/design-system/typography/config.ts +340 -0
  324. package/src/design-system/typography/index.ts +2 -0
  325. package/src/design-system/typography/tokens.ts +148 -0
  326. package/src/design-system/typography/utilities.css +728 -0
  327. package/src/library.css +20 -0
  328. package/src/react/hooks/useCheckoutSuccessParams.ts +7 -0
  329. package/src/react/index.tsx +47 -0
  330. package/src/react/primitives/BillingGate.tsx +26 -0
  331. package/src/react/primitives/BillingToggle.tsx +29 -0
  332. package/src/react/primitives/CheckoutButton.tsx +47 -0
  333. package/src/react/primitives/CheckoutSuccessSummary.tsx +36 -0
  334. package/src/react/primitives/CustomerPortalButton.tsx +50 -0
  335. package/src/react/primitives/NumberInput.tsx +83 -0
  336. package/src/react/primitives/OneTimeCheckoutButton.tsx +27 -0
  337. package/src/react/primitives/OneTimePaymentStatusBadge.tsx +18 -0
  338. package/src/react/primitives/PaymentWarningBanner.tsx +33 -0
  339. package/src/react/primitives/PricingCard.tsx +421 -0
  340. package/src/react/primitives/PricingSection.tsx +129 -0
  341. package/src/react/primitives/ScheduledChangeBanner.tsx +52 -0
  342. package/src/react/primitives/SegmentControl.tsx +32 -0
  343. package/src/react/primitives/SegmentGroup.tsx +53 -0
  344. package/src/react/primitives/TrialLimitBanner.tsx +32 -0
  345. package/src/react/shared.ts +138 -0
  346. package/src/react/widgets/BillingPortal.tsx +56 -0
  347. package/src/react/widgets/ProductItem.tsx +26 -0
  348. package/src/react/widgets/ProductRoot.tsx +441 -0
  349. package/src/react/widgets/SubscriptionItem.tsx +71 -0
  350. package/src/react/widgets/SubscriptionRoot.tsx +759 -0
  351. package/src/react/widgets/index.ts +36 -0
  352. package/src/react/widgets/productGroupContext.ts +10 -0
  353. package/src/react/widgets/subscriptionContext.ts +10 -0
  354. package/src/react/widgets/types.ts +179 -0
  355. package/src/svelte/index.ts +43 -0
  356. package/src/svelte/primitives/BillingGate.svelte +28 -0
  357. package/src/svelte/primitives/BillingToggle.svelte +27 -0
  358. package/src/svelte/primitives/CheckoutButton.svelte +60 -0
  359. package/src/svelte/primitives/CheckoutSuccessSummary.svelte +34 -0
  360. package/src/svelte/primitives/CustomerPortalButton.svelte +60 -0
  361. package/src/svelte/primitives/NumberInput.svelte +71 -0
  362. package/src/svelte/primitives/OneTimeCheckoutButton.svelte +37 -0
  363. package/src/svelte/primitives/OneTimePaymentStatusBadge.svelte +20 -0
  364. package/src/svelte/primitives/PaymentWarningBanner.svelte +30 -0
  365. package/src/svelte/primitives/PricingCard.svelte +356 -0
  366. package/src/svelte/primitives/PricingSection.svelte +121 -0
  367. package/src/svelte/primitives/ScheduledChangeBanner.svelte +46 -0
  368. package/src/svelte/primitives/SegmentControl.svelte +38 -0
  369. package/src/svelte/primitives/SegmentGroup.svelte +52 -0
  370. package/src/svelte/primitives/TrialLimitBanner.svelte +32 -0
  371. package/src/svelte/primitives/shared.ts +113 -0
  372. package/src/svelte/svelte.d.ts +6 -0
  373. package/src/svelte/widgets/BillingPortal.svelte +55 -0
  374. package/src/svelte/widgets/Product.svelte +35 -0
  375. package/src/svelte/widgets/ProductRoot.svelte +428 -0
  376. package/src/svelte/widgets/Subscription.svelte +52 -0
  377. package/src/svelte/widgets/SubscriptionRoot.svelte +690 -0
  378. package/src/svelte/widgets/index.ts +36 -0
  379. package/src/svelte/widgets/productGroupContext.ts +7 -0
  380. package/src/svelte/widgets/subscriptionContext.ts +7 -0
  381. package/src/svelte/widgets/types.ts +179 -0
  382. package/src/tailwind.css +6 -0
  383. package/src/test.ts +18 -0
@@ -0,0 +1,619 @@
1
+ /* eslint-disable */
2
+ /**
3
+ * Generated `ComponentApi` utility.
4
+ *
5
+ * THIS CODE IS AUTOMATICALLY GENERATED.
6
+ *
7
+ * To regenerate, run `npx convex dev`.
8
+ * @module
9
+ */
10
+
11
+ import type { FunctionReference } from "convex/server";
12
+
13
+ /**
14
+ * A utility for referencing a Convex component's exposed API.
15
+ *
16
+ * Useful when expecting a parameter like `components.myComponent`.
17
+ * Usage:
18
+ * ```ts
19
+ * async function myFunction(ctx: QueryCtx, component: ComponentApi) {
20
+ * return ctx.runQuery(component.someFile.someQuery, { ...args });
21
+ * }
22
+ * ```
23
+ */
24
+ export type ComponentApi<Name extends string | undefined = string | undefined> =
25
+ {
26
+ lib: {
27
+ createOrder: FunctionReference<
28
+ "mutation",
29
+ "internal",
30
+ {
31
+ order: {
32
+ affiliate?: string | null;
33
+ amount: number;
34
+ amountDue?: number;
35
+ amountPaid?: number;
36
+ checkoutId?: string | null;
37
+ createdAt: string;
38
+ currency: string;
39
+ customerId: string;
40
+ discountAmount?: number;
41
+ discountId?: string | null;
42
+ id: string;
43
+ metadata?: Record<string, any>;
44
+ mode?: string;
45
+ productId: string;
46
+ status: string;
47
+ subTotal?: number;
48
+ taxAmount?: number;
49
+ transactionId?: string | null;
50
+ type: string;
51
+ updatedAt: string;
52
+ };
53
+ },
54
+ any,
55
+ Name
56
+ >;
57
+ createProduct: FunctionReference<
58
+ "mutation",
59
+ "internal",
60
+ {
61
+ product: {
62
+ billingPeriod?: string;
63
+ billingType: string;
64
+ createdAt: string;
65
+ currency: string;
66
+ defaultSuccessUrl?: string | null;
67
+ description: string | null;
68
+ features?: Array<{ description: string; id: string }>;
69
+ id: string;
70
+ imageUrl?: string;
71
+ metadata?: Record<string, any>;
72
+ mode?: string;
73
+ modifiedAt: string | null;
74
+ name: string;
75
+ price: number;
76
+ productUrl?: string;
77
+ status: string;
78
+ taxCategory?: string;
79
+ taxMode?: string;
80
+ };
81
+ },
82
+ any,
83
+ Name
84
+ >;
85
+ createSubscription: FunctionReference<
86
+ "mutation",
87
+ "internal",
88
+ {
89
+ subscription: {
90
+ amount: number | null;
91
+ cancelAtPeriodEnd: boolean;
92
+ canceledAt?: string | null;
93
+ checkoutId: string | null;
94
+ collectionMethod?: string;
95
+ createdAt: string;
96
+ currency: string | null;
97
+ currentPeriodEnd: string | null;
98
+ currentPeriodStart: string;
99
+ customerId: string;
100
+ discountId?: string | null;
101
+ endedAt: string | null;
102
+ endsAt?: string | null;
103
+ id: string;
104
+ lastTransactionId?: string | null;
105
+ metadata: Record<string, any>;
106
+ mode?: string;
107
+ modifiedAt: string | null;
108
+ nextTransactionDate?: string | null;
109
+ priceId?: string;
110
+ productId: string;
111
+ recurringInterval: string | null;
112
+ seats?: number | null;
113
+ startedAt: string | null;
114
+ status: string;
115
+ trialEnd?: string | null;
116
+ trialStart?: string | null;
117
+ };
118
+ },
119
+ any,
120
+ Name
121
+ >;
122
+ executeSubscriptionLifecycle: FunctionReference<
123
+ "action",
124
+ "internal",
125
+ {
126
+ apiKey: string;
127
+ cancelMode?: string;
128
+ operation: "cancel" | "resume" | "pause";
129
+ previousCancelAtPeriodEnd?: boolean;
130
+ previousStatus?: string;
131
+ serverIdx?: number;
132
+ serverURL?: string;
133
+ subscriptionId: string;
134
+ },
135
+ any,
136
+ Name
137
+ >;
138
+ executeSubscriptionUpdate: FunctionReference<
139
+ "action",
140
+ "internal",
141
+ {
142
+ apiKey: string;
143
+ previousProductId?: string;
144
+ previousSeats?: number | null;
145
+ productId?: string;
146
+ serverIdx?: number;
147
+ serverURL?: string;
148
+ subscriptionId: string;
149
+ units?: number;
150
+ updateBehavior?: string;
151
+ },
152
+ any,
153
+ Name
154
+ >;
155
+ getCurrentSubscription: FunctionReference<
156
+ "query",
157
+ "internal",
158
+ { entityId: string },
159
+ {
160
+ amount: number | null;
161
+ cancelAtPeriodEnd: boolean;
162
+ canceledAt?: string | null;
163
+ checkoutId: string | null;
164
+ collectionMethod?: string;
165
+ createdAt: string;
166
+ currency: string | null;
167
+ currentPeriodEnd: string | null;
168
+ currentPeriodStart: string;
169
+ customerId: string;
170
+ discountId?: string | null;
171
+ endedAt: string | null;
172
+ endsAt?: string | null;
173
+ id: string;
174
+ lastTransactionId?: string | null;
175
+ metadata: Record<string, any>;
176
+ mode?: string;
177
+ modifiedAt: string | null;
178
+ nextTransactionDate?: string | null;
179
+ priceId?: string;
180
+ product: {
181
+ billingPeriod?: string;
182
+ billingType: string;
183
+ createdAt: string;
184
+ currency: string;
185
+ defaultSuccessUrl?: string | null;
186
+ description: string | null;
187
+ features?: Array<{ description: string; id: string }>;
188
+ id: string;
189
+ imageUrl?: string;
190
+ metadata?: Record<string, any>;
191
+ mode?: string;
192
+ modifiedAt: string | null;
193
+ name: string;
194
+ price: number;
195
+ productUrl?: string;
196
+ status: string;
197
+ taxCategory?: string;
198
+ taxMode?: string;
199
+ };
200
+ productId: string;
201
+ recurringInterval: string | null;
202
+ seats?: number | null;
203
+ startedAt: string | null;
204
+ status: string;
205
+ trialEnd?: string | null;
206
+ trialStart?: string | null;
207
+ } | null,
208
+ Name
209
+ >;
210
+ getCustomerByEntityId: FunctionReference<
211
+ "query",
212
+ "internal",
213
+ { entityId: string },
214
+ {
215
+ country?: string;
216
+ createdAt?: string;
217
+ email?: string;
218
+ entityId: string;
219
+ id: string;
220
+ metadata?: Record<string, any>;
221
+ mode?: string;
222
+ name?: string | null;
223
+ updatedAt?: string;
224
+ } | null,
225
+ Name
226
+ >;
227
+ getProduct: FunctionReference<
228
+ "query",
229
+ "internal",
230
+ { id: string },
231
+ {
232
+ billingPeriod?: string;
233
+ billingType: string;
234
+ createdAt: string;
235
+ currency: string;
236
+ defaultSuccessUrl?: string | null;
237
+ description: string | null;
238
+ features?: Array<{ description: string; id: string }>;
239
+ id: string;
240
+ imageUrl?: string;
241
+ metadata?: Record<string, any>;
242
+ mode?: string;
243
+ modifiedAt: string | null;
244
+ name: string;
245
+ price: number;
246
+ productUrl?: string;
247
+ status: string;
248
+ taxCategory?: string;
249
+ taxMode?: string;
250
+ } | null,
251
+ Name
252
+ >;
253
+ getSubscription: FunctionReference<
254
+ "query",
255
+ "internal",
256
+ { id: string },
257
+ {
258
+ amount: number | null;
259
+ cancelAtPeriodEnd: boolean;
260
+ canceledAt?: string | null;
261
+ checkoutId: string | null;
262
+ collectionMethod?: string;
263
+ createdAt: string;
264
+ currency: string | null;
265
+ currentPeriodEnd: string | null;
266
+ currentPeriodStart: string;
267
+ customerId: string;
268
+ discountId?: string | null;
269
+ endedAt: string | null;
270
+ endsAt?: string | null;
271
+ id: string;
272
+ lastTransactionId?: string | null;
273
+ metadata: Record<string, any>;
274
+ mode?: string;
275
+ modifiedAt: string | null;
276
+ nextTransactionDate?: string | null;
277
+ priceId?: string;
278
+ productId: string;
279
+ recurringInterval: string | null;
280
+ seats?: number | null;
281
+ startedAt: string | null;
282
+ status: string;
283
+ trialEnd?: string | null;
284
+ trialStart?: string | null;
285
+ } | null,
286
+ Name
287
+ >;
288
+ insertCustomer: FunctionReference<
289
+ "mutation",
290
+ "internal",
291
+ {
292
+ country?: string;
293
+ createdAt?: string;
294
+ email?: string;
295
+ entityId: string;
296
+ id: string;
297
+ metadata?: Record<string, any>;
298
+ mode?: string;
299
+ name?: string | null;
300
+ updatedAt?: string;
301
+ },
302
+ string,
303
+ Name
304
+ >;
305
+ listAllUserSubscriptions: FunctionReference<
306
+ "query",
307
+ "internal",
308
+ { entityId: string },
309
+ Array<{
310
+ amount: number | null;
311
+ cancelAtPeriodEnd: boolean;
312
+ canceledAt?: string | null;
313
+ checkoutId: string | null;
314
+ collectionMethod?: string;
315
+ createdAt: string;
316
+ currency: string | null;
317
+ currentPeriodEnd: string | null;
318
+ currentPeriodStart: string;
319
+ customerId: string;
320
+ discountId?: string | null;
321
+ endedAt: string | null;
322
+ endsAt?: string | null;
323
+ id: string;
324
+ lastTransactionId?: string | null;
325
+ metadata: Record<string, any>;
326
+ mode?: string;
327
+ modifiedAt: string | null;
328
+ nextTransactionDate?: string | null;
329
+ priceId?: string;
330
+ product: {
331
+ billingPeriod?: string;
332
+ billingType: string;
333
+ createdAt: string;
334
+ currency: string;
335
+ defaultSuccessUrl?: string | null;
336
+ description: string | null;
337
+ features?: Array<{ description: string; id: string }>;
338
+ id: string;
339
+ imageUrl?: string;
340
+ metadata?: Record<string, any>;
341
+ mode?: string;
342
+ modifiedAt: string | null;
343
+ name: string;
344
+ price: number;
345
+ productUrl?: string;
346
+ status: string;
347
+ taxCategory?: string;
348
+ taxMode?: string;
349
+ } | null;
350
+ productId: string;
351
+ recurringInterval: string | null;
352
+ seats?: number | null;
353
+ startedAt: string | null;
354
+ status: string;
355
+ trialEnd?: string | null;
356
+ trialStart?: string | null;
357
+ }>,
358
+ Name
359
+ >;
360
+ listCustomerSubscriptions: FunctionReference<
361
+ "query",
362
+ "internal",
363
+ { customerId: string },
364
+ Array<{
365
+ amount: number | null;
366
+ cancelAtPeriodEnd: boolean;
367
+ canceledAt?: string | null;
368
+ checkoutId: string | null;
369
+ collectionMethod?: string;
370
+ createdAt: string;
371
+ currency: string | null;
372
+ currentPeriodEnd: string | null;
373
+ currentPeriodStart: string;
374
+ customerId: string;
375
+ discountId?: string | null;
376
+ endedAt: string | null;
377
+ endsAt?: string | null;
378
+ id: string;
379
+ lastTransactionId?: string | null;
380
+ metadata: Record<string, any>;
381
+ mode?: string;
382
+ modifiedAt: string | null;
383
+ nextTransactionDate?: string | null;
384
+ priceId?: string;
385
+ productId: string;
386
+ recurringInterval: string | null;
387
+ seats?: number | null;
388
+ startedAt: string | null;
389
+ status: string;
390
+ trialEnd?: string | null;
391
+ trialStart?: string | null;
392
+ }>,
393
+ Name
394
+ >;
395
+ listProducts: FunctionReference<
396
+ "query",
397
+ "internal",
398
+ { includeArchived?: boolean },
399
+ Array<{
400
+ billingPeriod?: string;
401
+ billingType: string;
402
+ createdAt: string;
403
+ currency: string;
404
+ defaultSuccessUrl?: string | null;
405
+ description: string | null;
406
+ features?: Array<{ description: string; id: string }>;
407
+ id: string;
408
+ imageUrl?: string;
409
+ metadata?: Record<string, any>;
410
+ mode?: string;
411
+ modifiedAt: string | null;
412
+ name: string;
413
+ price: number;
414
+ productUrl?: string;
415
+ status: string;
416
+ taxCategory?: string;
417
+ taxMode?: string;
418
+ }>,
419
+ Name
420
+ >;
421
+ listUserOrders: FunctionReference<
422
+ "query",
423
+ "internal",
424
+ { entityId: string },
425
+ Array<{
426
+ affiliate?: string | null;
427
+ amount: number;
428
+ amountDue?: number;
429
+ amountPaid?: number;
430
+ checkoutId?: string | null;
431
+ createdAt: string;
432
+ currency: string;
433
+ customerId: string;
434
+ discountAmount?: number;
435
+ discountId?: string | null;
436
+ id: string;
437
+ metadata?: Record<string, any>;
438
+ mode?: string;
439
+ productId: string;
440
+ status: string;
441
+ subTotal?: number;
442
+ taxAmount?: number;
443
+ transactionId?: string | null;
444
+ type: string;
445
+ updatedAt: string;
446
+ }>,
447
+ Name
448
+ >;
449
+ listUserSubscriptions: FunctionReference<
450
+ "query",
451
+ "internal",
452
+ { entityId: string },
453
+ Array<{
454
+ amount: number | null;
455
+ cancelAtPeriodEnd: boolean;
456
+ canceledAt?: string | null;
457
+ checkoutId: string | null;
458
+ collectionMethod?: string;
459
+ createdAt: string;
460
+ currency: string | null;
461
+ currentPeriodEnd: string | null;
462
+ currentPeriodStart: string;
463
+ customerId: string;
464
+ discountId?: string | null;
465
+ endedAt: string | null;
466
+ endsAt?: string | null;
467
+ id: string;
468
+ lastTransactionId?: string | null;
469
+ metadata: Record<string, any>;
470
+ mode?: string;
471
+ modifiedAt: string | null;
472
+ nextTransactionDate?: string | null;
473
+ priceId?: string;
474
+ product: {
475
+ billingPeriod?: string;
476
+ billingType: string;
477
+ createdAt: string;
478
+ currency: string;
479
+ defaultSuccessUrl?: string | null;
480
+ description: string | null;
481
+ features?: Array<{ description: string; id: string }>;
482
+ id: string;
483
+ imageUrl?: string;
484
+ metadata?: Record<string, any>;
485
+ mode?: string;
486
+ modifiedAt: string | null;
487
+ name: string;
488
+ price: number;
489
+ productUrl?: string;
490
+ status: string;
491
+ taxCategory?: string;
492
+ taxMode?: string;
493
+ } | null;
494
+ productId: string;
495
+ recurringInterval: string | null;
496
+ seats?: number | null;
497
+ startedAt: string | null;
498
+ status: string;
499
+ trialEnd?: string | null;
500
+ trialStart?: string | null;
501
+ }>,
502
+ Name
503
+ >;
504
+ patchSubscription: FunctionReference<
505
+ "mutation",
506
+ "internal",
507
+ {
508
+ cancelAtPeriodEnd?: boolean;
509
+ clearOptimistic?: boolean;
510
+ productId?: string;
511
+ seats?: number | null;
512
+ status?: string;
513
+ subscriptionId: string;
514
+ },
515
+ any,
516
+ Name
517
+ >;
518
+ syncProducts: FunctionReference<
519
+ "action",
520
+ "internal",
521
+ { apiKey: string; serverIdx?: number; serverURL?: string },
522
+ any,
523
+ Name
524
+ >;
525
+ updateProduct: FunctionReference<
526
+ "mutation",
527
+ "internal",
528
+ {
529
+ product: {
530
+ billingPeriod?: string;
531
+ billingType: string;
532
+ createdAt: string;
533
+ currency: string;
534
+ defaultSuccessUrl?: string | null;
535
+ description: string | null;
536
+ features?: Array<{ description: string; id: string }>;
537
+ id: string;
538
+ imageUrl?: string;
539
+ metadata?: Record<string, any>;
540
+ mode?: string;
541
+ modifiedAt: string | null;
542
+ name: string;
543
+ price: number;
544
+ productUrl?: string;
545
+ status: string;
546
+ taxCategory?: string;
547
+ taxMode?: string;
548
+ };
549
+ },
550
+ any,
551
+ Name
552
+ >;
553
+ updateProducts: FunctionReference<
554
+ "mutation",
555
+ "internal",
556
+ {
557
+ products: Array<{
558
+ billingPeriod?: string;
559
+ billingType: string;
560
+ createdAt: string;
561
+ currency: string;
562
+ defaultSuccessUrl?: string | null;
563
+ description: string | null;
564
+ features?: Array<{ description: string; id: string }>;
565
+ id: string;
566
+ imageUrl?: string;
567
+ metadata?: Record<string, any>;
568
+ mode?: string;
569
+ modifiedAt: string | null;
570
+ name: string;
571
+ price: number;
572
+ productUrl?: string;
573
+ status: string;
574
+ taxCategory?: string;
575
+ taxMode?: string;
576
+ }>;
577
+ },
578
+ any,
579
+ Name
580
+ >;
581
+ updateSubscription: FunctionReference<
582
+ "mutation",
583
+ "internal",
584
+ {
585
+ subscription: {
586
+ amount: number | null;
587
+ cancelAtPeriodEnd: boolean;
588
+ canceledAt?: string | null;
589
+ checkoutId: string | null;
590
+ collectionMethod?: string;
591
+ createdAt: string;
592
+ currency: string | null;
593
+ currentPeriodEnd: string | null;
594
+ currentPeriodStart: string;
595
+ customerId: string;
596
+ discountId?: string | null;
597
+ endedAt: string | null;
598
+ endsAt?: string | null;
599
+ id: string;
600
+ lastTransactionId?: string | null;
601
+ metadata: Record<string, any>;
602
+ mode?: string;
603
+ modifiedAt: string | null;
604
+ nextTransactionDate?: string | null;
605
+ priceId?: string;
606
+ productId: string;
607
+ recurringInterval: string | null;
608
+ seats?: number | null;
609
+ startedAt: string | null;
610
+ status: string;
611
+ trialEnd?: string | null;
612
+ trialStart?: string | null;
613
+ };
614
+ },
615
+ any,
616
+ Name
617
+ >;
618
+ };
619
+ };
@@ -0,0 +1,60 @@
1
+ /* eslint-disable */
2
+ /**
3
+ * Generated data model types.
4
+ *
5
+ * THIS CODE IS AUTOMATICALLY GENERATED.
6
+ *
7
+ * To regenerate, run `npx convex dev`.
8
+ * @module
9
+ */
10
+
11
+ import type {
12
+ DataModelFromSchemaDefinition,
13
+ DocumentByName,
14
+ TableNamesInDataModel,
15
+ SystemTableNames,
16
+ } from "convex/server";
17
+ import type { GenericId } from "convex/values";
18
+ import schema from "../schema.js";
19
+
20
+ /**
21
+ * The names of all of your Convex tables.
22
+ */
23
+ export type TableNames = TableNamesInDataModel<DataModel>;
24
+
25
+ /**
26
+ * The type of a document stored in Convex.
27
+ *
28
+ * @typeParam TableName - A string literal type of the table name (like "users").
29
+ */
30
+ export type Doc<TableName extends TableNames> = DocumentByName<
31
+ DataModel,
32
+ TableName
33
+ >;
34
+
35
+ /**
36
+ * An identifier for a document in Convex.
37
+ *
38
+ * Convex documents are uniquely identified by their `Id`, which is accessible
39
+ * on the `_id` field. To learn more, see [Document IDs](https://docs.convex.dev/using/document-ids).
40
+ *
41
+ * Documents can be loaded using `db.get(tableName, id)` in query and mutation functions.
42
+ *
43
+ * IDs are just strings at runtime, but this type can be used to distinguish them from other
44
+ * strings when type checking.
45
+ *
46
+ * @typeParam TableName - A string literal type of the table name (like "users").
47
+ */
48
+ export type Id<TableName extends TableNames | SystemTableNames> =
49
+ GenericId<TableName>;
50
+
51
+ /**
52
+ * A type describing your Convex data model.
53
+ *
54
+ * This type includes information about what tables you have, the type of
55
+ * documents stored in those tables, and the indexes defined on them.
56
+ *
57
+ * This type is used to parameterize methods like `queryGeneric` and
58
+ * `mutationGeneric` to make them type-safe.
59
+ */
60
+ export type DataModel = DataModelFromSchemaDefinition<typeof schema>;