@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.js
CHANGED
|
@@ -284,13 +284,13 @@ var index_exports = {};
|
|
|
284
284
|
__export(index_exports, {
|
|
285
285
|
AUTH_TOKEN_KEY: () => AUTH_TOKEN_KEY,
|
|
286
286
|
ClayxButton: () => ClayxButton,
|
|
287
|
-
ClayxToast: () => ClayxToast,
|
|
288
287
|
DefaultErrorFallback: () => DefaultErrorFallback,
|
|
289
288
|
ElementSelector: () => ElementSelector,
|
|
290
289
|
ElementSelectorProvider: () => ElementSelectorProvider,
|
|
291
290
|
ErrorBoundary: () => ErrorBoundary,
|
|
292
291
|
FloatingButton: () => FloatingButton,
|
|
293
292
|
GlobalToastContainer: () => GlobalToastContainer,
|
|
293
|
+
GoeyToast: () => GoeyToast,
|
|
294
294
|
HowOneProvider: () => HowOneProvider,
|
|
295
295
|
Loading: () => Loading,
|
|
296
296
|
LoadingSpinner: () => LoadingSpinner,
|
|
@@ -1031,7 +1031,7 @@ var LoginForm = ({
|
|
|
1031
1031
|
};
|
|
1032
1032
|
|
|
1033
1033
|
// src/components/auth/HowoneProvider.tsx
|
|
1034
|
-
var
|
|
1034
|
+
var import_react9 = require("react");
|
|
1035
1035
|
init_auth();
|
|
1036
1036
|
|
|
1037
1037
|
// src/components/theme/ThemeProvider.tsx
|
|
@@ -1088,33 +1088,68 @@ var useTheme = () => {
|
|
|
1088
1088
|
};
|
|
1089
1089
|
|
|
1090
1090
|
// src/components/ui/Toast/GlobalToastContainer.tsx
|
|
1091
|
-
var
|
|
1091
|
+
var import_goey_toast = require("goey-toast");
|
|
1092
|
+
var import_styles = require("goey-toast/styles.css");
|
|
1093
|
+
|
|
1094
|
+
// src/components/theme/ThemeToggle.tsx
|
|
1095
|
+
var React2 = __toESM(require("react"));
|
|
1096
|
+
var import_react5 = require("@iconify/react");
|
|
1092
1097
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
1093
|
-
function
|
|
1098
|
+
function ThemeToggle({ className }) {
|
|
1099
|
+
const { setTheme, theme } = useTheme();
|
|
1100
|
+
const [mounted, setMounted] = React2.useState(false);
|
|
1101
|
+
React2.useEffect(() => {
|
|
1102
|
+
setMounted(true);
|
|
1103
|
+
}, []);
|
|
1104
|
+
const handleToggle = () => {
|
|
1105
|
+
if (theme === "dark") {
|
|
1106
|
+
setTheme("light");
|
|
1107
|
+
} else {
|
|
1108
|
+
setTheme("dark");
|
|
1109
|
+
}
|
|
1110
|
+
};
|
|
1111
|
+
if (!mounted) {
|
|
1112
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react5.Icon, { icon: "solar:sun-bold", width: 20, height: 20 });
|
|
1113
|
+
}
|
|
1094
1114
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1095
|
-
|
|
1115
|
+
"div",
|
|
1116
|
+
{
|
|
1117
|
+
className: `cursor-pointer ${className || ""}`,
|
|
1118
|
+
onClick: handleToggle,
|
|
1119
|
+
children: theme === "light" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react5.Icon, { icon: "solar:sun-bold", width: 20, height: 20 }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react5.Icon, { icon: "solar:moon-linear", width: 20, height: 20 })
|
|
1120
|
+
}
|
|
1121
|
+
);
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
// src/components/ui/Toast/GlobalToastContainer.tsx
|
|
1125
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
1126
|
+
function GlobalToastContainer() {
|
|
1127
|
+
const { theme } = useTheme();
|
|
1128
|
+
const resolvedTheme = theme === "dark" ? "dark" : "light";
|
|
1129
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1130
|
+
import_goey_toast.GoeyToaster,
|
|
1096
1131
|
{
|
|
1097
|
-
|
|
1098
|
-
|
|
1132
|
+
position: "bottom-right",
|
|
1133
|
+
theme: resolvedTheme
|
|
1099
1134
|
}
|
|
1100
1135
|
);
|
|
1101
1136
|
}
|
|
1102
1137
|
|
|
1103
1138
|
// src/components/ElementSelectorProvider.tsx
|
|
1104
|
-
var
|
|
1139
|
+
var import_react8 = require("react");
|
|
1105
1140
|
|
|
1106
1141
|
// src/components/ElementSelector.tsx
|
|
1107
|
-
var
|
|
1108
|
-
var
|
|
1142
|
+
var import_react6 = require("react");
|
|
1143
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1109
1144
|
var ElementSelector = ({
|
|
1110
1145
|
active,
|
|
1111
1146
|
onSelect,
|
|
1112
1147
|
onCancel
|
|
1113
1148
|
}) => {
|
|
1114
|
-
const [hoveredElement, setHoveredElement] = (0,
|
|
1115
|
-
const [highlightRect, setHighlightRect] = (0,
|
|
1116
|
-
const overlayRef = (0,
|
|
1117
|
-
const getSourceLocation = (0,
|
|
1149
|
+
const [hoveredElement, setHoveredElement] = (0, import_react6.useState)(null);
|
|
1150
|
+
const [highlightRect, setHighlightRect] = (0, import_react6.useState)(null);
|
|
1151
|
+
const overlayRef = (0, import_react6.useRef)(null);
|
|
1152
|
+
const getSourceLocation = (0, import_react6.useCallback)((element) => {
|
|
1118
1153
|
let current = element;
|
|
1119
1154
|
while (current && current !== document.body) {
|
|
1120
1155
|
const sourceLocationAttr = current.getAttribute("data-source-location");
|
|
@@ -1129,7 +1164,7 @@ var ElementSelector = ({
|
|
|
1129
1164
|
}
|
|
1130
1165
|
return null;
|
|
1131
1166
|
}, []);
|
|
1132
|
-
const handleMouseMove = (0,
|
|
1167
|
+
const handleMouseMove = (0, import_react6.useCallback)((e) => {
|
|
1133
1168
|
if (!active) return;
|
|
1134
1169
|
const elements = document.elementsFromPoint(e.clientX, e.clientY);
|
|
1135
1170
|
const targetElement = elements.find(
|
|
@@ -1141,7 +1176,7 @@ var ElementSelector = ({
|
|
|
1141
1176
|
setHighlightRect(rect);
|
|
1142
1177
|
}
|
|
1143
1178
|
}, [active, hoveredElement]);
|
|
1144
|
-
const handleClick = (0,
|
|
1179
|
+
const handleClick = (0, import_react6.useCallback)((e) => {
|
|
1145
1180
|
if (!active || !hoveredElement) return;
|
|
1146
1181
|
e.preventDefault();
|
|
1147
1182
|
e.stopPropagation();
|
|
@@ -1169,7 +1204,7 @@ var ElementSelector = ({
|
|
|
1169
1204
|
}
|
|
1170
1205
|
}
|
|
1171
1206
|
}, [active, hoveredElement, getSourceLocation, onSelect, onCancel]);
|
|
1172
|
-
(0,
|
|
1207
|
+
(0, import_react6.useEffect)(() => {
|
|
1173
1208
|
if (active) {
|
|
1174
1209
|
document.addEventListener("mousemove", handleMouseMove);
|
|
1175
1210
|
document.addEventListener("click", handleClick, true);
|
|
@@ -1185,8 +1220,8 @@ var ElementSelector = ({
|
|
|
1185
1220
|
}
|
|
1186
1221
|
}, [active, handleMouseMove, handleClick]);
|
|
1187
1222
|
if (!active) return null;
|
|
1188
|
-
return /* @__PURE__ */ (0,
|
|
1189
|
-
/* @__PURE__ */ (0,
|
|
1223
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
1224
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1190
1225
|
"div",
|
|
1191
1226
|
{
|
|
1192
1227
|
ref: overlayRef,
|
|
@@ -1203,7 +1238,7 @@ var ElementSelector = ({
|
|
|
1203
1238
|
}
|
|
1204
1239
|
}
|
|
1205
1240
|
),
|
|
1206
|
-
highlightRect && /* @__PURE__ */ (0,
|
|
1241
|
+
highlightRect && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1207
1242
|
"div",
|
|
1208
1243
|
{
|
|
1209
1244
|
style: {
|
|
@@ -1221,7 +1256,7 @@ var ElementSelector = ({
|
|
|
1221
1256
|
}
|
|
1222
1257
|
}
|
|
1223
1258
|
),
|
|
1224
|
-
hoveredElement && highlightRect && /* @__PURE__ */ (0,
|
|
1259
|
+
hoveredElement && highlightRect && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1225
1260
|
"div",
|
|
1226
1261
|
{
|
|
1227
1262
|
style: {
|
|
@@ -1247,17 +1282,17 @@ var ElementSelector = ({
|
|
|
1247
1282
|
};
|
|
1248
1283
|
|
|
1249
1284
|
// src/hooks/use-element-selector.ts
|
|
1250
|
-
var
|
|
1285
|
+
var import_react7 = require("react");
|
|
1251
1286
|
function useElementSelector() {
|
|
1252
|
-
const [isSelecting, setIsSelecting] = (0,
|
|
1253
|
-
const [selectedElement, setSelectedElement] = (0,
|
|
1254
|
-
const startSelecting = (0,
|
|
1287
|
+
const [isSelecting, setIsSelecting] = (0, import_react7.useState)(false);
|
|
1288
|
+
const [selectedElement, setSelectedElement] = (0, import_react7.useState)(null);
|
|
1289
|
+
const startSelecting = (0, import_react7.useCallback)(() => {
|
|
1255
1290
|
setIsSelecting(true);
|
|
1256
1291
|
}, []);
|
|
1257
|
-
const stopSelecting = (0,
|
|
1292
|
+
const stopSelecting = (0, import_react7.useCallback)(() => {
|
|
1258
1293
|
setIsSelecting(false);
|
|
1259
1294
|
}, []);
|
|
1260
|
-
const clearSelection = (0,
|
|
1295
|
+
const clearSelection = (0, import_react7.useCallback)(() => {
|
|
1261
1296
|
setSelectedElement(null);
|
|
1262
1297
|
}, []);
|
|
1263
1298
|
return {
|
|
@@ -1278,10 +1313,10 @@ function sendElementSelectionToParent(data) {
|
|
|
1278
1313
|
}
|
|
1279
1314
|
|
|
1280
1315
|
// src/components/ElementSelectorProvider.tsx
|
|
1281
|
-
var
|
|
1316
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1282
1317
|
var ElementSelectorProvider = ({ children }) => {
|
|
1283
|
-
const [isSelecting, setIsSelecting] = (0,
|
|
1284
|
-
const handleCancel = (0,
|
|
1318
|
+
const [isSelecting, setIsSelecting] = (0, import_react8.useState)(false);
|
|
1319
|
+
const handleCancel = (0, import_react8.useCallback)(() => {
|
|
1285
1320
|
setIsSelecting(false);
|
|
1286
1321
|
if (window.parent && window.parent !== window) {
|
|
1287
1322
|
window.parent.postMessage({
|
|
@@ -1289,10 +1324,10 @@ var ElementSelectorProvider = ({ children }) => {
|
|
|
1289
1324
|
}, "*");
|
|
1290
1325
|
}
|
|
1291
1326
|
}, []);
|
|
1292
|
-
const handleSelect = (0,
|
|
1327
|
+
const handleSelect = (0, import_react8.useCallback)((data) => {
|
|
1293
1328
|
sendElementSelectionToParent(data);
|
|
1294
1329
|
}, []);
|
|
1295
|
-
(0,
|
|
1330
|
+
(0, import_react8.useEffect)(() => {
|
|
1296
1331
|
const handleStartSelection = () => {
|
|
1297
1332
|
setIsSelecting(true);
|
|
1298
1333
|
};
|
|
@@ -1315,9 +1350,9 @@ var ElementSelectorProvider = ({ children }) => {
|
|
|
1315
1350
|
window.removeEventListener("message", handleMessage);
|
|
1316
1351
|
};
|
|
1317
1352
|
}, [handleCancel]);
|
|
1318
|
-
return /* @__PURE__ */ (0,
|
|
1353
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
1319
1354
|
children,
|
|
1320
|
-
/* @__PURE__ */ (0,
|
|
1355
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1321
1356
|
ElementSelector,
|
|
1322
1357
|
{
|
|
1323
1358
|
active: isSelecting,
|
|
@@ -1330,8 +1365,9 @@ var ElementSelectorProvider = ({ children }) => {
|
|
|
1330
1365
|
|
|
1331
1366
|
// src/components/auth/HowoneProvider.tsx
|
|
1332
1367
|
init_config();
|
|
1333
|
-
var
|
|
1334
|
-
var HowoneContext = (0,
|
|
1368
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1369
|
+
var HowoneContext = (0, import_react9.createContext)(null);
|
|
1370
|
+
var consumedTokenCache = /* @__PURE__ */ new Set();
|
|
1335
1371
|
var redirectOverlayStylesInjected = false;
|
|
1336
1372
|
var injectRedirectOverlayStyles = () => {
|
|
1337
1373
|
if (redirectOverlayStylesInjected || typeof document === "undefined") return;
|
|
@@ -1391,38 +1427,52 @@ var HowOneProvider = ({
|
|
|
1391
1427
|
forceDefaultTheme = false,
|
|
1392
1428
|
redirectOnUnauthenticated = true
|
|
1393
1429
|
}) => {
|
|
1394
|
-
const [user, setUser] = (0,
|
|
1395
|
-
const [token, setTokenState] = (0,
|
|
1396
|
-
const [hasCheckedUrlToken, setHasCheckedUrlToken] = (0,
|
|
1397
|
-
const [pendingRedirect, setPendingRedirect] = (0,
|
|
1398
|
-
const authCookieRoot = (0,
|
|
1430
|
+
const [user, setUser] = (0, import_react9.useState)(() => parseUserFromToken(getToken()));
|
|
1431
|
+
const [token, setTokenState] = (0, import_react9.useState)(() => getToken());
|
|
1432
|
+
const [hasCheckedUrlToken, setHasCheckedUrlToken] = (0, import_react9.useState)(false);
|
|
1433
|
+
const [pendingRedirect, setPendingRedirect] = (0, import_react9.useState)(false);
|
|
1434
|
+
const authCookieRoot = (0, import_react9.useMemo)(() => {
|
|
1399
1435
|
const env3 = getGlobalEnvironment() ?? "dev";
|
|
1400
1436
|
return setEnvironment(env3).AUTH_COOKIE_ROOT_VALUE;
|
|
1401
1437
|
}, []);
|
|
1402
|
-
const consumeTokenToCookie = (0,
|
|
1438
|
+
const consumeTokenToCookie = (0, import_react9.useCallback)(async (value2) => {
|
|
1439
|
+
if (!value2) return;
|
|
1440
|
+
if (consumedTokenCache.has(value2)) return;
|
|
1441
|
+
consumedTokenCache.add(value2);
|
|
1403
1442
|
try {
|
|
1404
|
-
await fetch(`${authCookieRoot}/consume`, {
|
|
1443
|
+
const response = await fetch(`${authCookieRoot}/consume`, {
|
|
1405
1444
|
method: "POST",
|
|
1406
1445
|
credentials: "include",
|
|
1407
1446
|
headers: {
|
|
1408
1447
|
Authorization: `Bearer ${value2}`
|
|
1409
1448
|
}
|
|
1410
1449
|
});
|
|
1450
|
+
if (!response.ok) {
|
|
1451
|
+
console.info("[HowOneProvider] consume token request failed:", response.status, response.statusText);
|
|
1452
|
+
}
|
|
1411
1453
|
} catch (error) {
|
|
1412
|
-
|
|
1454
|
+
try {
|
|
1455
|
+
const inIframe = typeof window !== "undefined" && window.top !== window.self;
|
|
1456
|
+
if (inIframe) {
|
|
1457
|
+
console.info("[HowOneProvider] consume token skipped in iframe context (likely third-party cookie/CORS policy).");
|
|
1458
|
+
return;
|
|
1459
|
+
}
|
|
1460
|
+
} catch {
|
|
1461
|
+
}
|
|
1462
|
+
console.warn("[HowOneProvider] Failed to consume token:", error);
|
|
1413
1463
|
}
|
|
1414
1464
|
}, [authCookieRoot]);
|
|
1415
|
-
const logoutFromCookie = (0,
|
|
1465
|
+
const logoutFromCookie = (0, import_react9.useCallback)(async () => {
|
|
1416
1466
|
try {
|
|
1417
1467
|
await fetch(`${authCookieRoot}/logout`, {
|
|
1418
1468
|
method: "POST",
|
|
1419
1469
|
credentials: "include"
|
|
1420
1470
|
});
|
|
1421
1471
|
} catch (error) {
|
|
1422
|
-
console.
|
|
1472
|
+
console.warn("[HowOneProvider] Failed to logout from cookie:", error);
|
|
1423
1473
|
}
|
|
1424
1474
|
}, [authCookieRoot]);
|
|
1425
|
-
const readAccessTokenCookie = (0,
|
|
1475
|
+
const readAccessTokenCookie = (0, import_react9.useCallback)(() => {
|
|
1426
1476
|
if (typeof document === "undefined") return null;
|
|
1427
1477
|
try {
|
|
1428
1478
|
const parts = document.cookie.split("; ");
|
|
@@ -1438,7 +1488,7 @@ var HowOneProvider = ({
|
|
|
1438
1488
|
}
|
|
1439
1489
|
return null;
|
|
1440
1490
|
}, []);
|
|
1441
|
-
(0,
|
|
1491
|
+
(0, import_react9.useEffect)(() => {
|
|
1442
1492
|
try {
|
|
1443
1493
|
const params = new URLSearchParams(window.location.search);
|
|
1444
1494
|
let urlToken = params.get("access_token") || params.get("token");
|
|
@@ -1467,12 +1517,12 @@ var HowOneProvider = ({
|
|
|
1467
1517
|
}
|
|
1468
1518
|
}
|
|
1469
1519
|
} catch (e) {
|
|
1470
|
-
console.
|
|
1520
|
+
console.warn("[HowOneProvider] Failed to capture token from URL:", e);
|
|
1471
1521
|
} finally {
|
|
1472
1522
|
setHasCheckedUrlToken(true);
|
|
1473
1523
|
}
|
|
1474
1524
|
}, [consumeTokenToCookie, readAccessTokenCookie]);
|
|
1475
|
-
const resolvedAuthUrl = (0,
|
|
1525
|
+
const resolvedAuthUrl = (0, import_react9.useMemo)(() => {
|
|
1476
1526
|
const env3 = getGlobalEnvironment() ?? "dev";
|
|
1477
1527
|
switch (env3) {
|
|
1478
1528
|
case "local":
|
|
@@ -1484,17 +1534,12 @@ var HowOneProvider = ({
|
|
|
1484
1534
|
return "https://howone.dev/auth";
|
|
1485
1535
|
}
|
|
1486
1536
|
}, []);
|
|
1487
|
-
(0,
|
|
1488
|
-
if (pendingRedirect) {
|
|
1489
|
-
injectRedirectOverlayStyles();
|
|
1490
|
-
}
|
|
1491
|
-
}, [pendingRedirect]);
|
|
1492
|
-
(0, import_react8.useEffect)(() => {
|
|
1537
|
+
(0, import_react9.useEffect)(() => {
|
|
1493
1538
|
if (pendingRedirect) {
|
|
1494
1539
|
injectRedirectOverlayStyles();
|
|
1495
1540
|
}
|
|
1496
1541
|
}, [pendingRedirect]);
|
|
1497
|
-
const redirectToAuth = (0,
|
|
1542
|
+
const redirectToAuth = (0, import_react9.useCallback)(() => {
|
|
1498
1543
|
if (!redirectOnUnauthenticated || typeof window === "undefined") return;
|
|
1499
1544
|
const activeProjectId = projectId ?? getDefaultProjectId();
|
|
1500
1545
|
const navigateToResolvedAuth = () => {
|
|
@@ -1508,7 +1553,7 @@ var HowOneProvider = ({
|
|
|
1508
1553
|
window.location.href = url.toString();
|
|
1509
1554
|
return;
|
|
1510
1555
|
} catch (error) {
|
|
1511
|
-
console.
|
|
1556
|
+
console.warn("[HowOneProvider] Failed to attach project_id to auth URL:", error);
|
|
1512
1557
|
}
|
|
1513
1558
|
}
|
|
1514
1559
|
window.location.href = resolvedAuthUrl;
|
|
@@ -1529,14 +1574,14 @@ var HowOneProvider = ({
|
|
|
1529
1574
|
});
|
|
1530
1575
|
return;
|
|
1531
1576
|
} catch (error) {
|
|
1532
|
-
console.
|
|
1577
|
+
console.warn("[HowOneProvider] Failed to build auth URL:", error);
|
|
1533
1578
|
}
|
|
1534
1579
|
navigateToResolvedAuth();
|
|
1535
1580
|
} catch {
|
|
1536
1581
|
navigateToResolvedAuth();
|
|
1537
1582
|
}
|
|
1538
1583
|
}, [redirectOnUnauthenticated, resolvedAuthUrl, projectId]);
|
|
1539
|
-
(0,
|
|
1584
|
+
(0, import_react9.useEffect)(() => {
|
|
1540
1585
|
if (!hasCheckedUrlToken) return;
|
|
1541
1586
|
if (!token && !user) {
|
|
1542
1587
|
redirectToAuth();
|
|
@@ -1559,31 +1604,31 @@ var HowOneProvider = ({
|
|
|
1559
1604
|
logout
|
|
1560
1605
|
};
|
|
1561
1606
|
if (!hasCheckedUrlToken) return null;
|
|
1562
|
-
return /* @__PURE__ */ (0,
|
|
1607
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
1563
1608
|
ThemeProvider,
|
|
1564
1609
|
{
|
|
1565
1610
|
defaultTheme,
|
|
1566
1611
|
storageKey: themeStorageKey,
|
|
1567
1612
|
forceDefault: forceDefaultTheme,
|
|
1568
1613
|
children: [
|
|
1569
|
-
/* @__PURE__ */ (0,
|
|
1614
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ElementSelectorProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(HowoneContext.Provider, { value, children: [
|
|
1570
1615
|
children,
|
|
1571
|
-
showHowOneFlag && /* @__PURE__ */ (0,
|
|
1572
|
-
pendingRedirect && /* @__PURE__ */ (0,
|
|
1616
|
+
showHowOneFlag && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(FloatingButton, { onClick: () => window.open("https://howone.ai", "_blank") }),
|
|
1617
|
+
pendingRedirect && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1573
1618
|
"div",
|
|
1574
1619
|
{
|
|
1575
1620
|
"data-howone-auth-overlay-root": true,
|
|
1576
1621
|
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",
|
|
1577
|
-
children: /* @__PURE__ */ (0,
|
|
1578
|
-
/* @__PURE__ */ (0,
|
|
1622
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "relative mt-6 flex h-[220px] w-[220px] items-center justify-center", children: [
|
|
1623
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1579
1624
|
"div",
|
|
1580
1625
|
{
|
|
1581
1626
|
className: "absolute inset-0 rounded-full bg-white/20",
|
|
1582
1627
|
style: { animation: "howone-glow-ring 2.4s ease-in-out infinite" }
|
|
1583
1628
|
}
|
|
1584
1629
|
),
|
|
1585
|
-
/* @__PURE__ */ (0,
|
|
1586
|
-
/* @__PURE__ */ (0,
|
|
1630
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "absolute inset-0 rounded-full bg-gradient-to-br from-white/10 via-white/25 to-white/10 blur-2xl" }),
|
|
1631
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1587
1632
|
"img",
|
|
1588
1633
|
{
|
|
1589
1634
|
style: { width: 250, animation: "howone-logo-pulse 2s ease-in-out infinite" },
|
|
@@ -1595,13 +1640,13 @@ var HowOneProvider = ({
|
|
|
1595
1640
|
}
|
|
1596
1641
|
)
|
|
1597
1642
|
] }) }),
|
|
1598
|
-
/* @__PURE__ */ (0,
|
|
1643
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(GlobalToastContainer, {})
|
|
1599
1644
|
]
|
|
1600
1645
|
}
|
|
1601
1646
|
);
|
|
1602
1647
|
};
|
|
1603
1648
|
function useHowoneContext() {
|
|
1604
|
-
const ctx = (0,
|
|
1649
|
+
const ctx = (0, import_react9.useContext)(HowoneContext);
|
|
1605
1650
|
if (!ctx) {
|
|
1606
1651
|
const t = getToken();
|
|
1607
1652
|
return {
|
|
@@ -1705,7 +1750,7 @@ var howone = {
|
|
|
1705
1750
|
var client_default = howone;
|
|
1706
1751
|
|
|
1707
1752
|
// src/components/ui/Loading.tsx
|
|
1708
|
-
var
|
|
1753
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1709
1754
|
var Loading = ({
|
|
1710
1755
|
size = "md",
|
|
1711
1756
|
text = "Loading...",
|
|
@@ -1718,14 +1763,14 @@ var Loading = ({
|
|
|
1718
1763
|
lg: "h-12 w-12"
|
|
1719
1764
|
};
|
|
1720
1765
|
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";
|
|
1721
|
-
return /* @__PURE__ */ (0,
|
|
1722
|
-
/* @__PURE__ */ (0,
|
|
1766
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: `${containerClasses} ${className}`, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "text-center", children: [
|
|
1767
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1723
1768
|
"div",
|
|
1724
1769
|
{
|
|
1725
1770
|
className: `animate-spin rounded-full border-2 border-gray-300 border-t-blue-600 mx-auto ${sizeClasses[size]}`
|
|
1726
1771
|
}
|
|
1727
1772
|
),
|
|
1728
|
-
text && /* @__PURE__ */ (0,
|
|
1773
|
+
text && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "mt-2 text-sm text-gray-600", children: text })
|
|
1729
1774
|
] }) });
|
|
1730
1775
|
};
|
|
1731
1776
|
var LoadingSpinner = ({
|
|
@@ -1737,7 +1782,7 @@ var LoadingSpinner = ({
|
|
|
1737
1782
|
md: "h-8 w-8",
|
|
1738
1783
|
lg: "h-12 w-12"
|
|
1739
1784
|
};
|
|
1740
|
-
return /* @__PURE__ */ (0,
|
|
1785
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1741
1786
|
"div",
|
|
1742
1787
|
{
|
|
1743
1788
|
className: `animate-spin rounded-full border-2 border-gray-300 border-t-blue-600 ${sizeClasses[size]} ${className}`
|
|
@@ -1746,9 +1791,9 @@ var LoadingSpinner = ({
|
|
|
1746
1791
|
};
|
|
1747
1792
|
|
|
1748
1793
|
// src/components/ui/ErrorBoundary.tsx
|
|
1749
|
-
var
|
|
1750
|
-
var
|
|
1751
|
-
var ErrorBoundary = class extends
|
|
1794
|
+
var import_react10 = require("react");
|
|
1795
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1796
|
+
var ErrorBoundary = class extends import_react10.Component {
|
|
1752
1797
|
constructor(props) {
|
|
1753
1798
|
super(props);
|
|
1754
1799
|
this.handleRetry = () => {
|
|
@@ -1770,13 +1815,13 @@ var ErrorBoundary = class extends import_react9.Component {
|
|
|
1770
1815
|
if (this.state.hasError) {
|
|
1771
1816
|
if (this.props.fallback) {
|
|
1772
1817
|
const FallbackComponent = this.props.fallback;
|
|
1773
|
-
return /* @__PURE__ */ (0,
|
|
1818
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(FallbackComponent, { error: this.state.error, retry: this.handleRetry });
|
|
1774
1819
|
}
|
|
1775
|
-
return /* @__PURE__ */ (0,
|
|
1776
|
-
/* @__PURE__ */ (0,
|
|
1777
|
-
/* @__PURE__ */ (0,
|
|
1778
|
-
/* @__PURE__ */ (0,
|
|
1779
|
-
/* @__PURE__ */ (0,
|
|
1820
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "min-h-[400px] flex items-center justify-center p-4", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "text-center max-w-md", children: [
|
|
1821
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "text-red-500 text-6xl mb-4", children: "\u26A0\uFE0F" }),
|
|
1822
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("h2", { className: "text-xl font-semibold text-gray-900 mb-2", children: "Something went wrong" }),
|
|
1823
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "text-gray-600 mb-4", children: "An unexpected error occurred. Please try refreshing the page." }),
|
|
1824
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1780
1825
|
"button",
|
|
1781
1826
|
{
|
|
1782
1827
|
onClick: this.handleRetry,
|
|
@@ -1790,10 +1835,10 @@ var ErrorBoundary = class extends import_react9.Component {
|
|
|
1790
1835
|
return this.props.children;
|
|
1791
1836
|
}
|
|
1792
1837
|
};
|
|
1793
|
-
var DefaultErrorFallback = ({ retry }) => /* @__PURE__ */ (0,
|
|
1794
|
-
/* @__PURE__ */ (0,
|
|
1795
|
-
/* @__PURE__ */ (0,
|
|
1796
|
-
retry && /* @__PURE__ */ (0,
|
|
1838
|
+
var DefaultErrorFallback = ({ retry }) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "min-h-[200px] flex items-center justify-center p-4", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "text-center", children: [
|
|
1839
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "text-red-500 text-4xl mb-2", children: "\u26A0\uFE0F" }),
|
|
1840
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "text-gray-600 mb-2", children: "Something went wrong" }),
|
|
1841
|
+
retry && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1797
1842
|
"button",
|
|
1798
1843
|
{
|
|
1799
1844
|
onClick: retry,
|
|
@@ -1804,7 +1849,7 @@ var DefaultErrorFallback = ({ retry }) => /* @__PURE__ */ (0, import_jsx_runtime
|
|
|
1804
1849
|
] }) });
|
|
1805
1850
|
|
|
1806
1851
|
// src/components/ui/ClayxButton.tsx
|
|
1807
|
-
var
|
|
1852
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1808
1853
|
var getSizeClasses = (size, isIconOnly) => {
|
|
1809
1854
|
if (isIconOnly) {
|
|
1810
1855
|
switch (size) {
|
|
@@ -1860,7 +1905,7 @@ var ClayxButton = ({
|
|
|
1860
1905
|
disabled:opacity-50 disabled:cursor-not-allowed disabled:pointer-events-none
|
|
1861
1906
|
`.replace(/\s+/g, " ").trim();
|
|
1862
1907
|
const combinedClasses = `${baseClasses} ${sizeClasses} ${variantClasses} ${className}`.trim();
|
|
1863
|
-
return /* @__PURE__ */ (0,
|
|
1908
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1864
1909
|
"button",
|
|
1865
1910
|
{
|
|
1866
1911
|
className: combinedClasses,
|
|
@@ -1872,349 +1917,38 @@ var ClayxButton = ({
|
|
|
1872
1917
|
};
|
|
1873
1918
|
|
|
1874
1919
|
// src/components/ui/LimitUpgradeToast.tsx
|
|
1875
|
-
var import_react13 = __toESM(require("react"));
|
|
1876
|
-
var import_react14 = require("@iconify/react");
|
|
1877
|
-
|
|
1878
|
-
// src/components/ui/Toast/ClayxToast.tsx
|
|
1879
1920
|
var import_react11 = __toESM(require("react"));
|
|
1880
|
-
var import_react_toastify2 = require("react-toastify");
|
|
1881
1921
|
var import_react12 = require("@iconify/react");
|
|
1882
1922
|
|
|
1883
|
-
// src/components/
|
|
1884
|
-
var
|
|
1885
|
-
var
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
const [mounted, setMounted] = React6.useState(false);
|
|
1890
|
-
React6.useEffect(() => {
|
|
1891
|
-
setMounted(true);
|
|
1892
|
-
}, []);
|
|
1893
|
-
const handleToggle = () => {
|
|
1894
|
-
if (theme === "dark") {
|
|
1895
|
-
setTheme("light");
|
|
1896
|
-
} else {
|
|
1897
|
-
setTheme("dark");
|
|
1898
|
-
}
|
|
1899
|
-
};
|
|
1900
|
-
if (!mounted) {
|
|
1901
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react10.Icon, { icon: "solar:sun-bold", width: 20, height: 20 });
|
|
1902
|
-
}
|
|
1903
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1904
|
-
"div",
|
|
1905
|
-
{
|
|
1906
|
-
className: `cursor-pointer ${className || ""}`,
|
|
1907
|
-
onClick: handleToggle,
|
|
1908
|
-
children: theme === "light" ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react10.Icon, { icon: "solar:sun-bold", width: 20, height: 20 }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react10.Icon, { icon: "solar:moon-linear", width: 20, height: 20 })
|
|
1909
|
-
}
|
|
1910
|
-
);
|
|
1911
|
-
}
|
|
1912
|
-
|
|
1913
|
-
// src/components/ui/Toast/ClayxToast.tsx
|
|
1914
|
-
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1915
|
-
var TOAST_ICONS = {
|
|
1916
|
-
success: {
|
|
1917
|
-
icon: "mdi:success",
|
|
1918
|
-
color: "text-green-400",
|
|
1919
|
-
className: "text-green-400",
|
|
1920
|
-
// 深色主题配置
|
|
1921
|
-
dark: {
|
|
1922
|
-
bgGradient: "bg-[#14181d]",
|
|
1923
|
-
// 移除透明度 f2
|
|
1924
|
-
gradientColor: "#389726",
|
|
1925
|
-
borderGradient: "border-[#389726]",
|
|
1926
|
-
borderGradientColor: "#389726"
|
|
1927
|
-
},
|
|
1928
|
-
// 浅色主题配置
|
|
1929
|
-
light: {
|
|
1930
|
-
bgGradient: "bg-[#fafafa]",
|
|
1931
|
-
// 移除透明度 ff
|
|
1932
|
-
gradientColor: "#22c55e",
|
|
1933
|
-
borderGradient: "border-[#22c55e]",
|
|
1934
|
-
borderGradientColor: "#22c55e"
|
|
1935
|
-
}
|
|
1936
|
-
},
|
|
1937
|
-
error: {
|
|
1938
|
-
icon: "ic:outline-close",
|
|
1939
|
-
color: "text-red-400",
|
|
1940
|
-
className: "text-red-400",
|
|
1941
|
-
dark: {
|
|
1942
|
-
bgGradient: "bg-[#14181d]",
|
|
1943
|
-
// 移除透明度 f2
|
|
1944
|
-
gradientColor: "#ef4444",
|
|
1945
|
-
borderGradient: "border-[#ef4444]",
|
|
1946
|
-
borderGradientColor: "#ef4444"
|
|
1947
|
-
},
|
|
1948
|
-
light: {
|
|
1949
|
-
bgGradient: "bg-[#fafafa]",
|
|
1950
|
-
// 移除透明度 ff
|
|
1951
|
-
gradientColor: "#f87171",
|
|
1952
|
-
borderGradient: "border-[#f87171]",
|
|
1953
|
-
borderGradientColor: "#f87171"
|
|
1954
|
-
}
|
|
1955
|
-
},
|
|
1956
|
-
warning: {
|
|
1957
|
-
icon: "mi:warning",
|
|
1958
|
-
color: "text-yellow-400",
|
|
1959
|
-
className: "text-yellow-400",
|
|
1960
|
-
dark: {
|
|
1961
|
-
bgGradient: "bg-[#14181d]",
|
|
1962
|
-
// 移除透明度 f2
|
|
1963
|
-
gradientColor: "#facc15",
|
|
1964
|
-
borderGradient: "border-[#facc15]",
|
|
1965
|
-
borderGradientColor: "#facc15"
|
|
1966
|
-
},
|
|
1967
|
-
light: {
|
|
1968
|
-
bgGradient: "bg-[#fafafa]",
|
|
1969
|
-
// 移除透明度 ff
|
|
1970
|
-
gradientColor: "#f59e0b",
|
|
1971
|
-
borderGradient: "border-[#f59e0b]",
|
|
1972
|
-
borderGradientColor: "#f59e0b"
|
|
1973
|
-
}
|
|
1974
|
-
},
|
|
1975
|
-
info: {
|
|
1976
|
-
icon: "ic:outline-info",
|
|
1977
|
-
color: "text-blue-400",
|
|
1978
|
-
className: "text-blue-400",
|
|
1979
|
-
dark: {
|
|
1980
|
-
bgGradient: "bg-[#14181d]",
|
|
1981
|
-
// 移除透明度 f2
|
|
1982
|
-
gradientColor: "#60a5fa",
|
|
1983
|
-
borderGradient: "border-[#60a5fa]",
|
|
1984
|
-
borderGradientColor: "#f0f0f0"
|
|
1985
|
-
},
|
|
1986
|
-
light: {
|
|
1987
|
-
bgGradient: "bg-[#fafafa]",
|
|
1988
|
-
// 移除透明度 ff
|
|
1989
|
-
gradientColor: "#3b82f6",
|
|
1990
|
-
borderGradient: "border-[#3b82f6]",
|
|
1991
|
-
borderGradientColor: "#3b82f6"
|
|
1992
|
-
}
|
|
1993
|
-
},
|
|
1994
|
-
default: {
|
|
1995
|
-
icon: "ic:round-notifications",
|
|
1996
|
-
color: "text-gray-400",
|
|
1997
|
-
className: "text-gray-400",
|
|
1998
|
-
dark: {
|
|
1999
|
-
bgGradient: "bg-[#14181d]",
|
|
2000
|
-
// 移除透明度 f2
|
|
2001
|
-
gradientColor: "#9ca3af",
|
|
2002
|
-
borderGradient: "border-[#9ca3af]",
|
|
2003
|
-
borderGradientColor: "#9ca3af"
|
|
2004
|
-
},
|
|
2005
|
-
light: {
|
|
2006
|
-
bgGradient: "bg-[#fafafa]",
|
|
2007
|
-
// 移除透明度 ff
|
|
2008
|
-
gradientColor: "#6b7280",
|
|
2009
|
-
borderGradient: "border-[#6b7280]",
|
|
2010
|
-
borderGradientColor: "#6b7280"
|
|
2011
|
-
}
|
|
2012
|
-
}
|
|
2013
|
-
};
|
|
2014
|
-
var CloseButton = import_react11.default.memo(({ closeToast }) => {
|
|
2015
|
-
const { theme } = useTheme();
|
|
2016
|
-
const handleClick = (0, import_react11.useCallback)((e) => {
|
|
2017
|
-
e.preventDefault();
|
|
2018
|
-
e.stopPropagation();
|
|
2019
|
-
closeToast?.();
|
|
2020
|
-
}, [closeToast]);
|
|
2021
|
-
const getCloseButtonColor = () => {
|
|
2022
|
-
const actualTheme = theme === "system" ? window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" : theme;
|
|
2023
|
-
return actualTheme === "dark" ? "#b4b4b4" : "#6b7280";
|
|
2024
|
-
};
|
|
2025
|
-
const getCloseButtonHoverColor = () => {
|
|
2026
|
-
const actualTheme = theme === "system" ? window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" : theme;
|
|
2027
|
-
return actualTheme === "dark" ? "white" : "#374151";
|
|
2028
|
-
};
|
|
2029
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2030
|
-
import_react12.Icon,
|
|
2031
|
-
{
|
|
2032
|
-
icon: "vaadin:close",
|
|
2033
|
-
className: "flex items-center justify-center rounded-full relative z-10 flex-shrink-0 cursor-pointer \n transition-colors duration-200 drop-shadow-sm",
|
|
2034
|
-
onClick: handleClick,
|
|
2035
|
-
width: 14,
|
|
2036
|
-
height: 14,
|
|
2037
|
-
style: {
|
|
2038
|
-
color: getCloseButtonColor()
|
|
2039
|
-
},
|
|
2040
|
-
onMouseEnter: (e) => {
|
|
2041
|
-
e.currentTarget.style.color = getCloseButtonHoverColor();
|
|
2042
|
-
},
|
|
2043
|
-
onMouseLeave: (e) => {
|
|
2044
|
-
e.currentTarget.style.color = getCloseButtonColor();
|
|
2045
|
-
}
|
|
2046
|
-
}
|
|
2047
|
-
);
|
|
2048
|
-
});
|
|
2049
|
-
CloseButton.displayName = "CloseButton";
|
|
2050
|
-
var ToastContent = ({ type, title, message, component, closeToast }) => {
|
|
2051
|
-
const iconConfig = TOAST_ICONS[type];
|
|
2052
|
-
const { theme } = useTheme();
|
|
2053
|
-
const handleClose = (0, import_react11.useCallback)(() => {
|
|
2054
|
-
closeToast?.();
|
|
2055
|
-
}, [closeToast]);
|
|
2056
|
-
const getTextColor = () => {
|
|
2057
|
-
const actualTheme = theme === "system" ? window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" : theme;
|
|
2058
|
-
return actualTheme === "dark" ? "white" : "#1f2937";
|
|
2059
|
-
};
|
|
2060
|
-
const getThemeConfig = () => {
|
|
2061
|
-
const actualTheme = theme === "system" ? window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" : theme;
|
|
2062
|
-
return actualTheme === "dark" ? iconConfig.dark : iconConfig.light;
|
|
2063
|
-
};
|
|
2064
|
-
const themeConfig = getThemeConfig();
|
|
2065
|
-
const lightBaseBackgroundByType = {
|
|
2066
|
-
success: "#f0fdf4",
|
|
2067
|
-
// green-50
|
|
2068
|
-
error: "#fef2f2",
|
|
2069
|
-
// red-50
|
|
2070
|
-
warning: "#fffbeb",
|
|
2071
|
-
// amber-50
|
|
2072
|
-
info: "#eff6ff",
|
|
2073
|
-
// blue-50
|
|
2074
|
-
default: "#f9fafb"
|
|
2075
|
-
// gray-50
|
|
2076
|
-
};
|
|
2077
|
-
if (component) {
|
|
2078
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: `flex items-start gap-3 !min-h-[90px] w-full backdrop-blur-md p-4 shadow-2xl overflow-hidden ${themeConfig.bgGradient}`, children: [
|
|
2079
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex-1 relative z-10", children: component }),
|
|
2080
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "relative z-10", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CloseButton, { closeToast: handleClose }) })
|
|
2081
|
-
] });
|
|
2082
|
-
}
|
|
2083
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("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: [
|
|
2084
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2085
|
-
"div",
|
|
2086
|
-
{
|
|
2087
|
-
className: "absolute left-0 top-0 w-full h-full rounded-xl",
|
|
2088
|
-
style: {
|
|
2089
|
-
background: theme === "dark" || theme === "system" && window.matchMedia("(prefers-color-scheme: dark)").matches ? "#0f1419" : lightBaseBackgroundByType[type],
|
|
2090
|
-
zIndex: -2
|
|
2091
|
-
}
|
|
2092
|
-
}
|
|
2093
|
-
),
|
|
2094
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2095
|
-
"div",
|
|
2096
|
-
{
|
|
2097
|
-
className: "absolute left-0 top-0 w-full h-full pointer-events-none rounded-xl",
|
|
2098
|
-
style: {
|
|
2099
|
-
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%)`,
|
|
2100
|
-
zIndex: -1
|
|
2101
|
-
}
|
|
2102
|
-
}
|
|
2103
|
-
),
|
|
2104
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2105
|
-
"div",
|
|
2106
|
-
{
|
|
2107
|
-
className: "absolute left-0 top-0 w-full h-full pointer-events-none rounded-xl",
|
|
2108
|
-
style: {
|
|
2109
|
-
border: "2px solid transparent",
|
|
2110
|
-
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%)`,
|
|
2111
|
-
backgroundOrigin: "border-box",
|
|
2112
|
-
backgroundClip: "border-box",
|
|
2113
|
-
WebkitMask: "linear-gradient(#ffffff 0 0) padding-box, linear-gradient(#ffffff 0 0)",
|
|
2114
|
-
WebkitMaskComposite: "xor",
|
|
2115
|
-
zIndex: 0
|
|
2116
|
-
}
|
|
2117
|
-
}
|
|
2118
|
-
),
|
|
2119
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex-shrink-0 flex-grow-0 mt-0.5 relative z-10", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2120
|
-
"div",
|
|
2121
|
-
{
|
|
2122
|
-
className: "backdrop-blur-sm rounded-full flex items-center justify-center overflow-hidden flex-shrink-0 flex-grow-0",
|
|
2123
|
-
style: {
|
|
2124
|
-
backgroundColor: theme === "dark" || theme === "system" && window.matchMedia("(prefers-color-scheme: dark)").matches ? "rgba(255, 255, 255, 0.1)" : "rgba(0, 0, 0, 0.05)",
|
|
2125
|
-
width: "28px",
|
|
2126
|
-
height: "28px"
|
|
2127
|
-
},
|
|
2128
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "rounded-full flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2129
|
-
import_react12.Icon,
|
|
2130
|
-
{
|
|
2131
|
-
icon: iconConfig.icon,
|
|
2132
|
-
width: 16,
|
|
2133
|
-
height: 16,
|
|
2134
|
-
className: `flex-shrink-0`,
|
|
2135
|
-
style: {
|
|
2136
|
-
color: themeConfig.gradientColor,
|
|
2137
|
-
display: "block"
|
|
2138
|
-
}
|
|
2139
|
-
}
|
|
2140
|
-
) })
|
|
2141
|
-
}
|
|
2142
|
-
) }),
|
|
2143
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex flex-col gap-1 flex-1 relative z-10", children: [
|
|
2144
|
-
title && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2145
|
-
"div",
|
|
2146
|
-
{
|
|
2147
|
-
className: "text-[16px] font-semibold leading-tight drop-shadow-sm",
|
|
2148
|
-
style: {
|
|
2149
|
-
color: getTextColor(),
|
|
2150
|
-
backgroundClip: "text"
|
|
2151
|
-
},
|
|
2152
|
-
children: title
|
|
2153
|
-
}
|
|
2154
|
-
),
|
|
2155
|
-
message && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2156
|
-
"div",
|
|
2157
|
-
{
|
|
2158
|
-
className: "text-[13px] font-normal leading-relaxed drop-shadow-sm",
|
|
2159
|
-
style: {
|
|
2160
|
-
color: getTextColor(),
|
|
2161
|
-
backgroundClip: "text"
|
|
2162
|
-
},
|
|
2163
|
-
children: message
|
|
2164
|
-
}
|
|
2165
|
-
)
|
|
2166
|
-
] }),
|
|
2167
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "relative z-10", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CloseButton, { closeToast: handleClose }) })
|
|
2168
|
-
] });
|
|
2169
|
-
};
|
|
2170
|
-
var defaultToastOptions = {
|
|
2171
|
-
position: "bottom-right",
|
|
2172
|
-
autoClose: 1500,
|
|
2173
|
-
hideProgressBar: true,
|
|
2174
|
-
closeOnClick: false,
|
|
2175
|
-
pauseOnHover: true,
|
|
2176
|
-
draggable: true,
|
|
2177
|
-
pauseOnFocusLoss: false,
|
|
2178
|
-
transition: import_react_toastify2.Bounce
|
|
2179
|
-
};
|
|
2180
|
-
var getToastifyTheme = () => {
|
|
2181
|
-
if (typeof window !== "undefined") {
|
|
2182
|
-
const root = document.documentElement;
|
|
2183
|
-
if (root.classList.contains("dark")) return "dark";
|
|
2184
|
-
if (root.classList.contains("light")) return "light";
|
|
2185
|
-
return window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
2186
|
-
}
|
|
2187
|
-
return "light";
|
|
1923
|
+
// src/components/ui/Toast/GoeyToast.tsx
|
|
1924
|
+
var import_goey_toast2 = require("goey-toast");
|
|
1925
|
+
var resolveDuration = (autoClose) => {
|
|
1926
|
+
if (typeof autoClose === "number") return autoClose;
|
|
1927
|
+
if (autoClose === false) return 24 * 60 * 60 * 1e3;
|
|
1928
|
+
return void 0;
|
|
2188
1929
|
};
|
|
2189
1930
|
var createToast = (type) => {
|
|
2190
1931
|
return (params) => {
|
|
2191
|
-
const {
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
...options,
|
|
2209
|
-
theme: getToastifyTheme(),
|
|
2210
|
-
// 确保圆角样式不被覆盖,添加 rounded-xl 类
|
|
2211
|
-
className: "!p-0 !shadow-none !rounded-xl",
|
|
2212
|
-
style: { padding: 0, borderRadius: "0.75rem", backgroundColor: "transparent" }
|
|
2213
|
-
}
|
|
2214
|
-
);
|
|
1932
|
+
const { autoClose, ...rawOptions } = params.options ?? {};
|
|
1933
|
+
const id = params.options?.id ?? `goey-${Date.now()}-${Math.random()}`;
|
|
1934
|
+
const closeToast = () => import_goey_toast2.goeyToast.dismiss(id);
|
|
1935
|
+
const description = params.component ?? (params.render ? params.render(closeToast) : params.message);
|
|
1936
|
+
const duration = resolveDuration(autoClose);
|
|
1937
|
+
const goeyOptions = {
|
|
1938
|
+
...rawOptions,
|
|
1939
|
+
id,
|
|
1940
|
+
description,
|
|
1941
|
+
...duration !== void 0 ? { duration } : {}
|
|
1942
|
+
};
|
|
1943
|
+
const title = params.title ?? "";
|
|
1944
|
+
if (type === "default") {
|
|
1945
|
+
(0, import_goey_toast2.goeyToast)(title, goeyOptions);
|
|
1946
|
+
return;
|
|
1947
|
+
}
|
|
1948
|
+
import_goey_toast2.goeyToast[type](title, goeyOptions);
|
|
2215
1949
|
};
|
|
2216
1950
|
};
|
|
2217
|
-
var
|
|
1951
|
+
var GoeyToast = {
|
|
2218
1952
|
success: createToast("success"),
|
|
2219
1953
|
error: createToast("error"),
|
|
2220
1954
|
warning: createToast("warning"),
|
|
@@ -2223,12 +1957,12 @@ var ClayxToast = {
|
|
|
2223
1957
|
};
|
|
2224
1958
|
|
|
2225
1959
|
// src/components/ui/LimitUpgradeToast.tsx
|
|
2226
|
-
var
|
|
1960
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
2227
1961
|
var LimitToastContainer = ({ message, onUpgrade, closeToast }) => {
|
|
2228
|
-
const [hover, setHover] =
|
|
2229
|
-
const [closeHover, setCloseHover] =
|
|
2230
|
-
return /* @__PURE__ */ (0,
|
|
2231
|
-
/* @__PURE__ */ (0,
|
|
1962
|
+
const [hover, setHover] = import_react11.default.useState(false);
|
|
1963
|
+
const [closeHover, setCloseHover] = import_react11.default.useState(false);
|
|
1964
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("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: [
|
|
1965
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2232
1966
|
"div",
|
|
2233
1967
|
{
|
|
2234
1968
|
className: "absolute left-0 top-0 w-full h-full rounded-md",
|
|
@@ -2238,7 +1972,7 @@ var LimitToastContainer = ({ message, onUpgrade, closeToast }) => {
|
|
|
2238
1972
|
}
|
|
2239
1973
|
}
|
|
2240
1974
|
),
|
|
2241
|
-
/* @__PURE__ */ (0,
|
|
1975
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2242
1976
|
"div",
|
|
2243
1977
|
{
|
|
2244
1978
|
className: "absolute left-0 top-0 w-full h-full pointer-events-none rounded-md",
|
|
@@ -2248,7 +1982,7 @@ var LimitToastContainer = ({ message, onUpgrade, closeToast }) => {
|
|
|
2248
1982
|
}
|
|
2249
1983
|
}
|
|
2250
1984
|
),
|
|
2251
|
-
/* @__PURE__ */ (0,
|
|
1985
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2252
1986
|
"div",
|
|
2253
1987
|
{
|
|
2254
1988
|
className: "absolute left-0 top-0 w-full h-full pointer-events-none rounded-md",
|
|
@@ -2264,15 +1998,15 @@ var LimitToastContainer = ({ message, onUpgrade, closeToast }) => {
|
|
|
2264
1998
|
}
|
|
2265
1999
|
}
|
|
2266
2000
|
),
|
|
2267
|
-
/* @__PURE__ */ (0,
|
|
2268
|
-
/* @__PURE__ */ (0,
|
|
2269
|
-
/* @__PURE__ */ (0,
|
|
2270
|
-
/* @__PURE__ */ (0,
|
|
2271
|
-
/* @__PURE__ */ (0,
|
|
2272
|
-
/* @__PURE__ */ (0,
|
|
2273
|
-
/* @__PURE__ */ (0,
|
|
2001
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("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" }),
|
|
2002
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("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" } }),
|
|
2003
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "relative z-10 flex items-start gap-4 p-4", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex flex-1 flex-col gap-3", children: [
|
|
2004
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
2005
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
2006
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "text-lg font-bold text-white", children: "Upgrade Required" }),
|
|
2007
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("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" })
|
|
2274
2008
|
] }),
|
|
2275
|
-
/* @__PURE__ */ (0,
|
|
2009
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2276
2010
|
ClayxButton,
|
|
2277
2011
|
{
|
|
2278
2012
|
onClick: closeToast,
|
|
@@ -2289,12 +2023,12 @@ var LimitToastContainer = ({ message, onUpgrade, closeToast }) => {
|
|
|
2289
2023
|
transition: "background-color 150ms ease",
|
|
2290
2024
|
cursor: "pointer"
|
|
2291
2025
|
},
|
|
2292
|
-
children: /* @__PURE__ */ (0,
|
|
2026
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react12.Icon, { icon: "iconamoon:close", className: "w-4 h-4 text-gray-400" })
|
|
2293
2027
|
}
|
|
2294
2028
|
)
|
|
2295
2029
|
] }),
|
|
2296
|
-
/* @__PURE__ */ (0,
|
|
2297
|
-
/* @__PURE__ */ (0,
|
|
2030
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-sm text-gray-300 leading-relaxed", children: message }),
|
|
2031
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "mt-1 flex items-center gap-3", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2298
2032
|
ClayxButton,
|
|
2299
2033
|
{
|
|
2300
2034
|
onClick: () => {
|
|
@@ -2312,8 +2046,8 @@ var LimitToastContainer = ({ message, onUpgrade, closeToast }) => {
|
|
|
2312
2046
|
backgroundImage: hover ? "linear-gradient(to right, #9333ea, #db2777)" : "linear-gradient(to right, #a855f7, #ec4899)",
|
|
2313
2047
|
boxShadow: hover ? "0 10px 15px -3px rgba(168,85,247,0.3), 0 4px 6px -2px rgba(168,85,247,0.3)" : "none"
|
|
2314
2048
|
},
|
|
2315
|
-
children: /* @__PURE__ */ (0,
|
|
2316
|
-
/* @__PURE__ */ (0,
|
|
2049
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: "flex items-center gap-2", children: [
|
|
2050
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react12.Icon, { icon: "solar:rocket-2-bold", className: "w-4 h-4" }),
|
|
2317
2051
|
"Upgrade Now"
|
|
2318
2052
|
] })
|
|
2319
2053
|
}
|
|
@@ -2322,22 +2056,10 @@ var LimitToastContainer = ({ message, onUpgrade, closeToast }) => {
|
|
|
2322
2056
|
] });
|
|
2323
2057
|
};
|
|
2324
2058
|
function showLimitUpgradeToast(message, onUpgrade) {
|
|
2325
|
-
|
|
2326
|
-
render: (closeToast) => /* @__PURE__ */ (0,
|
|
2059
|
+
GoeyToast.default({
|
|
2060
|
+
render: (closeToast) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(LimitToastContainer, { message, onUpgrade, closeToast }),
|
|
2327
2061
|
options: {
|
|
2328
|
-
|
|
2329
|
-
closeOnClick: false,
|
|
2330
|
-
autoClose: false,
|
|
2331
|
-
hideProgressBar: true,
|
|
2332
|
-
draggable: false,
|
|
2333
|
-
pauseOnHover: true,
|
|
2334
|
-
className: "!bg-transparent !shadow-none",
|
|
2335
|
-
style: {
|
|
2336
|
-
background: "transparent",
|
|
2337
|
-
padding: 0,
|
|
2338
|
-
width: "auto",
|
|
2339
|
-
maxWidth: "420px"
|
|
2340
|
-
}
|
|
2062
|
+
autoClose: false
|
|
2341
2063
|
}
|
|
2342
2064
|
});
|
|
2343
2065
|
}
|
|
@@ -2790,7 +2512,7 @@ async function executeSSEWorkflow(request, options = {}) {
|
|
|
2790
2512
|
if (errorData.log_type === "execution_display_error") {
|
|
2791
2513
|
const errorContent = errorData.content;
|
|
2792
2514
|
const displayMessage = errorContent || "Workflow execution failed";
|
|
2793
|
-
|
|
2515
|
+
GoeyToast.error({
|
|
2794
2516
|
title: "Execution Error",
|
|
2795
2517
|
message: displayMessage
|
|
2796
2518
|
});
|
|
@@ -3896,11 +3618,11 @@ function createClient(opts) {
|
|
|
3896
3618
|
}
|
|
3897
3619
|
|
|
3898
3620
|
// src/hooks/use-mobile.ts
|
|
3899
|
-
var
|
|
3621
|
+
var React8 = __toESM(require("react"));
|
|
3900
3622
|
var MOBILE_BREAKPOINT = 768;
|
|
3901
3623
|
function useIsMobile() {
|
|
3902
|
-
const [isMobile, setIsMobile] =
|
|
3903
|
-
|
|
3624
|
+
const [isMobile, setIsMobile] = React8.useState(void 0);
|
|
3625
|
+
React8.useEffect(() => {
|
|
3904
3626
|
const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
|
|
3905
3627
|
const onChange = () => {
|
|
3906
3628
|
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
@@ -3913,10 +3635,10 @@ function useIsMobile() {
|
|
|
3913
3635
|
}
|
|
3914
3636
|
|
|
3915
3637
|
// src/hooks/use-debounce.ts
|
|
3916
|
-
var
|
|
3638
|
+
var import_react13 = require("react");
|
|
3917
3639
|
function useDebounce(value, delay) {
|
|
3918
|
-
const [debouncedValue, setDebouncedValue] = (0,
|
|
3919
|
-
(0,
|
|
3640
|
+
const [debouncedValue, setDebouncedValue] = (0, import_react13.useState)(value);
|
|
3641
|
+
(0, import_react13.useEffect)(() => {
|
|
3920
3642
|
const handler = setTimeout(() => {
|
|
3921
3643
|
setDebouncedValue(value);
|
|
3922
3644
|
}, delay);
|
|
@@ -3928,9 +3650,9 @@ function useDebounce(value, delay) {
|
|
|
3928
3650
|
}
|
|
3929
3651
|
|
|
3930
3652
|
// src/hooks/use-workflow-stream.ts
|
|
3931
|
-
var
|
|
3653
|
+
var import_react14 = require("react");
|
|
3932
3654
|
function useWorkflowStream() {
|
|
3933
|
-
const [state, setState] = (0,
|
|
3655
|
+
const [state, setState] = (0, import_react14.useState)({
|
|
3934
3656
|
loading: false,
|
|
3935
3657
|
progress: 0,
|
|
3936
3658
|
streamContent: "",
|
|
@@ -3938,8 +3660,8 @@ function useWorkflowStream() {
|
|
|
3938
3660
|
result: null,
|
|
3939
3661
|
error: null
|
|
3940
3662
|
});
|
|
3941
|
-
const abortControllerRef = (0,
|
|
3942
|
-
const execute = (0,
|
|
3663
|
+
const abortControllerRef = (0, import_react14.useRef)(null);
|
|
3664
|
+
const execute = (0, import_react14.useCallback)(async (executeWorkflowStream, workflowId, inputs) => {
|
|
3943
3665
|
setState({
|
|
3944
3666
|
loading: true,
|
|
3945
3667
|
progress: 0,
|
|
@@ -3992,7 +3714,7 @@ function useWorkflowStream() {
|
|
|
3992
3714
|
throw error;
|
|
3993
3715
|
}
|
|
3994
3716
|
}, []);
|
|
3995
|
-
const cancel = (0,
|
|
3717
|
+
const cancel = (0, import_react14.useCallback)(() => {
|
|
3996
3718
|
if (abortControllerRef.current) {
|
|
3997
3719
|
abortControllerRef.current.abort();
|
|
3998
3720
|
setState((prev) => ({
|
|
@@ -4002,7 +3724,7 @@ function useWorkflowStream() {
|
|
|
4002
3724
|
}));
|
|
4003
3725
|
}
|
|
4004
3726
|
}, []);
|
|
4005
|
-
const reset = (0,
|
|
3727
|
+
const reset = (0, import_react14.useCallback)(() => {
|
|
4006
3728
|
setState({
|
|
4007
3729
|
loading: false,
|
|
4008
3730
|
progress: 0,
|
|
@@ -4308,13 +4030,13 @@ var elementSelector = {
|
|
|
4308
4030
|
0 && (module.exports = {
|
|
4309
4031
|
AUTH_TOKEN_KEY,
|
|
4310
4032
|
ClayxButton,
|
|
4311
|
-
ClayxToast,
|
|
4312
4033
|
DefaultErrorFallback,
|
|
4313
4034
|
ElementSelector,
|
|
4314
4035
|
ElementSelectorProvider,
|
|
4315
4036
|
ErrorBoundary,
|
|
4316
4037
|
FloatingButton,
|
|
4317
4038
|
GlobalToastContainer,
|
|
4039
|
+
GoeyToast,
|
|
4318
4040
|
HowOneProvider,
|
|
4319
4041
|
Loading,
|
|
4320
4042
|
LoadingSpinner,
|