@situm/react-native 3.15.0-beta.2 → 3.15.0-beta.3

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 (49) hide show
  1. package/lib/commonjs/index.js +73 -0
  2. package/lib/commonjs/sdk/index.js +931 -0
  3. package/lib/commonjs/sdk/internaDelegatedState.js +48 -0
  4. package/lib/commonjs/sdk/nativeInterface.js +20 -0
  5. package/lib/commonjs/sdk/types/constants.js +73 -0
  6. package/lib/commonjs/sdk/types/index.js +414 -0
  7. package/lib/commonjs/sdk/utils.js +156 -0
  8. package/lib/commonjs/utils/index.js +17 -0
  9. package/lib/commonjs/utils/logError.js +21 -0
  10. package/lib/commonjs/wayfinding/components/MapView.js +389 -0
  11. package/lib/commonjs/wayfinding/components/MapView.js.map +1 -0
  12. package/lib/commonjs/wayfinding/hooks/index.js +233 -0
  13. package/lib/commonjs/wayfinding/hooks/index.js.map +1 -0
  14. package/lib/commonjs/wayfinding/index.js +57 -0
  15. package/lib/commonjs/wayfinding/store/index.js +247 -0
  16. package/lib/commonjs/wayfinding/store/index.js.map +1 -0
  17. package/lib/commonjs/wayfinding/store/utils.js +49 -0
  18. package/lib/commonjs/wayfinding/store/utils.js.map +1 -0
  19. package/lib/commonjs/wayfinding/types/constants.js +13 -0
  20. package/lib/commonjs/wayfinding/types/constants.js.map +1 -0
  21. package/lib/commonjs/wayfinding/types/index.js +6 -0
  22. package/lib/commonjs/wayfinding/utils/index.js +12 -0
  23. package/lib/commonjs/wayfinding/utils/mapper.js +204 -0
  24. package/lib/module/index.js +14 -0
  25. package/lib/module/sdk/index.js +904 -0
  26. package/lib/module/sdk/index.js.map +1 -0
  27. package/lib/module/sdk/internaDelegatedState.js +43 -0
  28. package/lib/module/sdk/nativeInterface.js +20 -0
  29. package/lib/module/sdk/types/constants.js +70 -0
  30. package/lib/module/sdk/types/index.js +445 -0
  31. package/lib/module/sdk/utils.js +146 -0
  32. package/lib/module/utils/index.js +4 -0
  33. package/lib/module/utils/logError.js +17 -0
  34. package/lib/module/utils/logError.js.map +1 -0
  35. package/lib/module/wayfinding/components/MapView.js +381 -0
  36. package/lib/module/wayfinding/components/MapView.js.map +1 -0
  37. package/lib/module/wayfinding/hooks/index.js +226 -0
  38. package/lib/module/wayfinding/hooks/index.js.map +1 -0
  39. package/lib/module/wayfinding/index.js +15 -0
  40. package/lib/module/wayfinding/store/index.js +213 -0
  41. package/lib/module/wayfinding/store/index.js.map +1 -0
  42. package/lib/module/wayfinding/store/utils.js +40 -0
  43. package/lib/module/wayfinding/store/utils.js.map +1 -0
  44. package/lib/module/wayfinding/types/constants.js +9 -0
  45. package/lib/module/wayfinding/types/index.js +4 -0
  46. package/lib/module/wayfinding/types/index.js.map +1 -0
  47. package/lib/module/wayfinding/utils/index.js +7 -0
  48. package/lib/module/wayfinding/utils/mapper.js +195 -0
  49. package/package.json +3 -3
@@ -0,0 +1,204 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = exports.createPoint = exports.createNavigationRequest = exports.createDirectionsRequest = exports.createDirectionsMessage = void 0;
7
+ var _sdk = require("../../sdk");
8
+ /* eslint-disable @typescript-eslint/no-explicit-any */
9
+
10
+ const createPoint = payload => {
11
+ return {
12
+ buildingIdentifier: payload.buildingIdentifier,
13
+ floorIdentifier: payload.floorIdentifier,
14
+ cartesianCoordinate: payload.cartesianCoordinate,
15
+ coordinate: payload.coordinate
16
+ };
17
+ };
18
+ exports.createPoint = createPoint;
19
+ const createDirectionsMessage = payload => {
20
+ return {
21
+ buildingIdentifier: payload.buildingIdentifier,
22
+ originIdentifier: (payload.originIdentifier || -1).toString(),
23
+ originCategory: payload.originCategory,
24
+ destinationIdentifier: (payload.destinationIdentifier || -1).toString(),
25
+ destinationCategory: payload.destinationCategory,
26
+ identifier: (payload.identifier || "").toString()
27
+ };
28
+ };
29
+ exports.createDirectionsMessage = createDirectionsMessage;
30
+ const createDirectionsRequest = payload => {
31
+ return {
32
+ buildingIdentifier: payload.from.buildingIdentifier,
33
+ to: createPoint(payload.to),
34
+ from: createPoint(payload.from),
35
+ bearingFrom: payload.bearingFrom?.radians || 0,
36
+ accessibilityMode: payload.accessibilityMode || _sdk.AccessibilityMode.CHOOSE_SHORTEST,
37
+ minimizeFloorChanges: payload.minimizeFloorChanges || false,
38
+ includedTags: payload.includedTags || [],
39
+ excludedTags: payload.excludedTags || []
40
+ };
41
+ };
42
+ exports.createDirectionsRequest = createDirectionsRequest;
43
+ const createNavigationRequest = payload => {
44
+ const navigationRequest = {
45
+ distanceToGoalThreshold: payload.distanceToGoalThreshold,
46
+ outsideRouteThreshold: payload.outsideRouteThreshold,
47
+ distanceToIgnoreFirstIndication: payload.distanceToIgnoreFirstIndication,
48
+ distanceToFloorChangeThreshold: payload.distanceToFloorChangeThreshold,
49
+ distanceToChangeIndicationThreshold: payload.distanceToChangeIndicationThreshold,
50
+ indicationsInterval: payload.indicationsInterval,
51
+ timeToFirstIndication: payload.timeToFirstIndication,
52
+ roundIndicationsStep: payload.roundIndicationsStep,
53
+ timeToIgnoreUnexpectedFloorChanges: payload.timeToIgnoreUnexpectedFloorChanges,
54
+ ignoreLowQualityLocations: payload.ignoreLowQualityLocations
55
+ };
56
+ return Object.fromEntries(Object.entries(navigationRequest || {}).filter(([_, value]) => value !== undefined));
57
+ };
58
+ exports.createNavigationRequest = createNavigationRequest;
59
+ const mapperWrapper = (type, payload) => {
60
+ return JSON.stringify({
61
+ type,
62
+ payload: payload ?? {}
63
+ });
64
+ };
65
+ const ViewerMapper = {
66
+ // Configuration
67
+ followUser: follow => {
68
+ return mapperWrapper("camera.follow_user", {
69
+ value: follow
70
+ });
71
+ },
72
+ setLanguage: lang => {
73
+ return mapperWrapper("ui.set_language", lang);
74
+ },
75
+ setFavoritePois: poiIds => {
76
+ return mapperWrapper("ui.set_favorite_pois", poiIds);
77
+ },
78
+ initialConfiguration: style => {
79
+ return mapperWrapper("ui.initial_configuration", {
80
+ ...(style && {
81
+ style: style
82
+ })
83
+ });
84
+ },
85
+ // Cartography
86
+ selectPoi: poiId => {
87
+ return mapperWrapper(`cartography.select_poi`, {
88
+ identifier: poiId
89
+ });
90
+ },
91
+ selectCar: () => {
92
+ return mapperWrapper(`cartography.select_car`);
93
+ },
94
+ selectPoiCategory: categoryId => {
95
+ return mapperWrapper(`cartography.select_poi_category`, {
96
+ identifier: categoryId
97
+ });
98
+ },
99
+ selectFloor: (floorIdentifier, options) => {
100
+ return mapperWrapper(`cartography.select_floor`, {
101
+ identifier: floorIdentifier,
102
+ options
103
+ });
104
+ },
105
+ setDirectionsOptions: directionsOptions => {
106
+ return mapperWrapper(`directions.set_options`, {
107
+ includedTags: directionsOptions.includedTags,
108
+ excludedTags: directionsOptions.excludedTags
109
+ });
110
+ },
111
+ // Location
112
+ location: location => {
113
+ return mapperWrapper("location.update", {
114
+ ...(location.position && {
115
+ latitude: location.position.coordinate.latitude,
116
+ longitude: location.position.coordinate.longitude,
117
+ x: location.position.cartesianCoordinate.x,
118
+ y: location.position.cartesianCoordinate.y,
119
+ buildingId: location.position.buildingIdentifier,
120
+ floorId: location.position.floorIdentifier,
121
+ bearing: location.bearing?.degreesClockwise,
122
+ isIndoor: location.position.isIndoor,
123
+ isOutdoor: location.position.isOutdoor,
124
+ accuracy: location.accuracy,
125
+ hasBearing: location.hasBearing
126
+ })
127
+ });
128
+ },
129
+ locationStatus: locationStatus => {
130
+ return mapperWrapper("location.update_status", {
131
+ status: locationStatus
132
+ });
133
+ },
134
+ locationError: errorCode => {
135
+ return mapperWrapper("location.update_status", {
136
+ status: errorCode
137
+ });
138
+ },
139
+ // Directions
140
+ route: directions => {
141
+ return mapperWrapper("directions.update", directions);
142
+ },
143
+ routeToResult: route => {
144
+ return {
145
+ navigation: {
146
+ status: route.status,
147
+ destination: {
148
+ category: route?.destinationId ? "POI" : "COORDINATE",
149
+ identifier: route?.destinationId,
150
+ //name:, //TODO
151
+ point: route.to ? createPoint(route.to) : createPoint(route.TO)
152
+ }
153
+ }
154
+ };
155
+ },
156
+ // Navigation
157
+ navigation: navigation => {
158
+ return mapperWrapper(`navigation.${navigation.status}`, navigation);
159
+ },
160
+ navigateToPoi: navigate => {
161
+ return mapperWrapper(`navigation.start`, {
162
+ navigationTo: navigate?.identifier,
163
+ type: navigate.accessibilityMode
164
+ });
165
+ },
166
+ navigateToCar: params => {
167
+ return mapperWrapper(`navigation.start.to_car`, {
168
+ type: params?.accessibilityMode
169
+ });
170
+ },
171
+ navigateToPoint: ({
172
+ lat,
173
+ lng,
174
+ floorIdentifier,
175
+ navigationName,
176
+ accessibilityMode
177
+ }) => {
178
+ return mapperWrapper(`navigation.start`, {
179
+ lat,
180
+ lng,
181
+ floorIdentifier,
182
+ navigationName,
183
+ type: accessibilityMode
184
+ });
185
+ },
186
+ cancelNavigation: () => {
187
+ return mapperWrapper(`navigation.cancel`, {});
188
+ },
189
+ navigationToResult: navigation => {
190
+ return {
191
+ navigation: {
192
+ status: navigation?.type
193
+ }
194
+ };
195
+ },
196
+ search: searchFilter => {
197
+ return mapperWrapper(`ui.set_search_filter`, {
198
+ text: searchFilter.text,
199
+ poiCategoryIdentifier: searchFilter.poiCategoryIdentifier
200
+ });
201
+ }
202
+ };
203
+ var _default = exports.default = ViewerMapper;
204
+ //# sourceMappingURL=mapper.js.map
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ import SitumPlugin from "./sdk";
4
+
5
+ // Definitions
6
+ export * from "./sdk/types";
7
+ export * from "./wayfinding/types";
8
+
9
+ // APIs
10
+ export * from "./sdk";
11
+ export * from "./utils";
12
+ export * from "./wayfinding";
13
+ export default SitumPlugin;
14
+ //# sourceMappingURL=index.js.map