my-fleetbo-react-v1 1.0.7 → 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.7",
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
@@ -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