@howone/sdk 0.1.18 → 0.1.19
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 +51 -19
- package/dist/index.d.ts +51 -19
- package/dist/index.js +613 -281
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +610 -283
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import React, { Component, ReactNode } from 'react';
|
|
1
|
+
import React$1, { Component, ReactNode } from 'react';
|
|
2
2
|
import * as axios from 'axios';
|
|
3
3
|
import { AxiosResponse, InternalAxiosRequestConfig, AxiosRequestConfig, AxiosInstance } from 'axios';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
|
+
import { ToastOptions } from 'react-toastify';
|
|
5
6
|
|
|
6
7
|
interface FloatingButtonProps {
|
|
7
8
|
text?: string;
|
|
8
9
|
onClick?: () => void;
|
|
9
10
|
className?: string;
|
|
10
11
|
}
|
|
11
|
-
declare const FloatingButton: React.FC<FloatingButtonProps>;
|
|
12
|
+
declare const FloatingButton: React$1.FC<FloatingButtonProps>;
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* 统一认证服务
|
|
@@ -420,7 +421,7 @@ interface LoginFormProps {
|
|
|
420
421
|
appName?: string;
|
|
421
422
|
className?: string;
|
|
422
423
|
}
|
|
423
|
-
declare const LoginForm: React.FC<LoginFormProps>;
|
|
424
|
+
declare const LoginForm: React$1.FC<LoginFormProps>;
|
|
424
425
|
|
|
425
426
|
type AuthContextValue = {
|
|
426
427
|
user: ReturnType<typeof parseUserFromToken> | null;
|
|
@@ -428,8 +429,8 @@ type AuthContextValue = {
|
|
|
428
429
|
isAuthenticated: boolean;
|
|
429
430
|
logout: () => void;
|
|
430
431
|
};
|
|
431
|
-
declare const AuthProvider: React.FC<{
|
|
432
|
-
children: React.ReactNode;
|
|
432
|
+
declare const AuthProvider: React$1.FC<{
|
|
433
|
+
children: React$1.ReactNode;
|
|
433
434
|
autoRedirect?: boolean;
|
|
434
435
|
showFloatingButton?: boolean;
|
|
435
436
|
projectId?: string;
|
|
@@ -465,50 +466,81 @@ interface LoadingProps {
|
|
|
465
466
|
className?: string;
|
|
466
467
|
fullScreen?: boolean;
|
|
467
468
|
}
|
|
468
|
-
declare const Loading: React.FC<LoadingProps>;
|
|
469
|
+
declare const Loading: React$1.FC<LoadingProps>;
|
|
469
470
|
interface LoadingSpinnerProps {
|
|
470
471
|
size?: 'sm' | 'md' | 'lg';
|
|
471
472
|
className?: string;
|
|
472
473
|
}
|
|
473
|
-
declare const LoadingSpinner: React.FC<LoadingSpinnerProps>;
|
|
474
|
+
declare const LoadingSpinner: React$1.FC<LoadingSpinnerProps>;
|
|
474
475
|
|
|
475
476
|
interface ErrorBoundaryState {
|
|
476
477
|
hasError: boolean;
|
|
477
478
|
error?: Error;
|
|
478
|
-
errorInfo?: React.ErrorInfo;
|
|
479
|
+
errorInfo?: React$1.ErrorInfo;
|
|
479
480
|
}
|
|
480
481
|
interface ErrorBoundaryProps {
|
|
481
482
|
children: ReactNode;
|
|
482
|
-
fallback?: React.ComponentType<{
|
|
483
|
+
fallback?: React$1.ComponentType<{
|
|
483
484
|
error?: Error;
|
|
484
485
|
retry?: () => void;
|
|
485
486
|
}>;
|
|
486
|
-
onError?: (error: Error, errorInfo: React.ErrorInfo) => void;
|
|
487
|
+
onError?: (error: Error, errorInfo: React$1.ErrorInfo) => void;
|
|
487
488
|
}
|
|
488
489
|
declare class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
|
|
489
490
|
constructor(props: ErrorBoundaryProps);
|
|
490
491
|
static getDerivedStateFromError(error: Error): ErrorBoundaryState;
|
|
491
|
-
componentDidCatch(error: Error, errorInfo: React.ErrorInfo): void;
|
|
492
|
+
componentDidCatch(error: Error, errorInfo: React$1.ErrorInfo): void;
|
|
492
493
|
handleRetry: () => void;
|
|
493
|
-
render(): string | number | boolean | react_jsx_runtime.JSX.Element | Iterable<React.ReactNode> | null | undefined;
|
|
494
|
+
render(): string | number | boolean | react_jsx_runtime.JSX.Element | Iterable<React$1.ReactNode> | null | undefined;
|
|
494
495
|
}
|
|
495
496
|
interface ErrorFallbackProps {
|
|
496
497
|
error?: Error;
|
|
497
498
|
retry?: () => void;
|
|
498
499
|
}
|
|
499
|
-
declare const DefaultErrorFallback: React.FC<ErrorFallbackProps>;
|
|
500
|
+
declare const DefaultErrorFallback: React$1.FC<ErrorFallbackProps>;
|
|
501
|
+
|
|
502
|
+
type Theme = "dark" | "light" | "system";
|
|
503
|
+
type ThemeProviderProps = {
|
|
504
|
+
children: React.ReactNode;
|
|
505
|
+
defaultTheme?: Theme;
|
|
506
|
+
storageKey?: string;
|
|
507
|
+
};
|
|
508
|
+
type ThemeProviderState = {
|
|
509
|
+
theme: Theme;
|
|
510
|
+
setTheme: (theme: Theme) => void;
|
|
511
|
+
};
|
|
512
|
+
declare function ThemeProvider({ children, defaultTheme, storageKey, ...props }: ThemeProviderProps): react_jsx_runtime.JSX.Element;
|
|
513
|
+
declare const useTheme: () => ThemeProviderState;
|
|
514
|
+
|
|
515
|
+
interface ThemeToggleProps {
|
|
516
|
+
className?: string;
|
|
517
|
+
}
|
|
518
|
+
declare function ThemeToggle({ className }: ThemeToggleProps): react_jsx_runtime.JSX.Element;
|
|
519
|
+
|
|
520
|
+
declare function GlobalToastContainer(): react_jsx_runtime.JSX.Element;
|
|
521
|
+
|
|
522
|
+
interface ToastParams {
|
|
523
|
+
title?: string;
|
|
524
|
+
message?: string;
|
|
525
|
+
component?: React$1.ReactNode;
|
|
526
|
+
options?: Partial<ToastOptions>;
|
|
527
|
+
}
|
|
528
|
+
declare const ClayxToast: {
|
|
529
|
+
success: (params: ToastParams) => void;
|
|
530
|
+
error: (params: ToastParams) => void;
|
|
531
|
+
warning: (params: ToastParams) => void;
|
|
532
|
+
info: (params: ToastParams) => void;
|
|
533
|
+
default: (params: ToastParams) => void;
|
|
534
|
+
};
|
|
500
535
|
|
|
501
536
|
declare function useIsMobile(): boolean;
|
|
502
537
|
|
|
503
538
|
declare function useDebounce<T>(value: T, delay: number): T;
|
|
504
539
|
|
|
505
540
|
/**
|
|
506
|
-
*
|
|
507
|
-
*
|
|
508
|
-
* `error-handler.js` script into the page. The script is executed
|
|
509
|
-
* as soon as it's injected, providing early capture of runtime and
|
|
510
|
-
* Vite overlay errors for the host app.
|
|
541
|
+
* 在页面尽早注入错误处理脚本。
|
|
542
|
+
* 调用时机:应在应用入口尽早执行(例如在 root render 之前)。
|
|
511
543
|
*/
|
|
512
544
|
declare function injectEarlyErrorHandler(): void;
|
|
513
545
|
|
|
514
|
-
export { type AIWorkflowClientOptions, type AIWorkflowResponse, AUTH_ROOT, AUTH_TOKEN_KEY, type AccessContext, type Artifact, type ArtifactCreateInput, type ArtifactListQuery, AuthProvider, type AxiosAIWorkflowOptions, DefaultErrorFallback, type EmailLoginRequest, type EmailLoginResponse, ErrorBoundary, FloatingButton, Loading, LoadingSpinner, LoginForm, type SendCodeRequest, type SendCodeResponse, 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, useAuthContext, useDebounce, useIsMobile, workflowRequest };
|
|
546
|
+
export { type AIWorkflowClientOptions, type AIWorkflowResponse, AUTH_ROOT, AUTH_TOKEN_KEY, type AccessContext, type Artifact, type ArtifactCreateInput, type ArtifactListQuery, AuthProvider, type AxiosAIWorkflowOptions, ClayxToast, DefaultErrorFallback, type EmailLoginRequest, type EmailLoginResponse, ErrorBoundary, FloatingButton, GlobalToastContainer, 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, useAuthContext, useDebounce, useIsMobile, useTheme, workflowRequest };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import React, { Component, ReactNode } from 'react';
|
|
1
|
+
import React$1, { Component, ReactNode } from 'react';
|
|
2
2
|
import * as axios from 'axios';
|
|
3
3
|
import { AxiosResponse, InternalAxiosRequestConfig, AxiosRequestConfig, AxiosInstance } from 'axios';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
|
+
import { ToastOptions } from 'react-toastify';
|
|
5
6
|
|
|
6
7
|
interface FloatingButtonProps {
|
|
7
8
|
text?: string;
|
|
8
9
|
onClick?: () => void;
|
|
9
10
|
className?: string;
|
|
10
11
|
}
|
|
11
|
-
declare const FloatingButton: React.FC<FloatingButtonProps>;
|
|
12
|
+
declare const FloatingButton: React$1.FC<FloatingButtonProps>;
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* 统一认证服务
|
|
@@ -420,7 +421,7 @@ interface LoginFormProps {
|
|
|
420
421
|
appName?: string;
|
|
421
422
|
className?: string;
|
|
422
423
|
}
|
|
423
|
-
declare const LoginForm: React.FC<LoginFormProps>;
|
|
424
|
+
declare const LoginForm: React$1.FC<LoginFormProps>;
|
|
424
425
|
|
|
425
426
|
type AuthContextValue = {
|
|
426
427
|
user: ReturnType<typeof parseUserFromToken> | null;
|
|
@@ -428,8 +429,8 @@ type AuthContextValue = {
|
|
|
428
429
|
isAuthenticated: boolean;
|
|
429
430
|
logout: () => void;
|
|
430
431
|
};
|
|
431
|
-
declare const AuthProvider: React.FC<{
|
|
432
|
-
children: React.ReactNode;
|
|
432
|
+
declare const AuthProvider: React$1.FC<{
|
|
433
|
+
children: React$1.ReactNode;
|
|
433
434
|
autoRedirect?: boolean;
|
|
434
435
|
showFloatingButton?: boolean;
|
|
435
436
|
projectId?: string;
|
|
@@ -465,50 +466,81 @@ interface LoadingProps {
|
|
|
465
466
|
className?: string;
|
|
466
467
|
fullScreen?: boolean;
|
|
467
468
|
}
|
|
468
|
-
declare const Loading: React.FC<LoadingProps>;
|
|
469
|
+
declare const Loading: React$1.FC<LoadingProps>;
|
|
469
470
|
interface LoadingSpinnerProps {
|
|
470
471
|
size?: 'sm' | 'md' | 'lg';
|
|
471
472
|
className?: string;
|
|
472
473
|
}
|
|
473
|
-
declare const LoadingSpinner: React.FC<LoadingSpinnerProps>;
|
|
474
|
+
declare const LoadingSpinner: React$1.FC<LoadingSpinnerProps>;
|
|
474
475
|
|
|
475
476
|
interface ErrorBoundaryState {
|
|
476
477
|
hasError: boolean;
|
|
477
478
|
error?: Error;
|
|
478
|
-
errorInfo?: React.ErrorInfo;
|
|
479
|
+
errorInfo?: React$1.ErrorInfo;
|
|
479
480
|
}
|
|
480
481
|
interface ErrorBoundaryProps {
|
|
481
482
|
children: ReactNode;
|
|
482
|
-
fallback?: React.ComponentType<{
|
|
483
|
+
fallback?: React$1.ComponentType<{
|
|
483
484
|
error?: Error;
|
|
484
485
|
retry?: () => void;
|
|
485
486
|
}>;
|
|
486
|
-
onError?: (error: Error, errorInfo: React.ErrorInfo) => void;
|
|
487
|
+
onError?: (error: Error, errorInfo: React$1.ErrorInfo) => void;
|
|
487
488
|
}
|
|
488
489
|
declare class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
|
|
489
490
|
constructor(props: ErrorBoundaryProps);
|
|
490
491
|
static getDerivedStateFromError(error: Error): ErrorBoundaryState;
|
|
491
|
-
componentDidCatch(error: Error, errorInfo: React.ErrorInfo): void;
|
|
492
|
+
componentDidCatch(error: Error, errorInfo: React$1.ErrorInfo): void;
|
|
492
493
|
handleRetry: () => void;
|
|
493
|
-
render(): string | number | boolean | react_jsx_runtime.JSX.Element | Iterable<React.ReactNode> | null | undefined;
|
|
494
|
+
render(): string | number | boolean | react_jsx_runtime.JSX.Element | Iterable<React$1.ReactNode> | null | undefined;
|
|
494
495
|
}
|
|
495
496
|
interface ErrorFallbackProps {
|
|
496
497
|
error?: Error;
|
|
497
498
|
retry?: () => void;
|
|
498
499
|
}
|
|
499
|
-
declare const DefaultErrorFallback: React.FC<ErrorFallbackProps>;
|
|
500
|
+
declare const DefaultErrorFallback: React$1.FC<ErrorFallbackProps>;
|
|
501
|
+
|
|
502
|
+
type Theme = "dark" | "light" | "system";
|
|
503
|
+
type ThemeProviderProps = {
|
|
504
|
+
children: React.ReactNode;
|
|
505
|
+
defaultTheme?: Theme;
|
|
506
|
+
storageKey?: string;
|
|
507
|
+
};
|
|
508
|
+
type ThemeProviderState = {
|
|
509
|
+
theme: Theme;
|
|
510
|
+
setTheme: (theme: Theme) => void;
|
|
511
|
+
};
|
|
512
|
+
declare function ThemeProvider({ children, defaultTheme, storageKey, ...props }: ThemeProviderProps): react_jsx_runtime.JSX.Element;
|
|
513
|
+
declare const useTheme: () => ThemeProviderState;
|
|
514
|
+
|
|
515
|
+
interface ThemeToggleProps {
|
|
516
|
+
className?: string;
|
|
517
|
+
}
|
|
518
|
+
declare function ThemeToggle({ className }: ThemeToggleProps): react_jsx_runtime.JSX.Element;
|
|
519
|
+
|
|
520
|
+
declare function GlobalToastContainer(): react_jsx_runtime.JSX.Element;
|
|
521
|
+
|
|
522
|
+
interface ToastParams {
|
|
523
|
+
title?: string;
|
|
524
|
+
message?: string;
|
|
525
|
+
component?: React$1.ReactNode;
|
|
526
|
+
options?: Partial<ToastOptions>;
|
|
527
|
+
}
|
|
528
|
+
declare const ClayxToast: {
|
|
529
|
+
success: (params: ToastParams) => void;
|
|
530
|
+
error: (params: ToastParams) => void;
|
|
531
|
+
warning: (params: ToastParams) => void;
|
|
532
|
+
info: (params: ToastParams) => void;
|
|
533
|
+
default: (params: ToastParams) => void;
|
|
534
|
+
};
|
|
500
535
|
|
|
501
536
|
declare function useIsMobile(): boolean;
|
|
502
537
|
|
|
503
538
|
declare function useDebounce<T>(value: T, delay: number): T;
|
|
504
539
|
|
|
505
540
|
/**
|
|
506
|
-
*
|
|
507
|
-
*
|
|
508
|
-
* `error-handler.js` script into the page. The script is executed
|
|
509
|
-
* as soon as it's injected, providing early capture of runtime and
|
|
510
|
-
* Vite overlay errors for the host app.
|
|
541
|
+
* 在页面尽早注入错误处理脚本。
|
|
542
|
+
* 调用时机:应在应用入口尽早执行(例如在 root render 之前)。
|
|
511
543
|
*/
|
|
512
544
|
declare function injectEarlyErrorHandler(): void;
|
|
513
545
|
|
|
514
|
-
export { type AIWorkflowClientOptions, type AIWorkflowResponse, AUTH_ROOT, AUTH_TOKEN_KEY, type AccessContext, type Artifact, type ArtifactCreateInput, type ArtifactListQuery, AuthProvider, type AxiosAIWorkflowOptions, DefaultErrorFallback, type EmailLoginRequest, type EmailLoginResponse, ErrorBoundary, FloatingButton, Loading, LoadingSpinner, LoginForm, type SendCodeRequest, type SendCodeResponse, 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, useAuthContext, useDebounce, useIsMobile, workflowRequest };
|
|
546
|
+
export { type AIWorkflowClientOptions, type AIWorkflowResponse, AUTH_ROOT, AUTH_TOKEN_KEY, type AccessContext, type Artifact, type ArtifactCreateInput, type ArtifactListQuery, AuthProvider, type AxiosAIWorkflowOptions, ClayxToast, DefaultErrorFallback, type EmailLoginRequest, type EmailLoginResponse, ErrorBoundary, FloatingButton, GlobalToastContainer, 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, useAuthContext, useDebounce, useIsMobile, useTheme, workflowRequest };
|