@howone/sdk 0.1.1 → 0.1.3

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.js CHANGED
@@ -41,41 +41,32 @@ __export(auth_exports, {
41
41
  setToken: () => setToken,
42
42
  useAuth: () => useAuth
43
43
  });
44
- function setCookie(name, value, days = 30) {
44
+ function setLocal(name, value) {
45
45
  try {
46
- if (typeof document === "undefined") return;
47
- if (!value) {
48
- document.cookie = `${name}=; Max-Age=0; path=/; SameSite=Lax`;
46
+ if (typeof window === "undefined" || !window?.localStorage) return;
47
+ if (value === null) {
48
+ window.localStorage.removeItem(name);
49
49
  return;
50
50
  }
51
- const expires = new Date(Date.now() + days * 24 * 60 * 60 * 1e3).toUTCString();
52
- document.cookie = `${name}=${encodeURIComponent(value)}; Expires=${expires}; Path=/; SameSite=Lax`;
51
+ window.localStorage.setItem(name, value);
53
52
  } catch (e) {
54
53
  void e;
55
54
  }
56
55
  }
57
- function getCookie(name) {
56
+ function getLocal(name) {
58
57
  try {
59
- if (typeof document === "undefined") return null;
60
- const match = document.cookie.match(new RegExp("(?:^|; )" + name.replace(/([.$?*|{}()\[\]\\/+^])/g, "\\$1") + "=([^;]*)"));
61
- return match ? decodeURIComponent(match[1]) : null;
58
+ if (typeof window === "undefined" || !window?.localStorage) return null;
59
+ return window.localStorage.getItem(name);
62
60
  } catch (e) {
63
61
  return null;
64
62
  }
65
63
  }
66
64
  function setToken(token) {
67
65
  try {
68
- setCookie(AUTH_TOKEN_KEY, token, 30);
66
+ setLocal(AUTH_TOKEN_KEY, token);
69
67
  } catch (e) {
70
68
  void e;
71
69
  }
72
- if (!token) {
73
- try {
74
- notifyAuthStateChanged();
75
- } catch {
76
- }
77
- return;
78
- }
79
70
  try {
80
71
  notifyAuthStateChanged();
81
72
  } catch {
@@ -83,8 +74,8 @@ function setToken(token) {
83
74
  }
84
75
  function getToken() {
85
76
  try {
86
- const cookie = getCookie(AUTH_TOKEN_KEY);
87
- if (cookie) return cookie;
77
+ const v = getLocal(AUTH_TOKEN_KEY);
78
+ if (v) return v;
88
79
  } catch (e) {
89
80
  void e;
90
81
  }
@@ -244,10 +235,7 @@ var index_exports = {};
244
235
  __export(index_exports, {
245
236
  AUTH_ROOT: () => AUTH_ROOT,
246
237
  AUTH_TOKEN_KEY: () => AUTH_TOKEN_KEY,
247
- AuthGuard: () => AuthGuard,
248
238
  AuthProvider: () => AuthProvider,
249
- AuthRedirector: () => AuthRedirector,
250
- AuthRedirectorDefault: () => AuthRedirector_default,
251
239
  DefaultErrorFallback: () => DefaultErrorFallback,
252
240
  ErrorBoundary: () => ErrorBoundary,
253
241
  FloatingButton: () => FloatingButton,
@@ -282,32 +270,34 @@ __export(index_exports, {
282
270
  useAuthContext: () => useAuthContext,
283
271
  useDebounce: () => useDebounce,
284
272
  useIsMobile: () => useIsMobile,
285
- useLocalStorage: () => useLocalStorage,
286
273
  workflowRequest: () => workflowRequest
287
274
  });
288
275
  module.exports = __toCommonJS(index_exports);
289
276
 
290
277
  // src/components/FloatingButton.tsx
278
+ var import_iconify = require("@iconify/react/dist/iconify.js");
291
279
  var import_jsx_runtime = require("react/jsx-runtime");
292
280
  var FloatingButton = ({
293
281
  text = "Made in Howone",
294
282
  onClick,
295
283
  className = ""
296
284
  }) => {
297
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
285
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
298
286
  "button",
299
287
  {
300
288
  onClick,
289
+ id: "floating-howone-btn",
301
290
  className: `fixed flex bg-white gap-2 items-center right-4 z-50 text-black px-3 py-2 rounded-lg shadow-lg transition-colors duration-200 ${className}`,
302
291
  style: {
303
292
  fontSize: "14px",
304
293
  fontWeight: "bold",
305
294
  bottom: "28px"
306
295
  },
307
- children: [
308
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", { width: 20, src: "https://sxwxqoixnnklnpeutjrj.supabase.co/storage/v1/object/public/create-x/logo/logo-sm.svg", alt: "" }),
309
- text
310
- ]
296
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center gap-2", children: [
297
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", { width: 20, className: "pointer-events-auto", src: "https://sxwxqoixnnklnpeutjrj.supabase.co/storage/v1/object/public/create-x/logo/logo-sm.svg", alt: "" }),
298
+ text,
299
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_iconify.Icon, { icon: "mdi:close", className: "w-5 h-5 font-bold pointer-events-auto" })
300
+ ] })
311
301
  }
312
302
  );
313
303
  };
@@ -585,6 +575,30 @@ var UnifiedAuthService = class {
585
575
  hashToken = null;
586
576
  }
587
577
  const finalToken = accessTokenQuery || token || hashToken;
578
+ if (!finalToken && window.top && window.top !== window) {
579
+ try {
580
+ const topHref = String(window.top.location.href || "");
581
+ if (topHref) {
582
+ const up = new URL(topHref);
583
+ const topSearch = new URLSearchParams(up.search);
584
+ const topToken = topSearch.get("access_token") || topSearch.get("token") || null;
585
+ if (topToken) {
586
+ this.saveAuthData(topToken);
587
+ try {
588
+ topSearch.delete("token");
589
+ topSearch.delete("access_token");
590
+ topSearch.delete("project_id");
591
+ up.search = topSearch.toString();
592
+ up.hash = "";
593
+ window.top.history.replaceState({}, document.title, up.toString());
594
+ } catch {
595
+ }
596
+ return { success: true, token: topToken };
597
+ }
598
+ }
599
+ } catch {
600
+ }
601
+ }
588
602
  if (finalToken) {
589
603
  let user = null;
590
604
  if (userParam) {
@@ -596,8 +610,8 @@ var UnifiedAuthService = class {
596
610
  this.saveAuthData(finalToken);
597
611
  try {
598
612
  const u = new URL(window.location.href);
599
- u.searchParams.delete("token");
600
613
  u.searchParams.delete("access_token");
614
+ u.searchParams.delete("project_id");
601
615
  u.hash = "";
602
616
  window.history.replaceState({}, document.title, u.toString());
603
617
  } catch (e) {
@@ -642,9 +656,6 @@ var UnifiedAuthService = class {
642
656
  return { valid: false };
643
657
  }
644
658
  }
645
- /**
646
- * 从本地存储获取认证数据
647
- */
648
659
  getSavedAuthData() {
649
660
  try {
650
661
  let token = null;
@@ -946,6 +957,7 @@ function createArtifactsClient(req) {
946
957
  init_auth();
947
958
  init_config();
948
959
  init_config();
960
+ init_auth();
949
961
  var request = new request_default({
950
962
  baseURL: "https://create-x-backend.fly.dev/api",
951
963
  timeout: 6e4,
@@ -1081,6 +1093,15 @@ function createClient(opts) {
1081
1093
  workflowRequest: ai,
1082
1094
  // artifact helpers using artifacts-client
1083
1095
  artifacts: createArtifactsClient(biz),
1096
+ me: async () => {
1097
+ try {
1098
+ const t = token ?? (opts?.auth?.getToken ? await opts.auth.getToken() : null) ?? getToken();
1099
+ if (!t) return null;
1100
+ return parseUserFromToken(t);
1101
+ } catch (_e2) {
1102
+ return null;
1103
+ }
1104
+ },
1084
1105
  // auth helpers
1085
1106
  auth: {
1086
1107
  setToken: (t) => {
@@ -1330,153 +1351,60 @@ var LoginForm = ({
1330
1351
  ] });
1331
1352
  };
1332
1353
 
1333
- // src/components/auth/AuthGuard.tsx
1334
- var import_react_router_dom = require("react-router-dom");
1354
+ // src/components/auth/AuthProvider.tsx
1355
+ var import_react4 = require("react");
1335
1356
  init_auth();
1336
1357
  init_config();
1358
+
1359
+ // src/components/ui/Loading.tsx
1337
1360
  var import_jsx_runtime3 = require("react/jsx-runtime");
1338
- var AuthGuard = ({
1339
- children,
1340
- fallback,
1341
- redirectTo = "/login",
1342
- requireAuth = true,
1343
- roles = [],
1344
- permissions = []
1361
+ var Loading = ({
1362
+ size = "md",
1363
+ text = "Loading...",
1364
+ className = "",
1365
+ fullScreen = false
1345
1366
  }) => {
1346
- const { user: parsedUser, isAuthenticated } = useAuth();
1347
- const user = parsedUser;
1348
- const isLoading = false;
1349
- const location = (0, import_react_router_dom.useLocation)();
1350
- if (isLoading) {
1351
- if (fallback) {
1352
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: fallback });
1353
- }
1354
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "min-h-screen flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600" }) });
1355
- }
1356
- if (requireAuth && !isAuthenticated) {
1357
- try {
1358
- const urlParams = new URLSearchParams(window.location.search);
1359
- const tokenInUrl = urlParams.get("token") || urlParams.get("access_token");
1360
- let tokenInHash = null;
1361
- try {
1362
- if (window.location.hash && window.location.hash.length > 1) {
1363
- const hashParams = new URLSearchParams(window.location.hash.slice(1));
1364
- tokenInHash = hashParams.get("access_token") || hashParams.get("token");
1365
- }
1366
- } catch {
1367
- tokenInHash = null;
1368
- }
1369
- const localToken = getToken();
1370
- if (tokenInUrl || tokenInHash) {
1371
- try {
1372
- const res = unifiedAuth.checkOAuthCallback();
1373
- if (res && res.success) {
1374
- return null;
1375
- }
1376
- } catch {
1377
- }
1378
- }
1379
- if (localToken) {
1380
- return null;
1381
- }
1382
- } catch (e) {
1383
- void e;
1384
- }
1385
- if (redirectTo === "/login") {
1386
- const root = getAuthRoot() || "http://localhost:3000";
1387
- try {
1388
- const authUrl = new URL("/auth", String(root));
1389
- authUrl.searchParams.set("redirect_uri", window.location.href);
1390
- const pid = getDefaultProjectId();
1391
- if (pid) authUrl.searchParams.set("project_id", pid);
1392
- window.location.replace(authUrl.toString());
1393
- } catch {
1394
- window.location.replace(root);
1395
- }
1396
- return null;
1397
- }
1398
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_router_dom.Navigate, { to: redirectTo, state: { from: location }, replace: true });
1399
- }
1400
- if (roles.length > 0 && user !== null) {
1401
- const currentUser = user;
1402
- if (currentUser.roles) {
1403
- const hasRole = roles.some((role) => currentUser.roles.includes(role));
1404
- if (!hasRole) {
1405
- if (fallback) {
1406
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: fallback });
1407
- }
1408
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "min-h-screen flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "text-center", children: [
1409
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h1", { className: "text-2xl font-bold text-gray-900 mb-2", children: "Access Denied" }),
1410
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "text-gray-600", children: "You don't have the required role to access this page." })
1411
- ] }) });
1412
- }
1413
- }
1414
- }
1415
- if (permissions.length > 0 && user !== null) {
1416
- const currentUser = user;
1417
- if (currentUser.permissions) {
1418
- const hasPermission = permissions.some((permission) => currentUser.permissions.includes(permission));
1419
- if (!hasPermission) {
1420
- if (fallback) {
1421
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: fallback });
1422
- }
1423
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "min-h-screen flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "text-center", children: [
1424
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h1", { className: "text-2xl font-bold text-gray-900 mb-2", children: "Access Denied" }),
1425
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "text-gray-600", children: "You don't have the required permission to access this page." })
1426
- ] }) });
1367
+ const sizeClasses = {
1368
+ sm: "h-4 w-4",
1369
+ md: "h-8 w-8",
1370
+ lg: "h-12 w-12"
1371
+ };
1372
+ 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";
1373
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: `${containerClasses} ${className}`, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "text-center", children: [
1374
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1375
+ "div",
1376
+ {
1377
+ className: `animate-spin rounded-full border-2 border-gray-300 border-t-blue-600 mx-auto ${sizeClasses[size]}`
1427
1378
  }
1428
- }
1429
- }
1430
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children });
1379
+ ),
1380
+ text && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "mt-2 text-sm text-gray-600", children: text })
1381
+ ] }) });
1431
1382
  };
1432
-
1433
- // src/components/auth/AuthRedirector.tsx
1434
- var import_react4 = require("react");
1435
- init_auth();
1436
- init_config();
1437
- var import_jsx_runtime4 = require("react/jsx-runtime");
1438
- var AuthRedirector = ({ fallback }) => {
1439
- (0, import_react4.useEffect)(() => {
1440
- try {
1441
- const cb = unifiedAuth.checkOAuthCallback();
1442
- if (cb && cb.success) return;
1443
- const unsubscribe = onAuthStateChanged((state) => {
1444
- if (!state.user) {
1445
- try {
1446
- const root = getAuthRoot() || "http://localhost:3000";
1447
- const authUrl = new URL("/auth", String(root));
1448
- authUrl.searchParams.set("redirect_uri", window.location.href);
1449
- const pid = getDefaultProjectId && getDefaultProjectId();
1450
- if (pid) authUrl.searchParams.set("project_id", pid);
1451
- window.location.replace(authUrl.toString());
1452
- } catch {
1453
- }
1454
- }
1455
- });
1456
- return () => {
1457
- try {
1458
- unsubscribe();
1459
- } catch {
1460
- }
1461
- };
1462
- } catch {
1383
+ var LoadingSpinner = ({
1384
+ size = "md",
1385
+ className = ""
1386
+ }) => {
1387
+ const sizeClasses = {
1388
+ sm: "h-4 w-4",
1389
+ md: "h-8 w-8",
1390
+ lg: "h-12 w-12"
1391
+ };
1392
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1393
+ "div",
1394
+ {
1395
+ className: `animate-spin rounded-full border-2 border-gray-300 border-t-blue-600 ${sizeClasses[size]} ${className}`
1463
1396
  }
1464
- }, []);
1465
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "min-h-screen flex items-center justify-center bg-white", children: fallback ?? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "text-center", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h2", { className: "text-lg font-semibold", children: "Redirecting to authentication..." }) }) });
1397
+ );
1466
1398
  };
1467
- var AuthRedirector_default = AuthRedirector;
1468
1399
 
1469
1400
  // src/components/auth/AuthProvider.tsx
1470
- var import_react5 = require("react");
1471
- init_auth();
1472
- init_config();
1473
- var import_jsx_runtime5 = require("react/jsx-runtime");
1474
- var AuthContext = (0, import_react5.createContext)(null);
1401
+ var import_jsx_runtime4 = require("react/jsx-runtime");
1402
+ var AuthContext = (0, import_react4.createContext)(null);
1475
1403
  var AuthProvider = ({ children, autoRedirect = true, showFloatingButton = true, projectId }) => {
1476
- const [user, setUser] = (0, import_react5.useState)(() => parseUserFromToken(getToken()));
1477
- const [token, setTokenState] = (0, import_react5.useState)(() => getToken());
1478
- const [isLoading, setIsLoading] = (0, import_react5.useState)(false);
1479
- (0, import_react5.useEffect)(() => {
1404
+ const [user, setUser] = (0, import_react4.useState)(() => parseUserFromToken(getToken()));
1405
+ const [token, setTokenState] = (0, import_react4.useState)(() => getToken());
1406
+ const [isLoading, setIsLoading] = (0, import_react4.useState)(false);
1407
+ (0, import_react4.useEffect)(() => {
1480
1408
  try {
1481
1409
  if (projectId) setDefaultProjectId(String(projectId));
1482
1410
  } catch {
@@ -1506,7 +1434,18 @@ var AuthProvider = ({ children, autoRedirect = true, showFloatingButton = true,
1506
1434
  authUrl.searchParams.set("redirect_uri", window.location.href);
1507
1435
  const pid = getDefaultProjectId();
1508
1436
  if (pid) authUrl.searchParams.set("project_id", pid);
1509
- window.location.replace(authUrl.toString());
1437
+ try {
1438
+ if (window.top && window.top !== window) {
1439
+ window.top.location.replace(authUrl.toString());
1440
+ } else {
1441
+ window.location.replace(authUrl.toString());
1442
+ }
1443
+ } catch (e) {
1444
+ try {
1445
+ window.location.replace(authUrl.toString());
1446
+ } catch {
1447
+ }
1448
+ }
1510
1449
  } catch {
1511
1450
  }
1512
1451
  }
@@ -1530,23 +1469,24 @@ var AuthProvider = ({ children, autoRedirect = true, showFloatingButton = true,
1530
1469
  user,
1531
1470
  token,
1532
1471
  isAuthenticated: !!token,
1533
- isLoading,
1534
1472
  logout
1535
1473
  };
1536
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(AuthContext.Provider, { value, children: [
1474
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AuthContext.Provider, { value, children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
1475
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Loading, { fullScreen: true, text: "Checking authentication..." }),
1476
+ showFloatingButton && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(FloatingButton, { onClick: () => window.open("https://howone.ai", "_blank") })
1477
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
1537
1478
  children,
1538
- showFloatingButton && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(FloatingButton, { onClick: () => window.open("https://howone.ai", "_blank") })
1539
- ] });
1479
+ showFloatingButton && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(FloatingButton, { onClick: () => window.open("https://howone.ai", "_blank") })
1480
+ ] }) });
1540
1481
  };
1541
1482
  function useAuthContext() {
1542
- const ctx = (0, import_react5.useContext)(AuthContext);
1483
+ const ctx = (0, import_react4.useContext)(AuthContext);
1543
1484
  if (!ctx) {
1544
1485
  const t = getToken();
1545
1486
  return {
1546
1487
  user: parseUserFromToken(t),
1547
1488
  token: t,
1548
1489
  isAuthenticated: !!t,
1549
- isLoading: false,
1550
1490
  logout: () => {
1551
1491
  try {
1552
1492
  setToken(null);
@@ -1606,9 +1546,23 @@ var HowoneAuthClient = class {
1606
1546
  if (pid) authUrl.searchParams.set("project_id", String(pid));
1607
1547
  } catch {
1608
1548
  }
1609
- window.location.replace(authUrl.toString());
1549
+ try {
1550
+ if (window.top && window.top !== window) {
1551
+ window.top.location.replace(authUrl.toString());
1552
+ } else {
1553
+ window.location.replace(authUrl.toString());
1554
+ }
1555
+ } catch {
1556
+ try {
1557
+ window.location.replace(String(root));
1558
+ } catch {
1559
+ }
1560
+ }
1610
1561
  } catch {
1611
- window.location.replace(String(root));
1562
+ try {
1563
+ window.location.replace(String(root));
1564
+ } catch {
1565
+ }
1612
1566
  }
1613
1567
  }
1614
1568
  logout() {
@@ -1629,51 +1583,10 @@ var howone = {
1629
1583
  };
1630
1584
  var client_default = howone;
1631
1585
 
1632
- // src/components/ui/Loading.tsx
1633
- var import_jsx_runtime6 = require("react/jsx-runtime");
1634
- var Loading = ({
1635
- size = "md",
1636
- text = "Loading...",
1637
- className = "",
1638
- fullScreen = false
1639
- }) => {
1640
- const sizeClasses = {
1641
- sm: "h-4 w-4",
1642
- md: "h-8 w-8",
1643
- lg: "h-12 w-12"
1644
- };
1645
- 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";
1646
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: `${containerClasses} ${className}`, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "text-center", children: [
1647
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1648
- "div",
1649
- {
1650
- className: `animate-spin rounded-full border-2 border-gray-300 border-t-blue-600 mx-auto ${sizeClasses[size]}`
1651
- }
1652
- ),
1653
- text && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "mt-2 text-sm text-gray-600", children: text })
1654
- ] }) });
1655
- };
1656
- var LoadingSpinner = ({
1657
- size = "md",
1658
- className = ""
1659
- }) => {
1660
- const sizeClasses = {
1661
- sm: "h-4 w-4",
1662
- md: "h-8 w-8",
1663
- lg: "h-12 w-12"
1664
- };
1665
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1666
- "div",
1667
- {
1668
- className: `animate-spin rounded-full border-2 border-gray-300 border-t-blue-600 ${sizeClasses[size]} ${className}`
1669
- }
1670
- );
1671
- };
1672
-
1673
1586
  // src/components/ui/ErrorBoundary.tsx
1674
- var import_react6 = require("react");
1675
- var import_jsx_runtime7 = require("react/jsx-runtime");
1676
- var ErrorBoundary = class extends import_react6.Component {
1587
+ var import_react5 = require("react");
1588
+ var import_jsx_runtime5 = require("react/jsx-runtime");
1589
+ var ErrorBoundary = class extends import_react5.Component {
1677
1590
  constructor(props) {
1678
1591
  super(props);
1679
1592
  this.handleRetry = () => {
@@ -1695,13 +1608,13 @@ var ErrorBoundary = class extends import_react6.Component {
1695
1608
  if (this.state.hasError) {
1696
1609
  if (this.props.fallback) {
1697
1610
  const FallbackComponent = this.props.fallback;
1698
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(FallbackComponent, { error: this.state.error, retry: this.handleRetry });
1611
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(FallbackComponent, { error: this.state.error, retry: this.handleRetry });
1699
1612
  }
1700
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "min-h-[400px] flex items-center justify-center p-4", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "text-center max-w-md", children: [
1701
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "text-red-500 text-6xl mb-4", children: "\u26A0\uFE0F" }),
1702
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h2", { className: "text-xl font-semibold text-gray-900 mb-2", children: "Something went wrong" }),
1703
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "text-gray-600 mb-4", children: "An unexpected error occurred. Please try refreshing the page." }),
1704
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1613
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "min-h-[400px] flex items-center justify-center p-4", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "text-center max-w-md", children: [
1614
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "text-red-500 text-6xl mb-4", children: "\u26A0\uFE0F" }),
1615
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h2", { className: "text-xl font-semibold text-gray-900 mb-2", children: "Something went wrong" }),
1616
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-gray-600 mb-4", children: "An unexpected error occurred. Please try refreshing the page." }),
1617
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1705
1618
  "button",
1706
1619
  {
1707
1620
  onClick: this.handleRetry,
@@ -1715,10 +1628,10 @@ var ErrorBoundary = class extends import_react6.Component {
1715
1628
  return this.props.children;
1716
1629
  }
1717
1630
  };
1718
- var DefaultErrorFallback = ({ retry }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "min-h-[200px] flex items-center justify-center p-4", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "text-center", children: [
1719
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "text-red-500 text-4xl mb-2", children: "\u26A0\uFE0F" }),
1720
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "text-gray-600 mb-2", children: "Something went wrong" }),
1721
- retry && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1631
+ var DefaultErrorFallback = ({ retry }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "min-h-[200px] flex items-center justify-center p-4", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "text-center", children: [
1632
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "text-red-500 text-4xl mb-2", children: "\u26A0\uFE0F" }),
1633
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-gray-600 mb-2", children: "Something went wrong" }),
1634
+ retry && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1722
1635
  "button",
1723
1636
  {
1724
1637
  onClick: retry,
@@ -1729,11 +1642,11 @@ var DefaultErrorFallback = ({ retry }) => /* @__PURE__ */ (0, import_jsx_runtime
1729
1642
  ] }) });
1730
1643
 
1731
1644
  // src/hooks/use-mobile.ts
1732
- var React5 = __toESM(require("react"));
1645
+ var React4 = __toESM(require("react"));
1733
1646
  var MOBILE_BREAKPOINT = 768;
1734
1647
  function useIsMobile() {
1735
- const [isMobile, setIsMobile] = React5.useState(void 0);
1736
- React5.useEffect(() => {
1648
+ const [isMobile, setIsMobile] = React4.useState(void 0);
1649
+ React4.useEffect(() => {
1737
1650
  const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
1738
1651
  const onChange = () => {
1739
1652
  setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
@@ -1745,43 +1658,11 @@ function useIsMobile() {
1745
1658
  return !!isMobile;
1746
1659
  }
1747
1660
 
1748
- // src/hooks/use-local-storage.ts
1749
- var import_react7 = require("react");
1750
- function useLocalStorage(key, initialValue) {
1751
- const [storedValue, setStoredValue] = (0, import_react7.useState)(() => {
1752
- try {
1753
- const item = window.localStorage.getItem(key);
1754
- return item ? JSON.parse(item) : initialValue;
1755
- } catch (error) {
1756
- console.error(`Error reading localStorage key "${key}":`, error);
1757
- return initialValue;
1758
- }
1759
- });
1760
- const setValue = (value) => {
1761
- try {
1762
- const valueToStore = value instanceof Function ? value(storedValue) : value;
1763
- setStoredValue(valueToStore);
1764
- window.localStorage.setItem(key, JSON.stringify(valueToStore));
1765
- } catch (error) {
1766
- console.error(`Error setting localStorage key "${key}":`, error);
1767
- }
1768
- };
1769
- const removeValue = () => {
1770
- try {
1771
- window.localStorage.removeItem(key);
1772
- setStoredValue(initialValue);
1773
- } catch (error) {
1774
- console.error(`Error removing localStorage key "${key}":`, error);
1775
- }
1776
- };
1777
- return [storedValue, setValue, removeValue];
1778
- }
1779
-
1780
1661
  // src/hooks/use-debounce.ts
1781
- var import_react8 = require("react");
1662
+ var import_react6 = require("react");
1782
1663
  function useDebounce(value, delay) {
1783
- const [debouncedValue, setDebouncedValue] = (0, import_react8.useState)(value);
1784
- (0, import_react8.useEffect)(() => {
1664
+ const [debouncedValue, setDebouncedValue] = (0, import_react6.useState)(value);
1665
+ (0, import_react6.useEffect)(() => {
1785
1666
  const handler = setTimeout(() => {
1786
1667
  setDebouncedValue(value);
1787
1668
  }, delay);
@@ -2010,10 +1891,7 @@ init_config();
2010
1891
  0 && (module.exports = {
2011
1892
  AUTH_ROOT,
2012
1893
  AUTH_TOKEN_KEY,
2013
- AuthGuard,
2014
1894
  AuthProvider,
2015
- AuthRedirector,
2016
- AuthRedirectorDefault,
2017
1895
  DefaultErrorFallback,
2018
1896
  ErrorBoundary,
2019
1897
  FloatingButton,
@@ -2048,7 +1926,6 @@ init_config();
2048
1926
  useAuthContext,
2049
1927
  useDebounce,
2050
1928
  useIsMobile,
2051
- useLocalStorage,
2052
1929
  workflowRequest
2053
1930
  });
2054
1931
  //# sourceMappingURL=index.js.map