becomap 1.5.70 → 1.5.71
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/lib/becomap.js +1 -1
- package/lib/index.d.ts +21 -12
- package/package.json +1 -1
- package/public/README.md +902 -0
- package/public/index.html +744 -154
package/public/README.md
ADDED
|
@@ -0,0 +1,902 @@
|
|
|
1
|
+
# Becomap WebView Integration API Reference
|
|
2
|
+
|
|
3
|
+
This document provides detailed interface specifications for the Becomap WebView integration, including public methods, callback events, input parameters, and payload structures for native mobile application integration.
|
|
4
|
+
|
|
5
|
+
## 📋 Table of Contents
|
|
6
|
+
|
|
7
|
+
- [Public Methods](#public-methods)
|
|
8
|
+
- [Callback Events](#callback-events)
|
|
9
|
+
- [Core Data Interfaces](#core-data-interfaces)
|
|
10
|
+
- [Input Parameter Structures](#input-parameter-structures)
|
|
11
|
+
- [Callback Payload Structures](#callback-payload-structures)
|
|
12
|
+
- [Error Handling Interfaces](#error-handling-interfaces)
|
|
13
|
+
- [Enums and Constants](#enums-and-constants)
|
|
14
|
+
|
|
15
|
+
## 📚 Public Methods
|
|
16
|
+
|
|
17
|
+
### Core Initialization
|
|
18
|
+
|
|
19
|
+
#### `init(siteOptions)`
|
|
20
|
+
Initializes the map with site configuration and authentication credentials.
|
|
21
|
+
|
|
22
|
+
**Parameters:**
|
|
23
|
+
- `siteOptions`: Object containing authentication and site configuration
|
|
24
|
+
- `clientId`: String - Client identifier for authentication
|
|
25
|
+
- `clientSecret`: String - Client secret for authentication
|
|
26
|
+
- `siteIdentifier`: String - Unique site identifier
|
|
27
|
+
|
|
28
|
+
**Features:**
|
|
29
|
+
- Input validation and pre-condition checks
|
|
30
|
+
- Timeout handling for initialization operations
|
|
31
|
+
- Automatic retry on transient failures
|
|
32
|
+
- Progressive loading with status updates
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
### Floor and Location Management
|
|
37
|
+
|
|
38
|
+
#### `getCurrentFloor()`
|
|
39
|
+
Retrieves the currently displayed floor information.
|
|
40
|
+
- **Returns:** Current floor data via `onGetCurrentFloor` callback
|
|
41
|
+
- **Error Handling:** Returns null on failure with error notification
|
|
42
|
+
- **Internal:** Handles async operations internally with Promise resolution
|
|
43
|
+
|
|
44
|
+
#### `selectFloorWithId(floorId)`
|
|
45
|
+
Switches the map to display a specific floor.
|
|
46
|
+
- **Parameters:** `floorId` - String identifier of the target floor
|
|
47
|
+
- **Validation:** Checks if floor exists before switching
|
|
48
|
+
- **Events:** Triggers `onFloorSwitch` when successful
|
|
49
|
+
|
|
50
|
+
#### `selectLocationWithId(locationId)`
|
|
51
|
+
Selects and highlights a specific location on the map.
|
|
52
|
+
- **Parameters:** `locationId` - String identifier of the target location
|
|
53
|
+
- **Validation:** Validates location exists and is accessible
|
|
54
|
+
- **Events:** Triggers `onLocationSelect` when successful
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
### Data Retrieval Methods
|
|
59
|
+
|
|
60
|
+
#### `getCategories()`
|
|
61
|
+
Retrieves all available location categories.
|
|
62
|
+
- **Returns:** Array of category objects via `onGetCategories` callback
|
|
63
|
+
- **Fallback:** Returns empty array on failure
|
|
64
|
+
- **Caching:** Results are cached for performance optimization
|
|
65
|
+
- **Internal:** Handles async operations internally with Promise resolution
|
|
66
|
+
|
|
67
|
+
#### `getLocations()`
|
|
68
|
+
Retrieves all locations from the current site.
|
|
69
|
+
- **Returns:** Array of location objects via `onGetLocations` callback
|
|
70
|
+
- **Filtering:** Automatically filters by current floor if applicable
|
|
71
|
+
- **Performance:** Optimized for large datasets
|
|
72
|
+
- **Internal:** Handles async operations internally with Promise resolution
|
|
73
|
+
|
|
74
|
+
#### `getAmenities()`
|
|
75
|
+
Retrieves all amenity locations from the current site.
|
|
76
|
+
- **Returns:** Array of amenity location objects via `onGetAmenities` callback
|
|
77
|
+
- **Categorization:** Groups amenities by type
|
|
78
|
+
- **Accessibility:** Includes accessibility information
|
|
79
|
+
- **Internal:** Handles async operations internally with Promise resolution
|
|
80
|
+
|
|
81
|
+
#### `getAmenityTypes()`
|
|
82
|
+
Retrieves available amenity types from the current site.
|
|
83
|
+
- **Returns:** Array of amenity type objects via `onGetAmenityTypes` callback
|
|
84
|
+
- **Real-time:** Updates reflect current availability
|
|
85
|
+
- **Internal:** Handles async operations internally with Promise resolution
|
|
86
|
+
|
|
87
|
+
#### `selectAmenities(type)`
|
|
88
|
+
Selects amenities of a specific type on the map.
|
|
89
|
+
- **Parameters:** `type` - BCSiteAmenity enum value (e.g., "RESTROOM", "ATM", "FOOD_COURT")
|
|
90
|
+
- **Validation:** Validates amenity type exists
|
|
91
|
+
- **Visual:** Highlights selected amenities on map
|
|
92
|
+
|
|
93
|
+
#### `getSessionId()`
|
|
94
|
+
Retrieves the current session identifier for personalization.
|
|
95
|
+
- **Returns:** Session ID string via `onGetSessionId` callback
|
|
96
|
+
- **Async:** Handles asynchronous session creation
|
|
97
|
+
- **Retry:** Automatic retry on session creation failure
|
|
98
|
+
|
|
99
|
+
#### `getHappenings(type)`
|
|
100
|
+
Retrieves happenings/events of a specific type.
|
|
101
|
+
- **Parameters:** `type` - BCHappeningType enum value
|
|
102
|
+
- **Returns:** Array of happening objects via `onGetHappenings` callback
|
|
103
|
+
- **Filtering:** Supports time-based and location-based filtering
|
|
104
|
+
- **Internal:** Handles async operations internally with Promise resolution
|
|
105
|
+
|
|
106
|
+
#### `getEventSuggestions(sessionId, answers)`
|
|
107
|
+
Retrieves personalized event suggestions based on user preferences.
|
|
108
|
+
- **Parameters:**
|
|
109
|
+
- `sessionId` - String: Current session identifier
|
|
110
|
+
- `answers` - Array: User preference answers
|
|
111
|
+
- **Returns:** Suggestion array via `onGetEventSuggestions` callback
|
|
112
|
+
- **AI-Powered:** Uses machine learning for personalization
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
### Camera and Viewport Control
|
|
117
|
+
|
|
118
|
+
#### `focusTo(location, zoom, bearing, pitch)`
|
|
119
|
+
Focuses the map on a specific location with smooth animation.
|
|
120
|
+
- **Parameters:**
|
|
121
|
+
- `location`: Location object or identifier
|
|
122
|
+
- `zoom`: Optional number - Zoom level (default: current zoom)
|
|
123
|
+
- `bearing`: Optional number - Bearing/rotation in degrees
|
|
124
|
+
- `pitch`: Optional number - Pitch/tilt in degrees
|
|
125
|
+
- **Animation:** Smooth camera transition with configurable duration
|
|
126
|
+
- **Validation:** Validates location exists and is accessible
|
|
127
|
+
|
|
128
|
+
#### `updateZoom(zoom)`
|
|
129
|
+
Updates the map zoom level with bounds checking.
|
|
130
|
+
- **Parameters:** `zoom` - Number: New zoom level (typically 1-22)
|
|
131
|
+
- **Bounds:** Automatically constrains to valid zoom range
|
|
132
|
+
- **Animation:** Smooth zoom transition
|
|
133
|
+
|
|
134
|
+
#### `updatePitch(pitch)`
|
|
135
|
+
Updates the map pitch (tilt) angle.
|
|
136
|
+
- **Parameters:** `pitch` - Number: New pitch angle in degrees (0-60)
|
|
137
|
+
- **Validation:** Constrains pitch to valid range
|
|
138
|
+
- **3D Effect:** Enables 3D building visualization at higher pitches
|
|
139
|
+
|
|
140
|
+
#### `updateBearing(bearing)`
|
|
141
|
+
Updates the map bearing (rotation).
|
|
142
|
+
- **Parameters:** `bearing` - Number: New bearing in degrees (0-360)
|
|
143
|
+
- **Normalization:** Automatically normalizes bearing to 0-360 range
|
|
144
|
+
- **Compass:** Updates compass indicator if present
|
|
145
|
+
|
|
146
|
+
#### `setBounds(sw, ne)`
|
|
147
|
+
Sets geographic bounds for the map view.
|
|
148
|
+
- **Parameters:**
|
|
149
|
+
- `sw`: Array [lat, lng] - Southwest coordinate
|
|
150
|
+
- `ne`: Array [lat, lng] - Northeast coordinate
|
|
151
|
+
- **Validation:** Validates coordinate format and bounds
|
|
152
|
+
- **Fitting:** Automatically adjusts zoom to fit bounds
|
|
153
|
+
|
|
154
|
+
#### `setViewport(options)`
|
|
155
|
+
Sets the viewport with comprehensive options.
|
|
156
|
+
- **Parameters:** `options` - BCMapViewOptions object
|
|
157
|
+
- `zoom`: Optional number - Zoom level (1-22)
|
|
158
|
+
- `pitch`: Optional number - Pitch/tilt angle (0-60 degrees)
|
|
159
|
+
- `bearing`: Optional number - Bearing/rotation (0-360 degrees)
|
|
160
|
+
- `center`: Optional array [lat, lng] - Center coordinates
|
|
161
|
+
- **Animation:** Smooth transition to new viewport
|
|
162
|
+
- **Validation:** Validates all parameters
|
|
163
|
+
|
|
164
|
+
#### `resetDefaultViewport(options)`
|
|
165
|
+
Resets the map to default viewport with optional overrides.
|
|
166
|
+
- **Parameters:** `options` - Optional BCMapViewOptions overrides
|
|
167
|
+
- **Memory:** Remembers original default settings
|
|
168
|
+
- **Animation:** Smooth transition back to defaults
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
### Selection and Interaction
|
|
173
|
+
|
|
174
|
+
#### `clearSelection()`
|
|
175
|
+
Clears all current selections on the map.
|
|
176
|
+
- **Visual:** Removes all selection highlights
|
|
177
|
+
- **State:** Resets internal selection state
|
|
178
|
+
- **Events:** Triggers selection change events
|
|
179
|
+
|
|
180
|
+
#### `enableMultiSelection(val)`
|
|
181
|
+
Enables or disables multi-selection mode.
|
|
182
|
+
- **Parameters:** `val` - Boolean to enable/disable multi-selection
|
|
183
|
+
- **Behavior:** Allows selecting multiple locations simultaneously
|
|
184
|
+
- **UI:** Updates selection indicators accordingly
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
### Search Functionality
|
|
189
|
+
|
|
190
|
+
#### `searchForLocations(query, callbackId)`
|
|
191
|
+
Searches for locations with fuzzy matching and ranking.
|
|
192
|
+
- **Parameters:**
|
|
193
|
+
- `query` - String: Search text (supports partial matches)
|
|
194
|
+
- `callbackId` - String: Unique identifier for request tracking
|
|
195
|
+
- **Features:**
|
|
196
|
+
- Fuzzy text matching
|
|
197
|
+
- Relevance ranking
|
|
198
|
+
- Real-time suggestions
|
|
199
|
+
- **Returns:** Results via `onSearchForLocations` callback with callbackId
|
|
200
|
+
|
|
201
|
+
#### `searchForCategories(query, callbackId)`
|
|
202
|
+
Searches for categories with intelligent matching.
|
|
203
|
+
- **Parameters:**
|
|
204
|
+
- `query` - String: Search text
|
|
205
|
+
- `callbackId` - String: Unique identifier for request tracking
|
|
206
|
+
- **Features:**
|
|
207
|
+
- Category hierarchy search
|
|
208
|
+
- Synonym matching
|
|
209
|
+
- Popularity ranking
|
|
210
|
+
- **Returns:** Results via `onSearchForCategories` callback with callbackId
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
### Route Management
|
|
215
|
+
|
|
216
|
+
#### `getRoute(startID, goalID, waypoints, routeOptions)`
|
|
217
|
+
Calculates optimal route with advanced options.
|
|
218
|
+
- **Parameters:**
|
|
219
|
+
- `startID` - String: Starting location identifier
|
|
220
|
+
- `goalID` - String: Destination location identifier
|
|
221
|
+
- `waypoints` - Optional array: Waypoint location identifiers
|
|
222
|
+
- `routeOptions` - Optional BCRouteOptions: Route calculation preferences
|
|
223
|
+
- **Features:**
|
|
224
|
+
- Multiple route algorithms
|
|
225
|
+
- Accessibility considerations
|
|
226
|
+
- Real-time obstacle avoidance
|
|
227
|
+
- **Returns:** Route segments via `onGetRoute` callback
|
|
228
|
+
|
|
229
|
+
#### `showRoute(segmentOrderIndex)`
|
|
230
|
+
Displays the calculated route with visual enhancements.
|
|
231
|
+
- **Parameters:** `segmentOrderIndex` - Optional number: Order index of specific segment to display
|
|
232
|
+
- **Behavior:** If no parameter provided, shows entire route; if segment order index provided, shows only that segment
|
|
233
|
+
- **Visual:** Animated route line with directional indicators
|
|
234
|
+
- **Interactive:** Clickable route segments for details
|
|
235
|
+
- **Accessibility:** High contrast mode support
|
|
236
|
+
|
|
237
|
+
#### `showStep(step)`
|
|
238
|
+
Shows a specific step in the current route.
|
|
239
|
+
- **Parameters:** `step` - Number: Step order index to display
|
|
240
|
+
- **Visual:** Highlights current step with animation
|
|
241
|
+
- **Audio:** Optional voice guidance integration
|
|
242
|
+
|
|
243
|
+
#### `clearAllRoutes()`
|
|
244
|
+
Clears all displayed routes from the map.
|
|
245
|
+
- **Cleanup:** Removes all route visualizations
|
|
246
|
+
- **Memory:** Frees route calculation resources
|
|
247
|
+
- **State:** Resets route controller state
|
|
248
|
+
|
|
249
|
+
---
|
|
250
|
+
|
|
251
|
+
### Utility Functions
|
|
252
|
+
|
|
253
|
+
#### `cleanup()`
|
|
254
|
+
Performs comprehensive cleanup when WebView is destroyed.
|
|
255
|
+
- **Resources:** Cleans up all event listeners and timers
|
|
256
|
+
- **Memory:** Releases map and site objects
|
|
257
|
+
- **Storage:** Clears temporary data and caches
|
|
258
|
+
- **State:** Resets application to destroyed state
|
|
259
|
+
|
|
260
|
+
#### `healthCheck()`
|
|
261
|
+
Performs bridge connectivity health check.
|
|
262
|
+
- **Returns:** Comprehensive health status via `onHealthCheck` callback
|
|
263
|
+
- **Monitoring:** Updates bridge health metrics
|
|
264
|
+
|
|
265
|
+
#### `getAppState()`
|
|
266
|
+
Retrieves current application state and diagnostics.
|
|
267
|
+
- **Returns:** Application state, bridge health, queue status via `onGetAppState` callback
|
|
268
|
+
|
|
269
|
+
#### `recoverFromError()`
|
|
270
|
+
Attempts to recover from error states.
|
|
271
|
+
- **Recovery:** Resets error conditions and retries operations
|
|
272
|
+
- **Queue:** Processes any pending operations
|
|
273
|
+
- **Returns:** Recovery status via `onErrorRecovery` callback
|
|
274
|
+
|
|
275
|
+
#### `getDebugInfo()`
|
|
276
|
+
Provides comprehensive debugging information.
|
|
277
|
+
- **Returns:** System state, failed operations, performance metrics via `onGetDebugInfo` callback
|
|
278
|
+
- **Storage:** Includes localStorage diagnostic data
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
282
|
+
## 🎯 Callback Events
|
|
283
|
+
|
|
284
|
+
### Core Map Events
|
|
285
|
+
|
|
286
|
+
#### `onRenderComplete`
|
|
287
|
+
Triggered when the map finishes rendering and is ready for interaction.
|
|
288
|
+
|
|
289
|
+
**Payload Structure:**
|
|
290
|
+
- `site`: Complete BCMapSite object with all site information
|
|
291
|
+
- `timestamp`: Number - Unix timestamp when event occurred
|
|
292
|
+
- `appState`: String - Current application state ("ready")
|
|
293
|
+
|
|
294
|
+
**Usage:** Initialize UI elements, enable user interactions, start location services
|
|
295
|
+
|
|
296
|
+
#### `onViewChange` (Throttled)
|
|
297
|
+
Triggered when the map view changes (zoom, pan, rotation).
|
|
298
|
+
*Note: Throttled to maximum 10 events per second to prevent flooding.*
|
|
299
|
+
|
|
300
|
+
**Payload Structure:**
|
|
301
|
+
- `viewOptions`: BCMapViewOptions object
|
|
302
|
+
- `zoom`: Number - Current zoom level
|
|
303
|
+
- `pitch`: Number - Current pitch/tilt angle
|
|
304
|
+
- `bearing`: Number - Current bearing/rotation
|
|
305
|
+
- `center`: Array [lat, lng] - Current center coordinates
|
|
306
|
+
- `timestamp`: Number - Unix timestamp when event occurred
|
|
307
|
+
|
|
308
|
+
**Usage:** Update navigation controls, sync with external map controls, track user interaction patterns
|
|
309
|
+
|
|
310
|
+
#### `onLocationSelect`
|
|
311
|
+
Triggered when a location is selected on the map.
|
|
312
|
+
|
|
313
|
+
**Payload Structure:**
|
|
314
|
+
- `locations`: Array of BCLocation objects
|
|
315
|
+
- `id`: String - Unique location identifier
|
|
316
|
+
- `name`: String - Location name
|
|
317
|
+
- `floor`: String - Floor identifier where location exists
|
|
318
|
+
- `category`: String - Category identifier
|
|
319
|
+
- `coordinates`: Array [lat, lng] - Geographic coordinates
|
|
320
|
+
- `timestamp`: Number - Unix timestamp when event occurred
|
|
321
|
+
|
|
322
|
+
**Usage:** Display location details, update navigation destination, show location-specific actions
|
|
323
|
+
|
|
324
|
+
#### `onFloorSwitch`
|
|
325
|
+
Triggered when the user switches between floors.
|
|
326
|
+
|
|
327
|
+
**Payload Structure:**
|
|
328
|
+
- `floor`: BCMapFloor object
|
|
329
|
+
- `id`: String - Unique floor identifier
|
|
330
|
+
- `name`: String - Floor display name
|
|
331
|
+
- `level`: Number - Floor level/elevation
|
|
332
|
+
- `buildingId`: String - Parent building identifier
|
|
333
|
+
- `timestamp`: Number - Unix timestamp when event occurred
|
|
334
|
+
|
|
335
|
+
**Usage:** Update floor selector UI, refresh location lists, update navigation context
|
|
336
|
+
|
|
337
|
+
#### `onStepLoad`
|
|
338
|
+
Triggered when a route step is loaded during navigation.
|
|
339
|
+
|
|
340
|
+
**Payload Structure:**
|
|
341
|
+
- `step`: BCRouteStep object
|
|
342
|
+
- `index`: Number - Step order index
|
|
343
|
+
- `instruction`: String - Human-readable navigation instruction
|
|
344
|
+
- `distance`: Number - Distance to next step in meters
|
|
345
|
+
- `duration`: Number - Estimated time to next step in seconds
|
|
346
|
+
- `coordinates`: Array [lat, lng] - Step coordinates
|
|
347
|
+
- `timestamp`: Number - Unix timestamp when event occurred
|
|
348
|
+
|
|
349
|
+
**Usage:** Display navigation instructions, update progress indicators, trigger voice guidance
|
|
350
|
+
|
|
351
|
+
#### `onWalkthroughEnd`
|
|
352
|
+
Triggered when a navigation walkthrough completes.
|
|
353
|
+
|
|
354
|
+
**Payload Structure:**
|
|
355
|
+
- `timestamp`: Number - Unix timestamp when walkthrough ended
|
|
356
|
+
- `duration`: Number - Total walkthrough duration in milliseconds
|
|
357
|
+
- `stepsCompleted`: Number - Total number of steps completed
|
|
358
|
+
|
|
359
|
+
**Usage:** Show completion message, reset navigation UI, log navigation analytics
|
|
360
|
+
|
|
361
|
+
---
|
|
362
|
+
|
|
363
|
+
### Data Retrieval Callbacks
|
|
364
|
+
|
|
365
|
+
#### `onGetCurrentFloor`
|
|
366
|
+
Returns current floor information with enhanced details.
|
|
367
|
+
|
|
368
|
+
**Payload Structure:**
|
|
369
|
+
- `id`: String - Floor unique identifier
|
|
370
|
+
- `name`: String - Floor display name
|
|
371
|
+
- `level`: Number - Floor level (0 for ground floor)
|
|
372
|
+
- `buildingId`: String - Parent building identifier
|
|
373
|
+
- `isDefault`: Boolean - Whether this is the default floor
|
|
374
|
+
- `bounds`: Object - Floor boundary coordinates
|
|
375
|
+
|
|
376
|
+
#### `onGetCategories`
|
|
377
|
+
Returns array of categories with hierarchy information.
|
|
378
|
+
|
|
379
|
+
**Payload Structure:** Array of BCCategory objects
|
|
380
|
+
- `id`: String - Category unique identifier
|
|
381
|
+
- `name`: String - Category display name
|
|
382
|
+
- `icon`: String - Icon identifier or URL
|
|
383
|
+
- `parentId`: String|null - Parent category ID for hierarchy
|
|
384
|
+
- `subcategories`: Array[String] - Child category IDs
|
|
385
|
+
|
|
386
|
+
#### `onGetLocations`
|
|
387
|
+
Returns array of locations with comprehensive data.
|
|
388
|
+
|
|
389
|
+
**Payload Structure:** Array of BCLocation objects
|
|
390
|
+
- `id`: String - Location unique identifier
|
|
391
|
+
- `name`: String - Location display name
|
|
392
|
+
- `category`: String - Category identifier
|
|
393
|
+
- `floor`: String - Floor identifier
|
|
394
|
+
- `coordinates`: Array [lat, lng] - Geographic coordinates
|
|
395
|
+
- `isAccessible`: Boolean - Accessibility status
|
|
396
|
+
- `amenities`: Array[String] - Available amenity types
|
|
397
|
+
|
|
398
|
+
#### `onGetAmenities`
|
|
399
|
+
Returns array of all amenity locations.
|
|
400
|
+
|
|
401
|
+
**Payload Structure:** Array of BCLocation objects filtered for amenity locations
|
|
402
|
+
|
|
403
|
+
#### `onGetAmenityTypes`
|
|
404
|
+
Returns available amenity types information.
|
|
405
|
+
|
|
406
|
+
**Payload Structure:** Array of BCSiteAmenity objects with availability status
|
|
407
|
+
|
|
408
|
+
#### `onGetSessionId`
|
|
409
|
+
Returns session identifier for personalization.
|
|
410
|
+
|
|
411
|
+
**Payload Structure:** String - Unique session identifier
|
|
412
|
+
|
|
413
|
+
#### `onGetHappenings`
|
|
414
|
+
Returns array of happenings/events.
|
|
415
|
+
|
|
416
|
+
**Payload Structure:** Array of BCHappenings objects
|
|
417
|
+
- `id`: String - Happening unique identifier
|
|
418
|
+
- `name`: String - Event name
|
|
419
|
+
- `description`: String - Event description
|
|
420
|
+
- `startDate`: String - ISO 8601 start date
|
|
421
|
+
- `endDate`: String - ISO 8601 end date
|
|
422
|
+
- `type`: BCHappeningType - Event type enum
|
|
423
|
+
- `locationId`: String - Associated location ID
|
|
424
|
+
|
|
425
|
+
#### `onGetRoute`
|
|
426
|
+
Returns calculated route segments.
|
|
427
|
+
|
|
428
|
+
**Payload Structure:** Array of BCRouteSegment objects with navigation data
|
|
429
|
+
|
|
430
|
+
---
|
|
431
|
+
|
|
432
|
+
### Search Callbacks
|
|
433
|
+
|
|
434
|
+
#### `onSearchForLocations`
|
|
435
|
+
Returns location search results with relevance scoring.
|
|
436
|
+
|
|
437
|
+
**Payload Structure:**
|
|
438
|
+
- `callbackId`: String - Request tracking identifier
|
|
439
|
+
- `results`: Array of search result objects
|
|
440
|
+
- `id`: String - Location identifier
|
|
441
|
+
- `name`: String - Location name
|
|
442
|
+
- `relevanceScore`: Number - Relevance score (0-1)
|
|
443
|
+
- `matchType`: String - Type of match ("name", "category", etc.)
|
|
444
|
+
- `category`: String - Location category
|
|
445
|
+
- `totalResults`: Number - Total number of results found
|
|
446
|
+
- `searchTime`: Number - Search execution time in milliseconds
|
|
447
|
+
|
|
448
|
+
#### `onSearchForCategories`
|
|
449
|
+
Returns category search results with hierarchy.
|
|
450
|
+
|
|
451
|
+
**Payload Structure:**
|
|
452
|
+
- `callbackId`: String - Request tracking identifier
|
|
453
|
+
- `results`: Array of search result objects
|
|
454
|
+
- `id`: String - Category identifier
|
|
455
|
+
- `name`: String - Category name
|
|
456
|
+
- `relevanceScore`: Number - Relevance score (0-1)
|
|
457
|
+
- `locationCount`: Number - Number of locations in category
|
|
458
|
+
|
|
459
|
+
---
|
|
460
|
+
|
|
461
|
+
### Error Handling
|
|
462
|
+
|
|
463
|
+
#### `onError`
|
|
464
|
+
Triggered when an error occurs with comprehensive context.
|
|
465
|
+
|
|
466
|
+
**Payload Structure:**
|
|
467
|
+
- `message`: String - Human-readable error message
|
|
468
|
+
- `stack`: String - Error stack trace for debugging
|
|
469
|
+
- `timestamp`: Number - Unix timestamp when error occurred
|
|
470
|
+
- `operation`: String - Operation that caused the error
|
|
471
|
+
- `attempt`: Number - Current retry attempt number
|
|
472
|
+
- `maxRetries`: Number - Maximum retry attempts configured
|
|
473
|
+
- `appState`: String - Current application state
|
|
474
|
+
- `bridgeHealth`: Object - Bridge connectivity status
|
|
475
|
+
- `isConnected`: Boolean - Bridge connection status
|
|
476
|
+
- `lastHeartbeat`: Number - Last successful heartbeat timestamp
|
|
477
|
+
- Additional operation-specific context fields
|
|
478
|
+
|
|
479
|
+
**Error Categories:**
|
|
480
|
+
- **Network Errors**: Connectivity and API issues
|
|
481
|
+
- **Validation Errors**: Invalid parameters or state
|
|
482
|
+
- **Timeout Errors**: Operations exceeding time limits
|
|
483
|
+
- **Bridge Errors**: WebView communication issues
|
|
484
|
+
|
|
485
|
+
---
|
|
486
|
+
|
|
487
|
+
### Health and Monitoring Events
|
|
488
|
+
|
|
489
|
+
#### `onHealthCheck`
|
|
490
|
+
Response to health check requests with system status.
|
|
491
|
+
|
|
492
|
+
**Payload Structure:**
|
|
493
|
+
- `timestamp`: Number - Health check timestamp
|
|
494
|
+
- `appState`: String - Current application state
|
|
495
|
+
- `bridgeConnected`: Boolean - Bridge connectivity status
|
|
496
|
+
- `mapViewReady`: Boolean - Map view initialization status
|
|
497
|
+
- `siteLoaded`: Boolean - Site data loading status
|
|
498
|
+
- `queueLength`: Number - Pending operations count
|
|
499
|
+
- `lastHeartbeat`: Number - Last successful heartbeat timestamp
|
|
500
|
+
|
|
501
|
+
#### `onGetAppState`
|
|
502
|
+
Returns comprehensive application state information.
|
|
503
|
+
|
|
504
|
+
**Payload Structure:**
|
|
505
|
+
- `appState`: String - Current application state
|
|
506
|
+
- `bridgeHealth`: Object - Bridge connectivity metrics
|
|
507
|
+
- `queueStatus`: Object - Operation queue information
|
|
508
|
+
- `performance`: Object - Performance metrics
|
|
509
|
+
|
|
510
|
+
#### `onGetDebugInfo`
|
|
511
|
+
Returns detailed debugging information for troubleshooting.
|
|
512
|
+
|
|
513
|
+
**Payload Structure:**
|
|
514
|
+
- `timestamp`: Number - Debug info generation timestamp
|
|
515
|
+
- `appState`: String - Current application state
|
|
516
|
+
- `bridgeHealth`: Object - Bridge connectivity status
|
|
517
|
+
- `queueLength`: Number - Pending operations count
|
|
518
|
+
- `hasMapView`: Boolean - Map view existence status
|
|
519
|
+
- `hasSite`: Boolean - Site data loading status
|
|
520
|
+
- `eventListeners`: Number - Active event listener count
|
|
521
|
+
- `userAgent`: String - Browser user agent
|
|
522
|
+
- `becomapLoaded`: Boolean - SDK loading status
|
|
523
|
+
- `containerExists`: Boolean - Map container existence
|
|
524
|
+
- `failedMessagesCount`: Number - Failed message count
|
|
525
|
+
- `lastFailedMessage`: Object|null - Last failed message details
|
|
526
|
+
|
|
527
|
+
#### `onErrorRecovery`
|
|
528
|
+
Confirms successful error recovery attempt.
|
|
529
|
+
|
|
530
|
+
**Payload Structure:**
|
|
531
|
+
- `timestamp`: Number - Recovery attempt timestamp
|
|
532
|
+
- `success`: Boolean - Recovery success status
|
|
533
|
+
- `operationsRetried`: Number - Number of operations retried
|
|
534
|
+
- `queueCleared`: Boolean - Whether operation queue was cleared
|
|
535
|
+
|
|
536
|
+
#### `onCleanupComplete`
|
|
537
|
+
Confirms successful resource cleanup.
|
|
538
|
+
|
|
539
|
+
**Payload Structure:**
|
|
540
|
+
- `timestamp`: Number - Cleanup completion timestamp
|
|
541
|
+
- `resourcesFreed`: Array[String] - List of freed resource types
|
|
542
|
+
- `listenersRemoved`: Number - Number of event listeners removed
|
|
543
|
+
|
|
544
|
+
---
|
|
545
|
+
|
|
546
|
+
## 📊 Core Data Interfaces
|
|
547
|
+
|
|
548
|
+
### BCLocation Interface
|
|
549
|
+
Represents a location within the map with comprehensive metadata.
|
|
550
|
+
|
|
551
|
+
**Properties:**
|
|
552
|
+
- `id`: String - Unique location identifier
|
|
553
|
+
- `externalId`: String - External system identifier for cross-references
|
|
554
|
+
- `name`: String - Human-readable location name
|
|
555
|
+
- `type`: BCLocationType - Location type enum (AMENITIES, ENTRANCE, etc.)
|
|
556
|
+
- `description`: String - Detailed location description
|
|
557
|
+
- `amenity`: BCSiteAmenity - Associated amenity type if applicable
|
|
558
|
+
- `phone`: Record<string, string> - Phone numbers by type (main, support, etc.)
|
|
559
|
+
- `social`: Record<string, string> - Social media links by platform
|
|
560
|
+
- `operationHours`: Array<BCOperationHour> - Operating hours by day
|
|
561
|
+
- `links`: Array<BCLink> - Associated web links
|
|
562
|
+
- `categories`: Array<BCCategory> - Location categories
|
|
563
|
+
- `tags`: Array<string> - Searchable tags
|
|
564
|
+
- `banner`: String - Banner image URL
|
|
565
|
+
- `logo`: String - Logo image URL
|
|
566
|
+
- `siblingGroups`: Array<BCSiblingGroup> - Related location groups
|
|
567
|
+
- `topLocation`: Boolean - Whether location is featured/prominent
|
|
568
|
+
- `showLogo`: Boolean - Whether to display logo on map
|
|
569
|
+
- `floor`: BCMapFloor - Floor where location exists
|
|
570
|
+
- `mapObject`: BCMapObject|null - 3D model information if available
|
|
571
|
+
- `sortOrder`: Number - Display order priority
|
|
572
|
+
|
|
573
|
+
### BCMapFloor Interface
|
|
574
|
+
Represents a floor/level within a building.
|
|
575
|
+
|
|
576
|
+
**Properties:**
|
|
577
|
+
- `id`: String - Unique floor identifier
|
|
578
|
+
- `name`: String - Full floor name (e.g., "Ground Floor")
|
|
579
|
+
- `shortName`: String - Abbreviated name (e.g., "GF")
|
|
580
|
+
- `elevation`: Number - Floor elevation/level number
|
|
581
|
+
- `imageUrl`: String|null - Floor plan image URL
|
|
582
|
+
- `viewPort`: BCMapViewOptions - Default viewport settings for this floor
|
|
583
|
+
|
|
584
|
+
**Methods:**
|
|
585
|
+
- `equals(floor: BCMapFloor): Boolean` - Compare floor equality
|
|
586
|
+
|
|
587
|
+
### BCMapSite Interface
|
|
588
|
+
Represents the entire site/venue with all metadata.
|
|
589
|
+
|
|
590
|
+
**Properties:**
|
|
591
|
+
- `id`: String - Unique site identifier
|
|
592
|
+
- `siteName`: String - Site display name
|
|
593
|
+
- `address`: String - Physical address
|
|
594
|
+
- `city`: String - City name
|
|
595
|
+
- `countryCode`: String - ISO country code
|
|
596
|
+
- `postal`: String - Postal/ZIP code
|
|
597
|
+
- `state`: String - State/province
|
|
598
|
+
- `telephone`: String - Primary phone number
|
|
599
|
+
- `tzId`: String - Timezone identifier
|
|
600
|
+
- `utcOffset`: String - UTC offset
|
|
601
|
+
- `link`: String - Official website URL
|
|
602
|
+
- `type`: String - Site type classification
|
|
603
|
+
- `buildings`: Array<BCBuilding> - Buildings within the site
|
|
604
|
+
- `imageUrls`: SiteImageUrls - Associated image URLs
|
|
605
|
+
- `operationHours`: Array - Site operating hours
|
|
606
|
+
- `otherLanguages`: Array<BCMapLanguage> - Supported languages
|
|
607
|
+
|
|
608
|
+
### BCCategory Interface
|
|
609
|
+
Represents a location category with visual styling.
|
|
610
|
+
|
|
611
|
+
**Properties:**
|
|
612
|
+
- `id`: String - Unique category identifier
|
|
613
|
+
- `name`: String - Category display name
|
|
614
|
+
- `icon`: String|null - Icon URL or identifier
|
|
615
|
+
- `color`: BCColor - Category color scheme
|
|
616
|
+
- `externalId`: String - External system identifier
|
|
617
|
+
- `iconName`: String - Icon name from default icon set
|
|
618
|
+
|
|
619
|
+
### BCColor Interface
|
|
620
|
+
Represents color information for categories and styling.
|
|
621
|
+
|
|
622
|
+
**Properties:**
|
|
623
|
+
- `rgba`: String - RGBA color value
|
|
624
|
+
- `hex`: String - Hexadecimal color value
|
|
625
|
+
- `opacity`: Number - Opacity value (0-1)
|
|
626
|
+
|
|
627
|
+
### BCMapViewOptions Interface
|
|
628
|
+
Configuration options for map viewport and camera settings.
|
|
629
|
+
|
|
630
|
+
**Properties:**
|
|
631
|
+
- `center`: BCMapCoordinateLike - Geographic center point [lat, lng]
|
|
632
|
+
- `zoom`: Number - Zoom level (typically 1-22)
|
|
633
|
+
- `pitch`: Number - Camera pitch/tilt angle in degrees (0-60)
|
|
634
|
+
- `bearing`: Number - Camera bearing/rotation in degrees (0-360)
|
|
635
|
+
- `background`: String - Map container background color
|
|
636
|
+
|
|
637
|
+
### BCRouteStep Interface
|
|
638
|
+
Represents an individual step in a navigation route.
|
|
639
|
+
|
|
640
|
+
**Properties:**
|
|
641
|
+
- `orderIndex`: Number - Step sequence number
|
|
642
|
+
- `floor`: BCMapFloor - Floor where step occurs
|
|
643
|
+
- `action`: BC_STEP_ACTION - Step action type
|
|
644
|
+
- `direction`: BC_STEP_DIRECTION - Movement direction
|
|
645
|
+
- `reference`: BC_STEP_POSITION - Positional reference
|
|
646
|
+
- `referenceLocation`: BCLocation|null - Associated location
|
|
647
|
+
- `distance`: Number - Distance to next step in meters
|
|
648
|
+
|
|
649
|
+
### BCHappenings Interface
|
|
650
|
+
Represents events, offers, or news items at the site.
|
|
651
|
+
|
|
652
|
+
**Properties:**
|
|
653
|
+
- `id`: String - Unique happening identifier
|
|
654
|
+
- `name`: String - Event/offer name
|
|
655
|
+
- `description`: String - Detailed description
|
|
656
|
+
- `startDate`: String - ISO 8601 start date
|
|
657
|
+
- `endDate`: String - ISO 8601 end date
|
|
658
|
+
- `showDate`: String - Display date format
|
|
659
|
+
- `externalId`: String - External system identifier
|
|
660
|
+
- `siteId`: String - Associated site identifier
|
|
661
|
+
- `locationId`: String - Associated location identifier
|
|
662
|
+
- `images`: Array<string> - Image URLs
|
|
663
|
+
- `type`: BCHappeningType - Happening type enum
|
|
664
|
+
- `priority`: Number - Display priority
|
|
665
|
+
- `customFields`: Record<string, any> - Additional custom data
|
|
666
|
+
|
|
667
|
+
### BCOperationHour Interface
|
|
668
|
+
Represents operating hours for locations or sites.
|
|
669
|
+
|
|
670
|
+
**Properties:**
|
|
671
|
+
- `opens`: String - Opening time (e.g., "09:00 AM")
|
|
672
|
+
- `closes`: String - Closing time (e.g., "05:00 PM")
|
|
673
|
+
- `dayOfWeek`: Array<string> - Applicable days
|
|
674
|
+
|
|
675
|
+
### BCLink Interface
|
|
676
|
+
Represents hyperlinks associated with locations.
|
|
677
|
+
|
|
678
|
+
**Properties:**
|
|
679
|
+
- `url`: String - Link URL
|
|
680
|
+
- `label`: String - Link display label
|
|
681
|
+
|
|
682
|
+
### BCSiblingGroup Interface
|
|
683
|
+
Represents groups of related locations.
|
|
684
|
+
|
|
685
|
+
**Properties:**
|
|
686
|
+
- `label`: String - Group name
|
|
687
|
+
- `siblings`: Array<string> - Related location identifiers
|
|
688
|
+
|
|
689
|
+
### BCMapObject Interface
|
|
690
|
+
Represents 3D model information for locations.
|
|
691
|
+
|
|
692
|
+
**Properties:**
|
|
693
|
+
- `modelPath`: String - 3D model file path
|
|
694
|
+
- `rotation`: Number - Model rotation angle
|
|
695
|
+
- `scale`: Number - Model scale factor
|
|
696
|
+
|
|
697
|
+
---
|
|
698
|
+
|
|
699
|
+
## 📝 Input Parameter Structures
|
|
700
|
+
|
|
701
|
+
### Site Options (for `init` method)
|
|
702
|
+
Configuration object for map initialization.
|
|
703
|
+
|
|
704
|
+
**Structure:**
|
|
705
|
+
- `clientId`: String - Client authentication identifier
|
|
706
|
+
- `clientSecret`: String - Client authentication secret
|
|
707
|
+
- `siteIdentifier`: String - Target site unique identifier
|
|
708
|
+
|
|
709
|
+
### Route Options (for `getRoute` method)
|
|
710
|
+
Configuration object for route calculation.
|
|
711
|
+
|
|
712
|
+
**Structure:**
|
|
713
|
+
- `maxDistanceThreshold`: Number - Maximum allowed route distance
|
|
714
|
+
- `getAccessiblePath`: Boolean - Whether to prioritize accessible routes
|
|
715
|
+
|
|
716
|
+
### Viewport Options (for `setViewport` and `resetDefaultViewport` methods)
|
|
717
|
+
Camera and view configuration object.
|
|
718
|
+
|
|
719
|
+
**Structure:**
|
|
720
|
+
- `center`: Array [lat, lng] - Geographic center coordinates
|
|
721
|
+
- `zoom`: Number - Zoom level (1-22)
|
|
722
|
+
- `pitch`: Number - Camera tilt angle in degrees (0-60)
|
|
723
|
+
- `bearing`: Number - Camera rotation in degrees (0-360)
|
|
724
|
+
- `background`: String - Map container background color
|
|
725
|
+
|
|
726
|
+
### Segment Order Index (for `showRoute` method)
|
|
727
|
+
Identifier for targeting specific route segments.
|
|
728
|
+
|
|
729
|
+
**Structure:**
|
|
730
|
+
- `segmentOrderIndex`: Number - Order index of the target segment (matches BCRouteSegment.orderIndex property)
|
|
731
|
+
- **Range:** Positive integers starting from 0
|
|
732
|
+
- **Validation:** Must correspond to an existing segment in the current route
|
|
733
|
+
|
|
734
|
+
---
|
|
735
|
+
|
|
736
|
+
## 🔧 Enums and Constants
|
|
737
|
+
|
|
738
|
+
### BCSiteAmenity Enum
|
|
739
|
+
Predefined amenity types available at locations.
|
|
740
|
+
|
|
741
|
+
**Values:**
|
|
742
|
+
- `RESTROOM` - General restroom facility
|
|
743
|
+
- `PRAYER_ROOM` - Designated prayer/meditation room
|
|
744
|
+
- `WASHROOM_MEN` - Men's washroom
|
|
745
|
+
- `WASHROOM_WOMEN` - Women's washroom
|
|
746
|
+
- `ATM` - Automated Teller Machine
|
|
747
|
+
- `FOOD_COURT` - Food court area
|
|
748
|
+
- `INFORMATION_DESK` - Information/help desk
|
|
749
|
+
- `PICKUP_POINT` - Pickup/drop-off point
|
|
750
|
+
- `WASHROOM_FAMILY` - Family-friendly washroom
|
|
751
|
+
- `WASHROOM_ACCESSIBLE` - Accessible washroom for disabled individuals
|
|
752
|
+
|
|
753
|
+
### BCLocationType Enum
|
|
754
|
+
Classification of location types.
|
|
755
|
+
|
|
756
|
+
**Values:**
|
|
757
|
+
- `AMENITIES` - Amenity/service location
|
|
758
|
+
- `ENTRANCE` - Building/area entrance
|
|
759
|
+
- `STORE` - Retail store location
|
|
760
|
+
- `OFFICE` - Office/business location
|
|
761
|
+
- `RESTAURANT` - Dining establishment
|
|
762
|
+
- `SERVICE` - Service provider location
|
|
763
|
+
|
|
764
|
+
### BCHappeningType Enum
|
|
765
|
+
Types of events and happenings.
|
|
766
|
+
|
|
767
|
+
**Values:**
|
|
768
|
+
- `EVENT` - Scheduled event
|
|
769
|
+
- `OFFER` - Promotional offer
|
|
770
|
+
- `NEWS` - News announcement
|
|
771
|
+
|
|
772
|
+
### BC_STEP_ACTION Enum
|
|
773
|
+
Navigation step action types.
|
|
774
|
+
|
|
775
|
+
**Values:**
|
|
776
|
+
- `NONE` - No specific action
|
|
777
|
+
- `DEPARTURE` - Starting point departure
|
|
778
|
+
- `ARRIVALDESTINATION` - Final destination arrival
|
|
779
|
+
- `ARRIVALWAYPOINT` - Waypoint arrival
|
|
780
|
+
- `TURN` - Direction change
|
|
781
|
+
- `SWITCHFLOOR` - Floor/level change
|
|
782
|
+
|
|
783
|
+
### BC_STEP_DIRECTION Enum
|
|
784
|
+
Navigation step direction indicators.
|
|
785
|
+
|
|
786
|
+
**Values:**
|
|
787
|
+
- `NONE` - No specific direction
|
|
788
|
+
- `STRAIGHT` - Continue straight
|
|
789
|
+
- `RIGHT` - Turn right
|
|
790
|
+
- `SLIGHTRIGHT` - Slight right turn
|
|
791
|
+
- `UTURNRIGHT` - U-turn right
|
|
792
|
+
- `LEFT` - Turn left
|
|
793
|
+
- `SLIGHTLEFT` - Slight left turn
|
|
794
|
+
- `UTURNLEFT` - U-turn left
|
|
795
|
+
- `UP` - Move upward (stairs/elevator)
|
|
796
|
+
- `DOWN` - Move downward (stairs/elevator)
|
|
797
|
+
|
|
798
|
+
### BC_STEP_POSITION Enum
|
|
799
|
+
Positional reference for navigation steps.
|
|
800
|
+
|
|
801
|
+
**Values:**
|
|
802
|
+
- `NONE` - No specific position
|
|
803
|
+
- `AT` - At a specific point
|
|
804
|
+
- `BEFORE` - Before reaching a point
|
|
805
|
+
- `AFTER` - After passing a point
|
|
806
|
+
|
|
807
|
+
---
|
|
808
|
+
|
|
809
|
+
## 🔗 Message Bridge Protocol
|
|
810
|
+
|
|
811
|
+
### Message Format
|
|
812
|
+
All communication between native code and WebView follows a standardized JSON format:
|
|
813
|
+
|
|
814
|
+
**Structure:**
|
|
815
|
+
```
|
|
816
|
+
{
|
|
817
|
+
"type": "string", // Message type identifier
|
|
818
|
+
"payload": object, // Message data (varies by type)
|
|
819
|
+
"timestamp": number // Unix timestamp
|
|
820
|
+
}
|
|
821
|
+
```
|
|
822
|
+
|
|
823
|
+
### Bridge Health Monitoring
|
|
824
|
+
The bridge includes built-in health monitoring with automatic recovery:
|
|
825
|
+
|
|
826
|
+
- **Heartbeat System**: Regular connectivity checks
|
|
827
|
+
- **Operation Queue**: Failed operations queued for retry
|
|
828
|
+
- **Error Recovery**: Automatic retry with exponential backoff
|
|
829
|
+
- **State Management**: Application state tracking and recovery
|
|
830
|
+
|
|
831
|
+
### Performance Considerations
|
|
832
|
+
- **Event Throttling**: ViewChange events limited to 10/second
|
|
833
|
+
- **Memory Management**: Automatic cleanup of resources
|
|
834
|
+
- **Queue Management**: Intelligent operation processing
|
|
835
|
+
- **Error Handling**: Graceful degradation and recovery
|
|
836
|
+
|
|
837
|
+
---
|
|
838
|
+
|
|
839
|
+
## 📋 Integration Checklist
|
|
840
|
+
|
|
841
|
+
### Pre-Integration Requirements
|
|
842
|
+
- [ ] Valid Becomap client credentials
|
|
843
|
+
- [ ] Site identifier and configuration
|
|
844
|
+
- [ ] WebView-enabled mobile application
|
|
845
|
+
- [ ] Network connectivity for API calls
|
|
846
|
+
|
|
847
|
+
### Implementation Steps
|
|
848
|
+
1. **Bundle Integration**: Include generated bundle files in app
|
|
849
|
+
2. **WebView Configuration**: Enable JavaScript and configure message handlers
|
|
850
|
+
3. **Message Handling**: Implement native message processing
|
|
851
|
+
4. **Error Handling**: Set up error handling and recovery
|
|
852
|
+
5. **Testing**: Verify all public methods and callbacks work correctly
|
|
853
|
+
|
|
854
|
+
### Post-Integration Validation
|
|
855
|
+
- [ ] Map initializes successfully with valid credentials
|
|
856
|
+
- [ ] All callback events are received and processed
|
|
857
|
+
- [ ] Error handling works correctly
|
|
858
|
+
- [ ] Performance is acceptable for target devices
|
|
859
|
+
- [ ] Memory usage is within acceptable limits
|
|
860
|
+
|
|
861
|
+
---
|
|
862
|
+
|
|
863
|
+
## 🔍 API Usage Patterns
|
|
864
|
+
|
|
865
|
+
### Initialization Pattern
|
|
866
|
+
1. Load WebView with bundle
|
|
867
|
+
2. Call `init()` with site options
|
|
868
|
+
3. Wait for `onRenderComplete` callback
|
|
869
|
+
4. Begin using other API methods
|
|
870
|
+
|
|
871
|
+
### Data Retrieval Pattern
|
|
872
|
+
1. Call data retrieval method (e.g., `getLocations()`)
|
|
873
|
+
2. Handle response via corresponding callback (e.g., `onGetLocations`)
|
|
874
|
+
3. Process returned data in native code
|
|
875
|
+
4. Update UI accordingly
|
|
876
|
+
|
|
877
|
+
### Search Pattern
|
|
878
|
+
1. Call search method with query and callback ID
|
|
879
|
+
2. Handle results via callback with matching callback ID
|
|
880
|
+
3. Display search results to user
|
|
881
|
+
4. Handle user selection
|
|
882
|
+
|
|
883
|
+
### Navigation Pattern
|
|
884
|
+
1. Calculate route with `getRoute()`
|
|
885
|
+
2. Handle route data via `onGetRoute` callback
|
|
886
|
+
3. Display route with `showRoute()` (entire route) or `showRoute(segmentOrderIndex)` (specific segment)
|
|
887
|
+
4. Navigate step-by-step with `showStep()`
|
|
888
|
+
5. Handle step events via `onStepLoad` callback
|
|
889
|
+
|
|
890
|
+
### Segment-Level Navigation Pattern
|
|
891
|
+
1. Calculate route with `getRoute()`
|
|
892
|
+
2. Handle route segments via `onGetRoute` callback
|
|
893
|
+
3. Display specific segment with `showRoute(segmentOrderIndex)`
|
|
894
|
+
4. Switch between segments using different order indices with `showRoute(segmentOrderIndex)`
|
|
895
|
+
5. Show entire route again with `showRoute()` (no parameters)
|
|
896
|
+
|
|
897
|
+
### Error Handling Pattern
|
|
898
|
+
1. Implement `onError` callback handler
|
|
899
|
+
2. Log error details for debugging
|
|
900
|
+
3. Attempt recovery with `recoverFromError()` if appropriate
|
|
901
|
+
4. Provide user feedback and fallback options
|
|
902
|
+
5. Monitor bridge health with periodic `healthCheck()` calls
|