@authowl/react 0.20.0 → 0.21.1

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.
@@ -9,7 +9,7 @@ import {
9
9
  useServerError,
10
10
  useSubmitAction,
11
11
  useT
12
- } from "./chunk-DPWUE5HS.js";
12
+ } from "./chunk-K67DJJHP.js";
13
13
 
14
14
  // src/components/organization/TeamsSection.tsx
15
15
  import * as React4 from "react";
@@ -574,6 +574,43 @@ function useOrganization() {
574
574
  isLoaded: !isPending && orgLoaded
575
575
  };
576
576
  }
577
+ function useInvitationRecipientHint() {
578
+ const client = useAuthClient();
579
+ const apiRef = React5.useRef(client.organization);
580
+ apiRef.current = client.organization;
581
+ const [result, setResult] = React5.useState({
582
+ recipientHint: null,
583
+ isLoaded: false
584
+ });
585
+ React5.useEffect(() => {
586
+ let active = true;
587
+ const claim = readInvitationClaim();
588
+ if (!claim) {
589
+ setResult({ recipientHint: null, isLoaded: true });
590
+ return () => {
591
+ active = false;
592
+ };
593
+ }
594
+ void (async () => {
595
+ try {
596
+ const response = await apiRef.current.getInvitationRecipientHint({
597
+ invitationId: claim.id
598
+ });
599
+ if (!active) return;
600
+ setResult({
601
+ recipientHint: response.data?.recipientHint ?? null,
602
+ isLoaded: true
603
+ });
604
+ } catch {
605
+ if (active) setResult({ recipientHint: null, isLoaded: true });
606
+ }
607
+ })();
608
+ return () => {
609
+ active = false;
610
+ };
611
+ }, []);
612
+ return result;
613
+ }
577
614
  function useOrganizationInvitation() {
578
615
  const client = useAuthClient();
579
616
  const apiRef = React5.useRef(client.organization);
@@ -889,6 +926,7 @@ export {
889
926
  useUser,
890
927
  useAuth,
891
928
  useOrganization,
929
+ useInvitationRecipientHint,
892
930
  useOrganizationInvitation,
893
931
  useSignIn,
894
932
  usePasskeys,