@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.mjs CHANGED
@@ -278,8 +278,29 @@ var API_BASE_URLS = {
278
278
  dev: "https://create-x-backend-dev.fly.dev",
279
279
  prod: "https://create-x-backend.fly.dev"
280
280
  };
281
+ var detectEnvironmentFromHostname = () => {
282
+ try {
283
+ const hostname = window.location.hostname.toLowerCase();
284
+ if (hostname.includes("howone.ai")) {
285
+ return "prod";
286
+ }
287
+ if (hostname.includes("howone.dev")) {
288
+ return "dev";
289
+ }
290
+ if (hostname === "localhost" || hostname === "127.0.0.1" || hostname.startsWith("192.168.") || hostname.endsWith(".local")) {
291
+ return "local";
292
+ }
293
+ const globalEnv = getGlobalEnvironment();
294
+ if (globalEnv) {
295
+ return globalEnv;
296
+ }
297
+ return "prod";
298
+ } catch (error) {
299
+ return getGlobalEnvironment() ?? "dev";
300
+ }
301
+ };
281
302
  var resolveApiBaseUrl = () => {
282
- const env2 = getGlobalEnvironment() ?? "dev";
303
+ const env2 = detectEnvironmentFromHostname();
283
304
  return API_BASE_URLS[env2] ?? API_BASE_URLS.dev;
284
305
  };
285
306
  var UnifiedAuthService = class {
@@ -358,7 +379,13 @@ var UnifiedAuthService = class {
358
379
  };
359
380
  popupCheckInterval = window.setInterval(checkPopupStatus, 1e3);
360
381
  const messageHandler = (event) => {
361
- const validOrigins = [window.location.origin, "https://create-x-backend-dev.fly.dev"];
382
+ const validOrigins = [
383
+ window.location.origin,
384
+ this.API_BASE_URL,
385
+ // 使用当前环境的 API_BASE_URL
386
+ "https://create-x-backend-dev.fly.dev",
387
+ "https://create-x-backend.fly.dev"
388
+ ];
362
389
  const isValidOrigin = validOrigins.some(
363
390
  (origin) => event.origin === origin || event.origin.includes("localhost") || event.origin.includes("127.0.0.1") || event.origin.includes("fly.dev")
364
391
  );
@@ -5525,7 +5552,7 @@ var LimitToastContainer = ({ message, onUpgrade, closeToast }) => {
5525
5552
  /* @__PURE__ */ jsx13("div", { className: "relative z-10 flex items-start gap-4 p-4", children: /* @__PURE__ */ jsxs10("div", { className: "flex flex-1 flex-col gap-3", children: [
5526
5553
  /* @__PURE__ */ jsxs10("div", { className: "flex items-center justify-between", children: [
5527
5554
  /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2", children: [
5528
- /* @__PURE__ */ jsx13("div", { className: "text-lg font-bold bg-gradient-to-r from-white to-gray-400 bg-clip-text text-transparent", children: "Upgrade Required" }),
5555
+ /* @__PURE__ */ jsx13("div", { className: "text-lg font-bold text-white", children: "Upgrade Required" }),
5529
5556
  /* @__PURE__ */ jsx13("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" })
5530
5557
  ] }),
5531
5558
  /* @__PURE__ */ jsx13(