atriusmaps-node-sdk 3.3.356 → 3.3.358
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/dist/cjs/package.json.js +1 -1
- package/dist/cjs/plugins/dynamicPois/src/dynamicPois.js +24 -106
- package/dist/cjs/plugins/dynamicPois/src/processors.js +98 -0
- package/dist/package.json.js +1 -1
- package/dist/plugins/dynamicPois/src/dynamicPois.js +1 -1
- package/dist/plugins/dynamicPois/src/processors.js +1 -0
- package/package.json +1 -1
package/dist/cjs/package.json.js
CHANGED
|
@@ -1,26 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var R = require('ramda');
|
|
4
3
|
var Zousan = require('zousan');
|
|
5
|
-
|
|
6
|
-
function _interopNamespaceDefault(e) {
|
|
7
|
-
var n = Object.create(null);
|
|
8
|
-
if (e) {
|
|
9
|
-
Object.keys(e).forEach(function (k) {
|
|
10
|
-
if (k !== 'default') {
|
|
11
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
12
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () { return e[k]; }
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
n.default = e;
|
|
20
|
-
return Object.freeze(n);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
var R__namespace = /*#__PURE__*/_interopNamespaceDefault(R);
|
|
4
|
+
var processors = require('./processors.js');
|
|
24
5
|
|
|
25
6
|
/*
|
|
26
7
|
This service obtains dynamic POI data from our own backend REST API service.
|
|
@@ -49,35 +30,28 @@ var R__namespace = /*#__PURE__*/_interopNamespaceDefault(R);
|
|
|
49
30
|
|
|
50
31
|
|
|
51
32
|
const REFRESH_FREQUENCY = 1000 * 30; // every 30 seconds
|
|
33
|
+
const V3_URL_BASE = 'https://rest.locuslabs.com/v3';
|
|
34
|
+
const V1_URL_BASE = 'https://rest.locuslabs.com/v1';
|
|
52
35
|
|
|
53
|
-
function create (app
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
36
|
+
function create (app) {
|
|
37
|
+
const state = {
|
|
38
|
+
dataLoadedProm: new Zousan(),
|
|
39
|
+
dynamicDataNotPending: new Zousan()
|
|
40
|
+
};
|
|
57
41
|
const T = app.gt();
|
|
58
42
|
|
|
59
43
|
const init = async () => {
|
|
60
|
-
const urlBaseNew = config.urlBase || 'https://rest.locuslabs.com/v3';
|
|
61
|
-
const urlBase = config.urlBaseV1 || config.urlBase || 'https://rest.locuslabs.com/v1';
|
|
62
44
|
const accountId = app.config.plugins.venueDataLoader.accountId;
|
|
63
45
|
|
|
64
46
|
async function getURL () {
|
|
65
|
-
return dataLoadedProm
|
|
66
|
-
.then(venueData => {
|
|
67
|
-
let url = `${urlBase}/venue/${venueData.id}/account/${accountId}/get-all-dynamic-pois/`;
|
|
68
|
-
if (urlBase.startsWith('./') || urlBase.endsWith('.json'))
|
|
69
|
-
url = urlBase;
|
|
70
|
-
return url
|
|
71
|
-
})
|
|
47
|
+
return state.dataLoadedProm
|
|
48
|
+
.then(venueData => `${V1_URL_BASE}/venue/${venueData.id}/account/${accountId}/get-all-dynamic-pois/`)
|
|
72
49
|
}
|
|
73
50
|
|
|
74
51
|
/*
|
|
75
52
|
API URL: https://gitlab.com/locuslabs/core-data-team/rest-api/-/blob/develop/v3/docs/REST%20API%20v3.postman_collection.json
|
|
76
53
|
*/
|
|
77
|
-
const getWaitTimesUrl = async () => dataLoadedProm.then(venueData =>
|
|
78
|
-
(urlBaseNew.startsWith('./') || urlBaseNew.endsWith('.json'))
|
|
79
|
-
? urlBaseNew
|
|
80
|
-
: `${urlBaseNew}/venueId/${venueData.id}/accountId/${accountId}/get-dynamic-queue-times/`);
|
|
54
|
+
const getWaitTimesUrl = async () => state.dataLoadedProm.then(venueData => `${V3_URL_BASE}/venueId/${venueData.id}/accountId/${accountId}/get-dynamic-queue-times/`);
|
|
81
55
|
|
|
82
56
|
const updateFromAPI = async () => {
|
|
83
57
|
Promise.all([
|
|
@@ -89,10 +63,10 @@ function create (app, config) {
|
|
|
89
63
|
.then(fetch)
|
|
90
64
|
.then(r => r.json())
|
|
91
65
|
.then(waitTimes => processSecurityWaitTimes(Date.now(), waitTimes))
|
|
92
|
-
]).then(() => dynamicDataNotPending.resolve(true))
|
|
66
|
+
]).then(() => state.dynamicDataNotPending.resolve(true))
|
|
93
67
|
.catch(err => {
|
|
94
68
|
console.error(err);
|
|
95
|
-
dynamicDataNotPending.resolve(true);
|
|
69
|
+
state.dynamicDataNotPending.resolve(true);
|
|
96
70
|
});
|
|
97
71
|
};
|
|
98
72
|
|
|
@@ -102,11 +76,11 @@ function create (app, config) {
|
|
|
102
76
|
// This will certainly need to change at some point.
|
|
103
77
|
const queueTypes = await app.bus.get('venueData/getQueueTypes');
|
|
104
78
|
if (queueTypes.SecurityLane && queueTypes.SecurityLane.length) {
|
|
105
|
-
dataLoadedProm
|
|
79
|
+
state.dataLoadedProm
|
|
106
80
|
.then(updateFromAPI)
|
|
107
81
|
.then(() => setInterval(updateFromAPI, REFRESH_FREQUENCY));
|
|
108
82
|
} else
|
|
109
|
-
dynamicDataNotPending.resolve(true); // no need to wait for this since there is no dynamic data
|
|
83
|
+
state.dynamicDataNotPending.resolve(true); // no need to wait for this since there is no dynamic data
|
|
110
84
|
};
|
|
111
85
|
|
|
112
86
|
function processDynamicPois (...args) {
|
|
@@ -115,21 +89,7 @@ function create (app, config) {
|
|
|
115
89
|
}
|
|
116
90
|
|
|
117
91
|
function processParkingPOIS (timeNowMs, poiMap) {
|
|
118
|
-
const idValuesMap =
|
|
119
|
-
R__namespace.pipe(
|
|
120
|
-
R__namespace.filter(poi => poi.category === 'parking'),
|
|
121
|
-
R__namespace.map(poi => {
|
|
122
|
-
const da = poi.dynamicAttributes;
|
|
123
|
-
if (!da)
|
|
124
|
-
throw Error(`No dynamicAttributes defined for parking POI ${poi.poiId}`)
|
|
125
|
-
const age = (timeNowMs - poi.timestamp) / 1000; // how long ago this was updated by backend (in seconds)
|
|
126
|
-
const props = (age < da['parking.timeToLive']) // if this update is recent enough, consider it "valid"
|
|
127
|
-
? R__namespace.pick(['lotStatus', 'rateDay', 'rateHour', 'timeIsReal', 'timeToTerminal1', 'timeToTerminal2'], poi)
|
|
128
|
-
: { lotStatus: da['parking.default'], rateDay: '$ -', rateHour: '$ -', timeIsReal: false };
|
|
129
|
-
|
|
130
|
-
return { ...props, lastUpdated: poi.timestamp, lotName: poi.lotName }
|
|
131
|
-
}))(poiMap);
|
|
132
|
-
|
|
92
|
+
const idValuesMap = processors.processParkingPOIS(timeNowMs, poiMap);
|
|
133
93
|
app.bus.send('poi/setDynamicData', { plugin: 'parking', idValuesMap });
|
|
134
94
|
}
|
|
135
95
|
|
|
@@ -143,82 +103,40 @@ function create (app, config) {
|
|
|
143
103
|
return nameMap
|
|
144
104
|
};
|
|
145
105
|
|
|
146
|
-
/**
|
|
147
|
-
*
|
|
148
|
-
* @param {Record<Number, DynamicQueueTime} queueTimes A map of POI Ids to dynamic queue times
|
|
149
|
-
* @param {Record<Number, String>} labels A map of POI Ids to map labels
|
|
150
|
-
* @param {*} feature A GeoJson feature
|
|
151
|
-
* @returns feature
|
|
152
|
-
*/
|
|
153
|
-
const mutateSecurityCheckpointLabel = (queueTimes, labels) => feature => {
|
|
154
|
-
const id = feature.properties.id;
|
|
155
|
-
const dynamicData = queueTimes[id];
|
|
156
|
-
const label = labels[id];
|
|
157
|
-
if (dynamicData) { // should we only show this message when "timeIsReal" is true?
|
|
158
|
-
const { queueTime, isTemporarilyClosed } = dynamicData;
|
|
159
|
-
const secondaryText = isTemporarilyClosed ? T('ui:Closed') : T('ui:_xx_ minute wait', { count: queueTime });
|
|
160
|
-
feature.properties.text = `${label}\n${secondaryText}`;
|
|
161
|
-
}
|
|
162
|
-
return feature
|
|
163
|
-
};
|
|
164
|
-
|
|
165
106
|
/*
|
|
166
107
|
API response: https://gitlab.com/locuslabs/core-data-team/json-schemas/-/blob/develop/src/api-marketplace/dynamic-queue-data.json
|
|
167
108
|
*/
|
|
168
109
|
async function processSecurityWaitTimes (timeNowMs, waitTimes) {
|
|
169
|
-
const idValuesMap =
|
|
170
|
-
R__namespace.map(waitTime => [waitTime.poiId, toDynamicWaitTime(timeNowMs, waitTime)]),
|
|
171
|
-
R__namespace.fromPairs
|
|
172
|
-
)(waitTimes);
|
|
110
|
+
const idValuesMap = processors.processSecurityWaitTimes(timeNowMs, waitTimes);
|
|
173
111
|
|
|
174
112
|
app.bus.send('poi/setDynamicData', { plugin: 'security', idValuesMap });
|
|
175
113
|
|
|
176
114
|
const labels = await getPOILabels(Object.keys(idValuesMap)); // get a map of labels for the POIs - used in wait time labeling
|
|
177
115
|
|
|
178
116
|
app.bus.send('map/mutateFeature', {
|
|
179
|
-
functor: mutateSecurityCheckpointLabel(idValuesMap, labels)
|
|
117
|
+
functor: processors.mutateSecurityCheckpointLabel(T, idValuesMap, labels)
|
|
180
118
|
});
|
|
181
119
|
}
|
|
182
120
|
|
|
183
|
-
const toDynamicWaitTime = (timeNowMs, waitTime) => ({
|
|
184
|
-
queueTime: waitTime.queueTime,
|
|
185
|
-
isTemporarilyClosed: waitTime.isTemporarilyClosed,
|
|
186
|
-
timeIsReal: !waitTime.isQueueTimeDefault && waitTime.expiration > timeNowMs,
|
|
187
|
-
lastUpdated: timeNowMs
|
|
188
|
-
});
|
|
189
|
-
|
|
190
121
|
function processOpenClosedPois (timeNowMs, poiMap) {
|
|
191
|
-
const
|
|
192
|
-
|
|
193
|
-
const openClosedStatuses = R__namespace.map(R__namespace.path(pathToOpenClosedData), openClosedPois);
|
|
194
|
-
|
|
195
|
-
if (R__namespace.all(R__namespace.both(R__namespace.has('isOpen'), R__namespace.has('expiration')), R__namespace.values(openClosedStatuses))) {
|
|
196
|
-
const isExpired = R__namespace.pipe(R__namespace.prop('expiration'), R__namespace.lt(timeNowMs));
|
|
197
|
-
const idValuesMap = R__namespace.filter(isExpired, openClosedStatuses);
|
|
198
|
-
|
|
199
|
-
app.bus.send('poi/setDynamicData', { plugin: 'open-closed-status', idValuesMap });
|
|
200
|
-
} else {
|
|
201
|
-
throw Error('Open Closed poi status is malformed.')
|
|
202
|
-
}
|
|
122
|
+
const idValuesMap = processors.processOpenClosedPois(timeNowMs, poiMap);
|
|
123
|
+
app.bus.send('poi/setDynamicData', { plugin: 'open-closed-status', idValuesMap });
|
|
203
124
|
}
|
|
204
125
|
|
|
205
126
|
app.bus.on('venueData/venueDataLoaded', ({ venueData }) => {
|
|
206
|
-
if (dataLoadedProm.v) // non-standard - indicates promise has been resolved...
|
|
207
|
-
dataLoadedProm = Zousan.resolve(venueData);
|
|
127
|
+
if (state.dataLoadedProm.v) // non-standard - indicates promise has been resolved...
|
|
128
|
+
state.dataLoadedProm = Zousan.resolve(venueData);
|
|
208
129
|
else
|
|
209
|
-
dataLoadedProm.resolve(venueData);
|
|
130
|
+
state.dataLoadedProm.resolve(venueData);
|
|
210
131
|
});
|
|
211
132
|
|
|
212
133
|
// by returning this dynamicDataLoaded promise, we hold sdkReady event until this is resolved
|
|
213
|
-
app.bus.on('system/readywhenyouare', () => dynamicDataNotPending);
|
|
134
|
+
app.bus.on('system/readywhenyouare', () => state.dynamicDataNotPending);
|
|
214
135
|
|
|
215
136
|
return {
|
|
216
137
|
init,
|
|
217
138
|
internal: {
|
|
218
|
-
mutateSecurityCheckpointLabel,
|
|
219
139
|
processSecurityWaitTimes,
|
|
220
|
-
processParkingPOIS,
|
|
221
|
-
processOpenClosedPois,
|
|
222
140
|
processDynamicPois
|
|
223
141
|
}
|
|
224
142
|
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var R = require('ramda');
|
|
4
|
+
|
|
5
|
+
function _interopNamespaceDefault(e) {
|
|
6
|
+
var n = Object.create(null);
|
|
7
|
+
if (e) {
|
|
8
|
+
Object.keys(e).forEach(function (k) {
|
|
9
|
+
if (k !== 'default') {
|
|
10
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
11
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function () { return e[k]; }
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
n.default = e;
|
|
19
|
+
return Object.freeze(n);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
var R__namespace = /*#__PURE__*/_interopNamespaceDefault(R);
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
* @param {Record<Number, DynamicQueueTime} queueTimes A map of POI Ids to dynamic queue times
|
|
27
|
+
* @param {Record<Number, String>} labels A map of POI Ids to map labels
|
|
28
|
+
* @param {*} feature A GeoJson feature
|
|
29
|
+
* @returns feature
|
|
30
|
+
*/
|
|
31
|
+
const mutateSecurityCheckpointLabel = (T, queueTimes, labels) => feature => {
|
|
32
|
+
const id = feature.properties.id;
|
|
33
|
+
const dynamicData = queueTimes[id];
|
|
34
|
+
const label = labels[id];
|
|
35
|
+
if (dynamicData) { // should we only show this message when "timeIsReal" is true?
|
|
36
|
+
const { queueTime, isTemporarilyClosed } = dynamicData;
|
|
37
|
+
const secondaryText = isTemporarilyClosed ? T('ui:Closed') : T('ui:_xx_ minute wait', { count: queueTime });
|
|
38
|
+
feature.properties.text = `${label}\n${secondaryText}`;
|
|
39
|
+
}
|
|
40
|
+
return feature
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const processParkingPOIS = (timeNowMs, poiMap) => {
|
|
44
|
+
const idValuesMap =
|
|
45
|
+
R__namespace.pipe(
|
|
46
|
+
R__namespace.filter(poi => poi.category === 'parking'),
|
|
47
|
+
R__namespace.map(poi => {
|
|
48
|
+
const da = poi.dynamicAttributes;
|
|
49
|
+
if (!da)
|
|
50
|
+
throw Error(`No dynamicAttributes defined for parking POI ${poi.poiId}`)
|
|
51
|
+
const age = (timeNowMs - poi.timestamp) / 1000; // how long ago this was updated by backend (in seconds)
|
|
52
|
+
const props = (age < da['parking.timeToLive']) // if this update is recent enough, consider it "valid"
|
|
53
|
+
? R__namespace.pick(['lotStatus', 'rateDay', 'rateHour', 'timeIsReal', 'timeToTerminal1', 'timeToTerminal2'], poi)
|
|
54
|
+
: { lotStatus: da['parking.default'], rateDay: '$ -', rateHour: '$ -', timeIsReal: false };
|
|
55
|
+
|
|
56
|
+
return { ...props, lastUpdated: poi.timestamp, lotName: poi.lotName }
|
|
57
|
+
}))(poiMap);
|
|
58
|
+
return idValuesMap
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const processOpenClosedPois = (timeNowMs, poiMap) => {
|
|
62
|
+
const pathToOpenClosedData = ['dynamicData', 'openClosed'];
|
|
63
|
+
const openClosedPois = R__namespace.filter(R__namespace.hasPath(pathToOpenClosedData), poiMap);
|
|
64
|
+
const openClosedStatuses = R__namespace.map(R__namespace.path(pathToOpenClosedData), openClosedPois);
|
|
65
|
+
|
|
66
|
+
if (R__namespace.all(R__namespace.both(R__namespace.has('isOpen'), R__namespace.has('expiration')), R__namespace.values(openClosedStatuses))) {
|
|
67
|
+
const isExpired = R__namespace.pipe(R__namespace.prop('expiration'), R__namespace.lt(timeNowMs));
|
|
68
|
+
const idValuesMap = R__namespace.filter(isExpired, openClosedStatuses);
|
|
69
|
+
|
|
70
|
+
return idValuesMap
|
|
71
|
+
} else {
|
|
72
|
+
throw Error('Open Closed poi status is malformed.')
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const toDynamicWaitTime = (timeNowMs, waitTime) => ({
|
|
77
|
+
queueTime: waitTime.queueTime,
|
|
78
|
+
isTemporarilyClosed: waitTime.isTemporarilyClosed,
|
|
79
|
+
timeIsReal: !waitTime.isQueueTimeDefault && waitTime.expiration > timeNowMs,
|
|
80
|
+
lastUpdated: timeNowMs
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
/*
|
|
84
|
+
API response: https://gitlab.com/locuslabs/core-data-team/json-schemas/-/blob/develop/src/api-marketplace/dynamic-queue-data.json
|
|
85
|
+
*/
|
|
86
|
+
const processSecurityWaitTimes = (timeNowMs, waitTimes) => {
|
|
87
|
+
const idValuesMap = R__namespace.pipe(
|
|
88
|
+
R__namespace.map(waitTime => [waitTime.poiId, toDynamicWaitTime(timeNowMs, waitTime)]),
|
|
89
|
+
R__namespace.fromPairs
|
|
90
|
+
)(waitTimes);
|
|
91
|
+
|
|
92
|
+
return idValuesMap
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
exports.mutateSecurityCheckpointLabel = mutateSecurityCheckpointLabel;
|
|
96
|
+
exports.processOpenClosedPois = processOpenClosedPois;
|
|
97
|
+
exports.processParkingPOIS = processParkingPOIS;
|
|
98
|
+
exports.processSecurityWaitTimes = processSecurityWaitTimes;
|
package/dist/package.json.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e="web-engine",s="3.3.
|
|
1
|
+
var e="web-engine",s="3.3.358",o="UNLICENSED",r="module",l="src/main.js",t=["demo","deploy","nodesdk","src/extModules/flexapi","services/*","libraries/*"],a={colors:"cat utils/colors1.txt && node utils/processColors.js | pbcopy && cat utils/colors2.txt","cypress:a11y":"APPLITOOLS_IS_DISABLED=true && cypress open --browser chrome --env INPUT_MODALITY='keyboard'","cypress:comp":"APPLITOOLS_IS_DISABLED=true && cypress open --component --browser chrome","cypress:e2e":"APPLITOOLS_IS_DISABLED=true && cypress open --e2e --browser chrome",demo:"cd demo/ && yarn start","e2e:comp":"cypress run --component","e2e:record":"yarn cypress run --env RECORD_MODE=true",e2eSDKTest:"yarn start-server-and-test 'cd ./deploy && yarn buildDev && yarn serveLocal' 8085 'cd ./cypress/e2e/sdk && npx http-server' 8080 'yarn cypress run --spec cypress/e2e/sdk/**'",e2eTest:"cypress run --browser chrome",goProd:"cd deploy && scripts/goProd.sh",goStaging:"deploy/scripts/goStaging.sh",i18nOverrides:"yarn node utils/i18nOverrideCli src/i18n src/i18n-overrides",lint:"eslint .",mod:"demo/startMod.sh",mol:"demo/startMol.sh","mol:build":"demo/startMolBuild.sh",molProd:"cd deploy && yarn buildAndRunMol",prepare:"husky install",test:"jest --no-cache --verbose","test-watch":"jest --verbose --watch","test:e2e:video":"cypress run","test:vitest":"vitest"},i=["defaults"],n={"@azure/event-hubs":"^5.12.2","@dnd-kit/core":"^6.1.0","@dnd-kit/modifiers":"^7.0.0","@dnd-kit/sortable":"^8.0.0","@dnd-kit/utilities":"^3.2.2","@john-osullivan/react-window-dynamic-fork":"^1.9.0-alpha.1","@locus-labs/mod-badge":"^0.1.102","@locus-labs/mod-default-theme":"^0.0.113","@locus-labs/mod-footer":"^0.0.111","@locus-labs/mod-header":"^0.0.105","@locus-labs/mod-location-marker":"^0.0.104","@locus-labs/mod-map-legend":"^0.0.104","@locus-labs/mod-offscreen-indicator":"^0.0.104","@locus-labs/mod-pin":"^0.0.104","@locus-labs/mod-qr-code-card":"^0.0.104","@locus-labs/mod-qr-code-window":"^0.0.105","@locus-labs/mod-walk-time-matrix":"^0.0.103","@locus-labs/mol-desktop-building-level-selector":"^0.1.119","@locus-labs/mol-desktop-compass":"^0.1.120","@locus-labs/mol-desktop-default-theme":"^0.2.105","@locus-labs/mol-desktop-icon":"^0.1.131","@locus-labs/mol-desktop-logo":"^0.1.101","@locus-labs/mol-desktop-map-nav-button":"^0.1.130","@locus-labs/mol-desktop-tooltip":"^0.3.102","@locus-labs/mol-desktop-zoom-control":"^0.1.141","@locus-labs/mol-mobile-box":"^0.1.115","@locus-labs/mol-mobile-floating-action-button":"^0.0.117","@locus-labs/mol-mobile-icon":"^0.1.118","@locus-labs/mol-mobile-text":"^0.1.116","@locus-labs/mol-mobile-toast":"^0.1.102","@mapbox/mapbox-gl-draw":"^1.4.3","@mapbox/mapbox-gl-draw-static-mode":"^1.0.1","@microsoft/applicationinsights-web":"^3.3.4","@turf/circle":"^6.5.0","@turf/helpers":"^6.5.0","@turf/point-to-line-distance":"^6.5.0","@vitejs/plugin-react":"^4.0.1",IObject:"^0.7.2","axe-core":"^4.9.0",browserslist:"^4.24.2","crypto-browserify":"^3.12.0","cypress-axe":"^1.5.0","cypress-multi-reporters":"^1.6.4","file-loader":"^6.2.0",flexsearch:"^0.7.43","h3-js":"^4.1.0",i18next:"^20.3.4","i18next-browser-languagedetector":"^6.1.1","jest-transform-css":"6.0.1",jsdom:"^25.0.1",jsonschema:"^1.2.6",luxon:"^3.3.0","maplibre-gl":"^4.7.1","mini-css-extract-plugin":"^1.6.0","mocha-junit-reporter":"^2.2.1",mochawesome:"^7.1.3","node-polyfill-webpack-plugin":"^1.1.4","path-browserify":"^1.0.1",polished:"^4.0.2","prop-types":"^15.7.2","query-string":"^8.1.0",ramda:"^0.30.1",react:"^17.0.2","react-compound-slider":"^3.3.1","react-dom":"^17.0.2","react-json-editor-ajrm":"^2.5.13","react-qr-svg":"^2.2.1","react-svg":"^16.1.29","react-tageditor":"^0.2.3","react-virtualized-auto-sizer":"^1.0.2","smoothscroll-polyfill":"^0.4.4","styled-components":"5.1.0","styled-normalize":"^8.0.6","throttle-debounce":"^3.0.1",trackjs:"^3.7.4","ua-parser-js":"^0.7.23",uuid:"3.3.2",zousan:"^3.0.1","zousan-plus":"^4.0.1"},c={"@applitools/eyes-cypress":"^3.47.0","@babel/core":"^7.26.0","@babel/eslint-parser":"^7.25.9","@babel/plugin-proposal-class-properties":"^7.18.6","@babel/plugin-syntax-dynamic-import":"^7.8.3","@babel/plugin-syntax-import-assertions":"^7.26.0","@babel/plugin-transform-modules-commonjs":"^7.25.9","@babel/plugin-transform-runtime":"^7.25.9","@babel/preset-env":"^7.26.0","@babel/preset-react":"^7.25.9","@testing-library/jest-dom":"^6.6.3","@typescript-eslint/eslint-plugin":"^7.13.0","@typescript-eslint/parser":"^7.13.0","babel-jest":"^27.0.6","babel-loader":"^8.2.2","babel-plugin-inline-json-import":"^0.3.2","babel-plugin-module-resolver":"^5.0.0","babel-polyfill":"^6.26.0","chai-colors":"^1.0.1","css-loader":"^5.2.4",cypress:"^12.17.2","cypress-browser-permissions":"^1.1.0","cypress-real-events":"^1.11.0","cypress-wait-until":"^1.7.1",eslint:"^8.57.0","eslint-config-standard":"^16.0.3","eslint-import-resolver-typescript":"^3.6.1","eslint-plugin-cypress":"^2.11.1","eslint-plugin-import":"^2.16.0","eslint-plugin-jest":"^28.6.0","eslint-plugin-node":"^11.1.0","eslint-plugin-promise":"^5.1.0","eslint-plugin-react":"^7.12.4","eslint-plugin-standard":"^5.0.0","fetch-mock-jest":"^1.3.0",glob:"^10.3.3",husky:"^6.0.0",jest:"29.7.0","jest-environment-jsdom":"^29.7.0","lint-staged":"^11.0.1","node-fetch":"^2.6.0","null-loader":"^4.0.1",nx:"19.4.2","nx-remotecache-azure":"^19.0.0","start-server-and-test":"^2.0.0",typescript:"^5.4.5",vite:"^4.3.9",vitest:"^2.1.5",webpack:"^5.96.1","webpack-merge":"^6.0.1"},p="yarn@4.3.1",d={node:">=20"},m={},u={name:e,version:s,private:!0,license:o,type:r,main:l,workspaces:t,scripts:a,"lint-staged":{"*.js":["eslint --fix"]},browserslist:i,dependencies:n,devDependencies:c,packageManager:p,engines:d,nx:m};export{i as browserslist,u as default,n as dependencies,c as devDependencies,d as engines,o as license,l as main,e as name,m as nx,p as packageManager,a as scripts,r as type,s as version,t as workspaces};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e from"zousan";import{processParkingPOIS as n,processSecurityWaitTimes as t,mutateSecurityCheckpointLabel as a,processOpenClosedPois as o}from"./processors.js";function s(s){const c={dataLoadedProm:new e,dynamicDataNotPending:new e},i=s.gt();function d(...e){!function(e,t){const a=n(e,t);s.bus.send("poi/setDynamicData",{plugin:"parking",idValuesMap:a})}(...e),function(e,n){const t=o(e,n);s.bus.send("poi/setDynamicData",{plugin:"open-closed-status",idValuesMap:t})}(...e)}const u=async e=>{const n={};for(const t of e){const e=await s.bus.get("poi/getById",{id:t});e&&(n[t]=e.name)}return n};async function r(e,n){const o=t(e,n);s.bus.send("poi/setDynamicData",{plugin:"security",idValuesMap:o});const c=await u(Object.keys(o));s.bus.send("map/mutateFeature",{functor:a(i,o,c)})}return s.bus.on("venueData/venueDataLoaded",(({venueData:n})=>{c.dataLoadedProm.v?c.dataLoadedProm=e.resolve(n):c.dataLoadedProm.resolve(n)})),s.bus.on("system/readywhenyouare",(()=>c.dynamicDataNotPending)),{init:async()=>{const e=s.config.plugins.venueDataLoader.accountId;async function n(){return c.dataLoadedProm.then((n=>`https://rest.locuslabs.com/v1/venue/${n.id}/account/${e}/get-all-dynamic-pois/`))}const t=async()=>c.dataLoadedProm.then((n=>`https://rest.locuslabs.com/v3/venueId/${n.id}/accountId/${e}/get-dynamic-queue-times/`)),a=async()=>{Promise.all([n().then(fetch).then((e=>e.json())).then((e=>d(Date.now(),e))),t().then(fetch).then((e=>e.json())).then((e=>r(Date.now(),e)))]).then((()=>c.dynamicDataNotPending.resolve(!0))).catch((e=>{console.error(e),c.dynamicDataNotPending.resolve(!0)}))},o=await s.bus.get("venueData/getQueueTypes");o.SecurityLane&&o.SecurityLane.length?c.dataLoadedProm.then(a).then((()=>setInterval(a,3e4))):c.dynamicDataNotPending.resolve(!0)},internal:{processSecurityWaitTimes:r,processDynamicPois:d}}}export{s as create};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as e from"ramda";const t=(e,t,i)=>a=>{const r=a.properties.id,o=t[r],p=i[r];if(o){const{queueTime:t,isTemporarilyClosed:i}=o,r=i?e("ui:Closed"):e("ui:_xx_ minute wait",{count:t});a.properties.text=`${p}\n${r}`}return a},i=(t,i)=>e.pipe(e.filter((e=>"parking"===e.category)),e.map((i=>{const a=i.dynamicAttributes;if(!a)throw Error(`No dynamicAttributes defined for parking POI ${i.poiId}`);return{...(t-i.timestamp)/1e3<a["parking.timeToLive"]?e.pick(["lotStatus","rateDay","rateHour","timeIsReal","timeToTerminal1","timeToTerminal2"],i):{lotStatus:a["parking.default"],rateDay:"$ -",rateHour:"$ -",timeIsReal:!1},lastUpdated:i.timestamp,lotName:i.lotName}})))(i),a=(t,i)=>{const a=["dynamicData","openClosed"],r=e.filter(e.hasPath(a),i),o=e.map(e.path(a),r);if(e.all(e.both(e.has("isOpen"),e.has("expiration")),e.values(o))){const i=e.pipe(e.prop("expiration"),e.lt(t));return e.filter(i,o)}throw Error("Open Closed poi status is malformed.")},r=(e,t)=>({queueTime:t.queueTime,isTemporarilyClosed:t.isTemporarilyClosed,timeIsReal:!t.isQueueTimeDefault&&t.expiration>e,lastUpdated:e}),o=(t,i)=>e.pipe(e.map((e=>[e.poiId,r(t,e)])),e.fromPairs)(i);export{t as mutateSecurityCheckpointLabel,a as processOpenClosedPois,i as processParkingPOIS,o as processSecurityWaitTimes};
|
package/package.json
CHANGED