@treasure-dev/tdk-react
Version:
Treasure Development Kit for React-based projects
1,153 lines (1,121 loc) • 99.6 kB
JavaScript
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __esm = (fn, res) => function __init() {
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
};
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/translations/es.tsx
var es_exports = {};
__export(es_exports, {
default: () => es_default
});
var import_jsx_runtime4, translation2, es_default;
var init_es = __esm({
"src/translations/es.tsx"() {
"use strict";
import_jsx_runtime4 = require("react/jsx-runtime");
translation2 = {
connect: {
action: "Conectar",
header: ({ appName }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
"Conectarse a ",
appName
] }),
footer: ({ thirdweb }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
"Con tecnolog\xEDa de ",
thirdweb
] }),
option: {
email: "Correo electr\xF3nico",
or: "o",
apple: "Apple",
discord: "Discord",
google: "Google",
passkey: "Clave de paso",
wallet: "Cartera",
x: "X"
},
verify: {
header: "Verificar c\xF3digo",
description: ({ recipient }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
"Se envi\xF3 un c\xF3digo de verificaci\xF3n a ",
recipient,
". Iniciar\xE1 sesi\xF3n autom\xE1ticamente despu\xE9s de ingresar su c\xF3digo."
] }),
inputLabel: "Ingresar c\xF3digo de verificaci\xF3n:",
action: "Confirmar",
resend: {
prompt: "\xBFNo recibi\xF3 un c\xF3digo?",
action: "Reenviar",
countdown: ({ seconds }) => `Reenv\xEDo disponsible en ${seconds}s...`
}
},
migrate: {
header: "Migrate existing account",
description: "It looks like you have several existing Treasure profiles. Please choose one you would like to use moving forward as your identity across the Treasure ecosystem.",
approve: "Use this account",
reject: "Start fresh",
disclaimer: "NOTE: This is irreversible, so please choose carefully."
}
}
};
es_default = translation2;
}
});
// src/translations/ja.tsx
var ja_exports = {};
__export(ja_exports, {
default: () => ja_default
});
var import_jsx_runtime5, translation3, ja_default;
var init_ja = __esm({
"src/translations/ja.tsx"() {
"use strict";
import_jsx_runtime5 = require("react/jsx-runtime");
translation3 = {
connect: {
action: "\u63A5\u7D9A",
header: ({ appName }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
appName,
" \u306B\u63A5\u7D9A\u3059\u308B"
] }),
footer: ({ thirdweb }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
"\u63D0\u4F9B\u5143\uFF1A",
thirdweb
] }),
option: {
email: "\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9",
or: "\u307E\u305F\u306F",
apple: "Apple",
discord: "Discord",
google: "Google",
passkey: "\u30D1\u30B9\u30AD\u30FC",
wallet: "\u30A6\u30A9\u30EC\u30C3\u30C8",
x: "X"
},
verify: {
header: "\u30B3\u30FC\u30C9\u3092\u78BA\u8A8D",
description: ({ recipient }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
recipient,
" ",
"\u306B\u78BA\u8A8D\u30B3\u30FC\u30C9\u3092\u9001\u4FE1\u3057\u307E\u3057\u305F\u3002\u30B3\u30FC\u30C9\u3092\u5165\u529B\u3059\u308B\u3068\u81EA\u52D5\u7684\u306B\u30ED\u30B0\u30A4\u30F3\u3055\u308C\u307E\u3059\u3002"
] }),
inputLabel: "\u78BA\u8A8D\u30B3\u30FC\u30C9\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\uFF1A",
action: "\u78BA\u8A8D",
resend: {
prompt: "\u30B3\u30FC\u30C9\u304C\u5C4A\u304B\u306A\u3044\u5834\u5408\u306F\uFF1F",
action: "\u518D\u9001\u4FE1",
countdown: ({ seconds }) => `${seconds}\u79D2\u5F8C\u306B\u518D\u9001\u4FE1\u53EF\u80FD...`
}
},
migrate: {
header: "Migrate existing account",
description: "It looks like you have several existing Treasure profiles. Please choose one you would like to use moving forward as your identity across the Treasure ecosystem.",
approve: "Use this account",
reject: "Start fresh",
disclaimer: "NOTE: This is irreversible, so please choose carefully."
}
}
};
ja_default = translation3;
}
});
// src/translations/ru.tsx
var ru_exports = {};
__export(ru_exports, {
default: () => ru_default
});
var import_jsx_runtime6, translation4, ru_default;
var init_ru = __esm({
"src/translations/ru.tsx"() {
"use strict";
import_jsx_runtime6 = require("react/jsx-runtime");
translation4 = {
connect: {
action: "\u041F\u043E\u0434\u043A\u043B\u044E\u0447\u0438\u0442\u044C\u0441\u044F",
header: ({ appName }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
"\u041F\u043E\u0434\u043A\u043B\u044E\u0447\u0438\u0442\u044C\u0441\u044F \u043A ",
appName
] }),
footer: ({ thirdweb }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
"\u041D\u0430 \u043F\u043B\u0430\u0442\u0444\u043E\u0440\u043C\u0435 ",
thirdweb
] }),
option: {
email: "\u042D\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u044B\u0439 \u0430\u0434\u0440\u0435\u0441",
or: "\u0438\u043B\u0438",
apple: "Apple",
discord: "Discord",
google: "Google",
passkey: "\u041A\u043B\u044E\u0447 \u0434\u043E\u0441\u0442\u0443\u043F\u0430",
wallet: "\u041A\u043E\u0448\u0435\u043B\u0451\u043A",
x: "X"
},
verify: {
header: "\u041F\u0440\u043E\u0432\u0435\u0440\u0438\u0442\u044C \u043A\u043E\u0434",
description: ({ recipient }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
"\u041E\u0442\u043F\u0440\u0430\u0432\u0438\u043B\u0438 \u043A\u043E\u0434 \u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0438 \u043D\u0430 ",
recipient,
". \u041F\u043E\u0441\u043B\u0435 \u0432\u0432\u043E\u0434\u0430 \u043A\u043E\u0434\u0430, \u0412\u044B \u0431\u0443\u0434\u0435\u0442\u0435 \u0430\u0432\u0442\u043E\u043C\u0430\u0442\u0438\u0447\u0435\u0441\u043A\u0438 \u0430\u0432\u0442\u043E\u0440\u0438\u0437\u043E\u0432\u0430\u043D\u044B."
] }),
inputLabel: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043A\u043E\u0434 \u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0438:",
action: "\u041F\u043E\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044C",
resend: {
prompt: "\u041D\u0435 \u043F\u043E\u043B\u0443\u0447\u0438\u043B\u0438 \u043A\u043E\u0434?",
action: "\u041E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C \u043F\u043E\u0432\u0442\u043E\u0440\u043D\u043E",
countdown: ({ seconds }) => `\u041F\u043E\u0432\u0442\u043E\u0440\u043D\u0430\u044F \u043E\u0442\u043F\u0440\u0430\u0432\u043A\u0430 \u0432\u043E\u0437\u043C\u043E\u0436\u043D\u0430 \u0447\u0435\u0440\u0435\u0437 ${seconds} \u0441\u0435\u043A...`
}
},
migrate: {
header: "Migrate existing account",
description: "It looks like you have several existing Treasure profiles. Please choose one you would like to use moving forward as your identity across the Treasure ecosystem.",
approve: "Use this account",
reject: "Start fresh",
disclaimer: "NOTE: This is irreversible, so please choose carefully."
}
}
};
ru_default = translation4;
}
});
// src/index.ts
var src_exports = {};
__export(src_exports, {
Button: () => Button,
ConnectButton: () => ConnectButton,
ConnectModal: () => ConnectModal,
TreasureProvider: () => TreasureProvider,
useConnect: () => useConnect2,
useContractAddress: () => useContractAddress,
useContractAddresses: () => useContractAddresses,
useTreasure: () => useTreasure
});
module.exports = __toCommonJS(src_exports);
// src/providers/treasure.tsx
var import_tdk_core2 = require("@treasure-dev/tdk-core");
var import_react5 = require("react");
var import_thirdweb = require("thirdweb");
var import_react6 = require("thirdweb/react");
var import_utils2 = require("thirdweb/utils");
var import_wallets = require("thirdweb/wallets");
// src/ui/hooks/useLauncher.tsx
var import_launcher = require("@treasure-dev/launcher");
var import_react3 = require("react");
var import_react4 = require("thirdweb/react");
// src/ui/AccountModal.tsx
var VisuallyHidden = __toESM(require("@radix-ui/react-visually-hidden"));
var import_tdk_core = require("@treasure-dev/tdk-core");
var import_clsx2 = __toESM(require("clsx"));
var import_react2 = require("thirdweb/react");
var import_utils = require("thirdweb/utils");
// src/ui/components/Dialog.tsx
var DialogPrimitive = __toESM(require("@radix-ui/react-dialog"));
var import_clsx = __toESM(require("clsx"));
var React = __toESM(require("react"));
// src/ui/icons/CloseIcon.tsx
var import_jsx_runtime = require("react/jsx-runtime");
var CloseIcon = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { viewBox: "0 0 20 20", className, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("g", { children: [
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
"path",
{
d: "M14.375 5.625L5.625 14.375",
stroke: "currentColor",
strokeWidth: "1.5",
strokeLinecap: "round",
strokeLinejoin: "round"
}
),
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
"path",
{
d: "M5.625 5.625L14.375 14.375",
stroke: "currentColor",
strokeWidth: "1.5",
strokeLinecap: "round",
strokeLinejoin: "round"
}
)
] }) });
// src/ui/components/Dialog.tsx
var import_jsx_runtime2 = require("react/jsx-runtime");
var Dialog = DialogPrimitive.Root;
var DialogPortal = DialogPrimitive.Portal;
var DialogTitle = DialogPrimitive.Title;
var DialogOverlay = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
DialogPrimitive.Overlay,
{
ref,
className: "tdk-fixed tdk-inset-0 tdk-z-50 tdk-bg-black/30 tdk-backdrop-blur-sm data-[state=open]:tdk-animate-in data-[state=closed]:tdk-animate-out data-[state=closed]:tdk-fade-out-0 data-[state=open]:tdk-fade-in-0",
...props
}
));
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
var DialogContent = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(DialogPortal, { children: [
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(DialogOverlay, {}),
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
DialogPrimitive.Content,
{
ref,
className: (0, import_clsx.default)(
"tdk-fixed tdk-max-h-screen tdk-p-4 sm:tdk-px-6 tdk-overflow-y-auto tdk-left-1/2 tdk-top-1/2 tdk-z-50 tdk-w-full -tdk-translate-x-1/2 -tdk-translate-y-1/2 tdk-shadow-none tdk-drop-shadow-xl data-[state=open]:tdk-animate-in data-[state=closed]:tdk-animate-out data-[state=closed]:tdk-fade-out-0 data-[state=open]:tdk-fade-in-0 data-[state=closed]:tdk-zoom-out-95 data-[state=open]:tdk-zoom-in-95 data-[state=closed]:tdk-slide-out-to-left-1/2 data-[state=closed]:tdk-slide-out-to-top-[48%] data-[state=open]:tdk-slide-in-from-left-1/2 data-[state=open]:tdk-slide-in-from-top-[48%] tdk-outline-none focus:tdk-outline-none focus:tdk-ring-0",
className
),
...props,
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "tdk-relative", children: [
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(DialogPrimitive.Close, { className: "tdk-absolute tdk-top-0 tdk-right-0 tdk-pt-4 tdk-pr-4 tdk-pb-2 tdk-pl-2 tdk-bg-transparent tdk-border-none tdk-cursor-pointer tdk-group", children: [
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CloseIcon, { className: "tdk-h-5 tdk-w-5 tdk-text-silver-300 group-hover:tdk-text-cream tdk-transition-colors" }),
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "tdk-sr-only", children: "Close" })
] }),
children
] })
}
)
] }));
DialogContent.displayName = DialogPrimitive.Content.displayName;
// src/ui/hooks/useTranslation.ts
var import_react = require("react");
// src/translations/en.tsx
var import_jsx_runtime3 = require("react/jsx-runtime");
var translation = {
connect: {
action: "Connect",
header: ({ appName }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
"Connect to ",
appName
] }),
footer: ({ thirdweb }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
"Powered by ",
thirdweb
] }),
option: {
email: "Email address",
or: "or",
apple: "Apple",
discord: "Discord",
google: "Google",
passkey: "Passkey",
wallet: "Wallet",
x: "X"
},
verify: {
header: "Verify code",
description: ({ recipient }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
"We have sent a verification code to ",
recipient,
". You will be automatically logged in after entering your code."
] }),
inputLabel: "Enter verification code:",
action: "Confirm",
resend: {
prompt: "Didn't get a code?",
action: "Resend",
countdown: ({ seconds }) => `Resend available in ${seconds}s...`
}
},
migrate: {
header: "Migrate existing account",
description: "It looks like you have several existing Treasure profiles. Please choose one you would like to use moving forward as your identity across the Treasure ecosystem.",
approve: "Use this account",
reject: "Start fresh",
disclaimer: "NOTE: This is irreversible, so please choose carefully."
}
}
};
var en_default = translation;
// src/ui/hooks/useTranslation.ts
var SUPPORTED_LANGUAGES = ["en", "es", "ja", "ru"];
var isSupportedLanguage = (language) => SUPPORTED_LANGUAGES.includes(language);
var getTranslation = async (language) => {
switch (language) {
case "es": {
return (await Promise.resolve().then(() => (init_es(), es_exports))).default;
}
case "ja": {
return (await Promise.resolve().then(() => (init_ja(), ja_exports))).default;
}
case "ru": {
return (await Promise.resolve().then(() => (init_ru(), ru_exports))).default;
}
default:
return en_default;
}
};
var useTranslation = (options) => {
const treasure3 = useTreasure();
const [translation5, setTranslation] = (0, import_react.useState)(en_default);
const browserLanguage = navigator?.language.slice(0, 2).toLowerCase();
const language = options?.language ?? treasure3.language ?? (browserLanguage && isSupportedLanguage(browserLanguage) ? browserLanguage : void 0) ?? "en";
(0, import_react.useEffect)(() => {
(async () => {
setTranslation(await getTranslation(language));
})();
}, [language]);
const thirdwebLocale = (0, import_react.useMemo)(() => {
switch (language) {
case "en":
return "en_US";
case "es":
return "es_ES";
case "ja":
return "ja_JP";
default:
return void 0;
}
}, [language]);
return { language, thirdwebLocale, t: translation5 };
};
// src/ui/AccountModal.tsx
var import_jsx_runtime7 = require("react/jsx-runtime");
var AccountModal = ({ open, size = "lg", onOpenChange }) => {
const {
client,
user,
userAddress,
appName,
appIconUri = import_tdk_core.DEFAULT_TDK_APP_ICON_URI,
ecosystemId
} = useTreasure();
const { t } = useTranslation();
const { data: walletImage } = (0, import_react2.useWalletImage)(ecosystemId);
if (!user) {
return null;
}
const userWalletImage = user.pfp ?? walletImage;
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Dialog, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
DialogContent,
{
className: (0, import_clsx2.default)(
size === "lg" && "tdk-max-w-lg",
size === "xl" && "tdk-max-w-xl",
size === "2xl" && "tdk-max-w-2xl",
size === "3xl" && "tdk-max-w-3xl"
),
"aria-describedby": void 0,
children: [
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(VisuallyHidden.Root, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DialogTitle, { children: t.connect.header({ appName }) }) }),
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "tdk-rounded-lg tdk-overflow-hidden tdk-bg-night tdk-border tdk-border-night-600", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "tdk-p-6 tdk-flex tdk-flex-col tdk-items-center", children: [
appIconUri && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
"img",
{
src: appIconUri,
alt: appName,
className: "tdk-w-16 tdk-h-16"
}
),
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h1", { className: "tdk-mt-4 tdk-text-2xl tdk-font-semibold", children: appName }),
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "tdk-mt-6 tdk-flex tdk-items-center tdk-space-x-4", children: [
userWalletImage ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
import_react2.MediaRenderer,
{
client,
src: userWalletImage,
className: "tdk-w-12 tdk-h-12 tdk-rounded-full"
}
) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "tdk-w-12 tdk-h-12 tdk-rounded-full tdk-bg-gray-500" }),
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { children: [
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h2", { className: "tdk-text-lg tdk-font-semibold", children: user.tag || (0, import_utils.shortenAddress)(userAddress) }),
user.email && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "tdk-text-sm tdk-text-gray-400", children: user.email })
] })
] })
] }) })
]
}
) });
};
// src/ui/hooks/useLauncher.tsx
var import_jsx_runtime8 = require("react/jsx-runtime");
var useLauncher = ({
launcherOptions,
setRootElement,
onAuthTokenUpdated
}) => {
const activeWallet = (0, import_react4.useActiveWallet)();
const hasSetUrlParams = (0, import_react3.useRef)(false);
const [isUsingTreasureLauncher, setIsUsingTreasureLauncher] = (0, import_react3.useState)(false);
const [isUsingLauncherAuthToken, setIsUserLauncherAuthToken] = (0, import_react3.useState)(false);
const openLauncherAccountModal = (size) => {
if (!isUsingTreasureLauncher) {
console.debug(
"[useLauncher] openLauncherAccountModal cannot be used when not using Treasure Launcher"
);
return;
}
setRootElement(
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
AccountModal,
{
open: true,
size,
onOpenChange: () => setRootElement(null)
}
)
);
};
const onWalletComponentsUpdated = (0, import_react3.useCallback)(
async (authProvider, walletId, authCookie) => {
if (activeWallet || hasSetUrlParams.current) {
return;
}
hasSetUrlParams.current = true;
const url = new URL(window.location.href);
url.searchParams.set("authProvider", authProvider);
url.searchParams.set("walletId", walletId);
url.searchParams.set("authCookie", authCookie);
window.history.pushState({}, "", url.toString());
},
[activeWallet]
);
const startUserSession2 = (0, import_react3.useCallback)(
(sessionOptions) => {
return (0, import_launcher.startUserSessionViaLauncher)({
sessionOptions,
getPort: launcherOptions?.getPortOverride
});
},
[launcherOptions?.getPortOverride]
);
(0, import_react3.useEffect)(() => {
const authToken = launcherOptions?.getAuthTokenOverride?.() ?? (0, import_launcher.getTreasureLauncherAuthToken)();
const walletComponents = launcherOptions?.getWalletComponentsOverride?.() ?? (0, import_launcher.getTreasureLauncherWalletComponents)();
if (walletComponents) {
onWalletComponentsUpdated(
walletComponents.authProvider,
walletComponents.walletId,
walletComponents.authCookie
);
setIsUsingTreasureLauncher(true);
return;
}
if (authToken) {
setIsUsingTreasureLauncher(true);
setIsUserLauncherAuthToken(true);
onAuthTokenUpdated(authToken);
return;
}
setIsUsingTreasureLauncher(false);
}, [
launcherOptions?.getAuthTokenOverride,
launcherOptions?.getWalletComponentsOverride,
onAuthTokenUpdated,
onWalletComponentsUpdated
]);
return {
isUsingTreasureLauncher,
isUsingLauncherAuthToken,
openLauncherAccountModal,
startUserSession: startUserSession2
};
};
// src/utils/defaultAnalytics.ts
var EVT_TREASURECONNECT_CONNECTED = "tc_connected";
var EVT_TREASURECONNECT_DISCONNECTED = "tc_disconnected";
var EVT_TREASURECONNECT_UI_LOGIN = "tc_ui_login";
var EVT_TREASURECONNECT_UI_ACCOUNT = "tc_ui_account";
// src/utils/store.ts
var AUTH_TOKEN_KEY = "tdk:authToken";
var AUTH_METHOD_KEY = "tdk:authMethod";
var getStoredAuthToken = () => localStorage.getItem(AUTH_TOKEN_KEY) || void 0;
var setStoredAuthToken = (authToken) => localStorage.setItem(AUTH_TOKEN_KEY, authToken);
var clearStoredAuthToken = () => localStorage.removeItem(AUTH_TOKEN_KEY);
var getStoredAuthMethod = () => localStorage.getItem(AUTH_METHOD_KEY) || void 0;
var setStoredAuthMethod = (authMethod) => localStorage.setItem(AUTH_METHOD_KEY, authMethod);
var clearStoredAuthMethod = () => localStorage.removeItem(AUTH_METHOD_KEY);
// src/providers/treasure.tsx
var import_jsx_runtime9 = require("react/jsx-runtime");
var Context = (0, import_react5.createContext)({});
var useTreasure = () => {
const context = (0, import_react5.useContext)(Context);
if (!context) {
throw new Error(
"Must call `useTreasure` within a `TreasureProvider` component."
);
}
return context;
};
var TreasureProvider = ({
children,
language,
appName,
appIconUri,
apiUri = import_tdk_core2.DEFAULT_TDK_API_BASE_URI,
defaultChainId = import_tdk_core2.DEFAULT_TDK_CHAIN_ID,
clientId,
ecosystemId = import_tdk_core2.DEFAULT_TDK_ECOSYSTEM_ID,
ecosystemPartnerId,
analyticsOptions,
authOptions,
launcherOptions,
sessionOptions,
autoConnectTimeout = 5e3,
onConnect
}) => {
const [isAuthenticating, setIsAuthenticating] = (0, import_react5.useState)(false);
const [user, setUser] = (0, import_react5.useState)();
const [authToken, setAuthToken] = (0, import_react5.useState)();
const [el, setEl] = (0, import_react5.useState)(null);
const client = (0, import_react5.useMemo)(
() => (0, import_tdk_core2.createTreasureConnectClient)({ clientId }),
[clientId]
);
const activeWallet = (0, import_react6.useActiveWallet)();
const activeWalletStatus = (0, import_react6.useActiveWalletConnectionStatus)();
const activeWalletChain = (0, import_react6.useActiveWalletChain)();
const switchActiveWalletChain = (0, import_react6.useSwitchActiveWalletChain)();
const isAutoConnecting = (0, import_react6.useIsAutoConnecting)();
const chain = (user ? activeWalletChain : void 0) ?? (0, import_thirdweb.defineChain)(defaultChainId);
const tdk = (0, import_react5.useMemo)(
() => new import_tdk_core2.TDKAPI({
baseUri: apiUri,
chainId: chain.id,
backendWallet: sessionOptions?.backendWallet,
authToken,
client,
activeWallet
}),
[
apiUri,
chain.id,
sessionOptions?.backendWallet,
authToken,
client,
activeWallet
]
);
const contractAddresses = (0, import_react5.useMemo)(
() => (0, import_tdk_core2.getContractAddresses)(chain.id),
[chain.id]
);
const userAddress = user ? (0, import_tdk_core2.getUserAddress)(user, chain.id) ?? user.smartAccounts[0]?.address : void 0;
(0, import_react5.useEffect)(() => {
if (!analyticsOptions || import_tdk_core2.AnalyticsManager.instance.initialized) {
return;
}
import_tdk_core2.AnalyticsManager.instance.init({
apiUri: analyticsOptions.apiUri,
apiKey: analyticsOptions.apiKey,
app: analyticsOptions.appInfo,
cartridgeTag: analyticsOptions.cartridgeTag,
device: analyticsOptions.device
});
}, [analyticsOptions]);
const trackCustomEvent = (0, import_react5.useCallback)(
async (event) => {
if (!import_tdk_core2.AnalyticsManager.instance.initialized) {
return void 0;
}
let address = event.address ?? userAddress;
if (address === void 0 && event.userId === void 0) {
address = "";
event.userId = "";
}
const authMethod = getStoredAuthMethod();
const playerId = {
smart_account: address,
user_id: event.userId
};
const properties = event.properties ?? {};
properties.authentication = {
method: authMethod ?? null,
email: event.email ?? user?.email ?? null,
external_wallet_addresses: event.externalWalletAddresses ?? []
};
const trackableEvent = {
...playerId,
name: event.name,
properties: event.properties ?? {}
};
return import_tdk_core2.AnalyticsManager.instance.trackCustomEvent(trackableEvent);
},
[userAddress, user]
);
const onAuthTokenUpdated = (0, import_react5.useCallback)(
(authToken2) => {
tdk.user.me({ overrideAuthToken: authToken2 }).then((user2) => {
setUser(user2);
setAuthToken(authToken2);
setStoredAuthToken(authToken2);
onConnect?.(user2);
});
},
[tdk.user.me, onConnect]
);
const {
isUsingTreasureLauncher,
isUsingLauncherAuthToken,
openLauncherAccountModal,
startUserSession: startUserSessionViaLauncher2
} = useLauncher({
launcherOptions,
setRootElement: setEl,
onAuthTokenUpdated
});
const logOut = () => {
if (analyticsOptions?.automaticTrackLogout !== false) {
trackCustomEvent({
name: EVT_TREASURECONNECT_DISCONNECTED,
properties: {
isUsingTreasureLauncher,
isUsingLauncherAuthToken
}
}).then((eventId) => {
if (eventId) {
console.debug(
`[TreasureProvider] tracked logout event: ${eventId}`
);
}
}).catch((err) => {
console.error(`[TreasureProvider] error tracking logout: ${err}`);
});
}
setUser(void 0);
setAuthToken(void 0);
clearStoredAuthToken();
clearStoredAuthMethod();
activeWallet?.disconnect();
};
const logIn = async (wallet, chainId, authMethod, skipCurrentUser = false) => {
if (isUsingLauncherAuthToken) {
console.debug(
"[TreasureProvider] Skipping login because launcher is being used"
);
return { user: void 0, legacyProfiles: [] };
}
if (chainId) {
tdk.chainId = chainId;
}
let nextUser;
let nextAuthToken;
let legacyProfiles = [];
if (!skipCurrentUser) {
const storedAuthToken = getStoredAuthToken();
if (storedAuthToken) {
try {
const { exp: authTokenExpirationDate } = (0, import_tdk_core2.decodeAuthToken)(storedAuthToken);
if (authTokenExpirationDate > Date.now() / 1e3) {
setIsAuthenticating(true);
nextUser = await tdk.user.me({
overrideAuthToken: storedAuthToken
});
nextAuthToken = storedAuthToken;
}
} catch (err) {
console.debug(
"[TreasureProvider] Error fetching user with stored auth token:",
err
);
}
}
}
if (!nextUser) {
setIsAuthenticating(true);
try {
const result = await (0, import_tdk_core2.authenticateWallet)({
wallet,
tdk,
authTokenDurationSec: authOptions?.authTokenDurationSec ?? sessionOptions?.sessionDurationSec
});
nextAuthToken = result.token;
nextUser = result.user;
legacyProfiles = result.legacyProfiles;
} catch (err) {
setIsAuthenticating(false);
throw err;
}
}
if (!nextUser || !nextAuthToken) {
throw new Error("An unknown error occurred during login");
}
tdk.setAuthToken(nextAuthToken);
if (sessionOptions && !await (0, import_utils2.isZkSyncChain)(chainId ? (0, import_thirdweb.defineChain)(chainId) : chain)) {
setIsAuthenticating(true);
try {
await (0, import_tdk_core2.startUserSession)({
client,
wallet,
chainId: chainId ?? chain.id,
tdk,
sessions: nextUser.sessions,
options: sessionOptions
});
} catch (err) {
setIsAuthenticating(false);
throw err;
}
}
if (authMethod) {
setStoredAuthMethod(authMethod);
}
setUser(nextUser);
setAuthToken(nextAuthToken);
setStoredAuthToken(nextAuthToken);
if (analyticsOptions?.automaticTrackLogin !== false) {
trackCustomEvent({
name: EVT_TREASURECONNECT_CONNECTED,
email: nextUser.email,
externalWalletAddresses: nextUser.externalWalletAddresses,
address: nextUser.address,
properties: {
isUsingTreasureLauncher,
isUsingLauncherAuthToken
}
}).then((eventId) => {
if (eventId) {
console.debug(`[TreasureProvider] tracked login event: ${eventId}`);
}
}).catch((err) => {
console.error(`[TreasureProvider] error tracking login: ${err}`);
});
}
onConnect?.(nextUser);
setIsAuthenticating(false);
return { user: nextUser, legacyProfiles };
};
const switchChain = async (chainId) => {
if (activeWallet) {
await switchActiveWalletChain((0, import_thirdweb.defineChain)(chainId));
await logIn(activeWallet, chainId, void 0, true);
}
};
(0, import_react6.useAutoConnect)({
client,
chain,
wallets: [
(0, import_wallets.ecosystemWallet)(ecosystemId, {
partnerId: ecosystemPartnerId
})
],
timeout: autoConnectTimeout,
onConnect: logIn
});
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
Context.Provider,
{
value: {
language,
appName,
appIconUri,
chain,
contractAddresses,
tdk,
client,
ecosystemId,
ecosystemPartnerId,
isConnecting: isAutoConnecting || activeWalletStatus === "connecting" || isAuthenticating,
...user ? {
isConnected: true,
user,
userAddress: userAddress ?? import_thirdweb.ZERO_ADDRESS
// should not reach here
} : {
isConnected: false,
user: void 0,
userAddress: void 0
},
isUsingTreasureLauncher,
isUsingLauncherAuthToken,
logIn,
logOut,
updateUser: (partialUser) => setUser((curr) => curr ? { ...curr, ...partialUser } : void 0),
startUserSession: (options) => isUsingTreasureLauncher ? startUserSessionViaLauncher2(options) : (0, import_tdk_core2.startUserSession)({
client,
wallet: activeWallet,
chainId: chain.id,
tdk,
options
}),
switchChain,
setRootElement: setEl,
openLauncherAccountModal,
trackCustomEvent
},
children: [
children,
el
]
}
);
};
// src/ui/components/Button.tsx
var import_class_variance_authority = require("class-variance-authority");
var import_clsx4 = __toESM(require("clsx"));
// src/ui/components/Spinner.tsx
var import_clsx3 = __toESM(require("clsx"));
var import_jsx_runtime10 = require("react/jsx-runtime");
var Spinner = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
"svg",
{
className: (0, import_clsx3.default)("tdk-animate-spin", className),
xmlns: "http://www.w3.org/2000/svg",
fill: "none",
viewBox: "0 0 24 24",
children: [
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
"circle",
{
className: "tdk-opacity-25",
cx: "12",
cy: "12",
r: "10",
stroke: "currentColor",
strokeWidth: "4"
}
),
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
"path",
{
className: "tdk-opacity-75",
fill: "currentColor",
d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
}
)
]
}
);
// src/ui/components/Button.tsx
var import_jsx_runtime11 = require("react/jsx-runtime");
var buttonClassName = (0, import_class_variance_authority.cva)(
[
"tdk-rounded-lg tdk-px-4 tdk-py-1 tdk-transition-colors tdk-text-sm tdk-border tdk-border-solid tdk-min-h-9 disabled:tdk-cursor-not-allowed disabled:tdk-opacity-90"
],
{
variants: {
intent: {
primary: [
"tdk-text-cream tdk-border-ruby-600 tdk-bg-ruby-700 hover:tdk-border-ruby-400 hover:tdk-bg-ruby-500 active:tdk-border-ruby-700 active:tdk-bg-ruby-800 disabled:hover:tdk-border-ruby-600 disabled:hover:tdk-bg-ruby-700"
],
secondary: [
"tdk-text-black tdk-border-honey-400 tdk-bg-honey-500 hover:tdk-border-honey-300 hover:tdk-bg-honey-400 active:tdk-border-honey-500 active:tdk-bg-honey-800 disabled:hover:tdk-border-honey-400 disabled:hover:tdk-bg-honey-500"
]
},
isLoading: {
false: "tdk-cursor-pointer",
true: "tdk-flex tdk-items-center tdk-justify-center tdk-cursor-wait"
}
},
compoundVariants: [
{
intent: "primary",
isLoading: true,
class: "tdk-border-ruby-700 tdk-bg-ruby-800 hover:tdk-border-ruby-700 hover:tdk-bg-ruby-800"
},
{
intent: "secondary",
isLoading: true,
class: "tdk-border-honey-500 tdk-bg-honey-800 hover:tdk-border-honey-500 hover:tdk-bg-honey-800"
}
],
defaultVariants: {
intent: "primary",
isLoading: false
}
}
);
var Button = (props) => {
const { variant = "primary", isLoading = false } = props;
const children = isLoading ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Spinner, { className: "tdk-w-3.5 tdk-h-3.5 tdk-mx-auto" }) : props.children;
if (props.as === "link") {
const { as: _2, variant: __2, isLoading: ___2, ...linkProps } = props;
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
"a",
{
...linkProps,
className: (0, import_clsx4.default)(
buttonClassName({ intent: variant, isLoading }),
props.className
),
children
}
);
}
const { as: _, variant: __, isLoading: ___, ...buttonProps } = props;
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
"button",
{
...buttonProps,
className: (0, import_clsx4.default)(
buttonClassName({
intent: variant,
isLoading
}),
buttonProps.className
),
onClick: isLoading ? void 0 : props.onClick,
children
}
);
};
// src/ui/hooks/useConnect.tsx
var import_tdk_core6 = require("@treasure-dev/tdk-core");
var import_thirdweb3 = require("thirdweb");
var import_chains2 = require("thirdweb/chains");
var import_react13 = require("thirdweb/react");
var import_wallets3 = require("thirdweb/wallets");
// src/ui/ConnectModal/ConnectModal.tsx
var VisuallyHidden2 = __toESM(require("@radix-ui/react-visually-hidden"));
var import_tdk_core4 = require("@treasure-dev/tdk-core");
var import_clsx8 = __toESM(require("clsx"));
var import_react10 = require("react");
var import_react11 = require("thirdweb/react");
var import_wallets2 = require("thirdweb/wallets");
// src/utils/error.ts
var getErrorMessage = (err) => {
let message = err instanceof Error ? err.message : String(err);
if (err instanceof Object) {
const outerMessage = err.message;
if (outerMessage) {
try {
const parsed = JSON.parse(outerMessage);
if (parsed.message) {
message = parsed.message;
}
} catch (_err) {
message = outerMessage;
}
} else {
message = JSON.stringify(err);
}
}
if (
// Sent from Thirdweb if the user closes the social login window
message === "User closed login window" || // Sent from passkey login if the user cancels the process
err instanceof Error && err.name === "NotAllowedError"
) {
return "";
}
return message;
};
// src/ui/ConnectModal/ConnectMethodSelectionView.tsx
var import_tdk_core3 = require("@treasure-dev/tdk-core");
var import_clsx5 = __toESM(require("clsx"));
var import_react7 = require("react");
// src/ui/icons/AppleIcon.tsx
var import_jsx_runtime12 = require("react/jsx-runtime");
var AppleIcon = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("svg", { viewBox: "0 0 17 18", className, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("g", { children: [
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
"path",
{
d: "M12.3765 0C12.4222 0 12.4679 0 12.5161 0C12.6282 1.26937 12.0999 2.21784 11.4579 2.90469C10.8279 3.5868 9.96523 4.24836 8.56999 4.14798C8.47692 2.89679 9.00606 2.01866 9.64723 1.33339C10.2419 0.694755 11.332 0.126463 12.3765 0Z",
fill: "currentColor"
}
),
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
"path",
{
d: "M16.6001 13.2126C16.6001 13.2252 16.6001 13.2363 16.6001 13.2482C16.208 14.3373 15.6487 15.2708 14.9661 16.137C14.3431 16.9235 13.5795 17.9818 12.2162 17.9818C11.0381 17.9818 10.2556 17.2871 9.04823 17.2681C7.77105 17.2491 7.0687 17.849 5.90097 18C5.76739 18 5.63382 18 5.50282 18C4.64534 17.8862 3.95332 17.2633 3.44918 16.7022C1.96259 15.0439 0.813822 12.902 0.600098 10.1609C0.600098 9.89215 0.600098 9.6242 0.600098 9.35547C0.690586 7.39371 1.7299 5.7987 3.11135 5.0257C3.84043 4.61469 4.84269 4.26455 5.95871 4.42105C6.437 4.48902 6.92564 4.6392 7.35395 4.78779C7.75985 4.93085 8.26745 5.18457 8.74833 5.17113C9.07408 5.16244 9.39812 5.00673 9.72646 4.89686C10.6882 4.57834 11.631 4.21317 12.8737 4.38469C14.3672 4.59177 15.4272 5.20037 16.0822 6.13936C14.8188 6.8768 13.82 7.98809 13.9906 9.88582C14.1423 11.6097 15.235 12.6182 16.6001 13.2126Z",
fill: "currentColor"
}
)
] }) });
// src/ui/icons/DiscordIcon.tsx
var import_jsx_runtime13 = require("react/jsx-runtime");
var DiscordIcon = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("svg", { viewBox: "0 0 24 24", className, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("g", { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
"path",
{
d: "M18.6536 5.99368C17.4296 5.44168 16.1176 5.03368 14.7456 4.80168C14.7334 4.79933 14.7208 4.80084 14.7095 4.806C14.6981 4.81116 14.6887 4.81972 14.6824 4.83048C14.5144 5.12568 14.3272 5.51048 14.196 5.81448C12.7409 5.59707 11.2616 5.59707 9.80644 5.81448C9.66031 5.47757 9.49552 5.14906 9.31284 4.83048C9.30665 4.81958 9.29728 4.81084 9.28599 4.8054C9.2747 4.79997 9.26202 4.79811 9.24964 4.80008C7.87844 5.03208 6.56644 5.44008 5.34164 5.99288C5.33111 5.9973 5.32217 6.00483 5.31604 6.01448C2.82644 9.67448 2.14404 13.2441 2.47924 16.7689C2.48018 16.7775 2.48286 16.7859 2.48712 16.7934C2.49138 16.801 2.49714 16.8076 2.50404 16.8129C3.95716 17.8708 5.57791 18.6767 7.29844 19.1969C7.31044 19.2006 7.32327 19.2006 7.33525 19.1968C7.34724 19.1931 7.35783 19.1859 7.36564 19.1761C7.73588 18.6809 8.06396 18.1556 8.34644 17.6057C8.35036 17.5982 8.35262 17.5899 8.35307 17.5814C8.35351 17.5729 8.35214 17.5645 8.34903 17.5566C8.34591 17.5487 8.34115 17.5416 8.33504 17.5357C8.32894 17.5298 8.32164 17.5253 8.31364 17.5225C7.79685 17.3279 7.29611 17.093 6.81604 16.8201C6.80742 16.8152 6.80015 16.8082 6.79489 16.7997C6.78963 16.7913 6.78654 16.7817 6.78591 16.7718C6.78527 16.7619 6.78711 16.752 6.79125 16.7429C6.7954 16.7339 6.80171 16.7261 6.80964 16.7201C6.91044 16.6457 7.01124 16.5681 7.10724 16.4905C7.11588 16.4835 7.12629 16.4791 7.13731 16.4776C7.14833 16.4762 7.15952 16.4779 7.16964 16.4825C10.3112 17.8937 13.7136 17.8937 16.8184 16.4825C16.8286 16.4776 16.8399 16.4757 16.8511 16.477C16.8623 16.4783 16.8728 16.4827 16.8816 16.4897C16.9776 16.5681 17.0776 16.6457 17.1792 16.7201C17.1872 16.7259 17.1937 16.7337 17.1979 16.7426C17.2022 16.7516 17.2042 16.7615 17.2037 16.7714C17.2033 16.7813 17.2003 16.7909 17.1952 16.7994C17.1901 16.8079 17.183 16.815 17.1744 16.8201C16.696 17.0953 16.1984 17.3281 15.676 17.5217C15.668 17.5246 15.6607 17.5292 15.6546 17.5351C15.6485 17.5411 15.6437 17.5483 15.6406 17.5563C15.6375 17.5642 15.6362 17.5727 15.6366 17.5812C15.6371 17.5898 15.6393 17.5981 15.6432 17.6057C15.9312 18.1553 16.2608 18.6785 16.6232 19.1753C16.6308 19.1855 16.6413 19.1931 16.6533 19.1971C16.6653 19.2011 16.6783 19.2013 16.6904 19.1977C18.4139 18.679 20.0373 17.8727 21.492 16.8129C21.4991 16.8079 21.5051 16.8015 21.5095 16.794C21.5139 16.7866 21.5167 16.7783 21.5176 16.7697C21.9176 12.6945 20.8472 9.15368 18.6784 6.01608C18.6731 6.00588 18.6643 5.99793 18.6536 5.99368ZM8.81604 14.6225C7.87044 14.6225 7.09044 13.7673 7.09044 12.7185C7.09044 11.6689 7.85524 10.8145 8.81604 10.8145C9.78404 10.8145 10.5568 11.6761 10.5416 12.7185C10.5416 13.7681 9.77684 14.6225 8.81604 14.6225ZM15.196 14.6225C14.2496 14.6225 13.4704 13.7673 13.4704 12.7185C13.4704 11.6689 14.2344 10.8145 15.196 10.8145C16.164 10.8145 16.9368 11.6761 16.9216 12.7185C16.9216 13.7681 16.1648 14.6225 15.196 14.6225Z",
fill: "currentColor"
}
) }) });
// src/ui/icons/GoogleIcon.tsx
var import_jsx_runtime14 = require("react/jsx-runtime");
var GoogleIcon = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("svg", { viewBox: "0 0 25 24", className, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("g", { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
"path",
{
d: "M12.7991 16.25C14.7113 16.25 16.3285 14.9872 16.8623 13.25H13.55V10.75H19.9417C20.0123 11.1561 20.0491 11.5737 20.0491 12C20.0491 12.4263 20.0123 12.8439 19.9417 13.25C19.3494 16.6584 16.3769 19.25 12.7991 19.25C8.79501 19.25 5.54907 16.0041 5.54907 12C5.54907 7.99594 8.79501 4.75 12.7991 4.75C14.6102 4.75 16.2663 5.41412 17.5369 6.51213L15.4059 8.64314C14.6861 8.08336 13.7815 7.75 12.7991 7.75C10.4519 7.75 8.54907 9.65279 8.54907 12C8.54907 14.3472 10.4519 16.25 12.7991 16.25Z",
fill: "currentColor"
}
) }) });
// src/ui/icons/PasskeyIcon.tsx
var import_jsx_runtime15 = require("react/jsx-runtime");
var PasskeyIcon = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("svg", { viewBox: "0 0 25 24", className, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("g", { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
"path",
{
fillRule: "evenodd",
clipRule: "evenodd",
d: "M19.45 9C19.45 11.3472 17.5472 13.25 15.2 13.25C14.8898 13.25 14.5875 13.2168 14.2962 13.1537L13.7 13.75H11.95V15.5L10.7 16.75H8.94995V18.5L8.19995 19.25H4.94995V16L11.0462 9.90372C10.9832 9.61248 10.95 9.31012 10.95 9C10.95 6.65279 12.8527 4.75 15.2 4.75C17.5472 4.75 19.45 6.65279 19.45 9ZM15.7 9.12891C16.2522 9.12891 16.7 8.68119 16.7 8.12891C16.7 7.57662 16.2522 7.12891 15.7 7.12891C15.1477 7.12891 14.7 7.57662 14.7 8.12891C14.7 8.68119 15.1477 9.12891 15.7 9.12891Z",
fill: "currentColor"
}
) }) });
// src/ui/icons/WalletIcon.tsx
var import_jsx_runtime16 = require("react/jsx-runtime");
var WalletIcon = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("svg", { viewBox: "0 0 24 24", className, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("g", { children: [
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("g", { children: [
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
"path",
{
fillRule: "evenodd",
clipRule: "evenodd",
d: "M19.25 9.91667V17.25C19.25 18.3546 18.3546 19.25 17.25 19.25H6.75C5.64543 19.25 4.75 18.3546 4.75 17.25V6.75C4.75 8.04688 5.58333 8.29036 6 8.25H17.5833C18.5038 8.25 19.25 8.99619 19.25 9.91667ZM16 15.1289C17.1046 15.1289 18 14.2335 18 13.1289C18 12.0243 17.1046 11.1289 16 11.1289C14.8954 11.1289 14 12.0243 14 13.1289C14 14.2335 14.8954 15.1289 16 15.1289Z",
fill: "currentColor"
}
),
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
"path",
{
d: "M5.375 6.75C5.375 6.40482 5.09518 6.125 4.75 6.125C4.40482 6.125 4.125 6.40482 4.125 6.75H5.375ZM6 8.25V7.625C5.97988 7.625 5.95976 7.62597 5.93974 7.62791L6 8.25ZM19.875 17.25V9.91667H18.625V17.25H19.875ZM17.25 19.875C18.6997 19.875 19.875 18.6997 19.875 17.25H18.625C18.625 18.0094 18.0094 18.625 17.25 18.625V19.875ZM6.75 19.875H17.25V18.625H6.75V19.875ZM4.125 17.25C4.125 18.6997 5.30025 19.875 6.75 19.875V18.625C5.99061 18.625 5.375 18.0094 5.375 17.25H4.125ZM4.125 6.75V17.25H5.375V6.75H4.125ZM5.93974 7.62791C5.86727 7.63493 5.72987 7.61422 5.61987 7.52216C5.53136 7.44809 5.375 7.25648 5.375 6.75H4.125C4.125 7.5404 4.38531 8.11896 4.81763 8.48077C5.22846 8.82458 5.71606 8.90543 6.06026 8.87209L5.93974 7.62791ZM17.5833 7.625H6V8.875H17.5833V7.625ZM19.875 9.91667C19.875 8.65101 18.849 7.625 17.5833 7.625V8.875C18.1586 8.875 18.625 9.34137 18.625 9.91667H19.875ZM17.375 13.1289C17.375 13.8883 16.7594 14.5039 16 14.5039V15.7539C17.4497 15.7539 18.625 14.5787 18.625 13.1289H17.375ZM16 11.7539C16.7594 11.7539 17.375 12.3695 17.375 13.1289H18.625C18.625 11.6792 17.4497 10.5039 16 10.5039V11.7539ZM14.625 13.1289C14.625 12.3695 15.2406 11.7539 16 11.7539V10.5039C14.5503 10.5039 13.375 11.6792 13.375 13.1289H14.625ZM16 14.5039C15.2406 14.5039 14.625 13.8883 14.625 13.1289H13.375C13.375 14.5787 14.5503 15.7539 16 15.7539V14.5039Z",
fill: "currentColor"
}
)
] }),
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
"path",
{
d: "M17.25 8.25H6.5C5.5335 8.25 4.75 7.4665 4.75 6.5C4.75 5.5335 5.5335 4.75 6.5 4.75H15.25C16.3546 4.75 17.25 5.64543 17.25 6.75V8.25ZM17.25 8.25L17.5 8.25",
stroke: "currentColor",
strokeWidth: "1.25",
strokeLinecap: "round",
strokeLinejoin: "round"
}
)
] }) });
// src/ui/icons/XIcon.tsx
var import_jsx_runtime17 = require("react/jsx-runtime");
var XIcon = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("svg", { viewBox: "0 0 24 24", className, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
"path",
{
d: "M14.095479,10.316482L22.286354,1h-1.940718l-7.115352,8.087682L7.551414,1H1l8.589488,12.231093L1,23h1.940717 l7.509372-8.542861L16.448587,23H23L14.095479,10.316482z M11.436522,13.338465l-0.871624-1.218704l-6.924311-9.68815h2.981339 l5.58978,7.82155l0.867949,1.218704l7.26506,10.166271h-2.981339L11.436522,13.338465z",
fill: "currentColor"
}
) });
// src/ui/icons/ThirdwebTextIcon.tsx
var import_jsx_runtime18 = require("react/jsx-runtime");
var ThirdwebTextIcon = (props) => {
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
"svg",
{
width: props.height * 74 / 11,
height: props.height,
viewBox: "0 0 74 11",
fill: "none",
xmlns: "http://www.w3.org/2000/svg",
children: [
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
"path",
{
fillRule: "evenodd",
clipRule: "evenodd",
d: "M34.1489 0.373291C33.5297 0.373291 33.022 0.874761 33.022 1.51414C33.022 2.14097 33.5297 2.64244 34.1489 2.64244C34.7681 2.64244 35.2758 2.14097 35.2758 1.51414C35.2758 0.874761 34.7681 0.373291 34.1489 0.373291ZM35.1396 3.21913H33.1706V9.97644H35.1396V3.21913ZM21.6787 0.624035H23.5982V3.21914H25.0718V5.02444H23.5982V7.40642C23.5982 7.75745 23.8706 8.03326 24.205 8.03326H25.0594V9.95138H24.205C22.818 9.95138 21.6787 8.81054 21.6787 7.39389V5.0119H20.7871V3.20661H21.6787V0.624035ZM29.7652 3.0687C28.8736 3.0687 28.1677 3.44481 27.8953 4.03403V0.624035H25.9263V9.96392H27.8953V6.17782C