@antelopejs/dms-saas 0.4.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (815) hide show
  1. package/README.md +42 -2
  2. package/dist/auth/index.d.ts +1 -0
  3. package/dist/auth/index.js +1 -0
  4. package/dist/auth/index.js.map +1 -1
  5. package/dist/auth/owner-only-permissions-resolver.d.ts +1 -0
  6. package/dist/auth/owner-only-permissions-resolver.js +25 -0
  7. package/dist/auth/owner-only-permissions-resolver.js.map +1 -0
  8. package/dist/billing-state/directory-hooks.d.ts +1 -0
  9. package/dist/billing-state/directory-hooks.js +35 -0
  10. package/dist/billing-state/directory-hooks.js.map +1 -0
  11. package/dist/billing-state/directory.d.ts +29 -0
  12. package/dist/billing-state/directory.js +152 -0
  13. package/dist/billing-state/directory.js.map +1 -0
  14. package/dist/billing-state/index.d.ts +5 -1
  15. package/dist/billing-state/index.js +14 -2
  16. package/dist/billing-state/index.js.map +1 -1
  17. package/dist/billing-state/past-due-banner.d.ts +4 -3
  18. package/dist/billing-state/past-due-banner.js +30 -10
  19. package/dist/billing-state/past-due-banner.js.map +1 -1
  20. package/dist/billing-state/recovery.d.ts +4 -0
  21. package/dist/billing-state/recovery.js +7 -5
  22. package/dist/billing-state/recovery.js.map +1 -1
  23. package/dist/billing-state/trial-ending-banner.d.ts +4 -0
  24. package/dist/billing-state/trial-ending-banner.js +66 -0
  25. package/dist/billing-state/trial-ending-banner.js.map +1 -0
  26. package/dist/config/runtime.d.ts +1 -0
  27. package/dist/config/runtime.js +5 -0
  28. package/dist/config/runtime.js.map +1 -1
  29. package/dist/crons/auto-suspend-past-due.js +4 -5
  30. package/dist/crons/auto-suspend-past-due.js.map +1 -1
  31. package/dist/data-api/platformOwner/admin-user-invoices.d.ts +6 -4
  32. package/dist/data-api/platformOwner/admin-user-invoices.js +52 -30
  33. package/dist/data-api/platformOwner/admin-user-invoices.js.map +1 -1
  34. package/dist/data-api/platformOwner/admin-user-workspaces.d.ts +2 -0
  35. package/dist/data-api/platformOwner/admin-user-workspaces.js +69 -3
  36. package/dist/data-api/platformOwner/admin-user-workspaces.js.map +1 -1
  37. package/dist/data-api/platformOwner/credit-note-rows.d.ts +11 -0
  38. package/dist/data-api/platformOwner/credit-note-rows.js +54 -0
  39. package/dist/data-api/platformOwner/credit-note-rows.js.map +1 -0
  40. package/dist/data-api/platformOwner/credit-notes.d.ts +13 -0
  41. package/dist/data-api/platformOwner/credit-notes.js +149 -10
  42. package/dist/data-api/platformOwner/credit-notes.js.map +1 -1
  43. package/dist/data-api/platformOwner/features.d.ts +7 -2
  44. package/dist/data-api/platformOwner/features.js +151 -37
  45. package/dist/data-api/platformOwner/features.js.map +1 -1
  46. package/dist/data-api/platformOwner/invitations.js +29 -9
  47. package/dist/data-api/platformOwner/invitations.js.map +1 -1
  48. package/dist/data-api/platformOwner/invoice-cells.d.ts +5 -0
  49. package/dist/data-api/platformOwner/invoice-cells.js +51 -0
  50. package/dist/data-api/platformOwner/invoice-cells.js.map +1 -0
  51. package/dist/data-api/platformOwner/invoice-options.js.map +1 -1
  52. package/dist/data-api/platformOwner/invoice-rows.d.ts +9 -0
  53. package/dist/data-api/platformOwner/invoice-rows.js +39 -0
  54. package/dist/data-api/platformOwner/invoice-rows.js.map +1 -0
  55. package/dist/data-api/platformOwner/invoices.d.ts +24 -6
  56. package/dist/data-api/platformOwner/invoices.js +192 -11
  57. package/dist/data-api/platformOwner/invoices.js.map +1 -1
  58. package/dist/data-api/platformOwner/members.d.ts +2 -1
  59. package/dist/data-api/platformOwner/members.js +56 -20
  60. package/dist/data-api/platformOwner/members.js.map +1 -1
  61. package/dist/data-api/platformOwner/plan-migrations.d.ts +14 -2
  62. package/dist/data-api/platformOwner/plan-migrations.js +179 -33
  63. package/dist/data-api/platformOwner/plan-migrations.js.map +1 -1
  64. package/dist/data-api/platformOwner/plans.d.ts +30 -6
  65. package/dist/data-api/platformOwner/plans.js +269 -44
  66. package/dist/data-api/platformOwner/plans.js.map +1 -1
  67. package/dist/data-api/platformOwner/segments.d.ts +9 -7
  68. package/dist/data-api/platformOwner/segments.js +108 -101
  69. package/dist/data-api/platformOwner/segments.js.map +1 -1
  70. package/dist/data-api/platformOwner/table-scope.d.ts +6 -0
  71. package/dist/data-api/platformOwner/table-scope.js +8 -0
  72. package/dist/data-api/platformOwner/table-scope.js.map +1 -0
  73. package/dist/data-api/platformOwner/users.d.ts +15 -2
  74. package/dist/data-api/platformOwner/users.js +171 -15
  75. package/dist/data-api/platformOwner/users.js.map +1 -1
  76. package/dist/data-api/platformOwner/workspace-cells.d.ts +12 -0
  77. package/dist/data-api/platformOwner/workspace-cells.js +90 -0
  78. package/dist/data-api/platformOwner/workspace-cells.js.map +1 -0
  79. package/dist/data-api/platformOwner/workspaces.d.ts +26 -4
  80. package/dist/data-api/platformOwner/workspaces.js +269 -97
  81. package/dist/data-api/platformOwner/workspaces.js.map +1 -1
  82. package/dist/data-api/tenant/tenant-invoices.d.ts +4 -0
  83. package/dist/data-api/tenant/tenant-invoices.js +68 -4
  84. package/dist/data-api/tenant/tenant-invoices.js.map +1 -1
  85. package/dist/hooks/register.js +5 -1
  86. package/dist/hooks/register.js.map +1 -1
  87. package/dist/i18n/composed-text.d.ts +17 -0
  88. package/dist/i18n/composed-text.js +71 -0
  89. package/dist/i18n/composed-text.js.map +1 -0
  90. package/dist/implementations/dms-saas/billing.d.ts +1 -0
  91. package/dist/implementations/dms-saas/billing.js +4 -1
  92. package/dist/implementations/dms-saas/billing.js.map +1 -1
  93. package/dist/implementations/dms-saas/pages.d.ts +0 -1
  94. package/dist/implementations/dms-saas/pages.js +0 -4
  95. package/dist/implementations/dms-saas/pages.js.map +1 -1
  96. package/dist/index.js +5 -1
  97. package/dist/index.js.map +1 -1
  98. package/dist/metrics/activity-sources.d.ts +2 -0
  99. package/dist/metrics/activity-sources.js +60 -0
  100. package/dist/metrics/activity-sources.js.map +1 -0
  101. package/dist/metrics/activity.d.ts +25 -0
  102. package/dist/metrics/activity.js +197 -0
  103. package/dist/metrics/activity.js.map +1 -0
  104. package/dist/metrics/directory-summary.d.ts +30 -0
  105. package/dist/metrics/directory-summary.js +95 -0
  106. package/dist/metrics/directory-summary.js.map +1 -0
  107. package/dist/metrics/headline-items.d.ts +32 -0
  108. package/dist/metrics/headline-items.js +242 -0
  109. package/dist/metrics/headline-items.js.map +1 -0
  110. package/dist/metrics/normalised-mrr.d.ts +32 -0
  111. package/dist/metrics/normalised-mrr.js +75 -0
  112. package/dist/metrics/normalised-mrr.js.map +1 -0
  113. package/dist/metrics/revenue.d.ts +30 -0
  114. package/dist/metrics/revenue.js +126 -0
  115. package/dist/metrics/revenue.js.map +1 -0
  116. package/dist/notifications/recipients.d.ts +1 -0
  117. package/dist/notifications/recipients.js +4 -0
  118. package/dist/notifications/recipients.js.map +1 -1
  119. package/dist/notifications/subjects.d.ts +18 -17
  120. package/dist/notifications/subjects.js +7 -1
  121. package/dist/notifications/subjects.js.map +1 -1
  122. package/dist/operator-actions/commands.js +9 -6
  123. package/dist/operator-actions/commands.js.map +1 -1
  124. package/dist/operator-actions/invitation-commands.d.ts +7 -1
  125. package/dist/operator-actions/invitation-commands.js +16 -0
  126. package/dist/operator-actions/invitation-commands.js.map +1 -1
  127. package/dist/operator-actions/previews.d.ts +50 -0
  128. package/dist/operator-actions/previews.js +113 -0
  129. package/dist/operator-actions/previews.js.map +1 -0
  130. package/dist/operator-actions/types.d.ts +1 -1
  131. package/dist/operator-actions/upgrade-preview.d.ts +35 -0
  132. package/dist/operator-actions/upgrade-preview.js +110 -0
  133. package/dist/operator-actions/upgrade-preview.js.map +1 -0
  134. package/dist/operator-billing/billing-rules.d.ts +58 -0
  135. package/dist/operator-billing/billing-rules.js +90 -0
  136. package/dist/operator-billing/billing-rules.js.map +1 -0
  137. package/dist/operator-billing/billing-settings-store.d.ts +3 -0
  138. package/dist/operator-billing/billing-settings-store.js +34 -0
  139. package/dist/operator-billing/billing-settings-store.js.map +1 -0
  140. package/dist/operator-billing/billing-stats.d.ts +37 -0
  141. package/dist/operator-billing/billing-stats.js +197 -0
  142. package/dist/operator-billing/billing-stats.js.map +1 -0
  143. package/dist/operator-billing/credit-allowance.d.ts +17 -0
  144. package/dist/operator-billing/credit-allowance.js +44 -0
  145. package/dist/operator-billing/credit-allowance.js.map +1 -0
  146. package/dist/operator-billing/credit-note-request.d.ts +39 -0
  147. package/dist/operator-billing/credit-note-request.js +73 -0
  148. package/dist/operator-billing/credit-note-request.js.map +1 -0
  149. package/dist/operator-billing/index.d.ts +8 -0
  150. package/dist/operator-billing/index.js +25 -0
  151. package/dist/operator-billing/index.js.map +1 -0
  152. package/dist/operator-billing/invoice-credit.d.ts +41 -0
  153. package/dist/operator-billing/invoice-credit.js +111 -0
  154. package/dist/operator-billing/invoice-credit.js.map +1 -0
  155. package/dist/operator-billing/legal-documents-store.d.ts +12 -0
  156. package/dist/operator-billing/legal-documents-store.js +46 -0
  157. package/dist/operator-billing/legal-documents-store.js.map +1 -0
  158. package/dist/operator-billing/legal-versions.d.ts +5 -0
  159. package/dist/operator-billing/legal-versions.js +31 -0
  160. package/dist/operator-billing/legal-versions.js.map +1 -0
  161. package/dist/pages/block-meta.d.ts +15 -0
  162. package/dist/pages/block-meta.js +21 -0
  163. package/dist/pages/block-meta.js.map +1 -0
  164. package/dist/pages/module.d.ts +1 -3
  165. package/dist/pages/module.js +1 -8
  166. package/dist/pages/module.js.map +1 -1
  167. package/dist/pages/platform/credit-notes.d.ts +1 -0
  168. package/dist/pages/platform/credit-notes.js +63 -5
  169. package/dist/pages/platform/credit-notes.js.map +1 -1
  170. package/dist/pages/platform/dashboard.d.ts +4 -1
  171. package/dist/pages/platform/dashboard.js +123 -64
  172. package/dist/pages/platform/dashboard.js.map +1 -1
  173. package/dist/pages/platform/features.js +85 -12
  174. package/dist/pages/platform/features.js.map +1 -1
  175. package/dist/pages/platform/index.d.ts +1 -0
  176. package/dist/pages/platform/index.js +1 -0
  177. package/dist/pages/platform/index.js.map +1 -1
  178. package/dist/pages/platform/invoices.d.ts +6 -0
  179. package/dist/pages/platform/invoices.js +84 -28
  180. package/dist/pages/platform/invoices.js.map +1 -1
  181. package/dist/pages/platform/paths.d.ts +9 -0
  182. package/dist/pages/platform/paths.js +25 -0
  183. package/dist/pages/platform/paths.js.map +1 -0
  184. package/dist/pages/platform/plans/edit.d.ts +2 -2
  185. package/dist/pages/platform/plans/edit.js +170 -105
  186. package/dist/pages/platform/plans/edit.js.map +1 -1
  187. package/dist/pages/platform/plans/index.d.ts +1 -0
  188. package/dist/pages/platform/plans/index.js +177 -54
  189. package/dist/pages/platform/plans/index.js.map +1 -1
  190. package/dist/pages/platform/plans/migrations.d.ts +12 -0
  191. package/dist/pages/platform/plans/migrations.js +259 -13
  192. package/dist/pages/platform/plans/migrations.js.map +1 -1
  193. package/dist/pages/platform/segments/edit.d.ts +17 -0
  194. package/dist/pages/platform/segments/edit.js +124 -0
  195. package/dist/pages/platform/segments/edit.js.map +1 -0
  196. package/dist/pages/platform/segments/index.js +68 -8
  197. package/dist/pages/platform/segments/index.js.map +1 -1
  198. package/dist/pages/platform/settings.d.ts +1 -1
  199. package/dist/pages/platform/settings.js +164 -105
  200. package/dist/pages/platform/settings.js.map +1 -1
  201. package/dist/pages/platform/users/detail.js +112 -33
  202. package/dist/pages/platform/users/detail.js.map +1 -1
  203. package/dist/pages/platform/users/index.js +52 -18
  204. package/dist/pages/platform/users/index.js.map +1 -1
  205. package/dist/pages/platform/workspaces/detail.d.ts +3 -1
  206. package/dist/pages/platform/workspaces/detail.js +184 -113
  207. package/dist/pages/platform/workspaces/detail.js.map +1 -1
  208. package/dist/pages/platform/workspaces/index.d.ts +1 -20
  209. package/dist/pages/platform/workspaces/index.js +152 -180
  210. package/dist/pages/platform/workspaces/index.js.map +1 -1
  211. package/dist/pages/platform/workspaces/shared.d.ts +11 -0
  212. package/dist/pages/platform/workspaces/shared.js +53 -0
  213. package/dist/pages/platform/workspaces/shared.js.map +1 -0
  214. package/dist/pages/public/auth/no-workspace.js +7 -2
  215. package/dist/pages/public/auth/no-workspace.js.map +1 -1
  216. package/dist/pages/public/index.js.map +1 -1
  217. package/dist/pages/public/legal/privacy-policy.d.ts +1 -0
  218. package/dist/pages/public/legal/privacy-policy.js +9 -4
  219. package/dist/pages/public/legal/privacy-policy.js.map +1 -1
  220. package/dist/pages/public/legal/terms-and-conditions.d.ts +1 -0
  221. package/dist/pages/public/legal/terms-and-conditions.js +9 -4
  222. package/dist/pages/public/legal/terms-and-conditions.js.map +1 -1
  223. package/dist/pages/public/legal/terms-of-use.d.ts +1 -0
  224. package/dist/pages/public/legal/terms-of-use.js +9 -4
  225. package/dist/pages/public/legal/terms-of-use.js.map +1 -1
  226. package/dist/pages/public/nav-bar.d.ts +2 -0
  227. package/dist/pages/public/nav-bar.js +14 -0
  228. package/dist/pages/public/nav-bar.js.map +1 -0
  229. package/dist/pages/public/pricing.d.ts +10 -0
  230. package/dist/pages/public/pricing.js +32 -0
  231. package/dist/pages/public/pricing.js.map +1 -0
  232. package/dist/pages/public/register.d.ts +1 -0
  233. package/dist/pages/public/register.js +6 -3
  234. package/dist/pages/public/register.js.map +1 -1
  235. package/dist/pages/public/screens.js +1 -0
  236. package/dist/pages/public/screens.js.map +1 -1
  237. package/dist/pages/tenant/billing.d.ts +7 -7
  238. package/dist/pages/tenant/billing.js +141 -63
  239. package/dist/pages/tenant/billing.js.map +1 -1
  240. package/dist/pages/tenant/data-export.d.ts +3 -1
  241. package/dist/pages/tenant/data-export.js +25 -6
  242. package/dist/pages/tenant/data-export.js.map +1 -1
  243. package/dist/pages/tenant/general.d.ts +3 -2
  244. package/dist/pages/tenant/general.js +91 -11
  245. package/dist/pages/tenant/general.js.map +1 -1
  246. package/dist/pages/tenant/index.d.ts +1 -0
  247. package/dist/pages/tenant/index.js +1 -0
  248. package/dist/pages/tenant/index.js.map +1 -1
  249. package/dist/pages/tenant/members-seat-quota.d.ts +3 -0
  250. package/dist/pages/tenant/members-seat-quota.js +18 -6
  251. package/dist/pages/tenant/members-seat-quota.js.map +1 -1
  252. package/dist/pages/tenant/owner-only.d.ts +1 -0
  253. package/dist/pages/tenant/owner-only.js +14 -0
  254. package/dist/pages/tenant/owner-only.js.map +1 -0
  255. package/dist/pages/tenant/workspace-suspended.js +7 -3
  256. package/dist/pages/tenant/workspace-suspended.js.map +1 -1
  257. package/dist/plan-changes/applied-upgrade.d.ts +5 -0
  258. package/dist/plan-changes/applied-upgrade.js +51 -0
  259. package/dist/plan-changes/applied-upgrade.js.map +1 -0
  260. package/dist/plan-changes/deferred.js +9 -40
  261. package/dist/plan-changes/deferred.js.map +1 -1
  262. package/dist/plan-changes/immediate.d.ts +4 -0
  263. package/dist/plan-changes/immediate.js +34 -0
  264. package/dist/plan-changes/immediate.js.map +1 -0
  265. package/dist/plan-changes/index.d.ts +1 -0
  266. package/dist/plan-changes/index.js +1 -0
  267. package/dist/plan-changes/index.js.map +1 -1
  268. package/dist/plan-changes/pending-target.d.ts +17 -0
  269. package/dist/plan-changes/pending-target.js +62 -0
  270. package/dist/plan-changes/pending-target.js.map +1 -0
  271. package/dist/plans/catalogue-summary.d.ts +24 -0
  272. package/dist/plans/catalogue-summary.js +97 -0
  273. package/dist/plans/catalogue-summary.js.map +1 -0
  274. package/dist/plans/catalogue-usage.d.ts +36 -0
  275. package/dist/plans/catalogue-usage.js +120 -0
  276. package/dist/plans/catalogue-usage.js.map +1 -0
  277. package/dist/plans/feature-guards.d.ts +5 -0
  278. package/dist/plans/feature-guards.js +31 -0
  279. package/dist/plans/feature-guards.js.map +1 -0
  280. package/dist/plans/feature-usage.d.ts +4 -0
  281. package/dist/plans/feature-usage.js +22 -0
  282. package/dist/plans/feature-usage.js.map +1 -0
  283. package/dist/plans/migration-blocks.d.ts +13 -0
  284. package/dist/plans/migration-blocks.js +337 -0
  285. package/dist/plans/migration-blocks.js.map +1 -0
  286. package/dist/plans/migration-detail.d.ts +48 -0
  287. package/dist/plans/migration-detail.js +80 -0
  288. package/dist/plans/migration-detail.js.map +1 -0
  289. package/dist/plans/migration-dialogs.d.ts +8 -0
  290. package/dist/plans/migration-dialogs.js +103 -0
  291. package/dist/plans/migration-dialogs.js.map +1 -0
  292. package/dist/plans/migration-outcomes.d.ts +7 -0
  293. package/dist/plans/migration-outcomes.js +38 -0
  294. package/dist/plans/migration-outcomes.js.map +1 -0
  295. package/dist/plans/migration-realtime.d.ts +2 -0
  296. package/dist/plans/migration-realtime.js +19 -0
  297. package/dist/plans/migration-realtime.js.map +1 -0
  298. package/dist/plans/migration-workspaces.d.ts +40 -0
  299. package/dist/plans/migration-workspaces.js +121 -0
  300. package/dist/plans/migration-workspaces.js.map +1 -0
  301. package/dist/plans/money.d.ts +1 -0
  302. package/dist/plans/money.js +11 -0
  303. package/dist/plans/money.js.map +1 -0
  304. package/dist/plans/plan-access-type.d.ts +25 -0
  305. package/dist/plans/plan-access-type.js +49 -0
  306. package/dist/plans/plan-access-type.js.map +1 -0
  307. package/dist/plans/plan-audience.d.ts +3 -0
  308. package/dist/plans/plan-audience.js +9 -0
  309. package/dist/plans/plan-audience.js.map +1 -0
  310. package/dist/plans/plan-diff.d.ts +13 -0
  311. package/dist/plans/plan-diff.js +73 -0
  312. package/dist/plans/plan-diff.js.map +1 -0
  313. package/dist/plans/plan-permission-tree.d.ts +11 -0
  314. package/dist/plans/plan-permission-tree.js +58 -0
  315. package/dist/plans/plan-permission-tree.js.map +1 -0
  316. package/dist/plans/plan-write.d.ts +17 -0
  317. package/dist/plans/plan-write.js +111 -0
  318. package/dist/plans/plan-write.js.map +1 -0
  319. package/dist/plans/seat-capacity.d.ts +3 -1
  320. package/dist/plans/seat-capacity.js +10 -2
  321. package/dist/plans/seat-capacity.js.map +1 -1
  322. package/dist/plans/seat-hooks.d.ts +1 -0
  323. package/dist/plans/seat-hooks.js +1 -0
  324. package/dist/plans/seat-hooks.js.map +1 -1
  325. package/dist/plans/stripe-sync.d.ts +3 -0
  326. package/dist/plans/stripe-sync.js +16 -0
  327. package/dist/plans/stripe-sync.js.map +1 -1
  328. package/dist/routes/platformOwner/billing-settings.d.ts +11 -35
  329. package/dist/routes/platformOwner/billing-settings.js +77 -47
  330. package/dist/routes/platformOwner/billing-settings.js.map +1 -1
  331. package/dist/routes/platformOwner/billing-stats.d.ts +15 -0
  332. package/dist/routes/platformOwner/billing-stats.js +106 -0
  333. package/dist/routes/platformOwner/billing-stats.js.map +1 -0
  334. package/dist/routes/platformOwner/block-payloads.d.ts +7 -0
  335. package/dist/routes/platformOwner/block-payloads.js +3 -0
  336. package/dist/routes/platformOwner/block-payloads.js.map +1 -0
  337. package/dist/routes/platformOwner/credit-notes-issue.d.ts +7 -8
  338. package/dist/routes/platformOwner/credit-notes-issue.js +28 -16
  339. package/dist/routes/platformOwner/credit-notes-issue.js.map +1 -1
  340. package/dist/routes/platformOwner/dashboard.d.ts +14 -57
  341. package/dist/routes/platformOwner/dashboard.js +126 -247
  342. package/dist/routes/platformOwner/dashboard.js.map +1 -1
  343. package/dist/routes/platformOwner/index.d.ts +7 -0
  344. package/dist/routes/platformOwner/index.js +7 -0
  345. package/dist/routes/platformOwner/index.js.map +1 -1
  346. package/dist/routes/platformOwner/plan-deletion.d.ts +77 -19
  347. package/dist/routes/platformOwner/plan-deletion.js +219 -67
  348. package/dist/routes/platformOwner/plan-deletion.js.map +1 -1
  349. package/dist/routes/platformOwner/plan-dialogs.d.ts +22 -0
  350. package/dist/routes/platformOwner/plan-dialogs.js +211 -0
  351. package/dist/routes/platformOwner/plan-dialogs.js.map +1 -0
  352. package/dist/routes/platformOwner/plan-migration-context.d.ts +9 -0
  353. package/dist/routes/platformOwner/plan-migration-context.js +147 -0
  354. package/dist/routes/platformOwner/plan-migration-context.js.map +1 -0
  355. package/dist/routes/platformOwner/plan-migration-export.d.ts +12 -0
  356. package/dist/routes/platformOwner/plan-migration-export.js +100 -0
  357. package/dist/routes/platformOwner/plan-migration-export.js.map +1 -0
  358. package/dist/routes/platformOwner/plan-migrations.d.ts +43 -0
  359. package/dist/routes/platformOwner/plan-migrations.js +260 -0
  360. package/dist/routes/platformOwner/plan-migrations.js.map +1 -0
  361. package/dist/routes/platformOwner/plans.d.ts +44 -41
  362. package/dist/routes/platformOwner/plans.js +155 -142
  363. package/dist/routes/platformOwner/plans.js.map +1 -1
  364. package/dist/routes/platformOwner/platform-owners.d.ts +8 -6
  365. package/dist/routes/platformOwner/platform-owners.js +40 -12
  366. package/dist/routes/platformOwner/platform-owners.js.map +1 -1
  367. package/dist/routes/platformOwner/segments-export.d.ts +15 -0
  368. package/dist/routes/platformOwner/segments-export.js +143 -0
  369. package/dist/routes/platformOwner/segments-export.js.map +1 -0
  370. package/dist/routes/platformOwner/segments.d.ts +17 -11
  371. package/dist/routes/platformOwner/segments.js +62 -113
  372. package/dist/routes/platformOwner/segments.js.map +1 -1
  373. package/dist/routes/platformOwner/stripe-dashboard.d.ts +6 -0
  374. package/dist/routes/platformOwner/stripe-dashboard.js +29 -0
  375. package/dist/routes/platformOwner/stripe-dashboard.js.map +1 -0
  376. package/dist/routes/platformOwner/users-detail.d.ts +12 -22
  377. package/dist/routes/platformOwner/users-detail.js +60 -53
  378. package/dist/routes/platformOwner/users-detail.js.map +1 -1
  379. package/dist/routes/platformOwner/workspace-detail.d.ts +36 -0
  380. package/dist/routes/platformOwner/workspace-detail.js +222 -0
  381. package/dist/routes/platformOwner/workspace-detail.js.map +1 -0
  382. package/dist/routes/platformOwner/workspace-invitations.d.ts +4 -0
  383. package/dist/routes/platformOwner/workspace-invitations.js +18 -0
  384. package/dist/routes/platformOwner/workspace-invitations.js.map +1 -1
  385. package/dist/routes/platformOwner/workspace-operator-actions.d.ts +14 -2
  386. package/dist/routes/platformOwner/workspace-operator-actions.js +42 -4
  387. package/dist/routes/platformOwner/workspace-operator-actions.js.map +1 -1
  388. package/dist/routes/platformOwner/workspaces-admin.d.ts +17 -12
  389. package/dist/routes/platformOwner/workspaces-admin.js +122 -28
  390. package/dist/routes/platformOwner/workspaces-admin.js.map +1 -1
  391. package/dist/routes/public/index.d.ts +1 -0
  392. package/dist/routes/public/index.js +1 -0
  393. package/dist/routes/public/index.js.map +1 -1
  394. package/dist/routes/public/legal-documents.d.ts +2 -8
  395. package/dist/routes/public/legal-documents.js +4 -39
  396. package/dist/routes/public/legal-documents.js.map +1 -1
  397. package/dist/routes/public/pricing.d.ts +12 -0
  398. package/dist/routes/public/pricing.js +50 -0
  399. package/dist/routes/public/pricing.js.map +1 -0
  400. package/dist/routes/public/public-plan-catalog.d.ts +37 -0
  401. package/dist/routes/public/public-plan-catalog.js +63 -0
  402. package/dist/routes/public/public-plan-catalog.js.map +1 -0
  403. package/dist/routes/public/register.d.ts +13 -0
  404. package/dist/routes/public/register.js +88 -4
  405. package/dist/routes/public/register.js.map +1 -1
  406. package/dist/routes/tenant/billing-pay-invoice.d.ts +13 -0
  407. package/dist/routes/tenant/billing-pay-invoice.js +82 -0
  408. package/dist/routes/tenant/billing-pay-invoice.js.map +1 -0
  409. package/dist/routes/tenant/billing-portal.d.ts +8 -3
  410. package/dist/routes/tenant/billing-portal.js +34 -16
  411. package/dist/routes/tenant/billing-portal.js.map +1 -1
  412. package/dist/routes/tenant/billing-self-refund.d.ts +26 -1
  413. package/dist/routes/tenant/billing-self-refund.js +95 -46
  414. package/dist/routes/tenant/billing-self-refund.js.map +1 -1
  415. package/dist/routes/tenant/complimentary-banner.d.ts +12 -0
  416. package/dist/routes/tenant/complimentary-banner.js +64 -0
  417. package/dist/routes/tenant/complimentary-banner.js.map +1 -0
  418. package/dist/routes/tenant/data-export.js +14 -0
  419. package/dist/routes/tenant/data-export.js.map +1 -1
  420. package/dist/routes/tenant/index.d.ts +7 -0
  421. package/dist/routes/tenant/index.js +7 -0
  422. package/dist/routes/tenant/index.js.map +1 -1
  423. package/dist/routes/tenant/tenant-billing.d.ts +1 -0
  424. package/dist/routes/tenant/tenant-billing.js +18 -13
  425. package/dist/routes/tenant/tenant-billing.js.map +1 -1
  426. package/dist/routes/tenant/tenant-plan-authentication.d.ts +13 -0
  427. package/dist/routes/tenant/tenant-plan-authentication.js +79 -0
  428. package/dist/routes/tenant/tenant-plan-authentication.js.map +1 -0
  429. package/dist/routes/tenant/tenant-plan-cancellation.d.ts +12 -0
  430. package/dist/routes/tenant/tenant-plan-cancellation.js +87 -0
  431. package/dist/routes/tenant/tenant-plan-cancellation.js.map +1 -0
  432. package/dist/routes/tenant/tenant-plan-checkout.d.ts +3 -0
  433. package/dist/routes/tenant/tenant-plan-checkout.js +21 -11
  434. package/dist/routes/tenant/tenant-plan-checkout.js.map +1 -1
  435. package/dist/routes/tenant/tenant-plan-ops.d.ts +32 -2
  436. package/dist/routes/tenant/tenant-plan-ops.js +112 -39
  437. package/dist/routes/tenant/tenant-plan-ops.js.map +1 -1
  438. package/dist/routes/tenant/tenant-plan-preview.d.ts +33 -0
  439. package/dist/routes/tenant/tenant-plan-preview.js +216 -0
  440. package/dist/routes/tenant/tenant-plan-preview.js.map +1 -0
  441. package/dist/routes/tenant/tenant-plan-resubscription.d.ts +2 -0
  442. package/dist/routes/tenant/tenant-plan-resubscription.js +61 -0
  443. package/dist/routes/tenant/tenant-plan-resubscription.js.map +1 -0
  444. package/dist/routes/tenant/tenant-plan.d.ts +9 -4
  445. package/dist/routes/tenant/tenant-plan.js +124 -16
  446. package/dist/routes/tenant/tenant-plan.js.map +1 -1
  447. package/dist/routes/tenant/tenant-seats.d.ts +6 -1
  448. package/dist/routes/tenant/tenant-seats.js +26 -5
  449. package/dist/routes/tenant/tenant-seats.js.map +1 -1
  450. package/dist/routes/tenant/tenant-upcoming-invoice.d.ts +26 -0
  451. package/dist/routes/tenant/tenant-upcoming-invoice.js +200 -0
  452. package/dist/routes/tenant/tenant-upcoming-invoice.js.map +1 -0
  453. package/dist/routes/tenant/workspace-access.d.ts +67 -0
  454. package/dist/routes/tenant/workspace-access.js +224 -0
  455. package/dist/routes/tenant/workspace-access.js.map +1 -0
  456. package/dist/routes/tenant/workspaces.d.ts +12 -43
  457. package/dist/routes/tenant/workspaces.js +82 -192
  458. package/dist/routes/tenant/workspaces.js.map +1 -1
  459. package/dist/segments/index.d.ts +29 -0
  460. package/dist/segments/index.js +116 -0
  461. package/dist/segments/index.js.map +1 -0
  462. package/dist/stripe/client.d.ts +1 -0
  463. package/dist/stripe/client.js +11 -0
  464. package/dist/stripe/client.js.map +1 -1
  465. package/dist/stripe/customer-locale.d.ts +3 -0
  466. package/dist/stripe/customer-locale.js +36 -0
  467. package/dist/stripe/customer-locale.js.map +1 -0
  468. package/dist/stripe/dashboard-links.d.ts +2 -0
  469. package/dist/stripe/dashboard-links.js +8 -0
  470. package/dist/stripe/dashboard-links.js.map +1 -0
  471. package/dist/stripe/index.d.ts +3 -0
  472. package/dist/stripe/index.js +3 -0
  473. package/dist/stripe/index.js.map +1 -1
  474. package/dist/stripe/pending-update.d.ts +5 -0
  475. package/dist/stripe/pending-update.js +56 -0
  476. package/dist/stripe/pending-update.js.map +1 -0
  477. package/dist/stripe/plan-schedule.js +4 -1
  478. package/dist/stripe/plan-schedule.js.map +1 -1
  479. package/dist/stripe/subscription-cancellation.d.ts +3 -0
  480. package/dist/stripe/subscription-cancellation.js +26 -0
  481. package/dist/stripe/subscription-cancellation.js.map +1 -0
  482. package/dist/stripe/sync-plan.js +5 -6
  483. package/dist/stripe/sync-plan.js.map +1 -1
  484. package/dist/stripe/upcoming-invoice.d.ts +9 -0
  485. package/dist/stripe/upcoming-invoice.js +19 -3
  486. package/dist/stripe/upcoming-invoice.js.map +1 -1
  487. package/dist/stripe/webhook-checkout.js +2 -0
  488. package/dist/stripe/webhook-checkout.js.map +1 -1
  489. package/dist/stripe/webhook-credit-notes.js +15 -0
  490. package/dist/stripe/webhook-credit-notes.js.map +1 -1
  491. package/dist/stripe/webhook-dispatch.js +2 -0
  492. package/dist/stripe/webhook-dispatch.js.map +1 -1
  493. package/dist/stripe/webhook-handlers.d.ts +1 -0
  494. package/dist/stripe/webhook-handlers.js +34 -9
  495. package/dist/stripe/webhook-handlers.js.map +1 -1
  496. package/dist/stripe/webhook-shared.d.ts +3 -1
  497. package/dist/stripe/webhook-shared.js +20 -1
  498. package/dist/stripe/webhook-shared.js.map +1 -1
  499. package/dist/stripe/workspace-checkout.d.ts +2 -0
  500. package/dist/stripe/workspace-checkout.js +4 -0
  501. package/dist/stripe/workspace-checkout.js.map +1 -1
  502. package/dist/types/config.d.ts +2 -0
  503. package/dist/types/config.js.map +1 -1
  504. package/dist/upcoming-invoice/mapping.js +1 -0
  505. package/dist/upcoming-invoice/mapping.js.map +1 -1
  506. package/dist/users/index.d.ts +4 -0
  507. package/dist/users/index.js +21 -0
  508. package/dist/users/index.js.map +1 -0
  509. package/dist/users/platform-role.d.ts +18 -0
  510. package/dist/users/platform-role.js +127 -0
  511. package/dist/users/platform-role.js.map +1 -0
  512. package/dist/users/user-detail.d.ts +43 -0
  513. package/dist/users/user-detail.js +100 -0
  514. package/dist/users/user-detail.js.map +1 -0
  515. package/dist/users/user-facts.d.ts +10 -0
  516. package/dist/users/user-facts.js +157 -0
  517. package/dist/users/user-facts.js.map +1 -0
  518. package/dist/users/user-segments.d.ts +10 -0
  519. package/dist/users/user-segments.js +32 -0
  520. package/dist/users/user-segments.js.map +1 -0
  521. package/dist/utils/billing-displays.d.ts +6 -0
  522. package/dist/utils/billing-displays.js +17 -0
  523. package/dist/utils/billing-displays.js.map +1 -0
  524. package/dist/utils/billing-document-status.d.ts +0 -4
  525. package/dist/utils/billing-document-status.js +1 -13
  526. package/dist/utils/billing-document-status.js.map +1 -1
  527. package/dist/utils/billing-document-type.d.ts +6 -0
  528. package/dist/utils/billing-document-type.js +13 -0
  529. package/dist/utils/billing-document-type.js.map +1 -1
  530. package/dist/utils/csv-file.d.ts +2 -0
  531. package/dist/utils/csv-file.js +23 -0
  532. package/dist/utils/csv-file.js.map +1 -0
  533. package/dist/utils/form-insight-type.d.ts +8 -0
  534. package/dist/utils/form-insight-type.js +34 -0
  535. package/dist/utils/form-insight-type.js.map +1 -0
  536. package/dist/utils/index.d.ts +8 -0
  537. package/dist/utils/index.js +8 -0
  538. package/dist/utils/index.js.map +1 -1
  539. package/dist/utils/language.d.ts +1 -0
  540. package/dist/utils/language.js +7 -0
  541. package/dist/utils/language.js.map +1 -0
  542. package/dist/utils/money.d.ts +2 -0
  543. package/dist/utils/money.js +24 -0
  544. package/dist/utils/money.js.map +1 -0
  545. package/dist/utils/segment-evaluator.d.ts +4 -0
  546. package/dist/utils/segment-evaluator.js +15 -8
  547. package/dist/utils/segment-evaluator.js.map +1 -1
  548. package/dist/utils/segment-explain.d.ts +10 -0
  549. package/dist/utils/segment-explain.js +31 -0
  550. package/dist/utils/segment-explain.js.map +1 -0
  551. package/dist/utils/segment-fields.d.ts +13 -2
  552. package/dist/utils/segment-fields.js +137 -116
  553. package/dist/utils/segment-fields.js.map +1 -1
  554. package/dist/utils/segment-matching.d.ts +14 -3
  555. package/dist/utils/segment-matching.js +47 -13
  556. package/dist/utils/segment-matching.js.map +1 -1
  557. package/dist/utils/segment-preview.d.ts +31 -0
  558. package/dist/utils/segment-preview.js +83 -0
  559. package/dist/utils/segment-preview.js.map +1 -0
  560. package/dist/utils/segment-user-projection.d.ts +3 -0
  561. package/dist/utils/segment-user-projection.js +31 -0
  562. package/dist/utils/segment-user-projection.js.map +1 -0
  563. package/dist/utils/segment-validation.d.ts +14 -0
  564. package/dist/utils/segment-validation.js +98 -0
  565. package/dist/utils/segment-validation.js.map +1 -0
  566. package/dist/utils/status-vocabulary.d.ts +57 -0
  567. package/dist/utils/status-vocabulary.js +92 -0
  568. package/dist/utils/status-vocabulary.js.map +1 -0
  569. package/dist/workers/index.d.ts +1 -0
  570. package/dist/workers/index.js +1 -0
  571. package/dist/workers/index.js.map +1 -1
  572. package/dist/workers/plan-migration-resolution.d.ts +14 -0
  573. package/dist/workers/plan-migration-resolution.js +99 -0
  574. package/dist/workers/plan-migration-resolution.js.map +1 -0
  575. package/dist/workers/plan-migration.d.ts +6 -1
  576. package/dist/workers/plan-migration.js +152 -37
  577. package/dist/workers/plan-migration.js.map +1 -1
  578. package/dist/workspaces/billing-identity-lock.d.ts +1 -0
  579. package/dist/workspaces/billing-identity-lock.js +18 -0
  580. package/dist/workspaces/billing-identity-lock.js.map +1 -0
  581. package/dist/workspaces/complimentary-banner.d.ts +11 -0
  582. package/dist/workspaces/complimentary-banner.js +83 -0
  583. package/dist/workspaces/complimentary-banner.js.map +1 -0
  584. package/dist/workspaces/default-member-role.d.ts +2 -0
  585. package/dist/workspaces/default-member-role.js +43 -0
  586. package/dist/workspaces/default-member-role.js.map +1 -0
  587. package/dist/workspaces/deletion-request.d.ts +2 -0
  588. package/dist/workspaces/deletion-request.js +5 -0
  589. package/dist/workspaces/deletion-request.js.map +1 -0
  590. package/dist/workspaces/deletion.d.ts +1 -1
  591. package/dist/workspaces/deletion.js +19 -7
  592. package/dist/workspaces/deletion.js.map +1 -1
  593. package/dist/workspaces/detail-items.d.ts +15 -0
  594. package/dist/workspaces/detail-items.js +226 -0
  595. package/dist/workspaces/detail-items.js.map +1 -0
  596. package/dist/workspaces/first-payment.d.ts +5 -0
  597. package/dist/workspaces/first-payment.js +28 -0
  598. package/dist/workspaces/first-payment.js.map +1 -0
  599. package/dist/workspaces/free-workspaces-per-card.d.ts +6 -0
  600. package/dist/workspaces/free-workspaces-per-card.js +58 -0
  601. package/dist/workspaces/free-workspaces-per-card.js.map +1 -0
  602. package/dist/workspaces/index.d.ts +7 -0
  603. package/dist/workspaces/index.js +7 -0
  604. package/dist/workspaces/index.js.map +1 -1
  605. package/dist/workspaces/invitations.d.ts +2 -1
  606. package/dist/workspaces/invitations.js +16 -6
  607. package/dist/workspaces/invitations.js.map +1 -1
  608. package/dist/workspaces/my-workspaces.d.ts +13 -0
  609. package/dist/workspaces/my-workspaces.js +68 -0
  610. package/dist/workspaces/my-workspaces.js.map +1 -0
  611. package/dist/workspaces/operator-creation.d.ts +39 -0
  612. package/dist/workspaces/operator-creation.js +123 -0
  613. package/dist/workspaces/operator-creation.js.map +1 -0
  614. package/dist/workspaces/operator-view.d.ts +13 -0
  615. package/dist/workspaces/operator-view.js +37 -0
  616. package/dist/workspaces/operator-view.js.map +1 -0
  617. package/dist/workspaces/owner-contact.d.ts +7 -0
  618. package/dist/workspaces/owner-contact.js +24 -0
  619. package/dist/workspaces/owner-contact.js.map +1 -0
  620. package/dist/workspaces/owner-invitation-email.d.ts +12 -0
  621. package/dist/workspaces/owner-invitation-email.js +53 -0
  622. package/dist/workspaces/owner-invitation-email.js.map +1 -0
  623. package/dist/workspaces/provisioning.d.ts +2 -0
  624. package/dist/workspaces/provisioning.js +37 -15
  625. package/dist/workspaces/provisioning.js.map +1 -1
  626. package/dist/workspaces/self-serve-creation.d.ts +38 -0
  627. package/dist/workspaces/self-serve-creation.js +106 -0
  628. package/dist/workspaces/self-serve-creation.js.map +1 -0
  629. package/dist/workspaces/workspace-glance.d.ts +3 -0
  630. package/dist/workspaces/workspace-glance.js +93 -0
  631. package/dist/workspaces/workspace-glance.js.map +1 -0
  632. package/dist/workspaces/workspace-name.d.ts +2 -0
  633. package/dist/workspaces/workspace-name.js +14 -0
  634. package/dist/workspaces/workspace-name.js.map +1 -0
  635. package/dist/workspaces/workspace-overview.d.ts +41 -0
  636. package/dist/workspaces/workspace-overview.js +84 -0
  637. package/dist/workspaces/workspace-overview.js.map +1 -0
  638. package/dist/workspaces/workspace-owner.d.ts +7 -0
  639. package/dist/workspaces/workspace-owner.js +14 -0
  640. package/dist/workspaces/workspace-owner.js.map +1 -0
  641. package/frontend-vue/app/build/PayInvoiceDialog.vue +40 -0
  642. package/frontend-vue/app/build/PayInvoicePanel.vue +203 -0
  643. package/frontend-vue/app/build/PlanChangeReview.vue +415 -0
  644. package/frontend-vue/app/build/PlanFeatureValueInput.vue +143 -0
  645. package/frontend-vue/app/build/PlanPermissionPicker.vue +246 -0
  646. package/frontend-vue/app/build/WorkspaceSwitcherRow.vue +116 -0
  647. package/frontend-vue/app/build/components/CreditNoteInvoiceSummary.vue +82 -0
  648. package/frontend-vue/app/build/components/FormFieldRow.vue +97 -0
  649. package/frontend-vue/app/build/components/FormRows.vue +26 -0
  650. package/frontend-vue/app/build/components/RequiredLegend.vue +7 -0
  651. package/frontend-vue/app/build/composables/useCreditNoteDraft.ts +142 -0
  652. package/frontend-vue/app/build/composables/useCreditNoteTexts.ts +123 -0
  653. package/frontend-vue/app/build/composables/useLiveFormValues.ts +49 -0
  654. package/frontend-vue/app/build/day-formats.ts +17 -0
  655. package/frontend-vue/app/build/highlight.ts +28 -0
  656. package/frontend-vue/app/build/plan-catalog.ts +161 -0
  657. package/frontend-vue/app/build/plan-change-heading.ts +81 -0
  658. package/frontend-vue/app/build/plan-permissions.ts +92 -0
  659. package/frontend-vue/app/build/plan-retire.ts +83 -0
  660. package/frontend-vue/app/build/public/AccessTimeline.vue +68 -0
  661. package/frontend-vue/app/build/public/LegalAcceptance.vue +51 -0
  662. package/frontend-vue/app/build/public/OtherWorkspaces.vue +88 -0
  663. package/frontend-vue/app/build/public/PricingComparison.vue +227 -0
  664. package/frontend-vue/app/build/public/PricingFaq.vue +76 -0
  665. package/frontend-vue/app/build/public/PublicStage.vue +72 -0
  666. package/frontend-vue/app/build/public/RegistrationCardField.vue +74 -0
  667. package/frontend-vue/app/build/public/RegistrationPlanCard.vue +122 -0
  668. package/frontend-vue/app/build/public/access.ts +118 -0
  669. package/frontend-vue/app/build/public/chosen-plan.ts +36 -0
  670. package/frontend-vue/app/build/public/legal.ts +99 -0
  671. package/frontend-vue/app/build/public/pricing.ts +175 -0
  672. package/frontend-vue/app/build/public/routes.ts +122 -0
  673. package/frontend-vue/app/build/public/usePublicFetch.ts +44 -0
  674. package/frontend-vue/app/build/public/usePublicPlanFormat.ts +52 -0
  675. package/frontend-vue/app/build/segments/tree.ts +137 -0
  676. package/frontend-vue/app/build/segments/types.ts +119 -0
  677. package/frontend-vue/app/build/segments/useSegmentCatalog.ts +58 -0
  678. package/frontend-vue/app/build/segments/useSegmentDraft.ts +33 -0
  679. package/frontend-vue/app/build/segments/useSegmentPreview.ts +78 -0
  680. package/frontend-vue/app/build/segments/useSegmentSentence.ts +60 -0
  681. package/frontend-vue/app/build/segments/useSegmentWords.ts +204 -0
  682. package/frontend-vue/app/build/useWorkspaceName.ts +14 -0
  683. package/frontend-vue/app/build/users/useUserDetail.ts +82 -0
  684. package/frontend-vue/app/build/workspace-detail/ComplimentaryDialog.vue +219 -0
  685. package/frontend-vue/app/build/workspace-detail/CreditDialog.vue +243 -0
  686. package/frontend-vue/app/build/workspace-detail/UpgradeDialog.vue +258 -0
  687. package/frontend-vue/app/build/workspace-detail/WorkspaceActionDialogs.vue +82 -0
  688. package/frontend-vue/app/build/workspace-detail/planPrice.ts +26 -0
  689. package/frontend-vue/app/build/workspace-detail/types.ts +138 -0
  690. package/frontend-vue/app/build/workspace-detail/useWorkspaceActions.ts +177 -0
  691. package/frontend-vue/app/build/workspace-detail/useWorkspaceOverview.ts +44 -0
  692. package/frontend-vue/app/build/workspace-paths.ts +8 -0
  693. package/frontend-vue/app/components/BillingIdentityFields.vue +294 -161
  694. package/frontend-vue/app/components/CustomerPortalButton.vue +80 -32
  695. package/frontend-vue/app/components/DataExport.vue +250 -260
  696. package/frontend-vue/app/components/DataExportHistory.vue +246 -0
  697. package/frontend-vue/app/components/DunningTimeline.vue +120 -0
  698. package/frontend-vue/app/components/IssueCreditNoteModal.vue +318 -116
  699. package/frontend-vue/app/components/LegalDocumentRelease.vue +64 -0
  700. package/frontend-vue/app/components/LegalLayout.vue +284 -46
  701. package/frontend-vue/app/components/MigrationStripeCheck.vue +133 -0
  702. package/frontend-vue/app/components/PastDueAlert.vue +186 -78
  703. package/frontend-vue/app/components/PastDueBanner.vue +96 -67
  704. package/frontend-vue/app/components/PayInvoiceModal.vue +57 -0
  705. package/frontend-vue/app/components/PaymentMethodCard.vue +159 -163
  706. package/frontend-vue/app/components/PendingCheckoutModal.vue +61 -61
  707. package/frontend-vue/app/components/PlanAccessEditor.vue +410 -0
  708. package/frontend-vue/app/components/PlanCard.vue +358 -261
  709. package/frontend-vue/app/components/PlanCardPublic.vue +123 -51
  710. package/frontend-vue/app/components/PlanComparisonModal.vue +373 -309
  711. package/frontend-vue/app/components/PlanEditorPreview.vue +374 -0
  712. package/frontend-vue/app/components/PlanLimitInput.vue +92 -0
  713. package/frontend-vue/app/components/PlanTaxSync.vue +118 -0
  714. package/frontend-vue/app/components/PlanUpgradeModal.vue +265 -156
  715. package/frontend-vue/app/components/PlatformNotes.vue +215 -255
  716. package/frontend-vue/app/components/Pricing.vue +236 -0
  717. package/frontend-vue/app/components/PublicNavBar.vue +70 -0
  718. package/frontend-vue/app/components/RefundButton.vue +265 -113
  719. package/frontend-vue/app/components/RefundExample.vue +86 -0
  720. package/frontend-vue/app/components/Register.vue +217 -121
  721. package/frontend-vue/app/components/RegistrationClosed.vue +30 -13
  722. package/frontend-vue/app/components/RetirePlanModal.vue +829 -0
  723. package/frontend-vue/app/components/SeatQuotaBanner.vue +240 -90
  724. package/frontend-vue/app/components/SegmentConditionRow.vue +171 -0
  725. package/frontend-vue/app/components/SegmentConditionsBuilder.vue +89 -162
  726. package/frontend-vue/app/components/SegmentConditionsGroup.vue +273 -463
  727. package/frontend-vue/app/components/SegmentLivePreview.vue +301 -0
  728. package/frontend-vue/app/components/SegmentLogicToggle.vue +24 -0
  729. package/frontend-vue/app/components/SegmentRulesText.vue +57 -0
  730. package/frontend-vue/app/components/SegmentValueInput.vue +165 -0
  731. package/frontend-vue/app/components/SegmentWords.vue +36 -0
  732. package/frontend-vue/app/components/TenantBillingForm.vue +142 -103
  733. package/frontend-vue/app/components/TenantPlanCard.vue +635 -280
  734. package/frontend-vue/app/components/TrialEndingBanner.vue +76 -0
  735. package/frontend-vue/app/components/UserPlatformRoleCard.vue +102 -0
  736. package/frontend-vue/app/components/UserSegmentMatches.vue +123 -0
  737. package/frontend-vue/app/components/UserSummaryCard.vue +107 -158
  738. package/frontend-vue/app/components/WorkspaceAdminCreateModal.vue +354 -177
  739. package/frontend-vue/app/components/WorkspaceCreateModal.vue +372 -252
  740. package/frontend-vue/app/components/WorkspaceDangerZone.vue +178 -126
  741. package/frontend-vue/app/components/WorkspaceDetailHeader.vue +262 -19
  742. package/frontend-vue/app/components/WorkspaceInvitationLink.vue +108 -86
  743. package/frontend-vue/app/components/WorkspaceOperatorActions.vue +105 -330
  744. package/frontend-vue/app/components/WorkspaceSuspendButton.vue +34 -158
  745. package/frontend-vue/app/components/WorkspaceSuspended.vue +390 -149
  746. package/frontend-vue/app/components/WorkspaceSwitcherWidget.vue +145 -161
  747. package/frontend-vue/app/composables/useBillingIdentity.ts +97 -95
  748. package/frontend-vue/app/composables/useBillingStatus.ts +56 -24
  749. package/frontend-vue/app/composables/useCurrentWorkspace.ts +15 -30
  750. package/frontend-vue/app/composables/useDaysLeft.ts +20 -0
  751. package/frontend-vue/app/composables/useExportHistory.ts +209 -120
  752. package/frontend-vue/app/composables/useInvitationLink.ts +39 -53
  753. package/frontend-vue/app/composables/useMoneyFormat.ts +64 -33
  754. package/frontend-vue/app/composables/useMyWorkspaces.ts +41 -32
  755. package/frontend-vue/app/composables/useNextInvoice.ts +20 -0
  756. package/frontend-vue/app/composables/usePayInvoice.ts +52 -0
  757. package/frontend-vue/app/composables/usePendingCheckout.ts +71 -67
  758. package/frontend-vue/app/composables/usePlanCatalog.ts +16 -0
  759. package/frontend-vue/app/composables/usePlanChangeReview.ts +115 -0
  760. package/frontend-vue/app/composables/usePlanComparison.ts +17 -8
  761. package/frontend-vue/app/composables/usePlanDowngrade.ts +25 -23
  762. package/frontend-vue/app/composables/usePlanFeatureFormat.ts +238 -202
  763. package/frontend-vue/app/composables/usePlanPriceLabel.ts +28 -0
  764. package/frontend-vue/app/composables/useSaasRegistration.ts +516 -301
  765. package/frontend-vue/app/composables/useSaasStatus.ts +81 -0
  766. package/frontend-vue/app/composables/useSeatQuota.ts +27 -17
  767. package/frontend-vue/app/composables/useServerConfirm.ts +44 -0
  768. package/frontend-vue/app/composables/useStripePaymentElement.ts +3 -5
  769. package/frontend-vue/app/composables/useTenantPlan.ts +235 -99
  770. package/frontend-vue/app/composables/useUpgradeAuthentication.ts +37 -0
  771. package/frontend-vue/app/composables/useWorkspaceFinalization.ts +4 -0
  772. package/frontend-vue/app/composables/useWorkspaceOverview.ts +58 -0
  773. package/frontend-vue/app/composables/useWorkspaceRenamed.ts +33 -0
  774. package/frontend-vue/app/custom-pages/auth/no-workspace.vue +391 -312
  775. package/frontend-vue/app/plugins/auth-links.ts +38 -17
  776. package/frontend-vue/app/plugins/billing-data-types.ts +111 -58
  777. package/frontend-vue/app/plugins/footer-links.ts +13 -33
  778. package/frontend-vue/app/plugins/segment-conditions-data-type.ts +45 -0
  779. package/frontend-vue/app/plugins/sidebar-widgets.ts +13 -10
  780. package/frontend-vue/app/types/runtime-config.ts +9 -4
  781. package/frontend-vue/dms.frontend.build.ts +7 -0
  782. package/frontend-vue/dms.frontend.ts +6 -13
  783. package/frontend-vue/i18n/locales/saas-en-GB.json +499 -1380
  784. package/frontend-vue/i18n/locales/saas-fr-FR.json +499 -1380
  785. package/frontend-vue/i18n/locales/saas-operator-billing-en-GB.json +282 -0
  786. package/frontend-vue/i18n/locales/saas-operator-billing-fr-FR.json +282 -0
  787. package/frontend-vue/i18n/locales/saas-operator-catalog-en-GB.json +597 -0
  788. package/frontend-vue/i18n/locales/saas-operator-catalog-fr-FR.json +597 -0
  789. package/frontend-vue/i18n/locales/saas-operator-users-en-GB.json +505 -0
  790. package/frontend-vue/i18n/locales/saas-operator-users-fr-FR.json +505 -0
  791. package/frontend-vue/i18n/locales/saas-operator-workspaces-en-GB.json +595 -0
  792. package/frontend-vue/i18n/locales/saas-operator-workspaces-fr-FR.json +595 -0
  793. package/frontend-vue/i18n/locales/saas-public-en-GB.json +305 -0
  794. package/frontend-vue/i18n/locales/saas-public-fr-FR.json +305 -0
  795. package/frontend-vue/i18n/locales/saas-tenant-billing-en-GB.json +434 -0
  796. package/frontend-vue/i18n/locales/saas-tenant-billing-fr-FR.json +434 -0
  797. package/frontend-vue/i18n/locales/saas-tenant-workspace-en-GB.json +252 -0
  798. package/frontend-vue/i18n/locales/saas-tenant-workspace-fr-FR.json +252 -0
  799. package/frontend-vue/package.json +1 -1
  800. package/package.json +10 -10
  801. package/frontend-vue/app/components/CardGrid.vue +0 -77
  802. package/frontend-vue/app/components/DeletePlanModal.vue +0 -223
  803. package/frontend-vue/app/components/FreeAccessBanner.vue +0 -70
  804. package/frontend-vue/app/components/PlanCardsDisplay.vue +0 -127
  805. package/frontend-vue/app/components/PlanInheritancePicker.vue +0 -329
  806. package/frontend-vue/app/components/RecentActivity.vue +0 -72
  807. package/frontend-vue/app/components/WorkspaceBillingInfo.vue +0 -68
  808. package/frontend-vue/app/components/WorkspaceCompAccessButton.vue +0 -198
  809. package/frontend-vue/app/components/WorkspaceIdentity.vue +0 -99
  810. package/frontend-vue/app/components/WorkspaceJoinButton.vue +0 -50
  811. package/frontend-vue/app/components/WorkspaceSummaryCard.vue +0 -185
  812. package/frontend-vue/app/composables/useDetailRefresh.ts +0 -17
  813. package/frontend-vue/app/composables/usePastDueBannerAction.ts +0 -20
  814. package/frontend-vue/app/plugins/plan-cards-display.ts +0 -16
  815. package/frontend-vue/app/plugins/segment-conditions-data-type.client.ts +0 -122
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.SaasTenantPlanAuthenticationController = void 0;
16
+ exports.confirmOwnerUpgrade = confirmOwnerUpgrade;
17
+ const promises_1 = require("node:timers/promises");
18
+ const interface_api_1 = require("@antelopejs/interface-api");
19
+ const interface_api_util_1 = require("@antelopejs/interface-api-util");
20
+ const interface_database_decorators_1 = require("@antelopejs/interface-database-decorators");
21
+ const guards_1 = require("@antelopejs/interface-dms/guards");
22
+ const request_tenant_1 = require("@antelopejs/interface-dms/request-tenant");
23
+ const tenant_scoped_model_1 = require("@antelopejs/interface-dms/tenant-scoped-model");
24
+ const db_1 = require("../../db");
25
+ const client_1 = require("../../stripe/client");
26
+ const pending_update_1 = require("../../stripe/pending-update");
27
+ const applied_upgrade_1 = require("../../plan-changes/applied-upgrade");
28
+ const tenant_plan_ops_1 = require("./tenant-plan-ops");
29
+ const HTTP_PAYMENT_REQUIRED = 402;
30
+ const SETTLE_POLL_ATTEMPTS = 6;
31
+ const SETTLE_POLL_INTERVAL_MS = 500;
32
+ async function waitForAppliedUpdate(stripeSubscriptionId) {
33
+ for (let attempt = 0; attempt < SETTLE_POLL_ATTEMPTS; attempt += 1) {
34
+ await (0, promises_1.setTimeout)(SETTLE_POLL_INTERVAL_MS);
35
+ const current = await (0, client_1.getStripeClient)().subscriptions.retrieve(stripeSubscriptionId);
36
+ if (!current.pending_update)
37
+ return current;
38
+ }
39
+ return null;
40
+ }
41
+ async function settlePendingUpgrade(stripeSubscription) {
42
+ if (!stripeSubscription.pending_update)
43
+ return stripeSubscription;
44
+ if (await (0, pending_update_1.isPendingPaymentTaken)(stripeSubscription)) {
45
+ return waitForAppliedUpdate(stripeSubscription.id);
46
+ }
47
+ await (0, pending_update_1.discardPendingUpdate)(stripeSubscription);
48
+ throw new interface_api_1.HTTPResult(HTTP_PAYMENT_REQUIRED, "saas.errors.plan.upgrade_authentication_failed");
49
+ }
50
+ async function confirmOwnerUpgrade(tenantId, subscription, plan, model) {
51
+ const applied = { ...tenant_plan_ops_1.UNCHANGED_RESULT_BASE, changed: true, planId: plan._id };
52
+ (0, interface_api_util_1.assert)(subscription?.stripeSubscriptionId, tenant_plan_ops_1.HTTP_BAD_REQUEST, "saas.errors.workspace.no_active_subscription");
53
+ if (subscription.planId === plan._id)
54
+ return applied;
55
+ const settled = await settlePendingUpgrade(await (0, client_1.getStripeClient)().subscriptions.retrieve(subscription.stripeSubscriptionId));
56
+ if (!settled)
57
+ return applied;
58
+ (0, interface_api_util_1.assert)((0, applied_upgrade_1.billedPriceId)(settled) === plan.paymentProviderRefs?.stripePriceId, tenant_plan_ops_1.HTTP_CONFLICT, "saas.errors.plan.upgrade_not_applied");
59
+ await (0, applied_upgrade_1.recordUnlessAlreadyApplied)(tenantId, subscription, plan, model);
60
+ return applied;
61
+ }
62
+ class SaasTenantPlanAuthenticationController extends (0, interface_api_1.Controller)("/api/saas/tenant/plan/authentication") {
63
+ async confirmUpgrade(_user, body, ctx, tenantSubscriptionModel) {
64
+ const plan = await (0, tenant_plan_ops_1.loadSellablePlan)((0, interface_database_decorators_1.GetModel)(db_1.PlanModel), body.planId);
65
+ return confirmOwnerUpgrade((0, request_tenant_1.getRequestTenantId)(ctx), await tenantSubscriptionModel.findOne(), plan, tenantSubscriptionModel);
66
+ }
67
+ }
68
+ exports.SaasTenantPlanAuthenticationController = SaasTenantPlanAuthenticationController;
69
+ __decorate([
70
+ (0, interface_api_1.Post)("/"),
71
+ __param(0, (0, guards_1.AuthTenantOwner)({ bypassTenantAccessGate: true })),
72
+ __param(1, (0, interface_api_1.JSONBody)()),
73
+ __param(2, (0, interface_api_1.Context)()),
74
+ __param(3, (0, tenant_scoped_model_1.TenantScopedModel)(db_1.TenantSubscriptionModel)),
75
+ __metadata("design:type", Function),
76
+ __metadata("design:paramtypes", [Function, Object, Object, db_1.TenantSubscriptionModel]),
77
+ __metadata("design:returntype", Promise)
78
+ ], SaasTenantPlanAuthenticationController.prototype, "confirmUpgrade", null);
79
+ //# sourceMappingURL=tenant-plan-authentication.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tenant-plan-authentication.js","sourceRoot":"","sources":["../../../src/routes/tenant/tenant-plan-authentication.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AA6FA,kDA2BC;AA9GD,mDAA2D;AAC3D,6DAOmC;AACnC,uEAAwD;AACxD,6FAAqE;AACrE,6DAAmE;AACnE,6EAA8E;AAC9E,uFAAkF;AAGlF,iCAKkB;AAClB,gDAAsD;AACtD,gEAGqC;AACrC,wEAG4C;AAC5C,uDAM2B;AAE3B,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAClC,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAC/B,MAAM,uBAAuB,GAAG,GAAG,CAAC;AAUpC,KAAK,UAAU,oBAAoB,CACjC,oBAA4B;IAE5B,KAAK,IAAI,OAAO,GAAG,CAAC,EAAE,OAAO,GAAG,oBAAoB,EAAE,OAAO,IAAI,CAAC,EAAE,CAAC;QACnE,MAAM,IAAA,qBAAK,EAAC,uBAAuB,CAAC,CAAC;QACrC,MAAM,OAAO,GACX,MAAM,IAAA,wBAAe,GAAE,CAAC,aAAa,CAAC,QAAQ,CAAC,oBAAoB,CAAC,CAAC;QACvE,IAAI,CAAC,OAAO,CAAC,cAAc;YAAE,OAAO,OAAO,CAAC;IAC9C,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAOD,KAAK,UAAU,oBAAoB,CACjC,kBAAuC;IAEvC,IAAI,CAAC,kBAAkB,CAAC,cAAc;QAAE,OAAO,kBAAkB,CAAC;IAClE,IAAI,MAAM,IAAA,sCAAqB,EAAC,kBAAkB,CAAC,EAAE,CAAC;QACpD,OAAO,oBAAoB,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC;IACrD,CAAC;IACD,MAAM,IAAA,qCAAoB,EAAC,kBAAkB,CA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uBAAuB,CAAC,OAAO,EAAE,EACvC,IAAI,EACJ,uBAAuB,CACxB,CAAC;IACJ,CAAC;CACF;AApBD,wFAoBC;AAfO;IADL,IAAA,oBAAI,EAAC,GAAG,CAAC;IAEP,WAAA,IAAA,wBAAe,EAAC,EAAE,sBAAsB,EAAE,IAAI,EAAE,CAAC,CAAA;IACjD,WAAA,IAAA,wBAAQ,GAAE,CAAA;IACV,WAAA,IAAA,uBAAO,GAAE,CAAA;IACT,WAAA,IAAA,uCAAiB,EAAC,4BAAuB,CAAC,CAAA;;+DAClB,4BAAuB;;4EASjD"}
@@ -0,0 +1,12 @@
1
+ import { type RequestContext } from "@antelopejs/interface-api";
2
+ import type { User } from "@antelopejs/interface-dms/auth/db";
3
+ import { TenantSubscriptionModel } from "../../db";
4
+ export interface CancellationResult {
5
+ cancelAt: Date | null;
6
+ }
7
+ declare const SaasTenantPlanCancellationController_base: import("@antelopejs/interface-api").ControllerClass<object>;
8
+ export declare class SaasTenantPlanCancellationController extends SaasTenantPlanCancellationController_base {
9
+ cancelAtPeriodEnd(_user: User, ctx: RequestContext, tenantSubscriptionModel: TenantSubscriptionModel): Promise<CancellationResult>;
10
+ keepSubscription(_user: User, ctx: RequestContext, tenantSubscriptionModel: TenantSubscriptionModel): Promise<CancellationResult>;
11
+ }
12
+ export {};
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.SaasTenantPlanCancellationController = void 0;
16
+ const node_crypto_1 = require("node:crypto");
17
+ const interface_api_1 = require("@antelopejs/interface-api");
18
+ const interface_api_util_1 = require("@antelopejs/interface-api-util");
19
+ const guards_1 = require("@antelopejs/interface-dms/guards");
20
+ const request_tenant_1 = require("@antelopejs/interface-dms/request-tenant");
21
+ const tenant_scoped_model_1 = require("@antelopejs/interface-dms/tenant-scoped-model");
22
+ const billing_state_1 = require("../../billing-state");
23
+ const db_1 = require("../../db");
24
+ const plan_changes_1 = require("../../plan-changes");
25
+ const plan_schedule_1 = require("../../stripe/plan-schedule");
26
+ const complimentary_1 = require("../../workspaces/complimentary");
27
+ const tenant_plan_ops_1 = require("./tenant-plan-ops");
28
+ const CANCEL_KIND = "cancel";
29
+ function assertStripeBilled(subscription) {
30
+ (0, interface_api_util_1.assert)(subscription?.stripeSubscriptionId &&
31
+ !(0, complimentary_1.isComplimentarySubscription)(subscription), tenant_plan_ops_1.HTTP_BAD_REQUEST, "saas.errors.workspace.no_active_subscription");
32
+ }
33
+ function assertNothingUnpaid(subscription) {
34
+ (0, interface_api_util_1.assert)(subscription.status !== tenant_plan_ops_1.PAST_DUE_STATUS, tenant_plan_ops_1.HTTP_CONFLICT, "saas.errors.plan.unpaid_invoice_blocks_cancellation");
35
+ }
36
+ function cancelIntent() {
37
+ return {
38
+ operationId: (0, node_crypto_1.randomUUID)(),
39
+ kind: CANCEL_KIND,
40
+ targetPlanId: null,
41
+ requestedAt: new Date(),
42
+ };
43
+ }
44
+ async function writeCancellation(tenantId, subscription, model, shouldCancel) {
45
+ const intent = cancelIntent();
46
+ await model.beginTransition(subscription, intent);
47
+ await (0, plan_changes_1.clearPendingPlanChange)(tenantId, subscription, intent.operationId);
48
+ const periodEnd = await (0, plan_schedule_1.setSubscriptionCancelAtPeriodEnd)(subscription.stripeSubscriptionId, shouldCancel);
49
+ await model.completeTransition(subscription._id, intent.operationId, {
50
+ updatedAt: new Date(),
51
+ });
52
+ await (0, billing_state_1.recomputeTenantBillingState)(tenantId);
53
+ return { cancelAt: shouldCancel ? periodEnd : null };
54
+ }
55
+ class SaasTenantPlanCancellationController extends (0, interface_api_1.Controller)("/api/saas/tenant/plan/cancellation") {
56
+ async cancelAtPeriodEnd(_user, ctx, tenantSubscriptionModel) {
57
+ const subscription = await tenantSubscriptionModel.findOne();
58
+ assertStripeBilled(subscription);
59
+ assertNothingUnpaid(subscription);
60
+ return writeCancellation((0, request_tenant_1.getRequestTenantId)(ctx), subscription, tenantSubscriptionModel, true);
61
+ }
62
+ async keepSubscription(_user, ctx, tenantSubscriptionModel) {
63
+ const subscription = await tenantSubscriptionModel.findOne();
64
+ assertStripeBilled(subscription);
65
+ return writeCancellation((0, request_tenant_1.getRequestTenantId)(ctx), subscription, tenantSubscriptionModel, false);
66
+ }
67
+ }
68
+ exports.SaasTenantPlanCancellationController = SaasTenantPlanCancellationController;
69
+ __decorate([
70
+ (0, interface_api_1.Post)("/"),
71
+ __param(0, (0, guards_1.AuthTenantOwner)()),
72
+ __param(1, (0, interface_api_1.Context)()),
73
+ __param(2, (0, tenant_scoped_model_1.TenantScopedModel)(db_1.TenantSubscriptionModel)),
74
+ __metadata("design:type", Function),
75
+ __metadata("design:paramtypes", [Function, Object, db_1.TenantSubscriptionModel]),
76
+ __metadata("design:returntype", Promise)
77
+ ], SaasTenantPlanCancellationController.prototype, "cancelAtPeriodEnd", null);
78
+ __decorate([
79
+ (0, interface_api_1.Delete)("/"),
80
+ __param(0, (0, guards_1.AuthTenantOwner)()),
81
+ __param(1, (0, interface_api_1.Context)()),
82
+ __param(2, (0, tenant_scoped_model_1.TenantScopedModel)(db_1.TenantSubscriptionModel)),
83
+ __metadata("design:type", Function),
84
+ __metadata("design:paramtypes", [Function, Object, db_1.TenantSubscriptionModel]),
85
+ __metadata("design:returntype", Promise)
86
+ ], SaasTenantPlanCancellationController.prototype, "keepSubscription", null);
87
+ //# sourceMappingURL=tenant-plan-cancellation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tenant-plan-cancellation.js","sourceRoot":"","sources":["../../../src/routes/tenant/tenant-plan-cancellation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAKA,6CAAyC;AACzC,6DAMmC;AACnC,uEAAwD;AACxD,6DAAmE;AACnE,6EAA8E;AAC9E,uFAAkF;AAElF,uDAAkE;AAClE,iCAIkB;AAClB,qDAA4D;AAC5D,8DAA8E;AAC9E,kEAA6E;AAC7E,uDAI2B;AAE3B,MAAM,WAAW,GAAG,QAAiB,CAAC;AAatC,SAAS,kBAAkB,CACzB,YAA4C;IAE5C,IAAA,2BAAM,EACJ,YAAY,EAAE,oBAAoB;QAChC,CAAC,IAAA,2CAA2B,EAAC,YAAY,CAAC,EAC5C,kCAAgB,EAChB,8CAA8C,CAC/C,CAAC;AACJ,CAAC;AAMD,SAAS,mBAAmB,CAAC,YAAgC;IAC3D,IAAA,2BAAM,EACJ,YAAY,CAAC,MAAM,KAAK,iCAAe,EACvC,+BAAa,EACb,qDAAqD,CACtD,CAAC;AACJ,CAAC;AAED,SAAS,YAAY;IACnB,OAAO;QACL,WAAW,EAAE,IAAA,wBAAU,GAAE;QACzB,IAAI,EAAE,WAAW;QACjB,YAAY,EAAE,IAAI;QAClB,WAAW,EAAE,IAAI,IAAI,EAAE;KACxB,CAAC;AACJ,CAAC;AAOD,KAAK,UAAU,iBAAiB,CAC9B,QAAgB,EAChB,YAAsC,EACtC,KAA8B,EAC9B,YAAqB;IAErB,MAAM,MAAM,GAAG,YAAY,EAAE,CAAC;IAC9B,MAAM,KAAK,CAAC,eAAe,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;IAClD,MAAM,IAAA,qCAAsB,EAAC,QAAQ,EAAE,YAAY,EAAE,MAAM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AAO,GAAE,CAAA;IACT,WAAA,IAAA,uCAAiB,EAAC,4BAAuB,CAAC,CAAA;;uDAClB,4BAAuB;;6EAWjD;AAIK;IADL,IAAA,sBAAM,EAAC,GAAG,CAAC;IAET,WAAA,IAAA,wBAAe,GAAE,CAAA;IACjB,WAAA,IAAA,uBAAO,GAAE,CAAA;IACT,WAAA,IAAA,uCAAiB,EAAC,4BAAuB,CAAC,CAAA;;uDAClB,4BAAuB;;4EAUjD"}
@@ -1,2 +1,5 @@
1
+ import { type Plan, type TenantSubscription } from "../../db";
1
2
  import { type ChangePlanResult, type PlanChangeRequest } from "./tenant-plan-ops";
3
+ export declare function isCheckoutTrialAvailable(plan: Plan, ownerEmail: string): Promise<boolean>;
4
+ export declare function isTrialOfferedOnChange(plan: Plan, subscription: TenantSubscription | undefined, ownerEmail: string): Promise<boolean>;
2
5
  export declare function startPaidCheckout(request: PlanChangeRequest): Promise<ChangePlanResult>;
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isCheckoutTrialAvailable = isCheckoutTrialAvailable;
4
+ exports.isTrialOfferedOnChange = isTrialOfferedOnChange;
3
5
  exports.startPaidCheckout = startPaidCheckout;
4
6
  const node_crypto_1 = require("node:crypto");
5
7
  const interface_api_1 = require("@antelopejs/interface-api");
@@ -36,20 +38,26 @@ function validateCheckoutRedirectInput(body) {
36
38
  (0, interface_api_util_1.assert)(cancelUrl && (0, config_1.isAllowedRedirectUrl)(cancelUrl), tenant_plan_ops_1.HTTP_BAD_REQUEST, "saas.errors.billing.invalid_return_url");
37
39
  return { successUrl, cancelUrl };
38
40
  }
41
+ async function isCheckoutTrialAvailable(plan, ownerEmail) {
42
+ if (!plan.trialDays || plan.trialDays <= 0)
43
+ return false;
44
+ const emailHash = (0, utils_1.hashEmail)(ownerEmail);
45
+ if (await (0, interface_database_decorators_1.GetModel)(db_1.TrialConsumptionModel).existsForIdentity(emailHash, null))
46
+ return false;
47
+ const identity = await (0, interface_database_decorators_1.GetModel)(trial_identity_model_1.TrialIdentityModel).get((0, trial_identity_model_1.trialIdentityId)("email", emailHash));
48
+ return !identity?.tenantId;
49
+ }
50
+ async function isTrialOfferedOnChange(plan, subscription, ownerEmail) {
51
+ if (!(0, tenant_plan_ops_1.startsPaidCheckout)(plan, subscription))
52
+ return false;
53
+ return isCheckoutTrialAvailable(plan, ownerEmail);
54
+ }
39
55
  async function resolveCheckoutTrial(request) {
40
56
  const { newPlan, user, tenantId } = request;
41
- if (!newPlan.trialDays || newPlan.trialDays <= 0)
42
- return NO_TRIAL;
43
- const trialConsumptionModel = (0, interface_database_decorators_1.GetModel)(db_1.TrialConsumptionModel);
44
- const emailHash = (0, utils_1.hashEmail)(user.email);
45
- if (await trialConsumptionModel.existsForIdentity(emailHash, null)) {
46
- return NO_TRIAL;
47
- }
48
- const identities = (0, interface_database_decorators_1.GetModel)(trial_identity_model_1.TrialIdentityModel);
49
- const id = (0, trial_identity_model_1.trialIdentityId)("email", emailHash);
50
- if ((await identities.get(id))?.tenantId)
57
+ if (!(await isCheckoutTrialAvailable(newPlan, user.email)))
51
58
  return NO_TRIAL;
52
- if (!(await identities.reserve(id, tenantId)))
59
+ const id = (0, trial_identity_model_1.trialIdentityId)("email", (0, utils_1.hashEmail)(user.email));
60
+ if (!(await (0, interface_database_decorators_1.GetModel)(trial_identity_model_1.TrialIdentityModel).reserve(id, tenantId)))
53
61
  return NO_TRIAL;
54
62
  return { days: newPlan.trialDays, reservedIdentityId: id };
55
63
  }
@@ -139,6 +147,7 @@ async function openCheckoutSession(request, attempt, target) {
139
147
  operationId: attempt.operationId,
140
148
  tenantId: request.tenantId,
141
149
  ownerEmail: request.user.email,
150
+ ownerLanguage: request.user.language,
142
151
  }));
143
152
  if (!existingCustomerId)
144
153
  attempt.createdCustomerId = customerId;
@@ -146,6 +155,7 @@ async function openCheckoutSession(request, attempt, target) {
146
155
  operationId: attempt.operationId,
147
156
  tenantId: request.tenantId,
148
157
  ownerEmail: request.user.email,
158
+ ownerLanguage: request.user.language,
149
159
  stripePriceId: target.stripePriceId,
150
160
  trialDays: trial.days,
151
161
  successUrl: redirect.successUrl,
@@ -1 +1 @@
1
- {"version":3,"file":"tenant-plan-checkout.js","sourceRoot":"","sources":["../../../src/routes/tenant/tenant-plan-checkout.ts"],"names":[],"mappings":";;AAoVA,8CAMC;AA/UD,6CAAyC;AACzC,6DAAuD;AACvD,uEAAwD;AACxD,gEAA6D;AAC7D,6FAAqE;AACrE,iFAAyF;AACzF,uDAAkE;AAClE,yCAAoD;AACpD,iCAIkB;AAClB,gDAAsD;AACtD,wEAOyC;AACzC,uCAAwC;AACxC,kEAA6E;AAC7E,mFAGkD;AAClD,uDAO2B;AAC3B,mFAGyC;AAEzC,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAC/B,MAAM,wBAAwB,GAAG,GAAG,CAAC;AACrC,MAAM,sBAAsB,GAAG,iBAA0B,CAAC;AAC1D,MAAM,mBAAmB,GAAkB,IAAI,CAAC;AAChD,MAAM,aAAa,GAAG,UAAmB,CAAC;AAC1C,MAAM,UAAU,GAAG,qBAAqB,CAAC;AAgCzC,MAAM,QAAQ,GAAe,EAAE,IAAI,EAAE,CAAC,EAAE,kBAAkB,EAAE,IAAI,EAAE,CAAC;AAEnE,SAAS,gBAAgB,CAAC,KAAc;IACtC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC;QACzD,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE;QACd,CAAC,CAAC,IAAI,CAAC;AACX,CAAC;AAED,SAAS,6BAA6B,CACpC,IAAoB;IAEpB,MAAM,UAAU,GAAG,gBAAgB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACrD,MAAM,SAAS,GAAG,gBAAgB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACnD,IAAA,2BAAM,EACJ,UAAU,IAAI,IAAA,6BAAoB,EAAC,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C,QAAQ,CAAC,CAAC;IAC5C,OAAO;QACL,GAAG,uCAAqB;QACxB,MAAM,EAAE,OAAO,CAAC,GAAG;QACnB,WAAW,EAAE,QAAQ,CAAC,GAAG;KAC1B,CAAC;AACJ,CAAC;AAGM,KAAK,UAAU,iBAAiB,CACrC,OAA0B;IAE1B,OAAO,IAAA,8CAA2B,EAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,EAAE,CACxD,sBAAsB,CAAC,OAAO,CAAC,CAChC,CAAC;AACJ,CAAC"}
@@ -10,6 +10,14 @@ export interface ChangePlanBody {
10
10
  planId: string;
11
11
  successUrl?: string;
12
12
  cancelUrl?: string;
13
+ prorationDate?: number;
14
+ }
15
+ export interface ImmediateChangeBilling {
16
+ prorationBehavior: "create_prorations" | "always_invoice";
17
+ prorationDate?: number;
18
+ }
19
+ export interface UpgradeAuthentication {
20
+ clientSecret: string;
13
21
  }
14
22
  export interface ChangePlanResult {
15
23
  changed: boolean;
@@ -17,16 +25,33 @@ export interface ChangePlanResult {
17
25
  planId: string;
18
26
  effectiveAt: Date | null;
19
27
  checkoutUrl: string | null;
28
+ authentication: UpgradeAuthentication | null;
29
+ }
30
+ export interface OfferedPlanView extends TenantPlanView {
31
+ description: string;
32
+ billingMode: Plan["billingMode"];
33
+ maxMembers: number;
34
+ trialDays: number;
35
+ isTrialOffered: boolean;
36
+ audience: Plan["audience"];
37
+ isOfferedToCustomerType: boolean;
38
+ }
39
+ export interface SeatsInUse {
40
+ members: number;
41
+ pendingInvites: number;
42
+ occupied: number;
20
43
  }
21
44
  export interface CurrentPlanResult {
22
45
  current: Plan | null;
23
- available: TenantPlanView[];
46
+ seats: SeatsInUse;
47
+ available: OfferedPlanView[];
24
48
  features: TenantPlanFeature[];
25
49
  status: string | null;
26
50
  freeUntil: Date | null;
27
51
  isComplimentary: boolean;
28
52
  isPlanChangeLocked: boolean;
29
53
  canRecoverComplimentary: boolean;
54
+ canResubscribe: boolean;
30
55
  paidUsageStartedAt: Date | null;
31
56
  paidUsagePeriods: PaidUsagePeriod[] | null;
32
57
  currentPeriodEnd: Date | null;
@@ -45,12 +70,17 @@ export declare const UNCHANGED_RESULT_BASE: {
45
70
  readonly scheduled: false;
46
71
  readonly effectiveAt: null;
47
72
  readonly checkoutUrl: null;
73
+ readonly authentication: null;
48
74
  };
75
+ export declare function loadSellablePlan(planModel: PlanModel, planId: string): Promise<Plan>;
76
+ export declare function assertPlanAudience(plan: Plan, customerType: string | null | undefined): void;
49
77
  export declare function loadAndValidateTargetPlan(planModel: PlanModel, planId: string, customerType: string | null | undefined): Promise<Plan>;
50
78
  export declare function assertSeatLimit(tenantId: string, plan: Plan): Promise<void>;
51
- export declare function finalizeImmediateChange(tenantId: string, subscription: TenantSubscription, newPlan: Plan): Promise<void>;
79
+ export declare function planQuantity(tenantId: string, plan: Plan): Promise<number>;
52
80
  export declare function isPaidPlan(plan: Plan): boolean;
81
+ export declare function startsPaidCheckout(newPlan: Plan, subscription: TenantSubscription | undefined): boolean;
53
82
  export declare function insertFreeSubscription(user: User, newPlanId: string, tenantId: string, tenantSubscriptionModel: TenantSubscriptionModel): Promise<ChangePlanResult>;
54
83
  export declare function scheduleDowngrade(tenantId: string, subscription: TenantSubscription, newPlan: Plan): Promise<ChangePlanResult>;
55
84
  export declare function dropPendingChange(tenantId: string, subscription: TenantSubscription): Promise<ChangePlanResult>;
56
85
  export declare function applyImmediateChange(tenantId: string, subscription: TenantSubscription, newPlan: Plan, tenantSubscriptionModel: TenantSubscriptionModel, operatorIntent?: SubscriptionTransition): Promise<ChangePlanResult>;
86
+ export declare function applyOwnerUpgrade(tenantId: string, subscription: TenantSubscription, newPlan: Plan, tenantSubscriptionModel: TenantSubscriptionModel, prorationDate: number | undefined): Promise<ChangePlanResult>;
@@ -1,78 +1,103 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.UNCHANGED_RESULT_BASE = exports.PAST_DUE_STATUS = exports.HTTP_CONFLICT = exports.HTTP_BAD_REQUEST = exports.HTTP_NOT_FOUND = void 0;
7
+ exports.loadSellablePlan = loadSellablePlan;
8
+ exports.assertPlanAudience = assertPlanAudience;
4
9
  exports.loadAndValidateTargetPlan = loadAndValidateTargetPlan;
5
10
  exports.assertSeatLimit = assertSeatLimit;
6
- exports.finalizeImmediateChange = finalizeImmediateChange;
11
+ exports.planQuantity = planQuantity;
7
12
  exports.isPaidPlan = isPaidPlan;
13
+ exports.startsPaidCheckout = startsPaidCheckout;
8
14
  exports.insertFreeSubscription = insertFreeSubscription;
9
15
  exports.scheduleDowngrade = scheduleDowngrade;
10
16
  exports.dropPendingChange = dropPendingChange;
11
17
  exports.applyImmediateChange = applyImmediateChange;
12
- const node_crypto_1 = require("node:crypto");
18
+ exports.applyOwnerUpgrade = applyOwnerUpgrade;
19
+ const interface_api_1 = require("@antelopejs/interface-api");
13
20
  const interface_api_util_1 = require("@antelopejs/interface-api-util");
14
21
  const tenant_lifecycle_1 = require("@antelopejs/interface-dms/tenant-lifecycle");
15
22
  const billing_state_1 = require("../../billing-state");
16
23
  const plan_changes_1 = require("../../plan-changes");
17
24
  const plans_1 = require("../../plans");
25
+ const stripe_1 = __importDefault(require("stripe"));
18
26
  const client_1 = require("../../stripe/client");
19
- const workers_1 = require("../../workers");
27
+ const pending_update_1 = require("../../stripe/pending-update");
28
+ const first_payment_1 = require("../../workspaces/first-payment");
29
+ const plan_audience_1 = require("../../plans/plan-audience");
20
30
  exports.HTTP_NOT_FOUND = 404;
21
31
  exports.HTTP_BAD_REQUEST = 400;
22
32
  const HTTP_PAYMENT_REQUIRED = 402;
23
33
  exports.HTTP_CONFLICT = 409;
24
34
  exports.PAST_DUE_STATUS = "past_due";
25
- const PRORATION_BEHAVIOR = "create_prorations";
26
35
  const ACTIVE_STATUS = "active";
36
+ const SEAT_BILLING_MODE = "seat";
37
+ const FLAT_QUANTITY = 1;
38
+ const PAID_UPGRADE_PAYMENT_BEHAVIOR = "pending_if_incomplete";
39
+ const DEFERRED_PRORATION_BILLING = {
40
+ prorationBehavior: "create_prorations",
41
+ };
27
42
  exports.UNCHANGED_RESULT_BASE = {
28
43
  changed: false,
29
44
  scheduled: false,
30
45
  effectiveAt: null,
31
46
  checkoutUrl: null,
47
+ authentication: null,
32
48
  };
33
- async function loadAndValidateTargetPlan(planModel, planId, customerType) {
49
+ async function loadSellablePlan(planModel, planId) {
34
50
  const storedPlan = await planModel.get(planId);
35
51
  (0, interface_api_util_1.assert)(storedPlan && !storedPlan.isDeleted && storedPlan.isActive, exports.HTTP_BAD_REQUEST, "saas.errors.plan.invalid");
36
- (0, interface_api_util_1.assert)(customerType, exports.HTTP_BAD_REQUEST, "saas.errors.plan.customer_type_unknown");
37
- (0, interface_api_util_1.assert)(storedPlan.audience === "any" || storedPlan.audience === customerType, exports.HTTP_BAD_REQUEST, "saas.errors.plan.not_available_for_customer_type");
38
52
  const newPlan = await (0, plans_1.ensurePlanStripeRefs)(storedPlan, planModel);
39
53
  (0, interface_api_util_1.assert)(newPlan.price <= 0 || !!newPlan.paymentProviderRefs?.stripePriceId, exports.HTTP_BAD_REQUEST, "saas.errors.plan.not_synced_with_stripe");
40
54
  return newPlan;
41
55
  }
56
+ function assertPlanAudience(plan, customerType) {
57
+ (0, interface_api_util_1.assert)(customerType, exports.HTTP_BAD_REQUEST, "saas.errors.plan.customer_type_unknown");
58
+ (0, interface_api_util_1.assert)((0, plan_audience_1.isPlanOfferedTo)(plan, customerType), exports.HTTP_BAD_REQUEST, "saas.errors.plan.not_available_for_customer_type");
59
+ }
60
+ async function loadAndValidateTargetPlan(planModel, planId, customerType) {
61
+ const plan = await loadSellablePlan(planModel, planId);
62
+ assertPlanAudience(plan, customerType);
63
+ return plan;
64
+ }
42
65
  async function assertSeatLimit(tenantId, plan) {
43
66
  const occupiedSeats = await (0, plans_1.countOccupiedSeats)(tenantId);
44
67
  (0, interface_api_util_1.assert)((0, plans_1.fitsWithinSeatLimit)(plan.maxMembers, occupiedSeats), HTTP_PAYMENT_REQUIRED, "saas.errors.plan.downgrade_exceeds_seat_limit");
45
68
  }
46
- async function applyPlanChange(subscription, newPlan, newPlanId, tenantSubscriptionModel, operationId) {
47
- await syncStripePlanChange(subscription, newPlan, operationId);
48
- await tenantSubscriptionModel.updateDuringTransition(subscription._id, operationId, {
49
- planId: newPlanId,
50
- updatedAt: new Date(),
51
- });
69
+ async function planQuantity(tenantId, plan) {
70
+ if (plan.billingMode !== SEAT_BILLING_MODE)
71
+ return FLAT_QUANTITY;
72
+ return (0, plans_1.countOccupiedSeats)(tenantId);
52
73
  }
53
- async function finalizeImmediateChange(tenantId, subscription, newPlan) {
54
- await (0, workers_1.applyPlanDowngradeCleanup)(tenantId, newPlan);
55
- await (0, plans_1.syncStripeSeatQuantity)({
56
- tenantId,
57
- plan: newPlan,
58
- stripeSubscriptionId: subscription.stripeSubscriptionId,
59
- idempotencyKey: `seat-sync:change-plan:${tenantId}:${subscription._id}:${newPlan._id}`,
60
- });
61
- await (0, billing_state_1.recomputeTenantBillingState)(tenantId);
74
+ function toChargeParams(billing) {
75
+ if (billing.prorationBehavior !== "always_invoice") {
76
+ return {
77
+ proration_behavior: billing.prorationBehavior,
78
+ automatic_tax: { enabled: true },
79
+ };
80
+ }
81
+ return {
82
+ proration_behavior: billing.prorationBehavior,
83
+ proration_date: billing.prorationDate,
84
+ payment_behavior: PAID_UPGRADE_PAYMENT_BEHAVIOR,
85
+ };
62
86
  }
63
- async function syncStripePlanChange(subscription, newPlan, operationId) {
87
+ async function syncStripePlanChange(change) {
88
+ const { subscription, newPlan, operationId, billing } = change;
64
89
  if (!subscription.stripeSubscriptionId)
65
- return;
90
+ return null;
66
91
  const stripePriceId = newPlan.paymentProviderRefs?.stripePriceId;
67
92
  (0, interface_api_util_1.assert)(stripePriceId, exports.HTTP_BAD_REQUEST, "saas.errors.plan.no_stripe_price");
68
93
  const stripe = (0, client_1.getStripeClient)();
69
94
  const stripeSubscription = await stripe.subscriptions.retrieve(subscription.stripeSubscriptionId);
70
95
  const itemId = stripeSubscription.items.data[0]?.id;
71
96
  (0, interface_api_util_1.assert)(itemId, exports.HTTP_BAD_REQUEST, "saas.errors.stripe.subscription_no_item");
72
- await stripe.subscriptions.update(subscription.stripeSubscriptionId, {
73
- items: [{ id: itemId, price: stripePriceId }],
74
- proration_behavior: PRORATION_BEHAVIOR,
75
- automatic_tax: { enabled: true },
97
+ const quantity = await planQuantity(subscription._id, newPlan);
98
+ return stripe.subscriptions.update(subscription.stripeSubscriptionId, {
99
+ items: [{ id: itemId, price: stripePriceId, quantity }],
100
+ ...toChargeParams(billing),
76
101
  }, {
77
102
  idempotencyKey: `change-plan:${operationId}`,
78
103
  });
@@ -80,6 +105,9 @@ async function syncStripePlanChange(subscription, newPlan, operationId) {
80
105
  function isPaidPlan(plan) {
81
106
  return !!plan.paymentProviderRefs?.stripePriceId;
82
107
  }
108
+ function startsPaidCheckout(newPlan, subscription) {
109
+ return isPaidPlan(newPlan) && !(0, first_payment_1.liveStripeSubscriptionId)(subscription);
110
+ }
83
111
  async function insertFreeSubscription(user, newPlanId, tenantId, tenantSubscriptionModel) {
84
112
  await (0, tenant_lifecycle_1.runTenantLifecycleOperation)(tenantId, () => tenantSubscriptionModel.insert([
85
113
  {
@@ -126,20 +154,65 @@ async function dropPendingChange(tenantId, subscription) {
126
154
  planId: subscription.planId ?? "",
127
155
  };
128
156
  }
157
+ async function runImmediateChange(change, admission) {
158
+ const { tenantId, intent, model } = admission;
159
+ await model.beginTransition(change.subscription, intent);
160
+ await (0, plan_changes_1.clearPendingPlanChange)(tenantId, change.subscription, intent.operationId);
161
+ const updated = await syncStripePlanChange(change);
162
+ if (updated?.pending_update)
163
+ return updated;
164
+ await (0, plan_changes_1.recordPlanChange)(change.subscription, change.newPlan, intent.operationId, model);
165
+ await (0, plan_changes_1.finalizeImmediateChange)(tenantId, change.subscription, change.newPlan);
166
+ return updated;
167
+ }
129
168
  async function applyImmediateChange(tenantId, subscription, newPlan, tenantSubscriptionModel, operatorIntent) {
130
- const intent = operatorIntent ??
131
- {
132
- operationId: (0, node_crypto_1.randomUUID)(),
133
- kind: "change_plan",
134
- targetPlanId: newPlan._id,
135
- requestedAt: new Date(),
136
- };
137
- await tenantSubscriptionModel.beginTransition(subscription, intent);
138
- await (0, plan_changes_1.clearPendingPlanChange)(tenantId, subscription, intent.operationId);
139
- await applyPlanChange(subscription, newPlan, newPlan._id, tenantSubscriptionModel, intent.operationId);
140
- await finalizeImmediateChange(tenantId, subscription, newPlan);
169
+ const intent = operatorIntent ?? (0, plan_changes_1.newChangeIntent)(newPlan);
170
+ const change = {
171
+ subscription,
172
+ newPlan,
173
+ operationId: intent.operationId,
174
+ billing: DEFERRED_PRORATION_BILLING,
175
+ };
176
+ await runImmediateChange(change, {
177
+ tenantId,
178
+ intent,
179
+ model: tenantSubscriptionModel,
180
+ });
141
181
  if (!operatorIntent)
142
182
  await tenantSubscriptionModel.completeTransition(subscription._id, intent.operationId, {});
143
183
  return { ...exports.UNCHANGED_RESULT_BASE, changed: true, planId: newPlan._id };
144
184
  }
185
+ async function releaseDeclinedUpgrade(error, admission, subscriptionId) {
186
+ if (!(error instanceof stripe_1.default.errors.StripeCardError))
187
+ throw error;
188
+ await admission.model.completeTransition(subscriptionId, admission.intent.operationId, {});
189
+ throw new interface_api_1.HTTPResult(HTTP_PAYMENT_REQUIRED, "saas.errors.plan.upgrade_payment_declined");
190
+ }
191
+ async function requestUpgradeAuthentication(stripeSubscription) {
192
+ const clientSecret = await (0, pending_update_1.readPendingChallengeSecret)(stripeSubscription);
193
+ if (clientSecret)
194
+ return { clientSecret };
195
+ await (0, pending_update_1.discardPendingUpdate)(stripeSubscription);
196
+ throw new interface_api_1.HTTPResult(HTTP_PAYMENT_REQUIRED, "saas.errors.plan.upgrade_payment_declined");
197
+ }
198
+ async function applyOwnerUpgrade(tenantId, subscription, newPlan, tenantSubscriptionModel, prorationDate) {
199
+ const intent = (0, plan_changes_1.newChangeIntent)(newPlan);
200
+ const admission = { tenantId, intent, model: tenantSubscriptionModel };
201
+ const change = {
202
+ subscription,
203
+ newPlan,
204
+ operationId: intent.operationId,
205
+ billing: { prorationBehavior: "always_invoice", prorationDate },
206
+ };
207
+ const updated = await runImmediateChange(change, admission).catch((error) => releaseDeclinedUpgrade(error, admission, subscription._id));
208
+ await tenantSubscriptionModel.completeTransition(subscription._id, intent.operationId, {});
209
+ if (updated?.pending_update) {
210
+ return {
211
+ ...exports.UNCHANGED_RESULT_BASE,
212
+ planId: newPlan._id,
213
+ authentication: await requestUpgradeAuthentication(updated),
214
+ };
215
+ }
216
+ return { ...exports.UNCHANGED_RESULT_BASE, changed: true, planId: newPlan._id };
217
+ }
145
218
  //# sourceMappingURL=tenant-plan-ops.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tenant-plan-ops.js","sourceRoot":"","sources":["../../../src/routes/tenant/tenant-plan-ops.ts"],"names":[],"mappings":";;;AA4FA,8DAgCC;AAOD,0CAUC;AAqBD,0DAaC;AAiCD,gCAEC;AAED,wDA6BC;AAED,8CAiBC;AAED,8CAWC;AAOD,oDAgCC;AApTD,6CAAyC;AACzC,uEAAwD;AACxD,iFAAyF;AAEzF,uDAAkE;AAUlE,qDAI4B;AAC5B,uCAOqB;AACrB,gDAAsD;AACtD,2CAA0D;AAE7C,QAAA,cAAc,GAAG,GAAG,CAAC;AACrB,QAAA,gBAAgB,GAAG,GAAG,CAAC;AACpC,MAAM,qBAAqB,GAAG,GAAG,CAAC;AACrB,QAAA,aAAa,GAAG,GAAG,CAAC;AACpB,QAAA,eAAe,GAA6B,UAAU,CAAC;AACpE,MAAM,kBAAkB,GAAG,mBAA4B,CAAC;AACxD,MAAM,aAAa,GAAG,QAAiB,CAAC;AAwC3B,QAAA,qBAAqB,GAAG;IACnC,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,KAAK;IAChB,WAAW,EAAE,IAAI;IACjB,WAAW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