@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 @@
|
|
|
1
|
+
{"version":3,"file":"parse-future-date.js","sourceRoot":"","sources":["../../src/utils/parse-future-date.ts"],"names":[],"mappings":";;AAUA,0CAWC;AArBD,uEAAwD;AAExD,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAQ7B,SAAgB,eAAe,CAAC,KAAc,EAAE,QAAgB;IAC9D,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,EAAE;QAAE,OAAO,IAAI,CAAC;IACvE,IAAA,2BAAM,EACJ,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,YAAY,IAAI,EAClD,gBAAgB,EAChB,QAAQ,CACT,CAAC;IACF,MAAM,MAAM,GAAG,KAAK,YAAY,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC;IAC/D,IAAA,2BAAM,EAAC,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,EAAE,gBAAgB,EAAE,QAAQ,CAAC,CAAC;IACpE,IAAA,2BAAM,EAAC,MAAM,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE,EAAE,gBAAgB,EAAE,QAAQ,CAAC,CAAC;IAClE,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getRowInstance(row: object): string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getRowInstance = getRowInstance;
|
|
4
|
+
const INSTANCE_FIELD = "_instance";
|
|
5
|
+
function getRowInstance(row) {
|
|
6
|
+
return row[INSTANCE_FIELD];
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=row-instance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"row-instance.js","sourceRoot":"","sources":["../../src/utils/row-instance.ts"],"names":[],"mappings":";;AAKA,wCAEC;AAPD,MAAM,cAAc,GAAG,WAAW,CAAC;AAKnC,SAAgB,cAAc,CAAC,GAAW;IACxC,OAAQ,GAA8B,CAAC,cAAc,CAAC,CAAC;AACzD,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { DataType } from "@antelopejs/interface-dms/base/data-types";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
export interface SegmentConditionsTypeOptions {
|
|
4
|
+
fieldsCatalogUrl?: string;
|
|
5
|
+
[key: string]: unknown;
|
|
6
|
+
}
|
|
7
|
+
export declare class SegmentConditionsType extends DataType {
|
|
8
|
+
readonly options: SegmentConditionsTypeOptions;
|
|
9
|
+
constructor(options?: SegmentConditionsTypeOptions);
|
|
10
|
+
protected defaultInputComponent(): import("@antelopejs/interface-dms").ComponentInfoSerialized<unknown>;
|
|
11
|
+
getValidation(): z.ZodPipeline<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
12
|
+
logical: z.ZodEnum<["and", "or"]>;
|
|
13
|
+
conditions: z.ZodArray<z.ZodType<any, z.ZodTypeDef, any>, "many">;
|
|
14
|
+
}, "strip", z.ZodTypeAny, {
|
|
15
|
+
conditions: any[];
|
|
16
|
+
logical: "or" | "and";
|
|
17
|
+
}, {
|
|
18
|
+
conditions: any[];
|
|
19
|
+
logical: "or" | "and";
|
|
20
|
+
}>]>, any, string | {
|
|
21
|
+
conditions: any[];
|
|
22
|
+
logical: "or" | "and";
|
|
23
|
+
}>, z.ZodObject<{
|
|
24
|
+
logical: z.ZodEnum<["and", "or"]>;
|
|
25
|
+
conditions: z.ZodArray<z.ZodType<any, z.ZodTypeDef, any>, "many">;
|
|
26
|
+
}, "strip", z.ZodTypeAny, {
|
|
27
|
+
conditions: any[];
|
|
28
|
+
logical: "or" | "and";
|
|
29
|
+
}, {
|
|
30
|
+
conditions: any[];
|
|
31
|
+
logical: "or" | "and";
|
|
32
|
+
}>>;
|
|
33
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.SegmentConditionsType = void 0;
|
|
13
|
+
const custom_1 = require("@antelopejs/interface-dms/base/custom");
|
|
14
|
+
const data_types_1 = require("@antelopejs/interface-dms/base/data-types");
|
|
15
|
+
const zod_1 = require("zod");
|
|
16
|
+
const SEGMENT_OPERATOR_VALUES = [
|
|
17
|
+
"eq",
|
|
18
|
+
"neq",
|
|
19
|
+
"gt",
|
|
20
|
+
"gte",
|
|
21
|
+
"lt",
|
|
22
|
+
"lte",
|
|
23
|
+
"in",
|
|
24
|
+
"nin",
|
|
25
|
+
"contains",
|
|
26
|
+
];
|
|
27
|
+
const conditionSchema = zod_1.z.lazy(() => zod_1.z.union([
|
|
28
|
+
zod_1.z.object({
|
|
29
|
+
field: zod_1.z.string(),
|
|
30
|
+
operator: zod_1.z.enum(SEGMENT_OPERATOR_VALUES),
|
|
31
|
+
value: zod_1.z.unknown(),
|
|
32
|
+
}),
|
|
33
|
+
zod_1.z.object({
|
|
34
|
+
kind: zod_1.z.literal("workspaceRef"),
|
|
35
|
+
quantifier: zod_1.z.enum(["any", "all"]),
|
|
36
|
+
role: zod_1.z.enum(["member", "owner"]).optional(),
|
|
37
|
+
conditions: groupSchema,
|
|
38
|
+
}),
|
|
39
|
+
zod_1.z.object({
|
|
40
|
+
logical: zod_1.z.enum(["and", "or"]),
|
|
41
|
+
conditions: zod_1.z.array(conditionSchema),
|
|
42
|
+
}),
|
|
43
|
+
]));
|
|
44
|
+
const groupSchema = zod_1.z.object({
|
|
45
|
+
logical: zod_1.z.enum(["and", "or"]),
|
|
46
|
+
conditions: zod_1.z.array(conditionSchema),
|
|
47
|
+
});
|
|
48
|
+
const stringOrGroupSchema = zod_1.z
|
|
49
|
+
.union([zod_1.z.string(), groupSchema])
|
|
50
|
+
.transform((value) => {
|
|
51
|
+
if (typeof value === "string") {
|
|
52
|
+
if (value === "")
|
|
53
|
+
return { logical: "and", conditions: [] };
|
|
54
|
+
try {
|
|
55
|
+
return JSON.parse(value);
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
return { logical: "and", conditions: [] };
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return value;
|
|
62
|
+
})
|
|
63
|
+
.pipe(groupSchema);
|
|
64
|
+
let SegmentConditionsType = class SegmentConditionsType extends data_types_1.DataType {
|
|
65
|
+
options;
|
|
66
|
+
constructor(options = {}) {
|
|
67
|
+
super([], undefined, options);
|
|
68
|
+
this.options = options;
|
|
69
|
+
}
|
|
70
|
+
defaultInputComponent() {
|
|
71
|
+
return (0, custom_1.CustomComponent)("DmsSaasSegmentConditionsBuilder")
|
|
72
|
+
.options({
|
|
73
|
+
fieldsCatalogUrl: this.options.fieldsCatalogUrl,
|
|
74
|
+
})
|
|
75
|
+
.serializeSync();
|
|
76
|
+
}
|
|
77
|
+
getValidation() {
|
|
78
|
+
return stringOrGroupSchema;
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
exports.SegmentConditionsType = SegmentConditionsType;
|
|
82
|
+
exports.SegmentConditionsType = SegmentConditionsType = __decorate([
|
|
83
|
+
(0, data_types_1.RegisterDataType)("segment_conditions"),
|
|
84
|
+
__metadata("design:paramtypes", [Object])
|
|
85
|
+
], SegmentConditionsType);
|
|
86
|
+
//# sourceMappingURL=segment-conditions-type.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"segment-conditions-type.js","sourceRoot":"","sources":["../../src/utils/segment-conditions-type.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kEAAwE;AACxE,0EAGmD;AACnD,6BAAwB;AAExB,MAAM,uBAAuB,GAAG;IAC9B,IAAI;IACJ,KAAK;IACL,IAAI;IACJ,KAAK;IACL,IAAI;IACJ,KAAK;IAC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AAE;YAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC;QAC5D,IAAI,CAAC;YACH,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC3B,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC;QAC5C,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;KACD,IAAI,CAAC,WAAW,CAAC,CAAC;AAQd,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,qBAAQ;IACrB;IAA5B,YAA4B,UAAwC,EAAE;QACpE,KAAK,CAAC,EAAE,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;QADJ,YAAO,GAAP,OAAO,CAAmC;IAEtE,CAAC;IAES,qBAAqB;QAC7B,OAAO,IAAA,wBAAe,EAAC,iCAAiC,CAAC;aACtD,OAAO,CAAC;YACP,gBAAgB,EAAE,IAAI,CAAC,OAAO,CAAC,gBAAgB;SAChD,CAAC;aACD,aAAa,EAAE,CAAC;IACrB,CAAC;IAED,aAAa;QACX,OAAO,mBAAmB,CAAC;IAC7B,CAAC;CACF,CAAA;AAhBY,sDAAqB;gCAArB,qBAAqB;IADjC,IAAA,6BAAgB,EAAC,oBAAoB,CAAC;;GAC1B,qBAAqB,CAgBjC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { SegmentCondition, SegmentConditionGroup, SegmentWorkspaceRef } from "../db";
|
|
2
|
+
export type SegmentNode = SegmentCondition | SegmentConditionGroup | SegmentWorkspaceRef;
|
|
3
|
+
export declare function evaluateSegmentGroup(group: SegmentConditionGroup | null | undefined, target: Record<string, unknown>): boolean;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.evaluateSegmentGroup = evaluateSegmentGroup;
|
|
4
|
+
const segment_fields_1 = require("./segment-fields");
|
|
5
|
+
function isGroup(node) {
|
|
6
|
+
return node.logical !== undefined;
|
|
7
|
+
}
|
|
8
|
+
function isWorkspaceRef(node) {
|
|
9
|
+
return node.kind === "workspaceRef";
|
|
10
|
+
}
|
|
11
|
+
function getFieldValue(target, path) {
|
|
12
|
+
if (path in target)
|
|
13
|
+
return target[path];
|
|
14
|
+
return path
|
|
15
|
+
.split(".")
|
|
16
|
+
.reduce((acc, key) => acc && typeof acc === "object"
|
|
17
|
+
? acc[key]
|
|
18
|
+
: undefined, target);
|
|
19
|
+
}
|
|
20
|
+
const KIND_COERCERS = {
|
|
21
|
+
number: (value) => {
|
|
22
|
+
if (typeof value === "number")
|
|
23
|
+
return value;
|
|
24
|
+
const parsed = Number(value);
|
|
25
|
+
return Number.isNaN(parsed) ? undefined : parsed;
|
|
26
|
+
},
|
|
27
|
+
boolean: (value) => {
|
|
28
|
+
if (typeof value === "boolean")
|
|
29
|
+
return value;
|
|
30
|
+
if (value === "true")
|
|
31
|
+
return true;
|
|
32
|
+
if (value === "false")
|
|
33
|
+
return false;
|
|
34
|
+
return undefined;
|
|
35
|
+
},
|
|
36
|
+
date: (value) => value instanceof Date ? value.getTime() : new Date(String(value)).getTime(),
|
|
37
|
+
string: (value) => (typeof value === "string" ? value : String(value)),
|
|
38
|
+
};
|
|
39
|
+
function coerce(value, kind) {
|
|
40
|
+
if (value === null || value === undefined || kind === "unknown")
|
|
41
|
+
return value;
|
|
42
|
+
return KIND_COERCERS[kind](value);
|
|
43
|
+
}
|
|
44
|
+
function getKind(fieldId) {
|
|
45
|
+
return (0, segment_fields_1.findAnySegmentField)(fieldId)?.valueKind ?? "unknown";
|
|
46
|
+
}
|
|
47
|
+
function compareValues(actual, expected, kind) {
|
|
48
|
+
const a = coerce(actual, kind);
|
|
49
|
+
const e = coerce(expected, kind);
|
|
50
|
+
if (typeof a === "number" && typeof e === "number")
|
|
51
|
+
return a - e;
|
|
52
|
+
if (typeof a === "string" && typeof e === "string")
|
|
53
|
+
return a.localeCompare(e);
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
function equals(actual, expected, kind) {
|
|
57
|
+
return coerce(actual, kind) === coerce(expected, kind);
|
|
58
|
+
}
|
|
59
|
+
function comparesWith(actual, expected, kind, predicate) {
|
|
60
|
+
const comparison = compareValues(actual, expected, kind);
|
|
61
|
+
return comparison !== null && predicate(comparison);
|
|
62
|
+
}
|
|
63
|
+
function evaluateContains(actual, expected) {
|
|
64
|
+
if (typeof actual === "string" && typeof expected === "string") {
|
|
65
|
+
return actual.toLowerCase().includes(expected.toLowerCase());
|
|
66
|
+
}
|
|
67
|
+
if (Array.isArray(actual))
|
|
68
|
+
return actual.includes(expected);
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
const OPERATOR_HANDLERS = {
|
|
72
|
+
eq: (actual, expected, kind) => equals(actual, expected, kind),
|
|
73
|
+
neq: (actual, expected, kind) => !equals(actual, expected, kind),
|
|
74
|
+
gt: (actual, expected, kind) => comparesWith(actual, expected, kind, (c) => c > 0),
|
|
75
|
+
gte: (actual, expected, kind) => comparesWith(actual, expected, kind, (c) => c >= 0),
|
|
76
|
+
lt: (actual, expected, kind) => comparesWith(actual, expected, kind, (c) => c < 0),
|
|
77
|
+
lte: (actual, expected, kind) => comparesWith(actual, expected, kind, (c) => c <= 0),
|
|
78
|
+
in: (actual, expected, kind) => Array.isArray(expected) &&
|
|
79
|
+
expected.some((value) => equals(actual, value, kind)),
|
|
80
|
+
nin: (actual, expected, kind) => Array.isArray(expected) &&
|
|
81
|
+
!expected.some((value) => equals(actual, value, kind)),
|
|
82
|
+
contains: (actual, expected) => evaluateContains(actual, expected),
|
|
83
|
+
};
|
|
84
|
+
function evaluateCondition(condition, target) {
|
|
85
|
+
const handler = OPERATOR_HANDLERS[condition.operator];
|
|
86
|
+
if (!handler)
|
|
87
|
+
return false;
|
|
88
|
+
const actual = getFieldValue(target, condition.field);
|
|
89
|
+
return handler(actual, condition.value, getKind(condition.field));
|
|
90
|
+
}
|
|
91
|
+
function evaluateWorkspaceRef(node, target) {
|
|
92
|
+
const all = Array.isArray(target.workspaces)
|
|
93
|
+
? target.workspaces
|
|
94
|
+
: [];
|
|
95
|
+
const workspaces = node.role === "owner" ? all.filter((w) => w.isOwner === true) : all;
|
|
96
|
+
if (workspaces.length === 0)
|
|
97
|
+
return false;
|
|
98
|
+
return node.quantifier === "all"
|
|
99
|
+
? workspaces.every((w) => evaluateSegmentGroup(node.conditions, w))
|
|
100
|
+
: workspaces.some((w) => evaluateSegmentGroup(node.conditions, w));
|
|
101
|
+
}
|
|
102
|
+
function evaluateNode(node, target) {
|
|
103
|
+
if (isWorkspaceRef(node))
|
|
104
|
+
return evaluateWorkspaceRef(node, target);
|
|
105
|
+
if (isGroup(node))
|
|
106
|
+
return evaluateSegmentGroup(node, target);
|
|
107
|
+
return evaluateCondition(node, target);
|
|
108
|
+
}
|
|
109
|
+
function evaluateSegmentGroup(group, target) {
|
|
110
|
+
if (!group?.conditions?.length)
|
|
111
|
+
return false;
|
|
112
|
+
const results = group.conditions.map((node) => evaluateNode(node, target));
|
|
113
|
+
return group.logical === "or"
|
|
114
|
+
? results.some(Boolean)
|
|
115
|
+
: results.every(Boolean);
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=segment-evaluator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"segment-evaluator.js","sourceRoot":"","sources":["../../src/utils/segment-evaluator.ts"],"names":[],"mappings":";;AAkKA,oDASC;AArKD,qDAA8E;AAS9E,SAAS,OAAO,CAAC,IAAiB;IAChC,OAAQ,IAA8B,CAAC,OAAO,KAAK,SAAS,CAAC;AAC/D,CAAC;AAED,SAAS,cAAc,CAAC,IAAiB;IACvC,OAAQ,IAA4B,CAAC,IAAI,KAAK,cAAc,CAAC;AAC/D,CAAC;AAED,SAAS,aAAa,CAAC,MAA+B,EAAE,IAAY;IAClE,I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OAAO,CAAC,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type SEGMENT_OPERATORS } from "../db";
|
|
2
|
+
export type SegmentFieldCatalog = "workspace" | "user";
|
|
3
|
+
export type SegmentFieldType = "string" | "number" | "boolean" | "date" | "enum" | "enum:plan";
|
|
4
|
+
export type SegmentValueKind = "string" | "number" | "boolean" | "date";
|
|
5
|
+
export interface SegmentFieldDefinition {
|
|
6
|
+
id: string;
|
|
7
|
+
type: SegmentFieldType;
|
|
8
|
+
valueKind: SegmentValueKind;
|
|
9
|
+
labelKey: string;
|
|
10
|
+
descriptionKey: string;
|
|
11
|
+
operators: readonly (typeof SEGMENT_OPERATORS)[number][];
|
|
12
|
+
enumValues?: readonly string[];
|
|
13
|
+
unit?: "currency" | "days" | "count";
|
|
14
|
+
}
|
|
15
|
+
export declare const SEGMENT_FIELDS: readonly SegmentFieldDefinition[];
|
|
16
|
+
export declare const USER_SEGMENT_FIELDS: readonly SegmentFieldDefinition[];
|
|
17
|
+
export declare function getSegmentFields(catalog: SegmentFieldCatalog): readonly SegmentFieldDefinition[];
|
|
18
|
+
export declare function findSegmentField(fieldId: string, catalog: SegmentFieldCatalog): SegmentFieldDefinition | undefined;
|
|
19
|
+
export declare function findAnySegmentField(fieldId: string): SegmentFieldDefinition | undefined;
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.USER_SEGMENT_FIELDS = exports.SEGMENT_FIELDS = void 0;
|
|
4
|
+
exports.getSegmentFields = getSegmentFields;
|
|
5
|
+
exports.findSegmentField = findSegmentField;
|
|
6
|
+
exports.findAnySegmentField = findAnySegmentField;
|
|
7
|
+
const db_1 = require("../db");
|
|
8
|
+
const NUMBER_OPERATORS = ["eq", "neq", "gt", "gte", "lt", "lte"];
|
|
9
|
+
const STRING_OPERATORS = ["eq", "neq", "contains"];
|
|
10
|
+
const ENUM_OPERATORS = ["eq", "neq", "in", "nin"];
|
|
11
|
+
const BOOLEAN_OPERATORS = ["eq"];
|
|
12
|
+
const DATE_OPERATORS = ["gt", "gte", "lt", "lte"];
|
|
13
|
+
exports.SEGMENT_FIELDS = [
|
|
14
|
+
{
|
|
15
|
+
id: "name",
|
|
16
|
+
type: "string",
|
|
17
|
+
valueKind: "string",
|
|
18
|
+
labelKey: "saas.segments.fields.name.label",
|
|
19
|
+
descriptionKey: "saas.segments.fields.name.description",
|
|
20
|
+
operators: STRING_OPERATORS,
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
id: "createdAt",
|
|
24
|
+
type: "date",
|
|
25
|
+
valueKind: "date",
|
|
26
|
+
labelKey: "saas.segments.fields.created_at.label",
|
|
27
|
+
descriptionKey: "saas.segments.fields.created_at.description",
|
|
28
|
+
operators: DATE_OPERATORS,
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
id: "ageInDays",
|
|
32
|
+
type: "number",
|
|
33
|
+
valueKind: "number",
|
|
34
|
+
labelKey: "saas.segments.fields.age_in_days.label",
|
|
35
|
+
descriptionKey: "saas.segments.fields.age_in_days.description",
|
|
36
|
+
operators: NUMBER_OPERATORS,
|
|
37
|
+
unit: "days",
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
id: "planId",
|
|
41
|
+
type: "enum:plan",
|
|
42
|
+
valueKind: "string",
|
|
43
|
+
labelKey: "saas.segments.fields.plan_id.label",
|
|
44
|
+
descriptionKey: "saas.segments.fields.plan_id.description",
|
|
45
|
+
operators: ENUM_OPERATORS,
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
id: "mrr",
|
|
49
|
+
type: "number",
|
|
50
|
+
valueKind: "number",
|
|
51
|
+
labelKey: "saas.segments.fields.mrr.label",
|
|
52
|
+
descriptionKey: "saas.segments.fields.mrr.description",
|
|
53
|
+
operators: NUMBER_OPERATORS,
|
|
54
|
+
unit: "currency",
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
id: "isPaying",
|
|
58
|
+
type: "boolean",
|
|
59
|
+
valueKind: "boolean",
|
|
60
|
+
labelKey: "saas.segments.fields.is_paying.label",
|
|
61
|
+
descriptionKey: "saas.segments.fields.is_paying.description",
|
|
62
|
+
operators: BOOLEAN_OPERATORS,
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
id: "status",
|
|
66
|
+
type: "enum",
|
|
67
|
+
valueKind: "string",
|
|
68
|
+
labelKey: "saas.segments.fields.status.label",
|
|
69
|
+
descriptionKey: "saas.segments.fields.status.description",
|
|
70
|
+
operators: ENUM_OPERATORS,
|
|
71
|
+
enumValues: db_1.TENANT_SUBSCRIPTION_STATUSES,
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
id: "hasStripeCustomer",
|
|
75
|
+
type: "boolean",
|
|
76
|
+
valueKind: "boolean",
|
|
77
|
+
labelKey: "saas.segments.fields.has_stripe_customer.label",
|
|
78
|
+
descriptionKey: "saas.segments.fields.has_stripe_customer.description",
|
|
79
|
+
operators: BOOLEAN_OPERATORS,
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
id: "isOnTrial",
|
|
83
|
+
type: "boolean",
|
|
84
|
+
valueKind: "boolean",
|
|
85
|
+
labelKey: "saas.segments.fields.is_on_trial.label",
|
|
86
|
+
descriptionKey: "saas.segments.fields.is_on_trial.description",
|
|
87
|
+
operators: BOOLEAN_OPERATORS,
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
id: "customerType",
|
|
91
|
+
type: "enum",
|
|
92
|
+
valueKind: "string",
|
|
93
|
+
labelKey: "saas.segments.fields.customer_type.label",
|
|
94
|
+
descriptionKey: "saas.segments.fields.customer_type.description",
|
|
95
|
+
operators: ENUM_OPERATORS,
|
|
96
|
+
enumValues: db_1.TENANT_CUSTOMER_TYPES,
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
id: "membersCount",
|
|
100
|
+
type: "number",
|
|
101
|
+
valueKind: "number",
|
|
102
|
+
labelKey: "saas.segments.fields.members_count.label",
|
|
103
|
+
descriptionKey: "saas.segments.fields.members_count.description",
|
|
104
|
+
operators: NUMBER_OPERATORS,
|
|
105
|
+
unit: "count",
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
id: "totalRevenue",
|
|
109
|
+
type: "number",
|
|
110
|
+
valueKind: "number",
|
|
111
|
+
labelKey: "saas.segments.fields.total_revenue.label",
|
|
112
|
+
descriptionKey: "saas.segments.fields.total_revenue.description",
|
|
113
|
+
operators: NUMBER_OPERATORS,
|
|
114
|
+
unit: "currency",
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
id: "daysSinceLastInvoice",
|
|
118
|
+
type: "number",
|
|
119
|
+
valueKind: "number",
|
|
120
|
+
labelKey: "saas.segments.fields.days_since_last_invoice.label",
|
|
121
|
+
descriptionKey: "saas.segments.fields.days_since_last_invoice.description",
|
|
122
|
+
operators: NUMBER_OPERATORS,
|
|
123
|
+
unit: "days",
|
|
124
|
+
},
|
|
125
|
+
];
|
|
126
|
+
exports.USER_SEGMENT_FIELDS = [
|
|
127
|
+
{
|
|
128
|
+
id: "email",
|
|
129
|
+
type: "string",
|
|
130
|
+
valueKind: "string",
|
|
131
|
+
labelKey: "saas.segments.fields.user_email.label",
|
|
132
|
+
descriptionKey: "saas.segments.fields.user_email.description",
|
|
133
|
+
operators: STRING_OPERATORS,
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
id: "name",
|
|
137
|
+
type: "string",
|
|
138
|
+
valueKind: "string",
|
|
139
|
+
labelKey: "saas.segments.fields.user_name.label",
|
|
140
|
+
descriptionKey: "saas.segments.fields.user_name.description",
|
|
141
|
+
operators: STRING_OPERATORS,
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
id: "language",
|
|
145
|
+
type: "string",
|
|
146
|
+
valueKind: "string",
|
|
147
|
+
labelKey: "saas.segments.fields.user_language.label",
|
|
148
|
+
descriptionKey: "saas.segments.fields.user_language.description",
|
|
149
|
+
operators: STRING_OPERATORS,
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
id: "createdAt",
|
|
153
|
+
type: "date",
|
|
154
|
+
valueKind: "date",
|
|
155
|
+
labelKey: "saas.segments.fields.user_created_at.label",
|
|
156
|
+
descriptionKey: "saas.segments.fields.user_created_at.description",
|
|
157
|
+
operators: DATE_OPERATORS,
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
id: "ageInDays",
|
|
161
|
+
type: "number",
|
|
162
|
+
valueKind: "number",
|
|
163
|
+
labelKey: "saas.segments.fields.user_age_in_days.label",
|
|
164
|
+
descriptionKey: "saas.segments.fields.user_age_in_days.description",
|
|
165
|
+
operators: NUMBER_OPERATORS,
|
|
166
|
+
unit: "days",
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
id: "isValidated",
|
|
170
|
+
type: "boolean",
|
|
171
|
+
valueKind: "boolean",
|
|
172
|
+
labelKey: "saas.segments.fields.user_is_validated.label",
|
|
173
|
+
descriptionKey: "saas.segments.fields.user_is_validated.description",
|
|
174
|
+
operators: BOOLEAN_OPERATORS,
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
id: "daysSinceLastActive",
|
|
178
|
+
type: "number",
|
|
179
|
+
valueKind: "number",
|
|
180
|
+
labelKey: "saas.segments.fields.days_since_last_active.label",
|
|
181
|
+
descriptionKey: "saas.segments.fields.days_since_last_active.description",
|
|
182
|
+
operators: NUMBER_OPERATORS,
|
|
183
|
+
unit: "days",
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
id: "workspacesCount",
|
|
187
|
+
type: "number",
|
|
188
|
+
valueKind: "number",
|
|
189
|
+
labelKey: "saas.segments.fields.workspaces_count.label",
|
|
190
|
+
descriptionKey: "saas.segments.fields.workspaces_count.description",
|
|
191
|
+
operators: NUMBER_OPERATORS,
|
|
192
|
+
unit: "count",
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
id: "isOwnerOfAnyWorkspace",
|
|
196
|
+
type: "boolean",
|
|
197
|
+
valueKind: "boolean",
|
|
198
|
+
labelKey: "saas.segments.fields.is_owner_of_any_workspace.label",
|
|
199
|
+
descriptionKey: "saas.segments.fields.is_owner_of_any_workspace.description",
|
|
200
|
+
operators: BOOLEAN_OPERATORS,
|
|
201
|
+
},
|
|
202
|
+
];
|
|
203
|
+
function getSegmentFields(catalog) {
|
|
204
|
+
return catalog === "user" ? exports.USER_SEGMENT_FIELDS : exports.SEGMENT_FIELDS;
|
|
205
|
+
}
|
|
206
|
+
function findSegmentField(fieldId, catalog) {
|
|
207
|
+
return getSegmentFields(catalog).find((f) => f.id === fieldId);
|
|
208
|
+
}
|
|
209
|
+
function findAnySegmentField(fieldId) {
|
|
210
|
+
return (findSegmentField(fieldId, "workspace") ?? findSegmentField(fieldId, "user"));
|
|
211
|
+
}
|
|
212
|
+
//# sourceMappingURL=segment-fields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"segment-fields.js","sourceRoot":"","sources":["../../src/utils/segment-fields.ts"],"names":[],"mappings":";;;AA4OA,4CAIC;AAED,4CAKC;AAMD,kDAMC;AAnQD,8BAIe;AAiCf,MAAM,gBAAgB,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,CAAU,CAAC;AAC1E,MAAM,gBAAgB,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,UAAU,CAAU,CAAC;AAC5D,MAAM,cAAc,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,CAAU,CAAC;AAC3D,MAAM,iBAAiB,GAAG,CAAC,IAAI,CAAU,CAAC;AAC1C,MAAM,cAAc,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,CAAU,CAAC;AAE9C,QAAA,cAAc,GAAsC;IAC/D;QACE,EAAE,EAAE,MAAM;QACV,IAAI,EAAE,QAAQ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,EAAE,uBAAuB;QAC3B,IAAI,EAAE,SAAS;QACf,SAAS,EAAE,SAAS;QACpB,QAAQ,EAAE,sDAAsD;QAChE,cAAc,EACZ,4DAA4D;QAC9D,SAAS,EAAE,iBAAiB;KAC7B;CACO,CAAC;AAEX,SAAgB,gBAAgB,CAC9B,OAA4B;IAE5B,OAAO,OAAO,KAAK,MAAM,CAAC,CAAC,CAAC,2BAAmB,CAAC,CAAC,CAAC,sBAAc,CAAC;AACnE,CAAC;AAED,SAAgB,gBAAgB,CAC9B,OAAe,EACf,OAA4B;IAE5B,OAAO,gBAAgB,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,OAAO,CAAC,CAAC;AACjE,CAAC;AAMD,SAAgB,mBAAmB,CACjC,OAAe;IAEf,OAAO,CACL,gBAAgB,CAAC,OAAO,EAAE,WAAW,CAAC,IAAI,gBAAgB,CAAC,OAAO,EAAE,MAAM,CAAC,CAC5E,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { type Tenant } from "@antelopejs/interface-dms/db";
|
|
2
|
+
import { type Invoice, type Plan, PlanModel, type Segment, type TenantBillingInfo, type TenantSubscription } from "../db";
|
|
3
|
+
export interface WorkspaceProjection {
|
|
4
|
+
_id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
createdAt: Date;
|
|
7
|
+
ageInDays: number;
|
|
8
|
+
status: TenantSubscription["status"] | null;
|
|
9
|
+
hasSubscription: boolean;
|
|
10
|
+
hasStripeCustomer: boolean;
|
|
11
|
+
isOnTrial: boolean;
|
|
12
|
+
isFreeAccess: boolean;
|
|
13
|
+
planId: string | null;
|
|
14
|
+
planName: string | null;
|
|
15
|
+
currency: string;
|
|
16
|
+
mrr: number;
|
|
17
|
+
isPaying: boolean;
|
|
18
|
+
customerType: TenantBillingInfo["customerType"] | null;
|
|
19
|
+
membersCount: number;
|
|
20
|
+
totalRevenue: number;
|
|
21
|
+
daysSinceLastInvoice: number | null;
|
|
22
|
+
}
|
|
23
|
+
interface ProjectionInputs {
|
|
24
|
+
tenant: Tenant;
|
|
25
|
+
subscription: TenantSubscription | undefined;
|
|
26
|
+
billingInfo: TenantBillingInfo | undefined;
|
|
27
|
+
plan: Plan | null;
|
|
28
|
+
membersCount: number;
|
|
29
|
+
invoices: Invoice[];
|
|
30
|
+
now: Date;
|
|
31
|
+
}
|
|
32
|
+
export declare function buildWorkspaceProjection(inputs: ProjectionInputs): WorkspaceProjection;
|
|
33
|
+
export declare function loadWorkspaceProjection(tenant: Tenant, planModel: PlanModel, now?: Date, plansById?: ReadonlyMap<string, Plan>): Promise<WorkspaceProjection>;
|
|
34
|
+
export declare function loadAllTenantProjections(planModel: PlanModel, now?: Date): Promise<WorkspaceProjection[]>;
|
|
35
|
+
export type UserWorkspaceProjection = WorkspaceProjection & {
|
|
36
|
+
isOwner: boolean;
|
|
37
|
+
};
|
|
38
|
+
export type UserProjection = {
|
|
39
|
+
_id: string;
|
|
40
|
+
email: string;
|
|
41
|
+
name: string;
|
|
42
|
+
language: string;
|
|
43
|
+
createdAt: Date;
|
|
44
|
+
ageInDays: number;
|
|
45
|
+
isValidated: boolean;
|
|
46
|
+
daysSinceLastActive: number | null;
|
|
47
|
+
workspacesCount: number;
|
|
48
|
+
isOwnerOfAnyWorkspace: boolean;
|
|
49
|
+
workspaces: UserWorkspaceProjection[];
|
|
50
|
+
};
|
|
51
|
+
export declare function loadUserProjectionsFrom(workspaceProjections: readonly WorkspaceProjection[], now?: Date): Promise<UserProjection[]>;
|
|
52
|
+
export declare function loadAllUserProjections(planModel: PlanModel, now?: Date): Promise<UserProjection[]>;
|
|
53
|
+
export declare function recomputeSegments(segments: readonly Segment[]): Promise<void>;
|
|
54
|
+
export declare function recomputeAllSegments(): Promise<void>;
|
|
55
|
+
export declare function recomputeSegmentsByIds(ids: readonly string[]): Promise<void>;
|
|
56
|
+
export {};
|