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.
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 +6 -4
  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
@@ -1,275 +0,0 @@
1
- /**
2
- * Command pattern implementation for Pointr SDK
3
- * Commands are immutable objects that represent actions to perform on the map
4
- * @module commands
5
- */
6
-
7
- import { PTRCommandType } from '../constants';
8
-
9
- /**
10
- * Base class for all Pointr SDK commands
11
- */
12
- export abstract class PTRCommand {
13
- readonly type: PTRCommandType;
14
-
15
- constructor(type: PTRCommandType) {
16
- this.type = type;
17
- }
18
- }
19
-
20
- /**
21
- * Command to show a site on the map
22
- */
23
- export class PTRSiteCommand extends PTRCommand {
24
- readonly site: string;
25
-
26
- constructor(site: string) {
27
- super(PTRCommandType.SITE);
28
- this.site = site;
29
- }
30
- }
31
-
32
- /**
33
- * Command to show a building on the map
34
- */
35
- export class PTRBuildingCommand extends PTRCommand {
36
- readonly site: string;
37
- readonly building: string;
38
-
39
- constructor(site: string, building: string) {
40
- super(PTRCommandType.BUILDING);
41
- this.site = site;
42
- this.building = building;
43
- }
44
- }
45
-
46
- /**
47
- * Command to show a specific level of a building
48
- */
49
- export class PTRLevelCommand extends PTRCommand {
50
- readonly site: string;
51
- readonly building: string;
52
- readonly level: number;
53
-
54
- constructor(site: string, building: string, level: number) {
55
- super(PTRCommandType.LEVEL);
56
- this.site = site;
57
- this.building = building;
58
- this.level = level;
59
- }
60
- }
61
-
62
- /**
63
- * Command to show a Point of Interest on the map
64
- */
65
- export class PTRPoiCommand extends PTRCommand {
66
- readonly site: string;
67
- readonly poi: string;
68
-
69
- constructor(site: string, poi: string) {
70
- super(PTRCommandType.POI);
71
- this.site = site;
72
- this.poi = poi;
73
- }
74
- }
75
-
76
- /**
77
- * Command to show a navigation path to a POI from current location
78
- */
79
- export class PTRPathCommand extends PTRCommand {
80
- readonly site: string;
81
- readonly poi: string;
82
-
83
- constructor(site: string, poi: string) {
84
- super(PTRCommandType.PATH);
85
- this.site = site;
86
- this.poi = poi;
87
- }
88
- }
89
-
90
- /**
91
- * Command to show a static path between two POIs
92
- */
93
- export class PTRStaticPathCommand extends PTRCommand {
94
- readonly site: string;
95
- readonly fromPoi: string;
96
- readonly toPoi: string;
97
-
98
- constructor(site: string, fromPoi: string, toPoi: string) {
99
- super(PTRCommandType.STATIC_PATH);
100
- this.site = site;
101
- this.fromPoi = fromPoi;
102
- this.toPoi = toPoi;
103
- }
104
- }
105
-
106
- /**
107
- * Command to show static wayfinding between two POIs
108
- */
109
- export class PTRStaticWayfindingCommand extends PTRCommand {
110
- readonly site: string;
111
- readonly sourcePoi: string;
112
- readonly destinationPoi: string;
113
-
114
- constructor(site: string, sourcePoi: string, destinationPoi: string) {
115
- super(PTRCommandType.STATIC_WAYFINDING);
116
- this.site = site;
117
- this.sourcePoi = sourcePoi;
118
- this.destinationPoi = destinationPoi;
119
- }
120
- }
121
-
122
- /**
123
- * Command to mark car location at a specific level
124
- */
125
- export class PTRMarkMyCarLevelCommand extends PTRCommand {
126
- readonly site: string;
127
- readonly building: string;
128
- readonly level: number;
129
- readonly shouldShowPopup: boolean;
130
- readonly animationType: number;
131
-
132
- constructor(
133
- site: string,
134
- building: string,
135
- level: number,
136
- shouldShowPopup: boolean = true,
137
- animationType: number = 1
138
- ) {
139
- super(PTRCommandType.MARK_MY_CAR_LEVEL);
140
- this.site = site;
141
- this.building = building;
142
- this.level = level;
143
- this.shouldShowPopup = shouldShowPopup;
144
- this.animationType = animationType;
145
- }
146
- }
147
-
148
- /**
149
- * Command to mark car location at a site
150
- */
151
- export class PTRMarkMyCarSiteCommand extends PTRCommand {
152
- readonly site: string;
153
- readonly shouldShowPopup: boolean;
154
- readonly animationType: number;
155
-
156
- constructor(
157
- site: string,
158
- shouldShowPopup: boolean = true,
159
- animationType: number = 1
160
- ) {
161
- super(PTRCommandType.MARK_MY_CAR_SITE);
162
- this.site = site;
163
- this.shouldShowPopup = shouldShowPopup;
164
- this.animationType = animationType;
165
- }
166
- }
167
-
168
- /**
169
- * Command to show marked car location at a site
170
- */
171
- export class PTRShowMyCarSiteCommand extends PTRCommand {
172
- readonly site: string;
173
- readonly shouldShowPopup: boolean;
174
- readonly animationType: number;
175
-
176
- constructor(
177
- site: string,
178
- shouldShowPopup: boolean = true,
179
- animationType: number = 1
180
- ) {
181
- super(PTRCommandType.SHOW_MY_CAR_SITE);
182
- this.site = site;
183
- this.shouldShowPopup = shouldShowPopup;
184
- this.animationType = animationType;
185
- }
186
- }
187
-
188
- /**
189
- * Command to start the SDK and focus on a specific location
190
- * This is a special command that combines initialization with navigation
191
- */
192
- export class PTRStartAndFocusCommand {
193
- readonly clientId: string;
194
- readonly licenseKey: string;
195
- readonly baseUrl: string;
196
- readonly logLevel: number;
197
- readonly command:
198
- | PTRSiteCommand
199
- | PTRBuildingCommand
200
- | PTRLevelCommand
201
- | PTRPoiCommand;
202
-
203
- constructor(
204
- clientId: string,
205
- licenseKey: string,
206
- baseUrl: string,
207
- logLevel: number = 4,
208
- command:
209
- | PTRSiteCommand
210
- | PTRBuildingCommand
211
- | PTRLevelCommand
212
- | PTRPoiCommand
213
- ) {
214
- this.clientId = clientId;
215
- this.licenseKey = licenseKey;
216
- this.baseUrl = baseUrl;
217
- this.logLevel = logLevel;
218
- this.command = command;
219
- }
220
- }
221
-
222
- /**
223
- * Type guard to check if a command is a PTRSiteCommand
224
- */
225
- export function isPTRSiteCommand(
226
- command: PTRCommand
227
- ): command is PTRSiteCommand {
228
- return command.type === PTRCommandType.SITE;
229
- }
230
-
231
- /**
232
- * Type guard to check if a command is a PTRBuildingCommand
233
- */
234
- export function isPTRBuildingCommand(
235
- command: PTRCommand
236
- ): command is PTRBuildingCommand {
237
- return command.type === PTRCommandType.BUILDING;
238
- }
239
-
240
- /**
241
- * Type guard to check if a command is a PTRLevelCommand
242
- */
243
- export function isPTRLevelCommand(
244
- command: PTRCommand
245
- ): command is PTRLevelCommand {
246
- return command.type === PTRCommandType.LEVEL;
247
- }
248
-
249
- /**
250
- * Type guard to check if a command is a PTRPoiCommand
251
- */
252
- export function isPTRPoiCommand(
253
- command: PTRCommand
254
- ): command is PTRPoiCommand {
255
- return command.type === PTRCommandType.POI;
256
- }
257
-
258
- /**
259
- * Type guard to check if a command is a PTRPathCommand
260
- */
261
- export function isPTRPathCommand(
262
- command: PTRCommand
263
- ): command is PTRPathCommand {
264
- return command.type === PTRCommandType.PATH;
265
- }
266
-
267
- /**
268
- * Type guard to check if a command is a PTRStaticPathCommand
269
- */
270
- export function isPTRStaticPathCommand(
271
- command: PTRCommand
272
- ): command is PTRStaticPathCommand {
273
- return command.type === PTRCommandType.STATIC_PATH;
274
- }
275
-