@howone/sdk 0.1.19 → 0.1.21
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 +32 -6
- package/dist/index.d.ts +32 -6
- package/dist/index.js +164 -101
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +161 -98
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -423,19 +423,44 @@ interface LoginFormProps {
|
|
|
423
423
|
}
|
|
424
424
|
declare const LoginForm: React$1.FC<LoginFormProps>;
|
|
425
425
|
|
|
426
|
-
type
|
|
426
|
+
type Theme$1 = "dark" | "light" | "system";
|
|
427
|
+
type HowoneContextValue = {
|
|
427
428
|
user: ReturnType<typeof parseUserFromToken> | null;
|
|
428
429
|
token: string | null;
|
|
429
430
|
isAuthenticated: boolean;
|
|
430
431
|
logout: () => void;
|
|
431
432
|
};
|
|
432
|
-
|
|
433
|
+
interface HowoneProviderProps {
|
|
433
434
|
children: React$1.ReactNode;
|
|
434
435
|
autoRedirect?: boolean;
|
|
435
436
|
showFloatingButton?: boolean;
|
|
436
437
|
projectId?: string;
|
|
437
|
-
|
|
438
|
-
|
|
438
|
+
defaultTheme?: Theme$1;
|
|
439
|
+
themeStorageKey?: string;
|
|
440
|
+
forceDefaultTheme?: boolean;
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* HowoneProvider - All-in-one application provider
|
|
444
|
+
*
|
|
445
|
+
* Includes:
|
|
446
|
+
* - Authentication management
|
|
447
|
+
* - Theme management (dark/light/system)
|
|
448
|
+
* - Toast notifications
|
|
449
|
+
* - Floating button
|
|
450
|
+
*
|
|
451
|
+
* @example
|
|
452
|
+
* ```tsx
|
|
453
|
+
* <HowoneProvider
|
|
454
|
+
* defaultTheme="dark"
|
|
455
|
+
* themeStorageKey="my-app-theme"
|
|
456
|
+
* showFloatingButton={true}
|
|
457
|
+
* >
|
|
458
|
+
* <App />
|
|
459
|
+
* </HowoneProvider>
|
|
460
|
+
* ```
|
|
461
|
+
*/
|
|
462
|
+
declare const HowoneProvider: React$1.FC<HowoneProviderProps>;
|
|
463
|
+
declare function useHowoneContext(): HowoneContextValue;
|
|
439
464
|
|
|
440
465
|
type AuthState = {
|
|
441
466
|
user: Record<string, unknown> | null;
|
|
@@ -504,12 +529,13 @@ type ThemeProviderProps = {
|
|
|
504
529
|
children: React.ReactNode;
|
|
505
530
|
defaultTheme?: Theme;
|
|
506
531
|
storageKey?: string;
|
|
532
|
+
forceDefault?: boolean;
|
|
507
533
|
};
|
|
508
534
|
type ThemeProviderState = {
|
|
509
535
|
theme: Theme;
|
|
510
536
|
setTheme: (theme: Theme) => void;
|
|
511
537
|
};
|
|
512
|
-
declare function ThemeProvider({ children, defaultTheme, storageKey, ...props }: ThemeProviderProps): react_jsx_runtime.JSX.Element;
|
|
538
|
+
declare function ThemeProvider({ children, defaultTheme, storageKey, forceDefault, ...props }: ThemeProviderProps): react_jsx_runtime.JSX.Element;
|
|
513
539
|
declare const useTheme: () => ThemeProviderState;
|
|
514
540
|
|
|
515
541
|
interface ThemeToggleProps {
|
|
@@ -543,4 +569,4 @@ declare function useDebounce<T>(value: T, delay: number): T;
|
|
|
543
569
|
*/
|
|
544
570
|
declare function injectEarlyErrorHandler(): void;
|
|
545
571
|
|
|
546
|
-
export { type AIWorkflowClientOptions, type AIWorkflowResponse, AUTH_ROOT, AUTH_TOKEN_KEY, type AccessContext, type Artifact, type ArtifactCreateInput, type ArtifactListQuery,
|
|
572
|
+
export { type AIWorkflowClientOptions, type AIWorkflowResponse, AUTH_ROOT, AUTH_TOKEN_KEY, type AccessContext, type Artifact, type ArtifactCreateInput, type ArtifactListQuery, type AxiosAIWorkflowOptions, ClayxToast, DefaultErrorFallback, type EmailLoginRequest, type EmailLoginResponse, ErrorBoundary, FloatingButton, GlobalToastContainer, HowoneProvider, type HowoneProviderProps, Loading, LoadingSpinner, LoginForm, type SendCodeRequest, type SendCodeResponse, ThemeProvider, ThemeToggle, type Visibility, aiRequest, aiWorkflow, canAccessArtifact, createAIWorkflowClient, createAIWorkflowClientAxios, createArtifactsClient, createClient, getAuthRoot, getCodeStatus, getDefaultProjectId, getToken, howone, injectEarlyErrorHandler, isTokenValid, loginWithEmailCode, onAuthStateChanged, parseUserFromToken, request, sendEmailVerificationCode, setAuthRoot, setDefaultProjectId, setToken, unifiedAuth, unifiedOAuth, useAuth, useDebounce, useHowoneContext, useIsMobile, useTheme, workflowRequest };
|
package/dist/index.d.ts
CHANGED
|
@@ -423,19 +423,44 @@ interface LoginFormProps {
|
|
|
423
423
|
}
|
|
424
424
|
declare const LoginForm: React$1.FC<LoginFormProps>;
|
|
425
425
|
|
|
426
|
-
type
|
|
426
|
+
type Theme$1 = "dark" | "light" | "system";
|
|
427
|
+
type HowoneContextValue = {
|
|
427
428
|
user: ReturnType<typeof parseUserFromToken> | null;
|
|
428
429
|
token: string | null;
|
|
429
430
|
isAuthenticated: boolean;
|
|
430
431
|
logout: () => void;
|
|
431
432
|
};
|
|
432
|
-
|
|
433
|
+
interface HowoneProviderProps {
|
|
433
434
|
children: React$1.ReactNode;
|
|
434
435
|
autoRedirect?: boolean;
|
|
435
436
|
showFloatingButton?: boolean;
|
|
436
437
|
projectId?: string;
|
|
437
|
-
|
|
438
|
-
|
|
438
|
+
defaultTheme?: Theme$1;
|
|
439
|
+
themeStorageKey?: string;
|
|
440
|
+
forceDefaultTheme?: boolean;
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* HowoneProvider - All-in-one application provider
|
|
444
|
+
*
|
|
445
|
+
* Includes:
|
|
446
|
+
* - Authentication management
|
|
447
|
+
* - Theme management (dark/light/system)
|
|
448
|
+
* - Toast notifications
|
|
449
|
+
* - Floating button
|
|
450
|
+
*
|
|
451
|
+
* @example
|
|
452
|
+
* ```tsx
|
|
453
|
+
* <HowoneProvider
|
|
454
|
+
* defaultTheme="dark"
|
|
455
|
+
* themeStorageKey="my-app-theme"
|
|
456
|
+
* showFloatingButton={true}
|
|
457
|
+
* >
|
|
458
|
+
* <App />
|
|
459
|
+
* </HowoneProvider>
|
|
460
|
+
* ```
|
|
461
|
+
*/
|
|
462
|
+
declare const HowoneProvider: React$1.FC<HowoneProviderProps>;
|
|
463
|
+
declare function useHowoneContext(): HowoneContextValue;
|
|
439
464
|
|
|
440
465
|
type AuthState = {
|
|
441
466
|
user: Record<string, unknown> | null;
|
|
@@ -504,12 +529,13 @@ type ThemeProviderProps = {
|
|
|
504
529
|
children: React.ReactNode;
|
|
505
530
|
defaultTheme?: Theme;
|
|
506
531
|
storageKey?: string;
|
|
532
|
+
forceDefault?: boolean;
|
|
507
533
|
};
|
|
508
534
|
type ThemeProviderState = {
|
|
509
535
|
theme: Theme;
|
|
510
536
|
setTheme: (theme: Theme) => void;
|
|
511
537
|
};
|
|
512
|
-
declare function ThemeProvider({ children, defaultTheme, storageKey, ...props }: ThemeProviderProps): react_jsx_runtime.JSX.Element;
|
|
538
|
+
declare function ThemeProvider({ children, defaultTheme, storageKey, forceDefault, ...props }: ThemeProviderProps): react_jsx_runtime.JSX.Element;
|
|
513
539
|
declare const useTheme: () => ThemeProviderState;
|
|
514
540
|
|
|
515
541
|
interface ThemeToggleProps {
|
|
@@ -543,4 +569,4 @@ declare function useDebounce<T>(value: T, delay: number): T;
|
|
|
543
569
|
*/
|
|
544
570
|
declare function injectEarlyErrorHandler(): void;
|
|
545
571
|
|
|
546
|
-
export { type AIWorkflowClientOptions, type AIWorkflowResponse, AUTH_ROOT, AUTH_TOKEN_KEY, type AccessContext, type Artifact, type ArtifactCreateInput, type ArtifactListQuery,
|
|
572
|
+
export { type AIWorkflowClientOptions, type AIWorkflowResponse, AUTH_ROOT, AUTH_TOKEN_KEY, type AccessContext, type Artifact, type ArtifactCreateInput, type ArtifactListQuery, type AxiosAIWorkflowOptions, ClayxToast, DefaultErrorFallback, type EmailLoginRequest, type EmailLoginResponse, ErrorBoundary, FloatingButton, GlobalToastContainer, HowoneProvider, type HowoneProviderProps, Loading, LoadingSpinner, LoginForm, type SendCodeRequest, type SendCodeResponse, ThemeProvider, ThemeToggle, type Visibility, aiRequest, aiWorkflow, canAccessArtifact, createAIWorkflowClient, createAIWorkflowClientAxios, createArtifactsClient, createClient, getAuthRoot, getCodeStatus, getDefaultProjectId, getToken, howone, injectEarlyErrorHandler, isTokenValid, loginWithEmailCode, onAuthStateChanged, parseUserFromToken, request, sendEmailVerificationCode, setAuthRoot, setDefaultProjectId, setToken, unifiedAuth, unifiedOAuth, useAuth, useDebounce, useHowoneContext, useIsMobile, useTheme, workflowRequest };
|
package/dist/index.js
CHANGED
|
@@ -235,12 +235,12 @@ var index_exports = {};
|
|
|
235
235
|
__export(index_exports, {
|
|
236
236
|
AUTH_ROOT: () => AUTH_ROOT,
|
|
237
237
|
AUTH_TOKEN_KEY: () => AUTH_TOKEN_KEY,
|
|
238
|
-
AuthProvider: () => AuthProvider,
|
|
239
238
|
ClayxToast: () => ClayxToast,
|
|
240
239
|
DefaultErrorFallback: () => DefaultErrorFallback,
|
|
241
240
|
ErrorBoundary: () => ErrorBoundary,
|
|
242
241
|
FloatingButton: () => FloatingButton,
|
|
243
242
|
GlobalToastContainer: () => GlobalToastContainer,
|
|
243
|
+
HowoneProvider: () => HowoneProvider,
|
|
244
244
|
Loading: () => Loading,
|
|
245
245
|
LoadingSpinner: () => LoadingSpinner,
|
|
246
246
|
LoginForm: () => LoginForm,
|
|
@@ -271,8 +271,8 @@ __export(index_exports, {
|
|
|
271
271
|
unifiedAuth: () => unifiedAuth,
|
|
272
272
|
unifiedOAuth: () => unifiedOAuth,
|
|
273
273
|
useAuth: () => useAuth,
|
|
274
|
-
useAuthContext: () => useAuthContext,
|
|
275
274
|
useDebounce: () => useDebounce,
|
|
275
|
+
useHowoneContext: () => useHowoneContext,
|
|
276
276
|
useIsMobile: () => useIsMobile,
|
|
277
277
|
useTheme: () => useTheme,
|
|
278
278
|
workflowRequest: () => workflowRequest
|
|
@@ -292,7 +292,7 @@ var FloatingButton = ({
|
|
|
292
292
|
{
|
|
293
293
|
onClick,
|
|
294
294
|
id: "floating-howone-btn",
|
|
295
|
-
className: `fixed flex bg-
|
|
295
|
+
className: `fixed flex bg-background gap-2 items-center right-4 z-50 text-black dark:text-white px-3 py-2 rounded-lg shadow-lg transition-colors duration-200 border border-gray-200 dark:border-gray-700 ${className}`,
|
|
296
296
|
style: {
|
|
297
297
|
fontSize: "14px",
|
|
298
298
|
fontWeight: "bold",
|
|
@@ -1557,14 +1557,106 @@ var LoginForm = ({
|
|
|
1557
1557
|
] });
|
|
1558
1558
|
};
|
|
1559
1559
|
|
|
1560
|
-
// src/components/auth/
|
|
1561
|
-
var
|
|
1560
|
+
// src/components/auth/HowoneProvider.tsx
|
|
1561
|
+
var import_react5 = require("react");
|
|
1562
1562
|
init_auth();
|
|
1563
|
+
|
|
1564
|
+
// src/components/theme/ThemeProvider.tsx
|
|
1565
|
+
var import_react4 = require("react");
|
|
1563
1566
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
1564
|
-
var
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1567
|
+
var initialState = {
|
|
1568
|
+
theme: "system",
|
|
1569
|
+
setTheme: () => null
|
|
1570
|
+
};
|
|
1571
|
+
var ThemeProviderContext = (0, import_react4.createContext)(initialState);
|
|
1572
|
+
function ThemeProvider({
|
|
1573
|
+
children,
|
|
1574
|
+
defaultTheme = "system",
|
|
1575
|
+
storageKey = "vite-ui-theme",
|
|
1576
|
+
forceDefault = false,
|
|
1577
|
+
...props
|
|
1578
|
+
}) {
|
|
1579
|
+
const [theme, setTheme] = (0, import_react4.useState)(() => {
|
|
1580
|
+
if (forceDefault) {
|
|
1581
|
+
localStorage.setItem(storageKey, defaultTheme);
|
|
1582
|
+
return defaultTheme;
|
|
1583
|
+
}
|
|
1584
|
+
const stored = localStorage.getItem(storageKey);
|
|
1585
|
+
const initialTheme = stored || defaultTheme;
|
|
1586
|
+
if (!stored) {
|
|
1587
|
+
localStorage.setItem(storageKey, defaultTheme);
|
|
1588
|
+
}
|
|
1589
|
+
return initialTheme;
|
|
1590
|
+
});
|
|
1591
|
+
(0, import_react4.useEffect)(() => {
|
|
1592
|
+
const root = window.document.documentElement;
|
|
1593
|
+
root.classList.remove("light", "dark");
|
|
1594
|
+
if (theme === "system") {
|
|
1595
|
+
const systemTheme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
1596
|
+
root.classList.add(systemTheme);
|
|
1597
|
+
return;
|
|
1598
|
+
}
|
|
1599
|
+
root.classList.add(theme);
|
|
1600
|
+
}, [theme]);
|
|
1601
|
+
const value = {
|
|
1602
|
+
theme,
|
|
1603
|
+
setTheme: (theme2) => {
|
|
1604
|
+
localStorage.setItem(storageKey, theme2);
|
|
1605
|
+
setTheme(theme2);
|
|
1606
|
+
}
|
|
1607
|
+
};
|
|
1608
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ThemeProviderContext.Provider, { ...props, value, children });
|
|
1609
|
+
}
|
|
1610
|
+
var useTheme = () => {
|
|
1611
|
+
const context = (0, import_react4.useContext)(ThemeProviderContext);
|
|
1612
|
+
if (context === void 0)
|
|
1613
|
+
throw new Error("useTheme must be used within a ThemeProvider");
|
|
1614
|
+
return context;
|
|
1615
|
+
};
|
|
1616
|
+
|
|
1617
|
+
// src/components/ui/Toast/GlobalToastContainer.tsx
|
|
1618
|
+
var import_react_toastify = require("react-toastify");
|
|
1619
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
1620
|
+
function GlobalToastContainer() {
|
|
1621
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1622
|
+
import_react_toastify.ToastContainer,
|
|
1623
|
+
{
|
|
1624
|
+
newestOnTop: false,
|
|
1625
|
+
closeButton: false
|
|
1626
|
+
}
|
|
1627
|
+
);
|
|
1628
|
+
}
|
|
1629
|
+
|
|
1630
|
+
// src/components/auth/HowoneProvider.tsx
|
|
1631
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
1632
|
+
var HowoneContext = (0, import_react5.createContext)(null);
|
|
1633
|
+
var HowoneProvider = ({
|
|
1634
|
+
children,
|
|
1635
|
+
showFloatingButton = true,
|
|
1636
|
+
defaultTheme = "system",
|
|
1637
|
+
themeStorageKey = "howone-theme",
|
|
1638
|
+
forceDefaultTheme = false
|
|
1639
|
+
}) => {
|
|
1640
|
+
const [user, setUser] = (0, import_react5.useState)(() => parseUserFromToken(getToken()));
|
|
1641
|
+
const [token, setTokenState] = (0, import_react5.useState)(() => getToken());
|
|
1642
|
+
(0, import_react5.useEffect)(() => {
|
|
1643
|
+
try {
|
|
1644
|
+
const params = new URLSearchParams(window.location.search);
|
|
1645
|
+
const urlToken = params.get("access_token") || params.get("token");
|
|
1646
|
+
if (urlToken) {
|
|
1647
|
+
setToken(urlToken);
|
|
1648
|
+
setTokenState(urlToken);
|
|
1649
|
+
setUser(parseUserFromToken(urlToken));
|
|
1650
|
+
params.delete("access_token");
|
|
1651
|
+
params.delete("token");
|
|
1652
|
+
const newSearch = params.toString();
|
|
1653
|
+
const newUrl = window.location.pathname + (newSearch ? "?" + newSearch : "") + window.location.hash;
|
|
1654
|
+
window.history.replaceState({}, "", newUrl);
|
|
1655
|
+
}
|
|
1656
|
+
} catch (e) {
|
|
1657
|
+
console.error("[HowoneProvider] Failed to capture token from URL:", e);
|
|
1658
|
+
}
|
|
1659
|
+
}, []);
|
|
1568
1660
|
const logout = () => {
|
|
1569
1661
|
try {
|
|
1570
1662
|
setToken(null);
|
|
@@ -1579,13 +1671,24 @@ var AuthProvider = ({ children, showFloatingButton = true }) => {
|
|
|
1579
1671
|
isAuthenticated: !!token,
|
|
1580
1672
|
logout
|
|
1581
1673
|
};
|
|
1582
|
-
return /* @__PURE__ */ (0,
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1674
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1675
|
+
ThemeProvider,
|
|
1676
|
+
{
|
|
1677
|
+
defaultTheme,
|
|
1678
|
+
storageKey: themeStorageKey,
|
|
1679
|
+
forceDefault: forceDefaultTheme,
|
|
1680
|
+
children: [
|
|
1681
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(HowoneContext.Provider, { value, children: [
|
|
1682
|
+
children,
|
|
1683
|
+
showFloatingButton && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(FloatingButton, { onClick: () => window.open("https://howone.ai", "_blank") })
|
|
1684
|
+
] }),
|
|
1685
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(GlobalToastContainer, {})
|
|
1686
|
+
]
|
|
1687
|
+
}
|
|
1688
|
+
);
|
|
1586
1689
|
};
|
|
1587
|
-
function
|
|
1588
|
-
const ctx = (0,
|
|
1690
|
+
function useHowoneContext() {
|
|
1691
|
+
const ctx = (0, import_react5.useContext)(HowoneContext);
|
|
1589
1692
|
if (!ctx) {
|
|
1590
1693
|
const t = getToken();
|
|
1591
1694
|
return {
|
|
@@ -1689,7 +1792,7 @@ var howone = {
|
|
|
1689
1792
|
var client_default = howone;
|
|
1690
1793
|
|
|
1691
1794
|
// src/components/ui/Loading.tsx
|
|
1692
|
-
var
|
|
1795
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1693
1796
|
var Loading = ({
|
|
1694
1797
|
size = "md",
|
|
1695
1798
|
text = "Loading...",
|
|
@@ -1702,14 +1805,14 @@ var Loading = ({
|
|
|
1702
1805
|
lg: "h-12 w-12"
|
|
1703
1806
|
};
|
|
1704
1807
|
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";
|
|
1705
|
-
return /* @__PURE__ */ (0,
|
|
1706
|
-
/* @__PURE__ */ (0,
|
|
1808
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: `${containerClasses} ${className}`, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "text-center", children: [
|
|
1809
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1707
1810
|
"div",
|
|
1708
1811
|
{
|
|
1709
1812
|
className: `animate-spin rounded-full border-2 border-gray-300 border-t-blue-600 mx-auto ${sizeClasses[size]}`
|
|
1710
1813
|
}
|
|
1711
1814
|
),
|
|
1712
|
-
text && /* @__PURE__ */ (0,
|
|
1815
|
+
text && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "mt-2 text-sm text-gray-600", children: text })
|
|
1713
1816
|
] }) });
|
|
1714
1817
|
};
|
|
1715
1818
|
var LoadingSpinner = ({
|
|
@@ -1721,7 +1824,7 @@ var LoadingSpinner = ({
|
|
|
1721
1824
|
md: "h-8 w-8",
|
|
1722
1825
|
lg: "h-12 w-12"
|
|
1723
1826
|
};
|
|
1724
|
-
return /* @__PURE__ */ (0,
|
|
1827
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1725
1828
|
"div",
|
|
1726
1829
|
{
|
|
1727
1830
|
className: `animate-spin rounded-full border-2 border-gray-300 border-t-blue-600 ${sizeClasses[size]} ${className}`
|
|
@@ -1730,9 +1833,9 @@ var LoadingSpinner = ({
|
|
|
1730
1833
|
};
|
|
1731
1834
|
|
|
1732
1835
|
// src/components/ui/ErrorBoundary.tsx
|
|
1733
|
-
var
|
|
1734
|
-
var
|
|
1735
|
-
var ErrorBoundary = class extends
|
|
1836
|
+
var import_react6 = require("react");
|
|
1837
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1838
|
+
var ErrorBoundary = class extends import_react6.Component {
|
|
1736
1839
|
constructor(props) {
|
|
1737
1840
|
super(props);
|
|
1738
1841
|
this.handleRetry = () => {
|
|
@@ -1754,13 +1857,13 @@ var ErrorBoundary = class extends import_react5.Component {
|
|
|
1754
1857
|
if (this.state.hasError) {
|
|
1755
1858
|
if (this.props.fallback) {
|
|
1756
1859
|
const FallbackComponent = this.props.fallback;
|
|
1757
|
-
return /* @__PURE__ */ (0,
|
|
1860
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(FallbackComponent, { error: this.state.error, retry: this.handleRetry });
|
|
1758
1861
|
}
|
|
1759
|
-
return /* @__PURE__ */ (0,
|
|
1760
|
-
/* @__PURE__ */ (0,
|
|
1761
|
-
/* @__PURE__ */ (0,
|
|
1762
|
-
/* @__PURE__ */ (0,
|
|
1763
|
-
/* @__PURE__ */ (0,
|
|
1862
|
+
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: [
|
|
1863
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "text-red-500 text-6xl mb-4", children: "\u26A0\uFE0F" }),
|
|
1864
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h2", { className: "text-xl font-semibold text-gray-900 mb-2", children: "Something went wrong" }),
|
|
1865
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "text-gray-600 mb-4", children: "An unexpected error occurred. Please try refreshing the page." }),
|
|
1866
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1764
1867
|
"button",
|
|
1765
1868
|
{
|
|
1766
1869
|
onClick: this.handleRetry,
|
|
@@ -1774,10 +1877,10 @@ var ErrorBoundary = class extends import_react5.Component {
|
|
|
1774
1877
|
return this.props.children;
|
|
1775
1878
|
}
|
|
1776
1879
|
};
|
|
1777
|
-
var DefaultErrorFallback = ({ retry }) => /* @__PURE__ */ (0,
|
|
1778
|
-
/* @__PURE__ */ (0,
|
|
1779
|
-
/* @__PURE__ */ (0,
|
|
1780
|
-
retry && /* @__PURE__ */ (0,
|
|
1880
|
+
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: [
|
|
1881
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "text-red-500 text-4xl mb-2", children: "\u26A0\uFE0F" }),
|
|
1882
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "text-gray-600 mb-2", children: "Something went wrong" }),
|
|
1883
|
+
retry && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1781
1884
|
"button",
|
|
1782
1885
|
{
|
|
1783
1886
|
onClick: retry,
|
|
@@ -1787,54 +1890,11 @@ var DefaultErrorFallback = ({ retry }) => /* @__PURE__ */ (0, import_jsx_runtime
|
|
|
1787
1890
|
)
|
|
1788
1891
|
] }) });
|
|
1789
1892
|
|
|
1790
|
-
// src/components/theme/ThemeProvider.tsx
|
|
1791
|
-
var import_react6 = require("react");
|
|
1792
|
-
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1793
|
-
var initialState = {
|
|
1794
|
-
theme: "system",
|
|
1795
|
-
setTheme: () => null
|
|
1796
|
-
};
|
|
1797
|
-
var ThemeProviderContext = (0, import_react6.createContext)(initialState);
|
|
1798
|
-
function ThemeProvider({
|
|
1799
|
-
children,
|
|
1800
|
-
defaultTheme = "system",
|
|
1801
|
-
storageKey = "vite-ui-theme",
|
|
1802
|
-
...props
|
|
1803
|
-
}) {
|
|
1804
|
-
const [theme, setTheme] = (0, import_react6.useState)(
|
|
1805
|
-
() => localStorage.getItem(storageKey) || defaultTheme
|
|
1806
|
-
);
|
|
1807
|
-
(0, import_react6.useEffect)(() => {
|
|
1808
|
-
const root = window.document.documentElement;
|
|
1809
|
-
root.classList.remove("light", "dark");
|
|
1810
|
-
if (theme === "system") {
|
|
1811
|
-
const systemTheme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
1812
|
-
root.classList.add(systemTheme);
|
|
1813
|
-
return;
|
|
1814
|
-
}
|
|
1815
|
-
root.classList.add(theme);
|
|
1816
|
-
}, [theme]);
|
|
1817
|
-
const value = {
|
|
1818
|
-
theme,
|
|
1819
|
-
setTheme: (theme2) => {
|
|
1820
|
-
localStorage.setItem(storageKey, theme2);
|
|
1821
|
-
setTheme(theme2);
|
|
1822
|
-
}
|
|
1823
|
-
};
|
|
1824
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ThemeProviderContext.Provider, { ...props, value, children });
|
|
1825
|
-
}
|
|
1826
|
-
var useTheme = () => {
|
|
1827
|
-
const context = (0, import_react6.useContext)(ThemeProviderContext);
|
|
1828
|
-
if (context === void 0)
|
|
1829
|
-
throw new Error("useTheme must be used within a ThemeProvider");
|
|
1830
|
-
return context;
|
|
1831
|
-
};
|
|
1832
|
-
|
|
1833
1893
|
// src/components/theme/ThemeToggle.tsx
|
|
1834
1894
|
var React4 = __toESM(require("react"));
|
|
1835
1895
|
var import_next_themes = require("next-themes");
|
|
1836
1896
|
var import_react7 = require("@iconify/react");
|
|
1837
|
-
var
|
|
1897
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1838
1898
|
function ThemeToggle({ className }) {
|
|
1839
1899
|
const { setTheme, theme } = (0, import_next_themes.useTheme)();
|
|
1840
1900
|
const [mounted, setMounted] = React4.useState(false);
|
|
@@ -1842,44 +1902,31 @@ function ThemeToggle({ className }) {
|
|
|
1842
1902
|
setMounted(true);
|
|
1843
1903
|
}, []);
|
|
1844
1904
|
if (!mounted) {
|
|
1845
|
-
return /* @__PURE__ */ (0,
|
|
1905
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
1846
1906
|
"button",
|
|
1847
1907
|
{
|
|
1848
1908
|
className: `relative inline-flex h-10 w-12 items-center justify-center rounded-md border border-input bg-background hover:bg-accent hover:text-accent-foreground ${className || ""}`,
|
|
1849
1909
|
disabled: true,
|
|
1850
1910
|
children: [
|
|
1851
|
-
/* @__PURE__ */ (0,
|
|
1852
|
-
/* @__PURE__ */ (0,
|
|
1911
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react7.Icon, { icon: "solar:sun-2-linear", width: 20, height: 20 }),
|
|
1912
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "sr-only", children: "Toggle theme" })
|
|
1853
1913
|
]
|
|
1854
1914
|
}
|
|
1855
1915
|
);
|
|
1856
1916
|
}
|
|
1857
|
-
return /* @__PURE__ */ (0,
|
|
1917
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
1858
1918
|
"button",
|
|
1859
1919
|
{
|
|
1860
1920
|
className: `inline-flex h-10 w-12 items-center justify-center rounded-md border border-input bg-background hover:bg-accent hover:text-accent-foreground transition-colors ${className || ""}`,
|
|
1861
1921
|
onClick: () => setTheme(theme === "light" ? "dark" : "light"),
|
|
1862
1922
|
children: [
|
|
1863
|
-
theme === "light" ? /* @__PURE__ */ (0,
|
|
1864
|
-
/* @__PURE__ */ (0,
|
|
1923
|
+
theme === "light" ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react7.Icon, { icon: "solar:sun-2-linear", width: 20, height: 20 }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react7.Icon, { icon: "solar:moon-linear", width: 20, height: 20 }),
|
|
1924
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "sr-only", children: "Toggle theme" })
|
|
1865
1925
|
]
|
|
1866
1926
|
}
|
|
1867
1927
|
);
|
|
1868
1928
|
}
|
|
1869
1929
|
|
|
1870
|
-
// src/components/ui/Toast/GlobalToastContainer.tsx
|
|
1871
|
-
var import_react_toastify = require("react-toastify");
|
|
1872
|
-
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1873
|
-
function GlobalToastContainer() {
|
|
1874
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1875
|
-
import_react_toastify.ToastContainer,
|
|
1876
|
-
{
|
|
1877
|
-
newestOnTop: false,
|
|
1878
|
-
closeButton: false
|
|
1879
|
-
}
|
|
1880
|
-
);
|
|
1881
|
-
}
|
|
1882
|
-
|
|
1883
1930
|
// src/components/ui/Toast/ClayxToast.tsx
|
|
1884
1931
|
var import_react8 = __toESM(require("react"));
|
|
1885
1932
|
var import_react_toastify2 = require("react-toastify");
|
|
@@ -2000,15 +2047,31 @@ var ToastContent = ({ type, title, message, component, closeToast }) => {
|
|
|
2000
2047
|
}
|
|
2001
2048
|
) }) }),
|
|
2002
2049
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-col gap-1 flex-1 relative z-10", children: [
|
|
2003
|
-
title && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2004
|
-
|
|
2050
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2051
|
+
"div",
|
|
2052
|
+
{
|
|
2053
|
+
className: "font-semibold leading-tight text-white/95 drop-shadow-sm",
|
|
2054
|
+
style: { fontSize: "16px" },
|
|
2055
|
+
children: title
|
|
2056
|
+
}
|
|
2057
|
+
),
|
|
2058
|
+
message && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2059
|
+
"div",
|
|
2060
|
+
{
|
|
2061
|
+
className: "text-white/75 drop-shadow-sm",
|
|
2062
|
+
style: {
|
|
2063
|
+
fontSize: "13px"
|
|
2064
|
+
},
|
|
2065
|
+
children: message
|
|
2066
|
+
}
|
|
2067
|
+
)
|
|
2005
2068
|
] }),
|
|
2006
2069
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "relative z-10", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(CloseButton, { closeToast: handleClose }) })
|
|
2007
2070
|
] });
|
|
2008
2071
|
};
|
|
2009
2072
|
var defaultToastOptions = {
|
|
2010
2073
|
position: "bottom-right",
|
|
2011
|
-
autoClose:
|
|
2074
|
+
autoClose: 3e5,
|
|
2012
2075
|
hideProgressBar: true,
|
|
2013
2076
|
closeOnClick: false,
|
|
2014
2077
|
pauseOnHover: true,
|
|
@@ -2419,12 +2482,12 @@ init_config();
|
|
|
2419
2482
|
0 && (module.exports = {
|
|
2420
2483
|
AUTH_ROOT,
|
|
2421
2484
|
AUTH_TOKEN_KEY,
|
|
2422
|
-
AuthProvider,
|
|
2423
2485
|
ClayxToast,
|
|
2424
2486
|
DefaultErrorFallback,
|
|
2425
2487
|
ErrorBoundary,
|
|
2426
2488
|
FloatingButton,
|
|
2427
2489
|
GlobalToastContainer,
|
|
2490
|
+
HowoneProvider,
|
|
2428
2491
|
Loading,
|
|
2429
2492
|
LoadingSpinner,
|
|
2430
2493
|
LoginForm,
|
|
@@ -2455,8 +2518,8 @@ init_config();
|
|
|
2455
2518
|
unifiedAuth,
|
|
2456
2519
|
unifiedOAuth,
|
|
2457
2520
|
useAuth,
|
|
2458
|
-
useAuthContext,
|
|
2459
2521
|
useDebounce,
|
|
2522
|
+
useHowoneContext,
|
|
2460
2523
|
useIsMobile,
|
|
2461
2524
|
useTheme,
|
|
2462
2525
|
workflowRequest
|