@breadcoop/ui 1.0.28 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-FWCSY2DS.mjs +37 -0
- package/dist/components/LiftedButton/LiftedButton.d.mts +29 -0
- package/dist/components/LiftedButton/LiftedButton.mjs +149 -0
- package/dist/components/LiftedButton/LiftedButtonPresets.d.mts +55 -0
- package/dist/components/LiftedButton/LiftedButtonPresets.mjs +85 -0
- package/dist/components/LiftedButton/index.d.mts +2 -0
- package/dist/components/LiftedButton/index.mjs +0 -0
- package/dist/components/Logo/Logo.d.mts +29 -0
- package/dist/components/Logo/Logo.mjs +273 -0
- package/dist/components/Logo/index.d.mts +3 -0
- package/dist/components/Logo/index.mjs +5 -0
- package/dist/components/auth/button-shell.d.mts +5 -0
- package/dist/components/auth/button-shell.mjs +8 -0
- package/dist/components/auth/index.d.mts +5 -0
- package/dist/components/auth/index.mjs +5 -0
- package/dist/components/auth/login-button-general.d.mts +13 -0
- package/dist/components/auth/login-button-general.mjs +80 -0
- package/dist/components/auth/login-button-privy.d.mts +13 -0
- package/dist/components/auth/login-button-privy.mjs +64 -0
- package/dist/components/auth/login-button.d.mts +8 -0
- package/dist/components/auth/login-button.mjs +32 -0
- package/dist/components/buttons/button.d.mts +20 -0
- package/dist/components/buttons/button.mjs +98 -0
- package/dist/components/buttons/copy-icon.d.mts +10 -0
- package/dist/components/buttons/copy-icon.mjs +44 -0
- package/dist/components/buttons/index.d.mts +6 -0
- package/dist/components/buttons/index.mjs +7 -0
- package/dist/components/chip/chip.d.mts +12 -0
- package/dist/components/chip/chip.mjs +34 -0
- package/dist/components/connected-user/context.d.mts +14 -0
- package/dist/components/connected-user/context.mjs +22 -0
- package/dist/components/connected-user/index.d.mts +6 -0
- package/dist/components/connected-user/index.mjs +7 -0
- package/dist/components/connected-user/interface.d.mts +16 -0
- package/dist/components/connected-user/interface.mjs +0 -0
- package/dist/components/connected-user/privy-provider.d.mts +10 -0
- package/dist/components/connected-user/privy-provider.mjs +55 -0
- package/dist/components/connected-user/provider-general.d.mts +10 -0
- package/dist/components/connected-user/provider-general.mjs +38 -0
- package/dist/components/connected-user/provider.d.mts +9 -0
- package/dist/components/connected-user/provider.mjs +15 -0
- package/dist/components/footer/footer.d.mts +11 -0
- package/dist/components/footer/footer.mjs +222 -0
- package/dist/components/loading-icon.d.mts +9 -0
- package/dist/components/loading-icon.mjs +49 -0
- package/dist/components/navbar/account-menu.d.mts +15 -0
- package/dist/components/navbar/account-menu.mjs +48 -0
- package/dist/components/navbar/account-section.d.mts +14 -0
- package/dist/components/navbar/account-section.mjs +68 -0
- package/dist/components/navbar/account-widget-item.d.mts +12 -0
- package/dist/components/navbar/account-widget-item.mjs +21 -0
- package/dist/components/navbar/account-widget.d.mts +22 -0
- package/dist/components/navbar/account-widget.mjs +118 -0
- package/dist/components/navbar/index.d.mts +11 -0
- package/dist/components/navbar/index.mjs +10 -0
- package/dist/components/navbar/log-out.d.mts +7 -0
- package/dist/components/navbar/log-out.mjs +34 -0
- package/dist/components/navbar/navbar-menu.d.mts +12 -0
- package/dist/components/navbar/navbar-menu.mjs +57 -0
- package/dist/components/navbar/navbar.d.mts +25 -0
- package/dist/components/navbar/navbar.mjs +63 -0
- package/dist/components/navbar/solidarity-apps.d.mts +17 -0
- package/dist/components/navbar/solidarity-apps.mjs +167 -0
- package/dist/components/typography/Typography.d.mts +42 -0
- package/dist/components/typography/Typography.mjs +52 -0
- package/dist/components/typography/formatted-dec-num.d.mts +15 -0
- package/dist/components/typography/formatted-dec-num.mjs +40 -0
- package/dist/constansts/links.d.mts +26 -0
- package/dist/constansts/links.mjs +27 -0
- package/dist/constansts/tools.d.mts +23 -0
- package/dist/constansts/tools.mjs +52 -0
- package/dist/context/index.d.mts +5 -0
- package/dist/context/index.mjs +5 -0
- package/dist/context/lib.d.mts +31 -0
- package/dist/context/lib.mjs +33 -0
- package/dist/hooks/index.d.mts +4 -0
- package/dist/hooks/index.mjs +7 -0
- package/dist/hooks/use-auto-connect.d.mts +8 -0
- package/dist/hooks/use-auto-connect.mjs +39 -0
- package/dist/hooks/use-bread-balance.d.mts +13 -0
- package/dist/hooks/use-bread-balance.mjs +32 -0
- package/dist/hooks/use-copy-to-clipboard.d.mts +9 -0
- package/dist/hooks/use-copy-to-clipboard.mjs +26 -0
- package/dist/index.d.mts +33 -304
- package/dist/index.mjs +41 -1
- package/dist/interface/app.d.mts +3 -0
- package/dist/interface/app.mjs +0 -0
- package/dist/tailwind-preset.js +1 -0
- package/dist/theme.css +1 -0
- package/dist/utils/app.d.mts +19 -0
- package/dist/utils/app.mjs +21 -0
- package/dist/utils/cn.d.mts +5 -0
- package/dist/utils/cn.mjs +9 -0
- package/dist/utils/copy-to-clipboard.d.mts +3 -0
- package/dist/utils/copy-to-clipboard.mjs +10 -0
- package/dist/utils/cssValidation.d.mts +7 -0
- package/dist/utils/cssValidation.mjs +44 -0
- package/dist/utils/formatter.d.mts +3 -0
- package/dist/utils/formatter.mjs +13 -0
- package/dist/utils/index.d.mts +3 -0
- package/dist/utils/index.mjs +7 -0
- package/dist/utils/truncate-address.d.mts +3 -0
- package/dist/utils/truncate-address.mjs +5 -0
- package/package.json +9 -10
- package/tailwind-preset.js +1 -0
- package/theme.css +1 -0
- package/dist/index.d.ts +0 -304
- package/dist/index.js +0 -1
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__objRest,
|
|
3
|
+
__spreadProps,
|
|
4
|
+
__spreadValues
|
|
5
|
+
} from "../../chunk-FWCSY2DS.mjs";
|
|
6
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { LoadingIcon } from "../loading-icon.mjs";
|
|
8
|
+
import { cn } from "../../utils/index.mjs";
|
|
9
|
+
const getBaseClassName = (app, variant) => {
|
|
10
|
+
if (variant === "destructive") {
|
|
11
|
+
return "bg-system-red hover:bg-[#BF0A00] active:bg-system-red";
|
|
12
|
+
}
|
|
13
|
+
if (variant === "burn") {
|
|
14
|
+
return "bg-red-0 text-red-main hover:bg-red-1 active:bg-red-0";
|
|
15
|
+
}
|
|
16
|
+
if (variant === "positive") {
|
|
17
|
+
return "bg-system-green hover:bg-[#2B8F00] active:bg-system-green";
|
|
18
|
+
}
|
|
19
|
+
if (variant === "light") {
|
|
20
|
+
return "bg-paper-main text-surface-ink border-surface-ink hover:bg-paper-2 active:bg-paper-main";
|
|
21
|
+
}
|
|
22
|
+
if (app === "fund") {
|
|
23
|
+
if (variant === "primary") {
|
|
24
|
+
return "bg-core-orange hover:bg-orange-1 active:bg-core-orange";
|
|
25
|
+
}
|
|
26
|
+
return "bg-[#FBDED1] text-core-orange hover:bg-[#FFF1EA] active:bg-[#FBDED1]";
|
|
27
|
+
}
|
|
28
|
+
if (app === "stacks") {
|
|
29
|
+
if (variant === "primary") {
|
|
30
|
+
return "bg-primary-blue hover:bg-blue-2 active:bg-primary-blue";
|
|
31
|
+
}
|
|
32
|
+
return "bg-[#B9D5FF] text-primary-blue hover:bg-[#99C2FF] active:bg-[#B9D5FF]";
|
|
33
|
+
}
|
|
34
|
+
if (variant === "primary") {
|
|
35
|
+
return "bg-primary-jade hover:bg-jade-2 active:bg-primary-jade";
|
|
36
|
+
}
|
|
37
|
+
return "bg-[#CBE9E5] text-primary-jade hover:bg-[#BCD9D5] active:bg-[#CBE9E5]";
|
|
38
|
+
};
|
|
39
|
+
const Button = (_a) => {
|
|
40
|
+
var _b = _a, {
|
|
41
|
+
as,
|
|
42
|
+
app = "fund",
|
|
43
|
+
size,
|
|
44
|
+
variant = "primary",
|
|
45
|
+
rightIcon,
|
|
46
|
+
leftIcon,
|
|
47
|
+
children,
|
|
48
|
+
disabled,
|
|
49
|
+
className,
|
|
50
|
+
isLoading,
|
|
51
|
+
showChildrenWhenLoading,
|
|
52
|
+
withBorder
|
|
53
|
+
} = _b, rest = __objRest(_b, [
|
|
54
|
+
"as",
|
|
55
|
+
"app",
|
|
56
|
+
"size",
|
|
57
|
+
"variant",
|
|
58
|
+
"rightIcon",
|
|
59
|
+
"leftIcon",
|
|
60
|
+
"children",
|
|
61
|
+
"disabled",
|
|
62
|
+
"className",
|
|
63
|
+
"isLoading",
|
|
64
|
+
"showChildrenWhenLoading",
|
|
65
|
+
"withBorder"
|
|
66
|
+
]);
|
|
67
|
+
const Component = as != null ? as : "button";
|
|
68
|
+
return /* @__PURE__ */ jsxs(
|
|
69
|
+
Component,
|
|
70
|
+
__spreadProps(__spreadValues({}, rest), {
|
|
71
|
+
className: cn(
|
|
72
|
+
"text-paper-main",
|
|
73
|
+
"href" in rest ? "cursor-pointer" : "",
|
|
74
|
+
getBaseClassName(app, variant),
|
|
75
|
+
"flex items-center justify-center gap-2 active:shadow-none disabled:shadow-none disabled:bg-surface-grey disabled:cursor-not-allowed",
|
|
76
|
+
"transition-all duration-200 border disabled:border-transparent",
|
|
77
|
+
variant !== "light" && withBorder && "border-surface-ink",
|
|
78
|
+
variant !== "light" && !withBorder && "border-transparent",
|
|
79
|
+
size === "icon" ? "p-2.5" : size === "sm" ? "py-1 px-4" : "py-4 px-8",
|
|
80
|
+
size === "sm" ? "shadow-[0.125rem_0.125rem_0px_0px_#595959]" : "shadow-[0.25rem_0.25rem_0px_0px_#595959]",
|
|
81
|
+
className
|
|
82
|
+
),
|
|
83
|
+
disabled: disabled || isLoading,
|
|
84
|
+
children: [
|
|
85
|
+
(!isLoading || isLoading && showChildrenWhenLoading) && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
86
|
+
leftIcon,
|
|
87
|
+
children,
|
|
88
|
+
rightIcon
|
|
89
|
+
] }),
|
|
90
|
+
isLoading && /* @__PURE__ */ jsx(LoadingIcon, { app })
|
|
91
|
+
]
|
|
92
|
+
})
|
|
93
|
+
);
|
|
94
|
+
};
|
|
95
|
+
var button_default = Button;
|
|
96
|
+
export {
|
|
97
|
+
button_default as default
|
|
98
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ButtonHTMLAttributes } from 'react';
|
|
3
|
+
import { UseCopyToClipboardPayload } from '../../hooks/use-copy-to-clipboard.mjs';
|
|
4
|
+
|
|
5
|
+
interface CopyButtonProps extends ButtonHTMLAttributes<HTMLButtonElement>, UseCopyToClipboardPayload {
|
|
6
|
+
checkedIconSize?: number;
|
|
7
|
+
}
|
|
8
|
+
declare const CopyButtonIcon: ({ children, textToCopy, checkedIconSize, ...buttonProps }: CopyButtonProps) => react_jsx_runtime.JSX.Element;
|
|
9
|
+
|
|
10
|
+
export { CopyButtonIcon as default };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__objRest,
|
|
4
|
+
__spreadProps,
|
|
5
|
+
__spreadValues
|
|
6
|
+
} from "../../chunk-FWCSY2DS.mjs";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
import { CheckIcon, CopyIcon } from "@phosphor-icons/react";
|
|
9
|
+
import {
|
|
10
|
+
useCopyToClipboard
|
|
11
|
+
} from "../../hooks/use-copy-to-clipboard.mjs";
|
|
12
|
+
import { cn } from "../../utils/index.mjs";
|
|
13
|
+
import { useBreadUIKitContext } from "../../context/lib.mjs";
|
|
14
|
+
import { appsConfig } from "../../utils/app.mjs";
|
|
15
|
+
const CopyButtonIcon = (_a) => {
|
|
16
|
+
var _b = _a, {
|
|
17
|
+
children,
|
|
18
|
+
textToCopy,
|
|
19
|
+
checkedIconSize = 24
|
|
20
|
+
} = _b, buttonProps = __objRest(_b, [
|
|
21
|
+
"children",
|
|
22
|
+
"textToCopy",
|
|
23
|
+
"checkedIconSize"
|
|
24
|
+
]);
|
|
25
|
+
const { copied, copy } = useCopyToClipboard({
|
|
26
|
+
textToCopy
|
|
27
|
+
});
|
|
28
|
+
const app = useBreadUIKitContext().app;
|
|
29
|
+
return /* @__PURE__ */ jsx(
|
|
30
|
+
"button",
|
|
31
|
+
__spreadProps(__spreadValues({}, buttonProps), {
|
|
32
|
+
onClick: copy,
|
|
33
|
+
className: cn(
|
|
34
|
+
buttonProps.className,
|
|
35
|
+
copied ? "text-system-green!" : appsConfig[app].text
|
|
36
|
+
),
|
|
37
|
+
children: copied ? /* @__PURE__ */ jsx(CheckIcon, { size: checkedIconSize, className: "" }) : /* @__PURE__ */ jsx(CopyIcon, { size: 24, className: "fill-current" })
|
|
38
|
+
})
|
|
39
|
+
);
|
|
40
|
+
};
|
|
41
|
+
var copy_icon_default = CopyButtonIcon;
|
|
42
|
+
export {
|
|
43
|
+
copy_icon_default as default
|
|
44
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
interface ChipProps {
|
|
5
|
+
size?: "small" | "regular";
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
icon?: boolean;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
declare const Chip: ({ size, icon, className, children, }: ChipProps) => react_jsx_runtime.JSX.Element;
|
|
11
|
+
|
|
12
|
+
export { Chip as default };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import "../../chunk-FWCSY2DS.mjs";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
const Chip = ({
|
|
4
|
+
size = "small",
|
|
5
|
+
icon,
|
|
6
|
+
className = "",
|
|
7
|
+
children
|
|
8
|
+
}) => {
|
|
9
|
+
let extraClass = "";
|
|
10
|
+
if (size === "small") {
|
|
11
|
+
if (icon) {
|
|
12
|
+
extraClass = "p-2";
|
|
13
|
+
} else {
|
|
14
|
+
extraClass = "py-1 px-4";
|
|
15
|
+
}
|
|
16
|
+
} else {
|
|
17
|
+
if (icon) {
|
|
18
|
+
extraClass = "p-3";
|
|
19
|
+
} else {
|
|
20
|
+
extraClass = "py-3 px-6";
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return /* @__PURE__ */ jsx(
|
|
24
|
+
"div",
|
|
25
|
+
{
|
|
26
|
+
className: `border border-surface-ink hover:border-[#EA5817] disabled:border-surface-grey disabled:border-2 flex items-center justify-center gap-2.5 bg-paper-main ${extraClass} ${className}`,
|
|
27
|
+
children
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
};
|
|
31
|
+
var chip_default = Chip;
|
|
32
|
+
export {
|
|
33
|
+
chip_default as default
|
|
34
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { TConnectedUserState } from './interface.mjs';
|
|
3
|
+
import 'viem';
|
|
4
|
+
|
|
5
|
+
declare const ConnectedUserContext: React.Context<{
|
|
6
|
+
user: TConnectedUserState;
|
|
7
|
+
isSafe: boolean;
|
|
8
|
+
}>;
|
|
9
|
+
declare const useConnectedUser: () => {
|
|
10
|
+
user: TConnectedUserState;
|
|
11
|
+
isSafe: boolean;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export { ConnectedUserContext, useConnectedUser };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../chunk-FWCSY2DS.mjs";
|
|
3
|
+
import { createContext, useContext } from "react";
|
|
4
|
+
const ConnectedUserContext = createContext({
|
|
5
|
+
user: {
|
|
6
|
+
status: "LOADING"
|
|
7
|
+
},
|
|
8
|
+
isSafe: false
|
|
9
|
+
});
|
|
10
|
+
const useConnectedUser = () => {
|
|
11
|
+
const context = useContext(ConnectedUserContext);
|
|
12
|
+
if (context === void 0) {
|
|
13
|
+
throw new Error(
|
|
14
|
+
"useConnectedUser must be used within a ConnectedUserProvider"
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
return context;
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
ConnectedUserContext,
|
|
21
|
+
useConnectedUser
|
|
22
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { useConnectedUser } from './context.mjs';
|
|
2
|
+
export { ConnectedUserProvider } from './provider.mjs';
|
|
3
|
+
export { TConnectedUserState, TUserConnected, TUserLoading, TUserNotConnected } from './interface.mjs';
|
|
4
|
+
import 'react';
|
|
5
|
+
import 'react/jsx-runtime';
|
|
6
|
+
import 'viem';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Hex, Chain } from 'viem';
|
|
2
|
+
|
|
3
|
+
type TUserLoading = {
|
|
4
|
+
status: "LOADING";
|
|
5
|
+
};
|
|
6
|
+
type TUserNotConnected = {
|
|
7
|
+
status: "NOT_CONNECTED";
|
|
8
|
+
};
|
|
9
|
+
type TUserConnected = {
|
|
10
|
+
status: "CONNECTED" | "UNSUPPORTED_CHAIN";
|
|
11
|
+
address: Hex;
|
|
12
|
+
chain: Chain;
|
|
13
|
+
};
|
|
14
|
+
type TConnectedUserState = TUserLoading | TUserNotConnected | TUserConnected;
|
|
15
|
+
|
|
16
|
+
export type { TConnectedUserState, TUserConnected, TUserLoading, TUserNotConnected };
|
|
File without changes
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
interface IConnectedUserProviderPrivyProps {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
chainId: number;
|
|
7
|
+
}
|
|
8
|
+
declare function ConnectedUserProviderPrivy({ chainId, children, }: IConnectedUserProviderPrivyProps): react_jsx_runtime.JSX.Element;
|
|
9
|
+
|
|
10
|
+
export { ConnectedUserProviderPrivy };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../chunk-FWCSY2DS.mjs";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { useMemo } from "react";
|
|
5
|
+
import { useChains } from "wagmi";
|
|
6
|
+
import { usePrivy, useWallets } from "@privy-io/react-auth";
|
|
7
|
+
import { ConnectedUserContext } from "./context.mjs";
|
|
8
|
+
function ConnectedUserProviderPrivy({
|
|
9
|
+
chainId,
|
|
10
|
+
children
|
|
11
|
+
}) {
|
|
12
|
+
const { ready, authenticated } = usePrivy();
|
|
13
|
+
const { wallets } = useWallets();
|
|
14
|
+
const configuredChains = useChains();
|
|
15
|
+
const defaultChain = useMemo(
|
|
16
|
+
() => {
|
|
17
|
+
var _a;
|
|
18
|
+
return (_a = configuredChains.find((c) => c.id === chainId)) != null ? _a : configuredChains[0];
|
|
19
|
+
},
|
|
20
|
+
[configuredChains, chainId]
|
|
21
|
+
);
|
|
22
|
+
const embeddedWallet = useMemo(() => {
|
|
23
|
+
return wallets.find(
|
|
24
|
+
(wallet) => {
|
|
25
|
+
var _a;
|
|
26
|
+
return wallet.walletClientType === "privy" || wallet.walletClientType === "embedded_wallet" || ((_a = wallet.walletClientType) == null ? void 0 : _a.includes("embedded"));
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
}, [wallets]);
|
|
30
|
+
const user = useMemo(() => {
|
|
31
|
+
var _a;
|
|
32
|
+
if (!ready) return { status: "LOADING" };
|
|
33
|
+
if (!authenticated || !(embeddedWallet == null ? void 0 : embeddedWallet.address)) {
|
|
34
|
+
return { status: "NOT_CONNECTED" };
|
|
35
|
+
}
|
|
36
|
+
const address = embeddedWallet.address;
|
|
37
|
+
const walletChainId = embeddedWallet.chainId;
|
|
38
|
+
const parsedChainId = walletChainId ? parseInt(walletChainId.split(":")[1]) : void 0;
|
|
39
|
+
const _status = parsedChainId === chainId ? "CONNECTED" : "UNSUPPORTED_CHAIN";
|
|
40
|
+
const chain = (_a = configuredChains.find((c) => c.id === parsedChainId)) != null ? _a : defaultChain;
|
|
41
|
+
return {
|
|
42
|
+
status: _status,
|
|
43
|
+
address,
|
|
44
|
+
chain
|
|
45
|
+
};
|
|
46
|
+
}, [ready, authenticated, embeddedWallet, chainId, configuredChains, defaultChain]);
|
|
47
|
+
const isSafe = useMemo(() => {
|
|
48
|
+
return (embeddedWallet == null ? void 0 : embeddedWallet.walletClientType) === "safe" || false;
|
|
49
|
+
}, [embeddedWallet]);
|
|
50
|
+
const value = useMemo(() => ({ user, isSafe }), [user, isSafe]);
|
|
51
|
+
return /* @__PURE__ */ jsx(ConnectedUserContext.Provider, { value, children });
|
|
52
|
+
}
|
|
53
|
+
export {
|
|
54
|
+
ConnectedUserProviderPrivy
|
|
55
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
interface IConnectedUserProviderGeneralProps {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
chainId: number;
|
|
7
|
+
}
|
|
8
|
+
declare function ConnectedUserProviderGeneral({ chainId, children }: IConnectedUserProviderGeneralProps): react_jsx_runtime.JSX.Element;
|
|
9
|
+
|
|
10
|
+
export { ConnectedUserProviderGeneral };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../chunk-FWCSY2DS.mjs";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { useMemo } from "react";
|
|
5
|
+
import { useAccount, useChains } from "wagmi";
|
|
6
|
+
import { useAutoConnect } from "../../hooks/use-auto-connect.mjs";
|
|
7
|
+
import { ConnectedUserContext } from "./context.mjs";
|
|
8
|
+
function ConnectedUserProviderGeneral({ chainId, children }) {
|
|
9
|
+
const { isConnected, connector, address, status, chain } = useAccount();
|
|
10
|
+
const { isSafe } = useAutoConnect(connector);
|
|
11
|
+
const configuredChains = useChains();
|
|
12
|
+
const defaultChain = useMemo(
|
|
13
|
+
() => {
|
|
14
|
+
var _a;
|
|
15
|
+
return (_a = configuredChains.find((c) => c.id === chainId)) != null ? _a : configuredChains[0];
|
|
16
|
+
},
|
|
17
|
+
[configuredChains, chainId]
|
|
18
|
+
);
|
|
19
|
+
const user = useMemo(() => {
|
|
20
|
+
if (status === "connecting" && !address) {
|
|
21
|
+
return { status: "LOADING" };
|
|
22
|
+
}
|
|
23
|
+
if (status === "disconnected" || !isConnected || !address) {
|
|
24
|
+
return { status: "NOT_CONNECTED" };
|
|
25
|
+
}
|
|
26
|
+
const _status = (chain == null ? void 0 : chain.id) === chainId ? "CONNECTED" : "UNSUPPORTED_CHAIN";
|
|
27
|
+
return {
|
|
28
|
+
status: _status,
|
|
29
|
+
address,
|
|
30
|
+
chain: chain != null ? chain : defaultChain
|
|
31
|
+
};
|
|
32
|
+
}, [isConnected, address, chain, status, chainId, defaultChain]);
|
|
33
|
+
const value = useMemo(() => ({ user, isSafe }), [user, isSafe]);
|
|
34
|
+
return /* @__PURE__ */ jsx(ConnectedUserContext.Provider, { value, children });
|
|
35
|
+
}
|
|
36
|
+
export {
|
|
37
|
+
ConnectedUserProviderGeneral
|
|
38
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
interface IConnectedUserProviderProps {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
declare function ConnectedUserProvider({ children }: IConnectedUserProviderProps): react_jsx_runtime.JSX.Element;
|
|
8
|
+
|
|
9
|
+
export { ConnectedUserProvider };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../chunk-FWCSY2DS.mjs";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { useAuthProvider, useBreadUIKitContext } from "../../context/lib.mjs";
|
|
5
|
+
import { ConnectedUserProviderPrivy } from "./privy-provider.mjs";
|
|
6
|
+
import { ConnectedUserProviderGeneral } from "./provider-general.mjs";
|
|
7
|
+
function ConnectedUserProvider({ children }) {
|
|
8
|
+
const authProvider = useAuthProvider();
|
|
9
|
+
const { chainId } = useBreadUIKitContext();
|
|
10
|
+
const Provider = authProvider === "privy" ? ConnectedUserProviderPrivy : ConnectedUserProviderGeneral;
|
|
11
|
+
return /* @__PURE__ */ jsx(Provider, { chainId, children });
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
ConnectedUserProvider
|
|
15
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
interface FooterProps {
|
|
4
|
+
className?: string;
|
|
5
|
+
topClassName?: string;
|
|
6
|
+
infoClassName?: string;
|
|
7
|
+
mode?: "colored" | "transparent";
|
|
8
|
+
}
|
|
9
|
+
declare function Footer({ className, topClassName, infoClassName, mode, }: FooterProps): react_jsx_runtime.JSX.Element;
|
|
10
|
+
|
|
11
|
+
export { Footer as default };
|