@carlonicora/nextjs-jsonapi 1.14.0 → 1.16.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 (279) hide show
  1. package/dist/{ApiResponseInterface-B4QdWh-y.d.mts → ApiResponseInterface-BvWIeLkq.d.ts} +2 -1
  2. package/dist/{ApiResponseInterface-QLDnxLA9.d.ts → ApiResponseInterface-CAbw0sv7.d.mts} +2 -1
  3. package/dist/{BlockNoteEditor-436ZHDY3.mjs → BlockNoteEditor-HFX7Z5BQ.mjs} +5 -5
  4. package/dist/{BlockNoteEditor-WCK43JHX.js → BlockNoteEditor-MBFDWP7X.js} +15 -15
  5. package/dist/{BlockNoteEditor-WCK43JHX.js.map → BlockNoteEditor-MBFDWP7X.js.map} +1 -1
  6. package/dist/JsonApiRequest-45CLE65I.js +24 -0
  7. package/dist/{JsonApiRequest-FXZCYIER.js.map → JsonApiRequest-45CLE65I.js.map} +1 -1
  8. package/dist/{JsonApiRequest-HFWXMKMA.mjs → JsonApiRequest-6IPS3DZJ.mjs} +2 -2
  9. package/dist/{chunk-R6K76UTR.js → chunk-2AZLCF6D.js} +1687 -183
  10. package/dist/chunk-2AZLCF6D.js.map +1 -0
  11. package/dist/{chunk-2FCG3K64.mjs → chunk-5RAUCUAA.mjs} +3722 -396
  12. package/dist/chunk-5RAUCUAA.mjs.map +1 -0
  13. package/dist/{chunk-TGBXBUWM.mjs → chunk-BCKYJQ3K.mjs} +8 -1
  14. package/dist/chunk-BCKYJQ3K.mjs.map +1 -0
  15. package/dist/{chunk-A333VMBO.mjs → chunk-BCQSE3EU.mjs} +1654 -150
  16. package/dist/chunk-BCQSE3EU.mjs.map +1 -0
  17. package/dist/{chunk-FPZPD4JI.js → chunk-GPGJNTHP.js} +17 -10
  18. package/dist/chunk-GPGJNTHP.js.map +1 -0
  19. package/dist/{chunk-45QMJETP.js → chunk-ONB2DAIV.js} +4090 -764
  20. package/dist/chunk-ONB2DAIV.js.map +1 -0
  21. package/dist/{chunk-SJIVGCNM.mjs → chunk-POKIJ56Q.mjs} +7 -2
  22. package/dist/chunk-POKIJ56Q.mjs.map +1 -0
  23. package/dist/{chunk-6YD42BP6.js → chunk-R5QSSISB.js} +14 -9
  24. package/dist/chunk-R5QSSISB.js.map +1 -0
  25. package/dist/client/index.d.mts +5 -5
  26. package/dist/client/index.d.ts +5 -5
  27. package/dist/client/index.js +7 -5
  28. package/dist/client/index.js.map +1 -1
  29. package/dist/client/index.mjs +6 -4
  30. package/dist/components/index.d.mts +253 -9
  31. package/dist/components/index.d.ts +253 -9
  32. package/dist/components/index.js +83 -5
  33. package/dist/components/index.js.map +1 -1
  34. package/dist/components/index.mjs +82 -4
  35. package/dist/{config-eceYM5kN.d.ts → config-CWsTwnsK.d.mts} +7 -2
  36. package/dist/{config-C5tGGrYf.d.mts → config-DEaUbBqR.d.ts} +7 -2
  37. package/dist/{content.interface-TB2MfJGs.d.ts → content.interface-D_4b4RQt.d.ts} +1 -1
  38. package/dist/{content.interface-CxBBC7ec.d.mts → content.interface-Dk4UZcJM.d.mts} +1 -1
  39. package/dist/contexts/index.d.mts +2 -2
  40. package/dist/contexts/index.d.ts +2 -2
  41. package/dist/contexts/index.js +5 -5
  42. package/dist/contexts/index.mjs +4 -4
  43. package/dist/core/index.d.mts +528 -22
  44. package/dist/core/index.d.ts +528 -22
  45. package/dist/core/index.js +53 -3
  46. package/dist/core/index.js.map +1 -1
  47. package/dist/core/index.mjs +52 -2
  48. package/dist/index.d.mts +7 -7
  49. package/dist/index.d.ts +7 -7
  50. package/dist/index.js +56 -4
  51. package/dist/index.js.map +1 -1
  52. package/dist/index.mjs +55 -3
  53. package/dist/{notification.interface-lG6UpTpt.d.mts → notification.interface-BllkURRm.d.mts} +1 -2
  54. package/dist/{notification.interface-lG6UpTpt.d.ts → notification.interface-BllkURRm.d.ts} +1 -2
  55. package/dist/{s3.service-DP_hsssD.d.mts → s3.service-BEfGqho0.d.ts} +20 -2
  56. package/dist/{s3.service-Dq-PTUNa.d.ts → s3.service-DIQRYe93.d.mts} +20 -2
  57. package/dist/scripts/generate-web-module/generator.d.ts.map +1 -1
  58. package/dist/scripts/generate-web-module/generator.js +66 -0
  59. package/dist/scripts/generate-web-module/generator.js.map +1 -1
  60. package/dist/scripts/generate-web-module/templates/data/interface.template.js +8 -1
  61. package/dist/scripts/generate-web-module/templates/data/interface.template.js.map +1 -1
  62. package/dist/scripts/generate-web-module/templates/data/model.template.js +26 -3
  63. package/dist/scripts/generate-web-module/templates/data/model.template.js.map +1 -1
  64. package/dist/scripts/generate-web-module/templates/index.d.ts +8 -0
  65. package/dist/scripts/generate-web-module/templates/index.d.ts.map +1 -1
  66. package/dist/scripts/generate-web-module/templates/index.js +18 -1
  67. package/dist/scripts/generate-web-module/templates/index.js.map +1 -1
  68. package/dist/scripts/generate-web-module/templates/project/bootstrapper.template.d.ts +7 -0
  69. package/dist/scripts/generate-web-module/templates/project/bootstrapper.template.d.ts.map +1 -0
  70. package/dist/scripts/generate-web-module/templates/project/bootstrapper.template.js +141 -0
  71. package/dist/scripts/generate-web-module/templates/project/bootstrapper.template.js.map +1 -0
  72. package/dist/scripts/generate-web-module/templates/project/env.template.d.ts +7 -0
  73. package/dist/scripts/generate-web-module/templates/project/env.template.d.ts.map +1 -0
  74. package/dist/scripts/generate-web-module/templates/project/env.template.js +110 -0
  75. package/dist/scripts/generate-web-module/templates/project/env.template.js.map +1 -0
  76. package/dist/scripts/generate-web-module/templates/project/main-layout.template.d.ts +7 -0
  77. package/dist/scripts/generate-web-module/templates/project/main-layout.template.d.ts.map +1 -0
  78. package/dist/scripts/generate-web-module/templates/project/main-layout.template.js +101 -0
  79. package/dist/scripts/generate-web-module/templates/project/main-layout.template.js.map +1 -0
  80. package/dist/scripts/generate-web-module/templates/project/middleware-env.template.d.ts +7 -0
  81. package/dist/scripts/generate-web-module/templates/project/middleware-env.template.d.ts.map +1 -0
  82. package/dist/scripts/generate-web-module/templates/project/middleware-env.template.js +66 -0
  83. package/dist/scripts/generate-web-module/templates/project/middleware-env.template.js.map +1 -0
  84. package/dist/scripts/generate-web-module/templates/project/settings-container.template.d.ts +7 -0
  85. package/dist/scripts/generate-web-module/templates/project/settings-container.template.d.ts.map +1 -0
  86. package/dist/scripts/generate-web-module/templates/project/settings-container.template.js +257 -0
  87. package/dist/scripts/generate-web-module/templates/project/settings-container.template.js.map +1 -0
  88. package/dist/scripts/generate-web-module/templates/project/settings-context.template.d.ts +7 -0
  89. package/dist/scripts/generate-web-module/templates/project/settings-context.template.d.ts.map +1 -0
  90. package/dist/scripts/generate-web-module/templates/project/settings-context.template.js +124 -0
  91. package/dist/scripts/generate-web-module/templates/project/settings-context.template.js.map +1 -0
  92. package/dist/scripts/generate-web-module/templates/project/settings-module-page.template.d.ts +7 -0
  93. package/dist/scripts/generate-web-module/templates/project/settings-module-page.template.d.ts.map +1 -0
  94. package/dist/scripts/generate-web-module/templates/project/settings-module-page.template.js +78 -0
  95. package/dist/scripts/generate-web-module/templates/project/settings-module-page.template.js.map +1 -0
  96. package/dist/scripts/generate-web-module/templates/project/settings-page.template.d.ts +7 -0
  97. package/dist/scripts/generate-web-module/templates/project/settings-page.template.d.ts.map +1 -0
  98. package/dist/scripts/generate-web-module/templates/project/settings-page.template.js +75 -0
  99. package/dist/scripts/generate-web-module/templates/project/settings-page.template.js.map +1 -0
  100. package/dist/scripts/generate-web-module/types/template-data.interface.d.ts +1 -1
  101. package/dist/scripts/generate-web-module/types/template-data.interface.d.ts.map +1 -1
  102. package/dist/server/index.d.mts +4 -4
  103. package/dist/server/index.d.ts +4 -4
  104. package/dist/server/index.js +12 -12
  105. package/dist/server/index.mjs +2 -2
  106. package/dist/stripe-subscription.interface-C63L6hVg.d.mts +226 -0
  107. package/dist/stripe-subscription.interface-CUvNDvw5.d.ts +226 -0
  108. package/dist/{useSocket-Bua6MwLi.d.mts → useSocket-BpenBR2z.d.mts} +1 -1
  109. package/dist/{useSocket-D5dhUp4m.d.ts → useSocket-D-QYA0Sr.d.ts} +1 -1
  110. package/package.json +9 -1
  111. package/scripts/generate-web-module/generator.ts +83 -0
  112. package/scripts/generate-web-module/templates/data/interface.template.ts +7 -1
  113. package/scripts/generate-web-module/templates/data/model.template.ts +28 -5
  114. package/scripts/generate-web-module/templates/index.ts +10 -0
  115. package/scripts/generate-web-module/templates/project/bootstrapper.template.ts +108 -0
  116. package/scripts/generate-web-module/templates/project/env.template.ts +77 -0
  117. package/scripts/generate-web-module/templates/project/main-layout.template.tsx +68 -0
  118. package/scripts/generate-web-module/templates/project/middleware-env.template.ts +33 -0
  119. package/scripts/generate-web-module/templates/project/settings-container.template.tsx +224 -0
  120. package/scripts/generate-web-module/templates/project/settings-context.template.tsx +91 -0
  121. package/scripts/generate-web-module/templates/project/settings-module-page.template.tsx +45 -0
  122. package/scripts/generate-web-module/templates/project/settings-page.template.tsx +42 -0
  123. package/scripts/generate-web-module/types/template-data.interface.ts +1 -1
  124. package/src/client/config.ts +9 -0
  125. package/src/components/index.ts +7 -0
  126. package/src/core/abstracts/AbstractApiData.ts +79 -16
  127. package/src/core/abstracts/AbstractService.ts +104 -0
  128. package/src/core/endpoint/EndpointCreator.ts +7 -4
  129. package/src/core/index.ts +12 -4
  130. package/src/core/interfaces/ApiResponseInterface.ts +1 -0
  131. package/src/core/registry/ModuleRegistry.ts +11 -2
  132. package/src/core/utils/translateResponse.ts +17 -0
  133. package/src/features/billing/components/cards/BillingUsageSummaryCard.tsx +97 -0
  134. package/src/features/billing/components/cards/CustomerInfoCard.tsx +112 -0
  135. package/src/features/billing/components/cards/InvoicesSummaryCard.tsx +114 -0
  136. package/src/features/billing/components/cards/PaymentMethodSummaryCard.tsx +119 -0
  137. package/src/features/billing/components/cards/SubscriptionSummaryCard.tsx +146 -0
  138. package/src/features/billing/components/cards/index.ts +5 -0
  139. package/src/features/billing/components/containers/BillingDashboardContainer.tsx +427 -0
  140. package/src/features/billing/components/containers/index.ts +1 -0
  141. package/src/features/billing/components/index.ts +6 -0
  142. package/src/features/billing/components/modals/BillingDetailModal.tsx +36 -0
  143. package/src/features/billing/components/modals/index.ts +1 -0
  144. package/src/features/billing/components/providers/StripeProvider.tsx +48 -0
  145. package/src/features/billing/components/providers/index.ts +1 -0
  146. package/src/features/billing/components/utils/currency.ts +49 -0
  147. package/src/features/billing/components/utils/date.ts +21 -0
  148. package/src/features/billing/components/utils/index.ts +2 -0
  149. package/src/features/billing/components/widgets/BillingAlertBanner.tsx +63 -0
  150. package/src/features/billing/components/widgets/index.ts +1 -0
  151. package/src/features/billing/data/Billing.ts +17 -0
  152. package/src/features/billing/data/billing.service.ts +58 -0
  153. package/src/features/billing/data/index.ts +5 -0
  154. package/src/features/billing/index.ts +3 -0
  155. package/src/features/billing/modules/billing.module.ts +9 -0
  156. package/src/features/billing/modules/index.ts +1 -0
  157. package/src/features/billing/stripe-customer/components/containers/PaymentMethodsContainer.tsx +79 -0
  158. package/src/features/billing/stripe-customer/components/containers/index.ts +1 -0
  159. package/src/features/billing/stripe-customer/components/details/PaymentMethodCard.tsx +151 -0
  160. package/src/features/billing/stripe-customer/components/details/index.ts +1 -0
  161. package/src/features/billing/stripe-customer/components/forms/PaymentMethodEditor.tsx +186 -0
  162. package/src/features/billing/stripe-customer/components/forms/index.ts +1 -0
  163. package/src/features/billing/stripe-customer/components/index.ts +4 -0
  164. package/src/features/billing/stripe-customer/components/lists/PaymentMethodsList.tsx +19 -0
  165. package/src/features/billing/stripe-customer/components/lists/index.ts +1 -0
  166. package/src/features/billing/stripe-customer/data/index.ts +5 -0
  167. package/src/features/billing/stripe-customer/data/payment-method.interface.ts +27 -0
  168. package/src/features/billing/stripe-customer/data/payment-method.ts +119 -0
  169. package/src/features/billing/stripe-customer/data/stripe-customer.interface.ts +16 -0
  170. package/src/features/billing/stripe-customer/data/stripe-customer.service.ts +128 -0
  171. package/src/features/billing/stripe-customer/data/stripe-customer.ts +71 -0
  172. package/src/features/billing/stripe-customer/index.ts +3 -0
  173. package/src/features/billing/stripe-customer/stripe-customer.module.ts +9 -0
  174. package/src/features/billing/stripe-customer/stripe-payment-method.module.ts +9 -0
  175. package/src/features/billing/stripe-invoice/components/containers/InvoicesContainer.tsx +66 -0
  176. package/src/features/billing/stripe-invoice/components/containers/index.ts +1 -0
  177. package/src/features/billing/stripe-invoice/components/details/InvoiceDetails.tsx +172 -0
  178. package/src/features/billing/stripe-invoice/components/details/index.ts +1 -0
  179. package/src/features/billing/stripe-invoice/components/index.ts +4 -0
  180. package/src/features/billing/stripe-invoice/components/lists/InvoicesList.tsx +84 -0
  181. package/src/features/billing/stripe-invoice/components/lists/index.ts +1 -0
  182. package/src/features/billing/stripe-invoice/components/widgets/InvoiceStatusBadge.tsx +41 -0
  183. package/src/features/billing/stripe-invoice/components/widgets/index.ts +1 -0
  184. package/src/features/billing/stripe-invoice/data/index.ts +3 -0
  185. package/src/features/billing/stripe-invoice/data/stripe-invoice.interface.ts +65 -0
  186. package/src/features/billing/stripe-invoice/data/stripe-invoice.service.ts +64 -0
  187. package/src/features/billing/stripe-invoice/data/stripe-invoice.ts +177 -0
  188. package/src/features/billing/stripe-invoice/index.ts +2 -0
  189. package/src/features/billing/stripe-invoice/stripe-invoice.module.ts +9 -0
  190. package/src/features/billing/stripe-price/components/forms/PriceEditor.tsx +304 -0
  191. package/src/features/billing/stripe-price/components/forms/index.ts +1 -0
  192. package/src/features/billing/stripe-price/components/index.ts +2 -0
  193. package/src/features/billing/stripe-price/components/lists/PricesList.tsx +283 -0
  194. package/src/features/billing/stripe-price/components/lists/index.ts +1 -0
  195. package/src/features/billing/stripe-price/data/index.ts +3 -0
  196. package/src/features/billing/stripe-price/data/stripe-price.interface.ts +48 -0
  197. package/src/features/billing/stripe-price/data/stripe-price.service.ts +123 -0
  198. package/src/features/billing/stripe-price/data/stripe-price.ts +156 -0
  199. package/src/features/billing/stripe-price/index.ts +2 -0
  200. package/src/features/billing/stripe-price/stripe-price.module.ts +9 -0
  201. package/src/features/billing/stripe-product/components/containers/ProductsAdminContainer.tsx +86 -0
  202. package/src/features/billing/stripe-product/components/containers/index.ts +1 -0
  203. package/src/features/billing/stripe-product/components/forms/ProductEditor.tsx +100 -0
  204. package/src/features/billing/stripe-product/components/forms/index.ts +1 -0
  205. package/src/features/billing/stripe-product/components/index.ts +3 -0
  206. package/src/features/billing/stripe-product/components/lists/ProductsList.tsx +206 -0
  207. package/src/features/billing/stripe-product/components/lists/index.ts +1 -0
  208. package/src/features/billing/stripe-product/data/index.ts +3 -0
  209. package/src/features/billing/stripe-product/data/stripe-product.interface.ts +18 -0
  210. package/src/features/billing/stripe-product/data/stripe-product.service.ts +112 -0
  211. package/src/features/billing/stripe-product/data/stripe-product.ts +74 -0
  212. package/src/features/billing/stripe-product/index.ts +2 -0
  213. package/src/features/billing/stripe-product/stripe-product.module.ts +9 -0
  214. package/src/features/billing/stripe-subscription/components/containers/SubscriptionsContainer.tsx +304 -0
  215. package/src/features/billing/stripe-subscription/components/containers/index.ts +1 -0
  216. package/src/features/billing/stripe-subscription/components/details/SubscriptionDetails.tsx +223 -0
  217. package/src/features/billing/stripe-subscription/components/details/index.ts +1 -0
  218. package/src/features/billing/stripe-subscription/components/forms/CancelSubscriptionDialog.tsx +116 -0
  219. package/src/features/billing/stripe-subscription/components/forms/SubscriptionEditor.tsx +331 -0
  220. package/src/features/billing/stripe-subscription/components/forms/index.ts +2 -0
  221. package/src/features/billing/stripe-subscription/components/index.ts +5 -0
  222. package/src/features/billing/stripe-subscription/components/lists/SubscriptionsList.tsx +104 -0
  223. package/src/features/billing/stripe-subscription/components/lists/index.ts +1 -0
  224. package/src/features/billing/stripe-subscription/components/widgets/PricingCard.tsx +95 -0
  225. package/src/features/billing/stripe-subscription/components/widgets/PricingCardsGrid.tsx +110 -0
  226. package/src/features/billing/stripe-subscription/components/widgets/ProrationPreview.tsx +41 -0
  227. package/src/features/billing/stripe-subscription/components/widgets/SubscriptionStatusBadge.tsx +60 -0
  228. package/src/features/billing/stripe-subscription/components/widgets/index.ts +4 -0
  229. package/src/features/billing/stripe-subscription/data/index.ts +3 -0
  230. package/src/features/billing/stripe-subscription/data/stripe-subscription.interface.ts +66 -0
  231. package/src/features/billing/stripe-subscription/data/stripe-subscription.service.ts +193 -0
  232. package/src/features/billing/stripe-subscription/data/stripe-subscription.ts +135 -0
  233. package/src/features/billing/stripe-subscription/hooks/index.ts +1 -0
  234. package/src/features/billing/stripe-subscription/hooks/useConfirmSubscriptionPayment.ts +111 -0
  235. package/src/features/billing/stripe-subscription/index.ts +5 -0
  236. package/src/features/billing/stripe-subscription/stripe-subscription.module.ts +9 -0
  237. package/src/features/billing/stripe-usage/components/containers/UsageContainer.tsx +109 -0
  238. package/src/features/billing/stripe-usage/components/containers/index.ts +1 -0
  239. package/src/features/billing/stripe-usage/components/details/UsageSummaryCard.tsx +90 -0
  240. package/src/features/billing/stripe-usage/components/details/index.ts +1 -0
  241. package/src/features/billing/stripe-usage/components/index.ts +4 -0
  242. package/src/features/billing/stripe-usage/components/lists/UsageHistoryTable.tsx +72 -0
  243. package/src/features/billing/stripe-usage/components/lists/index.ts +1 -0
  244. package/src/features/billing/stripe-usage/components/widgets/UsageSummaryCards.tsx +19 -0
  245. package/src/features/billing/stripe-usage/components/widgets/index.ts +1 -0
  246. package/src/features/billing/stripe-usage/data/index.ts +3 -0
  247. package/src/features/billing/stripe-usage/data/stripe-usage.interface.ts +55 -0
  248. package/src/features/billing/stripe-usage/data/stripe-usage.service.ts +129 -0
  249. package/src/features/billing/stripe-usage/data/stripe-usage.ts +70 -0
  250. package/src/features/billing/stripe-usage/index.ts +2 -0
  251. package/src/features/billing/stripe-usage/stripe-usage.module.ts +9 -0
  252. package/src/features/company/components/forms/CompanyEditor.tsx +2 -2
  253. package/src/features/company/components/forms/CompanyLicense.tsx +4 -4
  254. package/src/features/company/contexts/CompanyContext.tsx +2 -2
  255. package/src/features/feature/components/forms/FormFeatures.tsx +13 -106
  256. package/src/features/feature/data/feature.interface.ts +1 -1
  257. package/src/features/feature/data/feature.ts +4 -4
  258. package/src/features/index.ts +7 -0
  259. package/src/features/module/data/module.interface.ts +0 -1
  260. package/src/features/module/data/module.ts +0 -6
  261. package/src/features/user/components/lists/ContributorsList.tsx +2 -2
  262. package/src/features/user/components/widgets/UserAvatar.tsx +1 -1
  263. package/src/index.ts +1 -1
  264. package/src/shadcnui/custom/link.tsx +16 -6
  265. package/src/utils/blocknote-diff.util.ts +2 -1
  266. package/src/utils/blocknote-word-diff-renderer.util.ts +8 -7
  267. package/dist/AuthComponent-hxOPs9o8.d.mts +0 -11
  268. package/dist/AuthComponent-hxOPs9o8.d.ts +0 -11
  269. package/dist/JsonApiRequest-FXZCYIER.js +0 -24
  270. package/dist/chunk-2FCG3K64.mjs.map +0 -1
  271. package/dist/chunk-45QMJETP.js.map +0 -1
  272. package/dist/chunk-6YD42BP6.js.map +0 -1
  273. package/dist/chunk-A333VMBO.mjs.map +0 -1
  274. package/dist/chunk-FPZPD4JI.js.map +0 -1
  275. package/dist/chunk-R6K76UTR.js.map +0 -1
  276. package/dist/chunk-SJIVGCNM.mjs.map +0 -1
  277. package/dist/chunk-TGBXBUWM.mjs.map +0 -1
  278. /package/dist/{BlockNoteEditor-436ZHDY3.mjs.map → BlockNoteEditor-HFX7Z5BQ.mjs.map} +0 -0
  279. /package/dist/{JsonApiRequest-HFWXMKMA.mjs.map → JsonApiRequest-6IPS3DZJ.mjs.map} +0 -0
@@ -11,7 +11,7 @@ import {
11
11
  setBootstrapper,
12
12
  translateResponse,
13
13
  tryBootstrap
14
- } from "./chunk-TGBXBUWM.mjs";
14
+ } from "./chunk-BCKYJQ3K.mjs";
15
15
  import {
16
16
  getClientToken
17
17
  } from "./chunk-AUXK7QSA.mjs";
@@ -121,23 +121,68 @@ var AbstractApiData = class {
121
121
  }
122
122
  /**
123
123
  * Read included relationship data and augment with relationship meta properties.
124
- * Used for single relationships (one-to-one) that have edge properties.
124
+ * Handles both single relationships (one-to-one) and array relationships (one-to-many).
125
+ *
126
+ * For single relationships: meta is read from `relationships[type].meta`
127
+ * For array relationships: per-item meta is read from `relationships[type].data[].meta`
125
128
  *
126
129
  * @param data - Hydrated JSON:API data
127
- * @param type - Relationship type key (e.g., "guide")
130
+ * @param type - Relationship type key (e.g., "guide", "persons")
128
131
  * @param dataType - Module reference for rehydration
129
- * @returns Related object augmented with meta properties, or undefined
132
+ * @returns Related object(s) augmented with meta properties, or undefined
130
133
  */
131
134
  _readIncludedWithMeta(data, type, dataType) {
132
- const related = this._readIncluded(data, type, dataType);
133
- if (!related || Array.isArray(related)) {
135
+ if (data.included === void 0 || data.included.length === 0 || data.jsonApi.relationships === void 0 || data.jsonApi.relationships[type] === void 0 || data.jsonApi.relationships[type].data === void 0) {
136
+ return void 0;
137
+ }
138
+ const relationshipData = data.jsonApi.relationships[type].data;
139
+ if (Array.isArray(relationshipData)) {
140
+ const result = [];
141
+ for (const item of relationshipData) {
142
+ const includedData2 = data.included.find((inc) => inc.id === item.id && inc.type === item.type);
143
+ if (!includedData2) continue;
144
+ const entity2 = RehydrationFactory.rehydrate(dataType, {
145
+ jsonApi: includedData2,
146
+ included: data.included
147
+ });
148
+ if (item.meta) {
149
+ Object.assign(entity2, item.meta);
150
+ }
151
+ result.push(entity2);
152
+ }
153
+ return result;
154
+ }
155
+ const includedData = data.included.find(
156
+ (inc) => inc.id === relationshipData.id && inc.type === relationshipData.type
157
+ );
158
+ if (!includedData) {
159
+ if (data.allData !== void 0) {
160
+ const fallbackData = data.allData.find(
161
+ (inc) => inc.id === relationshipData.id && inc.type === relationshipData.type
162
+ );
163
+ if (fallbackData) {
164
+ const entity2 = RehydrationFactory.rehydrate(dataType, {
165
+ jsonApi: fallbackData,
166
+ included: data.included
167
+ });
168
+ const relationshipMeta2 = data.jsonApi.relationships[type].meta;
169
+ if (relationshipMeta2) {
170
+ Object.assign(entity2, relationshipMeta2);
171
+ }
172
+ return entity2;
173
+ }
174
+ }
134
175
  return void 0;
135
176
  }
136
- const relationshipMeta = data.jsonApi.relationships?.[type]?.meta;
137
- if (!relationshipMeta) {
138
- return related;
177
+ const entity = RehydrationFactory.rehydrate(dataType, {
178
+ jsonApi: includedData,
179
+ included: data.included
180
+ });
181
+ const relationshipMeta = data.jsonApi.relationships[type].meta;
182
+ if (relationshipMeta) {
183
+ Object.assign(entity, relationshipMeta);
139
184
  }
140
- return Object.assign(related, relationshipMeta);
185
+ return entity;
141
186
  }
142
187
  dehydrate() {
143
188
  return {
@@ -227,7 +272,7 @@ var AbstractService = class {
227
272
  * Make an API call with automatic environment detection and error handling.
228
273
  */
229
274
  static async callApi(params) {
230
- const { JsonApiGet: JsonApiGet2, JsonApiPost: JsonApiPost2, JsonApiPut, JsonApiPatch, JsonApiDelete: JsonApiDelete2 } = await import("./JsonApiRequest-HFWXMKMA.mjs");
275
+ const { JsonApiGet: JsonApiGet2, JsonApiPost: JsonApiPost2, JsonApiPut, JsonApiPatch, JsonApiDelete: JsonApiDelete2 } = await import("./JsonApiRequest-6IPS3DZJ.mjs");
231
276
  let apiResponse;
232
277
  let language = "en";
233
278
  if (typeof window === "undefined") {
@@ -308,11 +353,96 @@ var AbstractService = class {
308
353
  if (apiResponse.self && params.self) params.self.self = apiResponse.self;
309
354
  return apiResponse.data;
310
355
  }
356
+ /**
357
+ * Make an API call and return both data and meta from the response.
358
+ */
359
+ static async callApiWithMeta(params) {
360
+ const { JsonApiGet: JsonApiGet2, JsonApiPost: JsonApiPost2, JsonApiPut, JsonApiPatch, JsonApiDelete: JsonApiDelete2 } = await import("./JsonApiRequest-6IPS3DZJ.mjs");
361
+ let apiResponse;
362
+ let language = "en";
363
+ if (typeof window === "undefined") {
364
+ const { getLocale } = await import("next-intl/server");
365
+ language = await getLocale() ?? "en";
366
+ } else {
367
+ language = this.getClientLocale();
368
+ }
369
+ switch (params.method) {
370
+ case "GET" /* GET */:
371
+ apiResponse = await JsonApiGet2({
372
+ classKey: params.type,
373
+ endpoint: params.endpoint,
374
+ companyId: params.companyId,
375
+ language
376
+ });
377
+ break;
378
+ case "POST" /* POST */:
379
+ apiResponse = await JsonApiPost2({
380
+ classKey: params.type,
381
+ endpoint: params.endpoint,
382
+ companyId: params.companyId,
383
+ body: params.input,
384
+ overridesJsonApiCreation: params.overridesJsonApiCreation,
385
+ language,
386
+ responseType: params.responseType,
387
+ files: params.files
388
+ });
389
+ break;
390
+ case "PUT" /* PUT */:
391
+ apiResponse = await JsonApiPut({
392
+ classKey: params.type,
393
+ endpoint: params.endpoint,
394
+ companyId: params.companyId,
395
+ body: params.input,
396
+ language,
397
+ responseType: params.responseType,
398
+ files: params.files
399
+ });
400
+ break;
401
+ case "PATCH" /* PATCH */:
402
+ apiResponse = await JsonApiPatch({
403
+ classKey: params.type,
404
+ endpoint: params.endpoint,
405
+ companyId: params.companyId,
406
+ body: params.input,
407
+ overridesJsonApiCreation: params.overridesJsonApiCreation,
408
+ language,
409
+ responseType: params.responseType,
410
+ files: params.files
411
+ });
412
+ break;
413
+ case "DELETE" /* DELETE */:
414
+ apiResponse = await JsonApiDelete2({
415
+ classKey: params.type,
416
+ endpoint: params.endpoint,
417
+ companyId: params.companyId,
418
+ language,
419
+ responseType: params.responseType
420
+ });
421
+ break;
422
+ default:
423
+ throw new Error("Method not found");
424
+ }
425
+ if (!apiResponse.ok) {
426
+ if (globalErrorHandler && typeof window !== "undefined") {
427
+ globalErrorHandler(apiResponse.response, apiResponse.error);
428
+ return { data: void 0, meta: void 0 };
429
+ } else {
430
+ const error = new Error(`${apiResponse.error}`);
431
+ error.status = apiResponse.response;
432
+ error.digest = `HTTP_${apiResponse.response}`;
433
+ throw error;
434
+ }
435
+ }
436
+ return {
437
+ data: apiResponse.data,
438
+ meta: apiResponse.meta
439
+ };
440
+ }
311
441
  /**
312
442
  * Get raw JSON:API response data without deserialization.
313
443
  */
314
444
  static async getRawData(params) {
315
- const { JsonApiGet: JsonApiGet2 } = await import("./JsonApiRequest-HFWXMKMA.mjs");
445
+ const { JsonApiGet: JsonApiGet2 } = await import("./JsonApiRequest-6IPS3DZJ.mjs");
316
446
  let language = "en";
317
447
  if (typeof window === "undefined") {
318
448
  const { getLocale } = await import("next-intl/server");
@@ -849,7 +979,8 @@ var EndpointCreator = class {
849
979
  if (this._endpoint.additionalParams) {
850
980
  additionalParams = this._endpoint.additionalParams.map((param) => `${param.key}=${param.value}`).join("&");
851
981
  }
852
- let response = `${this._endpoint.endpoint.name}`;
982
+ let response = ``;
983
+ response += `${typeof this._endpoint.endpoint === "string" ? this._endpoint.endpoint : this._endpoint.endpoint.name}`;
853
984
  if (this._endpoint.id) response += `/${this._endpoint.id}`;
854
985
  if (this._endpoint.childEndpoint) {
855
986
  response += `/${typeof this._endpoint.childEndpoint === "string" ? this._endpoint.childEndpoint : this._endpoint.childEndpoint.name}`;
@@ -1051,6 +1182,7 @@ var entityObjectSchema = z2.object({
1051
1182
  });
1052
1183
 
1053
1184
  // src/utils/blocknote-diff.util.ts
1185
+ import { v4 } from "uuid";
1054
1186
  var BlockNoteDiffUtil = class {
1055
1187
  static {
1056
1188
  __name(this, "BlockNoteDiffUtil");
@@ -1081,7 +1213,7 @@ var BlockNoteDiffUtil = class {
1081
1213
  const processedNewIds = /* @__PURE__ */ new Set();
1082
1214
  for (const originalBlock of originalBlocks) {
1083
1215
  const blockId = originalBlock.id;
1084
- const processId = blockId || crypto.randomUUID();
1216
+ const processId = blockId || v4();
1085
1217
  const newBlock = blockId ? newMap.get(blockId) : null;
1086
1218
  if (!newBlock) {
1087
1219
  const removedBlock = {
@@ -1627,6 +1759,7 @@ var BlockNoteDiffUtil = class {
1627
1759
  };
1628
1760
 
1629
1761
  // src/utils/blocknote-word-diff-renderer.util.ts
1762
+ import { v4 as v42 } from "uuid";
1630
1763
  var BlockNoteWordDiffRendererUtil = class {
1631
1764
  static {
1632
1765
  __name(this, "BlockNoteWordDiffRendererUtil");
@@ -1669,7 +1802,7 @@ var BlockNoteWordDiffRendererUtil = class {
1669
1802
  return this.renderBlockLevelDiff(block, onAcceptChange, onRejectChange);
1670
1803
  }
1671
1804
  const baseBlock = {
1672
- id: block.id || crypto.randomUUID(),
1805
+ id: block.id || v42(),
1673
1806
  type: block.type || "paragraph",
1674
1807
  props: this.getBlockProps(block),
1675
1808
  content: Array.isArray(block.content) ? block.content : [],
@@ -1682,7 +1815,7 @@ var BlockNoteWordDiffRendererUtil = class {
1682
1815
  static renderBlockLevelDiff(block, onAcceptChange, onRejectChange) {
1683
1816
  if (!block.diffId) {
1684
1817
  return {
1685
- id: block.id || crypto.randomUUID(),
1818
+ id: block.id || v42(),
1686
1819
  type: block.type || "paragraph",
1687
1820
  props: block.props || {},
1688
1821
  content: Array.isArray(block.content) ? block.content : [],
@@ -1697,7 +1830,7 @@ var BlockNoteWordDiffRendererUtil = class {
1697
1830
  if (block.diffType === "added") {
1698
1831
  if (blockRejected) {
1699
1832
  return {
1700
- id: block.id || crypto.randomUUID(),
1833
+ id: block.id || v42(),
1701
1834
  type: "paragraph",
1702
1835
  props: {},
1703
1836
  content: [],
@@ -1716,7 +1849,7 @@ var BlockNoteWordDiffRendererUtil = class {
1716
1849
  } else if (block.diffType === "removed") {
1717
1850
  if (blockAccepted) {
1718
1851
  return {
1719
- id: block.id || crypto.randomUUID(),
1852
+ id: block.id || v42(),
1720
1853
  type: "paragraph",
1721
1854
  props: {},
1722
1855
  content: [],
@@ -1734,7 +1867,7 @@ var BlockNoteWordDiffRendererUtil = class {
1734
1867
  }
1735
1868
  }
1736
1869
  const baseBlock = {
1737
- id: block.id || crypto.randomUUID(),
1870
+ id: block.id || v42(),
1738
1871
  type: block.type || "paragraph",
1739
1872
  props: this.getBlockProps(block),
1740
1873
  content,
@@ -1747,7 +1880,7 @@ var BlockNoteWordDiffRendererUtil = class {
1747
1880
  static renderWordLevelDiff(block, onAcceptChange, onRejectChange) {
1748
1881
  if (!block.wordDiffs) {
1749
1882
  return {
1750
- id: block.id || crypto.randomUUID(),
1883
+ id: block.id || v42(),
1751
1884
  type: block.type || "paragraph",
1752
1885
  props: block.props || {},
1753
1886
  content: Array.isArray(block.content) ? block.content : [],
@@ -1756,7 +1889,7 @@ var BlockNoteWordDiffRendererUtil = class {
1756
1889
  }
1757
1890
  const content = this.groupAndRenderWordDiffs(block.wordDiffs);
1758
1891
  return {
1759
- id: block.id || crypto.randomUUID(),
1892
+ id: block.id || v42(),
1760
1893
  type: block.type || "paragraph",
1761
1894
  props: block.props || {},
1762
1895
  content: Array.isArray(content) ? content : [],
@@ -2066,6 +2199,17 @@ function getValueFromPath(obj, path, userId) {
2066
2199
  }
2067
2200
  __name(getValueFromPath, "getValueFromPath");
2068
2201
 
2202
+ // src/features/auth/config.ts
2203
+ var _tokenHandler = null;
2204
+ function configureAuth(handler) {
2205
+ _tokenHandler = handler;
2206
+ }
2207
+ __name(configureAuth, "configureAuth");
2208
+ function getTokenHandler() {
2209
+ return _tokenHandler;
2210
+ }
2211
+ __name(getTokenHandler, "getTokenHandler");
2212
+
2069
2213
  // src/features/auth/data/auth.ts
2070
2214
  var Auth = class extends AbstractApiData {
2071
2215
  static {
@@ -2111,17 +2255,6 @@ var Auth = class extends AbstractApiData {
2111
2255
  }
2112
2256
  };
2113
2257
 
2114
- // src/features/auth/config.ts
2115
- var _tokenHandler = null;
2116
- function configureAuth(handler) {
2117
- _tokenHandler = handler;
2118
- }
2119
- __name(configureAuth, "configureAuth");
2120
- function getTokenHandler() {
2121
- return _tokenHandler;
2122
- }
2123
- __name(getTokenHandler, "getTokenHandler");
2124
-
2125
2258
  // src/features/auth/data/auth.service.ts
2126
2259
  var AuthService = class extends AbstractService {
2127
2260
  static {
@@ -2262,124 +2395,1475 @@ var AuthModule = /* @__PURE__ */ __name((factory) => factory({
2262
2395
  model: Auth
2263
2396
  }), "AuthModule");
2264
2397
 
2265
- // src/features/company/data/company.ts
2266
- var Company = class extends AbstractApiData {
2398
+ // src/features/billing/data/billing.service.ts
2399
+ var BillingService = class extends AbstractService {
2267
2400
  static {
2268
- __name(this, "Company");
2401
+ __name(this, "BillingService");
2269
2402
  }
2270
- _name;
2271
- _logo;
2272
- _logoUrl;
2273
- _configurations;
2274
- _licenseExpirationDate;
2275
- _features;
2276
- _modules;
2277
- get name() {
2278
- if (this._name === void 0) throw new Error("Name is not defined");
2279
- return this._name;
2403
+ // ============================================================================
2404
+ // Meter Methods (kept here for backwards compatibility)
2405
+ // ============================================================================
2406
+ /**
2407
+ * List all available usage meters
2408
+ * @deprecated Use StripeUsageService.listMeters() instead
2409
+ */
2410
+ static async listMeters(params) {
2411
+ const endpoint = new EndpointCreator({
2412
+ endpoint: Modules.StripeUsage,
2413
+ childEndpoint: "meters"
2414
+ });
2415
+ return this.callApi({
2416
+ type: Modules.StripeUsage,
2417
+ method: "GET" /* GET */,
2418
+ endpoint: endpoint.generate(),
2419
+ next: params?.next,
2420
+ previous: params?.prev
2421
+ });
2280
2422
  }
2281
- get logo() {
2282
- return this._logo;
2423
+ /**
2424
+ * Get meter summaries for a specific time period
2425
+ * @deprecated Use StripeUsageService.getMeterSummaries() instead
2426
+ */
2427
+ static async getMeterSummaries(params) {
2428
+ const endpoint = new EndpointCreator({
2429
+ endpoint: Modules.StripeUsage,
2430
+ childEndpoint: `meters/${params.meterId}/summaries`
2431
+ });
2432
+ endpoint.addAdditionalParam("startTime", params.startTime.toISOString());
2433
+ endpoint.addAdditionalParam("endTime", params.endTime.toISOString());
2434
+ return this.callApi({
2435
+ type: Modules.StripeUsage,
2436
+ method: "GET" /* GET */,
2437
+ endpoint: endpoint.generate()
2438
+ });
2283
2439
  }
2284
- get logoUrl() {
2285
- return this._logoUrl;
2440
+ };
2441
+
2442
+ // src/features/billing/data/Billing.ts
2443
+ var Billing = class extends AbstractApiData {
2444
+ static {
2445
+ __name(this, "Billing");
2286
2446
  }
2287
- get licenseExpirationDate() {
2288
- return this._licenseExpirationDate;
2447
+ rehydrate(data) {
2448
+ super.rehydrate(data);
2449
+ return this;
2289
2450
  }
2290
- get features() {
2291
- return this._features ?? [];
2451
+ createJsonApi(_data) {
2452
+ throw new Error("Billing is a namespace module and cannot be created");
2292
2453
  }
2293
- get modules() {
2294
- return this._modules ?? [];
2454
+ };
2455
+
2456
+ // src/features/billing/modules/billing.module.ts
2457
+ var BillingModule = /* @__PURE__ */ __name((factory) => factory({
2458
+ name: "billing",
2459
+ model: Billing,
2460
+ moduleId: "3266b307-5a9a-46f9-b78d-631f672f8735"
2461
+ }), "BillingModule");
2462
+
2463
+ // src/features/billing/stripe-customer/data/payment-method.ts
2464
+ var PaymentMethod = class extends AbstractApiData {
2465
+ static {
2466
+ __name(this, "PaymentMethod");
2295
2467
  }
2296
- get configurations() {
2297
- return this._configurations;
2468
+ _paymentType;
2469
+ _card;
2470
+ _billingDetails;
2471
+ get type() {
2472
+ if (!this._paymentType) throw new Error("type is not defined");
2473
+ return this._paymentType;
2474
+ }
2475
+ get card() {
2476
+ return this._card;
2477
+ }
2478
+ get billingDetails() {
2479
+ return this._billingDetails;
2298
2480
  }
2299
2481
  rehydrate(data) {
2300
2482
  super.rehydrate(data);
2301
- this._name = data.jsonApi.attributes.name;
2302
- this._configurations = data.jsonApi.attributes.configurations ? JSON.parse(data.jsonApi.attributes.configurations) : void 0;
2303
- this._logo = data.jsonApi.attributes.logo;
2304
- this._logoUrl = data.jsonApi.attributes.logoUrl;
2305
- this._licenseExpirationDate = data.jsonApi.attributes.licenseExpirationDate ? new Date(data.jsonApi.attributes.licenseExpirationDate) : void 0;
2306
- this._features = this._readIncluded(data, "features", Modules.Feature);
2307
- this._modules = this._readIncluded(data, "modules", Modules.Module);
2308
- return this;
2309
- }
2310
- createJsonApi(data) {
2311
- const response = {
2312
- data: {
2313
- type: Modules.Company.name,
2314
- id: data.id,
2315
- attributes: {},
2316
- meta: {},
2317
- relationships: {}
2318
- },
2319
- included: []
2320
- };
2321
- if (data.name) response.data.attributes.name = data.name;
2322
- if (data.configurations) response.data.attributes.configurations = JSON.stringify(data.configurations);
2323
- if (data.logo) response.data.attributes.logo = data.logo;
2324
- if (data.license) response.data.attributes.license = data.license;
2325
- if (data.privateKey) response.data.attributes.privateKey = data.privateKey;
2326
- if (data.featureIds && data.featureIds.length > 0) {
2327
- response.data.relationships.features = {
2328
- data: data.featureIds.map((featureId) => ({
2329
- type: Modules.Feature.name,
2330
- id: featureId
2331
- }))
2483
+ const attrs = data.jsonApi.attributes;
2484
+ this._paymentType = attrs.type;
2485
+ if (attrs.brand || attrs.last4 || attrs.expMonth || attrs.expYear) {
2486
+ this._card = {
2487
+ brand: attrs.brand,
2488
+ last4: attrs.last4,
2489
+ expMonth: attrs.expMonth,
2490
+ expYear: attrs.expYear
2332
2491
  };
2333
2492
  }
2334
- if (data.moduleIds && data.moduleIds.length > 0) {
2335
- response.data.relationships.modules = {
2336
- data: data.moduleIds.map((moduleId) => ({
2337
- type: Modules.Module.name,
2338
- id: moduleId
2339
- }))
2493
+ const hasAddress = attrs.billingAddressCity || attrs.billingAddressCountry || attrs.billingAddressLine1 || attrs.billingAddressLine2 || attrs.billingAddressPostalCode || attrs.billingAddressState;
2494
+ const hasBillingDetails = attrs.billingName || attrs.billingEmail || attrs.billingPhone || hasAddress;
2495
+ if (hasBillingDetails) {
2496
+ this._billingDetails = {
2497
+ name: attrs.billingName ?? void 0,
2498
+ email: attrs.billingEmail ?? void 0,
2499
+ phone: attrs.billingPhone ?? void 0
2340
2500
  };
2501
+ if (hasAddress) {
2502
+ this._billingDetails.address = {
2503
+ city: attrs.billingAddressCity ?? void 0,
2504
+ country: attrs.billingAddressCountry ?? void 0,
2505
+ line1: attrs.billingAddressLine1 ?? void 0,
2506
+ line2: attrs.billingAddressLine2 ?? void 0,
2507
+ postalCode: attrs.billingAddressPostalCode ?? void 0,
2508
+ state: attrs.billingAddressState ?? void 0
2509
+ };
2510
+ }
2341
2511
  }
2342
- return response;
2512
+ return this;
2513
+ }
2514
+ createJsonApi(_data) {
2515
+ throw new Error("PaymentMethod is managed by Stripe and cannot be created directly");
2343
2516
  }
2344
2517
  };
2345
2518
 
2346
- // src/features/company/data/company.fields.ts
2347
- var CompanyFields = /* @__PURE__ */ ((CompanyFields2) => {
2348
- CompanyFields2["companyId"] = "companyId";
2349
- CompanyFields2["name"] = "name";
2350
- CompanyFields2["createdAt"] = "createdAt";
2351
- CompanyFields2["updatedAt"] = "updatedAt";
2352
- return CompanyFields2;
2353
- })(CompanyFields || {});
2354
-
2355
- // src/features/company/data/company.service.ts
2356
- var CompanyService = class extends AbstractService {
2519
+ // src/features/billing/stripe-customer/data/stripe-customer.ts
2520
+ var StripeCustomer = class extends AbstractApiData {
2357
2521
  static {
2358
- __name(this, "CompanyService");
2359
- }
2360
- static async findOne(params) {
2361
- return this.callApi({
2362
- type: Modules.Company,
2363
- method: "GET" /* GET */,
2364
- endpoint: new EndpointCreator({ endpoint: Modules.Company, id: params.companyId }).generate()
2365
- });
2522
+ __name(this, "StripeCustomer");
2366
2523
  }
2367
- static async findMany(params) {
2368
- const endpoint = new EndpointCreator({ endpoint: Modules.Company });
2369
- if (params.search) endpoint.addAdditionalParam("search", params.search);
2370
- return this.callApi({
2371
- type: Modules.Company,
2372
- method: "GET" /* GET */,
2373
- endpoint: endpoint.generate(),
2374
- next: params.next
2375
- });
2524
+ _stripeCustomerId;
2525
+ _email;
2526
+ _name;
2527
+ _defaultPaymentMethodId;
2528
+ _currency;
2529
+ _balance;
2530
+ _delinquent = false;
2531
+ _metadata;
2532
+ get stripeCustomerId() {
2533
+ if (!this._stripeCustomerId) throw new Error("stripeCustomerId is not defined");
2534
+ return this._stripeCustomerId;
2376
2535
  }
2377
- static async delete(params) {
2378
- await this.callApi({
2379
- type: Modules.Company,
2380
- method: "DELETE" /* DELETE */,
2381
- endpoint: new EndpointCreator({ endpoint: Modules.Company, id: params.companyId }).generate()
2382
- });
2536
+ get email() {
2537
+ return this._email;
2538
+ }
2539
+ get name() {
2540
+ return this._name;
2541
+ }
2542
+ get defaultPaymentMethodId() {
2543
+ return this._defaultPaymentMethodId;
2544
+ }
2545
+ get currency() {
2546
+ return this._currency;
2547
+ }
2548
+ get balance() {
2549
+ return this._balance;
2550
+ }
2551
+ get delinquent() {
2552
+ return this._delinquent;
2553
+ }
2554
+ get metadata() {
2555
+ return this._metadata;
2556
+ }
2557
+ rehydrate(data) {
2558
+ super.rehydrate(data);
2559
+ this._stripeCustomerId = data.jsonApi.attributes.stripeCustomerId;
2560
+ this._email = data.jsonApi.attributes.email;
2561
+ this._name = data.jsonApi.attributes.name;
2562
+ this._defaultPaymentMethodId = data.jsonApi.attributes.defaultPaymentMethodId;
2563
+ this._currency = data.jsonApi.attributes.currency;
2564
+ this._balance = data.jsonApi.attributes.balance;
2565
+ this._delinquent = data.jsonApi.attributes.delinquent ?? false;
2566
+ this._metadata = data.jsonApi.attributes.metadata ? typeof data.jsonApi.attributes.metadata === "string" ? JSON.parse(data.jsonApi.attributes.metadata) : data.jsonApi.attributes.metadata : void 0;
2567
+ return this;
2568
+ }
2569
+ createJsonApi(_data) {
2570
+ throw new Error("BillingCustomer is managed by Stripe and cannot be created directly");
2571
+ }
2572
+ };
2573
+
2574
+ // src/features/billing/stripe-customer/data/stripe-customer.service.ts
2575
+ var StripeCustomerService = class extends AbstractService {
2576
+ static {
2577
+ __name(this, "StripeCustomerService");
2578
+ }
2579
+ // ============================================================================
2580
+ // Customer Methods
2581
+ // ============================================================================
2582
+ /**
2583
+ * Get the current user's billing customer record
2584
+ */
2585
+ static async getCustomer() {
2586
+ const endpoint = new EndpointCreator({
2587
+ endpoint: Modules.StripeCustomer
2588
+ });
2589
+ return this.callApi({
2590
+ type: Modules.StripeCustomer,
2591
+ method: "GET" /* GET */,
2592
+ endpoint: endpoint.generate()
2593
+ });
2594
+ }
2595
+ /**
2596
+ * Create a billing customer for the current user
2597
+ */
2598
+ static async createCustomer() {
2599
+ const endpoint = new EndpointCreator({
2600
+ endpoint: Modules.StripeCustomer
2601
+ });
2602
+ return this.callApi({
2603
+ type: Modules.StripeCustomer,
2604
+ method: "POST" /* POST */,
2605
+ endpoint: endpoint.generate()
2606
+ });
2607
+ }
2608
+ /**
2609
+ * Create a setup intent for adding payment methods
2610
+ */
2611
+ static async createSetupIntent() {
2612
+ const endpoint = new EndpointCreator({
2613
+ endpoint: Modules.Billing,
2614
+ childEndpoint: "setup-intent"
2615
+ });
2616
+ return this.callApi({
2617
+ type: Modules.Billing,
2618
+ method: "POST" /* POST */,
2619
+ endpoint: endpoint.generate()
2620
+ });
2621
+ }
2622
+ /**
2623
+ * Create a Stripe customer portal session URL
2624
+ */
2625
+ static async createPortalSession() {
2626
+ const endpoint = new EndpointCreator({
2627
+ endpoint: Modules.Billing,
2628
+ childEndpoint: "customers/portal-session"
2629
+ });
2630
+ return this.callApi({
2631
+ type: Modules.Billing,
2632
+ method: "POST" /* POST */,
2633
+ endpoint: endpoint.generate()
2634
+ });
2635
+ }
2636
+ // ============================================================================
2637
+ // Payment Method Methods
2638
+ // ============================================================================
2639
+ /**
2640
+ * List all payment methods for the current user
2641
+ */
2642
+ static async listPaymentMethods(params) {
2643
+ const endpoint = new EndpointCreator({
2644
+ endpoint: Modules.StripeCustomer,
2645
+ childEndpoint: "payment-methods"
2646
+ });
2647
+ return this.callApi({
2648
+ type: Modules.StripePaymentMethod,
2649
+ method: "GET" /* GET */,
2650
+ endpoint: endpoint.generate(),
2651
+ next: params?.next,
2652
+ previous: params?.prev
2653
+ });
2654
+ }
2655
+ /**
2656
+ * Set the default payment method for the current user
2657
+ */
2658
+ static async setDefaultPaymentMethod(params) {
2659
+ const endpoint = new EndpointCreator({
2660
+ endpoint: Modules.StripeCustomer,
2661
+ childEndpoint: `payment-methods/${params.paymentMethodId}/default`
2662
+ });
2663
+ return this.callApi({
2664
+ type: Modules.StripeCustomer,
2665
+ method: "POST" /* POST */,
2666
+ endpoint: endpoint.generate()
2667
+ });
2668
+ }
2669
+ /**
2670
+ * Remove a payment method
2671
+ */
2672
+ static async removePaymentMethod(params) {
2673
+ const endpoint = new EndpointCreator({
2674
+ endpoint: Modules.StripeCustomer,
2675
+ childEndpoint: `payment-methods/${params.paymentMethodId}`
2676
+ });
2677
+ await this.callApi({
2678
+ type: Modules.StripeCustomer,
2679
+ method: "DELETE" /* DELETE */,
2680
+ endpoint: endpoint.generate()
2681
+ });
2682
+ }
2683
+ };
2684
+
2685
+ // src/features/billing/stripe-customer/stripe-customer.module.ts
2686
+ var StripeCustomerModule = /* @__PURE__ */ __name((factory) => factory({
2687
+ name: "stripe-customers",
2688
+ model: StripeCustomer,
2689
+ moduleId: "25a80cb3-bf18-47fd-963a-639212519920"
2690
+ }), "StripeCustomerModule");
2691
+
2692
+ // src/features/billing/stripe-customer/stripe-payment-method.module.ts
2693
+ var StripePaymentMethodModule = /* @__PURE__ */ __name((factory) => factory({
2694
+ name: "stripe-payment-methods",
2695
+ model: PaymentMethod,
2696
+ moduleId: "e8f7d6c5-b4a3-4928-8170-1f2e3d4c5b6a"
2697
+ }), "StripePaymentMethodModule");
2698
+
2699
+ // src/features/billing/stripe-invoice/data/stripe-invoice.ts
2700
+ var StripeInvoice = class extends AbstractApiData {
2701
+ static {
2702
+ __name(this, "StripeInvoice");
2703
+ }
2704
+ _stripeInvoiceId;
2705
+ _stripeInvoiceNumber;
2706
+ _customerId;
2707
+ _subscriptionId;
2708
+ _subscription;
2709
+ _status;
2710
+ _amountDue;
2711
+ _amountPaid;
2712
+ _amountRemaining;
2713
+ _subtotal;
2714
+ _total;
2715
+ _tax;
2716
+ _currency;
2717
+ _periodStart;
2718
+ _periodEnd;
2719
+ _dueDate;
2720
+ _paidAt;
2721
+ _attemptCount = 0;
2722
+ _attempted = false;
2723
+ _stripeHostedInvoiceUrl;
2724
+ _stripePdfUrl;
2725
+ _paid = false;
2726
+ _metadata;
2727
+ get stripeInvoiceId() {
2728
+ if (!this._stripeInvoiceId) throw new Error("stripeInvoiceId is not defined");
2729
+ return this._stripeInvoiceId;
2730
+ }
2731
+ get stripeInvoiceNumber() {
2732
+ return this._stripeInvoiceNumber;
2733
+ }
2734
+ get customerId() {
2735
+ return this._customerId;
2736
+ }
2737
+ get subscriptionId() {
2738
+ return this._subscriptionId;
2739
+ }
2740
+ get subscription() {
2741
+ return this._subscription;
2742
+ }
2743
+ get status() {
2744
+ if (!this._status) throw new Error("status is not defined");
2745
+ return this._status;
2746
+ }
2747
+ get amountDue() {
2748
+ if (this._amountDue === void 0) throw new Error("amountDue is not defined");
2749
+ return this._amountDue;
2750
+ }
2751
+ get amountPaid() {
2752
+ if (this._amountPaid === void 0) throw new Error("amountPaid is not defined");
2753
+ return this._amountPaid;
2754
+ }
2755
+ get amountRemaining() {
2756
+ if (this._amountRemaining === void 0) throw new Error("amountRemaining is not defined");
2757
+ return this._amountRemaining;
2758
+ }
2759
+ get subtotal() {
2760
+ if (this._subtotal === void 0) throw new Error("subtotal is not defined");
2761
+ return this._subtotal;
2762
+ }
2763
+ get total() {
2764
+ if (this._total === void 0) throw new Error("total is not defined");
2765
+ return this._total;
2766
+ }
2767
+ get tax() {
2768
+ return this._tax;
2769
+ }
2770
+ get currency() {
2771
+ if (!this._currency) throw new Error("currency is not defined");
2772
+ return this._currency;
2773
+ }
2774
+ get periodStart() {
2775
+ if (!this._periodStart) throw new Error("periodStart is not defined");
2776
+ return this._periodStart;
2777
+ }
2778
+ get periodEnd() {
2779
+ if (!this._periodEnd) throw new Error("periodEnd is not defined");
2780
+ return this._periodEnd;
2781
+ }
2782
+ get dueDate() {
2783
+ return this._dueDate;
2784
+ }
2785
+ get paidAt() {
2786
+ return this._paidAt;
2787
+ }
2788
+ get attemptCount() {
2789
+ return this._attemptCount;
2790
+ }
2791
+ get attempted() {
2792
+ return this._attempted;
2793
+ }
2794
+ get stripeHostedInvoiceUrl() {
2795
+ return this._stripeHostedInvoiceUrl;
2796
+ }
2797
+ get stripePdfUrl() {
2798
+ return this._stripePdfUrl;
2799
+ }
2800
+ get paid() {
2801
+ return this._paid;
2802
+ }
2803
+ get metadata() {
2804
+ return this._metadata;
2805
+ }
2806
+ rehydrate(data) {
2807
+ super.rehydrate(data);
2808
+ this._stripeInvoiceId = data.jsonApi.attributes.stripeInvoiceId;
2809
+ this._stripeInvoiceNumber = data.jsonApi.attributes.stripeInvoiceNumber;
2810
+ this._customerId = data.jsonApi.attributes.customerId;
2811
+ this._subscriptionId = data.jsonApi.attributes.subscriptionId;
2812
+ this._status = data.jsonApi.attributes.status;
2813
+ this._amountDue = data.jsonApi.attributes.amountDue;
2814
+ this._amountPaid = data.jsonApi.attributes.amountPaid;
2815
+ this._amountRemaining = data.jsonApi.attributes.amountRemaining;
2816
+ this._subtotal = data.jsonApi.attributes.subtotal;
2817
+ this._total = data.jsonApi.attributes.total;
2818
+ this._tax = data.jsonApi.attributes.tax;
2819
+ this._currency = data.jsonApi.attributes.currency;
2820
+ this._periodStart = data.jsonApi.attributes.periodStart ? new Date(data.jsonApi.attributes.periodStart) : void 0;
2821
+ this._periodEnd = data.jsonApi.attributes.periodEnd ? new Date(data.jsonApi.attributes.periodEnd) : void 0;
2822
+ this._dueDate = data.jsonApi.attributes.dueDate ? new Date(data.jsonApi.attributes.dueDate) : void 0;
2823
+ this._paidAt = data.jsonApi.attributes.paidAt ? new Date(data.jsonApi.attributes.paidAt) : void 0;
2824
+ this._attemptCount = data.jsonApi.attributes.attemptCount ?? 0;
2825
+ this._attempted = data.jsonApi.attributes.attempted ?? false;
2826
+ this._stripeHostedInvoiceUrl = data.jsonApi.attributes.stripeHostedInvoiceUrl;
2827
+ this._stripePdfUrl = data.jsonApi.attributes.stripePdfUrl;
2828
+ this._paid = data.jsonApi.attributes.paid ?? false;
2829
+ this._metadata = data.jsonApi.attributes.metadata ? typeof data.jsonApi.attributes.metadata === "string" ? JSON.parse(data.jsonApi.attributes.metadata) : data.jsonApi.attributes.metadata : void 0;
2830
+ this._subscription = this._readIncluded(
2831
+ data,
2832
+ "subscription",
2833
+ Modules.StripeSubscription
2834
+ );
2835
+ return this;
2836
+ }
2837
+ createJsonApi(_data) {
2838
+ throw new Error("Invoice is managed by Stripe and cannot be created directly");
2839
+ }
2840
+ };
2841
+
2842
+ // src/features/billing/stripe-invoice/data/stripe-invoice.interface.ts
2843
+ var InvoiceStatus = /* @__PURE__ */ ((InvoiceStatus2) => {
2844
+ InvoiceStatus2["DRAFT"] = "draft";
2845
+ InvoiceStatus2["OPEN"] = "open";
2846
+ InvoiceStatus2["PAID"] = "paid";
2847
+ InvoiceStatus2["UNCOLLECTIBLE"] = "uncollectible";
2848
+ InvoiceStatus2["VOID"] = "void";
2849
+ return InvoiceStatus2;
2850
+ })(InvoiceStatus || {});
2851
+
2852
+ // src/features/billing/stripe-invoice/data/stripe-invoice.service.ts
2853
+ var StripeInvoiceService = class extends AbstractService {
2854
+ static {
2855
+ __name(this, "StripeInvoiceService");
2856
+ }
2857
+ /**
2858
+ * List all invoices for the current user
2859
+ */
2860
+ static async listInvoices(params) {
2861
+ const endpoint = new EndpointCreator({
2862
+ endpoint: Modules.StripeInvoice
2863
+ });
2864
+ if (params?.status) {
2865
+ endpoint.addAdditionalParam("status", params.status);
2866
+ }
2867
+ return this.callApi({
2868
+ type: Modules.StripeInvoice,
2869
+ method: "GET" /* GET */,
2870
+ endpoint: endpoint.generate(),
2871
+ next: params?.next,
2872
+ previous: params?.prev
2873
+ });
2874
+ }
2875
+ /**
2876
+ * Get a specific invoice by ID
2877
+ */
2878
+ static async getInvoice(params) {
2879
+ const endpoint = new EndpointCreator({
2880
+ endpoint: Modules.StripeInvoice,
2881
+ id: params.invoiceId
2882
+ });
2883
+ return this.callApi({
2884
+ type: Modules.StripeInvoice,
2885
+ method: "GET" /* GET */,
2886
+ endpoint: endpoint.generate()
2887
+ });
2888
+ }
2889
+ /**
2890
+ * Get the upcoming invoice for the current user
2891
+ */
2892
+ static async getUpcomingInvoice() {
2893
+ const endpoint = new EndpointCreator({
2894
+ endpoint: Modules.StripeInvoice,
2895
+ id: "upcoming"
2896
+ });
2897
+ return this.callApi({
2898
+ type: Modules.StripeInvoice,
2899
+ method: "GET" /* GET */,
2900
+ endpoint: endpoint.generate()
2901
+ });
2902
+ }
2903
+ };
2904
+
2905
+ // src/features/billing/stripe-invoice/stripe-invoice.module.ts
2906
+ var StripeInvoiceModule = /* @__PURE__ */ __name((factory) => factory({
2907
+ name: "stripe-invoices",
2908
+ model: StripeInvoice,
2909
+ moduleId: "37c73b8b-d3b1-4e5e-8fcb-a66d8ecfc05b"
2910
+ }), "StripeInvoiceModule");
2911
+
2912
+ // src/features/billing/stripe-price/data/stripe-price.ts
2913
+ var StripePrice = class extends AbstractApiData {
2914
+ static {
2915
+ __name(this, "StripePrice");
2916
+ }
2917
+ _stripePriceId;
2918
+ _productId;
2919
+ _product;
2920
+ _active = true;
2921
+ _currency;
2922
+ _unitAmount;
2923
+ _recurring;
2924
+ _priceType;
2925
+ _nickname;
2926
+ _lookupKey;
2927
+ _metadata;
2928
+ _description;
2929
+ _features;
2930
+ get stripePriceId() {
2931
+ if (!this._stripePriceId) throw new Error("stripePriceId is not defined");
2932
+ return this._stripePriceId;
2933
+ }
2934
+ get productId() {
2935
+ if (!this._productId) throw new Error("productId is not defined");
2936
+ return this._productId;
2937
+ }
2938
+ get product() {
2939
+ return this._product;
2940
+ }
2941
+ get active() {
2942
+ return this._active;
2943
+ }
2944
+ get currency() {
2945
+ if (!this._currency) throw new Error("currency is not defined");
2946
+ return this._currency;
2947
+ }
2948
+ get unitAmount() {
2949
+ return this._unitAmount;
2950
+ }
2951
+ get recurring() {
2952
+ return this._recurring;
2953
+ }
2954
+ get priceType() {
2955
+ if (!this._priceType) throw new Error("priceType is not defined");
2956
+ return this._priceType;
2957
+ }
2958
+ get nickname() {
2959
+ return this._nickname;
2960
+ }
2961
+ get lookupKey() {
2962
+ return this._lookupKey;
2963
+ }
2964
+ get metadata() {
2965
+ return this._metadata;
2966
+ }
2967
+ get description() {
2968
+ return this._description;
2969
+ }
2970
+ get features() {
2971
+ return this._features;
2972
+ }
2973
+ rehydrate(data) {
2974
+ super.rehydrate(data);
2975
+ this._stripePriceId = data.jsonApi.attributes.stripePriceId;
2976
+ this._productId = data.jsonApi.attributes.productId;
2977
+ this._active = data.jsonApi.attributes.active ?? true;
2978
+ this._currency = data.jsonApi.attributes.currency;
2979
+ this._unitAmount = data.jsonApi.attributes.unitAmount;
2980
+ this._priceType = data.jsonApi.attributes.priceType;
2981
+ if (data.jsonApi.attributes.recurringInterval) {
2982
+ this._recurring = {
2983
+ interval: data.jsonApi.attributes.recurringInterval,
2984
+ intervalCount: data.jsonApi.attributes.recurringIntervalCount ?? 1,
2985
+ usageType: data.jsonApi.attributes.recurringUsageType
2986
+ };
2987
+ }
2988
+ this._nickname = data.jsonApi.attributes.nickname;
2989
+ this._lookupKey = data.jsonApi.attributes.lookupKey;
2990
+ this._metadata = data.jsonApi.attributes.metadata ? typeof data.jsonApi.attributes.metadata === "string" ? JSON.parse(data.jsonApi.attributes.metadata) : data.jsonApi.attributes.metadata : void 0;
2991
+ this._description = data.jsonApi.attributes.description;
2992
+ this._features = data.jsonApi.attributes.features ? typeof data.jsonApi.attributes.features === "string" ? JSON.parse(data.jsonApi.attributes.features) : data.jsonApi.attributes.features : void 0;
2993
+ this._product = this._readIncluded(data, "product", Modules.StripeProduct);
2994
+ return this;
2995
+ }
2996
+ createJsonApi(data) {
2997
+ const response = {
2998
+ data: {
2999
+ type: Modules.StripePrice.name,
3000
+ id: data.id,
3001
+ attributes: {}
3002
+ }
3003
+ };
3004
+ if ("productId" in data && data.productId) {
3005
+ response.data.attributes.productId = data.productId;
3006
+ }
3007
+ if ("currency" in data && data.currency) {
3008
+ response.data.attributes.currency = data.currency;
3009
+ }
3010
+ if ("unitAmount" in data && data.unitAmount !== void 0) {
3011
+ response.data.attributes.unitAmount = data.unitAmount;
3012
+ }
3013
+ if ("active" in data && data.active !== void 0) {
3014
+ response.data.attributes.active = data.active;
3015
+ }
3016
+ if ("nickname" in data && data.nickname !== void 0) {
3017
+ response.data.attributes.nickname = data.nickname;
3018
+ }
3019
+ if ("metadata" in data && data.metadata) {
3020
+ response.data.attributes.metadata = data.metadata;
3021
+ }
3022
+ if ("recurring" in data && data.recurring) {
3023
+ response.data.attributes.recurring = data.recurring;
3024
+ }
3025
+ if ("description" in data && data.description !== void 0) {
3026
+ response.data.attributes.description = data.description;
3027
+ }
3028
+ if ("features" in data && data.features !== void 0) {
3029
+ response.data.attributes.features = JSON.stringify(data.features);
3030
+ }
3031
+ return response;
3032
+ }
3033
+ };
3034
+
3035
+ // src/features/billing/stripe-price/data/stripe-price.service.ts
3036
+ var StripePriceService = class extends AbstractService {
3037
+ static {
3038
+ __name(this, "StripePriceService");
3039
+ }
3040
+ /**
3041
+ * List all prices (admin)
3042
+ */
3043
+ static async listPrices(params) {
3044
+ const endpoint = new EndpointCreator({
3045
+ endpoint: Modules.StripePrice
3046
+ });
3047
+ if (params?.productId) {
3048
+ endpoint.addAdditionalParam("productId", params.productId);
3049
+ }
3050
+ if (params?.active !== void 0) {
3051
+ endpoint.addAdditionalParam("active", params.active.toString());
3052
+ }
3053
+ return this.callApi({
3054
+ type: Modules.StripePrice,
3055
+ method: "GET" /* GET */,
3056
+ endpoint: endpoint.generate(),
3057
+ next: params?.next,
3058
+ previous: params?.prev
3059
+ });
3060
+ }
3061
+ /**
3062
+ * Get a specific price by ID (admin)
3063
+ */
3064
+ static async getPrice(params) {
3065
+ const endpoint = new EndpointCreator({
3066
+ endpoint: Modules.StripePrice,
3067
+ id: params.id
3068
+ });
3069
+ return this.callApi({
3070
+ type: Modules.StripePrice,
3071
+ method: "GET" /* GET */,
3072
+ endpoint: endpoint.generate()
3073
+ });
3074
+ }
3075
+ /**
3076
+ * Create a new price (admin)
3077
+ */
3078
+ static async createPrice(params) {
3079
+ const endpoint = new EndpointCreator({
3080
+ endpoint: Modules.StripePrice
3081
+ });
3082
+ return this.callApi({
3083
+ type: Modules.StripePrice,
3084
+ method: "POST" /* POST */,
3085
+ endpoint: endpoint.generate(),
3086
+ input: params
3087
+ });
3088
+ }
3089
+ /**
3090
+ * Update an existing price (admin)
3091
+ */
3092
+ static async updatePrice(params) {
3093
+ const endpoint = new EndpointCreator({
3094
+ endpoint: Modules.StripePrice,
3095
+ id: params.id
3096
+ });
3097
+ return this.callApi({
3098
+ type: Modules.StripePrice,
3099
+ method: "PUT" /* PUT */,
3100
+ endpoint: endpoint.generate(),
3101
+ input: params
3102
+ });
3103
+ }
3104
+ /**
3105
+ * Archive a price (admin)
3106
+ *
3107
+ * Sets the price as inactive. Archived prices cannot be used for new subscriptions.
3108
+ */
3109
+ static async archivePrice(params) {
3110
+ const endpoint = new EndpointCreator({
3111
+ endpoint: Modules.StripePrice,
3112
+ id: params.id,
3113
+ childEndpoint: "archive"
3114
+ });
3115
+ await this.callApi({
3116
+ type: Modules.StripePrice,
3117
+ method: "POST" /* POST */,
3118
+ endpoint: endpoint.generate()
3119
+ });
3120
+ }
3121
+ /**
3122
+ * Reactivate a price (admin)
3123
+ *
3124
+ * Sets the price as active. Active prices can be used for new subscriptions.
3125
+ */
3126
+ static async reactivatePrice(params) {
3127
+ const endpoint = new EndpointCreator({
3128
+ endpoint: Modules.StripePrice,
3129
+ id: params.id,
3130
+ childEndpoint: "archive"
3131
+ });
3132
+ await this.callApi({
3133
+ type: Modules.StripePrice,
3134
+ method: "DELETE" /* DELETE */,
3135
+ endpoint: endpoint.generate()
3136
+ });
3137
+ }
3138
+ };
3139
+
3140
+ // src/features/billing/stripe-price/stripe-price.module.ts
3141
+ var StripePriceModule = /* @__PURE__ */ __name((factory) => factory({
3142
+ name: "stripe-prices",
3143
+ model: StripePrice,
3144
+ moduleId: "a7d3e5f1-8c9b-4a2e-b6d7-3f1c8e9a4b5d"
3145
+ }), "StripePriceModule");
3146
+
3147
+ // src/features/billing/stripe-product/data/stripe-product.ts
3148
+ var StripeProduct = class extends AbstractApiData {
3149
+ static {
3150
+ __name(this, "StripeProduct");
3151
+ }
3152
+ _stripeProductId;
3153
+ _name;
3154
+ _description;
3155
+ _active = true;
3156
+ _metadata;
3157
+ _stripePrices = [];
3158
+ get stripeProductId() {
3159
+ if (!this._stripeProductId) throw new Error("stripeProductId is not defined");
3160
+ return this._stripeProductId;
3161
+ }
3162
+ get name() {
3163
+ if (!this._name) throw new Error("name is not defined");
3164
+ return this._name;
3165
+ }
3166
+ get description() {
3167
+ return this._description;
3168
+ }
3169
+ get active() {
3170
+ return this._active;
3171
+ }
3172
+ get metadata() {
3173
+ return this._metadata;
3174
+ }
3175
+ get stripePrices() {
3176
+ return this._stripePrices ?? [];
3177
+ }
3178
+ rehydrate(data) {
3179
+ super.rehydrate(data);
3180
+ this._stripeProductId = data.jsonApi.attributes.stripeProductId;
3181
+ this._name = data.jsonApi.attributes.name;
3182
+ this._description = data.jsonApi.attributes.description;
3183
+ this._active = data.jsonApi.attributes.active ?? true;
3184
+ this._metadata = data.jsonApi.attributes.metadata ? typeof data.jsonApi.attributes.metadata === "string" ? JSON.parse(data.jsonApi.attributes.metadata) : data.jsonApi.attributes.metadata : void 0;
3185
+ this._stripePrices = this._readIncluded(data, "stripePrices", Modules.StripePrice);
3186
+ return this;
3187
+ }
3188
+ createJsonApi(data) {
3189
+ const response = {
3190
+ data: {
3191
+ type: Modules.StripeProduct.name,
3192
+ id: data.id,
3193
+ attributes: {}
3194
+ }
3195
+ };
3196
+ if (data.name) response.data.attributes.name = data.name;
3197
+ if (data.description !== void 0) response.data.attributes.description = data.description;
3198
+ if (data.active !== void 0) response.data.attributes.active = data.active;
3199
+ if (data.metadata) response.data.attributes.metadata = data.metadata;
3200
+ return response;
3201
+ }
3202
+ };
3203
+
3204
+ // src/features/billing/stripe-product/data/stripe-product.service.ts
3205
+ var StripeProductService = class extends AbstractService {
3206
+ static {
3207
+ __name(this, "StripeProductService");
3208
+ }
3209
+ /**
3210
+ * List all products (admin)
3211
+ */
3212
+ static async listProducts(params) {
3213
+ const endpoint = new EndpointCreator({
3214
+ endpoint: Modules.StripeProduct
3215
+ });
3216
+ if (params?.active !== void 0) {
3217
+ endpoint.addAdditionalParam("active", params.active.toString());
3218
+ }
3219
+ return this.callApi({
3220
+ type: Modules.StripeProduct,
3221
+ method: "GET" /* GET */,
3222
+ endpoint: endpoint.generate(),
3223
+ next: params?.next,
3224
+ previous: params?.prev
3225
+ });
3226
+ }
3227
+ /**
3228
+ * Get a specific product by ID (admin)
3229
+ */
3230
+ static async getProduct(params) {
3231
+ const endpoint = new EndpointCreator({
3232
+ endpoint: Modules.StripeProduct,
3233
+ id: params.id
3234
+ });
3235
+ return this.callApi({
3236
+ type: Modules.StripeProduct,
3237
+ method: "GET" /* GET */,
3238
+ endpoint: endpoint.generate()
3239
+ });
3240
+ }
3241
+ /**
3242
+ * Create a new product (admin)
3243
+ */
3244
+ static async createProduct(params) {
3245
+ const endpoint = new EndpointCreator({
3246
+ endpoint: Modules.StripeProduct
3247
+ });
3248
+ return this.callApi({
3249
+ type: Modules.StripeProduct,
3250
+ method: "POST" /* POST */,
3251
+ endpoint: endpoint.generate(),
3252
+ input: params
3253
+ });
3254
+ }
3255
+ /**
3256
+ * Update an existing product (admin)
3257
+ */
3258
+ static async updateProduct(params) {
3259
+ const endpoint = new EndpointCreator({
3260
+ endpoint: Modules.StripeProduct,
3261
+ id: params.id
3262
+ });
3263
+ return this.callApi({
3264
+ type: Modules.StripeProduct,
3265
+ method: "PUT" /* PUT */,
3266
+ endpoint: endpoint.generate(),
3267
+ input: params
3268
+ });
3269
+ }
3270
+ /**
3271
+ * Archive a product (admin)
3272
+ */
3273
+ static async archiveProduct(params) {
3274
+ const endpoint = new EndpointCreator({
3275
+ endpoint: Modules.StripeProduct,
3276
+ id: params.id,
3277
+ childEndpoint: "archive"
3278
+ });
3279
+ return this.callApi({
3280
+ type: Modules.StripeProduct,
3281
+ method: "POST" /* POST */,
3282
+ endpoint: endpoint.generate()
3283
+ });
3284
+ }
3285
+ /**
3286
+ * Reactivate a product (admin) - sets active to true
3287
+ */
3288
+ static async reactivateProduct(params) {
3289
+ const endpoint = new EndpointCreator({
3290
+ endpoint: Modules.StripeProduct,
3291
+ id: params.id,
3292
+ childEndpoint: "archive"
3293
+ });
3294
+ return this.callApi({
3295
+ type: Modules.StripeProduct,
3296
+ method: "DELETE" /* DELETE */,
3297
+ endpoint: endpoint.generate()
3298
+ });
3299
+ }
3300
+ };
3301
+
3302
+ // src/features/billing/stripe-product/stripe-product.module.ts
3303
+ var StripeProductModule = /* @__PURE__ */ __name((factory) => factory({
3304
+ name: "stripe-products",
3305
+ model: StripeProduct,
3306
+ moduleId: "f8c4a1e9-3b2d-4f7a-9e5c-1d8a6b3c9f2e"
3307
+ }), "StripeProductModule");
3308
+
3309
+ // src/features/billing/stripe-subscription/data/stripe-subscription.ts
3310
+ var StripeSubscription = class extends AbstractApiData {
3311
+ static {
3312
+ __name(this, "StripeSubscription");
3313
+ }
3314
+ _stripeSubscriptionId;
3315
+ _status;
3316
+ _currentPeriodStart;
3317
+ _currentPeriodEnd;
3318
+ _cancelAtPeriodEnd = false;
3319
+ _canceledAt;
3320
+ _trialStart;
3321
+ _trialEnd;
3322
+ _price;
3323
+ get stripeSubscriptionId() {
3324
+ if (!this._stripeSubscriptionId) throw new Error("stripeSubscriptionId is not defined");
3325
+ return this._stripeSubscriptionId;
3326
+ }
3327
+ get status() {
3328
+ if (!this._status) throw new Error("status is not defined");
3329
+ return this._status;
3330
+ }
3331
+ get currentPeriodStart() {
3332
+ if (!this._currentPeriodStart) throw new Error("currentPeriodStart is not defined");
3333
+ return this._currentPeriodStart;
3334
+ }
3335
+ get currentPeriodEnd() {
3336
+ if (!this._currentPeriodEnd) throw new Error("currentPeriodEnd is not defined");
3337
+ return this._currentPeriodEnd;
3338
+ }
3339
+ get cancelAtPeriodEnd() {
3340
+ return this._cancelAtPeriodEnd;
3341
+ }
3342
+ get canceledAt() {
3343
+ return this._canceledAt;
3344
+ }
3345
+ get trialStart() {
3346
+ return this._trialStart;
3347
+ }
3348
+ get trialEnd() {
3349
+ return this._trialEnd;
3350
+ }
3351
+ get price() {
3352
+ return this._price;
3353
+ }
3354
+ rehydrate(data) {
3355
+ super.rehydrate(data);
3356
+ this._stripeSubscriptionId = data.jsonApi.attributes.stripeSubscriptionId;
3357
+ this._status = data.jsonApi.attributes.status;
3358
+ this._currentPeriodStart = data.jsonApi.attributes.currentPeriodStart ? new Date(data.jsonApi.attributes.currentPeriodStart) : void 0;
3359
+ this._currentPeriodEnd = data.jsonApi.attributes.currentPeriodEnd ? new Date(data.jsonApi.attributes.currentPeriodEnd) : void 0;
3360
+ this._cancelAtPeriodEnd = data.jsonApi.attributes.cancelAtPeriodEnd ?? false;
3361
+ this._canceledAt = data.jsonApi.attributes.canceledAt ? new Date(data.jsonApi.attributes.canceledAt) : void 0;
3362
+ this._trialStart = data.jsonApi.attributes.trialStart ? new Date(data.jsonApi.attributes.trialStart) : void 0;
3363
+ this._trialEnd = data.jsonApi.attributes.trialEnd ? new Date(data.jsonApi.attributes.trialEnd) : void 0;
3364
+ this._price = this._readIncluded(data, "price", Modules.StripePrice);
3365
+ return this;
3366
+ }
3367
+ createJsonApi(data) {
3368
+ const response = {
3369
+ data: {
3370
+ type: Modules.StripeSubscription.name,
3371
+ id: data.id,
3372
+ attributes: {}
3373
+ }
3374
+ };
3375
+ if (data.priceId) {
3376
+ response.data.relationships = {
3377
+ stripePrice: {
3378
+ data: {
3379
+ type: Modules.StripePrice.name,
3380
+ id: data.priceId
3381
+ }
3382
+ }
3383
+ };
3384
+ }
3385
+ if (data.newPriceId) {
3386
+ response.data.attributes.priceId = data.newPriceId;
3387
+ }
3388
+ if (data.cancelImmediately !== void 0) {
3389
+ response.data.attributes.cancelImmediately = data.cancelImmediately;
3390
+ }
3391
+ if (data.quantity !== void 0) {
3392
+ response.data.attributes.quantity = data.quantity;
3393
+ }
3394
+ if (data.trialPeriodDays !== void 0) {
3395
+ response.data.attributes.trialPeriodDays = data.trialPeriodDays;
3396
+ }
3397
+ if (data.paymentMethodId) {
3398
+ response.data.attributes.paymentMethodId = data.paymentMethodId;
3399
+ }
3400
+ if (data.metadata) {
3401
+ response.data.attributes.metadata = data.metadata;
3402
+ }
3403
+ return response;
3404
+ }
3405
+ };
3406
+
3407
+ // src/features/billing/stripe-subscription/data/stripe-subscription.interface.ts
3408
+ var SubscriptionStatus = /* @__PURE__ */ ((SubscriptionStatus2) => {
3409
+ SubscriptionStatus2["ACTIVE"] = "active";
3410
+ SubscriptionStatus2["PAST_DUE"] = "past_due";
3411
+ SubscriptionStatus2["UNPAID"] = "unpaid";
3412
+ SubscriptionStatus2["CANCELED"] = "canceled";
3413
+ SubscriptionStatus2["INCOMPLETE"] = "incomplete";
3414
+ SubscriptionStatus2["INCOMPLETE_EXPIRED"] = "incomplete_expired";
3415
+ SubscriptionStatus2["TRIALING"] = "trialing";
3416
+ SubscriptionStatus2["PAUSED"] = "paused";
3417
+ return SubscriptionStatus2;
3418
+ })(SubscriptionStatus || {});
3419
+
3420
+ // src/features/billing/stripe-subscription/data/stripe-subscription.service.ts
3421
+ var StripeSubscriptionService = class extends AbstractService {
3422
+ static {
3423
+ __name(this, "StripeSubscriptionService");
3424
+ }
3425
+ // ============================================================================
3426
+ // Subscription Methods
3427
+ // ============================================================================
3428
+ /**
3429
+ * List all subscriptions for the current user
3430
+ */
3431
+ static async listSubscriptions(params) {
3432
+ const endpoint = new EndpointCreator({
3433
+ endpoint: Modules.StripeSubscription
3434
+ });
3435
+ return this.callApi({
3436
+ type: Modules.StripeSubscription,
3437
+ method: "GET" /* GET */,
3438
+ endpoint: endpoint.generate(),
3439
+ next: params?.next,
3440
+ previous: params?.prev
3441
+ });
3442
+ }
3443
+ /**
3444
+ * Get a specific subscription by ID
3445
+ */
3446
+ static async getSubscription(params) {
3447
+ const endpoint = new EndpointCreator({
3448
+ endpoint: Modules.StripeSubscription,
3449
+ id: params.subscriptionId
3450
+ });
3451
+ return this.callApi({
3452
+ type: Modules.StripeSubscription,
3453
+ method: "GET" /* GET */,
3454
+ endpoint: endpoint.generate()
3455
+ });
3456
+ }
3457
+ /**
3458
+ * Create a new subscription
3459
+ * Returns subscription data along with meta containing SCA payment confirmation details
3460
+ */
3461
+ static async createSubscription(params) {
3462
+ const endpoint = new EndpointCreator({
3463
+ endpoint: Modules.StripeSubscription
3464
+ });
3465
+ const result = await this.callApiWithMeta({
3466
+ type: Modules.StripeSubscription,
3467
+ method: "POST" /* POST */,
3468
+ endpoint: endpoint.generate(),
3469
+ input: params
3470
+ });
3471
+ return {
3472
+ subscription: result.data,
3473
+ meta: result.meta ?? {
3474
+ clientSecret: null,
3475
+ paymentIntentId: null,
3476
+ requiresAction: false
3477
+ }
3478
+ };
3479
+ }
3480
+ /**
3481
+ * Change the plan of an existing subscription
3482
+ */
3483
+ static async changePlan(params) {
3484
+ const endpoint = new EndpointCreator({
3485
+ endpoint: Modules.StripeSubscription,
3486
+ id: params.id,
3487
+ childEndpoint: "change-plan"
3488
+ });
3489
+ return this.callApi({
3490
+ type: Modules.StripeSubscription,
3491
+ method: "PUT" /* PUT */,
3492
+ endpoint: endpoint.generate(),
3493
+ input: params
3494
+ });
3495
+ }
3496
+ /**
3497
+ * Get a proration preview for a plan change
3498
+ */
3499
+ static async getProrationPreview(params) {
3500
+ const endpoint = new EndpointCreator({
3501
+ endpoint: Modules.StripeSubscription,
3502
+ id: params.subscriptionId,
3503
+ childEndpoint: "proration-preview"
3504
+ });
3505
+ endpoint.addAdditionalParam("newPriceId", params.newPriceId);
3506
+ if (params.quantity) {
3507
+ endpoint.addAdditionalParam("quantity", params.quantity.toString());
3508
+ }
3509
+ return this.callApi({
3510
+ type: Modules.StripeSubscription,
3511
+ method: "GET" /* GET */,
3512
+ endpoint: endpoint.generate()
3513
+ });
3514
+ }
3515
+ /**
3516
+ * Cancel a subscription
3517
+ */
3518
+ static async cancelSubscription(params) {
3519
+ const endpoint = new EndpointCreator({
3520
+ endpoint: Modules.StripeSubscription,
3521
+ id: params.id,
3522
+ childEndpoint: "cancel"
3523
+ });
3524
+ return this.callApi({
3525
+ type: Modules.StripeSubscription,
3526
+ method: "POST" /* POST */,
3527
+ endpoint: endpoint.generate(),
3528
+ input: params
3529
+ });
3530
+ }
3531
+ /**
3532
+ * Pause a subscription
3533
+ */
3534
+ static async pauseSubscription(params) {
3535
+ const endpoint = new EndpointCreator({
3536
+ endpoint: Modules.StripeSubscription,
3537
+ id: params.subscriptionId,
3538
+ childEndpoint: "pause"
3539
+ });
3540
+ return this.callApi({
3541
+ type: Modules.StripeSubscription,
3542
+ method: "POST" /* POST */,
3543
+ endpoint: endpoint.generate()
3544
+ });
3545
+ }
3546
+ /**
3547
+ * Resume a paused subscription
3548
+ */
3549
+ static async resumeSubscription(params) {
3550
+ const endpoint = new EndpointCreator({
3551
+ endpoint: Modules.StripeSubscription,
3552
+ id: params.subscriptionId,
3553
+ childEndpoint: "resume"
3554
+ });
3555
+ return this.callApi({
3556
+ type: Modules.StripeSubscription,
3557
+ method: "POST" /* POST */,
3558
+ endpoint: endpoint.generate()
3559
+ });
3560
+ }
3561
+ /**
3562
+ * Sync a subscription with the latest data from Stripe
3563
+ * This is useful after payment confirmation to get the updated status
3564
+ */
3565
+ static async syncSubscription(params) {
3566
+ const endpoint = new EndpointCreator({
3567
+ endpoint: Modules.StripeSubscription,
3568
+ id: params.subscriptionId,
3569
+ childEndpoint: "sync"
3570
+ });
3571
+ return this.callApi({
3572
+ type: Modules.StripeSubscription,
3573
+ method: "POST" /* POST */,
3574
+ endpoint: endpoint.generate()
3575
+ });
3576
+ }
3577
+ };
3578
+
3579
+ // src/features/billing/stripe-subscription/stripe-subscription.module.ts
3580
+ var StripeSubscriptionModule = /* @__PURE__ */ __name((factory) => factory({
3581
+ name: "stripe-subscriptions",
3582
+ model: StripeSubscription,
3583
+ moduleId: "5e8797ef-650b-4dd5-ac79-a2e530a6c7ba"
3584
+ }), "StripeSubscriptionModule");
3585
+
3586
+ // src/features/billing/stripe-usage/data/stripe-usage.ts
3587
+ var StripeUsage = class extends AbstractApiData {
3588
+ static {
3589
+ __name(this, "StripeUsage");
3590
+ }
3591
+ _subscriptionId;
3592
+ _meterId;
3593
+ _meterEventName;
3594
+ _stripeEventId;
3595
+ _quantity;
3596
+ _timestamp;
3597
+ get subscriptionId() {
3598
+ if (!this._subscriptionId) throw new Error("subscriptionId is not defined");
3599
+ return this._subscriptionId;
3600
+ }
3601
+ get meterId() {
3602
+ if (!this._meterId) throw new Error("meterId is not defined");
3603
+ return this._meterId;
3604
+ }
3605
+ get meterEventName() {
3606
+ if (!this._meterEventName) throw new Error("meterEventName is not defined");
3607
+ return this._meterEventName;
3608
+ }
3609
+ get stripeEventId() {
3610
+ if (!this._stripeEventId) throw new Error("stripeEventId is not defined");
3611
+ return this._stripeEventId;
3612
+ }
3613
+ get quantity() {
3614
+ if (this._quantity === void 0) throw new Error("quantity is not defined");
3615
+ return this._quantity;
3616
+ }
3617
+ get timestamp() {
3618
+ return this._timestamp;
3619
+ }
3620
+ rehydrate(data) {
3621
+ super.rehydrate(data);
3622
+ this._subscriptionId = data.jsonApi.attributes.subscriptionId;
3623
+ this._meterId = data.jsonApi.attributes.meterId;
3624
+ this._meterEventName = data.jsonApi.attributes.meterEventName;
3625
+ this._stripeEventId = data.jsonApi.attributes.stripeEventId;
3626
+ this._quantity = data.jsonApi.attributes.quantity;
3627
+ this._timestamp = data.jsonApi.attributes.timestamp ? new Date(data.jsonApi.attributes.timestamp) : void 0;
3628
+ return this;
3629
+ }
3630
+ createJsonApi(data) {
3631
+ const response = {
3632
+ data: {
3633
+ type: Modules.StripeUsage.name,
3634
+ attributes: {
3635
+ subscriptionItemId: data.subscriptionItemId,
3636
+ quantity: data.quantity
3637
+ }
3638
+ }
3639
+ };
3640
+ if (data.timestamp !== void 0) response.data.attributes.timestamp = data.timestamp;
3641
+ if (data.action !== void 0) response.data.attributes.action = data.action;
3642
+ return response;
3643
+ }
3644
+ };
3645
+
3646
+ // src/features/billing/stripe-usage/data/stripe-usage.service.ts
3647
+ var StripeUsageService = class extends AbstractService {
3648
+ static {
3649
+ __name(this, "StripeUsageService");
3650
+ }
3651
+ // ============================================================================
3652
+ // Meter Methods
3653
+ // ============================================================================
3654
+ /**
3655
+ * List all available usage meters
3656
+ */
3657
+ static async listMeters(params) {
3658
+ const endpoint = new EndpointCreator({
3659
+ endpoint: Modules.StripeUsage,
3660
+ childEndpoint: "meters"
3661
+ });
3662
+ return this.callApi({
3663
+ type: Modules.StripeUsage,
3664
+ method: "GET" /* GET */,
3665
+ endpoint: endpoint.generate(),
3666
+ next: params?.next,
3667
+ previous: params?.prev
3668
+ });
3669
+ }
3670
+ /**
3671
+ * Get meter summaries for a specific time period
3672
+ */
3673
+ static async getMeterSummaries(params) {
3674
+ const endpoint = new EndpointCreator({
3675
+ endpoint: Modules.StripeUsage,
3676
+ childEndpoint: `meters/${params.meterId}/summaries`
3677
+ });
3678
+ endpoint.addAdditionalParam("startTime", params.startTime.toISOString());
3679
+ endpoint.addAdditionalParam("endTime", params.endTime.toISOString());
3680
+ return this.callApi({
3681
+ type: Modules.StripeUsage,
3682
+ method: "GET" /* GET */,
3683
+ endpoint: endpoint.generate()
3684
+ });
3685
+ }
3686
+ // ============================================================================
3687
+ // Usage Record Methods
3688
+ // ============================================================================
3689
+ /**
3690
+ * Report usage for a subscription item
3691
+ */
3692
+ static async reportUsage(params) {
3693
+ const endpoint = new EndpointCreator({
3694
+ endpoint: Modules.StripeUsage
3695
+ });
3696
+ return this.callApi({
3697
+ type: Modules.StripeUsage,
3698
+ method: "POST" /* POST */,
3699
+ endpoint: endpoint.generate(),
3700
+ input: params
3701
+ });
3702
+ }
3703
+ /**
3704
+ * List usage records for a subscription item
3705
+ */
3706
+ static async listUsageRecords(params) {
3707
+ const endpoint = new EndpointCreator({
3708
+ endpoint: Modules.StripeUsage
3709
+ });
3710
+ endpoint.addAdditionalParam("subscriptionItemId", params.subscriptionItemId);
3711
+ return this.callApi({
3712
+ type: Modules.StripeUsage,
3713
+ method: "GET" /* GET */,
3714
+ endpoint: endpoint.generate(),
3715
+ next: params?.next,
3716
+ previous: params?.prev
3717
+ });
3718
+ }
3719
+ /**
3720
+ * Get usage summary for a subscription item
3721
+ */
3722
+ static async getUsageSummary(params) {
3723
+ const endpoint = new EndpointCreator({
3724
+ endpoint: Modules.StripeUsage,
3725
+ childEndpoint: "summary"
3726
+ });
3727
+ endpoint.addAdditionalParam("subscriptionItemId", params.subscriptionItemId);
3728
+ if (params.start) {
3729
+ endpoint.addAdditionalParam("start", params.start.toISOString());
3730
+ }
3731
+ if (params.end) {
3732
+ endpoint.addAdditionalParam("end", params.end.toISOString());
3733
+ }
3734
+ return this.callApi({
3735
+ type: Modules.StripeUsage,
3736
+ method: "GET" /* GET */,
3737
+ endpoint: endpoint.generate()
3738
+ });
3739
+ }
3740
+ };
3741
+
3742
+ // src/features/billing/stripe-usage/stripe-usage.module.ts
3743
+ var StripeUsageModule = /* @__PURE__ */ __name((factory) => factory({
3744
+ name: "stripe-usage-records",
3745
+ model: StripeUsage,
3746
+ moduleId: "c2e9f4a6-1d7b-4e3a-8f5c-9b2d6a1e7f3c"
3747
+ }), "StripeUsageModule");
3748
+
3749
+ // src/features/company/data/company.ts
3750
+ var Company = class extends AbstractApiData {
3751
+ static {
3752
+ __name(this, "Company");
3753
+ }
3754
+ _name;
3755
+ _logo;
3756
+ _logoUrl;
3757
+ _configurations;
3758
+ _licenseExpirationDate;
3759
+ _features;
3760
+ _modules;
3761
+ get name() {
3762
+ if (this._name === void 0) throw new Error("Name is not defined");
3763
+ return this._name;
3764
+ }
3765
+ get logo() {
3766
+ return this._logo;
3767
+ }
3768
+ get logoUrl() {
3769
+ return this._logoUrl;
3770
+ }
3771
+ get licenseExpirationDate() {
3772
+ return this._licenseExpirationDate;
3773
+ }
3774
+ get features() {
3775
+ return this._features ?? [];
3776
+ }
3777
+ get modules() {
3778
+ return this._modules ?? [];
3779
+ }
3780
+ get configurations() {
3781
+ return this._configurations;
3782
+ }
3783
+ rehydrate(data) {
3784
+ super.rehydrate(data);
3785
+ this._name = data.jsonApi.attributes.name;
3786
+ this._configurations = data.jsonApi.attributes.configurations ? JSON.parse(data.jsonApi.attributes.configurations) : void 0;
3787
+ this._logo = data.jsonApi.attributes.logo;
3788
+ this._logoUrl = data.jsonApi.attributes.logoUrl;
3789
+ this._licenseExpirationDate = data.jsonApi.attributes.licenseExpirationDate ? new Date(data.jsonApi.attributes.licenseExpirationDate) : void 0;
3790
+ this._features = this._readIncluded(data, "features", Modules.Feature);
3791
+ this._modules = this._readIncluded(data, "modules", Modules.Module);
3792
+ return this;
3793
+ }
3794
+ createJsonApi(data) {
3795
+ const response = {
3796
+ data: {
3797
+ type: Modules.Company.name,
3798
+ id: data.id,
3799
+ attributes: {},
3800
+ meta: {},
3801
+ relationships: {}
3802
+ },
3803
+ included: []
3804
+ };
3805
+ if (data.name) response.data.attributes.name = data.name;
3806
+ if (data.configurations) response.data.attributes.configurations = JSON.stringify(data.configurations);
3807
+ if (data.logo) response.data.attributes.logo = data.logo;
3808
+ if (data.license) response.data.attributes.license = data.license;
3809
+ if (data.privateKey) response.data.attributes.privateKey = data.privateKey;
3810
+ if (data.featureIds && data.featureIds.length > 0) {
3811
+ response.data.relationships.features = {
3812
+ data: data.featureIds.map((featureId) => ({
3813
+ type: Modules.Feature.name,
3814
+ id: featureId
3815
+ }))
3816
+ };
3817
+ }
3818
+ if (data.moduleIds && data.moduleIds.length > 0) {
3819
+ response.data.relationships.modules = {
3820
+ data: data.moduleIds.map((moduleId) => ({
3821
+ type: Modules.Module.name,
3822
+ id: moduleId
3823
+ }))
3824
+ };
3825
+ }
3826
+ return response;
3827
+ }
3828
+ };
3829
+
3830
+ // src/features/company/data/company.fields.ts
3831
+ var CompanyFields = /* @__PURE__ */ ((CompanyFields2) => {
3832
+ CompanyFields2["companyId"] = "companyId";
3833
+ CompanyFields2["name"] = "name";
3834
+ CompanyFields2["createdAt"] = "createdAt";
3835
+ CompanyFields2["updatedAt"] = "updatedAt";
3836
+ return CompanyFields2;
3837
+ })(CompanyFields || {});
3838
+
3839
+ // src/features/company/data/company.service.ts
3840
+ var CompanyService = class extends AbstractService {
3841
+ static {
3842
+ __name(this, "CompanyService");
3843
+ }
3844
+ static async findOne(params) {
3845
+ return this.callApi({
3846
+ type: Modules.Company,
3847
+ method: "GET" /* GET */,
3848
+ endpoint: new EndpointCreator({ endpoint: Modules.Company, id: params.companyId }).generate()
3849
+ });
3850
+ }
3851
+ static async findMany(params) {
3852
+ const endpoint = new EndpointCreator({ endpoint: Modules.Company });
3853
+ if (params.search) endpoint.addAdditionalParam("search", params.search);
3854
+ return this.callApi({
3855
+ type: Modules.Company,
3856
+ method: "GET" /* GET */,
3857
+ endpoint: endpoint.generate(),
3858
+ next: params.next
3859
+ });
3860
+ }
3861
+ static async delete(params) {
3862
+ await this.callApi({
3863
+ type: Modules.Company,
3864
+ method: "DELETE" /* DELETE */,
3865
+ endpoint: new EndpointCreator({ endpoint: Modules.Company, id: params.companyId }).generate()
3866
+ });
2383
3867
  }
2384
3868
  static async create(params) {
2385
3869
  return this.callApi({
@@ -2585,13 +4069,13 @@ var Feature = class extends AbstractApiData {
2585
4069
  __name(this, "Feature");
2586
4070
  }
2587
4071
  _name;
2588
- _isProduction;
4072
+ _isCore;
2589
4073
  _modules = [];
2590
4074
  get name() {
2591
4075
  return this._name ?? "";
2592
4076
  }
2593
- get isProduction() {
2594
- return this._isProduction == true ? true : false;
4077
+ get isCore() {
4078
+ return this._isCore == true ? true : false;
2595
4079
  }
2596
4080
  get modules() {
2597
4081
  return this._modules;
@@ -2599,7 +4083,7 @@ var Feature = class extends AbstractApiData {
2599
4083
  rehydrate(data) {
2600
4084
  super.rehydrate(data);
2601
4085
  this._name = data.jsonApi.attributes.name;
2602
- this._isProduction = data.jsonApi.attributes.isProduction ?? false;
4086
+ this._isCore = data.jsonApi.attributes.isCore ?? false;
2603
4087
  this._modules = this._readIncluded(data, `modules`, Modules.Module);
2604
4088
  return this;
2605
4089
  }
@@ -2637,15 +4121,11 @@ var Module = class extends AbstractApiData {
2637
4121
  __name(this, "Module");
2638
4122
  }
2639
4123
  _name;
2640
- _isCore;
2641
4124
  _permissions;
2642
4125
  get name() {
2643
4126
  if (!this._name) throw new Error("Name is not defined");
2644
4127
  return this._name ?? "";
2645
4128
  }
2646
- get isCore() {
2647
- return this._isCore ?? false;
2648
- }
2649
4129
  get permissions() {
2650
4130
  if (!this._permissions) throw new Error("Permissions is not defined");
2651
4131
  return this._permissions;
@@ -2653,7 +4133,6 @@ var Module = class extends AbstractApiData {
2653
4133
  rehydrate(data) {
2654
4134
  super.rehydrate(data);
2655
4135
  this._name = data.jsonApi.attributes.name;
2656
- this._isCore = data.jsonApi.attributes.isCore;
2657
4136
  this._permissions = data.jsonApi.meta.permissions;
2658
4137
  return this;
2659
4138
  }
@@ -3377,6 +4856,14 @@ var UserService = class extends AbstractService {
3377
4856
  }
3378
4857
  };
3379
4858
 
4859
+ // src/features/user/author.module.ts
4860
+ var AuthorModule = /* @__PURE__ */ __name((factory) => factory({
4861
+ pageUrl: "/authors",
4862
+ name: "authors",
4863
+ model: User,
4864
+ moduleId: "04cfc677-0fd2-4f5e-adf4-2483a00c0277"
4865
+ }), "AuthorModule");
4866
+
3380
4867
  // src/features/user/user.module.ts
3381
4868
  var UserModule = /* @__PURE__ */ __name((factory) => factory({
3382
4869
  pageUrl: "/users",
@@ -3395,14 +4882,6 @@ var UserModule = /* @__PURE__ */ __name((factory) => factory({
3395
4882
  }
3396
4883
  }), "UserModule");
3397
4884
 
3398
- // src/features/user/author.module.ts
3399
- var AuthorModule = /* @__PURE__ */ __name((factory) => factory({
3400
- pageUrl: "/authors",
3401
- name: "authors",
3402
- model: User,
3403
- moduleId: "04cfc677-0fd2-4f5e-adf4-2483a00c0277"
3404
- }), "AuthorModule");
3405
-
3406
4885
  export {
3407
4886
  RehydrationFactory,
3408
4887
  AbstractApiData,
@@ -3453,12 +4932,37 @@ export {
3453
4932
  checkPermissions,
3454
4933
  checkPermissionsFromServer,
3455
4934
  getValueFromPath,
3456
- Auth,
3457
4935
  configureAuth,
3458
4936
  getTokenHandler,
4937
+ Auth,
3459
4938
  AuthService,
3460
4939
  AuthComponent,
3461
4940
  AuthModule,
4941
+ BillingService,
4942
+ Billing,
4943
+ BillingModule,
4944
+ PaymentMethod,
4945
+ StripeCustomer,
4946
+ StripeCustomerService,
4947
+ StripeCustomerModule,
4948
+ StripePaymentMethodModule,
4949
+ StripeInvoice,
4950
+ InvoiceStatus,
4951
+ StripeInvoiceService,
4952
+ StripeInvoiceModule,
4953
+ StripePrice,
4954
+ StripePriceService,
4955
+ StripePriceModule,
4956
+ StripeProduct,
4957
+ StripeProductService,
4958
+ StripeProductModule,
4959
+ StripeSubscription,
4960
+ SubscriptionStatus,
4961
+ StripeSubscriptionService,
4962
+ StripeSubscriptionModule,
4963
+ StripeUsage,
4964
+ StripeUsageService,
4965
+ StripeUsageModule,
3462
4966
  Company,
3463
4967
  CompanyFields,
3464
4968
  CompanyService,
@@ -3489,7 +4993,7 @@ export {
3489
4993
  User,
3490
4994
  UserFields,
3491
4995
  UserService,
3492
- UserModule,
3493
- AuthorModule
4996
+ AuthorModule,
4997
+ UserModule
3494
4998
  };
3495
- //# sourceMappingURL=chunk-A333VMBO.mjs.map
4999
+ //# sourceMappingURL=chunk-BCQSE3EU.mjs.map