react-native-pointr 9.9.0 → 10.1.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 +284 -315
- package/CHANGELOG.md +42 -0
- package/EXTENDING.md +11 -16
- package/README.md +14 -14
- package/WAYFINDING_EVENTS.md +5 -3
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/pointr/PTRCoreExtensions.kt +33 -2
- package/android/src/main/java/com/pointr/PTRMapWidgetActionType.kt +17 -0
- package/android/src/main/java/com/pointr/PTRMapWidgetManager.kt +162 -406
- package/android/src/main/java/com/pointr/{PointrModule.kt → PTRNativeLibrary.kt} +150 -32
- package/android/src/main/java/com/pointr/{PointrPackage.kt → PTRPackage.kt} +2 -2
- package/ios/PTRMapWidgetContainerView.swift +174 -187
- package/ios/PTRMapWidgetManager-Bridging.m +12 -64
- package/ios/PTRMapWidgetManager.swift +164 -136
- package/ios/PTRNativeLibrary-Bridging.m +38 -2
- package/ios/PTRNativeLibrary.swift +206 -26
- package/package.json +6 -4
- package/react-native-pointr.podspec +1 -1
- package/src/NativePointrModule.ts +70 -0
- package/src/PTRMapWidgetUtils.ts +67 -144
- package/src/actions/index.ts +171 -0
- package/src/api/MapWidgetApi.ts +8 -8
- package/src/api/PointrSdk.ts +50 -91
- package/src/components/index.tsx +27 -26
- package/src/constants/index.ts +32 -13
- package/src/hooks/index.ts +1 -0
- package/src/hooks/usePointrGeofences.ts +37 -0
- package/src/hooks/usePointrSdk.ts +12 -5
- package/src/index.tsx +37 -70
- package/src/managers/PTRPoiManager.ts +2 -2
- package/src/types/PTRPoi.ts +5 -2
- package/src/types/PTRPosition.ts +15 -5
- package/src/types/PTRSite.ts +46 -0
- package/src/types/PTRWayfindingEvent.ts +11 -7
- package/src/types/config.ts +1 -0
- package/src/types/events.ts +1 -0
- package/src/types/index.ts +4 -0
- package/android/src/main/java/com/pointr/PTRMapWidgetCommandType.kt +0 -20
- package/src/PTRCommand.ts +0 -153
- package/src/api/index.ts +0 -9
- package/src/commands/index.ts +0 -275
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,48 @@ 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.1.0] - 2026-06-08
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
- Mobile SDK 10.1.0 integration.
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
## [10.0.0] - 2026-05-22
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
- **New actions**: `PTRFocusCoordinateAction` (focus map to a geographic coordinate), `PTRCategoryFilterAction` / `PTRHighlightCategoryAction` (filter visible POIs by category IDs).
|
|
17
|
+
- **New hook**: `usePointrGeofences(siteId)` — fetches geofences for a site with loading/error/refresh state.
|
|
18
|
+
- **New types**: `PTRSite`, `PTRBuilding`, `PTRLevel`.
|
|
19
|
+
- **New enums**: `PTRWayfindingMode`, `PTRMapTrackingMode`, `PTRMapWidgetLayoutState`.
|
|
20
|
+
- **New Architecture support**: TurboModule interop spec (`NativePointrModule`) added for React Native New Architecture compatibility.
|
|
21
|
+
- **`PTRPosition` readable aliases**: `latitude`, `longitude`, `siteId`, `buildingId`, `levelIndex` added alongside the existing short names (`lat`, `lon`, `sid`, `bid`, `lvl`).
|
|
22
|
+
- **`PTRMapWidgetConfiguration` new fields**: `exitButtonPosition`, `wayfindingMode`, `initialMapTrackingMode`, `searchLayout`.
|
|
23
|
+
- **`MIGRATION.md`**: step-by-step migration guide from v9.x.
|
|
24
|
+
- **Example app**: reworked with dedicated SDK and Events screens.
|
|
25
|
+
- **Maestro UI tests**: 6 flows covering home screen, SDK initialization, map widget open/close, listen toggle, position, and map events.
|
|
26
|
+
|
|
27
|
+
### Changed
|
|
28
|
+
- **BREAKING**: Entire command API renamed to action API — `PTRCommand` → `PTRAction`, `PTRCommandType` → `PTRActionType`, `executeMapCommand` → `executeMapAction`, `command` prop → `action` prop on `PTRMapWidget`. All command classes renamed to action classes (see table below and [MIGRATION.md](./MIGRATION.md#1-command-api-renamed-to-action-api)).
|
|
29
|
+
- **BREAKING**: `pointrSdk.start()` now returns `Promise<void>` instead of accepting a callback. See [MIGRATION.md](./MIGRATION.md#2-start-is-now-promisevoid).
|
|
30
|
+
- **BREAKING**: `PTRWayfindingEvent.type` is now the typed enum `PTRWayfindingEventType` instead of `number`. See [MIGRATION.md](./MIGRATION.md#3-ptrwayfindingeventtype-is-now-ptrwayfindingeventtype).
|
|
31
|
+
- Minimum React Native peer dependency bumped to `>=0.73`.
|
|
32
|
+
- Mobile SDK (iOS PointrKit, Android Pointr SDK) updated to **10.0.0**.
|
|
33
|
+
- `PTRWayfindingEventType` enum moved to `src/constants/index.ts` and re-exported from types.
|
|
34
|
+
|
|
35
|
+
### Removed
|
|
36
|
+
- `PTRStartAndFocusCommand` — use `sdkConfig` + `action` props on `PTRMapWidget` instead. See [MIGRATION.md](./MIGRATION.md#4-ptrstartandfocuscommand-removed).
|
|
37
|
+
- `PTRSiteCommand`, `PTRBuildingCommand`, `PTRLevelCommand` — replaced by `PTRFocusMapAction`.
|
|
38
|
+
- `PTRPoiCommand` — replaced by `PTRHighlightPoiAction`.
|
|
39
|
+
- `PTRPathCommand` — replaced by `PTRStartWayfindingAction`.
|
|
40
|
+
- `PTRStaticPathCommand`, `PTRStaticWayfindingCommand` — replaced by `PTRDisplayRouteAction`.
|
|
41
|
+
- `PTRMarkMyCarLevelCommand`, `PTRMarkMyCarSiteCommand` — replaced by `PTRMarkMyCarAction`.
|
|
42
|
+
- `PTRShowMyCarSiteCommand` — replaced by `PTRShowMyCarAction`.
|
|
43
|
+
- `executeMapCommand` function — replaced by `executeMapAction`.
|
|
44
|
+
- Type guard functions: `isPTRSiteCommand`, `isPTRBuildingCommand`, `isPTRLevelCommand`, `isPTRPoiCommand`, `isPTRPathCommand`, `isPTRStaticPathCommand`.
|
|
45
|
+
|
|
46
|
+
### Deprecated
|
|
47
|
+
- `PTRStateCallback` type — no longer needed with the Promise-based `start()`.
|
|
48
|
+
|
|
7
49
|
## [9.9.0] - 2026-04-22
|
|
8
50
|
|
|
9
51
|
### Changed
|
package/EXTENDING.md
CHANGED
|
@@ -18,7 +18,7 @@ This example shows how to add a function that retrieves all Points of Interest (
|
|
|
18
18
|
|
|
19
19
|
#### iOS Implementation
|
|
20
20
|
|
|
21
|
-
**File: `ios/
|
|
21
|
+
**File: `ios/PTRNativeLibrary.swift`**
|
|
22
22
|
|
|
23
23
|
Add the following method to your native iOS module:
|
|
24
24
|
|
|
@@ -54,7 +54,7 @@ func getPois(_ siteId: String,
|
|
|
54
54
|
}
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
-
**File: `ios/
|
|
57
|
+
**File: `ios/PTRNativeLibrary-Bridging.m`**
|
|
58
58
|
|
|
59
59
|
Add the method declaration to the bridge:
|
|
60
60
|
|
|
@@ -66,7 +66,7 @@ RCT_EXTERN_METHOD(getPois:(NSString *)siteId
|
|
|
66
66
|
|
|
67
67
|
#### Android Implementation
|
|
68
68
|
|
|
69
|
-
**File: `android/src/main/java/com/
|
|
69
|
+
**File: `android/src/main/java/com/pointr/PTRNativeLibrary.kt`**
|
|
70
70
|
|
|
71
71
|
Add the following method to your native Android module:
|
|
72
72
|
|
|
@@ -145,15 +145,15 @@ export interface PTRPoi {
|
|
|
145
145
|
|
|
146
146
|
### Step 3: Create JavaScript Wrapper
|
|
147
147
|
|
|
148
|
-
**File: `src/
|
|
148
|
+
**File: `src/managers/PTRPoiManager.ts`**
|
|
149
149
|
|
|
150
150
|
Create a wrapper function that provides a clean API:
|
|
151
151
|
|
|
152
152
|
```typescript
|
|
153
153
|
import { NativeModules } from 'react-native';
|
|
154
|
-
import { PTRPoi } from '
|
|
154
|
+
import { PTRPoi } from '../types/PTRPoi';
|
|
155
155
|
|
|
156
|
-
const
|
|
156
|
+
const PTRNativeLibrary = NativeModules.PTRNativeLibrary;
|
|
157
157
|
|
|
158
158
|
/**
|
|
159
159
|
* Get all Points of Interest (POIs) for a specific site
|
|
@@ -163,10 +163,9 @@ const { PTRNativePointrLibrary } = NativeModules;
|
|
|
163
163
|
*/
|
|
164
164
|
export async function getPois(siteId: string): Promise<PTRPoi[]> {
|
|
165
165
|
try {
|
|
166
|
-
const pois = await
|
|
166
|
+
const pois = await PTRNativeLibrary.getPois(siteId);
|
|
167
167
|
return pois as PTRPoi[];
|
|
168
168
|
} catch (error) {
|
|
169
|
-
console.error('Failed to get POIs:', error);
|
|
170
169
|
throw error;
|
|
171
170
|
}
|
|
172
171
|
}
|
|
@@ -174,17 +173,13 @@ export async function getPois(siteId: string): Promise<PTRPoi[]> {
|
|
|
174
173
|
|
|
175
174
|
### Step 4: Export the New Functionality
|
|
176
175
|
|
|
177
|
-
**File: `src/index.
|
|
176
|
+
**File: `src/index.tsx`**
|
|
178
177
|
|
|
179
178
|
Export the new functions and types from the main entry point:
|
|
180
179
|
|
|
181
180
|
```typescript
|
|
182
|
-
// Existing exports
|
|
183
|
-
export * from './PTRCommand';
|
|
184
|
-
export * from './PTRMapWidgetUtils';
|
|
185
|
-
|
|
186
181
|
// New exports
|
|
187
|
-
export { getPois } from './
|
|
182
|
+
export { getPois } from './managers/PTRPoiManager';
|
|
188
183
|
export type { PTRPoi } from './types/PTRPoi';
|
|
189
184
|
```
|
|
190
185
|
|
|
@@ -395,8 +390,8 @@ private fun sendEvent(eventName: String, params: WritableMap?) {
|
|
|
395
390
|
```typescript
|
|
396
391
|
import { NativeEventEmitter, NativeModules } from 'react-native';
|
|
397
392
|
|
|
398
|
-
const
|
|
399
|
-
const eventEmitter = new NativeEventEmitter(
|
|
393
|
+
const PTRNativeLibrary = NativeModules.PTRNativeLibrary;
|
|
394
|
+
const eventEmitter = new NativeEventEmitter(PTRNativeLibrary);
|
|
400
395
|
|
|
401
396
|
export function subscribeToLocationUpdates(
|
|
402
397
|
callback: (location: PTRLocation) => void
|
package/README.md
CHANGED
|
@@ -156,11 +156,11 @@ Then run `npm install` or `yarn install` to install the dependencies.
|
|
|
156
156
|
Import the package exports and render the map widget:
|
|
157
157
|
|
|
158
158
|
```typescript
|
|
159
|
-
import { PTRMapWidget,
|
|
159
|
+
import { PTRMapWidget, PTRFocusMapAction } from 'react-native-pointr';
|
|
160
160
|
import type { PTRConfiguration, PTRMapWidgetConfiguration } from 'react-native-pointr';
|
|
161
161
|
```
|
|
162
162
|
|
|
163
|
-
The simplest integration passes `sdkConfig`, `mapWidgetConfig`, and `
|
|
163
|
+
The simplest integration passes `sdkConfig`, `mapWidgetConfig`, and `action` as props directly — the widget handles initialization automatically:
|
|
164
164
|
|
|
165
165
|
```tsx
|
|
166
166
|
const SDK_CONFIG: PTRConfiguration = {
|
|
@@ -180,7 +180,7 @@ function MapScreen() {
|
|
|
180
180
|
style={{ flex: 1 }}
|
|
181
181
|
sdkConfig={SDK_CONFIG}
|
|
182
182
|
mapWidgetConfig={MAP_CONFIG}
|
|
183
|
-
|
|
183
|
+
action={new PTRFocusMapAction('<SITE_EXTERNAL_ID>')}
|
|
184
184
|
onMapWidgetDidEndLoading={(e) => console.log('Map loaded', e.nativeEvent)}
|
|
185
185
|
onWayfindingEvent={(e) => console.log('Navigation event', e.nativeEvent)}
|
|
186
186
|
/>
|
|
@@ -205,18 +205,18 @@ function App() {
|
|
|
205
205
|
}
|
|
206
206
|
```
|
|
207
207
|
|
|
208
|
-
### Available
|
|
208
|
+
### Available Actions
|
|
209
209
|
|
|
210
210
|
```typescript
|
|
211
|
-
import {
|
|
212
|
-
PTRPathCommand, PTRStaticPathCommand,
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
211
|
+
import { PTRFocusMapAction, PTRHighlightPoiAction,
|
|
212
|
+
PTRPathCommand, PTRStaticPathCommand, executeMapAction } from 'react-native-pointr';
|
|
213
|
+
|
|
214
|
+
executeMapAction(mapRef, new PTRFocusMapAction('site-id'));
|
|
215
|
+
executeMapAction(mapRef, new PTRFocusMapAction('site-id', 'building-id'));
|
|
216
|
+
executeMapAction(mapRef, new PTRFocusMapAction('site-id', 'building-id', 2));
|
|
217
|
+
executeMapAction(mapRef, new PTRHighlightPoiAction('site-id', 'poi-id'));
|
|
218
|
+
executeMapAction(mapRef, new PTRPathCommand('site-id', 'poi-id'));
|
|
219
|
+
executeMapAction(mapRef, new PTRStaticPathCommand('site-id', 'from-poi', 'to-poi'));
|
|
220
220
|
```
|
|
221
221
|
|
|
222
222
|
### Available Hooks
|
|
@@ -251,7 +251,7 @@ After completing the setup, start your app by running:
|
|
|
251
251
|
npx react-native run-android
|
|
252
252
|
```
|
|
253
253
|
|
|
254
|
-
That’s it! Your package should now be installed and ready to use in your React Native project. For more details on usage and advanced configuration, refer to the [API documentation](https://
|
|
254
|
+
That’s it! Your package should now be installed and ready to use in your React Native project. For more details on usage and advanced configuration, refer to the [API documentation](https://dev.pointr.tech/sdk-and-api-references/mobile-sdk-references/).
|
|
255
255
|
## 6. Run the Example App
|
|
256
256
|
|
|
257
257
|
To explore the included demo app:
|
package/WAYFINDING_EVENTS.md
CHANGED
|
@@ -42,7 +42,8 @@ import { type PTRPoi } from 'react-native-pointr';
|
|
|
42
42
|
identifier: string; // Internal unique identifier
|
|
43
43
|
externalIdentifier: string; // External API reference ID
|
|
44
44
|
name: string; // Display name
|
|
45
|
-
|
|
45
|
+
mainType: string; // Main POI type (e.g., "lobby", "room")
|
|
46
|
+
subType?: string; // Optional sub-type
|
|
46
47
|
position: PTRPosition; // Geographic position
|
|
47
48
|
geometry: PTRGeometry; // Shape data
|
|
48
49
|
attributes: PTRPoiAttributes; // Additional metadata
|
|
@@ -90,7 +91,7 @@ const handleWayfindingEvent = (event: NativeSyntheticEvent<PTRWayfindingEvent>)
|
|
|
90
91
|
|
|
91
92
|
// Access destination POI information
|
|
92
93
|
console.log(`Navigation ${eventTypeName} to: ${wayfindingEvent.poi.name}`);
|
|
93
|
-
console.log(`POI Type: ${wayfindingEvent.poi.
|
|
94
|
+
console.log(`POI Type: ${wayfindingEvent.poi.mainType}${wayfindingEvent.poi.subType ? '/' + wayfindingEvent.poi.subType : ''}`);
|
|
94
95
|
console.log(`Location: Level ${wayfindingEvent.poi.position.lvl}`);
|
|
95
96
|
};
|
|
96
97
|
```
|
|
@@ -175,7 +176,8 @@ const handleWayfindingEvent = (event: NativeSyntheticEvent<PTRWayfindingEvent>)
|
|
|
175
176
|
analytics.track('Wayfinding Event', {
|
|
176
177
|
eventType: type === -1 ? 'cancelled' : type === 0 ? 'started' : 'ended',
|
|
177
178
|
destinationName: poi.name,
|
|
178
|
-
destinationType: poi.
|
|
179
|
+
destinationType: poi.mainType,
|
|
180
|
+
destinationSubType: poi.subType,
|
|
179
181
|
destinationId: poi.externalIdentifier,
|
|
180
182
|
});
|
|
181
183
|
};
|
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:
|
|
96
|
+
implementation("com.pointrlabs:pointr:10.1.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'
|
|
@@ -2,12 +2,15 @@ package com.pointr
|
|
|
2
2
|
|
|
3
3
|
import com.facebook.react.bridge.Arguments
|
|
4
4
|
import com.facebook.react.bridge.ReadableMap
|
|
5
|
+
import com.facebook.react.bridge.WritableMap
|
|
5
6
|
import com.pointrlabs.core.geojson.PTRFeature
|
|
6
7
|
import com.pointrlabs.core.geometry.GeoMultiPoint
|
|
7
8
|
import com.pointrlabs.core.geometry.GeoMultiPolygon
|
|
8
9
|
import com.pointrlabs.core.geometry.GeoPoint
|
|
9
10
|
import com.pointrlabs.core.geometry.GeoPolygon
|
|
10
11
|
import com.pointrlabs.core.geometry.Geometry
|
|
12
|
+
import com.pointrlabs.core.management.models.Building
|
|
13
|
+
import com.pointrlabs.core.management.models.Site
|
|
11
14
|
import com.pointrlabs.core.positioning.model.Position
|
|
12
15
|
|
|
13
16
|
val Position.map
|
|
@@ -59,7 +62,8 @@ val PTRFeature.map
|
|
|
59
62
|
get() = Arguments.createMap().apply {
|
|
60
63
|
putString("identifier", identifier)
|
|
61
64
|
putString("externalIdentifier", externalIdentifier)
|
|
62
|
-
putString("
|
|
65
|
+
putString("mainType", mainType)
|
|
66
|
+
subType?.let { putString("subType", it) }
|
|
63
67
|
putMap("geometry", geometry.map)
|
|
64
68
|
putMap("attributes", getAttributes(attributes))
|
|
65
69
|
putString("name", name)
|
|
@@ -123,4 +127,31 @@ val Geometry.map
|
|
|
123
127
|
else -> Arguments.createMap().apply {
|
|
124
128
|
putString("type", type.name)
|
|
125
129
|
}
|
|
126
|
-
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// ─── Site / Building / Level → WritableMap ────────────────────────────────────
|
|
133
|
+
|
|
134
|
+
fun Site.toWritableMap(): WritableMap = Arguments.createMap().apply {
|
|
135
|
+
putString("identifier", identifier)
|
|
136
|
+
putString("externalIdentifier", externalIdentifier)
|
|
137
|
+
putString("name", name ?: "")
|
|
138
|
+
val buildingsArr = Arguments.createArray()
|
|
139
|
+
buildings.forEach { b -> buildingsArr.pushMap(b.toWritableMap()) }
|
|
140
|
+
putArray("buildings", buildingsArr)
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
fun Building.toWritableMap(): WritableMap = Arguments.createMap().apply {
|
|
144
|
+
putString("identifier", identifier)
|
|
145
|
+
putString("externalIdentifier", externalIdentifier)
|
|
146
|
+
putString("name", name ?: "")
|
|
147
|
+
val levelsArr = Arguments.createArray()
|
|
148
|
+
levels.forEach { lvl ->
|
|
149
|
+
levelsArr.pushMap(Arguments.createMap().apply {
|
|
150
|
+
putString("identifier", lvl.identifier)
|
|
151
|
+
putString("externalIdentifier", lvl.externalIdentifier)
|
|
152
|
+
putString("name", lvl.name ?: "")
|
|
153
|
+
putInt("index", lvl.index)
|
|
154
|
+
})
|
|
155
|
+
}
|
|
156
|
+
putArray("levels", levelsArr)
|
|
157
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
package com.pointr
|
|
2
|
+
|
|
3
|
+
import androidx.annotation.StringDef
|
|
4
|
+
|
|
5
|
+
@StringDef(value = [PTRMapWidgetActionType.FOCUS_MAP, PTRMapWidgetActionType.HIGHLIGHT_POI, PTRMapWidgetActionType.DISPLAY_ROUTE, PTRMapWidgetActionType.START_WAYFINDING, PTRMapWidgetActionType.MARK_MY_CAR, PTRMapWidgetActionType.SHOW_MY_CAR, PTRMapWidgetActionType.FOCUS_COORDINATE, PTRMapWidgetActionType.HIGHLIGHT_CATEGORY])
|
|
6
|
+
annotation class PTRMapWidgetActionType {
|
|
7
|
+
companion object {
|
|
8
|
+
const val FOCUS_MAP = "focusMap"
|
|
9
|
+
const val HIGHLIGHT_POI = "highlightPoi"
|
|
10
|
+
const val DISPLAY_ROUTE = "displayRoute"
|
|
11
|
+
const val START_WAYFINDING = "startWayfinding"
|
|
12
|
+
const val MARK_MY_CAR = "markMyCar"
|
|
13
|
+
const val SHOW_MY_CAR = "showMyCar"
|
|
14
|
+
const val FOCUS_COORDINATE = "focusCoordinate"
|
|
15
|
+
const val HIGHLIGHT_CATEGORY = "highlightCategory"
|
|
16
|
+
}
|
|
17
|
+
}
|