@mappedin/react-native-sdk 3.4.4 → 4.0.4-alpha.8
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/README.md +12 -8
- package/dist/index.d.ts +5753 -0
- package/dist/index.js +3552 -0
- package/dist/index.js.map +7 -0
- package/package.json +26 -22
- package/CHANGELOG.md +0 -42
- package/dist/get-venue/package.json +0 -44
- package/dist/get-venue/src/Mappedin.API.types.d.ts +0 -203
- package/dist/get-venue/src/Mappedin.API.types.d.ts.map +0 -1
- package/dist/get-venue/src/Mappedin.API.types.js +0 -4
- package/dist/get-venue/src/Mappedin.d.ts +0 -256
- package/dist/get-venue/src/Mappedin.d.ts.map +0 -1
- package/dist/get-venue/src/Mappedin.js +0 -248
- package/dist/get-venue/src/Mappedin.types.d.ts +0 -30
- package/dist/get-venue/src/Mappedin.types.d.ts.map +0 -1
- package/dist/get-venue/src/Mappedin.types.js +0 -1
- package/dist/get-venue/src/MappedinCategory.d.ts +0 -48
- package/dist/get-venue/src/MappedinCategory.d.ts.map +0 -1
- package/dist/get-venue/src/MappedinCategory.js +0 -87
- package/dist/get-venue/src/MappedinCoordinate.d.ts +0 -42
- package/dist/get-venue/src/MappedinCoordinate.d.ts.map +0 -1
- package/dist/get-venue/src/MappedinCoordinate.js +0 -43
- package/dist/get-venue/src/MappedinCoordinate.test.d.ts +0 -2
- package/dist/get-venue/src/MappedinCoordinate.test.d.ts.map +0 -1
- package/dist/get-venue/src/MappedinCoordinate.test.js +0 -19
- package/dist/get-venue/src/MappedinDestinationSet.d.ts +0 -8
- package/dist/get-venue/src/MappedinDestinationSet.d.ts.map +0 -1
- package/dist/get-venue/src/MappedinDestinationSet.js +0 -6
- package/dist/get-venue/src/MappedinDirections.d.ts +0 -56
- package/dist/get-venue/src/MappedinDirections.d.ts.map +0 -1
- package/dist/get-venue/src/MappedinDirections.js +0 -42
- package/dist/get-venue/src/MappedinEvent.d.ts +0 -30
- package/dist/get-venue/src/MappedinEvent.d.ts.map +0 -1
- package/dist/get-venue/src/MappedinEvent.js +0 -67
- package/dist/get-venue/src/MappedinJSONScene.d.ts +0 -9
- package/dist/get-venue/src/MappedinJSONScene.d.ts.map +0 -1
- package/dist/get-venue/src/MappedinJSONScene.js +0 -24
- package/dist/get-venue/src/MappedinLocation.d.ts +0 -89
- package/dist/get-venue/src/MappedinLocation.d.ts.map +0 -1
- package/dist/get-venue/src/MappedinLocation.js +0 -223
- package/dist/get-venue/src/MappedinLocationRankings.d.ts +0 -12
- package/dist/get-venue/src/MappedinLocationRankings.d.ts.map +0 -1
- package/dist/get-venue/src/MappedinLocationRankings.js +0 -26
- package/dist/get-venue/src/MappedinLocationState.d.ts +0 -14
- package/dist/get-venue/src/MappedinLocationState.d.ts.map +0 -1
- package/dist/get-venue/src/MappedinLocationState.js +0 -33
- package/dist/get-venue/src/MappedinMap.d.ts +0 -64
- package/dist/get-venue/src/MappedinMap.d.ts.map +0 -1
- package/dist/get-venue/src/MappedinMap.js +0 -215
- package/dist/get-venue/src/MappedinMapGroup.d.ts +0 -23
- package/dist/get-venue/src/MappedinMapGroup.d.ts.map +0 -1
- package/dist/get-venue/src/MappedinMapGroup.js +0 -62
- package/dist/get-venue/src/MappedinNavigatable.d.ts +0 -38
- package/dist/get-venue/src/MappedinNavigatable.d.ts.map +0 -1
- package/dist/get-venue/src/MappedinNavigatable.js +0 -82
- package/dist/get-venue/src/MappedinNode.d.ts +0 -65
- package/dist/get-venue/src/MappedinNode.d.ts.map +0 -1
- package/dist/get-venue/src/MappedinNode.js +0 -153
- package/dist/get-venue/src/MappedinPolygon.d.ts +0 -60
- package/dist/get-venue/src/MappedinPolygon.d.ts.map +0 -1
- package/dist/get-venue/src/MappedinPolygon.js +0 -164
- package/dist/get-venue/src/MappedinRankings.d.ts +0 -32
- package/dist/get-venue/src/MappedinRankings.d.ts.map +0 -1
- package/dist/get-venue/src/MappedinRankings.js +0 -46
- package/dist/get-venue/src/MappedinTheme.d.ts +0 -15
- package/dist/get-venue/src/MappedinTheme.d.ts.map +0 -1
- package/dist/get-venue/src/MappedinTheme.js +0 -41
- package/dist/get-venue/src/MappedinVenue.d.ts +0 -47
- package/dist/get-venue/src/MappedinVenue.d.ts.map +0 -1
- package/dist/get-venue/src/MappedinVenue.js +0 -61
- package/dist/get-venue/src/MappedinVortex.d.ts +0 -26
- package/dist/get-venue/src/MappedinVortex.d.ts.map +0 -1
- package/dist/get-venue/src/MappedinVortex.js +0 -54
- package/dist/get-venue/src/default-things.d.ts +0 -14
- package/dist/get-venue/src/default-things.d.ts.map +0 -1
- package/dist/get-venue/src/default-things.js +0 -60
- package/dist/get-venue/src/fixtures/MappedinDemoMall.json +0 -1
- package/dist/get-venue/src/index.cjs.js +0 -16
- package/dist/get-venue/src/index.d.ts +0 -65
- package/dist/get-venue/src/index.d.ts.map +0 -1
- package/dist/get-venue/src/index.js +0 -16
- package/dist/get-venue/src/utils.d.ts +0 -15
- package/dist/get-venue/src/utils.d.ts.map +0 -1
- package/dist/get-venue/src/utils.js +0 -188
- package/dist/get-venue/tsconfig.docs.json +0 -7
- package/dist/get-venue/tsconfig.isomorphic.json +0 -20
- package/dist/get-venue/tsconfig.isomorphic.tsbuildinfo +0 -2262
- package/dist/get-venue/tsconfig.json +0 -19
- package/dist/get-venue/tsconfig.tsbuildinfo +0 -2758
- package/dist/sdk/src/MappedinController.d.ts +0 -45
- package/dist/sdk/src/MappedinController.d.ts.map +0 -1
- package/dist/sdk/src/MappedinController.js +0 -1
- package/dist/sdk/src/MiMapView.d.ts +0 -80
- package/dist/sdk/src/MiMapView.d.ts.map +0 -1
- package/dist/sdk/src/MiMapView.element.d.ts +0 -8
- package/dist/sdk/src/MiMapView.element.d.ts.map +0 -1
- package/dist/sdk/src/MiMapView.element.js +0 -5
- package/dist/sdk/src/MiMapView.element.web.d.ts +0 -6
- package/dist/sdk/src/MiMapView.element.web.d.ts.map +0 -1
- package/dist/sdk/src/MiMapView.element.web.js +0 -1
- package/dist/sdk/src/MiMapView.js +0 -1
- package/dist/sdk/src/MiMapView.store.d.ts +0 -197
- package/dist/sdk/src/MiMapView.store.d.ts.map +0 -1
- package/dist/sdk/src/MiMapView.store.js +0 -1
- package/dist/sdk/src/MiMapView.store.types.d.ts +0 -202
- package/dist/sdk/src/MiMapView.store.types.d.ts.map +0 -1
- package/dist/sdk/src/MiMapView.store.types.js +0 -1
- package/dist/sdk/src/MiMiniMap.d.ts +0 -31
- package/dist/sdk/src/MiMiniMap.d.ts.map +0 -1
- package/dist/sdk/src/MiMiniMap.js +0 -3
- package/dist/sdk/src/MiMiniMap.store.d.ts +0 -22
- package/dist/sdk/src/MiMiniMap.store.d.ts.map +0 -1
- package/dist/sdk/src/MiMiniMap.store.js +0 -1
- package/dist/sdk/src/assets/index.html.d.ts +0 -3
- package/dist/sdk/src/assets/index.html.d.ts.map +0 -1
- package/dist/sdk/src/assets/index.html.js +0 -1
- package/dist/sdk/src/index.d.ts +0 -186
- package/dist/sdk/src/index.d.ts.map +0 -1
- package/dist/sdk/src/index.js +0 -1
- package/dist/sdk/src/pub-sub.d.ts +0 -27
- package/dist/sdk/src/pub-sub.d.ts.map +0 -1
- package/dist/sdk/src/pub-sub.js +0 -1
- package/dist/sdk/src/utils.d.ts +0 -18
- package/dist/sdk/src/utils.d.ts.map +0 -1
- package/dist/sdk/src/utils.js +0 -1
- package/dist/sdk/tsconfig.build.tsbuildinfo +0 -6928
- package/dist/types/src/Mappedin.bridge.events.d.ts +0 -74
- package/dist/types/src/Mappedin.bridge.events.d.ts.map +0 -1
- package/dist/types/src/Mappedin.bridge.events.js +0 -1
- package/dist/types/src/index.d.ts +0 -4
- package/dist/types/src/index.d.ts.map +0 -1
- package/dist/types/src/index.js +0 -1
- package/dist/types/src/navigator.d.ts +0 -78
- package/dist/types/src/navigator.d.ts.map +0 -1
- package/dist/types/src/navigator.js +0 -1
- package/dist/types/tsconfig.tsbuildinfo +0 -1819
- package/dist/types_mappedin__mappedin-js/tsconfig.tsbuildinfo +0 -1781
- package/dist/types_mappedin__mappedin-js/types.d.ts +0 -205
- package/dist/types_mappedin__mappedin-js/types.d.ts.map +0 -1
- package/dist/types_mappedin__mappedin-js/types.js +0 -53
- package/docs/assets/css/main.css +0 -2660
- package/docs/assets/images/icons.png +0 -0
- package/docs/assets/images/icons@2x.png +0 -0
- package/docs/assets/images/widgets.png +0 -0
- package/docs/assets/images/widgets@2x.png +0 -0
- package/docs/assets/js/main.js +0 -248
- package/docs/assets/js/search.js +0 -1
- package/docs/classes/mappedin.html +0 -560
- package/docs/classes/mappedincategory.html +0 -373
- package/docs/classes/mappedindestinationset.html +0 -184
- package/docs/classes/mappedindirections.html +0 -258
- package/docs/classes/mappedinevent.html +0 -387
- package/docs/classes/mappedinlocation.html +0 -942
- package/docs/classes/mappedinmap.html +0 -501
- package/docs/classes/mappedinmapgroup.html +0 -329
- package/docs/classes/mappedinnode.html +0 -717
- package/docs/classes/mappedinpolygon.html +0 -714
- package/docs/classes/mappedinrankings.html +0 -288
- package/docs/classes/mappedinvenue.html +0 -494
- package/docs/classes/mappedinvortex.html +0 -331
- package/docs/classes/mapviewstore.html +0 -1233
- package/docs/enums/action_type.html +0 -188
- package/docs/enums/bearing_type.html +0 -188
- package/docs/enums/collision_ranking_tiers.html +0 -177
- package/docs/enums/e_bluedot_state.html +0 -223
- package/docs/enums/e_bluedot_state_reason.html +0 -197
- package/docs/enums/e_marker_state.html +0 -204
- package/docs/enums/marker_anchor.html +0 -188
- package/docs/enums/state.html +0 -160
- package/docs/index.html +0 -1078
- package/docs/modules.html +0 -1898
|
@@ -1,248 +0,0 @@
|
|
|
1
|
-
import { Navigator } from '@mappedin/navigator';
|
|
2
|
-
import { MappedinCategory } from './MappedinCategory';
|
|
3
|
-
import { MappedinEvent } from './MappedinEvent';
|
|
4
|
-
import { MappedinLocation } from './MappedinLocation';
|
|
5
|
-
import { MappedinLocationRankings } from './MappedinLocationRankings';
|
|
6
|
-
import { MappedinLocationState } from './MappedinLocationState';
|
|
7
|
-
import { MappedinMap } from './MappedinMap';
|
|
8
|
-
import { MappedinMapGroup } from './MappedinMapGroup';
|
|
9
|
-
import { MappedinNode } from './MappedinNode';
|
|
10
|
-
import { MappedinPolygon } from './MappedinPolygon';
|
|
11
|
-
import { MappedinRankings } from './MappedinRankings';
|
|
12
|
-
import { MappedinTheme } from './MappedinTheme';
|
|
13
|
-
import { MappedinVenue } from './MappedinVenue';
|
|
14
|
-
import { MappedinVortex } from './MappedinVortex';
|
|
15
|
-
import { isGatewayKey, preloadImagesFromBundle } from './utils';
|
|
16
|
-
export const defaultOptions = {
|
|
17
|
-
baseUrl: 'https://api-gateway.mappedin.com/public/1/',
|
|
18
|
-
supplementaryUrl: 'https://api-gateway.mappedin.com/analytics/',
|
|
19
|
-
headers: {},
|
|
20
|
-
accessToken: '',
|
|
21
|
-
clientId: '',
|
|
22
|
-
noAuth: false,
|
|
23
|
-
includeHidden: true,
|
|
24
|
-
do2D: false,
|
|
25
|
-
clientSecret: '',
|
|
26
|
-
apiGateway: '',
|
|
27
|
-
authorization: '',
|
|
28
|
-
perspective: 'Website',
|
|
29
|
-
language: '',
|
|
30
|
-
things: {},
|
|
31
|
-
venue: '',
|
|
32
|
-
};
|
|
33
|
-
export var CollectionType;
|
|
34
|
-
(function (CollectionType) {
|
|
35
|
-
CollectionType["CATEGORY"] = "categories";
|
|
36
|
-
CollectionType["EVENT"] = "events";
|
|
37
|
-
CollectionType["LOCATION"] = "locations";
|
|
38
|
-
CollectionType["MAPGROUP"] = "mapGroups";
|
|
39
|
-
CollectionType["MAP"] = "maps";
|
|
40
|
-
CollectionType["NODE"] = "nodes";
|
|
41
|
-
CollectionType["POLYGON"] = "polygons";
|
|
42
|
-
CollectionType["VORTEX"] = "vortexes";
|
|
43
|
-
})(CollectionType || (CollectionType = {}));
|
|
44
|
-
const THINGS = {
|
|
45
|
-
categories: MappedinCategory,
|
|
46
|
-
locations: MappedinLocation,
|
|
47
|
-
vortexes: MappedinVortex,
|
|
48
|
-
maps: MappedinMap,
|
|
49
|
-
nodes: MappedinNode,
|
|
50
|
-
polygons: MappedinPolygon,
|
|
51
|
-
venue: MappedinVenue,
|
|
52
|
-
events: MappedinEvent,
|
|
53
|
-
mapGroups: MappedinMapGroup,
|
|
54
|
-
themes: MappedinTheme,
|
|
55
|
-
locationStates: MappedinLocationState,
|
|
56
|
-
locationRankings: MappedinLocationRankings,
|
|
57
|
-
rankings: MappedinRankings,
|
|
58
|
-
};
|
|
59
|
-
export class Mappedin {
|
|
60
|
-
constructor(options) {
|
|
61
|
-
this.#cache = {};
|
|
62
|
-
this.#data = '';
|
|
63
|
-
this.categories = [];
|
|
64
|
-
this.locations = [];
|
|
65
|
-
this.vortexes = [];
|
|
66
|
-
this.maps = [];
|
|
67
|
-
this.nodes = [];
|
|
68
|
-
this.polygons = [];
|
|
69
|
-
this.venue = {};
|
|
70
|
-
this.events = [];
|
|
71
|
-
this.mapGroups = [];
|
|
72
|
-
this.themes = [];
|
|
73
|
-
this.locationStates = [];
|
|
74
|
-
/**
|
|
75
|
-
* @deprecated use polygonRankings instead
|
|
76
|
-
* TODO: remove when we know that nobody is using this
|
|
77
|
-
*/
|
|
78
|
-
this.locationRankings = [];
|
|
79
|
-
this.options = options;
|
|
80
|
-
}
|
|
81
|
-
#cache;
|
|
82
|
-
#data;
|
|
83
|
-
generateGetters(names) {
|
|
84
|
-
try {
|
|
85
|
-
for (let i = 0, iLen = names.length; i < iLen; ++i) {
|
|
86
|
-
const name = names[i];
|
|
87
|
-
if (Array.isArray(this[name])) {
|
|
88
|
-
Object.defineProperty(this, `_${name}ByExternalId`, {
|
|
89
|
-
get() {
|
|
90
|
-
const cache = this.#cache[name];
|
|
91
|
-
if (typeof cache !== 'undefined') {
|
|
92
|
-
return cache;
|
|
93
|
-
}
|
|
94
|
-
const result = {};
|
|
95
|
-
this[name].forEach((l) => (result[l.externalId] = l));
|
|
96
|
-
this.#cache[name] = result;
|
|
97
|
-
return result;
|
|
98
|
-
},
|
|
99
|
-
});
|
|
100
|
-
Object.defineProperty(this, `_${name}ById`, {
|
|
101
|
-
get() {
|
|
102
|
-
const cache = this.#cache[name];
|
|
103
|
-
if (typeof cache !== 'undefined') {
|
|
104
|
-
return cache;
|
|
105
|
-
}
|
|
106
|
-
const result = {};
|
|
107
|
-
this[name].forEach((l) => (result[l.id] = l));
|
|
108
|
-
this.#cache[name] = result;
|
|
109
|
-
return result;
|
|
110
|
-
},
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
return this;
|
|
115
|
-
}
|
|
116
|
-
catch (e) {
|
|
117
|
-
throw new Error(e);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
getCollectionItemById(name, id) {
|
|
121
|
-
const indexById = `_${name}ById`;
|
|
122
|
-
const indexByExternalId = `_${name}ByExternalId`;
|
|
123
|
-
let collection = this[indexById];
|
|
124
|
-
if (collection != null && collection[id] != null) {
|
|
125
|
-
// @ts-ignore
|
|
126
|
-
return collection[id];
|
|
127
|
-
}
|
|
128
|
-
collection = this[indexByExternalId];
|
|
129
|
-
if (collection != null && collection[id] != null) {
|
|
130
|
-
// @ts-ignore
|
|
131
|
-
return collection[id];
|
|
132
|
-
}
|
|
133
|
-
return null;
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
*
|
|
137
|
-
* [experimental] Hydrate the Mappedin instance using a response from either {@link IMappedin.toString()}, {@link getVenueBundle} or by downloading the bundle manually
|
|
138
|
-
*/
|
|
139
|
-
async hydrate(mappedinSerializableData) {
|
|
140
|
-
let mappedinData;
|
|
141
|
-
// if we receive a string,
|
|
142
|
-
if (typeof mappedinSerializableData === 'string') {
|
|
143
|
-
try {
|
|
144
|
-
// cache the string so we can easily access it internally later
|
|
145
|
-
this.#data = mappedinSerializableData;
|
|
146
|
-
mappedinData = JSON.parse(mappedinSerializableData);
|
|
147
|
-
}
|
|
148
|
-
catch (e) {
|
|
149
|
-
console.error('Unable to parse JSON', e);
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
|
-
if (this.options.useBundleAssets === true) {
|
|
153
|
-
// convert images into Blobs and append scene data - this ensures the bundle needs to more API calls to show map
|
|
154
|
-
await preloadImagesFromBundle(mappedinData);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
else {
|
|
158
|
-
mappedinData = mappedinSerializableData;
|
|
159
|
-
this.#data = JSON.stringify(mappedinData);
|
|
160
|
-
}
|
|
161
|
-
const names = Object.keys(mappedinData);
|
|
162
|
-
for (let i = 0, iLen = names.length; i < iLen; ++i) {
|
|
163
|
-
const name = names[i];
|
|
164
|
-
const data = mappedinData[name];
|
|
165
|
-
if (THINGS[name] != null && typeof THINGS[name].hydrate === 'function') {
|
|
166
|
-
this[name] = THINGS[name].hydrate(data, this);
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
const { images, scenes } = mappedinData;
|
|
170
|
-
this.images = images;
|
|
171
|
-
this.scenes = scenes;
|
|
172
|
-
this.generateGetters(names);
|
|
173
|
-
this.initNavigator();
|
|
174
|
-
}
|
|
175
|
-
async fetch() {
|
|
176
|
-
// Vortexes are required for offline directions
|
|
177
|
-
if (!('vortexes' in this.options.things)) {
|
|
178
|
-
this.options.things.vortexes = [
|
|
179
|
-
'name',
|
|
180
|
-
'type',
|
|
181
|
-
'accessible',
|
|
182
|
-
'weight',
|
|
183
|
-
'multiplier',
|
|
184
|
-
'nodes',
|
|
185
|
-
];
|
|
186
|
-
}
|
|
187
|
-
if (!('locationStates' in this.options.things)) {
|
|
188
|
-
this.options.things.locationStates = ['name', 'id', 'value'];
|
|
189
|
-
}
|
|
190
|
-
if (!isGatewayKey(this.options.clientId)) {
|
|
191
|
-
if (this.options.things.rankings) {
|
|
192
|
-
delete this.options.things.rankings;
|
|
193
|
-
}
|
|
194
|
-
if (this.options.things.locationRankings) {
|
|
195
|
-
delete this.options.things.locationRankings;
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
// here we traverse through "things" in order to fetch whichever ones we need
|
|
199
|
-
const { things } = this.options;
|
|
200
|
-
const promises = [];
|
|
201
|
-
const names = Object.keys(things);
|
|
202
|
-
for (let i = 0, iLen = names.length; i < iLen; ++i) {
|
|
203
|
-
const name = names[i];
|
|
204
|
-
// this[name] = await THINGS[name].fetch(this);
|
|
205
|
-
if (THINGS[name]) {
|
|
206
|
-
promises.push(THINGS[name].fetch(this).then((data) => {
|
|
207
|
-
this[name] = data;
|
|
208
|
-
return Promise.resolve();
|
|
209
|
-
}));
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
this.generateGetters(names);
|
|
213
|
-
return Promise.all(promises).then(() => {
|
|
214
|
-
this.initNavigator();
|
|
215
|
-
this.#data = JSON.stringify(this.toJSON());
|
|
216
|
-
});
|
|
217
|
-
}
|
|
218
|
-
initNavigator() {
|
|
219
|
-
this.navigator = new Navigator({
|
|
220
|
-
locations: this.locations.map((l) => l.toJSON()),
|
|
221
|
-
nodes: this.nodes.map((n) => n.toJSON()),
|
|
222
|
-
vortexes: this.vortexes.map((v) => v.toJSON()),
|
|
223
|
-
maps: this.maps.map((m) => m.toJSON()),
|
|
224
|
-
});
|
|
225
|
-
}
|
|
226
|
-
/**
|
|
227
|
-
* Export venue data to JSON (for storage, encryption, etc)
|
|
228
|
-
*/
|
|
229
|
-
toJSON() {
|
|
230
|
-
const jsonVenue = {};
|
|
231
|
-
for (const item in THINGS) {
|
|
232
|
-
if (Array.isArray(this[item])) {
|
|
233
|
-
jsonVenue[item] = this[item].map((p) => p.toJSON());
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
return {
|
|
237
|
-
...jsonVenue,
|
|
238
|
-
venue: this.venue.toJSON(),
|
|
239
|
-
rankings: this.rankings?.toJSON(),
|
|
240
|
-
};
|
|
241
|
-
}
|
|
242
|
-
/**
|
|
243
|
-
* Export venue data to String
|
|
244
|
-
*/
|
|
245
|
-
toString() {
|
|
246
|
-
return this.#data;
|
|
247
|
-
}
|
|
248
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export declare type TGetVenueOptions = {
|
|
2
|
-
accessToken?: string;
|
|
3
|
-
clientId?: string;
|
|
4
|
-
clientSecret?: string;
|
|
5
|
-
baseUrl?: string;
|
|
6
|
-
includeHidden?: boolean;
|
|
7
|
-
noAuth?: boolean;
|
|
8
|
-
perspective?: string;
|
|
9
|
-
language?: string;
|
|
10
|
-
headers?: {
|
|
11
|
-
[key in string]: string;
|
|
12
|
-
};
|
|
13
|
-
venue: string;
|
|
14
|
-
things?: any;
|
|
15
|
-
};
|
|
16
|
-
export declare type TGetVenueOptionsInternal = {
|
|
17
|
-
baseUrl?: string;
|
|
18
|
-
supplementaryUrl?: string;
|
|
19
|
-
noAuth?: boolean;
|
|
20
|
-
includeHidden?: boolean;
|
|
21
|
-
apiGateway?: string;
|
|
22
|
-
authorization?: string;
|
|
23
|
-
/**
|
|
24
|
-
* @deprecated 2D support will be removed in the future
|
|
25
|
-
*/
|
|
26
|
-
do2D?: boolean;
|
|
27
|
-
things?: any;
|
|
28
|
-
headers?: any;
|
|
29
|
-
};
|
|
30
|
-
//# sourceMappingURL=Mappedin.types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Mappedin.types.d.ts","sourceRoot":"","sources":["../../src/Mappedin.types.ts"],"names":[],"mappings":"AAAA,oBAAY,gBAAgB,GAAG;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE;SACP,GAAG,IAAI,MAAM,GAAG,MAAM;KACxB,CAAC;IACF,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,GAAG,CAAC;CACd,CAAC;AAEF,oBAAY,wBAAwB,GAAG;IACrC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,OAAO,CAAC,EAAE,GAAG,CAAC;CACf,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Collection of all Categories within the Venue.
|
|
3
|
-
*
|
|
4
|
-
* @property categories
|
|
5
|
-
* @type [MappedinCategory]
|
|
6
|
-
*/
|
|
7
|
-
import type { MappedinLocation } from './MappedinLocation';
|
|
8
|
-
import type { Mappedin } from './Mappedin';
|
|
9
|
-
import type { TPicture } from './Mappedin.API.types';
|
|
10
|
-
/**
|
|
11
|
-
* A {@link MappedinCategory} is a collection of similar Locations.
|
|
12
|
-
*
|
|
13
|
-
* A Category can have more properties such as 'name', or 'parents' (for hierarchical categories) as well.
|
|
14
|
-
* For example, you may have a Fashion category, which has a Men's Fashion and Women's Fashion category. A Men's clothing store would belong to the Men’s Fashion category, but not necessarily be present in the Fashion category's list of Locations.
|
|
15
|
-
*
|
|
16
|
-
* The {@link Mappedin} 'things' object is where you would specify what properties you want to download for Categories. Only specify what you will actually use, to minmimze transfer time. Work with your Mappedin developer relations contact to set up any custom properties you need.
|
|
17
|
-
*
|
|
18
|
-
* See below for an example a 'things' object with available Category properties specified:
|
|
19
|
-
*
|
|
20
|
-
* things: {
|
|
21
|
-
* venue: [],
|
|
22
|
-
* locations: [],
|
|
23
|
-
* categories: ['venue', 'name', 'language', 'externalId', 'parents'],
|
|
24
|
-
* maps: []
|
|
25
|
-
* }
|
|
26
|
-
*
|
|
27
|
-
* @class MappedinCategory
|
|
28
|
-
*/
|
|
29
|
-
export declare class MappedinCategory {
|
|
30
|
-
#private;
|
|
31
|
-
name?: string | undefined;
|
|
32
|
-
externalId?: string | undefined;
|
|
33
|
-
parents?: string[] | undefined;
|
|
34
|
-
id?: string | undefined;
|
|
35
|
-
icon?: TPicture | undefined;
|
|
36
|
-
constructor(mappedin: Mappedin, data: any);
|
|
37
|
-
/**
|
|
38
|
-
* Locations in this Category.
|
|
39
|
-
*
|
|
40
|
-
* @property locations
|
|
41
|
-
* @type [MappedinLocation]
|
|
42
|
-
*/
|
|
43
|
-
get locations(): MappedinLocation[];
|
|
44
|
-
static hydrate(categories: any, mappedin: Mappedin): MappedinCategory[];
|
|
45
|
-
static fetch(mappedin: Mappedin): Promise<MappedinCategory[]>;
|
|
46
|
-
toJSON(): any;
|
|
47
|
-
}
|
|
48
|
-
//# sourceMappingURL=MappedinCategory.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MappedinCategory.d.ts","sourceRoot":"","sources":["../../src/MappedinCategory.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAGrD;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,gBAAgB;;IAO3B,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE1B,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAEhC,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAE/B,EAAE,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAExB,IAAI,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;gBAEhB,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG;IAOzC;;;;;OAKG;IACH,IAAI,SAAS,IAAI,gBAAgB,EAAE,CAuBlC;IAED,MAAM,CAAC,OAAO,CAAC,UAAU,EAAE,GAAG,EAAE,QAAQ,EAAE,QAAQ,GAAG,gBAAgB,EAAE;WAI1D,KAAK,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAcnE,MAAM;CAGP"}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Collection of all Categories within the Venue.
|
|
3
|
-
*
|
|
4
|
-
* @property categories
|
|
5
|
-
* @type [MappedinCategory]
|
|
6
|
-
*/
|
|
7
|
-
import { getArray } from './utils';
|
|
8
|
-
/**
|
|
9
|
-
* A {@link MappedinCategory} is a collection of similar Locations.
|
|
10
|
-
*
|
|
11
|
-
* A Category can have more properties such as 'name', or 'parents' (for hierarchical categories) as well.
|
|
12
|
-
* For example, you may have a Fashion category, which has a Men's Fashion and Women's Fashion category. A Men's clothing store would belong to the Men’s Fashion category, but not necessarily be present in the Fashion category's list of Locations.
|
|
13
|
-
*
|
|
14
|
-
* The {@link Mappedin} 'things' object is where you would specify what properties you want to download for Categories. Only specify what you will actually use, to minmimze transfer time. Work with your Mappedin developer relations contact to set up any custom properties you need.
|
|
15
|
-
*
|
|
16
|
-
* See below for an example a 'things' object with available Category properties specified:
|
|
17
|
-
*
|
|
18
|
-
* things: {
|
|
19
|
-
* venue: [],
|
|
20
|
-
* locations: [],
|
|
21
|
-
* categories: ['venue', 'name', 'language', 'externalId', 'parents'],
|
|
22
|
-
* maps: []
|
|
23
|
-
* }
|
|
24
|
-
*
|
|
25
|
-
* @class MappedinCategory
|
|
26
|
-
*/
|
|
27
|
-
export class MappedinCategory {
|
|
28
|
-
constructor(mappedin, data) {
|
|
29
|
-
this.#cache = {};
|
|
30
|
-
this.id = data.id;
|
|
31
|
-
this.#data = data;
|
|
32
|
-
this.#mappedin = mappedin;
|
|
33
|
-
Object.assign(this, data);
|
|
34
|
-
}
|
|
35
|
-
#mappedin;
|
|
36
|
-
#cache;
|
|
37
|
-
#data;
|
|
38
|
-
/**
|
|
39
|
-
* Locations in this Category.
|
|
40
|
-
*
|
|
41
|
-
* @property locations
|
|
42
|
-
* @type [MappedinLocation]
|
|
43
|
-
*/
|
|
44
|
-
get locations() {
|
|
45
|
-
const cache = this.#cache.locations;
|
|
46
|
-
if (typeof cache !== 'undefined') {
|
|
47
|
-
return cache;
|
|
48
|
-
}
|
|
49
|
-
const related = [];
|
|
50
|
-
const { locations } = this.#mappedin;
|
|
51
|
-
const { id } = this;
|
|
52
|
-
for (let i = 0, iLen = locations.length; i < iLen; ++i) {
|
|
53
|
-
const location = locations[i];
|
|
54
|
-
const through = location.categories;
|
|
55
|
-
if (Array.isArray(through)) {
|
|
56
|
-
for (let j = 0, jLen = through.length; j < jLen; ++j) {
|
|
57
|
-
if (through[j] === id) {
|
|
58
|
-
related.push(location);
|
|
59
|
-
break;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
this.#cache.locations = related;
|
|
65
|
-
return related;
|
|
66
|
-
}
|
|
67
|
-
static hydrate(categories, mappedin) {
|
|
68
|
-
return categories.map((c) => new MappedinCategory(mappedin, c));
|
|
69
|
-
}
|
|
70
|
-
static async fetch(mappedin) {
|
|
71
|
-
const query = {
|
|
72
|
-
fields: mappedin.options.things.categories,
|
|
73
|
-
venue: mappedin.options.venue,
|
|
74
|
-
};
|
|
75
|
-
try {
|
|
76
|
-
const data = await getArray(mappedin.options, 'category', query);
|
|
77
|
-
return data.map((c) => new MappedinCategory(mappedin, c));
|
|
78
|
-
}
|
|
79
|
-
catch (e) {
|
|
80
|
-
console.error('Fetch Categories:', e);
|
|
81
|
-
return [];
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
toJSON() {
|
|
85
|
-
return this.#data;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import type { MappedinMap } from './MappedinMap';
|
|
2
|
-
/**
|
|
3
|
-
* A {@link MappedinCoordinate} represents a coordinate on a map, created using lat/lon.
|
|
4
|
-
*
|
|
5
|
-
* @class MappedinCoordinate
|
|
6
|
-
*/
|
|
7
|
-
export declare class MappedinCoordinate {
|
|
8
|
-
/**
|
|
9
|
-
* ID of Map that the Node is located on.
|
|
10
|
-
*
|
|
11
|
-
* @property map {string}
|
|
12
|
-
*/
|
|
13
|
-
map: string;
|
|
14
|
-
/**
|
|
15
|
-
* X coordinate in Mappedin Units
|
|
16
|
-
* @property x {number}
|
|
17
|
-
*/
|
|
18
|
-
x: number;
|
|
19
|
-
/**
|
|
20
|
-
* Y coordinate in Mappedin Units
|
|
21
|
-
* @property y {number}
|
|
22
|
-
*/
|
|
23
|
-
y: number;
|
|
24
|
-
/**
|
|
25
|
-
* Latitude
|
|
26
|
-
*/
|
|
27
|
-
lat: number;
|
|
28
|
-
/**
|
|
29
|
-
* Longitude
|
|
30
|
-
*/
|
|
31
|
-
lon: number;
|
|
32
|
-
constructor(lat: number, lon: number, x: number, y: number, map: MappedinMap | string);
|
|
33
|
-
/**
|
|
34
|
-
*
|
|
35
|
-
* Calculate distance between a coordinate and a {@link MappedinNode} or {@link MappedinCoordinate}
|
|
36
|
-
*
|
|
37
|
-
* @param destination Destination to measure real distance to
|
|
38
|
-
* @returns distance in meters
|
|
39
|
-
*/
|
|
40
|
-
absoluteDistanceTo(destination: MappedinCoordinate): number;
|
|
41
|
-
}
|
|
42
|
-
//# sourceMappingURL=MappedinCoordinate.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MappedinCoordinate.d.ts","sourceRoot":"","sources":["../../src/MappedinCoordinate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAGjD;;;;GAIG;AACH,qBAAa,kBAAkB;IAC7B;;;;OAIG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;;OAGG;IACH,CAAC,SAAK;IAEN;;;OAGG;IACH,CAAC,SAAK;IAEN;;OAEG;IACH,GAAG,SAAK;IAER;;OAEG;IACH,GAAG,SAAK;gBAGN,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,GAAG,EAAE,WAAW,GAAG,MAAM;IAS3B;;;;;;OAMG;IACH,kBAAkB,CAAC,WAAW,EAAE,kBAAkB,GAAG,MAAM;CAM5D"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { getDistanceBetweenLatLon } from './utils';
|
|
2
|
-
/**
|
|
3
|
-
* A {@link MappedinCoordinate} represents a coordinate on a map, created using lat/lon.
|
|
4
|
-
*
|
|
5
|
-
* @class MappedinCoordinate
|
|
6
|
-
*/
|
|
7
|
-
export class MappedinCoordinate {
|
|
8
|
-
constructor(lat, lon, x, y, map) {
|
|
9
|
-
/**
|
|
10
|
-
* X coordinate in Mappedin Units
|
|
11
|
-
* @property x {number}
|
|
12
|
-
*/
|
|
13
|
-
this.x = 0;
|
|
14
|
-
/**
|
|
15
|
-
* Y coordinate in Mappedin Units
|
|
16
|
-
* @property y {number}
|
|
17
|
-
*/
|
|
18
|
-
this.y = 0;
|
|
19
|
-
/**
|
|
20
|
-
* Latitude
|
|
21
|
-
*/
|
|
22
|
-
this.lat = 0;
|
|
23
|
-
/**
|
|
24
|
-
* Longitude
|
|
25
|
-
*/
|
|
26
|
-
this.lon = 0;
|
|
27
|
-
this.lat = lat;
|
|
28
|
-
this.lon = lon;
|
|
29
|
-
this.map = typeof map === 'string' ? map : map.id;
|
|
30
|
-
this.x = x;
|
|
31
|
-
this.y = y;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
*
|
|
35
|
-
* Calculate distance between a coordinate and a {@link MappedinNode} or {@link MappedinCoordinate}
|
|
36
|
-
*
|
|
37
|
-
* @param destination Destination to measure real distance to
|
|
38
|
-
* @returns distance in meters
|
|
39
|
-
*/
|
|
40
|
-
absoluteDistanceTo(destination) {
|
|
41
|
-
return getDistanceBetweenLatLon([destination.lat, destination.lon], [this.lat, this.lon]);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MappedinCoordinate.test.d.ts","sourceRoot":"","sources":["../../../../get-venue/src/MappedinCoordinate.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Mappedin } from './Mappedin';
|
|
2
|
-
import VenueDataMDM from './fixtures/MappedinDemoMall.json';
|
|
3
|
-
const noopCreds = {
|
|
4
|
-
clientId: 'abc',
|
|
5
|
-
clientSecret: '123',
|
|
6
|
-
venue: 'mappedin-demo-mall',
|
|
7
|
-
perspective: 'Website',
|
|
8
|
-
};
|
|
9
|
-
describe('Mappedin Node', () => {
|
|
10
|
-
it('should return correct lat/lon - Mappedin Demo Mall', async () => {
|
|
11
|
-
const venue = new Mappedin(noopCreds);
|
|
12
|
-
await venue.hydrate(VenueDataMDM);
|
|
13
|
-
const currentMap = venue.maps[1];
|
|
14
|
-
const coordinate = currentMap.createCoordinate(43.65667327935503, -79.38199076145924);
|
|
15
|
-
const coordinate2 = currentMap.createCoordinate(43.650989718095225, -79.38258068275101);
|
|
16
|
-
// this can be confirmed using a lat/lon distance calculator, such as https://www.meridianoutpost.com/resources/etools/calculators/calculator-latitude-longitude-distance.php?
|
|
17
|
-
expect(coordinate.absoluteDistanceTo(coordinate2)).toBe(633.7627551346746);
|
|
18
|
-
});
|
|
19
|
-
});
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { MappedinLocation } from './MappedinLocation';
|
|
2
|
-
import type { MappedinPolygon } from './MappedinPolygon';
|
|
3
|
-
import type { MappedinNode } from './MappedinNode';
|
|
4
|
-
export declare class MappedinDestinationSet {
|
|
5
|
-
destinations: (MappedinLocation | MappedinNode | MappedinPolygon)[];
|
|
6
|
-
constructor(destinations: (MappedinLocation | MappedinNode | MappedinPolygon)[]);
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=MappedinDestinationSet.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MappedinDestinationSet.d.ts","sourceRoot":"","sources":["../../src/MappedinDestinationSet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD,qBAAa,sBAAsB;IACjC,YAAY,EAAE,CAAC,gBAAgB,GAAG,YAAY,GAAG,eAAe,CAAC,EAAE,CAAM;gBAGvE,YAAY,EAAE,CAAC,gBAAgB,GAAG,YAAY,GAAG,eAAe,CAAC,EAAE;CAItE"}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { IDirectionsResult } from '@mappedin/navigator';
|
|
2
|
-
import { ACTION_TYPE, BEARING_TYPE } from '@mappedin/navigator/lib/Directive';
|
|
3
|
-
import type { Mappedin } from './Mappedin';
|
|
4
|
-
import type { MappedinMap } from './MappedinMap';
|
|
5
|
-
import type { MappedinNode } from './MappedinNode';
|
|
6
|
-
import type { MappedinVortex } from './MappedinVortex';
|
|
7
|
-
interface IActionDeparture {
|
|
8
|
-
type: ACTION_TYPE.DEPARTURE;
|
|
9
|
-
}
|
|
10
|
-
interface IActionArrival {
|
|
11
|
-
type: ACTION_TYPE.ARRIVAL;
|
|
12
|
-
}
|
|
13
|
-
interface IActionTakeVortex {
|
|
14
|
-
type: ACTION_TYPE.TAKEVORTEX;
|
|
15
|
-
toMap: MappedinMap;
|
|
16
|
-
fromMap: MappedinMap;
|
|
17
|
-
}
|
|
18
|
-
interface IActionExitVortex {
|
|
19
|
-
type: ACTION_TYPE.EXITVORTEX;
|
|
20
|
-
toMap: MappedinMap;
|
|
21
|
-
fromMap: MappedinMap;
|
|
22
|
-
}
|
|
23
|
-
interface IActionTurn {
|
|
24
|
-
type: ACTION_TYPE.TURN;
|
|
25
|
-
bearing: BEARING_TYPE;
|
|
26
|
-
referencePosition?: string;
|
|
27
|
-
}
|
|
28
|
-
export declare type IAction = IActionArrival | IActionDeparture | IActionTurn | IActionTakeVortex | IActionExitVortex;
|
|
29
|
-
/** this is the "overloaded" version of the directive, with get-venue classes instead of stubs */
|
|
30
|
-
export declare type TMappedinDirective = {
|
|
31
|
-
node: MappedinNode;
|
|
32
|
-
/**
|
|
33
|
-
* Distance from the last instruction to the current. Useful for turn by turn navigation
|
|
34
|
-
*/
|
|
35
|
-
distance: number;
|
|
36
|
-
instruction: string;
|
|
37
|
-
action?: IAction;
|
|
38
|
-
atLocation?: MappedinVortex;
|
|
39
|
-
type?: BEARING_TYPE;
|
|
40
|
-
};
|
|
41
|
-
/**
|
|
42
|
-
* Directions Object
|
|
43
|
-
*/
|
|
44
|
-
export declare class MappedinDirections {
|
|
45
|
-
#private;
|
|
46
|
-
/**
|
|
47
|
-
* Total Distance
|
|
48
|
-
*/
|
|
49
|
-
distance: number;
|
|
50
|
-
path: MappedinNode[];
|
|
51
|
-
instructions: TMappedinDirective[];
|
|
52
|
-
constructor(mappedin: Mappedin, directions: IDirectionsResult);
|
|
53
|
-
toJSON(): IDirectionsResult;
|
|
54
|
-
}
|
|
55
|
-
export {};
|
|
56
|
-
//# sourceMappingURL=MappedinDirections.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MappedinDirections.d.ts","sourceRoot":"","sources":["../../src/MappedinDirections.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD,UAAU,gBAAgB;IACxB,IAAI,EAAE,WAAW,CAAC,SAAS,CAAC;CAC7B;AAED,UAAU,cAAc;IACtB,IAAI,EAAE,WAAW,CAAC,OAAO,CAAC;CAC3B;AAED,UAAU,iBAAiB;IACzB,IAAI,EAAE,WAAW,CAAC,UAAU,CAAC;IAC7B,KAAK,EAAE,WAAW,CAAC;IACnB,OAAO,EAAE,WAAW,CAAC;CACtB;AAED,UAAU,iBAAiB;IACzB,IAAI,EAAE,WAAW,CAAC,UAAU,CAAC;IAC7B,KAAK,EAAE,WAAW,CAAC;IACnB,OAAO,EAAE,WAAW,CAAC;CACtB;AAED,UAAU,WAAW;IACnB,IAAI,EAAE,WAAW,CAAC,IAAI,CAAC;IACvB,OAAO,EAAE,YAAY,CAAC;IACtB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,oBAAY,OAAO,GACf,cAAc,GACd,gBAAgB,GAChB,WAAW,GACX,iBAAiB,GACjB,iBAAiB,CAAC;AAEtB,iGAAiG;AACjG,oBAAY,kBAAkB,GAAG;IAC/B,IAAI,EAAE,YAAY,CAAC;IACnB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,cAAc,CAAC;IAC5B,IAAI,CAAC,EAAE,YAAY,CAAC;CACrB,CAAC;AAEF;;GAEG;AACH,qBAAa,kBAAkB;;IAK7B;;OAEG;IACH,QAAQ,SAAK;IAEb,IAAI,EAAE,YAAY,EAAE,CAAM;IAE1B,YAAY,EAAE,kBAAkB,EAAE,CAAM;gBAE5B,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,iBAAiB;IAoC7D,MAAM,IAAI,iBAAiB;CAG5B"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { ACTION_TYPE } from '@mappedin/navigator/lib/Directive';
|
|
2
|
-
/**
|
|
3
|
-
* Directions Object
|
|
4
|
-
*/
|
|
5
|
-
export class MappedinDirections {
|
|
6
|
-
constructor(mappedin, directions) {
|
|
7
|
-
/**
|
|
8
|
-
* Total Distance
|
|
9
|
-
*/
|
|
10
|
-
this.distance = 0;
|
|
11
|
-
this.path = [];
|
|
12
|
-
this.instructions = [];
|
|
13
|
-
this.#mappedin = mappedin;
|
|
14
|
-
this.#data = directions;
|
|
15
|
-
this.distance = directions.distance;
|
|
16
|
-
// what we're doing here is basically "enhancing" what we get back from navigator, with Mappedin classes
|
|
17
|
-
this.instructions = directions.instructions.map((i) => {
|
|
18
|
-
const instruction = {
|
|
19
|
-
...i,
|
|
20
|
-
action: {
|
|
21
|
-
...i.action,
|
|
22
|
-
},
|
|
23
|
-
atLocation: i.atLocation?.id
|
|
24
|
-
? this.#mappedin?._vortexesById?.[i.atLocation.id]
|
|
25
|
-
: undefined,
|
|
26
|
-
node: i.node?.id ? this.#mappedin?._nodesById?.[i.node.id] : undefined,
|
|
27
|
-
};
|
|
28
|
-
if (instruction.action?.type === ACTION_TYPE.TAKEVORTEX ||
|
|
29
|
-
instruction.action?.type === ACTION_TYPE.EXITVORTEX) {
|
|
30
|
-
instruction.action.fromMap = this.#mappedin._mapsById?.[instruction.action?.fromMap.id];
|
|
31
|
-
instruction.action.toMap = this.#mappedin._mapsById?.[instruction.action?.toMap.id];
|
|
32
|
-
}
|
|
33
|
-
return instruction;
|
|
34
|
-
});
|
|
35
|
-
this.path = directions.path.map((node) => this.#mappedin?._nodesById?.[node.id]);
|
|
36
|
-
}
|
|
37
|
-
#data;
|
|
38
|
-
#mappedin;
|
|
39
|
-
toJSON() {
|
|
40
|
-
return this.#data;
|
|
41
|
-
}
|
|
42
|
-
}
|