next-ai-editor 1.0.0 → 1.0.2
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.cjs +6 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -74,8 +74,10 @@ export declare interface ElementContext {
|
|
|
74
74
|
* Get the AI Editor service URL
|
|
75
75
|
*
|
|
76
76
|
* Priority order:
|
|
77
|
-
* 1. NEXT_PUBLIC_AI_EDITOR_SERVICE_URL environment variable
|
|
78
|
-
* 2.
|
|
77
|
+
* 1. NEXT_PUBLIC_AI_EDITOR_SERVICE_URL environment variable (for custom setups)
|
|
78
|
+
* 2. Auto-detect based on window.location.hostname
|
|
79
|
+
* - localhost -> http://localhost:3456
|
|
80
|
+
* - deployed -> https://${hostname}:3456
|
|
79
81
|
*/
|
|
80
82
|
export declare function getServiceUrl(): string;
|
|
81
83
|
|
package/dist/index.js
CHANGED
|
@@ -1006,12 +1006,12 @@ function MessageList({
|
|
|
1006
1006
|
] });
|
|
1007
1007
|
}
|
|
1008
1008
|
function getServiceUrl() {
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
return
|
|
1009
|
+
if (typeof window !== "undefined") {
|
|
1010
|
+
const hostname = window.location.hostname;
|
|
1011
|
+
if (hostname === "localhost" || hostname === "127.0.0.1") {
|
|
1012
|
+
return "http://localhost:3456";
|
|
1013
|
+
}
|
|
1014
|
+
return `https://${hostname}:3456`;
|
|
1015
1015
|
}
|
|
1016
1016
|
return "http://localhost:3456";
|
|
1017
1017
|
}
|