react-native-pointr 9.2.0 → 9.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.
Files changed (77) hide show
  1. package/.vscode/settings.json +21 -0
  2. package/API_REFERENCE.md +887 -0
  3. package/CHANGELOG.md +45 -0
  4. package/EXTENDING.md +419 -0
  5. package/README.md +221 -117
  6. package/WAYFINDING_EVENTS.md +243 -0
  7. package/android/build.gradle +4 -5
  8. package/android/src/main/java/com/pointr/PTRCoreExtensions.kt +126 -0
  9. package/android/src/main/java/com/pointr/PTRMapWidgetCommandType.kt +2 -1
  10. package/android/src/main/java/com/pointr/PTRMapWidgetManager.kt +78 -16
  11. package/android/src/main/java/com/pointr/PointrModule.kt +106 -3
  12. package/example/pointr_rn_demo/.bundle/config +2 -0
  13. package/example/pointr_rn_demo/.eslintrc.js +4 -0
  14. package/example/pointr_rn_demo/.prettierrc.js +5 -0
  15. package/example/pointr_rn_demo/.watchmanconfig +1 -0
  16. package/example/pointr_rn_demo/App.tsx +323 -0
  17. package/example/pointr_rn_demo/Gemfile +16 -0
  18. package/example/pointr_rn_demo/Gemfile.lock +111 -0
  19. package/example/pointr_rn_demo/README.md +188 -0
  20. package/example/pointr_rn_demo/__tests__/App.test.tsx +13 -0
  21. package/example/pointr_rn_demo/android/app/build.gradle +119 -0
  22. package/example/pointr_rn_demo/android/app/debug.keystore +0 -0
  23. package/example/pointr_rn_demo/android/app/proguard-rules.pro +10 -0
  24. package/example/pointr_rn_demo/android/app/src/main/AndroidManifest.xml +27 -0
  25. package/example/pointr_rn_demo/android/app/src/main/java/com/pointr_rn_demo/MainActivity.kt +22 -0
  26. package/example/pointr_rn_demo/android/app/src/main/java/com/pointr_rn_demo/MainApplication.kt +27 -0
  27. package/example/pointr_rn_demo/android/app/src/main/res/drawable/rn_edit_text_material.xml +37 -0
  28. package/example/pointr_rn_demo/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  29. package/example/pointr_rn_demo/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
  30. package/example/pointr_rn_demo/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  31. package/example/pointr_rn_demo/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
  32. package/example/pointr_rn_demo/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  33. package/example/pointr_rn_demo/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
  34. package/example/pointr_rn_demo/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  35. package/example/pointr_rn_demo/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
  36. package/example/pointr_rn_demo/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  37. package/example/pointr_rn_demo/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
  38. package/example/pointr_rn_demo/android/app/src/main/res/values/strings.xml +3 -0
  39. package/example/pointr_rn_demo/android/app/src/main/res/values/styles.xml +9 -0
  40. package/example/pointr_rn_demo/android/build.gradle +34 -0
  41. package/example/pointr_rn_demo/android/gradle.properties +44 -0
  42. package/example/pointr_rn_demo/android/settings.gradle +6 -0
  43. package/example/pointr_rn_demo/app.json +4 -0
  44. package/example/pointr_rn_demo/babel.config.js +3 -0
  45. package/example/pointr_rn_demo/index.js +16 -0
  46. package/example/pointr_rn_demo/ios/.xcode.env +11 -0
  47. package/example/pointr_rn_demo/ios/Podfile +40 -0
  48. package/example/pointr_rn_demo/ios/pointr_rn_demo/AppDelegate.swift +48 -0
  49. package/example/pointr_rn_demo/ios/pointr_rn_demo/Images.xcassets/AppIcon.appiconset/Contents.json +53 -0
  50. package/example/pointr_rn_demo/ios/pointr_rn_demo/Images.xcassets/Contents.json +6 -0
  51. package/example/pointr_rn_demo/ios/pointr_rn_demo/Info.plist +63 -0
  52. package/example/pointr_rn_demo/ios/pointr_rn_demo/LaunchScreen.storyboard +47 -0
  53. package/example/pointr_rn_demo/ios/pointr_rn_demo/PrivacyInfo.xcprivacy +37 -0
  54. package/example/pointr_rn_demo/ios/pointr_rn_demo.xcodeproj/project.pbxproj +488 -0
  55. package/example/pointr_rn_demo/ios/pointr_rn_demo.xcodeproj/xcshareddata/xcschemes/pointr_rn_demo.xcscheme +88 -0
  56. package/example/pointr_rn_demo/ios/pointr_rn_demo.xcworkspace/contents.xcworkspacedata +10 -0
  57. package/example/pointr_rn_demo/jest.config.js +3 -0
  58. package/example/pointr_rn_demo/metro.config.js +22 -0
  59. package/example/pointr_rn_demo/package.json +47 -0
  60. package/example/pointr_rn_demo/prepare-demo-distribution.sh +103 -0
  61. package/example/pointr_rn_demo/tsconfig.json +5 -0
  62. package/ios/PTRMapWidgetContainerView.swift +56 -5
  63. package/ios/PTRMapWidgetManager-Bridging.m +7 -0
  64. package/ios/PTRMapWidgetManager.swift +28 -0
  65. package/ios/PTRNativeLibrary-Bridging.m +4 -0
  66. package/ios/PTRNativeLibrary.swift +208 -2
  67. package/package.json +16 -2
  68. package/prepare-distribution.sh +151 -0
  69. package/react-native-pointr.podspec +1 -1
  70. package/src/PTRCommand.ts +13 -0
  71. package/src/PTRMapWidgetUtils.ts +10 -1
  72. package/src/PTRPoiManager.ts +20 -0
  73. package/src/index.tsx +40 -1
  74. package/src/types/PTRGeometry.ts +70 -0
  75. package/src/types/PTRPoi.ts +49 -0
  76. package/src/types/PTRPosition.ts +22 -0
  77. package/src/types/PTRWayfindingEvent.ts +18 -0
@@ -0,0 +1,151 @@
1
+ #!/bin/bash
2
+
3
+ # Script to prepare react-native-pointr package for distribution
4
+ # This script cleans build artifacts, removes git history, and creates a compressed archive
5
+ # Usage:
6
+ # ./prepare-distribution.sh - Package the library
7
+ # ./prepare-distribution.sh demo - Package the demo app
8
+
9
+ set -e # Exit on error
10
+
11
+ MODE="${1:-library}"
12
+
13
+ if [ "$MODE" = "demo" ]; then
14
+ echo "📱 Preparing demo app for distribution..."
15
+
16
+ DEMO_NAME="pointr_rn_demo"
17
+ DEMO_VERSION=$(grep -o '"version": "[^"]*"' example/pointr_rn_demo/package.json | head -1 | sed 's/"version": "\(.*\)"/\1/')
18
+ OUTPUT_NAME="${DEMO_NAME}-${DEMO_VERSION}.zip"
19
+ TEMP_DIR="${DEMO_NAME}_temp"
20
+
21
+ echo "🧹 Starting demo app cleanup and preparation..."
22
+ echo "📌 Demo version: ${DEMO_VERSION}"
23
+
24
+ # Create a temporary copy of the demo app
25
+ echo "📦 Creating temporary copy of demo app..."
26
+ rsync -a --exclude="node_modules" \
27
+ --exclude="android/build" \
28
+ --exclude="android/.gradle" \
29
+ --exclude="android/app/build" \
30
+ --exclude="ios/build" \
31
+ --exclude="ios/Pods" \
32
+ --exclude="ios/Podfile.lock" \
33
+ --exclude=".DS_Store" \
34
+ --exclude="*.log" \
35
+ example/pointr_rn_demo/ "../${TEMP_DIR}/"
36
+
37
+ cd "../${TEMP_DIR}"
38
+
39
+ # Remove development files
40
+ echo "🗑️ Removing development files..."
41
+ rm -rf .git
42
+ rm -rf .vscode
43
+ rm -rf .idea
44
+ rm -f .DS_Store
45
+ rm -f *.log
46
+ rm -f npm-debug.log*
47
+ rm -f yarn-debug.log*
48
+ rm -f yarn-error.log*
49
+
50
+ # Create the zip archive
51
+ echo "📦 Creating compressed archive..."
52
+ cd ..
53
+ zip -r "${OUTPUT_NAME}" "${TEMP_DIR}" -x "*.DS_Store" -q
54
+
55
+ # Create dist directory if it doesn't exist
56
+ mkdir -p "react-native-pointr/dist"
57
+
58
+ # Move the archive to dist directory
59
+ mv "${OUTPUT_NAME}" "react-native-pointr/dist/"
60
+
61
+ # Clean up temporary directory
62
+ echo "🧼 Cleaning up temporary files..."
63
+ rm -rf "${TEMP_DIR}"
64
+
65
+ cd "react-native-pointr"
66
+
67
+ echo "✅ Demo distribution package created successfully!"
68
+ echo "📦 Output file: ${OUTPUT_NAME}"
69
+ echo "📍 Location: $(pwd)/dist/${OUTPUT_NAME}"
70
+
71
+ exit 0
72
+ fi
73
+
74
+ # Library packaging mode
75
+ PACKAGE_NAME="react-native-pointr"
76
+ VERSION=$(grep -o '"version": "[^"]*"' package.json | head -1 | sed 's/"version": "\(.*\)"/\1/')
77
+ OUTPUT_NAME="${PACKAGE_NAME}-${VERSION}.zip"
78
+ TEMP_DIR="${PACKAGE_NAME}_temp"
79
+
80
+ echo "🧹 Starting package cleanup and preparation..."
81
+ echo "📌 Package version: ${VERSION}"
82
+
83
+ # Create a temporary copy of the package
84
+ echo "📦 Creating temporary copy..."
85
+ rsync -a --exclude=".git" \
86
+ --exclude="node_modules" \
87
+ --exclude="example" \
88
+ --exclude=".DS_Store" \
89
+ --exclude="*.log" \
90
+ --exclude="prepare-distribution.sh" \
91
+ ./ "../${TEMP_DIR}/"
92
+
93
+ cd "../${TEMP_DIR}"
94
+
95
+ # Clean Android build artifacts
96
+ echo "🤖 Cleaning Android build artifacts..."
97
+ if [ -d "android/build" ]; then
98
+ rm -rf android/build
99
+ fi
100
+ if [ -d "android/.gradle" ]; then
101
+ rm -rf android/.gradle
102
+ fi
103
+
104
+ # Clean iOS build artifacts
105
+ echo "🍎 Cleaning iOS build artifacts..."
106
+ if [ -d "ios/build" ]; then
107
+ rm -rf ios/build
108
+ fi
109
+ if [ -d "ios/Pods" ]; then
110
+ rm -rf ios/Pods
111
+ fi
112
+ if [ -f "ios/Podfile.lock" ]; then
113
+ rm -f ios/Podfile.lock
114
+ fi
115
+
116
+ # Remove common development files
117
+ echo "🗑️ Removing development files..."
118
+ rm -rf .git
119
+ rm -rf .gitignore
120
+ rm -rf .github
121
+ rm -rf node_modules
122
+ rm -rf .vscode
123
+ rm -rf .idea
124
+ rm -f .DS_Store
125
+ rm -f *.log
126
+ rm -f npm-debug.log*
127
+ rm -f yarn-debug.log*
128
+ rm -f yarn-error.log*
129
+ rm -f package-lock.json
130
+ rm -f yarn.lock
131
+
132
+ # Create the zip archive
133
+ echo "📦 Creating compressed archive..."
134
+ cd ..
135
+ zip -r "${OUTPUT_NAME}" "${TEMP_DIR}" -x "*.DS_Store" -q
136
+
137
+ # Create dist directory if it doesn't exist
138
+ mkdir -p "${PACKAGE_NAME}/dist"
139
+
140
+ # Move the archive to dist directory
141
+ mv "${OUTPUT_NAME}" "${PACKAGE_NAME}/dist/"
142
+
143
+ # Clean up temporary directory
144
+ echo "🧼 Cleaning up temporary files..."
145
+ rm -rf "${TEMP_DIR}"
146
+
147
+ cd "${PACKAGE_NAME}"
148
+
149
+ echo "✅ Distribution package created successfully!"
150
+ echo "📦 Output file: ${OUTPUT_NAME}"
151
+ echo "📍 Location: $(pwd)/dist/${OUTPUT_NAME}"
@@ -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', '9.2.0'
19
+ s.dependency 'PointrKit', '9.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/PTRCommand.ts CHANGED
@@ -8,6 +8,7 @@ export enum PTRCommandType {
8
8
  POI = "poi",
9
9
  PATH = "path",
10
10
  STATIC_PATH = "staticPath",
11
+ STATIC_WAYFINDING = "staticWayfinding",
11
12
  MARK_MY_CAR_LEVEL = "markMyCarForLevel",
12
13
  MARK_MY_CAR_SITE = "markMyCarForSite",
13
14
  SHOW_MY_CAR_SITE = "showMyCarForSite",
@@ -82,6 +83,18 @@ export class PTRStaticPathCommand extends PTRCommand {
82
83
  }
83
84
  }
84
85
 
86
+ /**
87
+ * Command to show static wayfinding using PTRMapWidgetStaticWayfindingAction
88
+ * @param site - the site that has the POIs
89
+ * @param sourcePoi - the source POI location to start the path from
90
+ * @param destinationPoi - the destination POI location to end the path at
91
+ */
92
+ export class PTRStaticWayfindingCommand extends PTRCommand {
93
+ constructor(public site: string, public sourcePoi: string, public destinationPoi: string) {
94
+ super(PTRCommandType.STATIC_WAYFINDING);
95
+ }
96
+ }
97
+
85
98
  /**
86
99
  * Command to show mark my car details
87
100
  * @param site - the site to show mark my car details
@@ -1,5 +1,5 @@
1
1
  import { UIManager } from 'react-native';
2
- import { PTRSiteCommand, PTRBuildingCommand, PTRLevelCommand, PTRPoiCommand, PTRPathCommand, PTRStaticPathCommand, PTRCommand, PTRCommandType, PTRMarkMyCarLevelCommand, PTRMarkMyCarSiteCommand, PTRShowMyCarSiteCommand, PTRStartAndFocusCommand } from 'react-native-pointr/src/PTRCommand';
2
+ import { PTRSiteCommand, PTRBuildingCommand, PTRLevelCommand, PTRPoiCommand, PTRPathCommand, PTRStaticPathCommand, PTRStaticWayfindingCommand, PTRCommand, PTRCommandType, PTRMarkMyCarLevelCommand, PTRMarkMyCarSiteCommand, PTRShowMyCarSiteCommand, PTRStartAndFocusCommand } from 'react-native-pointr/src/PTRCommand';
3
3
  /**
4
4
  * Handle PTRStartAndFocusCommand specifically
5
5
  * @param reactTag view tag of the map widget
@@ -153,6 +153,15 @@ export const showMapWidget = (reactTag: number, ptrCommand: PTRCommand | PTRStar
153
153
  );
154
154
  break;
155
155
  }
156
+ case PTRCommandType.STATIC_WAYFINDING: {
157
+ const staticWayfindingCommand = ptrCommand as PTRStaticWayfindingCommand;
158
+ UIManager.dispatchViewManagerCommand(
159
+ reactTag,
160
+ 'staticWayfinding',
161
+ [staticWayfindingCommand.site, staticWayfindingCommand.sourcePoi, staticWayfindingCommand.destinationPoi],
162
+ );
163
+ break;
164
+ }
156
165
  case PTRCommandType.MARK_MY_CAR_LEVEL: {
157
166
  const markMyCarCommand = ptrCommand as PTRMarkMyCarLevelCommand;
158
167
  UIManager.dispatchViewManagerCommand(
@@ -0,0 +1,20 @@
1
+ import { NativeModules } from 'react-native';
2
+ import { PTRPoi } from './types/PTRPoi';
3
+
4
+ const { PTRNativePointrLibrary } = NativeModules;
5
+
6
+ /**
7
+ * Get all Points of Interest (POIs) for a specific site
8
+ * @param siteId - The external identifier of the site
9
+ * @returns Promise that resolves with an array of POIs
10
+ * @throws Error if the site is not found or if the operation fails
11
+ */
12
+ export async function getPois(siteId: string): Promise<PTRPoi[]> {
13
+ try {
14
+ const pois = await PTRNativePointrLibrary.getPois(siteId);
15
+ return pois as PTRPoi[];
16
+ } catch (error) {
17
+ console.error('Failed to get POIs:', error);
18
+ throw error;
19
+ }
20
+ }
package/src/index.tsx CHANGED
@@ -17,4 +17,43 @@ const PTRNativePointrLibrary = NativeModules.PTRNativePointrLibrary
17
17
  }
18
18
  );
19
19
 
20
- module.exports = PTRNativePointrLibrary;
20
+ // Export the native library as default
21
+ export default PTRNativePointrLibrary;
22
+
23
+ // Export POI Manager functions
24
+ export { getPois } from './PTRPoiManager';
25
+
26
+ // Export Map Widget utilities
27
+ export { showMapWidget } from './PTRMapWidgetUtils';
28
+
29
+ // Export PTR Commands
30
+ export {
31
+ PTRCommandType,
32
+ PTRCommand,
33
+ PTRSiteCommand,
34
+ PTRBuildingCommand,
35
+ PTRLevelCommand,
36
+ PTRPoiCommand,
37
+ PTRPathCommand,
38
+ PTRStaticPathCommand,
39
+ PTRStaticWayfindingCommand,
40
+ PTRMarkMyCarLevelCommand,
41
+ PTRMarkMyCarSiteCommand,
42
+ PTRShowMyCarSiteCommand,
43
+ PTRStartAndFocusCommand,
44
+ } from './PTRCommand';
45
+
46
+ // Export types
47
+ export type { PTRPoi, PTRPoiAttributes } from './types/PTRPoi';
48
+ export type { PTRPosition } from './types/PTRPosition';
49
+ export type { PTRWayfindingEvent } from './types/PTRWayfindingEvent';
50
+ export type {
51
+ PTRGeometry,
52
+ PTRGeoPoint,
53
+ PTRGeoPolygon,
54
+ PTRGeoMultiPoint,
55
+ PTRGeoLineString,
56
+ PTRGeoMultiLineString,
57
+ PTRGeoMultiPolygon,
58
+ PTRGeoCircle,
59
+ } from './types/PTRGeometry';
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Base point with latitude and longitude
3
+ */
4
+ export interface PTRGeoPoint {
5
+ type: 'Point';
6
+ lat: number;
7
+ lon: number;
8
+ }
9
+
10
+ /**
11
+ * Polygon geometry with outer and inner rings
12
+ */
13
+ export interface PTRGeoPolygon {
14
+ type: 'Polygon';
15
+ outer: PTRGeoPoint[];
16
+ inners: PTRGeoPoint[][];
17
+ }
18
+
19
+ /**
20
+ * Multi-point geometry
21
+ */
22
+ export interface PTRGeoMultiPoint {
23
+ type: 'MultiPoint';
24
+ points: PTRGeoPoint[];
25
+ }
26
+
27
+ /**
28
+ * Line string geometry
29
+ */
30
+ export interface PTRGeoLineString {
31
+ type: 'LineString';
32
+ points: PTRGeoPoint[];
33
+ }
34
+
35
+ /**
36
+ * Multi-line string geometry
37
+ */
38
+ export interface PTRGeoMultiLineString {
39
+ type: 'MultiLineString';
40
+ lines: PTRGeoPoint[][];
41
+ }
42
+
43
+ /**
44
+ * Multi-polygon geometry
45
+ */
46
+ export interface PTRGeoMultiPolygon {
47
+ type: 'MultiPolygon';
48
+ polygons: PTRGeoPolygon[];
49
+ }
50
+
51
+ /**
52
+ * Circle geometry
53
+ */
54
+ export interface PTRGeoCircle {
55
+ type: 'Circle';
56
+ center: PTRGeoPoint;
57
+ radius: number;
58
+ }
59
+
60
+ /**
61
+ * Union of all supported geometry types
62
+ */
63
+ export type PTRGeometry =
64
+ | PTRGeoPoint
65
+ | PTRGeoPolygon
66
+ | PTRGeoMultiPoint
67
+ | PTRGeoLineString
68
+ | PTRGeoMultiLineString
69
+ | PTRGeoMultiPolygon
70
+ | PTRGeoCircle;
@@ -0,0 +1,49 @@
1
+ import { PTRPosition } from './PTRPosition';
2
+ import { PTRGeometry } from './PTRGeometry';
3
+
4
+ /**
5
+ * POI attributes containing additional metadata
6
+ */
7
+ export interface PTRPoiAttributes {
8
+ /** Logo URL */
9
+ logo?: string;
10
+
11
+ /** Array of image URLs */
12
+ images?: string[];
13
+
14
+ /** Description text */
15
+ description?: string;
16
+
17
+ /** Extra data as key-value pairs */
18
+ extra?: Record<string, any>;
19
+
20
+ /** Any other custom attributes */
21
+ [key: string]: any;
22
+ }
23
+
24
+ /**
25
+ * Point of Interest (POI) data structure
26
+ * Represents a feature from the Pointr SDK with location, geometry, and metadata
27
+ */
28
+ export interface PTRPoi {
29
+ /** Internal unique identifier */
30
+ identifier: string;
31
+
32
+ /** External identifier for API references */
33
+ externalIdentifier: string;
34
+
35
+ /** Display name of the POI */
36
+ name: string;
37
+
38
+ /** POI type code (e.g., "lobby", "room", "building-outline") */
39
+ typeCode: string;
40
+
41
+ /** Geographic position with site, building, and level information */
42
+ position: PTRPosition;
43
+
44
+ /** Geometry data (point, polygon, etc.) */
45
+ geometry: PTRGeometry;
46
+
47
+ /** Additional POI attributes and metadata */
48
+ attributes: PTRPoiAttributes;
49
+ }
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Geographic position with site, building, and level information
3
+ */
4
+ export interface PTRPosition {
5
+ /** Latitude */
6
+ lat: number;
7
+
8
+ /** Longitude */
9
+ lon: number;
10
+
11
+ /** Whether the position is valid */
12
+ isValid: boolean;
13
+
14
+ /** Site identifier */
15
+ sid: string;
16
+
17
+ /** Building identifier */
18
+ bid: string;
19
+
20
+ /** Level index */
21
+ lvl: number;
22
+ }
@@ -0,0 +1,18 @@
1
+ import { PTRPoi } from './PTRPoi';
2
+
3
+ /**
4
+ * Wayfinding event data structure
5
+ * Fired during wayfinding operations to track navigation state
6
+ */
7
+ export interface PTRWayfindingEvent {
8
+ /**
9
+ * Event type:
10
+ * -1 = Cancelled (user cancelled the navigation)
11
+ * 0 = Started (wayfinding navigation has started)
12
+ * 1 = Ended (user completed or closed the navigation)
13
+ */
14
+ type: number;
15
+
16
+ /** Destination Point of Interest */
17
+ poi: PTRPoi;
18
+ }