@polar-sh/sdk 0.46.3 → 0.46.4

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 (269) hide show
  1. package/README.md +2 -1
  2. package/dist/commonjs/funcs/customerPortalSubscriptionsUpdate.d.ts +2 -1
  3. package/dist/commonjs/funcs/customerPortalSubscriptionsUpdate.d.ts.map +1 -1
  4. package/dist/commonjs/funcs/customerPortalSubscriptionsUpdate.js +3 -2
  5. package/dist/commonjs/funcs/customerPortalSubscriptionsUpdate.js.map +1 -1
  6. package/dist/commonjs/funcs/subscriptionsUpdate.d.ts +2 -1
  7. package/dist/commonjs/funcs/subscriptionsUpdate.d.ts.map +1 -1
  8. package/dist/commonjs/funcs/subscriptionsUpdate.js +3 -2
  9. package/dist/commonjs/funcs/subscriptionsUpdate.js.map +1 -1
  10. package/dist/commonjs/lib/config.d.ts +3 -3
  11. package/dist/commonjs/lib/config.js +3 -3
  12. package/dist/commonjs/models/components/checkoutdiscountfixedonceforeverduration.d.ts +15 -0
  13. package/dist/commonjs/models/components/checkoutdiscountfixedonceforeverduration.d.ts.map +1 -1
  14. package/dist/commonjs/models/components/checkoutdiscountfixedonceforeverduration.js +2 -0
  15. package/dist/commonjs/models/components/checkoutdiscountfixedonceforeverduration.js.map +1 -1
  16. package/dist/commonjs/models/components/checkoutdiscountfixedrepeatduration.d.ts +15 -0
  17. package/dist/commonjs/models/components/checkoutdiscountfixedrepeatduration.d.ts.map +1 -1
  18. package/dist/commonjs/models/components/checkoutdiscountfixedrepeatduration.js +2 -0
  19. package/dist/commonjs/models/components/checkoutdiscountfixedrepeatduration.js.map +1 -1
  20. package/dist/commonjs/models/components/customersubscription.d.ts +5 -0
  21. package/dist/commonjs/models/components/customersubscription.d.ts.map +1 -1
  22. package/dist/commonjs/models/components/customersubscription.js +3 -0
  23. package/dist/commonjs/models/components/customersubscription.js.map +1 -1
  24. package/dist/commonjs/models/components/discountcreate.d.ts +2 -2
  25. package/dist/commonjs/models/components/discountcreate.d.ts.map +1 -1
  26. package/dist/commonjs/models/components/discountcreate.js +2 -2
  27. package/dist/commonjs/models/components/discountcreate.js.map +1 -1
  28. package/dist/commonjs/models/components/discountfixedonceforeverduration.d.ts +12 -0
  29. package/dist/commonjs/models/components/discountfixedonceforeverduration.d.ts.map +1 -1
  30. package/dist/commonjs/models/components/discountfixedonceforeverduration.js +1 -0
  31. package/dist/commonjs/models/components/discountfixedonceforeverduration.js.map +1 -1
  32. package/dist/commonjs/models/components/discountfixedonceforeverdurationbase.d.ts +15 -0
  33. package/dist/commonjs/models/components/discountfixedonceforeverdurationbase.d.ts.map +1 -1
  34. package/dist/commonjs/models/components/discountfixedonceforeverdurationbase.js +2 -0
  35. package/dist/commonjs/models/components/discountfixedonceforeverdurationbase.js.map +1 -1
  36. package/dist/commonjs/models/components/discountfixedonceforeverdurationcreate.d.ts +14 -5
  37. package/dist/commonjs/models/components/discountfixedonceforeverdurationcreate.d.ts.map +1 -1
  38. package/dist/commonjs/models/components/discountfixedonceforeverdurationcreate.js +3 -2
  39. package/dist/commonjs/models/components/discountfixedonceforeverdurationcreate.js.map +1 -1
  40. package/dist/commonjs/models/components/discountfixedrepeatduration.d.ts +12 -0
  41. package/dist/commonjs/models/components/discountfixedrepeatduration.d.ts.map +1 -1
  42. package/dist/commonjs/models/components/discountfixedrepeatduration.js +1 -0
  43. package/dist/commonjs/models/components/discountfixedrepeatduration.js.map +1 -1
  44. package/dist/commonjs/models/components/discountfixedrepeatdurationbase.d.ts +15 -0
  45. package/dist/commonjs/models/components/discountfixedrepeatdurationbase.d.ts.map +1 -1
  46. package/dist/commonjs/models/components/discountfixedrepeatdurationbase.js +2 -0
  47. package/dist/commonjs/models/components/discountfixedrepeatdurationbase.js.map +1 -1
  48. package/dist/commonjs/models/components/discountfixedrepeatdurationcreate.d.ts +14 -5
  49. package/dist/commonjs/models/components/discountfixedrepeatdurationcreate.d.ts.map +1 -1
  50. package/dist/commonjs/models/components/discountfixedrepeatdurationcreate.js +3 -2
  51. package/dist/commonjs/models/components/discountfixedrepeatdurationcreate.js.map +1 -1
  52. package/dist/commonjs/models/components/discountupdate.d.ts +12 -0
  53. package/dist/commonjs/models/components/discountupdate.d.ts.map +1 -1
  54. package/dist/commonjs/models/components/discountupdate.js +1 -0
  55. package/dist/commonjs/models/components/discountupdate.js.map +1 -1
  56. package/dist/commonjs/models/components/metricperiod.d.ts +5 -5
  57. package/dist/commonjs/models/components/metricperiod.d.ts.map +1 -1
  58. package/dist/commonjs/models/components/metricperiod.js +9 -9
  59. package/dist/commonjs/models/components/metricperiod.js.map +1 -1
  60. package/dist/commonjs/models/components/metrics.d.ts +1 -1
  61. package/dist/commonjs/models/components/metrics.d.ts.map +1 -1
  62. package/dist/commonjs/models/components/metrics.js +2 -2
  63. package/dist/commonjs/models/components/metrics.js.map +1 -1
  64. package/dist/commonjs/models/components/metricstotals.d.ts +5 -5
  65. package/dist/commonjs/models/components/metricstotals.d.ts.map +1 -1
  66. package/dist/commonjs/models/components/metricstotals.js +9 -9
  67. package/dist/commonjs/models/components/metricstotals.js.map +1 -1
  68. package/dist/commonjs/models/components/organizationcustomeremailsettings.d.ts +4 -0
  69. package/dist/commonjs/models/components/organizationcustomeremailsettings.d.ts.map +1 -1
  70. package/dist/commonjs/models/components/organizationcustomeremailsettings.js +8 -0
  71. package/dist/commonjs/models/components/organizationcustomeremailsettings.js.map +1 -1
  72. package/dist/commonjs/models/components/pendingsubscriptionupdate.d.ts +48 -0
  73. package/dist/commonjs/models/components/pendingsubscriptionupdate.d.ts.map +1 -0
  74. package/dist/commonjs/models/components/pendingsubscriptionupdate.js +83 -0
  75. package/dist/commonjs/models/components/pendingsubscriptionupdate.js.map +1 -0
  76. package/dist/commonjs/models/components/subscription.d.ts +6 -0
  77. package/dist/commonjs/models/components/subscription.d.ts.map +1 -1
  78. package/dist/commonjs/models/components/subscription.js +5 -0
  79. package/dist/commonjs/models/components/subscription.js.map +1 -1
  80. package/dist/commonjs/models/components/subscriptionprorationbehavior.d.ts +1 -0
  81. package/dist/commonjs/models/components/subscriptionprorationbehavior.d.ts.map +1 -1
  82. package/dist/commonjs/models/components/subscriptionprorationbehavior.js +1 -0
  83. package/dist/commonjs/models/components/subscriptionprorationbehavior.js.map +1 -1
  84. package/dist/commonjs/models/components/subscriptionupdatedbillingperiodmetadata.d.ts +11 -0
  85. package/dist/commonjs/models/components/subscriptionupdatedbillingperiodmetadata.d.ts.map +1 -0
  86. package/dist/commonjs/models/components/subscriptionupdatedbillingperiodmetadata.js +57 -0
  87. package/dist/commonjs/models/components/subscriptionupdatedbillingperiodmetadata.js.map +1 -0
  88. package/dist/commonjs/models/components/subscriptionupdateddiscountmetadata.d.ts +11 -0
  89. package/dist/commonjs/models/components/subscriptionupdateddiscountmetadata.d.ts.map +1 -0
  90. package/dist/commonjs/models/components/subscriptionupdateddiscountmetadata.js +57 -0
  91. package/dist/commonjs/models/components/subscriptionupdateddiscountmetadata.js.map +1 -0
  92. package/dist/commonjs/models/components/subscriptionupdatedevent.d.ts +75 -0
  93. package/dist/commonjs/models/components/subscriptionupdatedevent.d.ts.map +1 -0
  94. package/dist/commonjs/models/components/subscriptionupdatedevent.js +99 -0
  95. package/dist/commonjs/models/components/subscriptionupdatedevent.js.map +1 -0
  96. package/dist/commonjs/models/components/subscriptionupdatedproductmetadata.d.ts +13 -0
  97. package/dist/commonjs/models/components/subscriptionupdatedproductmetadata.d.ts.map +1 -0
  98. package/dist/commonjs/models/components/subscriptionupdatedproductmetadata.js +60 -0
  99. package/dist/commonjs/models/components/subscriptionupdatedproductmetadata.js.map +1 -0
  100. package/dist/commonjs/models/components/subscriptionupdatedseatsmetadata.d.ts +13 -0
  101. package/dist/commonjs/models/components/subscriptionupdatedseatsmetadata.d.ts.map +1 -0
  102. package/dist/commonjs/models/components/subscriptionupdatedseatsmetadata.js +59 -0
  103. package/dist/commonjs/models/components/subscriptionupdatedseatsmetadata.js.map +1 -0
  104. package/dist/commonjs/models/components/subscriptionupdatedtrialmetadata.d.ts +11 -0
  105. package/dist/commonjs/models/components/subscriptionupdatedtrialmetadata.d.ts.map +1 -0
  106. package/dist/commonjs/models/components/subscriptionupdatedtrialmetadata.js +57 -0
  107. package/dist/commonjs/models/components/subscriptionupdatedtrialmetadata.js.map +1 -0
  108. package/dist/commonjs/models/components/systemevent.d.ts +2 -1
  109. package/dist/commonjs/models/components/systemevent.d.ts.map +1 -1
  110. package/dist/commonjs/models/components/systemevent.js +2 -0
  111. package/dist/commonjs/models/components/systemevent.js.map +1 -1
  112. package/dist/commonjs/models/errors/paymentfailed.d.ts +20 -0
  113. package/dist/commonjs/models/errors/paymentfailed.d.ts.map +1 -0
  114. package/dist/commonjs/models/errors/paymentfailed.js +69 -0
  115. package/dist/commonjs/models/errors/paymentfailed.js.map +1 -0
  116. package/dist/commonjs/webhooks.d.ts +1 -1
  117. package/dist/commonjs/webhooks.d.ts.map +1 -1
  118. package/dist/commonjs/webhooks.js +15 -0
  119. package/dist/commonjs/webhooks.js.map +1 -1
  120. package/dist/esm/funcs/customerPortalSubscriptionsUpdate.d.ts +2 -1
  121. package/dist/esm/funcs/customerPortalSubscriptionsUpdate.d.ts.map +1 -1
  122. package/dist/esm/funcs/customerPortalSubscriptionsUpdate.js +3 -2
  123. package/dist/esm/funcs/customerPortalSubscriptionsUpdate.js.map +1 -1
  124. package/dist/esm/funcs/subscriptionsUpdate.d.ts +2 -1
  125. package/dist/esm/funcs/subscriptionsUpdate.d.ts.map +1 -1
  126. package/dist/esm/funcs/subscriptionsUpdate.js +3 -2
  127. package/dist/esm/funcs/subscriptionsUpdate.js.map +1 -1
  128. package/dist/esm/lib/config.d.ts +3 -3
  129. package/dist/esm/lib/config.js +3 -3
  130. package/dist/esm/models/components/checkoutdiscountfixedonceforeverduration.d.ts +15 -0
  131. package/dist/esm/models/components/checkoutdiscountfixedonceforeverduration.d.ts.map +1 -1
  132. package/dist/esm/models/components/checkoutdiscountfixedonceforeverduration.js +2 -0
  133. package/dist/esm/models/components/checkoutdiscountfixedonceforeverduration.js.map +1 -1
  134. package/dist/esm/models/components/checkoutdiscountfixedrepeatduration.d.ts +15 -0
  135. package/dist/esm/models/components/checkoutdiscountfixedrepeatduration.d.ts.map +1 -1
  136. package/dist/esm/models/components/checkoutdiscountfixedrepeatduration.js +2 -0
  137. package/dist/esm/models/components/checkoutdiscountfixedrepeatduration.js.map +1 -1
  138. package/dist/esm/models/components/customersubscription.d.ts +5 -0
  139. package/dist/esm/models/components/customersubscription.d.ts.map +1 -1
  140. package/dist/esm/models/components/customersubscription.js +3 -0
  141. package/dist/esm/models/components/customersubscription.js.map +1 -1
  142. package/dist/esm/models/components/discountcreate.d.ts +2 -2
  143. package/dist/esm/models/components/discountcreate.d.ts.map +1 -1
  144. package/dist/esm/models/components/discountcreate.js +2 -2
  145. package/dist/esm/models/components/discountcreate.js.map +1 -1
  146. package/dist/esm/models/components/discountfixedonceforeverduration.d.ts +12 -0
  147. package/dist/esm/models/components/discountfixedonceforeverduration.d.ts.map +1 -1
  148. package/dist/esm/models/components/discountfixedonceforeverduration.js +1 -0
  149. package/dist/esm/models/components/discountfixedonceforeverduration.js.map +1 -1
  150. package/dist/esm/models/components/discountfixedonceforeverdurationbase.d.ts +15 -0
  151. package/dist/esm/models/components/discountfixedonceforeverdurationbase.d.ts.map +1 -1
  152. package/dist/esm/models/components/discountfixedonceforeverdurationbase.js +2 -0
  153. package/dist/esm/models/components/discountfixedonceforeverdurationbase.js.map +1 -1
  154. package/dist/esm/models/components/discountfixedonceforeverdurationcreate.d.ts +14 -5
  155. package/dist/esm/models/components/discountfixedonceforeverdurationcreate.d.ts.map +1 -1
  156. package/dist/esm/models/components/discountfixedonceforeverdurationcreate.js +3 -2
  157. package/dist/esm/models/components/discountfixedonceforeverdurationcreate.js.map +1 -1
  158. package/dist/esm/models/components/discountfixedrepeatduration.d.ts +12 -0
  159. package/dist/esm/models/components/discountfixedrepeatduration.d.ts.map +1 -1
  160. package/dist/esm/models/components/discountfixedrepeatduration.js +1 -0
  161. package/dist/esm/models/components/discountfixedrepeatduration.js.map +1 -1
  162. package/dist/esm/models/components/discountfixedrepeatdurationbase.d.ts +15 -0
  163. package/dist/esm/models/components/discountfixedrepeatdurationbase.d.ts.map +1 -1
  164. package/dist/esm/models/components/discountfixedrepeatdurationbase.js +2 -0
  165. package/dist/esm/models/components/discountfixedrepeatdurationbase.js.map +1 -1
  166. package/dist/esm/models/components/discountfixedrepeatdurationcreate.d.ts +14 -5
  167. package/dist/esm/models/components/discountfixedrepeatdurationcreate.d.ts.map +1 -1
  168. package/dist/esm/models/components/discountfixedrepeatdurationcreate.js +3 -2
  169. package/dist/esm/models/components/discountfixedrepeatdurationcreate.js.map +1 -1
  170. package/dist/esm/models/components/discountupdate.d.ts +12 -0
  171. package/dist/esm/models/components/discountupdate.d.ts.map +1 -1
  172. package/dist/esm/models/components/discountupdate.js +1 -0
  173. package/dist/esm/models/components/discountupdate.js.map +1 -1
  174. package/dist/esm/models/components/metricperiod.d.ts +5 -5
  175. package/dist/esm/models/components/metricperiod.d.ts.map +1 -1
  176. package/dist/esm/models/components/metricperiod.js +7 -7
  177. package/dist/esm/models/components/metricperiod.js.map +1 -1
  178. package/dist/esm/models/components/metrics.d.ts +1 -1
  179. package/dist/esm/models/components/metrics.d.ts.map +1 -1
  180. package/dist/esm/models/components/metrics.js +2 -2
  181. package/dist/esm/models/components/metrics.js.map +1 -1
  182. package/dist/esm/models/components/metricstotals.d.ts +5 -5
  183. package/dist/esm/models/components/metricstotals.d.ts.map +1 -1
  184. package/dist/esm/models/components/metricstotals.js +7 -7
  185. package/dist/esm/models/components/metricstotals.js.map +1 -1
  186. package/dist/esm/models/components/organizationcustomeremailsettings.d.ts +4 -0
  187. package/dist/esm/models/components/organizationcustomeremailsettings.d.ts.map +1 -1
  188. package/dist/esm/models/components/organizationcustomeremailsettings.js +8 -0
  189. package/dist/esm/models/components/organizationcustomeremailsettings.js.map +1 -1
  190. package/dist/esm/models/components/pendingsubscriptionupdate.d.ts +48 -0
  191. package/dist/esm/models/components/pendingsubscriptionupdate.d.ts.map +1 -0
  192. package/dist/esm/models/components/pendingsubscriptionupdate.js +45 -0
  193. package/dist/esm/models/components/pendingsubscriptionupdate.js.map +1 -0
  194. package/dist/esm/models/components/subscription.d.ts +6 -0
  195. package/dist/esm/models/components/subscription.d.ts.map +1 -1
  196. package/dist/esm/models/components/subscription.js +5 -0
  197. package/dist/esm/models/components/subscription.js.map +1 -1
  198. package/dist/esm/models/components/subscriptionprorationbehavior.d.ts +1 -0
  199. package/dist/esm/models/components/subscriptionprorationbehavior.d.ts.map +1 -1
  200. package/dist/esm/models/components/subscriptionprorationbehavior.js +1 -0
  201. package/dist/esm/models/components/subscriptionprorationbehavior.js.map +1 -1
  202. package/dist/esm/models/components/subscriptionupdatedbillingperiodmetadata.d.ts +11 -0
  203. package/dist/esm/models/components/subscriptionupdatedbillingperiodmetadata.d.ts.map +1 -0
  204. package/dist/esm/models/components/subscriptionupdatedbillingperiodmetadata.js +20 -0
  205. package/dist/esm/models/components/subscriptionupdatedbillingperiodmetadata.js.map +1 -0
  206. package/dist/esm/models/components/subscriptionupdateddiscountmetadata.d.ts +11 -0
  207. package/dist/esm/models/components/subscriptionupdateddiscountmetadata.d.ts.map +1 -0
  208. package/dist/esm/models/components/subscriptionupdateddiscountmetadata.js +20 -0
  209. package/dist/esm/models/components/subscriptionupdateddiscountmetadata.js.map +1 -0
  210. package/dist/esm/models/components/subscriptionupdatedevent.d.ts +75 -0
  211. package/dist/esm/models/components/subscriptionupdatedevent.d.ts.map +1 -0
  212. package/dist/esm/models/components/subscriptionupdatedevent.js +61 -0
  213. package/dist/esm/models/components/subscriptionupdatedevent.js.map +1 -0
  214. package/dist/esm/models/components/subscriptionupdatedproductmetadata.d.ts +13 -0
  215. package/dist/esm/models/components/subscriptionupdatedproductmetadata.d.ts.map +1 -0
  216. package/dist/esm/models/components/subscriptionupdatedproductmetadata.js +23 -0
  217. package/dist/esm/models/components/subscriptionupdatedproductmetadata.js.map +1 -0
  218. package/dist/esm/models/components/subscriptionupdatedseatsmetadata.d.ts +13 -0
  219. package/dist/esm/models/components/subscriptionupdatedseatsmetadata.d.ts.map +1 -0
  220. package/dist/esm/models/components/subscriptionupdatedseatsmetadata.js +22 -0
  221. package/dist/esm/models/components/subscriptionupdatedseatsmetadata.js.map +1 -0
  222. package/dist/esm/models/components/subscriptionupdatedtrialmetadata.d.ts +11 -0
  223. package/dist/esm/models/components/subscriptionupdatedtrialmetadata.d.ts.map +1 -0
  224. package/dist/esm/models/components/subscriptionupdatedtrialmetadata.js +20 -0
  225. package/dist/esm/models/components/subscriptionupdatedtrialmetadata.js.map +1 -0
  226. package/dist/esm/models/components/systemevent.d.ts +2 -1
  227. package/dist/esm/models/components/systemevent.d.ts.map +1 -1
  228. package/dist/esm/models/components/systemevent.js +2 -0
  229. package/dist/esm/models/components/systemevent.js.map +1 -1
  230. package/dist/esm/models/errors/paymentfailed.d.ts +20 -0
  231. package/dist/esm/models/errors/paymentfailed.d.ts.map +1 -0
  232. package/dist/esm/models/errors/paymentfailed.js +32 -0
  233. package/dist/esm/models/errors/paymentfailed.js.map +1 -0
  234. package/dist/esm/webhooks.d.ts +1 -1
  235. package/dist/esm/webhooks.d.ts.map +1 -1
  236. package/dist/esm/webhooks.js +15 -0
  237. package/dist/esm/webhooks.js.map +1 -1
  238. package/jsr.json +1 -1
  239. package/package.json +1 -1
  240. package/src/funcs/customerPortalSubscriptionsUpdate.ts +9 -1
  241. package/src/funcs/subscriptionsUpdate.ts +9 -1
  242. package/src/lib/config.ts +3 -3
  243. package/src/models/components/checkoutdiscountfixedonceforeverduration.ts +13 -0
  244. package/src/models/components/checkoutdiscountfixedrepeatduration.ts +13 -0
  245. package/src/models/components/customersubscription.ts +10 -0
  246. package/src/models/components/discountcreate.ts +8 -8
  247. package/src/models/components/discountfixedonceforeverduration.ts +11 -0
  248. package/src/models/components/discountfixedonceforeverdurationbase.ts +13 -0
  249. package/src/models/components/discountfixedonceforeverdurationcreate.ts +13 -7
  250. package/src/models/components/discountfixedrepeatduration.ts +11 -0
  251. package/src/models/components/discountfixedrepeatdurationbase.ts +13 -0
  252. package/src/models/components/discountfixedrepeatdurationcreate.ts +13 -7
  253. package/src/models/components/discountupdate.ts +9 -0
  254. package/src/models/components/metricperiod.ts +23 -23
  255. package/src/models/components/metrics.ts +3 -3
  256. package/src/models/components/metricstotals.ts +23 -23
  257. package/src/models/components/organizationcustomeremailsettings.ts +14 -0
  258. package/src/models/components/pendingsubscriptionupdate.ts +119 -0
  259. package/src/models/components/subscription.ts +15 -0
  260. package/src/models/components/subscriptionprorationbehavior.ts +1 -0
  261. package/src/models/components/subscriptionupdatedbillingperiodmetadata.ts +45 -0
  262. package/src/models/components/subscriptionupdateddiscountmetadata.ts +42 -0
  263. package/src/models/components/subscriptionupdatedevent.ts +177 -0
  264. package/src/models/components/subscriptionupdatedproductmetadata.ts +49 -0
  265. package/src/models/components/subscriptionupdatedseatsmetadata.ts +47 -0
  266. package/src/models/components/subscriptionupdatedtrialmetadata.ts +41 -0
  267. package/src/models/components/systemevent.ts +7 -1
  268. package/src/models/errors/paymentfailed.ts +55 -0
  269. package/src/webhooks.ts +15 -0
@@ -0,0 +1,177 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { Result as SafeParseResult } from "../../types/fp.js";
9
+ import { smartUnion } from "../../types/smartUnion.js";
10
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
11
+ import { Customer, Customer$inboundSchema } from "./customer.js";
12
+ import {
13
+ SubscriptionUpdatedBillingPeriodMetadata,
14
+ SubscriptionUpdatedBillingPeriodMetadata$inboundSchema,
15
+ } from "./subscriptionupdatedbillingperiodmetadata.js";
16
+ import {
17
+ SubscriptionUpdatedDiscountMetadata,
18
+ SubscriptionUpdatedDiscountMetadata$inboundSchema,
19
+ } from "./subscriptionupdateddiscountmetadata.js";
20
+ import {
21
+ SubscriptionUpdatedProductMetadata,
22
+ SubscriptionUpdatedProductMetadata$inboundSchema,
23
+ } from "./subscriptionupdatedproductmetadata.js";
24
+ import {
25
+ SubscriptionUpdatedSeatsMetadata,
26
+ SubscriptionUpdatedSeatsMetadata$inboundSchema,
27
+ } from "./subscriptionupdatedseatsmetadata.js";
28
+ import {
29
+ SubscriptionUpdatedTrialMetadata,
30
+ SubscriptionUpdatedTrialMetadata$inboundSchema,
31
+ } from "./subscriptionupdatedtrialmetadata.js";
32
+
33
+ export type SubscriptionUpdatedEventMetadata =
34
+ | SubscriptionUpdatedProductMetadata
35
+ | SubscriptionUpdatedSeatsMetadata
36
+ | SubscriptionUpdatedDiscountMetadata
37
+ | SubscriptionUpdatedTrialMetadata
38
+ | SubscriptionUpdatedBillingPeriodMetadata;
39
+
40
+ /**
41
+ * An event created by Polar when a subscription is updated.
42
+ */
43
+ export type SubscriptionUpdatedEvent = {
44
+ /**
45
+ * The ID of the object.
46
+ */
47
+ id: string;
48
+ /**
49
+ * The timestamp of the event.
50
+ */
51
+ timestamp: Date;
52
+ /**
53
+ * The ID of the organization owning the event.
54
+ */
55
+ organizationId: string;
56
+ /**
57
+ * ID of the customer in your Polar organization associated with the event.
58
+ */
59
+ customerId: string | null;
60
+ /**
61
+ * The customer associated with the event.
62
+ */
63
+ customer: Customer | null;
64
+ /**
65
+ * ID of the customer in your system associated with the event.
66
+ */
67
+ externalCustomerId: string | null;
68
+ /**
69
+ * ID of the member within the customer's organization who performed the action inside B2B.
70
+ */
71
+ memberId?: string | null | undefined;
72
+ /**
73
+ * ID of the member in your system within the customer's organization who performed the action inside B2B.
74
+ */
75
+ externalMemberId?: string | null | undefined;
76
+ /**
77
+ * Number of direct child events linked to this event.
78
+ */
79
+ childCount: number;
80
+ /**
81
+ * The ID of the parent event.
82
+ */
83
+ parentId?: string | null | undefined;
84
+ /**
85
+ * Human readable label of the event type.
86
+ */
87
+ label: string;
88
+ /**
89
+ * The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API.
90
+ */
91
+ source: "system";
92
+ /**
93
+ * The name of the event.
94
+ */
95
+ name: "subscription.updated";
96
+ metadata:
97
+ | SubscriptionUpdatedProductMetadata
98
+ | SubscriptionUpdatedSeatsMetadata
99
+ | SubscriptionUpdatedDiscountMetadata
100
+ | SubscriptionUpdatedTrialMetadata
101
+ | SubscriptionUpdatedBillingPeriodMetadata;
102
+ };
103
+
104
+ /** @internal */
105
+ export const SubscriptionUpdatedEventMetadata$inboundSchema: z.ZodMiniType<
106
+ SubscriptionUpdatedEventMetadata,
107
+ unknown
108
+ > = smartUnion([
109
+ SubscriptionUpdatedProductMetadata$inboundSchema,
110
+ SubscriptionUpdatedSeatsMetadata$inboundSchema,
111
+ SubscriptionUpdatedDiscountMetadata$inboundSchema,
112
+ SubscriptionUpdatedTrialMetadata$inboundSchema,
113
+ SubscriptionUpdatedBillingPeriodMetadata$inboundSchema,
114
+ ]);
115
+
116
+ export function subscriptionUpdatedEventMetadataFromJSON(
117
+ jsonString: string,
118
+ ): SafeParseResult<SubscriptionUpdatedEventMetadata, SDKValidationError> {
119
+ return safeParse(
120
+ jsonString,
121
+ (x) => SubscriptionUpdatedEventMetadata$inboundSchema.parse(JSON.parse(x)),
122
+ `Failed to parse 'SubscriptionUpdatedEventMetadata' from JSON`,
123
+ );
124
+ }
125
+
126
+ /** @internal */
127
+ export const SubscriptionUpdatedEvent$inboundSchema: z.ZodMiniType<
128
+ SubscriptionUpdatedEvent,
129
+ unknown
130
+ > = z.pipe(
131
+ z.object({
132
+ id: z.string(),
133
+ timestamp: z.pipe(
134
+ z.iso.datetime({ offset: true }),
135
+ z.transform(v => new Date(v)),
136
+ ),
137
+ organization_id: z.string(),
138
+ customer_id: z.nullable(z.string()),
139
+ customer: z.nullable(Customer$inboundSchema),
140
+ external_customer_id: z.nullable(z.string()),
141
+ member_id: z.optional(z.nullable(z.string())),
142
+ external_member_id: z.optional(z.nullable(z.string())),
143
+ child_count: z._default(z.int(), 0),
144
+ parent_id: z.optional(z.nullable(z.string())),
145
+ label: z.string(),
146
+ source: z.literal("system"),
147
+ name: z.literal("subscription.updated"),
148
+ metadata: smartUnion([
149
+ SubscriptionUpdatedProductMetadata$inboundSchema,
150
+ SubscriptionUpdatedSeatsMetadata$inboundSchema,
151
+ SubscriptionUpdatedDiscountMetadata$inboundSchema,
152
+ SubscriptionUpdatedTrialMetadata$inboundSchema,
153
+ SubscriptionUpdatedBillingPeriodMetadata$inboundSchema,
154
+ ]),
155
+ }),
156
+ z.transform((v) => {
157
+ return remap$(v, {
158
+ "organization_id": "organizationId",
159
+ "customer_id": "customerId",
160
+ "external_customer_id": "externalCustomerId",
161
+ "member_id": "memberId",
162
+ "external_member_id": "externalMemberId",
163
+ "child_count": "childCount",
164
+ "parent_id": "parentId",
165
+ });
166
+ }),
167
+ );
168
+
169
+ export function subscriptionUpdatedEventFromJSON(
170
+ jsonString: string,
171
+ ): SafeParseResult<SubscriptionUpdatedEvent, SDKValidationError> {
172
+ return safeParse(
173
+ jsonString,
174
+ (x) => SubscriptionUpdatedEvent$inboundSchema.parse(JSON.parse(x)),
175
+ `Failed to parse 'SubscriptionUpdatedEvent' from JSON`,
176
+ );
177
+ }
@@ -0,0 +1,49 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { Result as SafeParseResult } from "../../types/fp.js";
9
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
10
+ import {
11
+ SubscriptionProrationBehavior,
12
+ SubscriptionProrationBehavior$inboundSchema,
13
+ } from "./subscriptionprorationbehavior.js";
14
+
15
+ export type SubscriptionUpdatedProductMetadata = {
16
+ subscriptionId: string;
17
+ productId: string;
18
+ prorationBehavior: SubscriptionProrationBehavior;
19
+ };
20
+
21
+ /** @internal */
22
+ export const SubscriptionUpdatedProductMetadata$inboundSchema: z.ZodMiniType<
23
+ SubscriptionUpdatedProductMetadata,
24
+ unknown
25
+ > = z.pipe(
26
+ z.object({
27
+ subscription_id: z.string(),
28
+ product_id: z.string(),
29
+ proration_behavior: SubscriptionProrationBehavior$inboundSchema,
30
+ }),
31
+ z.transform((v) => {
32
+ return remap$(v, {
33
+ "subscription_id": "subscriptionId",
34
+ "product_id": "productId",
35
+ "proration_behavior": "prorationBehavior",
36
+ });
37
+ }),
38
+ );
39
+
40
+ export function subscriptionUpdatedProductMetadataFromJSON(
41
+ jsonString: string,
42
+ ): SafeParseResult<SubscriptionUpdatedProductMetadata, SDKValidationError> {
43
+ return safeParse(
44
+ jsonString,
45
+ (x) =>
46
+ SubscriptionUpdatedProductMetadata$inboundSchema.parse(JSON.parse(x)),
47
+ `Failed to parse 'SubscriptionUpdatedProductMetadata' from JSON`,
48
+ );
49
+ }
@@ -0,0 +1,47 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { Result as SafeParseResult } from "../../types/fp.js";
9
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
10
+ import {
11
+ SubscriptionProrationBehavior,
12
+ SubscriptionProrationBehavior$inboundSchema,
13
+ } from "./subscriptionprorationbehavior.js";
14
+
15
+ export type SubscriptionUpdatedSeatsMetadata = {
16
+ subscriptionId: string;
17
+ seats: number;
18
+ prorationBehavior: SubscriptionProrationBehavior;
19
+ };
20
+
21
+ /** @internal */
22
+ export const SubscriptionUpdatedSeatsMetadata$inboundSchema: z.ZodMiniType<
23
+ SubscriptionUpdatedSeatsMetadata,
24
+ unknown
25
+ > = z.pipe(
26
+ z.object({
27
+ subscription_id: z.string(),
28
+ seats: z.int(),
29
+ proration_behavior: SubscriptionProrationBehavior$inboundSchema,
30
+ }),
31
+ z.transform((v) => {
32
+ return remap$(v, {
33
+ "subscription_id": "subscriptionId",
34
+ "proration_behavior": "prorationBehavior",
35
+ });
36
+ }),
37
+ );
38
+
39
+ export function subscriptionUpdatedSeatsMetadataFromJSON(
40
+ jsonString: string,
41
+ ): SafeParseResult<SubscriptionUpdatedSeatsMetadata, SDKValidationError> {
42
+ return safeParse(
43
+ jsonString,
44
+ (x) => SubscriptionUpdatedSeatsMetadata$inboundSchema.parse(JSON.parse(x)),
45
+ `Failed to parse 'SubscriptionUpdatedSeatsMetadata' from JSON`,
46
+ );
47
+ }
@@ -0,0 +1,41 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { Result as SafeParseResult } from "../../types/fp.js";
9
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
10
+
11
+ export type SubscriptionUpdatedTrialMetadata = {
12
+ subscriptionId: string;
13
+ trialEnd: string;
14
+ };
15
+
16
+ /** @internal */
17
+ export const SubscriptionUpdatedTrialMetadata$inboundSchema: z.ZodMiniType<
18
+ SubscriptionUpdatedTrialMetadata,
19
+ unknown
20
+ > = z.pipe(
21
+ z.object({
22
+ subscription_id: z.string(),
23
+ trial_end: z.string(),
24
+ }),
25
+ z.transform((v) => {
26
+ return remap$(v, {
27
+ "subscription_id": "subscriptionId",
28
+ "trial_end": "trialEnd",
29
+ });
30
+ }),
31
+ );
32
+
33
+ export function subscriptionUpdatedTrialMetadataFromJSON(
34
+ jsonString: string,
35
+ ): SafeParseResult<SubscriptionUpdatedTrialMetadata, SDKValidationError> {
36
+ return safeParse(
37
+ jsonString,
38
+ (x) => SubscriptionUpdatedTrialMetadata$inboundSchema.parse(JSON.parse(x)),
39
+ `Failed to parse 'SubscriptionUpdatedTrialMetadata' from JSON`,
40
+ );
41
+ }
@@ -110,6 +110,10 @@ import {
110
110
  SubscriptionUncanceledEvent,
111
111
  SubscriptionUncanceledEvent$inboundSchema,
112
112
  } from "./subscriptionuncanceledevent.js";
113
+ import {
114
+ SubscriptionUpdatedEvent,
115
+ SubscriptionUpdatedEvent$inboundSchema,
116
+ } from "./subscriptionupdatedevent.js";
113
117
 
114
118
  export type SystemEvent =
115
119
  | BalanceCreditOrderEvent
@@ -137,7 +141,8 @@ export type SystemEvent =
137
141
  | SubscriptionProductUpdatedEvent
138
142
  | SubscriptionRevokedEvent
139
143
  | SubscriptionSeatsUpdatedEvent
140
- | SubscriptionUncanceledEvent;
144
+ | SubscriptionUncanceledEvent
145
+ | SubscriptionUpdatedEvent;
141
146
 
142
147
  /** @internal */
143
148
  export const SystemEvent$inboundSchema: z.ZodMiniType<SystemEvent, unknown> = z
@@ -168,6 +173,7 @@ export const SystemEvent$inboundSchema: z.ZodMiniType<SystemEvent, unknown> = z
168
173
  SubscriptionRevokedEvent$inboundSchema,
169
174
  SubscriptionSeatsUpdatedEvent$inboundSchema,
170
175
  SubscriptionUncanceledEvent$inboundSchema,
176
+ SubscriptionUpdatedEvent$inboundSchema,
171
177
  ]);
172
178
 
173
179
  export function systemEventFromJSON(
@@ -0,0 +1,55 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+ import { PolarError } from "./polarerror.js";
7
+
8
+ export type PaymentFailedData = {
9
+ error: "PaymentFailed";
10
+ detail: string;
11
+ };
12
+
13
+ export class PaymentFailed extends PolarError {
14
+ error: "PaymentFailed";
15
+ detail: string;
16
+
17
+ /** The original data that was passed to this error instance. */
18
+ data$: PaymentFailedData;
19
+
20
+ constructor(
21
+ err: PaymentFailedData,
22
+ httpMeta: { response: Response; request: Request; body: string },
23
+ ) {
24
+ const message = "message" in err && typeof err.message === "string"
25
+ ? err.message
26
+ : `API error occurred: ${JSON.stringify(err)}`;
27
+ super(message, httpMeta);
28
+ this.data$ = err;
29
+ this.error = err.error;
30
+ this.detail = err.detail;
31
+
32
+ this.name = "PaymentFailed";
33
+ }
34
+ }
35
+
36
+ /** @internal */
37
+ export const PaymentFailed$inboundSchema: z.ZodMiniType<
38
+ PaymentFailed,
39
+ unknown
40
+ > = z.pipe(
41
+ z.object({
42
+ error: z.literal("PaymentFailed"),
43
+ detail: z.string(),
44
+ request$: z.custom<Request>(x => x instanceof Request),
45
+ response$: z.custom<Response>(x => x instanceof Response),
46
+ body$: z.string(),
47
+ }),
48
+ z.transform((v) => {
49
+ return new PaymentFailed(v, {
50
+ request: v.request$,
51
+ response: v.response$,
52
+ body: v.body$,
53
+ });
54
+ }),
55
+ );
package/src/webhooks.ts CHANGED
@@ -33,6 +33,11 @@ import { WebhookCustomerStateChangedPayload$inboundSchema } from "./models/compo
33
33
  import { WebhookCustomerSeatAssignedPayload$inboundSchema } from "./models/components/webhookcustomerseatassignedpayload.js";
34
34
  import { WebhookCustomerSeatClaimedPayload$inboundSchema } from "./models/components/webhookcustomerseatclaimedpayload.js";
35
35
  import { WebhookCustomerSeatRevokedPayload$inboundSchema } from "./models/components/webhookcustomerseatrevokedpayload.js";
36
+ import { WebhookMemberCreatedPayload$inboundSchema } from "./models/components/webhookmembercreatedpayload.js";
37
+ import { WebhookMemberUpdatedPayload$inboundSchema } from "./models/components/webhookmemberupdatedpayload.js";
38
+ import { WebhookMemberDeletedPayload$inboundSchema } from "./models/components/webhookmemberdeletedpayload.js";
39
+ import { WebhookCheckoutExpiredPayload$inboundSchema } from "./models/components/webhookcheckoutexpiredpayload.js";
40
+ import { WebhookSubscriptionPastDuePayload$inboundSchema } from "./models/components/webhooksubscriptionpastduepayload.js";
36
41
  import { SDKValidationError } from "./models/errors/sdkvalidationerror.js";
37
42
 
38
43
  class WebhookVerificationError extends Error {
@@ -59,6 +64,12 @@ const parseEvent = (parsed: any) => {
59
64
  return WebhookCustomerSeatClaimedPayload$inboundSchema.parse(parsed);
60
65
  case "customer_seat.revoked":
61
66
  return WebhookCustomerSeatRevokedPayload$inboundSchema.parse(parsed);
67
+ case "member.created":
68
+ return WebhookMemberCreatedPayload$inboundSchema.parse(parsed);
69
+ case "member.updated":
70
+ return WebhookMemberUpdatedPayload$inboundSchema.parse(parsed);
71
+ case "member.deleted":
72
+ return WebhookMemberDeletedPayload$inboundSchema.parse(parsed);
62
73
  case "benefit.created":
63
74
  return WebhookBenefitCreatedPayload$inboundSchema.parse(parsed);
64
75
  case "benefit_grant.created":
@@ -75,6 +86,8 @@ const parseEvent = (parsed: any) => {
75
86
  return WebhookCheckoutCreatedPayload$inboundSchema.parse(parsed);
76
87
  case "checkout.updated":
77
88
  return WebhookCheckoutUpdatedPayload$inboundSchema.parse(parsed);
89
+ case "checkout.expired":
90
+ return WebhookCheckoutExpiredPayload$inboundSchema.parse(parsed);
78
91
  case "order.created":
79
92
  return WebhookOrderCreatedPayload$inboundSchema.parse(parsed);
80
93
  case "order.paid":
@@ -105,6 +118,8 @@ const parseEvent = (parsed: any) => {
105
118
  return WebhookSubscriptionUncanceledPayload$inboundSchema.parse(parsed);
106
119
  case "subscription.updated":
107
120
  return WebhookSubscriptionUpdatedPayload$inboundSchema.parse(parsed);
121
+ case "subscription.past_due":
122
+ return WebhookSubscriptionPastDuePayload$inboundSchema.parse(parsed);
108
123
  default:
109
124
  throw new SDKValidationError(
110
125
  `Unknown event type: ${parsed.type}`,