@antelopejs/dms-saas 0.0.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/LICENSE +190 -0
- package/README.md +658 -0
- package/dist/auth/index.d.ts +3 -0
- package/dist/auth/index.js +20 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/oauth-entry.d.ts +5 -0
- package/dist/auth/oauth-entry.js +10 -0
- package/dist/auth/oauth-entry.js.map +1 -0
- package/dist/auth/plan-permissions-resolver.d.ts +1 -0
- package/dist/auth/plan-permissions-resolver.js +44 -0
- package/dist/auth/plan-permissions-resolver.js.map +1 -0
- package/dist/auth/subscription-access-gate.d.ts +8 -0
- package/dist/auth/subscription-access-gate.js +38 -0
- package/dist/auth/subscription-access-gate.js.map +1 -0
- package/dist/automation/index.d.ts +44 -0
- package/dist/automation/index.js +209 -0
- package/dist/automation/index.js.map +1 -0
- package/dist/billing-state/index.d.ts +5 -0
- package/dist/billing-state/index.js +58 -0
- package/dist/billing-state/index.js.map +1 -0
- package/dist/billing-state/recovery.d.ts +22 -0
- package/dist/billing-state/recovery.js +81 -0
- package/dist/billing-state/recovery.js.map +1 -0
- package/dist/config/dev-mode.d.ts +3 -0
- package/dist/config/dev-mode.js +27 -0
- package/dist/config/dev-mode.js.map +1 -0
- package/dist/config/index.d.ts +2 -0
- package/dist/config/index.js +19 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/runtime.d.ts +6 -0
- package/dist/config/runtime.js +54 -0
- package/dist/config/runtime.js.map +1 -0
- package/dist/crons/auto-suspend-past-due.d.ts +2 -0
- package/dist/crons/auto-suspend-past-due.js +43 -0
- package/dist/crons/auto-suspend-past-due.js.map +1 -0
- package/dist/crons/cleanup-stripe-webhook-events.d.ts +2 -0
- package/dist/crons/cleanup-stripe-webhook-events.js +27 -0
- package/dist/crons/cleanup-stripe-webhook-events.js.map +1 -0
- package/dist/crons/expire-free-workspaces.d.ts +2 -0
- package/dist/crons/expire-free-workspaces.js +36 -0
- package/dist/crons/expire-free-workspaces.js.map +1 -0
- package/dist/crons/hard-delete-cancelled.d.ts +2 -0
- package/dist/crons/hard-delete-cancelled.js +55 -0
- package/dist/crons/hard-delete-cancelled.js.map +1 -0
- package/dist/crons/index.d.ts +8 -0
- package/dist/crons/index.js +25 -0
- package/dist/crons/index.js.map +1 -0
- package/dist/crons/notify-free-workspaces-ending-soon.d.ts +2 -0
- package/dist/crons/notify-free-workspaces-ending-soon.js +69 -0
- package/dist/crons/notify-free-workspaces-ending-soon.js.map +1 -0
- package/dist/crons/recompute-billing-state.d.ts +2 -0
- package/dist/crons/recompute-billing-state.js +19 -0
- package/dist/crons/recompute-billing-state.js.map +1 -0
- package/dist/crons/recompute-segments.d.ts +2 -0
- package/dist/crons/recompute-segments.js +19 -0
- package/dist/crons/recompute-segments.js.map +1 -0
- package/dist/crons/reconcile-workspace-lifecycle.d.ts +2 -0
- package/dist/crons/reconcile-workspace-lifecycle.js +19 -0
- package/dist/crons/reconcile-workspace-lifecycle.js.map +1 -0
- package/dist/crons/register.d.ts +2 -0
- package/dist/crons/register.js +24 -0
- package/dist/crons/register.js.map +1 -0
- package/dist/crons/subscription-notifications.d.ts +2 -0
- package/dist/crons/subscription-notifications.js +55 -0
- package/dist/crons/subscription-notifications.js.map +1 -0
- package/dist/data-api/index.d.ts +2 -0
- package/dist/data-api/index.js +19 -0
- package/dist/data-api/index.js.map +1 -0
- package/dist/data-api/platformOwner/admin-user-invoices.d.ts +27 -0
- package/dist/data-api/platformOwner/admin-user-invoices.js +158 -0
- package/dist/data-api/platformOwner/admin-user-invoices.js.map +1 -0
- package/dist/data-api/platformOwner/admin-user-workspaces.d.ts +22 -0
- package/dist/data-api/platformOwner/admin-user-workspaces.js +97 -0
- package/dist/data-api/platformOwner/admin-user-workspaces.js.map +1 -0
- package/dist/data-api/platformOwner/credit-notes.d.ts +24 -0
- package/dist/data-api/platformOwner/credit-notes.js +133 -0
- package/dist/data-api/platformOwner/credit-notes.js.map +1 -0
- package/dist/data-api/platformOwner/features.d.ts +30 -0
- package/dist/data-api/platformOwner/features.js +141 -0
- package/dist/data-api/platformOwner/features.js.map +1 -0
- package/dist/data-api/platformOwner/hidden-filter.d.ts +1 -0
- package/dist/data-api/platformOwner/hidden-filter.js +18 -0
- package/dist/data-api/platformOwner/hidden-filter.js.map +1 -0
- package/dist/data-api/platformOwner/index.d.ts +12 -0
- package/dist/data-api/platformOwner/index.js +29 -0
- package/dist/data-api/platformOwner/index.js.map +1 -0
- package/dist/data-api/platformOwner/invoice-options.d.ts +7 -0
- package/dist/data-api/platformOwner/invoice-options.js +14 -0
- package/dist/data-api/platformOwner/invoice-options.js.map +1 -0
- package/dist/data-api/platformOwner/invoices.d.ts +26 -0
- package/dist/data-api/platformOwner/invoices.js +147 -0
- package/dist/data-api/platformOwner/invoices.js.map +1 -0
- package/dist/data-api/platformOwner/members.d.ts +24 -0
- package/dist/data-api/platformOwner/members.js +125 -0
- package/dist/data-api/platformOwner/members.js.map +1 -0
- package/dist/data-api/platformOwner/plan-migrations.d.ts +24 -0
- package/dist/data-api/platformOwner/plan-migrations.js +138 -0
- package/dist/data-api/platformOwner/plan-migrations.js.map +1 -0
- package/dist/data-api/platformOwner/plans.d.ts +30 -0
- package/dist/data-api/platformOwner/plans.js +228 -0
- package/dist/data-api/platformOwner/plans.js.map +1 -0
- package/dist/data-api/platformOwner/segments.d.ts +29 -0
- package/dist/data-api/platformOwner/segments.js +223 -0
- package/dist/data-api/platformOwner/segments.js.map +1 -0
- package/dist/data-api/platformOwner/support.d.ts +58 -0
- package/dist/data-api/platformOwner/support.js +111 -0
- package/dist/data-api/platformOwner/support.js.map +1 -0
- package/dist/data-api/platformOwner/users.d.ts +22 -0
- package/dist/data-api/platformOwner/users.js +128 -0
- package/dist/data-api/platformOwner/users.js.map +1 -0
- package/dist/data-api/platformOwner/workspaces.d.ts +22 -0
- package/dist/data-api/platformOwner/workspaces.js +153 -0
- package/dist/data-api/platformOwner/workspaces.js.map +1 -0
- package/dist/data-api/support-fields.d.ts +49 -0
- package/dist/data-api/support-fields.js +166 -0
- package/dist/data-api/support-fields.js.map +1 -0
- package/dist/data-api/support-routes.d.ts +10 -0
- package/dist/data-api/support-routes.js +71 -0
- package/dist/data-api/support-routes.js.map +1 -0
- package/dist/data-api/tenant/index.d.ts +2 -0
- package/dist/data-api/tenant/index.js +19 -0
- package/dist/data-api/tenant/index.js.map +1 -0
- package/dist/data-api/tenant/support.d.ts +39 -0
- package/dist/data-api/tenant/support.js +53 -0
- package/dist/data-api/tenant/support.js.map +1 -0
- package/dist/data-api/tenant/tenant-invoices.d.ts +37 -0
- package/dist/data-api/tenant/tenant-invoices.js +242 -0
- package/dist/data-api/tenant/tenant-invoices.js.map +1 -0
- package/dist/db/index.d.ts +1 -0
- package/dist/db/index.js +18 -0
- package/dist/db/index.js.map +1 -0
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/index.js +20 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/register.d.ts +1 -0
- package/dist/hooks/register.js +57 -0
- package/dist/hooks/register.js.map +1 -0
- package/dist/hooks/tenant-export.d.ts +2 -0
- package/dist/hooks/tenant-export.js +64 -0
- package/dist/hooks/tenant-export.js.map +1 -0
- package/dist/hooks/tenant-provisioning.d.ts +3 -0
- package/dist/hooks/tenant-provisioning.js +12 -0
- package/dist/hooks/tenant-provisioning.js.map +1 -0
- package/dist/implementations/dms-saas/billing.d.ts +2 -0
- package/dist/implementations/dms-saas/billing.js +49 -0
- package/dist/implementations/dms-saas/billing.js.map +1 -0
- package/dist/implementations/dms-saas/invoice-line-items.d.ts +11 -0
- package/dist/implementations/dms-saas/invoice-line-items.js +24 -0
- package/dist/implementations/dms-saas/invoice-line-items.js.map +1 -0
- package/dist/implementations/dms-saas/pages.d.ts +3 -0
- package/dist/implementations/dms-saas/pages.js +12 -0
- package/dist/implementations/dms-saas/pages.js.map +1 -0
- package/dist/implementations/dms-saas/workspace-lifecycle.d.ts +2 -0
- package/dist/implementations/dms-saas/workspace-lifecycle.js +23 -0
- package/dist/implementations/dms-saas/workspace-lifecycle.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +107 -0
- package/dist/index.js.map +1 -0
- package/dist/invoice-line-items/billing-window.d.ts +3 -0
- package/dist/invoice-line-items/billing-window.js +19 -0
- package/dist/invoice-line-items/billing-window.js.map +1 -0
- package/dist/invoice-line-items/index.d.ts +1 -0
- package/dist/invoice-line-items/index.js +18 -0
- package/dist/invoice-line-items/index.js.map +1 -0
- package/dist/invoice-line-items/injection.d.ts +2 -0
- package/dist/invoice-line-items/injection.js +171 -0
- package/dist/invoice-line-items/injection.js.map +1 -0
- package/dist/notifications/index.d.ts +2 -0
- package/dist/notifications/index.js +19 -0
- package/dist/notifications/index.js.map +1 -0
- package/dist/notifications/recipients.d.ts +14 -0
- package/dist/notifications/recipients.js +87 -0
- package/dist/notifications/recipients.js.map +1 -0
- package/dist/notifications/subjects.d.ts +21 -0
- package/dist/notifications/subjects.js +121 -0
- package/dist/notifications/subjects.js.map +1 -0
- package/dist/operator-actions/commands.d.ts +41 -0
- package/dist/operator-actions/commands.js +233 -0
- package/dist/operator-actions/commands.js.map +1 -0
- package/dist/operator-actions/db/index.d.ts +4 -0
- package/dist/operator-actions/db/index.js +21 -0
- package/dist/operator-actions/db/index.js.map +1 -0
- package/dist/operator-actions/db/lifecycle-delivery.model.d.ts +29 -0
- package/dist/operator-actions/db/lifecycle-delivery.model.js +85 -0
- package/dist/operator-actions/db/lifecycle-delivery.model.js.map +1 -0
- package/dist/operator-actions/db/lifecycle-delivery.table.d.ts +26 -0
- package/dist/operator-actions/db/lifecycle-delivery.table.js +107 -0
- package/dist/operator-actions/db/lifecycle-delivery.table.js.map +1 -0
- package/dist/operator-actions/db/operator-action.model.d.ts +33 -0
- package/dist/operator-actions/db/operator-action.model.js +63 -0
- package/dist/operator-actions/db/operator-action.model.js.map +1 -0
- package/dist/operator-actions/db/operator-action.table.d.ts +21 -0
- package/dist/operator-actions/db/operator-action.table.js +95 -0
- package/dist/operator-actions/db/operator-action.table.js.map +1 -0
- package/dist/operator-actions/index.d.ts +3 -0
- package/dist/operator-actions/index.js +20 -0
- package/dist/operator-actions/index.js.map +1 -0
- package/dist/operator-actions/journal.d.ts +22 -0
- package/dist/operator-actions/journal.js +183 -0
- package/dist/operator-actions/journal.js.map +1 -0
- package/dist/operator-actions/lifecycle-consumers.d.ts +12 -0
- package/dist/operator-actions/lifecycle-consumers.js +28 -0
- package/dist/operator-actions/lifecycle-consumers.js.map +1 -0
- package/dist/operator-actions/lifecycle-outbox.d.ts +19 -0
- package/dist/operator-actions/lifecycle-outbox.js +229 -0
- package/dist/operator-actions/lifecycle-outbox.js.map +1 -0
- package/dist/operator-actions/types.d.ts +11 -0
- package/dist/operator-actions/types.js +3 -0
- package/dist/operator-actions/types.js.map +1 -0
- package/dist/pages/definitions.d.ts +1 -0
- package/dist/pages/definitions.js +18 -0
- package/dist/pages/definitions.js.map +1 -0
- package/dist/pages/index.d.ts +4 -0
- package/dist/pages/index.js +21 -0
- package/dist/pages/index.js.map +1 -0
- package/dist/pages/module.d.ts +5 -0
- package/dist/pages/module.js +15 -0
- package/dist/pages/module.js.map +1 -0
- package/dist/pages/platform/categories.d.ts +6 -0
- package/dist/pages/platform/categories.js +48 -0
- package/dist/pages/platform/categories.js.map +1 -0
- package/dist/pages/platform/credit-notes.d.ts +9 -0
- package/dist/pages/platform/credit-notes.js +40 -0
- package/dist/pages/platform/credit-notes.js.map +1 -0
- package/dist/pages/platform/dashboard.d.ts +10 -0
- package/dist/pages/platform/dashboard.js +95 -0
- package/dist/pages/platform/dashboard.js.map +1 -0
- package/dist/pages/platform/features.d.ts +9 -0
- package/dist/pages/platform/features.js +42 -0
- package/dist/pages/platform/features.js.map +1 -0
- package/dist/pages/platform/index.d.ts +15 -0
- package/dist/pages/platform/index.js +32 -0
- package/dist/pages/platform/index.js.map +1 -0
- package/dist/pages/platform/invoices.d.ts +9 -0
- package/dist/pages/platform/invoices.js +63 -0
- package/dist/pages/platform/invoices.js.map +1 -0
- package/dist/pages/platform/plans/edit.d.ts +17 -0
- package/dist/pages/platform/plans/edit.js +213 -0
- package/dist/pages/platform/plans/edit.js.map +1 -0
- package/dist/pages/platform/plans/index.d.ts +9 -0
- package/dist/pages/platform/plans/index.js +99 -0
- package/dist/pages/platform/plans/index.js.map +1 -0
- package/dist/pages/platform/plans/migrations.d.ts +9 -0
- package/dist/pages/platform/plans/migrations.js +38 -0
- package/dist/pages/platform/plans/migrations.js.map +1 -0
- package/dist/pages/platform/segments/index.d.ts +9 -0
- package/dist/pages/platform/segments/index.js +59 -0
- package/dist/pages/platform/segments/index.js.map +1 -0
- package/dist/pages/platform/settings.d.ts +9 -0
- package/dist/pages/platform/settings.js +147 -0
- package/dist/pages/platform/settings.js.map +1 -0
- package/dist/pages/platform/support.d.ts +9 -0
- package/dist/pages/platform/support.js +29 -0
- package/dist/pages/platform/support.js.map +1 -0
- package/dist/pages/platform/users/detail.d.ts +9 -0
- package/dist/pages/platform/users/detail.js +78 -0
- package/dist/pages/platform/users/detail.js.map +1 -0
- package/dist/pages/platform/users/index.d.ts +9 -0
- package/dist/pages/platform/users/index.js +77 -0
- package/dist/pages/platform/users/index.js.map +1 -0
- package/dist/pages/platform/workspaces/detail.d.ts +9 -0
- package/dist/pages/platform/workspaces/detail.js +120 -0
- package/dist/pages/platform/workspaces/detail.js.map +1 -0
- package/dist/pages/platform/workspaces/index.d.ts +35 -0
- package/dist/pages/platform/workspaces/index.js +300 -0
- package/dist/pages/platform/workspaces/index.js.map +1 -0
- package/dist/pages/public/auth/index.d.ts +1 -0
- package/dist/pages/public/auth/index.js +18 -0
- package/dist/pages/public/auth/index.js.map +1 -0
- package/dist/pages/public/auth/no-workspace.d.ts +9 -0
- package/dist/pages/public/auth/no-workspace.js +26 -0
- package/dist/pages/public/auth/no-workspace.js.map +1 -0
- package/dist/pages/public/index.d.ts +3 -0
- package/dist/pages/public/index.js +20 -0
- package/dist/pages/public/index.js.map +1 -0
- package/dist/pages/public/legal/index.d.ts +3 -0
- package/dist/pages/public/legal/index.js +20 -0
- package/dist/pages/public/legal/index.js.map +1 -0
- package/dist/pages/public/legal/privacy-policy.d.ts +9 -0
- package/dist/pages/public/legal/privacy-policy.js +29 -0
- package/dist/pages/public/legal/privacy-policy.js.map +1 -0
- package/dist/pages/public/legal/terms-and-conditions.d.ts +9 -0
- package/dist/pages/public/legal/terms-and-conditions.js +29 -0
- package/dist/pages/public/legal/terms-and-conditions.js.map +1 -0
- package/dist/pages/public/legal/terms-of-use.d.ts +9 -0
- package/dist/pages/public/legal/terms-of-use.js +29 -0
- package/dist/pages/public/legal/terms-of-use.js.map +1 -0
- package/dist/pages/public/register.d.ts +9 -0
- package/dist/pages/public/register.js +29 -0
- package/dist/pages/public/register.js.map +1 -0
- package/dist/pages/public/screens.d.ts +3 -0
- package/dist/pages/public/screens.js +50 -0
- package/dist/pages/public/screens.js.map +1 -0
- package/dist/pages/tenant/billing.d.ts +15 -0
- package/dist/pages/tenant/billing.js +87 -0
- package/dist/pages/tenant/billing.js.map +1 -0
- package/dist/pages/tenant/data-export.d.ts +10 -0
- package/dist/pages/tenant/data-export.js +32 -0
- package/dist/pages/tenant/data-export.js.map +1 -0
- package/dist/pages/tenant/general.d.ts +10 -0
- package/dist/pages/tenant/general.js +33 -0
- package/dist/pages/tenant/general.js.map +1 -0
- package/dist/pages/tenant/index.d.ts +6 -0
- package/dist/pages/tenant/index.js +23 -0
- package/dist/pages/tenant/index.js.map +1 -0
- package/dist/pages/tenant/members-seat-quota.d.ts +3 -0
- package/dist/pages/tenant/members-seat-quota.js +25 -0
- package/dist/pages/tenant/members-seat-quota.js.map +1 -0
- package/dist/pages/tenant/support.d.ts +9 -0
- package/dist/pages/tenant/support.js +27 -0
- package/dist/pages/tenant/support.js.map +1 -0
- package/dist/pages/tenant/workspace-suspended.d.ts +9 -0
- package/dist/pages/tenant/workspace-suspended.js +26 -0
- package/dist/pages/tenant/workspace-suspended.js.map +1 -0
- package/dist/plan-changes/deferred.d.ts +18 -0
- package/dist/plan-changes/deferred.js +225 -0
- package/dist/plan-changes/deferred.js.map +1 -0
- package/dist/plan-changes/index.d.ts +1 -0
- package/dist/plan-changes/index.js +18 -0
- package/dist/plan-changes/index.js.map +1 -0
- package/dist/plans/index.d.ts +4 -0
- package/dist/plans/index.js +21 -0
- package/dist/plans/index.js.map +1 -0
- package/dist/plans/seat-capacity.d.ts +9 -0
- package/dist/plans/seat-capacity.js +38 -0
- package/dist/plans/seat-capacity.js.map +1 -0
- package/dist/plans/seat-hooks.d.ts +1 -0
- package/dist/plans/seat-hooks.js +80 -0
- package/dist/plans/seat-hooks.js.map +1 -0
- package/dist/plans/seat-sync.d.ts +10 -0
- package/dist/plans/seat-sync.js +23 -0
- package/dist/plans/seat-sync.js.map +1 -0
- package/dist/routes/index.d.ts +3 -0
- package/dist/routes/index.js +20 -0
- package/dist/routes/index.js.map +1 -0
- package/dist/routes/platformOwner/billing-settings.d.ts +20 -0
- package/dist/routes/platformOwner/billing-settings.js +98 -0
- package/dist/routes/platformOwner/billing-settings.js.map +1 -0
- package/dist/routes/platformOwner/credit-notes-issue.d.ts +16 -0
- package/dist/routes/platformOwner/credit-notes-issue.js +56 -0
- package/dist/routes/platformOwner/credit-notes-issue.js.map +1 -0
- package/dist/routes/platformOwner/dashboard.d.ts +62 -0
- package/dist/routes/platformOwner/dashboard.js +310 -0
- package/dist/routes/platformOwner/dashboard.js.map +1 -0
- package/dist/routes/platformOwner/index.d.ts +12 -0
- package/dist/routes/platformOwner/index.js +29 -0
- package/dist/routes/platformOwner/index.js.map +1 -0
- package/dist/routes/platformOwner/plan-deletion.d.ts +30 -0
- package/dist/routes/platformOwner/plan-deletion.js +156 -0
- package/dist/routes/platformOwner/plan-deletion.js.map +1 -0
- package/dist/routes/platformOwner/plans.d.ts +99 -0
- package/dist/routes/platformOwner/plans.js +376 -0
- package/dist/routes/platformOwner/plans.js.map +1 -0
- package/dist/routes/platformOwner/platform-notes.d.ts +36 -0
- package/dist/routes/platformOwner/platform-notes.js +149 -0
- package/dist/routes/platformOwner/platform-notes.js.map +1 -0
- package/dist/routes/platformOwner/platform-owners.d.ts +12 -0
- package/dist/routes/platformOwner/platform-owners.js +77 -0
- package/dist/routes/platformOwner/platform-owners.js.map +1 -0
- package/dist/routes/platformOwner/segments.d.ts +24 -0
- package/dist/routes/platformOwner/segments.js +174 -0
- package/dist/routes/platformOwner/segments.js.map +1 -0
- package/dist/routes/platformOwner/support.d.ts +21 -0
- package/dist/routes/platformOwner/support.js +180 -0
- package/dist/routes/platformOwner/support.js.map +1 -0
- package/dist/routes/platformOwner/users-detail.d.ts +26 -0
- package/dist/routes/platformOwner/users-detail.js +82 -0
- package/dist/routes/platformOwner/users-detail.js.map +1 -0
- package/dist/routes/platformOwner/workspace-operator-actions.d.ts +34 -0
- package/dist/routes/platformOwner/workspace-operator-actions.js +183 -0
- package/dist/routes/platformOwner/workspace-operator-actions.js.map +1 -0
- package/dist/routes/platformOwner/workspaces-admin.d.ts +27 -0
- package/dist/routes/platformOwner/workspaces-admin.js +140 -0
- package/dist/routes/platformOwner/workspaces-admin.js.map +1 -0
- package/dist/routes/public/index.d.ts +3 -0
- package/dist/routes/public/index.js +20 -0
- package/dist/routes/public/index.js.map +1 -0
- package/dist/routes/public/legal-documents.d.ts +15 -0
- package/dist/routes/public/legal-documents.js +72 -0
- package/dist/routes/public/legal-documents.js.map +1 -0
- package/dist/routes/public/register.d.ts +48 -0
- package/dist/routes/public/register.js +193 -0
- package/dist/routes/public/register.js.map +1 -0
- package/dist/routes/public/webhooks/index.d.ts +1 -0
- package/dist/routes/public/webhooks/index.js +18 -0
- package/dist/routes/public/webhooks/index.js.map +1 -0
- package/dist/routes/public/webhooks/stripe.d.ts +7 -0
- package/dist/routes/public/webhooks/stripe.js +41 -0
- package/dist/routes/public/webhooks/stripe.js.map +1 -0
- package/dist/routes/tenant/billing-portal.d.ts +31 -0
- package/dist/routes/tenant/billing-portal.js +117 -0
- package/dist/routes/tenant/billing-portal.js.map +1 -0
- package/dist/routes/tenant/billing-self-refund.d.ts +18 -0
- package/dist/routes/tenant/billing-self-refund.js +199 -0
- package/dist/routes/tenant/billing-self-refund.js.map +1 -0
- package/dist/routes/tenant/data-export.d.ts +16 -0
- package/dist/routes/tenant/data-export.js +102 -0
- package/dist/routes/tenant/data-export.js.map +1 -0
- package/dist/routes/tenant/index.d.ts +9 -0
- package/dist/routes/tenant/index.js +26 -0
- package/dist/routes/tenant/index.js.map +1 -0
- package/dist/routes/tenant/support.d.ts +27 -0
- package/dist/routes/tenant/support.js +185 -0
- package/dist/routes/tenant/support.js.map +1 -0
- package/dist/routes/tenant/tenant-billing.d.ts +26 -0
- package/dist/routes/tenant/tenant-billing.js +148 -0
- package/dist/routes/tenant/tenant-billing.js.map +1 -0
- package/dist/routes/tenant/tenant-plan-ops.d.ts +57 -0
- package/dist/routes/tenant/tenant-plan-ops.js +244 -0
- package/dist/routes/tenant/tenant-plan-ops.js.map +1 -0
- package/dist/routes/tenant/tenant-plan.d.ts +19 -0
- package/dist/routes/tenant/tenant-plan.js +172 -0
- package/dist/routes/tenant/tenant-plan.js.map +1 -0
- package/dist/routes/tenant/tenant-seats.d.ts +17 -0
- package/dist/routes/tenant/tenant-seats.js +58 -0
- package/dist/routes/tenant/tenant-seats.js.map +1 -0
- package/dist/routes/tenant/workspaces.d.ts +78 -0
- package/dist/routes/tenant/workspaces.js +301 -0
- package/dist/routes/tenant/workspaces.js.map +1 -0
- package/dist/stripe/client.d.ts +6 -0
- package/dist/stripe/client.js +44 -0
- package/dist/stripe/client.js.map +1 -0
- package/dist/stripe/customer-balance.d.ts +12 -0
- package/dist/stripe/customer-balance.js +16 -0
- package/dist/stripe/customer-balance.js.map +1 -0
- package/dist/stripe/customer-billing.d.ts +33 -0
- package/dist/stripe/customer-billing.js +140 -0
- package/dist/stripe/customer-billing.js.map +1 -0
- package/dist/stripe/index.d.ts +11 -0
- package/dist/stripe/index.js +28 -0
- package/dist/stripe/index.js.map +1 -0
- package/dist/stripe/plan-schedule.d.ts +9 -0
- package/dist/stripe/plan-schedule.js +83 -0
- package/dist/stripe/plan-schedule.js.map +1 -0
- package/dist/stripe/proration.d.ts +2 -0
- package/dist/stripe/proration.js +19 -0
- package/dist/stripe/proration.js.map +1 -0
- package/dist/stripe/sync-plan.d.ts +2 -0
- package/dist/stripe/sync-plan.js +66 -0
- package/dist/stripe/sync-plan.js.map +1 -0
- package/dist/stripe/webhook-checkout.d.ts +3 -0
- package/dist/stripe/webhook-checkout.js +157 -0
- package/dist/stripe/webhook-checkout.js.map +1 -0
- package/dist/stripe/webhook-credit-notes.d.ts +3 -0
- package/dist/stripe/webhook-credit-notes.js +192 -0
- package/dist/stripe/webhook-credit-notes.js.map +1 -0
- package/dist/stripe/webhook-dispatch.d.ts +2 -0
- package/dist/stripe/webhook-dispatch.js +45 -0
- package/dist/stripe/webhook-dispatch.js.map +1 -0
- package/dist/stripe/webhook-handlers.d.ts +11 -0
- package/dist/stripe/webhook-handlers.js +318 -0
- package/dist/stripe/webhook-handlers.js.map +1 -0
- package/dist/stripe/webhook-shared.d.ts +28 -0
- package/dist/stripe/webhook-shared.js +126 -0
- package/dist/stripe/webhook-shared.js.map +1 -0
- package/dist/stripe/workspace-checkout.d.ts +29 -0
- package/dist/stripe/workspace-checkout.js +106 -0
- package/dist/stripe/workspace-checkout.js.map +1 -0
- package/dist/support/admissions.d.ts +36 -0
- package/dist/support/admissions.js +136 -0
- package/dist/support/admissions.js.map +1 -0
- package/dist/support/attachments.d.ts +12 -0
- package/dist/support/attachments.js +56 -0
- package/dist/support/attachments.js.map +1 -0
- package/dist/support/config.d.ts +19 -0
- package/dist/support/config.js +75 -0
- package/dist/support/config.js.map +1 -0
- package/dist/support/index.d.ts +6 -0
- package/dist/support/index.js +23 -0
- package/dist/support/index.js.map +1 -0
- package/dist/support/operations.d.ts +51 -0
- package/dist/support/operations.js +109 -0
- package/dist/support/operations.js.map +1 -0
- package/dist/support/plans.d.ts +6 -0
- package/dist/support/plans.js +130 -0
- package/dist/support/plans.js.map +1 -0
- package/dist/support/publications.d.ts +8 -0
- package/dist/support/publications.js +106 -0
- package/dist/support/publications.js.map +1 -0
- package/dist/support/recovery.d.ts +7 -0
- package/dist/support/recovery.js +43 -0
- package/dist/support/recovery.js.map +1 -0
- package/dist/support/service.d.ts +51 -0
- package/dist/support/service.js +143 -0
- package/dist/support/service.js.map +1 -0
- package/dist/support/transitions.d.ts +4 -0
- package/dist/support/transitions.js +29 -0
- package/dist/support/transitions.js.map +1 -0
- package/dist/support/uploads.d.ts +39 -0
- package/dist/support/uploads.js +115 -0
- package/dist/support/uploads.js.map +1 -0
- package/dist/support/validation.d.ts +15 -0
- package/dist/support/validation.js +54 -0
- package/dist/support/validation.js.map +1 -0
- package/dist/types/config.d.ts +16 -0
- package/dist/types/config.js +3 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +18 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/billing-document-type.d.ts +3 -0
- package/dist/utils/billing-document-type.js +18 -0
- package/dist/utils/billing-document-type.js.map +1 -0
- package/dist/utils/billing-period-type.d.ts +3 -0
- package/dist/utils/billing-period-type.js +18 -0
- package/dist/utils/billing-period-type.js.map +1 -0
- package/dist/utils/email-hash.d.ts +1 -0
- package/dist/utils/email-hash.js +8 -0
- package/dist/utils/email-hash.js.map +1 -0
- package/dist/utils/export-dataset-stream.d.ts +19 -0
- package/dist/utils/export-dataset-stream.js +40 -0
- package/dist/utils/export-dataset-stream.js.map +1 -0
- package/dist/utils/index.d.ts +15 -0
- package/dist/utils/index.js +32 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/invoice-lines-type.d.ts +27 -0
- package/dist/utils/invoice-lines-type.js +34 -0
- package/dist/utils/invoice-lines-type.js.map +1 -0
- package/dist/utils/money-cents-type.d.ts +3 -0
- package/dist/utils/money-cents-type.js +18 -0
- package/dist/utils/money-cents-type.js.map +1 -0
- package/dist/utils/pagination.d.ts +22 -0
- package/dist/utils/pagination.js +35 -0
- package/dist/utils/pagination.js.map +1 -0
- package/dist/utils/parse-future-date.d.ts +1 -0
- package/dist/utils/parse-future-date.js +15 -0
- package/dist/utils/parse-future-date.js.map +1 -0
- package/dist/utils/row-instance.d.ts +1 -0
- package/dist/utils/row-instance.js +8 -0
- package/dist/utils/row-instance.js.map +1 -0
- package/dist/utils/segment-conditions-type.d.ts +33 -0
- package/dist/utils/segment-conditions-type.js +86 -0
- package/dist/utils/segment-conditions-type.js.map +1 -0
- package/dist/utils/segment-evaluator.d.ts +3 -0
- package/dist/utils/segment-evaluator.js +117 -0
- package/dist/utils/segment-evaluator.js.map +1 -0
- package/dist/utils/segment-fields.d.ts +19 -0
- package/dist/utils/segment-fields.js +212 -0
- package/dist/utils/segment-fields.js.map +1 -0
- package/dist/utils/segment-matching.d.ts +56 -0
- package/dist/utils/segment-matching.js +200 -0
- package/dist/utils/segment-matching.js.map +1 -0
- package/dist/utils/segment-name-cache.d.ts +2 -0
- package/dist/utils/segment-name-cache.js +22 -0
- package/dist/utils/segment-name-cache.js.map +1 -0
- package/dist/utils/time.d.ts +3 -0
- package/dist/utils/time.js +10 -0
- package/dist/utils/time.js.map +1 -0
- package/dist/workers/index.d.ts +1 -0
- package/dist/workers/index.js +18 -0
- package/dist/workers/index.js.map +1 -0
- package/dist/workers/plan-migration.d.ts +4 -0
- package/dist/workers/plan-migration.js +206 -0
- package/dist/workers/plan-migration.js.map +1 -0
- package/dist/workspaces/billing-profile.d.ts +3 -0
- package/dist/workspaces/billing-profile.js +55 -0
- package/dist/workspaces/billing-profile.js.map +1 -0
- package/dist/workspaces/complimentary.d.ts +7 -0
- package/dist/workspaces/complimentary.js +47 -0
- package/dist/workspaces/complimentary.js.map +1 -0
- package/dist/workspaces/db/card-capacity.model.d.ts +30 -0
- package/dist/workspaces/db/card-capacity.model.js +98 -0
- package/dist/workspaces/db/card-capacity.model.js.map +1 -0
- package/dist/workspaces/db/card-capacity.table.d.ts +11 -0
- package/dist/workspaces/db/card-capacity.table.js +34 -0
- package/dist/workspaces/db/card-capacity.table.js.map +1 -0
- package/dist/workspaces/db/provisioning-attempt.model.d.ts +24 -0
- package/dist/workspaces/db/provisioning-attempt.model.js +33 -0
- package/dist/workspaces/db/provisioning-attempt.model.js.map +1 -0
- package/dist/workspaces/db/provisioning-attempt.table.d.ts +18 -0
- package/dist/workspaces/db/provisioning-attempt.table.js +77 -0
- package/dist/workspaces/db/provisioning-attempt.table.js.map +1 -0
- package/dist/workspaces/db/trial-identity.model.d.ts +25 -0
- package/dist/workspaces/db/trial-identity.model.js +62 -0
- package/dist/workspaces/db/trial-identity.model.js.map +1 -0
- package/dist/workspaces/db/trial-identity.table.d.ts +7 -0
- package/dist/workspaces/db/trial-identity.table.js +34 -0
- package/dist/workspaces/db/trial-identity.table.js.map +1 -0
- package/dist/workspaces/deletion.d.ts +8 -0
- package/dist/workspaces/deletion.js +75 -0
- package/dist/workspaces/deletion.js.map +1 -0
- package/dist/workspaces/free-workspace-guard.d.ts +11 -0
- package/dist/workspaces/free-workspace-guard.js +96 -0
- package/dist/workspaces/free-workspace-guard.js.map +1 -0
- package/dist/workspaces/index.d.ts +6 -0
- package/dist/workspaces/index.js +23 -0
- package/dist/workspaces/index.js.map +1 -0
- package/dist/workspaces/provisioning-rollback.d.ts +2 -0
- package/dist/workspaces/provisioning-rollback.js +78 -0
- package/dist/workspaces/provisioning-rollback.js.map +1 -0
- package/dist/workspaces/provisioning-state.d.ts +6 -0
- package/dist/workspaces/provisioning-state.js +91 -0
- package/dist/workspaces/provisioning-state.js.map +1 -0
- package/dist/workspaces/provisioning.d.ts +49 -0
- package/dist/workspaces/provisioning.js +263 -0
- package/dist/workspaces/provisioning.js.map +1 -0
- package/dist/workspaces/registration-extras.d.ts +1 -0
- package/dist/workspaces/registration-extras.js +50 -0
- package/dist/workspaces/registration-extras.js.map +1 -0
- package/dist/workspaces/suspension.d.ts +13 -0
- package/dist/workspaces/suspension.js +124 -0
- package/dist/workspaces/suspension.js.map +1 -0
- package/frontend-vue/.editorconfig +12 -0
- package/frontend-vue/.prettierrc +11 -0
- package/frontend-vue/app/build/.gitkeep +0 -0
- package/frontend-vue/app/components/CardGrid.vue +77 -0
- package/frontend-vue/app/components/CustomerPortalButton.vue +45 -0
- package/frontend-vue/app/components/DataExport.vue +300 -0
- package/frontend-vue/app/components/DeletePlanModal.vue +223 -0
- package/frontend-vue/app/components/FreeAccessBanner.vue +70 -0
- package/frontend-vue/app/components/InvoiceLines.vue +57 -0
- package/frontend-vue/app/components/IssueCreditNoteModal.vue +128 -0
- package/frontend-vue/app/components/LegalLayout.vue +63 -0
- package/frontend-vue/app/components/LoadFailure.vue +25 -0
- package/frontend-vue/app/components/PastDueAlert.vue +96 -0
- package/frontend-vue/app/components/PaymentMethodCard.vue +86 -0
- package/frontend-vue/app/components/PlanCard.vue +294 -0
- package/frontend-vue/app/components/PlanCardPublic.vue +59 -0
- package/frontend-vue/app/components/PlanCardsDisplay.vue +127 -0
- package/frontend-vue/app/components/PlanComparisonModal.vue +213 -0
- package/frontend-vue/app/components/PlanInheritancePicker.vue +329 -0
- package/frontend-vue/app/components/PlatformNotes.vue +281 -0
- package/frontend-vue/app/components/PlatformSupport.vue +461 -0
- package/frontend-vue/app/components/RecentActivity.vue +72 -0
- package/frontend-vue/app/components/RefundButton.vue +126 -0
- package/frontend-vue/app/components/Register.vue +174 -0
- package/frontend-vue/app/components/RegistrationClosed.vue +15 -0
- package/frontend-vue/app/components/SeatQuotaBanner.vue +78 -0
- package/frontend-vue/app/components/SegmentConditionsBuilder.vue +176 -0
- package/frontend-vue/app/components/SegmentConditionsGroup.vue +494 -0
- package/frontend-vue/app/components/SupportAttachmentUpload.vue +140 -0
- package/frontend-vue/app/components/SupportThreadHistory.vue +139 -0
- package/frontend-vue/app/components/TenantBillingForm.vue +208 -0
- package/frontend-vue/app/components/TenantPlanCard.vue +223 -0
- package/frontend-vue/app/components/TenantSupport.vue +415 -0
- package/frontend-vue/app/components/UserSummaryCard.vue +166 -0
- package/frontend-vue/app/components/WorkspaceBillingInfo.vue +68 -0
- package/frontend-vue/app/components/WorkspaceCompAccessButton.vue +198 -0
- package/frontend-vue/app/components/WorkspaceCreateModal.vue +256 -0
- package/frontend-vue/app/components/WorkspaceDangerZone.vue +146 -0
- package/frontend-vue/app/components/WorkspaceDetailHeader.vue +24 -0
- package/frontend-vue/app/components/WorkspaceIdentity.vue +99 -0
- package/frontend-vue/app/components/WorkspaceJoinButton.vue +50 -0
- package/frontend-vue/app/components/WorkspaceOperatorActions.vue +340 -0
- package/frontend-vue/app/components/WorkspaceSummaryCard.vue +161 -0
- package/frontend-vue/app/components/WorkspaceSuspendButton.vue +167 -0
- package/frontend-vue/app/components/WorkspaceSuspended.vue +164 -0
- package/frontend-vue/app/components/WorkspaceSwitcherWidget.vue +247 -0
- package/frontend-vue/app/composables/useApiErrorMessage.ts +35 -0
- package/frontend-vue/app/composables/useBillingCountries.ts +54 -0
- package/frontend-vue/app/composables/useBillingDocumentType.ts +7 -0
- package/frontend-vue/app/composables/useBillingStatus.ts +39 -0
- package/frontend-vue/app/composables/useCurrentWorkspace.ts +43 -0
- package/frontend-vue/app/composables/useDetailRefresh.ts +17 -0
- package/frontend-vue/app/composables/useExportHistory.ts +143 -0
- package/frontend-vue/app/composables/useInvoiceLines.ts +22 -0
- package/frontend-vue/app/composables/useMoneyFormat.ts +49 -0
- package/frontend-vue/app/composables/useMyWorkspaces.ts +47 -0
- package/frontend-vue/app/composables/usePlanFeatureFormat.ts +60 -0
- package/frontend-vue/app/composables/usePlanIntervalLabel.ts +30 -0
- package/frontend-vue/app/composables/useSaasRegistration.ts +522 -0
- package/frontend-vue/app/composables/useSeatQuota.ts +18 -0
- package/frontend-vue/app/composables/useSharedRequest.ts +54 -0
- package/frontend-vue/app/composables/useStripePaymentElement.ts +74 -0
- package/frontend-vue/app/composables/useSubscriptionAccess.ts +12 -0
- package/frontend-vue/app/composables/useSupportRequest.ts +74 -0
- package/frontend-vue/app/composables/useTenantPlan.ts +95 -0
- package/frontend-vue/app/composables/useTenantSwitch.ts +22 -0
- package/frontend-vue/app/composables/useWorkspaceAccessCache.ts +25 -0
- package/frontend-vue/app/custom-pages/auth/no-workspace.vue +495 -0
- package/frontend-vue/app/middleware/workspace-suspended.global.ts +56 -0
- package/frontend-vue/app/plugins/auth-links.ts +24 -0
- package/frontend-vue/app/plugins/billing-data-types.ts +62 -0
- package/frontend-vue/app/plugins/footer-links.ts +36 -0
- package/frontend-vue/app/plugins/plan-cards-display.client.ts +16 -0
- package/frontend-vue/app/plugins/segment-conditions-data-type.client.ts +122 -0
- package/frontend-vue/app/plugins/sidebar-widgets.ts +13 -0
- package/frontend-vue/app/types/support.ts +123 -0
- package/frontend-vue/dms.frontend.ts +68 -0
- package/frontend-vue/eslint.config.mjs +13 -0
- package/frontend-vue/i18n/locales/saas-en-GB.json +1285 -0
- package/frontend-vue/i18n/locales/saas-fr-FR.json +1285 -0
- package/frontend-vue/package.json +27 -0
- package/frontend-vue/pnpm-lock.yaml +4948 -0
- package/frontend-vue/pnpm-workspace.yaml +2 -0
- package/frontend-vue/server/routes/auth/finalize-workspace.post.ts +61 -0
- package/package.json +91 -0
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, onMounted, ref, watch } from "vue";
|
|
3
|
+
|
|
4
|
+
interface AdminWorkspaceState {
|
|
5
|
+
status: string | null;
|
|
6
|
+
planId: string | null;
|
|
7
|
+
hasStripeSubscription: boolean;
|
|
8
|
+
freeUntil: string | null;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface Props {
|
|
12
|
+
routeParams?: Record<string, string>;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
type SuspensionAction = "suspend" | "unsuspend";
|
|
16
|
+
|
|
17
|
+
const SUSPENDED_STATUS = "suspended";
|
|
18
|
+
const CANCELLED_STATUS = "cancelled";
|
|
19
|
+
|
|
20
|
+
const props = defineProps<Props>();
|
|
21
|
+
|
|
22
|
+
const { $authFetch } = useAuthFetch();
|
|
23
|
+
const nuxtApp = useDmsApp();
|
|
24
|
+
const toast = useToast();
|
|
25
|
+
const { resolveApiError } = useApiErrorMessage();
|
|
26
|
+
|
|
27
|
+
const tenantId = computed(() => props.routeParams?.id ?? "");
|
|
28
|
+
const { trigger, triggerRef } = useDetailRefresh(tenantId.value);
|
|
29
|
+
const state = ref<AdminWorkspaceState | null>(null);
|
|
30
|
+
const isLoading = ref(true);
|
|
31
|
+
const isModalOpen = ref(false);
|
|
32
|
+
const isSubmitting = ref(false);
|
|
33
|
+
const operationId = ref(crypto.randomUUID());
|
|
34
|
+
const operationAction = ref<SuspensionAction | null>(null);
|
|
35
|
+
|
|
36
|
+
const isSuspended = computed(() => state.value?.status === SUSPENDED_STATUS);
|
|
37
|
+
|
|
38
|
+
const isHidden = computed(
|
|
39
|
+
() => !state.value || state.value.status === CANCELLED_STATUS,
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
const buttonLabel = computed(() =>
|
|
43
|
+
nuxtApp.$i18n.t(
|
|
44
|
+
isSuspended.value
|
|
45
|
+
? "saas.workspaces.admin.unsuspend"
|
|
46
|
+
: "saas.workspaces.admin.suspend",
|
|
47
|
+
),
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
const buttonColor = computed<"primary" | "error">(() =>
|
|
51
|
+
isSuspended.value ? "primary" : "error",
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
const confirmTitle = computed(() =>
|
|
55
|
+
nuxtApp.$i18n.t(
|
|
56
|
+
isSuspended.value
|
|
57
|
+
? "saas.workspaces.admin.confirm_unsuspend.title"
|
|
58
|
+
: "saas.workspaces.admin.confirm_suspend.title",
|
|
59
|
+
),
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
const confirmMessage = computed(() =>
|
|
63
|
+
nuxtApp.$i18n.t(
|
|
64
|
+
isSuspended.value
|
|
65
|
+
? "saas.workspaces.admin.confirm_unsuspend.description"
|
|
66
|
+
: state.value?.hasStripeSubscription
|
|
67
|
+
? "saas.workspaces.admin.confirm_suspend.description_with_pause"
|
|
68
|
+
: "saas.workspaces.admin.confirm_suspend.description_local",
|
|
69
|
+
),
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
async function loadState(): Promise<void> {
|
|
73
|
+
if (!tenantId.value) return;
|
|
74
|
+
isLoading.value = true;
|
|
75
|
+
try {
|
|
76
|
+
state.value = await $authFetch<AdminWorkspaceState>(
|
|
77
|
+
`/api/saas/workspaces/${tenantId.value}/admin-state`,
|
|
78
|
+
);
|
|
79
|
+
} catch {
|
|
80
|
+
state.value = null;
|
|
81
|
+
} finally {
|
|
82
|
+
isLoading.value = false;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
async function confirmAction(): Promise<void> {
|
|
87
|
+
isSubmitting.value = true;
|
|
88
|
+
try {
|
|
89
|
+
const endpoint = isSuspended.value ? "unsuspend" : "suspend";
|
|
90
|
+
await $authFetch(`/api/saas/workspaces/${tenantId.value}/${endpoint}`, {
|
|
91
|
+
method: "POST",
|
|
92
|
+
body: { operationId: operationId.value },
|
|
93
|
+
});
|
|
94
|
+
toast.add({
|
|
95
|
+
title: nuxtApp.$i18n.t(
|
|
96
|
+
isSuspended.value
|
|
97
|
+
? "saas.workspaces.admin.unsuspended"
|
|
98
|
+
: "saas.workspaces.admin.suspended",
|
|
99
|
+
),
|
|
100
|
+
color: "success",
|
|
101
|
+
icon: "i-ph-check-circle",
|
|
102
|
+
});
|
|
103
|
+
isModalOpen.value = false;
|
|
104
|
+
operationId.value = crypto.randomUUID();
|
|
105
|
+
operationAction.value = null;
|
|
106
|
+
trigger();
|
|
107
|
+
} catch (error) {
|
|
108
|
+
toast.add({
|
|
109
|
+
title: resolveApiError(error, "saas.workspaces.admin.action_error"),
|
|
110
|
+
color: "error",
|
|
111
|
+
icon: "i-ph-warning-circle",
|
|
112
|
+
});
|
|
113
|
+
trigger();
|
|
114
|
+
} finally {
|
|
115
|
+
isSubmitting.value = false;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function openModal(): void {
|
|
120
|
+
const action = isSuspended.value ? "unsuspend" : "suspend";
|
|
121
|
+
if (operationAction.value !== action) {
|
|
122
|
+
operationId.value = crypto.randomUUID();
|
|
123
|
+
operationAction.value = action;
|
|
124
|
+
}
|
|
125
|
+
isModalOpen.value = true;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
onMounted(loadState);
|
|
129
|
+
watch(triggerRef, loadState);
|
|
130
|
+
</script>
|
|
131
|
+
|
|
132
|
+
<template>
|
|
133
|
+
<div v-if="!isLoading && !isHidden" class="flex justify-end">
|
|
134
|
+
<UButton
|
|
135
|
+
:color="buttonColor"
|
|
136
|
+
variant="soft"
|
|
137
|
+
:icon="isSuspended ? 'i-ph-play' : 'i-ph-prohibit'"
|
|
138
|
+
@click="openModal"
|
|
139
|
+
>
|
|
140
|
+
{{ buttonLabel }}
|
|
141
|
+
</UButton>
|
|
142
|
+
|
|
143
|
+
<UModal
|
|
144
|
+
:open="isModalOpen"
|
|
145
|
+
:title="confirmTitle"
|
|
146
|
+
@update:open="isModalOpen = $event"
|
|
147
|
+
>
|
|
148
|
+
<template #body>
|
|
149
|
+
<p>{{ confirmMessage }}</p>
|
|
150
|
+
</template>
|
|
151
|
+
<template #footer>
|
|
152
|
+
<div class="flex justify-end gap-2">
|
|
153
|
+
<UButton variant="ghost" @click="isModalOpen = false">
|
|
154
|
+
{{ $t("common.cancel") }}
|
|
155
|
+
</UButton>
|
|
156
|
+
<UButton
|
|
157
|
+
:color="buttonColor"
|
|
158
|
+
:loading="isSubmitting"
|
|
159
|
+
@click="confirmAction"
|
|
160
|
+
>
|
|
161
|
+
{{ buttonLabel }}
|
|
162
|
+
</UButton>
|
|
163
|
+
</div>
|
|
164
|
+
</template>
|
|
165
|
+
</UModal>
|
|
166
|
+
</div>
|
|
167
|
+
</template>
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, onMounted, ref } from "vue";
|
|
3
|
+
|
|
4
|
+
const ACCESS_ENDPOINT = "/api/saas/billing/access";
|
|
5
|
+
const HOME_REDIRECT = "/";
|
|
6
|
+
const LOGIN_REDIRECT = "/auth/login";
|
|
7
|
+
const BILLING_PATH = "/settings/workspace/billing";
|
|
8
|
+
|
|
9
|
+
const { $authFetch } = useAuthFetch();
|
|
10
|
+
const { clear: clearSession } = useUserSession();
|
|
11
|
+
const { formatMinorUnits } = useMoneyFormat();
|
|
12
|
+
const cachedAccess = useWorkspaceAccessCache();
|
|
13
|
+
const { data: billingStatusState } = useBillingStatus();
|
|
14
|
+
const { data: tenantPlanState } = useTenantPlan();
|
|
15
|
+
|
|
16
|
+
const access = ref<WorkspaceAccess | null>(null);
|
|
17
|
+
const isLoading = ref(true);
|
|
18
|
+
const hasError = ref(false);
|
|
19
|
+
|
|
20
|
+
const statusKey = computed(() => {
|
|
21
|
+
const status = access.value?.status;
|
|
22
|
+
return isBlockingSubscriptionStatus(status)
|
|
23
|
+
? `saas.workspace_suspended.status.${status}`
|
|
24
|
+
: "saas.workspace_suspended.status.default";
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const invoice = computed(() => access.value?.unpaidInvoice ?? null);
|
|
28
|
+
const amountLabel = computed(() =>
|
|
29
|
+
formatMinorUnits(invoice.value?.amount, invoice.value?.currency),
|
|
30
|
+
);
|
|
31
|
+
const invoiceLabel = computed(() => invoice.value?.number ?? amountLabel.value);
|
|
32
|
+
|
|
33
|
+
async function loadAccess(): Promise<void> {
|
|
34
|
+
isLoading.value = true;
|
|
35
|
+
hasError.value = false;
|
|
36
|
+
try {
|
|
37
|
+
const result = await $authFetch<WorkspaceAccess>(ACCESS_ENDPOINT);
|
|
38
|
+
access.value = result;
|
|
39
|
+
if (!result.blocked) {
|
|
40
|
+
// Drop the middleware's cached blocked state before navigating,
|
|
41
|
+
// otherwise it redirects straight back here and the recovery path
|
|
42
|
+
// never resolves. The shared billing payloads cached while blocked go
|
|
43
|
+
// with it: an SPA navigation keeps useState alive, and the billing page
|
|
44
|
+
// would keep announcing a suspension the user just settled.
|
|
45
|
+
cachedAccess.value = null;
|
|
46
|
+
billingStatusState.value = null;
|
|
47
|
+
tenantPlanState.value = null;
|
|
48
|
+
await navigateDms(HOME_REDIRECT);
|
|
49
|
+
}
|
|
50
|
+
} catch {
|
|
51
|
+
hasError.value = true;
|
|
52
|
+
} finally {
|
|
53
|
+
isLoading.value = false;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** Same settlement route as the past-due banner: the Stripe-hosted invoice
|
|
58
|
+
* page handles payment, card update and 3DS on its own. */
|
|
59
|
+
function settle(): void {
|
|
60
|
+
const url = invoice.value?.hostedInvoiceUrl;
|
|
61
|
+
if (!url || typeof window === "undefined") return;
|
|
62
|
+
window.open(url, "_blank", "noopener");
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
async function logout(): Promise<void> {
|
|
66
|
+
await clearSession();
|
|
67
|
+
await navigateDms(LOGIN_REDIRECT);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
onMounted(loadAccess);
|
|
71
|
+
</script>
|
|
72
|
+
|
|
73
|
+
<template>
|
|
74
|
+
<div class="mx-auto flex min-h-[60vh] w-full max-w-xl flex-col justify-center gap-6 py-12">
|
|
75
|
+
<div v-if="isLoading" class="flex justify-center">
|
|
76
|
+
<UIcon name="i-ph-circle-notch" class="size-8 animate-spin" />
|
|
77
|
+
</div>
|
|
78
|
+
|
|
79
|
+
<UAlert
|
|
80
|
+
v-else-if="hasError"
|
|
81
|
+
color="error"
|
|
82
|
+
variant="subtle"
|
|
83
|
+
icon="i-ph-warning-circle"
|
|
84
|
+
:title="$t('saas.workspace_suspended.load_error')"
|
|
85
|
+
>
|
|
86
|
+
<template #actions>
|
|
87
|
+
<UButton
|
|
88
|
+
color="error"
|
|
89
|
+
variant="solid"
|
|
90
|
+
icon="i-ph-arrows-clockwise"
|
|
91
|
+
@click="loadAccess"
|
|
92
|
+
>
|
|
93
|
+
{{ $t("saas.workspace_suspended.recheck") }}
|
|
94
|
+
</UButton>
|
|
95
|
+
</template>
|
|
96
|
+
</UAlert>
|
|
97
|
+
|
|
98
|
+
<UCard v-else-if="access?.blocked">
|
|
99
|
+
<template #header>
|
|
100
|
+
<div class="flex items-center gap-3">
|
|
101
|
+
<UIcon name="i-ph-lock-simple" class="size-6 text-error" />
|
|
102
|
+
<h1 class="text-lg font-semibold">
|
|
103
|
+
{{ $t("saas.workspace_suspended.title") }}
|
|
104
|
+
</h1>
|
|
105
|
+
</div>
|
|
106
|
+
</template>
|
|
107
|
+
|
|
108
|
+
<div class="flex flex-col gap-4">
|
|
109
|
+
<p v-if="invoice">
|
|
110
|
+
{{
|
|
111
|
+
$t("saas.workspace_suspended.unpaid_invoice", {
|
|
112
|
+
invoice: invoiceLabel,
|
|
113
|
+
amount: amountLabel,
|
|
114
|
+
})
|
|
115
|
+
}}
|
|
116
|
+
</p>
|
|
117
|
+
<p v-else>{{ $t(statusKey) }}</p>
|
|
118
|
+
|
|
119
|
+
<p v-if="access.isTenantOwner" class="text-muted text-sm">
|
|
120
|
+
{{ $t("saas.workspace_suspended.retention_note") }}
|
|
121
|
+
</p>
|
|
122
|
+
<p v-else>
|
|
123
|
+
{{ $t("saas.workspace_suspended.contact_owner") }}
|
|
124
|
+
</p>
|
|
125
|
+
|
|
126
|
+
<div v-if="access.isTenantOwner" class="flex flex-wrap gap-2">
|
|
127
|
+
<UButton
|
|
128
|
+
v-if="invoice?.hostedInvoiceUrl"
|
|
129
|
+
color="primary"
|
|
130
|
+
icon="i-ph-arrow-square-out"
|
|
131
|
+
@click="settle"
|
|
132
|
+
>
|
|
133
|
+
{{ $t("saas.workspace_suspended.settle") }}
|
|
134
|
+
</UButton>
|
|
135
|
+
<UButton
|
|
136
|
+
color="neutral"
|
|
137
|
+
variant="subtle"
|
|
138
|
+
icon="i-ph-credit-card"
|
|
139
|
+
:to="BILLING_PATH"
|
|
140
|
+
>
|
|
141
|
+
{{ $t("saas.workspace_suspended.open_billing") }}
|
|
142
|
+
</UButton>
|
|
143
|
+
<DmsSaasCustomerPortalButton />
|
|
144
|
+
</div>
|
|
145
|
+
</div>
|
|
146
|
+
|
|
147
|
+
<template #footer>
|
|
148
|
+
<div class="flex items-center justify-between">
|
|
149
|
+
<UButton
|
|
150
|
+
color="neutral"
|
|
151
|
+
variant="ghost"
|
|
152
|
+
icon="i-ph-arrows-clockwise"
|
|
153
|
+
@click="loadAccess"
|
|
154
|
+
>
|
|
155
|
+
{{ $t("saas.workspace_suspended.recheck") }}
|
|
156
|
+
</UButton>
|
|
157
|
+
<UButton color="neutral" variant="outline" @click="logout">
|
|
158
|
+
{{ $t("saas.workspace_suspended.logout") }}
|
|
159
|
+
</UButton>
|
|
160
|
+
</div>
|
|
161
|
+
</template>
|
|
162
|
+
</UCard>
|
|
163
|
+
</div>
|
|
164
|
+
</template>
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, onMounted, ref, watch } from "vue";
|
|
3
|
+
|
|
4
|
+
const props = defineProps<{
|
|
5
|
+
collapsed?: boolean;
|
|
6
|
+
}>();
|
|
7
|
+
|
|
8
|
+
interface DmsSaasPublicRuntimeConfig {
|
|
9
|
+
admissionMode?: "open" | "invitation-only";
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const toast = useToast();
|
|
13
|
+
const { t } = useI18n();
|
|
14
|
+
const { resolveApiError } = useApiErrorMessage();
|
|
15
|
+
|
|
16
|
+
// Platform owners are not tenant members by default, so an owner can legitimately
|
|
17
|
+
// have no workspace at all — the switcher must still offer them a way in.
|
|
18
|
+
const isOwner = useIsOwner();
|
|
19
|
+
const config = useDmsRuntimeConfig();
|
|
20
|
+
const canCreateWorkspace = computed(
|
|
21
|
+
() =>
|
|
22
|
+
isOwner.value ||
|
|
23
|
+
(config.public.dmsSaas as DmsSaasPublicRuntimeConfig | undefined)
|
|
24
|
+
?.admissionMode !== "invitation-only",
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
const SEARCH_THRESHOLD = 6;
|
|
28
|
+
const HOME_ROUTE = "/";
|
|
29
|
+
|
|
30
|
+
const { workspaces, refresh } = useMyWorkspaces();
|
|
31
|
+
const isLoading = ref(true);
|
|
32
|
+
const isOpen = ref(false);
|
|
33
|
+
const isCreateOpen = ref(false);
|
|
34
|
+
const searchQuery = ref("");
|
|
35
|
+
const switchingId = ref<string | null>(null);
|
|
36
|
+
|
|
37
|
+
const current = computed<MyWorkspace | undefined>(
|
|
38
|
+
() => workspaces.value.find((w) => w.isCurrent) ?? workspaces.value[0],
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
const showSearch = computed(() => workspaces.value.length >= SEARCH_THRESHOLD);
|
|
42
|
+
|
|
43
|
+
const isVisible = computed(() => !!current.value || isOwner.value);
|
|
44
|
+
|
|
45
|
+
const triggerLabel = computed(
|
|
46
|
+
() => current.value?.name ?? t("saas.workspaces.none"),
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
const triggerCaption = computed(
|
|
50
|
+
() => current.value?.planName ?? t("saas.workspaces.current_label"),
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
const filtered = computed<MyWorkspace[]>(() => {
|
|
54
|
+
const needle = searchQuery.value.trim().toLowerCase();
|
|
55
|
+
if (!needle) return workspaces.value;
|
|
56
|
+
return workspaces.value.filter((w) => w.name.toLowerCase().includes(needle));
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
watch(isOpen, (open) => {
|
|
60
|
+
if (!open) searchQuery.value = "";
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
const popoverPlacement = computed(() =>
|
|
64
|
+
props.collapsed
|
|
65
|
+
? { side: "right" as const, align: "start" as const, sideOffset: 12 }
|
|
66
|
+
: { side: "bottom" as const, align: "start" as const, sideOffset: 6 },
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
function initialOf(name: string): string {
|
|
70
|
+
return (name.trim()[0] ?? "?").toUpperCase();
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
async function load(): Promise<void> {
|
|
74
|
+
try {
|
|
75
|
+
await refresh();
|
|
76
|
+
} catch {
|
|
77
|
+
// Errors are swallowed on purpose: useMyWorkspaces already decides what the
|
|
78
|
+
// list becomes, and the sidebar is no place for an error card.
|
|
79
|
+
} finally {
|
|
80
|
+
isLoading.value = false;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
async function selectWorkspace(workspace: MyWorkspace): Promise<void> {
|
|
85
|
+
if (workspace.isCurrent || switchingId.value) return;
|
|
86
|
+
switchingId.value = workspace._id;
|
|
87
|
+
try {
|
|
88
|
+
// Reloads the page on success, so the switching state never resets.
|
|
89
|
+
await useTenantSwitch(workspace._id);
|
|
90
|
+
} catch (error) {
|
|
91
|
+
switchingId.value = null;
|
|
92
|
+
toast.add({
|
|
93
|
+
title: resolveApiError(error, "saas.workspaces.switch_error"),
|
|
94
|
+
color: "error",
|
|
95
|
+
icon: "i-ph-warning-circle",
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function openCreateModal(): void {
|
|
101
|
+
isOpen.value = false;
|
|
102
|
+
isCreateOpen.value = true;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
async function onWorkspaceCreated(tenantId: string): Promise<void> {
|
|
106
|
+
isCreateOpen.value = false;
|
|
107
|
+
try {
|
|
108
|
+
// Lands on the DMS homepage rather than reloading the settings screen the
|
|
109
|
+
// creation was started from — that screen belongs to the previous tenant.
|
|
110
|
+
await useTenantSwitch(tenantId, HOME_ROUTE);
|
|
111
|
+
} catch (error) {
|
|
112
|
+
toast.add({
|
|
113
|
+
title: resolveApiError(error, "saas.workspaces.switch_error"),
|
|
114
|
+
color: "error",
|
|
115
|
+
icon: "i-ph-warning-circle",
|
|
116
|
+
});
|
|
117
|
+
load();
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
onMounted(load);
|
|
122
|
+
</script>
|
|
123
|
+
|
|
124
|
+
<template>
|
|
125
|
+
<USkeleton
|
|
126
|
+
v-if="isLoading"
|
|
127
|
+
:class="collapsed ? 'mx-auto size-9 rounded-md' : 'h-[46px] w-full rounded-md'"
|
|
128
|
+
/>
|
|
129
|
+
<UPopover
|
|
130
|
+
v-else-if="isVisible"
|
|
131
|
+
v-model:open="isOpen"
|
|
132
|
+
:content="popoverPlacement"
|
|
133
|
+
>
|
|
134
|
+
<UTooltip
|
|
135
|
+
:text="triggerLabel"
|
|
136
|
+
:disabled="!collapsed"
|
|
137
|
+
:content="{ side: 'right' }"
|
|
138
|
+
>
|
|
139
|
+
<button
|
|
140
|
+
type="button"
|
|
141
|
+
class="border-default bg-elevated hover:border-accented flex w-full items-center rounded-md border text-left transition-colors"
|
|
142
|
+
:class="collapsed ? 'mx-auto size-9 justify-center' : 'gap-2.5 px-2.5 py-2'"
|
|
143
|
+
:aria-label="$t('saas.workspaces.switcher_title')"
|
|
144
|
+
>
|
|
145
|
+
<span
|
|
146
|
+
class="bg-primary/10 text-primary grid size-7 shrink-0 place-items-center rounded-md text-xs font-semibold"
|
|
147
|
+
>
|
|
148
|
+
<UIcon v-if="!current" name="i-ph-buildings" class="size-4" />
|
|
149
|
+
<template v-else>{{ initialOf(current.name) }}</template>
|
|
150
|
+
</span>
|
|
151
|
+
<template v-if="!collapsed">
|
|
152
|
+
<span class="min-w-0 flex-1">
|
|
153
|
+
<span class="text-muted block truncate text-[10px] font-medium uppercase tracking-wide">
|
|
154
|
+
{{ triggerCaption }}
|
|
155
|
+
</span>
|
|
156
|
+
<span class="text-highlighted block truncate text-xs font-medium">
|
|
157
|
+
{{ triggerLabel }}
|
|
158
|
+
</span>
|
|
159
|
+
</span>
|
|
160
|
+
<UIcon
|
|
161
|
+
name="i-ph-caret-up-down"
|
|
162
|
+
class="text-dimmed size-4 shrink-0"
|
|
163
|
+
/>
|
|
164
|
+
</template>
|
|
165
|
+
</button>
|
|
166
|
+
</UTooltip>
|
|
167
|
+
|
|
168
|
+
<template #content>
|
|
169
|
+
<div class="flex w-64 flex-col gap-1 p-2">
|
|
170
|
+
<p class="text-muted px-2 pt-1 text-xs font-medium">
|
|
171
|
+
{{ $t("saas.workspaces.switcher_title") }}
|
|
172
|
+
</p>
|
|
173
|
+
<UInput
|
|
174
|
+
v-if="showSearch"
|
|
175
|
+
v-model="searchQuery"
|
|
176
|
+
size="sm"
|
|
177
|
+
icon="i-ph-magnifying-glass"
|
|
178
|
+
:placeholder="$t('saas.workspaces.select')"
|
|
179
|
+
/>
|
|
180
|
+
<ul v-if="filtered.length" class="m-0 max-h-64 list-none overflow-y-auto p-0">
|
|
181
|
+
<li v-for="workspace in filtered" :key="workspace._id">
|
|
182
|
+
<button
|
|
183
|
+
type="button"
|
|
184
|
+
class="hover:bg-elevated flex w-full cursor-pointer items-center gap-2.5 rounded-md px-2 py-1.5 text-left text-sm transition-colors"
|
|
185
|
+
:class="{ 'cursor-default': workspace.isCurrent || !!switchingId }"
|
|
186
|
+
@click="selectWorkspace(workspace)"
|
|
187
|
+
>
|
|
188
|
+
<span
|
|
189
|
+
class="bg-primary/10 text-primary grid size-6 shrink-0 place-items-center rounded-md text-[10px] font-semibold"
|
|
190
|
+
>
|
|
191
|
+
{{ initialOf(workspace.name) }}
|
|
192
|
+
</span>
|
|
193
|
+
<span
|
|
194
|
+
class="min-w-0 flex-1 truncate"
|
|
195
|
+
:class="workspace.isCurrent ? 'text-highlighted font-medium' : 'text-default'"
|
|
196
|
+
>
|
|
197
|
+
{{ workspace.name }}
|
|
198
|
+
</span>
|
|
199
|
+
<span
|
|
200
|
+
v-if="workspace.planName"
|
|
201
|
+
class="text-muted shrink-0 text-[10px] font-medium uppercase tracking-wide"
|
|
202
|
+
>
|
|
203
|
+
{{ workspace.planName }}
|
|
204
|
+
</span>
|
|
205
|
+
<UIcon
|
|
206
|
+
v-if="switchingId === workspace._id"
|
|
207
|
+
name="i-ph-spinner"
|
|
208
|
+
class="text-muted size-4 shrink-0 animate-spin"
|
|
209
|
+
/>
|
|
210
|
+
<UIcon
|
|
211
|
+
v-else-if="workspace.isCurrent"
|
|
212
|
+
name="i-ph-check"
|
|
213
|
+
class="text-primary size-4 shrink-0"
|
|
214
|
+
/>
|
|
215
|
+
</button>
|
|
216
|
+
</li>
|
|
217
|
+
</ul>
|
|
218
|
+
<p v-else-if="workspaces.length" class="text-muted px-2 py-1.5 text-sm">
|
|
219
|
+
{{ $t("saas.workspaces.no_results") }}
|
|
220
|
+
</p>
|
|
221
|
+
<USeparator v-if="workspaces.length" />
|
|
222
|
+
<UButton
|
|
223
|
+
v-if="canCreateWorkspace"
|
|
224
|
+
variant="ghost"
|
|
225
|
+
color="neutral"
|
|
226
|
+
icon="i-ph-plus"
|
|
227
|
+
size="sm"
|
|
228
|
+
block
|
|
229
|
+
class="justify-start"
|
|
230
|
+
@click="openCreateModal"
|
|
231
|
+
>
|
|
232
|
+
{{ $t("saas.workspaces.create.button") }}
|
|
233
|
+
</UButton>
|
|
234
|
+
</div>
|
|
235
|
+
</template>
|
|
236
|
+
</UPopover>
|
|
237
|
+
|
|
238
|
+
<UModal
|
|
239
|
+
v-model:open="isCreateOpen"
|
|
240
|
+
:title="$t('saas.workspaces.create.title')"
|
|
241
|
+
:description="$t('saas.workspaces.create.self_serve.description')"
|
|
242
|
+
>
|
|
243
|
+
<template #body>
|
|
244
|
+
<DmsSaasWorkspaceCreateModal :on-success-callback="onWorkspaceCreated" />
|
|
245
|
+
</template>
|
|
246
|
+
</UModal>
|
|
247
|
+
</template>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolves an unknown error thrown by `$authFetch` into a human-readable,
|
|
3
|
+
* translated message.
|
|
4
|
+
*
|
|
5
|
+
* The backend signals failures with `assert(cond, status, "i18n.key")`, which
|
|
6
|
+
* serializes the i18n key as the response body. ofetch exposes that body on
|
|
7
|
+
* `error.data` (a string, or `{ message }` for some handlers), while
|
|
8
|
+
* `error.message` only holds the generic "POST <url> 409" text — never show
|
|
9
|
+
* that to the user. We translate the server key when it exists, otherwise fall
|
|
10
|
+
* back to a caller-provided generic key.
|
|
11
|
+
*/
|
|
12
|
+
export function useApiErrorMessage() {
|
|
13
|
+
const nuxtApp = useDmsApp();
|
|
14
|
+
|
|
15
|
+
function extractServerKey(error: unknown): string | undefined {
|
|
16
|
+
const data = (error as { data?: unknown } | undefined)?.data;
|
|
17
|
+
if (typeof data === "string") return data;
|
|
18
|
+
const message = (data as { message?: unknown } | undefined)?.message;
|
|
19
|
+
return typeof message === "string" ? message : undefined;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** Translated server message, or `undefined` when the server sent no usable key. */
|
|
23
|
+
function resolveServerMessage(error: unknown): string | undefined {
|
|
24
|
+
const { t, te } = nuxtApp.$i18n;
|
|
25
|
+
const key = extractServerKey(error);
|
|
26
|
+
return key && te(key) ? t(key) : undefined;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** Translated server message, or the caller's generic fallback key. */
|
|
30
|
+
function resolveApiError(error: unknown, fallbackKey: string): string {
|
|
31
|
+
return resolveServerMessage(error) ?? nuxtApp.$i18n.t(fallbackKey);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return { resolveApiError, resolveServerMessage };
|
|
35
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export interface BillingCountryItem {
|
|
2
|
+
value: string;
|
|
3
|
+
label: string;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export interface BillingCountries {
|
|
7
|
+
countryItems: BillingCountryItem[];
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const BILLING_COUNTRY_CODES = [
|
|
11
|
+
"AT",
|
|
12
|
+
"BE",
|
|
13
|
+
"BG",
|
|
14
|
+
"HR",
|
|
15
|
+
"CY",
|
|
16
|
+
"CZ",
|
|
17
|
+
"DK",
|
|
18
|
+
"EE",
|
|
19
|
+
"FI",
|
|
20
|
+
"FR",
|
|
21
|
+
"DE",
|
|
22
|
+
"GR",
|
|
23
|
+
"HU",
|
|
24
|
+
"IE",
|
|
25
|
+
"IT",
|
|
26
|
+
"LV",
|
|
27
|
+
"LT",
|
|
28
|
+
"LU",
|
|
29
|
+
"MT",
|
|
30
|
+
"NL",
|
|
31
|
+
"PL",
|
|
32
|
+
"PT",
|
|
33
|
+
"RO",
|
|
34
|
+
"SK",
|
|
35
|
+
"SI",
|
|
36
|
+
"ES",
|
|
37
|
+
"SE",
|
|
38
|
+
"GB",
|
|
39
|
+
"CH",
|
|
40
|
+
"NO",
|
|
41
|
+
"US",
|
|
42
|
+
"CA",
|
|
43
|
+
"AU",
|
|
44
|
+
"NZ",
|
|
45
|
+
];
|
|
46
|
+
|
|
47
|
+
export function useBillingCountries(): BillingCountries {
|
|
48
|
+
return {
|
|
49
|
+
countryItems: BILLING_COUNTRY_CODES.map((code) => ({
|
|
50
|
+
value: code,
|
|
51
|
+
label: code,
|
|
52
|
+
})),
|
|
53
|
+
};
|
|
54
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
const CREDIT_NOTE_TYPE = "credit_note";
|
|
2
|
+
|
|
3
|
+
/** Resolves the translation key for current and pre-discriminant invoice rows. */
|
|
4
|
+
export function billingDocumentTypeKey(value: unknown): string {
|
|
5
|
+
const type = value === CREDIT_NOTE_TYPE ? CREDIT_NOTE_TYPE : "invoice";
|
|
6
|
+
return `saas.invoices.type.${type}`;
|
|
7
|
+
}
|