@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.
- package/README.md +42 -2
- package/dist/auth/index.d.ts +1 -0
- package/dist/auth/index.js +1 -0
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/owner-only-permissions-resolver.d.ts +1 -0
- package/dist/auth/owner-only-permissions-resolver.js +25 -0
- package/dist/auth/owner-only-permissions-resolver.js.map +1 -0
- package/dist/billing-state/directory-hooks.d.ts +1 -0
- package/dist/billing-state/directory-hooks.js +35 -0
- package/dist/billing-state/directory-hooks.js.map +1 -0
- package/dist/billing-state/directory.d.ts +29 -0
- package/dist/billing-state/directory.js +152 -0
- package/dist/billing-state/directory.js.map +1 -0
- package/dist/billing-state/index.d.ts +5 -1
- package/dist/billing-state/index.js +14 -2
- package/dist/billing-state/index.js.map +1 -1
- package/dist/billing-state/past-due-banner.d.ts +4 -3
- package/dist/billing-state/past-due-banner.js +30 -10
- package/dist/billing-state/past-due-banner.js.map +1 -1
- package/dist/billing-state/recovery.d.ts +4 -0
- package/dist/billing-state/recovery.js +7 -5
- package/dist/billing-state/recovery.js.map +1 -1
- package/dist/billing-state/trial-ending-banner.d.ts +4 -0
- package/dist/billing-state/trial-ending-banner.js +66 -0
- package/dist/billing-state/trial-ending-banner.js.map +1 -0
- package/dist/config/runtime.d.ts +1 -0
- package/dist/config/runtime.js +5 -0
- package/dist/config/runtime.js.map +1 -1
- package/dist/crons/auto-suspend-past-due.js +4 -5
- package/dist/crons/auto-suspend-past-due.js.map +1 -1
- package/dist/data-api/platformOwner/admin-user-invoices.d.ts +6 -4
- package/dist/data-api/platformOwner/admin-user-invoices.js +52 -30
- package/dist/data-api/platformOwner/admin-user-invoices.js.map +1 -1
- package/dist/data-api/platformOwner/admin-user-workspaces.d.ts +2 -0
- package/dist/data-api/platformOwner/admin-user-workspaces.js +69 -3
- package/dist/data-api/platformOwner/admin-user-workspaces.js.map +1 -1
- package/dist/data-api/platformOwner/credit-note-rows.d.ts +11 -0
- package/dist/data-api/platformOwner/credit-note-rows.js +54 -0
- package/dist/data-api/platformOwner/credit-note-rows.js.map +1 -0
- package/dist/data-api/platformOwner/credit-notes.d.ts +13 -0
- package/dist/data-api/platformOwner/credit-notes.js +149 -10
- package/dist/data-api/platformOwner/credit-notes.js.map +1 -1
- package/dist/data-api/platformOwner/features.d.ts +7 -2
- package/dist/data-api/platformOwner/features.js +151 -37
- package/dist/data-api/platformOwner/features.js.map +1 -1
- package/dist/data-api/platformOwner/invitations.js +29 -9
- package/dist/data-api/platformOwner/invitations.js.map +1 -1
- package/dist/data-api/platformOwner/invoice-cells.d.ts +5 -0
- package/dist/data-api/platformOwner/invoice-cells.js +51 -0
- package/dist/data-api/platformOwner/invoice-cells.js.map +1 -0
- package/dist/data-api/platformOwner/invoice-options.js.map +1 -1
- package/dist/data-api/platformOwner/invoice-rows.d.ts +9 -0
- package/dist/data-api/platformOwner/invoice-rows.js +39 -0
- package/dist/data-api/platformOwner/invoice-rows.js.map +1 -0
- package/dist/data-api/platformOwner/invoices.d.ts +24 -6
- package/dist/data-api/platformOwner/invoices.js +192 -11
- package/dist/data-api/platformOwner/invoices.js.map +1 -1
- package/dist/data-api/platformOwner/members.d.ts +2 -1
- package/dist/data-api/platformOwner/members.js +56 -20
- package/dist/data-api/platformOwner/members.js.map +1 -1
- package/dist/data-api/platformOwner/plan-migrations.d.ts +14 -2
- package/dist/data-api/platformOwner/plan-migrations.js +179 -33
- package/dist/data-api/platformOwner/plan-migrations.js.map +1 -1
- package/dist/data-api/platformOwner/plans.d.ts +30 -6
- package/dist/data-api/platformOwner/plans.js +269 -44
- package/dist/data-api/platformOwner/plans.js.map +1 -1
- package/dist/data-api/platformOwner/segments.d.ts +9 -7
- package/dist/data-api/platformOwner/segments.js +108 -101
- package/dist/data-api/platformOwner/segments.js.map +1 -1
- package/dist/data-api/platformOwner/table-scope.d.ts +6 -0
- package/dist/data-api/platformOwner/table-scope.js +8 -0
- package/dist/data-api/platformOwner/table-scope.js.map +1 -0
- package/dist/data-api/platformOwner/users.d.ts +15 -2
- package/dist/data-api/platformOwner/users.js +171 -15
- package/dist/data-api/platformOwner/users.js.map +1 -1
- package/dist/data-api/platformOwner/workspace-cells.d.ts +12 -0
- package/dist/data-api/platformOwner/workspace-cells.js +90 -0
- package/dist/data-api/platformOwner/workspace-cells.js.map +1 -0
- package/dist/data-api/platformOwner/workspaces.d.ts +26 -4
- package/dist/data-api/platformOwner/workspaces.js +269 -97
- package/dist/data-api/platformOwner/workspaces.js.map +1 -1
- package/dist/data-api/tenant/tenant-invoices.d.ts +4 -0
- package/dist/data-api/tenant/tenant-invoices.js +68 -4
- package/dist/data-api/tenant/tenant-invoices.js.map +1 -1
- package/dist/hooks/register.js +5 -1
- package/dist/hooks/register.js.map +1 -1
- package/dist/i18n/composed-text.d.ts +17 -0
- package/dist/i18n/composed-text.js +71 -0
- package/dist/i18n/composed-text.js.map +1 -0
- package/dist/implementations/dms-saas/billing.d.ts +1 -0
- package/dist/implementations/dms-saas/billing.js +4 -1
- package/dist/implementations/dms-saas/billing.js.map +1 -1
- package/dist/implementations/dms-saas/pages.d.ts +0 -1
- package/dist/implementations/dms-saas/pages.js +0 -4
- package/dist/implementations/dms-saas/pages.js.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/metrics/activity-sources.d.ts +2 -0
- package/dist/metrics/activity-sources.js +60 -0
- package/dist/metrics/activity-sources.js.map +1 -0
- package/dist/metrics/activity.d.ts +25 -0
- package/dist/metrics/activity.js +197 -0
- package/dist/metrics/activity.js.map +1 -0
- package/dist/metrics/directory-summary.d.ts +30 -0
- package/dist/metrics/directory-summary.js +95 -0
- package/dist/metrics/directory-summary.js.map +1 -0
- package/dist/metrics/headline-items.d.ts +32 -0
- package/dist/metrics/headline-items.js +242 -0
- package/dist/metrics/headline-items.js.map +1 -0
- package/dist/metrics/normalised-mrr.d.ts +32 -0
- package/dist/metrics/normalised-mrr.js +75 -0
- package/dist/metrics/normalised-mrr.js.map +1 -0
- package/dist/metrics/revenue.d.ts +30 -0
- package/dist/metrics/revenue.js +126 -0
- package/dist/metrics/revenue.js.map +1 -0
- package/dist/notifications/recipients.d.ts +1 -0
- package/dist/notifications/recipients.js +4 -0
- package/dist/notifications/recipients.js.map +1 -1
- package/dist/notifications/subjects.d.ts +18 -17
- package/dist/notifications/subjects.js +7 -1
- package/dist/notifications/subjects.js.map +1 -1
- package/dist/operator-actions/commands.js +9 -6
- package/dist/operator-actions/commands.js.map +1 -1
- package/dist/operator-actions/invitation-commands.d.ts +7 -1
- package/dist/operator-actions/invitation-commands.js +16 -0
- package/dist/operator-actions/invitation-commands.js.map +1 -1
- package/dist/operator-actions/previews.d.ts +50 -0
- package/dist/operator-actions/previews.js +113 -0
- package/dist/operator-actions/previews.js.map +1 -0
- package/dist/operator-actions/types.d.ts +1 -1
- package/dist/operator-actions/upgrade-preview.d.ts +35 -0
- package/dist/operator-actions/upgrade-preview.js +110 -0
- package/dist/operator-actions/upgrade-preview.js.map +1 -0
- package/dist/operator-billing/billing-rules.d.ts +58 -0
- package/dist/operator-billing/billing-rules.js +90 -0
- package/dist/operator-billing/billing-rules.js.map +1 -0
- package/dist/operator-billing/billing-settings-store.d.ts +3 -0
- package/dist/operator-billing/billing-settings-store.js +34 -0
- package/dist/operator-billing/billing-settings-store.js.map +1 -0
- package/dist/operator-billing/billing-stats.d.ts +37 -0
- package/dist/operator-billing/billing-stats.js +197 -0
- package/dist/operator-billing/billing-stats.js.map +1 -0
- package/dist/operator-billing/credit-allowance.d.ts +17 -0
- package/dist/operator-billing/credit-allowance.js +44 -0
- package/dist/operator-billing/credit-allowance.js.map +1 -0
- package/dist/operator-billing/credit-note-request.d.ts +39 -0
- package/dist/operator-billing/credit-note-request.js +73 -0
- package/dist/operator-billing/credit-note-request.js.map +1 -0
- package/dist/operator-billing/index.d.ts +8 -0
- package/dist/operator-billing/index.js +25 -0
- package/dist/operator-billing/index.js.map +1 -0
- package/dist/operator-billing/invoice-credit.d.ts +41 -0
- package/dist/operator-billing/invoice-credit.js +111 -0
- package/dist/operator-billing/invoice-credit.js.map +1 -0
- package/dist/operator-billing/legal-documents-store.d.ts +12 -0
- package/dist/operator-billing/legal-documents-store.js +46 -0
- package/dist/operator-billing/legal-documents-store.js.map +1 -0
- package/dist/operator-billing/legal-versions.d.ts +5 -0
- package/dist/operator-billing/legal-versions.js +31 -0
- package/dist/operator-billing/legal-versions.js.map +1 -0
- package/dist/pages/block-meta.d.ts +15 -0
- package/dist/pages/block-meta.js +21 -0
- package/dist/pages/block-meta.js.map +1 -0
- package/dist/pages/module.d.ts +1 -3
- package/dist/pages/module.js +1 -8
- package/dist/pages/module.js.map +1 -1
- package/dist/pages/platform/credit-notes.d.ts +1 -0
- package/dist/pages/platform/credit-notes.js +63 -5
- package/dist/pages/platform/credit-notes.js.map +1 -1
- package/dist/pages/platform/dashboard.d.ts +4 -1
- package/dist/pages/platform/dashboard.js +123 -64
- package/dist/pages/platform/dashboard.js.map +1 -1
- package/dist/pages/platform/features.js +85 -12
- package/dist/pages/platform/features.js.map +1 -1
- package/dist/pages/platform/index.d.ts +1 -0
- package/dist/pages/platform/index.js +1 -0
- package/dist/pages/platform/index.js.map +1 -1
- package/dist/pages/platform/invoices.d.ts +6 -0
- package/dist/pages/platform/invoices.js +84 -28
- package/dist/pages/platform/invoices.js.map +1 -1
- package/dist/pages/platform/paths.d.ts +9 -0
- package/dist/pages/platform/paths.js +25 -0
- package/dist/pages/platform/paths.js.map +1 -0
- package/dist/pages/platform/plans/edit.d.ts +2 -2
- package/dist/pages/platform/plans/edit.js +170 -105
- package/dist/pages/platform/plans/edit.js.map +1 -1
- package/dist/pages/platform/plans/index.d.ts +1 -0
- package/dist/pages/platform/plans/index.js +177 -54
- package/dist/pages/platform/plans/index.js.map +1 -1
- package/dist/pages/platform/plans/migrations.d.ts +12 -0
- package/dist/pages/platform/plans/migrations.js +259 -13
- package/dist/pages/platform/plans/migrations.js.map +1 -1
- package/dist/pages/platform/segments/edit.d.ts +17 -0
- package/dist/pages/platform/segments/edit.js +124 -0
- package/dist/pages/platform/segments/edit.js.map +1 -0
- package/dist/pages/platform/segments/index.js +68 -8
- package/dist/pages/platform/segments/index.js.map +1 -1
- package/dist/pages/platform/settings.d.ts +1 -1
- package/dist/pages/platform/settings.js +164 -105
- package/dist/pages/platform/settings.js.map +1 -1
- package/dist/pages/platform/users/detail.js +112 -33
- package/dist/pages/platform/users/detail.js.map +1 -1
- package/dist/pages/platform/users/index.js +52 -18
- package/dist/pages/platform/users/index.js.map +1 -1
- package/dist/pages/platform/workspaces/detail.d.ts +3 -1
- package/dist/pages/platform/workspaces/detail.js +184 -113
- package/dist/pages/platform/workspaces/detail.js.map +1 -1
- package/dist/pages/platform/workspaces/index.d.ts +1 -20
- package/dist/pages/platform/workspaces/index.js +152 -180
- package/dist/pages/platform/workspaces/index.js.map +1 -1
- package/dist/pages/platform/workspaces/shared.d.ts +11 -0
- package/dist/pages/platform/workspaces/shared.js +53 -0
- package/dist/pages/platform/workspaces/shared.js.map +1 -0
- package/dist/pages/public/auth/no-workspace.js +7 -2
- package/dist/pages/public/auth/no-workspace.js.map +1 -1
- package/dist/pages/public/index.js.map +1 -1
- package/dist/pages/public/legal/privacy-policy.d.ts +1 -0
- package/dist/pages/public/legal/privacy-policy.js +9 -4
- package/dist/pages/public/legal/privacy-policy.js.map +1 -1
- package/dist/pages/public/legal/terms-and-conditions.d.ts +1 -0
- package/dist/pages/public/legal/terms-and-conditions.js +9 -4
- package/dist/pages/public/legal/terms-and-conditions.js.map +1 -1
- package/dist/pages/public/legal/terms-of-use.d.ts +1 -0
- package/dist/pages/public/legal/terms-of-use.js +9 -4
- package/dist/pages/public/legal/terms-of-use.js.map +1 -1
- package/dist/pages/public/nav-bar.d.ts +2 -0
- package/dist/pages/public/nav-bar.js +14 -0
- package/dist/pages/public/nav-bar.js.map +1 -0
- package/dist/pages/public/pricing.d.ts +10 -0
- package/dist/pages/public/pricing.js +32 -0
- package/dist/pages/public/pricing.js.map +1 -0
- package/dist/pages/public/register.d.ts +1 -0
- package/dist/pages/public/register.js +6 -3
- package/dist/pages/public/register.js.map +1 -1
- package/dist/pages/public/screens.js +1 -0
- package/dist/pages/public/screens.js.map +1 -1
- package/dist/pages/tenant/billing.d.ts +7 -7
- package/dist/pages/tenant/billing.js +141 -63
- package/dist/pages/tenant/billing.js.map +1 -1
- package/dist/pages/tenant/data-export.d.ts +3 -1
- package/dist/pages/tenant/data-export.js +25 -6
- package/dist/pages/tenant/data-export.js.map +1 -1
- package/dist/pages/tenant/general.d.ts +3 -2
- package/dist/pages/tenant/general.js +91 -11
- package/dist/pages/tenant/general.js.map +1 -1
- package/dist/pages/tenant/index.d.ts +1 -0
- package/dist/pages/tenant/index.js +1 -0
- package/dist/pages/tenant/index.js.map +1 -1
- package/dist/pages/tenant/members-seat-quota.d.ts +3 -0
- package/dist/pages/tenant/members-seat-quota.js +18 -6
- package/dist/pages/tenant/members-seat-quota.js.map +1 -1
- package/dist/pages/tenant/owner-only.d.ts +1 -0
- package/dist/pages/tenant/owner-only.js +14 -0
- package/dist/pages/tenant/owner-only.js.map +1 -0
- package/dist/pages/tenant/workspace-suspended.js +7 -3
- package/dist/pages/tenant/workspace-suspended.js.map +1 -1
- package/dist/plan-changes/applied-upgrade.d.ts +5 -0
- package/dist/plan-changes/applied-upgrade.js +51 -0
- package/dist/plan-changes/applied-upgrade.js.map +1 -0
- package/dist/plan-changes/deferred.js +9 -40
- package/dist/plan-changes/deferred.js.map +1 -1
- package/dist/plan-changes/immediate.d.ts +4 -0
- package/dist/plan-changes/immediate.js +34 -0
- package/dist/plan-changes/immediate.js.map +1 -0
- package/dist/plan-changes/index.d.ts +1 -0
- package/dist/plan-changes/index.js +1 -0
- package/dist/plan-changes/index.js.map +1 -1
- package/dist/plan-changes/pending-target.d.ts +17 -0
- package/dist/plan-changes/pending-target.js +62 -0
- package/dist/plan-changes/pending-target.js.map +1 -0
- package/dist/plans/catalogue-summary.d.ts +24 -0
- package/dist/plans/catalogue-summary.js +97 -0
- package/dist/plans/catalogue-summary.js.map +1 -0
- package/dist/plans/catalogue-usage.d.ts +36 -0
- package/dist/plans/catalogue-usage.js +120 -0
- package/dist/plans/catalogue-usage.js.map +1 -0
- package/dist/plans/feature-guards.d.ts +5 -0
- package/dist/plans/feature-guards.js +31 -0
- package/dist/plans/feature-guards.js.map +1 -0
- package/dist/plans/feature-usage.d.ts +4 -0
- package/dist/plans/feature-usage.js +22 -0
- package/dist/plans/feature-usage.js.map +1 -0
- package/dist/plans/migration-blocks.d.ts +13 -0
- package/dist/plans/migration-blocks.js +337 -0
- package/dist/plans/migration-blocks.js.map +1 -0
- package/dist/plans/migration-detail.d.ts +48 -0
- package/dist/plans/migration-detail.js +80 -0
- package/dist/plans/migration-detail.js.map +1 -0
- package/dist/plans/migration-dialogs.d.ts +8 -0
- package/dist/plans/migration-dialogs.js +103 -0
- package/dist/plans/migration-dialogs.js.map +1 -0
- package/dist/plans/migration-outcomes.d.ts +7 -0
- package/dist/plans/migration-outcomes.js +38 -0
- package/dist/plans/migration-outcomes.js.map +1 -0
- package/dist/plans/migration-realtime.d.ts +2 -0
- package/dist/plans/migration-realtime.js +19 -0
- package/dist/plans/migration-realtime.js.map +1 -0
- package/dist/plans/migration-workspaces.d.ts +40 -0
- package/dist/plans/migration-workspaces.js +121 -0
- package/dist/plans/migration-workspaces.js.map +1 -0
- package/dist/plans/money.d.ts +1 -0
- package/dist/plans/money.js +11 -0
- package/dist/plans/money.js.map +1 -0
- package/dist/plans/plan-access-type.d.ts +25 -0
- package/dist/plans/plan-access-type.js +49 -0
- package/dist/plans/plan-access-type.js.map +1 -0
- package/dist/plans/plan-audience.d.ts +3 -0
- package/dist/plans/plan-audience.js +9 -0
- package/dist/plans/plan-audience.js.map +1 -0
- package/dist/plans/plan-diff.d.ts +13 -0
- package/dist/plans/plan-diff.js +73 -0
- package/dist/plans/plan-diff.js.map +1 -0
- package/dist/plans/plan-permission-tree.d.ts +11 -0
- package/dist/plans/plan-permission-tree.js +58 -0
- package/dist/plans/plan-permission-tree.js.map +1 -0
- package/dist/plans/plan-write.d.ts +17 -0
- package/dist/plans/plan-write.js +111 -0
- package/dist/plans/plan-write.js.map +1 -0
- package/dist/plans/seat-capacity.d.ts +3 -1
- package/dist/plans/seat-capacity.js +10 -2
- package/dist/plans/seat-capacity.js.map +1 -1
- package/dist/plans/seat-hooks.d.ts +1 -0
- package/dist/plans/seat-hooks.js +1 -0
- package/dist/plans/seat-hooks.js.map +1 -1
- package/dist/plans/stripe-sync.d.ts +3 -0
- package/dist/plans/stripe-sync.js +16 -0
- package/dist/plans/stripe-sync.js.map +1 -1
- package/dist/routes/platformOwner/billing-settings.d.ts +11 -35
- package/dist/routes/platformOwner/billing-settings.js +77 -47
- package/dist/routes/platformOwner/billing-settings.js.map +1 -1
- package/dist/routes/platformOwner/billing-stats.d.ts +15 -0
- package/dist/routes/platformOwner/billing-stats.js +106 -0
- package/dist/routes/platformOwner/billing-stats.js.map +1 -0
- package/dist/routes/platformOwner/block-payloads.d.ts +7 -0
- package/dist/routes/platformOwner/block-payloads.js +3 -0
- package/dist/routes/platformOwner/block-payloads.js.map +1 -0
- package/dist/routes/platformOwner/credit-notes-issue.d.ts +7 -8
- package/dist/routes/platformOwner/credit-notes-issue.js +28 -16
- package/dist/routes/platformOwner/credit-notes-issue.js.map +1 -1
- package/dist/routes/platformOwner/dashboard.d.ts +14 -57
- package/dist/routes/platformOwner/dashboard.js +126 -247
- package/dist/routes/platformOwner/dashboard.js.map +1 -1
- package/dist/routes/platformOwner/index.d.ts +7 -0
- package/dist/routes/platformOwner/index.js +7 -0
- package/dist/routes/platformOwner/index.js.map +1 -1
- package/dist/routes/platformOwner/plan-deletion.d.ts +77 -19
- package/dist/routes/platformOwner/plan-deletion.js +219 -67
- package/dist/routes/platformOwner/plan-deletion.js.map +1 -1
- package/dist/routes/platformOwner/plan-dialogs.d.ts +22 -0
- package/dist/routes/platformOwner/plan-dialogs.js +211 -0
- package/dist/routes/platformOwner/plan-dialogs.js.map +1 -0
- package/dist/routes/platformOwner/plan-migration-context.d.ts +9 -0
- package/dist/routes/platformOwner/plan-migration-context.js +147 -0
- package/dist/routes/platformOwner/plan-migration-context.js.map +1 -0
- package/dist/routes/platformOwner/plan-migration-export.d.ts +12 -0
- package/dist/routes/platformOwner/plan-migration-export.js +100 -0
- package/dist/routes/platformOwner/plan-migration-export.js.map +1 -0
- package/dist/routes/platformOwner/plan-migrations.d.ts +43 -0
- package/dist/routes/platformOwner/plan-migrations.js +260 -0
- package/dist/routes/platformOwner/plan-migrations.js.map +1 -0
- package/dist/routes/platformOwner/plans.d.ts +44 -41
- package/dist/routes/platformOwner/plans.js +155 -142
- package/dist/routes/platformOwner/plans.js.map +1 -1
- package/dist/routes/platformOwner/platform-owners.d.ts +8 -6
- package/dist/routes/platformOwner/platform-owners.js +40 -12
- package/dist/routes/platformOwner/platform-owners.js.map +1 -1
- package/dist/routes/platformOwner/segments-export.d.ts +15 -0
- package/dist/routes/platformOwner/segments-export.js +143 -0
- package/dist/routes/platformOwner/segments-export.js.map +1 -0
- package/dist/routes/platformOwner/segments.d.ts +17 -11
- package/dist/routes/platformOwner/segments.js +62 -113
- package/dist/routes/platformOwner/segments.js.map +1 -1
- package/dist/routes/platformOwner/stripe-dashboard.d.ts +6 -0
- package/dist/routes/platformOwner/stripe-dashboard.js +29 -0
- package/dist/routes/platformOwner/stripe-dashboard.js.map +1 -0
- package/dist/routes/platformOwner/users-detail.d.ts +12 -22
- package/dist/routes/platformOwner/users-detail.js +60 -53
- package/dist/routes/platformOwner/users-detail.js.map +1 -1
- package/dist/routes/platformOwner/workspace-detail.d.ts +36 -0
- package/dist/routes/platformOwner/workspace-detail.js +222 -0
- package/dist/routes/platformOwner/workspace-detail.js.map +1 -0
- package/dist/routes/platformOwner/workspace-invitations.d.ts +4 -0
- package/dist/routes/platformOwner/workspace-invitations.js +18 -0
- package/dist/routes/platformOwner/workspace-invitations.js.map +1 -1
- package/dist/routes/platformOwner/workspace-operator-actions.d.ts +14 -2
- package/dist/routes/platformOwner/workspace-operator-actions.js +42 -4
- package/dist/routes/platformOwner/workspace-operator-actions.js.map +1 -1
- package/dist/routes/platformOwner/workspaces-admin.d.ts +17 -12
- package/dist/routes/platformOwner/workspaces-admin.js +122 -28
- package/dist/routes/platformOwner/workspaces-admin.js.map +1 -1
- package/dist/routes/public/index.d.ts +1 -0
- package/dist/routes/public/index.js +1 -0
- package/dist/routes/public/index.js.map +1 -1
- package/dist/routes/public/legal-documents.d.ts +2 -8
- package/dist/routes/public/legal-documents.js +4 -39
- package/dist/routes/public/legal-documents.js.map +1 -1
- package/dist/routes/public/pricing.d.ts +12 -0
- package/dist/routes/public/pricing.js +50 -0
- package/dist/routes/public/pricing.js.map +1 -0
- package/dist/routes/public/public-plan-catalog.d.ts +37 -0
- package/dist/routes/public/public-plan-catalog.js +63 -0
- package/dist/routes/public/public-plan-catalog.js.map +1 -0
- package/dist/routes/public/register.d.ts +13 -0
- package/dist/routes/public/register.js +88 -4
- package/dist/routes/public/register.js.map +1 -1
- package/dist/routes/tenant/billing-pay-invoice.d.ts +13 -0
- package/dist/routes/tenant/billing-pay-invoice.js +82 -0
- package/dist/routes/tenant/billing-pay-invoice.js.map +1 -0
- package/dist/routes/tenant/billing-portal.d.ts +8 -3
- package/dist/routes/tenant/billing-portal.js +34 -16
- package/dist/routes/tenant/billing-portal.js.map +1 -1
- package/dist/routes/tenant/billing-self-refund.d.ts +26 -1
- package/dist/routes/tenant/billing-self-refund.js +95 -46
- package/dist/routes/tenant/billing-self-refund.js.map +1 -1
- package/dist/routes/tenant/complimentary-banner.d.ts +12 -0
- package/dist/routes/tenant/complimentary-banner.js +64 -0
- package/dist/routes/tenant/complimentary-banner.js.map +1 -0
- package/dist/routes/tenant/data-export.js +14 -0
- package/dist/routes/tenant/data-export.js.map +1 -1
- package/dist/routes/tenant/index.d.ts +7 -0
- package/dist/routes/tenant/index.js +7 -0
- package/dist/routes/tenant/index.js.map +1 -1
- package/dist/routes/tenant/tenant-billing.d.ts +1 -0
- package/dist/routes/tenant/tenant-billing.js +18 -13
- package/dist/routes/tenant/tenant-billing.js.map +1 -1
- package/dist/routes/tenant/tenant-plan-authentication.d.ts +13 -0
- package/dist/routes/tenant/tenant-plan-authentication.js +79 -0
- package/dist/routes/tenant/tenant-plan-authentication.js.map +1 -0
- package/dist/routes/tenant/tenant-plan-cancellation.d.ts +12 -0
- package/dist/routes/tenant/tenant-plan-cancellation.js +87 -0
- package/dist/routes/tenant/tenant-plan-cancellation.js.map +1 -0
- package/dist/routes/tenant/tenant-plan-checkout.d.ts +3 -0
- package/dist/routes/tenant/tenant-plan-checkout.js +21 -11
- package/dist/routes/tenant/tenant-plan-checkout.js.map +1 -1
- package/dist/routes/tenant/tenant-plan-ops.d.ts +32 -2
- package/dist/routes/tenant/tenant-plan-ops.js +112 -39
- package/dist/routes/tenant/tenant-plan-ops.js.map +1 -1
- package/dist/routes/tenant/tenant-plan-preview.d.ts +33 -0
- package/dist/routes/tenant/tenant-plan-preview.js +216 -0
- package/dist/routes/tenant/tenant-plan-preview.js.map +1 -0
- package/dist/routes/tenant/tenant-plan-resubscription.d.ts +2 -0
- package/dist/routes/tenant/tenant-plan-resubscription.js +61 -0
- package/dist/routes/tenant/tenant-plan-resubscription.js.map +1 -0
- package/dist/routes/tenant/tenant-plan.d.ts +9 -4
- package/dist/routes/tenant/tenant-plan.js +124 -16
- package/dist/routes/tenant/tenant-plan.js.map +1 -1
- package/dist/routes/tenant/tenant-seats.d.ts +6 -1
- package/dist/routes/tenant/tenant-seats.js +26 -5
- package/dist/routes/tenant/tenant-seats.js.map +1 -1
- package/dist/routes/tenant/tenant-upcoming-invoice.d.ts +26 -0
- package/dist/routes/tenant/tenant-upcoming-invoice.js +200 -0
- package/dist/routes/tenant/tenant-upcoming-invoice.js.map +1 -0
- package/dist/routes/tenant/workspace-access.d.ts +67 -0
- package/dist/routes/tenant/workspace-access.js +224 -0
- package/dist/routes/tenant/workspace-access.js.map +1 -0
- package/dist/routes/tenant/workspaces.d.ts +12 -43
- package/dist/routes/tenant/workspaces.js +82 -192
- package/dist/routes/tenant/workspaces.js.map +1 -1
- package/dist/segments/index.d.ts +29 -0
- package/dist/segments/index.js +116 -0
- package/dist/segments/index.js.map +1 -0
- package/dist/stripe/client.d.ts +1 -0
- package/dist/stripe/client.js +11 -0
- package/dist/stripe/client.js.map +1 -1
- package/dist/stripe/customer-locale.d.ts +3 -0
- package/dist/stripe/customer-locale.js +36 -0
- package/dist/stripe/customer-locale.js.map +1 -0
- package/dist/stripe/dashboard-links.d.ts +2 -0
- package/dist/stripe/dashboard-links.js +8 -0
- package/dist/stripe/dashboard-links.js.map +1 -0
- package/dist/stripe/index.d.ts +3 -0
- package/dist/stripe/index.js +3 -0
- package/dist/stripe/index.js.map +1 -1
- package/dist/stripe/pending-update.d.ts +5 -0
- package/dist/stripe/pending-update.js +56 -0
- package/dist/stripe/pending-update.js.map +1 -0
- package/dist/stripe/plan-schedule.js +4 -1
- package/dist/stripe/plan-schedule.js.map +1 -1
- package/dist/stripe/subscription-cancellation.d.ts +3 -0
- package/dist/stripe/subscription-cancellation.js +26 -0
- package/dist/stripe/subscription-cancellation.js.map +1 -0
- package/dist/stripe/sync-plan.js +5 -6
- package/dist/stripe/sync-plan.js.map +1 -1
- package/dist/stripe/upcoming-invoice.d.ts +9 -0
- package/dist/stripe/upcoming-invoice.js +19 -3
- package/dist/stripe/upcoming-invoice.js.map +1 -1
- package/dist/stripe/webhook-checkout.js +2 -0
- package/dist/stripe/webhook-checkout.js.map +1 -1
- package/dist/stripe/webhook-credit-notes.js +15 -0
- package/dist/stripe/webhook-credit-notes.js.map +1 -1
- package/dist/stripe/webhook-dispatch.js +2 -0
- package/dist/stripe/webhook-dispatch.js.map +1 -1
- package/dist/stripe/webhook-handlers.d.ts +1 -0
- package/dist/stripe/webhook-handlers.js +34 -9
- package/dist/stripe/webhook-handlers.js.map +1 -1
- package/dist/stripe/webhook-shared.d.ts +3 -1
- package/dist/stripe/webhook-shared.js +20 -1
- package/dist/stripe/webhook-shared.js.map +1 -1
- package/dist/stripe/workspace-checkout.d.ts +2 -0
- package/dist/stripe/workspace-checkout.js +4 -0
- package/dist/stripe/workspace-checkout.js.map +1 -1
- package/dist/types/config.d.ts +2 -0
- package/dist/types/config.js.map +1 -1
- package/dist/upcoming-invoice/mapping.js +1 -0
- package/dist/upcoming-invoice/mapping.js.map +1 -1
- package/dist/users/index.d.ts +4 -0
- package/dist/users/index.js +21 -0
- package/dist/users/index.js.map +1 -0
- package/dist/users/platform-role.d.ts +18 -0
- package/dist/users/platform-role.js +127 -0
- package/dist/users/platform-role.js.map +1 -0
- package/dist/users/user-detail.d.ts +43 -0
- package/dist/users/user-detail.js +100 -0
- package/dist/users/user-detail.js.map +1 -0
- package/dist/users/user-facts.d.ts +10 -0
- package/dist/users/user-facts.js +157 -0
- package/dist/users/user-facts.js.map +1 -0
- package/dist/users/user-segments.d.ts +10 -0
- package/dist/users/user-segments.js +32 -0
- package/dist/users/user-segments.js.map +1 -0
- package/dist/utils/billing-displays.d.ts +6 -0
- package/dist/utils/billing-displays.js +17 -0
- package/dist/utils/billing-displays.js.map +1 -0
- package/dist/utils/billing-document-status.d.ts +0 -4
- package/dist/utils/billing-document-status.js +1 -13
- package/dist/utils/billing-document-status.js.map +1 -1
- package/dist/utils/billing-document-type.d.ts +6 -0
- package/dist/utils/billing-document-type.js +13 -0
- package/dist/utils/billing-document-type.js.map +1 -1
- package/dist/utils/csv-file.d.ts +2 -0
- package/dist/utils/csv-file.js +23 -0
- package/dist/utils/csv-file.js.map +1 -0
- package/dist/utils/form-insight-type.d.ts +8 -0
- package/dist/utils/form-insight-type.js +34 -0
- package/dist/utils/form-insight-type.js.map +1 -0
- package/dist/utils/index.d.ts +8 -0
- package/dist/utils/index.js +8 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/language.d.ts +1 -0
- package/dist/utils/language.js +7 -0
- package/dist/utils/language.js.map +1 -0
- package/dist/utils/money.d.ts +2 -0
- package/dist/utils/money.js +24 -0
- package/dist/utils/money.js.map +1 -0
- package/dist/utils/segment-evaluator.d.ts +4 -0
- package/dist/utils/segment-evaluator.js +15 -8
- package/dist/utils/segment-evaluator.js.map +1 -1
- package/dist/utils/segment-explain.d.ts +10 -0
- package/dist/utils/segment-explain.js +31 -0
- package/dist/utils/segment-explain.js.map +1 -0
- package/dist/utils/segment-fields.d.ts +13 -2
- package/dist/utils/segment-fields.js +137 -116
- package/dist/utils/segment-fields.js.map +1 -1
- package/dist/utils/segment-matching.d.ts +14 -3
- package/dist/utils/segment-matching.js +47 -13
- package/dist/utils/segment-matching.js.map +1 -1
- package/dist/utils/segment-preview.d.ts +31 -0
- package/dist/utils/segment-preview.js +83 -0
- package/dist/utils/segment-preview.js.map +1 -0
- package/dist/utils/segment-user-projection.d.ts +3 -0
- package/dist/utils/segment-user-projection.js +31 -0
- package/dist/utils/segment-user-projection.js.map +1 -0
- package/dist/utils/segment-validation.d.ts +14 -0
- package/dist/utils/segment-validation.js +98 -0
- package/dist/utils/segment-validation.js.map +1 -0
- package/dist/utils/status-vocabulary.d.ts +57 -0
- package/dist/utils/status-vocabulary.js +92 -0
- package/dist/utils/status-vocabulary.js.map +1 -0
- package/dist/workers/index.d.ts +1 -0
- package/dist/workers/index.js +1 -0
- package/dist/workers/index.js.map +1 -1
- package/dist/workers/plan-migration-resolution.d.ts +14 -0
- package/dist/workers/plan-migration-resolution.js +99 -0
- package/dist/workers/plan-migration-resolution.js.map +1 -0
- package/dist/workers/plan-migration.d.ts +6 -1
- package/dist/workers/plan-migration.js +152 -37
- package/dist/workers/plan-migration.js.map +1 -1
- package/dist/workspaces/billing-identity-lock.d.ts +1 -0
- package/dist/workspaces/billing-identity-lock.js +18 -0
- package/dist/workspaces/billing-identity-lock.js.map +1 -0
- package/dist/workspaces/complimentary-banner.d.ts +11 -0
- package/dist/workspaces/complimentary-banner.js +83 -0
- package/dist/workspaces/complimentary-banner.js.map +1 -0
- package/dist/workspaces/default-member-role.d.ts +2 -0
- package/dist/workspaces/default-member-role.js +43 -0
- package/dist/workspaces/default-member-role.js.map +1 -0
- package/dist/workspaces/deletion-request.d.ts +2 -0
- package/dist/workspaces/deletion-request.js +5 -0
- package/dist/workspaces/deletion-request.js.map +1 -0
- package/dist/workspaces/deletion.d.ts +1 -1
- package/dist/workspaces/deletion.js +19 -7
- package/dist/workspaces/deletion.js.map +1 -1
- package/dist/workspaces/detail-items.d.ts +15 -0
- package/dist/workspaces/detail-items.js +226 -0
- package/dist/workspaces/detail-items.js.map +1 -0
- package/dist/workspaces/first-payment.d.ts +5 -0
- package/dist/workspaces/first-payment.js +28 -0
- package/dist/workspaces/first-payment.js.map +1 -0
- package/dist/workspaces/free-workspaces-per-card.d.ts +6 -0
- package/dist/workspaces/free-workspaces-per-card.js +58 -0
- package/dist/workspaces/free-workspaces-per-card.js.map +1 -0
- package/dist/workspaces/index.d.ts +7 -0
- package/dist/workspaces/index.js +7 -0
- package/dist/workspaces/index.js.map +1 -1
- package/dist/workspaces/invitations.d.ts +2 -1
- package/dist/workspaces/invitations.js +16 -6
- package/dist/workspaces/invitations.js.map +1 -1
- package/dist/workspaces/my-workspaces.d.ts +13 -0
- package/dist/workspaces/my-workspaces.js +68 -0
- package/dist/workspaces/my-workspaces.js.map +1 -0
- package/dist/workspaces/operator-creation.d.ts +39 -0
- package/dist/workspaces/operator-creation.js +123 -0
- package/dist/workspaces/operator-creation.js.map +1 -0
- package/dist/workspaces/operator-view.d.ts +13 -0
- package/dist/workspaces/operator-view.js +37 -0
- package/dist/workspaces/operator-view.js.map +1 -0
- package/dist/workspaces/owner-contact.d.ts +7 -0
- package/dist/workspaces/owner-contact.js +24 -0
- package/dist/workspaces/owner-contact.js.map +1 -0
- package/dist/workspaces/owner-invitation-email.d.ts +12 -0
- package/dist/workspaces/owner-invitation-email.js +53 -0
- package/dist/workspaces/owner-invitation-email.js.map +1 -0
- package/dist/workspaces/provisioning.d.ts +2 -0
- package/dist/workspaces/provisioning.js +37 -15
- package/dist/workspaces/provisioning.js.map +1 -1
- package/dist/workspaces/self-serve-creation.d.ts +38 -0
- package/dist/workspaces/self-serve-creation.js +106 -0
- package/dist/workspaces/self-serve-creation.js.map +1 -0
- package/dist/workspaces/workspace-glance.d.ts +3 -0
- package/dist/workspaces/workspace-glance.js +93 -0
- package/dist/workspaces/workspace-glance.js.map +1 -0
- package/dist/workspaces/workspace-name.d.ts +2 -0
- package/dist/workspaces/workspace-name.js +14 -0
- package/dist/workspaces/workspace-name.js.map +1 -0
- package/dist/workspaces/workspace-overview.d.ts +41 -0
- package/dist/workspaces/workspace-overview.js +84 -0
- package/dist/workspaces/workspace-overview.js.map +1 -0
- package/dist/workspaces/workspace-owner.d.ts +7 -0
- package/dist/workspaces/workspace-owner.js +14 -0
- package/dist/workspaces/workspace-owner.js.map +1 -0
- package/frontend-vue/app/build/PayInvoiceDialog.vue +40 -0
- package/frontend-vue/app/build/PayInvoicePanel.vue +203 -0
- package/frontend-vue/app/build/PlanChangeReview.vue +415 -0
- package/frontend-vue/app/build/PlanFeatureValueInput.vue +143 -0
- package/frontend-vue/app/build/PlanPermissionPicker.vue +246 -0
- package/frontend-vue/app/build/WorkspaceSwitcherRow.vue +116 -0
- package/frontend-vue/app/build/components/CreditNoteInvoiceSummary.vue +82 -0
- package/frontend-vue/app/build/components/FormFieldRow.vue +97 -0
- package/frontend-vue/app/build/components/FormRows.vue +26 -0
- package/frontend-vue/app/build/components/RequiredLegend.vue +7 -0
- package/frontend-vue/app/build/composables/useCreditNoteDraft.ts +142 -0
- package/frontend-vue/app/build/composables/useCreditNoteTexts.ts +123 -0
- package/frontend-vue/app/build/composables/useLiveFormValues.ts +49 -0
- package/frontend-vue/app/build/day-formats.ts +17 -0
- package/frontend-vue/app/build/highlight.ts +28 -0
- package/frontend-vue/app/build/plan-catalog.ts +161 -0
- package/frontend-vue/app/build/plan-change-heading.ts +81 -0
- package/frontend-vue/app/build/plan-permissions.ts +92 -0
- package/frontend-vue/app/build/plan-retire.ts +83 -0
- package/frontend-vue/app/build/public/AccessTimeline.vue +68 -0
- package/frontend-vue/app/build/public/LegalAcceptance.vue +51 -0
- package/frontend-vue/app/build/public/OtherWorkspaces.vue +88 -0
- package/frontend-vue/app/build/public/PricingComparison.vue +227 -0
- package/frontend-vue/app/build/public/PricingFaq.vue +76 -0
- package/frontend-vue/app/build/public/PublicStage.vue +72 -0
- package/frontend-vue/app/build/public/RegistrationCardField.vue +74 -0
- package/frontend-vue/app/build/public/RegistrationPlanCard.vue +122 -0
- package/frontend-vue/app/build/public/access.ts +118 -0
- package/frontend-vue/app/build/public/chosen-plan.ts +36 -0
- package/frontend-vue/app/build/public/legal.ts +99 -0
- package/frontend-vue/app/build/public/pricing.ts +175 -0
- package/frontend-vue/app/build/public/routes.ts +122 -0
- package/frontend-vue/app/build/public/usePublicFetch.ts +44 -0
- package/frontend-vue/app/build/public/usePublicPlanFormat.ts +52 -0
- package/frontend-vue/app/build/segments/tree.ts +137 -0
- package/frontend-vue/app/build/segments/types.ts +119 -0
- package/frontend-vue/app/build/segments/useSegmentCatalog.ts +58 -0
- package/frontend-vue/app/build/segments/useSegmentDraft.ts +33 -0
- package/frontend-vue/app/build/segments/useSegmentPreview.ts +78 -0
- package/frontend-vue/app/build/segments/useSegmentSentence.ts +60 -0
- package/frontend-vue/app/build/segments/useSegmentWords.ts +204 -0
- package/frontend-vue/app/build/useWorkspaceName.ts +14 -0
- package/frontend-vue/app/build/users/useUserDetail.ts +82 -0
- package/frontend-vue/app/build/workspace-detail/ComplimentaryDialog.vue +219 -0
- package/frontend-vue/app/build/workspace-detail/CreditDialog.vue +243 -0
- package/frontend-vue/app/build/workspace-detail/UpgradeDialog.vue +258 -0
- package/frontend-vue/app/build/workspace-detail/WorkspaceActionDialogs.vue +82 -0
- package/frontend-vue/app/build/workspace-detail/planPrice.ts +26 -0
- package/frontend-vue/app/build/workspace-detail/types.ts +138 -0
- package/frontend-vue/app/build/workspace-detail/useWorkspaceActions.ts +177 -0
- package/frontend-vue/app/build/workspace-detail/useWorkspaceOverview.ts +44 -0
- package/frontend-vue/app/build/workspace-paths.ts +8 -0
- package/frontend-vue/app/components/BillingIdentityFields.vue +294 -161
- package/frontend-vue/app/components/CustomerPortalButton.vue +80 -32
- package/frontend-vue/app/components/DataExport.vue +250 -260
- package/frontend-vue/app/components/DataExportHistory.vue +246 -0
- package/frontend-vue/app/components/DunningTimeline.vue +120 -0
- package/frontend-vue/app/components/IssueCreditNoteModal.vue +318 -116
- package/frontend-vue/app/components/LegalDocumentRelease.vue +64 -0
- package/frontend-vue/app/components/LegalLayout.vue +284 -46
- package/frontend-vue/app/components/MigrationStripeCheck.vue +133 -0
- package/frontend-vue/app/components/PastDueAlert.vue +186 -78
- package/frontend-vue/app/components/PastDueBanner.vue +96 -67
- package/frontend-vue/app/components/PayInvoiceModal.vue +57 -0
- package/frontend-vue/app/components/PaymentMethodCard.vue +159 -163
- package/frontend-vue/app/components/PendingCheckoutModal.vue +61 -61
- package/frontend-vue/app/components/PlanAccessEditor.vue +410 -0
- package/frontend-vue/app/components/PlanCard.vue +358 -261
- package/frontend-vue/app/components/PlanCardPublic.vue +123 -51
- package/frontend-vue/app/components/PlanComparisonModal.vue +373 -309
- package/frontend-vue/app/components/PlanEditorPreview.vue +374 -0
- package/frontend-vue/app/components/PlanLimitInput.vue +92 -0
- package/frontend-vue/app/components/PlanTaxSync.vue +118 -0
- package/frontend-vue/app/components/PlanUpgradeModal.vue +265 -156
- package/frontend-vue/app/components/PlatformNotes.vue +215 -255
- package/frontend-vue/app/components/Pricing.vue +236 -0
- package/frontend-vue/app/components/PublicNavBar.vue +70 -0
- package/frontend-vue/app/components/RefundButton.vue +265 -113
- package/frontend-vue/app/components/RefundExample.vue +86 -0
- package/frontend-vue/app/components/Register.vue +217 -121
- package/frontend-vue/app/components/RegistrationClosed.vue +30 -13
- package/frontend-vue/app/components/RetirePlanModal.vue +829 -0
- package/frontend-vue/app/components/SeatQuotaBanner.vue +240 -90
- package/frontend-vue/app/components/SegmentConditionRow.vue +171 -0
- package/frontend-vue/app/components/SegmentConditionsBuilder.vue +89 -162
- package/frontend-vue/app/components/SegmentConditionsGroup.vue +273 -463
- package/frontend-vue/app/components/SegmentLivePreview.vue +301 -0
- package/frontend-vue/app/components/SegmentLogicToggle.vue +24 -0
- package/frontend-vue/app/components/SegmentRulesText.vue +57 -0
- package/frontend-vue/app/components/SegmentValueInput.vue +165 -0
- package/frontend-vue/app/components/SegmentWords.vue +36 -0
- package/frontend-vue/app/components/TenantBillingForm.vue +142 -103
- package/frontend-vue/app/components/TenantPlanCard.vue +635 -280
- package/frontend-vue/app/components/TrialEndingBanner.vue +76 -0
- package/frontend-vue/app/components/UserPlatformRoleCard.vue +102 -0
- package/frontend-vue/app/components/UserSegmentMatches.vue +123 -0
- package/frontend-vue/app/components/UserSummaryCard.vue +107 -158
- package/frontend-vue/app/components/WorkspaceAdminCreateModal.vue +354 -177
- package/frontend-vue/app/components/WorkspaceCreateModal.vue +372 -252
- package/frontend-vue/app/components/WorkspaceDangerZone.vue +178 -126
- package/frontend-vue/app/components/WorkspaceDetailHeader.vue +262 -19
- package/frontend-vue/app/components/WorkspaceInvitationLink.vue +108 -86
- package/frontend-vue/app/components/WorkspaceOperatorActions.vue +105 -330
- package/frontend-vue/app/components/WorkspaceSuspendButton.vue +34 -158
- package/frontend-vue/app/components/WorkspaceSuspended.vue +390 -149
- package/frontend-vue/app/components/WorkspaceSwitcherWidget.vue +145 -161
- package/frontend-vue/app/composables/useBillingIdentity.ts +97 -95
- package/frontend-vue/app/composables/useBillingStatus.ts +56 -24
- package/frontend-vue/app/composables/useCurrentWorkspace.ts +15 -30
- package/frontend-vue/app/composables/useDaysLeft.ts +20 -0
- package/frontend-vue/app/composables/useExportHistory.ts +209 -120
- package/frontend-vue/app/composables/useInvitationLink.ts +39 -53
- package/frontend-vue/app/composables/useMoneyFormat.ts +64 -33
- package/frontend-vue/app/composables/useMyWorkspaces.ts +41 -32
- package/frontend-vue/app/composables/useNextInvoice.ts +20 -0
- package/frontend-vue/app/composables/usePayInvoice.ts +52 -0
- package/frontend-vue/app/composables/usePendingCheckout.ts +71 -67
- package/frontend-vue/app/composables/usePlanCatalog.ts +16 -0
- package/frontend-vue/app/composables/usePlanChangeReview.ts +115 -0
- package/frontend-vue/app/composables/usePlanComparison.ts +17 -8
- package/frontend-vue/app/composables/usePlanDowngrade.ts +25 -23
- package/frontend-vue/app/composables/usePlanFeatureFormat.ts +238 -202
- package/frontend-vue/app/composables/usePlanPriceLabel.ts +28 -0
- package/frontend-vue/app/composables/useSaasRegistration.ts +516 -301
- package/frontend-vue/app/composables/useSaasStatus.ts +81 -0
- package/frontend-vue/app/composables/useSeatQuota.ts +27 -17
- package/frontend-vue/app/composables/useServerConfirm.ts +44 -0
- package/frontend-vue/app/composables/useStripePaymentElement.ts +3 -5
- package/frontend-vue/app/composables/useTenantPlan.ts +235 -99
- package/frontend-vue/app/composables/useUpgradeAuthentication.ts +37 -0
- package/frontend-vue/app/composables/useWorkspaceFinalization.ts +4 -0
- package/frontend-vue/app/composables/useWorkspaceOverview.ts +58 -0
- package/frontend-vue/app/composables/useWorkspaceRenamed.ts +33 -0
- package/frontend-vue/app/custom-pages/auth/no-workspace.vue +391 -312
- package/frontend-vue/app/plugins/auth-links.ts +38 -17
- package/frontend-vue/app/plugins/billing-data-types.ts +111 -58
- package/frontend-vue/app/plugins/footer-links.ts +13 -33
- package/frontend-vue/app/plugins/segment-conditions-data-type.ts +45 -0
- package/frontend-vue/app/plugins/sidebar-widgets.ts +13 -10
- package/frontend-vue/app/types/runtime-config.ts +9 -4
- package/frontend-vue/dms.frontend.build.ts +7 -0
- package/frontend-vue/dms.frontend.ts +6 -13
- package/frontend-vue/i18n/locales/saas-en-GB.json +499 -1380
- package/frontend-vue/i18n/locales/saas-fr-FR.json +499 -1380
- package/frontend-vue/i18n/locales/saas-operator-billing-en-GB.json +282 -0
- package/frontend-vue/i18n/locales/saas-operator-billing-fr-FR.json +282 -0
- package/frontend-vue/i18n/locales/saas-operator-catalog-en-GB.json +597 -0
- package/frontend-vue/i18n/locales/saas-operator-catalog-fr-FR.json +597 -0
- package/frontend-vue/i18n/locales/saas-operator-users-en-GB.json +505 -0
- package/frontend-vue/i18n/locales/saas-operator-users-fr-FR.json +505 -0
- package/frontend-vue/i18n/locales/saas-operator-workspaces-en-GB.json +595 -0
- package/frontend-vue/i18n/locales/saas-operator-workspaces-fr-FR.json +595 -0
- package/frontend-vue/i18n/locales/saas-public-en-GB.json +305 -0
- package/frontend-vue/i18n/locales/saas-public-fr-FR.json +305 -0
- package/frontend-vue/i18n/locales/saas-tenant-billing-en-GB.json +434 -0
- package/frontend-vue/i18n/locales/saas-tenant-billing-fr-FR.json +434 -0
- package/frontend-vue/i18n/locales/saas-tenant-workspace-en-GB.json +252 -0
- package/frontend-vue/i18n/locales/saas-tenant-workspace-fr-FR.json +252 -0
- package/frontend-vue/package.json +1 -1
- package/package.json +10 -10
- package/frontend-vue/app/components/CardGrid.vue +0 -77
- package/frontend-vue/app/components/DeletePlanModal.vue +0 -223
- package/frontend-vue/app/components/FreeAccessBanner.vue +0 -70
- package/frontend-vue/app/components/PlanCardsDisplay.vue +0 -127
- package/frontend-vue/app/components/PlanInheritancePicker.vue +0 -329
- package/frontend-vue/app/components/RecentActivity.vue +0 -72
- package/frontend-vue/app/components/WorkspaceBillingInfo.vue +0 -68
- package/frontend-vue/app/components/WorkspaceCompAccessButton.vue +0 -198
- package/frontend-vue/app/components/WorkspaceIdentity.vue +0 -99
- package/frontend-vue/app/components/WorkspaceJoinButton.vue +0 -50
- package/frontend-vue/app/components/WorkspaceSummaryCard.vue +0 -185
- package/frontend-vue/app/composables/useDetailRefresh.ts +0 -17
- package/frontend-vue/app/composables/usePastDueBannerAction.ts +0 -20
- package/frontend-vue/app/plugins/plan-cards-display.ts +0 -16
- package/frontend-vue/app/plugins/segment-conditions-data-type.client.ts +0 -122
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { SessionModel, type User, UserModel } from "@antelopejs/interface-dms/auth/db";
|
|
2
|
+
import { PlanModel } from "../../db";
|
|
3
|
+
import { type PublicBillingRules, type PublicPlan } from "./public-plan-catalog";
|
|
4
|
+
import type { TenantPlanFeature } from "../../plans";
|
|
2
5
|
interface RegistrationPayload {
|
|
3
6
|
workspaceName?: string;
|
|
4
7
|
paymentMethodId?: string;
|
|
8
|
+
requestedPlanId?: string;
|
|
5
9
|
extras?: Record<string, unknown>;
|
|
6
10
|
}
|
|
7
11
|
interface RegisterBody extends RegistrationPayload {
|
|
@@ -34,16 +38,25 @@ interface RegisterResult {
|
|
|
34
38
|
userId: string;
|
|
35
39
|
tenantId: string;
|
|
36
40
|
}
|
|
41
|
+
interface RegistrationPlanSummary {
|
|
42
|
+
plan: PublicPlan;
|
|
43
|
+
requestedPlan: PublicPlan | null;
|
|
44
|
+
features: TenantPlanFeature[];
|
|
45
|
+
rules: PublicBillingRules;
|
|
46
|
+
}
|
|
37
47
|
declare const SaasRegisterApiController_base: import("@antelopejs/interface-api").ControllerClass<object>;
|
|
38
48
|
export declare class SaasRegisterApiController extends SaasRegisterApiController_base {
|
|
39
49
|
userModel: UserModel;
|
|
40
50
|
sessionModel: SessionModel;
|
|
51
|
+
planModel: PlanModel;
|
|
41
52
|
userAgent: string;
|
|
42
53
|
forwardedFor: string;
|
|
54
|
+
contentLanguage: unknown;
|
|
43
55
|
private ensureEmailAvailable;
|
|
44
56
|
private ensureNoWorkspaceYet;
|
|
45
57
|
private createInitialUser;
|
|
46
58
|
private issueAuthResponse;
|
|
59
|
+
describeRegistrationPlan(reference: unknown, language: unknown): Promise<RegistrationPlanSummary>;
|
|
47
60
|
createSetupIntent(): Promise<SetupIntentResponse>;
|
|
48
61
|
register(body: RegisterBody): Promise<RegisterResult>;
|
|
49
62
|
describePendingRegistration(body: PendingRegistrationBody): Promise<PendingRegistration>;
|
|
@@ -25,9 +25,15 @@ const db_2 = require("@antelopejs/interface-dms/auth/db");
|
|
|
25
25
|
const password_1 = require("@antelopejs/interface-dms/auth/password");
|
|
26
26
|
const auth_2 = require("../../auth");
|
|
27
27
|
const config_1 = require("../../config");
|
|
28
|
+
const db_3 = require("../../db");
|
|
28
29
|
const stripe_1 = require("../../stripe");
|
|
30
|
+
const content_language_1 = require("../../utils/content-language");
|
|
29
31
|
const workspaces_1 = require("../../workspaces");
|
|
32
|
+
const public_plan_catalog_1 = require("./public-plan-catalog");
|
|
33
|
+
const plan_audience_1 = require("../../plans/plan-audience");
|
|
30
34
|
const HTTP_BAD_REQUEST = 400;
|
|
35
|
+
const HTTP_CONFLICT = 409;
|
|
36
|
+
const REGISTRATION_CUSTOMER_TYPE = "individual";
|
|
31
37
|
const AUTH_KEY_BYTES = 32;
|
|
32
38
|
const DEFAULT_WORKSPACE_NAME = "My workspace";
|
|
33
39
|
function generateAuthKey() {
|
|
@@ -36,24 +42,60 @@ function generateAuthKey() {
|
|
|
36
42
|
function assertRegistrationPassword(password) {
|
|
37
43
|
(0, interface_api_util_1.assert)(typeof password === "string" && (0, password_1.isPasswordCompliant)(password), HTTP_BAD_REQUEST, "saas.errors.registration.password_policy");
|
|
38
44
|
}
|
|
45
|
+
async function registrationCardMayBackFreeWorkspace(card) {
|
|
46
|
+
if (!card.fingerprint)
|
|
47
|
+
return true;
|
|
48
|
+
const limit = await (0, workspaces_1.resolveFreeWorkspacesPerCard)();
|
|
49
|
+
if (!(0, workspaces_1.isFreePerCardPolicyActive)(limit))
|
|
50
|
+
return true;
|
|
51
|
+
return (0, workspaces_1.cardMayBackFreeWorkspace)(card.fingerprint, limit);
|
|
52
|
+
}
|
|
53
|
+
async function resolveRequestedPaidPlan(reference) {
|
|
54
|
+
const publicPlans = await (0, interface_database_decorators_1.GetModel)(db_3.PlanModel).findPubliclyVisible();
|
|
55
|
+
const plan = (0, public_plan_catalog_1.findPlanByReference)(publicPlans, reference);
|
|
56
|
+
const isPayable = !!plan &&
|
|
57
|
+
plan.isActive &&
|
|
58
|
+
!plan.isDeleted &&
|
|
59
|
+
!(0, workspaces_1.isFreePlan)(plan) &&
|
|
60
|
+
!!plan.paymentProviderRefs?.stripePriceId &&
|
|
61
|
+
(0, plan_audience_1.isPlanOfferedTo)(plan, REGISTRATION_CUSTOMER_TYPE);
|
|
62
|
+
return isPayable ? plan : null;
|
|
63
|
+
}
|
|
64
|
+
async function admitPendingPaymentRegistration(body, card) {
|
|
65
|
+
const plan = await resolveRequestedPaidPlan(body.requestedPlanId);
|
|
66
|
+
(0, interface_api_util_1.assert)(plan, HTTP_CONFLICT, "saas.errors.workspace.free_card_limit_reached");
|
|
67
|
+
return {
|
|
68
|
+
plan,
|
|
69
|
+
paymentMethodId: undefined,
|
|
70
|
+
card: { fingerprint: null, billingAddress: card.billingAddress },
|
|
71
|
+
awaitsFirstPayment: true,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
39
74
|
async function admitRegistration(body) {
|
|
40
75
|
const paymentMethodId = (0, config_1.resolveRegistrationPaymentMethodId)(body.paymentMethodId);
|
|
41
76
|
(0, workspaces_1.assertRegistrationExtras)(body.extras);
|
|
42
|
-
|
|
77
|
+
const plan = await (0, workspaces_1.resolveRegistrationPlan)();
|
|
78
|
+
const card = await (0, workspaces_1.resolveCardDetails)(paymentMethodId);
|
|
79
|
+
if (!(await registrationCardMayBackFreeWorkspace(card))) {
|
|
80
|
+
return admitPendingPaymentRegistration(body, card);
|
|
81
|
+
}
|
|
82
|
+
return { plan, paymentMethodId, card, awaitsFirstPayment: false };
|
|
43
83
|
}
|
|
44
84
|
async function buildRegistrationProvisioning(account, body, admitted, handles) {
|
|
45
|
-
const card =
|
|
85
|
+
const { card } = admitted;
|
|
46
86
|
const billingProfile = {
|
|
47
|
-
customerType:
|
|
87
|
+
customerType: REGISTRATION_CUSTOMER_TYPE,
|
|
48
88
|
address: card.billingAddress,
|
|
49
89
|
};
|
|
50
90
|
return {
|
|
51
91
|
userId: account.userId,
|
|
92
|
+
ownerLanguage: account.language,
|
|
52
93
|
payload: {
|
|
53
94
|
...billingProfile,
|
|
54
95
|
workspaceName: body.workspaceName?.trim() || DEFAULT_WORKSPACE_NAME,
|
|
55
96
|
planId: admitted.plan._id,
|
|
56
97
|
paymentMethodId: admitted.paymentMethodId,
|
|
98
|
+
awaitsFirstPayment: admitted.awaitsFirstPayment,
|
|
57
99
|
extras: body.extras,
|
|
58
100
|
},
|
|
59
101
|
stripeCustomerProfile: {
|
|
@@ -83,6 +125,7 @@ class SaasRegisterApiController extends (0, interface_api_1.Controller)("/api/sa
|
|
|
83
125
|
password: body.password,
|
|
84
126
|
authKey: generateAuthKey(),
|
|
85
127
|
owner: false,
|
|
128
|
+
language: (0, content_language_1.requestLocale)(this.contentLanguage),
|
|
86
129
|
createdAt: new Date(),
|
|
87
130
|
},
|
|
88
131
|
]);
|
|
@@ -101,6 +144,25 @@ class SaasRegisterApiController extends (0, interface_api_1.Controller)("/api/sa
|
|
|
101
144
|
user: await (0, auth_1.sanitizeUser)(user),
|
|
102
145
|
};
|
|
103
146
|
}
|
|
147
|
+
async describeRegistrationPlan(reference, language) {
|
|
148
|
+
(0, config_1.assertAdmissionOpen)();
|
|
149
|
+
const [plan, publicPlans, rules] = await Promise.all([
|
|
150
|
+
(0, workspaces_1.resolveRegistrationPlan)(),
|
|
151
|
+
this.planModel.findPubliclyVisible(),
|
|
152
|
+
(0, public_plan_catalog_1.loadPublicBillingRules)(),
|
|
153
|
+
]);
|
|
154
|
+
const requested = (0, public_plan_catalog_1.findPlanByReference)(publicPlans, reference);
|
|
155
|
+
const isAnotherPlan = !!requested && requested._id !== plan._id;
|
|
156
|
+
const shown = isAnotherPlan && requested ? [plan, requested] : [plan];
|
|
157
|
+
const catalog = await (0, public_plan_catalog_1.loadPublicPlanCatalog)(shown, (0, content_language_1.requestLocale)(language));
|
|
158
|
+
const byId = new Map(catalog.plans.map((entry) => [entry._id, entry]));
|
|
159
|
+
return {
|
|
160
|
+
plan: byId.get(plan._id) ?? catalog.plans[0],
|
|
161
|
+
requestedPlan: isAnotherPlan ? (byId.get(requested._id) ?? null) : null,
|
|
162
|
+
features: catalog.features,
|
|
163
|
+
rules,
|
|
164
|
+
};
|
|
165
|
+
}
|
|
104
166
|
async createSetupIntent() {
|
|
105
167
|
(0, config_1.assertAdmissionOpen)();
|
|
106
168
|
(0, config_1.assertRegistrationCardAccepted)();
|
|
@@ -118,6 +180,7 @@ class SaasRegisterApiController extends (0, interface_api_1.Controller)("/api/sa
|
|
|
118
180
|
userId: handles.userId,
|
|
119
181
|
email: body.email,
|
|
120
182
|
name: body.name,
|
|
183
|
+
language: (0, content_language_1.requestLocale)(this.contentLanguage),
|
|
121
184
|
};
|
|
122
185
|
const { tenantId } = await (0, workspaces_1.provisionWorkspace)(await buildRegistrationProvisioning(account, body, admitted, handles));
|
|
123
186
|
return { userId: handles.userId, tenantId };
|
|
@@ -149,7 +212,12 @@ class SaasRegisterApiController extends (0, interface_api_1.Controller)("/api/sa
|
|
|
149
212
|
await this.ensureNoWorkspaceYet(user._id);
|
|
150
213
|
const handles = { userId: user._id };
|
|
151
214
|
try {
|
|
152
|
-
const account = {
|
|
215
|
+
const account = {
|
|
216
|
+
userId: user._id,
|
|
217
|
+
email: user.email,
|
|
218
|
+
name: user.name,
|
|
219
|
+
language: user.language || (0, content_language_1.requestLocale)(this.contentLanguage),
|
|
220
|
+
};
|
|
153
221
|
const { tenantId } = await (0, workspaces_1.provisionWorkspace)(await buildRegistrationProvisioning(account, body, admitted, handles));
|
|
154
222
|
return await this.issueAuthResponse(user, tenantId);
|
|
155
223
|
}
|
|
@@ -168,6 +236,10 @@ __decorate([
|
|
|
168
236
|
(0, interface_database_decorators_1.Model)(db_2.SessionModel),
|
|
169
237
|
__metadata("design:type", db_2.SessionModel)
|
|
170
238
|
], SaasRegisterApiController.prototype, "sessionModel", void 0);
|
|
239
|
+
__decorate([
|
|
240
|
+
(0, interface_database_decorators_1.Model)(db_3.PlanModel),
|
|
241
|
+
__metadata("design:type", db_3.PlanModel)
|
|
242
|
+
], SaasRegisterApiController.prototype, "planModel", void 0);
|
|
171
243
|
__decorate([
|
|
172
244
|
(0, interface_api_1.Parameter)("user-agent", "header"),
|
|
173
245
|
__metadata("design:type", String)
|
|
@@ -176,6 +248,18 @@ __decorate([
|
|
|
176
248
|
(0, interface_api_1.Parameter)("x-forwarded-for", "header"),
|
|
177
249
|
__metadata("design:type", String)
|
|
178
250
|
], SaasRegisterApiController.prototype, "forwardedFor", void 0);
|
|
251
|
+
__decorate([
|
|
252
|
+
(0, interface_api_1.Parameter)(content_language_1.CONTENT_LANGUAGE_HEADER, "header"),
|
|
253
|
+
__metadata("design:type", Object)
|
|
254
|
+
], SaasRegisterApiController.prototype, "contentLanguage", void 0);
|
|
255
|
+
__decorate([
|
|
256
|
+
(0, interface_api_1.Get)("/plan"),
|
|
257
|
+
__param(0, (0, interface_api_1.Parameter)("plan", "query")),
|
|
258
|
+
__param(1, (0, interface_api_1.Parameter)(content_language_1.CONTENT_LANGUAGE_HEADER, "header")),
|
|
259
|
+
__metadata("design:type", Function),
|
|
260
|
+
__metadata("design:paramtypes", [Object, Object]),
|
|
261
|
+
__metadata("design:returntype", Promise)
|
|
262
|
+
], SaasRegisterApiController.prototype, "describeRegistrationPlan", null);
|
|
179
263
|
__decorate([
|
|
180
264
|
(0, interface_api_1.Get)("/setup-intent"),
|
|
181
265
|
__metadata("design:type", Function),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register.js","sourceRoot":"","sources":["../../../src/routes/public/register.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6CAA0C;AAC1C,6DAMmC;AACnC,uEAAwD;AACxD,gEAA6D;AAC7D,uEAAgE;AAChE,6FAA4E;AAC5E,qDAAiE;AACjE,yDAOwC;AACxC,0DAI2C;AAC3C,sEAA8E;AAC9E,qCAAkD;AAClD,yCAIsB;
|
|
1
|
+
{"version":3,"file":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AAI,EAAC,GAAG,CAAC;IACM,WAAA,IAAA,wBAAQ,GAAE,CAAA;;;;yDA+BzB;AAgBK;IADL,IAAA,oBAAI,EAAC,UAAU,CAAC;IAEd,WAAA,IAAA,wBAAQ,GAAE,CAAA;;;;4EAaZ;AAGK;IADL,IAAA,oBAAI,EAAC,WAAW,CAAC;IACF,WAAA,IAAA,wBAAQ,GAAE,CAAA;;;;yDAwBzB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { HTTPResult } from "@antelopejs/interface-api";
|
|
2
|
+
import type { User } from "@antelopejs/interface-dms/auth/db";
|
|
3
|
+
import { type Invoice, InvoiceModel, TenantSubscriptionModel } from "../../db";
|
|
4
|
+
export interface PayInvoiceResult {
|
|
5
|
+
status: string | null;
|
|
6
|
+
}
|
|
7
|
+
export declare function isPayableInvoice(invoice: Invoice | undefined): boolean;
|
|
8
|
+
export declare function toPaymentFailure(error: unknown): HTTPResult;
|
|
9
|
+
declare const SaasBillingPayInvoiceController_base: import("@antelopejs/interface-api").ControllerClass<object>;
|
|
10
|
+
export declare class SaasBillingPayInvoiceController extends SaasBillingPayInvoiceController_base {
|
|
11
|
+
payInvoice(_user: User, invoiceId: string, invoiceModel: InvoiceModel, tenantSubscriptionModel: TenantSubscriptionModel): Promise<PayInvoiceResult>;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,82 @@
|
|
|
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
15
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
16
|
+
};
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.SaasBillingPayInvoiceController = void 0;
|
|
19
|
+
exports.isPayableInvoice = isPayableInvoice;
|
|
20
|
+
exports.toPaymentFailure = toPaymentFailure;
|
|
21
|
+
const interface_api_1 = require("@antelopejs/interface-api");
|
|
22
|
+
const interface_api_util_1 = require("@antelopejs/interface-api-util");
|
|
23
|
+
const logging_1 = require("@antelopejs/interface-core/logging");
|
|
24
|
+
const guards_1 = require("@antelopejs/interface-dms/guards");
|
|
25
|
+
const tenant_scoped_model_1 = require("@antelopejs/interface-dms/tenant-scoped-model");
|
|
26
|
+
const stripe_1 = __importDefault(require("stripe"));
|
|
27
|
+
const db_1 = require("../../db");
|
|
28
|
+
const client_1 = require("../../stripe/client");
|
|
29
|
+
const complimentary_1 = require("../../workspaces/complimentary");
|
|
30
|
+
const HTTP_BAD_REQUEST = 400;
|
|
31
|
+
const HTTP_PAYMENT_REQUIRED = 402;
|
|
32
|
+
const HTTP_CONFLICT = 409;
|
|
33
|
+
const HTTP_SERVICE_UNAVAILABLE = 503;
|
|
34
|
+
const PAYABLE_STATUS = "open";
|
|
35
|
+
const INVOICE_DOCUMENT_TYPE = "invoice";
|
|
36
|
+
const LOG_PREFIX = "[dms-saas:pay-invoice]";
|
|
37
|
+
function isPayableInvoice(invoice) {
|
|
38
|
+
return (!!invoice &&
|
|
39
|
+
invoice.documentType === INVOICE_DOCUMENT_TYPE &&
|
|
40
|
+
invoice.status === PAYABLE_STATUS);
|
|
41
|
+
}
|
|
42
|
+
function assertPayableSubscription(subscription) {
|
|
43
|
+
(0, interface_api_util_1.assert)(subscription?.stripeCustomerId &&
|
|
44
|
+
!(0, complimentary_1.isComplimentarySubscription)(subscription), HTTP_BAD_REQUEST, "saas.errors.workspace.no_stripe_customer");
|
|
45
|
+
}
|
|
46
|
+
function toPaymentFailure(error) {
|
|
47
|
+
if (error instanceof stripe_1.default.errors.StripeCardError) {
|
|
48
|
+
return new interface_api_1.HTTPResult(HTTP_PAYMENT_REQUIRED, "saas.errors.billing.payment_declined");
|
|
49
|
+
}
|
|
50
|
+
if (error instanceof stripe_1.default.errors.StripeInvalidRequestError) {
|
|
51
|
+
return new interface_api_1.HTTPResult(HTTP_CONFLICT, "saas.errors.invoice.not_payable");
|
|
52
|
+
}
|
|
53
|
+
return new interface_api_1.HTTPResult(HTTP_SERVICE_UNAVAILABLE, "saas.errors.billing.payment_unavailable");
|
|
54
|
+
}
|
|
55
|
+
class SaasBillingPayInvoiceController extends (0, interface_api_1.Controller)("/api/saas/billing") {
|
|
56
|
+
async payInvoice(_user, invoiceId, invoiceModel, tenantSubscriptionModel) {
|
|
57
|
+
assertPayableSubscription(await tenantSubscriptionModel.findOne());
|
|
58
|
+
const invoice = await invoiceModel.get(invoiceId);
|
|
59
|
+
(0, interface_api_util_1.assert)(invoice && isPayableInvoice(invoice), HTTP_CONFLICT, "saas.errors.invoice.not_payable");
|
|
60
|
+
try {
|
|
61
|
+
const paid = await (0, client_1.getStripeClient)().invoices.pay(invoice.stripeInvoiceId);
|
|
62
|
+
return { status: paid.status ?? null };
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
logging_1.Logging.Warn(`${LOG_PREFIX} payment of ${invoice.stripeInvoiceId} failed`, error);
|
|
66
|
+
throw toPaymentFailure(error);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
exports.SaasBillingPayInvoiceController = SaasBillingPayInvoiceController;
|
|
71
|
+
__decorate([
|
|
72
|
+
(0, interface_api_1.Post)("/invoices/:invoiceId/pay"),
|
|
73
|
+
__param(0, (0, guards_1.AuthTenantOwner)({ bypassTenantAccessGate: true })),
|
|
74
|
+
__param(1, (0, interface_api_1.Parameter)("invoiceId")),
|
|
75
|
+
__param(2, (0, tenant_scoped_model_1.TenantScopedModel)(db_1.InvoiceModel)),
|
|
76
|
+
__param(3, (0, tenant_scoped_model_1.TenantScopedModel)(db_1.TenantSubscriptionModel)),
|
|
77
|
+
__metadata("design:type", Function),
|
|
78
|
+
__metadata("design:paramtypes", [Function, String, db_1.InvoiceModel,
|
|
79
|
+
db_1.TenantSubscriptionModel]),
|
|
80
|
+
__metadata("design:returntype", Promise)
|
|
81
|
+
], SaasBillingPayInvoiceController.prototype, "payInvoice", null);
|
|
82
|
+
//# sourceMappingURL=billing-pay-invoice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing-pay-invoice.js","sourceRoot":"","sources":["../../../src/routes/tenant/billing-pay-invoice.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAoCA,4CAMC;AAkBD,4CAcC;AA1ED,6DAKmC;AACnC,uEAAwD;AACxD,gEAA6D;AAC7D,6DAAmE;AACnE,uFAAkF;AAElF,oDAA4B;AAC5B,iCAKkB;AAClB,gDAAsD;AACtD,kEAA6E;AAE7E,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAC7B,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAClC,MAAM,aAAa,GAAG,GAAG,CAAC;AAC1B,MAAM,wBAAwB,GAAG,GAAG,CAAC;AACrC,MAAM,cAAc,GAAG,MAAM,CAAC;AAC9B,MAAM,qBAAqB,GAAG,SAAS,CAAC;AACxC,MAAM,UAAU,GAAG,wBAAwB,CAAC;AAS5C,SAAgB,gBAAgB,CAAC,OAA4B;IAC3D,OAAO,CACL,CAAC,CAAC,OAA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,CAAC,MAAM,IAAI,IAAI,EAAE,CAAC;QACzC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,iBAAO,CAAC,IAAI,CACV,GAAG,UAAU,eAAe,OAAO,CAAC,eAAe,SAAS,EAC5D,KAAK,CACN,CAAC;YACF,MAAM,gBAAgB,CAAC,KAAK,CAAC,CAAC;QAChC,CAAC;IACH,CAAC;CACF;AApCD,0EAoCC;AA3BO;IADL,IAAA,oBAAI,EAAC,0BAA0B,CAAC;IAE9B,WAAA,IAAA,wBAAe,EAAC,EAAE,sBAAsB,EAAE,IAAI,EAAE,CAAC,CAAA;IACjD,WAAA,IAAA,yBAAS,EAAC,WAAW,CAAC,CAAA;IACtB,WAAA,IAAA,uCAAiB,EAAC,iBAAY,CAAC,CAAA;IAC/B,WAAA,IAAA,uCAAiB,EAAC,4BAAuB,CAAC,CAAA;;uDADI,iBAAY;QAElC,4BAAuB;;iEAqBjD"}
|
|
@@ -4,15 +4,20 @@ import type { User } from "@antelopejs/interface-dms/auth/db";
|
|
|
4
4
|
import { type PaymentMethodSummary, type UnpaidInvoiceRef, type UnpaidInvoiceSummary } from "../../billing-state";
|
|
5
5
|
import type { TenantSubscriptionStatus } from "../../db";
|
|
6
6
|
import { TenantSubscriptionModel } from "../../db";
|
|
7
|
+
import { type WorkspaceOwnerContact } from "../../workspaces/owner-contact";
|
|
7
8
|
interface PortalSessionBody {
|
|
8
9
|
returnUrl: string;
|
|
9
10
|
}
|
|
10
|
-
interface
|
|
11
|
+
interface OwnerBillingDetails {
|
|
12
|
+
paymentMethod: PaymentMethodSummary | null;
|
|
13
|
+
unpaidInvoice: UnpaidInvoiceSummary | null;
|
|
14
|
+
scheduledCancellationAt: Date | null;
|
|
15
|
+
}
|
|
16
|
+
interface BillingStatus extends OwnerBillingDetails {
|
|
11
17
|
hasStripeCustomer: boolean;
|
|
12
18
|
status: TenantSubscriptionStatus | null;
|
|
13
19
|
isTenantOwner: boolean;
|
|
14
|
-
|
|
15
|
-
unpaidInvoice: UnpaidInvoiceSummary | null;
|
|
20
|
+
workspaceOwner: WorkspaceOwnerContact | null;
|
|
16
21
|
}
|
|
17
22
|
interface WorkspaceAccess {
|
|
18
23
|
blocked: boolean;
|
|
@@ -24,12 +24,35 @@ const billing_state_1 = require("../../billing-state");
|
|
|
24
24
|
const config_1 = require("../../config");
|
|
25
25
|
const db_2 = require("../../db");
|
|
26
26
|
const stripe_1 = require("../../stripe");
|
|
27
|
+
const first_payment_1 = require("../../workspaces/first-payment");
|
|
27
28
|
const complimentary_1 = require("../../workspaces/complimentary");
|
|
29
|
+
const owner_contact_1 = require("../../workspaces/owner-contact");
|
|
28
30
|
const HTTP_BAD_REQUEST = 400;
|
|
29
31
|
const RECOVERABLE_STATUSES = new Set([
|
|
30
32
|
"past_due",
|
|
31
33
|
"suspended",
|
|
32
34
|
]);
|
|
35
|
+
const NO_OWNER_DETAILS = {
|
|
36
|
+
paymentMethod: null,
|
|
37
|
+
unpaidInvoice: null,
|
|
38
|
+
scheduledCancellationAt: null,
|
|
39
|
+
};
|
|
40
|
+
function readsCancellation(subscription) {
|
|
41
|
+
return (!!(0, first_payment_1.liveStripeSubscriptionId)(subscription) && !subscription.pendingPlanId);
|
|
42
|
+
}
|
|
43
|
+
async function loadOwnerDetails(tenantId, subscription) {
|
|
44
|
+
const needsRecovery = RECOVERABLE_STATUSES.has(subscription.status);
|
|
45
|
+
const [paymentMethod, unpaidInvoice, scheduledCancellationAt] = await Promise.all([
|
|
46
|
+
subscription.stripeCustomerId
|
|
47
|
+
? (0, billing_state_1.fetchDefaultPaymentMethod)(subscription.stripeCustomerId)
|
|
48
|
+
: null,
|
|
49
|
+
needsRecovery ? (0, billing_state_1.buildUnpaidInvoiceSummary)(tenantId, subscription) : null,
|
|
50
|
+
readsCancellation(subscription)
|
|
51
|
+
? (0, stripe_1.fetchScheduledCancellation)(subscription.stripeSubscriptionId ?? "")
|
|
52
|
+
: null,
|
|
53
|
+
]);
|
|
54
|
+
return { paymentMethod, unpaidInvoice, scheduledCancellationAt };
|
|
55
|
+
}
|
|
33
56
|
class SaasBillingPortalController extends (0, interface_api_1.Controller)("/api/saas/billing") {
|
|
34
57
|
async getWorkspaceAccess(ctx, user, tenantMemberModel) {
|
|
35
58
|
const tenantId = (0, request_tenant_1.getRequestTenantId)(ctx);
|
|
@@ -48,28 +71,23 @@ class SaasBillingPortalController extends (0, interface_api_1.Controller)("/api/
|
|
|
48
71
|
}
|
|
49
72
|
async getStatus(ctx, user, tenantSubscriptionModel, tenantMemberModel) {
|
|
50
73
|
const tenantId = (0, request_tenant_1.getRequestTenantId)(ctx);
|
|
51
|
-
const subscription = await
|
|
52
|
-
|
|
74
|
+
const [subscription, membership, workspaceOwner] = await Promise.all([
|
|
75
|
+
tenantSubscriptionModel.findOne(),
|
|
76
|
+
tenantMemberModel.getByUser(user._id),
|
|
77
|
+
(0, owner_contact_1.findWorkspaceOwnerContact)(tenantId),
|
|
78
|
+
]);
|
|
53
79
|
const isTenantOwner = !!membership?.isTenantOwner;
|
|
80
|
+
const isComplimentary = (0, complimentary_1.isComplimentarySubscription)(subscription);
|
|
54
81
|
const base = {
|
|
55
|
-
hasStripeCustomer: !!subscription?.stripeCustomerId &&
|
|
56
|
-
!(0, complimentary_1.isComplimentarySubscription)(subscription),
|
|
82
|
+
hasStripeCustomer: !!subscription?.stripeCustomerId && !isComplimentary,
|
|
57
83
|
status: subscription?.status ?? null,
|
|
58
84
|
isTenantOwner,
|
|
85
|
+
workspaceOwner,
|
|
59
86
|
};
|
|
60
|
-
if (!subscription ||
|
|
61
|
-
|
|
62
|
-
(0, complimentary_1.isComplimentarySubscription)(subscription)) {
|
|
63
|
-
return { ...base, paymentMethod: null, unpaidInvoice: null };
|
|
87
|
+
if (!subscription || !isTenantOwner || isComplimentary) {
|
|
88
|
+
return { ...base, ...NO_OWNER_DETAILS };
|
|
64
89
|
}
|
|
65
|
-
|
|
66
|
-
const [paymentMethod, unpaidInvoice] = await Promise.all([
|
|
67
|
-
subscription.stripeCustomerId
|
|
68
|
-
? (0, billing_state_1.fetchDefaultPaymentMethod)(subscription.stripeCustomerId)
|
|
69
|
-
: null,
|
|
70
|
-
needsRecovery ? (0, billing_state_1.buildUnpaidInvoiceSummary)(tenantId, subscription) : null,
|
|
71
|
-
]);
|
|
72
|
-
return { ...base, paymentMethod, unpaidInvoice };
|
|
90
|
+
return { ...base, ...(await loadOwnerDetails(tenantId, subscription)) };
|
|
73
91
|
}
|
|
74
92
|
async createPortalSession(_user, body, tenantSubscriptionModel) {
|
|
75
93
|
(0, interface_api_util_1.assert)((0, config_1.isAllowedRedirectUrl)(body.returnUrl), HTTP_BAD_REQUEST, "saas.errors.billing.invalid_return_url");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"billing-portal.js","sourceRoot":"","sources":["../../../src/routes/tenant/billing-portal.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6DAOmC;AACnC,uEAAwD;AACxD,qDAAiE;AACjE,6DAG0C;AAC1C,6EAA8E;AAC9E,uFAAkF;AAElF,qCAAyD;AACzD,uDAO6B;AAC7B,yCAAoD;AAEpD,iCAAmD;AACnD,
|
|
1
|
+
{"version":3,"file":"billing-portal.js","sourceRoot":"","sources":["../../../src/routes/tenant/billing-portal.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6DAOmC;AACnC,uEAAwD;AACxD,qDAAiE;AACjE,6DAG0C;AAC1C,6EAA8E;AAC9E,uFAAkF;AAElF,qCAAyD;AACzD,uDAO6B;AAC7B,yCAAoD;AAEpD,iCAAmD;AACnD,yCAA2E;AAC3E,kEAA0E;AAC1E,kEAA6E;AAC7E,kEAGwC;AAExC,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAC7B,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAA2B;IAC7D,UAAU;IACV,WAAW;CACZ,CAAC,CAAC;AAqBH,MAAM,gBAAgB,GAAwB;IAC5C,aAAa,EAAE,IAAI;IACnB,aAAa,EAAE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IAE1C,WAAA,IAAA,uCAAiB,EAAC,sBAAiB,CAAC,CAAA;;uDADZ,4BAAuB;QAE7B,sBAAiB;;4DAoBrC;AAGK;IADL,IAAA,oBAAI,EAAC,iBAAiB,CAAC;IAErB,WAAA,IAAA,wBAAe,EAAC,EAAE,sBAAsB,EAAE,IAAI,EAAE,CAAC,CAAA;IACjD,WAAA,IAAA,wBAAQ,GAAE,CAAA;IACV,WAAA,IAAA,uCAAiB,EAAC,4BAAuB,CAAC,CAAA;;uDAClB,4BAAuB;;sEAsBjD"}
|
|
@@ -1,13 +1,38 @@
|
|
|
1
1
|
import type { User } from "@antelopejs/interface-dms/auth/db";
|
|
2
|
+
import type Stripe from "stripe";
|
|
2
3
|
import { BillingSettingsModel, TenantSubscriptionModel } from "../../db";
|
|
3
|
-
interface
|
|
4
|
+
export interface EligibleInvoice {
|
|
5
|
+
id: string;
|
|
6
|
+
amountPaid: number;
|
|
7
|
+
refundable: number;
|
|
8
|
+
created: number;
|
|
9
|
+
periodStart: number | null;
|
|
10
|
+
periodEnd: number | null;
|
|
11
|
+
currency: string | null;
|
|
12
|
+
}
|
|
13
|
+
export interface RefundEligibility {
|
|
14
|
+
eligible: boolean;
|
|
15
|
+
reason: string | null;
|
|
16
|
+
windowDays: number;
|
|
17
|
+
mode: string | null;
|
|
18
|
+
invoice: EligibleInvoice | null;
|
|
19
|
+
payments: EligibleInvoice[];
|
|
20
|
+
}
|
|
21
|
+
export interface RefundEligibilityResponse {
|
|
4
22
|
eligible: boolean;
|
|
5
23
|
reason: string | null;
|
|
6
24
|
windowDays: number;
|
|
7
25
|
mode: string | null;
|
|
8
26
|
refundAmount: number | null;
|
|
9
27
|
currency: string | null;
|
|
28
|
+
paymentsCount: number;
|
|
29
|
+
firstPaymentAt: Date | null;
|
|
30
|
+
windowEndsAt: Date | null;
|
|
31
|
+
refundedAt: Date | null;
|
|
10
32
|
}
|
|
33
|
+
export declare function firstChargedInvoice(invoices: Stripe.Invoice[]): Stripe.Invoice | null;
|
|
34
|
+
export declare function chargedInvoicesInWindow(invoices: Stripe.Invoice[], windowDays: number): Stripe.Invoice[];
|
|
35
|
+
export declare function toEligibilityResponse(eligibility: RefundEligibility, refundedAt: Date | null): RefundEligibilityResponse;
|
|
11
36
|
declare const SaasBillingSelfRefundController_base: import("@antelopejs/interface-api").ControllerClass<object>;
|
|
12
37
|
export declare class SaasBillingSelfRefundController extends SaasBillingSelfRefundController_base {
|
|
13
38
|
getRefundEligibility(_user: User, billingSettingsModel: BillingSettingsModel, tenantSubscriptionModel: TenantSubscriptionModel): Promise<RefundEligibilityResponse>;
|