@erikey/react 0.4.24 → 0.4.26
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/index.d.mts +51 -1
- package/dist/index.mjs +3 -1
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +3 -0
- package/dist/styles.css.map +1 -1
- package/dist/ui/index.mjs +275 -44
- package/dist/ui/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/ui/index.mjs
CHANGED
|
@@ -193,6 +193,18 @@ var UserRound = createLucideIcon("UserRound", [
|
|
|
193
193
|
["path", { d: "M20 21a8 8 0 0 0-16 0", key: "rfgkzh" }]
|
|
194
194
|
]);
|
|
195
195
|
|
|
196
|
+
// ../../../node_modules/.pnpm/lucide-react@0.462.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/wallet.js
|
|
197
|
+
var Wallet = createLucideIcon("Wallet", [
|
|
198
|
+
[
|
|
199
|
+
"path",
|
|
200
|
+
{
|
|
201
|
+
d: "M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1",
|
|
202
|
+
key: "18etb6"
|
|
203
|
+
}
|
|
204
|
+
],
|
|
205
|
+
["path", { d: "M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4", key: "xoc0q4" }]
|
|
206
|
+
]);
|
|
207
|
+
|
|
196
208
|
// src/ui/components/auth/auth-callback.tsx
|
|
197
209
|
import { useContext as useContext4, useEffect as useEffect5, useRef as useRef2 } from "react";
|
|
198
210
|
|
|
@@ -13726,7 +13738,7 @@ function AuthForm({
|
|
|
13726
13738
|
}
|
|
13727
13739
|
|
|
13728
13740
|
// src/ui/components/auth/auth-view.tsx
|
|
13729
|
-
import { useContext as
|
|
13741
|
+
import { useContext as useContext29, useEffect as useEffect23, useState as useState15 } from "react";
|
|
13730
13742
|
|
|
13731
13743
|
// src/ui/components/provider-icons.tsx
|
|
13732
13744
|
import { jsx as jsx29, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
@@ -14712,8 +14724,209 @@ function ProviderButton({
|
|
|
14712
14724
|
);
|
|
14713
14725
|
}
|
|
14714
14726
|
|
|
14727
|
+
// src/ui/components/auth/wallet-button.tsx
|
|
14728
|
+
import { useContext as useContext28, useState as useState14, useEffect as useEffect22, useCallback as useCallback8 } from "react";
|
|
14729
|
+
|
|
14730
|
+
// src/ui/lib/wallet.ts
|
|
14731
|
+
function hasInjectedWallet() {
|
|
14732
|
+
return typeof window !== "undefined" && !!window.ethereum;
|
|
14733
|
+
}
|
|
14734
|
+
async function connectWallet() {
|
|
14735
|
+
if (!window.ethereum) {
|
|
14736
|
+
throw new Error("No wallet found. Please install MetaMask or Phantom.");
|
|
14737
|
+
}
|
|
14738
|
+
const accounts = await window.ethereum.request({
|
|
14739
|
+
method: "eth_requestAccounts"
|
|
14740
|
+
});
|
|
14741
|
+
if (!accounts || accounts.length === 0) {
|
|
14742
|
+
throw new Error("No accounts found");
|
|
14743
|
+
}
|
|
14744
|
+
const chainIdHex = await window.ethereum.request({
|
|
14745
|
+
method: "eth_chainId"
|
|
14746
|
+
});
|
|
14747
|
+
const address = toChecksumAddress(accounts[0]);
|
|
14748
|
+
return {
|
|
14749
|
+
address,
|
|
14750
|
+
chainId: parseInt(chainIdHex, 16)
|
|
14751
|
+
};
|
|
14752
|
+
}
|
|
14753
|
+
async function signMessage(message, address) {
|
|
14754
|
+
if (!window.ethereum) {
|
|
14755
|
+
throw new Error("No wallet found");
|
|
14756
|
+
}
|
|
14757
|
+
return window.ethereum.request({
|
|
14758
|
+
method: "personal_sign",
|
|
14759
|
+
params: [message, address]
|
|
14760
|
+
});
|
|
14761
|
+
}
|
|
14762
|
+
function buildSiweMessage(opts) {
|
|
14763
|
+
const issuedAt = opts.issuedAt || (/* @__PURE__ */ new Date()).toISOString();
|
|
14764
|
+
return `${opts.domain} wants you to sign in with your Ethereum account:
|
|
14765
|
+
${opts.address}
|
|
14766
|
+
|
|
14767
|
+
${opts.statement}
|
|
14768
|
+
|
|
14769
|
+
URI: ${opts.uri}
|
|
14770
|
+
Version: ${opts.version}
|
|
14771
|
+
Chain ID: ${opts.chainId}
|
|
14772
|
+
Nonce: ${opts.nonce}
|
|
14773
|
+
Issued At: ${issuedAt}`;
|
|
14774
|
+
}
|
|
14775
|
+
function toChecksumAddress(address) {
|
|
14776
|
+
const addr = address.toLowerCase().replace("0x", "");
|
|
14777
|
+
if (address.match(/^0x[0-9a-fA-F]{40}$/)) {
|
|
14778
|
+
if (address !== address.toLowerCase() && address !== address.toUpperCase()) {
|
|
14779
|
+
return address;
|
|
14780
|
+
}
|
|
14781
|
+
}
|
|
14782
|
+
return address;
|
|
14783
|
+
}
|
|
14784
|
+
|
|
14785
|
+
// src/ui/components/auth/wallet-button.tsx
|
|
14786
|
+
import { jsx as jsx36, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
14787
|
+
function WalletButton({
|
|
14788
|
+
classNames,
|
|
14789
|
+
isSubmitting,
|
|
14790
|
+
localization,
|
|
14791
|
+
redirectTo,
|
|
14792
|
+
setIsSubmitting
|
|
14793
|
+
}) {
|
|
14794
|
+
const {
|
|
14795
|
+
authClient,
|
|
14796
|
+
localization: contextLocalization,
|
|
14797
|
+
toast,
|
|
14798
|
+
localizeErrors
|
|
14799
|
+
} = useContext28(AuthUIContext);
|
|
14800
|
+
localization = { ...contextLocalization, ...localization };
|
|
14801
|
+
const { onSuccess } = useOnSuccessTransition({ redirectTo });
|
|
14802
|
+
const [mounted, setMounted] = useState14(false);
|
|
14803
|
+
const [walletAddress, setWalletAddress] = useState14(null);
|
|
14804
|
+
const [chainId, setChainId] = useState14(null);
|
|
14805
|
+
useEffect22(() => {
|
|
14806
|
+
setMounted(true);
|
|
14807
|
+
}, []);
|
|
14808
|
+
const handleWalletAuth = useCallback8(async () => {
|
|
14809
|
+
setIsSubmitting?.(true);
|
|
14810
|
+
try {
|
|
14811
|
+
let address = walletAddress;
|
|
14812
|
+
let chain = chainId;
|
|
14813
|
+
if (!address || !chain) {
|
|
14814
|
+
const connection = await connectWallet();
|
|
14815
|
+
address = connection.address;
|
|
14816
|
+
chain = connection.chainId;
|
|
14817
|
+
setWalletAddress(address);
|
|
14818
|
+
setChainId(chain);
|
|
14819
|
+
}
|
|
14820
|
+
const nonceResult = await authClient.siwe.nonce({
|
|
14821
|
+
walletAddress: address,
|
|
14822
|
+
chainId: chain
|
|
14823
|
+
});
|
|
14824
|
+
if (nonceResult.error) {
|
|
14825
|
+
throw new Error(nonceResult.error.message || "Failed to get nonce");
|
|
14826
|
+
}
|
|
14827
|
+
const nonce = nonceResult.data?.nonce;
|
|
14828
|
+
if (!nonce) {
|
|
14829
|
+
throw new Error("No nonce received from server");
|
|
14830
|
+
}
|
|
14831
|
+
const message = buildSiweMessage({
|
|
14832
|
+
domain: window.location.host,
|
|
14833
|
+
address,
|
|
14834
|
+
statement: "Sign in with Ethereum",
|
|
14835
|
+
uri: window.location.origin,
|
|
14836
|
+
version: "1",
|
|
14837
|
+
chainId: chain,
|
|
14838
|
+
nonce
|
|
14839
|
+
});
|
|
14840
|
+
const signature = await signMessage(message, address);
|
|
14841
|
+
const verifyResult = await authClient.siwe.verify({
|
|
14842
|
+
message,
|
|
14843
|
+
signature,
|
|
14844
|
+
walletAddress: address,
|
|
14845
|
+
chainId: chain
|
|
14846
|
+
});
|
|
14847
|
+
if (verifyResult.error) {
|
|
14848
|
+
throw new Error(verifyResult.error.message || "Verification failed");
|
|
14849
|
+
}
|
|
14850
|
+
onSuccess();
|
|
14851
|
+
} catch (error) {
|
|
14852
|
+
toast({
|
|
14853
|
+
variant: "error",
|
|
14854
|
+
message: getLocalizedError({
|
|
14855
|
+
error,
|
|
14856
|
+
localization,
|
|
14857
|
+
localizeErrors
|
|
14858
|
+
})
|
|
14859
|
+
});
|
|
14860
|
+
setIsSubmitting?.(false);
|
|
14861
|
+
}
|
|
14862
|
+
}, [
|
|
14863
|
+
authClient,
|
|
14864
|
+
walletAddress,
|
|
14865
|
+
chainId,
|
|
14866
|
+
localization,
|
|
14867
|
+
localizeErrors,
|
|
14868
|
+
onSuccess,
|
|
14869
|
+
setIsSubmitting,
|
|
14870
|
+
toast
|
|
14871
|
+
]);
|
|
14872
|
+
if (!mounted) {
|
|
14873
|
+
return /* @__PURE__ */ jsxs23(
|
|
14874
|
+
Button,
|
|
14875
|
+
{
|
|
14876
|
+
className: cn(
|
|
14877
|
+
"w-full",
|
|
14878
|
+
classNames?.form?.button,
|
|
14879
|
+
classNames?.form?.secondaryButton
|
|
14880
|
+
),
|
|
14881
|
+
disabled: true,
|
|
14882
|
+
variant: "secondary",
|
|
14883
|
+
children: [
|
|
14884
|
+
/* @__PURE__ */ jsx36(Wallet, { className: "h-4 w-4" }),
|
|
14885
|
+
"Connect Wallet"
|
|
14886
|
+
]
|
|
14887
|
+
}
|
|
14888
|
+
);
|
|
14889
|
+
}
|
|
14890
|
+
if (!hasInjectedWallet()) {
|
|
14891
|
+
return /* @__PURE__ */ jsxs23(
|
|
14892
|
+
Button,
|
|
14893
|
+
{
|
|
14894
|
+
className: cn(
|
|
14895
|
+
"w-full",
|
|
14896
|
+
classNames?.form?.button,
|
|
14897
|
+
classNames?.form?.secondaryButton
|
|
14898
|
+
),
|
|
14899
|
+
disabled: true,
|
|
14900
|
+
variant: "secondary",
|
|
14901
|
+
title: "Install MetaMask or Phantom to use wallet sign-in",
|
|
14902
|
+
children: [
|
|
14903
|
+
/* @__PURE__ */ jsx36(Wallet, { className: "h-4 w-4" }),
|
|
14904
|
+
"No Wallet Found"
|
|
14905
|
+
]
|
|
14906
|
+
}
|
|
14907
|
+
);
|
|
14908
|
+
}
|
|
14909
|
+
return /* @__PURE__ */ jsxs23(
|
|
14910
|
+
Button,
|
|
14911
|
+
{
|
|
14912
|
+
className: cn(
|
|
14913
|
+
"w-full",
|
|
14914
|
+
classNames?.form?.button,
|
|
14915
|
+
classNames?.form?.secondaryButton
|
|
14916
|
+
),
|
|
14917
|
+
disabled: isSubmitting,
|
|
14918
|
+
variant: "secondary",
|
|
14919
|
+
onClick: handleWalletAuth,
|
|
14920
|
+
children: [
|
|
14921
|
+
/* @__PURE__ */ jsx36(Wallet, { className: "h-4 w-4" }),
|
|
14922
|
+
walletAddress ? `Sign in with ${walletAddress.slice(0, 6)}...${walletAddress.slice(-4)}` : "Sign in with Wallet"
|
|
14923
|
+
]
|
|
14924
|
+
}
|
|
14925
|
+
);
|
|
14926
|
+
}
|
|
14927
|
+
|
|
14715
14928
|
// src/ui/components/auth/auth-view.tsx
|
|
14716
|
-
import { Fragment as Fragment10, jsx as
|
|
14929
|
+
import { Fragment as Fragment10, jsx as jsx37, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
14717
14930
|
function AuthView({
|
|
14718
14931
|
className,
|
|
14719
14932
|
classNames,
|
|
@@ -14737,12 +14950,13 @@ function AuthView({
|
|
|
14737
14950
|
emailOTP,
|
|
14738
14951
|
oneTap,
|
|
14739
14952
|
passkey,
|
|
14953
|
+
wallet,
|
|
14740
14954
|
signUp,
|
|
14741
14955
|
social,
|
|
14742
14956
|
genericOAuth,
|
|
14743
14957
|
viewPaths,
|
|
14744
14958
|
Link
|
|
14745
|
-
} =
|
|
14959
|
+
} = useContext29(AuthUIContext);
|
|
14746
14960
|
localization = { ...contextLocalization, ...localization };
|
|
14747
14961
|
let socialLayout = socialLayoutProp;
|
|
14748
14962
|
if (socialLayout === "auto") {
|
|
@@ -14750,13 +14964,13 @@ function AuthView({
|
|
|
14750
14964
|
}
|
|
14751
14965
|
const path = pathProp ?? pathname?.split("/").pop();
|
|
14752
14966
|
const view = viewProp || getViewByPath(viewPaths, path) || "SIGN_IN";
|
|
14753
|
-
const [isSubmitting, setIsSubmitting] =
|
|
14754
|
-
const [providerError, setProviderError] =
|
|
14967
|
+
const [isSubmitting, setIsSubmitting] = useState15(false);
|
|
14968
|
+
const [providerError, setProviderError] = useState15(null);
|
|
14755
14969
|
const handleSetIsSubmitting = (value) => {
|
|
14756
14970
|
if (value) setProviderError(null);
|
|
14757
14971
|
setIsSubmitting(value);
|
|
14758
14972
|
};
|
|
14759
|
-
|
|
14973
|
+
useEffect23(() => {
|
|
14760
14974
|
const handlePageHide = () => setIsSubmitting(false);
|
|
14761
14975
|
window.addEventListener("pagehide", handlePageHide);
|
|
14762
14976
|
return () => {
|
|
@@ -14764,12 +14978,12 @@ function AuthView({
|
|
|
14764
14978
|
window.removeEventListener("pagehide", handlePageHide);
|
|
14765
14979
|
};
|
|
14766
14980
|
}, []);
|
|
14767
|
-
if (view === "CALLBACK") return /* @__PURE__ */
|
|
14768
|
-
if (view === "SIGN_OUT") return /* @__PURE__ */
|
|
14981
|
+
if (view === "CALLBACK") return /* @__PURE__ */ jsx37(AuthCallback, { redirectTo });
|
|
14982
|
+
if (view === "SIGN_OUT") return /* @__PURE__ */ jsx37(SignOut, { redirectTo });
|
|
14769
14983
|
const description = !credentials && !magicLink && !emailOTP ? localization.DISABLED_CREDENTIALS_DESCRIPTION : localization[`${view}_DESCRIPTION`];
|
|
14770
|
-
return /* @__PURE__ */
|
|
14771
|
-
/* @__PURE__ */
|
|
14772
|
-
/* @__PURE__ */
|
|
14984
|
+
return /* @__PURE__ */ jsxs24(Card, { className: cn("w-full max-w-sm", className, classNames?.base), children: [
|
|
14985
|
+
/* @__PURE__ */ jsx37(CardHeader, { className: classNames?.header, children: cardHeader ? cardHeader : /* @__PURE__ */ jsxs24(Fragment10, { children: [
|
|
14986
|
+
/* @__PURE__ */ jsx37(
|
|
14773
14987
|
CardTitle,
|
|
14774
14988
|
{
|
|
14775
14989
|
className: cn(
|
|
@@ -14779,7 +14993,7 @@ function AuthView({
|
|
|
14779
14993
|
children: localization[view]
|
|
14780
14994
|
}
|
|
14781
14995
|
),
|
|
14782
|
-
description && /* @__PURE__ */
|
|
14996
|
+
description && /* @__PURE__ */ jsx37(
|
|
14783
14997
|
CardDescription,
|
|
14784
14998
|
{
|
|
14785
14999
|
className: cn(
|
|
@@ -14790,18 +15004,18 @@ function AuthView({
|
|
|
14790
15004
|
}
|
|
14791
15005
|
)
|
|
14792
15006
|
] }) }),
|
|
14793
|
-
/* @__PURE__ */
|
|
15007
|
+
/* @__PURE__ */ jsxs24(CardContent, { className: cn("grid gap-6", classNames?.content), children: [
|
|
14794
15008
|
oneTap && ["SIGN_IN", "SIGN_UP", "MAGIC_LINK", "EMAIL_OTP"].includes(
|
|
14795
15009
|
view
|
|
14796
|
-
) && /* @__PURE__ */
|
|
15010
|
+
) && /* @__PURE__ */ jsx37(
|
|
14797
15011
|
OneTap,
|
|
14798
15012
|
{
|
|
14799
15013
|
localization,
|
|
14800
15014
|
redirectTo
|
|
14801
15015
|
}
|
|
14802
15016
|
),
|
|
14803
|
-
(credentials || magicLink || emailOTP) && /* @__PURE__ */
|
|
14804
|
-
/* @__PURE__ */
|
|
15017
|
+
(credentials || magicLink || emailOTP) && /* @__PURE__ */ jsxs24("div", { className: "grid gap-4", children: [
|
|
15018
|
+
/* @__PURE__ */ jsx37(
|
|
14805
15019
|
AuthForm,
|
|
14806
15020
|
{
|
|
14807
15021
|
classNames: classNames?.form,
|
|
@@ -14820,7 +15034,7 @@ function AuthView({
|
|
|
14820
15034
|
"SIGN_IN",
|
|
14821
15035
|
"MAGIC_LINK",
|
|
14822
15036
|
"EMAIL_OTP"
|
|
14823
|
-
].includes(view) || emailOTP && view === "EMAIL_OTP") && /* @__PURE__ */
|
|
15037
|
+
].includes(view) || emailOTP && view === "EMAIL_OTP") && /* @__PURE__ */ jsx37(
|
|
14824
15038
|
MagicLinkButton,
|
|
14825
15039
|
{
|
|
14826
15040
|
classNames,
|
|
@@ -14837,7 +15051,7 @@ function AuthView({
|
|
|
14837
15051
|
"EMAIL_OTP"
|
|
14838
15052
|
].includes(view) || magicLink && ["SIGN_IN", "MAGIC_LINK"].includes(
|
|
14839
15053
|
view
|
|
14840
|
-
)) && /* @__PURE__ */
|
|
15054
|
+
)) && /* @__PURE__ */ jsx37(
|
|
14841
15055
|
EmailOTPButton,
|
|
14842
15056
|
{
|
|
14843
15057
|
classNames,
|
|
@@ -14847,8 +15061,8 @@ function AuthView({
|
|
|
14847
15061
|
}
|
|
14848
15062
|
)
|
|
14849
15063
|
] }),
|
|
14850
|
-
view !== "RESET_PASSWORD" && view !== "EMAIL_VERIFICATION" && (social?.providers?.length || genericOAuth?.providers?.length || view === "SIGN_IN" && passkey) && /* @__PURE__ */
|
|
14851
|
-
(credentials || magicLink || emailOTP) && /* @__PURE__ */
|
|
15064
|
+
view !== "RESET_PASSWORD" && view !== "EMAIL_VERIFICATION" && (social?.providers?.length || genericOAuth?.providers?.length || view === "SIGN_IN" && passkey) && /* @__PURE__ */ jsxs24(Fragment10, { children: [
|
|
15065
|
+
(credentials || magicLink || emailOTP) && /* @__PURE__ */ jsxs24(
|
|
14852
15066
|
"div",
|
|
14853
15067
|
{
|
|
14854
15068
|
className: cn(
|
|
@@ -14856,7 +15070,7 @@ function AuthView({
|
|
|
14856
15070
|
classNames?.continueWith
|
|
14857
15071
|
),
|
|
14858
15072
|
children: [
|
|
14859
|
-
/* @__PURE__ */
|
|
15073
|
+
/* @__PURE__ */ jsx37(
|
|
14860
15074
|
Separator,
|
|
14861
15075
|
{
|
|
14862
15076
|
className: cn(
|
|
@@ -14865,8 +15079,8 @@ function AuthView({
|
|
|
14865
15079
|
)
|
|
14866
15080
|
}
|
|
14867
15081
|
),
|
|
14868
|
-
/* @__PURE__ */
|
|
14869
|
-
/* @__PURE__ */
|
|
15082
|
+
/* @__PURE__ */ jsx37("span", { className: "flex-shrink-0 text-muted-foreground text-sm", children: localization.OR_CONTINUE_WITH }),
|
|
15083
|
+
/* @__PURE__ */ jsx37(
|
|
14870
15084
|
Separator,
|
|
14871
15085
|
{
|
|
14872
15086
|
className: cn(
|
|
@@ -14878,8 +15092,8 @@ function AuthView({
|
|
|
14878
15092
|
]
|
|
14879
15093
|
}
|
|
14880
15094
|
),
|
|
14881
|
-
/* @__PURE__ */
|
|
14882
|
-
(social?.providers?.length || genericOAuth?.providers?.length) && /* @__PURE__ */
|
|
15095
|
+
/* @__PURE__ */ jsxs24("div", { className: "grid gap-4", children: [
|
|
15096
|
+
(social?.providers?.length || genericOAuth?.providers?.length) && /* @__PURE__ */ jsxs24(
|
|
14883
15097
|
"div",
|
|
14884
15098
|
{
|
|
14885
15099
|
className: cn(
|
|
@@ -14894,7 +15108,7 @@ function AuthView({
|
|
|
14894
15108
|
(socialProvider2) => socialProvider2.provider === provider
|
|
14895
15109
|
);
|
|
14896
15110
|
if (!socialProvider) return null;
|
|
14897
|
-
return /* @__PURE__ */
|
|
15111
|
+
return /* @__PURE__ */ jsx37(
|
|
14898
15112
|
ProviderButton,
|
|
14899
15113
|
{
|
|
14900
15114
|
classNames,
|
|
@@ -14911,7 +15125,7 @@ function AuthView({
|
|
|
14911
15125
|
);
|
|
14912
15126
|
}),
|
|
14913
15127
|
genericOAuth?.providers?.map(
|
|
14914
|
-
(provider) => /* @__PURE__ */
|
|
15128
|
+
(provider) => /* @__PURE__ */ jsx37(
|
|
14915
15129
|
ProviderButton,
|
|
14916
15130
|
{
|
|
14917
15131
|
classNames,
|
|
@@ -14931,7 +15145,7 @@ function AuthView({
|
|
|
14931
15145
|
]
|
|
14932
15146
|
}
|
|
14933
15147
|
),
|
|
14934
|
-
providerError && /* @__PURE__ */
|
|
15148
|
+
providerError && /* @__PURE__ */ jsx37("div", { className: "rounded-md bg-destructive/10 p-3 text-sm text-destructive", children: providerError }),
|
|
14935
15149
|
passkey && [
|
|
14936
15150
|
"SIGN_IN",
|
|
14937
15151
|
"MAGIC_LINK",
|
|
@@ -14939,7 +15153,7 @@ function AuthView({
|
|
|
14939
15153
|
"RECOVER_ACCOUNT",
|
|
14940
15154
|
"TWO_FACTOR",
|
|
14941
15155
|
"FORGOT_PASSWORD"
|
|
14942
|
-
].includes(view) && /* @__PURE__ */
|
|
15156
|
+
].includes(view) && /* @__PURE__ */ jsx37(
|
|
14943
15157
|
PasskeyButton,
|
|
14944
15158
|
{
|
|
14945
15159
|
classNames,
|
|
@@ -14948,12 +15162,27 @@ function AuthView({
|
|
|
14948
15162
|
redirectTo,
|
|
14949
15163
|
setIsSubmitting: handleSetIsSubmitting
|
|
14950
15164
|
}
|
|
15165
|
+
),
|
|
15166
|
+
wallet && [
|
|
15167
|
+
"SIGN_IN",
|
|
15168
|
+
"SIGN_UP",
|
|
15169
|
+
"MAGIC_LINK",
|
|
15170
|
+
"EMAIL_OTP"
|
|
15171
|
+
].includes(view) && /* @__PURE__ */ jsx37(
|
|
15172
|
+
WalletButton,
|
|
15173
|
+
{
|
|
15174
|
+
classNames,
|
|
15175
|
+
isSubmitting,
|
|
15176
|
+
localization,
|
|
15177
|
+
redirectTo,
|
|
15178
|
+
setIsSubmitting: handleSetIsSubmitting
|
|
15179
|
+
}
|
|
14951
15180
|
)
|
|
14952
15181
|
] })
|
|
14953
15182
|
] })
|
|
14954
15183
|
] }),
|
|
14955
|
-
cardFooter && /* @__PURE__ */
|
|
14956
|
-
credentials && signUp && /* @__PURE__ */
|
|
15184
|
+
cardFooter && /* @__PURE__ */ jsx37(CardFooter, { className: classNames?.footer, children: cardFooter }),
|
|
15185
|
+
credentials && signUp && /* @__PURE__ */ jsxs24(
|
|
14957
15186
|
CardFooter,
|
|
14958
15187
|
{
|
|
14959
15188
|
className: cn(
|
|
@@ -14961,8 +15190,8 @@ function AuthView({
|
|
|
14961
15190
|
classNames?.footer
|
|
14962
15191
|
),
|
|
14963
15192
|
children: [
|
|
14964
|
-
view === "SIGN_IN" || view === "MAGIC_LINK" || view === "EMAIL_OTP" ? localization.DONT_HAVE_AN_ACCOUNT : view === "SIGN_UP" ? localization.ALREADY_HAVE_AN_ACCOUNT : /* @__PURE__ */
|
|
14965
|
-
view === "SIGN_IN" || view === "MAGIC_LINK" || view === "EMAIL_OTP" || view === "SIGN_UP" ? /* @__PURE__ */
|
|
15193
|
+
view === "SIGN_IN" || view === "MAGIC_LINK" || view === "EMAIL_OTP" ? localization.DONT_HAVE_AN_ACCOUNT : view === "SIGN_UP" ? localization.ALREADY_HAVE_AN_ACCOUNT : /* @__PURE__ */ jsx37(ArrowLeft, { className: "size-3" }),
|
|
15194
|
+
view === "SIGN_IN" || view === "MAGIC_LINK" || view === "EMAIL_OTP" || view === "SIGN_UP" ? /* @__PURE__ */ jsx37(
|
|
14966
15195
|
Link,
|
|
14967
15196
|
{
|
|
14968
15197
|
className: cn(
|
|
@@ -14970,7 +15199,7 @@ function AuthView({
|
|
|
14970
15199
|
classNames?.footerLink
|
|
14971
15200
|
),
|
|
14972
15201
|
href: `${basePath}/${viewPaths[view === "SIGN_IN" || view === "MAGIC_LINK" || view === "EMAIL_OTP" ? "SIGN_UP" : "SIGN_IN"]}${isHydrated ? window.location.search : ""}`,
|
|
14973
|
-
children: /* @__PURE__ */
|
|
15202
|
+
children: /* @__PURE__ */ jsx37(
|
|
14974
15203
|
Button,
|
|
14975
15204
|
{
|
|
14976
15205
|
variant: "link",
|
|
@@ -14983,7 +15212,7 @@ function AuthView({
|
|
|
14983
15212
|
}
|
|
14984
15213
|
)
|
|
14985
15214
|
}
|
|
14986
|
-
) : /* @__PURE__ */
|
|
15215
|
+
) : /* @__PURE__ */ jsx37(
|
|
14987
15216
|
Button,
|
|
14988
15217
|
{
|
|
14989
15218
|
variant: "link",
|
|
@@ -15003,17 +15232,17 @@ function AuthView({
|
|
|
15003
15232
|
}
|
|
15004
15233
|
|
|
15005
15234
|
// src/ui/components/auth-loading.tsx
|
|
15006
|
-
import { useContext as
|
|
15235
|
+
import { useContext as useContext30 } from "react";
|
|
15007
15236
|
function AuthLoading({ children }) {
|
|
15008
15237
|
const {
|
|
15009
15238
|
hooks: { useSession }
|
|
15010
|
-
} =
|
|
15239
|
+
} = useContext30(AuthUIContext);
|
|
15011
15240
|
const { isPending } = useSession();
|
|
15012
15241
|
return isPending ? children : null;
|
|
15013
15242
|
}
|
|
15014
15243
|
|
|
15015
15244
|
// src/ui/hooks/use-authenticate.ts
|
|
15016
|
-
import { useContext as
|
|
15245
|
+
import { useContext as useContext31, useEffect as useEffect24 } from "react";
|
|
15017
15246
|
function useAuthenticate(options) {
|
|
15018
15247
|
const { authView = "SIGN_IN", enabled = true } = options ?? {};
|
|
15019
15248
|
const {
|
|
@@ -15021,10 +15250,10 @@ function useAuthenticate(options) {
|
|
|
15021
15250
|
basePath,
|
|
15022
15251
|
viewPaths,
|
|
15023
15252
|
replace
|
|
15024
|
-
} =
|
|
15253
|
+
} = useContext31(AuthUIContext);
|
|
15025
15254
|
const { data, isPending, error, refetch } = useSession();
|
|
15026
15255
|
const sessionData = data;
|
|
15027
|
-
|
|
15256
|
+
useEffect24(() => {
|
|
15028
15257
|
if (!enabled || isPending || sessionData) return;
|
|
15029
15258
|
const searchParams = new URLSearchParams(window.location.search);
|
|
15030
15259
|
const redirectTo = searchParams.get("redirectTo") || window.location.pathname + window.location.search;
|
|
@@ -15062,21 +15291,21 @@ function RedirectToSignUp() {
|
|
|
15062
15291
|
}
|
|
15063
15292
|
|
|
15064
15293
|
// src/ui/components/signed-in.tsx
|
|
15065
|
-
import { useContext as
|
|
15294
|
+
import { useContext as useContext32 } from "react";
|
|
15066
15295
|
function SignedIn({ children }) {
|
|
15067
15296
|
const {
|
|
15068
15297
|
hooks: { useSession }
|
|
15069
|
-
} =
|
|
15298
|
+
} = useContext32(AuthUIContext);
|
|
15070
15299
|
const { data } = useSession();
|
|
15071
15300
|
return data ? children : null;
|
|
15072
15301
|
}
|
|
15073
15302
|
|
|
15074
15303
|
// src/ui/components/signed-out.tsx
|
|
15075
|
-
import { useContext as
|
|
15304
|
+
import { useContext as useContext33 } from "react";
|
|
15076
15305
|
function SignedOut({ children }) {
|
|
15077
15306
|
const {
|
|
15078
15307
|
hooks: { useSession }
|
|
15079
|
-
} =
|
|
15308
|
+
} = useContext33(AuthUIContext);
|
|
15080
15309
|
const { data, isPending } = useSession();
|
|
15081
15310
|
return !data && !isPending ? children : null;
|
|
15082
15311
|
}
|
|
@@ -15133,6 +15362,7 @@ export {
|
|
|
15133
15362
|
UserAvatar,
|
|
15134
15363
|
VKIcon,
|
|
15135
15364
|
VercelIcon,
|
|
15365
|
+
WalletButton,
|
|
15136
15366
|
XIcon,
|
|
15137
15367
|
ZoomIcon,
|
|
15138
15368
|
accountViewPaths,
|
|
@@ -15164,6 +15394,7 @@ lucide-react/dist/esm/icons/qr-code.js:
|
|
|
15164
15394
|
lucide-react/dist/esm/icons/send.js:
|
|
15165
15395
|
lucide-react/dist/esm/icons/trash-2.js:
|
|
15166
15396
|
lucide-react/dist/esm/icons/user-round.js:
|
|
15397
|
+
lucide-react/dist/esm/icons/wallet.js:
|
|
15167
15398
|
lucide-react/dist/esm/lucide-react.js:
|
|
15168
15399
|
(**
|
|
15169
15400
|
* @license lucide-react v0.462.0 - ISC
|