@openfort/react 0.0.6 → 0.0.8

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/build/index.es.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Openfort as Openfort$1, EmbeddedState, AuthActionRequiredActions, OAuthProvider, RecoveryMethod, MissingRecoveryPasswordError, AccountTypeEnum, ChainTypeEnum } from '@openfort/openfort-js';
2
- export { RecoveryMethod, ThirdPartyOAuthProvider } from '@openfort/openfort-js';
2
+ export { OAuthProvider, RecoveryMethod, ThirdPartyOAuthProvider } from '@openfort/openfort-js';
3
3
  import { http, useConfig, useConnectors as useConnectors$1, useConnect as useConnect$1, useAccount, useDisconnect, useChainId, useSwitchChain, createConfig, useEnsAddress, useEnsName, useEnsAvatar, useBalance, WagmiContext, useBlockNumber } from 'wagmi';
4
4
  import { mainnet, polygon, optimism, arbitrum, sepolia } from 'wagmi/chains';
5
5
  import { safe, injected, coinbaseWallet, walletConnect } from '@wagmi/connectors';
@@ -7,7 +7,7 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
7
7
  import React, { useEffect, createContext, useState, useMemo, useRef, useCallback, createElement, useLayoutEffect, useContext } from 'react';
8
8
  import { detect } from 'detect-browser';
9
9
  import { Buffer } from 'buffer';
10
- import { useQueryClient, useQuery } from '@tanstack/react-query';
10
+ import { useQuery, useQueryClient } from '@tanstack/react-query';
11
11
  import { motion, AnimatePresence, MotionConfig } from 'framer-motion';
12
12
  import styled$1, { css, keyframes } from 'styled-components';
13
13
  import { createPortal } from 'react-dom';
@@ -22,13 +22,14 @@ import { createSiweMessage } from 'viem/siwe';
22
22
  import { signMessage } from '@wagmi/core';
23
23
  import calculateEntropy from 'fast-password-entropy';
24
24
 
25
- const OPENFORT_VERSION = '0.0.6';
25
+ const OPENFORT_VERSION = '0.0.8';
26
26
 
27
27
  var OpenfortErrorType;
28
28
  (function (OpenfortErrorType) {
29
29
  OpenfortErrorType["AUTHENTICATION_ERROR"] = "AUTHENTICATION_ERROR";
30
30
  OpenfortErrorType["WALLET_ERROR"] = "WALLET_ERROR";
31
31
  OpenfortErrorType["CONFIGURATION_ERROR"] = "CONFIGURATION_ERROR";
32
+ OpenfortErrorType["VALIDATION_ERROR"] = "VALIDATION_ERROR";
32
33
  })(OpenfortErrorType || (OpenfortErrorType = {}));
33
34
  class OpenfortError extends Error {
34
35
  constructor(message, type, data) {
@@ -760,24 +761,24 @@ const routes = {
760
761
  PROFILE: 'profile',
761
762
  SWITCHNETWORKS: 'switchNetworks',
762
763
  };
763
- var AuthProvider;
764
- (function (AuthProvider) {
765
- AuthProvider["GOOGLE"] = "google";
766
- AuthProvider["TWITTER"] = "twitter";
767
- AuthProvider["FACEBOOK"] = "facebook";
764
+ var UIAuthProvider;
765
+ (function (UIAuthProvider) {
766
+ UIAuthProvider["GOOGLE"] = "google";
767
+ UIAuthProvider["TWITTER"] = "twitter";
768
+ UIAuthProvider["FACEBOOK"] = "facebook";
768
769
  // DISCORD = "discord",
769
770
  // EPIC_GAMES = "epic_games",
770
771
  // LINE = "line",
771
772
  // TELEGRAM = "telegram", // Telegram is not working yet
772
773
  // Extended Providers
773
- AuthProvider["EMAIL"] = "email";
774
- AuthProvider["WALLET"] = "wallet";
775
- AuthProvider["GUEST"] = "guest";
776
- })(AuthProvider || (AuthProvider = {}));
774
+ UIAuthProvider["EMAIL"] = "email";
775
+ UIAuthProvider["WALLET"] = "wallet";
776
+ UIAuthProvider["GUEST"] = "guest";
777
+ })(UIAuthProvider || (UIAuthProvider = {}));
777
778
  const socialProviders = [
778
- AuthProvider.GOOGLE,
779
- AuthProvider.TWITTER,
780
- AuthProvider.FACEBOOK,
779
+ UIAuthProvider.GOOGLE,
780
+ UIAuthProvider.TWITTER,
781
+ UIAuthProvider.FACEBOOK,
781
782
  ];
782
783
 
783
784
  function useChainIsSupported(chainId) {
@@ -986,19 +987,20 @@ const CoreOpenfortProvider = ({ children, debugMode, onConnect, onDisconnect, ..
986
987
  const { walletConfig } = useOpenfort();
987
988
  // ---- Openfort instance ----
988
989
  const openfort = useMemo(() => {
990
+ var _a;
989
991
  log('Creating Openfort instance.', openfortProps);
990
992
  if (!openfortProps.baseConfiguration.publishableKey)
991
993
  throw Error('CoreOpenfortProvider requires a publishableKey to be set in the baseConfiguration.');
994
+ if (openfortProps.shieldConfiguration && !((_a = openfortProps.shieldConfiguration) === null || _a === void 0 ? void 0 : _a.passkeyRpId) && typeof window !== 'undefined') {
995
+ openfortProps.shieldConfiguration = {
996
+ passkeyRpId: window.location.hostname,
997
+ passkeyRpName: document.title || 'Openfort DApp',
998
+ ...openfortProps.shieldConfiguration,
999
+ };
1000
+ }
992
1001
  const newClient = createOpenfortClient(openfortProps);
993
1002
  return newClient;
994
1003
  }, []);
995
- // Create or use provided client
996
- // const client = useMemo(() => {
997
- // // return new Openfort(openfortProps)
998
- // const newClient = createOpenfortClient(openfortProps);
999
- // setDefaultClient(newClient);
1000
- // return newClient;
1001
- // }, [openfortProps]);
1002
1004
  // ---- Embedded state ----
1003
1005
  const [embeddedState, setEmbeddedState] = useState(EmbeddedState.NONE);
1004
1006
  const pollingRef = useRef(null);
@@ -1087,6 +1089,13 @@ const CoreOpenfortProvider = ({ children, debugMode, onConnect, onDisconnect, ..
1087
1089
  openfort.embeddedWallet.getEthereumProvider(resolvePolicy());
1088
1090
  }, [openfort, walletConfig, chainId]);
1089
1091
  const [isConnectedWithEmbeddedSigner, setIsConnectedWithEmbeddedSigner] = useState(false);
1092
+ // will reset on logout
1093
+ const { data: embeddedAccounts, refetch: fetchEmbeddedAccounts, isPending: isLoadingAccounts } = useQuery({
1094
+ queryKey: ['openfortEmbeddedAccountsList'],
1095
+ queryFn: () => openfort.embeddedWallet.list(),
1096
+ refetchOnMount: false,
1097
+ refetchOnWindowFocus: false,
1098
+ });
1090
1099
  useEffect(() => {
1091
1100
  if (!openfort)
1092
1101
  return;
@@ -1103,6 +1112,7 @@ const CoreOpenfortProvider = ({ children, debugMode, onConnect, onDisconnect, ..
1103
1112
  if (!user)
1104
1113
  updateUser(undefined, true);
1105
1114
  setIsConnectedWithEmbeddedSigner(false);
1115
+ fetchEmbeddedAccounts();
1106
1116
  break;
1107
1117
  case EmbeddedState.READY:
1108
1118
  (async () => {
@@ -1148,7 +1158,7 @@ const CoreOpenfortProvider = ({ children, debugMode, onConnect, onDisconnect, ..
1148
1158
  log('Logging out...');
1149
1159
  await openfort.auth.logout();
1150
1160
  await disconnectAsync();
1151
- queryClient.resetQueries({ queryKey: ['openfortEmbeddedWalletList'] });
1161
+ queryClient.resetQueries({ queryKey: ['openfortEmbeddedAccountsList'] });
1152
1162
  reset();
1153
1163
  startPollingEmbeddedState();
1154
1164
  }, [openfort]);
@@ -1198,6 +1208,8 @@ const CoreOpenfortProvider = ({ children, debugMode, onConnect, onDisconnect, ..
1198
1208
  needsRecovery,
1199
1209
  user,
1200
1210
  updateUser,
1211
+ embeddedAccounts,
1212
+ isLoadingAccounts,
1201
1213
  client: openfort,
1202
1214
  };
1203
1215
  return createElement(Context$1.Provider, { value }, jsxs(Fragment, { children: [jsx(ConnectCallback, { onConnect: onConnect, onDisconnect: onDisconnect }), children] }));
@@ -1354,7 +1366,7 @@ var base = {
1354
1366
  '--ck-body-disclaimer-link-hover-color': '#FFFFFF',
1355
1367
  '--ck-modal-box-shadow': '0px 2px 4px rgba(0, 0, 0, 0.02)',
1356
1368
  '--ck-copytoclipboard-stroke': '#555555',
1357
- '--ck-tooltip-background': '#2B2B2B',
1369
+ '--ck-tooltip-background': '#323232ff',
1358
1370
  '--ck-tooltip-background-secondary': '#333333',
1359
1371
  '--ck-tooltip-color': '#999999',
1360
1372
  '--ck-tooltip-shadow': '0px 2px 10px rgba(0, 0, 0, 0.08)',
@@ -2047,6 +2059,8 @@ const themeGlobals = {
2047
2059
  '--ck-chain-ethereum-01': '#25292E',
2048
2060
  '--ck-chain-ethereum-02': '#fff',
2049
2061
  '--ck-chain-ethereum-03': '#DFE0E0',
2062
+ '--ck-body-color-danger': '#FF4E4E',
2063
+ '--ck-body-color-valid': '#32D74B',
2050
2064
  },
2051
2065
  dark: {
2052
2066
  '--ck-graphic-wave-stop-01': '#E8F17D',
@@ -2058,6 +2072,8 @@ const themeGlobals = {
2058
2072
  '--ck-graphic-scaniconwithlogos-02': '#696969',
2059
2073
  '--ck-graphic-scaniconwithlogos-03': '#F8D74A',
2060
2074
  '--ck-graphic-scaniconwithlogos-04': '#3D3D3D',
2075
+ '--ck-body-color-danger': '#FF4E4E',
2076
+ '--ck-body-color-valid': '#32D74B',
2061
2077
  //'--ck-chain-ethereum-01': '#fff',
2062
2078
  //'--ck-chain-ethereum-02': '#000',
2063
2079
  //'--ck-chain-ethereum-03': '#000',
@@ -3100,9 +3116,10 @@ const EmailIcon = ({ ...props }) => (jsxs("svg", { xmlns: "http://www.w3.org/200
3100
3116
  const GuestIcon = ({ ...props }) => (jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 256 256", width: "256", height: "256", children: [jsx("rect", { width: "256", height: "256", fill: "none" }), jsx("circle", { cx: "128", cy: "96", r: "64", fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "16" }), jsx("path", { d: "M32,216c19.37-33.47,54.55-56,96-56s76.63,22.53,96,56", fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "16" })] }));
3101
3117
  const EyeIcon = ({ ...props }) => (jsxs("svg", { width: "800", height: "800", fill: "none", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", ...props, children: [jsx("path", { d: "m15.001 12c0 1.6569-1.3431 3-3 3-1.6568 0-3-1.3431-3-3s1.3432-3 3-3c1.6569 0 3 1.3431 3 3z", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2 }), jsx("path", { d: "m12.001 5c-4.4777 0-8.2679 2.9429-9.5422 7 1.2743 4.0571 5.0646 7 9.5422 7 4.4776 0 8.2679-2.9429 9.5422-7-1.2743-4.0571-5.0646-7-9.5422-7z", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2 })] }));
3102
3118
  const EyeOffIcon = ({ ...props }) => (jsx("svg", { width: "800", height: "800", fill: "none", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", ...props, children: jsx("path", { d: "m2.999 3 18 18m-11.156-11.086c-0.52264 0.53996-0.84428 1.2756-0.84428 2.0864 0 1.6569 1.3432 3 3 3 0.8225 0 1.5677-0.331 2.1096-0.867m-7.6096-7.4858c-1.8993 1.2532-3.346 3.1368-4.042 5.3528 1.2742 4.0571 5.0646 7 9.5422 7 1.9889 0 3.8422-0.5806 5.3996-1.5816m-6.3998-12.369c0.329-0.03266 0.6627-0.04939 1.0002-0.04939 4.4777 0 8.268 2.9429 9.5422 7-0.2807 0.894-0.6837 1.7338-1.1892 2.5", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2 }) }));
3103
- const KeyIcon = ({ ...props }) => (jsx("svg", { transform: "matrix(1 0 0 1 0 0)", width: "197px", height: "197px", fill: "none", stroke: "#000000", viewBox: "-2.4 -2.4 28.8 28.8", xmlns: "http://www.w3.org/2000/svg", ...props, children: jsx("path", { d: "M15 15a6 6 0 1 0-5.743-4.257L9 11l-5.707 5.707a1 1 0 0 0-.293.707V20a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1 1 1 0 0 1 1-1 1 1 0 0 0 1-1 1 1 0 0 1 1-1h.586a1 1 0 0 0 .707-.293L13 15l.257-.257A5.999 5.999 0 0 0 15 15zm2-6a2 2 0 0 0-2-2", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.152 }) }));
3104
- const LockIcon = ({ ...props }) => (jsxs("svg", { fill: "none", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", ...props, children: [jsx("path", { d: "m9 16c0 0.5523-0.44772 1-1 1s-1-0.4477-1-1 0.44772-1 1-1 1 0.4477 1 1z", fill: "currentColor" }), jsx("path", { d: "m13 16c0 0.5523-0.4477 1-1 1s-1-0.4477-1-1 0.4477-1 1-1 1 0.4477 1 1z", fill: "currentColor" }), jsx("path", { d: "m17 16c0 0.5523-0.4477 1-1 1s-1-0.4477-1-1 0.4477-1 1-1 1 0.4477 1 1z", fill: "currentColor" }), jsx("path", { d: "m6 10v-2c0-0.34071 0.0284-0.67479 0.08296-1m11.917 3v-2c0-3.3137-2.6863-6-6-6-1.792 0-3.4006 0.78563-4.5 2.0313", stroke: "currentColor", strokeLinecap: "round", strokeWidth: 1.68 }), jsx("path", { d: "m11 22h-3c-2.8284 0-4.2426 0-5.1213-0.8787s-0.87868-2.2929-0.87868-5.1213 0-4.2426 0.87868-5.1213 2.2929-0.8787 5.1213-0.8787h8c2.8284 0 4.2426 0 5.1213 0.8787s0.8787 2.2929 0.8787 5.1213 0 4.2426-0.8787 5.1213-2.2929 0.8787-5.1213 0.8787h-1", stroke: "currentColor", strokeLinecap: "round", strokeWidth: 1.68 })] }));
3119
+ const KeyIcon = ({ ...props }) => (jsx("svg", { transform: "matrix(1 0 0 1 0 0)", width: "24", height: "24", fill: "none", stroke: "#000000", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", ...props, children: jsx("path", { d: "M15 15a6 6 0 1 0-5.743-4.257L9 11l-5.707 5.707a1 1 0 0 0-.293.707V20a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1 1 1 0 0 1 1-1 1 1 0 0 0 1-1 1 1 0 0 1 1-1h.586a1 1 0 0 0 .707-.293L13 15l.257-.257A5.999 5.999 0 0 0 15 15zm2-6a2 2 0 0 0-2-2", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.152 }) }));
3120
+ const LockIcon = ({ ...props }) => (jsxs("svg", { fill: "none", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", ...props, children: [jsx("path", { d: "m9 16c0 0.5523-0.44772 1-1 1s-1-0.4477-1-1 0.44772-1 1-1 1 0.4477 1 1z", fill: "currentColor" }), jsx("path", { d: "m13 16c0 0.5523-0.4477 1-1 1s-1-0.4477-1-1 0.4477-1 1-1 1 0.4477 1 1z", fill: "currentColor" }), jsx("path", { d: "m17 16c0 0.5523-0.4477 1-1 1s-1-0.4477-1-1 0.4477-1 1-1 1 0.4477 1 1z", fill: "currentColor" }), jsx("path", { d: "m6 10v-2c0-0.34071 0.0284-0.67479 0.08296-1m11.917 3v-2c0-3.3137-2.6863-6-6-6-1.792 0-3.4006 0.78563-4.5 2.0313", stroke: "currentColor", strokeLinecap: "round", strokeWidth: 1.152 }), jsx("path", { d: "m11 22h-3c-2.8284 0-4.2426 0-5.1213-0.8787s-0.87868-2.2929-0.87868-5.1213 0-4.2426 0.87868-5.1213 2.2929-0.8787 5.1213-0.8787h8c2.8284 0 4.2426 0 5.1213 0.8787s0.8787 2.2929 0.8787 5.1213 0 4.2426-0.8787 5.1213-2.2929 0.8787-5.1213 0.8787h-1", stroke: "currentColor", strokeLinecap: "round", strokeWidth: 1.152 })] }));
3105
3121
  const ShieldIcon = ({ ...props }) => (jsx("svg", { fill: "none", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", ...props, children: jsx("path", { d: "m9 12 2 2 4-4m5 2c0 4.4611-5.46 7.6937-7.3586 8.683-0.2053 0.107-0.308 0.1605-0.4504 0.1882-0.111 0.0216-0.271 0.0216-0.382 0-0.1424-0.0277-0.2451-0.0812-0.4504-0.1882-1.8986-0.9893-7.3586-4.2219-7.3586-8.683v-3.7824c0-0.79951 0-1.1993 0.13076-1.5429 0.11551-0.30357 0.30322-0.57443 0.5469-0.78918 0.27584-0.24309 0.65014-0.38345 1.3987-0.66418l5.3618-2.0107c0.2079-0.07796 0.3118-0.11694 0.4188-0.1324 0.0948-0.0137 0.1912-0.0137 0.286 0 0.107 0.01546 0.2109 0.05444 0.4188 0.1324l5.3618 2.0107c0.7486 0.28073 1.1229 0.42109 1.3987 0.66418 0.2437 0.21475 0.4314 0.48561 0.5469 0.78918 0.1308 0.34363 0.1308 0.74338 0.1308 1.5429v3.7824z", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.2 }) }));
3122
+ const FingerPrintIcon = ({ ...props }) => (jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 256 256", ...props, children: [jsx("rect", { width: 256, height: 256, fill: "none" }), jsx("path", { d: "M50.69,184.92A127.52,127.52,0,0,0,64,128a63.85,63.85,0,0,1,24-50", fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 10 }), jsx("path", { d: "M128,128a191.11,191.11,0,0,1-24,93", fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 10 }), jsx("path", { d: "M96,128a32,32,0,0,1,64,0,223.12,223.12,0,0,1-21.28,95.41", fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 10 }), jsx("path", { d: "M218.56,184A289.45,289.45,0,0,0,224,128a96,96,0,0,0-192,0,95.8,95.8,0,0,1-5.47,32", fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 10 }), jsx("path", { d: "M92.81,160a158.92,158.92,0,0,1-18.12,47.84", fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 10 }), jsx("path", { d: "M120,64.5a66,66,0,0,1,8-.49,64,64,0,0,1,64,64,259.86,259.86,0,0,1-2,32", fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 10 }), jsx("path", { d: "M183.94,192q-2.28,8.88-5.18,17.5", fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 10 })] }));
3106
3123
 
3107
3124
  const KEYCODE_TAB = 9;
3108
3125
  function useFocusTrap() {
@@ -7642,7 +7659,7 @@ const LogoPosition = styled(motion.div) `
7642
7659
  const LogoInner = styled(motion.div) `
7643
7660
  position: absolute;
7644
7661
  `;
7645
- const LogoGraphic = styled(motion.div) `
7662
+ const LogoGraphic$1 = styled(motion.div) `
7646
7663
  position: relative;
7647
7664
  overflow: hidden;
7648
7665
  height: 58px;
@@ -7712,7 +7729,7 @@ const Logo$2 = styled(motion.div) `
7712
7729
 
7713
7730
  &:nth-child(1) ${LogoPosition} {
7714
7731
  transform: translate(50%, 50%);
7715
- ${LogoGraphic} {
7732
+ ${LogoGraphic$1} {
7716
7733
  border-radius: 17.2px;
7717
7734
  width: 72px;
7718
7735
  height: 72px;
@@ -7739,7 +7756,7 @@ const Introduction = () => {
7739
7756
  const context = useOpenfort();
7740
7757
  const locales = useLocales({});
7741
7758
  const ctaUrl = (_b = (_a = context.uiConfig) === null || _a === void 0 ? void 0 : _a.walletOnboardingUrl) !== null && _b !== void 0 ? _b : locales.onboardingScreen_ctaUrl;
7742
- return (jsxs(PageContent, { children: [jsxs(Graphic, { children: [jsxs(LogoGroup, { children: [jsx(Logo$2, { children: jsx(LogoPosition, { children: jsx(LogoInner, { children: jsx(FloatWrapper, { children: jsx(RotateWrapper, { children: jsx(LogoGraphic, { children: jsx(Logos.Coinbase, { background: true }) }) }) }) }) }) }), jsx(Logo$2, { children: jsx(LogoPosition, { children: jsx(LogoInner, { children: jsx(FloatWrapper, { children: jsx(RotateWrapper, { children: jsx(LogoGraphic, { children: jsx(Logos.MetaMask, { background: true }) }) }) }) }) }) }), jsx(Logo$2, { children: jsx(LogoPosition, { children: jsx(LogoInner, { children: jsx(FloatWrapper, { children: jsx(RotateWrapper, { children: jsx(LogoGraphic, { children: jsx(Logos.Trust, {}) }) }) }) }) }) }), jsx(Logo$2, { children: jsx(LogoPosition, { children: jsx(LogoInner, { children: jsx(FloatWrapper, { children: jsx(RotateWrapper, { children: jsx(LogoGraphic, { children: jsx(Logos.Argent, {}) }) }) }) }) }) }), jsx(Logo$2, { children: jsx(LogoPosition, { children: jsx(LogoInner, { children: jsx(FloatWrapper, { children: jsx(RotateWrapper, { children: jsx(LogoGraphic, { children: jsx(Logos.ImToken, {}) }) }) }) }) }) })] }), jsx(GraphicBackground, { children: wave })] }), jsxs(ModalContent, { style: { paddingBottom: 18 }, children: [jsx(ModalH1, { "$small": true, children: locales.onboardingScreen_h1 }), jsx(ModalBody, { children: locales.onboardingScreen_p })] }), jsx(Button, { href: ctaUrl, arrow: true, children: locales.onboardingScreen_ctaText })] }));
7759
+ return (jsxs(PageContent, { children: [jsxs(Graphic, { children: [jsxs(LogoGroup, { children: [jsx(Logo$2, { children: jsx(LogoPosition, { children: jsx(LogoInner, { children: jsx(FloatWrapper, { children: jsx(RotateWrapper, { children: jsx(LogoGraphic$1, { children: jsx(Logos.Coinbase, { background: true }) }) }) }) }) }) }), jsx(Logo$2, { children: jsx(LogoPosition, { children: jsx(LogoInner, { children: jsx(FloatWrapper, { children: jsx(RotateWrapper, { children: jsx(LogoGraphic$1, { children: jsx(Logos.MetaMask, { background: true }) }) }) }) }) }) }), jsx(Logo$2, { children: jsx(LogoPosition, { children: jsx(LogoInner, { children: jsx(FloatWrapper, { children: jsx(RotateWrapper, { children: jsx(LogoGraphic$1, { children: jsx(Logos.Trust, {}) }) }) }) }) }) }), jsx(Logo$2, { children: jsx(LogoPosition, { children: jsx(LogoInner, { children: jsx(FloatWrapper, { children: jsx(RotateWrapper, { children: jsx(LogoGraphic$1, { children: jsx(Logos.Argent, {}) }) }) }) }) }) }), jsx(Logo$2, { children: jsx(LogoPosition, { children: jsx(LogoInner, { children: jsx(FloatWrapper, { children: jsx(RotateWrapper, { children: jsx(LogoGraphic$1, { children: jsx(Logos.ImToken, {}) }) }) }) }) }) })] }), jsx(GraphicBackground, { children: wave })] }), jsxs(ModalContent, { style: { paddingBottom: 18 }, children: [jsx(ModalH1, { "$small": true, children: locales.onboardingScreen_h1 }), jsx(ModalBody, { children: locales.onboardingScreen_p })] }), jsx(Button, { href: ctaUrl, arrow: true, children: locales.onboardingScreen_ctaText })] }));
7743
7760
  };
7744
7761
 
7745
7762
  const AvatarContainer = styled(motion.div) `
@@ -9206,12 +9223,12 @@ function useProviders() {
9206
9223
  const { user } = useOpenfortCore();
9207
9224
  const { uiConfig: options, thirdPartyAuth, setOpen } = useOpenfort();
9208
9225
  const allProviders = (options === null || options === void 0 ? void 0 : options.authProviders) || [];
9209
- const providers = allProviders.filter(p => p !== AuthProvider.GUEST) || [];
9226
+ const providers = allProviders.filter(p => p !== UIAuthProvider.GUEST) || [];
9210
9227
  const linkedProviders = user ? providers.filter(p => { var _a; return (_a = user.linkedAccounts) === null || _a === void 0 ? void 0 : _a.find(a => a.provider === p); }) : [];
9211
9228
  const availableProviders = user ?
9212
9229
  providers.filter(provider => {
9213
9230
  var _a;
9214
- if (provider === AuthProvider.WALLET)
9231
+ if (provider === UIAuthProvider.WALLET)
9215
9232
  return true; // Wallet is always available
9216
9233
  return !((_a = user.linkedAccounts) === null || _a === void 0 ? void 0 : _a.find(a => a.provider === provider));
9217
9234
  })
@@ -9312,7 +9329,7 @@ const ProviderIcon = ({ provider }) => {
9312
9329
  case "facebook":
9313
9330
  return providersLogos[provider.provider];
9314
9331
  default:
9315
- return jsx(FitText, { children: provider.provider.substring(0, 1).toUpperCase() });
9332
+ return jsx(FitText, { children: provider.provider.substring(0, 4).toUpperCase() });
9316
9333
  }
9317
9334
  };
9318
9335
  const LinkedProvider = ({ provider }) => {
@@ -9394,15 +9411,15 @@ const Content = styled(motion.div) `
9394
9411
  gap: 12px;
9395
9412
  }
9396
9413
  `;
9397
- const dist = 2;
9398
- const shakeKeyframes = keyframes `
9414
+ const dist$1 = 2;
9415
+ const shakeKeyframes$1 = keyframes `
9399
9416
  0%{ transform:none; }
9400
- 25%{ transform:translateX(${dist}px); }
9401
- 50%{ transform:translateX(-${dist}px); }
9402
- 75%{ transform:translateX(${dist}px); }
9417
+ 25%{ transform:translateX(${dist$1}px); }
9418
+ 50%{ transform:translateX(-${dist$1}px); }
9419
+ 75%{ transform:translateX(${dist$1}px); }
9403
9420
  100%{ transform:none; }
9404
9421
  `;
9405
- const outlineKeyframes = keyframes `
9422
+ const outlineKeyframes$1 = keyframes `
9406
9423
  0%{ opacity:1; }
9407
9424
  100%{ opacity:0; }
9408
9425
  `;
@@ -9441,9 +9458,9 @@ const ConnectingAnimation$1 = styled(motion.div) `
9441
9458
  }
9442
9459
  ${(props) => props.$shake &&
9443
9460
  css `
9444
- animation: ${shakeKeyframes} 220ms ease-out both;
9461
+ animation: ${shakeKeyframes$1} 220ms ease-out both;
9445
9462
  &:before {
9446
- animation: ${outlineKeyframes} 220ms ease-out 750ms both;
9463
+ animation: ${outlineKeyframes$1} 220ms ease-out 750ms both;
9447
9464
  }
9448
9465
  `}
9449
9466
  `;
@@ -9451,8 +9468,8 @@ const RetryButton = styled(motion.button) `
9451
9468
  z-index: 5;
9452
9469
  appearance: none;
9453
9470
  position: absolute;
9454
- right: 2px;
9455
- bottom: 2px;
9471
+ right: 10px;
9472
+ bottom: 10px;
9456
9473
  padding: 0;
9457
9474
  display: flex;
9458
9475
  align-items: center;
@@ -9464,7 +9481,7 @@ const RetryButton = styled(motion.button) `
9464
9481
  overflow: hidden;
9465
9482
  background: none;
9466
9483
 
9467
- color: var(--ck-body-background);
9484
+ color: var(--ck-body-background-secondary);
9468
9485
  transition: color 200ms ease;
9469
9486
  box-shadow: 0px 2px 6px rgba(0, 0, 0, 0.15);
9470
9487
 
@@ -10153,6 +10170,7 @@ const TextWrapper = styled.div `
10153
10170
  flex-direction: column;
10154
10171
  gap: 12px;
10155
10172
  padding: 0 8px 32px;
10173
+ text-align: center;
10156
10174
  `;
10157
10175
  const ConnectingContainer = styled(motion.div) `
10158
10176
  display: flex;
@@ -10161,7 +10179,20 @@ justify-content: center;
10161
10179
  margin: 10px auto 16px;
10162
10180
  height: 120px;
10163
10181
  `;
10182
+ const dist = 2;
10183
+ const shakeKeyframes = keyframes `
10184
+ 0%{ transform:none; }
10185
+ 25%{ transform:translateX(${dist}px); }
10186
+ 50%{ transform:translateX(-${dist}px); }
10187
+ 75%{ transform:translateX(${dist}px); }
10188
+ 100%{ transform:none; }
10189
+ `;
10190
+ const outlineKeyframes = keyframes `
10191
+ 0%{ opacity:0; }
10192
+ 100%{ opacity:1; }
10193
+ `;
10164
10194
  const ConnectingAnimation = styled(motion.div) `
10195
+ position: relative;
10165
10196
  user-select: none;
10166
10197
  position: relative;
10167
10198
  --spinner-error-opacity: 0;
@@ -10170,18 +10201,26 @@ const ConnectingAnimation = styled(motion.div) `
10170
10201
  position: absolute;
10171
10202
  inset: 1px;
10172
10203
  opacity: 0;
10173
- background: var(--ck-body-color-valid);
10204
+ background: ${(props) => props.$color};
10174
10205
  }
10175
- ${(props) => props.$success &&
10206
+ ${(props) => !!props.$color &&
10176
10207
  css `
10177
10208
  &:before {
10178
10209
  opacity: 1;
10179
10210
  }
10180
10211
  `}
10212
+ ${(props) => props.$shake &&
10213
+ css `
10214
+ animation: ${shakeKeyframes} 220ms ease-out both;
10215
+ &:before {
10216
+ animation: ${outlineKeyframes} 220ms ease-out both;
10217
+ }
10218
+ `}
10181
10219
  `;
10182
- const Loader = ({ reason, isLoading = true, icon }) => {
10220
+ const Loader = ({ header, description, icon, isError = false, isSuccess = false, isLoading = !isError && !isSuccess, onRetry, }) => {
10183
10221
  const { uiConfig: options } = useOpenfort();
10184
10222
  const { triggerResize } = useOpenfort();
10223
+ const locales = useLocales();
10185
10224
  useEffect(() => {
10186
10225
  return () => triggerResize();
10187
10226
  }, []);
@@ -10197,11 +10236,11 @@ const Loader = ({ reason, isLoading = true, icon }) => {
10197
10236
  }
10198
10237
  return jsx(Logos.Openfort, {});
10199
10238
  };
10200
- return (jsxs(Fragment, { children: [jsx(ConnectingContainer, { children: jsx(ConnectingAnimation, { "$success": !isLoading, children: jsx(SquircleSpinner, { logo: jsx("div", { style: {
10201
- padding: '12px',
10202
- position: 'relative',
10203
- width: '100%',
10204
- }, children: renderLogo() }), connecting: isLoading }) }) }), jsx(TextWrapper, { children: isLoading ? (jsxs(Fragment, { children: [jsx(ModalH1, { children: "Loading, please wait" }), jsx(ModalBody, { children: reason })] })) : (jsxs(ModalH1, { "$valid": true, children: [jsx(TickIcon, {}), " ", reason] })) })] }));
10239
+ return (jsxs(Fragment, { children: [jsx(ConnectingContainer, { children: jsxs(ConnectingAnimation, { "$color": isSuccess ? 'var(--ck-body-color-valid)' : isError ? 'var(--ck-body-color-danger)' : undefined, "$shake": isError, children: [jsx(AnimatePresence, { children: (isError && onRetry) && (jsx(RetryButton, { "aria-label": "Retry", initial: { opacity: 0, scale: 0.8 }, animate: { opacity: 1, scale: 1 }, exit: { opacity: 0, scale: 0.8 }, whileTap: { scale: 0.9 }, transition: { duration: 0.1 }, onClick: onRetry, children: jsx(RetryIconContainer, { children: jsx(Tooltip, { open: isError, message: locales.tryAgainQuestion, xOffset: -6, children: jsx(RetryIconCircle, {}) }) }) })) }), jsx(SquircleSpinner, { logo: jsx("div", { style: {
10240
+ padding: '12px',
10241
+ position: 'relative',
10242
+ width: '100%',
10243
+ }, children: renderLogo() }), connecting: isLoading })] }) }), jsxs(TextWrapper, { children: [isLoading && (jsxs(Fragment, { children: [jsx(ModalH1, { children: "Loading, please wait" }), jsx(ModalBody, { children: description !== null && description !== void 0 ? description : header })] })), isSuccess && (jsxs(Fragment, { children: [jsxs(ModalH1, { "$valid": true, children: [jsx(TickIcon, {}), " ", header] }), jsx(ModalBody, { children: description })] })), isError && (jsxs(Fragment, { children: [jsx(ModalH1, { "$error": true, children: header }), jsx(ModalBody, { children: description })] }))] })] }));
10205
10244
  };
10206
10245
 
10207
10246
  const states$1 = {
@@ -10299,7 +10338,7 @@ const ConnectWithOAuth = ({}) => {
10299
10338
  }
10300
10339
  })();
10301
10340
  }, [status]);
10302
- return (jsx(PageContent, { children: jsx(Loader, { reason: `Connecting with ${connector.id}`, icon: providersLogos[connector.id] }) }));
10341
+ return (jsx(PageContent, { children: jsx(Loader, { header: `Connecting with ${connector.id}`, icon: providersLogos[connector.id] }) }));
10303
10342
  };
10304
10343
 
10305
10344
  const states = {
@@ -10561,6 +10600,13 @@ const EmailSignup = () => {
10561
10600
  }, children: [jsx(Input, { style: { marginTop: 0 }, value: email, onChange: (e) => setEmail(e.target.value), type: "email", placeholder: "Enter your email", disabled: signupLoading, autoComplete: "off" }), jsx(Input, { value: password, onChange: (e) => setPassword(e.target.value), type: "password", placeholder: "Enter your password", disabled: signupLoading, autoComplete: "new-password" }), signupError && (jsx(ModalBody, { style: { height: 24, marginTop: 12 }, "$error": true, children: jsx(FitText, { children: "Invalid email or password" }) })), jsx(Button, { onClick: handleSubmit, disabled: signupLoading, children: "Sign up" })] }), jsx("div", { style: { marginTop: 16 }, children: jsx(OrDivider, {}) }), jsx(Button, { onClick: () => { setRoute(routes.EMAIL_LOGIN); }, children: "Log in" })] }));
10562
10601
  };
10563
10602
 
10603
+ const LogoGraphic = ({ size = "100%", logo }) => {
10604
+ return (jsx(Logo$2, { children: jsx(LogoPosition, { children: jsx(LogoInner, { children: jsx(FloatWrapper, { children: jsx(RotateWrapper, { children: jsx(LogoGraphic$1, { style: { transform: `scale(${size})` }, children: logo }) }) }) }) }) }));
10605
+ };
10606
+ const FloatingGraphic = ({ height = "130px", logoCenter, logoTopRight, logoTopLeft, logoBottomRight, logoBottomLeft }) => {
10607
+ return (jsxs(Graphic, { "$height": height, children: [jsxs(LogoGroup, { children: [jsx(LogoGraphic, { ...logoCenter }), logoTopLeft ? jsx(LogoGraphic, { ...logoTopLeft }) : jsx("div", {}), logoTopRight ? jsx(LogoGraphic, { ...logoTopRight }) : jsx("div", {}), logoBottomLeft ? jsx(LogoGraphic, { ...logoBottomLeft }) : jsx("div", {}), logoBottomRight ? jsx(LogoGraphic, { ...logoBottomRight }) : jsx("div", {})] }), jsx(GraphicBackground, { children: wave })] }));
10608
+ };
10609
+
10564
10610
  const EmailVerification = () => {
10565
10611
  const { client } = useOpenfortCore();
10566
10612
  const { setRoute, log } = useOpenfort();
@@ -10643,10 +10689,19 @@ const EmailVerification = () => {
10643
10689
  })();
10644
10690
  }, []);
10645
10691
  if (loading) {
10646
- return (jsx(PageContent, { children: jsx(Loader, { reason: "Checking if account is verified" }) }));
10647
- }
10648
- return ( // TODO: Improve this page
10649
- jsxs(PageContent, { children: [jsxs(Graphic, { children: [jsxs(LogoGroup, { children: [jsx(Logo$2, { children: jsx(LogoPosition, { children: jsx(LogoInner, { children: jsx(FloatWrapper, { children: jsx(RotateWrapper, { children: jsx(LogoGraphic, { children: jsx(EmailIcon, {}) }) }) }) }) }) }), jsx(Logo$2, { children: jsx(LogoPosition, { children: jsx(LogoInner, { children: jsx(FloatWrapper, { children: jsx(RotateWrapper, { children: jsx(LogoGraphic, { children: jsx(EmailIcon, {}) }) }) }) }) }) }), jsx(Logo$2, { children: jsx(LogoPosition, { children: jsx(LogoInner, { children: jsx(FloatWrapper, { children: jsx(RotateWrapper, { children: jsx(LogoGraphic, { children: jsx(EmailIcon, {}) }) }) }) }) }) }), jsx(Logo$2, { children: jsx(LogoPosition, { children: jsx(LogoInner, { children: jsx(FloatWrapper, { children: jsx(RotateWrapper, { children: jsx(LogoGraphic, { children: jsx(EmailIcon, {}) }) }) }) }) }) }), jsx(Logo$2, { children: jsx(LogoPosition, { children: jsx(LogoInner, { children: jsx(FloatWrapper, { children: jsx(RotateWrapper, { children: jsx(LogoGraphic, { children: jsx(EmailIcon, {}) }) }) }) }) }) })] }), jsx(GraphicBackground, { children: wave })] }), jsx(ModalContent, { children: verificationResponse ? (jsxs(Fragment, { children: [jsx(ModalH1, { "$small": true, children: verificationResponse.success ? "Email verified" : "Email verification failed" }), jsxs(ModalBody, { children: [verificationResponse.error ? (verificationResponse.error) : ("Your email has been verified."), jsx(Button, { onClick: () => {
10692
+ return (jsx(PageContent, { children: jsx(Loader, { header: "Checking if account is verified" }) }));
10693
+ }
10694
+ return (jsxs(PageContent, { children: [jsx(FloatingGraphic, { height: "190px", logoCenter: {
10695
+ logo: jsx(EmailIcon, {}),
10696
+ }, logoTopLeft: {
10697
+ logo: jsx(EmailIcon, {}),
10698
+ }, logoBottomRight: {
10699
+ logo: jsx(EmailIcon, {}),
10700
+ }, logoTopRight: {
10701
+ logo: jsx(EmailIcon, {}),
10702
+ }, logoBottomLeft: {
10703
+ logo: jsx(EmailIcon, {}),
10704
+ } }), jsx(ModalContent, { children: verificationResponse ? (jsxs(Fragment, { children: [jsx(ModalH1, { "$small": true, children: verificationResponse.success ? "Email verified" : "Email verification failed" }), jsxs(ModalBody, { children: [verificationResponse.error ? (verificationResponse.error) : ("Your email has been verified."), jsx(Button, { onClick: () => {
10650
10705
  setRoute(routes.EMAIL_LOGIN);
10651
10706
  }, style: { marginTop: 12 }, children: "Continue" })] })] })) : (jsxs(Fragment, { children: [jsx(ModalH1, { "$small": true, children: "Email sent" }), jsxs(ModalBody, { style: { height: 40 }, children: ["Please check your email.", jsx("br", {}), emailInStorage] }), jsx(TextLinkButton, { style: { textDecoration: 'underline' }, onClick: () => { setRoute(routes.EMAIL_LOGIN); }, children: "Use another email" })] })) })] }));
10652
10707
  };
@@ -10862,7 +10917,7 @@ const Loading = () => {
10862
10917
  // UX: Wait a bit before showing the next page
10863
10918
  setTimeout(() => setIsFirstFrame(false), 400);
10864
10919
  }, []);
10865
- return (jsx(PageContent, { children: jsx(Loader, { reason: "Redirecting" }) }));
10920
+ return (jsx(PageContent, { children: jsx(Loader, { header: "Redirecting" }) }));
10866
10921
  };
10867
10922
 
10868
10923
  const ProviderButton = ({ children, icon, onClick }) => {
@@ -10896,17 +10951,17 @@ const AuthProviderButton = ({ provider, title = provider + " login", icon }) =>
10896
10951
  };
10897
10952
  const ProviderButtonSwitch = ({ provider }) => {
10898
10953
  switch (provider) {
10899
- case AuthProvider.GUEST:
10954
+ case UIAuthProvider.GUEST:
10900
10955
  return jsx(GuestButton, {});
10901
- case AuthProvider.WALLET:
10956
+ case UIAuthProvider.WALLET:
10902
10957
  return jsx(WalletButton, {});
10903
- case AuthProvider.EMAIL:
10958
+ case UIAuthProvider.EMAIL:
10904
10959
  return jsx(EmailButton, {});
10905
- case AuthProvider.GOOGLE:
10960
+ case UIAuthProvider.GOOGLE:
10906
10961
  return (jsx(AuthProviderButton, { provider: OAuthProvider.GOOGLE, title: "Google", icon: providersLogos[provider] }));
10907
- case AuthProvider.TWITTER:
10962
+ case UIAuthProvider.TWITTER:
10908
10963
  return (jsx(AuthProviderButton, { provider: OAuthProvider.TWITTER, title: "X", icon: providersLogos[provider] }));
10909
- case AuthProvider.FACEBOOK:
10964
+ case UIAuthProvider.FACEBOOK:
10910
10965
  return (jsx(AuthProviderButton, { provider: OAuthProvider.FACEBOOK, title: "Facebook", icon: providersLogos[provider] }));
10911
10966
  default:
10912
10967
  throw new Error(`NOT IMPLEMENTED: ${provider}`);
@@ -10926,7 +10981,7 @@ const AddressButNoUserCase = () => {
10926
10981
  console.error("Failed to update user");
10927
10982
  });
10928
10983
  }, []);
10929
- return (jsx(PageContent, { children: jsx(Loader, { reason: "Updating user" }) }));
10984
+ return (jsx(PageContent, { children: jsx(Loader, { header: "Updating user" }) }));
10930
10985
  };
10931
10986
  const SocialProvidersButton = () => {
10932
10987
  const { setRoute } = useOpenfort();
@@ -11015,14 +11070,23 @@ function useUser() {
11015
11070
  };
11016
11071
  }
11017
11072
 
11018
- const parseOpenfortWallet = ({ address, recoveryMethod, }) => ({
11019
- connectorType: "embedded",
11020
- walletClientType: "openfort",
11021
- address,
11022
- id: embeddedWalletId,
11023
- isAvailable: true,
11024
- recoveryMethod,
11025
- });
11073
+ const parseEmbeddedAccount = (embeddedAccount) => {
11074
+ var _a;
11075
+ return ({
11076
+ connectorType: "embedded",
11077
+ walletClientType: "openfort",
11078
+ address: embeddedAccount.address,
11079
+ id: embeddedWalletId,
11080
+ isAvailable: true,
11081
+ recoveryMethod: (_a = embeddedAccount.recoveryMethod) !== null && _a !== void 0 ? _a : RecoveryMethod.AUTOMATIC,
11082
+ accountId: embeddedAccount.id,
11083
+ accountType: embeddedAccount.accountType,
11084
+ ownerAddress: embeddedAccount.ownerAddress,
11085
+ implementationType: embeddedAccount.implementationType,
11086
+ salt: embeddedAccount.salt,
11087
+ createdAt: embeddedAccount.createdAt,
11088
+ });
11089
+ };
11026
11090
  const mapWalletStatus = (status) => {
11027
11091
  return {
11028
11092
  error: status.error,
@@ -11033,7 +11097,7 @@ const mapWalletStatus = (status) => {
11033
11097
  };
11034
11098
  };
11035
11099
  function useWallets(hookOptions = {}) {
11036
- const { client } = useOpenfortCore();
11100
+ const { client, embeddedAccounts, isLoadingAccounts: isLoadingWallets } = useOpenfortCore();
11037
11101
  const { user } = useUser();
11038
11102
  const { walletConfig, log, setOpen, setRoute, setConnector, uiConfig } = useOpenfort();
11039
11103
  const { connector, isConnected, address } = useAccount();
@@ -11075,13 +11139,6 @@ function useWallets(hookOptions = {}) {
11075
11139
  }
11076
11140
  }
11077
11141
  });
11078
- // will reset on logout
11079
- const { data: embeddedWallets, refetch, isPending: isLoadingWallets } = useQuery({
11080
- queryKey: ['openfortEmbeddedWalletList'],
11081
- queryFn: () => client.embeddedWallet.list(),
11082
- refetchOnMount: false,
11083
- refetchOnWindowFocus: false,
11084
- });
11085
11142
  const getEncryptionSession = useCallback(async () => {
11086
11143
  if (!walletConfig || !walletConfig.createEncryptedSessionEndpoint) {
11087
11144
  throw new Error("No createEncryptedSessionEndpoint set in walletConfig");
@@ -11098,9 +11155,61 @@ function useWallets(hookOptions = {}) {
11098
11155
  const respJSON = await resp.json();
11099
11156
  return respJSON.session;
11100
11157
  }, [walletConfig]);
11158
+ const parseWalletRecovery = useMemo(() => async function parseWalletRecovery(recovery, embeddedAccounts, walletAddress) {
11159
+ var _a, _b;
11160
+ switch (recovery === null || recovery === void 0 ? void 0 : recovery.recoveryMethod) {
11161
+ case undefined:
11162
+ case RecoveryMethod.AUTOMATIC:
11163
+ const accessToken = await client.getAccessToken();
11164
+ if (!accessToken) {
11165
+ throw new OpenfortError("Openfort access token not found", OpenfortErrorType.AUTHENTICATION_ERROR);
11166
+ }
11167
+ return {
11168
+ recoveryMethod: RecoveryMethod.AUTOMATIC,
11169
+ encryptionSession: (walletConfig === null || walletConfig === void 0 ? void 0 : walletConfig.getEncryptionSession) ?
11170
+ await walletConfig.getEncryptionSession(accessToken) :
11171
+ await getEncryptionSession()
11172
+ };
11173
+ case RecoveryMethod.PASSWORD:
11174
+ if (!recovery.password) {
11175
+ throw new OpenfortError("Please enter your password", OpenfortErrorType.VALIDATION_ERROR);
11176
+ }
11177
+ return {
11178
+ recoveryMethod: RecoveryMethod.PASSWORD,
11179
+ password: recovery.password,
11180
+ };
11181
+ case RecoveryMethod.PASSKEY:
11182
+ if (!embeddedAccounts) {
11183
+ return {
11184
+ recoveryMethod: RecoveryMethod.PASSKEY,
11185
+ };
11186
+ }
11187
+ if (!walletAddress) {
11188
+ walletAddress = (_a = embeddedAccounts.find(w => w.recoveryMethod === RecoveryMethod.PASSKEY)) === null || _a === void 0 ? void 0 : _a.address;
11189
+ if (!walletAddress) {
11190
+ throw new OpenfortError("No wallet address provided and no embedded wallet with passkey recovery found", OpenfortErrorType.VALIDATION_ERROR);
11191
+ }
11192
+ }
11193
+ const details = (_b = embeddedAccounts.find(w => w.address === walletAddress && w.recoveryMethod === RecoveryMethod.PASSKEY)) === null || _b === void 0 ? void 0 : _b.recoveryMethodDetails;
11194
+ const passkeyId = details === null || details === void 0 ? void 0 : details.passkeyId;
11195
+ const passkeyEnv = details === null || details === void 0 ? void 0 : details.passkeyEnv;
11196
+ if (!passkeyId || !passkeyEnv) {
11197
+ throw new OpenfortError("No passkey details found for the wallet", OpenfortErrorType.VALIDATION_ERROR);
11198
+ }
11199
+ return {
11200
+ recoveryMethod: RecoveryMethod.PASSKEY,
11201
+ passkeyInfo: {
11202
+ passkeyId,
11203
+ passkeyEnv,
11204
+ },
11205
+ };
11206
+ default:
11207
+ throw new OpenfortError("Invalid recovery method", OpenfortErrorType.VALIDATION_ERROR);
11208
+ }
11209
+ }, [walletConfig, getEncryptionSession]);
11101
11210
  const rawWallets = useMemo(() => {
11102
11211
  const userWallets = user ? user.linkedAccounts
11103
- .filter((a) => a.provider === AuthProvider.WALLET)
11212
+ .filter((a) => a.provider === UIAuthProvider.WALLET)
11104
11213
  .map((a) => {
11105
11214
  const wallet = deviceWallets.find((c) => c.connector.id === a.walletClientType);
11106
11215
  return {
@@ -11111,38 +11220,34 @@ function useWallets(hookOptions = {}) {
11111
11220
  isAvailable: !!wallet,
11112
11221
  };
11113
11222
  }) : [];
11114
- embeddedWallets === null || embeddedWallets === void 0 ? void 0 : embeddedWallets.forEach((wallet) => {
11223
+ embeddedAccounts === null || embeddedAccounts === void 0 ? void 0 : embeddedAccounts.forEach((embeddedAccount) => {
11115
11224
  // Remove duplicates (different chain ids)
11116
- if (userWallets.find(w => w.address === (wallet.address)))
11225
+ if (userWallets.find(w => w.address === (embeddedAccount.address)))
11117
11226
  return;
11118
- userWallets.push(parseOpenfortWallet({
11119
- address: wallet.address,
11120
- recoveryMethod: wallet.recoveryMethod,
11121
- }));
11227
+ userWallets.push(parseEmbeddedAccount(embeddedAccount));
11122
11228
  });
11123
11229
  return userWallets;
11124
- }, [user === null || user === void 0 ? void 0 : user.linkedAccounts, embeddedWallets]);
11230
+ }, [user === null || user === void 0 ? void 0 : user.linkedAccounts, embeddedAccounts]);
11125
11231
  const wallets = useMemo(() => {
11126
- // if (!isConnected || !address) return rawWallets;
11127
- log("Mapping wallets", { rawWallets, status, address, isConnected, connector });
11232
+ // log("Mapping wallets", { rawWallets, status, address, isConnected, connector: connector?.id });
11128
11233
  return rawWallets.map((w) => ({
11129
11234
  ...w,
11130
11235
  isConnecting: status.status === 'connecting' && status.address === w.address,
11131
11236
  isActive: w.address === address && isConnected && (connector === null || connector === void 0 ? void 0 : connector.id) === w.id,
11132
11237
  }));
11133
- }, [rawWallets, status, address, isConnected, connector]);
11238
+ }, [rawWallets.length, status.status, address, isConnected, connector === null || connector === void 0 ? void 0 : connector.id]);
11134
11239
  const activeWallet = isConnected && connector ? wallets.find((w) => w.isActive) : undefined;
11135
11240
  useEffect(() => {
11136
11241
  if (connectToConnector)
11137
11242
  connect({ connector: connectToConnector.connector });
11138
11243
  }, [connectToConnector]);
11139
11244
  const setActiveWallet = useCallback(async (options) => {
11140
- var _a;
11141
- const optionsObject = typeof options === "string" ? { connector: options } : options;
11245
+ var _a, _b, _c, _d, _e;
11246
+ const optionsObject = typeof options === "string" ? { walletId: options } : options;
11142
11247
  const { showUI } = optionsObject;
11143
11248
  let connector = null;
11144
- if (typeof optionsObject.connector === 'string') {
11145
- const wallet = deviceWallets.find(c => c.id === optionsObject.connector);
11249
+ if (typeof optionsObject.walletId === 'string') {
11250
+ const wallet = deviceWallets.find(c => c.id === optionsObject.walletId);
11146
11251
  if (!wallet) {
11147
11252
  log("Connector not found", connector);
11148
11253
  return { error: new OpenfortError("Connector not found", OpenfortErrorType.WALLET_ERROR) };
@@ -11151,10 +11256,10 @@ function useWallets(hookOptions = {}) {
11151
11256
  connector = wallet.connector;
11152
11257
  }
11153
11258
  else {
11154
- connector = optionsObject.connector;
11259
+ connector = optionsObject.walletId;
11155
11260
  }
11156
11261
  if (!connector) {
11157
- log("Connector not found", deviceWallets, optionsObject.connector);
11262
+ log("Connector not found", deviceWallets, optionsObject.walletId);
11158
11263
  return { error: new OpenfortError("Connector not found", OpenfortErrorType.WALLET_ERROR) };
11159
11264
  }
11160
11265
  if ((activeWallet === null || activeWallet === void 0 ? void 0 : activeWallet.id) === connector.id && address === optionsObject.address) {
@@ -11187,7 +11292,7 @@ function useWallets(hookOptions = {}) {
11187
11292
  return {};
11188
11293
  }
11189
11294
  function isOpenfortWallet(opts) {
11190
- return opts.connector === embeddedWalletId;
11295
+ return opts.walletId === embeddedWalletId;
11191
11296
  }
11192
11297
  log("Setting active wallet", { options: optionsObject, chainId });
11193
11298
  if (isOpenfortWallet(optionsObject)) {
@@ -11195,7 +11300,6 @@ function useWallets(hookOptions = {}) {
11195
11300
  status: 'connecting',
11196
11301
  address: optionsObject.address,
11197
11302
  });
11198
- const { password } = optionsObject;
11199
11303
  if (!walletConfig) {
11200
11304
  return onError({
11201
11305
  error: new OpenfortError("Embedded signer not enabled", OpenfortErrorType.WALLET_ERROR),
@@ -11203,48 +11307,64 @@ function useWallets(hookOptions = {}) {
11203
11307
  hookOptions
11204
11308
  });
11205
11309
  }
11206
- log(`Handling recovery with Openfort: ${password ? "with password" : "without password"}, chainId=${chainId}`);
11207
11310
  try {
11208
- const recoveryParams = password ? {
11209
- recoveryMethod: RecoveryMethod.PASSWORD,
11210
- password,
11211
- } : {
11212
- recoveryMethod: RecoveryMethod.AUTOMATIC,
11213
- encryptionSession: walletConfig.getEncryptionSession ?
11214
- await walletConfig.getEncryptionSession() :
11215
- await getEncryptionSession()
11216
- };
11217
- // Ensure that the embedded wallet is listed
11218
- const embeddedWallets = await client.embeddedWallet.list();
11219
- log("Recovery params", optionsObject.address);
11220
- log("Embedded wallets", embeddedWallets, chainId);
11311
+ const embeddedAccounts = await queryClient.ensureQueryData({
11312
+ queryKey: ['openfortEmbeddedAccountsList'],
11313
+ queryFn: () => client.embeddedWallet.list()
11314
+ });
11221
11315
  let walletAddress = optionsObject.address;
11316
+ // Ensure that the embedded wallet is listed
11317
+ log("Embedded wallets", embeddedAccounts, chainId);
11318
+ let embeddedAccount;
11222
11319
  if (walletAddress) {
11223
- const walletId = (_a = embeddedWallets === null || embeddedWallets === void 0 ? void 0 : embeddedWallets.find((w) => w.address === walletAddress && w.chainId === chainId)) === null || _a === void 0 ? void 0 : _a.id;
11224
- if (!walletId) {
11320
+ const accountToRecover = embeddedAccounts.find(w => w.address === walletAddress && w.chainId === chainId);
11321
+ if (!accountToRecover) {
11322
+ // TODO: Connect to wallet in the other chain and then switch chain
11323
+ return onError({
11324
+ error: new OpenfortError(`Embedded wallet not found for address ${walletAddress} and chainId ${chainId}`, OpenfortErrorType.WALLET_ERROR),
11325
+ options: optionsObject,
11326
+ hookOptions
11327
+ });
11328
+ }
11329
+ log("Found embedded wallet to recover", accountToRecover);
11330
+ if (((_a = optionsObject.recovery) === null || _a === void 0 ? void 0 : _a.recoveryMethod) && accountToRecover.recoveryMethod && optionsObject.recovery.recoveryMethod !== accountToRecover.recoveryMethod) {
11331
+ log("Recovery method does not match", optionsObject.recovery.recoveryMethod, accountToRecover.recoveryMethod);
11225
11332
  return onError({
11226
- error: new OpenfortError("Embedded wallet not found for address", OpenfortErrorType.WALLET_ERROR),
11333
+ error: new OpenfortError("The recovery phrase you entered is incorrect and does not match the wallet's recovery method", OpenfortErrorType.WALLET_ERROR),
11227
11334
  options: optionsObject,
11228
11335
  hookOptions
11229
11336
  });
11230
11337
  }
11231
- await client.embeddedWallet.recover({
11232
- account: walletId,
11338
+ const recovery = {
11339
+ recoveryMethod: (_b = accountToRecover.recoveryMethod) !== null && _b !== void 0 ? _b : RecoveryMethod.AUTOMATIC,
11340
+ password: (_c = optionsObject.recovery) === null || _c === void 0 ? void 0 : _c.password,
11341
+ };
11342
+ const recoveryParams = await parseWalletRecovery(recovery, embeddedAccounts, walletAddress);
11343
+ embeddedAccount = await client.embeddedWallet.recover({
11344
+ account: accountToRecover.id,
11233
11345
  recoveryParams,
11234
11346
  });
11235
11347
  }
11236
11348
  else {
11237
11349
  // Check if the embedded wallet is already created in the current chain
11238
- if (embeddedWallets.some((w) => w.chainId === chainId)) {
11239
- const walletToRecover = embeddedWallets.find((w) => w.chainId === chainId);
11240
- await client.embeddedWallet.recover({
11241
- account: walletToRecover.id,
11350
+ if (embeddedAccounts.some((w) => w.chainId === chainId)) {
11351
+ const accountToRecover = embeddedAccounts.find((w) => w.chainId === chainId);
11352
+ log("Found embedded wallet to recover (without walletAddress)", accountToRecover);
11353
+ const recovery = {
11354
+ recoveryMethod: (_d = accountToRecover.recoveryMethod) !== null && _d !== void 0 ? _d : RecoveryMethod.AUTOMATIC,
11355
+ password: (_e = optionsObject.recovery) === null || _e === void 0 ? void 0 : _e.password,
11356
+ };
11357
+ const recoveryParams = await parseWalletRecovery(recovery, embeddedAccounts, walletAddress);
11358
+ embeddedAccount = await client.embeddedWallet.recover({
11359
+ account: accountToRecover.id,
11242
11360
  recoveryParams,
11243
11361
  });
11244
- walletAddress = walletToRecover.address;
11362
+ walletAddress = accountToRecover.address;
11245
11363
  }
11246
11364
  else {
11365
+ log("No embedded wallet found for the current chain");
11247
11366
  // Here it should check if there is a wallet that can recover in another chain and recover it in the current chain (its a different account so its not supported yet)
11367
+ // TODO: Connect to wallet in the other chain and then switch chain
11248
11368
  return onError({
11249
11369
  error: new OpenfortError("No embedded wallet found for the current chain", OpenfortErrorType.WALLET_ERROR),
11250
11370
  options: optionsObject,
@@ -11252,47 +11372,42 @@ function useWallets(hookOptions = {}) {
11252
11372
  });
11253
11373
  }
11254
11374
  }
11375
+ if (!embeddedAccount) {
11376
+ return onError({
11377
+ error: new OpenfortError("Failed to recover embedded wallet", OpenfortErrorType.WALLET_ERROR),
11378
+ options: optionsObject,
11379
+ hookOptions
11380
+ });
11381
+ }
11255
11382
  setStatus({
11256
11383
  status: 'success',
11257
11384
  });
11258
11385
  return onSuccess({
11259
11386
  data: {
11260
- wallet: parseOpenfortWallet({
11261
- address: walletAddress,
11262
- recoveryMethod: recoveryParams.recoveryMethod,
11263
- }),
11387
+ wallet: parseEmbeddedAccount(embeddedAccount),
11264
11388
  },
11265
11389
  options: optionsObject,
11266
11390
  hookOptions,
11267
11391
  });
11268
11392
  }
11269
11393
  catch (err) {
11270
- log('Error handling recovery with Openfort:', err);
11394
+ let error;
11271
11395
  if (err instanceof MissingRecoveryPasswordError) {
11272
- const error = new OpenfortError("Missing recovery password", OpenfortErrorType.WALLET_ERROR);
11273
- setStatus({
11274
- status: 'error',
11275
- error,
11276
- });
11277
- return onError({
11278
- error,
11279
- options: optionsObject,
11280
- hookOptions
11281
- });
11396
+ error = new OpenfortError("Missing recovery password", OpenfortErrorType.WALLET_ERROR);
11282
11397
  }
11283
- if (typeof err === 'string') {
11284
- const error = new OpenfortError(err, OpenfortErrorType.WALLET_ERROR);
11285
- setStatus({
11286
- status: 'error',
11287
- error,
11288
- });
11289
- return onError({
11290
- error,
11291
- options: optionsObject,
11292
- hookOptions
11293
- });
11398
+ else if (err instanceof OpenfortError) {
11399
+ error = err;
11400
+ }
11401
+ else if (typeof err === 'string') {
11402
+ error = new OpenfortError(err, OpenfortErrorType.WALLET_ERROR);
11403
+ }
11404
+ else {
11405
+ error = new OpenfortError("Failed to recover embedded wallet", OpenfortErrorType.WALLET_ERROR, { error: err });
11406
+ if (error.message === "Wrong recovery password for this embedded signer") {
11407
+ error.message = "Wrong password, Please try again.";
11408
+ }
11294
11409
  }
11295
- const error = new OpenfortError("The recovery phrase you entered is incorrect.", OpenfortErrorType.WALLET_ERROR);
11410
+ log('Error handling recovery with Openfort:', error, err);
11296
11411
  setStatus({
11297
11412
  status: 'error',
11298
11413
  error,
@@ -11300,7 +11415,7 @@ function useWallets(hookOptions = {}) {
11300
11415
  return onError({
11301
11416
  error,
11302
11417
  options: optionsObject,
11303
- hookOptions
11418
+ hookOptions,
11304
11419
  });
11305
11420
  }
11306
11421
  }
@@ -11315,13 +11430,14 @@ function useWallets(hookOptions = {}) {
11315
11430
  });
11316
11431
  }
11317
11432
  return {};
11318
- }, [wallets, setOpen, setRoute, setConnector, disconnectAsync, log, address, client, walletConfig, chainId, refetch, hookOptions]);
11319
- const createWallet = useCallback(async ({ password, ...options } = {}) => {
11433
+ }, [wallets, setOpen, setRoute, setConnector, disconnectAsync, log, address, client, walletConfig, chainId, hookOptions]);
11434
+ const queryClient = useQueryClient();
11435
+ const createWallet = useCallback(async ({ recovery, ...options } = {}) => {
11320
11436
  var _a;
11321
11437
  setStatus({
11322
11438
  status: 'creating',
11323
11439
  });
11324
- log("Creating wallet", { password: !!password, options });
11440
+ log("Creating wallet", { recovery: (recovery === null || recovery === void 0 ? void 0 : recovery.recoveryMethod) || RecoveryMethod.AUTOMATIC, options });
11325
11441
  try {
11326
11442
  const accessToken = await client.getAccessToken();
11327
11443
  if (!accessToken) {
@@ -11338,16 +11454,8 @@ function useWallets(hookOptions = {}) {
11338
11454
  options,
11339
11455
  });
11340
11456
  }
11341
- const recoveryParams = password ? {
11342
- recoveryMethod: RecoveryMethod.PASSWORD,
11343
- password,
11344
- } : {
11345
- recoveryMethod: RecoveryMethod.AUTOMATIC,
11346
- encryptionSession: walletConfig.getEncryptionSession ?
11347
- await walletConfig.getEncryptionSession() :
11348
- await getEncryptionSession()
11349
- };
11350
- const wallet = await client.embeddedWallet.create({
11457
+ const recoveryParams = await parseWalletRecovery(recovery);
11458
+ const embeddedAccount = await client.embeddedWallet.create({
11351
11459
  chainId: (_a = uiConfig === null || uiConfig === void 0 ? void 0 : uiConfig.initialChainId) !== null && _a !== void 0 ? _a : chainId,
11352
11460
  accountType: (options === null || options === void 0 ? void 0 : options.accountType) || (walletConfig === null || walletConfig === void 0 ? void 0 : walletConfig.accountType) || AccountTypeEnum.SMART_ACCOUNT,
11353
11461
  chainType: ChainTypeEnum.EVM,
@@ -11356,13 +11464,10 @@ function useWallets(hookOptions = {}) {
11356
11464
  setStatus({
11357
11465
  status: 'success',
11358
11466
  });
11359
- refetch();
11467
+ queryClient.invalidateQueries({ queryKey: ['openfortEmbeddedAccountsList'] });
11360
11468
  return onSuccess({
11361
11469
  data: {
11362
- wallet: parseOpenfortWallet({
11363
- address: wallet.address,
11364
- recoveryMethod: wallet.recoveryMethod,
11365
- })
11470
+ wallet: parseEmbeddedAccount(embeddedAccount)
11366
11471
  }
11367
11472
  });
11368
11473
  }
@@ -11379,7 +11484,7 @@ function useWallets(hookOptions = {}) {
11379
11484
  options,
11380
11485
  });
11381
11486
  }
11382
- }, [refetch, client, uiConfig, chainId]);
11487
+ }, [client, uiConfig, chainId]);
11383
11488
  const setRecovery = useCallback(async (params) => {
11384
11489
  try {
11385
11490
  setStatus({
@@ -11394,10 +11499,7 @@ function useWallets(hookOptions = {}) {
11394
11499
  hookOptions,
11395
11500
  options: params,
11396
11501
  data: {
11397
- wallet: parseOpenfortWallet({
11398
- address: embeddedAccount.address,
11399
- recoveryMethod: embeddedAccount.recoveryMethod,
11400
- }),
11502
+ wallet: parseEmbeddedAccount(embeddedAccount),
11401
11503
  }
11402
11504
  });
11403
11505
  }
@@ -11425,6 +11527,35 @@ function useWallets(hookOptions = {}) {
11425
11527
  };
11426
11528
  }
11427
11529
 
11530
+ const TickListContainer = styled.ul `
11531
+ display: flex;
11532
+ flex-direction: column;
11533
+ gap: 8px;
11534
+ padding-top: 8px;
11535
+ padding-bottom: 8px;
11536
+ `;
11537
+ const TickItem = styled.li `
11538
+ display: flex;
11539
+ align-items: center;
11540
+ text-align: left;
11541
+ gap: 8px;
11542
+ font-size: 16px;
11543
+ line-height: 24px;
11544
+ `;
11545
+ const TickIconWrapper = styled.span `
11546
+ display: flex;
11547
+ align-items: center;
11548
+ justify-content: center;
11549
+ width: 16px;
11550
+ height: 16px;
11551
+ flex-shrink: 0;
11552
+ `;
11553
+
11554
+ const TickList = ({ items }) => {
11555
+ return (jsx(TickListContainer, { children: items.map((item, index) => (jsxs(TickItem, { children: [jsx(TickIconWrapper, { children: jsx(TickIcon, {}) }), jsx("span", { children: item })] }, index))) }));
11556
+ };
11557
+ TickList.displayName = 'TickList';
11558
+
11428
11559
  /**
11429
11560
  * Password Utilities Module
11430
11561
  * Provides functions for password strength calculation, passphrase generation,
@@ -11567,35 +11698,6 @@ const PasswordStrengthIndicator = ({ password, showPasswordIsTooWeakError }) =>
11567
11698
  }, transition: { duration: 0.3 }, style: { color: '#ef4444', fontSize: '0.875rem', fontWeight: 500, position: 'absolute', top: '0' }, children: "Password is too weak" })] })] }));
11568
11699
  };
11569
11700
 
11570
- const TickListContainer = styled.ul `
11571
- display: flex;
11572
- flex-direction: column;
11573
- gap: 8px;
11574
- padding-top: 8px;
11575
- padding-bottom: 8px;
11576
- `;
11577
- const TickItem = styled.li `
11578
- display: flex;
11579
- align-items: center;
11580
- text-align: left;
11581
- gap: 8px;
11582
- font-size: 16px;
11583
- line-height: 24px;
11584
- `;
11585
- const TickIconWrapper = styled.span `
11586
- display: flex;
11587
- align-items: center;
11588
- justify-content: center;
11589
- width: 16px;
11590
- height: 16px;
11591
- flex-shrink: 0;
11592
- `;
11593
-
11594
- const TickList = ({ items }) => {
11595
- return (jsx(TickListContainer, { children: items.map((item, index) => (jsxs(TickItem, { children: [jsx(TickIconWrapper, { children: jsx(TickIcon, {}) }), jsx("span", { children: item })] }, index))) }));
11596
- };
11597
- TickList.displayName = 'TickList';
11598
-
11599
11701
  const OtherMethodButton = styled.button `
11600
11702
  width: 100%;
11601
11703
  color: var(--ck-body-color-muted);
@@ -11618,8 +11720,11 @@ const RecoverPasswordWallet = ({ wallet }) => {
11618
11720
  const handleSubmit = async () => {
11619
11721
  setLoading(true);
11620
11722
  const { error } = await setActiveWallet({
11621
- connector: embeddedWalletId,
11622
- password: recoveryPhrase,
11723
+ walletId: embeddedWalletId,
11724
+ recovery: {
11725
+ recoveryMethod: RecoveryMethod.PASSWORD,
11726
+ password: recoveryPhrase,
11727
+ },
11623
11728
  address: wallet.address,
11624
11729
  });
11625
11730
  setLoading(false);
@@ -11640,12 +11745,55 @@ const RecoverPasswordWallet = ({ wallet }) => {
11640
11745
  address: wallet.address,
11641
11746
  config: ensFallbackConfig,
11642
11747
  });
11643
- const separator = '....';
11644
- return (jsxs(PageContent, { children: [jsxs(Graphic, { "$height": "130px", children: [jsxs(LogoGroup, { children: [jsx(Logo$2, { children: jsx(LogoPosition, { children: jsx(LogoInner, { children: jsx(FloatWrapper, { children: jsx(RotateWrapper, { children: jsx(LogoGraphic, { style: { transform: "scale(1.2)" }, children: jsx(KeyIcon, {}) }) }) }) }) }) }), jsx(Logo$2, { children: jsx(LogoPosition, { children: jsx(LogoInner, { children: jsx(FloatWrapper, { children: jsx(RotateWrapper, { children: jsx(LogoGraphic, { style: { transform: "scale(0.75)" }, children: jsx(ShieldIcon, {}) }) }) }) }) }) }), jsx(Logo$2, {}), jsx(Logo$2, {}), jsx(Logo$2, { children: jsx(LogoPosition, { children: jsx(LogoInner, { children: jsx(FloatWrapper, { children: jsx(RotateWrapper, { children: jsx(LogoGraphic, { style: { transform: "scale(0.5)" }, children: jsx(LockIcon, {}) }) }) }) }) }) })] }), jsx(GraphicBackground, { children: wave })] }), jsx(ModalHeading, { children: "Recover wallet" }), jsxs(ModalBody, { style: { textAlign: "center" }, children: ["Please enter the recovery password to recover wallet", " ", jsx(CopyToClipboard, { string: wallet.address, children: ensName !== null && ensName !== void 0 ? ensName : truncateEthAddress(wallet.address, separator) })] }), jsxs("form", { onSubmit: (e) => {
11748
+ return (jsxs(PageContent, { children: [jsx(FloatingGraphic, { height: "130px", logoCenter: {
11749
+ logo: jsx(KeyIcon, {}),
11750
+ size: "1.2",
11751
+ }, logoTopLeft: {
11752
+ logo: jsx(ShieldIcon, {}),
11753
+ size: "0.75",
11754
+ }, logoBottomRight: {
11755
+ logo: jsx(LockIcon, {}),
11756
+ size: "0.5",
11757
+ } }), jsx(ModalHeading, { children: "Recover wallet" }), jsxs(ModalBody, { style: { textAlign: "center" }, children: ["Please enter the recovery password to recover wallet", " ", jsx(CopyToClipboard, { string: wallet.address, children: ensName !== null && ensName !== void 0 ? ensName : truncateEthAddress(wallet.address) })] }), jsxs("form", { onSubmit: (e) => {
11645
11758
  e.preventDefault();
11646
11759
  handleSubmit();
11647
11760
  }, children: [jsx(Input, { value: recoveryPhrase, onChange: (e) => setRecoveryPhrase(e.target.value), type: "password", placeholder: "Enter your password", autoComplete: "off" }), recoveryError && (jsx(motion.div, { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, children: jsx(ModalBody, { style: { height: 24, marginTop: 12 }, "$error": true, children: jsx(FitText, { children: recoveryError }) }) }, recoveryError)), jsx(Button, { onClick: handleSubmit, waiting: loading, disabled: loading, children: "Recover wallet" })] })] }));
11648
11761
  };
11762
+ const RecoverPasskeyWallet = ({ wallet }) => {
11763
+ const { triggerResize, uiConfig: options, log } = useOpenfort();
11764
+ const { setActiveWallet, error: recoveryError, isConnecting: loading } = useWallets();
11765
+ const [shouldRecoverWallet, setShouldRecoverWallet] = useState(false);
11766
+ const recoverWallet = async () => {
11767
+ setActiveWallet({
11768
+ walletId: embeddedWalletId,
11769
+ recovery: {
11770
+ recoveryMethod: RecoveryMethod.PASSKEY,
11771
+ },
11772
+ address: wallet.address,
11773
+ });
11774
+ };
11775
+ useEffect(() => {
11776
+ // To ensure the wallet is created only once
11777
+ if (shouldRecoverWallet) {
11778
+ recoverWallet();
11779
+ }
11780
+ }, [shouldRecoverWallet]);
11781
+ useEffect(() => {
11782
+ setShouldRecoverWallet(true);
11783
+ }, []);
11784
+ useEffect(() => {
11785
+ if (recoveryError)
11786
+ triggerResize();
11787
+ }, [recoveryError]);
11788
+ const ensFallbackConfig = useEnsFallbackConfig();
11789
+ const { data: ensName } = useEnsName({
11790
+ chainId: 1,
11791
+ address: wallet.address,
11792
+ config: ensFallbackConfig,
11793
+ });
11794
+ const walletDisplay = ensName !== null && ensName !== void 0 ? ensName : truncateEthAddress(wallet.address);
11795
+ return (jsxs(PageContent, { children: [jsx(BackButton, { onClick: (() => setShouldRecoverWallet(false)) }), jsx(Loader, { icon: jsx(FingerPrintIcon, {}), isError: !!recoveryError, header: recoveryError ? "Invalid passkey." : `Recovering wallet ${walletDisplay} with passkey...`, description: recoveryError ? "There was an error creating your passkey. Please try again." : undefined, onRetry: () => recoverWallet() })] }));
11796
+ };
11649
11797
  const RecoverAutomaticWallet = ({ walletAddress }) => {
11650
11798
  const { embeddedState } = useOpenfortCore();
11651
11799
  const { setActiveWallet } = useWallets();
@@ -11656,7 +11804,7 @@ const RecoverAutomaticWallet = ({ walletAddress }) => {
11656
11804
  if (embeddedState === EmbeddedState.EMBEDDED_SIGNER_NOT_CONFIGURED) {
11657
11805
  log("Automatically recovering wallet", walletAddress);
11658
11806
  const response = await setActiveWallet({
11659
- connector: embeddedWalletId,
11807
+ walletId: embeddedWalletId,
11660
11808
  });
11661
11809
  if (response.error) {
11662
11810
  setError(response.error.message || "There was an error recovering your account");
@@ -11668,7 +11816,7 @@ const RecoverAutomaticWallet = ({ walletAddress }) => {
11668
11816
  if (error) {
11669
11817
  jsx(PageContent, { children: jsx(ModalBody, { style: { textAlign: "center" }, "$error": true, children: jsx(FitText, { children: error }) }) });
11670
11818
  }
11671
- return (jsx(PageContent, { children: jsx(Loader, { reason: `Recovering wallet...` }) }));
11819
+ return (jsx(PageContent, { children: jsx(Loader, { header: `Recovering wallet...` }) }));
11672
11820
  };
11673
11821
  const CreateWalletAutomaticRecovery = () => {
11674
11822
  const { embeddedState } = useOpenfortCore();
@@ -11692,7 +11840,7 @@ const CreateWalletAutomaticRecovery = () => {
11692
11840
  setShouldCreateWallet(true);
11693
11841
  }
11694
11842
  }, [embeddedState]);
11695
- return (jsx(PageContent, { children: jsx(Loader, { reason: "Creating wallet..." }) }));
11843
+ return (jsx(PageContent, { children: jsx(Loader, { header: "Creating wallet..." }) }));
11696
11844
  };
11697
11845
  const OtherMethod = ({ currentMethod, onChangeMethod }) => {
11698
11846
  const { uiConfig } = useOpenfort();
@@ -11713,6 +11861,9 @@ const OtherMethod = ({ currentMethod, onChangeMethod }) => {
11713
11861
  case RecoveryMethod.AUTOMATIC:
11714
11862
  text = "Skip for now";
11715
11863
  break;
11864
+ case RecoveryMethod.PASSKEY:
11865
+ text = "Use passkey recovery";
11866
+ break;
11716
11867
  default:
11717
11868
  text = method;
11718
11869
  }
@@ -11722,6 +11873,40 @@ const OtherMethod = ({ currentMethod, onChangeMethod }) => {
11722
11873
  }
11723
11874
  return (jsx(OtherMethodButton, { onClick: () => onChangeMethod("other"), children: "Choose another recovery method" }));
11724
11875
  };
11876
+ const CreateWalletPasskeyRecovery = ({ onChangeMethod }) => {
11877
+ const { triggerResize } = useOpenfort();
11878
+ const { createWallet, error: recoveryError } = useWallets();
11879
+ const [shouldCreateWallet, setShouldCreateWallet] = useState(false);
11880
+ const { log } = useOpenfort();
11881
+ const { embeddedState } = useOpenfortCore();
11882
+ useEffect(() => {
11883
+ // To ensure the wallet is created only once
11884
+ if (shouldCreateWallet) {
11885
+ (async () => {
11886
+ log("Creating wallet passkey recovery");
11887
+ const response = await createWallet({
11888
+ recovery: {
11889
+ recoveryMethod: RecoveryMethod.PASSKEY,
11890
+ }
11891
+ });
11892
+ if (response.error) {
11893
+ log("Error creating wallet", response.error);
11894
+ setShouldCreateWallet(false);
11895
+ }
11896
+ })();
11897
+ }
11898
+ }, [shouldCreateWallet]);
11899
+ useEffect(() => {
11900
+ if (embeddedState === EmbeddedState.EMBEDDED_SIGNER_NOT_CONFIGURED) {
11901
+ setShouldCreateWallet(true);
11902
+ }
11903
+ }, [embeddedState]);
11904
+ useEffect(() => {
11905
+ if (recoveryError)
11906
+ triggerResize();
11907
+ }, [recoveryError]);
11908
+ return (jsx(PageContent, { children: jsx(Loader, { icon: jsx(FingerPrintIcon, {}), isError: !!recoveryError, header: recoveryError ? "Invalid passkey." : "Creating wallet with passkey...", description: recoveryError ? "There was an error creating your passkey. Please try again." : undefined, onRetry: () => setShouldCreateWallet(true) }) }));
11909
+ };
11725
11910
  const CreateWalletPasswordRecovery = ({ onChangeMethod }) => {
11726
11911
  const [recoveryPhrase, setRecoveryPhrase] = useState("");
11727
11912
  const [recoveryError, setRecoveryError] = useState(false);
@@ -11736,7 +11921,10 @@ const CreateWalletPasswordRecovery = ({ onChangeMethod }) => {
11736
11921
  }
11737
11922
  setLoading(true);
11738
11923
  const { error } = await createWallet({
11739
- password: recoveryPhrase,
11924
+ recovery: {
11925
+ recoveryMethod: RecoveryMethod.PASSWORD,
11926
+ password: recoveryPhrase,
11927
+ },
11740
11928
  });
11741
11929
  setLoading(false);
11742
11930
  if (error) {
@@ -11750,7 +11938,16 @@ const CreateWalletPasswordRecovery = ({ onChangeMethod }) => {
11750
11938
  if (recoveryError)
11751
11939
  triggerResize();
11752
11940
  }, [recoveryError]);
11753
- return (jsxs(PageContent, { children: [jsxs(Graphic, { "$height": "80px", children: [jsxs(LogoGroup, { children: [jsx(Logo$2, { children: jsx(LogoPosition, { children: jsx(LogoInner, { children: jsx(FloatWrapper, { children: jsx(RotateWrapper, { children: jsx(LogoGraphic, { style: { transform: "scale(1.2)" }, children: jsx(KeyIcon, {}) }) }) }) }) }) }), jsx(Logo$2, { children: jsx(LogoPosition, { children: jsx(LogoInner, { children: jsx(FloatWrapper, { children: jsx(RotateWrapper, { children: jsx(LogoGraphic, { style: { transform: "scale(0.75)" }, children: jsx(ShieldIcon, {}) }) }) }) }) }) }), jsx("div", {}), jsx("div", {}), jsx(Logo$2, { children: jsx(LogoPosition, { children: jsx(LogoInner, { children: jsx(FloatWrapper, { children: jsx(RotateWrapper, { children: jsx(LogoGraphic, { style: { transform: "scale(0.5)" }, children: jsx(LockIcon, {}) }) }) }) }) }) })] }), jsx(GraphicBackground, { children: wave })] }), jsx(ModalHeading, { children: "Secure your wallet" }), jsxs(ModalBody, { style: { textAlign: "center" }, children: [jsx(FitText, { children: "Set a password for your wallet." }), jsxs("form", { onSubmit: (e) => {
11941
+ return (jsxs(PageContent, { children: [jsx(FloatingGraphic, { height: "80px", logoCenter: {
11942
+ logo: jsx(KeyIcon, {}),
11943
+ size: "1.2",
11944
+ }, logoTopLeft: {
11945
+ logo: jsx(ShieldIcon, {}),
11946
+ size: "0.75",
11947
+ }, logoBottomRight: {
11948
+ logo: jsx(LockIcon, {}),
11949
+ size: "0.5",
11950
+ } }), jsx(ModalHeading, { children: "Secure your wallet" }), jsxs(ModalBody, { style: { textAlign: "center" }, children: [jsx(FitText, { children: "Set a password for your wallet." }), jsxs("form", { onSubmit: (e) => {
11754
11951
  e.preventDefault();
11755
11952
  handleSubmit();
11756
11953
  }, children: [jsx(Input, { value: recoveryPhrase, onChange: (e) => {
@@ -11763,7 +11960,7 @@ const CreateWalletPasswordRecovery = ({ onChangeMethod }) => {
11763
11960
  ] }), recoveryError && (jsx(motion.div, { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, children: jsx(ModalBody, { style: { height: 24, marginTop: 12 }, "$error": true, children: jsx(FitText, { children: recoveryError }) }) }, recoveryError)), jsx(Button, { onClick: handleSubmit, waiting: loading, disabled: loading, children: "Create wallet" })] }), jsx(OtherMethod, { currentMethod: RecoveryMethod.PASSWORD, onChangeMethod: onChangeMethod })] })] }));
11764
11961
  };
11765
11962
  const ChooseRecoveryMethod = ({ onChangeMethod }) => {
11766
- return (jsxs(PageContent, { children: [jsx(ModalHeading, { children: "Choose a recovery method" }), jsx(Button, { onClick: () => onChangeMethod(RecoveryMethod.PASSWORD), children: "Password" }), jsx(Button, { onClick: () => onChangeMethod(RecoveryMethod.AUTOMATIC), children: "Automatic" }), jsx(Button, { onClick: () => { }, children: "Passkey (coming soon)" })] }));
11963
+ return (jsxs(PageContent, { children: [jsx(ModalHeading, { children: "Choose a recovery method" }), jsx(Button, { onClick: () => onChangeMethod(RecoveryMethod.PASSWORD), children: "Password" }), jsx(Button, { onClick: () => onChangeMethod(RecoveryMethod.AUTOMATIC), children: "Automatic" }), jsx(Button, { onClick: () => onChangeMethod(RecoveryMethod.PASSKEY), children: "Passkey" })] }));
11767
11964
  };
11768
11965
  const RecoverWallet = ({ wallet }) => {
11769
11966
  switch (wallet.recoveryMethod) {
@@ -11771,34 +11968,66 @@ const RecoverWallet = ({ wallet }) => {
11771
11968
  return jsx(RecoverPasswordWallet, { wallet: wallet });
11772
11969
  case RecoveryMethod.AUTOMATIC:
11773
11970
  return jsx(RecoverAutomaticWallet, { walletAddress: wallet.address });
11971
+ case RecoveryMethod.PASSKEY:
11972
+ return jsx(RecoverPasskeyWallet, { wallet: wallet });
11774
11973
  default:
11775
11974
  console.error("Unsupported recovery method: " + wallet.recoveryMethod + ", defaulting to automatic.");
11776
11975
  return jsx(RecoverAutomaticWallet, { walletAddress: wallet.address });
11777
11976
  }
11778
11977
  };
11978
+ const WalletRecoveryIcon = ({ recovery }) => {
11979
+ switch (recovery) {
11980
+ case RecoveryMethod.PASSWORD:
11981
+ return jsx(KeyIcon, {});
11982
+ case RecoveryMethod.PASSKEY:
11983
+ return jsx(FingerPrintIcon, {});
11984
+ case RecoveryMethod.AUTOMATIC:
11985
+ return jsx(LockIcon, {});
11986
+ default:
11987
+ return null;
11988
+ }
11989
+ };
11990
+ const SelectWalletButton = ({ wallet, onSelect }) => {
11991
+ const ensFallbackConfig = useEnsFallbackConfig();
11992
+ const { data: ensName } = useEnsName({
11993
+ chainId: 1,
11994
+ address: wallet.address,
11995
+ config: ensFallbackConfig,
11996
+ });
11997
+ const walletDisplay = ensName !== null && ensName !== void 0 ? ensName : truncateEthAddress(wallet.address);
11998
+ // <Button
11999
+ // onClick={() => onSelect(wallet)}
12000
+ // >
12001
+ // {walletDisplay} - {wallet.recoveryMethod} recover
12002
+ // </Button>
12003
+ return (jsx(ProvidersButton, { children: jsxs(Button, { onClick: () => onSelect(wallet), children: [jsx(ProviderLabel, { children: walletDisplay }), jsx(ProviderIcon$1, { children: jsx(WalletRecoveryIcon, { recovery: wallet.recoveryMethod }) })] }) }));
12004
+ };
12005
+ const SelectWalletToRecover = ({ wallets }) => {
12006
+ const [selectedWallet, setSelectedWallet] = useState(null);
12007
+ if (selectedWallet) {
12008
+ return jsx(RecoverWallet, { wallet: selectedWallet });
12009
+ }
12010
+ return (jsxs(PageContent, { children: [jsx(ModalHeading, { children: "Select a wallet to recover" }), wallets.map((wallet) => (jsx(SelectWalletButton, { wallet: wallet, onSelect: setSelectedWallet }, wallet.id)))] }));
12011
+ };
11779
12012
  const CreateWallet = () => {
11780
- const { uiConfig } = useOpenfort();
12013
+ const { uiConfig, triggerResize } = useOpenfort();
11781
12014
  const [userSelectedMethod, setUserSelectedMethod] = useState(null);
11782
- if (userSelectedMethod) {
11783
- switch (userSelectedMethod) {
11784
- case RecoveryMethod.PASSWORD:
11785
- return jsx(CreateWalletPasswordRecovery, { onChangeMethod: setUserSelectedMethod });
11786
- case RecoveryMethod.AUTOMATIC:
11787
- return jsx(CreateWalletAutomaticRecovery, {});
11788
- case "other":
11789
- return jsx(ChooseRecoveryMethod, { onChangeMethod: setUserSelectedMethod });
11790
- default:
11791
- throw new Error("Unsupported recovery method: " + userSelectedMethod);
11792
- }
11793
- }
11794
- // Default recovery method configured
11795
- switch (uiConfig.walletRecovery.defaultMethod) {
12015
+ useEffect(() => {
12016
+ triggerResize();
12017
+ }, [userSelectedMethod]);
12018
+ const method = userSelectedMethod !== null && userSelectedMethod !== void 0 ? userSelectedMethod : uiConfig.walletRecovery.defaultMethod;
12019
+ switch (method) {
11796
12020
  case RecoveryMethod.PASSWORD:
11797
12021
  return jsx(CreateWalletPasswordRecovery, { onChangeMethod: setUserSelectedMethod });
11798
12022
  case RecoveryMethod.AUTOMATIC:
11799
12023
  return jsx(CreateWalletAutomaticRecovery, {});
12024
+ case RecoveryMethod.PASSKEY:
12025
+ return jsx(CreateWalletPasskeyRecovery, { onChangeMethod: setUserSelectedMethod });
12026
+ case "other":
12027
+ return jsx(ChooseRecoveryMethod, { onChangeMethod: setUserSelectedMethod });
11800
12028
  default:
11801
- throw new Error("Unsupported recovery method: " + uiConfig.walletRecovery.defaultMethod);
12029
+ console.error("Unsupported recovery method: " + userSelectedMethod + uiConfig.walletRecovery.defaultMethod);
12030
+ return null;
11802
12031
  }
11803
12032
  };
11804
12033
  const Connected = () => {
@@ -11809,7 +12038,7 @@ const Connected = () => {
11809
12038
  setOpen(false);
11810
12039
  }, 1000);
11811
12040
  }, []);
11812
- return (jsx(PageContent, { children: jsx(Loader, { isLoading: false, reason: "Connected" }) }));
12041
+ return (jsx(PageContent, { children: jsx(Loader, { isLoading: false, isSuccess: true, header: "Connected" }) }));
11813
12042
  };
11814
12043
  const RecoverPage = () => {
11815
12044
  const { needsRecovery, user } = useOpenfortCore();
@@ -11847,7 +12076,7 @@ const RecoverPage = () => {
11847
12076
  // setLoading(false);
11848
12077
  // }, [user])
11849
12078
  if (embeddedSignerLoading) {
11850
- return (jsx(PageContent, { children: jsx(Loader, { reason: "Setting up wallet" }) }));
12079
+ return (jsx(PageContent, { children: jsx(Loader, { header: "Setting up wallet" }) }));
11851
12080
  }
11852
12081
  if (isConnected && user) {
11853
12082
  return jsx(Connected, {});
@@ -11860,20 +12089,10 @@ const RecoverPage = () => {
11860
12089
  if (openfortWallets.length === 0) {
11861
12090
  return (jsx(CreateWallet, {}));
11862
12091
  }
11863
- // if (wallets.length === 1) {
11864
- return (jsx(RecoverWallet, { wallet: openfortWallets[0] }));
11865
- // }
11866
- // return (
11867
- // <PageContent>
11868
- // <div style={{ flexDirection: "column", display: "flex", gap: 8 }}>
11869
- // {wallets.map((wallet) => (
11870
- // <div key={wallet.address}>
11871
- // {wallet.address} - {wallet.recoveryMethod} recover
11872
- // </div>
11873
- // ))}
11874
- // </div>
11875
- // </PageContent>
11876
- // )
12092
+ if (wallets.length === 1) {
12093
+ return (jsx(RecoverWallet, { wallet: openfortWallets[0] }));
12094
+ }
12095
+ return (jsx(SelectWalletToRecover, { wallets: openfortWallets }));
11877
12096
  // if (walletConfig && walletConfig.recoveryMethod === RecoveryMethod.AUTOMATIC) {
11878
12097
  // return <AutomaticRecovery />
11879
12098
  // }
@@ -12087,9 +12306,9 @@ const OpenfortProvider = ({ children, uiConfig, onConnect, onDisconnect, debugMo
12087
12306
  defaultMethod: allowAutomaticRecovery ? RecoveryMethod.AUTOMATIC : RecoveryMethod.PASSWORD,
12088
12307
  },
12089
12308
  authProviders: [
12090
- AuthProvider.GUEST,
12091
- AuthProvider.EMAIL,
12092
- AuthProvider.WALLET,
12309
+ UIAuthProvider.GUEST,
12310
+ UIAuthProvider.EMAIL,
12311
+ UIAuthProvider.WALLET,
12093
12312
  ],
12094
12313
  };
12095
12314
  const safeUiConfig = Object.assign({}, defaultUIOptions, uiConfig);
@@ -12775,14 +12994,12 @@ const useConnectToWalletPostAuth = () => {
12775
12994
  const { walletConfig } = useOpenfort();
12776
12995
  const { signOut } = useSignOut();
12777
12996
  const queryClient = useQueryClient();
12778
- const tryUseWallet = useCallback(async ({ logoutOnError: signOutOnError = true, automaticRecovery = true }) => {
12779
- console.log("tryUseWallet", { walletConfig, automaticRecovery });
12780
- if ((!(walletConfig === null || walletConfig === void 0 ? void 0 : walletConfig.createEncryptedSessionEndpoint) && !(walletConfig === null || walletConfig === void 0 ? void 0 : walletConfig.getEncryptionSession)) || !automaticRecovery) {
12997
+ const tryUseWallet = useCallback(async ({ logoutOnError: signOutOnError = true, recoverWalletAutomatically = true }) => {
12998
+ if ((!(walletConfig === null || walletConfig === void 0 ? void 0 : walletConfig.createEncryptedSessionEndpoint) && !(walletConfig === null || walletConfig === void 0 ? void 0 : walletConfig.getEncryptionSession)) || !recoverWalletAutomatically) {
12781
12999
  // If there is no encryption session, we cannot create a wallet
12782
13000
  return {};
12783
13001
  }
12784
- const wallets = await queryClient.ensureQueryData({ queryKey: ['openfortEmbeddedWalletList'] });
12785
- console.log("WALLETS", wallets);
13002
+ const wallets = await queryClient.ensureQueryData({ queryKey: ['openfortEmbeddedAccountsList'] });
12786
13003
  let wallet;
12787
13004
  if (wallets.length === 0) {
12788
13005
  const createWalletResult = await createWallet();
@@ -12797,7 +13014,7 @@ const useConnectToWalletPostAuth = () => {
12797
13014
  // Has a wallet with automatic recovery
12798
13015
  if (wallets.some(w => w.recoveryMethod === RecoveryMethod.AUTOMATIC)) {
12799
13016
  const setWalletResult = await setActiveWallet({
12800
- connector: embeddedWalletId,
13017
+ walletId: embeddedWalletId,
12801
13018
  });
12802
13019
  if (!setWalletResult.wallet || (setWalletResult.error && signOutOnError)) {
12803
13020
  console.error("Error recovering wallet:", setWalletResult.error);
@@ -12828,7 +13045,7 @@ const useEmailAuth = (hookOptions = {}) => {
12828
13045
  }, []);
12829
13046
  const { tryUseWallet } = useConnectToWalletPostAuth();
12830
13047
  const signInEmail = useCallback(async (options) => {
12831
- var _a;
13048
+ var _a, _b, _c;
12832
13049
  try {
12833
13050
  setStatus({
12834
13051
  status: 'loading',
@@ -12859,8 +13076,8 @@ const useEmailAuth = (hookOptions = {}) => {
12859
13076
  }
12860
13077
  else {
12861
13078
  const { wallet } = await tryUseWallet({
12862
- logoutOnError: options.logoutOnError || hookOptions.logoutOnError,
12863
- automaticRecovery: options.automaticRecovery || hookOptions.automaticRecovery,
13079
+ logoutOnError: (_b = options.logoutOnError) !== null && _b !== void 0 ? _b : hookOptions.logoutOnError,
13080
+ recoverWalletAutomatically: (_c = options.recoverWalletAutomatically) !== null && _c !== void 0 ? _c : hookOptions.recoverWalletAutomatically,
12864
13081
  });
12865
13082
  setStatus({
12866
13083
  status: 'success',
@@ -12960,7 +13177,7 @@ const useEmailAuth = (hookOptions = {}) => {
12960
13177
  }
12961
13178
  }, [client, setStatus, updateUser, hookOptions]);
12962
13179
  const signUpEmail = useCallback(async (options) => {
12963
- var _a;
13180
+ var _a, _b, _c;
12964
13181
  try {
12965
13182
  setStatus({
12966
13183
  status: 'loading',
@@ -12992,8 +13209,8 @@ const useEmailAuth = (hookOptions = {}) => {
12992
13209
  }
12993
13210
  else {
12994
13211
  const { wallet } = await tryUseWallet({
12995
- logoutOnError: options.logoutOnError || hookOptions.logoutOnError,
12996
- automaticRecovery: options.automaticRecovery || hookOptions.automaticRecovery,
13212
+ logoutOnError: (_b = options.logoutOnError) !== null && _b !== void 0 ? _b : hookOptions.logoutOnError,
13213
+ recoverWalletAutomatically: (_c = options.recoverWalletAutomatically) !== null && _c !== void 0 ? _c : hookOptions.recoverWalletAutomatically,
12997
13214
  });
12998
13215
  setStatus({
12999
13216
  status: 'success',
@@ -13133,15 +13350,6 @@ const useEmailAuth = (hookOptions = {}) => {
13133
13350
  };
13134
13351
  };
13135
13352
 
13136
- ({
13137
- // [OAuthProvider.APPLE]: AuthProvider.,
13138
- // [OAuthProvider.DISCORD]: AuthProvider.,
13139
- // [OAuthProvider.EPIC_GAMES]: AuthProvider.,
13140
- [AuthProvider.FACEBOOK]: OAuthProvider.FACEBOOK,
13141
- [AuthProvider.GOOGLE]: OAuthProvider.GOOGLE,
13142
- // [OAuthProvider.LINE]: AuthProvider.,
13143
- [AuthProvider.TWITTER]: OAuthProvider.TWITTER,
13144
- });
13145
13353
  const useOAuth = (hookOptions = {}) => {
13146
13354
  const { client, updateUser } = useOpenfortCore();
13147
13355
  const [status, setStatus] = useState({
@@ -13149,6 +13357,7 @@ const useOAuth = (hookOptions = {}) => {
13149
13357
  });
13150
13358
  const { tryUseWallet } = useConnectToWalletPostAuth();
13151
13359
  const storeCredentials = useCallback(async ({ player, accessToken, refreshToken, ...options }) => {
13360
+ var _a, _b;
13152
13361
  setStatus({
13153
13362
  status: 'loading',
13154
13363
  });
@@ -13163,8 +13372,8 @@ const useOAuth = (hookOptions = {}) => {
13163
13372
  });
13164
13373
  const user = await updateUser() || undefined;
13165
13374
  const { wallet } = await tryUseWallet({
13166
- logoutOnError: options.logoutOnError || hookOptions.logoutOnError,
13167
- automaticRecovery: options.automaticRecovery || hookOptions.automaticRecovery,
13375
+ logoutOnError: (_a = options.logoutOnError) !== null && _a !== void 0 ? _a : hookOptions.logoutOnError,
13376
+ recoverWalletAutomatically: (_b = options.recoverWalletAutomatically) !== null && _b !== void 0 ? _b : hookOptions.recoverWalletAutomatically,
13168
13377
  });
13169
13378
  return onSuccess({
13170
13379
  data: { user, wallet, type: "storeCredentials" },
@@ -13397,6 +13606,7 @@ const useGuestAuth = (hookOptions = {}) => {
13397
13606
  });
13398
13607
  const { tryUseWallet } = useConnectToWalletPostAuth();
13399
13608
  const signUpGuest = useCallback(async (options = {}) => {
13609
+ var _a, _b;
13400
13610
  try {
13401
13611
  setStatus({
13402
13612
  status: 'loading',
@@ -13405,8 +13615,8 @@ const useGuestAuth = (hookOptions = {}) => {
13405
13615
  const user = result.player;
13406
13616
  await updateUser(user);
13407
13617
  const { wallet } = await tryUseWallet({
13408
- logoutOnError: options.logoutOnError || hookOptions.logoutOnError,
13409
- automaticRecovery: options.automaticRecovery || hookOptions.automaticRecovery,
13618
+ logoutOnError: (_a = options.logoutOnError) !== null && _a !== void 0 ? _a : hookOptions.logoutOnError,
13619
+ recoverWalletAutomatically: (_b = options.recoverWalletAutomatically) !== null && _b !== void 0 ? _b : hookOptions.recoverWalletAutomatically,
13410
13620
  });
13411
13621
  setStatus({
13412
13622
  status: 'success',
@@ -13618,5 +13828,5 @@ const useWalletAuth = (hookOptions = {}) => {
13618
13828
  };
13619
13829
  };
13620
13830
 
13621
- export { AuthProvider, Avatar, Chain as ChainIcon, OPENFORT_VERSION, OpenfortButton, OpenfortError, OpenfortErrorType, OpenfortProvider, OpenfortStatus, embeddedWalletId, defaultConfig as getDefaultConfig, defaultConnectors as getDefaultConnectors, useAuthCallback, useChainIsSupported, useChains, useConnectWithSiwe, useEmailAuth, useGuestAuth, useOAuth, useOpenfortCore as useOpenfort, useSignOut, useStatus, useUI, useUser, useWallet, useWalletAuth, useWallets, wallets };
13831
+ export { UIAuthProvider as AuthProvider, Avatar, Chain as ChainIcon, OPENFORT_VERSION, OpenfortButton, OpenfortError, OpenfortErrorType, OpenfortProvider, OpenfortStatus, embeddedWalletId, defaultConfig as getDefaultConfig, defaultConnectors as getDefaultConnectors, useAuthCallback, useChainIsSupported, useChains, useConnectWithSiwe, useEmailAuth, useGuestAuth, useOAuth, useOpenfortCore as useOpenfort, useSignOut, useStatus, useUI, useUser, useWallet, useWalletAuth, useWallets, wallets };
13622
13832
  //# sourceMappingURL=index.es.js.map