nuxt-backend 0.5.0 → 0.6.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 +8 -4
- package/dist/capabilities/registry.js +1 -1
- package/dist/chunks/catalog.mjs +1 -1
- package/dist/chunks/{index.mjs → devtools.mjs} +2 -2
- package/dist/chunks/doctor.mjs +14 -6
- package/dist/chunks/email-previews.mjs +1 -1
- package/dist/chunks/health.mjs +2 -2
- package/dist/chunks/install.mjs +4 -4
- package/dist/chunks/run.mjs +1 -1
- package/dist/chunks/server.mjs +15 -4
- package/dist/cli.mjs +28 -8
- package/dist/convex/access-tickets.d.ts +17 -2
- package/dist/convex/access-tickets.d.ts.map +1 -1
- package/dist/convex/account-data.d.ts +4 -4
- package/dist/convex/account-data.d.ts.map +1 -1
- package/dist/convex/account-data.js +5 -4
- package/dist/convex/account-data.js.map +1 -1
- package/dist/convex/app.d.ts +1 -0
- package/dist/convex/app.d.ts.map +1 -1
- package/dist/convex/app.js +2 -1
- package/dist/convex/app.js.map +1 -1
- package/dist/convex/client/better-auth-options.d.ts.map +1 -1
- package/dist/convex/client/better-auth-options.js +12 -3
- package/dist/convex/client/better-auth-options.js.map +1 -1
- package/dist/convex/client/component.d.ts +4 -0
- package/dist/convex/client/component.d.ts.map +1 -1
- package/dist/convex/client/index.d.ts +5 -0
- package/dist/convex/client/index.d.ts.map +1 -1
- package/dist/convex/client/launch-gate.d.ts.map +1 -1
- package/dist/convex/client/launch-gate.js +30 -1
- package/dist/convex/client/launch-gate.js.map +1 -1
- package/dist/convex/client/plugins.d.ts.map +1 -1
- package/dist/convex/client/plugins.js +3 -0
- package/dist/convex/client/plugins.js.map +1 -1
- package/dist/convex/client/two-factor.d.ts +7 -0
- package/dist/convex/client/two-factor.d.ts.map +1 -0
- package/dist/convex/client/two-factor.js +57 -0
- package/dist/convex/client/two-factor.js.map +1 -0
- package/dist/convex/components/backend/_generated/api.d.ts +2 -0
- package/dist/convex/components/backend/_generated/api.d.ts.map +1 -1
- package/dist/convex/components/backend/_generated/api.js.map +1 -1
- package/dist/convex/components/backend/_generated/component.d.ts +292 -10
- package/dist/convex/components/backend/_generated/component.d.ts.map +1 -1
- package/dist/convex/components/backend/account.d.ts +63 -17
- package/dist/convex/components/backend/account.d.ts.map +1 -1
- package/dist/convex/components/backend/account.js +24 -1
- package/dist/convex/components/backend/account.js.map +1 -1
- package/dist/convex/components/backend/adapter.d.ts.map +1 -1
- package/dist/convex/components/backend/adapter.js +7 -2
- package/dist/convex/components/backend/adapter.js.map +1 -1
- package/dist/convex/components/backend/ai.d.ts +1 -1
- package/dist/convex/components/backend/billing.d.ts +10 -0
- package/dist/convex/components/backend/billing.d.ts.map +1 -1
- package/dist/convex/components/backend/billing.js +2 -1
- package/dist/convex/components/backend/billing.js.map +1 -1
- package/dist/convex/components/backend/commerce.d.ts +229 -0
- package/dist/convex/components/backend/commerce.d.ts.map +1 -0
- package/dist/convex/components/backend/commerce.js +392 -0
- package/dist/convex/components/backend/commerce.js.map +1 -0
- package/dist/convex/components/backend/funnel.d.ts +6 -6
- package/dist/convex/components/backend/jobs.d.ts +1 -1
- package/dist/convex/components/backend/referrals.d.ts +2 -2
- package/dist/convex/components/backend/schema.d.ts +327 -21
- package/dist/convex/components/backend/schema.d.ts.map +1 -1
- package/dist/convex/components/backend/schema.js +108 -1
- package/dist/convex/components/backend/schema.js.map +1 -1
- package/dist/convex/components/backend/waitlist.d.ts +42 -6
- package/dist/convex/components/backend/waitlist.d.ts.map +1 -1
- package/dist/convex/components/backend/waitlist.js +142 -39
- package/dist/convex/components/backend/waitlist.js.map +1 -1
- package/dist/convex/email-templates.d.ts +12 -0
- package/dist/convex/email-templates.d.ts.map +1 -1
- package/dist/convex/email-templates.js +3 -0
- package/dist/convex/email-templates.js.map +1 -1
- package/dist/convex/emails/waitlist-friend-joined.d.ts +9 -0
- package/dist/convex/emails/waitlist-friend-joined.d.ts.map +1 -0
- package/dist/convex/emails/waitlist-friend-joined.js +22 -0
- package/dist/convex/emails/waitlist-friend-joined.js.map +1 -0
- package/dist/convex/errors.d.ts +6 -6
- package/dist/convex/errors.d.ts.map +1 -1
- package/dist/convex/errors.js +14 -2
- package/dist/convex/errors.js.map +1 -1
- package/dist/convex/events.d.ts +19 -0
- package/dist/convex/events.d.ts.map +1 -1
- package/dist/convex/events.js +14 -0
- package/dist/convex/events.js.map +1 -1
- package/dist/convex/integrations/billing/checkout.d.ts +2 -2
- package/dist/convex/integrations/billing/checkout.d.ts.map +1 -1
- package/dist/convex/integrations/billing/checkout.js +79 -11
- package/dist/convex/integrations/billing/checkout.js.map +1 -1
- package/dist/convex/integrations/billing/commerce-entitlements.d.ts +12 -0
- package/dist/convex/integrations/billing/commerce-entitlements.d.ts.map +1 -0
- package/dist/convex/integrations/billing/commerce-entitlements.js +78 -0
- package/dist/convex/integrations/billing/commerce-entitlements.js.map +1 -0
- package/dist/convex/integrations/billing/commerce-events.d.ts +15 -0
- package/dist/convex/integrations/billing/commerce-events.d.ts.map +1 -0
- package/dist/convex/integrations/billing/commerce-events.js +433 -0
- package/dist/convex/integrations/billing/commerce-events.js.map +1 -0
- package/dist/convex/integrations/billing/commerce-history.d.ts +20 -0
- package/dist/convex/integrations/billing/commerce-history.d.ts.map +1 -0
- package/dist/convex/integrations/billing/commerce-history.js +106 -0
- package/dist/convex/integrations/billing/commerce-history.js.map +1 -0
- package/dist/convex/integrations/billing/commerce-webhooks.d.ts +23 -0
- package/dist/convex/integrations/billing/commerce-webhooks.d.ts.map +1 -0
- package/dist/convex/integrations/billing/commerce-webhooks.js +49 -0
- package/dist/convex/integrations/billing/commerce-webhooks.js.map +1 -0
- package/dist/convex/integrations/billing/commerce.d.ts +100 -0
- package/dist/convex/integrations/billing/commerce.d.ts.map +1 -0
- package/dist/convex/integrations/billing/commerce.js +323 -0
- package/dist/convex/integrations/billing/commerce.js.map +1 -0
- package/dist/convex/integrations/billing/context.d.ts +8 -0
- package/dist/convex/integrations/billing/context.d.ts.map +1 -1
- package/dist/convex/integrations/billing/context.js +14 -2
- package/dist/convex/integrations/billing/context.js.map +1 -1
- package/dist/convex/integrations/billing/credits.d.ts +1 -1
- package/dist/convex/integrations/billing/credits.d.ts.map +1 -1
- package/dist/convex/integrations/billing/credits.js +49 -28
- package/dist/convex/integrations/billing/credits.js.map +1 -1
- package/dist/convex/integrations/billing/customers.d.ts +1 -1
- package/dist/convex/integrations/billing/customers.d.ts.map +1 -1
- package/dist/convex/integrations/billing/customers.js +15 -1
- package/dist/convex/integrations/billing/customers.js.map +1 -1
- package/dist/convex/integrations/billing/entitlements.d.ts +1 -1
- package/dist/convex/integrations/billing/entitlements.d.ts.map +1 -1
- package/dist/convex/integrations/billing/entitlements.js +6 -1
- package/dist/convex/integrations/billing/entitlements.js.map +1 -1
- package/dist/convex/integrations/billing/erasure.d.ts +1 -1
- package/dist/convex/integrations/billing/erasure.d.ts.map +1 -1
- package/dist/convex/integrations/billing/erasure.js +10 -5
- package/dist/convex/integrations/billing/erasure.js.map +1 -1
- package/dist/convex/integrations/billing/free-plan.d.ts +6 -1
- package/dist/convex/integrations/billing/free-plan.d.ts.map +1 -1
- package/dist/convex/integrations/billing/free-plan.js +22 -4
- package/dist/convex/integrations/billing/free-plan.js.map +1 -1
- package/dist/convex/integrations/billing/functions.d.ts +1 -1
- package/dist/convex/integrations/billing/functions.d.ts.map +1 -1
- package/dist/convex/integrations/billing/functions.js +3 -2
- package/dist/convex/integrations/billing/functions.js.map +1 -1
- package/dist/convex/integrations/billing/gifts.d.ts.map +1 -1
- package/dist/convex/integrations/billing/gifts.js +3 -0
- package/dist/convex/integrations/billing/gifts.js.map +1 -1
- package/dist/convex/integrations/billing/history.d.ts +1 -1
- package/dist/convex/integrations/billing/history.d.ts.map +1 -1
- package/dist/convex/integrations/billing/history.js +6 -1
- package/dist/convex/integrations/billing/history.js.map +1 -1
- package/dist/convex/integrations/billing/lifecycle.d.ts +1 -1
- package/dist/convex/integrations/billing/lifecycle.d.ts.map +1 -1
- package/dist/convex/integrations/billing/lifecycle.js +4 -1
- package/dist/convex/integrations/billing/lifecycle.js.map +1 -1
- package/dist/convex/integrations/billing/providers/capabilities.d.ts +17 -0
- package/dist/convex/integrations/billing/providers/capabilities.d.ts.map +1 -0
- package/dist/convex/integrations/billing/providers/capabilities.js +77 -0
- package/dist/convex/integrations/billing/providers/capabilities.js.map +1 -0
- package/dist/convex/integrations/billing/providers/consent.d.ts +52 -0
- package/dist/convex/integrations/billing/providers/consent.d.ts.map +1 -0
- package/dist/convex/integrations/billing/providers/consent.js +79 -0
- package/dist/convex/integrations/billing/providers/consent.js.map +1 -0
- package/dist/convex/integrations/billing/providers/creem.d.ts +22 -0
- package/dist/convex/integrations/billing/providers/creem.d.ts.map +1 -0
- package/dist/convex/integrations/billing/providers/creem.js +208 -0
- package/dist/convex/integrations/billing/providers/creem.js.map +1 -0
- package/dist/convex/integrations/billing/providers/dodo.d.ts +15 -0
- package/dist/convex/integrations/billing/providers/dodo.d.ts.map +1 -0
- package/dist/convex/integrations/billing/providers/dodo.js +197 -0
- package/dist/convex/integrations/billing/providers/dodo.js.map +1 -0
- package/dist/convex/integrations/billing/providers/http.d.ts +41 -0
- package/dist/convex/integrations/billing/providers/http.d.ts.map +1 -0
- package/dist/convex/integrations/billing/providers/http.js +146 -0
- package/dist/convex/integrations/billing/providers/http.js.map +1 -0
- package/dist/convex/integrations/billing/providers/index.d.ts +35 -0
- package/dist/convex/integrations/billing/providers/index.d.ts.map +1 -0
- package/dist/convex/integrations/billing/providers/index.js +62 -0
- package/dist/convex/integrations/billing/providers/index.js.map +1 -0
- package/dist/convex/integrations/billing/providers/stripe.d.ts +28 -0
- package/dist/convex/integrations/billing/providers/stripe.d.ts.map +1 -0
- package/dist/convex/integrations/billing/providers/stripe.js +327 -0
- package/dist/convex/integrations/billing/providers/stripe.js.map +1 -0
- package/dist/convex/integrations/billing/providers/types.d.ts +263 -0
- package/dist/convex/integrations/billing/providers/types.d.ts.map +1 -0
- package/dist/convex/integrations/billing/providers/types.js +48 -0
- package/dist/convex/integrations/billing/providers/types.js.map +1 -0
- package/dist/convex/integrations/billing/subscriptions.d.ts +1 -1
- package/dist/convex/integrations/billing/subscriptions.d.ts.map +1 -1
- package/dist/convex/integrations/billing/subscriptions.js +20 -6
- package/dist/convex/integrations/billing/subscriptions.js.map +1 -1
- package/dist/convex/integrations/billing/types/setup.d.ts +64 -1
- package/dist/convex/integrations/billing/types/setup.d.ts.map +1 -1
- package/dist/convex/integrations/billing.d.ts +4 -1
- package/dist/convex/integrations/billing.d.ts.map +1 -1
- package/dist/convex/integrations/billing.js +12 -2
- package/dist/convex/integrations/billing.js.map +1 -1
- package/dist/convex/integrations/email.d.ts +1 -1
- package/dist/convex/integrations/email.d.ts.map +1 -1
- package/dist/convex/integrations/email.js.map +1 -1
- package/dist/convex/integrations/launch.d.ts +27 -2
- package/dist/convex/integrations/launch.d.ts.map +1 -1
- package/dist/convex/integrations/launch.js +15 -3
- package/dist/convex/integrations/launch.js.map +1 -1
- package/dist/convex/integrations/presence.d.ts +110 -0
- package/dist/convex/integrations/presence.d.ts.map +1 -0
- package/dist/convex/integrations/presence.js +92 -0
- package/dist/convex/integrations/presence.js.map +1 -0
- package/dist/convex/integrations/waitlist.d.ts +41 -7
- package/dist/convex/integrations/waitlist.d.ts.map +1 -1
- package/dist/convex/integrations/waitlist.js +45 -6
- package/dist/convex/integrations/waitlist.js.map +1 -1
- package/dist/convex/integrations/webhook-guard.d.ts +8 -0
- package/dist/convex/integrations/webhook-guard.d.ts.map +1 -1
- package/dist/convex/integrations/webhook-guard.js +11 -4
- package/dist/convex/integrations/webhook-guard.js.map +1 -1
- package/dist/convex/label-groups/admin.d.ts +9 -0
- package/dist/convex/label-groups/admin.d.ts.map +1 -1
- package/dist/convex/label-groups/admin.js +9 -0
- package/dist/convex/label-groups/admin.js.map +1 -1
- package/dist/convex/label-groups/audit.d.ts +2 -0
- package/dist/convex/label-groups/audit.d.ts.map +1 -1
- package/dist/convex/label-groups/audit.js +2 -0
- package/dist/convex/label-groups/audit.js.map +1 -1
- package/dist/convex/label-groups/auth.d.ts +9 -0
- package/dist/convex/label-groups/auth.d.ts.map +1 -1
- package/dist/convex/label-groups/auth.js +10 -0
- package/dist/convex/label-groups/auth.js.map +1 -1
- package/dist/convex/label-groups/email.d.ts +6 -0
- package/dist/convex/label-groups/email.d.ts.map +1 -1
- package/dist/convex/label-groups/email.js +7 -0
- package/dist/convex/label-groups/email.js.map +1 -1
- package/dist/convex/label-groups/errors.d.ts +4 -0
- package/dist/convex/label-groups/errors.d.ts.map +1 -1
- package/dist/convex/label-groups/errors.js +4 -0
- package/dist/convex/label-groups/errors.js.map +1 -1
- package/dist/convex/label-groups/security.d.ts +19 -0
- package/dist/convex/label-groups/security.d.ts.map +1 -1
- package/dist/convex/label-groups/security.js +20 -0
- package/dist/convex/label-groups/security.js.map +1 -1
- package/dist/convex/label-groups/waitlist.d.ts +8 -0
- package/dist/convex/label-groups/waitlist.d.ts.map +1 -1
- package/dist/convex/label-groups/waitlist.js +9 -0
- package/dist/convex/label-groups/waitlist.js.map +1 -1
- package/dist/convex/label-translations.d.ts.map +1 -1
- package/dist/convex/label-translations.js +24 -0
- package/dist/convex/label-translations.js.map +1 -1
- package/dist/convex/labels.d.ts +57 -0
- package/dist/convex/labels.d.ts.map +1 -1
- package/dist/convex/log.js +2 -0
- package/dist/convex/log.js.map +1 -1
- package/dist/convex/sensitive-actions.d.ts.map +1 -1
- package/dist/convex/sensitive-actions.js +11 -0
- package/dist/convex/sensitive-actions.js.map +1 -1
- package/dist/convex/waitlist-rules.d.ts +63 -9
- package/dist/convex/waitlist-rules.d.ts.map +1 -1
- package/dist/convex/waitlist-rules.js +38 -7
- package/dist/convex/waitlist-rules.js.map +1 -1
- package/dist/devtools-client/_nuxt/DHNi4uhO.js +6 -0
- package/dist/devtools-client/index.html +1 -1
- package/dist/env-registry.js +9 -0
- package/dist/module.d.ts +14 -2
- package/dist/module.js +2 -2
- package/dist/module.json +2 -2
- package/dist/runtime/locales/de.json +58 -1
- package/dist/runtime/locales/en.json +60 -3
- package/dist/runtime/locales/es.json +58 -1
- package/dist/runtime/locales/fr.json +58 -1
- package/dist/runtime/locales/ru.json +58 -1
- package/dist/runtime/server/monitoring/backend-calls.d.ts +3 -3
- package/dist/runtime/server/monitoring/backend-calls.js +2 -2
- package/dist/runtime/server/monitoring/health.js +2 -2
- package/dist/runtime/vue/auth-client.d.ts +3 -2
- package/dist/runtime/vue/auth-client.js +2 -1
- package/dist/runtime/vue/components/account/SecuritySettings.d.vue.ts +25 -2
- package/dist/runtime/vue/components/account/SecuritySettings.vue +52 -2
- package/dist/runtime/vue/components/account/SecuritySettings.vue.d.ts +25 -2
- package/dist/runtime/vue/components/account/SecurityTwoFactor.css +1 -0
- package/dist/runtime/vue/components/account/SecurityTwoFactor.d.vue.ts +4 -0
- package/dist/runtime/vue/components/account/SecurityTwoFactor.vue +107 -0
- package/dist/runtime/vue/components/account/SecurityTwoFactor.vue.d.ts +4 -0
- package/dist/runtime/vue/components/account/security-settings.d.ts +18 -1
- package/dist/runtime/vue/components/admin/AdminUsers.d.vue.ts +11 -2
- package/dist/runtime/vue/components/admin/AdminUsers.vue.d.ts +11 -2
- package/dist/runtime/vue/components/admin/AdminWaitlist.css +1 -1
- package/dist/runtime/vue/components/admin/AdminWaitlistActions.vue +41 -1
- package/dist/runtime/vue/components/admin/AdminWorkspaces.d.vue.ts +9 -0
- package/dist/runtime/vue/components/admin/AdminWorkspaces.vue.d.ts +9 -0
- package/dist/runtime/vue/components/admin/admin-waitlist-tab.js +28 -0
- package/dist/runtime/vue/components/auth/AuthForm.d.vue.ts +9 -0
- package/dist/runtime/vue/components/auth/AuthForm.vue +8 -0
- package/dist/runtime/vue/components/auth/AuthForm.vue.d.ts +9 -0
- package/dist/runtime/vue/components/auth/AuthFormTwoFactor.css +1 -0
- package/dist/runtime/vue/components/auth/AuthFormTwoFactor.d.vue.ts +3 -0
- package/dist/runtime/vue/components/auth/AuthFormTwoFactor.vue +70 -0
- package/dist/runtime/vue/components/auth/AuthFormTwoFactor.vue.d.ts +3 -0
- package/dist/runtime/vue/components/auth/AuthFormWaitlisted.vue +7 -2
- package/dist/runtime/vue/components/auth/WaitlistForm.d.vue.ts +8 -0
- package/dist/runtime/vue/components/auth/WaitlistForm.vue.d.ts +8 -0
- package/dist/runtime/vue/components/auth/WaitlistPlace.css +1 -1
- package/dist/runtime/vue/components/auth/WaitlistPlace.vue +37 -0
- package/dist/runtime/vue/components/auth/WaitlistShare.vue +2 -2
- package/dist/runtime/vue/components/auth/auth-form.d.ts +2 -0
- package/dist/runtime/vue/components/workspaces/AuditLog.d.vue.ts +2 -0
- package/dist/runtime/vue/components/workspaces/AuditLog.vue.d.ts +2 -0
- package/dist/runtime/vue/components/workspaces/WorkspaceSettings.d.vue.ts +2 -2
- package/dist/runtime/vue/components/workspaces/WorkspaceSettings.vue.d.ts +2 -2
- package/dist/runtime/vue/composables/use-login-flow.d.ts +19 -4
- package/dist/runtime/vue/composables/use-login-flow.js +31 -0
- package/dist/runtime/vue/composables/use-room-presence.d.ts +63 -0
- package/dist/runtime/vue/composables/use-room-presence.js +31 -0
- package/dist/runtime/vue/composables/use-two-factor.d.ts +58 -0
- package/dist/runtime/vue/composables/use-two-factor.js +49 -0
- package/dist/runtime/vue/composables/use-waitlist-admin.d.ts +5 -0
- package/dist/runtime/vue/composables/use-waitlist-admin.js +5 -1
- package/dist/runtime/vue/composables/use-waitlist.d.ts +4 -0
- package/dist/runtime/vue/composables/use-waitlist.js +1 -1
- package/dist/runtime/vue/parts.d.ts +8 -1
- package/dist/runtime/vue/two-factor-client.d.ts +15 -0
- package/dist/runtime/vue/two-factor-client.js +19 -0
- package/dist/runtime/vue/utils/auth-session.js +10 -1
- package/dist/runtime/vue/utils/login-bindings.js +1 -0
- package/dist/runtime/vue/utils/page-guard.d.ts +2 -2
- package/dist/runtime/vue/utils/page-guard.js +2 -2
- package/dist/shared/{nuxt-backend.CBvrM7pG.mjs → nuxt-backend.CM_p0XQE.mjs} +1 -1
- package/dist/shared/{nuxt-backend.Dikfaocl.mjs → nuxt-backend.C_Y_BtBs.mjs} +128 -5
- package/dist/shared/{nuxt-backend.DbaXvH__.mjs → nuxt-backend.ChvlbHQq.mjs} +203 -9
- package/dist/shared/{nuxt-backend.BqXAZChe.mjs → nuxt-backend.D16peTIt.mjs} +57 -35
- package/dist/shared/{nuxt-backend.DH1Ya3uB.mjs → nuxt-backend.D4JXvCP6.mjs} +3 -2
- package/dist/types.d.ts +1 -1
- package/package.json +19 -10
- package/skills/nuxt-backend/SKILL.md +18 -18
- package/skills/nuxt-backend/references/api.md +31 -6
- package/skills/nuxt-backend/references/install.md +9 -6
- package/skills/nuxt-backend/references/renames.json +8 -0
- package/skills/nuxt-backend/references/surface.json +62 -2
- package/skills/nuxt-backend-auth/SKILL.md +8 -2
- package/skills/nuxt-backend-auth/references/api.md +3 -1
- package/skills/nuxt-backend-billing/SKILL.md +15 -0
- package/skills/nuxt-backend-billing/references/api.md +14 -1
- package/skills/nuxt-backend-data/SKILL.md +1 -0
- package/skills/nuxt-backend-data/references/api.md +10 -1
- package/skills/nuxt-backend-email/references/api.md +1 -1
- package/skills/nuxt-backend-ship/SKILL.md +2 -1
- package/skills/nuxt-backend-upgrade/references/upgrade.md +6 -0
- package/src/convex/access-tickets.ts +10 -2
- package/src/convex/account-data.ts +5 -4
- package/src/convex/app.ts +2 -1
- package/src/convex/client/better-auth-options.ts +12 -3
- package/src/convex/client/launch-gate.ts +28 -1
- package/src/convex/client/plugins.ts +3 -0
- package/src/convex/client/two-factor.ts +66 -0
- package/src/convex/components/backend/_generated/api.ts +2 -0
- package/src/convex/components/backend/_generated/component.ts +500 -2
- package/src/convex/components/backend/account.ts +25 -1
- package/src/convex/components/backend/adapter.ts +7 -2
- package/src/convex/components/backend/billing.ts +2 -1
- package/src/convex/components/backend/commerce.ts +408 -0
- package/src/convex/components/backend/schema.ts +110 -1
- package/src/convex/components/backend/waitlist.ts +144 -40
- package/src/convex/email-templates.ts +16 -0
- package/src/convex/emails/waitlist-friend-joined.ts +23 -0
- package/src/convex/errors.ts +15 -2
- package/src/convex/events.ts +14 -0
- package/src/convex/integrations/billing/checkout.ts +78 -11
- package/src/convex/integrations/billing/commerce-entitlements.ts +92 -0
- package/src/convex/integrations/billing/commerce-events.ts +487 -0
- package/src/convex/integrations/billing/commerce-history.ts +110 -0
- package/src/convex/integrations/billing/commerce-webhooks.ts +69 -0
- package/src/convex/integrations/billing/commerce.ts +366 -0
- package/src/convex/integrations/billing/context.ts +19 -2
- package/src/convex/integrations/billing/credits.ts +47 -27
- package/src/convex/integrations/billing/customers.ts +15 -1
- package/src/convex/integrations/billing/entitlements.ts +5 -1
- package/src/convex/integrations/billing/erasure.ts +11 -6
- package/src/convex/integrations/billing/free-plan.ts +30 -5
- package/src/convex/integrations/billing/functions.ts +3 -2
- package/src/convex/integrations/billing/gifts.ts +2 -0
- package/src/convex/integrations/billing/history.ts +9 -0
- package/src/convex/integrations/billing/lifecycle.ts +3 -1
- package/src/convex/integrations/billing/providers/capabilities.ts +78 -0
- package/src/convex/integrations/billing/providers/consent.ts +94 -0
- package/src/convex/integrations/billing/providers/creem.ts +225 -0
- package/src/convex/integrations/billing/providers/dodo.ts +214 -0
- package/src/convex/integrations/billing/providers/http.ts +168 -0
- package/src/convex/integrations/billing/providers/index.ts +65 -0
- package/src/convex/integrations/billing/providers/stripe.ts +345 -0
- package/src/convex/integrations/billing/providers/types.ts +281 -0
- package/src/convex/integrations/billing/subscriptions.ts +20 -6
- package/src/convex/integrations/billing/types/setup.ts +63 -1
- package/src/convex/integrations/billing.ts +46 -3
- package/src/convex/integrations/email.ts +1 -0
- package/src/convex/integrations/launch.ts +45 -7
- package/src/convex/integrations/presence.ts +160 -0
- package/src/convex/integrations/waitlist.ts +84 -12
- package/src/convex/integrations/webhook-guard.ts +20 -4
- package/src/convex/label-groups/admin.ts +9 -0
- package/src/convex/label-groups/audit.ts +2 -0
- package/src/convex/label-groups/auth.ts +10 -0
- package/src/convex/label-groups/email.ts +7 -0
- package/src/convex/label-groups/errors.ts +4 -0
- package/src/convex/label-groups/security.ts +20 -0
- package/src/convex/label-groups/waitlist.ts +9 -0
- package/src/convex/label-translations.ts +24 -0
- package/src/convex/log.ts +2 -0
- package/src/convex/sensitive-actions.ts +11 -0
- package/src/convex/waitlist-rules.ts +84 -8
- package/src/runtime/vue/components/account/SecuritySettings.vue +58 -4
- package/src/runtime/vue/components/account/SecurityTwoFactor.css +68 -0
- package/src/runtime/vue/components/account/SecurityTwoFactor.vue +113 -0
- package/src/runtime/vue/components/admin/AdminWaitlist.css +1 -0
- package/src/runtime/vue/components/admin/AdminWaitlistActions.vue +44 -2
- package/src/runtime/vue/components/auth/AuthForm.vue +8 -0
- package/src/runtime/vue/components/auth/AuthFormTwoFactor.css +40 -0
- package/src/runtime/vue/components/auth/AuthFormTwoFactor.vue +75 -0
- package/src/runtime/vue/components/auth/AuthFormWaitlisted.vue +11 -4
- package/src/runtime/vue/components/auth/WaitlistPlace.css +16 -0
- package/src/runtime/vue/components/auth/WaitlistPlace.vue +49 -2
- package/src/runtime/vue/components/auth/WaitlistShare.vue +4 -3
- package/dist/devtools-client/_nuxt/CiCAOwUc.js +0 -5
|
@@ -2,6 +2,8 @@ import { checkoutsClientUpdate } from '@polar-sh/sdk/funcs/checkoutsClientUpdate
|
|
|
2
2
|
import { checkoutsCreate } from '@polar-sh/sdk/funcs/checkoutsCreate.js'
|
|
3
3
|
import { actionGeneric, type Auth, type GenericActionCtx, type GenericDataModel } from 'convex/server'
|
|
4
4
|
import { v } from 'convex/values'
|
|
5
|
+
import { providerTrialOf } from '../../catalog.js'
|
|
6
|
+
import { catalogProductOf, commerceCall, polarOnly, pricesManyCurrencies } from './commerce.js'
|
|
5
7
|
import { BILLING_ACCESS, type BillingContext } from './context.js'
|
|
6
8
|
import type { BillingCustomers } from './customers.js'
|
|
7
9
|
import { type CatalogDiscounts, type KeyedDiscount, refusedDiscount } from './discounts.js'
|
|
@@ -58,13 +60,13 @@ const CHECKOUT_ID_PLACEHOLDER = '{CHECKOUT_ID}'
|
|
|
58
60
|
* and all: the provider fills in every placeholder. A URL that already
|
|
59
61
|
* carries the package's parameter keeps it.
|
|
60
62
|
*/
|
|
61
|
-
export function withCheckoutReturn(successUrl: string): string {
|
|
63
|
+
export function withCheckoutReturn(successUrl: string, returnId: string = CHECKOUT_ID_PLACEHOLDER): string {
|
|
62
64
|
if (new URL(successUrl).searchParams.has(CHECKOUT_RETURN_PARAM)) return successUrl
|
|
63
65
|
const hash = successUrl.indexOf('#')
|
|
64
66
|
const base = hash === -1 ? successUrl : successUrl.slice(0, hash)
|
|
65
67
|
const fragment = hash === -1 ? '' : successUrl.slice(hash)
|
|
66
68
|
const separator = !base.includes('?') ? '?' : base.endsWith('?') || base.endsWith('&') ? '' : '&'
|
|
67
|
-
return `${base}${separator}${CHECKOUT_RETURN_PARAM}=${
|
|
69
|
+
return `${base}${separator}${CHECKOUT_RETURN_PARAM}=${returnId}${fragment}`
|
|
68
70
|
}
|
|
69
71
|
|
|
70
72
|
/**
|
|
@@ -77,9 +79,29 @@ export function isIpAddress(value: string): boolean {
|
|
|
77
79
|
return value.length <= 45 && value.includes(':') && /^[\da-f:.]+$/i.test(value) && (value.match(/::/g)?.length ?? 0) <= 1
|
|
78
80
|
}
|
|
79
81
|
|
|
82
|
+
/** Days in each unit a checkout trial counts in. */
|
|
83
|
+
const TRIAL_UNIT_DAYS = { day: 1, week: 7, month: 30, year: 365 } as const
|
|
84
|
+
|
|
85
|
+
/** A trial in days, as an adapter provider takes it. */
|
|
86
|
+
function trialDaysOf(trial: { interval: keyof typeof TRIAL_UNIT_DAYS, count?: number } | undefined): number | undefined {
|
|
87
|
+
return trial ? TRIAL_UNIT_DAYS[trial.interval] * (trial.count ?? 1) : undefined
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** What a checkout carries beside the app's own metadata: the campaign, who opened it, the soft opt-in's box. */
|
|
91
|
+
function checkoutMetadata(options: ServerCheckoutOptions, openedBy: string | undefined): Record<string, string> {
|
|
92
|
+
return {
|
|
93
|
+
...options.metadata,
|
|
94
|
+
...campaignMetadata(options.utm),
|
|
95
|
+
// Who opened it, for an abandoned checkout's lifecycle email (`billing.checkout_abandoned`).
|
|
96
|
+
...(openedBy ? { openedBy } : {}),
|
|
97
|
+
// The soft opt-in's box, read back on the paid order (`order.paid`).
|
|
98
|
+
...(options.emailOptOut === undefined ? {} : { [EMAIL_OPT_OUT_METADATA]: String(options.emailOptOut) }),
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
80
102
|
/** The checkout link: the entity's own provider customer, then a checkout session by its external id. */
|
|
81
103
|
export function createCheckout(
|
|
82
|
-
{ components, config, provider, cache, catalogIds, requireEntity, requireLaunched, unwrapProvider, throttle, recordEvent }: BillingContext,
|
|
104
|
+
{ components, config, provider, commerce, cache, catalogIds, requireEntity, requireLaunched, unwrapProvider, throttle, recordEvent }: BillingContext,
|
|
83
105
|
{ requireTrustedUrl, requireCatalogProducts, requireClientMetadata, requireCurrency }: PurchaseRules,
|
|
84
106
|
{ ensureCustomer, profileOf, trialAllowed }: BillingCustomers,
|
|
85
107
|
{ freeSubscriptionOf, isFreeProduct }: Pick<BillingFreePlan, 'freeSubscriptionOf' | 'isFreeProduct'>,
|
|
@@ -104,14 +126,7 @@ export function createCheckout(
|
|
|
104
126
|
*/
|
|
105
127
|
const buildCheckoutPayload = (options: ServerCheckoutOptions, entityId: string, hasCode: boolean, trialUsed: boolean, openedBy: string | undefined): CheckoutCreateInput => {
|
|
106
128
|
const prefill = options.prefill ?? {}
|
|
107
|
-
|
|
108
|
-
const metadata = {
|
|
109
|
-
...options.metadata,
|
|
110
|
-
...campaignMetadata(options.utm),
|
|
111
|
-
...(openedBy ? { openedBy } : {}),
|
|
112
|
-
// The soft opt-in's box, read back on the paid order (`order.paid`).
|
|
113
|
-
...(options.emailOptOut === undefined ? {} : { [EMAIL_OPT_OUT_METADATA]: String(options.emailOptOut) }),
|
|
114
|
-
}
|
|
129
|
+
const metadata = checkoutMetadata(options, openedBy)
|
|
115
130
|
return {
|
|
116
131
|
products: options.productIds,
|
|
117
132
|
// By the entity's id, never the email: the customer is the entity's own.
|
|
@@ -357,6 +372,52 @@ export function createCheckout(
|
|
|
357
372
|
throw backendError('invalid_input', { field: 'discountId' }, '[nuxt-backend] Billing: the provider refused the discount for this checkout — it has ended, is used up, or is not for this product.')
|
|
358
373
|
}
|
|
359
374
|
|
|
375
|
+
/**
|
|
376
|
+
* A checkout on an adapter provider (commerce.ts): one catalog product,
|
|
377
|
+
* at the provider's hosted checkout, for the entity's own customer there
|
|
378
|
+
* once it has one. The entity's id rides in the metadata, which every
|
|
379
|
+
* delivery of the order and the subscription carries back. A plan change
|
|
380
|
+
* goes through `updateSubscription`, never a checkout; a discount by key
|
|
381
|
+
* or id, and a currency other than the product's own, are Polar's for
|
|
382
|
+
* now, and a code is the provider's to check.
|
|
383
|
+
*/
|
|
384
|
+
const commerceCheckout = async (ctx: RunWriteCtx & { auth?: Auth }, entity: BillingEntity, options: ServerCheckoutOptions, discountCode: string | undefined): Promise<{ url: string }> => {
|
|
385
|
+
const mode = commerce!
|
|
386
|
+
const { userId } = entity
|
|
387
|
+
if (options.discount !== undefined || options.discountId) throw polarOnly(mode.name, 'a discount of the catalog at checkout')
|
|
388
|
+
// One provider product per catalog product, priced in one currency there: a second one can't be picked here.
|
|
389
|
+
if (options.currency && pricesManyCurrencies(mode.config.definition)) throw polarOnly(mode.name, 'choosing the currency at checkout')
|
|
390
|
+
if (options.subscriptionId) throw backendError('invalid_input', { field: 'subscriptionId' }, '[nuxt-backend] Billing: a checkout starts a subscription — switch a plan with updateSubscription (useBilling().changePlan).')
|
|
391
|
+
const [productId, ...more] = options.productIds
|
|
392
|
+
const product = catalogProductOf(mode.config.definition, mode.ids, productId)
|
|
393
|
+
if (!productId || more.length > 0 || !product) throw backendError('invalid_input', { field: 'productIds' }, `[nuxt-backend] Billing: a ${mode.name} checkout sells one product of the catalog.`)
|
|
394
|
+
await requireNoHeldSubscription(ctx, userId, options)
|
|
395
|
+
const profile = await profileOf(ctx, userId)
|
|
396
|
+
const trial = product.kind !== 'plan' || options.trial === false ? undefined : trialDaysOf(options.trial ?? providerTrialOf(product.plan.trial))
|
|
397
|
+
const trialDays = trial && await trialAllowed(ctx, userId, profile, true) ? trial : undefined
|
|
398
|
+
const openedBy = (await ctx.auth?.getUserIdentity())?.subject
|
|
399
|
+
const providerCustomerId = await ctx.runQuery(mode.refs.customerOf, { entityId: userId, provider: mode.name })
|
|
400
|
+
const returnId = crypto.randomUUID()
|
|
401
|
+
const session = await commerceCall('checkout', () => mode.client().createCheckout({
|
|
402
|
+
productId,
|
|
403
|
+
kind: product.kind === 'plan' ? 'subscription' : 'one_time',
|
|
404
|
+
customer: {
|
|
405
|
+
entityId: userId,
|
|
406
|
+
...(options.prefill?.email || entity.email ? { email: options.prefill?.email || entity.email } : {}),
|
|
407
|
+
...(options.prefill?.name ? { name: options.prefill.name } : {}),
|
|
408
|
+
...(providerCustomerId ? { providerCustomerId } : {}),
|
|
409
|
+
},
|
|
410
|
+
// A plan or pack checkout comes back with an id, which the client's checkout-return plugin reads to refresh the entitlements once.
|
|
411
|
+
successUrl: withCheckoutReturn(options.successUrl, returnId),
|
|
412
|
+
...(discountCode ? { discountCode } : {}),
|
|
413
|
+
...(options.locale ? { locale: options.locale } : {}),
|
|
414
|
+
...(trialDays ? { trialDays } : {}),
|
|
415
|
+
metadata: checkoutMetadata(options, openedBy),
|
|
416
|
+
idempotencyKey: returnId,
|
|
417
|
+
}))
|
|
418
|
+
return { url: session.url }
|
|
419
|
+
}
|
|
420
|
+
|
|
360
421
|
/**
|
|
361
422
|
* What a referral promised the person it brought, on their first paid
|
|
362
423
|
* checkout: the discount the program named, locked on, or its trial
|
|
@@ -416,6 +477,12 @@ export function createCheckout(
|
|
|
416
477
|
trialPayload(options.trial)
|
|
417
478
|
await throttle(ctx, userId, 'checkouts')
|
|
418
479
|
const { discount: _key, ...checked } = { ...options, currency }
|
|
480
|
+
if (commerce) {
|
|
481
|
+
const opened = await commerceCheckout(ctx, entity, { ...checked, discount: options.discount }, discountCode)
|
|
482
|
+
const productId = options.productIds[0]
|
|
483
|
+
if (productId) await recordEvent(ctx, userId, { type: 'billing.checkout_started', data: { productId } })
|
|
484
|
+
return opened
|
|
485
|
+
}
|
|
419
486
|
// With none named, the person's referral may have promised one.
|
|
420
487
|
const referral = discountCode || named || options.discountId ? undefined : await referralOffer(ctx, entity, options)
|
|
421
488
|
const opened = referral?.discount
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import type { BillingContext } from './context.js'
|
|
2
|
+
import type { ProviderCtx, RunQueryCtx, RunWriteCtx } from './types/base.js'
|
|
3
|
+
import type { CustomerEntitlements } from './types/records.js'
|
|
4
|
+
import type { Billing } from './types/surface.js'
|
|
5
|
+
|
|
6
|
+
// The entitlements of adapter mode (commerce.ts), read from what the app
|
|
7
|
+
// keeps instead of a provider's customer state: the plan is the entity's
|
|
8
|
+
// live subscriptions (the free plan's product when it holds none), what it
|
|
9
|
+
// grants is the catalog products' benefits, and the meters are the cache's
|
|
10
|
+
// own, which only the grant ledger and the spends move.
|
|
11
|
+
|
|
12
|
+
/** Statuses of a subscription the entity still holds. */
|
|
13
|
+
const LIVE_STATUSES = new Set(['active', 'trialing', 'past_due', 'paused'])
|
|
14
|
+
|
|
15
|
+
/** A synced subscription as this module reads it. */
|
|
16
|
+
interface SyncedSubscription { productId: string, status: string, endedAt?: string | null, trialEnd?: string | null }
|
|
17
|
+
|
|
18
|
+
/** A product row's benefit, as the synthesized rows carry one. */
|
|
19
|
+
interface ProductBenefit { id: string, type: string, description: string, metadata?: Record<string, string | number | boolean> }
|
|
20
|
+
|
|
21
|
+
/** The entitlement reads and writes of adapter mode, in the shape {@link createEntitlements} returns. */
|
|
22
|
+
export function createCommerceEntitlements(context: BillingContext) {
|
|
23
|
+
const { provider, cache, freePlan, syncProducts } = context
|
|
24
|
+
const commerce = context.commerce!
|
|
25
|
+
|
|
26
|
+
/** The products the entity's plan is now: its live subscriptions', else the free plan's. */
|
|
27
|
+
const activeProducts = async (ctx: RunQueryCtx, userId: string): Promise<string[]> => {
|
|
28
|
+
const now = new Date().toISOString()
|
|
29
|
+
const live = (await provider.listAllUserSubscriptions(ctx as unknown as ProviderCtx, { userId }) as SyncedSubscription[])
|
|
30
|
+
.filter(subscription => subscription.endedAt == null && LIVE_STATUSES.has(subscription.status)
|
|
31
|
+
&& !(subscription.status === 'trialing' && subscription.trialEnd != null && subscription.trialEnd <= now))
|
|
32
|
+
.map(subscription => subscription.productId)
|
|
33
|
+
if (live.length > 0) return [...new Set(live)]
|
|
34
|
+
return freePlan ? [freePlan.productId] : []
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** The benefits the products carry, each once, and whether every product's row was found. */
|
|
38
|
+
const benefitsOf = async (ctx: RunQueryCtx, productIds: string[]) => {
|
|
39
|
+
const rows = await Promise.all(productIds.map(productId => provider.getProduct(ctx as unknown as ProviderCtx, { productId })))
|
|
40
|
+
const seen = new Map<string, ProductBenefit>()
|
|
41
|
+
for (const row of rows) {
|
|
42
|
+
for (const benefit of (row?.benefits ?? []) as ProductBenefit[]) if (!seen.has(benefit.id)) seen.set(benefit.id, benefit)
|
|
43
|
+
}
|
|
44
|
+
return { benefits: [...seen.values()], complete: rows.every(Boolean) }
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const getCustomerState: Billing['getCustomerState'] = async (ctx, { userId }): Promise<CustomerEntitlements> => {
|
|
48
|
+
const customerId = await ctx.runQuery(commerce.refs.customerOf, { entityId: userId, provider: commerce.name })
|
|
49
|
+
const activeProductIds = await activeProducts(ctx, userId)
|
|
50
|
+
const { benefits } = await benefitsOf(ctx, activeProductIds)
|
|
51
|
+
const meters = (await ctx.runQuery(cache.getByUser, { userId }))?.meters ?? []
|
|
52
|
+
return {
|
|
53
|
+
customerId,
|
|
54
|
+
activeProductIds,
|
|
55
|
+
benefits: benefits.map(benefit => ({
|
|
56
|
+
id: benefit.id,
|
|
57
|
+
benefitId: benefit.id,
|
|
58
|
+
type: benefit.type,
|
|
59
|
+
// The catalog's benefits are features and credit grants only.
|
|
60
|
+
kind: benefit.type === 'meter_credit' ? 'credits' as const : 'feature' as const,
|
|
61
|
+
name: benefit.description,
|
|
62
|
+
metadata: benefit.metadata ?? {},
|
|
63
|
+
})),
|
|
64
|
+
meters,
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Write the entity's plan and benefits to the cache, its meters kept. A
|
|
70
|
+
* product whose row is not there yet (a catalog never synced on this
|
|
71
|
+
* deployment) writes the catalog's rows first.
|
|
72
|
+
*/
|
|
73
|
+
const refreshEntitlements = async (ctx: RunWriteCtx, userId: string): Promise<void> => {
|
|
74
|
+
const activeProductIds = await activeProducts(ctx, userId)
|
|
75
|
+
if (!(await benefitsOf(ctx, activeProductIds)).complete) await syncProducts(ctx)
|
|
76
|
+
const { benefits } = await benefitsOf(ctx, activeProductIds)
|
|
77
|
+
const customerId = await ctx.runQuery(commerce.refs.customerOf, { entityId: userId, provider: commerce.name })
|
|
78
|
+
await ctx.runMutation(commerce.refs.setPlanState, {
|
|
79
|
+
userId,
|
|
80
|
+
...(customerId ? { customerId } : {}),
|
|
81
|
+
activeProductIds,
|
|
82
|
+
benefits: benefits.map(benefit => ({ id: benefit.id, benefitId: benefit.id, type: benefit.type, metadata: benefit.metadata ?? {} })),
|
|
83
|
+
})
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const forgetEntity: Billing['forgetEntity'] = async (ctx, userId) => {
|
|
87
|
+
await ctx.runMutation(cache.deleteByUser, { userId })
|
|
88
|
+
await ctx.runMutation(commerce.refs.forgetEntity, { entityId: userId })
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return { getCustomerState, refreshEntitlements, forgetEntity }
|
|
92
|
+
}
|