cauthy-auth 0.25.0 → 0.27.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/dist/svelte.mjs CHANGED
@@ -257,6 +257,7 @@ function createAuthClient(options = {}) {
257
257
  mfa: (f) => post("/sign-in/mfa", { code: f.code }, checkCode(f.code)),
258
258
  mfaMethods: () => post("/sign-in/mfa/methods", {}, null),
259
259
  mfaSendCode: () => post("/sign-in/mfa/send", {}, null),
260
+ mfaSendEmail: () => post("/sign-in/mfa/email", {}, null),
260
261
  mfaPush: () => post("/sign-in/mfa/push", {}, null),
261
262
  async mfaPushWait(o = {}) {
262
263
  const status = await new Promise((resolve) => {
@@ -375,7 +376,7 @@ function createAuthClient(options = {}) {
375
376
  signUp: {
376
377
  email: (f) => post(
377
378
  "/sign-up/email",
378
- { email: f.email, password: f.password, name: f.name, organization: f.organization },
379
+ { email: f.email, password: f.password, name: f.name, organization: f.organization, acceptLegal: f.acceptLegal, consents: f.consents },
379
380
  firstProblem(checkName(f.name), checkEmail(f.email), checkNewPassword(f.password), checkOrganization(f.organization)),
380
381
  f.captchaToken
381
382
  )
@@ -408,6 +409,12 @@ function createAuthClient(options = {}) {
408
409
  return body && typeof body.account === "object" ? body.account : null;
409
410
  },
410
411
  update: (f) => post("/me", { name: f.name }, checkName(f.name)),
412
+ async legal() {
413
+ const body = await read("/me/legal");
414
+ if (!body) return { ok: false, error: { code: "not_signed_in", message: "Nobody is signed in." } };
415
+ return { ok: true, status: "ok", pending: Array.isArray(body.pending) ? body.pending : [] };
416
+ },
417
+ acceptLegal: (f = {}) => post("/me/legal/accept", { kinds: f.kinds ?? [] }, null),
411
418
  changePassword: (f) => {
412
419
  const bad = checkNewPassword(f.newPassword);
413
420
  return post("/me/password", { password: f.password, newPassword: f.newPassword }, bad ? { ...bad, field: "newPassword" } : null);