@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
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.totalsByCurrency = totalsByCurrency;
|
|
4
|
+
exports.computeInvoiceStats = computeInvoiceStats;
|
|
5
|
+
exports.computeCreditNoteStats = computeCreditNoteStats;
|
|
6
|
+
exports.startOfMonth = startOfMonth;
|
|
7
|
+
exports.startOfYear = startOfYear;
|
|
8
|
+
const composed_text_1 = require("../i18n/composed-text");
|
|
9
|
+
const credit_note_request_1 = require("./credit-note-request");
|
|
10
|
+
const STATS = "saas.operator_billing.stats";
|
|
11
|
+
const FALLBACK_STAT_CURRENCY = "eur";
|
|
12
|
+
const ISSUED_STATUS = "issued";
|
|
13
|
+
const VOID_STATUS = "void";
|
|
14
|
+
const BALANCE_TYPE = "credit_to_balance";
|
|
15
|
+
function totalsByCurrency(rows) {
|
|
16
|
+
const totals = new Map();
|
|
17
|
+
for (const { amount, currency } of rows) {
|
|
18
|
+
const key = currency.toLowerCase();
|
|
19
|
+
totals.set(key, (totals.get(key) ?? 0) + amount);
|
|
20
|
+
}
|
|
21
|
+
if (totals.size === 0) {
|
|
22
|
+
return [{ amount: 0, currency: FALLBACK_STAT_CURRENCY }];
|
|
23
|
+
}
|
|
24
|
+
return [...totals]
|
|
25
|
+
.map(([currency, amount]) => ({ amount, currency }))
|
|
26
|
+
.sort((left, right) => right.amount - left.amount);
|
|
27
|
+
}
|
|
28
|
+
function moneyFigures(figures) {
|
|
29
|
+
const amounts = figures.map((figure) => (0, composed_text_1.moneyParam)(figure.amount, figure.currency));
|
|
30
|
+
return amounts.length === 1 ? amounts[0] : (0, composed_text_1.sumList)(amounts);
|
|
31
|
+
}
|
|
32
|
+
function detailOf(figure) {
|
|
33
|
+
if (typeof figure.value === "number" || figure.value.length < 2)
|
|
34
|
+
return figure.detail;
|
|
35
|
+
return (0, composed_text_1.composed)(`${STATS}.other_currencies`, {
|
|
36
|
+
amounts: moneyFigures(figure.value.slice(1)),
|
|
37
|
+
detail: figure.detail,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
function toStatItem(figure) {
|
|
41
|
+
return {
|
|
42
|
+
id: figure.id,
|
|
43
|
+
icon: figure.icon,
|
|
44
|
+
tone: figure.tone,
|
|
45
|
+
eyebrow: `$${STATS}.${figure.eyebrow}`,
|
|
46
|
+
value: typeof figure.value === "number"
|
|
47
|
+
? figure.value
|
|
48
|
+
: (0, composed_text_1.valueText)(moneyFigures(figure.value.slice(0, 1))),
|
|
49
|
+
detail: detailOf(figure),
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
const issued = (notes) => notes.filter((note) => note.status === ISSUED_STATUS);
|
|
53
|
+
const refunded = (notes) => issued(notes).filter((note) => !!note.refundId);
|
|
54
|
+
const isAutomatic = (note) => !note.metadata?.[credit_note_request_1.CREDIT_NOTE_METADATA.issuedBy];
|
|
55
|
+
function amountDue(row) {
|
|
56
|
+
return {
|
|
57
|
+
amount: Math.max(0, row.amount - row.amountPaid),
|
|
58
|
+
currency: row.currency,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function collected(row) {
|
|
62
|
+
return { amount: row.amountPaid, currency: row.currency };
|
|
63
|
+
}
|
|
64
|
+
function awaitingPayment(open) {
|
|
65
|
+
return {
|
|
66
|
+
id: "awaiting",
|
|
67
|
+
icon: "i-ph-hourglass-medium",
|
|
68
|
+
tone: "warning",
|
|
69
|
+
eyebrow: "awaiting_payment",
|
|
70
|
+
value: totalsByCurrency(open.map(amountDue)),
|
|
71
|
+
detail: {
|
|
72
|
+
key: `${STATS}.awaiting_payment_detail`,
|
|
73
|
+
params: {
|
|
74
|
+
count: (0, composed_text_1.countParam)(open.length),
|
|
75
|
+
retries: open.filter((row) => !!row.nextPaymentAttemptAt).length,
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
function collectedThisMonth(paid) {
|
|
81
|
+
return {
|
|
82
|
+
id: "collected",
|
|
83
|
+
icon: "i-ph-check-circle",
|
|
84
|
+
tone: "success",
|
|
85
|
+
eyebrow: "collected_this_month",
|
|
86
|
+
value: totalsByCurrency(paid.map(collected)),
|
|
87
|
+
detail: {
|
|
88
|
+
key: `${STATS}.collected_this_month_detail`,
|
|
89
|
+
params: { count: (0, composed_text_1.countParam)(paid.length) },
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
function creditedThisMonth(notes) {
|
|
94
|
+
const issuedNotes = issued(notes);
|
|
95
|
+
return {
|
|
96
|
+
id: "credited",
|
|
97
|
+
icon: "i-ph-receipt-x",
|
|
98
|
+
tone: "primary",
|
|
99
|
+
eyebrow: "credited_this_month",
|
|
100
|
+
value: totalsByCurrency(issuedNotes),
|
|
101
|
+
detail: {
|
|
102
|
+
key: `${STATS}.credited_this_month_detail`,
|
|
103
|
+
params: {
|
|
104
|
+
count: (0, composed_text_1.countParam)(issuedNotes.length),
|
|
105
|
+
refunded: moneyFigures(totalsByCurrency(refunded(notes))),
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
function writtenOffThisYear(rows) {
|
|
111
|
+
return {
|
|
112
|
+
id: "written_off",
|
|
113
|
+
icon: "i-ph-prohibit",
|
|
114
|
+
tone: "error",
|
|
115
|
+
eyebrow: "written_off_this_year",
|
|
116
|
+
value: totalsByCurrency(rows),
|
|
117
|
+
detail: {
|
|
118
|
+
key: `${STATS}.written_off_this_year_detail`,
|
|
119
|
+
params: { count: (0, composed_text_1.countParam)(rows.length) },
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
function computeInvoiceStats(input) {
|
|
124
|
+
return {
|
|
125
|
+
items: [
|
|
126
|
+
awaitingPayment(input.open),
|
|
127
|
+
collectedThisMonth(input.paidThisMonth),
|
|
128
|
+
creditedThisMonth(input.creditNotesThisMonth),
|
|
129
|
+
writtenOffThisYear(input.writtenOffThisYear),
|
|
130
|
+
].map(toStatItem),
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
function creditSplit(notes) {
|
|
134
|
+
const issuedNotes = issued(notes);
|
|
135
|
+
return {
|
|
136
|
+
id: "credited",
|
|
137
|
+
icon: "i-ph-receipt-x",
|
|
138
|
+
tone: "primary",
|
|
139
|
+
eyebrow: "credited_this_month",
|
|
140
|
+
value: totalsByCurrency(issuedNotes),
|
|
141
|
+
detail: {
|
|
142
|
+
key: `${STATS}.credit_split_detail`,
|
|
143
|
+
params: {
|
|
144
|
+
balance: moneyFigures(totalsByCurrency(issuedNotes.filter((note) => note.type === BALANCE_TYPE))),
|
|
145
|
+
refunded: moneyFigures(totalsByCurrency(refunded(notes))),
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
function refundedToCards(notes) {
|
|
151
|
+
const refunds = refunded(notes);
|
|
152
|
+
return {
|
|
153
|
+
id: "refunded",
|
|
154
|
+
icon: "i-ph-credit-card",
|
|
155
|
+
tone: "neutral",
|
|
156
|
+
eyebrow: "refunded_to_cards",
|
|
157
|
+
value: totalsByCurrency(refunds),
|
|
158
|
+
detail: {
|
|
159
|
+
key: `${STATS}.refunded_to_cards_detail`,
|
|
160
|
+
params: {
|
|
161
|
+
count: (0, composed_text_1.countParam)(refunds.length),
|
|
162
|
+
automatic: refunds.filter(isAutomatic).length,
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
function creditNoteCount(notes) {
|
|
168
|
+
return {
|
|
169
|
+
id: "count",
|
|
170
|
+
icon: "i-ph-files",
|
|
171
|
+
tone: "neutral",
|
|
172
|
+
eyebrow: "credit_notes_this_month",
|
|
173
|
+
value: notes.length,
|
|
174
|
+
detail: {
|
|
175
|
+
key: `${STATS}.credit_notes_this_month_detail`,
|
|
176
|
+
params: {
|
|
177
|
+
void: notes.filter((note) => note.status === VOID_STATUS).length,
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
function computeCreditNoteStats(notes) {
|
|
183
|
+
return {
|
|
184
|
+
items: [
|
|
185
|
+
creditSplit(notes),
|
|
186
|
+
refundedToCards(notes),
|
|
187
|
+
creditNoteCount(notes),
|
|
188
|
+
].map(toStatItem),
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
function startOfMonth(now) {
|
|
192
|
+
return new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), 1));
|
|
193
|
+
}
|
|
194
|
+
function startOfYear(now) {
|
|
195
|
+
return new Date(Date.UTC(now.getUTCFullYear(), 0, 1));
|
|
196
|
+
}
|
|
197
|
+
//# sourceMappingURL=billing-stats.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing-stats.js","sourceRoot":"","sources":["../../src/operator-billing/billing-stats.ts"],"names":[],"mappings":";;AAuFA,4CAYC;AA0HD,kDASC;AAgED,wDAUC;AAGD,oCAEC;AAGD,kCAEC;AApTD,yDAM+B;AAC/B,+DAA6D;AA2B7D,MAAM,KAAK,GAAG,6BAA6B,CAAC;AAG5C,MAAM,sBAAsB,GAAG,KAAK,CAAC;AAErC,MAAM,aAAa,GAAG,QAAQ,CAAC;AAC/B,MAAM,WAAW,GAAG,MAAM,CAAC;AAC3B,MAAM,YAAY,GAAG,mBAAmB,CAAC;AAwCzC,SAAgB,gBAAgB,CAAC,IAAyB;IACxD,MAAM,MAAM,GAAG,IAAI,GAAG,EAAkB,CAAC;IACzC,KAAK,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,IAAI,EAAE,CAAC;QACxC,MAAM,GAAG,GAAG,QAAQ,CAAC,WA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AO;QACL,KAAK,EAAE;YACL,WAAW,CAAC,KAAK,CAAC;YAClB,eAAe,CAAC,KAAK,CAAC;YACtB,eAAe,CAAC,KAAK,CAAC;SACvB,CAAC,GAAG,CAAC,UAAU,CAAC;KAClB,CAAC;AACJ,CAAC;AAGD,SAAgB,YAAY,CAAC,GAAS;IACpC,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,cAAc,EAAE,EAAE,GAAG,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;AACxE,CAAC;AAGD,SAAgB,WAAW,CAAC,GAAS;IACnC,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,cAAc,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AACxD,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { CreditNote, InvoiceStatus } from "../db";
|
|
2
|
+
export declare const CREDIT_MODES: readonly ["credit_to_balance", "refund", "reduce_amount_due"];
|
|
3
|
+
export type CreditMode = (typeof CREDIT_MODES)[number];
|
|
4
|
+
export type CreditBlockReason = "draft" | "void" | "uncollectible" | "fully_credited";
|
|
5
|
+
export declare const CREDITABLE_INVOICE_STATUSES: InvoiceStatus[];
|
|
6
|
+
export interface CreditableInvoice {
|
|
7
|
+
status: string;
|
|
8
|
+
total: number;
|
|
9
|
+
}
|
|
10
|
+
export interface CreditAllowance {
|
|
11
|
+
credited: number;
|
|
12
|
+
creditable: number;
|
|
13
|
+
modes: readonly CreditMode[];
|
|
14
|
+
blockReason: CreditBlockReason | null;
|
|
15
|
+
}
|
|
16
|
+
export declare function sumIssuedCredits(creditNotes: readonly Pick<CreditNote, "amount" | "status">[]): number;
|
|
17
|
+
export declare function creditAllowance(invoice: CreditableInvoice, credited: number): CreditAllowance;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CREDITABLE_INVOICE_STATUSES = exports.CREDIT_MODES = void 0;
|
|
4
|
+
exports.sumIssuedCredits = sumIssuedCredits;
|
|
5
|
+
exports.creditAllowance = creditAllowance;
|
|
6
|
+
exports.CREDIT_MODES = [
|
|
7
|
+
"credit_to_balance",
|
|
8
|
+
"refund",
|
|
9
|
+
"reduce_amount_due",
|
|
10
|
+
];
|
|
11
|
+
const MODES_BY_STATUS = {
|
|
12
|
+
paid: ["credit_to_balance", "refund"],
|
|
13
|
+
open: ["reduce_amount_due"],
|
|
14
|
+
};
|
|
15
|
+
const BLOCK_REASON_BY_STATUS = {
|
|
16
|
+
draft: "draft",
|
|
17
|
+
void: "void",
|
|
18
|
+
uncollectible: "uncollectible",
|
|
19
|
+
};
|
|
20
|
+
const ISSUED_CREDIT_NOTE_STATUS = "issued";
|
|
21
|
+
exports.CREDITABLE_INVOICE_STATUSES = Object.keys(MODES_BY_STATUS);
|
|
22
|
+
function sumIssuedCredits(creditNotes) {
|
|
23
|
+
return creditNotes
|
|
24
|
+
.filter((note) => note.status === ISSUED_CREDIT_NOTE_STATUS)
|
|
25
|
+
.reduce((total, note) => total + note.amount, 0);
|
|
26
|
+
}
|
|
27
|
+
function creditAllowance(invoice, credited) {
|
|
28
|
+
const creditable = Math.max(0, invoice.total - credited);
|
|
29
|
+
const statusModes = MODES_BY_STATUS[invoice.status] ?? [];
|
|
30
|
+
const blockReason = resolveBlockReason(invoice.status, creditable);
|
|
31
|
+
return {
|
|
32
|
+
credited,
|
|
33
|
+
creditable: blockReason ? 0 : creditable,
|
|
34
|
+
modes: blockReason ? [] : statusModes,
|
|
35
|
+
blockReason,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function resolveBlockReason(status, creditable) {
|
|
39
|
+
if (!MODES_BY_STATUS[status]) {
|
|
40
|
+
return BLOCK_REASON_BY_STATUS[status] ?? "void";
|
|
41
|
+
}
|
|
42
|
+
return creditable > 0 ? null : "fully_credited";
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=credit-allowance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credit-allowance.js","sourceRoot":"","sources":["../../src/operator-billing/credit-allowance.ts"],"names":[],"mappings":";;;AA0DA,4CAMC;AASD,0CAaC;AA/EY,QAAA,YAAY,GAAG;IAC1B,mBAAmB;IACnB,QAAQ;IACR,mBAAmB;CACX,CAAC;AAWX,MAAM,eAAe,GAA0D;IAC7E,IAAI,EAAE,CAAC,mBAAmB,EAAE,QAAQ,CAAC;IACrC,IAAI,EAAE,CAAC,mBAAmB,CAAC;CAC5B,CAAC;AAEF,MAAM,sBAAsB,GAAsC;IAChE,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;IACZ,aAAa,EAAE,eAAe;CAC/B,CAAC;AAEF,MAAM,yBAAyB,GAAG,QAAQ,CAAC;AAG9B,QAAA,2BAA2B,GAAG,MAAM,CAAC,IAAI,CACpD,eAAe,CACG,CAAC;AAoBrB,SAAgB,gBAAgB,CAC9B,WAA6D;IAE7D,OAAO,WAAW;SACf,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,KAAK,yBAAyB,CAAC;SAC3D,MAAM,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;AACrD,CAAC;AASD,SAAgB,eAAe,CAC7B,OAA0B,EAC1B,QAAgB;IAEhB,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,KAAK,GAAG,QAAQ,CAAC,CAAC;IACzD,MAAM,WAAW,GAAG,eAAe,CAAC,OAAO,CAAC,MAAuB,CAAC,IAAI,EAAE,CAAC;IAC3E,MAAM,WAAW,GAAG,kBAAkB,CAAC,OAAO,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACnE,OAAO;QACL,QAAQ;QACR,UAAU,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU;QACxC,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW;QACrC,WAAW;KACZ,CAAC;AACJ,CAAC;AAED,SAAS,kBAAkB,CACzB,MAAc,EACd,UAAkB;IAElB,IAAI,CAAC,eAAe,CAAC,MAAuB,CAAC,EAAE,CAAC;QAC9C,OAAO,sBAAsB,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC;IAClD,CAAC;IACD,OAAO,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,gBAAgB,CAAC;AAClD,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type Stripe from "stripe";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
export declare const CREDIT_REASONS: readonly ["service_issue", "billing_error", "duplicate", "goodwill", "fraudulent", "other"];
|
|
4
|
+
export type CreditReason = (typeof CREDIT_REASONS)[number];
|
|
5
|
+
export declare const CREDIT_NOTE_METADATA: {
|
|
6
|
+
readonly issuedBy: "saas_issued_by";
|
|
7
|
+
readonly issuedByName: "saas_issued_by_name";
|
|
8
|
+
readonly reason: "saas_reason";
|
|
9
|
+
readonly internalMemo: "saas_internal_memo";
|
|
10
|
+
};
|
|
11
|
+
export declare const issueCreditNoteBodySchema: z.ZodObject<{
|
|
12
|
+
invoiceId: z.ZodString;
|
|
13
|
+
amount: z.ZodNumber;
|
|
14
|
+
mode: z.ZodEnum<["credit_to_balance", "refund", "reduce_amount_due"]>;
|
|
15
|
+
reason: z.ZodEnum<["service_issue", "billing_error", "duplicate", "goodwill", "fraudulent", "other"]>;
|
|
16
|
+
memo: z.ZodOptional<z.ZodString>;
|
|
17
|
+
requestId: z.ZodString;
|
|
18
|
+
}, "strip", z.ZodTypeAny, {
|
|
19
|
+
mode: "credit_to_balance" | "refund" | "reduce_amount_due";
|
|
20
|
+
reason: "duplicate" | "other" | "fraudulent" | "service_issue" | "billing_error" | "goodwill";
|
|
21
|
+
invoiceId: string;
|
|
22
|
+
amount: number;
|
|
23
|
+
requestId: string;
|
|
24
|
+
memo?: string | undefined;
|
|
25
|
+
}, {
|
|
26
|
+
mode: "credit_to_balance" | "refund" | "reduce_amount_due";
|
|
27
|
+
reason: "duplicate" | "other" | "fraudulent" | "service_issue" | "billing_error" | "goodwill";
|
|
28
|
+
invoiceId: string;
|
|
29
|
+
amount: number;
|
|
30
|
+
requestId: string;
|
|
31
|
+
memo?: string | undefined;
|
|
32
|
+
}>;
|
|
33
|
+
export type IssueCreditNoteBody = z.infer<typeof issueCreditNoteBodySchema>;
|
|
34
|
+
export interface CreditNoteIssuer {
|
|
35
|
+
_id: string;
|
|
36
|
+
name?: string | null;
|
|
37
|
+
email?: string | null;
|
|
38
|
+
}
|
|
39
|
+
export declare function buildCreditNoteParams(stripeInvoiceId: string, body: IssueCreditNoteBody, issuer: CreditNoteIssuer): Stripe.CreditNoteCreateParams;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.issueCreditNoteBodySchema = exports.CREDIT_NOTE_METADATA = exports.CREDIT_REASONS = void 0;
|
|
4
|
+
exports.buildCreditNoteParams = buildCreditNoteParams;
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const credit_allowance_1 = require("./credit-allowance");
|
|
7
|
+
exports.CREDIT_REASONS = [
|
|
8
|
+
"service_issue",
|
|
9
|
+
"billing_error",
|
|
10
|
+
"duplicate",
|
|
11
|
+
"goodwill",
|
|
12
|
+
"fraudulent",
|
|
13
|
+
"other",
|
|
14
|
+
];
|
|
15
|
+
exports.CREDIT_NOTE_METADATA = {
|
|
16
|
+
issuedBy: "saas_issued_by",
|
|
17
|
+
issuedByName: "saas_issued_by_name",
|
|
18
|
+
reason: "saas_reason",
|
|
19
|
+
internalMemo: "saas_internal_memo",
|
|
20
|
+
};
|
|
21
|
+
const INTERNAL_MEMO_MAX_LENGTH = 500;
|
|
22
|
+
const STRIPE_REASON = {
|
|
23
|
+
service_issue: "product_unsatisfactory",
|
|
24
|
+
billing_error: "order_change",
|
|
25
|
+
duplicate: "duplicate",
|
|
26
|
+
fraudulent: "fraudulent",
|
|
27
|
+
};
|
|
28
|
+
const AMOUNT_FIELD_BY_MODE = {
|
|
29
|
+
credit_to_balance: "credit_amount",
|
|
30
|
+
refund: "refund_amount",
|
|
31
|
+
};
|
|
32
|
+
exports.issueCreditNoteBodySchema = zod_1.z.object({
|
|
33
|
+
invoiceId: zod_1.z.string().min(1),
|
|
34
|
+
amount: zod_1.z
|
|
35
|
+
.number()
|
|
36
|
+
.int()
|
|
37
|
+
.positive({ message: "$saas.errors.credit_note.amount_positive" }),
|
|
38
|
+
mode: zod_1.z.enum(credit_allowance_1.CREDIT_MODES),
|
|
39
|
+
reason: zod_1.z.enum(exports.CREDIT_REASONS),
|
|
40
|
+
memo: zod_1.z
|
|
41
|
+
.string()
|
|
42
|
+
.trim()
|
|
43
|
+
.max(INTERNAL_MEMO_MAX_LENGTH, {
|
|
44
|
+
message: "$saas.errors.credit_note.memo_too_long",
|
|
45
|
+
})
|
|
46
|
+
.optional(),
|
|
47
|
+
requestId: zod_1.z.string().min(1).max(100),
|
|
48
|
+
});
|
|
49
|
+
function buildMetadata(body, issuer) {
|
|
50
|
+
const metadata = {
|
|
51
|
+
[exports.CREDIT_NOTE_METADATA.issuedBy]: issuer._id,
|
|
52
|
+
[exports.CREDIT_NOTE_METADATA.issuedByName]: issuer.name || issuer.email || "",
|
|
53
|
+
[exports.CREDIT_NOTE_METADATA.reason]: body.reason,
|
|
54
|
+
};
|
|
55
|
+
if (body.memo)
|
|
56
|
+
metadata[exports.CREDIT_NOTE_METADATA.internalMemo] = body.memo;
|
|
57
|
+
return metadata;
|
|
58
|
+
}
|
|
59
|
+
function buildCreditNoteParams(stripeInvoiceId, body, issuer) {
|
|
60
|
+
const params = {
|
|
61
|
+
invoice: stripeInvoiceId,
|
|
62
|
+
amount: body.amount,
|
|
63
|
+
metadata: buildMetadata(body, issuer),
|
|
64
|
+
};
|
|
65
|
+
const reason = STRIPE_REASON[body.reason];
|
|
66
|
+
if (reason)
|
|
67
|
+
params.reason = reason;
|
|
68
|
+
const amountField = AMOUNT_FIELD_BY_MODE[body.mode];
|
|
69
|
+
if (amountField)
|
|
70
|
+
params[amountField] = body.amount;
|
|
71
|
+
return params;
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=credit-note-request.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credit-note-request.js","sourceRoot":"","sources":["../../src/operator-billing/credit-note-request.ts"],"names":[],"mappings":";;;AAiGA,sDAeC;AA/GD,6BAAwB;AACxB,yDAAmE;AAGtD,QAAA,cAAc,GAAG;IAC5B,eAAe;IACf,eAAe;IACf,WAAW;IACX,UAAU;IACV,YAAY;IACZ,OAAO;CACC,CAAC;AASE,QAAA,oBAAoB,GAAG;IAClC,QAAQ,EAAE,gBAAgB;IAC1B,YAAY,EAAE,qBAAqB;IACnC,MAAM,EAAE,aAAa;IACrB,YAAY,EAAE,oBAAoB;CAC1B,CAAC;AAGX,MAAM,wBAAwB,GAAG,GAAG,CAAC;AAErC,MAAM,aAAa,GAEf;IACF,aAAa,EAAE,wBAAwB;IACvC,aAAa,EAAE,cAAc;IAC7B,SAAS,EAAE,WAAW;IACtB,UAAU,EAAE,YAAY;CACzB,CAAC;AAEF,MAAM,oBAAoB,GAEtB;IACF,iBAAiB,EAAE,eAAe;IAClC,MAAM,EAAE,eAAe;CACxB,CAAC;AAGW,QAAA,yBAAyB,GAAG,OAAC,CAAC,MAAM,CAAC;IAChD,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5B,MAAM,EAAE,OAAC;SACN,MAAM,EAAE;SACR,GAAG,EAAE;SACL,QAAQ,CAAC,EAAE,O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BAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpD,IAAI,WAAW;QAAE,MAAM,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;IACnD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from "./billing-rules";
|
|
2
|
+
export * from "./billing-settings-store";
|
|
3
|
+
export * from "./billing-stats";
|
|
4
|
+
export * from "./credit-allowance";
|
|
5
|
+
export * from "./credit-note-request";
|
|
6
|
+
export * from "./invoice-credit";
|
|
7
|
+
export * from "./legal-documents-store";
|
|
8
|
+
export * from "./legal-versions";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./billing-rules"), exports);
|
|
18
|
+
__exportStar(require("./billing-settings-store"), exports);
|
|
19
|
+
__exportStar(require("./billing-stats"), exports);
|
|
20
|
+
__exportStar(require("./credit-allowance"), exports);
|
|
21
|
+
__exportStar(require("./credit-note-request"), exports);
|
|
22
|
+
__exportStar(require("./invoice-credit"), exports);
|
|
23
|
+
__exportStar(require("./legal-documents-store"), exports);
|
|
24
|
+
__exportStar(require("./legal-versions"), exports);
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/operator-billing/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,2DAAyC;AACzC,kDAAgC;AAChC,qDAAmC;AACnC,wDAAsC;AACtC,mDAAiC;AACjC,0DAAwC;AACxC,mDAAiC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type Stripe from "stripe";
|
|
2
|
+
import { type CreditNote, type Invoice, type InvoiceLine, type InvoiceModel } from "../db";
|
|
3
|
+
import { type PaymentMethodSummary } from "../billing-state/recovery";
|
|
4
|
+
import { type CreditAllowance } from "./credit-allowance";
|
|
5
|
+
export interface PriorCredit {
|
|
6
|
+
number: string;
|
|
7
|
+
amount: number;
|
|
8
|
+
currency: string;
|
|
9
|
+
type: string;
|
|
10
|
+
status: string;
|
|
11
|
+
issuedAt: Date;
|
|
12
|
+
}
|
|
13
|
+
export interface CreditNotePreview extends CreditAllowance {
|
|
14
|
+
invoice: {
|
|
15
|
+
_id: string;
|
|
16
|
+
number: string | null;
|
|
17
|
+
status: string;
|
|
18
|
+
currency: string;
|
|
19
|
+
total: number;
|
|
20
|
+
tax: number;
|
|
21
|
+
amountPaid: number;
|
|
22
|
+
paidAt: Date | null;
|
|
23
|
+
autoFinalizesAt: Date | null;
|
|
24
|
+
lines: InvoiceLine[];
|
|
25
|
+
};
|
|
26
|
+
workspaceName: string;
|
|
27
|
+
priorCredits: PriorCredit[];
|
|
28
|
+
card: PaymentMethodSummary | null;
|
|
29
|
+
nextInvoiceAt: Date | null;
|
|
30
|
+
}
|
|
31
|
+
export interface LoadedInvoice {
|
|
32
|
+
invoice: Invoice;
|
|
33
|
+
tenantId: string;
|
|
34
|
+
}
|
|
35
|
+
export declare function loadInvoice(invoiceModel: InvoiceModel, invoiceId: string): Promise<LoadedInvoice>;
|
|
36
|
+
export declare function resolveCreditAllowance(loaded: LoadedInvoice): Promise<{
|
|
37
|
+
allowance: CreditAllowance;
|
|
38
|
+
priorNotes: CreditNote[];
|
|
39
|
+
stripeInvoice: Stripe.Invoice;
|
|
40
|
+
}>;
|
|
41
|
+
export declare function buildCreditNotePreview(loaded: LoadedInvoice): Promise<CreditNotePreview>;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.loadInvoice = loadInvoice;
|
|
4
|
+
exports.resolveCreditAllowance = resolveCreditAllowance;
|
|
5
|
+
exports.buildCreditNotePreview = buildCreditNotePreview;
|
|
6
|
+
const interface_api_util_1 = require("@antelopejs/interface-api-util");
|
|
7
|
+
const interface_database_decorators_1 = require("@antelopejs/interface-database-decorators");
|
|
8
|
+
const db_1 = require("@antelopejs/interface-dms/db");
|
|
9
|
+
const db_2 = require("../db");
|
|
10
|
+
const recovery_1 = require("../billing-state/recovery");
|
|
11
|
+
const client_1 = require("../stripe/client");
|
|
12
|
+
const webhook_shared_1 = require("../stripe/webhook-shared");
|
|
13
|
+
const utils_1 = require("../utils");
|
|
14
|
+
const credit_allowance_1 = require("./credit-allowance");
|
|
15
|
+
const HTTP_NOT_FOUND = 404;
|
|
16
|
+
const INVOICE_DOCUMENT_TYPE = "invoice";
|
|
17
|
+
const PAYMENT_INTENT_EXPANSION = "payments.data.payment.payment_intent";
|
|
18
|
+
async function loadInvoice(invoiceModel, invoiceId) {
|
|
19
|
+
const invoice = await invoiceModel.get(invoiceId);
|
|
20
|
+
(0, interface_api_util_1.assert)(invoice?.documentType === INVOICE_DOCUMENT_TYPE, HTTP_NOT_FOUND, "saas.errors.invoice.not_found");
|
|
21
|
+
return { invoice, tenantId: (0, utils_1.getRowInstance)(invoice) };
|
|
22
|
+
}
|
|
23
|
+
function toPriorCredit(note) {
|
|
24
|
+
return {
|
|
25
|
+
number: note.number,
|
|
26
|
+
amount: note.amount,
|
|
27
|
+
currency: note.currency,
|
|
28
|
+
type: note.type,
|
|
29
|
+
status: note.status,
|
|
30
|
+
issuedAt: note.issuedAt,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
async function readStripeInvoice(stripeInvoiceId) {
|
|
34
|
+
return (0, client_1.getStripeClient)().invoices.retrieve(stripeInvoiceId, {
|
|
35
|
+
expand: [PAYMENT_INTENT_EXPANSION],
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
function creditedAmount(priorNotes, stripeInvoice) {
|
|
39
|
+
const fromStripe = (stripeInvoice.pre_payment_credit_notes_amount ?? 0) +
|
|
40
|
+
(stripeInvoice.post_payment_credit_notes_amount ?? 0);
|
|
41
|
+
return Math.max((0, credit_allowance_1.sumIssuedCredits)(priorNotes), fromStripe);
|
|
42
|
+
}
|
|
43
|
+
async function resolveCreditAllowance(loaded) {
|
|
44
|
+
const { invoice, tenantId } = loaded;
|
|
45
|
+
const [priorNotes, stripeInvoice] = await Promise.all([
|
|
46
|
+
(0, interface_database_decorators_1.GetModel)(db_2.CreditNoteModel, tenantId).findByInvoice(invoice._id),
|
|
47
|
+
readStripeInvoice(invoice.stripeInvoiceId),
|
|
48
|
+
]);
|
|
49
|
+
const status = stripeInvoice.status ?? invoice.status;
|
|
50
|
+
const allowance = (0, credit_allowance_1.creditAllowance)({ status, total: stripeInvoice.total ?? invoice.total }, creditedAmount(priorNotes, stripeInvoice));
|
|
51
|
+
return { allowance, priorNotes, stripeInvoice };
|
|
52
|
+
}
|
|
53
|
+
function paidWith(stripeInvoice) {
|
|
54
|
+
const payment = stripeInvoice.payments?.data.find((entry) => typeof entry.payment.payment_intent === "object")?.payment.payment_intent;
|
|
55
|
+
return payment?.payment_method ?? null;
|
|
56
|
+
}
|
|
57
|
+
async function paymentCard(stripeInvoice) {
|
|
58
|
+
const method = paidWith(stripeInvoice);
|
|
59
|
+
if (!method)
|
|
60
|
+
return null;
|
|
61
|
+
if (typeof method !== "string")
|
|
62
|
+
return (0, recovery_1.toCardSummary)(method);
|
|
63
|
+
const retrieved = await (0, client_1.getStripeClient)()
|
|
64
|
+
.paymentMethods.retrieve(method)
|
|
65
|
+
.catch(() => null);
|
|
66
|
+
return (0, recovery_1.toCardSummary)(retrieved);
|
|
67
|
+
}
|
|
68
|
+
async function resolveCard(stripeInvoice) {
|
|
69
|
+
const card = await paymentCard(stripeInvoice);
|
|
70
|
+
if (card)
|
|
71
|
+
return card;
|
|
72
|
+
const customerId = (0, webhook_shared_1.asCustomerId)(stripeInvoice.customer);
|
|
73
|
+
return customerId ? (0, recovery_1.fetchDefaultPaymentMethod)(customerId) : null;
|
|
74
|
+
}
|
|
75
|
+
async function workspaceContext(tenantId) {
|
|
76
|
+
const [tenant, subscription] = await Promise.all([
|
|
77
|
+
(0, interface_database_decorators_1.GetModel)(db_1.TenantModel).get(tenantId),
|
|
78
|
+
(0, interface_database_decorators_1.GetModel)(db_2.TenantSubscriptionModel, tenantId).findOne(),
|
|
79
|
+
]);
|
|
80
|
+
return {
|
|
81
|
+
workspaceName: tenant?.name ?? "",
|
|
82
|
+
nextInvoiceAt: subscription?.currentPeriodEnd ?? null,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
async function buildCreditNotePreview(loaded) {
|
|
86
|
+
const { invoice, tenantId } = loaded;
|
|
87
|
+
const { allowance, priorNotes, stripeInvoice } = await resolveCreditAllowance(loaded);
|
|
88
|
+
const [card, context] = await Promise.all([
|
|
89
|
+
resolveCard(stripeInvoice),
|
|
90
|
+
workspaceContext(tenantId),
|
|
91
|
+
]);
|
|
92
|
+
return {
|
|
93
|
+
...allowance,
|
|
94
|
+
...context,
|
|
95
|
+
card,
|
|
96
|
+
priorCredits: priorNotes.map(toPriorCredit),
|
|
97
|
+
invoice: {
|
|
98
|
+
_id: invoice._id,
|
|
99
|
+
number: invoice.number,
|
|
100
|
+
status: stripeInvoice.status ?? invoice.status,
|
|
101
|
+
currency: invoice.currency,
|
|
102
|
+
total: invoice.total,
|
|
103
|
+
tax: invoice.tax,
|
|
104
|
+
amountPaid: stripeInvoice.amount_paid,
|
|
105
|
+
paidAt: invoice.paidAt,
|
|
106
|
+
autoFinalizesAt: invoice.autoFinalizesAt,
|
|
107
|
+
lines: invoice.lines ?? [],
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
//# sourceMappingURL=invoice-credit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invoice-credit.js","sourceRoot":"","sources":["../../src/operator-billing/invoice-credit.ts"],"names":[],"mappings":";;AA2EA,kCAWC;AAyCD,wDAgBC;AAkDD,wDA4BC;AA7ND,uEAAwD;AACxD,6FAAqE;AACrE,qDAA2D;AAE3D,8BAOe;AACf,wDAImC;AACnC,6CAAmD;AACnD,6DAAwD;AACxD,oCAA0C;AAC1C,yDAI4B;AAE5B,MAAM,cAAc,GAAG,GAAG,CAAC;AAC3B,MAAM,qBAAqB,GAAG,SAAS,CAAC;AAGxC,MAAM,wBAAwB,GAAG,sCAAsC,CAAC;AA6CjE,KAAK,UAAU,WAAW,CAC/B,YAA0B,EAC1B,SAAiB;IAEjB,MAAM,OAAO,GAAG,MAAM,YAAY,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAClD,IAAA,2BAAM,EACJ,OAAO,EAAE,YAAY,KAAK,qBAAqB,EAC/C,cAAc,EACd,+BAA+B,CAChC,CAAC;IACF,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAA,sBAAc,EAAC,OAAO,CAAC,EAAE,CAAC;AACxD,CAAC;AAED,SAAS,aAAa,CAAC,IAAgB;IACrC,OAAO;QACL,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,IAAI,EAAE,IAAI,CAAC,IAAI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
+
import { type LegalDocumentTexts } from "./legal-versions";
|
|
3
|
+
export interface PublishedLegalDocuments {
|
|
4
|
+
termsOfUse: string;
|
|
5
|
+
termsAndConditions: string;
|
|
6
|
+
privacyPolicy: string;
|
|
7
|
+
versions: LegalDocumentVersions;
|
|
8
|
+
updatedAt: Date | null;
|
|
9
|
+
}
|
|
10
|
+
export declare function ensureLegalDocumentsRow(model: LegalDocumentsModel): Promise<void>;
|
|
11
|
+
export declare function readLegalDocuments(model: LegalDocumentsModel): Promise<PublishedLegalDocuments>;
|
|
12
|
+
export declare function saveLegalDocuments(model: LegalDocumentsModel, texts: LegalDocumentTexts, now: Date): Promise<void>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ensureLegalDocumentsRow = ensureLegalDocumentsRow;
|
|
4
|
+
exports.readLegalDocuments = readLegalDocuments;
|
|
5
|
+
exports.saveLegalDocuments = saveLegalDocuments;
|
|
6
|
+
const db_1 = require("../db");
|
|
7
|
+
const legal_versions_1 = require("./legal-versions");
|
|
8
|
+
function emptyDocuments(now) {
|
|
9
|
+
return {
|
|
10
|
+
_id: db_1.LEGAL_DOCUMENTS_SINGLETON_ID,
|
|
11
|
+
termsOfUse: "",
|
|
12
|
+
termsAndConditions: "",
|
|
13
|
+
privacyPolicy: "",
|
|
14
|
+
versions: (0, legal_versions_1.readLegalDocumentVersions)(null),
|
|
15
|
+
updatedAt: now,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
async function ensureLegalDocumentsRow(model) {
|
|
19
|
+
const existing = await model.get(db_1.LEGAL_DOCUMENTS_SINGLETON_ID);
|
|
20
|
+
if (existing)
|
|
21
|
+
return;
|
|
22
|
+
await model.insert([emptyDocuments(new Date())]);
|
|
23
|
+
}
|
|
24
|
+
async function readLegalDocuments(model) {
|
|
25
|
+
const row = await model.get(db_1.LEGAL_DOCUMENTS_SINGLETON_ID);
|
|
26
|
+
return {
|
|
27
|
+
termsOfUse: row?.termsOfUse ?? "",
|
|
28
|
+
termsAndConditions: row?.termsAndConditions ?? "",
|
|
29
|
+
privacyPolicy: row?.privacyPolicy ?? "",
|
|
30
|
+
versions: (0, legal_versions_1.readLegalDocumentVersions)(row),
|
|
31
|
+
updatedAt: row?.updatedAt ?? null,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
async function saveLegalDocuments(model, texts, now) {
|
|
35
|
+
await ensureLegalDocumentsRow(model);
|
|
36
|
+
const row = await model.get(db_1.LEGAL_DOCUMENTS_SINGLETON_ID);
|
|
37
|
+
const changed = Object.fromEntries(Object.entries(texts).filter(([key, text]) => text !== row?.[key]));
|
|
38
|
+
if (Object.keys(changed).length === 0)
|
|
39
|
+
return;
|
|
40
|
+
await model.update(db_1.LEGAL_DOCUMENTS_SINGLETON_ID, {
|
|
41
|
+
...changed,
|
|
42
|
+
versions: (0, legal_versions_1.bumpLegalDocumentVersions)(row, changed, now),
|
|
43
|
+
updatedAt: now,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=legal-documents-store.js.map
|