@howone/sdk 0.2.13 → 0.2.15

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
@@ -67,9 +67,9 @@ function getGlobalEnvironment() {
67
67
  try {
68
68
  const g = globalThis.__HOWONE_ENV__;
69
69
  if (g === "local" || g === "dev" || g === "prod") return g;
70
- return null;
70
+ return "prod";
71
71
  } catch {
72
- return null;
72
+ return "prod";
73
73
  }
74
74
  }
75
75
  var DEFAULT_PROJECT_ID, env, localEnv, devEnv, prodEnv, envs;
@@ -5198,7 +5198,8 @@ var ClayxButton = ({
5198
5198
  };
5199
5199
 
5200
5200
  // src/components/ui/LimitUpgradeToast.tsx
5201
- var import_react13 = require("@iconify/react");
5201
+ var import_react13 = __toESM(require("react"));
5202
+ var import_react14 = require("@iconify/react");
5202
5203
 
5203
5204
  // src/components/ui/Toast/ClayxToast.tsx
5204
5205
  var import_react11 = __toESM(require("react"));
@@ -5400,8 +5401,20 @@ var ToastContent = ({ type, title, message, component, closeToast }) => {
5400
5401
  return actualTheme === "dark" ? iconConfig.dark : iconConfig.light;
5401
5402
  };
5402
5403
  const themeConfig = getThemeConfig();
5404
+ const lightBaseBackgroundByType = {
5405
+ success: "#f0fdf4",
5406
+ // green-50
5407
+ error: "#fef2f2",
5408
+ // red-50
5409
+ warning: "#fffbeb",
5410
+ // amber-50
5411
+ info: "#eff6ff",
5412
+ // blue-50
5413
+ default: "#f9fafb"
5414
+ // gray-50
5415
+ };
5403
5416
  if (component) {
5404
- 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: [
5417
+ 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: [
5405
5418
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex-1 relative z-10", children: component }),
5406
5419
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "relative z-10", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CloseButton, { closeToast: handleClose }) })
5407
5420
  ] });
@@ -5412,7 +5425,7 @@ var ToastContent = ({ type, title, message, component, closeToast }) => {
5412
5425
  {
5413
5426
  className: "absolute left-0 top-0 w-full h-full rounded-xl",
5414
5427
  style: {
5415
- background: theme === "dark" || theme === "system" && window.matchMedia("(prefers-color-scheme: dark)").matches ? "#0f1419" : "#ffffff",
5428
+ background: theme === "dark" || theme === "system" && window.matchMedia("(prefers-color-scheme: dark)").matches ? "#0f1419" : lightBaseBackgroundByType[type],
5416
5429
  zIndex: -2
5417
5430
  }
5418
5431
  }
@@ -5422,7 +5435,7 @@ var ToastContent = ({ type, title, message, component, closeToast }) => {
5422
5435
  {
5423
5436
  className: "absolute left-0 top-0 w-full h-full pointer-events-none rounded-xl",
5424
5437
  style: {
5425
- 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}15 0%, ${themeConfig.gradientColor}08 15%, #fafafaff 30%)`,
5438
+ 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%)`,
5426
5439
  zIndex: -1
5427
5440
  }
5428
5441
  }
@@ -5433,13 +5446,12 @@ var ToastContent = ({ type, title, message, component, closeToast }) => {
5433
5446
  className: "absolute left-0 top-0 w-full h-full pointer-events-none rounded-xl",
5434
5447
  style: {
5435
5448
  border: "2px solid transparent",
5436
- 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}40 0%, ${themeConfig.borderGradientColor}25 5%, transparent 22%)`,
5449
+ 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%)`,
5437
5450
  backgroundOrigin: "border-box",
5438
5451
  backgroundClip: "border-box",
5439
- WebkitMask: "linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0)",
5452
+ WebkitMask: "linear-gradient(#ffffff 0 0) padding-box, linear-gradient(#ffffff 0 0)",
5440
5453
  WebkitMaskComposite: "xor",
5441
- mask: "linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0)",
5442
- maskComposite: "exclude"
5454
+ zIndex: 0
5443
5455
  }
5444
5456
  }
5445
5457
  ),
@@ -5490,9 +5502,17 @@ var defaultToastOptions = {
5490
5502
  pauseOnHover: true,
5491
5503
  draggable: true,
5492
5504
  pauseOnFocusLoss: false,
5493
- theme: "dark",
5494
5505
  transition: import_react_toastify2.Bounce
5495
5506
  };
5507
+ var getToastifyTheme = () => {
5508
+ if (typeof window !== "undefined") {
5509
+ const root = document.documentElement;
5510
+ if (root.classList.contains("dark")) return "dark";
5511
+ if (root.classList.contains("light")) return "light";
5512
+ return window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
5513
+ }
5514
+ return "light";
5515
+ };
5496
5516
  var createToast = (type) => {
5497
5517
  return (params) => {
5498
5518
  const { title, message, component, options } = params;
@@ -5513,6 +5533,7 @@ var createToast = (type) => {
5513
5533
  {
5514
5534
  ...defaultToastOptions,
5515
5535
  ...options,
5536
+ theme: getToastifyTheme(),
5516
5537
  // 确保圆角样式不被覆盖,添加 rounded-xl 类
5517
5538
  className: "!p-0 !shadow-none !rounded-xl",
5518
5539
  style: { padding: 0, borderRadius: "0.75rem" }
@@ -5531,6 +5552,8 @@ var ClayxToast = {
5531
5552
  // src/components/ui/LimitUpgradeToast.tsx
5532
5553
  var import_jsx_runtime13 = require("react/jsx-runtime");
5533
5554
  var LimitToastContainer = ({ message, onUpgrade, closeToast }) => {
5555
+ const [hover, setHover] = import_react13.default.useState(false);
5556
+ const [closeHover, setCloseHover] = import_react13.default.useState(false);
5534
5557
  return /* @__PURE__ */ (0, import_jsx_runtime13.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: [
5535
5558
  /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
5536
5559
  "div",
@@ -5582,8 +5605,18 @@ var LimitToastContainer = ({ message, onUpgrade, closeToast }) => {
5582
5605
  onClick: closeToast,
5583
5606
  isIconOnly: true,
5584
5607
  size: "sm",
5585
- className: "h-6 w-6 min-w-6 rounded-full bg-white/5 hover:bg-white/10 transition-colors",
5586
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react13.Icon, { icon: "iconamoon:close", className: "w-4 h-4 text-gray-400" })
5608
+ onMouseEnter: () => setCloseHover(true),
5609
+ onMouseLeave: () => setCloseHover(false),
5610
+ style: {
5611
+ height: "1.5rem",
5612
+ width: "1.5rem",
5613
+ minWidth: "1.5rem",
5614
+ borderRadius: "9999px",
5615
+ backgroundColor: closeHover ? "rgba(255,255,255,0.1)" : "rgba(255,255,255,0.05)",
5616
+ transition: "background-color 150ms ease",
5617
+ cursor: "pointer"
5618
+ },
5619
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react14.Icon, { icon: "iconamoon:close", className: "w-4 h-4 text-gray-400" })
5587
5620
  }
5588
5621
  )
5589
5622
  ] }),
@@ -5595,10 +5628,19 @@ var LimitToastContainer = ({ message, onUpgrade, closeToast }) => {
5595
5628
  onUpgrade();
5596
5629
  closeToast?.();
5597
5630
  },
5598
- className: "flex-1 bg-gradient-to-r from-purple-500 to-pink-500 hover:from-purple-600 hover:to-pink-600 text-white font-semibold transition-all duration-300 hover:shadow-lg hover:shadow-purple-500/30 cursor-pointer",
5599
- style: { cursor: "pointer" },
5631
+ onMouseEnter: () => setHover(true),
5632
+ onMouseLeave: () => setHover(false),
5633
+ style: {
5634
+ flex: 1,
5635
+ color: "#ffffff",
5636
+ fontWeight: 600,
5637
+ cursor: "pointer",
5638
+ transition: "all 300ms ease-in-out",
5639
+ backgroundImage: hover ? "linear-gradient(to right, #9333ea, #db2777)" : "linear-gradient(to right, #a855f7, #ec4899)",
5640
+ boxShadow: hover ? "0 10px 15px -3px rgba(168,85,247,0.3), 0 4px 6px -2px rgba(168,85,247,0.3)" : "none"
5641
+ },
5600
5642
  children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "flex items-center gap-2", children: [
5601
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react13.Icon, { icon: "solar:rocket-2-bold", className: "w-4 h-4" }),
5643
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react14.Icon, { icon: "solar:rocket-2-bold", className: "w-4 h-4" }),
5602
5644
  "Upgrade Now"
5603
5645
  ] })
5604
5646
  }
@@ -6117,11 +6159,11 @@ function createClient(opts) {
6117
6159
  }
6118
6160
 
6119
6161
  // src/hooks/use-mobile.ts
6120
- var React8 = __toESM(require("react"));
6162
+ var React9 = __toESM(require("react"));
6121
6163
  var MOBILE_BREAKPOINT = 768;
6122
6164
  function useIsMobile() {
6123
- const [isMobile, setIsMobile] = React8.useState(void 0);
6124
- React8.useEffect(() => {
6165
+ const [isMobile, setIsMobile] = React9.useState(void 0);
6166
+ React9.useEffect(() => {
6125
6167
  const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
6126
6168
  const onChange = () => {
6127
6169
  setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
@@ -6134,10 +6176,10 @@ function useIsMobile() {
6134
6176
  }
6135
6177
 
6136
6178
  // src/hooks/use-debounce.ts
6137
- var import_react14 = require("react");
6179
+ var import_react15 = require("react");
6138
6180
  function useDebounce(value, delay) {
6139
- const [debouncedValue, setDebouncedValue] = (0, import_react14.useState)(value);
6140
- (0, import_react14.useEffect)(() => {
6181
+ const [debouncedValue, setDebouncedValue] = (0, import_react15.useState)(value);
6182
+ (0, import_react15.useEffect)(() => {
6141
6183
  const handler = setTimeout(() => {
6142
6184
  setDebouncedValue(value);
6143
6185
  }, delay);