react-native-steerpath-smart-map 1.29.4 → 2.0.0-alpha.1

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 (107) hide show
  1. package/.eslintrc.js +66 -0
  2. package/.prettierrc +7 -0
  3. package/CHANGELOG.md +39 -0
  4. package/README.md +7 -0
  5. package/android/bin/src/main/java/com/steerpath/rnsmartmap/RNEventKeys.class +0 -0
  6. package/android/bin/src/main/java/com/steerpath/rnsmartmap/RNSmartGeofenceManager.class +0 -0
  7. package/android/bin/src/main/java/com/steerpath/rnsmartmap/RNSmartLocationManager.class +0 -0
  8. package/android/bin/src/main/java/com/steerpath/rnsmartmap/RNSmartMapManager.class +0 -0
  9. package/android/bin/src/main/java/com/steerpath/rnsmartmap/RNSmartMapModule.class +0 -0
  10. package/android/bin/src/main/java/com/steerpath/rnsmartmap/RNSmartMapPackage.class +0 -0
  11. package/android/bin/src/main/java/com/steerpath/rnsmartmap/RNSmartMapPackage.kt +28 -0
  12. package/android/bin/src/main/java/com/steerpath/rnsmartmap/RNSmartMapView.class +0 -0
  13. package/android/bin/src/main/java/com/steerpath/rnsmartmap/RNSmartMapViewManager.class +0 -0
  14. package/android/bin/src/main/java/com/steerpath/rnsmartmap/Utils.class +0 -0
  15. package/android/build.gradle +22 -33
  16. package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
  17. package/android/src/main/java/com/steerpath/rnsmartmap/RNSmartLocationManager.java +22 -14
  18. package/android/src/main/java/com/steerpath/rnsmartmap/RNSmartMapManager.java +9 -31
  19. package/android/src/main/java/com/steerpath/rnsmartmap/RNSmartMapPackage.java +11 -9
  20. package/android/src/main/java/com/steerpath/rnsmartmap/Utils.java +36 -36
  21. package/ios/RNSmartLocationManager.m +28 -3
  22. package/ios/RNSmartMapManager.m +10 -22
  23. package/lib/commonjs/SmartLocationManager.js +50 -0
  24. package/lib/commonjs/SmartLocationManager.js.map +1 -0
  25. package/lib/commonjs/SmartLocationManager.web.js +11 -0
  26. package/lib/commonjs/SmartLocationManager.web.js.map +1 -0
  27. package/lib/commonjs/SmartMapManager.js +59 -0
  28. package/lib/commonjs/SmartMapManager.js.map +1 -0
  29. package/lib/commonjs/SmartMapManager.web.js +24 -0
  30. package/lib/commonjs/SmartMapManager.web.js.map +1 -0
  31. package/lib/commonjs/index.js +28 -0
  32. package/lib/commonjs/index.js.map +1 -0
  33. package/lib/commonjs/package.json +1 -0
  34. package/lib/module/SmartLocationManager.js +46 -0
  35. package/lib/module/SmartLocationManager.js.map +1 -0
  36. package/lib/module/SmartLocationManager.web.js +7 -0
  37. package/lib/module/SmartLocationManager.web.js.map +1 -0
  38. package/lib/module/SmartMapManager.js +54 -0
  39. package/lib/module/SmartMapManager.js.map +1 -0
  40. package/lib/module/SmartMapManager.web.js +20 -0
  41. package/lib/module/SmartMapManager.web.js.map +1 -0
  42. package/lib/module/index.js +5 -0
  43. package/lib/module/index.js.map +1 -0
  44. package/lib/typescript/SmartLocationManager.d.ts +19 -0
  45. package/lib/typescript/SmartLocationManager.d.ts.map +1 -0
  46. package/{dist → lib/typescript}/SmartLocationManager.web.d.ts +1 -0
  47. package/lib/typescript/SmartLocationManager.web.d.ts.map +1 -0
  48. package/{dist → lib/typescript}/SmartMapManager.d.ts +13 -15
  49. package/lib/typescript/SmartMapManager.d.ts.map +1 -0
  50. package/lib/typescript/SmartMapManager.web.d.ts +8 -0
  51. package/lib/typescript/SmartMapManager.web.d.ts.map +1 -0
  52. package/lib/typescript/index.d.ts +5 -0
  53. package/lib/typescript/index.d.ts.map +1 -0
  54. package/package.json +38 -13
  55. package/react-native-steerpath-smart-map.podspec +15 -12
  56. package/src/SmartLocationManager.ts +25 -9
  57. package/src/SmartMapManager.ts +12 -19
  58. package/src/SmartMapManager.web.ts +3 -24
  59. package/src/index.ts +3 -4
  60. package/tsconfig.json +14 -9
  61. package/.eslintrc.json +0 -81
  62. package/android/src/main/java/com/steerpath/rnsmartmap/RNEventKeys.java +0 -29
  63. package/android/src/main/java/com/steerpath/rnsmartmap/RNSmartGeofenceManager.java +0 -103
  64. package/android/src/main/java/com/steerpath/rnsmartmap/RNSmartMapModule.java +0 -284
  65. package/android/src/main/java/com/steerpath/rnsmartmap/RNSmartMapView.java +0 -470
  66. package/android/src/main/java/com/steerpath/rnsmartmap/RNSmartMapViewManager.java +0 -307
  67. package/dist/SmartGeofenceManager.d.ts +0 -17
  68. package/dist/SmartGeofenceManager.js +0 -61
  69. package/dist/SmartGeofenceManager.web.d.ts +0 -9
  70. package/dist/SmartGeofenceManager.web.js +0 -10
  71. package/dist/SmartLocationManager.d.ts +0 -11
  72. package/dist/SmartLocationManager.js +0 -22
  73. package/dist/SmartLocationManager.web.js +0 -4
  74. package/dist/SmartMapEventManager.web.d.ts +0 -5
  75. package/dist/SmartMapEventManager.web.js +0 -10
  76. package/dist/SmartMapManager.js +0 -53
  77. package/dist/SmartMapManager.web.d.ts +0 -12
  78. package/dist/SmartMapManager.web.js +0 -33
  79. package/dist/SmartMapView.d.ts +0 -3
  80. package/dist/SmartMapView.js +0 -294
  81. package/dist/SmartMapView.web.d.ts +0 -3
  82. package/dist/SmartMapView.web.js +0 -270
  83. package/dist/SmartMapViewProps.d.ts +0 -267
  84. package/dist/SmartMapViewProps.js +0 -76
  85. package/dist/index.d.ts +0 -5
  86. package/dist/index.js +0 -5
  87. package/dist/internalUtils.d.ts +0 -1
  88. package/dist/internalUtils.js +0 -5
  89. package/ios/RCTConvert+SmartMapView.h +0 -35
  90. package/ios/RCTConvert+SmartMapView.m +0 -295
  91. package/ios/RNSmartGeofenceManager.h +0 -24
  92. package/ios/RNSmartGeofenceManager.m +0 -110
  93. package/ios/RNSmartMapUserTaskEventManager.h +0 -19
  94. package/ios/RNSmartMapUserTaskEventManager.m +0 -46
  95. package/ios/RNSmartMapView.h +0 -37
  96. package/ios/RNSmartMapView.m +0 -21
  97. package/ios/RNSmartMapViewManager.h +0 -27
  98. package/ios/RNSmartMapViewManager.m +0 -608
  99. package/package-lock.json +0 -6570
  100. package/src/SmartGeofenceManager.ts +0 -94
  101. package/src/SmartGeofenceManager.web.ts +0 -11
  102. package/src/SmartMapEventManager.web.ts +0 -13
  103. package/src/SmartMapView.tsx +0 -377
  104. package/src/SmartMapView.web.tsx +0 -342
  105. package/src/SmartMapViewProps.ts +0 -338
  106. package/src/internalUtils.ts +0 -5
  107. package/src/typings/steerpath-smart-sdk.d.ts +0 -5
@@ -1,342 +0,0 @@
1
- /* eslint-disable react/destructuring-assignment */
2
- import React, {
3
- useEffect,
4
- useImperativeHandle,
5
- useRef,
6
- forwardRef,
7
- } from "react";
8
- import { PixelRatio } from "react-native";
9
- import {
10
- SmartMapViewProps,
11
- SmartMapObject,
12
- SmartMapViewMethods,
13
- SmartMapUserTask,
14
- SmartMapPOISelectionUserTask,
15
- SmartMapCameraOptions,
16
- } from "./SmartMapViewProps";
17
- import { steerpath } from "steerpath-smart-sdk";
18
-
19
- //no longer needed as the steerpath is imported from node modules
20
- //instead of the window namespace
21
- //declare let window: any;
22
-
23
- const COMPONENT_ID_PREFIX = "map_container_id";
24
-
25
- // Implementation for the smart map reference
26
- interface SmartMapRef {
27
- removeMap: Function;
28
- getSmartMapCameraOptions: Function;
29
- }
30
-
31
- function runCommand<ArgsT extends Array<unknown>>(
32
- handler: SmartMapRef | null,
33
- name: string,
34
- args: ArgsT
35
- ) {
36
- handler?.[name](...args);
37
- }
38
-
39
- function convertToWebSDKSmartMapObj(smartMapObj: SmartMapObject) {
40
- return new steerpath.SmartMapObject(
41
- smartMapObj.latitude,
42
- smartMapObj.longitude,
43
- smartMapObj.floorIndex,
44
- smartMapObj.buildingRef,
45
- smartMapObj.localRef,
46
- smartMapObj.title,
47
- smartMapObj.properties
48
- );
49
- }
50
-
51
- function convertToWebUserTaskObj(userTask: SmartMapUserTask) {
52
- const addMarker = (userTask.payload as SmartMapPOISelectionUserTask)
53
- .shouldAddMarker;
54
- const actionButtonText = (userTask.payload as SmartMapPOISelectionUserTask)
55
- .actionButtonText;
56
- const actionButtonIcon = (userTask.payload as SmartMapPOISelectionUserTask)
57
- .actionButtonIcon;
58
- const smartMapObject = (userTask.payload as SmartMapPOISelectionUserTask)
59
- .smartMapObject;
60
- return new steerpath.POISelectionUserTask(
61
- smartMapObject,
62
- addMarker,
63
- actionButtonText,
64
- actionButtonIcon
65
- );
66
- }
67
-
68
- function parseJwtToken(token) {
69
- try {
70
- let base64Url = token.split(".")[1];
71
- let base64 = base64Url.replace("-", "+").replace("_", "/");
72
- return JSON.parse(window.atob(base64));
73
- } catch (e) {
74
- return null;
75
- } finally {
76
- }
77
- }
78
-
79
- export const SmartMapView = forwardRef<SmartMapViewMethods, SmartMapViewProps>(
80
- (props, ref) => {
81
- const smartMapRef = useRef<SmartMapRef>(null);
82
-
83
- useEffect(() => {
84
- let smartSDK = {};
85
-
86
- if (parseJwtToken(props.apiKey).hasOwnProperty("client_token")) {
87
- smartSDK = steerpath.sdk[parseJwtToken(props.apiKey).client_token];
88
- } else {
89
- if (props.apiKey) {
90
- smartSDK = steerpath.sdk[props.apiKey];
91
- }
92
- }
93
- // Allow setting the ref
94
- // @ts-ignore
95
- smartMapRef.current = new steerpath.SmartMapView(
96
- COMPONENT_ID_PREFIX,
97
- smartSDK
98
- );
99
- const events = [
100
- {
101
- sdk: "onMapClick",
102
- binding: "onMapClicked",
103
- },
104
- {
105
- sdk: "onSearchResultSelected",
106
- binding: "onSearchResultSelected",
107
- },
108
- {
109
- sdk: "steerpathLayerIndexChanged",
110
- binding: "onVisibleFloorChanged",
111
- },
112
- {
113
- sdk: "steerpathMapLoaded",
114
- binding: "onMapLoaded",
115
- },
116
- {
117
- sdk: "onSearchCategorySelected",
118
- binding: "onSearchCategorySelected",
119
- },
120
- ];
121
- //add map event listeners ("on")
122
- events.forEach((event) => {
123
- if (props[event.binding]) {
124
- steerpath.MapEventListener.on(event.sdk, props[event.binding]);
125
- }
126
- });
127
-
128
- //also add user task listener
129
- steerpath.UserTaskListener.on(
130
- "onUserTaskResponse",
131
- props.onUserTaskResponse
132
- );
133
-
134
- return () => {
135
- //remove map event listeners ("off")
136
- events.forEach((event) => {
137
- if (props[event.binding]) {
138
- steerpath.MapEventListener.off(event.sdk, props[event.binding]);
139
- }
140
- });
141
-
142
- //also remove user task listener
143
- steerpath.UserTaskListener.off(
144
- "onUserTaskResponse",
145
- props.onUserTaskResponse
146
- );
147
-
148
- //When screen size changes and this component unmounted
149
- //remove the old instance of smartMapRef.current
150
- if (smartMapRef.current) {
151
- smartMapRef.current?.removeMap();
152
- }
153
- };
154
- }, [props.apiKey]);
155
-
156
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
157
- useImperativeHandle(ref, () => ({
158
- setCamera({
159
- latitude,
160
- longitude,
161
- zoomLevel,
162
- bearing,
163
- pitch,
164
- floorIndex,
165
- buildingRef,
166
- }) {
167
- runCommand(smartMapRef.current, "setCamera", [
168
- latitude,
169
- longitude,
170
- zoomLevel,
171
- bearing,
172
- pitch,
173
- floorIndex,
174
- buildingRef,
175
- ]);
176
- },
177
- setCameraToBuildingRef(buildingRef, callback) {
178
- runCommand(smartMapRef.current, "setCameraToBuilding", [
179
- buildingRef,
180
- 18,
181
- callback,
182
- ]);
183
- },
184
- setCameraToObject(localRef, buildingRef, zoomLevel, callback) {
185
- runCommand(smartMapRef.current, "setCameraToObject", [
186
- localRef,
187
- buildingRef,
188
- zoomLevel,
189
- callback,
190
- ]);
191
- },
192
-
193
- addMarker(smartMapObj, layout, iconName, textColor, textHaloColor) {
194
- runCommand(smartMapRef.current, "addMarker", [
195
- convertToWebSDKSmartMapObj(smartMapObj),
196
- layout,
197
- iconName || "category_marker",
198
- textColor,
199
- textHaloColor,
200
- ]);
201
- },
202
- addMarkers(mapObjectsArray, layout, iconName, textColor, textHaloColor) {
203
- mapObjectsArray = mapObjectsArray.map((smartMapObject) => {
204
- return convertToWebSDKSmartMapObj(smartMapObject);
205
- });
206
- runCommand(smartMapRef.current, "addMarkers", [
207
- mapObjectsArray,
208
- layout,
209
- iconName || "category_marker",
210
- textColor,
211
- textHaloColor,
212
- ]);
213
- },
214
- removeMarker(smartMapObj) {
215
- runCommand(smartMapRef.current, "removeMarker", [
216
- convertToWebSDKSmartMapObj(smartMapObj),
217
- ]);
218
- },
219
- removeMarkers(mapObjectsArray) {
220
- mapObjectsArray = mapObjectsArray.map((smartMapObject) => {
221
- return convertToWebSDKSmartMapObj(smartMapObject);
222
- });
223
- runCommand(smartMapRef.current, "removeMarkers", [mapObjectsArray]);
224
- },
225
- removeAllMarkers() {
226
- runCommand(smartMapRef.current, "removeAllMarkers", []);
227
- },
228
- animateCamera({
229
- latitude,
230
- longitude,
231
- zoomLevel,
232
- bearing,
233
- pitch,
234
- floorIndex,
235
- buildingRef,
236
- }) {
237
- runCommand(smartMapRef.current, "animateCamera", [
238
- latitude,
239
- longitude,
240
- zoomLevel,
241
- bearing,
242
- pitch,
243
- floorIndex,
244
- buildingRef,
245
- ]);
246
- },
247
- animateCameraToBuildingRef(buildingRef, callback) {
248
- runCommand(smartMapRef.current, "animateCameraToBuilding", [
249
- buildingRef,
250
- 18,
251
- callback,
252
- ]);
253
- },
254
- animateCameraToObject(localRef, buildingRef, zoomLevel, callback) {
255
- runCommand(smartMapRef.current, "animateCameraToObject", [
256
- localRef,
257
- buildingRef,
258
- zoomLevel,
259
- callback,
260
- ]);
261
- },
262
- setMapMode(mapMode) {
263
- runCommand(smartMapRef.current, "setMapMode", [mapMode]);
264
- },
265
- startUserTask(userTask: SmartMapUserTask) {
266
- // TODO: roope fixes
267
- runCommand(smartMapRef.current, "startUserTask", [
268
- convertToWebUserTaskObj(userTask),
269
- ]);
270
- },
271
- getCurrentUserTask() {
272
- //TODO: does not return current task
273
- return runCommand(smartMapRef.current, "getCurrentUserTask", []);
274
- },
275
- cancelCurrentUserTask() {
276
- runCommand(smartMapRef.current, "cancelCurrentUserTask", []);
277
- },
278
- selectMapObject(smartMapObj: SmartMapObject) {
279
- const localRef = smartMapObj.localRef;
280
- const buildingRef = smartMapObj.buildingRef;
281
- runCommand(smartMapRef.current, "selectMapObject", [
282
- localRef,
283
- buildingRef,
284
- ]);
285
- },
286
- getMapObject(localRef, buildingRef, source, callback) {
287
- runCommand(smartMapRef.current, "getMapObject", [
288
- localRef,
289
- buildingRef,
290
- source,
291
- callback,
292
- ]);
293
- },
294
- getMapObjectByProperties(properties, callback) {
295
- runCommand(smartMapRef.current, "getMapObjectByProperties", [
296
- properties,
297
- callback,
298
- ]);
299
- },
300
- onBackPressed() {
301
- // Web doesn't have this implementation
302
- },
303
- start() {
304
- // No web implementation
305
- },
306
- stop() {
307
- // No web implementation
308
- },
309
- getWidgetPadding() {
310
- // TODO: add correct callback to getWidgetPadding on web
311
- return runCommand(smartMapRef.current, "getWidgetPadding", []);
312
- },
313
- resetWidgetPadding() {
314
- runCommand(smartMapRef.current, "resetWidgetPadding", []);
315
- },
316
- setWidgetPadding(left, top, right, bottom) {
317
- runCommand(smartMapRef.current, "setWidgetPadding", [
318
- PixelRatio.getPixelSizeForLayoutSize(left || 0),
319
- PixelRatio.getPixelSizeForLayoutSize(top || 0),
320
- PixelRatio.getPixelSizeForLayoutSize(right || 0),
321
- PixelRatio.getPixelSizeForLayoutSize(bottom || 0),
322
- ]);
323
- },
324
- setGeoJson(sourceId, geoJson, callback) {
325
- runCommand(smartMapRef.current, "setGeoJson", [
326
- sourceId,
327
- geoJson,
328
- callback,
329
- ]);
330
- },
331
- getSmartMapCameraOptions(callback) {
332
- const smartMapCameraOptions: SmartMapCameraOptions = smartMapRef.current ? smartMapRef.current.getSmartMapCameraOptions() : null
333
- if (smartMapCameraOptions) callback(smartMapCameraOptions)
334
- },
335
- stopLive() {
336
- runCommand(smartMapRef.current, "stopLive", []);
337
- },
338
- }));
339
-
340
- return <div id={COMPONENT_ID_PREFIX} style={{ flex: 1, height: "100%" }} />;
341
- }
342
- );
@@ -1,338 +0,0 @@
1
- import { ViewProperties } from "react-native";
2
-
3
- export interface ConfigSDK {
4
- apiKey: string;
5
- configFilePath?: string | null;
6
- configString?: string | null;
7
- }
8
-
9
- export interface SmartMapViewMethods {
10
- addMarker(
11
- smartMapObj: SmartMapObject,
12
- layout: Layout | null,
13
- iconName: string | null,
14
- textColor: string | null,
15
- textHaloColor: string | null
16
- ): void;
17
- addMarkers(
18
- mapObjectsArray: SmartMapObject[],
19
- layout: Layout | null,
20
- iconName: string | null,
21
- textColor: string | null,
22
- textHaloColor: string | null
23
- ): void;
24
- animateCamera(arg: {
25
- latitude: number;
26
- longitude: number;
27
- zoomLevel: number;
28
- bearing?: number;
29
- pitch?: number;
30
- floorIndex?: number;
31
- buildingRef?: string;
32
- }): void;
33
- animateCameraToBuildingRef(
34
- buildingRef: string,
35
- callback: (response: MapResponse) => void
36
- ): void;
37
- animateCameraToObject(
38
- localRef: string,
39
- buildingRef: string,
40
- zoomLevel: number | null,
41
- callback: (response: MapResponse) => void
42
- ): void;
43
- cancelCurrentUserTask(): void;
44
- getCurrentUserTask(
45
- callback: (userTaskResponse: SmartMapUserTaskResponse) => void
46
- ): void;
47
- getMapObject(
48
- localRef: string,
49
- buildingRef: string,
50
- source: SmartObjectSource,
51
- callback: (mapObject: SmartMapObject | null) => void
52
- ): void;
53
- getMapObjectByProperties(
54
- properties: Record<string, unknown>,
55
- callback: (mapObject: SmartMapObject | null) => void
56
- ): void;
57
- getWidgetPadding(
58
- callback: (padding: {
59
- left: number;
60
- top: number;
61
- right: number;
62
- bottom: number;
63
- }) => void
64
- ): void;
65
- onBackPressed(callback: (response: boolean) => void): void; // Android only
66
- removeMarker(smartMapObj: SmartMapObject): void;
67
- removeMarkers(mapObjectsArray: SmartMapObject[]): void;
68
- removeAllMarkers(): void;
69
- selectMapObject(mapObj: SmartMapObject): void;
70
- setCamera(arg: {
71
- latitude: number;
72
- longitude: number;
73
- zoomLevel: number;
74
- bearing?: number;
75
- pitch?: number;
76
- floorIndex?: number;
77
- buildingRef?: string;
78
- }): void;
79
- setCameraToBuildingRef(
80
- buildingRef: string,
81
- callback: (response: MapResponse) => void
82
- ): void;
83
- setCameraToObject(
84
- localRef: string,
85
- buildingRef: string,
86
- zoomLevel: number,
87
- callback: (response: MapResponse) => void
88
- ): void;
89
- setGeoJson(
90
- sourceId: string,
91
- geoJson: Record<string, unknown> | null,
92
- callback: (response: MapResponse) => void
93
- ): void;
94
- setMapMode(mapMode: SmartMapMode): void;
95
- setWidgetPadding(
96
- left: number,
97
- top: number,
98
- right: number,
99
- bottom: number
100
- ): void;
101
- start(): void; // Android only
102
- startUserTask(userTask: SmartMapUserTask): void;
103
- stop(): void; // Android only
104
- getSmartMapCameraOptions(callback: (options: SmartMapCameraOptions) => void): void;
105
- }
106
-
107
- export enum SmartMapMode {
108
- MAP_ONLY = "mapOnly",
109
- STATIC = "static",
110
- SEARCH = "search",
111
- }
112
-
113
- export enum SmartObjectSource {
114
- STATIC = "STATIC",
115
- MARKER = "MARKER",
116
- LIVE = "LIVE",
117
- }
118
-
119
- export enum Layout {
120
- TOP = "top",
121
- BOTTOM = "bottom",
122
- LEFT = "left",
123
- RIGHT = "right",
124
- }
125
-
126
- export enum MapResponse {
127
- SUCCESS = "success",
128
- OBJECT_NOT_FOUND = "objectNotFound",
129
- NETWORK_ERROR = "networkError",
130
- NOT_SUPPORTED = "notSupported",
131
- }
132
-
133
- export enum SmartGeofenceResponse {
134
- SUCCESS = "success",
135
- MALFORMED_DATA = "malformedData",
136
- NOT_FOUND = "notFound",
137
- }
138
-
139
- export enum SmartMapEvent {
140
- MAP_LOADED = "SPSmartMapLoaded",
141
- MAP_CLICKED = "SPSmartMapClicked",
142
- SEARCH_RESULT_SELECTED = "SPSearchResultSelected",
143
- }
144
-
145
- export enum SmartMapViewStatus {
146
- ONLY_MAP = "onlyMap",
147
- CARD_VIEW = "cardView",
148
- ERROR_VIEW = "errorView",
149
- SETTING_VIEW = "settingView",
150
- NAVIGATING_VIEW = "navigatingView",
151
- SEARCH_VIEW = "searchView",
152
- }
153
-
154
- export enum SmartBottomSheetState {
155
- HIDDEN = "hidden",
156
- COLLAPSED = "collapsed",
157
- HALF_EXPANDED = "halfExpanded",
158
- EXPANDED = "expanded",
159
- }
160
-
161
- export enum NavigationError {
162
- OBJECT_NOT_FOUND = "objectNotFound",
163
- ROUTE_NOT_FOUND = "routeNotFound",
164
- USER_LOCATION_NOT_FOUND = "userLocationNotFound",
165
- }
166
-
167
- export enum SmartMapUserTaskResponse {
168
- STARTED = "started",
169
- CANCELLED = "cancelled",
170
- ERROR = "error",
171
- BUSY = "busy",
172
- UNSUPPORTED = "unsupported",
173
- COMPLETED = "completed",
174
- }
175
- export interface LinkProperty {
176
- title: string;
177
- url: string;
178
- };
179
-
180
- export interface ImageProperty {
181
- title: string;
182
- url: string;
183
- };
184
-
185
- export type BookingIntegration = {
186
- integrationType: string;
187
- integrationRef: string;
188
- }
189
- export type OccupancyIntegrations = BookingIntegration;
190
-
191
- export interface SmartMapObjectProperties {
192
- amenities?: string[];
193
- bookingIntegrations?: BookingIntegration[];
194
- occupancyIntegrations?: OccupancyIntegrations[];
195
- buildingRef: string;
196
- calendarRef?: string;
197
- capacity?: number;
198
- cateringEmail?: string;
199
- css_class: string;
200
- description?: string;
201
- 'description:fi'?: string;
202
- 'description:nb'?: string;
203
- 'description:sv'?: string;
204
- 'description:en'?: string;
205
- images?: ImageProperty[];
206
- 'images:fi'?: ImageProperty[];
207
- 'images:sv'?: ImageProperty[];
208
- 'images:nb'?: ImageProperty[];
209
- 'images:en'?: ImageProperty[];
210
- integrationRef?: string;
211
- keywords?: string[];
212
- 'keywords:fi'?: string[];
213
- 'keywords:sv'?: string[];
214
- 'keywords:nb'?: string[];
215
- 'keywords:en'?: string[];
216
- layerIndex: number;
217
- links?: LinkProperty[];
218
- 'links:fi'?: LinkProperty[];
219
- 'links:sv'?: LinkProperty[];
220
- 'links:nb'?: LinkProperty[];
221
- 'links:en'?: LinkProperty[];
222
- localRef?: string;
223
- occupancy?: string;
224
- parentRef?: string;
225
- resourceType?: string;
226
- sp_maximum_advance_booking_hours_normal_user?: number;
227
- sp_maximum_booking_hours_normal_user?: number;
228
- sp_maximum_advance_booking_hours_power_user?: number;
229
- sp_maximum_booking_hours_power_user?: number;
230
- subType?: string;
231
- tags?: string[];
232
- title: string;
233
- 'title:fi'?: string;
234
- 'title:sv'?: string;
235
- 'title:nb'?: string;
236
- 'title:en'?: string;
237
- weekPlannerCapacity?: number;
238
- externalFeedbackUrl?: string;
239
- [key: string]: any; // Probably not the best practice, but this way we can get the access to properties that are not typed above.
240
- }
241
-
242
- export interface SmartMapObject {
243
- latitude: number;
244
- longitude: number;
245
- floorIndex: number;
246
- localRef: string;
247
- buildingRef: string;
248
- title: string;
249
- properties: SmartMapObjectProperties,
250
- source: SmartObjectSource;
251
- }
252
-
253
- export interface SmartViewWebProps {
254
- apiKey?: string;
255
- }
256
-
257
- export interface SearchAction {
258
- title: string;
259
- shortTitle: string;
260
- description: string;
261
- iconName: string;
262
- action: {
263
- allTags?: string[];
264
- anyTags?: string[];
265
- type: string;
266
- }
267
- }
268
-
269
- export interface SmartViewNativeProps {
270
- onBottomSheetStateChanged?: (payload: {
271
- state: SmartBottomSheetState;
272
- }) => void;
273
- onMapClicked?: (payload: { mapObjects: SmartMapObject[] }) => void;
274
- onNavigationDestinationReached?: () => void;
275
- onNavigationEnded?: () => void;
276
- onNavigationFailed?: (payload: { error: NavigationError }) => void;
277
- onNavigationPreviewAppeared?: () => void;
278
- onNavigationStarted?: () => void;
279
- onSearchCategorySelected?: (payload: {
280
- searchAction: SearchAction;
281
- searchResults: SmartMapObject[];
282
- }) => void;
283
- onSearchResultSelected?: (payload: { mapObject: SmartMapObject }) => void;
284
- onUserFloorChanged?: (payload: {
285
- floorIndex: number;
286
- buildingRef?: string;
287
- }) => void;
288
- onUserTaskResponse?: (payload: {
289
- response: SmartMapUserTaskResponse;
290
- userTask: SmartMapUserTask;
291
- }) => void;
292
- onViewStatusChanged?: (payload: {
293
- status: SmartMapViewStatus;
294
- poiDetail: SmartMapObject;
295
- }) => void;
296
- onVisibleFloorChanged?: (payload: {
297
- floorIndex: number;
298
- buildingRef?: string;
299
- }) => void;
300
- }
301
-
302
- export interface SmartMapViewProps
303
- extends ViewProperties,
304
- SmartViewWebProps,
305
- SmartViewNativeProps {
306
- /**
307
- * This is a quick hack for enabling typed ref
308
- */
309
- ref?: any;
310
- onMapLoaded?: () => void;
311
- }
312
-
313
- export type SmartMapNavigationUserTask = SmartMapObject;
314
-
315
- export interface SmartMapPOISelectionUserTask {
316
- shouldAddMarker: boolean;
317
- actionButtonText: string;
318
- actionButtonIcon: string;
319
- smartMapObject: SmartMapObject;
320
- }
321
-
322
- export enum SmartMapUserTaskType {
323
- NAVIGATION = "navigation",
324
- POI_SELECTION = "poiSelection",
325
- }
326
-
327
- export interface SmartMapUserTask {
328
- type: SmartMapUserTaskType;
329
- payload: SmartMapNavigationUserTask | SmartMapPOISelectionUserTask;
330
- }
331
-
332
- export interface SmartMapCameraOptions {
333
- pitch: number;
334
- bearing: number;
335
- zoomLevel: number;
336
- latitude: number;
337
- longitude: number;
338
- }
@@ -1,5 +0,0 @@
1
- import { PixelRatio } from "react-native";
2
- export function convertNativePixelToDp(input: number) {
3
- const ratio = PixelRatio.get();
4
- return input / ratio;
5
- }
@@ -1,5 +0,0 @@
1
- // Included the typing of steerpath-smart-sdk
2
- // the typeRoots in tsconfig.json
3
- declare module 'steerpath-smart-sdk' {
4
- export const steerpath: any;
5
- }