@base44-preview/cli 0.1.7-pr.588.7702fbb → 0.1.8-pr.580.d80a0ce

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.
@@ -9,7 +9,8 @@
9
9
  "preview": "vite preview"
10
10
  },
11
11
  "dependencies": {
12
- "@base44/sdk": "^0.8.3",
12
+ "@base44/sdk": "^0.8.40",
13
+ "@base44/vite-plugin": "^1.0.30",
13
14
  "lucide-react": "^0.475.0",
14
15
  "react": "^18.2.0",
15
16
  "react-dom": "^18.2.0"
@@ -0,0 +1,13 @@
1
+ import { createClient } from '@base44/sdk';
2
+ import { appParams } from '@/lib/app-params';
3
+
4
+ const { appId, token, functionsVersion, appBaseUrl } = appParams;
5
+
6
+ export const base44 = createClient({
7
+ appId,
8
+ token,
9
+ functionsVersion,
10
+ serverUrl: '',
11
+ requiresAuth: false,
12
+ appBaseUrl
13
+ });
@@ -0,0 +1,28 @@
1
+ import { getAccessToken } from '@base44/sdk';
2
+
3
+ const isNode = typeof window === 'undefined';
4
+
5
+ const isClearAccessTokenRequested = () =>
6
+ !isNode && new URLSearchParams(window.location.search).get("clear_access_token") === 'true';
7
+
8
+ const clearStoredAccessToken = () => {
9
+ window.localStorage.removeItem('base44_access_token');
10
+ window.localStorage.removeItem('token');
11
+ }
12
+
13
+ const getAppParams = () => {
14
+ if (isClearAccessTokenRequested()) {
15
+ clearStoredAccessToken();
16
+ }
17
+ return {
18
+ appId: import.meta.env.VITE_BASE44_APP_ID,
19
+ token: getAccessToken(),
20
+ functionsVersion: import.meta.env.VITE_BASE44_FUNCTIONS_VERSION,
21
+ appBaseUrl: import.meta.env.VITE_BASE44_APP_BASE_URL,
22
+ }
23
+ }
24
+
25
+
26
+ export const appParams = {
27
+ ...getAppParams()
28
+ }
@@ -1,12 +1,7 @@
1
- import { defineConfig } from 'vite';
1
+ import base44 from '@base44/vite-plugin';
2
2
  import react from '@vitejs/plugin-react';
3
- import path from 'path';
3
+ import { defineConfig } from 'vite';
4
4
 
5
5
  export default defineConfig({
6
- plugins: [react()],
7
- resolve: {
8
- alias: {
9
- '@': path.resolve(__dirname, './src'),
10
- },
11
- },
6
+ plugins: [base44(), react()],
12
7
  });