@de./sdk-rn 1.0.16 → 1.0.18
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.
|
@@ -19,6 +19,7 @@ export interface MSIProps extends MapOptions {
|
|
|
19
19
|
}
|
|
20
20
|
export interface MSIRef extends MSIInterface {
|
|
21
21
|
isReady: () => boolean;
|
|
22
|
+
retry: () => void;
|
|
22
23
|
}
|
|
23
24
|
declare const _default: React.ForwardRefExoticComponent<MSIProps & React.RefAttributes<MSIRef>>;
|
|
24
25
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/allend/MSI/index.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAuE,MAAM,OAAO,CAAA;AAI3F,OAAO,QAAQ,MAAM,YAAY,CAAA;AACjC,OAAO,OAAO,MAAM,WAAW,CAAA;AAC/B,OAAO,OAAO,EAAE,EAAE,KAAK,MAAM,EAAE,MAAM,WAAW,CAAA;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAE7C,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,QAAQ,CAAA;IAClB,OAAO,EAAE,OAAO,CAAA;IAChB,OAAO,EAAE,OAAO,CAAA;CACjB;AA4CD,MAAM,WAAW,QAAS,SAAQ,UAAU;IAC1C,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAA;IAChC,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,YAAY,KAAK,IAAI,CAAA;CACvC;AAED,MAAM,WAAW,MAAO,SAAQ,YAAY;IAC1C,OAAO,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/allend/MSI/index.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,O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AY,CAAC;IAO7B,OAAO,IAAI,OAAO;CAGnB"}
|
package/dist/allend/MSI/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* React Native SDK for MSI (Map Service Interface)
|
|
4
4
|
*/
|
|
5
5
|
import React, { useRef, useEffect, useState, forwardRef, useImperativeHandle } from 'react';
|
|
6
|
-
import { View, StyleSheet, AppState } from 'react-native';
|
|
6
|
+
import { View, Text, StyleSheet, AppState } from 'react-native';
|
|
7
7
|
import { WebView } from 'react-native-webview';
|
|
8
8
|
import WIO from 'webview.io';
|
|
9
9
|
import Controls from './Controls';
|
|
@@ -57,92 +57,193 @@ export default forwardRef((props, ref) => {
|
|
|
57
57
|
const handlesRef = useRef(null);
|
|
58
58
|
const pluginsRef = useRef(null);
|
|
59
59
|
const [isConnected, setIsConnected] = useState(false);
|
|
60
|
+
const [isReady, setIsReady] = useState(false);
|
|
60
61
|
const [hasError, setHasError] = useState(false);
|
|
62
|
+
const [connectionAttempts, setConnectionAttempts] = useState(0);
|
|
63
|
+
const isInitializedRef = useRef(false);
|
|
61
64
|
// Expose API via ref
|
|
62
65
|
useImperativeHandle(ref, () => ({
|
|
63
66
|
controls: controlsRef.current,
|
|
64
67
|
handles: handlesRef.current,
|
|
65
68
|
plugins: pluginsRef.current,
|
|
66
|
-
isReady: () => isConnected
|
|
69
|
+
isReady: () => isConnected && isReady,
|
|
70
|
+
retry: () => {
|
|
71
|
+
setHasError(false);
|
|
72
|
+
setConnectionAttempts(0);
|
|
73
|
+
initializeConnection();
|
|
74
|
+
}
|
|
67
75
|
}));
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
};
|
|
85
|
-
}, []);
|
|
86
|
-
const initialize = () => {
|
|
87
|
-
// Initialize WIO bridge
|
|
88
|
-
console.log('Initializing WIO bridge from MSI component');
|
|
89
|
-
wioRef.current = new WIO({
|
|
90
|
-
type: 'WEBVIEW',
|
|
91
|
-
debug: props.env === 'dev'
|
|
76
|
+
const initializeAPI = () => {
|
|
77
|
+
var _a;
|
|
78
|
+
if (isInitializedRef.current || !wioRef.current || !isConnected || !isReady)
|
|
79
|
+
return;
|
|
80
|
+
console.log('[MSI] Initializing API components');
|
|
81
|
+
const controls = new Controls(wioRef.current, props), handles = new Handles(wioRef.current, controls, props), plugins = new Plugins(wioRef.current, handles, controls, props);
|
|
82
|
+
plugins.mount(REGISTERED_PLUGINS);
|
|
83
|
+
controlsRef.current = controls;
|
|
84
|
+
handlesRef.current = handles;
|
|
85
|
+
pluginsRef.current = plugins;
|
|
86
|
+
isInitializedRef.current = true;
|
|
87
|
+
console.log('[MSI] API initialized successfully');
|
|
88
|
+
(_a = props.onLoaded) === null || _a === void 0 ? void 0 : _a.call(props, {
|
|
89
|
+
controls,
|
|
90
|
+
handles,
|
|
91
|
+
plugins
|
|
92
92
|
});
|
|
93
|
+
};
|
|
94
|
+
const performBinding = async () => {
|
|
95
|
+
var _a;
|
|
96
|
+
if (!wioRef.current)
|
|
97
|
+
return;
|
|
98
|
+
console.log('[MSI] Performing bind with access token');
|
|
99
|
+
try {
|
|
100
|
+
// Use emitAsync for better error handling
|
|
101
|
+
await wioRef.current.emitAsync('bind', Object.assign(Object.assign({}, props), { origin: 'react-native' }), 10000); // 10 second timeout for binding
|
|
102
|
+
console.log('[MSI] Bind successful');
|
|
103
|
+
setIsConnected(true);
|
|
104
|
+
setHasError(false);
|
|
105
|
+
}
|
|
106
|
+
catch (error) {
|
|
107
|
+
console.error('[MSI] Bind failed:', error);
|
|
108
|
+
const errorObj = error instanceof Error ? error : new Error(String(error));
|
|
109
|
+
setHasError(true);
|
|
110
|
+
(_a = props.onError) === null || _a === void 0 ? void 0 : _a.call(props, errorObj);
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
const initializeConnection = () => {
|
|
114
|
+
if (!wioRef.current || !webViewRef.current)
|
|
115
|
+
return;
|
|
93
116
|
const baseURL = props.env === 'dev'
|
|
94
117
|
? 'http://localhost:4800'
|
|
95
118
|
: 'https://msi.dedot.io';
|
|
119
|
+
console.log('[MSI] Initiating WIO connection to', baseURL);
|
|
96
120
|
wioRef.current.initiate(webViewRef, baseURL);
|
|
121
|
+
};
|
|
122
|
+
useEffect(() => {
|
|
123
|
+
// Initialize WIO bridge
|
|
124
|
+
console.log('[MSI] Creating WIO instance');
|
|
125
|
+
wioRef.current = new WIO({
|
|
126
|
+
type: 'WEBVIEW',
|
|
127
|
+
debug: props.env === 'dev',
|
|
128
|
+
connectionTimeout: 15000, // 15 seconds for initial connection
|
|
129
|
+
connectionPingInterval: 2000,
|
|
130
|
+
maxConnectionAttempts: 5,
|
|
131
|
+
autoReconnect: true,
|
|
132
|
+
heartbeatInterval: 30000
|
|
133
|
+
});
|
|
97
134
|
// Setup event listeners
|
|
98
|
-
console.log('
|
|
135
|
+
console.log('[MSI] Setting up WIO event listeners');
|
|
99
136
|
wioRef.current
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
var _a;
|
|
107
|
-
console.log('WIO bind from MSI component', error);
|
|
108
|
-
if (error) {
|
|
109
|
-
const errorObj = new Error(typeof error === 'string' ? error : 'Connection failed');
|
|
110
|
-
setHasError(true);
|
|
111
|
-
(_a = props.onError) === null || _a === void 0 ? void 0 : _a.call(props, errorObj);
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
setIsConnected(true);
|
|
115
|
-
});
|
|
137
|
+
// Handle successful connection
|
|
138
|
+
.on('connect', async () => {
|
|
139
|
+
console.log('[MSI] WIO bridge connected');
|
|
140
|
+
setConnectionAttempts(0);
|
|
141
|
+
// Perform binding after connection
|
|
142
|
+
await performBinding();
|
|
116
143
|
})
|
|
117
|
-
|
|
144
|
+
// Handle connection timeout
|
|
145
|
+
.on('connect_timeout', ({ attempts }) => {
|
|
118
146
|
var _a;
|
|
119
|
-
console.
|
|
120
|
-
|
|
147
|
+
console.error('[MSI] Connection timeout after', attempts, 'attempts');
|
|
148
|
+
setConnectionAttempts(attempts);
|
|
121
149
|
setHasError(true);
|
|
122
|
-
(_a = props.onError) === null || _a === void 0 ? void 0 : _a.call(props,
|
|
150
|
+
(_a = props.onError) === null || _a === void 0 ? void 0 : _a.call(props, new Error(`Failed to connect after ${attempts} attempts`));
|
|
151
|
+
})
|
|
152
|
+
// Handle reconnection attempts
|
|
153
|
+
.on('reconnecting', ({ attempt, delay }) => {
|
|
154
|
+
console.log(`[MSI] Reconnecting (attempt ${attempt}, delay ${delay}ms)`);
|
|
155
|
+
setIsConnected(false);
|
|
156
|
+
setIsReady(false);
|
|
157
|
+
})
|
|
158
|
+
// Handle reconnection failure
|
|
159
|
+
.on('reconnection_failed', ({ attempts }) => {
|
|
160
|
+
var _a;
|
|
161
|
+
console.error('[MSI] Reconnection failed after', attempts, 'attempts');
|
|
162
|
+
setHasError(true);
|
|
163
|
+
(_a = props.onError) === null || _a === void 0 ? void 0 : _a.call(props, new Error(`Reconnection failed after ${attempts} attempts`));
|
|
123
164
|
})
|
|
165
|
+
// Handle disconnection
|
|
166
|
+
.on('disconnect', ({ reason }) => {
|
|
167
|
+
console.log('[MSI] Disconnected:', reason);
|
|
168
|
+
setIsConnected(false);
|
|
169
|
+
setIsReady(false);
|
|
170
|
+
})
|
|
171
|
+
// Handle WebView ready event
|
|
124
172
|
.on('ready', () => {
|
|
125
|
-
var _a
|
|
126
|
-
console.log('MSI ready'
|
|
173
|
+
var _a;
|
|
174
|
+
console.log('[MSI] WebView content ready');
|
|
175
|
+
setIsReady(true);
|
|
127
176
|
(_a = props.onReady) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
177
|
+
})
|
|
178
|
+
// Handle errors
|
|
179
|
+
.on('error', (error) => {
|
|
180
|
+
var _a;
|
|
181
|
+
console.error('[MSI] WIO error:', error);
|
|
182
|
+
const errorObj = typeof error === 'object' && error.error
|
|
183
|
+
? new Error(error.error)
|
|
184
|
+
: typeof error === 'string'
|
|
185
|
+
? new Error(error)
|
|
186
|
+
: error instanceof Error
|
|
187
|
+
? error
|
|
188
|
+
: new Error('Unknown error');
|
|
189
|
+
// Don't set hasError for rate limiting or non-critical errors
|
|
190
|
+
if (error.type !== 'RATE_LIMIT_EXCEEDED') {
|
|
191
|
+
setHasError(true);
|
|
141
192
|
}
|
|
193
|
+
(_a = props.onError) === null || _a === void 0 ? void 0 : _a.call(props, errorObj);
|
|
142
194
|
});
|
|
143
|
-
|
|
195
|
+
// Handle app state changes
|
|
196
|
+
const subscription = AppState.addEventListener('change', (nextAppState) => {
|
|
197
|
+
var _a, _b, _c;
|
|
198
|
+
if (nextAppState === 'background') {
|
|
199
|
+
console.log('[MSI] App backgrounded - pausing map updates');
|
|
200
|
+
// Optionally emit event to WebView to pause rendering
|
|
201
|
+
(_a = wioRef.current) === null || _a === void 0 ? void 0 : _a.emit('app:background');
|
|
202
|
+
}
|
|
203
|
+
else if (nextAppState === 'active') {
|
|
204
|
+
console.log('[MSI] App active - resuming map updates');
|
|
205
|
+
(_b = wioRef.current) === null || _b === void 0 ? void 0 : _b.emit('app:foreground');
|
|
206
|
+
// Check if we need to reconnect
|
|
207
|
+
if (!((_c = wioRef.current) === null || _c === void 0 ? void 0 : _c.isConnected())) {
|
|
208
|
+
console.log('[MSI] Reconnecting after app resumed');
|
|
209
|
+
initializeConnection();
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
return () => {
|
|
214
|
+
var _a;
|
|
215
|
+
console.log('[MSI] Cleaning up');
|
|
216
|
+
subscription.remove();
|
|
217
|
+
(_a = wioRef.current) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
218
|
+
isInitializedRef.current = false;
|
|
219
|
+
};
|
|
220
|
+
}, []);
|
|
221
|
+
// Initialize API when both connection and ready state are achieved
|
|
222
|
+
useEffect(() => initializeAPI(), [isConnected, isReady]);
|
|
144
223
|
const handleMessage = (event) => {
|
|
145
224
|
var _a;
|
|
225
|
+
// Handle console logs separately
|
|
226
|
+
try {
|
|
227
|
+
const data = JSON.parse(event.nativeEvent.data);
|
|
228
|
+
if (data.type === '__console') {
|
|
229
|
+
const prefix = '[WebView]';
|
|
230
|
+
switch (data.level) {
|
|
231
|
+
case 'log':
|
|
232
|
+
console.log(prefix, data.message);
|
|
233
|
+
break;
|
|
234
|
+
case 'error':
|
|
235
|
+
console.error(prefix, data.message);
|
|
236
|
+
break;
|
|
237
|
+
case 'warn':
|
|
238
|
+
console.warn(prefix, data.message);
|
|
239
|
+
break;
|
|
240
|
+
}
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
catch (e) {
|
|
245
|
+
// Not JSON or not console log, pass to WIO
|
|
246
|
+
}
|
|
146
247
|
(_a = wioRef.current) === null || _a === void 0 ? void 0 : _a.handleMessage(event);
|
|
147
248
|
};
|
|
148
249
|
const baseURL = props.env === 'dev'
|
|
@@ -152,21 +253,27 @@ export default forwardRef((props, ref) => {
|
|
|
152
253
|
<WebView ref={webViewRef} source={{ uri: mapUrl }} style={styles.webview} onMessage={handleMessage} injectedJavaScript={`
|
|
153
254
|
${getInjectedConsole()}
|
|
154
255
|
${WIO_PAIR_INJECTED_JAVASCRIPT}
|
|
155
|
-
`} javaScriptEnabled={true} domStorageEnabled={true} geolocationEnabled={true} allowsInlineMediaPlayback={true} cacheEnabled={true} androidLayerType="hardware" allowsBackForwardNavigationGestures={false} bounces={false} scrollEnabled={false} mixedContentMode="always" originWhitelist={['*']} onLoadStart={() => console.log('WebView loading...')} onLoadEnd={() => {
|
|
156
|
-
console.log('WebView loaded');
|
|
157
|
-
|
|
158
|
-
|
|
256
|
+
`} javaScriptEnabled={true} domStorageEnabled={true} geolocationEnabled={true} allowsInlineMediaPlayback={true} cacheEnabled={true} androidLayerType="hardware" allowsBackForwardNavigationGestures={false} bounces={false} scrollEnabled={false} mixedContentMode="always" originWhitelist={['*']} onLoadStart={() => console.log('[MSI] WebView loading...')} onLoadEnd={() => {
|
|
257
|
+
console.log('[MSI] WebView loaded, initiating connection');
|
|
258
|
+
// Let WIO handle the connection automatically
|
|
259
|
+
// Remove the manual ping - it's not needed!
|
|
260
|
+
initializeConnection();
|
|
159
261
|
}} onError={(syntheticEvent) => {
|
|
160
262
|
var _a;
|
|
161
263
|
const { nativeEvent } = syntheticEvent;
|
|
162
|
-
console.error('WebView error:', nativeEvent);
|
|
264
|
+
console.error('[MSI] WebView error:', nativeEvent);
|
|
163
265
|
setHasError(true);
|
|
164
266
|
(_a = props.onError) === null || _a === void 0 ? void 0 : _a.call(props, new Error(nativeEvent.description || 'WebView error'));
|
|
165
267
|
}}/>
|
|
166
268
|
|
|
167
269
|
{hasError && (<View style={styles.errorOverlay}>
|
|
168
270
|
<View style={styles.errorCard}>
|
|
169
|
-
{/*
|
|
271
|
+
{/* Add error UI with retry button */}
|
|
272
|
+
<Text style={styles.errorText}>
|
|
273
|
+
{connectionAttempts > 0
|
|
274
|
+
? `Connection failed after ${connectionAttempts} attempts`
|
|
275
|
+
: 'An error occurred'}
|
|
276
|
+
</Text>
|
|
170
277
|
</View>
|
|
171
278
|
</View>)}
|
|
172
279
|
</View>);
|
|
@@ -185,7 +292,13 @@ const styles = StyleSheet.create({
|
|
|
185
292
|
backgroundColor: 'white',
|
|
186
293
|
padding: 20,
|
|
187
294
|
borderRadius: 12,
|
|
188
|
-
margin: 20
|
|
295
|
+
margin: 20,
|
|
296
|
+
minWidth: 200
|
|
297
|
+
},
|
|
298
|
+
errorText: {
|
|
299
|
+
fontSize: 16,
|
|
300
|
+
color: '#333',
|
|
301
|
+
textAlign: 'center'
|
|
189
302
|
}
|
|
190
303
|
});
|
|
191
304
|
// =====================================================
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/allend/MSI/index.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAA;AAC3F,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAkB,MAAM,cAAc,CAAA;AACzE,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAC9C,OAAO,GAAG,MAAM,YAAY,CAAA;AAC5B,OAAO,QAAQ,MAAM,YAAY,CAAA;AACjC,OAAO,OAAO,MAAM,WAAW,CAAA;AAC/B,OAAO,OAAwB,MAAM,WAAW,CAAA;AAShD,SAAS,kBAAkB;IACzB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCN,CAAC;AACJ,CAAC;AAED,MAAM,4BAA4B,GAAG,IAAI,GAAG,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,qBAAqB,EAAE,CAAA;AACzF,MAAM,iBAAiB,GAAG,CAAC,aAAa,CAAC,CAAA;AACzC,MAAM,kBAAkB,GAAgC,EAAE,CAAA;AAY1D,gBAAgB;AAChB,eAAe,UAAU,CAAmB,CAAE,KAAK,EAAE,GAAG,EAAG,EAAE;IAC3D,MAAM,UAAU,GAAG,MAAM,CAAU,IAAI,CAAC,CAAA;IACxC,MAAM,MAAM,GAAG,MAAM,CAAa,IAAI,CAAC,CAAA;IACvC,MAAM,WAAW,GAAG,MAAM,CAAkB,IAAI,CAAC,CAAA;IACjD,MAAM,UAAU,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAA;IAC/C,MAAM,UAAU,GAAG,MAAM,CAAiB,IAAI,C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I,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW;YAC3B,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAA;IAC3C,CAAC;IAED,MAAM,CAAK,IAAY,EAAE,EAAa;QACpC,kBAAkB,CAAC,IAAI,CAAC,GAAG,EAAE,CAAA;IAC/B,CAAC;IAED,IAAI,CAAE,KAAa,EAAE,OAAiB;QACpC,IAAI,KAAK,KAAK,OAAO;YAAG,IAAI,CAAC,OAAO,GAAG,OAAc,CAAA;aAChD,IAAI,KAAK,KAAK,OAAO;YAAG,IAAI,CAAC,OAAO,GAAG,OAAc,CAAA;QAC1D,OAAO,IAAI,CAAA;IACb,CAAC;IAED,EAAE,CAAE,KAAa,EAAE,OAAiB;QAClC,OAAO,IAAI,CAAC,IAAI,CAAE,KAAK,EAAE,OAAO,CAAE,CAAA;IACpC,CAAC;IAED,UAAU;QACR,OAAO,IAAI,CAAC,OAAO,CAAA;IACrB,CAAC;IAED,IAAI;QACF,OAAO,IAAI,OAAO,CAAC,CAAE,OAAO,EAAE,MAAM,EAAG,EAAE;YACvC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAA;YACvB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAA;QACvB,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,OAAO;QACL,OAAO,KAAK,CAAA;IACd,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@de./sdk-rn",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.18",
|
|
4
4
|
"description": "Complete SDK pack for MSI React Native (Map Service Interface) and DClient services",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"events": "^3.3.0",
|
|
39
39
|
"socket.io-client": "^4.6.1",
|
|
40
|
-
"webview.io": "^1.0.
|
|
40
|
+
"webview.io": "^1.0.2"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"react": ">=16.8.0",
|
package/src/allend/MSI/index.tsx
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import React, { useRef, useEffect, useState, forwardRef, useImperativeHandle } from 'react'
|
|
7
|
-
import { View, StyleSheet, AppState, AppStateStatus } from 'react-native'
|
|
7
|
+
import { View, Text, StyleSheet, AppState, AppStateStatus } from 'react-native'
|
|
8
8
|
import { WebView } from 'react-native-webview'
|
|
9
9
|
import WIO from 'webview.io'
|
|
10
10
|
import Controls from './Controls'
|
|
@@ -68,6 +68,7 @@ export interface MSIProps extends MapOptions {
|
|
|
68
68
|
|
|
69
69
|
export interface MSIRef extends MSIInterface {
|
|
70
70
|
isReady: () => boolean
|
|
71
|
+
retry: () => void
|
|
71
72
|
}
|
|
72
73
|
|
|
73
74
|
// MSI Component
|
|
@@ -78,107 +79,205 @@ export default forwardRef<MSIRef, MSIProps>(( props, ref ) => {
|
|
|
78
79
|
const handlesRef = useRef<Handles | null>(null)
|
|
79
80
|
const pluginsRef = useRef<Plugins | null>(null)
|
|
80
81
|
const [isConnected, setIsConnected] = useState(false)
|
|
82
|
+
const [isReady, setIsReady] = useState(false)
|
|
81
83
|
const [hasError, setHasError] = useState(false)
|
|
84
|
+
const [connectionAttempts, setConnectionAttempts] = useState(0)
|
|
85
|
+
const isInitializedRef = useRef(false)
|
|
82
86
|
|
|
83
87
|
// Expose API via ref
|
|
84
88
|
useImperativeHandle( ref, () => ({
|
|
85
89
|
controls: controlsRef.current!,
|
|
86
90
|
handles: handlesRef.current!,
|
|
87
91
|
plugins: pluginsRef.current!,
|
|
88
|
-
isReady: () => isConnected
|
|
92
|
+
isReady: () => isConnected && isReady,
|
|
93
|
+
retry: () => {
|
|
94
|
+
setHasError(false)
|
|
95
|
+
setConnectionAttempts(0)
|
|
96
|
+
initializeConnection()
|
|
97
|
+
}
|
|
89
98
|
}))
|
|
90
99
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
const initializeAPI = () => {
|
|
101
|
+
if( isInitializedRef.current || !wioRef.current || !isConnected || !isReady ) return
|
|
102
|
+
|
|
103
|
+
console.log('[MSI] Initializing API components')
|
|
104
|
+
|
|
105
|
+
const
|
|
106
|
+
controls = new Controls( wioRef.current, props ),
|
|
107
|
+
handles = new Handles( wioRef.current, controls, props ),
|
|
108
|
+
plugins = new Plugins( wioRef.current, handles, controls, props )
|
|
109
|
+
|
|
110
|
+
plugins.mount( REGISTERED_PLUGINS )
|
|
111
|
+
|
|
112
|
+
controlsRef.current = controls
|
|
113
|
+
handlesRef.current = handles
|
|
114
|
+
pluginsRef.current = plugins
|
|
115
|
+
isInitializedRef.current = true
|
|
116
|
+
|
|
117
|
+
console.log('[MSI] API initialized successfully')
|
|
118
|
+
props.onLoaded?.({
|
|
119
|
+
controls,
|
|
120
|
+
handles,
|
|
121
|
+
plugins
|
|
102
122
|
})
|
|
123
|
+
}
|
|
103
124
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
125
|
+
const performBinding = async () => {
|
|
126
|
+
if( !wioRef.current ) return
|
|
127
|
+
|
|
128
|
+
console.log('[MSI] Performing bind with access token')
|
|
129
|
+
|
|
130
|
+
try {
|
|
131
|
+
// Use emitAsync for better error handling
|
|
132
|
+
await wioRef.current.emitAsync('bind', { ...props, origin: 'react-native' }, 10000) // 10 second timeout for binding
|
|
133
|
+
|
|
134
|
+
console.log('[MSI] Bind successful')
|
|
135
|
+
setIsConnected(true)
|
|
136
|
+
setHasError(false)
|
|
107
137
|
}
|
|
108
|
-
|
|
138
|
+
catch( error ) {
|
|
139
|
+
console.error('[MSI] Bind failed:', error)
|
|
140
|
+
const errorObj = error instanceof Error ? error : new Error(String(error))
|
|
141
|
+
setHasError(true)
|
|
142
|
+
props.onError?.(errorObj)
|
|
143
|
+
}
|
|
144
|
+
}
|
|
109
145
|
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
console.log('Initializing WIO bridge from MSI component')
|
|
113
|
-
wioRef.current = new WIO({
|
|
114
|
-
type: 'WEBVIEW',
|
|
115
|
-
debug: props.env === 'dev'
|
|
116
|
-
})
|
|
146
|
+
const initializeConnection = () => {
|
|
147
|
+
if( !wioRef.current || !webViewRef.current ) return
|
|
117
148
|
|
|
118
149
|
const baseURL = props.env === 'dev'
|
|
119
150
|
? 'http://localhost:4800'
|
|
120
151
|
: 'https://msi.dedot.io'
|
|
121
152
|
|
|
153
|
+
console.log('[MSI] Initiating WIO connection to', baseURL)
|
|
122
154
|
wioRef.current.initiate( webViewRef, baseURL )
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
useEffect(() => {
|
|
158
|
+
// Initialize WIO bridge
|
|
159
|
+
console.log('[MSI] Creating WIO instance')
|
|
160
|
+
wioRef.current = new WIO({
|
|
161
|
+
type: 'WEBVIEW',
|
|
162
|
+
debug: props.env === 'dev',
|
|
163
|
+
connectionTimeout: 15000, // 15 seconds for initial connection
|
|
164
|
+
connectionPingInterval: 2000,
|
|
165
|
+
maxConnectionAttempts: 5,
|
|
166
|
+
autoReconnect: true,
|
|
167
|
+
heartbeatInterval: 30000
|
|
168
|
+
})
|
|
123
169
|
|
|
124
170
|
// Setup event listeners
|
|
125
|
-
console.log('
|
|
171
|
+
console.log('[MSI] Setting up WIO event listeners')
|
|
172
|
+
|
|
126
173
|
wioRef.current
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
174
|
+
// Handle successful connection
|
|
175
|
+
.on('connect', async () => {
|
|
176
|
+
console.log('[MSI] WIO bridge connected')
|
|
177
|
+
setConnectionAttempts(0)
|
|
178
|
+
|
|
179
|
+
// Perform binding after connection
|
|
180
|
+
await performBinding()
|
|
181
|
+
})
|
|
182
|
+
// Handle connection timeout
|
|
183
|
+
.on('connect_timeout', ({ attempts }) => {
|
|
184
|
+
console.error('[MSI] Connection timeout after', attempts, 'attempts')
|
|
185
|
+
setConnectionAttempts(attempts)
|
|
186
|
+
setHasError(true)
|
|
187
|
+
props.onError?.(new Error(`Failed to connect after ${attempts} attempts`))
|
|
188
|
+
})
|
|
189
|
+
// Handle reconnection attempts
|
|
190
|
+
.on('reconnecting', ({ attempt, delay }) => {
|
|
191
|
+
console.log(`[MSI] Reconnecting (attempt ${attempt}, delay ${delay}ms)`)
|
|
192
|
+
setIsConnected(false)
|
|
193
|
+
setIsReady(false)
|
|
194
|
+
})
|
|
195
|
+
// Handle reconnection failure
|
|
196
|
+
.on('reconnection_failed', ({ attempts }) => {
|
|
197
|
+
console.error('[MSI] Reconnection failed after', attempts, 'attempts')
|
|
198
|
+
setHasError(true)
|
|
199
|
+
props.onError?.(new Error(`Reconnection failed after ${attempts} attempts`))
|
|
147
200
|
})
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
201
|
+
// Handle disconnection
|
|
202
|
+
.on('disconnect', ({ reason }) => {
|
|
203
|
+
console.log('[MSI] Disconnected:', reason)
|
|
204
|
+
setIsConnected(false)
|
|
205
|
+
setIsReady(false)
|
|
153
206
|
})
|
|
207
|
+
// Handle WebView ready event
|
|
154
208
|
.on('ready', () => {
|
|
155
|
-
console.log('MSI ready'
|
|
209
|
+
console.log('[MSI] WebView content ready')
|
|
210
|
+
setIsReady(true)
|
|
156
211
|
props.onReady?.()
|
|
212
|
+
})
|
|
213
|
+
// Handle errors
|
|
214
|
+
.on('error', ( error: any ) => {
|
|
215
|
+
console.error('[MSI] WIO error:', error)
|
|
216
|
+
const errorObj = typeof error === 'object' && error.error
|
|
217
|
+
? new Error(error.error)
|
|
218
|
+
: typeof error === 'string'
|
|
219
|
+
? new Error(error)
|
|
220
|
+
: error instanceof Error
|
|
221
|
+
? error
|
|
222
|
+
: new Error('Unknown error')
|
|
223
|
+
|
|
224
|
+
// Don't set hasError for rate limiting or non-critical errors
|
|
225
|
+
if( error.type !== 'RATE_LIMIT_EXCEEDED' ){
|
|
226
|
+
setHasError(true)
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
props.onError?.(errorObj)
|
|
230
|
+
})
|
|
157
231
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
232
|
+
// Handle app state changes
|
|
233
|
+
const subscription = AppState.addEventListener('change', ( nextAppState: AppStateStatus ) => {
|
|
234
|
+
if( nextAppState === 'background' ){
|
|
235
|
+
console.log('[MSI] App backgrounded - pausing map updates')
|
|
236
|
+
// Optionally emit event to WebView to pause rendering
|
|
237
|
+
wioRef.current?.emit('app:background')
|
|
238
|
+
}
|
|
239
|
+
else if( nextAppState === 'active' ){
|
|
240
|
+
console.log('[MSI] App active - resuming map updates')
|
|
241
|
+
wioRef.current?.emit('app:foreground')
|
|
164
242
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
console.log('MSI loaded', controls, handles, plugins)
|
|
172
|
-
props.onLoaded?.({
|
|
173
|
-
controls,
|
|
174
|
-
handles,
|
|
175
|
-
plugins
|
|
176
|
-
})
|
|
243
|
+
// Check if we need to reconnect
|
|
244
|
+
if( !wioRef.current?.isConnected() ){
|
|
245
|
+
console.log('[MSI] Reconnecting after app resumed')
|
|
246
|
+
initializeConnection()
|
|
247
|
+
}
|
|
177
248
|
}
|
|
178
249
|
})
|
|
179
|
-
|
|
250
|
+
|
|
251
|
+
return () => {
|
|
252
|
+
console.log('[MSI] Cleaning up')
|
|
253
|
+
subscription.remove()
|
|
254
|
+
wioRef.current?.disconnect()
|
|
255
|
+
isInitializedRef.current = false
|
|
256
|
+
}
|
|
257
|
+
}, [])
|
|
258
|
+
|
|
259
|
+
// Initialize API when both connection and ready state are achieved
|
|
260
|
+
useEffect( () => initializeAPI(), [isConnected, isReady] )
|
|
180
261
|
|
|
181
262
|
const handleMessage = ( event: any ) => {
|
|
263
|
+
// Handle console logs separately
|
|
264
|
+
try {
|
|
265
|
+
const data = JSON.parse(event.nativeEvent.data)
|
|
266
|
+
if( data.type === '__console' ){
|
|
267
|
+
const prefix = '[WebView]'
|
|
268
|
+
switch( data.level ){
|
|
269
|
+
case 'log': console.log(prefix, data.message); break
|
|
270
|
+
case 'error': console.error(prefix, data.message); break
|
|
271
|
+
case 'warn': console.warn(prefix, data.message); break
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
return
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
catch(e){
|
|
278
|
+
// Not JSON or not console log, pass to WIO
|
|
279
|
+
}
|
|
280
|
+
|
|
182
281
|
wioRef.current?.handleMessage( event )
|
|
183
282
|
}
|
|
184
283
|
|
|
@@ -210,15 +309,16 @@ export default forwardRef<MSIRef, MSIProps>(( props, ref ) => {
|
|
|
210
309
|
scrollEnabled={false}
|
|
211
310
|
mixedContentMode="always"
|
|
212
311
|
originWhitelist={['*']}
|
|
213
|
-
onLoadStart={() => console.log('WebView loading...')}
|
|
312
|
+
onLoadStart={() => console.log('[MSI] WebView loading...')}
|
|
214
313
|
onLoadEnd={() => {
|
|
215
|
-
console.log('WebView loaded')
|
|
216
|
-
|
|
217
|
-
|
|
314
|
+
console.log('[MSI] WebView loaded, initiating connection')
|
|
315
|
+
// Let WIO handle the connection automatically
|
|
316
|
+
// Remove the manual ping - it's not needed!
|
|
317
|
+
initializeConnection()
|
|
218
318
|
}}
|
|
219
319
|
onError={( syntheticEvent ) => {
|
|
220
320
|
const { nativeEvent } = syntheticEvent
|
|
221
|
-
console.error('WebView error:', nativeEvent )
|
|
321
|
+
console.error('[MSI] WebView error:', nativeEvent )
|
|
222
322
|
setHasError( true )
|
|
223
323
|
props.onError?.( new Error( nativeEvent.description || 'WebView error' ) )
|
|
224
324
|
}}
|
|
@@ -227,7 +327,12 @@ export default forwardRef<MSIRef, MSIProps>(( props, ref ) => {
|
|
|
227
327
|
{hasError && (
|
|
228
328
|
<View style={styles.errorOverlay}>
|
|
229
329
|
<View style={styles.errorCard}>
|
|
230
|
-
{/*
|
|
330
|
+
{/* Add error UI with retry button */}
|
|
331
|
+
<Text style={styles.errorText}>
|
|
332
|
+
{connectionAttempts > 0
|
|
333
|
+
? `Connection failed after ${connectionAttempts} attempts`
|
|
334
|
+
: 'An error occurred'}
|
|
335
|
+
</Text>
|
|
231
336
|
</View>
|
|
232
337
|
</View>
|
|
233
338
|
)}
|
|
@@ -254,7 +359,13 @@ const styles = StyleSheet.create({
|
|
|
254
359
|
backgroundColor: 'white',
|
|
255
360
|
padding: 20,
|
|
256
361
|
borderRadius: 12,
|
|
257
|
-
margin: 20
|
|
362
|
+
margin: 20,
|
|
363
|
+
minWidth: 200
|
|
364
|
+
},
|
|
365
|
+
errorText: {
|
|
366
|
+
fontSize: 16,
|
|
367
|
+
color: '#333',
|
|
368
|
+
textAlign: 'center'
|
|
258
369
|
}
|
|
259
370
|
})
|
|
260
371
|
|