@howone/sdk 0.5.3 → 0.6.0
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 +8 -4
- package/dist/index.d.ts +8 -4
- package/dist/index.js +175 -463
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +147 -435
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -4
package/dist/index.mjs
CHANGED
|
@@ -961,7 +961,7 @@ var LoginForm = ({
|
|
|
961
961
|
|
|
962
962
|
// src/components/auth/HowoneProvider.tsx
|
|
963
963
|
init_auth();
|
|
964
|
-
import { createContext as createContext2, useContext as useContext2, useState as
|
|
964
|
+
import { createContext as createContext2, useContext as useContext2, useState as useState8, useEffect as useEffect7, useMemo, useCallback as useCallback4 } from "react";
|
|
965
965
|
|
|
966
966
|
// src/components/theme/ThemeProvider.tsx
|
|
967
967
|
import { createContext, useContext, useEffect as useEffect3, useState as useState3 } from "react";
|
|
@@ -1017,31 +1017,66 @@ var useTheme = () => {
|
|
|
1017
1017
|
};
|
|
1018
1018
|
|
|
1019
1019
|
// src/components/ui/Toast/GlobalToastContainer.tsx
|
|
1020
|
-
import {
|
|
1020
|
+
import { GoeyToaster } from "goey-toast";
|
|
1021
|
+
import "goey-toast/styles.css";
|
|
1022
|
+
|
|
1023
|
+
// src/components/theme/ThemeToggle.tsx
|
|
1024
|
+
import * as React2 from "react";
|
|
1025
|
+
import { Icon as Icon3 } from "@iconify/react";
|
|
1021
1026
|
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
1022
|
-
function
|
|
1027
|
+
function ThemeToggle({ className }) {
|
|
1028
|
+
const { setTheme, theme } = useTheme();
|
|
1029
|
+
const [mounted, setMounted] = React2.useState(false);
|
|
1030
|
+
React2.useEffect(() => {
|
|
1031
|
+
setMounted(true);
|
|
1032
|
+
}, []);
|
|
1033
|
+
const handleToggle = () => {
|
|
1034
|
+
if (theme === "dark") {
|
|
1035
|
+
setTheme("light");
|
|
1036
|
+
} else {
|
|
1037
|
+
setTheme("dark");
|
|
1038
|
+
}
|
|
1039
|
+
};
|
|
1040
|
+
if (!mounted) {
|
|
1041
|
+
return /* @__PURE__ */ jsx4(Icon3, { icon: "solar:sun-bold", width: 20, height: 20 });
|
|
1042
|
+
}
|
|
1023
1043
|
return /* @__PURE__ */ jsx4(
|
|
1024
|
-
|
|
1044
|
+
"div",
|
|
1025
1045
|
{
|
|
1026
|
-
|
|
1027
|
-
|
|
1046
|
+
className: `cursor-pointer ${className || ""}`,
|
|
1047
|
+
onClick: handleToggle,
|
|
1048
|
+
children: theme === "light" ? /* @__PURE__ */ jsx4(Icon3, { icon: "solar:sun-bold", width: 20, height: 20 }) : /* @__PURE__ */ jsx4(Icon3, { icon: "solar:moon-linear", width: 20, height: 20 })
|
|
1049
|
+
}
|
|
1050
|
+
);
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
// src/components/ui/Toast/GlobalToastContainer.tsx
|
|
1054
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
1055
|
+
function GlobalToastContainer() {
|
|
1056
|
+
const { theme } = useTheme();
|
|
1057
|
+
const resolvedTheme = theme === "dark" ? "dark" : "light";
|
|
1058
|
+
return /* @__PURE__ */ jsx5(
|
|
1059
|
+
GoeyToaster,
|
|
1060
|
+
{
|
|
1061
|
+
position: "bottom-right",
|
|
1062
|
+
theme: resolvedTheme
|
|
1028
1063
|
}
|
|
1029
1064
|
);
|
|
1030
1065
|
}
|
|
1031
1066
|
|
|
1032
1067
|
// src/components/ElementSelectorProvider.tsx
|
|
1033
|
-
import { useEffect as
|
|
1068
|
+
import { useEffect as useEffect6, useState as useState7, useCallback as useCallback3 } from "react";
|
|
1034
1069
|
|
|
1035
1070
|
// src/components/ElementSelector.tsx
|
|
1036
|
-
import { useEffect as
|
|
1037
|
-
import { Fragment, jsx as
|
|
1071
|
+
import { useEffect as useEffect5, useState as useState5, useCallback, useRef } from "react";
|
|
1072
|
+
import { Fragment, jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1038
1073
|
var ElementSelector = ({
|
|
1039
1074
|
active,
|
|
1040
1075
|
onSelect,
|
|
1041
1076
|
onCancel
|
|
1042
1077
|
}) => {
|
|
1043
|
-
const [hoveredElement, setHoveredElement] =
|
|
1044
|
-
const [highlightRect, setHighlightRect] =
|
|
1078
|
+
const [hoveredElement, setHoveredElement] = useState5(null);
|
|
1079
|
+
const [highlightRect, setHighlightRect] = useState5(null);
|
|
1045
1080
|
const overlayRef = useRef(null);
|
|
1046
1081
|
const getSourceLocation = useCallback((element) => {
|
|
1047
1082
|
let current = element;
|
|
@@ -1098,7 +1133,7 @@ var ElementSelector = ({
|
|
|
1098
1133
|
}
|
|
1099
1134
|
}
|
|
1100
1135
|
}, [active, hoveredElement, getSourceLocation, onSelect, onCancel]);
|
|
1101
|
-
|
|
1136
|
+
useEffect5(() => {
|
|
1102
1137
|
if (active) {
|
|
1103
1138
|
document.addEventListener("mousemove", handleMouseMove);
|
|
1104
1139
|
document.addEventListener("click", handleClick, true);
|
|
@@ -1115,7 +1150,7 @@ var ElementSelector = ({
|
|
|
1115
1150
|
}, [active, handleMouseMove, handleClick]);
|
|
1116
1151
|
if (!active) return null;
|
|
1117
1152
|
return /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
1118
|
-
/* @__PURE__ */
|
|
1153
|
+
/* @__PURE__ */ jsx6(
|
|
1119
1154
|
"div",
|
|
1120
1155
|
{
|
|
1121
1156
|
ref: overlayRef,
|
|
@@ -1132,7 +1167,7 @@ var ElementSelector = ({
|
|
|
1132
1167
|
}
|
|
1133
1168
|
}
|
|
1134
1169
|
),
|
|
1135
|
-
highlightRect && /* @__PURE__ */
|
|
1170
|
+
highlightRect && /* @__PURE__ */ jsx6(
|
|
1136
1171
|
"div",
|
|
1137
1172
|
{
|
|
1138
1173
|
style: {
|
|
@@ -1150,7 +1185,7 @@ var ElementSelector = ({
|
|
|
1150
1185
|
}
|
|
1151
1186
|
}
|
|
1152
1187
|
),
|
|
1153
|
-
hoveredElement && highlightRect && /* @__PURE__ */
|
|
1188
|
+
hoveredElement && highlightRect && /* @__PURE__ */ jsx6(
|
|
1154
1189
|
"div",
|
|
1155
1190
|
{
|
|
1156
1191
|
style: {
|
|
@@ -1176,10 +1211,10 @@ var ElementSelector = ({
|
|
|
1176
1211
|
};
|
|
1177
1212
|
|
|
1178
1213
|
// src/hooks/use-element-selector.ts
|
|
1179
|
-
import { useState as
|
|
1214
|
+
import { useState as useState6, useCallback as useCallback2 } from "react";
|
|
1180
1215
|
function useElementSelector() {
|
|
1181
|
-
const [isSelecting, setIsSelecting] =
|
|
1182
|
-
const [selectedElement, setSelectedElement] =
|
|
1216
|
+
const [isSelecting, setIsSelecting] = useState6(false);
|
|
1217
|
+
const [selectedElement, setSelectedElement] = useState6(null);
|
|
1183
1218
|
const startSelecting = useCallback2(() => {
|
|
1184
1219
|
setIsSelecting(true);
|
|
1185
1220
|
}, []);
|
|
@@ -1207,9 +1242,9 @@ function sendElementSelectionToParent(data) {
|
|
|
1207
1242
|
}
|
|
1208
1243
|
|
|
1209
1244
|
// src/components/ElementSelectorProvider.tsx
|
|
1210
|
-
import { Fragment as Fragment2, jsx as
|
|
1245
|
+
import { Fragment as Fragment2, jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1211
1246
|
var ElementSelectorProvider = ({ children }) => {
|
|
1212
|
-
const [isSelecting, setIsSelecting] =
|
|
1247
|
+
const [isSelecting, setIsSelecting] = useState7(false);
|
|
1213
1248
|
const handleCancel = useCallback3(() => {
|
|
1214
1249
|
setIsSelecting(false);
|
|
1215
1250
|
if (window.parent && window.parent !== window) {
|
|
@@ -1221,7 +1256,7 @@ var ElementSelectorProvider = ({ children }) => {
|
|
|
1221
1256
|
const handleSelect = useCallback3((data) => {
|
|
1222
1257
|
sendElementSelectionToParent(data);
|
|
1223
1258
|
}, []);
|
|
1224
|
-
|
|
1259
|
+
useEffect6(() => {
|
|
1225
1260
|
const handleStartSelection = () => {
|
|
1226
1261
|
setIsSelecting(true);
|
|
1227
1262
|
};
|
|
@@ -1246,7 +1281,7 @@ var ElementSelectorProvider = ({ children }) => {
|
|
|
1246
1281
|
}, [handleCancel]);
|
|
1247
1282
|
return /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
1248
1283
|
children,
|
|
1249
|
-
/* @__PURE__ */
|
|
1284
|
+
/* @__PURE__ */ jsx7(
|
|
1250
1285
|
ElementSelector,
|
|
1251
1286
|
{
|
|
1252
1287
|
active: isSelecting,
|
|
@@ -1259,7 +1294,7 @@ var ElementSelectorProvider = ({ children }) => {
|
|
|
1259
1294
|
|
|
1260
1295
|
// src/components/auth/HowoneProvider.tsx
|
|
1261
1296
|
init_config();
|
|
1262
|
-
import { jsx as
|
|
1297
|
+
import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1263
1298
|
var HowoneContext = createContext2(null);
|
|
1264
1299
|
var consumedTokenCache = /* @__PURE__ */ new Set();
|
|
1265
1300
|
var redirectOverlayStylesInjected = false;
|
|
@@ -1321,10 +1356,10 @@ var HowOneProvider = ({
|
|
|
1321
1356
|
forceDefaultTheme = false,
|
|
1322
1357
|
redirectOnUnauthenticated = true
|
|
1323
1358
|
}) => {
|
|
1324
|
-
const [user, setUser] =
|
|
1325
|
-
const [token, setTokenState] =
|
|
1326
|
-
const [hasCheckedUrlToken, setHasCheckedUrlToken] =
|
|
1327
|
-
const [pendingRedirect, setPendingRedirect] =
|
|
1359
|
+
const [user, setUser] = useState8(() => parseUserFromToken(getToken()));
|
|
1360
|
+
const [token, setTokenState] = useState8(() => getToken());
|
|
1361
|
+
const [hasCheckedUrlToken, setHasCheckedUrlToken] = useState8(false);
|
|
1362
|
+
const [pendingRedirect, setPendingRedirect] = useState8(false);
|
|
1328
1363
|
const authCookieRoot = useMemo(() => {
|
|
1329
1364
|
const env3 = getGlobalEnvironment() ?? "dev";
|
|
1330
1365
|
return setEnvironment(env3).AUTH_COOKIE_ROOT_VALUE;
|
|
@@ -1382,7 +1417,7 @@ var HowOneProvider = ({
|
|
|
1382
1417
|
}
|
|
1383
1418
|
return null;
|
|
1384
1419
|
}, []);
|
|
1385
|
-
|
|
1420
|
+
useEffect7(() => {
|
|
1386
1421
|
try {
|
|
1387
1422
|
const params = new URLSearchParams(window.location.search);
|
|
1388
1423
|
let urlToken = params.get("access_token") || params.get("token");
|
|
@@ -1428,7 +1463,7 @@ var HowOneProvider = ({
|
|
|
1428
1463
|
return "https://howone.dev/auth";
|
|
1429
1464
|
}
|
|
1430
1465
|
}, []);
|
|
1431
|
-
|
|
1466
|
+
useEffect7(() => {
|
|
1432
1467
|
if (pendingRedirect) {
|
|
1433
1468
|
injectRedirectOverlayStyles();
|
|
1434
1469
|
}
|
|
@@ -1475,7 +1510,7 @@ var HowOneProvider = ({
|
|
|
1475
1510
|
navigateToResolvedAuth();
|
|
1476
1511
|
}
|
|
1477
1512
|
}, [redirectOnUnauthenticated, resolvedAuthUrl, projectId]);
|
|
1478
|
-
|
|
1513
|
+
useEffect7(() => {
|
|
1479
1514
|
if (!hasCheckedUrlToken) return;
|
|
1480
1515
|
if (!token && !user) {
|
|
1481
1516
|
redirectToAuth();
|
|
@@ -1505,24 +1540,24 @@ var HowOneProvider = ({
|
|
|
1505
1540
|
storageKey: themeStorageKey,
|
|
1506
1541
|
forceDefault: forceDefaultTheme,
|
|
1507
1542
|
children: [
|
|
1508
|
-
/* @__PURE__ */
|
|
1543
|
+
/* @__PURE__ */ jsx8(ElementSelectorProvider, { children: /* @__PURE__ */ jsxs5(HowoneContext.Provider, { value, children: [
|
|
1509
1544
|
children,
|
|
1510
|
-
showHowOneFlag && /* @__PURE__ */
|
|
1511
|
-
pendingRedirect && /* @__PURE__ */
|
|
1545
|
+
showHowOneFlag && /* @__PURE__ */ jsx8(FloatingButton, { onClick: () => window.open("https://howone.ai", "_blank") }),
|
|
1546
|
+
pendingRedirect && /* @__PURE__ */ jsx8(
|
|
1512
1547
|
"div",
|
|
1513
1548
|
{
|
|
1514
1549
|
"data-howone-auth-overlay-root": true,
|
|
1515
1550
|
className: "fixed inset-0 z-[100000] h-full w-full flex flex-col items-center justify-center bg-black/65 backdrop-blur-sm text-white",
|
|
1516
1551
|
children: /* @__PURE__ */ jsxs5("div", { className: "relative mt-6 flex h-[220px] w-[220px] items-center justify-center", children: [
|
|
1517
|
-
/* @__PURE__ */
|
|
1552
|
+
/* @__PURE__ */ jsx8(
|
|
1518
1553
|
"div",
|
|
1519
1554
|
{
|
|
1520
1555
|
className: "absolute inset-0 rounded-full bg-white/20",
|
|
1521
1556
|
style: { animation: "howone-glow-ring 2.4s ease-in-out infinite" }
|
|
1522
1557
|
}
|
|
1523
1558
|
),
|
|
1524
|
-
/* @__PURE__ */
|
|
1525
|
-
/* @__PURE__ */
|
|
1559
|
+
/* @__PURE__ */ jsx8("div", { className: "absolute inset-0 rounded-full bg-gradient-to-br from-white/10 via-white/25 to-white/10 blur-2xl" }),
|
|
1560
|
+
/* @__PURE__ */ jsx8(
|
|
1526
1561
|
"img",
|
|
1527
1562
|
{
|
|
1528
1563
|
style: { width: 250, animation: "howone-logo-pulse 2s ease-in-out infinite" },
|
|
@@ -1534,7 +1569,7 @@ var HowOneProvider = ({
|
|
|
1534
1569
|
}
|
|
1535
1570
|
)
|
|
1536
1571
|
] }) }),
|
|
1537
|
-
/* @__PURE__ */
|
|
1572
|
+
/* @__PURE__ */ jsx8(GlobalToastContainer, {})
|
|
1538
1573
|
]
|
|
1539
1574
|
}
|
|
1540
1575
|
);
|
|
@@ -1644,7 +1679,7 @@ var howone = {
|
|
|
1644
1679
|
var client_default = howone;
|
|
1645
1680
|
|
|
1646
1681
|
// src/components/ui/Loading.tsx
|
|
1647
|
-
import { jsx as
|
|
1682
|
+
import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1648
1683
|
var Loading = ({
|
|
1649
1684
|
size = "md",
|
|
1650
1685
|
text = "Loading...",
|
|
@@ -1657,14 +1692,14 @@ var Loading = ({
|
|
|
1657
1692
|
lg: "h-12 w-12"
|
|
1658
1693
|
};
|
|
1659
1694
|
const containerClasses = fullScreen ? "fixed inset-0 flex items-center justify-center bg-white/80 backdrop-blur-sm z-50" : "flex items-center justify-center p-4";
|
|
1660
|
-
return /* @__PURE__ */
|
|
1661
|
-
/* @__PURE__ */
|
|
1695
|
+
return /* @__PURE__ */ jsx9("div", { className: `${containerClasses} ${className}`, children: /* @__PURE__ */ jsxs6("div", { className: "text-center", children: [
|
|
1696
|
+
/* @__PURE__ */ jsx9(
|
|
1662
1697
|
"div",
|
|
1663
1698
|
{
|
|
1664
1699
|
className: `animate-spin rounded-full border-2 border-gray-300 border-t-blue-600 mx-auto ${sizeClasses[size]}`
|
|
1665
1700
|
}
|
|
1666
1701
|
),
|
|
1667
|
-
text && /* @__PURE__ */
|
|
1702
|
+
text && /* @__PURE__ */ jsx9("p", { className: "mt-2 text-sm text-gray-600", children: text })
|
|
1668
1703
|
] }) });
|
|
1669
1704
|
};
|
|
1670
1705
|
var LoadingSpinner = ({
|
|
@@ -1676,7 +1711,7 @@ var LoadingSpinner = ({
|
|
|
1676
1711
|
md: "h-8 w-8",
|
|
1677
1712
|
lg: "h-12 w-12"
|
|
1678
1713
|
};
|
|
1679
|
-
return /* @__PURE__ */
|
|
1714
|
+
return /* @__PURE__ */ jsx9(
|
|
1680
1715
|
"div",
|
|
1681
1716
|
{
|
|
1682
1717
|
className: `animate-spin rounded-full border-2 border-gray-300 border-t-blue-600 ${sizeClasses[size]} ${className}`
|
|
@@ -1686,7 +1721,7 @@ var LoadingSpinner = ({
|
|
|
1686
1721
|
|
|
1687
1722
|
// src/components/ui/ErrorBoundary.tsx
|
|
1688
1723
|
import { Component } from "react";
|
|
1689
|
-
import { jsx as
|
|
1724
|
+
import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1690
1725
|
var ErrorBoundary = class extends Component {
|
|
1691
1726
|
constructor(props) {
|
|
1692
1727
|
super(props);
|
|
@@ -1709,13 +1744,13 @@ var ErrorBoundary = class extends Component {
|
|
|
1709
1744
|
if (this.state.hasError) {
|
|
1710
1745
|
if (this.props.fallback) {
|
|
1711
1746
|
const FallbackComponent = this.props.fallback;
|
|
1712
|
-
return /* @__PURE__ */
|
|
1747
|
+
return /* @__PURE__ */ jsx10(FallbackComponent, { error: this.state.error, retry: this.handleRetry });
|
|
1713
1748
|
}
|
|
1714
|
-
return /* @__PURE__ */
|
|
1715
|
-
/* @__PURE__ */
|
|
1716
|
-
/* @__PURE__ */
|
|
1717
|
-
/* @__PURE__ */
|
|
1718
|
-
/* @__PURE__ */
|
|
1749
|
+
return /* @__PURE__ */ jsx10("div", { className: "min-h-[400px] flex items-center justify-center p-4", children: /* @__PURE__ */ jsxs7("div", { className: "text-center max-w-md", children: [
|
|
1750
|
+
/* @__PURE__ */ jsx10("div", { className: "text-red-500 text-6xl mb-4", children: "\u26A0\uFE0F" }),
|
|
1751
|
+
/* @__PURE__ */ jsx10("h2", { className: "text-xl font-semibold text-gray-900 mb-2", children: "Something went wrong" }),
|
|
1752
|
+
/* @__PURE__ */ jsx10("p", { className: "text-gray-600 mb-4", children: "An unexpected error occurred. Please try refreshing the page." }),
|
|
1753
|
+
/* @__PURE__ */ jsx10(
|
|
1719
1754
|
"button",
|
|
1720
1755
|
{
|
|
1721
1756
|
onClick: this.handleRetry,
|
|
@@ -1729,10 +1764,10 @@ var ErrorBoundary = class extends Component {
|
|
|
1729
1764
|
return this.props.children;
|
|
1730
1765
|
}
|
|
1731
1766
|
};
|
|
1732
|
-
var DefaultErrorFallback = ({ retry }) => /* @__PURE__ */
|
|
1733
|
-
/* @__PURE__ */
|
|
1734
|
-
/* @__PURE__ */
|
|
1735
|
-
retry && /* @__PURE__ */
|
|
1767
|
+
var DefaultErrorFallback = ({ retry }) => /* @__PURE__ */ jsx10("div", { className: "min-h-[200px] flex items-center justify-center p-4", children: /* @__PURE__ */ jsxs7("div", { className: "text-center", children: [
|
|
1768
|
+
/* @__PURE__ */ jsx10("div", { className: "text-red-500 text-4xl mb-2", children: "\u26A0\uFE0F" }),
|
|
1769
|
+
/* @__PURE__ */ jsx10("p", { className: "text-gray-600 mb-2", children: "Something went wrong" }),
|
|
1770
|
+
retry && /* @__PURE__ */ jsx10(
|
|
1736
1771
|
"button",
|
|
1737
1772
|
{
|
|
1738
1773
|
onClick: retry,
|
|
@@ -1743,7 +1778,7 @@ var DefaultErrorFallback = ({ retry }) => /* @__PURE__ */ jsx9("div", { classNam
|
|
|
1743
1778
|
] }) });
|
|
1744
1779
|
|
|
1745
1780
|
// src/components/ui/ClayxButton.tsx
|
|
1746
|
-
import { jsx as
|
|
1781
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
1747
1782
|
var getSizeClasses = (size, isIconOnly) => {
|
|
1748
1783
|
if (isIconOnly) {
|
|
1749
1784
|
switch (size) {
|
|
@@ -1799,7 +1834,7 @@ var ClayxButton = ({
|
|
|
1799
1834
|
disabled:opacity-50 disabled:cursor-not-allowed disabled:pointer-events-none
|
|
1800
1835
|
`.replace(/\s+/g, " ").trim();
|
|
1801
1836
|
const combinedClasses = `${baseClasses} ${sizeClasses} ${variantClasses} ${className}`.trim();
|
|
1802
|
-
return /* @__PURE__ */
|
|
1837
|
+
return /* @__PURE__ */ jsx11(
|
|
1803
1838
|
"button",
|
|
1804
1839
|
{
|
|
1805
1840
|
className: combinedClasses,
|
|
@@ -1811,349 +1846,38 @@ var ClayxButton = ({
|
|
|
1811
1846
|
};
|
|
1812
1847
|
|
|
1813
1848
|
// src/components/ui/LimitUpgradeToast.tsx
|
|
1814
|
-
import
|
|
1815
|
-
import { Icon as Icon5 } from "@iconify/react";
|
|
1816
|
-
|
|
1817
|
-
// src/components/ui/Toast/ClayxToast.tsx
|
|
1818
|
-
import React7, { useCallback as useCallback5 } from "react";
|
|
1819
|
-
import { Bounce, toast } from "react-toastify";
|
|
1849
|
+
import React7 from "react";
|
|
1820
1850
|
import { Icon as Icon4 } from "@iconify/react";
|
|
1821
1851
|
|
|
1822
|
-
// src/components/
|
|
1823
|
-
import
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
const [mounted, setMounted] = React6.useState(false);
|
|
1829
|
-
React6.useEffect(() => {
|
|
1830
|
-
setMounted(true);
|
|
1831
|
-
}, []);
|
|
1832
|
-
const handleToggle = () => {
|
|
1833
|
-
if (theme === "dark") {
|
|
1834
|
-
setTheme("light");
|
|
1835
|
-
} else {
|
|
1836
|
-
setTheme("dark");
|
|
1837
|
-
}
|
|
1838
|
-
};
|
|
1839
|
-
if (!mounted) {
|
|
1840
|
-
return /* @__PURE__ */ jsx11(Icon3, { icon: "solar:sun-bold", width: 20, height: 20 });
|
|
1841
|
-
}
|
|
1842
|
-
return /* @__PURE__ */ jsx11(
|
|
1843
|
-
"div",
|
|
1844
|
-
{
|
|
1845
|
-
className: `cursor-pointer ${className || ""}`,
|
|
1846
|
-
onClick: handleToggle,
|
|
1847
|
-
children: theme === "light" ? /* @__PURE__ */ jsx11(Icon3, { icon: "solar:sun-bold", width: 20, height: 20 }) : /* @__PURE__ */ jsx11(Icon3, { icon: "solar:moon-linear", width: 20, height: 20 })
|
|
1848
|
-
}
|
|
1849
|
-
);
|
|
1850
|
-
}
|
|
1851
|
-
|
|
1852
|
-
// src/components/ui/Toast/ClayxToast.tsx
|
|
1853
|
-
import { jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1854
|
-
var TOAST_ICONS = {
|
|
1855
|
-
success: {
|
|
1856
|
-
icon: "mdi:success",
|
|
1857
|
-
color: "text-green-400",
|
|
1858
|
-
className: "text-green-400",
|
|
1859
|
-
// 深色主题配置
|
|
1860
|
-
dark: {
|
|
1861
|
-
bgGradient: "bg-[#14181d]",
|
|
1862
|
-
// 移除透明度 f2
|
|
1863
|
-
gradientColor: "#389726",
|
|
1864
|
-
borderGradient: "border-[#389726]",
|
|
1865
|
-
borderGradientColor: "#389726"
|
|
1866
|
-
},
|
|
1867
|
-
// 浅色主题配置
|
|
1868
|
-
light: {
|
|
1869
|
-
bgGradient: "bg-[#fafafa]",
|
|
1870
|
-
// 移除透明度 ff
|
|
1871
|
-
gradientColor: "#22c55e",
|
|
1872
|
-
borderGradient: "border-[#22c55e]",
|
|
1873
|
-
borderGradientColor: "#22c55e"
|
|
1874
|
-
}
|
|
1875
|
-
},
|
|
1876
|
-
error: {
|
|
1877
|
-
icon: "ic:outline-close",
|
|
1878
|
-
color: "text-red-400",
|
|
1879
|
-
className: "text-red-400",
|
|
1880
|
-
dark: {
|
|
1881
|
-
bgGradient: "bg-[#14181d]",
|
|
1882
|
-
// 移除透明度 f2
|
|
1883
|
-
gradientColor: "#ef4444",
|
|
1884
|
-
borderGradient: "border-[#ef4444]",
|
|
1885
|
-
borderGradientColor: "#ef4444"
|
|
1886
|
-
},
|
|
1887
|
-
light: {
|
|
1888
|
-
bgGradient: "bg-[#fafafa]",
|
|
1889
|
-
// 移除透明度 ff
|
|
1890
|
-
gradientColor: "#f87171",
|
|
1891
|
-
borderGradient: "border-[#f87171]",
|
|
1892
|
-
borderGradientColor: "#f87171"
|
|
1893
|
-
}
|
|
1894
|
-
},
|
|
1895
|
-
warning: {
|
|
1896
|
-
icon: "mi:warning",
|
|
1897
|
-
color: "text-yellow-400",
|
|
1898
|
-
className: "text-yellow-400",
|
|
1899
|
-
dark: {
|
|
1900
|
-
bgGradient: "bg-[#14181d]",
|
|
1901
|
-
// 移除透明度 f2
|
|
1902
|
-
gradientColor: "#facc15",
|
|
1903
|
-
borderGradient: "border-[#facc15]",
|
|
1904
|
-
borderGradientColor: "#facc15"
|
|
1905
|
-
},
|
|
1906
|
-
light: {
|
|
1907
|
-
bgGradient: "bg-[#fafafa]",
|
|
1908
|
-
// 移除透明度 ff
|
|
1909
|
-
gradientColor: "#f59e0b",
|
|
1910
|
-
borderGradient: "border-[#f59e0b]",
|
|
1911
|
-
borderGradientColor: "#f59e0b"
|
|
1912
|
-
}
|
|
1913
|
-
},
|
|
1914
|
-
info: {
|
|
1915
|
-
icon: "ic:outline-info",
|
|
1916
|
-
color: "text-blue-400",
|
|
1917
|
-
className: "text-blue-400",
|
|
1918
|
-
dark: {
|
|
1919
|
-
bgGradient: "bg-[#14181d]",
|
|
1920
|
-
// 移除透明度 f2
|
|
1921
|
-
gradientColor: "#60a5fa",
|
|
1922
|
-
borderGradient: "border-[#60a5fa]",
|
|
1923
|
-
borderGradientColor: "#f0f0f0"
|
|
1924
|
-
},
|
|
1925
|
-
light: {
|
|
1926
|
-
bgGradient: "bg-[#fafafa]",
|
|
1927
|
-
// 移除透明度 ff
|
|
1928
|
-
gradientColor: "#3b82f6",
|
|
1929
|
-
borderGradient: "border-[#3b82f6]",
|
|
1930
|
-
borderGradientColor: "#3b82f6"
|
|
1931
|
-
}
|
|
1932
|
-
},
|
|
1933
|
-
default: {
|
|
1934
|
-
icon: "ic:round-notifications",
|
|
1935
|
-
color: "text-gray-400",
|
|
1936
|
-
className: "text-gray-400",
|
|
1937
|
-
dark: {
|
|
1938
|
-
bgGradient: "bg-[#14181d]",
|
|
1939
|
-
// 移除透明度 f2
|
|
1940
|
-
gradientColor: "#9ca3af",
|
|
1941
|
-
borderGradient: "border-[#9ca3af]",
|
|
1942
|
-
borderGradientColor: "#9ca3af"
|
|
1943
|
-
},
|
|
1944
|
-
light: {
|
|
1945
|
-
bgGradient: "bg-[#fafafa]",
|
|
1946
|
-
// 移除透明度 ff
|
|
1947
|
-
gradientColor: "#6b7280",
|
|
1948
|
-
borderGradient: "border-[#6b7280]",
|
|
1949
|
-
borderGradientColor: "#6b7280"
|
|
1950
|
-
}
|
|
1951
|
-
}
|
|
1952
|
-
};
|
|
1953
|
-
var CloseButton = React7.memo(({ closeToast }) => {
|
|
1954
|
-
const { theme } = useTheme();
|
|
1955
|
-
const handleClick = useCallback5((e) => {
|
|
1956
|
-
e.preventDefault();
|
|
1957
|
-
e.stopPropagation();
|
|
1958
|
-
closeToast?.();
|
|
1959
|
-
}, [closeToast]);
|
|
1960
|
-
const getCloseButtonColor = () => {
|
|
1961
|
-
const actualTheme = theme === "system" ? window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" : theme;
|
|
1962
|
-
return actualTheme === "dark" ? "#b4b4b4" : "#6b7280";
|
|
1963
|
-
};
|
|
1964
|
-
const getCloseButtonHoverColor = () => {
|
|
1965
|
-
const actualTheme = theme === "system" ? window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" : theme;
|
|
1966
|
-
return actualTheme === "dark" ? "white" : "#374151";
|
|
1967
|
-
};
|
|
1968
|
-
return /* @__PURE__ */ jsx12(
|
|
1969
|
-
Icon4,
|
|
1970
|
-
{
|
|
1971
|
-
icon: "vaadin:close",
|
|
1972
|
-
className: "flex items-center justify-center rounded-full relative z-10 flex-shrink-0 cursor-pointer \n transition-colors duration-200 drop-shadow-sm",
|
|
1973
|
-
onClick: handleClick,
|
|
1974
|
-
width: 14,
|
|
1975
|
-
height: 14,
|
|
1976
|
-
style: {
|
|
1977
|
-
color: getCloseButtonColor()
|
|
1978
|
-
},
|
|
1979
|
-
onMouseEnter: (e) => {
|
|
1980
|
-
e.currentTarget.style.color = getCloseButtonHoverColor();
|
|
1981
|
-
},
|
|
1982
|
-
onMouseLeave: (e) => {
|
|
1983
|
-
e.currentTarget.style.color = getCloseButtonColor();
|
|
1984
|
-
}
|
|
1985
|
-
}
|
|
1986
|
-
);
|
|
1987
|
-
});
|
|
1988
|
-
CloseButton.displayName = "CloseButton";
|
|
1989
|
-
var ToastContent = ({ type, title, message, component, closeToast }) => {
|
|
1990
|
-
const iconConfig = TOAST_ICONS[type];
|
|
1991
|
-
const { theme } = useTheme();
|
|
1992
|
-
const handleClose = useCallback5(() => {
|
|
1993
|
-
closeToast?.();
|
|
1994
|
-
}, [closeToast]);
|
|
1995
|
-
const getTextColor = () => {
|
|
1996
|
-
const actualTheme = theme === "system" ? window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" : theme;
|
|
1997
|
-
return actualTheme === "dark" ? "white" : "#1f2937";
|
|
1998
|
-
};
|
|
1999
|
-
const getThemeConfig = () => {
|
|
2000
|
-
const actualTheme = theme === "system" ? window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" : theme;
|
|
2001
|
-
return actualTheme === "dark" ? iconConfig.dark : iconConfig.light;
|
|
2002
|
-
};
|
|
2003
|
-
const themeConfig = getThemeConfig();
|
|
2004
|
-
const lightBaseBackgroundByType = {
|
|
2005
|
-
success: "#f0fdf4",
|
|
2006
|
-
// green-50
|
|
2007
|
-
error: "#fef2f2",
|
|
2008
|
-
// red-50
|
|
2009
|
-
warning: "#fffbeb",
|
|
2010
|
-
// amber-50
|
|
2011
|
-
info: "#eff6ff",
|
|
2012
|
-
// blue-50
|
|
2013
|
-
default: "#f9fafb"
|
|
2014
|
-
// gray-50
|
|
2015
|
-
};
|
|
2016
|
-
if (component) {
|
|
2017
|
-
return /* @__PURE__ */ jsxs8("div", { className: `flex items-start gap-3 !min-h-[90px] w-full backdrop-blur-md p-4 shadow-2xl overflow-hidden ${themeConfig.bgGradient}`, children: [
|
|
2018
|
-
/* @__PURE__ */ jsx12("div", { className: "flex-1 relative z-10", children: component }),
|
|
2019
|
-
/* @__PURE__ */ jsx12("div", { className: "relative z-10", children: /* @__PURE__ */ jsx12(CloseButton, { closeToast: handleClose }) })
|
|
2020
|
-
] });
|
|
2021
|
-
}
|
|
2022
|
-
return /* @__PURE__ */ jsxs8("div", { className: `flex items-start gap-3 !min-h-[90px] w-full backdrop-blur-md p-4 shadow-2xl relative overflow-hidden ${themeConfig.bgGradient}`, children: [
|
|
2023
|
-
/* @__PURE__ */ jsx12(
|
|
2024
|
-
"div",
|
|
2025
|
-
{
|
|
2026
|
-
className: "absolute left-0 top-0 w-full h-full rounded-xl",
|
|
2027
|
-
style: {
|
|
2028
|
-
background: theme === "dark" || theme === "system" && window.matchMedia("(prefers-color-scheme: dark)").matches ? "#0f1419" : lightBaseBackgroundByType[type],
|
|
2029
|
-
zIndex: -2
|
|
2030
|
-
}
|
|
2031
|
-
}
|
|
2032
|
-
),
|
|
2033
|
-
/* @__PURE__ */ jsx12(
|
|
2034
|
-
"div",
|
|
2035
|
-
{
|
|
2036
|
-
className: "absolute left-0 top-0 w-full h-full pointer-events-none rounded-xl",
|
|
2037
|
-
style: {
|
|
2038
|
-
background: theme === "dark" || theme === "system" && window.matchMedia("(prefers-color-scheme: dark)").matches ? `linear-gradient(135deg, ${themeConfig.gradientColor}30 0%, ${themeConfig.gradientColor}20 15%, #14181df2 30%)` : `linear-gradient(135deg, ${themeConfig.gradientColor}20 0%, ${themeConfig.gradientColor}12 15%, #ffffff 30%)`,
|
|
2039
|
-
zIndex: -1
|
|
2040
|
-
}
|
|
2041
|
-
}
|
|
2042
|
-
),
|
|
2043
|
-
/* @__PURE__ */ jsx12(
|
|
2044
|
-
"div",
|
|
2045
|
-
{
|
|
2046
|
-
className: "absolute left-0 top-0 w-full h-full pointer-events-none rounded-xl",
|
|
2047
|
-
style: {
|
|
2048
|
-
border: "2px solid transparent",
|
|
2049
|
-
backgroundImage: theme === "dark" || theme === "system" && window.matchMedia("(prefers-color-scheme: dark)").matches ? `linear-gradient(135deg, ${themeConfig.borderGradientColor}60 0%, ${themeConfig.borderGradientColor}40 5%, transparent 22%)` : `linear-gradient(135deg, ${themeConfig.borderGradientColor}99 0%, ${themeConfig.borderGradientColor}66 5%, transparent 22%)`,
|
|
2050
|
-
backgroundOrigin: "border-box",
|
|
2051
|
-
backgroundClip: "border-box",
|
|
2052
|
-
WebkitMask: "linear-gradient(#ffffff 0 0) padding-box, linear-gradient(#ffffff 0 0)",
|
|
2053
|
-
WebkitMaskComposite: "xor",
|
|
2054
|
-
zIndex: 0
|
|
2055
|
-
}
|
|
2056
|
-
}
|
|
2057
|
-
),
|
|
2058
|
-
/* @__PURE__ */ jsx12("div", { className: "flex-shrink-0 flex-grow-0 mt-0.5 relative z-10", children: /* @__PURE__ */ jsx12(
|
|
2059
|
-
"div",
|
|
2060
|
-
{
|
|
2061
|
-
className: "backdrop-blur-sm rounded-full flex items-center justify-center overflow-hidden flex-shrink-0 flex-grow-0",
|
|
2062
|
-
style: {
|
|
2063
|
-
backgroundColor: theme === "dark" || theme === "system" && window.matchMedia("(prefers-color-scheme: dark)").matches ? "rgba(255, 255, 255, 0.1)" : "rgba(0, 0, 0, 0.05)",
|
|
2064
|
-
width: "28px",
|
|
2065
|
-
height: "28px"
|
|
2066
|
-
},
|
|
2067
|
-
children: /* @__PURE__ */ jsx12("div", { className: "rounded-full flex items-center justify-center", children: /* @__PURE__ */ jsx12(
|
|
2068
|
-
Icon4,
|
|
2069
|
-
{
|
|
2070
|
-
icon: iconConfig.icon,
|
|
2071
|
-
width: 16,
|
|
2072
|
-
height: 16,
|
|
2073
|
-
className: `flex-shrink-0`,
|
|
2074
|
-
style: {
|
|
2075
|
-
color: themeConfig.gradientColor,
|
|
2076
|
-
display: "block"
|
|
2077
|
-
}
|
|
2078
|
-
}
|
|
2079
|
-
) })
|
|
2080
|
-
}
|
|
2081
|
-
) }),
|
|
2082
|
-
/* @__PURE__ */ jsxs8("div", { className: "flex flex-col gap-1 flex-1 relative z-10", children: [
|
|
2083
|
-
title && /* @__PURE__ */ jsx12(
|
|
2084
|
-
"div",
|
|
2085
|
-
{
|
|
2086
|
-
className: "text-[16px] font-semibold leading-tight drop-shadow-sm",
|
|
2087
|
-
style: {
|
|
2088
|
-
color: getTextColor(),
|
|
2089
|
-
backgroundClip: "text"
|
|
2090
|
-
},
|
|
2091
|
-
children: title
|
|
2092
|
-
}
|
|
2093
|
-
),
|
|
2094
|
-
message && /* @__PURE__ */ jsx12(
|
|
2095
|
-
"div",
|
|
2096
|
-
{
|
|
2097
|
-
className: "text-[13px] font-normal leading-relaxed drop-shadow-sm",
|
|
2098
|
-
style: {
|
|
2099
|
-
color: getTextColor(),
|
|
2100
|
-
backgroundClip: "text"
|
|
2101
|
-
},
|
|
2102
|
-
children: message
|
|
2103
|
-
}
|
|
2104
|
-
)
|
|
2105
|
-
] }),
|
|
2106
|
-
/* @__PURE__ */ jsx12("div", { className: "relative z-10", children: /* @__PURE__ */ jsx12(CloseButton, { closeToast: handleClose }) })
|
|
2107
|
-
] });
|
|
2108
|
-
};
|
|
2109
|
-
var defaultToastOptions = {
|
|
2110
|
-
position: "bottom-right",
|
|
2111
|
-
autoClose: 1500,
|
|
2112
|
-
hideProgressBar: true,
|
|
2113
|
-
closeOnClick: false,
|
|
2114
|
-
pauseOnHover: true,
|
|
2115
|
-
draggable: true,
|
|
2116
|
-
pauseOnFocusLoss: false,
|
|
2117
|
-
transition: Bounce
|
|
2118
|
-
};
|
|
2119
|
-
var getToastifyTheme = () => {
|
|
2120
|
-
if (typeof window !== "undefined") {
|
|
2121
|
-
const root = document.documentElement;
|
|
2122
|
-
if (root.classList.contains("dark")) return "dark";
|
|
2123
|
-
if (root.classList.contains("light")) return "light";
|
|
2124
|
-
return window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
2125
|
-
}
|
|
2126
|
-
return "light";
|
|
1852
|
+
// src/components/ui/Toast/GoeyToast.tsx
|
|
1853
|
+
import { goeyToast } from "goey-toast";
|
|
1854
|
+
var resolveDuration = (autoClose) => {
|
|
1855
|
+
if (typeof autoClose === "number") return autoClose;
|
|
1856
|
+
if (autoClose === false) return 24 * 60 * 60 * 1e3;
|
|
1857
|
+
return void 0;
|
|
2127
1858
|
};
|
|
2128
1859
|
var createToast = (type) => {
|
|
2129
1860
|
return (params) => {
|
|
2130
|
-
const {
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
...options,
|
|
2148
|
-
theme: getToastifyTheme(),
|
|
2149
|
-
// 确保圆角样式不被覆盖,添加 rounded-xl 类
|
|
2150
|
-
className: "!p-0 !shadow-none !rounded-xl",
|
|
2151
|
-
style: { padding: 0, borderRadius: "0.75rem", backgroundColor: "transparent" }
|
|
2152
|
-
}
|
|
2153
|
-
);
|
|
1861
|
+
const { autoClose, ...rawOptions } = params.options ?? {};
|
|
1862
|
+
const id = params.options?.id ?? `goey-${Date.now()}-${Math.random()}`;
|
|
1863
|
+
const closeToast = () => goeyToast.dismiss(id);
|
|
1864
|
+
const description = params.component ?? (params.render ? params.render(closeToast) : params.message);
|
|
1865
|
+
const duration = resolveDuration(autoClose);
|
|
1866
|
+
const goeyOptions = {
|
|
1867
|
+
...rawOptions,
|
|
1868
|
+
id,
|
|
1869
|
+
description,
|
|
1870
|
+
...duration !== void 0 ? { duration } : {}
|
|
1871
|
+
};
|
|
1872
|
+
const title = params.title ?? "";
|
|
1873
|
+
if (type === "default") {
|
|
1874
|
+
goeyToast(title, goeyOptions);
|
|
1875
|
+
return;
|
|
1876
|
+
}
|
|
1877
|
+
goeyToast[type](title, goeyOptions);
|
|
2154
1878
|
};
|
|
2155
1879
|
};
|
|
2156
|
-
var
|
|
1880
|
+
var GoeyToast = {
|
|
2157
1881
|
success: createToast("success"),
|
|
2158
1882
|
error: createToast("error"),
|
|
2159
1883
|
warning: createToast("warning"),
|
|
@@ -2162,12 +1886,12 @@ var ClayxToast = {
|
|
|
2162
1886
|
};
|
|
2163
1887
|
|
|
2164
1888
|
// src/components/ui/LimitUpgradeToast.tsx
|
|
2165
|
-
import { jsx as
|
|
1889
|
+
import { jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2166
1890
|
var LimitToastContainer = ({ message, onUpgrade, closeToast }) => {
|
|
2167
|
-
const [hover, setHover] =
|
|
2168
|
-
const [closeHover, setCloseHover] =
|
|
2169
|
-
return /* @__PURE__ */
|
|
2170
|
-
/* @__PURE__ */
|
|
1891
|
+
const [hover, setHover] = React7.useState(false);
|
|
1892
|
+
const [closeHover, setCloseHover] = React7.useState(false);
|
|
1893
|
+
return /* @__PURE__ */ jsxs8("div", { className: "relative w-full max-w-[420px] overflow-hidden rounded-md bg-gradient-to-br from-[#1A1A1A] via-[#151515] to-[#1A1A1A] shadow-[0_20px_60px_rgba(168,85,247,0.2)] backdrop-blur-sm", children: [
|
|
1894
|
+
/* @__PURE__ */ jsx12(
|
|
2171
1895
|
"div",
|
|
2172
1896
|
{
|
|
2173
1897
|
className: "absolute left-0 top-0 w-full h-full rounded-md",
|
|
@@ -2177,7 +1901,7 @@ var LimitToastContainer = ({ message, onUpgrade, closeToast }) => {
|
|
|
2177
1901
|
}
|
|
2178
1902
|
}
|
|
2179
1903
|
),
|
|
2180
|
-
/* @__PURE__ */
|
|
1904
|
+
/* @__PURE__ */ jsx12(
|
|
2181
1905
|
"div",
|
|
2182
1906
|
{
|
|
2183
1907
|
className: "absolute left-0 top-0 w-full h-full pointer-events-none rounded-md",
|
|
@@ -2187,7 +1911,7 @@ var LimitToastContainer = ({ message, onUpgrade, closeToast }) => {
|
|
|
2187
1911
|
}
|
|
2188
1912
|
}
|
|
2189
1913
|
),
|
|
2190
|
-
/* @__PURE__ */
|
|
1914
|
+
/* @__PURE__ */ jsx12(
|
|
2191
1915
|
"div",
|
|
2192
1916
|
{
|
|
2193
1917
|
className: "absolute left-0 top-0 w-full h-full pointer-events-none rounded-md",
|
|
@@ -2203,15 +1927,15 @@ var LimitToastContainer = ({ message, onUpgrade, closeToast }) => {
|
|
|
2203
1927
|
}
|
|
2204
1928
|
}
|
|
2205
1929
|
),
|
|
2206
|
-
/* @__PURE__ */
|
|
2207
|
-
/* @__PURE__ */
|
|
2208
|
-
/* @__PURE__ */
|
|
2209
|
-
/* @__PURE__ */
|
|
2210
|
-
/* @__PURE__ */
|
|
2211
|
-
/* @__PURE__ */
|
|
2212
|
-
/* @__PURE__ */
|
|
1930
|
+
/* @__PURE__ */ jsx12("div", { className: "absolute -top-16 -right-16 h-32 w-32 rounded-full bg-gradient-to-br from-purple-500/20 via-pink-500/10 to-transparent blur-3xl animate-pulse" }),
|
|
1931
|
+
/* @__PURE__ */ jsx12("div", { className: "absolute -bottom-16 -left-16 h-32 w-32 rounded-full bg-gradient-to-tr from-blue-500/10 to-transparent blur-2xl animate-pulse", style: { animationDelay: "1s" } }),
|
|
1932
|
+
/* @__PURE__ */ jsx12("div", { className: "relative z-10 flex items-start gap-4 p-4", children: /* @__PURE__ */ jsxs8("div", { className: "flex flex-1 flex-col gap-3", children: [
|
|
1933
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex items-center justify-between", children: [
|
|
1934
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-2", children: [
|
|
1935
|
+
/* @__PURE__ */ jsx12("div", { className: "text-lg font-bold text-white", children: "Upgrade Required" }),
|
|
1936
|
+
/* @__PURE__ */ jsx12("div", { className: "px-2 py-0.5 text-xs font-bold bg-purple-500/20 text-purple-400 rounded-md border border-purple-500/30", children: "Premium" })
|
|
2213
1937
|
] }),
|
|
2214
|
-
/* @__PURE__ */
|
|
1938
|
+
/* @__PURE__ */ jsx12(
|
|
2215
1939
|
ClayxButton,
|
|
2216
1940
|
{
|
|
2217
1941
|
onClick: closeToast,
|
|
@@ -2228,12 +1952,12 @@ var LimitToastContainer = ({ message, onUpgrade, closeToast }) => {
|
|
|
2228
1952
|
transition: "background-color 150ms ease",
|
|
2229
1953
|
cursor: "pointer"
|
|
2230
1954
|
},
|
|
2231
|
-
children: /* @__PURE__ */
|
|
1955
|
+
children: /* @__PURE__ */ jsx12(Icon4, { icon: "iconamoon:close", className: "w-4 h-4 text-gray-400" })
|
|
2232
1956
|
}
|
|
2233
1957
|
)
|
|
2234
1958
|
] }),
|
|
2235
|
-
/* @__PURE__ */
|
|
2236
|
-
/* @__PURE__ */
|
|
1959
|
+
/* @__PURE__ */ jsx12("p", { className: "text-sm text-gray-300 leading-relaxed", children: message }),
|
|
1960
|
+
/* @__PURE__ */ jsx12("div", { className: "mt-1 flex items-center gap-3", children: /* @__PURE__ */ jsx12(
|
|
2237
1961
|
ClayxButton,
|
|
2238
1962
|
{
|
|
2239
1963
|
onClick: () => {
|
|
@@ -2251,8 +1975,8 @@ var LimitToastContainer = ({ message, onUpgrade, closeToast }) => {
|
|
|
2251
1975
|
backgroundImage: hover ? "linear-gradient(to right, #9333ea, #db2777)" : "linear-gradient(to right, #a855f7, #ec4899)",
|
|
2252
1976
|
boxShadow: hover ? "0 10px 15px -3px rgba(168,85,247,0.3), 0 4px 6px -2px rgba(168,85,247,0.3)" : "none"
|
|
2253
1977
|
},
|
|
2254
|
-
children: /* @__PURE__ */
|
|
2255
|
-
/* @__PURE__ */
|
|
1978
|
+
children: /* @__PURE__ */ jsxs8("span", { className: "flex items-center gap-2", children: [
|
|
1979
|
+
/* @__PURE__ */ jsx12(Icon4, { icon: "solar:rocket-2-bold", className: "w-4 h-4" }),
|
|
2256
1980
|
"Upgrade Now"
|
|
2257
1981
|
] })
|
|
2258
1982
|
}
|
|
@@ -2261,22 +1985,10 @@ var LimitToastContainer = ({ message, onUpgrade, closeToast }) => {
|
|
|
2261
1985
|
] });
|
|
2262
1986
|
};
|
|
2263
1987
|
function showLimitUpgradeToast(message, onUpgrade) {
|
|
2264
|
-
|
|
2265
|
-
render: (closeToast) => /* @__PURE__ */
|
|
1988
|
+
GoeyToast.default({
|
|
1989
|
+
render: (closeToast) => /* @__PURE__ */ jsx12(LimitToastContainer, { message, onUpgrade, closeToast }),
|
|
2266
1990
|
options: {
|
|
2267
|
-
|
|
2268
|
-
closeOnClick: false,
|
|
2269
|
-
autoClose: false,
|
|
2270
|
-
hideProgressBar: true,
|
|
2271
|
-
draggable: false,
|
|
2272
|
-
pauseOnHover: true,
|
|
2273
|
-
className: "!bg-transparent !shadow-none",
|
|
2274
|
-
style: {
|
|
2275
|
-
background: "transparent",
|
|
2276
|
-
padding: 0,
|
|
2277
|
-
width: "auto",
|
|
2278
|
-
maxWidth: "420px"
|
|
2279
|
-
}
|
|
1991
|
+
autoClose: false
|
|
2280
1992
|
}
|
|
2281
1993
|
});
|
|
2282
1994
|
}
|
|
@@ -2729,7 +2441,7 @@ async function executeSSEWorkflow(request, options = {}) {
|
|
|
2729
2441
|
if (errorData.log_type === "execution_display_error") {
|
|
2730
2442
|
const errorContent = errorData.content;
|
|
2731
2443
|
const displayMessage = errorContent || "Workflow execution failed";
|
|
2732
|
-
|
|
2444
|
+
GoeyToast.error({
|
|
2733
2445
|
title: "Execution Error",
|
|
2734
2446
|
message: displayMessage
|
|
2735
2447
|
});
|
|
@@ -3835,11 +3547,11 @@ function createClient(opts) {
|
|
|
3835
3547
|
}
|
|
3836
3548
|
|
|
3837
3549
|
// src/hooks/use-mobile.ts
|
|
3838
|
-
import * as
|
|
3550
|
+
import * as React8 from "react";
|
|
3839
3551
|
var MOBILE_BREAKPOINT = 768;
|
|
3840
3552
|
function useIsMobile() {
|
|
3841
|
-
const [isMobile, setIsMobile] =
|
|
3842
|
-
|
|
3553
|
+
const [isMobile, setIsMobile] = React8.useState(void 0);
|
|
3554
|
+
React8.useEffect(() => {
|
|
3843
3555
|
const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
|
|
3844
3556
|
const onChange = () => {
|
|
3845
3557
|
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
@@ -3867,7 +3579,7 @@ function useDebounce(value, delay) {
|
|
|
3867
3579
|
}
|
|
3868
3580
|
|
|
3869
3581
|
// src/hooks/use-workflow-stream.ts
|
|
3870
|
-
import { useState as useState11, useCallback as
|
|
3582
|
+
import { useState as useState11, useCallback as useCallback5, useRef as useRef2 } from "react";
|
|
3871
3583
|
function useWorkflowStream() {
|
|
3872
3584
|
const [state, setState] = useState11({
|
|
3873
3585
|
loading: false,
|
|
@@ -3878,7 +3590,7 @@ function useWorkflowStream() {
|
|
|
3878
3590
|
error: null
|
|
3879
3591
|
});
|
|
3880
3592
|
const abortControllerRef = useRef2(null);
|
|
3881
|
-
const execute =
|
|
3593
|
+
const execute = useCallback5(async (executeWorkflowStream, workflowId, inputs) => {
|
|
3882
3594
|
setState({
|
|
3883
3595
|
loading: true,
|
|
3884
3596
|
progress: 0,
|
|
@@ -3931,7 +3643,7 @@ function useWorkflowStream() {
|
|
|
3931
3643
|
throw error;
|
|
3932
3644
|
}
|
|
3933
3645
|
}, []);
|
|
3934
|
-
const cancel =
|
|
3646
|
+
const cancel = useCallback5(() => {
|
|
3935
3647
|
if (abortControllerRef.current) {
|
|
3936
3648
|
abortControllerRef.current.abort();
|
|
3937
3649
|
setState((prev) => ({
|
|
@@ -3941,7 +3653,7 @@ function useWorkflowStream() {
|
|
|
3941
3653
|
}));
|
|
3942
3654
|
}
|
|
3943
3655
|
}, []);
|
|
3944
|
-
const reset =
|
|
3656
|
+
const reset = useCallback5(() => {
|
|
3945
3657
|
setState({
|
|
3946
3658
|
loading: false,
|
|
3947
3659
|
progress: 0,
|
|
@@ -4246,13 +3958,13 @@ var elementSelector = {
|
|
|
4246
3958
|
export {
|
|
4247
3959
|
AUTH_TOKEN_KEY,
|
|
4248
3960
|
ClayxButton,
|
|
4249
|
-
ClayxToast,
|
|
4250
3961
|
DefaultErrorFallback,
|
|
4251
3962
|
ElementSelector,
|
|
4252
3963
|
ElementSelectorProvider,
|
|
4253
3964
|
ErrorBoundary,
|
|
4254
3965
|
FloatingButton,
|
|
4255
3966
|
GlobalToastContainer,
|
|
3967
|
+
GoeyToast,
|
|
4256
3968
|
HowOneProvider,
|
|
4257
3969
|
Loading,
|
|
4258
3970
|
LoadingSpinner,
|