@mezo-org/passport 0.4.0-dev.0 → 0.4.0-dev.10
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/src/api/auth.d.ts +78 -0
- package/dist/src/api/auth.d.ts.map +1 -0
- package/dist/src/api/auth.js +77 -0
- package/dist/src/api/auth.js.map +1 -0
- package/dist/src/api/client.d.ts +24 -0
- package/dist/src/api/client.d.ts.map +1 -0
- package/dist/src/api/client.js +54 -0
- package/dist/src/api/client.js.map +1 -0
- package/dist/src/api/fetch-error.d.ts +5 -0
- package/dist/src/api/fetch-error.d.ts.map +1 -0
- package/dist/src/api/fetch-error.js +8 -0
- package/dist/src/api/fetch-error.js.map +1 -0
- package/dist/src/api/index.d.ts +3 -0
- package/dist/src/api/index.d.ts.map +1 -0
- package/dist/src/api/index.js +3 -0
- package/dist/src/api/index.js.map +1 -0
- package/dist/src/api/portal.d.ts +32 -0
- package/dist/src/api/portal.d.ts.map +1 -0
- package/dist/src/api/portal.js +23 -0
- package/dist/src/api/portal.js.map +1 -0
- package/dist/src/assets/DefaultAvatar.d.ts +5 -0
- package/dist/src/assets/DefaultAvatar.d.ts.map +1 -0
- package/dist/src/assets/DefaultAvatar.js +21 -0
- package/dist/src/assets/DefaultAvatar.js.map +1 -0
- package/dist/src/components/Dropdown/AccountAddress.d.ts +8 -0
- package/dist/src/components/Dropdown/AccountAddress.d.ts.map +1 -0
- package/dist/src/components/Dropdown/AccountAddress.js +66 -0
- package/dist/src/components/Dropdown/AccountAddress.js.map +1 -0
- package/dist/src/components/Dropdown/AccountAssets.d.ts +14 -0
- package/dist/src/components/Dropdown/AccountAssets.d.ts.map +1 -0
- package/dist/src/components/Dropdown/AccountAssets.js +44 -0
- package/dist/src/components/Dropdown/AccountAssets.js.map +1 -0
- package/dist/src/components/Dropdown/AccountBalance.d.ts +7 -0
- package/dist/src/components/Dropdown/AccountBalance.d.ts.map +1 -0
- package/dist/src/components/Dropdown/AccountBalance.js +18 -0
- package/dist/src/components/Dropdown/AccountBalance.js.map +1 -0
- package/dist/src/components/Dropdown/ConnectedTrigger.d.ts +7 -0
- package/dist/src/components/Dropdown/ConnectedTrigger.d.ts.map +1 -0
- package/dist/src/components/Dropdown/ConnectedTrigger.js +30 -0
- package/dist/src/components/Dropdown/ConnectedTrigger.js.map +1 -0
- package/dist/src/components/Dropdown/Content.d.ts +9 -0
- package/dist/src/components/Dropdown/Content.d.ts.map +1 -0
- package/dist/src/components/Dropdown/Content.js +69 -0
- package/dist/src/components/Dropdown/Content.js.map +1 -0
- package/dist/src/components/Dropdown/DisconnectedTrigger.d.ts +7 -0
- package/dist/src/components/Dropdown/DisconnectedTrigger.d.ts.map +1 -0
- package/dist/src/components/Dropdown/DisconnectedTrigger.js +13 -0
- package/dist/src/components/Dropdown/DisconnectedTrigger.js.map +1 -0
- package/dist/src/components/Dropdown/Dropdown.d.ts +20 -0
- package/dist/src/components/Dropdown/Dropdown.d.ts.map +1 -0
- package/dist/src/components/Dropdown/Dropdown.js +64 -0
- package/dist/src/components/Dropdown/Dropdown.js.map +1 -0
- package/dist/src/components/Dropdown/WelcomeBlock.d.ts +8 -0
- package/dist/src/components/Dropdown/WelcomeBlock.d.ts.map +1 -0
- package/dist/src/components/Dropdown/WelcomeBlock.js +44 -0
- package/dist/src/components/Dropdown/WelcomeBlock.js.map +1 -0
- package/dist/src/components/Dropdown/index.d.ts +3 -0
- package/dist/src/components/Dropdown/index.d.ts.map +1 -0
- package/dist/src/components/Dropdown/index.js +2 -0
- package/dist/src/components/Dropdown/index.js.map +1 -0
- package/dist/src/components/index.d.ts +2 -0
- package/dist/src/components/index.d.ts.map +1 -0
- package/dist/src/components/index.js +2 -0
- package/dist/src/components/index.js.map +1 -0
- package/dist/src/hooks/constants.d.ts +7 -0
- package/dist/src/hooks/constants.d.ts.map +1 -0
- package/dist/src/hooks/constants.js +7 -0
- package/dist/src/hooks/constants.js.map +1 -0
- package/dist/src/hooks/index.d.ts +10 -0
- package/dist/src/hooks/index.d.ts.map +1 -1
- package/dist/src/hooks/index.js +10 -0
- package/dist/src/hooks/index.js.map +1 -1
- package/dist/src/hooks/useAssetsUSDConversion.d.ts +8 -0
- package/dist/src/hooks/useAssetsUSDConversion.d.ts.map +1 -0
- package/dist/src/hooks/useAssetsUSDConversion.js +21 -0
- package/dist/src/hooks/useAssetsUSDConversion.js.map +1 -0
- package/dist/src/hooks/useAuthApiClient.d.ts +2 -0
- package/dist/src/hooks/useAuthApiClient.d.ts.map +1 -0
- package/dist/src/hooks/useAuthApiClient.js +6 -0
- package/dist/src/hooks/useAuthApiClient.js.map +1 -0
- package/dist/src/hooks/useAuthenticateWithWallet.d.ts +73 -0
- package/dist/src/hooks/useAuthenticateWithWallet.d.ts.map +1 -0
- package/dist/src/hooks/useAuthenticateWithWallet.js +69 -0
- package/dist/src/hooks/useAuthenticateWithWallet.js.map +1 -0
- package/dist/src/hooks/useCreateAccount.d.ts +108 -0
- package/dist/src/hooks/useCreateAccount.d.ts.map +1 -0
- package/dist/src/hooks/useCreateAccount.js +21 -0
- package/dist/src/hooks/useCreateAccount.js.map +1 -0
- package/dist/src/hooks/useCreateSession.d.ts +76 -0
- package/dist/src/hooks/useCreateSession.d.ts.map +1 -0
- package/dist/src/hooks/useCreateSession.js +29 -0
- package/dist/src/hooks/useCreateSession.js.map +1 -0
- package/dist/src/hooks/useDropdownData.d.ts +45 -0
- package/dist/src/hooks/useDropdownData.d.ts.map +1 -0
- package/dist/src/hooks/useDropdownData.js +74 -0
- package/dist/src/hooks/useDropdownData.js.map +1 -0
- package/dist/src/hooks/useEnsureNoSessionAndFetchNonce.d.ts +5 -0
- package/dist/src/hooks/useEnsureNoSessionAndFetchNonce.d.ts.map +1 -0
- package/dist/src/hooks/useEnsureNoSessionAndFetchNonce.js +34 -0
- package/dist/src/hooks/useEnsureNoSessionAndFetchNonce.js.map +1 -0
- package/dist/src/hooks/useGetAccountByAddress.d.ts +4 -0
- package/dist/src/hooks/useGetAccountByAddress.d.ts.map +1 -0
- package/dist/src/hooks/useGetAccountByAddress.js +17 -0
- package/dist/src/hooks/useGetAccountByAddress.js.map +1 -0
- package/dist/src/hooks/useGetAccountByMezoId.d.ts +4 -0
- package/dist/src/hooks/useGetAccountByMezoId.d.ts.map +1 -0
- package/dist/src/hooks/useGetAccountByMezoId.js +17 -0
- package/dist/src/hooks/useGetAccountByMezoId.js.map +1 -0
- package/dist/src/hooks/useGetCurrentAccount.d.ts +18 -0
- package/dist/src/hooks/useGetCurrentAccount.d.ts.map +1 -0
- package/dist/src/hooks/useGetCurrentAccount.js +37 -0
- package/dist/src/hooks/useGetCurrentAccount.js.map +1 -0
- package/dist/src/hooks/useGetSession.d.ts +4 -0
- package/dist/src/hooks/useGetSession.d.ts.map +1 -0
- package/dist/src/hooks/useGetSession.js +15 -0
- package/dist/src/hooks/useGetSession.js.map +1 -0
- package/dist/src/hooks/useLinkAccount.d.ts +72 -0
- package/dist/src/hooks/useLinkAccount.d.ts.map +1 -0
- package/dist/src/hooks/useLinkAccount.js +19 -0
- package/dist/src/hooks/useLinkAccount.js.map +1 -0
- package/dist/src/hooks/usePassportContext.d.ts +3 -0
- package/dist/src/hooks/usePassportContext.d.ts.map +1 -0
- package/dist/src/hooks/usePassportContext.js +10 -0
- package/dist/src/hooks/usePassportContext.js.map +1 -0
- package/dist/src/hooks/usePortalApiClient.d.ts +2 -0
- package/dist/src/hooks/usePortalApiClient.d.ts.map +1 -0
- package/dist/src/hooks/usePortalApiClient.js +6 -0
- package/dist/src/hooks/usePortalApiClient.js.map +1 -0
- package/dist/src/hooks/useSignInWithDiscord.d.ts +73 -0
- package/dist/src/hooks/useSignInWithDiscord.d.ts.map +1 -0
- package/dist/src/hooks/useSignInWithDiscord.js +25 -0
- package/dist/src/hooks/useSignInWithDiscord.js.map +1 -0
- package/dist/src/hooks/useSignInWithWallet.d.ts +73 -0
- package/dist/src/hooks/useSignInWithWallet.d.ts.map +1 -0
- package/dist/src/hooks/useSignInWithWallet.js +11 -0
- package/dist/src/hooks/useSignInWithWallet.js.map +1 -0
- package/dist/src/hooks/useSignOut.d.ts +72 -0
- package/dist/src/hooks/useSignOut.d.ts.map +1 -0
- package/dist/src/hooks/useSignOut.js +22 -0
- package/dist/src/hooks/useSignOut.js.map +1 -0
- package/dist/src/hooks/useSignUpWithWallet.d.ts +73 -0
- package/dist/src/hooks/useSignUpWithWallet.d.ts.map +1 -0
- package/dist/src/hooks/useSignUpWithWallet.js +11 -0
- package/dist/src/hooks/useSignUpWithWallet.js.map +1 -0
- package/dist/src/hooks/useUpdateMezoId.d.ts +108 -0
- package/dist/src/hooks/useUpdateMezoId.d.ts.map +1 -0
- package/dist/src/hooks/useUpdateMezoId.js +19 -0
- package/dist/src/hooks/useUpdateMezoId.js.map +1 -0
- package/dist/src/hooks/useWalletAccount.d.ts +12 -0
- package/dist/src/hooks/useWalletAccount.d.ts.map +1 -0
- package/dist/src/hooks/useWalletAccount.js +28 -0
- package/dist/src/hooks/useWalletAccount.js.map +1 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +2 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/provider.d.ts +17 -0
- package/dist/src/provider.d.ts.map +1 -0
- package/dist/src/provider.js +16 -0
- package/dist/src/provider.js.map +1 -0
- package/dist/src/utils/address.d.ts +15 -0
- package/dist/src/utils/address.d.ts.map +1 -0
- package/dist/src/utils/address.js +35 -0
- package/dist/src/utils/address.js.map +1 -0
- package/dist/src/utils/address.test.d.ts +2 -0
- package/dist/src/utils/address.test.d.ts.map +1 -0
- package/dist/src/utils/address.test.js +32 -0
- package/dist/src/utils/address.test.js.map +1 -0
- package/dist/src/utils/cryptoAssets.d.ts +28 -0
- package/dist/src/utils/cryptoAssets.d.ts.map +1 -0
- package/dist/src/utils/cryptoAssets.js +73 -0
- package/dist/src/utils/cryptoAssets.js.map +1 -0
- package/dist/src/utils/cryptoAssets.test.d.ts +2 -0
- package/dist/src/utils/cryptoAssets.test.d.ts.map +1 -0
- package/dist/src/utils/cryptoAssets.test.js +50 -0
- package/dist/src/utils/cryptoAssets.test.js.map +1 -0
- package/dist/src/utils/currency.d.ts +14 -0
- package/dist/src/utils/currency.d.ts.map +1 -0
- package/dist/src/utils/currency.js +27 -0
- package/dist/src/utils/currency.js.map +1 -0
- package/dist/src/utils/currency.test.d.ts +2 -0
- package/dist/src/utils/currency.test.d.ts.map +1 -0
- package/dist/src/utils/currency.test.js +34 -0
- package/dist/src/utils/currency.test.js.map +1 -0
- package/dist/src/utils/numbers.d.ts +26 -0
- package/dist/src/utils/numbers.d.ts.map +1 -0
- package/dist/src/utils/numbers.js +40 -0
- package/dist/src/utils/numbers.js.map +1 -0
- package/dist/src/utils/numbers.test.d.ts +2 -0
- package/dist/src/utils/numbers.test.d.ts.map +1 -0
- package/dist/src/utils/numbers.test.js +54 -0
- package/dist/src/utils/numbers.test.js.map +1 -0
- package/dist/src/utils/siww.d.ts +4 -0
- package/dist/src/utils/siww.d.ts.map +1 -0
- package/dist/src/utils/siww.js +19 -0
- package/dist/src/utils/siww.js.map +1 -0
- package/dist/src/utils/time.d.ts +5 -0
- package/dist/src/utils/time.d.ts.map +1 -0
- package/dist/src/utils/time.js +5 -0
- package/dist/src/utils/time.js.map +1 -0
- package/package.json +13 -5
- package/src/api/auth.ts +178 -0
- package/src/api/client.ts +78 -0
- package/src/api/fetch-error.ts +8 -0
- package/src/api/index.ts +2 -0
- package/src/api/portal.ts +56 -0
- package/src/assets/DefaultAvatar.tsx +74 -0
- package/src/components/Dropdown/AccountAddress.tsx +130 -0
- package/src/components/Dropdown/AccountAssets.tsx +110 -0
- package/src/components/Dropdown/AccountBalance.tsx +38 -0
- package/src/components/Dropdown/ConnectedTrigger.tsx +56 -0
- package/src/components/Dropdown/Content.tsx +148 -0
- package/src/components/Dropdown/DisconnectedTrigger.tsx +36 -0
- package/src/components/Dropdown/Dropdown.tsx +111 -0
- package/src/components/Dropdown/README.md +51 -0
- package/src/components/Dropdown/WelcomeBlock.tsx +92 -0
- package/src/components/Dropdown/index.ts +2 -0
- package/src/components/index.ts +1 -0
- package/src/hooks/constants.ts +6 -0
- package/src/hooks/index.ts +10 -0
- package/src/hooks/useAssetsUSDConversion.ts +31 -0
- package/src/hooks/useAuthApiClient.ts +6 -0
- package/src/hooks/useAuthenticateWithWallet.ts +98 -0
- package/src/hooks/useCreateAccount.ts +36 -0
- package/src/hooks/useCreateSession.ts +44 -0
- package/src/hooks/useDropdownData.ts +131 -0
- package/src/hooks/useEnsureNoSessionAndFetchNonce.ts +46 -0
- package/src/hooks/useGetAccountByAddress.ts +25 -0
- package/src/hooks/useGetAccountByMezoId.ts +25 -0
- package/src/hooks/useGetCurrentAccount.ts +62 -0
- package/src/hooks/useGetSession.ts +22 -0
- package/src/hooks/useLinkAccount.ts +33 -0
- package/src/hooks/usePassportContext.ts +11 -0
- package/src/hooks/usePortalApiClient.ts +6 -0
- package/src/hooks/useSignInWithDiscord.ts +35 -0
- package/src/hooks/useSignInWithWallet.ts +21 -0
- package/src/hooks/useSignOut.ts +35 -0
- package/src/hooks/useSignUpWithWallet.ts +21 -0
- package/src/hooks/useUpdateMezoId.ts +33 -0
- package/src/hooks/useWalletAccount.ts +53 -0
- package/src/index.ts +2 -0
- package/src/provider.ts +50 -0
- package/src/utils/address.test.ts +38 -0
- package/src/utils/address.ts +43 -0
- package/src/utils/cryptoAssets.test.ts +61 -0
- package/src/utils/cryptoAssets.ts +93 -0
- package/src/utils/currency.test.ts +38 -0
- package/src/utils/currency.ts +32 -0
- package/src/utils/numbers.test.ts +73 -0
- package/src/utils/numbers.ts +55 -0
- package/src/utils/siww.ts +31 -0
- package/src/utils/time.ts +4 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useGetCurrentAccount.js","sourceRoot":"","sources":["../../../src/hooks/useGetCurrentAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AASzD,MAAM,UAAU,oBAAoB,CAClC,eAGI,EAAE;IAEN,MAAM,aAAa,GAAG,gBAAgB,EAAE,CAAA;IACxC,MAAM,eAAe,GAAG,kBAAkB,EAAE,CAAA;IAE5C,OAAO,QAAQ,CAAC;QACd,QAAQ,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,UAAU,CAAC,OAAO,CAAC;QAClD,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,MAAM,cAAc,GAAG,MAAM,aAAa,CAAC,iBAAiB,EAAE,CAAA;YAC9D,MAAM,aAAa,GAAG,cAAc,EAAE,cAAc,EAAE,MAAM,CAC1D,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,QAAQ,CACvC,CAAA;YACD,IAAI,CAAC,aAAa,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACjD,OAAO;oBACL,GAAG,cAAc;oBACjB,IAAI,EAAE;wBACJ,SAAS,EAAE,CAAC;qBACb;iBACF,CAAA;YACH,CAAC;YAED,MAAM,SAAS,GAAG,aAAa,CAAC,GAAG,CACjC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,UAAU,IAAI,OAAO,CAAC,UAAU,CACtD,CAAA;YACD,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,GAAG,CAC5B,SAAS,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,eAAe,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CACnE,CAAA;YAED,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAC3B,CAAC,OAAO,EAAE,WAAW,EAAE,EAAE,CAAC,OAAO,GAAG,WAAW,CAAC,SAAS,EACzD,CAAC,CACF,CAAA;YAED,OAAO;gBACL,GAAG,cAAc;gBACjB,IAAI,EAAE;oBACJ,SAAS;iBACV;aACF,CAAA;QACH,CAAC;QACD,SAAS,EAAE,aAAa;QACxB,KAAK,EAAE,CAAC;QACR,GAAG,YAAY;KAChB,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { UseBaseQueryOptions } from "@tanstack/react-query";
|
|
2
|
+
import type { GetSessionResponse } from "../api";
|
|
3
|
+
export declare function useGetSession(code?: string, queryOptions?: Omit<UseBaseQueryOptions<GetSessionResponse>, "queryKey" | "queryFn">): import("@tanstack/react-query").UseQueryResult<GetSessionResponse, Error>;
|
|
4
|
+
//# sourceMappingURL=useGetSession.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useGetSession.d.ts","sourceRoot":"","sources":["../../../src/hooks/useGetSession.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAIrE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAA;AAEhD,wBAAgB,aAAa,CAC3B,IAAI,CAAC,EAAE,MAAM,EACb,YAAY,GAAE,IAAI,CAChB,mBAAmB,CAAC,kBAAkB,CAAC,EACvC,UAAU,GAAG,SAAS,CAClB,6EAUP"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { useQuery } from "@tanstack/react-query";
|
|
2
|
+
import { useAuthApiClient } from "./useAuthApiClient";
|
|
3
|
+
import { QUERY_KEYS } from "./constants";
|
|
4
|
+
import { ONE_MINUTE_MS } from "../utils/time";
|
|
5
|
+
export function useGetSession(code, queryOptions = {}) {
|
|
6
|
+
const authApiClient = useAuthApiClient();
|
|
7
|
+
return useQuery({
|
|
8
|
+
queryKey: [QUERY_KEYS.SESSION, code],
|
|
9
|
+
queryFn: () => authApiClient.getSession(code),
|
|
10
|
+
staleTime: ONE_MINUTE_MS,
|
|
11
|
+
retry: 1,
|
|
12
|
+
...queryOptions,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=useGetSession.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useGetSession.js","sourceRoot":"","sources":["../../../src/hooks/useGetSession.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAuB,MAAM,uBAAuB,CAAA;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAG7C,MAAM,UAAU,aAAa,CAC3B,IAAa,EACb,eAGI,EAAE;IAEN,MAAM,aAAa,GAAG,gBAAgB,EAAE,CAAA;IACxC,OAAO,QAAQ,CAAC;QACd,QAAQ,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC;QACpC,OAAO,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,UAAU,CAAC,IAAI,CAAC;QAC7C,SAAS,EAAE,aAAa;QACxB,KAAK,EAAE,CAAC;QACR,GAAG,YAAY;KAChB,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { MutationOptions, DefaultError } from "@tanstack/react-query";
|
|
2
|
+
import type { LinkAccountRequest, LinkAccountResponse } from "../api";
|
|
3
|
+
export declare function useLinkAccount(mutationOptions?: Omit<MutationOptions<LinkAccountResponse, DefaultError, LinkAccountRequest>, "mutationFn" | "mutationKey">): {
|
|
4
|
+
data: undefined;
|
|
5
|
+
variables: undefined;
|
|
6
|
+
error: null;
|
|
7
|
+
isError: false;
|
|
8
|
+
isIdle: true;
|
|
9
|
+
isPending: false;
|
|
10
|
+
isSuccess: false;
|
|
11
|
+
status: "idle";
|
|
12
|
+
reset: () => void;
|
|
13
|
+
context: unknown;
|
|
14
|
+
failureCount: number;
|
|
15
|
+
failureReason: Error | null;
|
|
16
|
+
isPaused: boolean;
|
|
17
|
+
submittedAt: number;
|
|
18
|
+
linkAccount: import("@tanstack/react-query").UseMutateFunction<LinkAccountResponse, Error, import("../api").CreateSessionRequest, unknown>;
|
|
19
|
+
linkAccountAsync: import("@tanstack/react-query").UseMutateAsyncFunction<LinkAccountResponse, Error, import("../api").CreateSessionRequest, unknown>;
|
|
20
|
+
} | {
|
|
21
|
+
data: undefined;
|
|
22
|
+
variables: import("../api").CreateSessionRequest;
|
|
23
|
+
error: null;
|
|
24
|
+
isError: false;
|
|
25
|
+
isIdle: false;
|
|
26
|
+
isPending: true;
|
|
27
|
+
isSuccess: false;
|
|
28
|
+
status: "pending";
|
|
29
|
+
reset: () => void;
|
|
30
|
+
context: unknown;
|
|
31
|
+
failureCount: number;
|
|
32
|
+
failureReason: Error | null;
|
|
33
|
+
isPaused: boolean;
|
|
34
|
+
submittedAt: number;
|
|
35
|
+
linkAccount: import("@tanstack/react-query").UseMutateFunction<LinkAccountResponse, Error, import("../api").CreateSessionRequest, unknown>;
|
|
36
|
+
linkAccountAsync: import("@tanstack/react-query").UseMutateAsyncFunction<LinkAccountResponse, Error, import("../api").CreateSessionRequest, unknown>;
|
|
37
|
+
} | {
|
|
38
|
+
data: undefined;
|
|
39
|
+
error: Error;
|
|
40
|
+
variables: import("../api").CreateSessionRequest;
|
|
41
|
+
isError: true;
|
|
42
|
+
isIdle: false;
|
|
43
|
+
isPending: false;
|
|
44
|
+
isSuccess: false;
|
|
45
|
+
status: "error";
|
|
46
|
+
reset: () => void;
|
|
47
|
+
context: unknown;
|
|
48
|
+
failureCount: number;
|
|
49
|
+
failureReason: Error | null;
|
|
50
|
+
isPaused: boolean;
|
|
51
|
+
submittedAt: number;
|
|
52
|
+
linkAccount: import("@tanstack/react-query").UseMutateFunction<LinkAccountResponse, Error, import("../api").CreateSessionRequest, unknown>;
|
|
53
|
+
linkAccountAsync: import("@tanstack/react-query").UseMutateAsyncFunction<LinkAccountResponse, Error, import("../api").CreateSessionRequest, unknown>;
|
|
54
|
+
} | {
|
|
55
|
+
data: LinkAccountResponse;
|
|
56
|
+
error: null;
|
|
57
|
+
variables: import("../api").CreateSessionRequest;
|
|
58
|
+
isError: false;
|
|
59
|
+
isIdle: false;
|
|
60
|
+
isPending: false;
|
|
61
|
+
isSuccess: true;
|
|
62
|
+
status: "success";
|
|
63
|
+
reset: () => void;
|
|
64
|
+
context: unknown;
|
|
65
|
+
failureCount: number;
|
|
66
|
+
failureReason: Error | null;
|
|
67
|
+
isPaused: boolean;
|
|
68
|
+
submittedAt: number;
|
|
69
|
+
linkAccount: import("@tanstack/react-query").UseMutateFunction<LinkAccountResponse, Error, import("../api").CreateSessionRequest, unknown>;
|
|
70
|
+
linkAccountAsync: import("@tanstack/react-query").UseMutateAsyncFunction<LinkAccountResponse, Error, import("../api").CreateSessionRequest, unknown>;
|
|
71
|
+
};
|
|
72
|
+
//# sourceMappingURL=useLinkAccount.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLinkAccount.d.ts","sourceRoot":"","sources":["../../../src/hooks/useLinkAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,eAAe,EACf,YAAY,EACb,MAAM,uBAAuB,CAAA;AAE9B,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAA;AAGrE,wBAAgB,cAAc,CAC5B,eAAe,GAAE,IAAI,CACnB,eAAe,CAAC,mBAAmB,EAAE,YAAY,EAAE,kBAAkB,CAAC,EACtE,YAAY,GAAG,aAAa,CACxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkBP"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useQueryClient, useMutation, } from "@tanstack/react-query";
|
|
2
|
+
import { useAuthApiClient } from "./useAuthApiClient";
|
|
3
|
+
import { QUERY_KEYS } from "./constants";
|
|
4
|
+
export function useLinkAccount(mutationOptions = {}) {
|
|
5
|
+
const queryClient = useQueryClient();
|
|
6
|
+
const authApiClient = useAuthApiClient();
|
|
7
|
+
const { onSuccess: customOnSuccess, ...restMutationOptions } = mutationOptions;
|
|
8
|
+
const { mutate, mutateAsync, ...rest } = useMutation({
|
|
9
|
+
mutationFn: (linkAccountRequest) => authApiClient.linkAccount(linkAccountRequest),
|
|
10
|
+
onSuccess: (data, variables, context) => {
|
|
11
|
+
queryClient.resetQueries({ queryKey: [QUERY_KEYS.ACCOUNT] });
|
|
12
|
+
if (customOnSuccess)
|
|
13
|
+
customOnSuccess(data, variables, context);
|
|
14
|
+
},
|
|
15
|
+
...restMutationOptions,
|
|
16
|
+
});
|
|
17
|
+
return { linkAccount: mutate, linkAccountAsync: mutateAsync, ...rest };
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=useLinkAccount.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLinkAccount.js","sourceRoot":"","sources":["../../../src/hooks/useLinkAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,WAAW,GAGZ,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAErD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAExC,MAAM,UAAU,cAAc,CAC5B,kBAGI,EAAE;IAEN,MAAM,WAAW,GAAG,cAAc,EAAE,CAAA;IACpC,MAAM,aAAa,GAAG,gBAAgB,EAAE,CAAA;IAExC,MAAM,EAAE,SAAS,EAAE,eAAe,EAAE,GAAG,mBAAmB,EAAE,GAAG,eAAe,CAAA;IAE9E,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,IAAI,EAAE,GAAG,WAAW,CAAC;QACnD,UAAU,EAAE,CAAC,kBAAsC,EAAE,EAAE,CACrD,aAAa,CAAC,WAAW,CAAC,kBAAkB,CAAC;QAC/C,SAAS,EAAE,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE;YACtC,WAAW,CAAC,YAAY,CAAC,EAAE,QAAQ,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;YAC5D,IAAI,eAAe;gBAAE,eAAe,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,CAAC,CAAA;QAChE,CAAC;QACD,GAAG,mBAAmB;KACvB,CAAC,CAAA;IAEF,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,gBAAgB,EAAE,WAAW,EAAE,GAAG,IAAI,EAAE,CAAA;AACxE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePassportContext.d.ts","sourceRoot":"","sources":["../../../src/hooks/usePassportContext.ts"],"names":[],"mappings":"AACA,OAAO,EAAmB,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAEnE,wBAAgB,kBAAkB,IAAI,oBAAoB,CAOzD"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useContext } from "react";
|
|
2
|
+
import { PassportContext } from "../provider";
|
|
3
|
+
export function usePassportContext() {
|
|
4
|
+
const passportContext = useContext(PassportContext);
|
|
5
|
+
if (!passportContext) {
|
|
6
|
+
throw new Error("usePassportContext must be used within PassportProvider!");
|
|
7
|
+
}
|
|
8
|
+
return passportContext;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=usePassportContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePassportContext.js","sourceRoot":"","sources":["../../../src/hooks/usePassportContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAClC,OAAO,EAAE,eAAe,EAAwB,MAAM,aAAa,CAAA;AAEnE,MAAM,UAAU,kBAAkB;IAChC,MAAM,eAAe,GAAG,UAAU,CAAC,eAAe,CAAC,CAAA;IACnD,IAAI,CAAC,eAAe,EAAE,CAAC;QACrB,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAA;IAC7E,CAAC;IAED,OAAO,eAAe,CAAA;AACxB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePortalApiClient.d.ts","sourceRoot":"","sources":["../../../src/hooks/usePortalApiClient.ts"],"names":[],"mappings":"AAEA,wBAAgB,kBAAkB,qCAGjC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePortalApiClient.js","sourceRoot":"","sources":["../../../src/hooks/usePortalApiClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAEzD,MAAM,UAAU,kBAAkB;IAChC,MAAM,EAAE,eAAe,EAAE,GAAG,kBAAkB,EAAE,CAAA;IAChD,OAAO,eAAe,CAAA;AACxB,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { MutationOptions } from "@tanstack/react-query";
|
|
2
|
+
import type { AuthenticationProviderRedirectResponse } from "../api";
|
|
3
|
+
declare function useSignInWithDiscord(mutationOptions?: Omit<MutationOptions<AuthenticationProviderRedirectResponse>, "mutationFn" | "mutationKey">): {
|
|
4
|
+
data: undefined;
|
|
5
|
+
variables: undefined;
|
|
6
|
+
error: null;
|
|
7
|
+
isError: false;
|
|
8
|
+
isIdle: true;
|
|
9
|
+
isPending: false;
|
|
10
|
+
isSuccess: false;
|
|
11
|
+
status: "idle";
|
|
12
|
+
reset: () => void;
|
|
13
|
+
context: unknown;
|
|
14
|
+
failureCount: number;
|
|
15
|
+
failureReason: Error | null;
|
|
16
|
+
isPaused: boolean;
|
|
17
|
+
submittedAt: number;
|
|
18
|
+
signInWithDiscord: import("@tanstack/react-query").UseMutateFunction<AuthenticationProviderRedirectResponse, Error, void, unknown>;
|
|
19
|
+
signInWithDiscordAsync: import("@tanstack/react-query").UseMutateAsyncFunction<AuthenticationProviderRedirectResponse, Error, void, unknown>;
|
|
20
|
+
} | {
|
|
21
|
+
data: undefined;
|
|
22
|
+
variables: void;
|
|
23
|
+
error: null;
|
|
24
|
+
isError: false;
|
|
25
|
+
isIdle: false;
|
|
26
|
+
isPending: true;
|
|
27
|
+
isSuccess: false;
|
|
28
|
+
status: "pending";
|
|
29
|
+
reset: () => void;
|
|
30
|
+
context: unknown;
|
|
31
|
+
failureCount: number;
|
|
32
|
+
failureReason: Error | null;
|
|
33
|
+
isPaused: boolean;
|
|
34
|
+
submittedAt: number;
|
|
35
|
+
signInWithDiscord: import("@tanstack/react-query").UseMutateFunction<AuthenticationProviderRedirectResponse, Error, void, unknown>;
|
|
36
|
+
signInWithDiscordAsync: import("@tanstack/react-query").UseMutateAsyncFunction<AuthenticationProviderRedirectResponse, Error, void, unknown>;
|
|
37
|
+
} | {
|
|
38
|
+
data: undefined;
|
|
39
|
+
error: Error;
|
|
40
|
+
variables: void;
|
|
41
|
+
isError: true;
|
|
42
|
+
isIdle: false;
|
|
43
|
+
isPending: false;
|
|
44
|
+
isSuccess: false;
|
|
45
|
+
status: "error";
|
|
46
|
+
reset: () => void;
|
|
47
|
+
context: unknown;
|
|
48
|
+
failureCount: number;
|
|
49
|
+
failureReason: Error | null;
|
|
50
|
+
isPaused: boolean;
|
|
51
|
+
submittedAt: number;
|
|
52
|
+
signInWithDiscord: import("@tanstack/react-query").UseMutateFunction<AuthenticationProviderRedirectResponse, Error, void, unknown>;
|
|
53
|
+
signInWithDiscordAsync: import("@tanstack/react-query").UseMutateAsyncFunction<AuthenticationProviderRedirectResponse, Error, void, unknown>;
|
|
54
|
+
} | {
|
|
55
|
+
data: AuthenticationProviderRedirectResponse;
|
|
56
|
+
error: null;
|
|
57
|
+
variables: void;
|
|
58
|
+
isError: false;
|
|
59
|
+
isIdle: false;
|
|
60
|
+
isPending: false;
|
|
61
|
+
isSuccess: true;
|
|
62
|
+
status: "success";
|
|
63
|
+
reset: () => void;
|
|
64
|
+
context: unknown;
|
|
65
|
+
failureCount: number;
|
|
66
|
+
failureReason: Error | null;
|
|
67
|
+
isPaused: boolean;
|
|
68
|
+
submittedAt: number;
|
|
69
|
+
signInWithDiscord: import("@tanstack/react-query").UseMutateFunction<AuthenticationProviderRedirectResponse, Error, void, unknown>;
|
|
70
|
+
signInWithDiscordAsync: import("@tanstack/react-query").UseMutateAsyncFunction<AuthenticationProviderRedirectResponse, Error, void, unknown>;
|
|
71
|
+
};
|
|
72
|
+
export { useSignInWithDiscord };
|
|
73
|
+
//# sourceMappingURL=useSignInWithDiscord.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSignInWithDiscord.d.ts","sourceRoot":"","sources":["../../../src/hooks/useSignInWithDiscord.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAe,MAAM,uBAAuB,CAAA;AAGpE,OAAO,KAAK,EAAE,sCAAsC,EAAE,MAAM,QAAQ,CAAA;AAEpE,iBAAS,oBAAoB,CAC3B,eAAe,GAAE,IAAI,CACnB,eAAe,CAAC,sCAAsC,CAAC,EACvD,YAAY,GAAG,aAAa,CACxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuBP;AAED,OAAO,EAAE,oBAAoB,EAAE,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { useMutation } from "@tanstack/react-query";
|
|
2
|
+
import { useCreateSession } from "./useCreateSession";
|
|
3
|
+
import { useEnsureNoSessionAndFetchNonce } from "./useEnsureNoSessionAndFetchNonce";
|
|
4
|
+
function useSignInWithDiscord(mutationOptions = {}) {
|
|
5
|
+
const { ensureNoSessionAndFetchNonce } = useEnsureNoSessionAndFetchNonce();
|
|
6
|
+
const { createSessionAsync } = useCreateSession();
|
|
7
|
+
const { mutate, mutateAsync, ...signInMutationRestParameters } = useMutation({
|
|
8
|
+
mutationFn: async () => {
|
|
9
|
+
await ensureNoSessionAndFetchNonce();
|
|
10
|
+
return (await createSessionAsync({
|
|
11
|
+
type: "discord",
|
|
12
|
+
}));
|
|
13
|
+
// ^ By passing type: "discord" we know for sure the return type is
|
|
14
|
+
// AuthenticationProviderRedirectResponse
|
|
15
|
+
},
|
|
16
|
+
...mutationOptions,
|
|
17
|
+
});
|
|
18
|
+
return {
|
|
19
|
+
signInWithDiscord: mutate,
|
|
20
|
+
signInWithDiscordAsync: mutateAsync,
|
|
21
|
+
...signInMutationRestParameters,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export { useSignInWithDiscord };
|
|
25
|
+
//# sourceMappingURL=useSignInWithDiscord.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSignInWithDiscord.js","sourceRoot":"","sources":["../../../src/hooks/useSignInWithDiscord.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,+BAA+B,EAAE,MAAM,mCAAmC,CAAA;AAGnF,SAAS,oBAAoB,CAC3B,kBAGI,EAAE;IAEN,MAAM,EAAE,4BAA4B,EAAE,GAAG,+BAA+B,EAAE,CAAA;IAC1E,MAAM,EAAE,kBAAkB,EAAE,GAAG,gBAAgB,EAAE,CAAA;IAEjD,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,4BAA4B,EAAE,GAAG,WAAW,CAAC;QAC3E,UAAU,EAAE,KAAK,IAAqD,EAAE;YACtE,MAAM,4BAA4B,EAAE,CAAA;YAEpC,OAAO,CAAC,MAAM,kBAAkB,CAAC;gBAC/B,IAAI,EAAE,SAAS;aAChB,CAAC,CAA2C,CAAA;YAC7C,mEAAmE;YACnE,yCAAyC;QAC3C,CAAC;QACD,GAAG,eAAe;KACnB,CAAC,CAAA;IAEF,OAAO;QACL,iBAAiB,EAAE,MAAM;QACzB,sBAAsB,EAAE,WAAW;QACnC,GAAG,4BAA4B;KAChC,CAAA;AACH,CAAC;AAED,OAAO,EAAE,oBAAoB,EAAE,CAAA"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { MutationOptions } from "@tanstack/react-query";
|
|
2
|
+
import type { Session } from "../api";
|
|
3
|
+
declare function useSignInWithWallet(mutationOptions?: Omit<MutationOptions<Session>, "mutationFn" | "mutationKey">): {
|
|
4
|
+
data: undefined;
|
|
5
|
+
variables: undefined;
|
|
6
|
+
error: null;
|
|
7
|
+
isError: false;
|
|
8
|
+
isIdle: true;
|
|
9
|
+
isPending: false;
|
|
10
|
+
isSuccess: false;
|
|
11
|
+
status: "idle";
|
|
12
|
+
reset: () => void;
|
|
13
|
+
context: unknown;
|
|
14
|
+
failureCount: number;
|
|
15
|
+
failureReason: Error | null;
|
|
16
|
+
isPaused: boolean;
|
|
17
|
+
submittedAt: number;
|
|
18
|
+
signInWithWallet: import("@tanstack/react-query").UseMutateFunction<Session, Error, void, unknown>;
|
|
19
|
+
signInWithWalletAsync: import("@tanstack/react-query").UseMutateAsyncFunction<Session, Error, void, unknown>;
|
|
20
|
+
} | {
|
|
21
|
+
data: undefined;
|
|
22
|
+
variables: void;
|
|
23
|
+
error: null;
|
|
24
|
+
isError: false;
|
|
25
|
+
isIdle: false;
|
|
26
|
+
isPending: true;
|
|
27
|
+
isSuccess: false;
|
|
28
|
+
status: "pending";
|
|
29
|
+
reset: () => void;
|
|
30
|
+
context: unknown;
|
|
31
|
+
failureCount: number;
|
|
32
|
+
failureReason: Error | null;
|
|
33
|
+
isPaused: boolean;
|
|
34
|
+
submittedAt: number;
|
|
35
|
+
signInWithWallet: import("@tanstack/react-query").UseMutateFunction<Session, Error, void, unknown>;
|
|
36
|
+
signInWithWalletAsync: import("@tanstack/react-query").UseMutateAsyncFunction<Session, Error, void, unknown>;
|
|
37
|
+
} | {
|
|
38
|
+
data: undefined;
|
|
39
|
+
error: Error;
|
|
40
|
+
variables: void;
|
|
41
|
+
isError: true;
|
|
42
|
+
isIdle: false;
|
|
43
|
+
isPending: false;
|
|
44
|
+
isSuccess: false;
|
|
45
|
+
status: "error";
|
|
46
|
+
reset: () => void;
|
|
47
|
+
context: unknown;
|
|
48
|
+
failureCount: number;
|
|
49
|
+
failureReason: Error | null;
|
|
50
|
+
isPaused: boolean;
|
|
51
|
+
submittedAt: number;
|
|
52
|
+
signInWithWallet: import("@tanstack/react-query").UseMutateFunction<Session, Error, void, unknown>;
|
|
53
|
+
signInWithWalletAsync: import("@tanstack/react-query").UseMutateAsyncFunction<Session, Error, void, unknown>;
|
|
54
|
+
} | {
|
|
55
|
+
data: Session;
|
|
56
|
+
error: null;
|
|
57
|
+
variables: void;
|
|
58
|
+
isError: false;
|
|
59
|
+
isIdle: false;
|
|
60
|
+
isPending: false;
|
|
61
|
+
isSuccess: true;
|
|
62
|
+
status: "success";
|
|
63
|
+
reset: () => void;
|
|
64
|
+
context: unknown;
|
|
65
|
+
failureCount: number;
|
|
66
|
+
failureReason: Error | null;
|
|
67
|
+
isPaused: boolean;
|
|
68
|
+
submittedAt: number;
|
|
69
|
+
signInWithWallet: import("@tanstack/react-query").UseMutateFunction<Session, Error, void, unknown>;
|
|
70
|
+
signInWithWalletAsync: import("@tanstack/react-query").UseMutateAsyncFunction<Session, Error, void, unknown>;
|
|
71
|
+
};
|
|
72
|
+
export { useSignInWithWallet };
|
|
73
|
+
//# sourceMappingURL=useSignInWithWallet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSignInWithWallet.d.ts","sourceRoot":"","sources":["../../../src/hooks/useSignInWithWallet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAEvD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAErC,iBAAS,mBAAmB,CAC1B,eAAe,GAAE,IAAI,CACnB,eAAe,CAAC,OAAO,CAAC,EACxB,YAAY,GAAG,aAAa,CACxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUP;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useAuthenticateWithWallet } from "./useAuthenticateWithWallet";
|
|
2
|
+
function useSignInWithWallet(mutationOptions = {}) {
|
|
3
|
+
const { authenticateWithWallet, authenticateWithWalletAsync, ...rest } = useAuthenticateWithWallet(false, mutationOptions);
|
|
4
|
+
return {
|
|
5
|
+
signInWithWallet: authenticateWithWallet,
|
|
6
|
+
signInWithWalletAsync: authenticateWithWalletAsync,
|
|
7
|
+
...rest,
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export { useSignInWithWallet };
|
|
11
|
+
//# sourceMappingURL=useSignInWithWallet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSignInWithWallet.js","sourceRoot":"","sources":["../../../src/hooks/useSignInWithWallet.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAA;AAGvE,SAAS,mBAAmB,CAC1B,kBAGI,EAAE;IAEN,MAAM,EAAE,sBAAsB,EAAE,2BAA2B,EAAE,GAAG,IAAI,EAAE,GACpE,yBAAyB,CAAC,KAAK,EAAE,eAAe,CAAC,CAAA;IAEnD,OAAO;QACL,gBAAgB,EAAE,sBAAsB;QACxC,qBAAqB,EAAE,2BAA2B;QAClD,GAAG,IAAI;KACR,CAAA;AACH,CAAC;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAA"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { MutationOptions } from "@tanstack/react-query";
|
|
2
|
+
import type { DeleteSessionResponse } from "../api";
|
|
3
|
+
export declare function useSignOut(mutationOptions?: Omit<MutationOptions<DeleteSessionResponse>, "mutationFn" | "mutationKey">): {
|
|
4
|
+
data: undefined;
|
|
5
|
+
variables: undefined;
|
|
6
|
+
error: null;
|
|
7
|
+
isError: false;
|
|
8
|
+
isIdle: true;
|
|
9
|
+
isPending: false;
|
|
10
|
+
isSuccess: false;
|
|
11
|
+
status: "idle";
|
|
12
|
+
reset: () => void;
|
|
13
|
+
context: unknown;
|
|
14
|
+
failureCount: number;
|
|
15
|
+
failureReason: Error | null;
|
|
16
|
+
isPaused: boolean;
|
|
17
|
+
submittedAt: number;
|
|
18
|
+
signOut: import("@tanstack/react-query").UseMutateFunction<DeleteSessionResponse, Error, void, unknown>;
|
|
19
|
+
signOutAsync: import("@tanstack/react-query").UseMutateAsyncFunction<DeleteSessionResponse, Error, void, unknown>;
|
|
20
|
+
} | {
|
|
21
|
+
data: undefined;
|
|
22
|
+
variables: void;
|
|
23
|
+
error: null;
|
|
24
|
+
isError: false;
|
|
25
|
+
isIdle: false;
|
|
26
|
+
isPending: true;
|
|
27
|
+
isSuccess: false;
|
|
28
|
+
status: "pending";
|
|
29
|
+
reset: () => void;
|
|
30
|
+
context: unknown;
|
|
31
|
+
failureCount: number;
|
|
32
|
+
failureReason: Error | null;
|
|
33
|
+
isPaused: boolean;
|
|
34
|
+
submittedAt: number;
|
|
35
|
+
signOut: import("@tanstack/react-query").UseMutateFunction<DeleteSessionResponse, Error, void, unknown>;
|
|
36
|
+
signOutAsync: import("@tanstack/react-query").UseMutateAsyncFunction<DeleteSessionResponse, Error, void, unknown>;
|
|
37
|
+
} | {
|
|
38
|
+
data: undefined;
|
|
39
|
+
error: Error;
|
|
40
|
+
variables: void;
|
|
41
|
+
isError: true;
|
|
42
|
+
isIdle: false;
|
|
43
|
+
isPending: false;
|
|
44
|
+
isSuccess: false;
|
|
45
|
+
status: "error";
|
|
46
|
+
reset: () => void;
|
|
47
|
+
context: unknown;
|
|
48
|
+
failureCount: number;
|
|
49
|
+
failureReason: Error | null;
|
|
50
|
+
isPaused: boolean;
|
|
51
|
+
submittedAt: number;
|
|
52
|
+
signOut: import("@tanstack/react-query").UseMutateFunction<DeleteSessionResponse, Error, void, unknown>;
|
|
53
|
+
signOutAsync: import("@tanstack/react-query").UseMutateAsyncFunction<DeleteSessionResponse, Error, void, unknown>;
|
|
54
|
+
} | {
|
|
55
|
+
data: DeleteSessionResponse;
|
|
56
|
+
error: null;
|
|
57
|
+
variables: void;
|
|
58
|
+
isError: false;
|
|
59
|
+
isIdle: false;
|
|
60
|
+
isPending: false;
|
|
61
|
+
isSuccess: true;
|
|
62
|
+
status: "success";
|
|
63
|
+
reset: () => void;
|
|
64
|
+
context: unknown;
|
|
65
|
+
failureCount: number;
|
|
66
|
+
failureReason: Error | null;
|
|
67
|
+
isPaused: boolean;
|
|
68
|
+
submittedAt: number;
|
|
69
|
+
signOut: import("@tanstack/react-query").UseMutateFunction<DeleteSessionResponse, Error, void, unknown>;
|
|
70
|
+
signOutAsync: import("@tanstack/react-query").UseMutateAsyncFunction<DeleteSessionResponse, Error, void, unknown>;
|
|
71
|
+
};
|
|
72
|
+
//# sourceMappingURL=useSignOut.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSignOut.d.ts","sourceRoot":"","sources":["../../../src/hooks/useSignOut.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAGhB,MAAM,uBAAuB,CAAA;AAG9B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAA;AAEnD,wBAAgB,UAAU,CACxB,eAAe,GAAE,IAAI,CACnB,eAAe,CAAC,qBAAqB,CAAC,EACtC,YAAY,GAAG,aAAa,CACxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqBP"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { useMutation, useQueryClient, } from "@tanstack/react-query";
|
|
2
|
+
import { useAuthApiClient } from "./useAuthApiClient";
|
|
3
|
+
import { QUERY_KEYS } from "./constants";
|
|
4
|
+
export function useSignOut(mutationOptions = {}) {
|
|
5
|
+
const queryClient = useQueryClient();
|
|
6
|
+
const authApiClient = useAuthApiClient();
|
|
7
|
+
const { onSuccess: customOnSuccess, ...restMutationOptions } = mutationOptions;
|
|
8
|
+
const { mutate, mutateAsync, ...rest } = useMutation({
|
|
9
|
+
mutationFn: () => authApiClient.deleteSession(),
|
|
10
|
+
onSuccess: (data, variables, context) => {
|
|
11
|
+
queryClient.resetQueries({ queryKey: [QUERY_KEYS.SESSION] });
|
|
12
|
+
queryClient.resetQueries({
|
|
13
|
+
queryKey: [QUERY_KEYS.ACCOUNT, QUERY_KEYS.CURRENT],
|
|
14
|
+
});
|
|
15
|
+
if (customOnSuccess)
|
|
16
|
+
customOnSuccess(data, variables, context);
|
|
17
|
+
},
|
|
18
|
+
...restMutationOptions,
|
|
19
|
+
});
|
|
20
|
+
return { signOut: mutate, signOutAsync: mutateAsync, ...rest };
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=useSignOut.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSignOut.js","sourceRoot":"","sources":["../../../src/hooks/useSignOut.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,WAAW,EACX,cAAc,GACf,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAGxC,MAAM,UAAU,UAAU,CACxB,kBAGI,EAAE;IAEN,MAAM,WAAW,GAAG,cAAc,EAAE,CAAA;IACpC,MAAM,aAAa,GAAG,gBAAgB,EAAE,CAAA;IAExC,MAAM,EAAE,SAAS,EAAE,eAAe,EAAE,GAAG,mBAAmB,EAAE,GAAG,eAAe,CAAA;IAE9E,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,IAAI,EAAE,GAAG,WAAW,CAAC;QACnD,UAAU,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,aAAa,EAAE;QAC/C,SAAS,EAAE,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE;YACtC,WAAW,CAAC,YAAY,CAAC,EAAE,QAAQ,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;YAC5D,WAAW,CAAC,YAAY,CAAC;gBACvB,QAAQ,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,UAAU,CAAC,OAAO,CAAC;aACnD,CAAC,CAAA;YAEF,IAAI,eAAe;gBAAE,eAAe,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,CAAC,CAAA;QAChE,CAAC;QACD,GAAG,mBAAmB;KACvB,CAAC,CAAA;IAEF,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,GAAG,IAAI,EAAE,CAAA;AAChE,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { MutationOptions } from "@tanstack/react-query";
|
|
2
|
+
import type { Session } from "../api";
|
|
3
|
+
declare function useSignUpWithWallet(mutationOptions?: Omit<MutationOptions<Session>, "mutationFn" | "mutationKey">): {
|
|
4
|
+
data: undefined;
|
|
5
|
+
variables: undefined;
|
|
6
|
+
error: null;
|
|
7
|
+
isError: false;
|
|
8
|
+
isIdle: true;
|
|
9
|
+
isPending: false;
|
|
10
|
+
isSuccess: false;
|
|
11
|
+
status: "idle";
|
|
12
|
+
reset: () => void;
|
|
13
|
+
context: unknown;
|
|
14
|
+
failureCount: number;
|
|
15
|
+
failureReason: Error | null;
|
|
16
|
+
isPaused: boolean;
|
|
17
|
+
submittedAt: number;
|
|
18
|
+
signUpWithWallet: import("@tanstack/react-query").UseMutateFunction<Session, Error, void, unknown>;
|
|
19
|
+
signUpWithWalletAsync: import("@tanstack/react-query").UseMutateAsyncFunction<Session, Error, void, unknown>;
|
|
20
|
+
} | {
|
|
21
|
+
data: undefined;
|
|
22
|
+
variables: void;
|
|
23
|
+
error: null;
|
|
24
|
+
isError: false;
|
|
25
|
+
isIdle: false;
|
|
26
|
+
isPending: true;
|
|
27
|
+
isSuccess: false;
|
|
28
|
+
status: "pending";
|
|
29
|
+
reset: () => void;
|
|
30
|
+
context: unknown;
|
|
31
|
+
failureCount: number;
|
|
32
|
+
failureReason: Error | null;
|
|
33
|
+
isPaused: boolean;
|
|
34
|
+
submittedAt: number;
|
|
35
|
+
signUpWithWallet: import("@tanstack/react-query").UseMutateFunction<Session, Error, void, unknown>;
|
|
36
|
+
signUpWithWalletAsync: import("@tanstack/react-query").UseMutateAsyncFunction<Session, Error, void, unknown>;
|
|
37
|
+
} | {
|
|
38
|
+
data: undefined;
|
|
39
|
+
error: Error;
|
|
40
|
+
variables: void;
|
|
41
|
+
isError: true;
|
|
42
|
+
isIdle: false;
|
|
43
|
+
isPending: false;
|
|
44
|
+
isSuccess: false;
|
|
45
|
+
status: "error";
|
|
46
|
+
reset: () => void;
|
|
47
|
+
context: unknown;
|
|
48
|
+
failureCount: number;
|
|
49
|
+
failureReason: Error | null;
|
|
50
|
+
isPaused: boolean;
|
|
51
|
+
submittedAt: number;
|
|
52
|
+
signUpWithWallet: import("@tanstack/react-query").UseMutateFunction<Session, Error, void, unknown>;
|
|
53
|
+
signUpWithWalletAsync: import("@tanstack/react-query").UseMutateAsyncFunction<Session, Error, void, unknown>;
|
|
54
|
+
} | {
|
|
55
|
+
data: Session;
|
|
56
|
+
error: null;
|
|
57
|
+
variables: void;
|
|
58
|
+
isError: false;
|
|
59
|
+
isIdle: false;
|
|
60
|
+
isPending: false;
|
|
61
|
+
isSuccess: true;
|
|
62
|
+
status: "success";
|
|
63
|
+
reset: () => void;
|
|
64
|
+
context: unknown;
|
|
65
|
+
failureCount: number;
|
|
66
|
+
failureReason: Error | null;
|
|
67
|
+
isPaused: boolean;
|
|
68
|
+
submittedAt: number;
|
|
69
|
+
signUpWithWallet: import("@tanstack/react-query").UseMutateFunction<Session, Error, void, unknown>;
|
|
70
|
+
signUpWithWalletAsync: import("@tanstack/react-query").UseMutateAsyncFunction<Session, Error, void, unknown>;
|
|
71
|
+
};
|
|
72
|
+
export { useSignUpWithWallet };
|
|
73
|
+
//# sourceMappingURL=useSignUpWithWallet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSignUpWithWallet.d.ts","sourceRoot":"","sources":["../../../src/hooks/useSignUpWithWallet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAEvD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAErC,iBAAS,mBAAmB,CAC1B,eAAe,GAAE,IAAI,CACnB,eAAe,CAAC,OAAO,CAAC,EACxB,YAAY,GAAG,aAAa,CACxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUP;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useAuthenticateWithWallet } from "./useAuthenticateWithWallet";
|
|
2
|
+
function useSignUpWithWallet(mutationOptions = {}) {
|
|
3
|
+
const { authenticateWithWallet, authenticateWithWalletAsync, ...rest } = useAuthenticateWithWallet(true, mutationOptions);
|
|
4
|
+
return {
|
|
5
|
+
signUpWithWallet: authenticateWithWallet,
|
|
6
|
+
signUpWithWalletAsync: authenticateWithWalletAsync,
|
|
7
|
+
...rest,
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export { useSignUpWithWallet };
|
|
11
|
+
//# sourceMappingURL=useSignUpWithWallet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSignUpWithWallet.js","sourceRoot":"","sources":["../../../src/hooks/useSignUpWithWallet.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAA;AAGvE,SAAS,mBAAmB,CAC1B,kBAGI,EAAE;IAEN,MAAM,EAAE,sBAAsB,EAAE,2BAA2B,EAAE,GAAG,IAAI,EAAE,GACpE,yBAAyB,CAAC,IAAI,EAAE,eAAe,CAAC,CAAA;IAElD,OAAO;QACL,gBAAgB,EAAE,sBAAsB;QACxC,qBAAqB,EAAE,2BAA2B;QAClD,GAAG,IAAI;KACR,CAAA;AACH,CAAC;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAA"}
|