@howone/sdk 0.6.0 → 0.7.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 +6 -8
- package/dist/index.d.ts +6 -8
- package/dist/index.js +435 -175
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +407 -147
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -6
package/dist/index.mjs
CHANGED
|
@@ -154,7 +154,20 @@ function decodeJwtPayload(token) {
|
|
|
154
154
|
if (pad === 2) base64 += "==";
|
|
155
155
|
else if (pad === 3) base64 += "=";
|
|
156
156
|
else if (pad !== 0) return null;
|
|
157
|
-
const
|
|
157
|
+
const binary = atob(base64);
|
|
158
|
+
let json = binary;
|
|
159
|
+
try {
|
|
160
|
+
if (typeof TextDecoder !== "undefined") {
|
|
161
|
+
const bytes = Uint8Array.from(binary, (ch) => ch.charCodeAt(0));
|
|
162
|
+
json = new TextDecoder("utf-8", { fatal: false }).decode(bytes);
|
|
163
|
+
} else {
|
|
164
|
+
json = decodeURIComponent(
|
|
165
|
+
binary.split("").map((ch) => `%${ch.charCodeAt(0).toString(16).padStart(2, "0")}`).join("")
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
} catch {
|
|
169
|
+
json = binary;
|
|
170
|
+
}
|
|
158
171
|
return JSON.parse(json);
|
|
159
172
|
} catch {
|
|
160
173
|
return null;
|
|
@@ -961,7 +974,7 @@ var LoginForm = ({
|
|
|
961
974
|
|
|
962
975
|
// src/components/auth/HowoneProvider.tsx
|
|
963
976
|
init_auth();
|
|
964
|
-
import { createContext as createContext2, useContext as useContext2, useState as
|
|
977
|
+
import { createContext as createContext2, useContext as useContext2, useState as useState7, useEffect as useEffect6, useMemo, useCallback as useCallback4 } from "react";
|
|
965
978
|
|
|
966
979
|
// src/components/theme/ThemeProvider.tsx
|
|
967
980
|
import { createContext, useContext, useEffect as useEffect3, useState as useState3 } from "react";
|
|
@@ -1017,66 +1030,31 @@ var useTheme = () => {
|
|
|
1017
1030
|
};
|
|
1018
1031
|
|
|
1019
1032
|
// src/components/ui/Toast/GlobalToastContainer.tsx
|
|
1020
|
-
import {
|
|
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";
|
|
1033
|
+
import { ToastContainer } from "react-toastify";
|
|
1026
1034
|
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
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
|
-
}
|
|
1043
|
-
return /* @__PURE__ */ jsx4(
|
|
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
1035
|
function GlobalToastContainer() {
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
return /* @__PURE__ */ jsx5(
|
|
1059
|
-
GoeyToaster,
|
|
1036
|
+
return /* @__PURE__ */ jsx4(
|
|
1037
|
+
ToastContainer,
|
|
1060
1038
|
{
|
|
1061
|
-
|
|
1062
|
-
|
|
1039
|
+
newestOnTop: false,
|
|
1040
|
+
closeButton: false
|
|
1063
1041
|
}
|
|
1064
1042
|
);
|
|
1065
1043
|
}
|
|
1066
1044
|
|
|
1067
1045
|
// src/components/ElementSelectorProvider.tsx
|
|
1068
|
-
import { useEffect as
|
|
1046
|
+
import { useEffect as useEffect5, useState as useState6, useCallback as useCallback3 } from "react";
|
|
1069
1047
|
|
|
1070
1048
|
// src/components/ElementSelector.tsx
|
|
1071
|
-
import { useEffect as
|
|
1072
|
-
import { Fragment, jsx as
|
|
1049
|
+
import { useEffect as useEffect4, useState as useState4, useCallback, useRef } from "react";
|
|
1050
|
+
import { Fragment, jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1073
1051
|
var ElementSelector = ({
|
|
1074
1052
|
active,
|
|
1075
1053
|
onSelect,
|
|
1076
1054
|
onCancel
|
|
1077
1055
|
}) => {
|
|
1078
|
-
const [hoveredElement, setHoveredElement] =
|
|
1079
|
-
const [highlightRect, setHighlightRect] =
|
|
1056
|
+
const [hoveredElement, setHoveredElement] = useState4(null);
|
|
1057
|
+
const [highlightRect, setHighlightRect] = useState4(null);
|
|
1080
1058
|
const overlayRef = useRef(null);
|
|
1081
1059
|
const getSourceLocation = useCallback((element) => {
|
|
1082
1060
|
let current = element;
|
|
@@ -1133,7 +1111,7 @@ var ElementSelector = ({
|
|
|
1133
1111
|
}
|
|
1134
1112
|
}
|
|
1135
1113
|
}, [active, hoveredElement, getSourceLocation, onSelect, onCancel]);
|
|
1136
|
-
|
|
1114
|
+
useEffect4(() => {
|
|
1137
1115
|
if (active) {
|
|
1138
1116
|
document.addEventListener("mousemove", handleMouseMove);
|
|
1139
1117
|
document.addEventListener("click", handleClick, true);
|
|
@@ -1150,7 +1128,7 @@ var ElementSelector = ({
|
|
|
1150
1128
|
}, [active, handleMouseMove, handleClick]);
|
|
1151
1129
|
if (!active) return null;
|
|
1152
1130
|
return /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
1153
|
-
/* @__PURE__ */
|
|
1131
|
+
/* @__PURE__ */ jsx5(
|
|
1154
1132
|
"div",
|
|
1155
1133
|
{
|
|
1156
1134
|
ref: overlayRef,
|
|
@@ -1167,7 +1145,7 @@ var ElementSelector = ({
|
|
|
1167
1145
|
}
|
|
1168
1146
|
}
|
|
1169
1147
|
),
|
|
1170
|
-
highlightRect && /* @__PURE__ */
|
|
1148
|
+
highlightRect && /* @__PURE__ */ jsx5(
|
|
1171
1149
|
"div",
|
|
1172
1150
|
{
|
|
1173
1151
|
style: {
|
|
@@ -1185,7 +1163,7 @@ var ElementSelector = ({
|
|
|
1185
1163
|
}
|
|
1186
1164
|
}
|
|
1187
1165
|
),
|
|
1188
|
-
hoveredElement && highlightRect && /* @__PURE__ */
|
|
1166
|
+
hoveredElement && highlightRect && /* @__PURE__ */ jsx5(
|
|
1189
1167
|
"div",
|
|
1190
1168
|
{
|
|
1191
1169
|
style: {
|
|
@@ -1211,10 +1189,10 @@ var ElementSelector = ({
|
|
|
1211
1189
|
};
|
|
1212
1190
|
|
|
1213
1191
|
// src/hooks/use-element-selector.ts
|
|
1214
|
-
import { useState as
|
|
1192
|
+
import { useState as useState5, useCallback as useCallback2 } from "react";
|
|
1215
1193
|
function useElementSelector() {
|
|
1216
|
-
const [isSelecting, setIsSelecting] =
|
|
1217
|
-
const [selectedElement, setSelectedElement] =
|
|
1194
|
+
const [isSelecting, setIsSelecting] = useState5(false);
|
|
1195
|
+
const [selectedElement, setSelectedElement] = useState5(null);
|
|
1218
1196
|
const startSelecting = useCallback2(() => {
|
|
1219
1197
|
setIsSelecting(true);
|
|
1220
1198
|
}, []);
|
|
@@ -1242,9 +1220,9 @@ function sendElementSelectionToParent(data) {
|
|
|
1242
1220
|
}
|
|
1243
1221
|
|
|
1244
1222
|
// src/components/ElementSelectorProvider.tsx
|
|
1245
|
-
import { Fragment as Fragment2, jsx as
|
|
1223
|
+
import { Fragment as Fragment2, jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1246
1224
|
var ElementSelectorProvider = ({ children }) => {
|
|
1247
|
-
const [isSelecting, setIsSelecting] =
|
|
1225
|
+
const [isSelecting, setIsSelecting] = useState6(false);
|
|
1248
1226
|
const handleCancel = useCallback3(() => {
|
|
1249
1227
|
setIsSelecting(false);
|
|
1250
1228
|
if (window.parent && window.parent !== window) {
|
|
@@ -1256,7 +1234,7 @@ var ElementSelectorProvider = ({ children }) => {
|
|
|
1256
1234
|
const handleSelect = useCallback3((data) => {
|
|
1257
1235
|
sendElementSelectionToParent(data);
|
|
1258
1236
|
}, []);
|
|
1259
|
-
|
|
1237
|
+
useEffect5(() => {
|
|
1260
1238
|
const handleStartSelection = () => {
|
|
1261
1239
|
setIsSelecting(true);
|
|
1262
1240
|
};
|
|
@@ -1281,7 +1259,7 @@ var ElementSelectorProvider = ({ children }) => {
|
|
|
1281
1259
|
}, [handleCancel]);
|
|
1282
1260
|
return /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
1283
1261
|
children,
|
|
1284
|
-
/* @__PURE__ */
|
|
1262
|
+
/* @__PURE__ */ jsx6(
|
|
1285
1263
|
ElementSelector,
|
|
1286
1264
|
{
|
|
1287
1265
|
active: isSelecting,
|
|
@@ -1294,7 +1272,7 @@ var ElementSelectorProvider = ({ children }) => {
|
|
|
1294
1272
|
|
|
1295
1273
|
// src/components/auth/HowoneProvider.tsx
|
|
1296
1274
|
init_config();
|
|
1297
|
-
import { jsx as
|
|
1275
|
+
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1298
1276
|
var HowoneContext = createContext2(null);
|
|
1299
1277
|
var consumedTokenCache = /* @__PURE__ */ new Set();
|
|
1300
1278
|
var redirectOverlayStylesInjected = false;
|
|
@@ -1356,10 +1334,10 @@ var HowOneProvider = ({
|
|
|
1356
1334
|
forceDefaultTheme = false,
|
|
1357
1335
|
redirectOnUnauthenticated = true
|
|
1358
1336
|
}) => {
|
|
1359
|
-
const [user, setUser] =
|
|
1360
|
-
const [token, setTokenState] =
|
|
1361
|
-
const [hasCheckedUrlToken, setHasCheckedUrlToken] =
|
|
1362
|
-
const [pendingRedirect, setPendingRedirect] =
|
|
1337
|
+
const [user, setUser] = useState7(() => parseUserFromToken(getToken()));
|
|
1338
|
+
const [token, setTokenState] = useState7(() => getToken());
|
|
1339
|
+
const [hasCheckedUrlToken, setHasCheckedUrlToken] = useState7(false);
|
|
1340
|
+
const [pendingRedirect, setPendingRedirect] = useState7(false);
|
|
1363
1341
|
const authCookieRoot = useMemo(() => {
|
|
1364
1342
|
const env3 = getGlobalEnvironment() ?? "dev";
|
|
1365
1343
|
return setEnvironment(env3).AUTH_COOKIE_ROOT_VALUE;
|
|
@@ -1417,7 +1395,7 @@ var HowOneProvider = ({
|
|
|
1417
1395
|
}
|
|
1418
1396
|
return null;
|
|
1419
1397
|
}, []);
|
|
1420
|
-
|
|
1398
|
+
useEffect6(() => {
|
|
1421
1399
|
try {
|
|
1422
1400
|
const params = new URLSearchParams(window.location.search);
|
|
1423
1401
|
let urlToken = params.get("access_token") || params.get("token");
|
|
@@ -1463,7 +1441,7 @@ var HowOneProvider = ({
|
|
|
1463
1441
|
return "https://howone.dev/auth";
|
|
1464
1442
|
}
|
|
1465
1443
|
}, []);
|
|
1466
|
-
|
|
1444
|
+
useEffect6(() => {
|
|
1467
1445
|
if (pendingRedirect) {
|
|
1468
1446
|
injectRedirectOverlayStyles();
|
|
1469
1447
|
}
|
|
@@ -1510,7 +1488,7 @@ var HowOneProvider = ({
|
|
|
1510
1488
|
navigateToResolvedAuth();
|
|
1511
1489
|
}
|
|
1512
1490
|
}, [redirectOnUnauthenticated, resolvedAuthUrl, projectId]);
|
|
1513
|
-
|
|
1491
|
+
useEffect6(() => {
|
|
1514
1492
|
if (!hasCheckedUrlToken) return;
|
|
1515
1493
|
if (!token && !user) {
|
|
1516
1494
|
redirectToAuth();
|
|
@@ -1540,24 +1518,24 @@ var HowOneProvider = ({
|
|
|
1540
1518
|
storageKey: themeStorageKey,
|
|
1541
1519
|
forceDefault: forceDefaultTheme,
|
|
1542
1520
|
children: [
|
|
1543
|
-
/* @__PURE__ */
|
|
1521
|
+
/* @__PURE__ */ jsx7(ElementSelectorProvider, { children: /* @__PURE__ */ jsxs5(HowoneContext.Provider, { value, children: [
|
|
1544
1522
|
children,
|
|
1545
|
-
showHowOneFlag && /* @__PURE__ */
|
|
1546
|
-
pendingRedirect && /* @__PURE__ */
|
|
1523
|
+
showHowOneFlag && /* @__PURE__ */ jsx7(FloatingButton, { onClick: () => window.open("https://howone.ai", "_blank") }),
|
|
1524
|
+
pendingRedirect && /* @__PURE__ */ jsx7(
|
|
1547
1525
|
"div",
|
|
1548
1526
|
{
|
|
1549
1527
|
"data-howone-auth-overlay-root": true,
|
|
1550
1528
|
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",
|
|
1551
1529
|
children: /* @__PURE__ */ jsxs5("div", { className: "relative mt-6 flex h-[220px] w-[220px] items-center justify-center", children: [
|
|
1552
|
-
/* @__PURE__ */
|
|
1530
|
+
/* @__PURE__ */ jsx7(
|
|
1553
1531
|
"div",
|
|
1554
1532
|
{
|
|
1555
1533
|
className: "absolute inset-0 rounded-full bg-white/20",
|
|
1556
1534
|
style: { animation: "howone-glow-ring 2.4s ease-in-out infinite" }
|
|
1557
1535
|
}
|
|
1558
1536
|
),
|
|
1559
|
-
/* @__PURE__ */
|
|
1560
|
-
/* @__PURE__ */
|
|
1537
|
+
/* @__PURE__ */ jsx7("div", { className: "absolute inset-0 rounded-full bg-gradient-to-br from-white/10 via-white/25 to-white/10 blur-2xl" }),
|
|
1538
|
+
/* @__PURE__ */ jsx7(
|
|
1561
1539
|
"img",
|
|
1562
1540
|
{
|
|
1563
1541
|
style: { width: 250, animation: "howone-logo-pulse 2s ease-in-out infinite" },
|
|
@@ -1569,7 +1547,7 @@ var HowOneProvider = ({
|
|
|
1569
1547
|
}
|
|
1570
1548
|
)
|
|
1571
1549
|
] }) }),
|
|
1572
|
-
/* @__PURE__ */
|
|
1550
|
+
/* @__PURE__ */ jsx7(GlobalToastContainer, {})
|
|
1573
1551
|
]
|
|
1574
1552
|
}
|
|
1575
1553
|
);
|
|
@@ -1679,7 +1657,7 @@ var howone = {
|
|
|
1679
1657
|
var client_default = howone;
|
|
1680
1658
|
|
|
1681
1659
|
// src/components/ui/Loading.tsx
|
|
1682
|
-
import { jsx as
|
|
1660
|
+
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1683
1661
|
var Loading = ({
|
|
1684
1662
|
size = "md",
|
|
1685
1663
|
text = "Loading...",
|
|
@@ -1692,14 +1670,14 @@ var Loading = ({
|
|
|
1692
1670
|
lg: "h-12 w-12"
|
|
1693
1671
|
};
|
|
1694
1672
|
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";
|
|
1695
|
-
return /* @__PURE__ */
|
|
1696
|
-
/* @__PURE__ */
|
|
1673
|
+
return /* @__PURE__ */ jsx8("div", { className: `${containerClasses} ${className}`, children: /* @__PURE__ */ jsxs6("div", { className: "text-center", children: [
|
|
1674
|
+
/* @__PURE__ */ jsx8(
|
|
1697
1675
|
"div",
|
|
1698
1676
|
{
|
|
1699
1677
|
className: `animate-spin rounded-full border-2 border-gray-300 border-t-blue-600 mx-auto ${sizeClasses[size]}`
|
|
1700
1678
|
}
|
|
1701
1679
|
),
|
|
1702
|
-
text && /* @__PURE__ */
|
|
1680
|
+
text && /* @__PURE__ */ jsx8("p", { className: "mt-2 text-sm text-gray-600", children: text })
|
|
1703
1681
|
] }) });
|
|
1704
1682
|
};
|
|
1705
1683
|
var LoadingSpinner = ({
|
|
@@ -1711,7 +1689,7 @@ var LoadingSpinner = ({
|
|
|
1711
1689
|
md: "h-8 w-8",
|
|
1712
1690
|
lg: "h-12 w-12"
|
|
1713
1691
|
};
|
|
1714
|
-
return /* @__PURE__ */
|
|
1692
|
+
return /* @__PURE__ */ jsx8(
|
|
1715
1693
|
"div",
|
|
1716
1694
|
{
|
|
1717
1695
|
className: `animate-spin rounded-full border-2 border-gray-300 border-t-blue-600 ${sizeClasses[size]} ${className}`
|
|
@@ -1721,7 +1699,7 @@ var LoadingSpinner = ({
|
|
|
1721
1699
|
|
|
1722
1700
|
// src/components/ui/ErrorBoundary.tsx
|
|
1723
1701
|
import { Component } from "react";
|
|
1724
|
-
import { jsx as
|
|
1702
|
+
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1725
1703
|
var ErrorBoundary = class extends Component {
|
|
1726
1704
|
constructor(props) {
|
|
1727
1705
|
super(props);
|
|
@@ -1744,13 +1722,13 @@ var ErrorBoundary = class extends Component {
|
|
|
1744
1722
|
if (this.state.hasError) {
|
|
1745
1723
|
if (this.props.fallback) {
|
|
1746
1724
|
const FallbackComponent = this.props.fallback;
|
|
1747
|
-
return /* @__PURE__ */
|
|
1725
|
+
return /* @__PURE__ */ jsx9(FallbackComponent, { error: this.state.error, retry: this.handleRetry });
|
|
1748
1726
|
}
|
|
1749
|
-
return /* @__PURE__ */
|
|
1750
|
-
/* @__PURE__ */
|
|
1751
|
-
/* @__PURE__ */
|
|
1752
|
-
/* @__PURE__ */
|
|
1753
|
-
/* @__PURE__ */
|
|
1727
|
+
return /* @__PURE__ */ jsx9("div", { className: "min-h-[400px] flex items-center justify-center p-4", children: /* @__PURE__ */ jsxs7("div", { className: "text-center max-w-md", children: [
|
|
1728
|
+
/* @__PURE__ */ jsx9("div", { className: "text-red-500 text-6xl mb-4", children: "\u26A0\uFE0F" }),
|
|
1729
|
+
/* @__PURE__ */ jsx9("h2", { className: "text-xl font-semibold text-gray-900 mb-2", children: "Something went wrong" }),
|
|
1730
|
+
/* @__PURE__ */ jsx9("p", { className: "text-gray-600 mb-4", children: "An unexpected error occurred. Please try refreshing the page." }),
|
|
1731
|
+
/* @__PURE__ */ jsx9(
|
|
1754
1732
|
"button",
|
|
1755
1733
|
{
|
|
1756
1734
|
onClick: this.handleRetry,
|
|
@@ -1764,10 +1742,10 @@ var ErrorBoundary = class extends Component {
|
|
|
1764
1742
|
return this.props.children;
|
|
1765
1743
|
}
|
|
1766
1744
|
};
|
|
1767
|
-
var DefaultErrorFallback = ({ retry }) => /* @__PURE__ */
|
|
1768
|
-
/* @__PURE__ */
|
|
1769
|
-
/* @__PURE__ */
|
|
1770
|
-
retry && /* @__PURE__ */
|
|
1745
|
+
var DefaultErrorFallback = ({ retry }) => /* @__PURE__ */ jsx9("div", { className: "min-h-[200px] flex items-center justify-center p-4", children: /* @__PURE__ */ jsxs7("div", { className: "text-center", children: [
|
|
1746
|
+
/* @__PURE__ */ jsx9("div", { className: "text-red-500 text-4xl mb-2", children: "\u26A0\uFE0F" }),
|
|
1747
|
+
/* @__PURE__ */ jsx9("p", { className: "text-gray-600 mb-2", children: "Something went wrong" }),
|
|
1748
|
+
retry && /* @__PURE__ */ jsx9(
|
|
1771
1749
|
"button",
|
|
1772
1750
|
{
|
|
1773
1751
|
onClick: retry,
|
|
@@ -1778,7 +1756,7 @@ var DefaultErrorFallback = ({ retry }) => /* @__PURE__ */ jsx10("div", { classNa
|
|
|
1778
1756
|
] }) });
|
|
1779
1757
|
|
|
1780
1758
|
// src/components/ui/ClayxButton.tsx
|
|
1781
|
-
import { jsx as
|
|
1759
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
1782
1760
|
var getSizeClasses = (size, isIconOnly) => {
|
|
1783
1761
|
if (isIconOnly) {
|
|
1784
1762
|
switch (size) {
|
|
@@ -1834,7 +1812,7 @@ var ClayxButton = ({
|
|
|
1834
1812
|
disabled:opacity-50 disabled:cursor-not-allowed disabled:pointer-events-none
|
|
1835
1813
|
`.replace(/\s+/g, " ").trim();
|
|
1836
1814
|
const combinedClasses = `${baseClasses} ${sizeClasses} ${variantClasses} ${className}`.trim();
|
|
1837
|
-
return /* @__PURE__ */
|
|
1815
|
+
return /* @__PURE__ */ jsx10(
|
|
1838
1816
|
"button",
|
|
1839
1817
|
{
|
|
1840
1818
|
className: combinedClasses,
|
|
@@ -1846,38 +1824,320 @@ var ClayxButton = ({
|
|
|
1846
1824
|
};
|
|
1847
1825
|
|
|
1848
1826
|
// src/components/ui/LimitUpgradeToast.tsx
|
|
1849
|
-
import
|
|
1827
|
+
import React8 from "react";
|
|
1828
|
+
import { Icon as Icon5 } from "@iconify/react";
|
|
1829
|
+
|
|
1830
|
+
// src/components/ui/Toast/ClayxToast.tsx
|
|
1831
|
+
import React7, { useCallback as useCallback5 } from "react";
|
|
1832
|
+
import { Bounce, toast } from "react-toastify";
|
|
1850
1833
|
import { Icon as Icon4 } from "@iconify/react";
|
|
1851
1834
|
|
|
1852
|
-
// src/components/
|
|
1853
|
-
import
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1835
|
+
// src/components/theme/ThemeToggle.tsx
|
|
1836
|
+
import * as React6 from "react";
|
|
1837
|
+
import { Icon as Icon3 } from "@iconify/react";
|
|
1838
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
1839
|
+
function ThemeToggle({ className }) {
|
|
1840
|
+
const { setTheme, theme } = useTheme();
|
|
1841
|
+
const [mounted, setMounted] = React6.useState(false);
|
|
1842
|
+
React6.useEffect(() => {
|
|
1843
|
+
setMounted(true);
|
|
1844
|
+
}, []);
|
|
1845
|
+
const handleToggle = () => {
|
|
1846
|
+
if (theme === "dark") {
|
|
1847
|
+
setTheme("light");
|
|
1848
|
+
} else {
|
|
1849
|
+
setTheme("dark");
|
|
1850
|
+
}
|
|
1851
|
+
};
|
|
1852
|
+
if (!mounted) {
|
|
1853
|
+
return /* @__PURE__ */ jsx11(Icon3, { icon: "solar:sun-bold", width: 20, height: 20 });
|
|
1854
|
+
}
|
|
1855
|
+
return /* @__PURE__ */ jsx11(
|
|
1856
|
+
"div",
|
|
1857
|
+
{
|
|
1858
|
+
className: `cursor-pointer ${className || ""}`,
|
|
1859
|
+
onClick: handleToggle,
|
|
1860
|
+
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 })
|
|
1861
|
+
}
|
|
1862
|
+
);
|
|
1863
|
+
}
|
|
1864
|
+
|
|
1865
|
+
// src/components/ui/Toast/ClayxToast.tsx
|
|
1866
|
+
import { jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1867
|
+
var TOAST_ICONS = {
|
|
1868
|
+
success: {
|
|
1869
|
+
icon: "mdi:success",
|
|
1870
|
+
color: "text-green-400",
|
|
1871
|
+
className: "text-green-400",
|
|
1872
|
+
dark: {
|
|
1873
|
+
bgGradient: "bg-[#14181d]",
|
|
1874
|
+
gradientColor: "#389726",
|
|
1875
|
+
borderGradient: "border-[#389726]",
|
|
1876
|
+
borderGradientColor: "#389726"
|
|
1877
|
+
},
|
|
1878
|
+
light: {
|
|
1879
|
+
bgGradient: "bg-[#fafafa]",
|
|
1880
|
+
gradientColor: "#22c55e",
|
|
1881
|
+
borderGradient: "border-[#22c55e]",
|
|
1882
|
+
borderGradientColor: "#22c55e"
|
|
1883
|
+
}
|
|
1884
|
+
},
|
|
1885
|
+
error: {
|
|
1886
|
+
icon: "ic:outline-close",
|
|
1887
|
+
color: "text-red-400",
|
|
1888
|
+
className: "text-red-400",
|
|
1889
|
+
dark: {
|
|
1890
|
+
bgGradient: "bg-[#14181d]",
|
|
1891
|
+
gradientColor: "#ef4444",
|
|
1892
|
+
borderGradient: "border-[#ef4444]",
|
|
1893
|
+
borderGradientColor: "#ef4444"
|
|
1894
|
+
},
|
|
1895
|
+
light: {
|
|
1896
|
+
bgGradient: "bg-[#fafafa]",
|
|
1897
|
+
gradientColor: "#f87171",
|
|
1898
|
+
borderGradient: "border-[#f87171]",
|
|
1899
|
+
borderGradientColor: "#f87171"
|
|
1900
|
+
}
|
|
1901
|
+
},
|
|
1902
|
+
warning: {
|
|
1903
|
+
icon: "mi:warning",
|
|
1904
|
+
color: "text-yellow-400",
|
|
1905
|
+
className: "text-yellow-400",
|
|
1906
|
+
dark: {
|
|
1907
|
+
bgGradient: "bg-[#14181d]",
|
|
1908
|
+
gradientColor: "#facc15",
|
|
1909
|
+
borderGradient: "border-[#facc15]",
|
|
1910
|
+
borderGradientColor: "#facc15"
|
|
1911
|
+
},
|
|
1912
|
+
light: {
|
|
1913
|
+
bgGradient: "bg-[#fafafa]",
|
|
1914
|
+
gradientColor: "#f59e0b",
|
|
1915
|
+
borderGradient: "border-[#f59e0b]",
|
|
1916
|
+
borderGradientColor: "#f59e0b"
|
|
1917
|
+
}
|
|
1918
|
+
},
|
|
1919
|
+
info: {
|
|
1920
|
+
icon: "ic:outline-info",
|
|
1921
|
+
color: "text-blue-400",
|
|
1922
|
+
className: "text-blue-400",
|
|
1923
|
+
dark: {
|
|
1924
|
+
bgGradient: "bg-[#14181d]",
|
|
1925
|
+
gradientColor: "#60a5fa",
|
|
1926
|
+
borderGradient: "border-[#60a5fa]",
|
|
1927
|
+
borderGradientColor: "#f0f0f0"
|
|
1928
|
+
},
|
|
1929
|
+
light: {
|
|
1930
|
+
bgGradient: "bg-[#fafafa]",
|
|
1931
|
+
gradientColor: "#3b82f6",
|
|
1932
|
+
borderGradient: "border-[#3b82f6]",
|
|
1933
|
+
borderGradientColor: "#3b82f6"
|
|
1934
|
+
}
|
|
1935
|
+
},
|
|
1936
|
+
default: {
|
|
1937
|
+
icon: "ic:round-notifications",
|
|
1938
|
+
color: "text-gray-400",
|
|
1939
|
+
className: "text-gray-400",
|
|
1940
|
+
dark: {
|
|
1941
|
+
bgGradient: "bg-[#14181d]",
|
|
1942
|
+
gradientColor: "#9ca3af",
|
|
1943
|
+
borderGradient: "border-[#9ca3af]",
|
|
1944
|
+
borderGradientColor: "#9ca3af"
|
|
1945
|
+
},
|
|
1946
|
+
light: {
|
|
1947
|
+
bgGradient: "bg-[#fafafa]",
|
|
1948
|
+
gradientColor: "#6b7280",
|
|
1949
|
+
borderGradient: "border-[#6b7280]",
|
|
1950
|
+
borderGradientColor: "#6b7280"
|
|
1951
|
+
}
|
|
1952
|
+
}
|
|
1953
|
+
};
|
|
1954
|
+
var CloseButton = React7.memo(({ closeToast }) => {
|
|
1955
|
+
const { theme } = useTheme();
|
|
1956
|
+
const handleClick = useCallback5((e) => {
|
|
1957
|
+
e.preventDefault();
|
|
1958
|
+
e.stopPropagation();
|
|
1959
|
+
closeToast?.();
|
|
1960
|
+
}, [closeToast]);
|
|
1961
|
+
const getCloseButtonColor = () => {
|
|
1962
|
+
const actualTheme = theme === "system" ? window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" : theme;
|
|
1963
|
+
return actualTheme === "dark" ? "#b4b4b4" : "#6b7280";
|
|
1964
|
+
};
|
|
1965
|
+
const getCloseButtonHoverColor = () => {
|
|
1966
|
+
const actualTheme = theme === "system" ? window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" : theme;
|
|
1967
|
+
return actualTheme === "dark" ? "white" : "#374151";
|
|
1968
|
+
};
|
|
1969
|
+
return /* @__PURE__ */ jsx12(
|
|
1970
|
+
Icon4,
|
|
1971
|
+
{
|
|
1972
|
+
icon: "vaadin:close",
|
|
1973
|
+
className: "flex items-center justify-center rounded-full relative z-10 flex-shrink-0 cursor-pointer transition-colors duration-200 drop-shadow-sm",
|
|
1974
|
+
onClick: handleClick,
|
|
1975
|
+
width: 14,
|
|
1976
|
+
height: 14,
|
|
1977
|
+
style: {
|
|
1978
|
+
color: getCloseButtonColor()
|
|
1979
|
+
},
|
|
1980
|
+
onMouseEnter: (e) => {
|
|
1981
|
+
e.currentTarget.style.color = getCloseButtonHoverColor();
|
|
1982
|
+
},
|
|
1983
|
+
onMouseLeave: (e) => {
|
|
1984
|
+
e.currentTarget.style.color = getCloseButtonColor();
|
|
1985
|
+
}
|
|
1986
|
+
}
|
|
1987
|
+
);
|
|
1988
|
+
});
|
|
1989
|
+
CloseButton.displayName = "CloseButton";
|
|
1990
|
+
var ToastContent = ({ type, title, message, component, closeToast }) => {
|
|
1991
|
+
const iconConfig = TOAST_ICONS[type];
|
|
1992
|
+
const { theme } = useTheme();
|
|
1993
|
+
const handleClose = useCallback5(() => {
|
|
1994
|
+
closeToast?.();
|
|
1995
|
+
}, [closeToast]);
|
|
1996
|
+
const getTextColor = () => {
|
|
1997
|
+
const actualTheme = theme === "system" ? window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" : theme;
|
|
1998
|
+
return actualTheme === "dark" ? "white" : "#1f2937";
|
|
1999
|
+
};
|
|
2000
|
+
const getThemeConfig = () => {
|
|
2001
|
+
const actualTheme = theme === "system" ? window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" : theme;
|
|
2002
|
+
return actualTheme === "dark" ? iconConfig.dark : iconConfig.light;
|
|
2003
|
+
};
|
|
2004
|
+
const themeConfig = getThemeConfig();
|
|
2005
|
+
const lightBaseBackgroundByType = {
|
|
2006
|
+
success: "#f0fdf4",
|
|
2007
|
+
error: "#fef2f2",
|
|
2008
|
+
warning: "#fffbeb",
|
|
2009
|
+
info: "#eff6ff",
|
|
2010
|
+
default: "#f9fafb"
|
|
2011
|
+
};
|
|
2012
|
+
if (component) {
|
|
2013
|
+
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: [
|
|
2014
|
+
/* @__PURE__ */ jsx12("div", { className: "flex-1 relative z-10", children: component }),
|
|
2015
|
+
/* @__PURE__ */ jsx12("div", { className: "relative z-10", children: /* @__PURE__ */ jsx12(CloseButton, { closeToast: handleClose }) })
|
|
2016
|
+
] });
|
|
2017
|
+
}
|
|
2018
|
+
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: [
|
|
2019
|
+
/* @__PURE__ */ jsx12(
|
|
2020
|
+
"div",
|
|
2021
|
+
{
|
|
2022
|
+
className: "absolute left-0 top-0 w-full h-full rounded-xl",
|
|
2023
|
+
style: {
|
|
2024
|
+
background: theme === "dark" || theme === "system" && window.matchMedia("(prefers-color-scheme: dark)").matches ? "#0f1419" : lightBaseBackgroundByType[type],
|
|
2025
|
+
zIndex: -2
|
|
2026
|
+
}
|
|
2027
|
+
}
|
|
2028
|
+
),
|
|
2029
|
+
/* @__PURE__ */ jsx12(
|
|
2030
|
+
"div",
|
|
2031
|
+
{
|
|
2032
|
+
className: "absolute left-0 top-0 w-full h-full pointer-events-none rounded-xl",
|
|
2033
|
+
style: {
|
|
2034
|
+
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%)`,
|
|
2035
|
+
zIndex: -1
|
|
2036
|
+
}
|
|
2037
|
+
}
|
|
2038
|
+
),
|
|
2039
|
+
/* @__PURE__ */ jsx12(
|
|
2040
|
+
"div",
|
|
2041
|
+
{
|
|
2042
|
+
className: "absolute left-0 top-0 w-full h-full pointer-events-none rounded-xl",
|
|
2043
|
+
style: {
|
|
2044
|
+
border: "2px solid transparent",
|
|
2045
|
+
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%)`,
|
|
2046
|
+
backgroundOrigin: "border-box",
|
|
2047
|
+
backgroundClip: "border-box",
|
|
2048
|
+
WebkitMask: "linear-gradient(#ffffff 0 0) padding-box, linear-gradient(#ffffff 0 0)",
|
|
2049
|
+
WebkitMaskComposite: "xor",
|
|
2050
|
+
zIndex: 0
|
|
2051
|
+
}
|
|
2052
|
+
}
|
|
2053
|
+
),
|
|
2054
|
+
/* @__PURE__ */ jsx12("div", { className: "flex-shrink-0 mt-0.5 relative z-10", children: /* @__PURE__ */ jsx12("div", { className: `w-7 h-7 backdrop-blur-sm rounded-full flex items-center justify-center ${theme === "dark" || theme === "system" && window.matchMedia("(prefers-color-scheme: dark)").matches ? "bg-white/10" : "bg-black/5"}`, children: /* @__PURE__ */ jsx12(
|
|
2055
|
+
Icon4,
|
|
2056
|
+
{
|
|
2057
|
+
icon: iconConfig.icon,
|
|
2058
|
+
width: 16,
|
|
2059
|
+
height: 16,
|
|
2060
|
+
className: iconConfig.color,
|
|
2061
|
+
style: {
|
|
2062
|
+
color: themeConfig.gradientColor
|
|
2063
|
+
}
|
|
2064
|
+
}
|
|
2065
|
+
) }) }),
|
|
2066
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex flex-col gap-1 flex-1 relative z-10", children: [
|
|
2067
|
+
title && /* @__PURE__ */ jsx12(
|
|
2068
|
+
"div",
|
|
2069
|
+
{
|
|
2070
|
+
className: "text-[16px] font-semibold leading-tight drop-shadow-sm",
|
|
2071
|
+
style: {
|
|
2072
|
+
color: getTextColor(),
|
|
2073
|
+
backgroundClip: "text"
|
|
2074
|
+
},
|
|
2075
|
+
children: title
|
|
2076
|
+
}
|
|
2077
|
+
),
|
|
2078
|
+
message && /* @__PURE__ */ jsx12(
|
|
2079
|
+
"div",
|
|
2080
|
+
{
|
|
2081
|
+
className: "text-[13px] font-normal leading-relaxed drop-shadow-sm",
|
|
2082
|
+
style: {
|
|
2083
|
+
color: getTextColor(),
|
|
2084
|
+
backgroundClip: "text"
|
|
2085
|
+
},
|
|
2086
|
+
children: message
|
|
2087
|
+
}
|
|
2088
|
+
)
|
|
2089
|
+
] }),
|
|
2090
|
+
/* @__PURE__ */ jsx12("div", { className: "relative z-10", children: /* @__PURE__ */ jsx12(CloseButton, { closeToast: handleClose }) })
|
|
2091
|
+
] });
|
|
2092
|
+
};
|
|
2093
|
+
var defaultToastOptions = {
|
|
2094
|
+
position: "bottom-right",
|
|
2095
|
+
autoClose: 3e3,
|
|
2096
|
+
hideProgressBar: true,
|
|
2097
|
+
closeOnClick: false,
|
|
2098
|
+
pauseOnHover: true,
|
|
2099
|
+
draggable: true,
|
|
2100
|
+
pauseOnFocusLoss: false,
|
|
2101
|
+
transition: Bounce
|
|
2102
|
+
};
|
|
2103
|
+
var getToastifyTheme = () => {
|
|
2104
|
+
if (typeof window !== "undefined") {
|
|
2105
|
+
const root = document.documentElement;
|
|
2106
|
+
if (root.classList.contains("dark")) return "dark";
|
|
2107
|
+
if (root.classList.contains("light")) return "light";
|
|
2108
|
+
return window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
2109
|
+
}
|
|
2110
|
+
return "light";
|
|
1858
2111
|
};
|
|
1859
2112
|
var createToast = (type) => {
|
|
1860
2113
|
return (params) => {
|
|
1861
|
-
const {
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
2114
|
+
const { title, message, component, options } = params;
|
|
2115
|
+
toast(
|
|
2116
|
+
({ closeToast }) => {
|
|
2117
|
+
if (params.render) return params.render(closeToast ?? (() => {
|
|
2118
|
+
}));
|
|
2119
|
+
return /* @__PURE__ */ jsx12(
|
|
2120
|
+
ToastContent,
|
|
2121
|
+
{
|
|
2122
|
+
type,
|
|
2123
|
+
title,
|
|
2124
|
+
message: message || "",
|
|
2125
|
+
component,
|
|
2126
|
+
closeToast
|
|
2127
|
+
}
|
|
2128
|
+
);
|
|
2129
|
+
},
|
|
2130
|
+
{
|
|
2131
|
+
...defaultToastOptions,
|
|
2132
|
+
...options,
|
|
2133
|
+
theme: getToastifyTheme(),
|
|
2134
|
+
className: "!p-0 !shadow-none !rounded-xl",
|
|
2135
|
+
style: { padding: 0, borderRadius: "0.75rem" }
|
|
2136
|
+
}
|
|
2137
|
+
);
|
|
1878
2138
|
};
|
|
1879
2139
|
};
|
|
1880
|
-
var
|
|
2140
|
+
var ClayxToast = {
|
|
1881
2141
|
success: createToast("success"),
|
|
1882
2142
|
error: createToast("error"),
|
|
1883
2143
|
warning: createToast("warning"),
|
|
@@ -1886,12 +2146,12 @@ var GoeyToast = {
|
|
|
1886
2146
|
};
|
|
1887
2147
|
|
|
1888
2148
|
// src/components/ui/LimitUpgradeToast.tsx
|
|
1889
|
-
import { jsx as
|
|
2149
|
+
import { jsx as jsx13, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1890
2150
|
var LimitToastContainer = ({ message, onUpgrade, closeToast }) => {
|
|
1891
|
-
const [hover, setHover] =
|
|
1892
|
-
const [closeHover, setCloseHover] =
|
|
1893
|
-
return /* @__PURE__ */
|
|
1894
|
-
/* @__PURE__ */
|
|
2151
|
+
const [hover, setHover] = React8.useState(false);
|
|
2152
|
+
const [closeHover, setCloseHover] = React8.useState(false);
|
|
2153
|
+
return /* @__PURE__ */ jsxs9("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: [
|
|
2154
|
+
/* @__PURE__ */ jsx13(
|
|
1895
2155
|
"div",
|
|
1896
2156
|
{
|
|
1897
2157
|
className: "absolute left-0 top-0 w-full h-full rounded-md",
|
|
@@ -1901,7 +2161,7 @@ var LimitToastContainer = ({ message, onUpgrade, closeToast }) => {
|
|
|
1901
2161
|
}
|
|
1902
2162
|
}
|
|
1903
2163
|
),
|
|
1904
|
-
/* @__PURE__ */
|
|
2164
|
+
/* @__PURE__ */ jsx13(
|
|
1905
2165
|
"div",
|
|
1906
2166
|
{
|
|
1907
2167
|
className: "absolute left-0 top-0 w-full h-full pointer-events-none rounded-md",
|
|
@@ -1911,7 +2171,7 @@ var LimitToastContainer = ({ message, onUpgrade, closeToast }) => {
|
|
|
1911
2171
|
}
|
|
1912
2172
|
}
|
|
1913
2173
|
),
|
|
1914
|
-
/* @__PURE__ */
|
|
2174
|
+
/* @__PURE__ */ jsx13(
|
|
1915
2175
|
"div",
|
|
1916
2176
|
{
|
|
1917
2177
|
className: "absolute left-0 top-0 w-full h-full pointer-events-none rounded-md",
|
|
@@ -1927,15 +2187,15 @@ var LimitToastContainer = ({ message, onUpgrade, closeToast }) => {
|
|
|
1927
2187
|
}
|
|
1928
2188
|
}
|
|
1929
2189
|
),
|
|
1930
|
-
/* @__PURE__ */
|
|
1931
|
-
/* @__PURE__ */
|
|
1932
|
-
/* @__PURE__ */
|
|
1933
|
-
/* @__PURE__ */
|
|
1934
|
-
/* @__PURE__ */
|
|
1935
|
-
/* @__PURE__ */
|
|
1936
|
-
/* @__PURE__ */
|
|
2190
|
+
/* @__PURE__ */ jsx13("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" }),
|
|
2191
|
+
/* @__PURE__ */ jsx13("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" } }),
|
|
2192
|
+
/* @__PURE__ */ jsx13("div", { className: "relative z-10 flex items-start gap-4 p-4", children: /* @__PURE__ */ jsxs9("div", { className: "flex flex-1 flex-col gap-3", children: [
|
|
2193
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex items-center justify-between", children: [
|
|
2194
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-2", children: [
|
|
2195
|
+
/* @__PURE__ */ jsx13("div", { className: "text-lg font-bold text-white", children: "Upgrade Required" }),
|
|
2196
|
+
/* @__PURE__ */ jsx13("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" })
|
|
1937
2197
|
] }),
|
|
1938
|
-
/* @__PURE__ */
|
|
2198
|
+
/* @__PURE__ */ jsx13(
|
|
1939
2199
|
ClayxButton,
|
|
1940
2200
|
{
|
|
1941
2201
|
onClick: closeToast,
|
|
@@ -1952,12 +2212,12 @@ var LimitToastContainer = ({ message, onUpgrade, closeToast }) => {
|
|
|
1952
2212
|
transition: "background-color 150ms ease",
|
|
1953
2213
|
cursor: "pointer"
|
|
1954
2214
|
},
|
|
1955
|
-
children: /* @__PURE__ */
|
|
2215
|
+
children: /* @__PURE__ */ jsx13(Icon5, { icon: "iconamoon:close", className: "w-4 h-4 text-gray-400" })
|
|
1956
2216
|
}
|
|
1957
2217
|
)
|
|
1958
2218
|
] }),
|
|
1959
|
-
/* @__PURE__ */
|
|
1960
|
-
/* @__PURE__ */
|
|
2219
|
+
/* @__PURE__ */ jsx13("p", { className: "text-sm text-gray-300 leading-relaxed", children: message }),
|
|
2220
|
+
/* @__PURE__ */ jsx13("div", { className: "mt-1 flex items-center gap-3", children: /* @__PURE__ */ jsx13(
|
|
1961
2221
|
ClayxButton,
|
|
1962
2222
|
{
|
|
1963
2223
|
onClick: () => {
|
|
@@ -1975,8 +2235,8 @@ var LimitToastContainer = ({ message, onUpgrade, closeToast }) => {
|
|
|
1975
2235
|
backgroundImage: hover ? "linear-gradient(to right, #9333ea, #db2777)" : "linear-gradient(to right, #a855f7, #ec4899)",
|
|
1976
2236
|
boxShadow: hover ? "0 10px 15px -3px rgba(168,85,247,0.3), 0 4px 6px -2px rgba(168,85,247,0.3)" : "none"
|
|
1977
2237
|
},
|
|
1978
|
-
children: /* @__PURE__ */
|
|
1979
|
-
/* @__PURE__ */
|
|
2238
|
+
children: /* @__PURE__ */ jsxs9("span", { className: "flex items-center gap-2", children: [
|
|
2239
|
+
/* @__PURE__ */ jsx13(Icon5, { icon: "solar:rocket-2-bold", className: "w-4 h-4" }),
|
|
1980
2240
|
"Upgrade Now"
|
|
1981
2241
|
] })
|
|
1982
2242
|
}
|
|
@@ -1985,8 +2245,8 @@ var LimitToastContainer = ({ message, onUpgrade, closeToast }) => {
|
|
|
1985
2245
|
] });
|
|
1986
2246
|
};
|
|
1987
2247
|
function showLimitUpgradeToast(message, onUpgrade) {
|
|
1988
|
-
|
|
1989
|
-
render: (closeToast) => /* @__PURE__ */
|
|
2248
|
+
ClayxToast.default({
|
|
2249
|
+
render: (closeToast) => /* @__PURE__ */ jsx13(LimitToastContainer, { message, onUpgrade, closeToast }),
|
|
1990
2250
|
options: {
|
|
1991
2251
|
autoClose: false
|
|
1992
2252
|
}
|
|
@@ -2441,7 +2701,7 @@ async function executeSSEWorkflow(request, options = {}) {
|
|
|
2441
2701
|
if (errorData.log_type === "execution_display_error") {
|
|
2442
2702
|
const errorContent = errorData.content;
|
|
2443
2703
|
const displayMessage = errorContent || "Workflow execution failed";
|
|
2444
|
-
|
|
2704
|
+
ClayxToast.error({
|
|
2445
2705
|
title: "Execution Error",
|
|
2446
2706
|
message: displayMessage
|
|
2447
2707
|
});
|
|
@@ -3547,11 +3807,11 @@ function createClient(opts) {
|
|
|
3547
3807
|
}
|
|
3548
3808
|
|
|
3549
3809
|
// src/hooks/use-mobile.ts
|
|
3550
|
-
import * as
|
|
3810
|
+
import * as React9 from "react";
|
|
3551
3811
|
var MOBILE_BREAKPOINT = 768;
|
|
3552
3812
|
function useIsMobile() {
|
|
3553
|
-
const [isMobile, setIsMobile] =
|
|
3554
|
-
|
|
3813
|
+
const [isMobile, setIsMobile] = React9.useState(void 0);
|
|
3814
|
+
React9.useEffect(() => {
|
|
3555
3815
|
const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
|
|
3556
3816
|
const onChange = () => {
|
|
3557
3817
|
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
@@ -3579,7 +3839,7 @@ function useDebounce(value, delay) {
|
|
|
3579
3839
|
}
|
|
3580
3840
|
|
|
3581
3841
|
// src/hooks/use-workflow-stream.ts
|
|
3582
|
-
import { useState as useState11, useCallback as
|
|
3842
|
+
import { useState as useState11, useCallback as useCallback6, useRef as useRef2 } from "react";
|
|
3583
3843
|
function useWorkflowStream() {
|
|
3584
3844
|
const [state, setState] = useState11({
|
|
3585
3845
|
loading: false,
|
|
@@ -3590,7 +3850,7 @@ function useWorkflowStream() {
|
|
|
3590
3850
|
error: null
|
|
3591
3851
|
});
|
|
3592
3852
|
const abortControllerRef = useRef2(null);
|
|
3593
|
-
const execute =
|
|
3853
|
+
const execute = useCallback6(async (executeWorkflowStream, workflowId, inputs) => {
|
|
3594
3854
|
setState({
|
|
3595
3855
|
loading: true,
|
|
3596
3856
|
progress: 0,
|
|
@@ -3643,7 +3903,7 @@ function useWorkflowStream() {
|
|
|
3643
3903
|
throw error;
|
|
3644
3904
|
}
|
|
3645
3905
|
}, []);
|
|
3646
|
-
const cancel =
|
|
3906
|
+
const cancel = useCallback6(() => {
|
|
3647
3907
|
if (abortControllerRef.current) {
|
|
3648
3908
|
abortControllerRef.current.abort();
|
|
3649
3909
|
setState((prev) => ({
|
|
@@ -3653,7 +3913,7 @@ function useWorkflowStream() {
|
|
|
3653
3913
|
}));
|
|
3654
3914
|
}
|
|
3655
3915
|
}, []);
|
|
3656
|
-
const reset =
|
|
3916
|
+
const reset = useCallback6(() => {
|
|
3657
3917
|
setState({
|
|
3658
3918
|
loading: false,
|
|
3659
3919
|
progress: 0,
|
|
@@ -3958,13 +4218,13 @@ var elementSelector = {
|
|
|
3958
4218
|
export {
|
|
3959
4219
|
AUTH_TOKEN_KEY,
|
|
3960
4220
|
ClayxButton,
|
|
4221
|
+
ClayxToast,
|
|
3961
4222
|
DefaultErrorFallback,
|
|
3962
4223
|
ElementSelector,
|
|
3963
4224
|
ElementSelectorProvider,
|
|
3964
4225
|
ErrorBoundary,
|
|
3965
4226
|
FloatingButton,
|
|
3966
4227
|
GlobalToastContainer,
|
|
3967
|
-
GoeyToast,
|
|
3968
4228
|
HowOneProvider,
|
|
3969
4229
|
Loading,
|
|
3970
4230
|
LoadingSpinner,
|