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
|
@@ -50,6 +50,10 @@ export function useLoginFlow(options = {}) {
|
|
|
50
50
|
const recoveryCode = ref("");
|
|
51
51
|
const inviteCode = ref("");
|
|
52
52
|
const age = ref("");
|
|
53
|
+
const twoFactorCode = ref("");
|
|
54
|
+
let twoFactorPassed = false;
|
|
55
|
+
const withBackupCode = ref(false);
|
|
56
|
+
const trustDevice = ref(false);
|
|
53
57
|
const waitlist = ref(null);
|
|
54
58
|
const access = useApiNamespace("access");
|
|
55
59
|
const checkInvite = access?.checkInvite ? useMutation(access.checkInvite) : null;
|
|
@@ -61,6 +65,10 @@ export function useLoginFlow(options = {}) {
|
|
|
61
65
|
const emailValid = computed(() => validate(email.value) === true);
|
|
62
66
|
const trimmedEmail = () => email.value.trim();
|
|
63
67
|
const { run, clearError, refuse } = stepRunner({ pending, error, retryAfter });
|
|
68
|
+
watch(withBackupCode, () => {
|
|
69
|
+
twoFactorCode.value = "";
|
|
70
|
+
clearError();
|
|
71
|
+
}, { flush: "sync" });
|
|
64
72
|
async function refreshSession() {
|
|
65
73
|
await auth.session.value.refetch();
|
|
66
74
|
}
|
|
@@ -169,6 +177,11 @@ export function useLoginFlow(options = {}) {
|
|
|
169
177
|
await auth.signInWithOtp({ email: trimmedEmail(), otp: otp.value.trim(), ...invite ? { inviteCode: invite } : {}, ...typedAge !== void 0 ? { age: typedAge } : {}, locale: activeLocale() });
|
|
170
178
|
} catch (cause) {
|
|
171
179
|
const failure = failureOf(cause);
|
|
180
|
+
if (failure.code === "forbidden" && failure.data.reason === "two_factor_required") {
|
|
181
|
+
twoFactorPassed = false;
|
|
182
|
+
step.value = "two-factor";
|
|
183
|
+
return false;
|
|
184
|
+
}
|
|
172
185
|
if (failure.code === "forbidden" && failure.data.reason === "age_required") {
|
|
173
186
|
step.value = "age";
|
|
174
187
|
return false;
|
|
@@ -190,6 +203,16 @@ export function useLoginFlow(options = {}) {
|
|
|
190
203
|
const verifyCode = () => run(async () => {
|
|
191
204
|
if (await signIn(keptInvite())) await finishSignIn();
|
|
192
205
|
});
|
|
206
|
+
const verifyTwoFactor = () => run(async () => {
|
|
207
|
+
if (!twoFactorPassed) {
|
|
208
|
+
const code = twoFactorCode.value.replace(/\s+/g, "");
|
|
209
|
+
if (!code) throw backendError("invalid_input", { field: "twoFactorCode", reason: "required" });
|
|
210
|
+
await auth.verifyTwoFactor({ code, backup: withBackupCode.value, trustDevice: trustDevice.value });
|
|
211
|
+
twoFactorPassed = true;
|
|
212
|
+
twoFactorCode.value = "";
|
|
213
|
+
}
|
|
214
|
+
await finishSignIn();
|
|
215
|
+
});
|
|
193
216
|
const redeemInviteCode = () => run(async () => {
|
|
194
217
|
const code = inviteCode.value.trim();
|
|
195
218
|
const status = checkInvite ? (await checkInvite({ code })).status : "valid";
|
|
@@ -228,6 +251,9 @@ export function useLoginFlow(options = {}) {
|
|
|
228
251
|
if (recovering.value) return;
|
|
229
252
|
clearError();
|
|
230
253
|
if (!(target === "invite-code" && step.value === "waitlisted")) otp.value = "";
|
|
254
|
+
twoFactorCode.value = "";
|
|
255
|
+
twoFactorPassed = false;
|
|
256
|
+
withBackupCode.value = false;
|
|
231
257
|
step.value = target;
|
|
232
258
|
};
|
|
233
259
|
const reset = () => {
|
|
@@ -238,6 +264,7 @@ export function useLoginFlow(options = {}) {
|
|
|
238
264
|
recoveryCode.value = "";
|
|
239
265
|
inviteCode.value = "";
|
|
240
266
|
age.value = "";
|
|
267
|
+
trustDevice.value = false;
|
|
241
268
|
waitlist.value = null;
|
|
242
269
|
pending.value = false;
|
|
243
270
|
};
|
|
@@ -265,6 +292,9 @@ export function useLoginFlow(options = {}) {
|
|
|
265
292
|
recoveryCode,
|
|
266
293
|
inviteCode,
|
|
267
294
|
age,
|
|
295
|
+
twoFactorCode,
|
|
296
|
+
withBackupCode,
|
|
297
|
+
trustDevice,
|
|
268
298
|
waitlist,
|
|
269
299
|
passkeyRequired: computed(() => recovering.value),
|
|
270
300
|
isPending: computed(() => pending.value),
|
|
@@ -276,6 +306,7 @@ export function useLoginFlow(options = {}) {
|
|
|
276
306
|
verifyCode,
|
|
277
307
|
redeemInviteCode,
|
|
278
308
|
submitAge,
|
|
309
|
+
verifyTwoFactor,
|
|
279
310
|
addPasskey,
|
|
280
311
|
skipPasskey,
|
|
281
312
|
recover,
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { FunctionReference } from 'convex/server';
|
|
2
|
+
import { type ComputedRef, type MaybeRefOrGetter } from 'vue';
|
|
3
|
+
import type { RoomMember } from '../../../convex/integrations/presence.js';
|
|
4
|
+
/** The functions `backend/presence.ts` exports from `setupPresence`. */
|
|
5
|
+
interface PresenceRefs {
|
|
6
|
+
list: FunctionReference<'query', 'public', {
|
|
7
|
+
roomToken: string;
|
|
8
|
+
}, RoomMember[]>;
|
|
9
|
+
heartbeat: FunctionReference<'mutation', 'public', {
|
|
10
|
+
roomId: string;
|
|
11
|
+
userId: string;
|
|
12
|
+
sessionId: string;
|
|
13
|
+
interval: number;
|
|
14
|
+
}, {
|
|
15
|
+
roomToken: string;
|
|
16
|
+
sessionToken: string;
|
|
17
|
+
}>;
|
|
18
|
+
disconnect: FunctionReference<'mutation', 'public', {
|
|
19
|
+
sessionToken: string;
|
|
20
|
+
}>;
|
|
21
|
+
}
|
|
22
|
+
export interface UseRoomPresenceOptions {
|
|
23
|
+
/** Milliseconds between heartbeats. Default 10000: someone who leaves without a word drops off after 2.5 of them. */
|
|
24
|
+
interval?: MaybeRefOrGetter<number | undefined>;
|
|
25
|
+
/** Override the injected `api.presence` namespace. */
|
|
26
|
+
api?: PresenceRefs;
|
|
27
|
+
}
|
|
28
|
+
export interface UseRoomPresenceReturn {
|
|
29
|
+
/** Everyone in the room, the signed-in person first, or `undefined` while it loads (and while nobody is signed in). */
|
|
30
|
+
members: ComputedRef<RoomMember[] | undefined>;
|
|
31
|
+
/** The others online now, for a face pile or "3 people here". */
|
|
32
|
+
others: ComputedRef<RoomMember[]>;
|
|
33
|
+
/** `true` once the room has answered. */
|
|
34
|
+
ready: ComputedRef<boolean>;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Who is here: keep the signed-in person in a room (a page, a document,
|
|
38
|
+
* `workspace:<id>`) while the page is open and visible, and list who else
|
|
39
|
+
* is there, live. The room is whatever string the app names; the backend's
|
|
40
|
+
* `setupPresence({ canJoin })` decides who may join it. Signed out, it
|
|
41
|
+
* sends nothing and lists nobody. Pairs with the base module's
|
|
42
|
+
* `<FacePile :presence-state="members ?? []">`.
|
|
43
|
+
*
|
|
44
|
+
* Needs `backend/presence.ts` exporting `setupPresence(components)`'s
|
|
45
|
+
* `list`, `heartbeat` and `disconnect`, and `@convex-dev/presence` mounted
|
|
46
|
+
* in `convex.config.ts` as `presence`.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```vue
|
|
50
|
+
* <script setup lang="ts">
|
|
51
|
+
* const route = useRoute()
|
|
52
|
+
* const { others } = useRoomPresence(() => `doc:${route.params.id}`)
|
|
53
|
+
* </script>
|
|
54
|
+
*
|
|
55
|
+
* <template>
|
|
56
|
+
* <p v-if="others.length">{{ others.map(person => person.name).join(', ') }} also here</p>
|
|
57
|
+
* </template>
|
|
58
|
+
* ```
|
|
59
|
+
*
|
|
60
|
+
* @experimental
|
|
61
|
+
*/
|
|
62
|
+
export declare function useRoomPresence(roomId: MaybeRefOrGetter<string>, options?: UseRoomPresenceOptions): UseRoomPresenceReturn;
|
|
63
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { computed, effectScope, getCurrentInstance, onScopeDispose, shallowRef, toValue, watch } from "vue";
|
|
2
|
+
import { usePresence } from "nuxt-convex-module/presence/client";
|
|
3
|
+
import { useAuthSession } from "../utils/auth-session.js";
|
|
4
|
+
import { useBackendNamespace } from "../utils/namespace.js";
|
|
5
|
+
export function useRoomPresence(roomId, options = {}) {
|
|
6
|
+
const auth = useAuthSession();
|
|
7
|
+
const api = useBackendNamespace("presence", "useRoomPresence", options.api);
|
|
8
|
+
const app = getCurrentInstance()?.appContext.app;
|
|
9
|
+
const state = shallowRef();
|
|
10
|
+
let scope;
|
|
11
|
+
const stop = () => {
|
|
12
|
+
scope?.stop();
|
|
13
|
+
scope = void 0;
|
|
14
|
+
state.value = void 0;
|
|
15
|
+
};
|
|
16
|
+
watch([() => auth.user.value?.id, () => Boolean(toValue(roomId))], ([userId, named]) => {
|
|
17
|
+
stop();
|
|
18
|
+
if (!userId || !named || !api.heartbeat) return;
|
|
19
|
+
scope = effectScope();
|
|
20
|
+
const start = () => scope.run(() => usePresence(api, roomId, userId, options.interval));
|
|
21
|
+
state.value = app ? app.runWithContext(start) : start();
|
|
22
|
+
}, { immediate: true });
|
|
23
|
+
onScopeDispose(stop);
|
|
24
|
+
const members = computed(() => state.value?.value);
|
|
25
|
+
const self = computed(() => auth.user.value?.id);
|
|
26
|
+
return {
|
|
27
|
+
members,
|
|
28
|
+
others: computed(() => (members.value ?? []).filter((person) => person.online && person.userId !== self.value)),
|
|
29
|
+
ready: computed(() => members.value !== void 0)
|
|
30
|
+
};
|
|
31
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { type ComputedRef, type Ref } from 'vue';
|
|
2
|
+
import type { BackendError } from '../utils/backend-error.js';
|
|
3
|
+
/** What turning the authenticator app on hands back, before its first code confirms it. */
|
|
4
|
+
export interface TwoFactorSetup {
|
|
5
|
+
/** The `otpauth://` link an authenticator app reads (as a QR code, or opened on the same device). */
|
|
6
|
+
totpURI: string;
|
|
7
|
+
/** The key in the link, for an app that takes it typed. */
|
|
8
|
+
secret: string;
|
|
9
|
+
/** Ten codes that each stand in for the app once: shown now, then never again. */
|
|
10
|
+
backupCodes: string[];
|
|
11
|
+
}
|
|
12
|
+
export interface UseTwoFactorReturn {
|
|
13
|
+
/** `true` once the account asks for the app's code after its sign-in code. */
|
|
14
|
+
enabled: ComputedRef<boolean>;
|
|
15
|
+
/** The setup `start` answered, waiting for `confirm`; `null` otherwise. */
|
|
16
|
+
pendingSetup: Ref<TwoFactorSetup | null>;
|
|
17
|
+
/** `true` while an action runs. */
|
|
18
|
+
isPending: ComputedRef<boolean>;
|
|
19
|
+
/** Why the last action failed, or `null`. The next action clears it, and so does signing out. */
|
|
20
|
+
error: ComputedRef<BackendError | null>;
|
|
21
|
+
/**
|
|
22
|
+
* Begin turning the app on: a new secret and new backup codes, in
|
|
23
|
+
* `pendingSetup`. Nothing asks for the app until `confirm` checks its
|
|
24
|
+
* first code. Takes a recent sign-in and refuses an administrator's visit.
|
|
25
|
+
*/
|
|
26
|
+
start: () => Promise<TwoFactorSetup>;
|
|
27
|
+
/** Check the app's first code and turn the step on. Rejects with `invalid_input` on `twoFactorCode` for a wrong one. */
|
|
28
|
+
confirm: (code: string) => Promise<void>;
|
|
29
|
+
/** Turn the app off: sign-in codes and passkeys sign in alone again. Takes a recent sign-in. */
|
|
30
|
+
disable: () => Promise<void>;
|
|
31
|
+
/** New backup codes in place of the old ones, which stop working. Takes a recent sign-in. */
|
|
32
|
+
regenerateBackupCodes: () => Promise<string[]>;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The authenticator app as a second step after a sign-in code (TOTP), for
|
|
36
|
+
* the signed-in account: turn it on (`start`, then `confirm` with the
|
|
37
|
+
* app's first code), off, and new backup codes. A passkey sign-in asks for
|
|
38
|
+
* no second step: the passkey is one already. `<SecuritySettings>`
|
|
39
|
+
* renders all of it; wrap the actions in
|
|
40
|
+
* `useReauthentication().withReauthentication` when building your own.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```vue
|
|
44
|
+
* <script setup lang="ts">
|
|
45
|
+
* const twoFactor = useTwoFactor()
|
|
46
|
+
* const { withReauthentication } = useReauthentication()
|
|
47
|
+
* const code = ref('')
|
|
48
|
+
* </script>
|
|
49
|
+
* <template>
|
|
50
|
+
* <button v-if="!twoFactor.enabled.value" @click="withReauthentication(twoFactor.start)">Use an authenticator app</button>
|
|
51
|
+
* <form v-if="twoFactor.pendingSetup.value" @submit.prevent="twoFactor.confirm(code)">
|
|
52
|
+
* <a :href="twoFactor.pendingSetup.value.totpURI">Open in your app</a>
|
|
53
|
+
* <input v-model="code" autocomplete="one-time-code">
|
|
54
|
+
* </form>
|
|
55
|
+
* </template>
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
export declare function useTwoFactor(): UseTwoFactorReturn;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { computed, ref, watch } from "vue";
|
|
2
|
+
import { useAuthSession } from "../utils/auth-session.js";
|
|
3
|
+
import { unwrapAuth } from "../utils/auth-result.js";
|
|
4
|
+
import { useActionState } from "../utils/action-state.js";
|
|
5
|
+
function secretOf(totpURI) {
|
|
6
|
+
try {
|
|
7
|
+
return new URL(totpURI).searchParams.get("secret") ?? "";
|
|
8
|
+
} catch {
|
|
9
|
+
return "";
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export function useTwoFactor() {
|
|
13
|
+
const auth = useAuthSession();
|
|
14
|
+
const { client } = auth;
|
|
15
|
+
const signedOut = () => !auth.isLoading.value && !auth.isAuthenticated.value;
|
|
16
|
+
const { isPending, failure, run } = useActionState(signedOut);
|
|
17
|
+
const pendingSetup = ref(null);
|
|
18
|
+
const account = () => auth.user.value?.id ?? null;
|
|
19
|
+
watch(account, () => {
|
|
20
|
+
pendingSetup.value = null;
|
|
21
|
+
});
|
|
22
|
+
return {
|
|
23
|
+
enabled: computed(() => auth.user.value?.twoFactorEnabled === true),
|
|
24
|
+
pendingSetup,
|
|
25
|
+
isPending,
|
|
26
|
+
error: computed(() => signedOut() ? null : failure.value),
|
|
27
|
+
start: () => run(async () => {
|
|
28
|
+
const startedFor = account();
|
|
29
|
+
const answer = unwrapAuth(await client.twoFactor.enable({}));
|
|
30
|
+
const setup = { ...answer, secret: secretOf(answer.totpURI) };
|
|
31
|
+
if (account() === startedFor) pendingSetup.value = setup;
|
|
32
|
+
return setup;
|
|
33
|
+
}),
|
|
34
|
+
confirm: (code) => run(async () => {
|
|
35
|
+
unwrapAuth(await client.twoFactor.verifyTotp({ code: code.replace(/\s+/g, "") }));
|
|
36
|
+
pendingSetup.value = null;
|
|
37
|
+
await auth.session.value.refetch();
|
|
38
|
+
}),
|
|
39
|
+
disable: () => run(async () => {
|
|
40
|
+
unwrapAuth(await client.twoFactor.disable({}));
|
|
41
|
+
pendingSetup.value = null;
|
|
42
|
+
await auth.session.value.refetch();
|
|
43
|
+
}),
|
|
44
|
+
regenerateBackupCodes: () => run(async () => {
|
|
45
|
+
const { backupCodes } = unwrapAuth(await client.twoFactor.generateBackupCodes({}));
|
|
46
|
+
return backupCodes;
|
|
47
|
+
})
|
|
48
|
+
};
|
|
49
|
+
}
|
|
@@ -45,6 +45,11 @@ export interface UseWaitlistAdminReturn {
|
|
|
45
45
|
note: (id: string, note: string) => Promise<void>;
|
|
46
46
|
/** The room a wave has: the sign-in codes left this hour and the email plan's quota today. `null` for no administrator. Rejects on failure. */
|
|
47
47
|
caps: () => Promise<WaitlistCaps | null>;
|
|
48
|
+
/** Plan the next wave (`size` from the front of the line, opening at `opensAt`), or clear it with `null`. Takes a recent sign-in. Rejects on failure. */
|
|
49
|
+
plan: (wave: {
|
|
50
|
+
size: number;
|
|
51
|
+
opensAt?: number | null;
|
|
52
|
+
} | null) => Promise<void>;
|
|
48
53
|
}
|
|
49
54
|
/**
|
|
50
55
|
* The admin console's Waitlist tab, as data: the waiting people (the oldest
|
|
@@ -22,6 +22,7 @@ export function useWaitlistAdmin(options = {}) {
|
|
|
22
22
|
const admit = call(api.admitWaitlist, "admitWaitlist");
|
|
23
23
|
const decline = call(api.declineWaitlist, "declineWaitlist");
|
|
24
24
|
const note = call(api.noteWaitlist, "noteWaitlist");
|
|
25
|
+
const planWave = call(api.planWaitlistWave, "planWaitlistWave");
|
|
25
26
|
const readCaps = api.getWaitlistCaps ? useAction(api.getWaitlistCaps) : null;
|
|
26
27
|
return {
|
|
27
28
|
console: computed(() => {
|
|
@@ -38,6 +39,9 @@ export function useWaitlistAdmin(options = {}) {
|
|
|
38
39
|
note: async (id, text) => {
|
|
39
40
|
await note({ id, note: text });
|
|
40
41
|
},
|
|
41
|
-
caps: () => run(async () => readCaps ? await readCaps({}) : null, { silent: true })
|
|
42
|
+
caps: () => run(async () => readCaps ? await readCaps({}) : null, { silent: true }),
|
|
43
|
+
plan: async (wave) => {
|
|
44
|
+
await planWave(wave ? { size: wave.size, ...wave.opensAt != null ? { opensAt: wave.opensAt } : {} } : { size: null });
|
|
45
|
+
}
|
|
42
46
|
};
|
|
43
47
|
}
|
|
@@ -50,6 +50,10 @@ export interface WaitlistApiRefs {
|
|
|
50
50
|
note: string;
|
|
51
51
|
}, null>;
|
|
52
52
|
getWaitlistCaps?: FunctionReference<'action', 'public', Record<string, never>, WaitlistCaps | null>;
|
|
53
|
+
planWaitlistWave?: FunctionReference<'mutation', 'public', {
|
|
54
|
+
size: number | null;
|
|
55
|
+
opensAt?: number | null;
|
|
56
|
+
}, null>;
|
|
53
57
|
}
|
|
54
58
|
/** Where a person is in joining: asking for the code, entering it, or reading their place. */
|
|
55
59
|
export type WaitlistStep = 'join' | 'verify' | 'status';
|
|
@@ -108,7 +108,7 @@ export function useWaitlist(options = {}) {
|
|
|
108
108
|
token.value = waiting?.token ?? null;
|
|
109
109
|
if (token.value) kept?.keep(token.value);
|
|
110
110
|
left.value = false;
|
|
111
|
-
result = { status: "waiting", position: waiting?.position ?? null, total: waiting?.total ?? 0, friends: 0, cap: 0, shareCode: "", launchNews: launchNews.value, token: waiting?.token ?? "" };
|
|
111
|
+
result = { status: "waiting", position: waiting?.position ?? null, total: waiting?.total ?? 0, joinedAt: 0, friends: 0, cap: 0, credit: 0, perFriend: 0, wave: null, shareCode: "", launchNews: launchNews.value, token: waiting?.token ?? "" };
|
|
112
112
|
joined.value = result;
|
|
113
113
|
step.value = "status";
|
|
114
114
|
return;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { UseAccountReturn } from './composables/use-account.js';
|
|
2
|
+
import type { UseTwoFactorReturn } from './composables/use-two-factor.js';
|
|
2
3
|
import type { UseAppShellReturn } from './composables/use-app-shell.js';
|
|
3
4
|
import type { UseAdminReturn } from './composables/use-admin.js';
|
|
4
5
|
import type { AuditEntry } from './composables/use-audit-log.js';
|
|
@@ -31,7 +32,7 @@ export type CancelFlowQuestionProps = CancelFlowPartProps;
|
|
|
31
32
|
export type CancelFlowOfferProps = CancelFlowPartProps;
|
|
32
33
|
export type CancelFlowConfirmProps = CancelFlowPartProps;
|
|
33
34
|
export type CancelFlowEndProps = CancelFlowPartProps;
|
|
34
|
-
/** The sign-in parts of `<AuthForm>`: `AuthFormHeader`, `AuthFormChoose`, `AuthFormPasskey`, `AuthFormEmail`, `AuthFormCode`, `AuthFormRecover`, `AuthFormWaitlisted`, `AuthFormInviteCode`, `AuthFormAge`, `AuthFormUndeliverable`, `AuthFormPasskeyOffer`, `AuthFormAgreement`, `AuthFormError`. */
|
|
35
|
+
/** The sign-in parts of `<AuthForm>`: `AuthFormHeader`, `AuthFormChoose`, `AuthFormPasskey`, `AuthFormEmail`, `AuthFormCode`, `AuthFormRecover`, `AuthFormWaitlisted`, `AuthFormInviteCode`, `AuthFormAge`, `AuthFormTwoFactor`, `AuthFormUndeliverable`, `AuthFormPasskeyOffer`, `AuthFormAgreement`, `AuthFormError`. */
|
|
35
36
|
export interface AuthFormPartProps {
|
|
36
37
|
/** The login flow `<AuthForm>` runs: `useLoginFlow()`, with its `bind`. */
|
|
37
38
|
flow: UseLoginFlowReturn;
|
|
@@ -45,6 +46,7 @@ export type AuthFormRecoverProps = AuthFormPartProps;
|
|
|
45
46
|
export type AuthFormWaitlistedProps = AuthFormPartProps;
|
|
46
47
|
export type AuthFormInviteCodeProps = AuthFormPartProps;
|
|
47
48
|
export type AuthFormAgeProps = AuthFormPartProps;
|
|
49
|
+
export type AuthFormTwoFactorProps = AuthFormPartProps;
|
|
48
50
|
export type AuthFormUndeliverableProps = AuthFormPartProps;
|
|
49
51
|
export type AuthFormPasskeyOfferProps = AuthFormPartProps;
|
|
50
52
|
export type AuthFormAgreementProps = AuthFormPartProps;
|
|
@@ -127,6 +129,11 @@ export interface SecurityPasskeysProps {
|
|
|
127
129
|
/** `usePasskeys()`. */
|
|
128
130
|
passkeys: UsePasskeysReturn;
|
|
129
131
|
}
|
|
132
|
+
/** `SecurityTwoFactor`. */
|
|
133
|
+
export interface SecurityTwoFactorProps {
|
|
134
|
+
/** `useTwoFactor()`. */
|
|
135
|
+
twoFactor: UseTwoFactorReturn;
|
|
136
|
+
}
|
|
130
137
|
/** `SecurityAlerts`. */
|
|
131
138
|
export interface SecurityAlertsProps {
|
|
132
139
|
/** The account's latest sign-ins from a new device, live (`listSignInAlerts`). */
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { twoFactorClient as betterAuthTwoFactorClient } from 'better-auth/client/plugins';
|
|
2
|
+
/** Better Auth's two-factor client plugin, as `twoFactorClient()` from `better-auth/client/plugins` returns it. */
|
|
3
|
+
export type TwoFactorClientPlugin = ReturnType<typeof betterAuthTwoFactorClient>;
|
|
4
|
+
/**
|
|
5
|
+
* Better Auth's two-factor client plugin without its error-code table and
|
|
6
|
+
* its redirect: the sign-in form reads `twoFactorRedirect` off the sign-in
|
|
7
|
+
* code's answer itself (`useLoginFlow`'s `two-factor` step), so the page
|
|
8
|
+
* stays where it is. What is left is the routes' methods and the session
|
|
9
|
+
* signal after each, as in Better Auth's. Every page's entry carries the
|
|
10
|
+
* client's plugins (see ./admin-client), so its `$ERROR_CODES`, type-level
|
|
11
|
+
* for a client plugin, stays out.
|
|
12
|
+
*
|
|
13
|
+
* test/unit/role-clients.test.ts holds it to Better Auth's own plugin.
|
|
14
|
+
*/
|
|
15
|
+
export declare function twoFactorClient(): TwoFactorClientPlugin;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export function twoFactorClient() {
|
|
2
|
+
const plugin = {
|
|
3
|
+
id: "two-factor",
|
|
4
|
+
// Type-level only, as in Better Auth's plugin: the server plugin it pairs with.
|
|
5
|
+
$InferServerPlugin: {},
|
|
6
|
+
atomListeners: [{ matcher: (path) => path.startsWith("/two-factor/"), signal: "$sessionSignal" }],
|
|
7
|
+
pathMethods: {
|
|
8
|
+
"/two-factor/disable": "POST",
|
|
9
|
+
"/two-factor/enable": "POST",
|
|
10
|
+
"/two-factor/send-otp": "POST",
|
|
11
|
+
"/two-factor/generate-backup-codes": "POST",
|
|
12
|
+
"/two-factor/get-totp-uri": "POST",
|
|
13
|
+
"/two-factor/verify-totp": "POST",
|
|
14
|
+
"/two-factor/verify-otp": "POST",
|
|
15
|
+
"/two-factor/verify-backup-code": "POST"
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
return plugin;
|
|
19
|
+
}
|
|
@@ -5,6 +5,7 @@ import { unwrapAuth } from "./auth-result.js";
|
|
|
5
5
|
import { signInMethod, useLastSignInState } from "./last-sign-in.js";
|
|
6
6
|
import { markLocalSignOut, sessionKey } from "./local-sign-out.js";
|
|
7
7
|
import { useActionState } from "./action-state.js";
|
|
8
|
+
import { backendError } from "../../../convex/errors.js";
|
|
8
9
|
import { appRole, hasAnyRole } from "./roles.js";
|
|
9
10
|
import { credentialIdOf, signalUnknownCredential, signalUserDetails } from "./passkey-signals.js";
|
|
10
11
|
function inLanguage(locale) {
|
|
@@ -13,6 +14,10 @@ function inLanguage(locale) {
|
|
|
13
14
|
function signedInUser(data) {
|
|
14
15
|
return data.user;
|
|
15
16
|
}
|
|
17
|
+
function codeSignedIn(data) {
|
|
18
|
+
if (data?.twoFactorRedirect === true) throw backendError("forbidden", { reason: "two_factor_required" });
|
|
19
|
+
return signedInUser(data);
|
|
20
|
+
}
|
|
16
21
|
const EXPECTED_AUTOFILL_ENDS = ["ERROR_CEREMONY_ABORTED", "rate_limited"];
|
|
17
22
|
function passkeyAnswer() {
|
|
18
23
|
let credentialId = null;
|
|
@@ -92,7 +97,11 @@ export function useAuthSession() {
|
|
|
92
97
|
sendOtp: (email, type = "sign-in", { locale } = {}) => run(async () => {
|
|
93
98
|
unwrapAuth(await client.emailOtp.sendVerificationOtp({ email, type }, ...inLanguage(locale)));
|
|
94
99
|
}),
|
|
95
|
-
signInWithOtp: ({ locale, ...args }) => run(async () => signedInWith("email-otp")(
|
|
100
|
+
signInWithOtp: ({ locale, ...args }) => run(async () => signedInWith("email-otp")(codeSignedIn(unwrapAuth(await client.signIn.emailOtp(args, ...inLanguage(locale)))))),
|
|
101
|
+
verifyTwoFactor: ({ code, backup = false, trustDevice = false }) => run(async () => {
|
|
102
|
+
const answer = backup ? await client.twoFactor.verifyBackupCode({ code, trustDevice }) : await client.twoFactor.verifyTotp({ code, trustDevice });
|
|
103
|
+
return signedInWith("email-otp")(signedInUser(unwrapAuth(answer)));
|
|
104
|
+
}),
|
|
96
105
|
signInWithPasskey,
|
|
97
106
|
registerPasskey: (options) => run(async () => unwrapAuth(await client.passkey.addPasskey({ ...options }))),
|
|
98
107
|
// The package's own routes (passkey-only.ts on the server), through the client's fetch.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { RouteLocationNormalized } from 'vue-router';
|
|
2
2
|
import type { NuxtApp, NuxtError } from '#app';
|
|
3
3
|
import { navigateTo } from '#imports';
|
|
4
|
-
import type {
|
|
4
|
+
import type { ConvexBetterAuthEvent } from 'nuxt-convex-module/better-auth/server';
|
|
5
5
|
import type { AccessDeniedData, PageAccessRules } from './access-rules.js';
|
|
6
6
|
/** What the middleware reads in the app's context before the guard loads. */
|
|
7
7
|
export interface PageGuardContext {
|
|
@@ -10,7 +10,7 @@ export interface PageGuardContext {
|
|
|
10
10
|
/** The same-origin auth route (`backend.authRoute`). */
|
|
11
11
|
authRoute: string;
|
|
12
12
|
/** The request, on a server render. */
|
|
13
|
-
event?:
|
|
13
|
+
event?: ConvexBetterAuthEvent;
|
|
14
14
|
/** `useRequestFetch()`: on the server, a fetch that forwards the request's cookies. */
|
|
15
15
|
fetch: (url: string) => Promise<unknown>;
|
|
16
16
|
}
|
|
@@ -30,8 +30,8 @@ function granted(features, feature) {
|
|
|
30
30
|
}
|
|
31
31
|
export async function serverSubject(context) {
|
|
32
32
|
if (!context.event) return null;
|
|
33
|
-
const {
|
|
34
|
-
const auth =
|
|
33
|
+
const { convexBetterAuthNuxt } = await import("nuxt-convex-module/better-auth/server");
|
|
34
|
+
const auth = convexBetterAuthNuxt(context.event);
|
|
35
35
|
const token = await auth.getToken();
|
|
36
36
|
if (!token) return null;
|
|
37
37
|
const claims = tokenClaims(token);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { bP as CAPABILITIES, aU as BACKEND_ENV, j as resolveFunctionsDir, u as scaffoldBackendFiles, q as configuredDeployment, I as isDevDeploymentId, bQ as isEnvProvisioned, a0 as devPushRefusal, bR as markEnvProvisioned, b8 as finding, $ as runEnvPush, t as spawnConvex } from './nuxt-backend.ChvlbHQq.mjs';
|
|
2
2
|
import { existsSync, writeFileSync, readFileSync } from 'node:fs';
|
|
3
3
|
import { resolve, join, delimiter } from 'node:path';
|
|
4
4
|
import { defineCommand } from 'citty';
|