my-fleetbo-react-v1 1.0.6 → 1.0.8

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "my-fleetbo-react-v1",
3
3
  "private": false,
4
- "version": "1.0.6",
4
+ "version": "1.0.8",
5
5
  "description": "React template optimized for the Fleetbo ecosystem.",
6
6
  "author": "Jean Aubain Noucti",
7
7
  "license": "MIT",
@@ -75,8 +75,14 @@ export const useStartupEffect = () => {
75
75
  }, 500);
76
76
  }
77
77
  else {
78
+ // Sentinelle de sécurité active pour le mode Standalone Web App
78
79
  setTimeout(() => {
79
- if (!isReadyRef.current) setError("Running outside of Fleetbo Environment.");
80
+ if (!isReadyRef.current) {
81
+ setError("Running outside of Fleetbo Environment.");
82
+
83
+ // ⚡ COUPE-CIRCUIT : On désamorce le timeout de 15s immédiatement
84
+ if (timer) clearTimeout(timer);
85
+ }
80
86
  }, 2000);
81
87
  }
82
88
 
package/src/App.jsx CHANGED
@@ -3,19 +3,19 @@ import { Routes, Route, Navigate, useLocation } from "react-router-dom";
3
3
  import { useStartupEffect } from '@fleetbo/hooks/useStartupEffect';
4
4
 
5
5
  // Application views
6
- import Tab1 from "./app/tabs/Tab1";
7
- import Tab2 from "./app/tabs/Tab2";
8
- import Tab3 from "./app/tabs/Tab3";
9
- import Welcome from "./app/tabs/Welcome";
6
+ import Tab1 from "./app/mocks/tabs/Tab1";
7
+ import Tab2 from "./app/mocks/tabs/Tab2";
8
+ import Tab3 from "./app/mocks/tabs/Tab3";
9
+ import Tabs from "./app/mocks/tabs/Tabs";
10
10
  import AuthRouter from "./app/core/AuthRouter";
11
11
  import NotFound from './app/core/NotFound';
12
12
 
13
13
  // FLEETBO_IMPORTS
14
14
  import Login from "./app/mocks/login/Login";
15
15
  import LoginWeb from "./app/mocks/login/LoginWeb";
16
- import SampleTab1 from './app/mocks/SampleTab1';
17
- import SampleTab2 from './app/mocks/SampleTab2';
18
- import SampleTab3 from './app/mocks/SampleTab3';
16
+ import SampleTab1 from './app/mocks/sample/SampleTab1';
17
+ import SampleTab2 from './app/mocks/sample/SampleTab2';
18
+ import SampleTab3 from './app/mocks/sample/SampleTab3';
19
19
  // FLEETBO_MORE_IMPORTS
20
20
 
21
21
  const TabRedirector = ({ children }) => {
@@ -84,7 +84,7 @@ function App() {
84
84
  const isActuallyAuthenticated = isAuthenticated || iframeAuthOverride;
85
85
 
86
86
  if (isNavbarRoute) {
87
- return isActuallyAuthenticated ? <Welcome /> : null;
87
+ return isActuallyAuthenticated ? <Tabs /> : null;
88
88
  }
89
89
 
90
90
  return (
@@ -115,9 +115,9 @@ function App() {
115
115
  <Route path="/tab3" element={<Tab3 />} />
116
116
 
117
117
  {/* FLEETBO_ROUTES */}
118
- <Route path="/mocks/sampletab1" element={<SampleTab1 />} />
119
- <Route path="/mocks/sampletab2" element={<SampleTab2 />} />
120
- <Route path="/mocks/sampletab3" element={<SampleTab3 />} />
118
+ <Route path="/sampletab1" element={<SampleTab1 />} />
119
+ <Route path="/sampletab2" element={<SampleTab2 />} />
120
+ <Route path="/sampletab3" element={<SampleTab3 />} />
121
121
  {/* FLEETBO_DYNAMIC ROUTES */}
122
122
 
123
123
  <Route path="*" element={<NotFound />} />
@@ -12,17 +12,33 @@ import { PageConfig } from '@fleetbo';
12
12
 
13
13
  const DEFAULT_TAB = 'tab1';
14
14
 
15
- const Login = ({ sessionData: sessionDataProp }) => {
16
- const sessionData = sessionDataProp || (() => {
17
- try {
18
- const s = localStorage.getItem('fleetbo_session');
19
- return s ? JSON.parse(s) : null;
20
- } catch (e) { return null; }
21
- })();
22
-
15
+ const Login = () => {
16
+ const [appInfo, setAppInfo] = useState(null);
23
17
  const [phoneNumber, setPhoneNumber] = useState('');
24
18
  const [loadingLog, setLoadingLog] = useState(false);
25
19
 
20
+ useEffect(() => {
21
+ const checkStatus = async () => {
22
+ if (window.Fleetbo && typeof window.Fleetbo.checkAuthStatusAndRedirect === 'function') {
23
+ try {
24
+ const res = await window.Fleetbo.checkAuthStatusAndRedirect();
25
+ if (res && res.success) {
26
+ setAppInfo({
27
+ name: res.appName || 'Fleetbo App',
28
+ description: res.description || 'DevTool Workspace'
29
+ });
30
+ if (res.isLoggedIn) {
31
+ window.Fleetbo.openView('Tab1', true);
32
+ }
33
+ }
34
+ } catch (err) {
35
+ console.error("Infrastructure connection error:", err);
36
+ }
37
+ }
38
+ };
39
+ checkStatus();
40
+ }, []);
41
+
26
42
  const handleVerifyPhoneNumber = async () => {
27
43
  if (!phoneNumber.trim()) return;
28
44
  setLoadingLog(true);
@@ -46,14 +62,14 @@ const Login = ({ sessionData: sessionDataProp }) => {
46
62
 
47
63
  <div className="login-passerelle-container" style={{ animation: 'fadeIn 0.5s ease-in-out' }}>
48
64
  <div className="login-passerelle-box">
49
- {sessionData ? (
65
+ {appInfo ? (
50
66
  <div className="w-100 d-flex flex-column align-items-center text-center" style={{ maxWidth: '340px' }}>
51
67
  <img className="mb-3" src={logo} alt="logo" style={{ width: '50px', height: '50px' }} />
52
68
  <h3 className="fw-bold mb-1" style={{ fontSize: '19px', color: '#4c8a69' }}>
53
- {sessionData.appName || "Fleetbo"}
69
+ {appInfo.name || "Fleetbo"}
54
70
  </h3>
55
71
  <p className="text-muted mb-4" style={{ fontSize: '13px' }}>
56
- {sessionData.description || "Mobile Cloud OS"}
72
+ {appInfo.description || "Mobile Cloud OS"}
57
73
  </p>
58
74
 
59
75
  <input
@@ -307,7 +307,7 @@ export default function LoginWeb() {
307
307
 
308
308
  <div className="gatekeeper-panel">
309
309
  <div className="form-box">
310
- <h2 className="gatekeeper-title">Workspace Login</h2>
310
+ <h2 className="gatekeeper-title">Workspace Aubain</h2>
311
311
  <p className="gatekeeper-subtitle">
312
312
  Target Infrastructure: <span style={{ color: '#0E904D', fontWeight: '600' }}>{appInfo.name}</span>
313
313
  </p>
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
 
3
- export default function SampleTab() {
3
+ export default function SampleTab1() {
4
4
  return (
5
5
  <div
6
6
  className="d-flex flex-column justify-content-center align-items-center w-100"
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
 
3
- export default function SampleTab() {
3
+ export default function SampleTab2() {
4
4
  return (
5
5
  <div
6
6
  className="d-flex flex-column justify-content-center align-items-center w-100"
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
 
3
- export default function SampleTab() {
3
+ export default function SampleTab3() {
4
4
  return (
5
5
  <div
6
6
  className="d-flex flex-column justify-content-center align-items-center w-100"
@@ -1,13 +1,3 @@
1
- /**
2
- * Tab1.jsx — Fleetbo JS in Action
3
- * Quick ref:
4
- * Fleetbo.openView('Module', true) → Full Native view/tab (120 FPS)
5
- * Fleetbo.exec('Module', 'action', {}) → Native overlay (Atomic)
6
- * Fleetbo.add(db, col, json) → Write documents to Mongo BaaS
7
- * Fleetbo.getDocsG(db, col) → Read documents (General collection)
8
- * Fleetbo.delete(db, col, id) → Absolute document annihilation
9
- */
10
-
11
1
  import { useEffect, useState } from 'react';
12
2
  import { PageConfig } from '@fleetbo';
13
3
 
@@ -1,6 +1,3 @@
1
- /**
2
- * Fleetbo Tab Redirect or Not
3
- */
4
1
  import { useEffect, useState } from 'react';
5
2
  import { PageConfig } from '@fleetbo';
6
3
 
@@ -25,7 +25,7 @@ const getInitialTab = () => {
25
25
  return localStorage.getItem("activeTab") || 'Tab1';
26
26
  };
27
27
 
28
- const Welcome = () => {
28
+ const Tab = () => {
29
29
  const location = useLocation();
30
30
 
31
31
  const [navbarType, setNavbarType] = useState(getNavbarType);
@@ -171,4 +171,4 @@ const Welcome = () => {
171
171
  );
172
172
  };
173
173
 
174
- export default Welcome;
174
+ export default Tab;
File without changes