@howone/sdk 0.5.2 → 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 +196 -474
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +168 -446
- 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",
|
|
1045
|
+
{
|
|
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,
|
|
1025
1060
|
{
|
|
1026
|
-
|
|
1027
|
-
|
|
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,8 +1294,9 @@ 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);
|
|
1299
|
+
var consumedTokenCache = /* @__PURE__ */ new Set();
|
|
1264
1300
|
var redirectOverlayStylesInjected = false;
|
|
1265
1301
|
var injectRedirectOverlayStyles = () => {
|
|
1266
1302
|
if (redirectOverlayStylesInjected || typeof document === "undefined") return;
|
|
@@ -1320,25 +1356,39 @@ var HowOneProvider = ({
|
|
|
1320
1356
|
forceDefaultTheme = false,
|
|
1321
1357
|
redirectOnUnauthenticated = true
|
|
1322
1358
|
}) => {
|
|
1323
|
-
const [user, setUser] =
|
|
1324
|
-
const [token, setTokenState] =
|
|
1325
|
-
const [hasCheckedUrlToken, setHasCheckedUrlToken] =
|
|
1326
|
-
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);
|
|
1327
1363
|
const authCookieRoot = useMemo(() => {
|
|
1328
1364
|
const env3 = getGlobalEnvironment() ?? "dev";
|
|
1329
1365
|
return setEnvironment(env3).AUTH_COOKIE_ROOT_VALUE;
|
|
1330
1366
|
}, []);
|
|
1331
1367
|
const consumeTokenToCookie = useCallback4(async (value2) => {
|
|
1368
|
+
if (!value2) return;
|
|
1369
|
+
if (consumedTokenCache.has(value2)) return;
|
|
1370
|
+
consumedTokenCache.add(value2);
|
|
1332
1371
|
try {
|
|
1333
|
-
await fetch(`${authCookieRoot}/consume`, {
|
|
1372
|
+
const response = await fetch(`${authCookieRoot}/consume`, {
|
|
1334
1373
|
method: "POST",
|
|
1335
1374
|
credentials: "include",
|
|
1336
1375
|
headers: {
|
|
1337
1376
|
Authorization: `Bearer ${value2}`
|
|
1338
1377
|
}
|
|
1339
1378
|
});
|
|
1379
|
+
if (!response.ok) {
|
|
1380
|
+
console.info("[HowOneProvider] consume token request failed:", response.status, response.statusText);
|
|
1381
|
+
}
|
|
1340
1382
|
} catch (error) {
|
|
1341
|
-
|
|
1383
|
+
try {
|
|
1384
|
+
const inIframe = typeof window !== "undefined" && window.top !== window.self;
|
|
1385
|
+
if (inIframe) {
|
|
1386
|
+
console.info("[HowOneProvider] consume token skipped in iframe context (likely third-party cookie/CORS policy).");
|
|
1387
|
+
return;
|
|
1388
|
+
}
|
|
1389
|
+
} catch {
|
|
1390
|
+
}
|
|
1391
|
+
console.warn("[HowOneProvider] Failed to consume token:", error);
|
|
1342
1392
|
}
|
|
1343
1393
|
}, [authCookieRoot]);
|
|
1344
1394
|
const logoutFromCookie = useCallback4(async () => {
|
|
@@ -1348,7 +1398,7 @@ var HowOneProvider = ({
|
|
|
1348
1398
|
credentials: "include"
|
|
1349
1399
|
});
|
|
1350
1400
|
} catch (error) {
|
|
1351
|
-
console.
|
|
1401
|
+
console.warn("[HowOneProvider] Failed to logout from cookie:", error);
|
|
1352
1402
|
}
|
|
1353
1403
|
}, [authCookieRoot]);
|
|
1354
1404
|
const readAccessTokenCookie = useCallback4(() => {
|
|
@@ -1367,7 +1417,7 @@ var HowOneProvider = ({
|
|
|
1367
1417
|
}
|
|
1368
1418
|
return null;
|
|
1369
1419
|
}, []);
|
|
1370
|
-
|
|
1420
|
+
useEffect7(() => {
|
|
1371
1421
|
try {
|
|
1372
1422
|
const params = new URLSearchParams(window.location.search);
|
|
1373
1423
|
let urlToken = params.get("access_token") || params.get("token");
|
|
@@ -1396,7 +1446,7 @@ var HowOneProvider = ({
|
|
|
1396
1446
|
}
|
|
1397
1447
|
}
|
|
1398
1448
|
} catch (e) {
|
|
1399
|
-
console.
|
|
1449
|
+
console.warn("[HowOneProvider] Failed to capture token from URL:", e);
|
|
1400
1450
|
} finally {
|
|
1401
1451
|
setHasCheckedUrlToken(true);
|
|
1402
1452
|
}
|
|
@@ -1413,12 +1463,7 @@ var HowOneProvider = ({
|
|
|
1413
1463
|
return "https://howone.dev/auth";
|
|
1414
1464
|
}
|
|
1415
1465
|
}, []);
|
|
1416
|
-
|
|
1417
|
-
if (pendingRedirect) {
|
|
1418
|
-
injectRedirectOverlayStyles();
|
|
1419
|
-
}
|
|
1420
|
-
}, [pendingRedirect]);
|
|
1421
|
-
useEffect6(() => {
|
|
1466
|
+
useEffect7(() => {
|
|
1422
1467
|
if (pendingRedirect) {
|
|
1423
1468
|
injectRedirectOverlayStyles();
|
|
1424
1469
|
}
|
|
@@ -1437,7 +1482,7 @@ var HowOneProvider = ({
|
|
|
1437
1482
|
window.location.href = url.toString();
|
|
1438
1483
|
return;
|
|
1439
1484
|
} catch (error) {
|
|
1440
|
-
console.
|
|
1485
|
+
console.warn("[HowOneProvider] Failed to attach project_id to auth URL:", error);
|
|
1441
1486
|
}
|
|
1442
1487
|
}
|
|
1443
1488
|
window.location.href = resolvedAuthUrl;
|
|
@@ -1458,14 +1503,14 @@ var HowOneProvider = ({
|
|
|
1458
1503
|
});
|
|
1459
1504
|
return;
|
|
1460
1505
|
} catch (error) {
|
|
1461
|
-
console.
|
|
1506
|
+
console.warn("[HowOneProvider] Failed to build auth URL:", error);
|
|
1462
1507
|
}
|
|
1463
1508
|
navigateToResolvedAuth();
|
|
1464
1509
|
} catch {
|
|
1465
1510
|
navigateToResolvedAuth();
|
|
1466
1511
|
}
|
|
1467
1512
|
}, [redirectOnUnauthenticated, resolvedAuthUrl, projectId]);
|
|
1468
|
-
|
|
1513
|
+
useEffect7(() => {
|
|
1469
1514
|
if (!hasCheckedUrlToken) return;
|
|
1470
1515
|
if (!token && !user) {
|
|
1471
1516
|
redirectToAuth();
|
|
@@ -1495,24 +1540,24 @@ var HowOneProvider = ({
|
|
|
1495
1540
|
storageKey: themeStorageKey,
|
|
1496
1541
|
forceDefault: forceDefaultTheme,
|
|
1497
1542
|
children: [
|
|
1498
|
-
/* @__PURE__ */
|
|
1543
|
+
/* @__PURE__ */ jsx8(ElementSelectorProvider, { children: /* @__PURE__ */ jsxs5(HowoneContext.Provider, { value, children: [
|
|
1499
1544
|
children,
|
|
1500
|
-
showHowOneFlag && /* @__PURE__ */
|
|
1501
|
-
pendingRedirect && /* @__PURE__ */
|
|
1545
|
+
showHowOneFlag && /* @__PURE__ */ jsx8(FloatingButton, { onClick: () => window.open("https://howone.ai", "_blank") }),
|
|
1546
|
+
pendingRedirect && /* @__PURE__ */ jsx8(
|
|
1502
1547
|
"div",
|
|
1503
1548
|
{
|
|
1504
1549
|
"data-howone-auth-overlay-root": true,
|
|
1505
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",
|
|
1506
1551
|
children: /* @__PURE__ */ jsxs5("div", { className: "relative mt-6 flex h-[220px] w-[220px] items-center justify-center", children: [
|
|
1507
|
-
/* @__PURE__ */
|
|
1552
|
+
/* @__PURE__ */ jsx8(
|
|
1508
1553
|
"div",
|
|
1509
1554
|
{
|
|
1510
1555
|
className: "absolute inset-0 rounded-full bg-white/20",
|
|
1511
1556
|
style: { animation: "howone-glow-ring 2.4s ease-in-out infinite" }
|
|
1512
1557
|
}
|
|
1513
1558
|
),
|
|
1514
|
-
/* @__PURE__ */
|
|
1515
|
-
/* @__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(
|
|
1516
1561
|
"img",
|
|
1517
1562
|
{
|
|
1518
1563
|
style: { width: 250, animation: "howone-logo-pulse 2s ease-in-out infinite" },
|
|
@@ -1524,7 +1569,7 @@ var HowOneProvider = ({
|
|
|
1524
1569
|
}
|
|
1525
1570
|
)
|
|
1526
1571
|
] }) }),
|
|
1527
|
-
/* @__PURE__ */
|
|
1572
|
+
/* @__PURE__ */ jsx8(GlobalToastContainer, {})
|
|
1528
1573
|
]
|
|
1529
1574
|
}
|
|
1530
1575
|
);
|
|
@@ -1634,7 +1679,7 @@ var howone = {
|
|
|
1634
1679
|
var client_default = howone;
|
|
1635
1680
|
|
|
1636
1681
|
// src/components/ui/Loading.tsx
|
|
1637
|
-
import { jsx as
|
|
1682
|
+
import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1638
1683
|
var Loading = ({
|
|
1639
1684
|
size = "md",
|
|
1640
1685
|
text = "Loading...",
|
|
@@ -1647,14 +1692,14 @@ var Loading = ({
|
|
|
1647
1692
|
lg: "h-12 w-12"
|
|
1648
1693
|
};
|
|
1649
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";
|
|
1650
|
-
return /* @__PURE__ */
|
|
1651
|
-
/* @__PURE__ */
|
|
1695
|
+
return /* @__PURE__ */ jsx9("div", { className: `${containerClasses} ${className}`, children: /* @__PURE__ */ jsxs6("div", { className: "text-center", children: [
|
|
1696
|
+
/* @__PURE__ */ jsx9(
|
|
1652
1697
|
"div",
|
|
1653
1698
|
{
|
|
1654
1699
|
className: `animate-spin rounded-full border-2 border-gray-300 border-t-blue-600 mx-auto ${sizeClasses[size]}`
|
|
1655
1700
|
}
|
|
1656
1701
|
),
|
|
1657
|
-
text && /* @__PURE__ */
|
|
1702
|
+
text && /* @__PURE__ */ jsx9("p", { className: "mt-2 text-sm text-gray-600", children: text })
|
|
1658
1703
|
] }) });
|
|
1659
1704
|
};
|
|
1660
1705
|
var LoadingSpinner = ({
|
|
@@ -1666,7 +1711,7 @@ var LoadingSpinner = ({
|
|
|
1666
1711
|
md: "h-8 w-8",
|
|
1667
1712
|
lg: "h-12 w-12"
|
|
1668
1713
|
};
|
|
1669
|
-
return /* @__PURE__ */
|
|
1714
|
+
return /* @__PURE__ */ jsx9(
|
|
1670
1715
|
"div",
|
|
1671
1716
|
{
|
|
1672
1717
|
className: `animate-spin rounded-full border-2 border-gray-300 border-t-blue-600 ${sizeClasses[size]} ${className}`
|
|
@@ -1676,7 +1721,7 @@ var LoadingSpinner = ({
|
|
|
1676
1721
|
|
|
1677
1722
|
// src/components/ui/ErrorBoundary.tsx
|
|
1678
1723
|
import { Component } from "react";
|
|
1679
|
-
import { jsx as
|
|
1724
|
+
import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1680
1725
|
var ErrorBoundary = class extends Component {
|
|
1681
1726
|
constructor(props) {
|
|
1682
1727
|
super(props);
|
|
@@ -1699,13 +1744,13 @@ var ErrorBoundary = class extends Component {
|
|
|
1699
1744
|
if (this.state.hasError) {
|
|
1700
1745
|
if (this.props.fallback) {
|
|
1701
1746
|
const FallbackComponent = this.props.fallback;
|
|
1702
|
-
return /* @__PURE__ */
|
|
1747
|
+
return /* @__PURE__ */ jsx10(FallbackComponent, { error: this.state.error, retry: this.handleRetry });
|
|
1703
1748
|
}
|
|
1704
|
-
return /* @__PURE__ */
|
|
1705
|
-
/* @__PURE__ */
|
|
1706
|
-
/* @__PURE__ */
|
|
1707
|
-
/* @__PURE__ */
|
|
1708
|
-
/* @__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(
|
|
1709
1754
|
"button",
|
|
1710
1755
|
{
|
|
1711
1756
|
onClick: this.handleRetry,
|
|
@@ -1719,10 +1764,10 @@ var ErrorBoundary = class extends Component {
|
|
|
1719
1764
|
return this.props.children;
|
|
1720
1765
|
}
|
|
1721
1766
|
};
|
|
1722
|
-
var DefaultErrorFallback = ({ retry }) => /* @__PURE__ */
|
|
1723
|
-
/* @__PURE__ */
|
|
1724
|
-
/* @__PURE__ */
|
|
1725
|
-
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(
|
|
1726
1771
|
"button",
|
|
1727
1772
|
{
|
|
1728
1773
|
onClick: retry,
|
|
@@ -1733,7 +1778,7 @@ var DefaultErrorFallback = ({ retry }) => /* @__PURE__ */ jsx9("div", { classNam
|
|
|
1733
1778
|
] }) });
|
|
1734
1779
|
|
|
1735
1780
|
// src/components/ui/ClayxButton.tsx
|
|
1736
|
-
import { jsx as
|
|
1781
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
1737
1782
|
var getSizeClasses = (size, isIconOnly) => {
|
|
1738
1783
|
if (isIconOnly) {
|
|
1739
1784
|
switch (size) {
|
|
@@ -1789,7 +1834,7 @@ var ClayxButton = ({
|
|
|
1789
1834
|
disabled:opacity-50 disabled:cursor-not-allowed disabled:pointer-events-none
|
|
1790
1835
|
`.replace(/\s+/g, " ").trim();
|
|
1791
1836
|
const combinedClasses = `${baseClasses} ${sizeClasses} ${variantClasses} ${className}`.trim();
|
|
1792
|
-
return /* @__PURE__ */
|
|
1837
|
+
return /* @__PURE__ */ jsx11(
|
|
1793
1838
|
"button",
|
|
1794
1839
|
{
|
|
1795
1840
|
className: combinedClasses,
|
|
@@ -1801,349 +1846,38 @@ var ClayxButton = ({
|
|
|
1801
1846
|
};
|
|
1802
1847
|
|
|
1803
1848
|
// src/components/ui/LimitUpgradeToast.tsx
|
|
1804
|
-
import
|
|
1805
|
-
import { Icon as Icon5 } from "@iconify/react";
|
|
1806
|
-
|
|
1807
|
-
// src/components/ui/Toast/ClayxToast.tsx
|
|
1808
|
-
import React7, { useCallback as useCallback5 } from "react";
|
|
1809
|
-
import { Bounce, toast } from "react-toastify";
|
|
1849
|
+
import React7 from "react";
|
|
1810
1850
|
import { Icon as Icon4 } from "@iconify/react";
|
|
1811
1851
|
|
|
1812
|
-
// src/components/
|
|
1813
|
-
import
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
const [mounted, setMounted] = React6.useState(false);
|
|
1819
|
-
React6.useEffect(() => {
|
|
1820
|
-
setMounted(true);
|
|
1821
|
-
}, []);
|
|
1822
|
-
const handleToggle = () => {
|
|
1823
|
-
if (theme === "dark") {
|
|
1824
|
-
setTheme("light");
|
|
1825
|
-
} else {
|
|
1826
|
-
setTheme("dark");
|
|
1827
|
-
}
|
|
1828
|
-
};
|
|
1829
|
-
if (!mounted) {
|
|
1830
|
-
return /* @__PURE__ */ jsx11(Icon3, { icon: "solar:sun-bold", width: 20, height: 20 });
|
|
1831
|
-
}
|
|
1832
|
-
return /* @__PURE__ */ jsx11(
|
|
1833
|
-
"div",
|
|
1834
|
-
{
|
|
1835
|
-
className: `cursor-pointer ${className || ""}`,
|
|
1836
|
-
onClick: handleToggle,
|
|
1837
|
-
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 })
|
|
1838
|
-
}
|
|
1839
|
-
);
|
|
1840
|
-
}
|
|
1841
|
-
|
|
1842
|
-
// src/components/ui/Toast/ClayxToast.tsx
|
|
1843
|
-
import { jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1844
|
-
var TOAST_ICONS = {
|
|
1845
|
-
success: {
|
|
1846
|
-
icon: "mdi:success",
|
|
1847
|
-
color: "text-green-400",
|
|
1848
|
-
className: "text-green-400",
|
|
1849
|
-
// 深色主题配置
|
|
1850
|
-
dark: {
|
|
1851
|
-
bgGradient: "bg-[#14181d]",
|
|
1852
|
-
// 移除透明度 f2
|
|
1853
|
-
gradientColor: "#389726",
|
|
1854
|
-
borderGradient: "border-[#389726]",
|
|
1855
|
-
borderGradientColor: "#389726"
|
|
1856
|
-
},
|
|
1857
|
-
// 浅色主题配置
|
|
1858
|
-
light: {
|
|
1859
|
-
bgGradient: "bg-[#fafafa]",
|
|
1860
|
-
// 移除透明度 ff
|
|
1861
|
-
gradientColor: "#22c55e",
|
|
1862
|
-
borderGradient: "border-[#22c55e]",
|
|
1863
|
-
borderGradientColor: "#22c55e"
|
|
1864
|
-
}
|
|
1865
|
-
},
|
|
1866
|
-
error: {
|
|
1867
|
-
icon: "ic:outline-close",
|
|
1868
|
-
color: "text-red-400",
|
|
1869
|
-
className: "text-red-400",
|
|
1870
|
-
dark: {
|
|
1871
|
-
bgGradient: "bg-[#14181d]",
|
|
1872
|
-
// 移除透明度 f2
|
|
1873
|
-
gradientColor: "#ef4444",
|
|
1874
|
-
borderGradient: "border-[#ef4444]",
|
|
1875
|
-
borderGradientColor: "#ef4444"
|
|
1876
|
-
},
|
|
1877
|
-
light: {
|
|
1878
|
-
bgGradient: "bg-[#fafafa]",
|
|
1879
|
-
// 移除透明度 ff
|
|
1880
|
-
gradientColor: "#f87171",
|
|
1881
|
-
borderGradient: "border-[#f87171]",
|
|
1882
|
-
borderGradientColor: "#f87171"
|
|
1883
|
-
}
|
|
1884
|
-
},
|
|
1885
|
-
warning: {
|
|
1886
|
-
icon: "mi:warning",
|
|
1887
|
-
color: "text-yellow-400",
|
|
1888
|
-
className: "text-yellow-400",
|
|
1889
|
-
dark: {
|
|
1890
|
-
bgGradient: "bg-[#14181d]",
|
|
1891
|
-
// 移除透明度 f2
|
|
1892
|
-
gradientColor: "#facc15",
|
|
1893
|
-
borderGradient: "border-[#facc15]",
|
|
1894
|
-
borderGradientColor: "#facc15"
|
|
1895
|
-
},
|
|
1896
|
-
light: {
|
|
1897
|
-
bgGradient: "bg-[#fafafa]",
|
|
1898
|
-
// 移除透明度 ff
|
|
1899
|
-
gradientColor: "#f59e0b",
|
|
1900
|
-
borderGradient: "border-[#f59e0b]",
|
|
1901
|
-
borderGradientColor: "#f59e0b"
|
|
1902
|
-
}
|
|
1903
|
-
},
|
|
1904
|
-
info: {
|
|
1905
|
-
icon: "ic:outline-info",
|
|
1906
|
-
color: "text-blue-400",
|
|
1907
|
-
className: "text-blue-400",
|
|
1908
|
-
dark: {
|
|
1909
|
-
bgGradient: "bg-[#14181d]",
|
|
1910
|
-
// 移除透明度 f2
|
|
1911
|
-
gradientColor: "#60a5fa",
|
|
1912
|
-
borderGradient: "border-[#60a5fa]",
|
|
1913
|
-
borderGradientColor: "#f0f0f0"
|
|
1914
|
-
},
|
|
1915
|
-
light: {
|
|
1916
|
-
bgGradient: "bg-[#fafafa]",
|
|
1917
|
-
// 移除透明度 ff
|
|
1918
|
-
gradientColor: "#3b82f6",
|
|
1919
|
-
borderGradient: "border-[#3b82f6]",
|
|
1920
|
-
borderGradientColor: "#3b82f6"
|
|
1921
|
-
}
|
|
1922
|
-
},
|
|
1923
|
-
default: {
|
|
1924
|
-
icon: "ic:round-notifications",
|
|
1925
|
-
color: "text-gray-400",
|
|
1926
|
-
className: "text-gray-400",
|
|
1927
|
-
dark: {
|
|
1928
|
-
bgGradient: "bg-[#14181d]",
|
|
1929
|
-
// 移除透明度 f2
|
|
1930
|
-
gradientColor: "#9ca3af",
|
|
1931
|
-
borderGradient: "border-[#9ca3af]",
|
|
1932
|
-
borderGradientColor: "#9ca3af"
|
|
1933
|
-
},
|
|
1934
|
-
light: {
|
|
1935
|
-
bgGradient: "bg-[#fafafa]",
|
|
1936
|
-
// 移除透明度 ff
|
|
1937
|
-
gradientColor: "#6b7280",
|
|
1938
|
-
borderGradient: "border-[#6b7280]",
|
|
1939
|
-
borderGradientColor: "#6b7280"
|
|
1940
|
-
}
|
|
1941
|
-
}
|
|
1942
|
-
};
|
|
1943
|
-
var CloseButton = React7.memo(({ closeToast }) => {
|
|
1944
|
-
const { theme } = useTheme();
|
|
1945
|
-
const handleClick = useCallback5((e) => {
|
|
1946
|
-
e.preventDefault();
|
|
1947
|
-
e.stopPropagation();
|
|
1948
|
-
closeToast?.();
|
|
1949
|
-
}, [closeToast]);
|
|
1950
|
-
const getCloseButtonColor = () => {
|
|
1951
|
-
const actualTheme = theme === "system" ? window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" : theme;
|
|
1952
|
-
return actualTheme === "dark" ? "#b4b4b4" : "#6b7280";
|
|
1953
|
-
};
|
|
1954
|
-
const getCloseButtonHoverColor = () => {
|
|
1955
|
-
const actualTheme = theme === "system" ? window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" : theme;
|
|
1956
|
-
return actualTheme === "dark" ? "white" : "#374151";
|
|
1957
|
-
};
|
|
1958
|
-
return /* @__PURE__ */ jsx12(
|
|
1959
|
-
Icon4,
|
|
1960
|
-
{
|
|
1961
|
-
icon: "vaadin:close",
|
|
1962
|
-
className: "flex items-center justify-center rounded-full relative z-10 flex-shrink-0 cursor-pointer \n transition-colors duration-200 drop-shadow-sm",
|
|
1963
|
-
onClick: handleClick,
|
|
1964
|
-
width: 14,
|
|
1965
|
-
height: 14,
|
|
1966
|
-
style: {
|
|
1967
|
-
color: getCloseButtonColor()
|
|
1968
|
-
},
|
|
1969
|
-
onMouseEnter: (e) => {
|
|
1970
|
-
e.currentTarget.style.color = getCloseButtonHoverColor();
|
|
1971
|
-
},
|
|
1972
|
-
onMouseLeave: (e) => {
|
|
1973
|
-
e.currentTarget.style.color = getCloseButtonColor();
|
|
1974
|
-
}
|
|
1975
|
-
}
|
|
1976
|
-
);
|
|
1977
|
-
});
|
|
1978
|
-
CloseButton.displayName = "CloseButton";
|
|
1979
|
-
var ToastContent = ({ type, title, message, component, closeToast }) => {
|
|
1980
|
-
const iconConfig = TOAST_ICONS[type];
|
|
1981
|
-
const { theme } = useTheme();
|
|
1982
|
-
const handleClose = useCallback5(() => {
|
|
1983
|
-
closeToast?.();
|
|
1984
|
-
}, [closeToast]);
|
|
1985
|
-
const getTextColor = () => {
|
|
1986
|
-
const actualTheme = theme === "system" ? window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" : theme;
|
|
1987
|
-
return actualTheme === "dark" ? "white" : "#1f2937";
|
|
1988
|
-
};
|
|
1989
|
-
const getThemeConfig = () => {
|
|
1990
|
-
const actualTheme = theme === "system" ? window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" : theme;
|
|
1991
|
-
return actualTheme === "dark" ? iconConfig.dark : iconConfig.light;
|
|
1992
|
-
};
|
|
1993
|
-
const themeConfig = getThemeConfig();
|
|
1994
|
-
const lightBaseBackgroundByType = {
|
|
1995
|
-
success: "#f0fdf4",
|
|
1996
|
-
// green-50
|
|
1997
|
-
error: "#fef2f2",
|
|
1998
|
-
// red-50
|
|
1999
|
-
warning: "#fffbeb",
|
|
2000
|
-
// amber-50
|
|
2001
|
-
info: "#eff6ff",
|
|
2002
|
-
// blue-50
|
|
2003
|
-
default: "#f9fafb"
|
|
2004
|
-
// gray-50
|
|
2005
|
-
};
|
|
2006
|
-
if (component) {
|
|
2007
|
-
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: [
|
|
2008
|
-
/* @__PURE__ */ jsx12("div", { className: "flex-1 relative z-10", children: component }),
|
|
2009
|
-
/* @__PURE__ */ jsx12("div", { className: "relative z-10", children: /* @__PURE__ */ jsx12(CloseButton, { closeToast: handleClose }) })
|
|
2010
|
-
] });
|
|
2011
|
-
}
|
|
2012
|
-
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: [
|
|
2013
|
-
/* @__PURE__ */ jsx12(
|
|
2014
|
-
"div",
|
|
2015
|
-
{
|
|
2016
|
-
className: "absolute left-0 top-0 w-full h-full rounded-xl",
|
|
2017
|
-
style: {
|
|
2018
|
-
background: theme === "dark" || theme === "system" && window.matchMedia("(prefers-color-scheme: dark)").matches ? "#0f1419" : lightBaseBackgroundByType[type],
|
|
2019
|
-
zIndex: -2
|
|
2020
|
-
}
|
|
2021
|
-
}
|
|
2022
|
-
),
|
|
2023
|
-
/* @__PURE__ */ jsx12(
|
|
2024
|
-
"div",
|
|
2025
|
-
{
|
|
2026
|
-
className: "absolute left-0 top-0 w-full h-full pointer-events-none rounded-xl",
|
|
2027
|
-
style: {
|
|
2028
|
-
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%)`,
|
|
2029
|
-
zIndex: -1
|
|
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
|
-
border: "2px solid transparent",
|
|
2039
|
-
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%)`,
|
|
2040
|
-
backgroundOrigin: "border-box",
|
|
2041
|
-
backgroundClip: "border-box",
|
|
2042
|
-
WebkitMask: "linear-gradient(#ffffff 0 0) padding-box, linear-gradient(#ffffff 0 0)",
|
|
2043
|
-
WebkitMaskComposite: "xor",
|
|
2044
|
-
zIndex: 0
|
|
2045
|
-
}
|
|
2046
|
-
}
|
|
2047
|
-
),
|
|
2048
|
-
/* @__PURE__ */ jsx12("div", { className: "flex-shrink-0 flex-grow-0 mt-0.5 relative z-10", children: /* @__PURE__ */ jsx12(
|
|
2049
|
-
"div",
|
|
2050
|
-
{
|
|
2051
|
-
className: "backdrop-blur-sm rounded-full flex items-center justify-center overflow-hidden flex-shrink-0 flex-grow-0",
|
|
2052
|
-
style: {
|
|
2053
|
-
backgroundColor: theme === "dark" || theme === "system" && window.matchMedia("(prefers-color-scheme: dark)").matches ? "rgba(255, 255, 255, 0.1)" : "rgba(0, 0, 0, 0.05)",
|
|
2054
|
-
width: "28px",
|
|
2055
|
-
height: "28px"
|
|
2056
|
-
},
|
|
2057
|
-
children: /* @__PURE__ */ jsx12("div", { className: "rounded-full flex items-center justify-center", children: /* @__PURE__ */ jsx12(
|
|
2058
|
-
Icon4,
|
|
2059
|
-
{
|
|
2060
|
-
icon: iconConfig.icon,
|
|
2061
|
-
width: 16,
|
|
2062
|
-
height: 16,
|
|
2063
|
-
className: `flex-shrink-0`,
|
|
2064
|
-
style: {
|
|
2065
|
-
color: themeConfig.gradientColor,
|
|
2066
|
-
display: "block"
|
|
2067
|
-
}
|
|
2068
|
-
}
|
|
2069
|
-
) })
|
|
2070
|
-
}
|
|
2071
|
-
) }),
|
|
2072
|
-
/* @__PURE__ */ jsxs8("div", { className: "flex flex-col gap-1 flex-1 relative z-10", children: [
|
|
2073
|
-
title && /* @__PURE__ */ jsx12(
|
|
2074
|
-
"div",
|
|
2075
|
-
{
|
|
2076
|
-
className: "text-[16px] font-semibold leading-tight drop-shadow-sm",
|
|
2077
|
-
style: {
|
|
2078
|
-
color: getTextColor(),
|
|
2079
|
-
backgroundClip: "text"
|
|
2080
|
-
},
|
|
2081
|
-
children: title
|
|
2082
|
-
}
|
|
2083
|
-
),
|
|
2084
|
-
message && /* @__PURE__ */ jsx12(
|
|
2085
|
-
"div",
|
|
2086
|
-
{
|
|
2087
|
-
className: "text-[13px] font-normal leading-relaxed drop-shadow-sm",
|
|
2088
|
-
style: {
|
|
2089
|
-
color: getTextColor(),
|
|
2090
|
-
backgroundClip: "text"
|
|
2091
|
-
},
|
|
2092
|
-
children: message
|
|
2093
|
-
}
|
|
2094
|
-
)
|
|
2095
|
-
] }),
|
|
2096
|
-
/* @__PURE__ */ jsx12("div", { className: "relative z-10", children: /* @__PURE__ */ jsx12(CloseButton, { closeToast: handleClose }) })
|
|
2097
|
-
] });
|
|
2098
|
-
};
|
|
2099
|
-
var defaultToastOptions = {
|
|
2100
|
-
position: "bottom-right",
|
|
2101
|
-
autoClose: 1500,
|
|
2102
|
-
hideProgressBar: true,
|
|
2103
|
-
closeOnClick: false,
|
|
2104
|
-
pauseOnHover: true,
|
|
2105
|
-
draggable: true,
|
|
2106
|
-
pauseOnFocusLoss: false,
|
|
2107
|
-
transition: Bounce
|
|
2108
|
-
};
|
|
2109
|
-
var getToastifyTheme = () => {
|
|
2110
|
-
if (typeof window !== "undefined") {
|
|
2111
|
-
const root = document.documentElement;
|
|
2112
|
-
if (root.classList.contains("dark")) return "dark";
|
|
2113
|
-
if (root.classList.contains("light")) return "light";
|
|
2114
|
-
return window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
2115
|
-
}
|
|
2116
|
-
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;
|
|
2117
1858
|
};
|
|
2118
1859
|
var createToast = (type) => {
|
|
2119
1860
|
return (params) => {
|
|
2120
|
-
const {
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
...options,
|
|
2138
|
-
theme: getToastifyTheme(),
|
|
2139
|
-
// 确保圆角样式不被覆盖,添加 rounded-xl 类
|
|
2140
|
-
className: "!p-0 !shadow-none !rounded-xl",
|
|
2141
|
-
style: { padding: 0, borderRadius: "0.75rem", backgroundColor: "transparent" }
|
|
2142
|
-
}
|
|
2143
|
-
);
|
|
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);
|
|
2144
1878
|
};
|
|
2145
1879
|
};
|
|
2146
|
-
var
|
|
1880
|
+
var GoeyToast = {
|
|
2147
1881
|
success: createToast("success"),
|
|
2148
1882
|
error: createToast("error"),
|
|
2149
1883
|
warning: createToast("warning"),
|
|
@@ -2152,12 +1886,12 @@ var ClayxToast = {
|
|
|
2152
1886
|
};
|
|
2153
1887
|
|
|
2154
1888
|
// src/components/ui/LimitUpgradeToast.tsx
|
|
2155
|
-
import { jsx as
|
|
1889
|
+
import { jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2156
1890
|
var LimitToastContainer = ({ message, onUpgrade, closeToast }) => {
|
|
2157
|
-
const [hover, setHover] =
|
|
2158
|
-
const [closeHover, setCloseHover] =
|
|
2159
|
-
return /* @__PURE__ */
|
|
2160
|
-
/* @__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(
|
|
2161
1895
|
"div",
|
|
2162
1896
|
{
|
|
2163
1897
|
className: "absolute left-0 top-0 w-full h-full rounded-md",
|
|
@@ -2167,7 +1901,7 @@ var LimitToastContainer = ({ message, onUpgrade, closeToast }) => {
|
|
|
2167
1901
|
}
|
|
2168
1902
|
}
|
|
2169
1903
|
),
|
|
2170
|
-
/* @__PURE__ */
|
|
1904
|
+
/* @__PURE__ */ jsx12(
|
|
2171
1905
|
"div",
|
|
2172
1906
|
{
|
|
2173
1907
|
className: "absolute left-0 top-0 w-full h-full pointer-events-none rounded-md",
|
|
@@ -2177,7 +1911,7 @@ var LimitToastContainer = ({ message, onUpgrade, closeToast }) => {
|
|
|
2177
1911
|
}
|
|
2178
1912
|
}
|
|
2179
1913
|
),
|
|
2180
|
-
/* @__PURE__ */
|
|
1914
|
+
/* @__PURE__ */ jsx12(
|
|
2181
1915
|
"div",
|
|
2182
1916
|
{
|
|
2183
1917
|
className: "absolute left-0 top-0 w-full h-full pointer-events-none rounded-md",
|
|
@@ -2193,15 +1927,15 @@ var LimitToastContainer = ({ message, onUpgrade, closeToast }) => {
|
|
|
2193
1927
|
}
|
|
2194
1928
|
}
|
|
2195
1929
|
),
|
|
2196
|
-
/* @__PURE__ */
|
|
2197
|
-
/* @__PURE__ */
|
|
2198
|
-
/* @__PURE__ */
|
|
2199
|
-
/* @__PURE__ */
|
|
2200
|
-
/* @__PURE__ */
|
|
2201
|
-
/* @__PURE__ */
|
|
2202
|
-
/* @__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" })
|
|
2203
1937
|
] }),
|
|
2204
|
-
/* @__PURE__ */
|
|
1938
|
+
/* @__PURE__ */ jsx12(
|
|
2205
1939
|
ClayxButton,
|
|
2206
1940
|
{
|
|
2207
1941
|
onClick: closeToast,
|
|
@@ -2218,12 +1952,12 @@ var LimitToastContainer = ({ message, onUpgrade, closeToast }) => {
|
|
|
2218
1952
|
transition: "background-color 150ms ease",
|
|
2219
1953
|
cursor: "pointer"
|
|
2220
1954
|
},
|
|
2221
|
-
children: /* @__PURE__ */
|
|
1955
|
+
children: /* @__PURE__ */ jsx12(Icon4, { icon: "iconamoon:close", className: "w-4 h-4 text-gray-400" })
|
|
2222
1956
|
}
|
|
2223
1957
|
)
|
|
2224
1958
|
] }),
|
|
2225
|
-
/* @__PURE__ */
|
|
2226
|
-
/* @__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(
|
|
2227
1961
|
ClayxButton,
|
|
2228
1962
|
{
|
|
2229
1963
|
onClick: () => {
|
|
@@ -2241,8 +1975,8 @@ var LimitToastContainer = ({ message, onUpgrade, closeToast }) => {
|
|
|
2241
1975
|
backgroundImage: hover ? "linear-gradient(to right, #9333ea, #db2777)" : "linear-gradient(to right, #a855f7, #ec4899)",
|
|
2242
1976
|
boxShadow: hover ? "0 10px 15px -3px rgba(168,85,247,0.3), 0 4px 6px -2px rgba(168,85,247,0.3)" : "none"
|
|
2243
1977
|
},
|
|
2244
|
-
children: /* @__PURE__ */
|
|
2245
|
-
/* @__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" }),
|
|
2246
1980
|
"Upgrade Now"
|
|
2247
1981
|
] })
|
|
2248
1982
|
}
|
|
@@ -2251,22 +1985,10 @@ var LimitToastContainer = ({ message, onUpgrade, closeToast }) => {
|
|
|
2251
1985
|
] });
|
|
2252
1986
|
};
|
|
2253
1987
|
function showLimitUpgradeToast(message, onUpgrade) {
|
|
2254
|
-
|
|
2255
|
-
render: (closeToast) => /* @__PURE__ */
|
|
1988
|
+
GoeyToast.default({
|
|
1989
|
+
render: (closeToast) => /* @__PURE__ */ jsx12(LimitToastContainer, { message, onUpgrade, closeToast }),
|
|
2256
1990
|
options: {
|
|
2257
|
-
|
|
2258
|
-
closeOnClick: false,
|
|
2259
|
-
autoClose: false,
|
|
2260
|
-
hideProgressBar: true,
|
|
2261
|
-
draggable: false,
|
|
2262
|
-
pauseOnHover: true,
|
|
2263
|
-
className: "!bg-transparent !shadow-none",
|
|
2264
|
-
style: {
|
|
2265
|
-
background: "transparent",
|
|
2266
|
-
padding: 0,
|
|
2267
|
-
width: "auto",
|
|
2268
|
-
maxWidth: "420px"
|
|
2269
|
-
}
|
|
1991
|
+
autoClose: false
|
|
2270
1992
|
}
|
|
2271
1993
|
});
|
|
2272
1994
|
}
|
|
@@ -2719,7 +2441,7 @@ async function executeSSEWorkflow(request, options = {}) {
|
|
|
2719
2441
|
if (errorData.log_type === "execution_display_error") {
|
|
2720
2442
|
const errorContent = errorData.content;
|
|
2721
2443
|
const displayMessage = errorContent || "Workflow execution failed";
|
|
2722
|
-
|
|
2444
|
+
GoeyToast.error({
|
|
2723
2445
|
title: "Execution Error",
|
|
2724
2446
|
message: displayMessage
|
|
2725
2447
|
});
|
|
@@ -3825,11 +3547,11 @@ function createClient(opts) {
|
|
|
3825
3547
|
}
|
|
3826
3548
|
|
|
3827
3549
|
// src/hooks/use-mobile.ts
|
|
3828
|
-
import * as
|
|
3550
|
+
import * as React8 from "react";
|
|
3829
3551
|
var MOBILE_BREAKPOINT = 768;
|
|
3830
3552
|
function useIsMobile() {
|
|
3831
|
-
const [isMobile, setIsMobile] =
|
|
3832
|
-
|
|
3553
|
+
const [isMobile, setIsMobile] = React8.useState(void 0);
|
|
3554
|
+
React8.useEffect(() => {
|
|
3833
3555
|
const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
|
|
3834
3556
|
const onChange = () => {
|
|
3835
3557
|
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
@@ -3857,7 +3579,7 @@ function useDebounce(value, delay) {
|
|
|
3857
3579
|
}
|
|
3858
3580
|
|
|
3859
3581
|
// src/hooks/use-workflow-stream.ts
|
|
3860
|
-
import { useState as useState11, useCallback as
|
|
3582
|
+
import { useState as useState11, useCallback as useCallback5, useRef as useRef2 } from "react";
|
|
3861
3583
|
function useWorkflowStream() {
|
|
3862
3584
|
const [state, setState] = useState11({
|
|
3863
3585
|
loading: false,
|
|
@@ -3868,7 +3590,7 @@ function useWorkflowStream() {
|
|
|
3868
3590
|
error: null
|
|
3869
3591
|
});
|
|
3870
3592
|
const abortControllerRef = useRef2(null);
|
|
3871
|
-
const execute =
|
|
3593
|
+
const execute = useCallback5(async (executeWorkflowStream, workflowId, inputs) => {
|
|
3872
3594
|
setState({
|
|
3873
3595
|
loading: true,
|
|
3874
3596
|
progress: 0,
|
|
@@ -3921,7 +3643,7 @@ function useWorkflowStream() {
|
|
|
3921
3643
|
throw error;
|
|
3922
3644
|
}
|
|
3923
3645
|
}, []);
|
|
3924
|
-
const cancel =
|
|
3646
|
+
const cancel = useCallback5(() => {
|
|
3925
3647
|
if (abortControllerRef.current) {
|
|
3926
3648
|
abortControllerRef.current.abort();
|
|
3927
3649
|
setState((prev) => ({
|
|
@@ -3931,7 +3653,7 @@ function useWorkflowStream() {
|
|
|
3931
3653
|
}));
|
|
3932
3654
|
}
|
|
3933
3655
|
}, []);
|
|
3934
|
-
const reset =
|
|
3656
|
+
const reset = useCallback5(() => {
|
|
3935
3657
|
setState({
|
|
3936
3658
|
loading: false,
|
|
3937
3659
|
progress: 0,
|
|
@@ -4236,13 +3958,13 @@ var elementSelector = {
|
|
|
4236
3958
|
export {
|
|
4237
3959
|
AUTH_TOKEN_KEY,
|
|
4238
3960
|
ClayxButton,
|
|
4239
|
-
ClayxToast,
|
|
4240
3961
|
DefaultErrorFallback,
|
|
4241
3962
|
ElementSelector,
|
|
4242
3963
|
ElementSelectorProvider,
|
|
4243
3964
|
ErrorBoundary,
|
|
4244
3965
|
FloatingButton,
|
|
4245
3966
|
GlobalToastContainer,
|
|
3967
|
+
GoeyToast,
|
|
4246
3968
|
HowOneProvider,
|
|
4247
3969
|
Loading,
|
|
4248
3970
|
LoadingSpinner,
|