next-ai-editor 1.0.0 → 1.0.1
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 +7 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.js +7 -0
- 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
|
@@ -1013,6 +1013,13 @@ function getServiceUrl() {
|
|
|
1013
1013
|
if (typeof process !== "undefined" && ((_b = process.env) == null ? void 0 : _b.NEXT_PUBLIC_AI_EDITOR_SERVICE_URL)) {
|
|
1014
1014
|
return process.env.NEXT_PUBLIC_AI_EDITOR_SERVICE_URL;
|
|
1015
1015
|
}
|
|
1016
|
+
if (typeof window !== "undefined") {
|
|
1017
|
+
const hostname = window.location.hostname;
|
|
1018
|
+
if (hostname === "localhost" || hostname === "127.0.0.1") {
|
|
1019
|
+
return "http://localhost:3456";
|
|
1020
|
+
}
|
|
1021
|
+
return `https://${hostname}:3456`;
|
|
1022
|
+
}
|
|
1016
1023
|
return "http://localhost:3456";
|
|
1017
1024
|
}
|
|
1018
1025
|
function buildServiceUrl(path) {
|