@antelopejs/dms-saas 0.3.15 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +61 -14
- 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 +8 -2
- package/dist/data-api/platformOwner/features.js +155 -35
- 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 +83 -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 +172 -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 +104 -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 +45 -42
- package/dist/routes/platformOwner/plans.js +162 -143
- 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 +125 -15
- 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/content-language.d.ts +2 -0
- package/dist/utils/content-language.js +12 -0
- package/dist/utils/content-language.js.map +1 -0
- 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 +9 -0
- package/dist/utils/index.js +9 -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 +71 -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 -310
- 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 +264 -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 -281
- 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 +304 -0
- package/frontend-vue/i18n/locales/saas-public-fr-FR.json +304 -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/composables/usePlanFeatureLabel.ts +0 -24
- package/frontend-vue/app/plugins/plan-cards-display.client.ts +0 -16
- package/frontend-vue/app/plugins/segment-conditions-data-type.client.ts +0 -122
package/README.md
CHANGED
|
@@ -34,6 +34,38 @@ playground frontend during backend development, use `pnpm frontend:dev`; this
|
|
|
34
34
|
dispatches through the core CLI as `ajs dms dev`. The playground connects to
|
|
35
35
|
MongoDB at `mongodb://localhost:27017` unless `MONGO_URL` is set, either in the
|
|
36
36
|
environment or in `playground/.env`.
|
|
37
|
+
Sign-in with GitHub and Google is wired to `GITHUB_CLIENT_ID`,
|
|
38
|
+
`GITHUB_CLIENT_SECRET`, `GOOGLE_CLIENT_ID` and `GOOGLE_CLIENT_SECRET`, read the
|
|
39
|
+
same way: a provider's button appears on the login and register screens once
|
|
40
|
+
both of its values are set, with
|
|
41
|
+
`http://localhost:3001/auth/oauth/<provider>/callback` registered as its
|
|
42
|
+
callback URL.
|
|
43
|
+
|
|
44
|
+
### Playground data set
|
|
45
|
+
|
|
46
|
+
On its first start against an empty database, the playground writes a data set
|
|
47
|
+
to review every screen with: sign in as `admin@example.com` with the password
|
|
48
|
+
`Playground-Admin-1!` (a platform admin who also owns the `acme` workspace).
|
|
49
|
+
Every other seeded account, platform admins `hugo@antelope.io` and
|
|
50
|
+
`sofia@antelope.io` and the workspace owners and members, uses the same
|
|
51
|
+
password.
|
|
52
|
+
|
|
53
|
+
It holds the feature and plan catalogue (Free, Starter, Pro, Team, Business
|
|
54
|
+
per seat, Enterprise yearly and hidden, Growth 2024 retired), thirteen
|
|
55
|
+
workspaces in every billing state (active, trialing, free, complimentary with
|
|
56
|
+
and without an end date, past due, pending payment, suspended, cancelled) with
|
|
57
|
+
their members and pending invitations, invoices in every status, credit notes,
|
|
58
|
+
plan migrations, segments, internal notes, billing rules and legal documents.
|
|
59
|
+
Dates are relative to the first start, and Stripe ids are fake: nothing calls
|
|
60
|
+
Stripe for them.
|
|
61
|
+
|
|
62
|
+
The seed lives in `playground/src/seed` and runs once: the platform admin
|
|
63
|
+
account, written last, marks it complete. Drop the database to start over. On
|
|
64
|
+
each later start it only adds newly registered permissions to the seeded plans,
|
|
65
|
+
so pages added to the module stay visible to workspace owners. Segment counts
|
|
66
|
+
appear after the first segment recompute (every 15 minutes), and the running
|
|
67
|
+
plan migration turns to "reconciliation required" on the next restart, as an
|
|
68
|
+
interrupted migration does.
|
|
37
69
|
|
|
38
70
|
## Completing a registration that entered without a workspace
|
|
39
71
|
|
|
@@ -127,7 +159,7 @@ Two module options shape it:
|
|
|
127
159
|
|
|
128
160
|
| Value | Behaviour |
|
|
129
161
|
| --- | --- |
|
|
130
|
-
| `required` (default) | The card step is shown and must be completed. The workspace gets a Stripe customer and a free subscription on that
|
|
162
|
+
| `required` (default) | The card step is shown and must be completed. The workspace gets a Stripe customer holding that card and a free subscription — a local one while the free plan is off Stripe, which the upgrade checkout replaces on that customer — and the free-workspace-per-card cap applies. |
|
|
131
163
|
| `optional` | The card step is shown, and the visitor may choose to add a card later. Without a card the workspace is card-less, as under `none`. |
|
|
132
164
|
| `none` | The card step is never shown, `GET /api/saas/register/setup-intent` answers `400 saas.errors.registration.payment_method_disabled`, and Stripe is never called: the workspace gets a local free subscription with no Stripe customer, which the upgrade checkout creates when the owner first pays. A card sent anyway is ignored. |
|
|
133
165
|
|
|
@@ -282,22 +314,29 @@ pass.
|
|
|
282
314
|
|
|
283
315
|
## Plan feature labels and values
|
|
284
316
|
|
|
285
|
-
A feature
|
|
286
|
-
(
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
317
|
+
A feature's `displayName` and `tooltip` are localized fields
|
|
318
|
+
(`@Localized`, falling back to `en`): the row stores one value per locale and
|
|
319
|
+
every reader gets the text in the viewer's language, taken from the
|
|
320
|
+
`x-content-language` header the DMS frontend sends. The tenant plan pages and
|
|
321
|
+
the plan admin pages show it as written; the features table in the platform
|
|
322
|
+
admin edits it one language at a time.
|
|
323
|
+
|
|
324
|
+
A module declaring features writes every locale at once through
|
|
325
|
+
`localize("*")`, never i18n keys:
|
|
291
326
|
|
|
292
327
|
```ts
|
|
293
|
-
{
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
}
|
|
328
|
+
const row = FeatureModel.fromPlainData({
|
|
329
|
+
_id: "cloud.plan.egress",
|
|
330
|
+
displayName: { en: "Included egress", fr: "Trafic sortant inclus" },
|
|
331
|
+
tooltip: { en: "Outbound traffic", fr: "Trafic sortant" },
|
|
332
|
+
// ...
|
|
333
|
+
}).localize("*");
|
|
334
|
+
await GetModel(FeatureModel).insert(row);
|
|
297
335
|
```
|
|
298
336
|
|
|
299
|
-
|
|
300
|
-
|
|
337
|
+
Read a row with `localizeFeature(feature, locale)` from
|
|
338
|
+
`@antelopejs/interface-dms-saas/plans`. A row without a value in the viewer's
|
|
339
|
+
locale or in `en` has no tooltip.
|
|
301
340
|
|
|
302
341
|
Values are formatted from the feature's `valueType` and `unit`: `-1` reads as
|
|
303
342
|
unlimited, booleans as ✓/—, numbers are grouped in the viewer's locale. A
|
|
@@ -686,7 +725,10 @@ export class WorkspaceRegistriesController extends PageController("registries",
|
|
|
686
725
|
|
|
687
726
|
Extensions of the existing tenant billing page register components through
|
|
688
727
|
stable page and anchor identifiers. They do not import the page controller,
|
|
689
|
-
which would load the module's page registration graph.
|
|
728
|
+
which would load the module's page registration graph. An anchor names a block
|
|
729
|
+
(`tenantBillingPage.components.planCard`) wherever the page lays it out: the
|
|
730
|
+
plan card sits in a two-column grid, and a block placed after it stacks under
|
|
731
|
+
it in the same column.
|
|
690
732
|
|
|
691
733
|
```ts
|
|
692
734
|
import { CustomComponent } from "@antelopejs/interface-dms/base/custom";
|
|
@@ -949,6 +991,11 @@ Billing no longer infers state from rows that predate the current fields. Rows
|
|
|
949
991
|
imported from the pre-DMS codebase or written by earlier builds must be fixed
|
|
950
992
|
in the database, with writers stopped, before upgrading:
|
|
951
993
|
|
|
994
|
+
- **`features.displayName` and `features.tooltip`** are localized. Rows
|
|
995
|
+
written by earlier builds hold a plain string (often a `$` i18n key) that
|
|
996
|
+
the localized readers cannot use. Drop the `features` table and let the
|
|
997
|
+
declaring modules write it again on startup, then re-enter any feature
|
|
998
|
+
created by hand.
|
|
952
999
|
- **`tenant_subscriptions.isComplimentary`** is required. Only
|
|
953
1000
|
`isComplimentary: true` makes a subscription complimentary; a missing value
|
|
954
1001
|
is read as not complimentary. Set `isComplimentary: true` on admin gifts that
|
package/dist/auth/index.d.ts
CHANGED
package/dist/auth/index.js
CHANGED
|
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./oauth-entry"), exports);
|
|
18
|
+
__exportStar(require("./owner-only-permissions-resolver"), exports);
|
|
18
19
|
__exportStar(require("./plan-permissions-resolver"), exports);
|
|
19
20
|
__exportStar(require("./subscription-access-gate"), exports);
|
|
20
21
|
//# sourceMappingURL=index.js.map
|
package/dist/auth/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,8DAA4C;AAC5C,6DAA2C"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,oEAAkD;AAClD,8DAA4C;AAC5C,6DAA2C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function registerOwnerOnlyPermissionsResolver(): void;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerOwnerOnlyPermissionsResolver = registerOwnerOnlyPermissionsResolver;
|
|
4
|
+
const permissions_resolver_1 = require("@antelopejs/interface-dms/permissions-resolver");
|
|
5
|
+
const owner_only_1 = require("../pages/tenant/owner-only");
|
|
6
|
+
const workspace_owner_1 = require("../workspaces/workspace-owner");
|
|
7
|
+
const RESOLVER_ID = "dms-saas.owner-only-surfaces";
|
|
8
|
+
const RESOLVER_ORDER = 110;
|
|
9
|
+
const ALL_PERMISSIONS = "*";
|
|
10
|
+
async function withholdOwnerOnlySurfaces(userId, tenantId, current) {
|
|
11
|
+
if (current.has(ALL_PERMISSIONS))
|
|
12
|
+
return current;
|
|
13
|
+
if (await (0, workspace_owner_1.isWorkspaceOwner)(userId, tenantId))
|
|
14
|
+
return current;
|
|
15
|
+
const withheld = new Set((0, owner_only_1.ownerOnlyPermissionIds)());
|
|
16
|
+
return new Set([...current].filter((id) => !withheld.has(id)));
|
|
17
|
+
}
|
|
18
|
+
function registerOwnerOnlyPermissionsResolver() {
|
|
19
|
+
(0, permissions_resolver_1.RegisterPermissionsResolver)({
|
|
20
|
+
id: RESOLVER_ID,
|
|
21
|
+
order: RESOLVER_ORDER,
|
|
22
|
+
resolver: withholdOwnerOnlySurfaces,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=owner-only-permissions-resolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"owner-only-permissions-resolver.js","sourceRoot":"","sources":["../../src/auth/owner-only-permissions-resolver.ts"],"names":[],"mappings":";;AAyBA,oFAMC;AA/BD,yFAA6F;AAC7F,2DAAoE;AACpE,mEAAiE;AAEjE,MAAM,WAAW,GAAG,8BAA8B,CAAC;AAGnD,MAAM,cAAc,GAAG,GAAG,CAAC;AAC3B,MAAM,eAAe,GAAG,GAAG,CAAC;AAE5B,KAAK,UAAU,yBAAyB,CACtC,MAAc,EACd,QAAgB,EAChB,OAAoB;IAEpB,IAAI,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC;QAAE,OAAO,OAAO,CAAC;IACjD,IAAI,MAAM,IAAA,kCAAgB,EAAC,MAAM,EAAE,QAAQ,CAAC;QAAE,OAAO,OAAO,CAAC;IAC7D,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,IAAA,mCAAsB,GAAE,CAAC,CAAC;IACnD,OAAO,IAAI,GAAG,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AACjE,CAAC;AAMD,SAAgB,oCAAoC;IAClD,IAAA,kDAA2B,EAAC;QAC1B,EAAE,EAAE,WAAW;QACf,KAAK,EAAE,cAAc;QACrB,QAAQ,EAAE,yBAAyB;KACpC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function registerWorkspaceDirectoryHooks(): void;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerWorkspaceDirectoryHooks = registerWorkspaceDirectoryHooks;
|
|
4
|
+
const logging_1 = require("@antelopejs/interface-core/logging");
|
|
5
|
+
const hooks_1 = require("@antelopejs/interface-dms/hooks");
|
|
6
|
+
const index_1 = require("./index");
|
|
7
|
+
const LOG_PREFIX = "[dms-saas:workspace-directory]";
|
|
8
|
+
const SEAT_HANDED_OVER = new Set([
|
|
9
|
+
"replaced",
|
|
10
|
+
"resent",
|
|
11
|
+
]);
|
|
12
|
+
function refresh(tenantId, departures = {}) {
|
|
13
|
+
void (0, index_1.recomputeTenantBillingState)(tenantId, departures).catch((error) => {
|
|
14
|
+
logging_1.Logging.Error(`${LOG_PREFIX} refresh of ${tenantId} failed`, error);
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
function registerWorkspaceDirectoryHooks() {
|
|
18
|
+
(0, hooks_1.RegisterHook)(hooks_1.Hook.MEMBER_ADDED, ({ tenantId }) => {
|
|
19
|
+
refresh(tenantId);
|
|
20
|
+
return undefined;
|
|
21
|
+
});
|
|
22
|
+
(0, hooks_1.RegisterHook)(hooks_1.Hook.INVITE_CREATED, ({ tenantId }) => {
|
|
23
|
+
refresh(tenantId);
|
|
24
|
+
return undefined;
|
|
25
|
+
});
|
|
26
|
+
(0, hooks_1.RegisterHook)(hooks_1.Hook.INVITE_DELETED, ({ tenantId, email, reason }) => {
|
|
27
|
+
refresh(tenantId, SEAT_HANDED_OVER.has(reason) ? {} : { inviteeEmail: email });
|
|
28
|
+
return undefined;
|
|
29
|
+
});
|
|
30
|
+
(0, hooks_1.RegisterHook)(hooks_1.Hook.MEMBER_REMOVED, ({ tenantId, userIds }) => {
|
|
31
|
+
refresh(tenantId, { userIds });
|
|
32
|
+
return undefined;
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=directory-hooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"directory-hooks.js","sourceRoot":"","sources":["../../src/billing-state/directory-hooks.ts"],"names":[],"mappings":";;AAgCA,0EAoBC;AApDD,gEAA6D;AAC7D,2DAIyC;AAEzC,mCAAsD;AAEtD,MAAM,UAAU,GAAG,gCAAgC,CAAC;AAGpD,MAAM,gBAAgB,GAAqC,IAAI,GAAG,CAAC;IACjE,UAAU;IACV,QAAQ;CACT,CAAC,CAAC;AAEH,SAAS,OAAO,CAAC,QAAgB,EAAE,aAAkC,EAAE;IACrE,KAAK,IAAA,mCAA2B,EAAC,QAAQ,EAAE,UAAU,CAAC,CAAC,KAAK,CAC1D,CAAC,KAAc,EAAE,EAAE;QACjB,iBAAO,CAAC,KAAK,CAAC,GAAG,UAAU,eAAe,QAAQ,SAAS,EAAE,KAAK,CAAC,CAAC;IACtE,CAAC,CACF,CAAC;AACJ,CAAC;AASD,SAAgB,+BAA+B;IAC7C,IAAA,oBAAY,EAAC,YAAI,CAAC,YAAY,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;QAC/C,OAAO,CAAC,QAAQ,CAAC,CAAC;QAClB,OAAO,SAAS,CAAC;IACnB,CAAC,CAAC,CAAC;IACH,IAAA,oBAAY,EAAC,YAAI,CAAC,cAAc,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;QACjD,OAAO,CAAC,QAAQ,CAAC,CAAC;QAClB,OAAO,SAAS,CAAC;IACnB,CAAC,CAAC,CAAC;IACH,IAAA,oBAAY,EAAC,YAAI,CAAC,cAAc,EAAE,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE;QAChE,OAAO,CACL,QAAQ,EACR,gBAAgB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,KAAK,EAAE,CAC5D,CAAC;QACF,OAAO,SAAS,CAAC;IACnB,CAAC,CAAC,CAAC;IACH,IAAA,oBAAY,EAAC,YAAI,CAAC,cAAc,EAAE,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE;QAC1D,OAAO,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;QAC/B,OAAO,SAAS,CAAC;IACnB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type BillingState, type Plan, type TenantBillingState, type TenantSubscription, type WorkspaceDirectoryFields, type WorkspaceOwnerStatus } from "../db";
|
|
2
|
+
import { type SeatUsage } from "../plans/seat-capacity";
|
|
3
|
+
export interface DirectoryDepartures {
|
|
4
|
+
userIds?: readonly string[];
|
|
5
|
+
inviteeEmail?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface DirectoryOwner {
|
|
8
|
+
status: WorkspaceOwnerStatus;
|
|
9
|
+
name: string | null;
|
|
10
|
+
email: string | null;
|
|
11
|
+
}
|
|
12
|
+
export interface DirectoryPolicy {
|
|
13
|
+
autoSuspendDelayDays: number | null;
|
|
14
|
+
retentionDays: number;
|
|
15
|
+
}
|
|
16
|
+
export interface DirectoryInputs {
|
|
17
|
+
billingState: BillingState;
|
|
18
|
+
subscription: TenantSubscription | undefined;
|
|
19
|
+
plan: Plan | null;
|
|
20
|
+
seats: SeatUsage;
|
|
21
|
+
owner: DirectoryOwner;
|
|
22
|
+
policy: DirectoryPolicy;
|
|
23
|
+
existing: TenantBillingState | undefined;
|
|
24
|
+
reportingCurrency: string;
|
|
25
|
+
now: Date;
|
|
26
|
+
}
|
|
27
|
+
export declare function buildWorkspaceDirectoryFields(inputs: DirectoryInputs): WorkspaceDirectoryFields;
|
|
28
|
+
export declare function loadDirectoryOwner(tenantId: string, now?: Date, departures?: DirectoryDepartures): Promise<DirectoryOwner>;
|
|
29
|
+
export declare function loadWorkspaceDirectoryFields(tenantId: string, billingState: BillingState, subscription: TenantSubscription | undefined, existing: TenantBillingState | undefined, departures?: DirectoryDepartures): Promise<WorkspaceDirectoryFields>;
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildWorkspaceDirectoryFields = buildWorkspaceDirectoryFields;
|
|
4
|
+
exports.loadDirectoryOwner = loadDirectoryOwner;
|
|
5
|
+
exports.loadWorkspaceDirectoryFields = loadWorkspaceDirectoryFields;
|
|
6
|
+
const interface_database_decorators_1 = require("@antelopejs/interface-database-decorators");
|
|
7
|
+
const db_1 = require("@antelopejs/interface-dms/db");
|
|
8
|
+
const db_2 = require("@antelopejs/interface-dms/auth/db");
|
|
9
|
+
const db_3 = require("../db");
|
|
10
|
+
const config_1 = require("../config");
|
|
11
|
+
const normalised_mrr_1 = require("../metrics/normalised-mrr");
|
|
12
|
+
const seat_capacity_1 = require("../plans/seat-capacity");
|
|
13
|
+
const time_1 = require("../utils/time");
|
|
14
|
+
const invitations_1 = require("../workspaces/invitations");
|
|
15
|
+
const billing_settings_store_1 = require("../operator-billing/billing-settings-store");
|
|
16
|
+
const NO_OWNER = { status: "none", name: null, email: null };
|
|
17
|
+
const OWNER_STATUS_BY_INVITATION = {
|
|
18
|
+
pending: "invited",
|
|
19
|
+
expired: "expired",
|
|
20
|
+
};
|
|
21
|
+
function addDays(date, days) {
|
|
22
|
+
return date ? new Date(new Date(date).getTime() + days * time_1.MS_PER_DAY) : null;
|
|
23
|
+
}
|
|
24
|
+
function datedBy(kind, at) {
|
|
25
|
+
return at ? { kind, at: new Date(at) } : null;
|
|
26
|
+
}
|
|
27
|
+
const RENEWAL_BY_STATE = {
|
|
28
|
+
active: ({ subscription }) => datedBy("renews", subscription?.currentPeriodEnd),
|
|
29
|
+
trialing: ({ subscription }) => datedBy("trial_ends", subscription?.currentPeriodEnd),
|
|
30
|
+
free: ({ subscription }) => datedBy("free_until", subscription?.freeUntil),
|
|
31
|
+
past_due: ({ subscription, policy }) => policy.autoSuspendDelayDays === null
|
|
32
|
+
? null
|
|
33
|
+
: datedBy("suspends", addDays(subscription?.pastDueSince, policy.autoSuspendDelayDays)),
|
|
34
|
+
suspended: ({ stateSince }) => datedBy("suspended", stateSince),
|
|
35
|
+
pending_payment: ({ stateSince }) => datedBy("awaiting_payment", stateSince),
|
|
36
|
+
cancelled: ({ subscription, policy }) => datedBy("deletes", addDays(subscription?.updatedAt, policy.retentionDays)),
|
|
37
|
+
};
|
|
38
|
+
function resolveStateSince(inputs) {
|
|
39
|
+
const { existing, billingState, subscription, now } = inputs;
|
|
40
|
+
if (existing?.billingState === billingState && existing.stateSince)
|
|
41
|
+
return new Date(existing.stateSince);
|
|
42
|
+
if (existing?.stateSince)
|
|
43
|
+
return now;
|
|
44
|
+
const recorded = subscription?.pastDueSince ?? subscription?.updatedAt;
|
|
45
|
+
return recorded ? new Date(recorded) : now;
|
|
46
|
+
}
|
|
47
|
+
function resolvePreviousMrr(inputs) {
|
|
48
|
+
const { existing, billingState } = inputs;
|
|
49
|
+
if (existing && existing.billingState !== billingState)
|
|
50
|
+
return existing.mrrMinor;
|
|
51
|
+
return existing?.previousMrrMinor ?? 0;
|
|
52
|
+
}
|
|
53
|
+
function planFields(plan) {
|
|
54
|
+
return {
|
|
55
|
+
planId: plan?._id ?? null,
|
|
56
|
+
planName: plan?.name ?? null,
|
|
57
|
+
planInterval: plan?.interval ?? null,
|
|
58
|
+
planBillingMode: plan?.billingMode ?? null,
|
|
59
|
+
planUnitAmountMinor: plan ? (0, normalised_mrr_1.planUnitAmountMinor)(plan) : null,
|
|
60
|
+
currency: plan?.currency ? plan.currency.toUpperCase() : null,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function buildWorkspaceDirectoryFields(inputs) {
|
|
64
|
+
const { subscription, plan, seats, owner, policy, billingState } = inputs;
|
|
65
|
+
const isComplimentary = subscription?.isComplimentary === true;
|
|
66
|
+
const stateSince = resolveStateSince(inputs);
|
|
67
|
+
const renewal = RENEWAL_BY_STATE[billingState]({
|
|
68
|
+
subscription,
|
|
69
|
+
policy,
|
|
70
|
+
stateSince,
|
|
71
|
+
});
|
|
72
|
+
const mrr = (0, normalised_mrr_1.normalisedMrr)({
|
|
73
|
+
billingState,
|
|
74
|
+
isComplimentary,
|
|
75
|
+
plan,
|
|
76
|
+
billedSeats: seats.occupied,
|
|
77
|
+
});
|
|
78
|
+
return {
|
|
79
|
+
...planFields(plan),
|
|
80
|
+
seats: seats.occupied,
|
|
81
|
+
members: seats.members,
|
|
82
|
+
pendingPlanId: subscription?.pendingPlanId ?? null,
|
|
83
|
+
isComplimentary,
|
|
84
|
+
mrrMinor: mrr.amountMinor,
|
|
85
|
+
previousMrrMinor: resolvePreviousMrr(inputs),
|
|
86
|
+
reportingMrr: (0, normalised_mrr_1.reportingMajorUnits)(mrr, inputs.reportingCurrency),
|
|
87
|
+
renewalKind: renewal?.kind ?? null,
|
|
88
|
+
renewsAt: renewal?.at ?? null,
|
|
89
|
+
stateSince,
|
|
90
|
+
ownerStatus: owner.status,
|
|
91
|
+
ownerNeverJoined: owner.status === "invited" || owner.status === "expired",
|
|
92
|
+
ownerName: owner.name,
|
|
93
|
+
ownerEmail: owner.email,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
async function loadJoinedOwner(tenantId, departures) {
|
|
97
|
+
const owners = await (0, interface_database_decorators_1.GetModel)(db_1.TenantMemberModel, tenantId).listOwners();
|
|
98
|
+
const owner = owners.find((member) => !departures.userIds?.includes(member.userId));
|
|
99
|
+
if (!owner)
|
|
100
|
+
return null;
|
|
101
|
+
const user = await (0, interface_database_decorators_1.GetModel)(db_2.UserModel).get(owner.userId);
|
|
102
|
+
return {
|
|
103
|
+
status: "joined",
|
|
104
|
+
name: user?.name || null,
|
|
105
|
+
email: user?.email ?? null,
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
async function loadDirectoryOwner(tenantId, now = new Date(), departures = {}) {
|
|
109
|
+
const joined = await loadJoinedOwner(tenantId, departures);
|
|
110
|
+
if (joined)
|
|
111
|
+
return joined;
|
|
112
|
+
const invite = await (0, invitations_1.findPendingOwnerInvite)(tenantId);
|
|
113
|
+
if (!invite || invite.email === departures.inviteeEmail)
|
|
114
|
+
return NO_OWNER;
|
|
115
|
+
return {
|
|
116
|
+
status: OWNER_STATUS_BY_INVITATION[(0, invitations_1.invitationStatusOf)(invite, now)],
|
|
117
|
+
name: null,
|
|
118
|
+
email: invite.email,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
async function loadDirectoryPolicy() {
|
|
122
|
+
const settings = await (0, billing_settings_store_1.loadBillingSettings)();
|
|
123
|
+
return {
|
|
124
|
+
autoSuspendDelayDays: settings.autoSuspendEnabled
|
|
125
|
+
? settings.autoSuspendDelayDays
|
|
126
|
+
: null,
|
|
127
|
+
retentionDays: settings.dataRetentionDaysAfterCancellation,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
async function loadWorkspaceDirectoryFields(tenantId, billingState, subscription, existing, departures = {}) {
|
|
131
|
+
const now = new Date();
|
|
132
|
+
const [plan, seats, owner, policy] = await Promise.all([
|
|
133
|
+
subscription?.planId
|
|
134
|
+
? (0, interface_database_decorators_1.GetModel)(db_3.PlanModel).get(subscription.planId)
|
|
135
|
+
: undefined,
|
|
136
|
+
(0, seat_capacity_1.getSeatUsage)(tenantId, departures.inviteeEmail, departures.userIds),
|
|
137
|
+
loadDirectoryOwner(tenantId, now, departures),
|
|
138
|
+
loadDirectoryPolicy(),
|
|
139
|
+
]);
|
|
140
|
+
return buildWorkspaceDirectoryFields({
|
|
141
|
+
billingState,
|
|
142
|
+
subscription,
|
|
143
|
+
plan: plan ?? null,
|
|
144
|
+
seats,
|
|
145
|
+
owner,
|
|
146
|
+
policy,
|
|
147
|
+
existing,
|
|
148
|
+
reportingCurrency: (0, config_1.getReportingCurrency)(),
|
|
149
|
+
now,
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
//# sourceMappingURL=directory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"directory.js","sourceRoot":"","sources":["../../src/billing-state/directory.ts"],"names":[],"mappings":";;AAiJA,sEAkCC;AAuBD,gDAcC;AAcD,oEA2BC;AAjQD,6FAAqE;AACrE,qDAAiE;AACjE,0DAA8D;AAC9D,8BASe;AACf,sCAAiD;AACjD,8DAImC;AACnC,0DAAsE;AACtE,wCAA2C;AAC3C,2DAGmC;AACnC,uFAAiF;AAkDjF,MAAM,QAAQ,GAAmB,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAE7E,MAAM,0BAA0B,GAAyC;IACvE,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;CACnB,CAAC;AAEF,SAAS,OAAO,CAAC,IAA6B,EAAE,IAAY;IAC1D,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,GAAG,IAAI,GAAG,iBAAU,CAAC,CAAC,CA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AC,CAAC,QAAQ,CAAC,oBAAoB;YAC/B,CAAC,CAAC,IAAI;QACR,aAAa,EAAE,QAAQ,CAAC,kCAAkC;KAC3D,CAAC;AACJ,CAAC;AAGM,KAAK,UAAU,4BAA4B,CAChD,QAAgB,EAChB,YAA0B,EAC1B,YAA4C,EAC5C,QAAwC,EACxC,aAAkC,EAAE;IAEpC,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;IACvB,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QACrD,YAAY,EAAE,MAAM;YAClB,CAAC,CAAC,IAAA,wCAAQ,EAAC,cAAS,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC;YAC9C,CAAC,CAAC,SAAS;QACb,IAAA,4BAAY,EAAC,QAAQ,EAAE,UAAU,CAAC,YAAY,EAAE,UAAU,CAAC,OAAO,CAAC;QACnE,kBAAkB,CAAC,QAAQ,EAAE,GAAG,EAAE,UAAU,CAAC;QAC7C,mBAAmB,EAAE;KACtB,CAAC,CAAC;IACH,OAAO,6BAA6B,CAAC;QACnC,YAAY;QACZ,YAAY;QACZ,IAAI,EAAE,IAAI,IAAI,IAAI;QAClB,KAAK;QACL,KAAK;QACL,MAAM;QACN,QAAQ;QACR,iBAAiB,EAAE,IAAA,6BAAoB,GAAE;QACzC,GAAG;KACJ,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { type BillingState, type TenantSubscription } from "../db";
|
|
2
|
+
import { type DirectoryDepartures } from "./directory";
|
|
3
|
+
export * from "./directory";
|
|
2
4
|
export * from "./past-due-banner";
|
|
3
5
|
export * from "./recovery";
|
|
6
|
+
export * from "./trial-ending-banner";
|
|
4
7
|
export declare function deriveBillingState(subscription: TenantSubscription | undefined): BillingState;
|
|
5
|
-
export declare function recomputeTenantBillingState(tenantId: string): Promise<void>;
|
|
8
|
+
export declare function recomputeTenantBillingState(tenantId: string, departures?: DirectoryDepartures): Promise<void>;
|
|
6
9
|
export declare function recomputeAllTenantBillingStates(): Promise<void>;
|
|
10
|
+
export declare function registerBillingLayoutBanners(): void;
|
|
@@ -17,11 +17,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
exports.deriveBillingState = deriveBillingState;
|
|
18
18
|
exports.recomputeTenantBillingState = recomputeTenantBillingState;
|
|
19
19
|
exports.recomputeAllTenantBillingStates = recomputeAllTenantBillingStates;
|
|
20
|
+
exports.registerBillingLayoutBanners = registerBillingLayoutBanners;
|
|
20
21
|
const interface_database_decorators_1 = require("@antelopejs/interface-database-decorators");
|
|
21
22
|
const db_1 = require("@antelopejs/interface-dms/db");
|
|
22
23
|
const db_2 = require("../db");
|
|
24
|
+
const directory_1 = require("./directory");
|
|
25
|
+
const past_due_banner_1 = require("./past-due-banner");
|
|
26
|
+
const trial_ending_banner_1 = require("./trial-ending-banner");
|
|
27
|
+
__exportStar(require("./directory"), exports);
|
|
23
28
|
__exportStar(require("./past-due-banner"), exports);
|
|
24
29
|
__exportStar(require("./recovery"), exports);
|
|
30
|
+
__exportStar(require("./trial-ending-banner"), exports);
|
|
25
31
|
const ACTIVE_STATUS = "active";
|
|
26
32
|
const FREE_STATE = "free";
|
|
27
33
|
const PUBLICATION_ATTEMPTS = 3;
|
|
@@ -34,7 +40,7 @@ function deriveBillingState(subscription) {
|
|
|
34
40
|
}
|
|
35
41
|
return subscription.status;
|
|
36
42
|
}
|
|
37
|
-
async function recomputeTenantBillingState(tenantId) {
|
|
43
|
+
async function recomputeTenantBillingState(tenantId, departures = {}) {
|
|
38
44
|
const model = (0, interface_database_decorators_1.GetModel)(db_2.TenantBillingStateModel);
|
|
39
45
|
for (let attempt = 0; attempt < PUBLICATION_ATTEMPTS; attempt++) {
|
|
40
46
|
const existing = await model.findByTenant(tenantId);
|
|
@@ -43,7 +49,9 @@ async function recomputeTenantBillingState(tenantId) {
|
|
|
43
49
|
const subscription = await (0, interface_database_decorators_1.GetModel)(db_2.TenantSubscriptionModel, tenantId).findOne();
|
|
44
50
|
if (subscription?.deletionStartedAt)
|
|
45
51
|
return;
|
|
46
|
-
|
|
52
|
+
const billingState = deriveBillingState(subscription);
|
|
53
|
+
const directory = await (0, directory_1.loadWorkspaceDirectoryFields)(tenantId, billingState, subscription, existing, departures);
|
|
54
|
+
if (await model.upsertForTenant(tenantId, billingState, existing, directory))
|
|
47
55
|
return;
|
|
48
56
|
}
|
|
49
57
|
throw new Error("Billing recomputation conflicted with a concurrent publication");
|
|
@@ -56,4 +64,8 @@ async function recomputeAllTenantBillingStates() {
|
|
|
56
64
|
await recomputeTenantBillingState(tenant._id);
|
|
57
65
|
}
|
|
58
66
|
}
|
|
67
|
+
function registerBillingLayoutBanners() {
|
|
68
|
+
(0, past_due_banner_1.registerPastDueBanners)();
|
|
69
|
+
(0, trial_ending_banner_1.registerTrialEndingBanners)();
|
|
70
|
+
}
|
|
59
71
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/billing-state/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/billing-state/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAyBA,gDAWC;AASD,kEA6BC;AAED,0EAMC;AAGD,oEAGC;AAxFD,6FAAqE;AACrE,qDAA2D;AAC3D,8BAKe;AACf,2CAGqB;AAErB,uDAA2D;AAC3D,+DAAmE;AAEnE,8CAA4B;AAC5B,oDAAkC;AAClC,6CAA2B;AAC3B,wDAAsC;AAEtC,MAAM,aAAa,GAAG,QAAQ,CAAC;AAC/B,MAAM,UAAU,GAAiB,MAAM,CAAC;AACxC,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAE/B,SAAgB,kBAAkB,CAChC,YAA4C;IAE5C,IAAI,CAAC,YAAY;QAAE,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CAAC,MAAM,CAAC,GAAG;YAAE,SAAS;QAC1B,MAAM,2BAA2B,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAChD,CAAC;AACH,CAAC;AAGD,SAAgB,4BAA4B;IAC1C,IAAA,wCAAsB,GAAE,CAAC;IACzB,IAAA,gDAA0B,GAAE,CAAC;AAC/B,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type LayoutBannerComponentInfo, type LayoutBannerContext } from "@antelopejs/interface-dms/layout-banners";
|
|
2
|
-
export declare function isPastDueBannerVisible(
|
|
3
|
-
export declare const
|
|
4
|
-
export declare
|
|
2
|
+
export declare function isPastDueBannerVisible(context: LayoutBannerContext): Promise<boolean>;
|
|
3
|
+
export declare const PAST_DUE_OWNER_BANNER: LayoutBannerComponentInfo;
|
|
4
|
+
export declare const PAST_DUE_MEMBER_BANNER: LayoutBannerComponentInfo;
|
|
5
|
+
export declare function registerPastDueBanners(): void;
|
|
@@ -1,25 +1,45 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.PAST_DUE_MEMBER_BANNER = exports.PAST_DUE_OWNER_BANNER = void 0;
|
|
4
4
|
exports.isPastDueBannerVisible = isPastDueBannerVisible;
|
|
5
|
-
exports.
|
|
5
|
+
exports.registerPastDueBanners = registerPastDueBanners;
|
|
6
6
|
const interface_database_decorators_1 = require("@antelopejs/interface-database-decorators");
|
|
7
7
|
const layout_banners_1 = require("@antelopejs/interface-dms/layout-banners");
|
|
8
8
|
const db_1 = require("../db");
|
|
9
|
+
const workspace_owner_1 = require("../workspaces/workspace-owner");
|
|
9
10
|
const PAST_DUE_STATE = "past_due";
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
const BANNER_COMPONENT = "DmsSaasPastDueBanner";
|
|
12
|
+
async function isPastDueBannerVisible(context) {
|
|
13
|
+
if (!context.user)
|
|
12
14
|
return false;
|
|
13
|
-
const state = await (0, interface_database_decorators_1.GetModel)(db_1.TenantBillingStateModel).findByTenant(tenantId);
|
|
15
|
+
const state = await (0, interface_database_decorators_1.GetModel)(db_1.TenantBillingStateModel).findByTenant(context.tenantId);
|
|
14
16
|
return !state?.deletedAt && state?.billingState === PAST_DUE_STATE;
|
|
15
17
|
}
|
|
16
|
-
|
|
18
|
+
function visibleTo(audience) {
|
|
19
|
+
return async (context) => {
|
|
20
|
+
if (!(await isPastDueBannerVisible(context)))
|
|
21
|
+
return false;
|
|
22
|
+
const isOwner = await (0, workspace_owner_1.isWorkspaceOwnerRequest)(context);
|
|
23
|
+
return isOwner === (audience === "owner");
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
exports.PAST_DUE_OWNER_BANNER = {
|
|
17
27
|
key: "dms-saas:past-due",
|
|
18
28
|
variant: layout_banners_1.LayoutBannerVariant.ERROR,
|
|
19
|
-
component:
|
|
20
|
-
|
|
29
|
+
component: BANNER_COMPONENT,
|
|
30
|
+
props: { audience: "owner" },
|
|
31
|
+
visible: visibleTo("owner"),
|
|
32
|
+
};
|
|
33
|
+
exports.PAST_DUE_MEMBER_BANNER = {
|
|
34
|
+
key: "dms-saas:past-due-member",
|
|
35
|
+
variant: layout_banners_1.LayoutBannerVariant.WARNING,
|
|
36
|
+
dismissible: true,
|
|
37
|
+
component: BANNER_COMPONENT,
|
|
38
|
+
props: { audience: "member" },
|
|
39
|
+
visible: visibleTo("member"),
|
|
21
40
|
};
|
|
22
|
-
function
|
|
23
|
-
(0, layout_banners_1.RegisterLayoutBanner)(exports.
|
|
41
|
+
function registerPastDueBanners() {
|
|
42
|
+
(0, layout_banners_1.RegisterLayoutBanner)(exports.PAST_DUE_OWNER_BANNER);
|
|
43
|
+
(0, layout_banners_1.RegisterLayoutBanner)(exports.PAST_DUE_MEMBER_BANNER);
|
|
24
44
|
}
|
|
25
45
|
//# sourceMappingURL=past-due-banner.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"past-due-banner.js","sourceRoot":"","sources":["../../src/billing-state/past-due-banner.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"past-due-banner.js","sourceRoot":"","sources":["../../src/billing-state/past-due-banner.ts"],"names":[],"mappings":";;;AAqBA,wDAQC;AAgCD,wDAGC;AAhED,6FAAqE;AACrE,6EAKkD;AAClD,8BAAmE;AACnE,mEAAwE;AAExE,MAAM,cAAc,GAAiB,UAAU,CAAC;AAChD,MAAM,gBAAgB,GAAG,sBAAsB,CAAC;AAUzC,KAAK,UAAU,sBAAsB,CAC1C,OAA4B;IAE5B,IAAI,CAAC,OAAO,CAAC,IAAI;QAAE,OAAO,KAAK,CAAC;IAChC,MAAM,KAAK,GAAG,MAAM,IAAA,wCAAQ,EAAC,4BAAuB,CAAC,CAAC,YAAY,CAChE,OAAO,CAAC,QAAQ,CACjB,CAAC;IACF,OAAO,CAAC,KAAK,EAAE,SAAS,IAAI,KAAK,EAAE,YAAY,KAAK,cAAc,CAAC;AACrE,CAAC;AAED,SAAS,SAAS,CAAC,QAAyB;IAC1C,OAAO,KAAK,EAAE,OAA4B,EAAoB,EAAE;QAC9D,IAAI,CAAC,CAAC,MAAM,sBAAsB,CAAC,OAAO,CAAC,CAAC;YAAE,OAAO,KAAK,CAAC;QAC3D,MAAM,OAAO,GAAG,MAAM,IAAA,yCAAuB,EAAC,OAAO,CAAC,CAAC;QACvD,OAAO,OAAO,KAAK,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC;IAC5C,CAAC,CAAC;AACJ,CAAC;AAGY,QAAA,qBAAqB,GAA8B;IAC9D,GAAG,EAAE,mBAAmB;IACxB,OAAO,EAAE,oCAAmB,CAAC,KAAK;IAClC,SAAS,EAAE,gBAAgB;IAC3B,KAAK,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE;IAC5B,OAAO,EAAE,SAAS,CAAC,OAAO,CAAC;CAC5B,CAAC;AAMW,QAAA,sBAAsB,GAA8B;IAC/D,GAAG,EAAE,0BAA0B;IAC/B,OAAO,EAAE,oCAAmB,CAAC,OAAO;IACpC,WAAW,EAAE,IAAI;IACjB,SAAS,EAAE,gBAAgB;IAC3B,KAAK,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE;IAC7B,OAAO,EAAE,SAAS,CAAC,QAAQ,CAAC;CAC7B,CAAC;AAEF,SAAgB,sBAAsB;IACpC,IAAA,qCAAoB,EAAC,6BAAqB,CAAC,CAAC;IAC5C,IAAA,qCAAoB,EAAC,8BAAsB,CAAC,CAAC;AAC/C,CAAC"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import type Stripe from "stripe";
|
|
1
2
|
import { type Invoice, type TenantSubscription } from "../db";
|
|
2
3
|
export interface PaymentMethodSummary {
|
|
3
4
|
brand: string;
|
|
4
5
|
last4: string;
|
|
5
6
|
expMonth: number;
|
|
6
7
|
expYear: number;
|
|
8
|
+
holderName: string | null;
|
|
7
9
|
}
|
|
8
10
|
export interface UnpaidInvoiceRef {
|
|
9
11
|
number: string | null;
|
|
@@ -12,10 +14,12 @@ export interface UnpaidInvoiceRef {
|
|
|
12
14
|
hostedInvoiceUrl: string | null;
|
|
13
15
|
}
|
|
14
16
|
export interface UnpaidInvoiceSummary extends UnpaidInvoiceRef {
|
|
17
|
+
invoiceId: string;
|
|
15
18
|
failedAt: Date | null;
|
|
16
19
|
nextRetryAt: Date | null;
|
|
17
20
|
suspendAt: Date | null;
|
|
18
21
|
}
|
|
22
|
+
export declare function toCardSummary(paymentMethod: Stripe.PaymentMethod | null): PaymentMethodSummary | null;
|
|
19
23
|
export declare function fetchDefaultPaymentMethod(stripeCustomerId: string): Promise<PaymentMethodSummary | null>;
|
|
20
24
|
export declare function toUnpaidInvoiceRef(invoice: Invoice): UnpaidInvoiceRef;
|
|
21
25
|
export declare function buildUnpaidInvoiceRef(tenantId: string): Promise<UnpaidInvoiceRef | null>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toCardSummary = toCardSummary;
|
|
3
4
|
exports.fetchDefaultPaymentMethod = fetchDefaultPaymentMethod;
|
|
4
5
|
exports.toUnpaidInvoiceRef = toUnpaidInvoiceRef;
|
|
5
6
|
exports.buildUnpaidInvoiceRef = buildUnpaidInvoiceRef;
|
|
@@ -8,6 +9,7 @@ const interface_database_decorators_1 = require("@antelopejs/interface-database-
|
|
|
8
9
|
const db_1 = require("../db");
|
|
9
10
|
const client_1 = require("../stripe/client");
|
|
10
11
|
const time_1 = require("../utils/time");
|
|
12
|
+
const billing_settings_store_1 = require("../operator-billing/billing-settings-store");
|
|
11
13
|
function toCardSummary(paymentMethod) {
|
|
12
14
|
const card = paymentMethod?.card;
|
|
13
15
|
if (!card)
|
|
@@ -17,6 +19,7 @@ function toCardSummary(paymentMethod) {
|
|
|
17
19
|
last4: card.last4,
|
|
18
20
|
expMonth: card.exp_month,
|
|
19
21
|
expYear: card.exp_year,
|
|
22
|
+
holderName: paymentMethod?.billing_details?.name ?? null,
|
|
20
23
|
};
|
|
21
24
|
}
|
|
22
25
|
async function fetchDefaultPaymentMethod(stripeCustomerId) {
|
|
@@ -36,12 +39,10 @@ async function fetchDefaultPaymentMethod(stripeCustomerId) {
|
|
|
36
39
|
async function resolveSuspendAt(pastDueSince) {
|
|
37
40
|
if (!pastDueSince)
|
|
38
41
|
return null;
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
if (!settings?.autoSuspendEnabled)
|
|
42
|
+
const settings = await (0, billing_settings_store_1.loadBillingSettings)();
|
|
43
|
+
if (!settings.autoSuspendEnabled)
|
|
42
44
|
return null;
|
|
43
|
-
|
|
44
|
-
return new Date(pastDueSince.getTime() + delayDays * time_1.MS_PER_DAY);
|
|
45
|
+
return new Date(pastDueSince.getTime() + settings.autoSuspendDelayDays * time_1.MS_PER_DAY);
|
|
45
46
|
}
|
|
46
47
|
async function fetchNextRetryAt(stripeInvoiceId) {
|
|
47
48
|
const stripe = (0, client_1.getStripeClient)();
|
|
@@ -73,6 +74,7 @@ async function buildUnpaidInvoiceSummary(tenantId, subscription) {
|
|
|
73
74
|
]);
|
|
74
75
|
return {
|
|
75
76
|
...toUnpaidInvoiceRef(invoice),
|
|
77
|
+
invoiceId: invoice._id,
|
|
76
78
|
failedAt: subscription.pastDueSince ?? null,
|
|
77
79
|
nextRetryAt,
|
|
78
80
|
suspendAt,
|