atriusmaps-node-sdk 3.3.374 → 3.3.376
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
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var name = "web-engine";
|
|
6
|
-
var version = "3.3.
|
|
6
|
+
var version = "3.3.376";
|
|
7
7
|
var license = "UNLICENSED";
|
|
8
8
|
var type = "module";
|
|
9
9
|
var main = "src/main.js";
|
|
@@ -48,7 +48,6 @@ var dependencies = {
|
|
|
48
48
|
"@dnd-kit/modifiers": "^7.0.0",
|
|
49
49
|
"@dnd-kit/sortable": "^8.0.0",
|
|
50
50
|
"@dnd-kit/utilities": "^3.2.2",
|
|
51
|
-
"@john-osullivan/react-window-dynamic-fork": "^1.9.0-alpha.1",
|
|
52
51
|
"@locus-labs/mod-badge": "^0.1.102",
|
|
53
52
|
"@locus-labs/mod-default-theme": "^0.0.113",
|
|
54
53
|
"@locus-labs/mod-footer": "^0.0.111",
|
|
@@ -113,6 +112,7 @@ var dependencies = {
|
|
|
113
112
|
"react-svg": "^16.1.29",
|
|
114
113
|
"react-tageditor": "^0.2.3",
|
|
115
114
|
"react-virtualized-auto-sizer": "^1.0.2",
|
|
115
|
+
"react-window": "^1.8.11",
|
|
116
116
|
"smoothscroll-polyfill": "^0.4.4",
|
|
117
117
|
"styled-components": "5.1.0",
|
|
118
118
|
"styled-normalize": "^8.0.6",
|
|
@@ -29,17 +29,23 @@ var processors = require('./processors.js');
|
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
let REFRESH_FREQUENCY = 1000 * 30; // every 30 seconds
|
|
33
33
|
const MARKETPLACE_URL_BASE = 'https://marketplace.locuslabs.com';
|
|
34
34
|
|
|
35
|
+
const MAX_FETCH_FAILS = 3; // 3 strikes and you're out!
|
|
36
|
+
|
|
35
37
|
const ACCOUNT_ID_HEADER = 'x-account-id';
|
|
36
38
|
|
|
37
|
-
function create (app) {
|
|
39
|
+
function create (app, config = {}) {
|
|
38
40
|
const state = {
|
|
39
41
|
dynamicDataNotPending: new Zousan()
|
|
40
42
|
};
|
|
41
43
|
const T = app.gt();
|
|
42
44
|
|
|
45
|
+
// used in testing
|
|
46
|
+
if (config._overrideRefreshFrequency)
|
|
47
|
+
REFRESH_FREQUENCY = config._overrideRefreshFrequency;
|
|
48
|
+
|
|
43
49
|
// by returning this dynamicDataLoaded promise, we hold sdkReady event until this is resolved
|
|
44
50
|
app.bus.on('system/readywhenyouare', () => state.dynamicDataNotPending);
|
|
45
51
|
|
|
@@ -51,14 +57,24 @@ function create (app) {
|
|
|
51
57
|
|
|
52
58
|
const dynamicPoisUrl = `${MARKETPLACE_URL_BASE}/venueId/${venueId}/dynamic-poi`;
|
|
53
59
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
let fetchFailuresCount = 0;
|
|
61
|
+
let fetchSuccessCount = 0;
|
|
62
|
+
let fetchIntervalHandle;
|
|
63
|
+
const updateFromAPI = async () => {
|
|
64
|
+
const response = await fetch(dynamicPoisUrl, { headers: { [ACCOUNT_ID_HEADER]: accountId } });
|
|
65
|
+
if (response.ok) // 404 if customer does not have dynamic POIs
|
|
66
|
+
return response.json()
|
|
67
|
+
.then(({ data }) => processDynamicPois(data))
|
|
68
|
+
.then(() => { fetchSuccessCount++; })
|
|
69
|
+
.catch(console.error)
|
|
70
|
+
else {
|
|
71
|
+
console.warn('dynamicPois: fetch response status not ok', response);
|
|
72
|
+
fetchFailuresCount++;
|
|
73
|
+
// Don't keep trying after multiple fails unless past success is at least 50%
|
|
74
|
+
if (fetchFailuresCount >= MAX_FETCH_FAILS && fetchFailuresCount > fetchSuccessCount)
|
|
75
|
+
clearInterval(fetchIntervalHandle);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
62
78
|
|
|
63
79
|
// Currently, the only way to know if a venue has dynamic POIs is if they have security wait times
|
|
64
80
|
// and the only way we know that is if they have queueTypes.
|
|
@@ -67,7 +83,8 @@ function create (app) {
|
|
|
67
83
|
const queueTypes = await app.bus.get('venueData/getQueueTypes');
|
|
68
84
|
if (queueTypes.SecurityLane && queueTypes.SecurityLane.length) {
|
|
69
85
|
return updateFromAPI()
|
|
70
|
-
.then(() => setInterval(updateFromAPI, REFRESH_FREQUENCY))
|
|
86
|
+
.then(() => { fetchIntervalHandle = setInterval(updateFromAPI, REFRESH_FREQUENCY); })
|
|
87
|
+
.finally(() => state.dynamicDataNotPending.resolve(true)) // even in case of failure, we don't want to hold up the UI
|
|
71
88
|
} else
|
|
72
89
|
return state.dynamicDataNotPending.resolve(true) // no need to wait for this since there is no dynamic data
|
|
73
90
|
};
|
package/dist/package.json.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e="web-engine",s="3.3.
|
|
1
|
+
var e="web-engine",s="3.3.376",o="UNLICENSED",r="module",t="src/main.js",l=["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","@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","react-window":"^1.8.11","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.x"},m={},u={name:e,version:s,private:!0,license:o,type:r,main:t,workspaces:l,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,t as main,e as name,m as nx,p as packageManager,a as scripts,r as type,s as version,l as workspaces};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"zousan";import{processParkingPOIS as t,processSecurityWaitTimes as n,mutateSecurityCheckpointLabel as a,processOpenClosedPois as s}from"./processors.js";
|
|
1
|
+
import e from"zousan";import{processParkingPOIS as t,processSecurityWaitTimes as n,mutateSecurityCheckpointLabel as a,processOpenClosedPois as s}from"./processors.js";let o=3e4;const c="x-account-id";function i(i,r={}){const u={dynamicDataNotPending:new e},d=i.gt();r._overrideRefreshFrequency&&(o=r._overrideRefreshFrequency),i.bus.on("system/readywhenyouare",(()=>u.dynamicDataNotPending));const y=async e=>{const t={};for(const n of e){const e=await i.bus.get("poi/getById",{id:n});e&&(t[n]=e.name)}return t};return{init:async()=>{const[e,r]=await Promise.all([i.bus.get("venueData/getAccountId"),i.bus.get("venueData/getVenueId")]),l=`https://marketplace.locuslabs.com/venueId/${r}/dynamic-poi`;let p,m=0,g=0;const f=async()=>{const o=await fetch(l,{headers:{[c]:e}});if(o.ok)return o.json().then((({data:e})=>{return function(e){const n=t(e);i.bus.send("poi/setDynamicData",{plugin:"parking",idValuesMap:n})}(o=e),function(e){const t=s(e);i.bus.send("poi/setDynamicData",{plugin:"open-closed-status",idValuesMap:t})}(o),void async function(e){const t=n(e);i.bus.send("poi/setDynamicData",{plugin:"security",idValuesMap:t});const s=await y(Object.keys(t));i.bus.send("map/mutateFeature",{functor:a(d,t,s)})}(o);var o})).then((()=>{g++})).catch(console.error);console.warn("dynamicPois: fetch response status not ok",o),m++,m>=3&&m>g&&clearInterval(p)},D=await i.bus.get("venueData/getQueueTypes");return D.SecurityLane&&D.SecurityLane.length?f().then((()=>{p=setInterval(f,o)})).finally((()=>u.dynamicDataNotPending.resolve(!0))):u.dynamicDataNotPending.resolve(!0)}}}export{i as create};
|
package/package.json
CHANGED