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.
Files changed (414) hide show
  1. package/README.md +8 -4
  2. package/dist/capabilities/registry.js +1 -1
  3. package/dist/chunks/catalog.mjs +1 -1
  4. package/dist/chunks/{index.mjs → devtools.mjs} +2 -2
  5. package/dist/chunks/doctor.mjs +14 -6
  6. package/dist/chunks/email-previews.mjs +1 -1
  7. package/dist/chunks/health.mjs +2 -2
  8. package/dist/chunks/install.mjs +4 -4
  9. package/dist/chunks/run.mjs +1 -1
  10. package/dist/chunks/server.mjs +15 -4
  11. package/dist/cli.mjs +28 -8
  12. package/dist/convex/access-tickets.d.ts +17 -2
  13. package/dist/convex/access-tickets.d.ts.map +1 -1
  14. package/dist/convex/account-data.d.ts +4 -4
  15. package/dist/convex/account-data.d.ts.map +1 -1
  16. package/dist/convex/account-data.js +5 -4
  17. package/dist/convex/account-data.js.map +1 -1
  18. package/dist/convex/app.d.ts +1 -0
  19. package/dist/convex/app.d.ts.map +1 -1
  20. package/dist/convex/app.js +2 -1
  21. package/dist/convex/app.js.map +1 -1
  22. package/dist/convex/client/better-auth-options.d.ts.map +1 -1
  23. package/dist/convex/client/better-auth-options.js +12 -3
  24. package/dist/convex/client/better-auth-options.js.map +1 -1
  25. package/dist/convex/client/component.d.ts +4 -0
  26. package/dist/convex/client/component.d.ts.map +1 -1
  27. package/dist/convex/client/index.d.ts +5 -0
  28. package/dist/convex/client/index.d.ts.map +1 -1
  29. package/dist/convex/client/launch-gate.d.ts.map +1 -1
  30. package/dist/convex/client/launch-gate.js +30 -1
  31. package/dist/convex/client/launch-gate.js.map +1 -1
  32. package/dist/convex/client/plugins.d.ts.map +1 -1
  33. package/dist/convex/client/plugins.js +3 -0
  34. package/dist/convex/client/plugins.js.map +1 -1
  35. package/dist/convex/client/two-factor.d.ts +7 -0
  36. package/dist/convex/client/two-factor.d.ts.map +1 -0
  37. package/dist/convex/client/two-factor.js +57 -0
  38. package/dist/convex/client/two-factor.js.map +1 -0
  39. package/dist/convex/components/backend/_generated/api.d.ts +2 -0
  40. package/dist/convex/components/backend/_generated/api.d.ts.map +1 -1
  41. package/dist/convex/components/backend/_generated/api.js.map +1 -1
  42. package/dist/convex/components/backend/_generated/component.d.ts +292 -10
  43. package/dist/convex/components/backend/_generated/component.d.ts.map +1 -1
  44. package/dist/convex/components/backend/account.d.ts +63 -17
  45. package/dist/convex/components/backend/account.d.ts.map +1 -1
  46. package/dist/convex/components/backend/account.js +24 -1
  47. package/dist/convex/components/backend/account.js.map +1 -1
  48. package/dist/convex/components/backend/adapter.d.ts.map +1 -1
  49. package/dist/convex/components/backend/adapter.js +7 -2
  50. package/dist/convex/components/backend/adapter.js.map +1 -1
  51. package/dist/convex/components/backend/ai.d.ts +1 -1
  52. package/dist/convex/components/backend/billing.d.ts +10 -0
  53. package/dist/convex/components/backend/billing.d.ts.map +1 -1
  54. package/dist/convex/components/backend/billing.js +2 -1
  55. package/dist/convex/components/backend/billing.js.map +1 -1
  56. package/dist/convex/components/backend/commerce.d.ts +229 -0
  57. package/dist/convex/components/backend/commerce.d.ts.map +1 -0
  58. package/dist/convex/components/backend/commerce.js +392 -0
  59. package/dist/convex/components/backend/commerce.js.map +1 -0
  60. package/dist/convex/components/backend/funnel.d.ts +6 -6
  61. package/dist/convex/components/backend/jobs.d.ts +1 -1
  62. package/dist/convex/components/backend/referrals.d.ts +2 -2
  63. package/dist/convex/components/backend/schema.d.ts +327 -21
  64. package/dist/convex/components/backend/schema.d.ts.map +1 -1
  65. package/dist/convex/components/backend/schema.js +108 -1
  66. package/dist/convex/components/backend/schema.js.map +1 -1
  67. package/dist/convex/components/backend/waitlist.d.ts +42 -6
  68. package/dist/convex/components/backend/waitlist.d.ts.map +1 -1
  69. package/dist/convex/components/backend/waitlist.js +142 -39
  70. package/dist/convex/components/backend/waitlist.js.map +1 -1
  71. package/dist/convex/email-templates.d.ts +12 -0
  72. package/dist/convex/email-templates.d.ts.map +1 -1
  73. package/dist/convex/email-templates.js +3 -0
  74. package/dist/convex/email-templates.js.map +1 -1
  75. package/dist/convex/emails/waitlist-friend-joined.d.ts +9 -0
  76. package/dist/convex/emails/waitlist-friend-joined.d.ts.map +1 -0
  77. package/dist/convex/emails/waitlist-friend-joined.js +22 -0
  78. package/dist/convex/emails/waitlist-friend-joined.js.map +1 -0
  79. package/dist/convex/errors.d.ts +6 -6
  80. package/dist/convex/errors.d.ts.map +1 -1
  81. package/dist/convex/errors.js +14 -2
  82. package/dist/convex/errors.js.map +1 -1
  83. package/dist/convex/events.d.ts +19 -0
  84. package/dist/convex/events.d.ts.map +1 -1
  85. package/dist/convex/events.js +14 -0
  86. package/dist/convex/events.js.map +1 -1
  87. package/dist/convex/integrations/billing/checkout.d.ts +2 -2
  88. package/dist/convex/integrations/billing/checkout.d.ts.map +1 -1
  89. package/dist/convex/integrations/billing/checkout.js +79 -11
  90. package/dist/convex/integrations/billing/checkout.js.map +1 -1
  91. package/dist/convex/integrations/billing/commerce-entitlements.d.ts +12 -0
  92. package/dist/convex/integrations/billing/commerce-entitlements.d.ts.map +1 -0
  93. package/dist/convex/integrations/billing/commerce-entitlements.js +78 -0
  94. package/dist/convex/integrations/billing/commerce-entitlements.js.map +1 -0
  95. package/dist/convex/integrations/billing/commerce-events.d.ts +15 -0
  96. package/dist/convex/integrations/billing/commerce-events.d.ts.map +1 -0
  97. package/dist/convex/integrations/billing/commerce-events.js +433 -0
  98. package/dist/convex/integrations/billing/commerce-events.js.map +1 -0
  99. package/dist/convex/integrations/billing/commerce-history.d.ts +20 -0
  100. package/dist/convex/integrations/billing/commerce-history.d.ts.map +1 -0
  101. package/dist/convex/integrations/billing/commerce-history.js +106 -0
  102. package/dist/convex/integrations/billing/commerce-history.js.map +1 -0
  103. package/dist/convex/integrations/billing/commerce-webhooks.d.ts +23 -0
  104. package/dist/convex/integrations/billing/commerce-webhooks.d.ts.map +1 -0
  105. package/dist/convex/integrations/billing/commerce-webhooks.js +49 -0
  106. package/dist/convex/integrations/billing/commerce-webhooks.js.map +1 -0
  107. package/dist/convex/integrations/billing/commerce.d.ts +100 -0
  108. package/dist/convex/integrations/billing/commerce.d.ts.map +1 -0
  109. package/dist/convex/integrations/billing/commerce.js +323 -0
  110. package/dist/convex/integrations/billing/commerce.js.map +1 -0
  111. package/dist/convex/integrations/billing/context.d.ts +8 -0
  112. package/dist/convex/integrations/billing/context.d.ts.map +1 -1
  113. package/dist/convex/integrations/billing/context.js +14 -2
  114. package/dist/convex/integrations/billing/context.js.map +1 -1
  115. package/dist/convex/integrations/billing/credits.d.ts +1 -1
  116. package/dist/convex/integrations/billing/credits.d.ts.map +1 -1
  117. package/dist/convex/integrations/billing/credits.js +49 -28
  118. package/dist/convex/integrations/billing/credits.js.map +1 -1
  119. package/dist/convex/integrations/billing/customers.d.ts +1 -1
  120. package/dist/convex/integrations/billing/customers.d.ts.map +1 -1
  121. package/dist/convex/integrations/billing/customers.js +15 -1
  122. package/dist/convex/integrations/billing/customers.js.map +1 -1
  123. package/dist/convex/integrations/billing/entitlements.d.ts +1 -1
  124. package/dist/convex/integrations/billing/entitlements.d.ts.map +1 -1
  125. package/dist/convex/integrations/billing/entitlements.js +6 -1
  126. package/dist/convex/integrations/billing/entitlements.js.map +1 -1
  127. package/dist/convex/integrations/billing/erasure.d.ts +1 -1
  128. package/dist/convex/integrations/billing/erasure.d.ts.map +1 -1
  129. package/dist/convex/integrations/billing/erasure.js +10 -5
  130. package/dist/convex/integrations/billing/erasure.js.map +1 -1
  131. package/dist/convex/integrations/billing/free-plan.d.ts +6 -1
  132. package/dist/convex/integrations/billing/free-plan.d.ts.map +1 -1
  133. package/dist/convex/integrations/billing/free-plan.js +22 -4
  134. package/dist/convex/integrations/billing/free-plan.js.map +1 -1
  135. package/dist/convex/integrations/billing/functions.d.ts +1 -1
  136. package/dist/convex/integrations/billing/functions.d.ts.map +1 -1
  137. package/dist/convex/integrations/billing/functions.js +3 -2
  138. package/dist/convex/integrations/billing/functions.js.map +1 -1
  139. package/dist/convex/integrations/billing/gifts.d.ts.map +1 -1
  140. package/dist/convex/integrations/billing/gifts.js +3 -0
  141. package/dist/convex/integrations/billing/gifts.js.map +1 -1
  142. package/dist/convex/integrations/billing/history.d.ts +1 -1
  143. package/dist/convex/integrations/billing/history.d.ts.map +1 -1
  144. package/dist/convex/integrations/billing/history.js +6 -1
  145. package/dist/convex/integrations/billing/history.js.map +1 -1
  146. package/dist/convex/integrations/billing/lifecycle.d.ts +1 -1
  147. package/dist/convex/integrations/billing/lifecycle.d.ts.map +1 -1
  148. package/dist/convex/integrations/billing/lifecycle.js +4 -1
  149. package/dist/convex/integrations/billing/lifecycle.js.map +1 -1
  150. package/dist/convex/integrations/billing/providers/capabilities.d.ts +17 -0
  151. package/dist/convex/integrations/billing/providers/capabilities.d.ts.map +1 -0
  152. package/dist/convex/integrations/billing/providers/capabilities.js +77 -0
  153. package/dist/convex/integrations/billing/providers/capabilities.js.map +1 -0
  154. package/dist/convex/integrations/billing/providers/consent.d.ts +52 -0
  155. package/dist/convex/integrations/billing/providers/consent.d.ts.map +1 -0
  156. package/dist/convex/integrations/billing/providers/consent.js +79 -0
  157. package/dist/convex/integrations/billing/providers/consent.js.map +1 -0
  158. package/dist/convex/integrations/billing/providers/creem.d.ts +22 -0
  159. package/dist/convex/integrations/billing/providers/creem.d.ts.map +1 -0
  160. package/dist/convex/integrations/billing/providers/creem.js +208 -0
  161. package/dist/convex/integrations/billing/providers/creem.js.map +1 -0
  162. package/dist/convex/integrations/billing/providers/dodo.d.ts +15 -0
  163. package/dist/convex/integrations/billing/providers/dodo.d.ts.map +1 -0
  164. package/dist/convex/integrations/billing/providers/dodo.js +197 -0
  165. package/dist/convex/integrations/billing/providers/dodo.js.map +1 -0
  166. package/dist/convex/integrations/billing/providers/http.d.ts +41 -0
  167. package/dist/convex/integrations/billing/providers/http.d.ts.map +1 -0
  168. package/dist/convex/integrations/billing/providers/http.js +146 -0
  169. package/dist/convex/integrations/billing/providers/http.js.map +1 -0
  170. package/dist/convex/integrations/billing/providers/index.d.ts +35 -0
  171. package/dist/convex/integrations/billing/providers/index.d.ts.map +1 -0
  172. package/dist/convex/integrations/billing/providers/index.js +62 -0
  173. package/dist/convex/integrations/billing/providers/index.js.map +1 -0
  174. package/dist/convex/integrations/billing/providers/stripe.d.ts +28 -0
  175. package/dist/convex/integrations/billing/providers/stripe.d.ts.map +1 -0
  176. package/dist/convex/integrations/billing/providers/stripe.js +327 -0
  177. package/dist/convex/integrations/billing/providers/stripe.js.map +1 -0
  178. package/dist/convex/integrations/billing/providers/types.d.ts +263 -0
  179. package/dist/convex/integrations/billing/providers/types.d.ts.map +1 -0
  180. package/dist/convex/integrations/billing/providers/types.js +48 -0
  181. package/dist/convex/integrations/billing/providers/types.js.map +1 -0
  182. package/dist/convex/integrations/billing/subscriptions.d.ts +1 -1
  183. package/dist/convex/integrations/billing/subscriptions.d.ts.map +1 -1
  184. package/dist/convex/integrations/billing/subscriptions.js +20 -6
  185. package/dist/convex/integrations/billing/subscriptions.js.map +1 -1
  186. package/dist/convex/integrations/billing/types/setup.d.ts +64 -1
  187. package/dist/convex/integrations/billing/types/setup.d.ts.map +1 -1
  188. package/dist/convex/integrations/billing.d.ts +4 -1
  189. package/dist/convex/integrations/billing.d.ts.map +1 -1
  190. package/dist/convex/integrations/billing.js +12 -2
  191. package/dist/convex/integrations/billing.js.map +1 -1
  192. package/dist/convex/integrations/email.d.ts +1 -1
  193. package/dist/convex/integrations/email.d.ts.map +1 -1
  194. package/dist/convex/integrations/email.js.map +1 -1
  195. package/dist/convex/integrations/launch.d.ts +27 -2
  196. package/dist/convex/integrations/launch.d.ts.map +1 -1
  197. package/dist/convex/integrations/launch.js +15 -3
  198. package/dist/convex/integrations/launch.js.map +1 -1
  199. package/dist/convex/integrations/presence.d.ts +110 -0
  200. package/dist/convex/integrations/presence.d.ts.map +1 -0
  201. package/dist/convex/integrations/presence.js +92 -0
  202. package/dist/convex/integrations/presence.js.map +1 -0
  203. package/dist/convex/integrations/waitlist.d.ts +41 -7
  204. package/dist/convex/integrations/waitlist.d.ts.map +1 -1
  205. package/dist/convex/integrations/waitlist.js +45 -6
  206. package/dist/convex/integrations/waitlist.js.map +1 -1
  207. package/dist/convex/integrations/webhook-guard.d.ts +8 -0
  208. package/dist/convex/integrations/webhook-guard.d.ts.map +1 -1
  209. package/dist/convex/integrations/webhook-guard.js +11 -4
  210. package/dist/convex/integrations/webhook-guard.js.map +1 -1
  211. package/dist/convex/label-groups/admin.d.ts +9 -0
  212. package/dist/convex/label-groups/admin.d.ts.map +1 -1
  213. package/dist/convex/label-groups/admin.js +9 -0
  214. package/dist/convex/label-groups/admin.js.map +1 -1
  215. package/dist/convex/label-groups/audit.d.ts +2 -0
  216. package/dist/convex/label-groups/audit.d.ts.map +1 -1
  217. package/dist/convex/label-groups/audit.js +2 -0
  218. package/dist/convex/label-groups/audit.js.map +1 -1
  219. package/dist/convex/label-groups/auth.d.ts +9 -0
  220. package/dist/convex/label-groups/auth.d.ts.map +1 -1
  221. package/dist/convex/label-groups/auth.js +10 -0
  222. package/dist/convex/label-groups/auth.js.map +1 -1
  223. package/dist/convex/label-groups/email.d.ts +6 -0
  224. package/dist/convex/label-groups/email.d.ts.map +1 -1
  225. package/dist/convex/label-groups/email.js +7 -0
  226. package/dist/convex/label-groups/email.js.map +1 -1
  227. package/dist/convex/label-groups/errors.d.ts +4 -0
  228. package/dist/convex/label-groups/errors.d.ts.map +1 -1
  229. package/dist/convex/label-groups/errors.js +4 -0
  230. package/dist/convex/label-groups/errors.js.map +1 -1
  231. package/dist/convex/label-groups/security.d.ts +19 -0
  232. package/dist/convex/label-groups/security.d.ts.map +1 -1
  233. package/dist/convex/label-groups/security.js +20 -0
  234. package/dist/convex/label-groups/security.js.map +1 -1
  235. package/dist/convex/label-groups/waitlist.d.ts +8 -0
  236. package/dist/convex/label-groups/waitlist.d.ts.map +1 -1
  237. package/dist/convex/label-groups/waitlist.js +9 -0
  238. package/dist/convex/label-groups/waitlist.js.map +1 -1
  239. package/dist/convex/label-translations.d.ts.map +1 -1
  240. package/dist/convex/label-translations.js +24 -0
  241. package/dist/convex/label-translations.js.map +1 -1
  242. package/dist/convex/labels.d.ts +57 -0
  243. package/dist/convex/labels.d.ts.map +1 -1
  244. package/dist/convex/log.js +2 -0
  245. package/dist/convex/log.js.map +1 -1
  246. package/dist/convex/sensitive-actions.d.ts.map +1 -1
  247. package/dist/convex/sensitive-actions.js +11 -0
  248. package/dist/convex/sensitive-actions.js.map +1 -1
  249. package/dist/convex/waitlist-rules.d.ts +63 -9
  250. package/dist/convex/waitlist-rules.d.ts.map +1 -1
  251. package/dist/convex/waitlist-rules.js +38 -7
  252. package/dist/convex/waitlist-rules.js.map +1 -1
  253. package/dist/devtools-client/_nuxt/DHNi4uhO.js +6 -0
  254. package/dist/devtools-client/index.html +1 -1
  255. package/dist/env-registry.js +9 -0
  256. package/dist/module.d.ts +14 -2
  257. package/dist/module.js +2 -2
  258. package/dist/module.json +2 -2
  259. package/dist/runtime/locales/de.json +58 -1
  260. package/dist/runtime/locales/en.json +60 -3
  261. package/dist/runtime/locales/es.json +58 -1
  262. package/dist/runtime/locales/fr.json +58 -1
  263. package/dist/runtime/locales/ru.json +58 -1
  264. package/dist/runtime/server/monitoring/backend-calls.d.ts +3 -3
  265. package/dist/runtime/server/monitoring/backend-calls.js +2 -2
  266. package/dist/runtime/server/monitoring/health.js +2 -2
  267. package/dist/runtime/vue/auth-client.d.ts +3 -2
  268. package/dist/runtime/vue/auth-client.js +2 -1
  269. package/dist/runtime/vue/components/account/SecuritySettings.d.vue.ts +25 -2
  270. package/dist/runtime/vue/components/account/SecuritySettings.vue +52 -2
  271. package/dist/runtime/vue/components/account/SecuritySettings.vue.d.ts +25 -2
  272. package/dist/runtime/vue/components/account/SecurityTwoFactor.css +1 -0
  273. package/dist/runtime/vue/components/account/SecurityTwoFactor.d.vue.ts +4 -0
  274. package/dist/runtime/vue/components/account/SecurityTwoFactor.vue +107 -0
  275. package/dist/runtime/vue/components/account/SecurityTwoFactor.vue.d.ts +4 -0
  276. package/dist/runtime/vue/components/account/security-settings.d.ts +18 -1
  277. package/dist/runtime/vue/components/admin/AdminUsers.d.vue.ts +11 -2
  278. package/dist/runtime/vue/components/admin/AdminUsers.vue.d.ts +11 -2
  279. package/dist/runtime/vue/components/admin/AdminWaitlist.css +1 -1
  280. package/dist/runtime/vue/components/admin/AdminWaitlistActions.vue +41 -1
  281. package/dist/runtime/vue/components/admin/AdminWorkspaces.d.vue.ts +9 -0
  282. package/dist/runtime/vue/components/admin/AdminWorkspaces.vue.d.ts +9 -0
  283. package/dist/runtime/vue/components/admin/admin-waitlist-tab.js +28 -0
  284. package/dist/runtime/vue/components/auth/AuthForm.d.vue.ts +9 -0
  285. package/dist/runtime/vue/components/auth/AuthForm.vue +8 -0
  286. package/dist/runtime/vue/components/auth/AuthForm.vue.d.ts +9 -0
  287. package/dist/runtime/vue/components/auth/AuthFormTwoFactor.css +1 -0
  288. package/dist/runtime/vue/components/auth/AuthFormTwoFactor.d.vue.ts +3 -0
  289. package/dist/runtime/vue/components/auth/AuthFormTwoFactor.vue +70 -0
  290. package/dist/runtime/vue/components/auth/AuthFormTwoFactor.vue.d.ts +3 -0
  291. package/dist/runtime/vue/components/auth/AuthFormWaitlisted.vue +7 -2
  292. package/dist/runtime/vue/components/auth/WaitlistForm.d.vue.ts +8 -0
  293. package/dist/runtime/vue/components/auth/WaitlistForm.vue.d.ts +8 -0
  294. package/dist/runtime/vue/components/auth/WaitlistPlace.css +1 -1
  295. package/dist/runtime/vue/components/auth/WaitlistPlace.vue +37 -0
  296. package/dist/runtime/vue/components/auth/WaitlistShare.vue +2 -2
  297. package/dist/runtime/vue/components/auth/auth-form.d.ts +2 -0
  298. package/dist/runtime/vue/components/workspaces/AuditLog.d.vue.ts +2 -0
  299. package/dist/runtime/vue/components/workspaces/AuditLog.vue.d.ts +2 -0
  300. package/dist/runtime/vue/components/workspaces/WorkspaceSettings.d.vue.ts +2 -2
  301. package/dist/runtime/vue/components/workspaces/WorkspaceSettings.vue.d.ts +2 -2
  302. package/dist/runtime/vue/composables/use-login-flow.d.ts +19 -4
  303. package/dist/runtime/vue/composables/use-login-flow.js +31 -0
  304. package/dist/runtime/vue/composables/use-room-presence.d.ts +63 -0
  305. package/dist/runtime/vue/composables/use-room-presence.js +31 -0
  306. package/dist/runtime/vue/composables/use-two-factor.d.ts +58 -0
  307. package/dist/runtime/vue/composables/use-two-factor.js +49 -0
  308. package/dist/runtime/vue/composables/use-waitlist-admin.d.ts +5 -0
  309. package/dist/runtime/vue/composables/use-waitlist-admin.js +5 -1
  310. package/dist/runtime/vue/composables/use-waitlist.d.ts +4 -0
  311. package/dist/runtime/vue/composables/use-waitlist.js +1 -1
  312. package/dist/runtime/vue/parts.d.ts +8 -1
  313. package/dist/runtime/vue/two-factor-client.d.ts +15 -0
  314. package/dist/runtime/vue/two-factor-client.js +19 -0
  315. package/dist/runtime/vue/utils/auth-session.js +10 -1
  316. package/dist/runtime/vue/utils/login-bindings.js +1 -0
  317. package/dist/runtime/vue/utils/page-guard.d.ts +2 -2
  318. package/dist/runtime/vue/utils/page-guard.js +2 -2
  319. package/dist/shared/{nuxt-backend.CBvrM7pG.mjs → nuxt-backend.CM_p0XQE.mjs} +1 -1
  320. package/dist/shared/{nuxt-backend.Dikfaocl.mjs → nuxt-backend.C_Y_BtBs.mjs} +128 -5
  321. package/dist/shared/{nuxt-backend.DbaXvH__.mjs → nuxt-backend.ChvlbHQq.mjs} +203 -9
  322. package/dist/shared/{nuxt-backend.BqXAZChe.mjs → nuxt-backend.D16peTIt.mjs} +57 -35
  323. package/dist/shared/{nuxt-backend.DH1Ya3uB.mjs → nuxt-backend.D4JXvCP6.mjs} +3 -2
  324. package/dist/types.d.ts +1 -1
  325. package/package.json +19 -10
  326. package/skills/nuxt-backend/SKILL.md +18 -18
  327. package/skills/nuxt-backend/references/api.md +31 -6
  328. package/skills/nuxt-backend/references/install.md +9 -6
  329. package/skills/nuxt-backend/references/renames.json +8 -0
  330. package/skills/nuxt-backend/references/surface.json +62 -2
  331. package/skills/nuxt-backend-auth/SKILL.md +8 -2
  332. package/skills/nuxt-backend-auth/references/api.md +3 -1
  333. package/skills/nuxt-backend-billing/SKILL.md +15 -0
  334. package/skills/nuxt-backend-billing/references/api.md +14 -1
  335. package/skills/nuxt-backend-data/SKILL.md +1 -0
  336. package/skills/nuxt-backend-data/references/api.md +10 -1
  337. package/skills/nuxt-backend-email/references/api.md +1 -1
  338. package/skills/nuxt-backend-ship/SKILL.md +2 -1
  339. package/skills/nuxt-backend-upgrade/references/upgrade.md +6 -0
  340. package/src/convex/access-tickets.ts +10 -2
  341. package/src/convex/account-data.ts +5 -4
  342. package/src/convex/app.ts +2 -1
  343. package/src/convex/client/better-auth-options.ts +12 -3
  344. package/src/convex/client/launch-gate.ts +28 -1
  345. package/src/convex/client/plugins.ts +3 -0
  346. package/src/convex/client/two-factor.ts +66 -0
  347. package/src/convex/components/backend/_generated/api.ts +2 -0
  348. package/src/convex/components/backend/_generated/component.ts +500 -2
  349. package/src/convex/components/backend/account.ts +25 -1
  350. package/src/convex/components/backend/adapter.ts +7 -2
  351. package/src/convex/components/backend/billing.ts +2 -1
  352. package/src/convex/components/backend/commerce.ts +408 -0
  353. package/src/convex/components/backend/schema.ts +110 -1
  354. package/src/convex/components/backend/waitlist.ts +144 -40
  355. package/src/convex/email-templates.ts +16 -0
  356. package/src/convex/emails/waitlist-friend-joined.ts +23 -0
  357. package/src/convex/errors.ts +15 -2
  358. package/src/convex/events.ts +14 -0
  359. package/src/convex/integrations/billing/checkout.ts +78 -11
  360. package/src/convex/integrations/billing/commerce-entitlements.ts +92 -0
  361. package/src/convex/integrations/billing/commerce-events.ts +487 -0
  362. package/src/convex/integrations/billing/commerce-history.ts +110 -0
  363. package/src/convex/integrations/billing/commerce-webhooks.ts +69 -0
  364. package/src/convex/integrations/billing/commerce.ts +366 -0
  365. package/src/convex/integrations/billing/context.ts +19 -2
  366. package/src/convex/integrations/billing/credits.ts +47 -27
  367. package/src/convex/integrations/billing/customers.ts +15 -1
  368. package/src/convex/integrations/billing/entitlements.ts +5 -1
  369. package/src/convex/integrations/billing/erasure.ts +11 -6
  370. package/src/convex/integrations/billing/free-plan.ts +30 -5
  371. package/src/convex/integrations/billing/functions.ts +3 -2
  372. package/src/convex/integrations/billing/gifts.ts +2 -0
  373. package/src/convex/integrations/billing/history.ts +9 -0
  374. package/src/convex/integrations/billing/lifecycle.ts +3 -1
  375. package/src/convex/integrations/billing/providers/capabilities.ts +78 -0
  376. package/src/convex/integrations/billing/providers/consent.ts +94 -0
  377. package/src/convex/integrations/billing/providers/creem.ts +225 -0
  378. package/src/convex/integrations/billing/providers/dodo.ts +214 -0
  379. package/src/convex/integrations/billing/providers/http.ts +168 -0
  380. package/src/convex/integrations/billing/providers/index.ts +65 -0
  381. package/src/convex/integrations/billing/providers/stripe.ts +345 -0
  382. package/src/convex/integrations/billing/providers/types.ts +281 -0
  383. package/src/convex/integrations/billing/subscriptions.ts +20 -6
  384. package/src/convex/integrations/billing/types/setup.ts +63 -1
  385. package/src/convex/integrations/billing.ts +46 -3
  386. package/src/convex/integrations/email.ts +1 -0
  387. package/src/convex/integrations/launch.ts +45 -7
  388. package/src/convex/integrations/presence.ts +160 -0
  389. package/src/convex/integrations/waitlist.ts +84 -12
  390. package/src/convex/integrations/webhook-guard.ts +20 -4
  391. package/src/convex/label-groups/admin.ts +9 -0
  392. package/src/convex/label-groups/audit.ts +2 -0
  393. package/src/convex/label-groups/auth.ts +10 -0
  394. package/src/convex/label-groups/email.ts +7 -0
  395. package/src/convex/label-groups/errors.ts +4 -0
  396. package/src/convex/label-groups/security.ts +20 -0
  397. package/src/convex/label-groups/waitlist.ts +9 -0
  398. package/src/convex/label-translations.ts +24 -0
  399. package/src/convex/log.ts +2 -0
  400. package/src/convex/sensitive-actions.ts +11 -0
  401. package/src/convex/waitlist-rules.ts +84 -8
  402. package/src/runtime/vue/components/account/SecuritySettings.vue +58 -4
  403. package/src/runtime/vue/components/account/SecurityTwoFactor.css +68 -0
  404. package/src/runtime/vue/components/account/SecurityTwoFactor.vue +113 -0
  405. package/src/runtime/vue/components/admin/AdminWaitlist.css +1 -0
  406. package/src/runtime/vue/components/admin/AdminWaitlistActions.vue +44 -2
  407. package/src/runtime/vue/components/auth/AuthForm.vue +8 -0
  408. package/src/runtime/vue/components/auth/AuthFormTwoFactor.css +40 -0
  409. package/src/runtime/vue/components/auth/AuthFormTwoFactor.vue +75 -0
  410. package/src/runtime/vue/components/auth/AuthFormWaitlisted.vue +11 -4
  411. package/src/runtime/vue/components/auth/WaitlistPlace.css +16 -0
  412. package/src/runtime/vue/components/auth/WaitlistPlace.vue +49 -2
  413. package/src/runtime/vue/components/auth/WaitlistShare.vue +4 -3
  414. package/dist/devtools-client/_nuxt/CiCAOwUc.js +0 -5
@@ -154,6 +154,14 @@ export interface WebhookDelivery<Ctx> {
154
154
  service: WebhookService
155
155
  /** The provider's delivery id header (`webhook-id` / `svix-id`). */
156
156
  deliveryId: string | null
157
+ /**
158
+ * The delivery id a provider writes in the body instead of a header
159
+ * (Stripe's and Creem's event `id`), read once the body is in and
160
+ * before anything verifies it, for the redelivery dedupe and the log row.
161
+ * Unverified, as a header id is: a forged body naming an id already
162
+ * handled only gets the same 200 the real redelivery would.
163
+ */
164
+ bodyDeliveryId?: (body: string) => string | null
157
165
  /**
158
166
  * The inbound request. The edge reads its body, once, and only after the
159
167
  * secret check and a `Content-Length` over the cap have had their say.
@@ -203,12 +211,15 @@ function logRejected(service: WebhookService, outcome: keyof typeof REFUSALS, st
203
211
 
204
212
  /** One delivery's log: its row in the delivery log, and the refusal that also writes the deployment-log line. */
205
213
  interface DeliveryRecorder {
214
+ /** Key the row by an id read from the body, once it is in. */
215
+ rekey: (deliveryId: string) => void
206
216
  record: (outcome: WebhookOutcome, details?: { type?: string, note?: string }) => Promise<void>
207
217
  refuse: (outcome: keyof typeof REFUSALS, response?: Response, note?: string) => Promise<Response>
208
218
  }
209
219
 
210
220
  /** The recorder for one delivery; a log write that fails is reported and never fails the delivery. */
211
- function deliveryRecorder(log: GuardCtx, refs: WebhookLogRefs, service: WebhookService, deliveryId: string): DeliveryRecorder {
221
+ function deliveryRecorder(log: GuardCtx, refs: WebhookLogRefs, service: WebhookService, firstId: string): DeliveryRecorder {
222
+ let deliveryId = firstId
212
223
  const record: DeliveryRecorder['record'] = async (outcome, details) => {
213
224
  try {
214
225
  await log.runMutation(refs.record as never, { service, deliveryId, type: details?.type, outcome, note: details?.note } as never)
@@ -224,7 +235,10 @@ function deliveryRecorder(log: GuardCtx, refs: WebhookLogRefs, service: WebhookS
224
235
  logRejected(service, outcome, answer.status)
225
236
  return answer
226
237
  }
227
- return { record, refuse }
238
+ const rekey: DeliveryRecorder['rekey'] = (id) => {
239
+ deliveryId = id
240
+ }
241
+ return { rekey, record, refuse }
228
242
  }
229
243
 
230
244
  /**
@@ -277,8 +291,10 @@ async function answerBeforeRoute<Ctx>(log: GuardCtx, refs: WebhookLogRefs, deliv
277
291
  }
278
292
  const body = await readCappedBody(delivery.request)
279
293
  if (body === null) return logged.refuse('oversized')
280
- if (!delivery.deliveryId) return body
281
- const prior = await log.runQuery(refs.find as never, { service, deliveryId: delivery.deliveryId } as never) as { outcome: WebhookOutcome } | null
294
+ const deliveryId = delivery.deliveryId ?? delivery.bodyDeliveryId?.(body) ?? null
295
+ if (!deliveryId) return body
296
+ if (!delivery.deliveryId) logged.rekey(deliveryId)
297
+ const prior = await log.runQuery(refs.find as never, { service, deliveryId } as never) as { outcome: WebhookOutcome } | null
282
298
  if (prior?.outcome !== 'ok') return body
283
299
  await logged.record('duplicate')
284
300
  return new Response('Already processed', { status: 200 })
@@ -761,6 +761,15 @@ const ADMIN_LABELS = {
761
761
  declineConfirm: 'Decline {count} entry? Its ticket is withdrawn. | Decline {count} entries? Their tickets are withdrawn.',
762
762
  abuseConfirm: 'Remove {count} entry as abuse? What it gave the friend who shared with it is taken back. | Remove {count} entries as abuse? What each gave the friend who shared with it is taken back.',
763
763
  noEntries: 'Nobody here yet.',
764
+ planTitle: 'The next wave',
765
+ planHint: 'People waiting see whether they are in it, and how many friends would put them in it, never its size.',
766
+ planSize: 'People in it',
767
+ planOpensAt: 'Opens on (optional)',
768
+ plan: 'Plan',
769
+ planning: 'Planning…',
770
+ planned: 'The next wave is planned.',
771
+ planCleared: 'The plan is cleared.',
772
+ planClear: 'Clear the plan',
764
773
  capsTitle: 'Room for a wave',
765
774
  capsHint: 'A wave is bounded by the sign-in codes the deployment allows and the email plan\'s daily quota.',
766
775
  capCodes: 'Sign-in codes left this hour: {left} of {limit}',
@@ -104,6 +104,8 @@ const AUDIT_LABELS = {
104
104
  admitted: '{actor} admitted people from the waitlist',
105
105
  declined: '{actor} declined waitlist entries',
106
106
  left: '{actor} left the waitlist',
107
+ friend_joined: '{actor} joined the waitlist through a friend\'s link',
108
+ wave_planned: '{actor} planned the next waitlist wave',
107
109
  },
108
110
  report: {
109
111
  decided: '{actor} decided reported content',
@@ -51,6 +51,16 @@ const AUTH_LABELS = {
51
51
  ageQuestion: 'How old are you?',
52
52
  ageSubmit: 'Continue',
53
53
  ageChecking: 'Checking…',
54
+ // The second step of a code sign-in, for an account with an authenticator app.
55
+ twoFactorIntro: 'Enter the 6-digit code from your authenticator app.',
56
+ twoFactorBackupIntro: 'Enter one of the backup codes you saved when you turned on the authenticator app. Each works once.',
57
+ twoFactorCode: 'Authentication code',
58
+ twoFactorBackupCode: 'Backup code',
59
+ twoFactorTrustDevice: 'Don\'t ask again on this device for 30 days',
60
+ twoFactorSubmit: 'Verify',
61
+ twoFactorChecking: 'Checking the code…',
62
+ twoFactorUseBackup: 'Use a backup code instead',
63
+ twoFactorUseApp: 'Use the authenticator app instead',
54
64
  haveInviteCode: 'I have an invite code',
55
65
  // An address the email provider stopped delivering to: the same words whether or not an account holds it.
56
66
  undeliverable: 'We can\'t send email to this address right now. Use another address, or contact us for help.',
@@ -146,6 +146,13 @@ const EMAIL_LABELS = {
146
146
  note: 'We admit in waves and may also admit by other criteria. Your place can change. Use this link to check it any time. It needs no sign-in code, so keep the email to yourself.',
147
147
  action: 'See your place',
148
148
  },
149
+ // To a waiting person, at most once a day, when a friend joins with their link (`boost.notify`).
150
+ waitlistFriendJoined: {
151
+ subject: 'A friend joined with your link',
152
+ intro: 'A friend joined the waitlist with your link. {count} friend has joined so far. | A friend joined the waitlist with your link. {count} friends have joined so far.',
153
+ note: 'Every friend who joins with your link moves you up the line.',
154
+ action: 'See your place',
155
+ },
149
156
  topicConfirmation: {
150
157
  subject: 'Confirm: {topic}',
151
158
  intro: 'You asked to receive {topic}. Confirm with one press, and it starts.',
@@ -28,6 +28,7 @@ const ERROR_LABELS = {
28
28
  forbidden_invitation_refused: 'This invitation can\'t be sent.',
29
29
  forbidden_ticket_required: 'Signing up needs an invite right now.',
30
30
  forbidden_consent_required: 'Accept the updated terms to continue.',
31
+ forbidden_two_factor_required: 'Enter the code from your authenticator app to finish signing in.',
31
32
  forbidden_age_required: 'Tell us how old you are to continue.',
32
33
  forbidden_under_age: 'We can\'t create an account for you.',
33
34
  forbidden_sole_owner: 'You\'re the only owner of a workspace others belong to. Make another member an owner first.',
@@ -61,6 +62,9 @@ const ERROR_LABELS = {
61
62
  invalid_input_invite_expired: 'That invite code has expired.',
62
63
  invalid_input_invite_used_up: 'That invite code has been used up.',
63
64
  invalid_input_invite_revoked: 'That invite code is no longer valid.',
65
+ invalid_input_twoFactorCode: 'That code isn\'t right. Check your authenticator app and try again.',
66
+ invalid_input_backup_code: 'That backup code isn\'t right, or it was used already.',
67
+ invalid_input_two_factor_expired: 'That sign-in took too long. Start again with a new sign-in code.',
64
68
  invalid_input_recoveryCode: 'That recovery code isn\'t right, or it was used already.',
65
69
  invalid_input_passkeys: 'A passkey-only account needs a passkey. Add one, or allow sign-in codes again first.',
66
70
  invalid_input_slug: 'That name is taken. Try another one.',
@@ -23,6 +23,26 @@ const SECURITY_LABELS = {
23
23
  removeNamed: 'Remove passkey {name}',
24
24
  removing: 'Removing…',
25
25
  removeConfirm: 'Remove passkey “{name}”?',
26
+ // The authenticator app, asked for after a sign-in code (TOTP).
27
+ twoFactor: 'Authenticator app',
28
+ twoFactorHint: 'After a sign-in code, ask for a code from an authenticator app too. A passkey sign-in needs none.',
29
+ twoFactorOn: 'On: a sign-in code is followed by a code from your authenticator app.',
30
+ twoFactorStart: 'Set up an authenticator app',
31
+ twoFactorStarting: 'Preparing…',
32
+ twoFactorScan: 'Add this account to your authenticator app: open the link on this device, or type the key.',
33
+ twoFactorOpenApp: 'Open in authenticator app',
34
+ twoFactorKey: 'Key: {secret}',
35
+ twoFactorCode: 'Code from the app',
36
+ twoFactorConfirm: 'Turn on',
37
+ twoFactorConfirming: 'Checking the code…',
38
+ twoFactorEnabled: 'Authenticator app turned on.',
39
+ twoFactorDisable: 'Turn off',
40
+ twoFactorDisabling: 'Turning off…',
41
+ twoFactorDisableConfirm: 'Turn off the authenticator app? Sign-in codes will work alone again.',
42
+ twoFactorDisabled: 'Authenticator app turned off.',
43
+ backupCodes: 'Backup codes: each one works once in place of the app. Keep them somewhere safe. They are shown once.',
44
+ backupCodesNew: 'Make new backup codes',
45
+ backupCodesMaking: 'Making new codes…',
26
46
  sessions: 'Active sessions',
27
47
  sessionsLoading: 'Loading sessions…',
28
48
  unknownDevice: 'Unknown device',
@@ -20,6 +20,14 @@ const WAITLIST_LABELS = {
20
20
  back: 'Use another address',
21
21
  placed: 'You\'re #{position} of {total}',
22
22
  placedUnknown: 'You\'re on the waitlist.',
23
+ // Where rank is private (`place: { rank: false }`): the person's own facts, never the list's size.
24
+ joinedOn: 'You joined on {date}.',
25
+ credit: 'Your friends moved you {count} day up the line. | Your friends moved you {count} days up the line.',
26
+ creditHours: 'Your friends moved you {count} hour up the line. | Your friends moved you {count} hours up the line.',
27
+ creditMinutes: 'Your friends moved you {count} minute up the line. | Your friends moved you {count} minutes up the line.',
28
+ waveIn: 'You\'re in the next wave, for now.',
29
+ waveShort: '{count} more friend puts you in the next wave. | {count} more friends put you in the next wave.',
30
+ waveOpens: 'The next wave opens on {date}.',
23
31
  disclosure: 'We admit in waves and may also admit by other criteria. Your position can change.',
24
32
  admitted: 'You\'re in. Sign up with the address you joined with.',
25
33
  signUp: 'Sign up',
@@ -29,6 +37,7 @@ const WAITLIST_LABELS = {
29
37
  dropReferral: 'Not from a friend',
30
38
  shareTitle: 'Move up the list',
31
39
  shareIntro: 'Each friend who joins with your link moves you up, up to {cap} friends.',
40
+ shareIntroOpen: 'Each friend who joins with your link moves you up, with no limit.',
32
41
  shareLink: 'Your link',
33
42
  copy: 'Copy',
34
43
  copied: 'Copied',
@@ -183,6 +183,12 @@ export const LABEL_TRANSLATIONS: Record<string, LabelTree> = {
183
183
  note: 'Мы допускаем людей волнами и можем допускать и по другим критериям. Ваше место может меняться. По этой ссылке его можно проверить в любой момент. Код для входа ей не нужен, поэтому никому не пересылайте это письмо.',
184
184
  action: 'Посмотреть своё место',
185
185
  },
186
+ waitlistFriendJoined: {
187
+ subject: 'По вашей ссылке записался друг',
188
+ intro: 'По вашей ссылке в список ожидания записался друг. Пока это {count} друг. | По вашей ссылке в список ожидания записался друг. Друзей пока: {count}.',
189
+ note: 'Каждый друг, записавшийся по вашей ссылке, поднимает вас выше в очереди.',
190
+ action: 'Посмотреть своё место',
191
+ },
186
192
  topicConfirmation: {
187
193
  subject: 'Подтвердите: {topic}',
188
194
  intro: 'Вы попросили присылать вам {topic}. Подтвердите одним нажатием — и рассылка начнётся.',
@@ -655,6 +661,12 @@ export const LABEL_TRANSLATIONS: Record<string, LabelTree> = {
655
661
  note: 'Wir lassen in Wellen zu und können auch nach anderen Kriterien zulassen. Ihr Platz kann sich ändern. Über diesen Link können Sie ihn jederzeit prüfen. Er braucht keinen Anmeldecode, also geben Sie diese E-Mail nicht weiter.',
656
662
  action: 'Ihren Platz ansehen',
657
663
  },
664
+ waitlistFriendJoined: {
665
+ subject: 'Jemand hat sich über Ihren Link eingetragen',
666
+ intro: 'Jemand hat sich über Ihren Link auf die Warteliste gesetzt. Bisher {count} Person. | Jemand hat sich über Ihren Link auf die Warteliste gesetzt. Bisher {count} Personen.',
667
+ note: 'Jede Person, die sich über Ihren Link einträgt, bringt Sie auf der Warteliste nach vorn.',
668
+ action: 'Ihren Platz ansehen',
669
+ },
658
670
  topicConfirmation: {
659
671
  subject: 'Bestätigen: {topic}',
660
672
  intro: 'Sie möchten {topic} erhalten. Bestätigen Sie mit einem Klick, dann geht es los.',
@@ -1127,6 +1139,12 @@ export const LABEL_TRANSLATIONS: Record<string, LabelTree> = {
1127
1139
  note: 'Admitimos por tandas y también podemos admitir según otros criterios. Tu puesto puede cambiar. Usa este enlace para consultarlo cuando quieras. No necesita código de inicio de sesión, así que no compartas este correo.',
1128
1140
  action: 'Ver tu puesto',
1129
1141
  },
1142
+ waitlistFriendJoined: {
1143
+ subject: 'Un amigo se unió con tu enlace',
1144
+ intro: 'Un amigo se unió a la lista de espera con tu enlace. Llevas {count} amigo. | Un amigo se unió a la lista de espera con tu enlace. Llevas {count} amigos.',
1145
+ note: 'Cada amigo que se una con tu enlace te hace subir en la fila.',
1146
+ action: 'Ver tu puesto',
1147
+ },
1130
1148
  topicConfirmation: {
1131
1149
  subject: 'Confirma: {topic}',
1132
1150
  intro: 'Pediste recibir {topic}. Confirma con un clic y empezará.',
@@ -1599,6 +1617,12 @@ export const LABEL_TRANSLATIONS: Record<string, LabelTree> = {
1599
1617
  note: 'Nous admettons les personnes par vagues et pouvons aussi les admettre selon d’autres critères. Votre place peut changer. Utilisez ce lien pour la consulter à tout moment. Il ne nécessite aucun code de connexion : gardez cet e-mail pour vous.',
1600
1618
  action: 'Voir votre place',
1601
1619
  },
1620
+ waitlistFriendJoined: {
1621
+ subject: 'Un ami s’est inscrit avec votre lien',
1622
+ intro: 'Un ami s’est inscrit sur la liste d’attente avec votre lien. {count} ami inscrit jusqu’ici. | Un ami s’est inscrit sur la liste d’attente avec votre lien. Amis inscrits jusqu’ici : {count}.',
1623
+ note: 'Chaque ami qui s’inscrit avec votre lien vous fait avancer dans la file.',
1624
+ action: 'Voir votre place',
1625
+ },
1602
1626
  topicConfirmation: {
1603
1627
  subject: 'Confirmez : {topic}',
1604
1628
  intro: 'Vous avez demandé à recevoir {topic}. Confirmez en un clic, et c’est parti.',
package/src/convex/log.ts CHANGED
@@ -27,6 +27,7 @@ export const LOG_CODES = {
27
27
  'waitlist.mirror_drift': 'A launch-news contact could not be written to the email provider after its retries; its waitlist entry is flagged and the next maintenance pass tries again.',
28
28
  'waitlist.admitted_unsent': 'A waitlist entry was admitted, but its "You\'re in" email was not sent; the ticket stands.',
29
29
  'waitlist.confirmation_unsent': 'A new waitlist entry was recorded, but its confirmation email (the status link) or its join event was not sent; the entry stands.',
30
+ 'waitlist.friend_unsent': 'A friend joined through a waiting person\'s share link, but the "A friend joined" email to that person was not sent; the credit stands.',
30
31
  'waitlist.caps_unread': 'The Waitlist tab could not read the sign-in code budget or the email provider\'s usage; the tab shows it as not known.',
31
32
  'email.inbound_rejected': 'Inbound mail was dropped before it reached the app\'s hooks. The `reason` says why: `dmarc` (the sender failed DMARC, or a reply\'s sender did not pass it), `rate_limited` (past the inbound rate limit), `sender_mismatch` (a reply address answered by someone else) or `unknown_recipient` (no reply address, workspace or support address claims it).',
32
33
  'email.contact_held': 'A contact message was stored but not sent to the team: EMAIL_API_KEY is not set, or the deployment is in test mode and the address is not one of the provider\'s test addresses. It stays in the admin console\'s Inbox tab.',
@@ -74,6 +75,7 @@ export const LOG_CODES = {
74
75
  'billing.withdrawal_receipt_failed': 'An EU withdrawal went through at the provider, but its receipt email could not be sent; the activity trail holds its date and time.',
75
76
  'billing.consent_unrecorded': 'A renewing checkout was created, but the proof of its renewal consent could not be kept.',
76
77
  'billing.reverse_trial_failed': 'A new workspace stayed on the free plan: its reverse trial could not start.',
78
+ 'billing.commerce_unknown_entity': 'A billing delivery from Stripe, Dodo or Creem named no billing entity the app knows; it was acknowledged and left out.',
77
79
  'billing.welcome_credits_unqueued': 'A new billing entity started on the free plan, but its welcome credits could not be queued.',
78
80
  'billing.welcome_credits_unsynced': 'Welcome credits were granted, but the balance could not be read back yet.',
79
81
  'billing.pass_period_unaligned': 'A claimed plan pass kept the provider\'s billing period instead of starting its first month at the claim; its end date still holds, enforced by the sweep.',
@@ -135,6 +135,17 @@ const ROWS = {
135
135
  '/passkey/update-passkey': OWN,
136
136
  // Turning sign-in codes off (or on, or a new recovery code) changes how the account is defended.
137
137
  '/passkey-only/set': STEP_UP,
138
+ // The authenticator app: turning it on or off, its secret and its backup codes change how the account is defended.
139
+ '/two-factor/enable': STEP_UP,
140
+ '/two-factor/disable': STEP_UP,
141
+ '/two-factor/get-totp-uri': STEP_UP,
142
+ '/two-factor/generate-backup-codes': STEP_UP,
143
+ // The step after a code: the challenge it holds is the code's own, and the plugin locks the account after wrong codes.
144
+ '/two-factor/verify-totp': { ...OWN, limit: CHECKS_CODE },
145
+ '/two-factor/verify-backup-code': { ...OWN, limit: CHECKS_CODE },
146
+ // An emailed second code: off, since the first factor is one already; the routes answer that.
147
+ '/two-factor/send-otp': OWN,
148
+ '/two-factor/verify-otp': { ...OWN, limit: CHECKS_CODE },
138
149
 
139
150
  // ── Workspaces ─────────────────────────────────────────────────────────
140
151
  '/organization/list': VISIT,
@@ -25,6 +25,8 @@ export const WAITLIST_SOURCE_MAX = 64
25
25
  export const WAITLIST_NOTE_MAX = 500
26
26
  /** The most entries one admission takes (the tab's "next N"). */
27
27
  export const WAITLIST_WAVE_MAX = 200
28
+ /** The largest wave an administrator may plan; it is admitted 200 at a time. */
29
+ export const WAITLIST_WAVE_PLAN_MAX = 10_000
28
30
  /** The most entries a console read lists. */
29
31
  export const WAITLIST_CONSOLE_ROWS = 200
30
32
  /** How many of a status's oldest entries a filtered console read looks through. */
@@ -38,18 +40,92 @@ export const SOURCE_SIGN_IN = 'sign-in'
38
40
  /** The source of an entry made on a form, when the app names none. */
39
41
  export const SOURCE_FORM = 'form'
40
42
 
41
- /** How many friends move a person up, by default, and how far each moves them. */
42
- export const DEFAULT_BOOST = { cap: 10, days: 1 } as const
43
-
44
43
  const DAY_MS = 24 * 60 * 60 * 1000
45
44
 
46
45
  /**
47
- * The key people queue by: when they were verified, moved up by their
48
- * boost. A friend is worth `days` days, up to the cap, so one sharer never
49
- * jumps a whole list and a long wait still counts. Ties break by entry id.
46
+ * How the line rewards sharing, as the component applies it: how far each
47
+ * friend moves the sharer up, how many friends count, and how far a friend
48
+ * who came through a link starts up the line themselves. Durations in ms.
49
+ */
50
+ export interface WaitlistBoostRule {
51
+ /** How far each friend moves the sharer up the line. */
52
+ perFriend: number
53
+ /** The most friends that count for one person; `null` for no limit, 0 when sharing is off. */
54
+ cap: number | null
55
+ /** How far a friend who came through a link starts up the line. */
56
+ welcome: number
57
+ }
58
+
59
+ /** The package's rule: a day for each friend, up to ten, and nothing for the friend. */
60
+ export const DEFAULT_BOOST: WaitlistBoostRule = { perFriend: DAY_MS, cap: 10, welcome: 0 }
61
+
62
+ /** The most a single friend, or a welcome, may be worth: a year. */
63
+ export const WAITLIST_BOOST_MAX_MS = 365 * DAY_MS
64
+
65
+ /**
66
+ * The waitlist's rule, checked, as the sign-in gate and `setupWaitlist`
67
+ * read it: how sharing moves people, whether a person may read their place
68
+ * and the size of the list, and whether a sharer hears of a friend.
69
+ */
70
+ export interface WaitlistRule {
71
+ boost: WaitlistBoostRule
72
+ /** Whether a person reads their place and how many wait. */
73
+ rank: boolean
74
+ /** Whether a sharer is emailed when a friend joins with their link. */
75
+ notify: boolean
76
+ }
77
+
78
+ /** How sharing moves people up the line, as `setupAccess({ waitlist: { boost } })` takes it. Durations in milliseconds. */
79
+ export interface WaitlistBoostOptions {
80
+ /** How far each friend who joins through a person's link moves them up the line. Default a day; at most a year. */
81
+ perFriend?: number
82
+ /** The most friends that count for one person. Default 10; `null` for no limit. */
83
+ cap?: number | null
84
+ /** How far the friend starts up the line themselves, for coming through a link. Default 0. */
85
+ welcome?: number
86
+ /** Email the person, at most once a day, when a friend joins with their link (`waitlistFriendJoined`). Default false. */
87
+ notify?: boolean
88
+ }
89
+
90
+ /** The waitlist's rule as `setupAccess({ waitlist })` takes it. */
91
+ export interface WaitlistOptions {
92
+ /** How sharing moves people; `false` turns it off. Default: a day a friend, up to ten, nothing for the friend. */
93
+ boost?: WaitlistBoostOptions | false
94
+ /** What a person reads of their standing; `{ rank: false }` keeps their position and the list's size to the administrators. */
95
+ place?: { rank?: boolean }
96
+ }
97
+
98
+ /** The rule `setupAccess({ waitlist })` names, checked: whole milliseconds, a positive step, a cap of at least one friend or none. */
99
+ export function checkedWaitlistRule(options: WaitlistOptions | undefined): WaitlistRule {
100
+ const rank = options?.place?.rank !== false
101
+ const boost = options?.boost
102
+ if (boost === false) return { boost: { ...DEFAULT_BOOST, cap: 0, welcome: 0 }, rank, notify: false }
103
+ const perFriend = boost?.perFriend ?? DEFAULT_BOOST.perFriend
104
+ const cap = boost?.cap === undefined ? DEFAULT_BOOST.cap : boost.cap
105
+ const welcome = boost?.welcome ?? DEFAULT_BOOST.welcome
106
+ if (!Number.isInteger(perFriend) || perFriend < 60_000 || perFriend > WAITLIST_BOOST_MAX_MS) throw new TypeError('[nuxt-backend] setupAccess: `waitlist.boost.perFriend` is a whole number of milliseconds, from a minute to a year.')
107
+ if (cap !== null && (!Number.isInteger(cap) || cap < 1)) throw new TypeError('[nuxt-backend] setupAccess: `waitlist.boost.cap` is a whole number of friends, at least 1, or `null` for no limit. To turn sharing off, pass `boost: false`.')
108
+ if (!Number.isInteger(welcome) || welcome < 0 || welcome > WAITLIST_BOOST_MAX_MS) throw new TypeError('[nuxt-backend] setupAccess: `waitlist.boost.welcome` is a whole number of milliseconds, from 0 to a year.')
109
+ return { boost: { perFriend, cap, welcome }, rank, notify: boost?.notify === true }
110
+ }
111
+
112
+ /**
113
+ * The key people queue by: when they were verified, moved up by the credit
114
+ * their friends earned them (and the welcome a link gave them). The date
115
+ * itself is never rewritten: only the key moves. Ties break by entry id.
116
+ */
117
+ export function queueKey(verifiedAt: number, credit = 0): number {
118
+ return verifiedAt - credit
119
+ }
120
+
121
+ /**
122
+ * How many more friends put a person ahead of a cutoff key, each friend
123
+ * moving them `perFriend` up: 0 when they stand ahead of it already. A key
124
+ * equal to the cutoff counts as behind it, as a tie may break either way.
50
125
  */
51
- export function queueKey(verifiedAt: number, boost: number, days: number = DEFAULT_BOOST.days): number {
52
- return verifiedAt - boost * days * DAY_MS
126
+ export function friendsShortOf(key: number, cutoff: number, perFriend: number): number {
127
+ if (key < cutoff) return 0
128
+ return Math.floor((key - cutoff) / perFriend) + 1
53
129
  }
54
130
 
55
131
  /** An address as the waitlist keeps it: trimmed, lower-cased. */
@@ -1,10 +1,11 @@
1
1
  <script setup lang="ts">
2
- import { computed, nextTick, ref } from 'vue'
2
+ import { computed, nextTick, ref, watch } from 'vue'
3
3
  import { busyAttributes } from '../../a11y'
4
4
  import { useLabels, type BackendLabels, type LabelOverrides } from '../../composables/use-labels'
5
5
  import { type Passkey, usePasskeys } from '../../composables/use-passkeys'
6
6
  import { useReauthentication } from '../../composables/use-reauthentication'
7
7
  import { parseUserAgent, type SessionInfo, useSessions } from '../../composables/use-sessions'
8
+ import { useTwoFactor } from '../../composables/use-two-factor'
8
9
  import { useAuthSession } from '../../utils/auth-session'
9
10
  import { useConfirmation } from '../../utils/confirmation'
10
11
  import { focusedIn, focusStranded, returnFocus } from '../../utils/focus-return'
@@ -23,11 +24,12 @@ import { provideSecurityView, type SecuritySection, type SecuritySettingsSlots,
23
24
  * entirely on `useAuth`, `usePasskeys` and `useSessions`.
24
25
  *
25
26
  * Markup on `data-security` hooks, built from parts (`SecurityPasskeys`,
26
- * `SecuritySessions`); replace any region via its slot — each slot receives
27
+ * `SecurityTwoFactor`, `SecuritySessions`); replace any region via its slot — each slot receives
27
28
  * {@link SecuritySlotContext}. Destructive actions ask first, through the
28
29
  * `confirm` prop or, without one, the component's own confirmation dialog.
29
30
  *
30
- * Adding or removing a passkey takes a recent sign-in: when the session's
31
+ * Adding or removing a passkey, and turning the authenticator app on or
32
+ * off, takes a recent sign-in: when the session's
31
33
  * is older, `<ReauthenticateDialog>` (rendered here) asks the person to
32
34
  * confirm it is them, then the action runs again. Revoking a session never asks.
33
35
  */
@@ -39,11 +41,13 @@ const props = withDefaults(defineProps<{
39
41
  confirm?: (message: string) => boolean | Promise<boolean>
40
42
  /** Copy for this component, over `appConfig.backend.labels.security` and the translations. */
41
43
  labels?: LabelOverrides<BackendLabels['security']>
42
- }>(), { sections: () => ['passkeys', 'sessions', 'alerts', 'danger'], confirm: undefined, labels: undefined })
44
+ }>(), { sections: () => ['passkeys', 'twoFactor', 'sessions', 'alerts', 'danger'], confirm: undefined, labels: undefined })
43
45
 
44
46
  const emit = defineEmits({
45
47
  'passkey-added': () => true,
46
48
  'passkey-removed': (_id: string) => true,
49
+ 'two-factor-enabled': () => true,
50
+ 'two-factor-disabled': () => true,
47
51
  'session-revoked': (_id: string) => true,
48
52
  'sessions-revoked': () => true,
49
53
  'signed-out': () => true,
@@ -54,6 +58,7 @@ const slots = defineSlots<SecuritySettingsSlots>()
54
58
  const auth = useAuthSession()
55
59
  const passkeys = usePasskeys()
56
60
  const sessions = useSessions()
61
+ const twoFactor = useTwoFactor()
57
62
  const alerts = useSignInAlertsState()
58
63
  // A recent sign-in, asked for when an action needs one and the session's is older.
59
64
  const { withReauthentication } = useReauthentication()
@@ -140,6 +145,7 @@ const signOut = () => run('sign-out', async () => {
140
145
  const context = computed<SecuritySlotContext>(() => ({
141
146
  user: auth.user.value,
142
147
  passkeys,
148
+ twoFactor,
143
149
  sessions,
144
150
  alerts,
145
151
  message: message.value,
@@ -150,6 +156,21 @@ const context = computed<SecuritySlotContext>(() => ({
150
156
 
151
157
  // Passkey-only: the recovery code a switch answered, shown until the page goes.
152
158
  const recoveryCode = ref<string | null>(null)
159
+ // The authenticator app: the first code typed, and the backup codes a setup answered, shown until the page goes.
160
+ const twoFactorCode = ref('')
161
+ const backupCodes = ref<string[] | null>(null)
162
+ // Codes belong to the account that asked for them: another account, or signing out, drops them.
163
+ const accountId = () => (auth.user.value as { id?: string } | null | undefined)?.id ?? null
164
+ watch(accountId, () => {
165
+ backupCodes.value = null
166
+ twoFactorCode.value = ''
167
+ })
168
+ /** Keep an answer only while the account that asked for it is still the signed-in one. */
169
+ async function forSameAccount<T>(action: () => Promise<T>): Promise<T | undefined> {
170
+ const askedFor = accountId()
171
+ const answer = await action()
172
+ return accountId() === askedFor ? answer : undefined
173
+ }
153
174
 
154
175
  provideSecurityView({
155
176
  labels,
@@ -177,6 +198,32 @@ provideSecurityView({
177
198
  const answer = await withReauthentication(() => passkeys.setPasskeyOnly(on))
178
199
  recoveryCode.value = answer.recoveryCode
179
200
  }),
201
+ twoFactorCode,
202
+ backupCodes,
203
+ startTwoFactor: () => run('two-factor:start', async () => {
204
+ const setup = await forSameAccount(() => withReauthentication(() => twoFactor.start()))
205
+ if (!setup) return
206
+ twoFactorCode.value = ''
207
+ backupCodes.value = setup.backupCodes
208
+ }),
209
+ confirmTwoFactor: () => run('two-factor:confirm', async () => {
210
+ await twoFactor.confirm(twoFactorCode.value)
211
+ twoFactorCode.value = ''
212
+ emit('two-factor-enabled')
213
+ }, () => t('twoFactorEnabled')),
214
+ disableTwoFactor: async () => {
215
+ const key = 'two-factor:disable'
216
+ if (!(await confirmed(key, t('twoFactorDisableConfirm')))) return
217
+ await run(key, async () => {
218
+ await withReauthentication(() => twoFactor.disable())
219
+ backupCodes.value = null
220
+ emit('two-factor-disabled')
221
+ }, () => t('twoFactorDisabled'))
222
+ },
223
+ regenerateBackupCodes: () => run('two-factor:backup-codes', async () => {
224
+ const codes = await forSameAccount(() => withReauthentication(() => twoFactor.regenerateBackupCodes()))
225
+ if (codes) backupCodes.value = codes
226
+ }),
180
227
  saveRename: row => run(`passkey:rename:${row.id}`, async () => {
181
228
  const name = editName.value.trim()
182
229
  if (name && name !== row.name) await passkeys.rename(row.id, name)
@@ -222,6 +269,13 @@ provideSecurityView({
222
269
  >
223
270
  <SecurityPasskeys :passkeys="passkeys" />
224
271
  </slot>
272
+ <slot
273
+ v-else-if="section === 'twoFactor'"
274
+ name="twoFactor"
275
+ v-bind="context"
276
+ >
277
+ <SecurityTwoFactor :two-factor="twoFactor" />
278
+ </slot>
225
279
  <slot
226
280
  v-else-if="section === 'sessions'"
227
281
  name="sessions"
@@ -0,0 +1,68 @@
1
+ /*
2
+ * SecurityTwoFactor's default styles, on its data-* hooks. Theme through the
3
+ * --bk-* tokens (tokens.css) or the hooks themselves: every rule sits in
4
+ * `@layer nuxt-backend`, so any rule of the app's wins.
5
+ */
6
+ @layer nuxt-backend {
7
+ [data-security='two-factor-hint'],
8
+ [data-security='two-factor-scan'],
9
+ [data-security='backup-codes-note'] {
10
+ margin: 0;
11
+ font-size: 0.85rem;
12
+ color: var(--bk-muted);
13
+ line-height: 1.5;
14
+ }
15
+
16
+ /* The setup: a frame of its own, so the link, the key and the field read as one step. */
17
+ [data-security='two-factor-setup'],
18
+ [data-security='backup-codes'] {
19
+ display: flex;
20
+ flex-direction: column;
21
+ gap: 0.6rem;
22
+ padding: 0.75rem 0.8rem;
23
+ border: var(--bk-border-width-surface, var(--bk-border-width)) solid var(--bk-edge);
24
+ box-shadow: var(--bk-shadow);
25
+ border-radius: var(--bk-radius);
26
+ }
27
+
28
+ [data-security='two-factor-key'],
29
+ [data-security='backup-code'] :where(code) {
30
+ font-variant-numeric: tabular-nums;
31
+ letter-spacing: 0.08em;
32
+ overflow-wrap: anywhere;
33
+ }
34
+
35
+ [data-security='input-two-factor-code'] {
36
+ max-width: 10rem;
37
+ padding: 0.3rem 0.5rem;
38
+ border: var(--bk-border-width-control, var(--bk-border-width)) solid var(--bk-edge);
39
+ border-radius: var(--bk-radius-control);
40
+ background: transparent;
41
+ color: inherit;
42
+ font: inherit;
43
+ font-variant-numeric: tabular-nums;
44
+ letter-spacing: 0.15em;
45
+ }
46
+
47
+ [data-security='two-factor-start'],
48
+ [data-security='two-factor-confirm'] {
49
+ align-self: flex-start;
50
+ background: var(--bk-accent);
51
+ border-color: var(--bk-accent);
52
+ color: var(--bk-on-accent);
53
+ }
54
+
55
+ /* On: said by the frame's tone as well as the words. */
56
+ [data-security='section-two-factor'][data-state='on'] [data-security='two-factor-hint'] {
57
+ color: var(--bk-ok);
58
+ }
59
+
60
+ [data-security='backup-code-list'] {
61
+ display: grid;
62
+ grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
63
+ gap: 0.35rem 1rem;
64
+ margin: 0;
65
+ padding: 0;
66
+ list-style: none;
67
+ }
68
+ }