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