react-native-pointr 9.8.0 → 10.0.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.
Files changed (41) hide show
  1. package/API_REFERENCE.md +284 -315
  2. package/CHANGELOG.md +42 -0
  3. package/EXTENDING.md +11 -16
  4. package/README.md +14 -14
  5. package/WAYFINDING_EVENTS.md +5 -3
  6. package/android/build.gradle +1 -1
  7. package/android/src/main/java/com/pointr/PTRCoreExtensions.kt +33 -2
  8. package/android/src/main/java/com/pointr/PTRMapWidgetActionType.kt +17 -0
  9. package/android/src/main/java/com/pointr/PTRMapWidgetManager.kt +162 -406
  10. package/android/src/main/java/com/pointr/{PointrModule.kt → PTRNativeLibrary.kt} +150 -32
  11. package/android/src/main/java/com/pointr/{PointrPackage.kt → PTRPackage.kt} +2 -2
  12. package/ios/PTRMapWidgetContainerView.swift +174 -187
  13. package/ios/PTRMapWidgetManager-Bridging.m +12 -64
  14. package/ios/PTRMapWidgetManager.swift +164 -136
  15. package/ios/PTRNativeLibrary-Bridging.m +38 -2
  16. package/ios/PTRNativeLibrary.swift +206 -26
  17. package/package.json +5 -3
  18. package/react-native-pointr.podspec +1 -1
  19. package/src/NativePointrModule.ts +70 -0
  20. package/src/PTRMapWidgetUtils.ts +67 -144
  21. package/src/actions/index.ts +171 -0
  22. package/src/api/MapWidgetApi.ts +8 -8
  23. package/src/api/PointrSdk.ts +50 -91
  24. package/src/components/index.tsx +27 -26
  25. package/src/constants/index.ts +32 -13
  26. package/src/hooks/index.ts +1 -0
  27. package/src/hooks/usePointrGeofences.ts +37 -0
  28. package/src/hooks/usePointrSdk.ts +12 -5
  29. package/src/index.tsx +37 -70
  30. package/src/managers/PTRPoiManager.ts +2 -2
  31. package/src/types/PTRPoi.ts +5 -2
  32. package/src/types/PTRPosition.ts +15 -5
  33. package/src/types/PTRSite.ts +46 -0
  34. package/src/types/PTRWayfindingEvent.ts +11 -7
  35. package/src/types/config.ts +1 -0
  36. package/src/types/events.ts +1 -0
  37. package/src/types/index.ts +4 -0
  38. package/android/src/main/java/com/pointr/PTRMapWidgetCommandType.kt +0 -20
  39. package/src/PTRCommand.ts +0 -153
  40. package/src/api/index.ts +0 -9
  41. 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.0.0] - 2026-05-22
8
+
9
+ ### Added
10
+ - **New actions**: `PTRFocusCoordinateAction` (focus map to a geographic coordinate), `PTRCategoryFilterAction` / `PTRHighlightCategoryAction` (filter visible POIs by category IDs).
11
+ - **New hook**: `usePointrGeofences(siteId)` — fetches geofences for a site with loading/error/refresh state.
12
+ - **New types**: `PTRSite`, `PTRBuilding`, `PTRLevel`.
13
+ - **New enums**: `PTRWayfindingMode`, `PTRMapTrackingMode`, `PTRMapWidgetLayoutState`.
14
+ - **New Architecture support**: TurboModule interop spec (`NativePointrModule`) added for React Native New Architecture compatibility.
15
+ - **`PTRPosition` readable aliases**: `latitude`, `longitude`, `siteId`, `buildingId`, `levelIndex` added alongside the existing short names (`lat`, `lon`, `sid`, `bid`, `lvl`).
16
+ - **`PTRMapWidgetConfiguration` new fields**: `exitButtonPosition`, `wayfindingMode`, `initialMapTrackingMode`, `searchLayout`.
17
+ - **`MIGRATION.md`**: step-by-step migration guide from v9.x.
18
+ - **Example app**: reworked with dedicated SDK and Events screens.
19
+ - **Maestro UI tests**: 6 flows covering home screen, SDK initialization, map widget open/close, listen toggle, position, and map events.
20
+
21
+ ### Changed
22
+ - **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)).
23
+ - **BREAKING**: `pointrSdk.start()` now returns `Promise<void>` instead of accepting a callback. See [MIGRATION.md](./MIGRATION.md#2-start-is-now-promisevoid).
24
+ - **BREAKING**: `PTRWayfindingEvent.type` is now the typed enum `PTRWayfindingEventType` instead of `number`. See [MIGRATION.md](./MIGRATION.md#3-ptrwayfindingeventtype-is-now-ptrwayfindingeventtype).
25
+ - Minimum React Native peer dependency bumped to `>=0.73`.
26
+ - Mobile SDK (iOS PointrKit, Android Pointr SDK) updated to **10.0.0**.
27
+ - `PTRWayfindingEventType` enum moved to `src/constants/index.ts` and re-exported from types.
28
+
29
+ ### Removed
30
+ - `PTRStartAndFocusCommand` — use `sdkConfig` + `action` props on `PTRMapWidget` instead. See [MIGRATION.md](./MIGRATION.md#4-ptrstartandfocuscommand-removed).
31
+ - `PTRSiteCommand`, `PTRBuildingCommand`, `PTRLevelCommand` — replaced by `PTRFocusMapAction`.
32
+ - `PTRPoiCommand` — replaced by `PTRHighlightPoiAction`.
33
+ - `PTRPathCommand` — replaced by `PTRStartWayfindingAction`.
34
+ - `PTRStaticPathCommand`, `PTRStaticWayfindingCommand` — replaced by `PTRDisplayRouteAction`.
35
+ - `PTRMarkMyCarLevelCommand`, `PTRMarkMyCarSiteCommand` — replaced by `PTRMarkMyCarAction`.
36
+ - `PTRShowMyCarSiteCommand` — replaced by `PTRShowMyCarAction`.
37
+ - `executeMapCommand` function — replaced by `executeMapAction`.
38
+ - Type guard functions: `isPTRSiteCommand`, `isPTRBuildingCommand`, `isPTRLevelCommand`, `isPTRPoiCommand`, `isPTRPathCommand`, `isPTRStaticPathCommand`.
39
+
40
+ ### Deprecated
41
+ - `PTRStateCallback` type — no longer needed with the Promise-based `start()`.
42
+
43
+ ## [9.9.0] - 2026-04-22
44
+
45
+ ### Changed
46
+ - Mobile SDK 9.9.0 integration.
47
+
48
+
7
49
  ## [9.8.0] - 2026-04-16
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/PTRNativePointrLibrary.swift`**
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/PTRNativePointrLibrary.m`**
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/reactnativepointr/PTRNativePointrLibraryModule.kt`**
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/PTRNativePointrLibrary.ts`**
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 './types/PTRPoi';
154
+ import { PTRPoi } from '../types/PTRPoi';
155
155
 
156
- const { PTRNativePointrLibrary } = NativeModules;
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 PTRNativePointrLibrary.getPois(siteId);
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.ts`**
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 './PTRNativePointrLibrary';
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 { PTRNativePointrLibrary } = NativeModules;
399
- const eventEmitter = new NativeEventEmitter(PTRNativePointrLibrary);
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, PTRSiteCommand } from 'react-native-pointr';
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 `command` as props directly — the widget handles initialization automatically:
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
- command={new PTRSiteCommand('<SITE_EXTERNAL_ID>')}
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 Commands
208
+ ### Available Actions
209
209
 
210
210
  ```typescript
211
- import { PTRSiteCommand, PTRBuildingCommand, PTRLevelCommand, PTRPoiCommand,
212
- PTRPathCommand, PTRStaticPathCommand, executeMapCommand } from 'react-native-pointr';
213
-
214
- executeMapCommand(mapRef, new PTRSiteCommand('site-id'));
215
- executeMapCommand(mapRef, new PTRBuildingCommand('site-id', 'building-id'));
216
- executeMapCommand(mapRef, new PTRLevelCommand('site-id', 'building-id', 2));
217
- executeMapCommand(mapRef, new PTRPoiCommand('site-id', 'poi-id'));
218
- executeMapCommand(mapRef, new PTRPathCommand('site-id', 'poi-id'));
219
- executeMapCommand(mapRef, new PTRStaticPathCommand('site-id', 'from-poi', 'to-poi'));
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://docs.pointr.tech/docs/8.x/Developer%20Portal/API%20Reference/api%20ref-mobile/).
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:
@@ -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
- typeCode: string; // POI type (e.g., "lobby", "room")
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.typeCode}`);
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.typeCode,
179
+ destinationType: poi.mainType,
180
+ destinationSubType: poi.subType,
179
181
  destinationId: poi.externalIdentifier,
180
182
  });
181
183
  };
@@ -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:9.8.0")
96
+ implementation("com.pointrlabs:pointr:10.0.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("typeCode", typeCode)
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
+ }