@base44-preview/sdk 0.8.17-pr.77.cbf4b6e → 0.8.17-pr.77.dfc0f63

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.
@@ -33,8 +33,16 @@ export function createAuthModule(axios, functionsAxiosClient, appId, options) {
33
33
  const redirectUrl = nextUrl
34
34
  ? new URL(nextUrl, window.location.origin).toString()
35
35
  : window.location.href;
36
+ // For preview URLs (preview--*), redirect to main app's login page
37
+ // but keep from_url pointing to the preview URL
38
+ let loginBaseUrl = (_a = options.appBaseUrl) !== null && _a !== void 0 ? _a : "";
39
+ const hostname = window.location.hostname;
40
+ if (hostname.startsWith("preview--")) {
41
+ const mainHostname = hostname.replace(/^preview--/, "");
42
+ loginBaseUrl = `${window.location.protocol}//${mainHostname}${window.location.port ? ":" + window.location.port : ""}`;
43
+ }
36
44
  // Build the login URL
37
- const loginUrl = `${(_a = options.appBaseUrl) !== null && _a !== void 0 ? _a : ""}/login?from_url=${encodeURIComponent(redirectUrl)}`;
45
+ const loginUrl = `${loginBaseUrl}/login?from_url=${encodeURIComponent(redirectUrl)}`;
38
46
  // Redirect to the login page
39
47
  window.location.href = loginUrl;
40
48
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base44-preview/sdk",
3
- "version": "0.8.17-pr.77.cbf4b6e",
3
+ "version": "0.8.17-pr.77.dfc0f63",
4
4
  "description": "JavaScript SDK for Base44 API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",