@base44-preview/sdk 0.8.23-pr.134.95f58f7 → 0.8.23-pr.153.716511b

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.
@@ -1,60 +1,3 @@
1
- const POPUP_AUTH_DOMAIN_REGEX = /^(preview-sandbox--|preview--|checkpoint--)[^.]+\./;
2
- function isPopupAuthDomain() {
3
- if (typeof window === "undefined")
4
- return false;
5
- return POPUP_AUTH_DOMAIN_REGEX.test(window.location.hostname);
6
- }
7
- /**
8
- * Opens a URL in a centered popup and waits for the backend to postMessage
9
- * the auth result back. On success, redirects the current window to
10
- * redirectUrl with the token params appended, preserving the same behaviour
11
- * as a normal full-page redirect flow.
12
- *
13
- * @param url - The login URL to open in the popup (should include popup_origin).
14
- * @param redirectUrl - Where to redirect after auth (the original fromUrl).
15
- * @param expectedOrigin - The origin we expect the postMessage to come from.
16
- */
17
- function loginViaPopup(url, redirectUrl, expectedOrigin) {
18
- const width = 500;
19
- const height = 600;
20
- const left = Math.round(window.screenX + (window.outerWidth - width) / 2);
21
- const top = Math.round(window.screenY + (window.outerHeight - height) / 2);
22
- const popup = window.open(url, "base44_auth", `width=${width},height=${height},left=${left},top=${top},resizable=yes,scrollbars=yes`);
23
- if (!popup) {
24
- return;
25
- }
26
- const cleanup = () => {
27
- window.removeEventListener("message", onMessage);
28
- clearInterval(pollTimer);
29
- if (!popup.closed)
30
- popup.close();
31
- };
32
- const onMessage = (event) => {
33
- var _a;
34
- if (event.origin !== expectedOrigin)
35
- return;
36
- if (event.source !== popup)
37
- return;
38
- if (!((_a = event.data) === null || _a === void 0 ? void 0 : _a.access_token))
39
- return;
40
- cleanup();
41
- // Append the token params to redirectUrl so the app processes them
42
- // exactly as it would from a normal OAuth callback redirect.
43
- const callbackUrl = new URL(redirectUrl);
44
- const { access_token, is_new_user } = event.data;
45
- callbackUrl.searchParams.set("access_token", access_token);
46
- if (is_new_user != null) {
47
- callbackUrl.searchParams.set("is_new_user", String(is_new_user));
48
- }
49
- window.location.href = callbackUrl.toString();
50
- };
51
- // Only used to detect the user closing the popup before auth completes
52
- const pollTimer = setInterval(() => {
53
- if (popup.closed)
54
- cleanup();
55
- }, 500);
56
- window.addEventListener("message", onMessage);
57
- }
58
1
  /**
59
2
  * Creates the auth module for the Base44 SDK.
60
3
  *
@@ -106,13 +49,7 @@ export function createAuthModule(axios, functionsAxiosClient, appId, options) {
106
49
  authPath = `/apps/auth${providerPath}/login`;
107
50
  }
108
51
  const loginUrl = `${options.appBaseUrl}/api${authPath}?${queryParams}`;
109
- // On preview/sandbox/checkpoint domains the app runs inside an iframe —
110
- // use a popup to avoid OAuth providers blocking iframe navigation.
111
- if (isPopupAuthDomain()) {
112
- const popupLoginUrl = `${loginUrl}&popup_origin=${encodeURIComponent(window.location.origin)}`;
113
- return loginViaPopup(popupLoginUrl, redirectUrl, window.location.origin);
114
- }
115
- // Default: full-page redirect
52
+ // Redirect to the provider login page
116
53
  window.location.href = loginUrl;
117
54
  },
118
55
  // Logout the current user
@@ -65,7 +65,7 @@ function createEntityHandler(axios, appId, entityName, getSocket) {
65
65
  params.skip = skip;
66
66
  if (fields)
67
67
  params.fields = Array.isArray(fields) ? fields.join(",") : fields;
68
- return axios.get(baseURL, { params });
68
+ return axios.get(baseURL, { params, headers: { 'Accept-Encoding': 'identity' } });
69
69
  },
70
70
  // Filter entities based on query
71
71
  async filter(query, sort, limit, skip, fields) {
@@ -80,7 +80,7 @@ function createEntityHandler(axios, appId, entityName, getSocket) {
80
80
  params.skip = skip;
81
81
  if (fields)
82
82
  params.fields = Array.isArray(fields) ? fields.join(",") : fields;
83
- return axios.get(baseURL, { params });
83
+ return axios.get(baseURL, { params, headers: { 'Accept-Encoding': 'identity' } });
84
84
  },
85
85
  // Get entity by ID
86
86
  async get(id) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base44-preview/sdk",
3
- "version": "0.8.23-pr.134.95f58f7",
3
+ "version": "0.8.23-pr.153.716511b",
4
4
  "description": "JavaScript SDK for Base44 API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",