react-native-pointr 10.3.0 → 10.5.0
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/API_REFERENCE.md +140 -41
- package/CHANGELOG.md +12 -0
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/pointr/PTRMapWidgetManager.kt +4 -0
- package/android/src/main/java/com/pointr/PTRNativeLibrary.kt +7 -3
- package/ios/PTRNativeLibrary-Bridging.m +1 -1
- package/ios/PTRNativeLibrary.swift +3 -1
- package/package.json +2 -2
- package/react-native-pointr.podspec +1 -1
- package/src/NativePointrModule.ts +2 -1
- package/src/api/PointrSdk.ts +103 -1
- package/src/types/config.ts +2 -0
package/API_REFERENCE.md
CHANGED
|
@@ -79,6 +79,7 @@ pointrSdk.initialize({
|
|
|
79
79
|
licenseKey: '<LICENSE_KEY>',
|
|
80
80
|
baseUrl: 'https://<your-instance>.pointr.cloud',
|
|
81
81
|
logLevel: PTRLogLevel.WARNING, // optional, defaults to ERROR
|
|
82
|
+
personaId: '<PERSONA_ID>', // optional persona selection
|
|
82
83
|
});
|
|
83
84
|
```
|
|
84
85
|
|
|
@@ -152,7 +153,7 @@ const config = pointrSdk.getConfig();
|
|
|
152
153
|
|
|
153
154
|
#### `getCurrentLocation()`
|
|
154
155
|
|
|
155
|
-
Returns a `Promise<
|
|
156
|
+
Returns a `Promise<PTRPosition | null>` with the last known calculated position, or `null` if unavailable.
|
|
156
157
|
|
|
157
158
|
The resolved object contains the raw native payload with these fields:
|
|
158
159
|
|
|
@@ -257,6 +258,142 @@ const geofences = await pointrSdk.getGeofences('<SITE_ID>');
|
|
|
257
258
|
|
|
258
259
|
---
|
|
259
260
|
|
|
261
|
+
#### `shouldRequestPermissionsAtStartup(should)`
|
|
262
|
+
|
|
263
|
+
Controls whether the SDK automatically requests location (and motion) permissions at startup. Call before `start()` to take effect.
|
|
264
|
+
|
|
265
|
+
**Parameters:**
|
|
266
|
+
- `should` (`boolean`): `true` to request permissions automatically, `false` to handle them manually.
|
|
267
|
+
|
|
268
|
+
```typescript
|
|
269
|
+
pointrSdk.shouldRequestPermissionsAtStartup(false);
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
---
|
|
273
|
+
|
|
274
|
+
#### `requestPermissions()`
|
|
275
|
+
|
|
276
|
+
Manually requests the required location (and motion) permissions. Use when `shouldRequestPermissionsAtStartup(false)` was set.
|
|
277
|
+
|
|
278
|
+
```typescript
|
|
279
|
+
pointrSdk.requestPermissions();
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
---
|
|
283
|
+
|
|
284
|
+
#### `getPois(siteId)`
|
|
285
|
+
|
|
286
|
+
Returns a `Promise<PTRPoi[]>` with all POIs for the given site.
|
|
287
|
+
|
|
288
|
+
**Parameters:**
|
|
289
|
+
- `siteId` (`string`): External site identifier.
|
|
290
|
+
|
|
291
|
+
```typescript
|
|
292
|
+
const pois = await pointrSdk.getPois('<SITE_ID>');
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
---
|
|
296
|
+
|
|
297
|
+
#### `searchPois(siteId, query)`
|
|
298
|
+
|
|
299
|
+
Returns a `Promise<PTRPoi[]>` with POIs whose name or external identifier matches the case-insensitive `query`.
|
|
300
|
+
|
|
301
|
+
**Parameters:**
|
|
302
|
+
- `siteId` (`string`): External site identifier.
|
|
303
|
+
- `query` (`string`): Case-insensitive search term.
|
|
304
|
+
|
|
305
|
+
```typescript
|
|
306
|
+
const results = await pointrSdk.searchPois('<SITE_ID>', 'cafe');
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
---
|
|
310
|
+
|
|
311
|
+
#### `getSites()`
|
|
312
|
+
|
|
313
|
+
Returns a `Promise<PTRSite[]>` with all sites available to the client.
|
|
314
|
+
|
|
315
|
+
```typescript
|
|
316
|
+
const sites = await pointrSdk.getSites();
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
---
|
|
320
|
+
|
|
321
|
+
#### `getBuildings(siteId)`
|
|
322
|
+
|
|
323
|
+
Returns a `Promise<PTRBuilding[]>` with all buildings for the given site.
|
|
324
|
+
|
|
325
|
+
**Parameters:**
|
|
326
|
+
- `siteId` (`string`): External site identifier.
|
|
327
|
+
|
|
328
|
+
```typescript
|
|
329
|
+
const buildings = await pointrSdk.getBuildings('<SITE_ID>');
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
---
|
|
333
|
+
|
|
334
|
+
#### `getSiteByExternalId(externalId)`
|
|
335
|
+
|
|
336
|
+
Returns a `Promise<PTRSite | null>` with the site matching the given external identifier, or `null` if not found.
|
|
337
|
+
|
|
338
|
+
**Parameters:**
|
|
339
|
+
- `externalId` (`string`): External site identifier.
|
|
340
|
+
|
|
341
|
+
```typescript
|
|
342
|
+
const site = await pointrSdk.getSiteByExternalId('<SITE_ID>');
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
---
|
|
346
|
+
|
|
347
|
+
#### `getClientName()`
|
|
348
|
+
|
|
349
|
+
Returns a `Promise<string>` with the configured client identifier.
|
|
350
|
+
|
|
351
|
+
```typescript
|
|
352
|
+
const clientName = await pointrSdk.getClientName();
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
---
|
|
356
|
+
|
|
357
|
+
#### `isWayfindingReady(siteId)`
|
|
358
|
+
|
|
359
|
+
Returns a `Promise<boolean>` indicating whether wayfinding data is ready for the given site.
|
|
360
|
+
|
|
361
|
+
**Parameters:**
|
|
362
|
+
- `siteId` (`string`): External site identifier.
|
|
363
|
+
|
|
364
|
+
```typescript
|
|
365
|
+
const ready = await pointrSdk.isWayfindingReady('<SITE_ID>');
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
---
|
|
369
|
+
|
|
370
|
+
#### `calculateDistance(from, to)`
|
|
371
|
+
|
|
372
|
+
Returns a `Promise<number>` with the straight-line distance in metres between two coordinates.
|
|
373
|
+
|
|
374
|
+
**Parameters:**
|
|
375
|
+
- `from` (`{ lat: number; lon: number }`): Origin coordinate.
|
|
376
|
+
- `to` (`{ lat: number; lon: number }`): Destination coordinate.
|
|
377
|
+
|
|
378
|
+
```typescript
|
|
379
|
+
const metres = await pointrSdk.calculateDistance(
|
|
380
|
+
{ lat: 47.4979, lon: 19.0402 },
|
|
381
|
+
{ lat: 47.4985, lon: 19.0410 }
|
|
382
|
+
);
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
---
|
|
386
|
+
|
|
387
|
+
#### `isMyCarMarked()`
|
|
388
|
+
|
|
389
|
+
Returns a `Promise<boolean>` indicating whether the user's car location has been marked/saved.
|
|
390
|
+
|
|
391
|
+
```typescript
|
|
392
|
+
const marked = await pointrSdk.isMyCarMarked();
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
---
|
|
396
|
+
|
|
260
397
|
#### `getEventEmitter()`
|
|
261
398
|
|
|
262
399
|
Returns the underlying `NativeEventEmitter` for advanced subscription use cases.
|
|
@@ -269,11 +406,10 @@ const emitter = pointrSdk.getEventEmitter();
|
|
|
269
406
|
|
|
270
407
|
#### `getNativeModule()`
|
|
271
408
|
|
|
272
|
-
Returns the raw `NativeModules.PTRNativeLibrary` reference for advanced use cases not covered by the `PointrSdk` wrapper
|
|
409
|
+
Returns the raw `NativeModules.PTRNativeLibrary` reference for advanced use cases not covered by the `PointrSdk` wrapper.
|
|
273
410
|
|
|
274
411
|
```typescript
|
|
275
412
|
const native = pointrSdk.getNativeModule();
|
|
276
|
-
const pois = await native.getPois('<SITE_ID>');
|
|
277
413
|
```
|
|
278
414
|
|
|
279
415
|
---
|
|
@@ -654,36 +790,6 @@ enum PTRWayfindingMode {
|
|
|
654
790
|
|
|
655
791
|
---
|
|
656
792
|
|
|
657
|
-
### `PTRMapTrackingMode`
|
|
658
|
-
|
|
659
|
-
Controls how the map follows the user's position.
|
|
660
|
-
|
|
661
|
-
```typescript
|
|
662
|
-
enum PTRMapTrackingMode {
|
|
663
|
-
NONE = 'none',
|
|
664
|
-
TRACKING = 'tracking',
|
|
665
|
-
TRACKING_WITH_HEADING = 'trackingWithHeading',
|
|
666
|
-
}
|
|
667
|
-
```
|
|
668
|
-
|
|
669
|
-
---
|
|
670
|
-
|
|
671
|
-
### `PTRMapWidgetLayoutState`
|
|
672
|
-
|
|
673
|
-
Represents the active panel state of the map widget.
|
|
674
|
-
|
|
675
|
-
```typescript
|
|
676
|
-
enum PTRMapWidgetLayoutState {
|
|
677
|
-
IDLE = 'idle',
|
|
678
|
-
POI_DETAILS = 'poiDetails',
|
|
679
|
-
WAYFINDING = 'wayfinding',
|
|
680
|
-
STATIC_WAYFINDING= 'staticWayfinding',
|
|
681
|
-
ROUTE_SUMMARY = 'routeSummary',
|
|
682
|
-
}
|
|
683
|
-
```
|
|
684
|
-
|
|
685
|
-
---
|
|
686
|
-
|
|
687
793
|
### `PTRWayfindingEventType`
|
|
688
794
|
|
|
689
795
|
Lifecycle states of a navigation session, used as `PTRWayfindingEvent.type`.
|
|
@@ -878,6 +984,7 @@ interface PTRConfiguration {
|
|
|
878
984
|
readonly licenseKey: string;
|
|
879
985
|
readonly baseUrl: string;
|
|
880
986
|
readonly logLevel?: PTRLogLevel; // default: PTRLogLevel.ERROR
|
|
987
|
+
readonly personaId?: string; // optional persona id for the selected SDK persona
|
|
881
988
|
}
|
|
882
989
|
```
|
|
883
990
|
|
|
@@ -900,14 +1007,6 @@ interface PTRMapWidgetConfiguration {
|
|
|
900
1007
|
readonly shouldFocusOnFirstUserPosition?: boolean;
|
|
901
1008
|
readonly isQuickAccessEnabled?: boolean;
|
|
902
1009
|
readonly isAppBannerEnabled?: boolean;
|
|
903
|
-
/** Position of the exit button. Accepted values: 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight' */
|
|
904
|
-
readonly exitButtonPosition?: string;
|
|
905
|
-
/** Routing mode. Defaults to PTRWayfindingMode.NORMAL. */
|
|
906
|
-
readonly wayfindingMode?: PTRWayfindingMode;
|
|
907
|
-
/** Initial map tracking mode. Defaults to PTRMapTrackingMode.NONE. */
|
|
908
|
-
readonly initialMapTrackingMode?: PTRMapTrackingMode;
|
|
909
|
-
/** Search panel layout. Accepted values: 'default' | 'minimal' */
|
|
910
|
-
readonly searchLayout?: string;
|
|
911
1010
|
}
|
|
912
1011
|
```
|
|
913
1012
|
|
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,18 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
5
5
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [10.5.0] - 2026-07-17
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
- Mobile SDK 10.5.0 integration.
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
## [Unreleased]
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
- **`PointrSdk` methods** exposing previously native-only capabilities: `shouldRequestPermissionsAtStartup`, `requestPermissions`, `getPois`, `searchPois`, `getSites`, `getBuildings`, `getSiteByExternalId`, `getClientName`, `isWayfindingReady`, `calculateDistance`, `isMyCarMarked`.
|
|
17
|
+
|
|
18
|
+
|
|
7
19
|
## [10.3.0] - 2026-06-30
|
|
8
20
|
|
|
9
21
|
### Changed
|
package/android/build.gradle
CHANGED
|
@@ -93,7 +93,7 @@ dependencies {
|
|
|
93
93
|
//noinspection GradleDynamicVersion
|
|
94
94
|
implementation "com.facebook.react:react-android:0.82.1"
|
|
95
95
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
96
|
-
implementation("com.pointrlabs:pointr:10.
|
|
96
|
+
implementation("com.pointrlabs:pointr:10.5.0")
|
|
97
97
|
implementation ("org.jetbrains.kotlin:kotlin-reflect:$kotlin_version")
|
|
98
98
|
implementation 'com.google.android.material:material:1.12.0'
|
|
99
99
|
implementation 'androidx.constraintlayout:constraintlayout:2.2.1'
|
|
@@ -105,8 +105,12 @@ class PTRMapWidgetManager(private val reactContext: ReactApplicationContext) :
|
|
|
105
105
|
val clientId = obj.optString("clientId")
|
|
106
106
|
val licenseKey = obj.optString("licenseKey")
|
|
107
107
|
val baseUrl = obj.optString("baseUrl")
|
|
108
|
+
val personaId = obj.optString("personaId", "")
|
|
108
109
|
if (clientId.isNotEmpty() && licenseKey.isNotEmpty() && baseUrl.isNotEmpty()) {
|
|
109
110
|
val params = PTRParams(clientId, licenseKey, baseUrl)
|
|
111
|
+
if (personaId.isNotEmpty()) {
|
|
112
|
+
params.personaId = personaId
|
|
113
|
+
}
|
|
110
114
|
val logLevel = obj.optInt("logLevel", Plog.LogLevel.ERROR.ordinal)
|
|
111
115
|
params.logLevel = try {
|
|
112
116
|
Plog.LogLevel.entries[logLevel]
|
|
@@ -117,14 +117,16 @@ class PTRNativeLibrary(reactContext: ReactApplicationContext) :
|
|
|
117
117
|
clientId: String,
|
|
118
118
|
licenceKey: String,
|
|
119
119
|
baseUrl: String,
|
|
120
|
-
logLevel: Int = 0
|
|
120
|
+
logLevel: Int = 0,
|
|
121
|
+
personaId: String = ""
|
|
121
122
|
) {
|
|
122
123
|
initialize(
|
|
123
124
|
reactApplicationContext,
|
|
124
125
|
clientId,
|
|
125
126
|
licenceKey,
|
|
126
127
|
baseUrl,
|
|
127
|
-
logLevel
|
|
128
|
+
logLevel,
|
|
129
|
+
personaId
|
|
128
130
|
)
|
|
129
131
|
}
|
|
130
132
|
|
|
@@ -513,9 +515,11 @@ class PTRNativeLibrary(reactContext: ReactApplicationContext) :
|
|
|
513
515
|
clientId: String,
|
|
514
516
|
licenceKey: String,
|
|
515
517
|
baseUrl: String,
|
|
516
|
-
logLevel: Int = 0
|
|
518
|
+
logLevel: Int = 0,
|
|
519
|
+
personaId: String
|
|
517
520
|
) {
|
|
518
521
|
val ptrParams = PTRParams(clientId, licenceKey, baseUrl)
|
|
522
|
+
ptrParams.personaId = personaId
|
|
519
523
|
try {
|
|
520
524
|
val ptrLogLevel = Plog.LogLevel.entries[logLevel]
|
|
521
525
|
ptrParams.logLevel = ptrLogLevel
|
|
@@ -17,7 +17,7 @@ RCT_EXTERN_METHOD(stopObserving)
|
|
|
17
17
|
// Core methods
|
|
18
18
|
RCT_EXTERN_METHOD(shouldRequestPermissionsAtStartup:(BOOL)shouldRequestPermissionsAtStartup)
|
|
19
19
|
|
|
20
|
-
RCT_EXTERN_METHOD(initialize:(NSString *)clientIdentifier licenseKey:(NSString *)licenseKey baseUrl:(NSString *)baseUrl logLevel:(int)logLevel)
|
|
20
|
+
RCT_EXTERN_METHOD(initialize:(NSString *)clientIdentifier licenseKey:(NSString *)licenseKey baseUrl:(NSString *)baseUrl logLevel:(int)logLevel personaId:(NSString *)personaId)
|
|
21
21
|
|
|
22
22
|
RCT_EXTERN_METHOD(start:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
|
|
23
23
|
|
|
@@ -213,10 +213,12 @@ class PTRNativeLibrary: RCTEventEmitter, PTREventManagerDelegate {
|
|
|
213
213
|
@objc func initialize(_ clientIdentifier: String,
|
|
214
214
|
licenseKey: String,
|
|
215
215
|
baseUrl: String,
|
|
216
|
-
logLevel: Int
|
|
216
|
+
logLevel: Int,
|
|
217
|
+
personaId: String) {
|
|
217
218
|
guard let presentedViewController = RCTPresentedViewController() else { return }
|
|
218
219
|
self.rootViewController = presentedViewController
|
|
219
220
|
PTRNativeLibrary.params.mode = PointrDebugMode()
|
|
221
|
+
PTRNativeLibrary.params.personaIdentifier = personaId
|
|
220
222
|
PTRNativeLibrary.params.loggerLevel = PTRLoggerLevel.init(rawValue: Int32(logLevel)) ?? .error
|
|
221
223
|
PTRNativeLibrary.params.licenseKey = licenseKey
|
|
222
224
|
PTRNativeLibrary.params.baseUrl = baseUrl
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-pointr",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.5.0",
|
|
4
4
|
"description": "Pointr React-Native Module",
|
|
5
5
|
"main": "src/index",
|
|
6
6
|
"files": [
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/node": ">=20",
|
|
41
41
|
"@types/react": "^19.2.15",
|
|
42
|
-
"react": "
|
|
42
|
+
"react": "19.2.3",
|
|
43
43
|
"react-native": "0.85.3",
|
|
44
44
|
"typescript": "^5.8.3"
|
|
45
45
|
},
|
|
@@ -16,7 +16,7 @@ Pod::Spec.new do |s|
|
|
|
16
16
|
|
|
17
17
|
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
18
18
|
|
|
19
|
-
s.dependency 'PointrKit', '10.
|
|
19
|
+
s.dependency 'PointrKit', '10.5.0'
|
|
20
20
|
|
|
21
21
|
# Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
|
|
22
22
|
# See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
|
package/src/api/PointrSdk.ts
CHANGED
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
import { NativeModules, NativeEventEmitter, Platform } from 'react-native';
|
|
8
8
|
import type { PTRConfiguration, PTRMapWidgetConfiguration } from '../types/config';
|
|
9
9
|
import type { PTRPosition } from '../types/PTRPosition';
|
|
10
|
+
import type { PTRPoi } from '../types/PTRPoi';
|
|
11
|
+
import type { PTRSite, PTRBuilding } from '../types/PTRSite';
|
|
10
12
|
import type { PTRGeofence } from '../types/events';
|
|
11
13
|
import { PTRState, PTRLogLevel, PTRErrorMessages, PTREvents } from '../constants';
|
|
12
14
|
|
|
@@ -70,7 +72,8 @@ export class PointrSdk {
|
|
|
70
72
|
config.clientId,
|
|
71
73
|
config.licenseKey,
|
|
72
74
|
config.baseUrl,
|
|
73
|
-
logLevel
|
|
75
|
+
logLevel,
|
|
76
|
+
config.personaId ?? ''
|
|
74
77
|
);
|
|
75
78
|
this.state = PTRState.INITIALIZED;
|
|
76
79
|
} catch (error) {
|
|
@@ -107,6 +110,21 @@ export class PointrSdk {
|
|
|
107
110
|
}
|
|
108
111
|
}
|
|
109
112
|
|
|
113
|
+
// ─── Permissions ─────────────────────────────────────────────────────────────
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Control whether the SDK requests location (and motion) permissions
|
|
117
|
+
* automatically at startup. Call before `start()` to take effect.
|
|
118
|
+
*/
|
|
119
|
+
public shouldRequestPermissionsAtStartup(should: boolean): void {
|
|
120
|
+
PTRNativeLibrary.shouldRequestPermissionsAtStartup(should);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/** Manually request the required location (and motion) permissions. */
|
|
124
|
+
public requestPermissions(): void {
|
|
125
|
+
PTRNativeLibrary.requestPermissions();
|
|
126
|
+
}
|
|
127
|
+
|
|
110
128
|
/** Get the current SDK state */
|
|
111
129
|
public getState(): PTRState {
|
|
112
130
|
return this.state;
|
|
@@ -190,6 +208,90 @@ export class PointrSdk {
|
|
|
190
208
|
return PTRNativeLibrary.getGeofences(siteId);
|
|
191
209
|
}
|
|
192
210
|
|
|
211
|
+
// ─── POIs ──────────────────────────────────────────────────────────────────
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Get all POIs for a site.
|
|
215
|
+
* @param siteId - External site identifier
|
|
216
|
+
*/
|
|
217
|
+
public getPois(siteId: string): Promise<PTRPoi[]> {
|
|
218
|
+
return PTRNativeLibrary.getPois(siteId);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Search POIs within a site by name or external identifier.
|
|
223
|
+
* @param siteId - External site identifier
|
|
224
|
+
* @param query - Case-insensitive search term
|
|
225
|
+
*/
|
|
226
|
+
public searchPois(siteId: string, query: string): Promise<PTRPoi[]> {
|
|
227
|
+
return PTRNativeLibrary.searchPois(siteId, query);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
// ─── Sites & Buildings ───────────────────────────────────────────────────────
|
|
231
|
+
|
|
232
|
+
/** Get all sites available to the client. */
|
|
233
|
+
public getSites(): Promise<PTRSite[]> {
|
|
234
|
+
return PTRNativeLibrary.getSites();
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Get all buildings for a site.
|
|
239
|
+
* @param siteId - External site identifier
|
|
240
|
+
*/
|
|
241
|
+
public getBuildings(siteId: string): Promise<PTRBuilding[]> {
|
|
242
|
+
return PTRNativeLibrary.getBuildings(siteId);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Get a single site by its external identifier.
|
|
247
|
+
* Resolves with the site or null if not found.
|
|
248
|
+
* @param externalId - External site identifier
|
|
249
|
+
*/
|
|
250
|
+
public getSiteByExternalId(externalId: string): Promise<PTRSite | null> {
|
|
251
|
+
return PTRNativeLibrary.getSiteByExternalId(externalId);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/** Get the configured client identifier. */
|
|
255
|
+
public getClientName(): Promise<string> {
|
|
256
|
+
return PTRNativeLibrary.getClientName();
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
// ─── Wayfinding ──────────────────────────────────────────────────────────────
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Whether wayfinding data is ready for the given site.
|
|
263
|
+
* @param siteId - External site identifier
|
|
264
|
+
*/
|
|
265
|
+
public isWayfindingReady(siteId: string): Promise<boolean> {
|
|
266
|
+
return PTRNativeLibrary.isWayfindingReady(siteId);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Calculate the straight-line distance (in metres) between two coordinates.
|
|
271
|
+
* @param from - Origin coordinate
|
|
272
|
+
* @param to - Destination coordinate
|
|
273
|
+
*/
|
|
274
|
+
public calculateDistance(
|
|
275
|
+
from: { lat: number; lon: number },
|
|
276
|
+
to: { lat: number; lon: number }
|
|
277
|
+
): Promise<number> {
|
|
278
|
+
return PTRNativeLibrary.calculateDistance(
|
|
279
|
+
JSON.stringify(from),
|
|
280
|
+
JSON.stringify(to)
|
|
281
|
+
);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
// ─── My Car ──────────────────────────────────────────────────────────────────
|
|
285
|
+
|
|
286
|
+
/** Whether the user's car location has been marked/saved. */
|
|
287
|
+
public isMyCarMarked(): Promise<boolean> {
|
|
288
|
+
return new Promise((resolve) => {
|
|
289
|
+
PTRNativeLibrary.isMyCarMarked((result: any) => {
|
|
290
|
+
resolve(result == null);
|
|
291
|
+
});
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
|
|
193
295
|
/** Get native module reference (for advanced use cases) */
|
|
194
296
|
public getNativeModule() {
|
|
195
297
|
return PTRNativeLibrary;
|
package/src/types/config.ts
CHANGED