@howone/sdk 0.2.15 → 0.2.16

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
@@ -349,8 +349,29 @@ var API_BASE_URLS = {
349
349
  dev: "https://create-x-backend-dev.fly.dev",
350
350
  prod: "https://create-x-backend.fly.dev"
351
351
  };
352
+ var detectEnvironmentFromHostname = () => {
353
+ try {
354
+ const hostname = window.location.hostname.toLowerCase();
355
+ if (hostname.includes("howone.ai")) {
356
+ return "prod";
357
+ }
358
+ if (hostname.includes("howone.dev")) {
359
+ return "dev";
360
+ }
361
+ if (hostname === "localhost" || hostname === "127.0.0.1" || hostname.startsWith("192.168.") || hostname.endsWith(".local")) {
362
+ return "local";
363
+ }
364
+ const globalEnv = getGlobalEnvironment();
365
+ if (globalEnv) {
366
+ return globalEnv;
367
+ }
368
+ return "prod";
369
+ } catch (error) {
370
+ return getGlobalEnvironment() ?? "dev";
371
+ }
372
+ };
352
373
  var resolveApiBaseUrl = () => {
353
- const env2 = getGlobalEnvironment() ?? "dev";
374
+ const env2 = detectEnvironmentFromHostname();
354
375
  return API_BASE_URLS[env2] ?? API_BASE_URLS.dev;
355
376
  };
356
377
  var UnifiedAuthService = class {
@@ -429,7 +450,13 @@ var UnifiedAuthService = class {
429
450
  };
430
451
  popupCheckInterval = window.setInterval(checkPopupStatus, 1e3);
431
452
  const messageHandler = (event) => {
432
- const validOrigins = [window.location.origin, "https://create-x-backend-dev.fly.dev"];
453
+ const validOrigins = [
454
+ window.location.origin,
455
+ this.API_BASE_URL,
456
+ // 使用当前环境的 API_BASE_URL
457
+ "https://create-x-backend-dev.fly.dev",
458
+ "https://create-x-backend.fly.dev"
459
+ ];
433
460
  const isValidOrigin = validOrigins.some(
434
461
  (origin) => event.origin === origin || event.origin.includes("localhost") || event.origin.includes("127.0.0.1") || event.origin.includes("fly.dev")
435
462
  );
@@ -5596,7 +5623,7 @@ var LimitToastContainer = ({ message, onUpgrade, closeToast }) => {
5596
5623
  /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "relative z-10 flex items-start gap-4 p-4", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-1 flex-col gap-3", children: [
5597
5624
  /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center justify-between", children: [
5598
5625
  /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center gap-2", children: [
5599
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "text-lg font-bold bg-gradient-to-r from-white to-gray-400 bg-clip-text text-transparent", children: "Upgrade Required" }),
5626
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "text-lg font-bold text-white", children: "Upgrade Required" }),
5600
5627
  /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "px-2 py-0.5 text-xs font-bold bg-purple-500/20 text-purple-400 rounded-md border border-purple-500/30", children: "Premium" })
5601
5628
  ] }),
5602
5629
  /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(