@howone/sdk 0.5.3 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +29 -57
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +29 -57
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.d.mts
CHANGED
|
@@ -1169,6 +1169,7 @@ declare function ThemeToggle({ className }: ThemeToggleProps): react_jsx_runtime
|
|
|
1169
1169
|
|
|
1170
1170
|
declare function GlobalToastContainer(): react_jsx_runtime.JSX.Element;
|
|
1171
1171
|
|
|
1172
|
+
type ToastType = "success" | "error" | "warning" | "info" | "default";
|
|
1172
1173
|
interface ToastParams {
|
|
1173
1174
|
title?: string;
|
|
1174
1175
|
message?: string;
|
|
@@ -1176,6 +1177,7 @@ interface ToastParams {
|
|
|
1176
1177
|
component?: React$1.ReactNode;
|
|
1177
1178
|
options?: Partial<ToastOptions>;
|
|
1178
1179
|
}
|
|
1180
|
+
|
|
1179
1181
|
declare const ClayxToast: {
|
|
1180
1182
|
success: (params: ToastParams) => void;
|
|
1181
1183
|
error: (params: ToastParams) => void;
|
|
@@ -1349,4 +1351,4 @@ declare const elementSelector: {
|
|
|
1349
1351
|
isActive: () => boolean;
|
|
1350
1352
|
};
|
|
1351
1353
|
|
|
1352
|
-
export { type AIWorkflowClientOptions, type AIWorkflowResponse, AUTH_TOKEN_KEY, type AccessContext, type Artifact, type ArtifactCreateInput, type ArtifactListQuery, type AxiosAIWorkflowOptions, type BatchUploadOptions, type BatchUploadResponse, ClayxButton, ClayxToast, type CostUpdate, DefaultErrorFallback, type ElementSelectionData, ElementSelector, ElementSelectorProvider, type EmailLoginRequest, type EmailLoginResponse, type Environment, ErrorBoundary, type ExecutionResult, FloatingButton, type GenerateImageOptions, type GenerateImageResponse, GlobalToastContainer, HowOneProvider, type HowOneProviderProps, Loading, LoadingSpinner, LoginForm, type NodeExecution, type SSEClient, type SSEClientConfig, type SSEEventPayload, type SSEExecutionOptions, type SSERequest, type SSESession, type SSEStreamConfig, type SSEWorkflowOptions, type SSEWorkflowRequestInit, type SendCodeRequest, type SendCodeResponse, type SourceLocation, ThemeProvider, ThemeToggle, type UploadOptions, type UploadResponse, type UseElementSelectorReturn, type UseWorkflowStreamState, type Visibility, aiWorkflow, canAccessArtifact, createAIWorkflowClient, createAIWorkflowClientAxios, createArtifactsClient, createClient, createSSEClient, createSSERequest, createUploadClient, elementSelector, type envs, executeSSEWorkflow, getCodeStatus, getDefaultProjectId, getEnvironment, getEnvs, getGlobalEnvironment, getToken, howone, iframeNavigation, initIframeNavigation, isTokenValid, loginWithEmailCode, onAuthStateChanged, parseUserFromToken, sendElementSelectionToParent, sendEmailVerificationCode, setDefaultProjectId, setEnvironment, setToken, showLimitUpgradeToast, unifiedAuth, unifiedOAuth, useAuth, useDebounce, useElementSelector, useHowoneContext, useIsMobile, useTheme, useWorkflowStream };
|
|
1354
|
+
export { type AIWorkflowClientOptions, type AIWorkflowResponse, AUTH_TOKEN_KEY, type AccessContext, type Artifact, type ArtifactCreateInput, type ArtifactListQuery, type AxiosAIWorkflowOptions, type BatchUploadOptions, type BatchUploadResponse, ClayxButton, ClayxToast, type CostUpdate, DefaultErrorFallback, type ElementSelectionData, ElementSelector, ElementSelectorProvider, type EmailLoginRequest, type EmailLoginResponse, type Environment, ErrorBoundary, type ExecutionResult, FloatingButton, type GenerateImageOptions, type GenerateImageResponse, GlobalToastContainer, HowOneProvider, type HowOneProviderProps, Loading, LoadingSpinner, LoginForm, type NodeExecution, type SSEClient, type SSEClientConfig, type SSEEventPayload, type SSEExecutionOptions, type SSERequest, type SSESession, type SSEStreamConfig, type SSEWorkflowOptions, type SSEWorkflowRequestInit, type SendCodeRequest, type SendCodeResponse, type SourceLocation, ThemeProvider, ThemeToggle, type ToastParams, type ToastType, type UploadOptions, type UploadResponse, type UseElementSelectorReturn, type UseWorkflowStreamState, type Visibility, aiWorkflow, canAccessArtifact, createAIWorkflowClient, createAIWorkflowClientAxios, createArtifactsClient, createClient, createSSEClient, createSSERequest, createUploadClient, elementSelector, type envs, executeSSEWorkflow, getCodeStatus, getDefaultProjectId, getEnvironment, getEnvs, getGlobalEnvironment, getToken, howone, iframeNavigation, initIframeNavigation, isTokenValid, loginWithEmailCode, onAuthStateChanged, parseUserFromToken, sendElementSelectionToParent, sendEmailVerificationCode, setDefaultProjectId, setEnvironment, setToken, showLimitUpgradeToast, unifiedAuth, unifiedOAuth, useAuth, useDebounce, useElementSelector, useHowoneContext, useIsMobile, useTheme, useWorkflowStream };
|
package/dist/index.d.ts
CHANGED
|
@@ -1169,6 +1169,7 @@ declare function ThemeToggle({ className }: ThemeToggleProps): react_jsx_runtime
|
|
|
1169
1169
|
|
|
1170
1170
|
declare function GlobalToastContainer(): react_jsx_runtime.JSX.Element;
|
|
1171
1171
|
|
|
1172
|
+
type ToastType = "success" | "error" | "warning" | "info" | "default";
|
|
1172
1173
|
interface ToastParams {
|
|
1173
1174
|
title?: string;
|
|
1174
1175
|
message?: string;
|
|
@@ -1176,6 +1177,7 @@ interface ToastParams {
|
|
|
1176
1177
|
component?: React$1.ReactNode;
|
|
1177
1178
|
options?: Partial<ToastOptions>;
|
|
1178
1179
|
}
|
|
1180
|
+
|
|
1179
1181
|
declare const ClayxToast: {
|
|
1180
1182
|
success: (params: ToastParams) => void;
|
|
1181
1183
|
error: (params: ToastParams) => void;
|
|
@@ -1349,4 +1351,4 @@ declare const elementSelector: {
|
|
|
1349
1351
|
isActive: () => boolean;
|
|
1350
1352
|
};
|
|
1351
1353
|
|
|
1352
|
-
export { type AIWorkflowClientOptions, type AIWorkflowResponse, AUTH_TOKEN_KEY, type AccessContext, type Artifact, type ArtifactCreateInput, type ArtifactListQuery, type AxiosAIWorkflowOptions, type BatchUploadOptions, type BatchUploadResponse, ClayxButton, ClayxToast, type CostUpdate, DefaultErrorFallback, type ElementSelectionData, ElementSelector, ElementSelectorProvider, type EmailLoginRequest, type EmailLoginResponse, type Environment, ErrorBoundary, type ExecutionResult, FloatingButton, type GenerateImageOptions, type GenerateImageResponse, GlobalToastContainer, HowOneProvider, type HowOneProviderProps, Loading, LoadingSpinner, LoginForm, type NodeExecution, type SSEClient, type SSEClientConfig, type SSEEventPayload, type SSEExecutionOptions, type SSERequest, type SSESession, type SSEStreamConfig, type SSEWorkflowOptions, type SSEWorkflowRequestInit, type SendCodeRequest, type SendCodeResponse, type SourceLocation, ThemeProvider, ThemeToggle, type UploadOptions, type UploadResponse, type UseElementSelectorReturn, type UseWorkflowStreamState, type Visibility, aiWorkflow, canAccessArtifact, createAIWorkflowClient, createAIWorkflowClientAxios, createArtifactsClient, createClient, createSSEClient, createSSERequest, createUploadClient, elementSelector, type envs, executeSSEWorkflow, getCodeStatus, getDefaultProjectId, getEnvironment, getEnvs, getGlobalEnvironment, getToken, howone, iframeNavigation, initIframeNavigation, isTokenValid, loginWithEmailCode, onAuthStateChanged, parseUserFromToken, sendElementSelectionToParent, sendEmailVerificationCode, setDefaultProjectId, setEnvironment, setToken, showLimitUpgradeToast, unifiedAuth, unifiedOAuth, useAuth, useDebounce, useElementSelector, useHowoneContext, useIsMobile, useTheme, useWorkflowStream };
|
|
1354
|
+
export { type AIWorkflowClientOptions, type AIWorkflowResponse, AUTH_TOKEN_KEY, type AccessContext, type Artifact, type ArtifactCreateInput, type ArtifactListQuery, type AxiosAIWorkflowOptions, type BatchUploadOptions, type BatchUploadResponse, ClayxButton, ClayxToast, type CostUpdate, DefaultErrorFallback, type ElementSelectionData, ElementSelector, ElementSelectorProvider, type EmailLoginRequest, type EmailLoginResponse, type Environment, ErrorBoundary, type ExecutionResult, FloatingButton, type GenerateImageOptions, type GenerateImageResponse, GlobalToastContainer, HowOneProvider, type HowOneProviderProps, Loading, LoadingSpinner, LoginForm, type NodeExecution, type SSEClient, type SSEClientConfig, type SSEEventPayload, type SSEExecutionOptions, type SSERequest, type SSESession, type SSEStreamConfig, type SSEWorkflowOptions, type SSEWorkflowRequestInit, type SendCodeRequest, type SendCodeResponse, type SourceLocation, ThemeProvider, ThemeToggle, type ToastParams, type ToastType, type UploadOptions, type UploadResponse, type UseElementSelectorReturn, type UseWorkflowStreamState, type Visibility, aiWorkflow, canAccessArtifact, createAIWorkflowClient, createAIWorkflowClientAxios, createArtifactsClient, createClient, createSSEClient, createSSERequest, createUploadClient, elementSelector, type envs, executeSSEWorkflow, getCodeStatus, getDefaultProjectId, getEnvironment, getEnvs, getGlobalEnvironment, getToken, howone, iframeNavigation, initIframeNavigation, isTokenValid, loginWithEmailCode, onAuthStateChanged, parseUserFromToken, sendElementSelectionToParent, sendEmailVerificationCode, setDefaultProjectId, setEnvironment, setToken, showLimitUpgradeToast, unifiedAuth, unifiedOAuth, useAuth, useDebounce, useElementSelector, useHowoneContext, useIsMobile, useTheme, useWorkflowStream };
|
package/dist/index.js
CHANGED
|
@@ -164,7 +164,20 @@ function decodeJwtPayload(token) {
|
|
|
164
164
|
if (pad === 2) base64 += "==";
|
|
165
165
|
else if (pad === 3) base64 += "=";
|
|
166
166
|
else if (pad !== 0) return null;
|
|
167
|
-
const
|
|
167
|
+
const binary = atob(base64);
|
|
168
|
+
let json = binary;
|
|
169
|
+
try {
|
|
170
|
+
if (typeof TextDecoder !== "undefined") {
|
|
171
|
+
const bytes = Uint8Array.from(binary, (ch) => ch.charCodeAt(0));
|
|
172
|
+
json = new TextDecoder("utf-8", { fatal: false }).decode(bytes);
|
|
173
|
+
} else {
|
|
174
|
+
json = decodeURIComponent(
|
|
175
|
+
binary.split("").map((ch) => `%${ch.charCodeAt(0).toString(16).padStart(2, "0")}`).join("")
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
} catch {
|
|
179
|
+
json = binary;
|
|
180
|
+
}
|
|
168
181
|
return JSON.parse(json);
|
|
169
182
|
} catch {
|
|
170
183
|
return null;
|
|
@@ -1927,18 +1940,14 @@ var TOAST_ICONS = {
|
|
|
1927
1940
|
icon: "mdi:success",
|
|
1928
1941
|
color: "text-green-400",
|
|
1929
1942
|
className: "text-green-400",
|
|
1930
|
-
// 深色主题配置
|
|
1931
1943
|
dark: {
|
|
1932
1944
|
bgGradient: "bg-[#14181d]",
|
|
1933
|
-
// 移除透明度 f2
|
|
1934
1945
|
gradientColor: "#389726",
|
|
1935
1946
|
borderGradient: "border-[#389726]",
|
|
1936
1947
|
borderGradientColor: "#389726"
|
|
1937
1948
|
},
|
|
1938
|
-
// 浅色主题配置
|
|
1939
1949
|
light: {
|
|
1940
1950
|
bgGradient: "bg-[#fafafa]",
|
|
1941
|
-
// 移除透明度 ff
|
|
1942
1951
|
gradientColor: "#22c55e",
|
|
1943
1952
|
borderGradient: "border-[#22c55e]",
|
|
1944
1953
|
borderGradientColor: "#22c55e"
|
|
@@ -1950,14 +1959,12 @@ var TOAST_ICONS = {
|
|
|
1950
1959
|
className: "text-red-400",
|
|
1951
1960
|
dark: {
|
|
1952
1961
|
bgGradient: "bg-[#14181d]",
|
|
1953
|
-
// 移除透明度 f2
|
|
1954
1962
|
gradientColor: "#ef4444",
|
|
1955
1963
|
borderGradient: "border-[#ef4444]",
|
|
1956
1964
|
borderGradientColor: "#ef4444"
|
|
1957
1965
|
},
|
|
1958
1966
|
light: {
|
|
1959
1967
|
bgGradient: "bg-[#fafafa]",
|
|
1960
|
-
// 移除透明度 ff
|
|
1961
1968
|
gradientColor: "#f87171",
|
|
1962
1969
|
borderGradient: "border-[#f87171]",
|
|
1963
1970
|
borderGradientColor: "#f87171"
|
|
@@ -1969,14 +1976,12 @@ var TOAST_ICONS = {
|
|
|
1969
1976
|
className: "text-yellow-400",
|
|
1970
1977
|
dark: {
|
|
1971
1978
|
bgGradient: "bg-[#14181d]",
|
|
1972
|
-
// 移除透明度 f2
|
|
1973
1979
|
gradientColor: "#facc15",
|
|
1974
1980
|
borderGradient: "border-[#facc15]",
|
|
1975
1981
|
borderGradientColor: "#facc15"
|
|
1976
1982
|
},
|
|
1977
1983
|
light: {
|
|
1978
1984
|
bgGradient: "bg-[#fafafa]",
|
|
1979
|
-
// 移除透明度 ff
|
|
1980
1985
|
gradientColor: "#f59e0b",
|
|
1981
1986
|
borderGradient: "border-[#f59e0b]",
|
|
1982
1987
|
borderGradientColor: "#f59e0b"
|
|
@@ -1988,14 +1993,12 @@ var TOAST_ICONS = {
|
|
|
1988
1993
|
className: "text-blue-400",
|
|
1989
1994
|
dark: {
|
|
1990
1995
|
bgGradient: "bg-[#14181d]",
|
|
1991
|
-
// 移除透明度 f2
|
|
1992
1996
|
gradientColor: "#60a5fa",
|
|
1993
1997
|
borderGradient: "border-[#60a5fa]",
|
|
1994
1998
|
borderGradientColor: "#f0f0f0"
|
|
1995
1999
|
},
|
|
1996
2000
|
light: {
|
|
1997
2001
|
bgGradient: "bg-[#fafafa]",
|
|
1998
|
-
// 移除透明度 ff
|
|
1999
2002
|
gradientColor: "#3b82f6",
|
|
2000
2003
|
borderGradient: "border-[#3b82f6]",
|
|
2001
2004
|
borderGradientColor: "#3b82f6"
|
|
@@ -2007,14 +2010,12 @@ var TOAST_ICONS = {
|
|
|
2007
2010
|
className: "text-gray-400",
|
|
2008
2011
|
dark: {
|
|
2009
2012
|
bgGradient: "bg-[#14181d]",
|
|
2010
|
-
// 移除透明度 f2
|
|
2011
2013
|
gradientColor: "#9ca3af",
|
|
2012
2014
|
borderGradient: "border-[#9ca3af]",
|
|
2013
2015
|
borderGradientColor: "#9ca3af"
|
|
2014
2016
|
},
|
|
2015
2017
|
light: {
|
|
2016
2018
|
bgGradient: "bg-[#fafafa]",
|
|
2017
|
-
// 移除透明度 ff
|
|
2018
2019
|
gradientColor: "#6b7280",
|
|
2019
2020
|
borderGradient: "border-[#6b7280]",
|
|
2020
2021
|
borderGradientColor: "#6b7280"
|
|
@@ -2040,7 +2041,7 @@ var CloseButton = import_react11.default.memo(({ closeToast }) => {
|
|
|
2040
2041
|
import_react12.Icon,
|
|
2041
2042
|
{
|
|
2042
2043
|
icon: "vaadin:close",
|
|
2043
|
-
className: "flex items-center justify-center rounded-full relative z-10 flex-shrink-0 cursor-pointer
|
|
2044
|
+
className: "flex items-center justify-center rounded-full relative z-10 flex-shrink-0 cursor-pointer transition-colors duration-200 drop-shadow-sm",
|
|
2044
2045
|
onClick: handleClick,
|
|
2045
2046
|
width: 14,
|
|
2046
2047
|
height: 14,
|
|
@@ -2074,15 +2075,10 @@ var ToastContent = ({ type, title, message, component, closeToast }) => {
|
|
|
2074
2075
|
const themeConfig = getThemeConfig();
|
|
2075
2076
|
const lightBaseBackgroundByType = {
|
|
2076
2077
|
success: "#f0fdf4",
|
|
2077
|
-
// green-50
|
|
2078
2078
|
error: "#fef2f2",
|
|
2079
|
-
// red-50
|
|
2080
2079
|
warning: "#fffbeb",
|
|
2081
|
-
// amber-50
|
|
2082
2080
|
info: "#eff6ff",
|
|
2083
|
-
// blue-50
|
|
2084
2081
|
default: "#f9fafb"
|
|
2085
|
-
// gray-50
|
|
2086
2082
|
};
|
|
2087
2083
|
if (component) {
|
|
2088
2084
|
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: [
|
|
@@ -2126,30 +2122,18 @@ var ToastContent = ({ type, title, message, component, closeToast }) => {
|
|
|
2126
2122
|
}
|
|
2127
2123
|
}
|
|
2128
2124
|
),
|
|
2129
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex-shrink-0
|
|
2130
|
-
|
|
2125
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex-shrink-0 mt-0.5 relative z-10", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: `w-7 h-7 backdrop-blur-sm rounded-full flex items-center justify-center ${theme === "dark" || theme === "system" && window.matchMedia("(prefers-color-scheme: dark)").matches ? "bg-white/10" : "bg-black/5"}`, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2126
|
+
import_react12.Icon,
|
|
2131
2127
|
{
|
|
2132
|
-
|
|
2128
|
+
icon: iconConfig.icon,
|
|
2129
|
+
width: 16,
|
|
2130
|
+
height: 16,
|
|
2131
|
+
className: iconConfig.color,
|
|
2133
2132
|
style: {
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
height: "28px"
|
|
2137
|
-
},
|
|
2138
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "rounded-full flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2139
|
-
import_react12.Icon,
|
|
2140
|
-
{
|
|
2141
|
-
icon: iconConfig.icon,
|
|
2142
|
-
width: 16,
|
|
2143
|
-
height: 16,
|
|
2144
|
-
className: `flex-shrink-0`,
|
|
2145
|
-
style: {
|
|
2146
|
-
color: themeConfig.gradientColor,
|
|
2147
|
-
display: "block"
|
|
2148
|
-
}
|
|
2149
|
-
}
|
|
2150
|
-
) })
|
|
2133
|
+
color: themeConfig.gradientColor
|
|
2134
|
+
}
|
|
2151
2135
|
}
|
|
2152
|
-
) }),
|
|
2136
|
+
) }) }),
|
|
2153
2137
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex flex-col gap-1 flex-1 relative z-10", children: [
|
|
2154
2138
|
title && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2155
2139
|
"div",
|
|
@@ -2179,7 +2163,7 @@ var ToastContent = ({ type, title, message, component, closeToast }) => {
|
|
|
2179
2163
|
};
|
|
2180
2164
|
var defaultToastOptions = {
|
|
2181
2165
|
position: "bottom-right",
|
|
2182
|
-
autoClose:
|
|
2166
|
+
autoClose: 3e3,
|
|
2183
2167
|
hideProgressBar: true,
|
|
2184
2168
|
closeOnClick: false,
|
|
2185
2169
|
pauseOnHover: true,
|
|
@@ -2201,7 +2185,8 @@ var createToast = (type) => {
|
|
|
2201
2185
|
const { title, message, component, options } = params;
|
|
2202
2186
|
(0, import_react_toastify2.toast)(
|
|
2203
2187
|
({ closeToast }) => {
|
|
2204
|
-
if (params.render) return params.render(closeToast)
|
|
2188
|
+
if (params.render) return params.render(closeToast ?? (() => {
|
|
2189
|
+
}));
|
|
2205
2190
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2206
2191
|
ToastContent,
|
|
2207
2192
|
{
|
|
@@ -2217,9 +2202,8 @@ var createToast = (type) => {
|
|
|
2217
2202
|
...defaultToastOptions,
|
|
2218
2203
|
...options,
|
|
2219
2204
|
theme: getToastifyTheme(),
|
|
2220
|
-
// 确保圆角样式不被覆盖,添加 rounded-xl 类
|
|
2221
2205
|
className: "!p-0 !shadow-none !rounded-xl",
|
|
2222
|
-
style: { padding: 0, borderRadius: "0.75rem"
|
|
2206
|
+
style: { padding: 0, borderRadius: "0.75rem" }
|
|
2223
2207
|
}
|
|
2224
2208
|
);
|
|
2225
2209
|
};
|
|
@@ -2335,19 +2319,7 @@ function showLimitUpgradeToast(message, onUpgrade) {
|
|
|
2335
2319
|
ClayxToast.default({
|
|
2336
2320
|
render: (closeToast) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(LimitToastContainer, { message, onUpgrade, closeToast }),
|
|
2337
2321
|
options: {
|
|
2338
|
-
|
|
2339
|
-
closeOnClick: false,
|
|
2340
|
-
autoClose: false,
|
|
2341
|
-
hideProgressBar: true,
|
|
2342
|
-
draggable: false,
|
|
2343
|
-
pauseOnHover: true,
|
|
2344
|
-
className: "!bg-transparent !shadow-none",
|
|
2345
|
-
style: {
|
|
2346
|
-
background: "transparent",
|
|
2347
|
-
padding: 0,
|
|
2348
|
-
width: "auto",
|
|
2349
|
-
maxWidth: "420px"
|
|
2350
|
-
}
|
|
2322
|
+
autoClose: false
|
|
2351
2323
|
}
|
|
2352
2324
|
});
|
|
2353
2325
|
}
|