cauthy-auth 0.20.0 → 0.23.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 (43) hide show
  1. package/dist/{cauthy-Bn3iv50y.d.ts → cauthy-DGAy45G2.d.ts} +1 -1
  2. package/dist/{cauthy-C29HCvag.d.mts → cauthy-XkIbG5gE.d.mts} +1 -1
  3. package/dist/client.d.mts +133 -3
  4. package/dist/client.d.ts +133 -3
  5. package/dist/client.js +54 -0
  6. package/dist/client.js.map +1 -1
  7. package/dist/client.mjs +54 -0
  8. package/dist/client.mjs.map +1 -1
  9. package/dist/express.d.mts +2 -2
  10. package/dist/express.d.ts +2 -2
  11. package/dist/fastify.d.mts +2 -2
  12. package/dist/fastify.d.ts +2 -2
  13. package/dist/hono.d.mts +2 -2
  14. package/dist/hono.d.ts +2 -2
  15. package/dist/index.d.mts +2 -2
  16. package/dist/index.d.ts +2 -2
  17. package/dist/index.js +178 -5
  18. package/dist/index.js.map +1 -1
  19. package/dist/index.mjs +178 -5
  20. package/dist/index.mjs.map +1 -1
  21. package/dist/next.d.mts +2 -2
  22. package/dist/next.d.ts +2 -2
  23. package/dist/react.d.mts +171 -2
  24. package/dist/react.d.ts +171 -2
  25. package/dist/react.js +261 -3
  26. package/dist/react.js.map +1 -1
  27. package/dist/react.mjs +260 -3
  28. package/dist/react.mjs.map +1 -1
  29. package/dist/svelte.d.mts +2 -2
  30. package/dist/svelte.d.ts +2 -2
  31. package/dist/svelte.js +54 -0
  32. package/dist/svelte.js.map +1 -1
  33. package/dist/svelte.mjs +54 -0
  34. package/dist/svelte.mjs.map +1 -1
  35. package/dist/{system-ZD_Wa8Bm.d.mts → system-BxMsSIu1.d.mts} +2 -0
  36. package/dist/{system-DhRr_WxR.d.ts → system-DTIeDXDP.d.ts} +2 -0
  37. package/dist/vue.d.mts +2 -2
  38. package/dist/vue.d.ts +2 -2
  39. package/dist/vue.js +54 -0
  40. package/dist/vue.js.map +1 -1
  41. package/dist/vue.mjs +54 -0
  42. package/dist/vue.mjs.map +1 -1
  43. package/package.json +1 -1
package/dist/react.mjs CHANGED
@@ -229,6 +229,7 @@ function createAuthClient(options = {}) {
229
229
  return null;
230
230
  }
231
231
  }
232
+ const upgradeUrl = (provider, o = {}) => `${base}/me/upgrade/social/${encodeURIComponent(provider)}${o.returnTo ? `?return_to=${encodeURIComponent(o.returnTo)}` : ""}`;
232
233
  const linkUrl = (provider, o = {}) => `${base}/me/identities/link/${encodeURIComponent(provider)}${o.returnTo ? `?return_to=${encodeURIComponent(o.returnTo)}` : ""}`;
233
234
  const socialUrl = (provider, o = {}) => `${base}/sign-in/social/${encodeURIComponent(provider)}${o.returnTo ? `?return_to=${encodeURIComponent(o.returnTo)}` : ""}`;
234
235
  const ssoUrl = (target, o = {}) => {
@@ -266,10 +267,40 @@ function createAuthClient(options = {}) {
266
267
  }
267
268
  return {
268
269
  signIn: {
270
+ anonymously: (f = {}) => post("/sign-in/anonymous", {}, null, f.captchaToken),
269
271
  email: (f) => post("/sign-in/email", { email: f.email, password: f.password }, firstProblem(checkEmail(f.email), checkPassword(f.password)), f.captchaToken),
270
272
  mfa: (f) => post("/sign-in/mfa", { code: f.code }, checkCode(f.code)),
271
273
  mfaMethods: () => post("/sign-in/mfa/methods", {}, null),
272
274
  mfaSendCode: () => post("/sign-in/mfa/send", {}, null),
275
+ mfaPush: () => post("/sign-in/mfa/push", {}, null),
276
+ async mfaPushWait(o = {}) {
277
+ const status = await new Promise((resolve) => {
278
+ if (typeof EventSource !== "function") return resolve("approved");
279
+ const source = new EventSource(`${base}/sign-in/mfa/push/events`, { withCredentials: true });
280
+ const stop = (st) => {
281
+ source.close();
282
+ resolve(st);
283
+ };
284
+ o.signal?.addEventListener("abort", () => stop("aborted"));
285
+ source.addEventListener("status", (e) => {
286
+ const st = (() => {
287
+ try {
288
+ return String(JSON.parse(e.data).status);
289
+ } catch {
290
+ return "";
291
+ }
292
+ })();
293
+ if (st && st !== "pending") stop(st);
294
+ });
295
+ source.onerror = () => {
296
+ if (source.readyState === EventSource.CLOSED) stop("expired");
297
+ };
298
+ });
299
+ if (status === "aborted") return { ok: false, error: { code: "aborted", message: "Stopped waiting." } };
300
+ if (status === "denied") return { ok: false, error: { code: "push_denied", message: "The sign-in was turned down on the phone." } };
301
+ if (status === "expired") return { ok: false, error: { code: "push_expired", message: "Nobody answered on the phone in time." } };
302
+ return post("/sign-in/mfa/push/finish", {}, null);
303
+ },
273
304
  magicLink: (f) => post("/sign-in/magic-link", { email: f.email, ...f.create ? { create: true } : {}, ...f.returnTo ? { returnTo: f.returnTo } : {} }, checkEmail(f.email), f.captchaToken),
274
305
  magicLinkVerify: (f) => post("/sign-in/magic-link/verify", { token: f.token }, null),
275
306
  emailCode: (f) => post("/sign-in/email-code", { code: f.code }, checkCode(f.code)),
@@ -363,6 +394,24 @@ function createAuthClient(options = {}) {
363
394
  resetPassword: (f) => post("/reset-password", { token: f.token, password: f.password }, checkNewPassword(f.password)),
364
395
  verifyEmail: (f) => post("/verify-email", { token: f.token }, null),
365
396
  signOut: () => post("/sign-out", {}, null),
397
+ organizations: {
398
+ async list(system) {
399
+ const body = await read(`/me/organizations${system ? `?system=${encodeURIComponent(system)}` : ""}`);
400
+ return body && Array.isArray(body.organizations) ? body.organizations : [];
401
+ },
402
+ async members(id) {
403
+ const body = await read(`/me/organizations/members?id=${encodeURIComponent(id)}`);
404
+ return body && Array.isArray(body.members) ? body.members : null;
405
+ },
406
+ async roles(id) {
407
+ const body = await read(`/me/organizations/roles?id=${encodeURIComponent(id)}`);
408
+ return body && Array.isArray(body.roles) ? body.roles : null;
409
+ },
410
+ add: (id, f) => post("/me/organizations/members/add", { organizationId: id, email: f.email, role: f.role, name: f.name ?? "", locale: f.locale ?? "" }, checkEmail(f.email)),
411
+ setRole: (id, userId, role) => post("/me/organizations/members/role", { organizationId: id, userId, role }, null),
412
+ remove: (id, userId) => post("/me/organizations/members/remove", { organizationId: id, userId }, null),
413
+ inviteAgain: (id, userId, f = {}) => post("/me/organizations/members/invite", { organizationId: id, userId, locale: f.locale ?? "" }, null)
414
+ },
366
415
  account: {
367
416
  async get() {
368
417
  const body = await read("/me");
@@ -401,6 +450,11 @@ function createAuthClient(options = {}) {
401
450
  return body && Array.isArray(body.sessions) ? body.sessions : [];
402
451
  },
403
452
  signOutEverywhere: () => post("/me/sessions/end", {}, null),
453
+ upgrade: (f) => post("/me/upgrade", { email: f.email, password: f.password, name: f.name ?? "" }, firstProblem(checkName(f.name), checkEmail(f.email), checkNewPassword(f.password))),
454
+ upgradeUrl,
455
+ upgradeWith(provider, o) {
456
+ window.location.assign(upgradeUrl(provider, o));
457
+ },
404
458
  async agents() {
405
459
  const body = await read("/me/agents");
406
460
  return body && Array.isArray(body.agents) ? body.agents : [];
@@ -511,6 +565,9 @@ var TEXTS = {
511
565
  sendCodeSms: "Send a code by SMS to {to}",
512
566
  sendCodeWhatsapp: "Send a code by WhatsApp to {to}",
513
567
  codeSent: "We sent a code to {to}. Type it here.",
568
+ pushSend: "Approve on my phone",
569
+ pushPick: "On your phone, pick {n}",
570
+ pushWaiting: "We sent a notification to your phone. Open it and pick this number.",
514
571
  phone: "Phone, with its country code",
515
572
  phoneHelp: "Get your codes by SMS or WhatsApp instead of an app.",
516
573
  phoneOn: "Codes go to {to}.",
@@ -575,7 +632,29 @@ var TEXTS = {
575
632
  unlink: "Unlink",
576
633
  linked: "The account was linked.",
577
634
  ssoOnly: "Your company signs you in to this account.",
635
+ members: "Members",
636
+ membersHidden: "Your role here does not let you see the members.",
637
+ organizationMissing: "You do not belong to this organization.",
638
+ memberYou: "you",
639
+ memberInvited: "invited",
640
+ memberManager: "manages members",
641
+ memberRole: "Role",
642
+ memberAdd: "Add member",
643
+ memberAdded: "{email} is a member now.",
644
+ memberRemove: "Remove",
645
+ memberRemoveConfirm: "Remove {who}?",
646
+ memberLeave: "Leave",
647
+ memberLeaveConfirm: "Leave {org}? You will need an invitation to come back.",
648
+ memberInviteAgain: "Send the invitation again",
649
+ memberInvitationSent: "The invitation is on its way.",
650
+ yes: "Yes",
651
+ cancel: "Cancel",
578
652
  errors: {
653
+ not_allowed: "Your role in this organization does not allow that.",
654
+ last_manager: "Somebody else must manage the members first: give that role to another member.",
655
+ already_member: "That person already belongs to the organization. Change their role instead.",
656
+ unknown_role: "Choose one of the roles offered.",
657
+ user_not_active: "That account is disabled.",
579
658
  required: "This is required.",
580
659
  invalid_email: "That does not look like an email address.",
581
660
  too_short: "Use at least 8 characters.",
@@ -635,6 +714,9 @@ var TEXTS = {
635
714
  sendCodeSms: "Enviar un c\xF3digo por SMS a {to}",
636
715
  sendCodeWhatsapp: "Enviar un c\xF3digo por WhatsApp a {to}",
637
716
  codeSent: "Te enviamos un c\xF3digo a {to}. Escr\xEDbelo aqu\xED.",
717
+ pushSend: "Aprobar en mi tel\xE9fono",
718
+ pushPick: "En tu tel\xE9fono, elige el {n}",
719
+ pushWaiting: "Enviamos una notificaci\xF3n a tu tel\xE9fono. \xC1brela y elige este n\xFAmero.",
638
720
  phone: "Tel\xE9fono, con su c\xF3digo de pa\xEDs",
639
721
  phoneHelp: "Recibe tus c\xF3digos por SMS o WhatsApp en vez de una app.",
640
722
  phoneOn: "Los c\xF3digos van a {to}.",
@@ -699,7 +781,29 @@ var TEXTS = {
699
781
  unlink: "Desvincular",
700
782
  linked: "La cuenta qued\xF3 vinculada.",
701
783
  ssoOnly: "A esta cuenta entras con el inicio de sesi\xF3n de tu empresa.",
784
+ members: "Miembros",
785
+ membersHidden: "Tu rol aqu\xED no te deja ver los miembros.",
786
+ organizationMissing: "No perteneces a esta organizaci\xF3n.",
787
+ memberYou: "t\xFA",
788
+ memberInvited: "invitado",
789
+ memberManager: "administra los miembros",
790
+ memberRole: "Rol",
791
+ memberAdd: "Agregar miembro",
792
+ memberAdded: "{email} ya es miembro.",
793
+ memberRemove: "Quitar",
794
+ memberRemoveConfirm: "\xBFQuitar a {who}?",
795
+ memberLeave: "Salir",
796
+ memberLeaveConfirm: "\xBFSalir de {org}? Necesitar\xE1s una invitaci\xF3n para volver.",
797
+ memberInviteAgain: "Enviar la invitaci\xF3n de nuevo",
798
+ memberInvitationSent: "La invitaci\xF3n va en camino.",
799
+ yes: "S\xED",
800
+ cancel: "Cancelar",
702
801
  errors: {
802
+ not_allowed: "Tu rol en esta organizaci\xF3n no permite eso.",
803
+ last_manager: "Primero alguien m\xE1s debe administrar los miembros: dale ese rol a otro miembro.",
804
+ already_member: "Esa persona ya pertenece a la organizaci\xF3n. Cambia su rol.",
805
+ unknown_role: "Escoge uno de los roles ofrecidos.",
806
+ user_not_active: "Esa cuenta est\xE1 desactivada.",
703
807
  required: "Este dato es obligatorio.",
704
808
  invalid_email: "Eso no parece un correo.",
705
809
  too_short: "Usa al menos 8 caracteres.",
@@ -915,9 +1019,28 @@ function SignIn(props) {
915
1019
  useEffect(() => {
916
1020
  if (step !== "code") return;
917
1021
  void auth.signIn.mfaMethods().then((r) => {
918
- if (r.ok) setPhoneWay({ totp: r.totp, phone: r.phone });
1022
+ if (r.ok) setPhoneWay({ totp: r.totp, phone: r.phone, push: r.push });
919
1023
  });
920
1024
  }, [step]);
1025
+ const [pushNumber, setPushNumber] = useState(0);
1026
+ const pushWait = useRef(null);
1027
+ useEffect(() => () => pushWait.current?.abort(), []);
1028
+ const sendPush = async () => {
1029
+ f.setBusy(true);
1030
+ f.setError(null);
1031
+ const r = await auth.signIn.mfaPush();
1032
+ f.setBusy(false);
1033
+ if (!r.ok) return f.setError(r.error);
1034
+ setPushNumber(r.number);
1035
+ pushWait.current?.abort();
1036
+ const ctl = new AbortController();
1037
+ pushWait.current = ctl;
1038
+ const done = await auth.signIn.mfaPushWait({ signal: ctl.signal });
1039
+ if (ctl.signal.aborted) return;
1040
+ setPushNumber(0);
1041
+ if (!done.ok) return f.setError(done.error);
1042
+ f.done();
1043
+ };
921
1044
  const sendCode = async () => {
922
1045
  f.setBusy(true);
923
1046
  f.setError(null);
@@ -1029,6 +1152,11 @@ function SignIn(props) {
1029
1152
  return /* @__PURE__ */ jsxs("form", { className: f.cx("form"), ...f.root, onSubmit: submit, noValidate: true, children: [
1030
1153
  /* @__PURE__ */ jsx("p", { className: f.cx("notice"), children: phoneSent ? f.t.codeSent.replace("{to}", phoneSent) : phoneWay?.phone && !phoneWay.totp ? f.t.codeHelpPhone : f.t.codeHelp }),
1031
1154
  general && /* @__PURE__ */ jsx("p", { role: "alert", className: f.cx("error"), children: f.say(general) }),
1155
+ pushNumber > 0 ? /* @__PURE__ */ jsxs("div", { className: f.cx("notice"), role: "status", "aria-live": "polite", children: [
1156
+ /* @__PURE__ */ jsx("p", { children: f.t.pushPick.replace("{n}", String(pushNumber)) }),
1157
+ /* @__PURE__ */ jsx("p", { style: { fontSize: 48, fontWeight: 700, margin: "4px 0", textAlign: "center" }, children: pushNumber }),
1158
+ /* @__PURE__ */ jsx("p", { children: f.t.pushWaiting })
1159
+ ] }) : phoneWay?.push && /* @__PURE__ */ jsx(f.Button, { type: "button", disabled: f.busy, className: f.cx("button"), onClick: () => void sendPush(), children: f.t.pushSend }),
1032
1160
  phoneWay?.phone && /* @__PURE__ */ jsx(f.Button, { type: "button", disabled: f.busy, className: f.cx("providerButton"), onClick: () => void sendCode(), children: (phoneWay.phone.channel === "whatsapp" ? f.t.sendCodeWhatsapp : f.t.sendCodeSms).replace("{to}", to) }),
1033
1161
  /* @__PURE__ */ jsx(Field, { f, name: "code", type: "text", label: f.t.code, value: code, autoComplete: "one-time-code", required: true, onChange: setCode }),
1034
1162
  /* @__PURE__ */ jsx(f.Button, { type: "submit", disabled: f.busy, className: f.cx("button"), children: f.t.verify })
@@ -1103,7 +1231,7 @@ function SignUp(props) {
1103
1231
  e.preventDefault();
1104
1232
  f.setBusy(true);
1105
1233
  f.setError(null);
1106
- const r = await auth.signUp.email({ name, email, password, captchaToken: challenge.token });
1234
+ const r = auth.session?.user.isAnonymous === true ? await auth.account.upgrade({ name, email, password }) : await auth.signUp.email({ name, email, password, captchaToken: challenge.token });
1107
1235
  f.setBusy(false);
1108
1236
  challenge.renew();
1109
1237
  if (!r.ok) return f.setError(r.error);
@@ -1273,6 +1401,130 @@ function Account(props) {
1273
1401
  ] })
1274
1402
  ] });
1275
1403
  }
1404
+ function OrganizationMembers(props) {
1405
+ const auth = useAuth();
1406
+ const { root } = useForm(props);
1407
+ const { f, done, setDone, run } = useSection(props);
1408
+ const problem = f.error && f.error.field !== "email" ? f.error : null;
1409
+ const [seat, setSeat] = useState(void 0);
1410
+ const [members, setMembers] = useState(null);
1411
+ const [roles, setRoles] = useState([]);
1412
+ const [email, setEmail] = useState("");
1413
+ const [role, setRole] = useState("");
1414
+ const [asking, setAsking] = useState(null);
1415
+ const id = props.organizationId;
1416
+ const when = props.formatDate ?? ((iso) => new Date(iso).toLocaleDateString());
1417
+ const load = async () => {
1418
+ const [list, people, choices] = await Promise.all([auth.organizations.list(), auth.organizations.members(id), auth.organizations.roles(id)]);
1419
+ setSeat(list.find((o) => o.id === id) ?? null);
1420
+ setMembers(people);
1421
+ setRoles(choices ?? []);
1422
+ if (choices && choices.length > 0 && !choices.some((c) => c.role === role)) setRole(choices[0].role);
1423
+ };
1424
+ useEffect(() => {
1425
+ void load();
1426
+ }, [id]);
1427
+ if (seat === void 0) return /* @__PURE__ */ jsx("div", { className: f.cx("account"), ...root, "aria-busy": "true" });
1428
+ if (seat === null) return /* @__PURE__ */ jsx("div", { className: f.cx("account"), ...root, children: /* @__PURE__ */ jsx("p", { className: f.cx("notice"), children: f.t.organizationMissing }) });
1429
+ const manage = seat.can.manageMembers;
1430
+ const label = (r) => roles.find((c) => c.role === r)?.name || r;
1431
+ const add = async (e) => {
1432
+ e.preventDefault();
1433
+ const r = await run(() => auth.organizations.add(id, { email, role, locale: props.locale }));
1434
+ if (!r.ok) return;
1435
+ setEmail("");
1436
+ setDone(f.t.memberAdded.replace("{email}", r.member.email));
1437
+ await load();
1438
+ };
1439
+ const change = async (m, next) => {
1440
+ const r = await run(() => auth.organizations.setRole(id, m.userId, next));
1441
+ if (r.ok) await load();
1442
+ };
1443
+ const remove = async (m) => {
1444
+ setAsking(null);
1445
+ const r = await run(() => auth.organizations.remove(id, m.userId));
1446
+ if (!r.ok) return;
1447
+ if (m.you) setSeat(null);
1448
+ else await load();
1449
+ };
1450
+ const inviteAgain = async (m) => {
1451
+ const r = await run(() => auth.organizations.inviteAgain(id, m.userId, { locale: props.locale }));
1452
+ if (r.ok) setDone(f.t.memberInvitationSent);
1453
+ };
1454
+ return /* @__PURE__ */ jsxs("div", { className: f.cx("account"), ...root, children: [
1455
+ /* @__PURE__ */ jsxs("section", { className: f.cx("section"), children: [
1456
+ /* @__PURE__ */ jsxs("h2", { className: f.cx("heading"), children: [
1457
+ f.t.members,
1458
+ " \xB7 ",
1459
+ seat.name
1460
+ ] }),
1461
+ problem && /* @__PURE__ */ jsx("p", { role: "alert", className: f.cx("error"), children: f.say(problem) }),
1462
+ members === null ? /* @__PURE__ */ jsxs(Fragment, { children: [
1463
+ /* @__PURE__ */ jsx("p", { className: f.cx("notice"), children: f.t.membersHidden }),
1464
+ auth.session && (asking === auth.session.user.id ? /* @__PURE__ */ jsxs("span", { role: "group", "aria-label": f.t.memberLeave, children: [
1465
+ /* @__PURE__ */ jsx("span", { children: f.t.memberLeaveConfirm.replace("{org}", seat.name) }),
1466
+ " ",
1467
+ /* @__PURE__ */ jsx(
1468
+ f.Button,
1469
+ {
1470
+ type: "button",
1471
+ disabled: f.busy,
1472
+ className: f.cx("providerButton"),
1473
+ onClick: () => void remove({ userId: auth.session.user.id, you: true }),
1474
+ children: f.t.yes
1475
+ }
1476
+ ),
1477
+ /* @__PURE__ */ jsx(f.Button, { type: "button", disabled: f.busy, className: f.cx("providerButton"), onClick: () => setAsking(null), children: f.t.cancel })
1478
+ ] }) : /* @__PURE__ */ jsx(f.Button, { type: "button", disabled: f.busy, className: f.cx("providerButton"), onClick: () => setAsking(auth.session.user.id), children: f.t.memberLeave }))
1479
+ ] }) : /* @__PURE__ */ jsx("ul", { className: f.cx("sessions"), children: members.map((m) => {
1480
+ const who = m.name || m.email;
1481
+ return /* @__PURE__ */ jsxs("li", { className: f.cx("session"), children: [
1482
+ /* @__PURE__ */ jsxs("span", { children: [
1483
+ who,
1484
+ m.name ? ` \xB7 ${m.email}` : "",
1485
+ m.you ? ` (${f.t.memberYou})` : "",
1486
+ m.invited ? ` \xB7 ${f.t.memberInvited}` : "",
1487
+ m.manager ? ` \xB7 ${f.t.memberManager}` : "",
1488
+ " \xB7 ",
1489
+ when(m.since)
1490
+ ] }),
1491
+ " ",
1492
+ manage && roles.length > 0 ? /* @__PURE__ */ jsx(
1493
+ "select",
1494
+ {
1495
+ "aria-label": `${f.t.memberRole}: ${who}`,
1496
+ className: f.cx("input"),
1497
+ value: m.role,
1498
+ disabled: f.busy,
1499
+ onChange: (e) => void change(m, e.target.value),
1500
+ children: roles.map((c) => /* @__PURE__ */ jsx("option", { value: c.role, children: c.name || c.role }, c.role))
1501
+ }
1502
+ ) : /* @__PURE__ */ jsx("span", { children: label(m.role) }),
1503
+ " ",
1504
+ asking === m.userId ? /* @__PURE__ */ jsxs("span", { role: "group", "aria-label": m.you ? f.t.memberLeave : f.t.memberRemove, children: [
1505
+ /* @__PURE__ */ jsx("span", { children: m.you ? f.t.memberLeaveConfirm.replace("{org}", seat.name) : f.t.memberRemoveConfirm.replace("{who}", who) }),
1506
+ " ",
1507
+ /* @__PURE__ */ jsx(f.Button, { type: "button", disabled: f.busy, className: f.cx("providerButton"), onClick: () => void remove(m), children: f.t.yes }),
1508
+ /* @__PURE__ */ jsx(f.Button, { type: "button", disabled: f.busy, className: f.cx("providerButton"), onClick: () => setAsking(null), children: f.t.cancel })
1509
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
1510
+ manage && m.invited && /* @__PURE__ */ jsx(f.Button, { type: "button", disabled: f.busy, className: f.cx("providerButton"), onClick: () => void inviteAgain(m), children: f.t.memberInviteAgain }),
1511
+ (manage || m.you) && /* @__PURE__ */ jsx(f.Button, { type: "button", disabled: f.busy, className: f.cx("providerButton"), onClick: () => setAsking(m.userId), children: m.you ? f.t.memberLeave : f.t.memberRemove })
1512
+ ] })
1513
+ ] }, m.userId);
1514
+ }) }),
1515
+ done && /* @__PURE__ */ jsx("p", { role: "status", className: f.cx("notice"), children: done })
1516
+ ] }),
1517
+ manage && roles.length > 0 && /* @__PURE__ */ jsxs("form", { className: f.cx("section"), onSubmit: add, noValidate: true, children: [
1518
+ /* @__PURE__ */ jsx("h2", { className: f.cx("heading"), children: f.t.memberAdd }),
1519
+ /* @__PURE__ */ jsx(Field, { f, name: "email", type: "email", label: f.t.email, value: email, autoComplete: "off", required: true, onChange: setEmail }),
1520
+ /* @__PURE__ */ jsxs("label", { className: f.cx("field"), children: [
1521
+ /* @__PURE__ */ jsx("span", { className: f.cx("label"), children: f.t.memberRole }),
1522
+ /* @__PURE__ */ jsx("select", { name: "role", className: f.cx("input"), value: role, onChange: (e) => setRole(e.target.value), children: roles.map((c) => /* @__PURE__ */ jsx("option", { value: c.role, children: c.name || c.role }, c.role)) })
1523
+ ] }),
1524
+ /* @__PURE__ */ jsx(f.Button, { type: "submit", disabled: f.busy, className: f.cx("button"), children: f.t.memberAdd })
1525
+ ] })
1526
+ ] });
1527
+ }
1276
1528
  function PasskeysPart({ props, account, accountUrl, when }) {
1277
1529
  const auth = useAuth();
1278
1530
  const { f, done, setDone, run, general } = useSection(props);
@@ -1694,8 +1946,10 @@ function useAuth() {
1694
1946
  ...client,
1695
1947
  signIn: {
1696
1948
  ...client.signIn,
1949
+ anonymously: (f) => then(client.signIn.anonymously(f)),
1697
1950
  email: (f) => then(client.signIn.email(f)),
1698
1951
  mfa: (f) => then(client.signIn.mfa(f)),
1952
+ mfaPushWait: (o) => then(client.signIn.mfaPushWait(o)),
1699
1953
  magicLinkVerify: (f) => then(client.signIn.magicLinkVerify(f)),
1700
1954
  emailCode: (f) => then(client.signIn.emailCode(f)),
1701
1955
  passkey: (o) => then(client.signIn.passkey(o)),
@@ -1709,7 +1963,9 @@ function useAuth() {
1709
1963
  // What is on screen says the new name, and knows when the session ended.
1710
1964
  update: (f) => then(client.account.update(f)),
1711
1965
  changePassword: (f) => then(client.account.changePassword(f)),
1712
- signOutEverywhere: () => then(client.account.signOutEverywhere())
1966
+ signOutEverywhere: () => then(client.account.signOutEverywhere()),
1967
+ // The guest is now the account: what is on screen says so.
1968
+ upgrade: (f) => then(client.account.upgrade(f))
1713
1969
  },
1714
1970
  session,
1715
1971
  status,
@@ -1722,6 +1978,7 @@ export {
1722
1978
  CauthyProvider,
1723
1979
  ForgotPassword,
1724
1980
  GoogleOneTap,
1981
+ OrganizationMembers,
1725
1982
  ResetPassword,
1726
1983
  SignIn,
1727
1984
  SignUp,