@situm/react-native 3.15.0-beta.3 → 3.15.0-beta.4
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.map +0 -1
- package/lib/commonjs/sdk/index.js.map +1 -1
- package/lib/commonjs/sdk/internaDelegatedState.js.map +0 -1
- package/lib/commonjs/sdk/nativeInterface.js.map +0 -1
- package/lib/commonjs/sdk/types/index.js.map +0 -1
- package/lib/commonjs/sdk/utils.js.map +0 -1
- package/lib/commonjs/utils/logError.js.map +0 -1
- package/lib/commonjs/wayfinding/types/index.js.map +0 -1
- package/lib/commonjs/wayfinding/utils/mapper.js.map +0 -1
- package/lib/module/index.js.map +0 -1
- package/lib/module/sdk/index.js.map +1 -1
- package/lib/module/sdk/internaDelegatedState.js.map +0 -1
- package/lib/module/sdk/nativeInterface.js.map +0 -1
- package/lib/module/sdk/types/index.js.map +0 -1
- package/lib/module/sdk/utils.js.map +0 -1
- package/lib/module/utils/logError.js.map +0 -1
- package/lib/module/wayfinding/types/index.js.map +0 -1
- package/lib/module/wayfinding/utils/index.js.map +0 -1
- package/lib/typescript/sdk/index.d.ts +5 -2
- package/lib/typescript/sdk/index.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/sdk/index.ts +4 -14
- package/lib/commonjs/index.js +0 -73
- package/lib/commonjs/sdk/index.js +0 -931
- package/lib/commonjs/sdk/internaDelegatedState.js +0 -48
- package/lib/commonjs/sdk/nativeInterface.js +0 -20
- package/lib/commonjs/sdk/types/constants.js +0 -73
- package/lib/commonjs/sdk/types/index.js +0 -414
- package/lib/commonjs/sdk/utils.js +0 -156
- package/lib/commonjs/utils/index.js +0 -17
- package/lib/commonjs/utils/logError.js +0 -21
- package/lib/commonjs/wayfinding/components/MapView.js +0 -389
- package/lib/commonjs/wayfinding/components/MapView.js.map +0 -1
- package/lib/commonjs/wayfinding/hooks/index.js +0 -233
- package/lib/commonjs/wayfinding/hooks/index.js.map +0 -1
- package/lib/commonjs/wayfinding/index.js +0 -57
- package/lib/commonjs/wayfinding/store/index.js +0 -247
- package/lib/commonjs/wayfinding/store/index.js.map +0 -1
- package/lib/commonjs/wayfinding/store/utils.js +0 -49
- package/lib/commonjs/wayfinding/types/constants.js +0 -13
- package/lib/commonjs/wayfinding/types/index.js +0 -6
- package/lib/commonjs/wayfinding/utils/index.js +0 -12
- package/lib/commonjs/wayfinding/utils/mapper.js +0 -204
- package/lib/module/index.js +0 -14
- package/lib/module/sdk/index.js +0 -904
- package/lib/module/sdk/internaDelegatedState.js +0 -43
- package/lib/module/sdk/nativeInterface.js +0 -20
- package/lib/module/sdk/types/constants.js +0 -70
- package/lib/module/sdk/types/index.js +0 -445
- package/lib/module/sdk/utils.js +0 -146
- package/lib/module/utils/index.js +0 -4
- package/lib/module/utils/logError.js +0 -17
- package/lib/module/wayfinding/components/MapView.js +0 -381
- package/lib/module/wayfinding/components/MapView.js.map +0 -1
- package/lib/module/wayfinding/hooks/index.js +0 -226
- package/lib/module/wayfinding/hooks/index.js.map +0 -1
- package/lib/module/wayfinding/index.js +0 -15
- package/lib/module/wayfinding/store/index.js +0 -213
- package/lib/module/wayfinding/store/index.js.map +0 -1
- package/lib/module/wayfinding/store/utils.js +0 -40
- package/lib/module/wayfinding/types/constants.js +0 -9
- package/lib/module/wayfinding/types/index.js +0 -4
- package/lib/module/wayfinding/utils/index.js +0 -7
- package/lib/module/wayfinding/utils/mapper.js +0 -195
- package/lib/module/wayfinding/utils/mapper.js.map +0 -1
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
4
|
-
import { useContext, useState } from "react";
|
|
5
|
-
import SitumPlugin from "../../sdk";
|
|
6
|
-
import { ErrorCode, ErrorType } from "../../sdk/types";
|
|
7
|
-
import { InternalCallType, LocationStatusName, NavigationStatus, NavigationUpdateType } from "../../sdk/types/constants";
|
|
8
|
-
import { resetLocation, selectDirections, selectError, selectLocation, selectLocationStatus, selectNavigation, setDirections, setError, setLocation, setLocationStatus, setNavigation, UseSitumContext } from "../store/index";
|
|
9
|
-
import { useDispatch, useSelector } from "../store/utils";
|
|
10
|
-
import { createDirectionsMessage, createDirectionsRequest, createNavigationRequest } from "../utils/mapper";
|
|
11
|
-
const defaultNavigationRequest = {
|
|
12
|
-
distanceToGoalThreshold: 4,
|
|
13
|
-
outsideRouteThreshold: 5
|
|
14
|
-
};
|
|
15
|
-
export const useSitumInternal = () => {
|
|
16
|
-
const dispatch = useDispatch();
|
|
17
|
-
const location = useSelector(selectLocation);
|
|
18
|
-
const locationStatus = useSelector(selectLocationStatus);
|
|
19
|
-
const directions = useSelector(selectDirections);
|
|
20
|
-
const navigation = useSelector(selectNavigation);
|
|
21
|
-
const error = useSelector(selectError);
|
|
22
|
-
const [lockDirections, setLockDirections] = useState(false);
|
|
23
|
-
const init = () => {
|
|
24
|
-
console.debug("Situm > hook > Initializing -> Registering callbacks");
|
|
25
|
-
registerCallbacks();
|
|
26
|
-
};
|
|
27
|
-
function registerCallbacks() {
|
|
28
|
-
SitumPlugin.internalSetMethodCallMapDelegate(internalCall => {
|
|
29
|
-
switch (internalCall.type) {
|
|
30
|
-
case InternalCallType.LOCATION:
|
|
31
|
-
let location = internalCall.get();
|
|
32
|
-
dispatch(setLocation({
|
|
33
|
-
...location
|
|
34
|
-
}));
|
|
35
|
-
break;
|
|
36
|
-
case InternalCallType.LOCATION_STATUS:
|
|
37
|
-
let statusName = internalCall.get();
|
|
38
|
-
if (statusName in LocationStatusName) {
|
|
39
|
-
dispatch(setLocationStatus(statusName));
|
|
40
|
-
}
|
|
41
|
-
break;
|
|
42
|
-
case InternalCallType.LOCATION_STOPPED:
|
|
43
|
-
// TODO: LOCATION_STOPPED exists only in RN, delete!
|
|
44
|
-
dispatch(resetLocation());
|
|
45
|
-
break;
|
|
46
|
-
case InternalCallType.LOCATION_ERROR:
|
|
47
|
-
let error = internalCall.get();
|
|
48
|
-
dispatch(setError(error));
|
|
49
|
-
break;
|
|
50
|
-
case InternalCallType.NAVIGATION_START:
|
|
51
|
-
dispatch(setNavigation({
|
|
52
|
-
type: NavigationUpdateType.PROGRESS,
|
|
53
|
-
status: NavigationStatus.START
|
|
54
|
-
}));
|
|
55
|
-
break;
|
|
56
|
-
case InternalCallType.NAVIGATION_DESTINATION_REACHED:
|
|
57
|
-
dispatch(setNavigation({
|
|
58
|
-
type: NavigationUpdateType.DESTINATION_REACHED,
|
|
59
|
-
status: NavigationStatus.UPDATE
|
|
60
|
-
}));
|
|
61
|
-
break;
|
|
62
|
-
case InternalCallType.NAVIGATION_PROGRESS:
|
|
63
|
-
let progress = internalCall.get();
|
|
64
|
-
dispatch(setNavigation({
|
|
65
|
-
currentIndication: progress?.currentIndication,
|
|
66
|
-
routeStep: progress?.routeStep,
|
|
67
|
-
distanceToGoal: progress?.distanceToGoal,
|
|
68
|
-
points: progress?.points,
|
|
69
|
-
type: NavigationUpdateType.PROGRESS,
|
|
70
|
-
segments: progress?.segments,
|
|
71
|
-
status: NavigationStatus.UPDATE
|
|
72
|
-
}));
|
|
73
|
-
break;
|
|
74
|
-
case InternalCallType.NAVIGATION_OUT_OF_ROUTE:
|
|
75
|
-
dispatch(setNavigation({
|
|
76
|
-
type: NavigationUpdateType.OUT_OF_ROUTE,
|
|
77
|
-
status: NavigationStatus.UPDATE
|
|
78
|
-
}));
|
|
79
|
-
break;
|
|
80
|
-
case InternalCallType.NAVIGATION_CANCELLATION:
|
|
81
|
-
dispatch(setNavigation({
|
|
82
|
-
type: NavigationUpdateType.CANCELLED,
|
|
83
|
-
status: NavigationStatus.STOP
|
|
84
|
-
}));
|
|
85
|
-
break;
|
|
86
|
-
case InternalCallType.NAVIGATION_ERROR:
|
|
87
|
-
case InternalCallType.GEOFENCES_ENTER:
|
|
88
|
-
case InternalCallType.GEOFENCES_EXIT:
|
|
89
|
-
// Do nothing.
|
|
90
|
-
break;
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
const calculateRoute = async (payload, interceptor, updateRoute = true) => {
|
|
95
|
-
console.debug("Situm > hook > calculating route");
|
|
96
|
-
const directionsRequest = createDirectionsRequest(payload.directionsRequest);
|
|
97
|
-
interceptor && interceptor(directionsRequest);
|
|
98
|
-
const {
|
|
99
|
-
to,
|
|
100
|
-
from,
|
|
101
|
-
minimizeFloorChanges,
|
|
102
|
-
accessibilityMode,
|
|
103
|
-
bearingFrom,
|
|
104
|
-
includedTags,
|
|
105
|
-
excludedTags
|
|
106
|
-
} = directionsRequest;
|
|
107
|
-
const {
|
|
108
|
-
originIdentifier,
|
|
109
|
-
destinationIdentifier,
|
|
110
|
-
buildingIdentifier
|
|
111
|
-
} = createDirectionsMessage(payload);
|
|
112
|
-
const _buildings = await SitumPlugin.fetchBuildings();
|
|
113
|
-
const _building = _buildings.find(b => b.buildingIdentifier === buildingIdentifier);
|
|
114
|
-
if (!_building) {
|
|
115
|
-
console.debug(`Situm > hook > Could not compute route: missing building`);
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
if (!to || !from || lockDirections) {
|
|
119
|
-
console.debug(`Situm > hook > Could not compute route (to: ${to}, from: ${from}, lockDirections: ${lockDirections})`);
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// iOS workaround -> does not allow for several direction petitions
|
|
124
|
-
setLockDirections(true);
|
|
125
|
-
return await SitumPlugin.requestDirections(_building, from, to, {
|
|
126
|
-
minimizeFloorChanges,
|
|
127
|
-
accessibilityMode,
|
|
128
|
-
bearingFrom,
|
|
129
|
-
includedTags,
|
|
130
|
-
excludedTags
|
|
131
|
-
}).then(_directions => {
|
|
132
|
-
const newRoute = {
|
|
133
|
-
..._directions,
|
|
134
|
-
originIdentifier,
|
|
135
|
-
destinationIdentifier,
|
|
136
|
-
type: accessibilityMode
|
|
137
|
-
};
|
|
138
|
-
if (updateRoute) {
|
|
139
|
-
dispatch(setDirections(newRoute));
|
|
140
|
-
}
|
|
141
|
-
return newRoute;
|
|
142
|
-
}).catch(e => {
|
|
143
|
-
console.error(`Situm > hook > Could not compute route: ${e}`);
|
|
144
|
-
dispatch(setDirections({
|
|
145
|
-
error: JSON.stringify(e)
|
|
146
|
-
}));
|
|
147
|
-
}).finally(() => {
|
|
148
|
-
setLockDirections(false);
|
|
149
|
-
});
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
// Navigation
|
|
153
|
-
const startNavigation = (payload, interceptor) => {
|
|
154
|
-
console.debug("Situm > hook > request to start navigation");
|
|
155
|
-
// TODO: we should delegate this to the sdk plugin
|
|
156
|
-
if (!navigation || navigation?.status !== NavigationStatus.STOP) {
|
|
157
|
-
stopNavigation();
|
|
158
|
-
}
|
|
159
|
-
calculateRoute(payload, interceptor, false).then(r => {
|
|
160
|
-
if (!r) {
|
|
161
|
-
console.debug(`Situm > hook > No route was computed`);
|
|
162
|
-
return;
|
|
163
|
-
}
|
|
164
|
-
dispatch(setNavigation({
|
|
165
|
-
status: NavigationStatus.START,
|
|
166
|
-
type: NavigationUpdateType.PROGRESS,
|
|
167
|
-
...r
|
|
168
|
-
}));
|
|
169
|
-
try {
|
|
170
|
-
const navigationRequest = createNavigationRequest(payload.navigationRequest);
|
|
171
|
-
SitumPlugin.requestNavigationUpdates({
|
|
172
|
-
...defaultNavigationRequest,
|
|
173
|
-
...navigationRequest
|
|
174
|
-
});
|
|
175
|
-
} catch (e) {
|
|
176
|
-
console.error(`Situm > hook > Could not update navigation ${e}`);
|
|
177
|
-
//TODO: Remove this and emit these errors in SitumPlugin.onNavigationError
|
|
178
|
-
dispatch(setError({
|
|
179
|
-
message: "Could not update navigation",
|
|
180
|
-
code: ErrorCode.UNKNOWN,
|
|
181
|
-
type: ErrorType.NON_CRITICAL
|
|
182
|
-
}));
|
|
183
|
-
stopNavigation();
|
|
184
|
-
}
|
|
185
|
-
}).catch(e => {
|
|
186
|
-
console.error(`Situm > hook > Could not compute route for navigation ${JSON.stringify(e)}`);
|
|
187
|
-
});
|
|
188
|
-
};
|
|
189
|
-
const stopNavigation = () => {
|
|
190
|
-
// TODO: we should delegate this to the sdk plugin
|
|
191
|
-
if (!navigation || navigation?.status === NavigationStatus.STOP) {
|
|
192
|
-
return;
|
|
193
|
-
}
|
|
194
|
-
console.debug("Situm > hook > Stopping navigation");
|
|
195
|
-
SitumPlugin.removeNavigationUpdates().then(() => {
|
|
196
|
-
console.debug("Situm > hook > Successfully removed navigation updates");
|
|
197
|
-
dispatch(setNavigation({
|
|
198
|
-
status: NavigationStatus.STOP
|
|
199
|
-
}));
|
|
200
|
-
}).catch(e => {
|
|
201
|
-
console.warn(`Situm > hook > Could not remove navigation updates ${JSON.stringify(e)}`);
|
|
202
|
-
});
|
|
203
|
-
};
|
|
204
|
-
return {
|
|
205
|
-
// States
|
|
206
|
-
location,
|
|
207
|
-
locationStatus,
|
|
208
|
-
directions,
|
|
209
|
-
navigation,
|
|
210
|
-
error,
|
|
211
|
-
// Functions
|
|
212
|
-
init,
|
|
213
|
-
calculateRoute,
|
|
214
|
-
startNavigation,
|
|
215
|
-
stopNavigation
|
|
216
|
-
};
|
|
217
|
-
};
|
|
218
|
-
const useSitum = () => {
|
|
219
|
-
const context = useContext(UseSitumContext);
|
|
220
|
-
if (!context) {
|
|
221
|
-
throw new Error("Situm > hook > No SitumProvider found.");
|
|
222
|
-
}
|
|
223
|
-
return context.useSitum;
|
|
224
|
-
};
|
|
225
|
-
export default useSitum;
|
|
226
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useContext","useState","SitumPlugin","ErrorCode","ErrorType","InternalCallType","LocationStatusName","NavigationStatus","NavigationUpdateType","resetLocation","selectDirections","selectError","selectLocation","selectLocationStatus","selectNavigation","setDirections","setError","setLocation","setLocationStatus","setNavigation","UseSitumContext","useDispatch","useSelector","createDirectionsMessage","createDirectionsRequest","createNavigationRequest","defaultNavigationRequest","distanceToGoalThreshold","outsideRouteThreshold","useSitumInternal","dispatch","location","locationStatus","directions","navigation","error","lockDirections","setLockDirections","init","console","debug","registerCallbacks","internalSetMethodCallMapDelegate","internalCall","type","LOCATION","get","LOCATION_STATUS","statusName","LOCATION_STOPPED","LOCATION_ERROR","NAVIGATION_START","PROGRESS","status","START","NAVIGATION_DESTINATION_REACHED","DESTINATION_REACHED","UPDATE","NAVIGATION_PROGRESS","progress","currentIndication","routeStep","distanceToGoal","points","segments","NAVIGATION_OUT_OF_ROUTE","OUT_OF_ROUTE","NAVIGATION_CANCELLATION","CANCELLED","STOP","NAVIGATION_ERROR","GEOFENCES_ENTER","GEOFENCES_EXIT","calculateRoute","payload","interceptor","updateRoute","directionsRequest","to","from","minimizeFloorChanges","accessibilityMode","bearingFrom","includedTags","excludedTags","originIdentifier","destinationIdentifier","buildingIdentifier","_buildings","fetchBuildings","_building","find","b","requestDirections","then","_directions","newRoute","catch","e","JSON","stringify","finally","startNavigation","stopNavigation","r","navigationRequest","requestNavigationUpdates","message","code","UNKNOWN","NON_CRITICAL","removeNavigationUpdates","warn","useSitum","context","Error"],"sourceRoot":"../../../../src","sources":["wayfinding/hooks/index.ts"],"mappings":";;AAAA;AACA,SAASA,UAAU,EAAEC,QAAQ,QAAQ,OAAO;AAE5C,OAAOC,WAAW,MAAM,WAAW;AACnC,SAGEC,SAAS,EACTC,SAAS,QAIJ,iBAAiB;AACxB,SACEC,gBAAgB,EAChBC,kBAAkB,EAClBC,gBAAgB,EAChBC,oBAAoB,QACf,2BAA2B;AAClC,SACEC,aAAa,EACbC,gBAAgB,EAChBC,WAAW,EACXC,cAAc,EACdC,oBAAoB,EACpBC,gBAAgB,EAChBC,aAAa,EACbC,QAAQ,EACRC,WAAW,EACXC,iBAAiB,EACjBC,aAAa,EACbC,eAAe,QACV,gBAAgB;AACvB,SAASC,WAAW,EAAEC,WAAW,QAAQ,gBAAgB;AAEzD,SACEC,uBAAuB,EACvBC,uBAAuB,EACvBC,uBAAuB,QAClB,iBAAiB;AA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EF,CACF,CAAC,EACH,CAAC;IACH,CAAC,CAAC;EACN,CAAC;EAED,OAAO;IACL;IACAnE,QAAQ;IACRC,cAAc;IAEdC,UAAU;IACVC,UAAU;IACVC,KAAK;IAEL;IACAG,IAAI;IACJmC,cAAc;IACd6B,eAAe;IACfC;EACF,CAAC;AACH,CAAC;AAED,MAAMU,QAAQ,GAAGA,CAAA,KAAM;EACrB,MAAMC,OAAO,GAAGlH,UAAU,CAACoB,eAAe,CAAC;EAE3C,IAAI,CAAC8F,OAAO,EAAE;IACZ,MAAM,IAAIC,KAAK,CAAC,wCAAwC,CAAC;EAC3D;EAEA,OAAOD,OAAO,CAACD,QAAQ;AACzB,CAAC;AAED,eAAeA,QAAQ","ignoreList":[]}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
// Definitions
|
|
4
|
-
export * from "./types";
|
|
5
|
-
export * from "./types/constants";
|
|
6
|
-
|
|
7
|
-
// Hook
|
|
8
|
-
export { default as useSitum } from "./hooks";
|
|
9
|
-
|
|
10
|
-
// State Provider
|
|
11
|
-
export { default as SitumProvider } from "./store";
|
|
12
|
-
|
|
13
|
-
// Component
|
|
14
|
-
export { default as MapView } from "./components/MapView";
|
|
15
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
4
|
-
import React, { createContext, useReducer } from "react";
|
|
5
|
-
import { useSitumInternal } from "../hooks";
|
|
6
|
-
import { createStore } from "./utils";
|
|
7
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
-
export const initialState = {
|
|
9
|
-
webViewRef: undefined,
|
|
10
|
-
sdkInitialized: false,
|
|
11
|
-
user: undefined,
|
|
12
|
-
location: undefined,
|
|
13
|
-
locationStatus: undefined,
|
|
14
|
-
buildings: null,
|
|
15
|
-
currentBuilding: undefined,
|
|
16
|
-
pois: [],
|
|
17
|
-
directions: undefined,
|
|
18
|
-
navigation: undefined,
|
|
19
|
-
destinationPoiID: undefined,
|
|
20
|
-
error: undefined,
|
|
21
|
-
buildingIdentifier: "-1"
|
|
22
|
-
};
|
|
23
|
-
export const SitumContext = /*#__PURE__*/createContext(undefined);
|
|
24
|
-
const store = createStore({
|
|
25
|
-
initialState,
|
|
26
|
-
reducers: {
|
|
27
|
-
setWebViewRef: (state, payload) => {
|
|
28
|
-
return {
|
|
29
|
-
...state,
|
|
30
|
-
webViewRef: payload
|
|
31
|
-
};
|
|
32
|
-
},
|
|
33
|
-
setSdkInitialized: (state, payload) => {
|
|
34
|
-
return {
|
|
35
|
-
...state,
|
|
36
|
-
sdkInitialized: payload
|
|
37
|
-
};
|
|
38
|
-
},
|
|
39
|
-
setAuth: (state, payload) => {
|
|
40
|
-
return {
|
|
41
|
-
...state,
|
|
42
|
-
user: payload
|
|
43
|
-
};
|
|
44
|
-
},
|
|
45
|
-
setLocation: (state, payload) => {
|
|
46
|
-
return {
|
|
47
|
-
...state,
|
|
48
|
-
location: payload
|
|
49
|
-
};
|
|
50
|
-
},
|
|
51
|
-
setLocationStatus: (state, payload) => {
|
|
52
|
-
return {
|
|
53
|
-
...state,
|
|
54
|
-
locationStatus: payload
|
|
55
|
-
};
|
|
56
|
-
},
|
|
57
|
-
resetLocation: state => {
|
|
58
|
-
return {
|
|
59
|
-
...state,
|
|
60
|
-
location: initialState.location
|
|
61
|
-
};
|
|
62
|
-
},
|
|
63
|
-
setBuildings: (state, payload) => {
|
|
64
|
-
return {
|
|
65
|
-
...state,
|
|
66
|
-
buildings: payload
|
|
67
|
-
};
|
|
68
|
-
},
|
|
69
|
-
setCurrentBuilding: (state, payload) => {
|
|
70
|
-
return {
|
|
71
|
-
...state,
|
|
72
|
-
currentBuilding: payload
|
|
73
|
-
};
|
|
74
|
-
},
|
|
75
|
-
setPois: (state, payload) => {
|
|
76
|
-
return {
|
|
77
|
-
...state,
|
|
78
|
-
pois: payload
|
|
79
|
-
};
|
|
80
|
-
},
|
|
81
|
-
setDirections: (state, payload) => {
|
|
82
|
-
return {
|
|
83
|
-
...state,
|
|
84
|
-
directions: payload
|
|
85
|
-
};
|
|
86
|
-
},
|
|
87
|
-
setNavigation: (state, payload) => {
|
|
88
|
-
return {
|
|
89
|
-
...state,
|
|
90
|
-
navigation: payload
|
|
91
|
-
};
|
|
92
|
-
},
|
|
93
|
-
setDestinationPoiID: (state, payload) => {
|
|
94
|
-
return {
|
|
95
|
-
...state,
|
|
96
|
-
destinationPoiID: payload
|
|
97
|
-
};
|
|
98
|
-
},
|
|
99
|
-
setError: (state, payload) => {
|
|
100
|
-
return {
|
|
101
|
-
...state,
|
|
102
|
-
error: payload
|
|
103
|
-
};
|
|
104
|
-
},
|
|
105
|
-
setBuildingIdentifier: (state, payload) => {
|
|
106
|
-
return {
|
|
107
|
-
...state,
|
|
108
|
-
buildingIdentifier: payload
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
export const selectWebViewRef = state => {
|
|
114
|
-
return state.webViewRef;
|
|
115
|
-
};
|
|
116
|
-
export const selectIsSDKInitialized = state => {
|
|
117
|
-
return state.sdkInitialized;
|
|
118
|
-
};
|
|
119
|
-
export const selectUser = state => {
|
|
120
|
-
return state.user;
|
|
121
|
-
};
|
|
122
|
-
export const selectLocation = state => {
|
|
123
|
-
return state.location;
|
|
124
|
-
};
|
|
125
|
-
export const selectLocationStatus = state => {
|
|
126
|
-
return state.locationStatus;
|
|
127
|
-
};
|
|
128
|
-
export const selectBuildings = state => {
|
|
129
|
-
return state.buildings;
|
|
130
|
-
};
|
|
131
|
-
export const selectCurrentBuilding = state => {
|
|
132
|
-
return state.currentBuilding;
|
|
133
|
-
};
|
|
134
|
-
export const selectPois = state => {
|
|
135
|
-
return state.pois;
|
|
136
|
-
};
|
|
137
|
-
export const selectDirections = state => {
|
|
138
|
-
return state.directions;
|
|
139
|
-
};
|
|
140
|
-
export const selectNavigation = state => {
|
|
141
|
-
return state.navigation;
|
|
142
|
-
};
|
|
143
|
-
export const selectDestinationPoiID = state => {
|
|
144
|
-
return state.destinationPoiID;
|
|
145
|
-
};
|
|
146
|
-
export const selectError = state => {
|
|
147
|
-
return state.error;
|
|
148
|
-
};
|
|
149
|
-
export const selectBuildingIdentifier = state => {
|
|
150
|
-
return state.buildingIdentifier;
|
|
151
|
-
};
|
|
152
|
-
export const {
|
|
153
|
-
setWebViewRef,
|
|
154
|
-
setSdkInitialized,
|
|
155
|
-
setAuth,
|
|
156
|
-
setLocation,
|
|
157
|
-
setLocationStatus,
|
|
158
|
-
resetLocation,
|
|
159
|
-
setBuildings,
|
|
160
|
-
setCurrentBuilding,
|
|
161
|
-
setPois,
|
|
162
|
-
setDirections,
|
|
163
|
-
setNavigation,
|
|
164
|
-
setDestinationPoiID,
|
|
165
|
-
setError,
|
|
166
|
-
setBuildingIdentifier
|
|
167
|
-
} = store.actions;
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* Context specifically to store the only instance of our hook.
|
|
171
|
-
*/
|
|
172
|
-
export const UseSitumContext = /*#__PURE__*/createContext(undefined);
|
|
173
|
-
const UseSitumProvider = ({
|
|
174
|
-
children
|
|
175
|
-
}) => {
|
|
176
|
-
// TODO: if we have this, there is no need to have a context for the rest of the state
|
|
177
|
-
// as there is only one instance of the hook
|
|
178
|
-
const useSitum = useSitumInternal();
|
|
179
|
-
return /*#__PURE__*/_jsx(UseSitumContext.Provider, {
|
|
180
|
-
value: {
|
|
181
|
-
useSitum
|
|
182
|
-
},
|
|
183
|
-
children: children
|
|
184
|
-
});
|
|
185
|
-
};
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
* Main context of the application, stores the plugins' state.
|
|
189
|
-
*/
|
|
190
|
-
const SitumProvider = ({
|
|
191
|
-
email,
|
|
192
|
-
apiKey,
|
|
193
|
-
children
|
|
194
|
-
}) => {
|
|
195
|
-
const [state, dispatch] = useReducer(store.reducer, {
|
|
196
|
-
...store.initialState,
|
|
197
|
-
user: {
|
|
198
|
-
email,
|
|
199
|
-
apiKey
|
|
200
|
-
}
|
|
201
|
-
});
|
|
202
|
-
return /*#__PURE__*/_jsx(SitumContext.Provider, {
|
|
203
|
-
value: {
|
|
204
|
-
state,
|
|
205
|
-
dispatch
|
|
206
|
-
},
|
|
207
|
-
children: /*#__PURE__*/_jsx(UseSitumProvider, {
|
|
208
|
-
children: children
|
|
209
|
-
})
|
|
210
|
-
});
|
|
211
|
-
};
|
|
212
|
-
export default SitumProvider;
|
|
213
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","createContext","useReducer","useSitumInternal","createStore","jsx","_jsx","initialState","webViewRef","undefined","sdkInitialized","user","location","locationStatus","buildings","currentBuilding","pois","directions","navigation","destinationPoiID","error","buildingIdentifier","SitumContext","store","reducers","setWebViewRef","state","payload","setSdkInitialized","setAuth","setLocation","setLocationStatus","resetLocation","setBuildings","setCurrentBuilding","setPois","setDirections","setNavigation","setDestinationPoiID","setError","setBuildingIdentifier","selectWebViewRef","selectIsSDKInitialized","selectUser","selectLocation","selectLocationStatus","selectBuildings","selectCurrentBuilding","selectPois","selectDirections","selectNavigation","selectDestinationPoiID","selectError","selectBuildingIdentifier","actions","UseSitumContext","UseSitumProvider","children","useSitum","Provider","value","SitumProvider","email","apiKey","dispatch","reducer"],"sourceRoot":"../../../../src","sources":["wayfinding/store/index.tsx"],"mappings":";;AAAA;AACA,OAAOA,KAAK,IAAIC,aAAa,EAAyBC,UAAU,QAAQ,OAAO;AAW/E,SAASC,gBAAgB,QAAQ,UAAU;AAC3C,SAASC,WAAW,QAAQ,SAAS;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAuBtC,OAAO,MAAMC,YAAmB,GAAG;EACjCC,UAAU,EAAEC,SAAS;EACrBC,cAAc,EAAE,KAAK;EACrBC,IAAI,EAAEF,SAAS;EACfG,QAAQ,EAA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AAMC,eAAe,gBAAGtD,aAAa,CAC1CQ,SACF,CAAC;AAED,MAAM+C,gBAAyD,GAAGA,CAAC;EACjEC;AACF,CAAC,KAAK;EACJ;EACA;EACA,MAAMC,QAAQ,GAAGvD,gBAAgB,CAAC,CAAC;EAEnC,oBACEG,IAAA,CAACiD,eAAe,CAACI,QAAQ;IAACC,KAAK,EAAE;MAAEF;IAAS,CAAE;IAAAD,QAAA,EAC3CA;EAAQ,CACe,CAAC;AAE/B,CAAC;;AAED;AACA;AACA;AACA,MAAMI,aAKL,GAAGA,CAAC;EAAEC,KAAK;EAAEC,MAAM;EAAEN;AAAS,CAAC,KAAK;EACnC,MAAM,CAAC/B,KAAK,EAAEsC,QAAQ,CAAC,GAAG9D,UAAU,CAACqB,KAAK,CAAC0C,OAAO,EAAE;IAClD,GAAG1C,KAAK,CAAChB,YAAY;IACrBI,IAAI,EAAE;MAAEmD,KAAK;MAAEC;IAAO;EACxB,CAAC,CAAC;EAEF,oBACEzD,IAAA,CAACgB,YAAY,CAACqC,QAAQ;IACpBC,KAAK,EAAE;MACLlC,KAAK;MACLsC;IACF,CAAE;IAAAP,QAAA,eAEFnD,IAAA,CAACkD,gBAAgB;MAAAC,QAAA,EAAEA;IAAQ,CAAmB;EAAC,CAC1B,CAAC;AAE5B,CAAC;AAED,eAAeI,aAAa","ignoreList":[]}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
4
|
-
import { useContext } from "react";
|
|
5
|
-
import { SitumContext } from "./index";
|
|
6
|
-
export const createReducer = () => {
|
|
7
|
-
const reducer = (state, action) => {
|
|
8
|
-
return action(state);
|
|
9
|
-
};
|
|
10
|
-
return reducer;
|
|
11
|
-
};
|
|
12
|
-
export const createStore = ({
|
|
13
|
-
initialState,
|
|
14
|
-
reducers
|
|
15
|
-
}) => {
|
|
16
|
-
const actions = Object.keys(reducers).reduce((acc, r) => {
|
|
17
|
-
acc[r] = payload => state => reducers[r](state, payload);
|
|
18
|
-
return acc;
|
|
19
|
-
}, {});
|
|
20
|
-
return {
|
|
21
|
-
initialState,
|
|
22
|
-
actions,
|
|
23
|
-
reducer: createReducer()
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
export const useSelector = selector => {
|
|
27
|
-
const context = useContext(SitumContext);
|
|
28
|
-
if (!context) {
|
|
29
|
-
throw new Error("No SitumProvider found.");
|
|
30
|
-
}
|
|
31
|
-
return selector(context.state);
|
|
32
|
-
};
|
|
33
|
-
export const useDispatch = () => {
|
|
34
|
-
const context = useContext(SitumContext);
|
|
35
|
-
if (!context) {
|
|
36
|
-
throw new Error("No SitumProvider found.");
|
|
37
|
-
}
|
|
38
|
-
return context.dispatch;
|
|
39
|
-
};
|
|
40
|
-
//# sourceMappingURL=utils.js.map
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
// Define class that handles errors
|
|
4
|
-
export let ErrorName = /*#__PURE__*/function (ErrorName) {
|
|
5
|
-
ErrorName["ERR_INTERNET_DISCONNECTED"] = "ERR_INTERNET_DISCONNECTED";
|
|
6
|
-
ErrorName["ERR_INTERNAL_SERVER_ERROR"] = "ERR_INTERNAL_SERVER_ERROR";
|
|
7
|
-
return ErrorName;
|
|
8
|
-
}({});
|
|
9
|
-
//# sourceMappingURL=constants.js.map
|