@situm/react-native 3.16.4 → 3.17.0-beta.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.
- package/lib/commonjs/sdk/index.js +6 -0
- package/lib/commonjs/sdk/index.js.map +1 -1
- package/lib/commonjs/wayfinding/components/MapView.js +88 -41
- package/lib/commonjs/wayfinding/components/MapView.js.map +1 -1
- package/lib/commonjs/wayfinding/hooks/index.js +7 -6
- package/lib/commonjs/wayfinding/hooks/index.js.map +1 -1
- package/lib/commonjs/wayfinding/store/index.js +27 -4
- package/lib/commonjs/wayfinding/store/index.js.map +1 -1
- package/lib/module/sdk/index.js +6 -0
- package/lib/module/sdk/index.js.map +1 -1
- package/lib/module/wayfinding/components/MapView.js +66 -19
- package/lib/module/wayfinding/components/MapView.js.map +1 -1
- package/lib/module/wayfinding/hooks/index.js +7 -6
- package/lib/module/wayfinding/hooks/index.js.map +1 -1
- package/lib/module/wayfinding/store/index.js +26 -5
- package/lib/module/wayfinding/store/index.js.map +1 -1
- package/lib/typescript/sdk/index.d.ts.map +1 -1
- package/lib/typescript/wayfinding/components/MapView.d.ts +10 -3
- package/lib/typescript/wayfinding/components/MapView.d.ts.map +1 -1
- package/lib/typescript/wayfinding/hooks/index.d.ts.map +1 -1
- package/lib/typescript/wayfinding/store/index.d.ts +22 -2
- package/lib/typescript/wayfinding/store/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/sdk/index.ts +7 -0
- package/src/wayfinding/components/MapView.tsx +106 -30
- package/src/wayfinding/hooks/index.ts +7 -6
- package/src/wayfinding/store/index.tsx +64 -7
- package/README.md +0 -187
|
@@ -1 +1 @@
|
|
|
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;AAExB,MAAMC,wBAAwB,GAAG;EAC/BC,uBAAuB,EAAE,CAAC;EAC1BC,qBAAqB,EAAE;AACzB,CAAC;AAED,OAAO,MAAMC,gBAAgB,GAAGA,CAAA,KAAM;EACpC,MAAMC,QAAQ,GAAGT,WAAW,CAAC,CAAC;EAE9B,MAAMU,QAAQ,GAAGT,WAAW,CAACV,cAAc,CAAC;EAC5C,MAAMoB,cAAc,GAAGV,WAAW,CAACT,oBAAoB,CAAC;EAExD,MAAMoB,UAAU,GAAGX,WAAW,CAACZ,gBAAgB,CAAC;EAChD,MAAMwB,UAAU,GAAGZ,WAAW,CAACR,gBAAgB,CAAC;EAChD,MAAMqB,KAAK,GAAGb,WAAW,CAACX,WAAW,CAAC;EAEtC,MAAM,CAACyB,cAAc,EAAEC,iBAAiB,CAAC,GAAGpC,QAAQ,CAAU,KAAK,CAAC;EAEpE,MAAMqC,IAAI,GAAGA,CAAA,KAAM;IACjBC,OAAO,CAACC,KAAK,CAAC,sDAAsD,CAAC;IACrEC,iBAAiB,CAAC,CAAC;EACrB,CAAC;EAED,SAASA,iBAAiBA,CAAA,EAAG;IAC3BvC,WAAW,CAACwC,gCAAgC,CACzCC,YAA0B,IAAK;MAC9B,QAAQA,YAAY,CAACC,IAAI;QACvB,KAAKvC,gBAAgB,CAACwC,QAAQ;UAC5B,
|
|
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","receivedLocation","get","LOCATION_STATUS","statusName","LOCATION_STOPPED","LOCATION_ERROR","receivedError","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;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;AAExB,MAAMC,wBAAwB,GAAG;EAC/BC,uBAAuB,EAAE,CAAC;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OAAO;IACL;IACArE,QAAQ;IACRC,cAAc;IAEdC,UAAU;IACVC,UAAU;IACVC,KAAK;IAEL;IACAG,IAAI;IACJqC,cAAc;IACd6B,eAAe;IACfC;EACF,CAAC;AACH,CAAC;AAED,MAAMU,QAAQ,GAAGA,CAAA,KAAM;EACrB,MAAMC,OAAO,GAAGpH,UAAU,CAACoB,eAAe,CAAC;EAE3C,IAAI,CAACgG,OAAO,EAAE;IACZ,MAAM,IAAIC,KAAK,CAAC,wCAAwC,CAAC;EAC3D;EAEA,OAAOD,OAAO,CAACD,QAAQ;AACzB,CAAC;AAED,eAAeA,QAAQ","ignoreList":[]}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
4
|
-
import React, { createContext, useReducer } from "react";
|
|
4
|
+
import React, { createContext, useEffect, useReducer, useState } from "react";
|
|
5
|
+
import SitumPlugin from "../../sdk";
|
|
5
6
|
import { useSitumInternal } from "../hooks";
|
|
6
7
|
import { createStore } from "./utils";
|
|
7
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
8
9
|
export const initialState = {
|
|
9
10
|
webViewRef: undefined,
|
|
10
11
|
sdkInitialized: false,
|
|
11
12
|
user: undefined,
|
|
13
|
+
apiDomain: undefined,
|
|
12
14
|
location: undefined,
|
|
13
15
|
locationStatus: undefined,
|
|
14
16
|
buildings: null,
|
|
@@ -119,6 +121,9 @@ export const selectIsSDKInitialized = state => {
|
|
|
119
121
|
export const selectUser = state => {
|
|
120
122
|
return state.user;
|
|
121
123
|
};
|
|
124
|
+
export const selectApiDomain = state => {
|
|
125
|
+
return state.apiDomain;
|
|
126
|
+
};
|
|
122
127
|
export const selectLocation = state => {
|
|
123
128
|
return state.location;
|
|
124
129
|
};
|
|
@@ -185,11 +190,12 @@ const UseSitumProvider = ({
|
|
|
185
190
|
};
|
|
186
191
|
|
|
187
192
|
/**
|
|
188
|
-
* Main context of the application, stores the
|
|
193
|
+
* Main context of the application, stores the plugin's state.
|
|
189
194
|
*/
|
|
190
195
|
const SitumProvider = ({
|
|
191
196
|
email,
|
|
192
197
|
apiKey,
|
|
198
|
+
apiDomain,
|
|
193
199
|
children
|
|
194
200
|
}) => {
|
|
195
201
|
const [state, dispatch] = useReducer(store.reducer, {
|
|
@@ -197,15 +203,30 @@ const SitumProvider = ({
|
|
|
197
203
|
user: {
|
|
198
204
|
email,
|
|
199
205
|
apiKey
|
|
200
|
-
}
|
|
206
|
+
},
|
|
207
|
+
apiDomain: apiDomain
|
|
201
208
|
});
|
|
209
|
+
const [isInitialized, setIsInitialized] = useState(false);
|
|
210
|
+
useEffect(() => {
|
|
211
|
+
try {
|
|
212
|
+
SitumPlugin.init();
|
|
213
|
+
apiDomain && SitumPlugin.setDashboardURL(apiDomain);
|
|
214
|
+
if (!apiKey) {
|
|
215
|
+
throw new Error("Please specify SitumProvider.apiKey to be able to successfully use SitumPlugin and MapView.");
|
|
216
|
+
}
|
|
217
|
+
SitumPlugin.setApiKey(apiKey);
|
|
218
|
+
} catch (e) {
|
|
219
|
+
console.error(`SitumProvider > Could not initialize ${e}`);
|
|
220
|
+
}
|
|
221
|
+
setIsInitialized(true);
|
|
222
|
+
}, [apiKey, apiDomain]);
|
|
202
223
|
return /*#__PURE__*/_jsx(SitumContext.Provider, {
|
|
203
224
|
value: {
|
|
204
225
|
state,
|
|
205
226
|
dispatch
|
|
206
227
|
},
|
|
207
228
|
children: /*#__PURE__*/_jsx(UseSitumProvider, {
|
|
208
|
-
children: children
|
|
229
|
+
children: isInitialized ? children : /*#__PURE__*/_jsx(_Fragment, {})
|
|
209
230
|
})
|
|
210
231
|
});
|
|
211
232
|
};
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
1
|
+
{"version":3,"names":["React","createContext","useEffect","useReducer","useState","SitumPlugin","useSitumInternal","createStore","jsx","_jsx","Fragment","_Fragment","initialState","webViewRef","undefined","sdkInitialized","user","apiDomain","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","selectApiDomain","selectLocation","selectLocationStatus","selectBuildings","selectCurrentBuilding","selectPois","selectDirections","selectNavigation","selectDestinationPoiID","selectError","selectBuildingIdentifier","actions","UseSitumContext","UseSitumProvider","children","useSitum","Provider","value","SitumProvider","email","apiKey","dispatch","reducer","isInitialized","setIsInitialized","init","setDashboardURL","Error","setApiKey","e","console"],"sourceRoot":"../../../../src","sources":["wayfinding/store/index.tsx"],"mappings":";;AAAA;AACA,OAAOA,KAAK,IACVC,aAAa,EAEbC,SAAS,EACTC,UAAU,EACVC,QAAQ,QACH,OAAO;AAEd,OAAOC,WAAW,MAAM,WAAW;AAUnC,SAASC,gBAAgB,QAAQ,UA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AE;QACX,MAAM,IAAIO,KAAK,CACb,6FACF,CAAC;MACH;MACAxE,WAAW,CAACyE,SAAS,CAACR,MAAM,CAAC;IAC/B,CAAC,CAAC,OAAOS,CAAC,EAAE;MACVC,OAAO,CAACtD,KAAK,CAAC,wCAAwCqD,CAAC,EAAE,CAAC;IAC5D;IACAL,gBAAgB,CAAC,IAAI,CAAC;EACxB,CAAC,EAAE,CAACJ,MAAM,EAAErD,SAAS,CAAC,CAAC;EAEvB,oBACER,IAAA,CAACmB,YAAY,CAACsC,QAAQ;IACpBC,KAAK,EAAE;MACLnC,KAAK;MACLuC;IACF,CAAE;IAAAP,QAAA,eASFvD,IAAA,CAACsD,gBAAgB;MAAAC,QAAA,EAAES,aAAa,GAAGT,QAAQ,gBAAGvD,IAAA,CAAAE,SAAA,IAAI;IAAC,CAAmB;EAAC,CAClD,CAAC;AAE5B,CAAC;AAED,eAAeyD,aAAa","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/sdk/index.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,YAAY,EACjB,KAAK,oBAAoB,EAEzB,KAAK,iBAAiB,EACtB,KAAK,KAAK,EAGV,KAAK,KAAK,EACV,KAAK,QAAQ,EACb,YAAY,EACZ,KAAK,QAAQ,EACb,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,GAAG,EACR,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,KAAK,EACV,KAAK,KAAK,EACV,KAAK,UAAU,EACf,mBAAmB,EACnB,KAAK,iBAAiB,EACvB,MAAM,SAAS,CAAC;AASjB,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC;AAmMlC,MAAM,CAAC,OAAO,OAAO,WAAW;IAC9B;;;OAGG;IACH,MAAM,CAAC,oBAAoB,EAAE,MAAM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UAAU,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,UAExD;CACH"}
|
|
@@ -13,10 +13,13 @@ export type MapViewConfiguration = {
|
|
|
13
13
|
*/
|
|
14
14
|
viewerDomain?: string;
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
16
|
+
* Your Situm API key. Find your API key at your [Situm dashboard's profile](https://dashboard.situm.com/accounts/profile)
|
|
17
|
+
*
|
|
18
|
+
* Since X.YY.ZZ version this parameter is not required. Instead, you should specify your apiKey
|
|
19
|
+
* at the root of your app with `SitumProvider.apiKey` for the correct usage of the plugin.
|
|
20
|
+
* If {@param situmApiKey} is specified, `SitumProvider.apiKey` will be ignored.
|
|
18
21
|
*/
|
|
19
|
-
situmApiKey
|
|
22
|
+
situmApiKey?: string;
|
|
20
23
|
/**
|
|
21
24
|
* @deprecated Use `profile` instead.
|
|
22
25
|
* A String identifier that allows you to remotely configure all map settings.
|
|
@@ -83,6 +86,10 @@ export interface MapViewProps {
|
|
|
83
86
|
* @param event {@link OnFavoritePoisUpdatedResult} object.
|
|
84
87
|
*/
|
|
85
88
|
onFavoritePoisUpdated?: (event: OnFavoritePoisUpdatedResult) => void;
|
|
89
|
+
/**
|
|
90
|
+
* Internal callback invoked with every MapView message.
|
|
91
|
+
*/
|
|
92
|
+
onInternalMapViewMessageDelegate?: (type: string, payload: any) => void;
|
|
86
93
|
}
|
|
87
94
|
declare const MapView: React.ForwardRefExoticComponent<MapViewProps & React.RefAttributes<MapViewRef>>;
|
|
88
95
|
export default MapView;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapView.d.ts","sourceRoot":"","sources":["../../../../src/wayfinding/components/MapView.tsx"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"MapView.d.ts","sourceRoot":"","sources":["../../../../src/wayfinding/components/MapView.tsx"],"names":[],"mappings":"AAEA,OAAO,KAON,MAAM,OAAO,CAAC;AACf,OAAO,EAGL,KAAK,SAA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EAAE,CAAC,KAAK,EAAE,2BAA2B,KAAK,IAAI,CAAC;IACrE;;;OAGG;IACH,qBAAqB,CAAC,EAAE,CAAC,KAAK,EAAE,2BAA2B,KAAK,IAAI,CAAC;IACrE;;OAEG;IACH,gCAAgC,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,IAAI,CAAC;CACzE;AAED,QAAA,MAAM,OAAO,iFAyjBZ,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/wayfinding/hooks/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/wayfinding/hooks/index.ts"],"names":[],"mappings":"AAmCA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,UAAU,CAAC;AAY/D,eAAO,MAAM,gBAAgB;;;;;;;8BAoGhB,GAAG,gBACE,8BAA8B;+BAsEnC,GAAG,gBACE,8BAA8B;;CAuF/C,CAAC;AAEF,QAAA,MAAM,QAAQ,WAQb,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -9,6 +9,7 @@ export interface State {
|
|
|
9
9
|
webViewRef: MutableRefObject<undefined> | undefined;
|
|
10
10
|
sdkInitialized: boolean;
|
|
11
11
|
user?: User;
|
|
12
|
+
apiDomain?: string;
|
|
12
13
|
location?: Location;
|
|
13
14
|
locationStatus?: LocationStatusName;
|
|
14
15
|
buildings: Building[] | null;
|
|
@@ -28,6 +29,7 @@ export declare const SitumContext: React.Context<{
|
|
|
28
29
|
export declare const selectWebViewRef: (state: State) => React.MutableRefObject<undefined> | undefined;
|
|
29
30
|
export declare const selectIsSDKInitialized: (state: State) => boolean;
|
|
30
31
|
export declare const selectUser: (state: State) => User | undefined;
|
|
32
|
+
export declare const selectApiDomain: (state: State) => string | undefined;
|
|
31
33
|
export declare const selectLocation: (state: State) => Location | undefined;
|
|
32
34
|
export declare const selectLocationStatus: (state: State) => LocationStatusName | undefined;
|
|
33
35
|
export declare const selectBuildings: (state: State) => Building[] | null;
|
|
@@ -46,11 +48,29 @@ export declare const UseSitumContext: React.Context<{
|
|
|
46
48
|
useSitum: any;
|
|
47
49
|
} | undefined>;
|
|
48
50
|
/**
|
|
49
|
-
* Main context of the application, stores the
|
|
51
|
+
* Main context of the application, stores the plugin's state.
|
|
50
52
|
*/
|
|
51
53
|
declare const SitumProvider: React.FC<React.PropsWithChildren<{
|
|
54
|
+
/**
|
|
55
|
+
* Your Situm email account.
|
|
56
|
+
*/
|
|
52
57
|
email?: string;
|
|
53
|
-
|
|
58
|
+
/**
|
|
59
|
+
* Your Situm API key. Find your API key at your [Situm dashboard's profile](https://dashboard.situm.com/accounts/profile)
|
|
60
|
+
*
|
|
61
|
+
* When specifying a valid situm API key in this parameter, you won't need to call later on the `SitumPlugin.init()` & `SitumPlugin.setApiKey()` methods,
|
|
62
|
+
* and also you won't need to specify `MapViewConfiguration.situmApiKey` when configuring your MapView.
|
|
63
|
+
*/
|
|
64
|
+
apiKey: string;
|
|
65
|
+
/**
|
|
66
|
+
* Set the API domain that will be used by the native SDKs and MapView to obtain the situm's data.
|
|
67
|
+
*
|
|
68
|
+
* When specifying a valid domain in this parameter, you won't need to call later on the `SitumPlugin.setDashboardURL()` method,
|
|
69
|
+
* and also you won't need to specify `MapViewConfiguration.apiDomain` when configuring your MapView.
|
|
70
|
+
*
|
|
71
|
+
* Defaults to "api.situm.com"
|
|
72
|
+
*/
|
|
73
|
+
apiDomain?: string;
|
|
54
74
|
}>>;
|
|
55
75
|
export default SitumProvider;
|
|
56
76
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/wayfinding/store/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","source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,MAAM,CAAC;CACpB,CAAC,CA2CH,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@situm/react-native",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.17.0-beta.0",
|
|
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>",
|
package/src/sdk/index.ts
CHANGED
|
@@ -315,6 +315,13 @@ export default class SitumPlugin {
|
|
|
315
315
|
*/
|
|
316
316
|
|
|
317
317
|
static setDashboardURL = (url: string) => {
|
|
318
|
+
if (!url.startsWith("https://")) {
|
|
319
|
+
url = "https://" + url;
|
|
320
|
+
}
|
|
321
|
+
if (url.endsWith("/")) {
|
|
322
|
+
url = url.substring(0, url.length - 1);
|
|
323
|
+
}
|
|
324
|
+
|
|
318
325
|
return exceptionWrapper<void>(({ onCallback }) => {
|
|
319
326
|
RNCSitumPlugin.setDashboardURL(url, (response: { success: boolean }) => {
|
|
320
327
|
onCallback(response, "Failed to set dashboard URL.");
|
|
@@ -4,6 +4,7 @@ import React, {
|
|
|
4
4
|
useCallback,
|
|
5
5
|
useEffect,
|
|
6
6
|
useImperativeHandle,
|
|
7
|
+
useMemo,
|
|
7
8
|
useRef,
|
|
8
9
|
useState,
|
|
9
10
|
} from "react";
|
|
@@ -22,7 +23,13 @@ import type {
|
|
|
22
23
|
|
|
23
24
|
import SitumPlugin from "../../sdk";
|
|
24
25
|
import useSitum from "../hooks";
|
|
25
|
-
import {
|
|
26
|
+
import {
|
|
27
|
+
selectApiDomain,
|
|
28
|
+
selectUser,
|
|
29
|
+
setError,
|
|
30
|
+
setLocationStatus,
|
|
31
|
+
} from "../store";
|
|
32
|
+
import { useSelector } from "../store/utils";
|
|
26
33
|
import {
|
|
27
34
|
type CartographySelectionOptions,
|
|
28
35
|
type MapViewDirectionsOptions,
|
|
@@ -65,10 +72,14 @@ export type MapViewConfiguration = {
|
|
|
65
72
|
*/
|
|
66
73
|
viewerDomain?: string;
|
|
67
74
|
/**
|
|
68
|
-
*
|
|
69
|
-
*
|
|
75
|
+
* Your Situm API key. Find your API key at your [Situm dashboard's profile](https://dashboard.situm.com/accounts/profile)
|
|
76
|
+
*
|
|
77
|
+
* Since X.YY.ZZ version this parameter is not required. Instead, you should specify your apiKey
|
|
78
|
+
* at the root of your app with `SitumProvider.apiKey` for the correct usage of the plugin.
|
|
79
|
+
* If {@param situmApiKey} is specified, `SitumProvider.apiKey` will be ignored.
|
|
70
80
|
*/
|
|
71
|
-
|
|
81
|
+
// TODO: set the version on the doc right before releasing this version.
|
|
82
|
+
situmApiKey?: string;
|
|
72
83
|
/**
|
|
73
84
|
* @deprecated Use `profile` instead.
|
|
74
85
|
* A String identifier that allows you to remotely configure all map settings.
|
|
@@ -143,6 +154,10 @@ export interface MapViewProps {
|
|
|
143
154
|
* @param event {@link OnFavoritePoisUpdatedResult} object.
|
|
144
155
|
*/
|
|
145
156
|
onFavoritePoisUpdated?: (event: OnFavoritePoisUpdatedResult) => void;
|
|
157
|
+
/**
|
|
158
|
+
* Internal callback invoked with every MapView message.
|
|
159
|
+
*/
|
|
160
|
+
onInternalMapViewMessageDelegate?: (type: string, payload: any) => void;
|
|
146
161
|
}
|
|
147
162
|
|
|
148
163
|
const MapView = React.forwardRef<MapViewRef, MapViewProps>(
|
|
@@ -157,6 +172,7 @@ const MapView = React.forwardRef<MapViewRef, MapViewProps>(
|
|
|
157
172
|
onFloorChanged = () => {},
|
|
158
173
|
onExternalLinkClicked = undefined,
|
|
159
174
|
onFavoritePoisUpdated = () => {},
|
|
175
|
+
onInternalMapViewMessageDelegate = () => {},
|
|
160
176
|
},
|
|
161
177
|
ref,
|
|
162
178
|
) => {
|
|
@@ -169,6 +185,9 @@ const MapView = React.forwardRef<MapViewRef, MapViewProps>(
|
|
|
169
185
|
const [buildingIdentifier, setBuildingIdentifier] = useState<string>(
|
|
170
186
|
configuration.buildingIdentifier,
|
|
171
187
|
);
|
|
188
|
+
|
|
189
|
+
const user = useSelector(selectUser);
|
|
190
|
+
const apiDomain = useSelector(selectApiDomain);
|
|
172
191
|
const {
|
|
173
192
|
init,
|
|
174
193
|
location,
|
|
@@ -509,8 +528,15 @@ const MapView = React.forwardRef<MapViewRef, MapViewProps>(
|
|
|
509
528
|
}, [mapLoaded]);
|
|
510
529
|
|
|
511
530
|
const handleRequestFromViewer = (event: WebViewMessageEvent) => {
|
|
512
|
-
|
|
513
|
-
|
|
531
|
+
let eventParsed: any = {};
|
|
532
|
+
try {
|
|
533
|
+
eventParsed = JSON.parse(event.nativeEvent.data);
|
|
534
|
+
} catch (err) {
|
|
535
|
+
console.warn("Invalid JSON from viewer:", err);
|
|
536
|
+
}
|
|
537
|
+
const type = eventParsed?.type ?? "message.unknown";
|
|
538
|
+
const payload = eventParsed?.payload ?? {};
|
|
539
|
+
switch (type) {
|
|
514
540
|
case "app.map_is_ready":
|
|
515
541
|
init();
|
|
516
542
|
setMapLoaded(true);
|
|
@@ -518,53 +544,63 @@ const MapView = React.forwardRef<MapViewRef, MapViewProps>(
|
|
|
518
544
|
onLoad && onLoad("");
|
|
519
545
|
break;
|
|
520
546
|
case "directions.requested":
|
|
521
|
-
calculateRoute(
|
|
547
|
+
calculateRoute(payload, _onDirectionsRequestInterceptor);
|
|
522
548
|
break;
|
|
523
549
|
case "navigation.requested":
|
|
524
|
-
startNavigation(
|
|
550
|
+
startNavigation(payload, _onDirectionsRequestInterceptor);
|
|
525
551
|
break;
|
|
526
552
|
case "navigation.stopped":
|
|
527
553
|
stopNavigation();
|
|
528
554
|
break;
|
|
529
555
|
case "cartography.poi_selected":
|
|
530
|
-
onPoiSelected(
|
|
556
|
+
onPoiSelected(payload);
|
|
531
557
|
break;
|
|
532
558
|
case "cartography.poi_deselected":
|
|
533
|
-
onPoiDeselected(
|
|
559
|
+
onPoiDeselected(payload);
|
|
534
560
|
break;
|
|
535
561
|
case "ui.favorite_pois_updated": {
|
|
536
562
|
const favoritePoisIds = {
|
|
537
|
-
currentPoisIdentifiers:
|
|
538
|
-
? [...
|
|
563
|
+
currentPoisIdentifiers: payload.favoritePois
|
|
564
|
+
? [...payload.favoritePois]
|
|
539
565
|
: [],
|
|
540
566
|
};
|
|
541
567
|
onFavoritePoisUpdated(favoritePoisIds);
|
|
542
568
|
break;
|
|
543
569
|
}
|
|
544
570
|
case "cartography.floor_selected":
|
|
545
|
-
onFloorChanged(
|
|
571
|
+
onFloorChanged(payload);
|
|
546
572
|
break;
|
|
547
573
|
case "cartography.building_selected":
|
|
548
574
|
if (
|
|
549
|
-
!
|
|
550
|
-
|
|
575
|
+
!payload.identifier ||
|
|
576
|
+
payload.identifier.toString() === buildingIdentifier
|
|
551
577
|
) {
|
|
552
578
|
return;
|
|
553
579
|
} else {
|
|
554
|
-
setBuildingIdentifier(
|
|
580
|
+
setBuildingIdentifier(payload.identifier.toString());
|
|
555
581
|
}
|
|
556
582
|
break;
|
|
557
583
|
case "viewer.navigation.started":
|
|
558
584
|
case "viewer.navigation.updated":
|
|
559
585
|
case "viewer.navigation.stopped":
|
|
560
|
-
SitumPlugin.updateNavigationState(
|
|
586
|
+
SitumPlugin.updateNavigationState(payload);
|
|
561
587
|
break;
|
|
562
588
|
case "ui.speak_aloud_text":
|
|
563
|
-
SitumPlugin.speakAloudText(
|
|
589
|
+
SitumPlugin.speakAloudText(payload);
|
|
564
590
|
break;
|
|
565
591
|
default:
|
|
566
592
|
break;
|
|
567
593
|
}
|
|
594
|
+
// Internal callback that will receive every MapView message. This callback
|
|
595
|
+
// has been introduced to enable communication between MapView and the new AR
|
|
596
|
+
// module, serving as a direct and extensible mode that avoids the
|
|
597
|
+
// intermediation of this plugin.
|
|
598
|
+
try {
|
|
599
|
+
typeof onInternalMapViewMessageDelegate === "function" &&
|
|
600
|
+
onInternalMapViewMessageDelegate(type, payload);
|
|
601
|
+
} catch (error) {
|
|
602
|
+
console.error(`Error delegating ${type}:`, error);
|
|
603
|
+
}
|
|
568
604
|
};
|
|
569
605
|
|
|
570
606
|
const _onShouldStartLoadWithRequest = (request: any) => {
|
|
@@ -586,8 +622,31 @@ const MapView = React.forwardRef<MapViewRef, MapViewProps>(
|
|
|
586
622
|
return true;
|
|
587
623
|
};
|
|
588
624
|
|
|
589
|
-
const
|
|
590
|
-
|
|
625
|
+
const _effectiveApiKey = useMemo(() => {
|
|
626
|
+
const internalApiKey = user?.apiKey;
|
|
627
|
+
const configApiKey = configuration.situmApiKey;
|
|
628
|
+
|
|
629
|
+
if (!configApiKey && !internalApiKey) {
|
|
630
|
+
console.error(
|
|
631
|
+
"No apiKey was specified. Make sure to be authenticated either by specifying the SitumProvider.apiKey or by specifying the MapViewConfiguration.situmApiKey.",
|
|
632
|
+
);
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
return configApiKey ?? internalApiKey;
|
|
636
|
+
}, [user?.apiKey, configuration.situmApiKey]);
|
|
637
|
+
|
|
638
|
+
const _effectiveProfile = useMemo(() => {
|
|
639
|
+
let effectiveProfile: any = "";
|
|
640
|
+
|
|
641
|
+
if (
|
|
642
|
+
configuration.profile?.length === 0 &&
|
|
643
|
+
configuration.remoteIdentifier?.length === 0
|
|
644
|
+
) {
|
|
645
|
+
effectiveProfile = "";
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
effectiveProfile = configuration.profile;
|
|
649
|
+
|
|
591
650
|
if (
|
|
592
651
|
configuration.remoteIdentifier &&
|
|
593
652
|
configuration.remoteIdentifier.length > 0
|
|
@@ -599,8 +658,31 @@ const MapView = React.forwardRef<MapViewRef, MapViewProps>(
|
|
|
599
658
|
effectiveProfile = configuration.remoteIdentifier;
|
|
600
659
|
}
|
|
601
660
|
}
|
|
661
|
+
|
|
602
662
|
return effectiveProfile;
|
|
603
|
-
};
|
|
663
|
+
}, [configuration.profile, configuration.remoteIdentifier]);
|
|
664
|
+
|
|
665
|
+
const _effectiveApiDomain = useMemo(() => {
|
|
666
|
+
let finalApiDomain = configuration.apiDomain ?? apiDomain;
|
|
667
|
+
|
|
668
|
+
if (!finalApiDomain) return "";
|
|
669
|
+
|
|
670
|
+
finalApiDomain = finalApiDomain.replace("https://", "");
|
|
671
|
+
finalApiDomain = finalApiDomain.replace("/", "");
|
|
672
|
+
|
|
673
|
+
return `&domain=${finalApiDomain}`;
|
|
674
|
+
}, [apiDomain, configuration.apiDomain]);
|
|
675
|
+
|
|
676
|
+
const _effectiveBuildingId = useMemo(() => {
|
|
677
|
+
let finalBuildingIdentifier = "";
|
|
678
|
+
const buildingId = configuration.buildingIdentifier;
|
|
679
|
+
|
|
680
|
+
if (buildingId && buildingId.length > 0) {
|
|
681
|
+
finalBuildingIdentifier = `&buildingid=${buildingId}`;
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
return finalBuildingIdentifier;
|
|
685
|
+
}, [configuration.buildingIdentifier]);
|
|
604
686
|
|
|
605
687
|
const _disableInternalWebViewTTSEngine = () => {
|
|
606
688
|
sendMessageToViewer(
|
|
@@ -615,15 +697,9 @@ const MapView = React.forwardRef<MapViewRef, MapViewProps>(
|
|
|
615
697
|
<WebView
|
|
616
698
|
ref={webViewRef}
|
|
617
699
|
source={{
|
|
618
|
-
uri: `${configuration.viewerDomain || SITUM_BASE_DOMAIN}/${
|
|
619
|
-
|
|
620
|
-
}
|
|
621
|
-
configuration.situmApiKey
|
|
622
|
-
}&wl=true&global=true&mode=embed${
|
|
623
|
-
configuration.buildingIdentifier
|
|
624
|
-
? `&buildingid=${configuration.buildingIdentifier}`
|
|
625
|
-
: ""
|
|
626
|
-
}&show=rts`,
|
|
700
|
+
uri: `${configuration.viewerDomain || SITUM_BASE_DOMAIN}/${_effectiveProfile}?apikey=${
|
|
701
|
+
_effectiveApiKey
|
|
702
|
+
}${_effectiveApiDomain}${_effectiveBuildingId}&mode=embed`,
|
|
627
703
|
}}
|
|
628
704
|
style={StyleSheet.flatten([viewerStyles.webview, style])}
|
|
629
705
|
limitsNavigationsToAppBoundDomains={true}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable no-case-declarations */
|
|
1
2
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
3
|
import { useContext, useState } from "react";
|
|
3
4
|
|
|
@@ -66,15 +67,15 @@ export const useSitumInternal = () => {
|
|
|
66
67
|
(internalCall: InternalCall) => {
|
|
67
68
|
switch (internalCall.type) {
|
|
68
69
|
case InternalCallType.LOCATION:
|
|
69
|
-
|
|
70
|
+
const receivedLocation = internalCall.get<Location>();
|
|
70
71
|
dispatch(
|
|
71
72
|
setLocation({
|
|
72
|
-
...
|
|
73
|
+
...receivedLocation,
|
|
73
74
|
}),
|
|
74
75
|
);
|
|
75
76
|
break;
|
|
76
77
|
case InternalCallType.LOCATION_STATUS:
|
|
77
|
-
|
|
78
|
+
const statusName = internalCall.get<string>();
|
|
78
79
|
if (statusName in LocationStatusName) {
|
|
79
80
|
dispatch(setLocationStatus(statusName));
|
|
80
81
|
}
|
|
@@ -84,8 +85,8 @@ export const useSitumInternal = () => {
|
|
|
84
85
|
dispatch(resetLocation());
|
|
85
86
|
break;
|
|
86
87
|
case InternalCallType.LOCATION_ERROR:
|
|
87
|
-
|
|
88
|
-
dispatch(setError(
|
|
88
|
+
const receivedError = internalCall.get<Error>();
|
|
89
|
+
dispatch(setError(receivedError));
|
|
89
90
|
break;
|
|
90
91
|
case InternalCallType.NAVIGATION_START:
|
|
91
92
|
dispatch(
|
|
@@ -104,7 +105,7 @@ export const useSitumInternal = () => {
|
|
|
104
105
|
);
|
|
105
106
|
break;
|
|
106
107
|
case InternalCallType.NAVIGATION_PROGRESS:
|
|
107
|
-
|
|
108
|
+
const progress = internalCall.get<NavigationProgress>();
|
|
108
109
|
dispatch(
|
|
109
110
|
setNavigation({
|
|
110
111
|
currentIndication: progress?.currentIndication,
|