atriusmaps-node-sdk 3.3.446 → 3.3.448
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
|
@@ -38,13 +38,21 @@ async function create (app, config) {
|
|
|
38
38
|
|
|
39
39
|
const mergeWithProp = (prop, toAdd, o) => R__namespace.over(R__namespace.lensProp(prop), old => R__namespace.mergeRight(old || {}, toAdd), o);
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
41
|
+
// This function counts the number of characters that match at the beginning of two strings.
|
|
42
|
+
const countMatchedPrefix = (a, b) => a.split('').reduce((max, _, i) => a.substring(0, i + 1) === b.substring(0, i + 1) ? i : max, -1) + 1;
|
|
43
|
+
|
|
44
|
+
// This function returns the venue definition for a specific language. It does this by filtering the venueList for the specified language,
|
|
45
|
+
// sorting the results by how many characters match at the beginning of the venueId, and
|
|
46
|
+
// returning the first one. If no venues match, undefined is returned.
|
|
47
|
+
const getVenueDefForLang = (venueData, lang) =>
|
|
48
|
+
Object.values(venueData.venueList)
|
|
49
|
+
.filter(venueDef => venueDef.locale === lang) // select all the venues for the specified language
|
|
50
|
+
.sort((a, b) => countMatchedPrefix(b.id, venueData.id) - countMatchedPrefix(a.id, venueData.id)) // sort by how many characters match at the beginning of the venueId - most first
|
|
51
|
+
.at(0); // take the first one, which is the one that matches the most characters at the beginning of the venueId
|
|
52
|
+
|
|
53
|
+
// This function determines the "base venue ID", which currently is the venue ID of the Engilsh version of the venue.
|
|
54
|
+
// We can use the venueList to find the English version of the venue, and then return its ID.
|
|
55
|
+
const calculateBaseVenueId = venueData => getVenueDefForLang(venueData, 'en')?.id;
|
|
48
56
|
|
|
49
57
|
async function loadVenueData (vConfig, languagesToTry) {
|
|
50
58
|
// For all non-production stages, require SSO (if no assetStage defined we default to 'prod')
|
|
@@ -62,13 +70,10 @@ async function create (app, config) {
|
|
|
62
70
|
|
|
63
71
|
venueData.defaultOrdinal = venueData.defaultOrdinal || getDefaultOrdinal(venueData);
|
|
64
72
|
venueData.structures = venueLoadingUtils.buildStructures(venueData);
|
|
65
|
-
|
|
66
|
-
const langObj = getLanguageObject(currentLang);
|
|
67
|
-
venueData.bareVenueId = venueId.slice(0, venueId.length - langObj.assetSuffix.length);
|
|
73
|
+
venueData.baseVenueId = calculateBaseVenueId(venueData);
|
|
68
74
|
venueData.getTranslatedContentPath = contentType => `https://content.locuslabs.com/${venueData.category}/${contentType}/${venueId}/${accountId}`;
|
|
69
75
|
venueData.fetchJson = fetchJson;
|
|
70
76
|
venueData.fetchText = fetchText;
|
|
71
|
-
log.info('venueData ', venueData, langObj, currentLang);
|
|
72
77
|
if (app.config.debug && app.env.isBrowser)
|
|
73
78
|
window._venueData = venueData;
|
|
74
79
|
|
|
@@ -349,14 +354,6 @@ async function create (app, config) {
|
|
|
349
354
|
.then(notifyState);
|
|
350
355
|
});
|
|
351
356
|
|
|
352
|
-
app.bus.on('venueData/changeVenueLanguage', async ({ lang }) => {
|
|
353
|
-
return venueDataLoaded.then(async venueData => {
|
|
354
|
-
const langObj = getLanguageObject(lang);
|
|
355
|
-
const newVenueId = `${venueData.bareVenueId}${langObj.assetSuffix}`;
|
|
356
|
-
app.bus.send('venueData/loadNewVenue', { accountId: config.accountId, venueId: newVenueId });
|
|
357
|
-
})
|
|
358
|
-
});
|
|
359
|
-
|
|
360
357
|
// returns a full URL to an image hosted on img.locuslabs.com, size has to be a string of format ${width}x${height}
|
|
361
358
|
app.bus.on('venueData/getPoiImageUrl', ({ imageName, size }) => {
|
|
362
359
|
return `https://img.locuslabs.com/resize/${config.accountId}/png/transparent/${size}contain/poi/${imageName}`
|
|
@@ -366,7 +363,7 @@ async function create (app, config) {
|
|
|
366
363
|
// for now it uses venueId and accountId and is used to fix collision when storing data in localStorage
|
|
367
364
|
app.bus.on('venueData/getDistributionId', () => {
|
|
368
365
|
return venueDataLoaded.then(venueData => {
|
|
369
|
-
return `${venueData.
|
|
366
|
+
return `${venueData.baseVenueId}-${config.accountId}`
|
|
370
367
|
})
|
|
371
368
|
});
|
|
372
369
|
|
|
@@ -384,13 +381,37 @@ async function create (app, config) {
|
|
|
384
381
|
|
|
385
382
|
app.bus.on('venueData/getAssetsTimestamp', getVenueDataProp('version'));
|
|
386
383
|
|
|
387
|
-
app.bus.on('venueData/getTranslatedFloorId', async ({ floorId }) =>
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
384
|
+
app.bus.on('venueData/getTranslatedFloorId', async ({ floorId }) =>
|
|
385
|
+
venueDataLoaded.then(venueData => getTranslatedFloorId(floorId, venueData)));
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* Takes a floorId that may be from the same venue but localized differently
|
|
389
|
+
* so it must be converted to this venue's floorId. FloorIds are of the form
|
|
390
|
+
* <venueId>-<buildingId>-<levelId> where <venueId> has a 2-letter suffice from
|
|
391
|
+
* its baseVenueId.
|
|
392
|
+
*
|
|
393
|
+
* e.g. dfw-building1-level1 -> dfwxx-building1-level1
|
|
394
|
+
* or dfwxx-building1-level1 -> dfw-building1-level1
|
|
395
|
+
* or dfwxx-building1-level1 -> dfwyy-building1-level1
|
|
396
|
+
*
|
|
397
|
+
* @param {string} floorId - The floor ID to translate.
|
|
398
|
+
* @param {Object} venueData - The venue data object containing the baseVenueId and structures.
|
|
399
|
+
* @returns {string} - The translated floor ID that matches the venue's baseVenue
|
|
400
|
+
*/
|
|
401
|
+
function getTranslatedFloorId (floorId, venueData) {
|
|
402
|
+
const allFloorIds = getAllFloorIds(venueData);
|
|
403
|
+
|
|
404
|
+
if (allFloorIds.includes(floorId))
|
|
405
|
+
return floorId // already in this venue
|
|
406
|
+
|
|
407
|
+
const buildingLevel = floorId.split('-').slice(1).join('-'); // get the building-level part of the floorId
|
|
408
|
+
|
|
409
|
+
// find a floor in the current venueData that matches the specified floorId with just an adjustment to the venueId portion in floorId string construct
|
|
410
|
+
return allFloorIds.find(fid => new RegExp(`${venueData.baseVenueId}.?.?-${buildingLevel}`).test(fid))
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
// returns a list of all floor ids in the venue data
|
|
414
|
+
const getAllFloorIds = venueData => venueData.structures.reduce((floors, s) => floors.concat(Object.keys(s.levels)), []);
|
|
394
415
|
|
|
395
416
|
/**
|
|
396
417
|
* Returns object with queue types (security and immigration lanes) that are present in the venue defined in venue data.
|
|
@@ -466,7 +487,9 @@ async function create (app, config) {
|
|
|
466
487
|
init,
|
|
467
488
|
runTest,
|
|
468
489
|
internal: {
|
|
490
|
+
calculateBaseVenueId,
|
|
469
491
|
getDefaultStructureId,
|
|
492
|
+
getTranslatedFloorId,
|
|
470
493
|
setConfigProperty: (key, value) => { config[key] = value; }
|
|
471
494
|
}
|
|
472
495
|
}
|
package/dist/package.json.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e="web-engine",s="3.3.
|
|
1
|
+
var e="web-engine",s="3.3.448",o="UNLICENSED",t="module",r="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/**'",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",test:"jest --no-cache --verbose","test-watch":"jest --verbose --watch","test:vitest":"vitest run"},i=["defaults"],n={react:"^18.3.1"},c={"@azure/event-hubs":"^5.12.2","@dnd-kit/core":"^6.3.1","@dnd-kit/modifiers":"^9.0.0","@dnd-kit/sortable":"^10.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.5.0","@mapbox/mapbox-gl-draw-static-mode":"^1.0.1","@microsoft/applicationinsights-web":"^3.3.6","@turf/area":"^7.2.0","@turf/bbox-clip":"^7.2.0","@turf/bbox-polygon":"^7.2.0","@turf/circle":"^7.2.0","@turf/helpers":"^7.2.0","@turf/point-to-line-distance":"^7.2.0","@vitejs/plugin-react":"^4.3.4","axe-core":"^4.10.3",browserslist:"^4.24.4","crypto-browserify":"^3.12.1","cypress-axe":"^1.6.0","cypress-multi-reporters":"^2.0.5","cypress-real-events":"^1.14.0","file-loader":"^6.2.0",flexsearch:"^0.7.43","h3-js":"^4.1.0",i18next:"^20.6.1","i18next-browser-languagedetector":"^6.1.1","jest-transform-css":"6.0.2",jsdom:"^25.0.1",jsonschema:"^1.5.0",luxon:"^3.5.0","maplibre-gl":"^4.7.1","mini-css-extract-plugin":"^2.9.2","mocha-junit-reporter":"^2.2.1",mochawesome:"^7.1.3","node-polyfill-webpack-plugin":"^4.1.0","path-browserify":"^1.0.1","prop-types":"^15.8.1",ramda:"^0.30.1",react:"^18.3.1","react-compound-slider":"^3.4.0","react-dom":"^18.3.1","react-json-editor-ajrm":"^2.5.14","react-qr-svg":"^2.4.0","react-svg":"^16.3.0","react-virtualized-auto-sizer":"^1.0.25","react-window":"^1.8.11","smoothscroll-polyfill":"^0.4.4","styled-components":"^6.1.15","styled-normalize":"^8.1.1","throttle-debounce":"^5.0.2",trackjs:"^3.10.4","ua-parser-js":"^0.7.40",uuid:"11.1.0",zousan:"^3.0.1","zousan-plus":"^4.0.1"},p={"@applitools/eyes-cypress":"^3.51.0","@babel/core":"^7.26.10","@babel/eslint-parser":"^7.26.10","@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.26.3","@babel/plugin-transform-runtime":"^7.26.10","@babel/preset-env":"^7.26.9","@babel/preset-react":"^7.26.3","@testing-library/jest-dom":"^6.6.3","@types/react":"^19.0.10","@types/react-dom":"^19.0.4","@typescript-eslint/eslint-plugin":"^8.26.1","@typescript-eslint/parser":"^8.26.1","babel-jest":"^29.7.0","babel-loader":"^10.0.0","babel-plugin-inline-json-import":"^0.3.2","babel-plugin-module-resolver":"^5.0.2","babel-plugin-styled-components":"^2.1.4","chai-colors":"^1.0.1","css-loader":"^7.1.2",cypress:"^14.2.0","cypress-browser-permissions":"^1.1.0","cypress-wait-until":"^3.0.2",eslint:"^8.57.1","eslint-config-standard":"^17.1.0","eslint-import-resolver-typescript":"^3.9.1","eslint-plugin-cypress":"^2.15.2","eslint-plugin-import":"^2.31.0","eslint-plugin-jest":"^28.11.0","eslint-plugin-n":"^17.16.2","eslint-plugin-node":"^11.1.0","eslint-plugin-promise":"^5.2.0","eslint-plugin-react":"^7.37.4","eslint-plugin-standard":"^5.0.0","fetch-mock-jest":"^1.5.1",glob:"^11.0.1",husky:"^9.1.7",jest:"29.7.0","jest-environment-jsdom":"^29.7.0","lint-staged":"^15.5.0","node-fetch":"^2.7.0","null-loader":"^4.0.1",nx:"19.8.14","nx-remotecache-azure":"^19.0.0","os-browserify":"^0.3.0","start-server-and-test":"^2.0.11",typescript:"^5.8.2",vite:"^4.3.9",vitest:"^2.1.9","webpack-merge":"^6.0.1"},d="yarn@4.7.0",m={node:"22.x"},u={},b={name:e,version:s,private:!0,license:o,type:t,main:r,workspaces:l,scripts:a,"lint-staged":{"*.js":["eslint --fix"]},browserslist:i,resolutions:n,dependencies:c,devDependencies:p,packageManager:d,engines:m,nx:u};export{i as browserslist,b as default,c as dependencies,p as devDependencies,m as engines,o as license,r as main,e as name,u as nx,d as packageManager,n as resolutions,a as scripts,t as type,s as version,l as workspaces};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"ramda";import
|
|
1
|
+
import*as e from"ramda";import t from"zousan";import{normalizeCoords as a,getVenueDataFromUrls as n,buildStructures as s,createFetchJson as r,createFetchText as u}from"./venueLoadingUtils.js";async function o(o,i){const d=o.log.sublog("venueDataLoader");let l=new t,c=new t;const p=t=>t.defaultStructureId||e.path(["structureOrder",0],t)||e.path(["selectorOrder",0],t)||e.pipe(e.prop("structures"),Object.values,e.path([0,"id"]))(t),v=(e,t)=>e.split("").reduce(((a,n,s)=>e.substring(0,s+1)===t.substring(0,s+1)?s:a),-1)+1,g=e=>((e,t)=>Object.values(e.venueList).filter((e=>e.locale===t)).sort(((t,a)=>v(a.id,e.id)-v(t.id,e.id))).at(0))(e,"en")?.id;async function f(t,a){t.assetStage&&"prod"!==t.assetStage&&location.hostname;const i=r(),d=u(),c=await n(t,i,a),{accountId:v,venueId:f}=t;return c.assetStage=t.assetStage,c.defaultOrdinal=c.defaultOrdinal||function(t){const a=p(t),n=Object.values(t.structures).find(e.propEq(a,"id"));return n.levels[n.defaultLevelId].ordinal}(c),c.structures=s(c),c.baseVenueId=g(c),c.getTranslatedContentPath=e=>`https://content.locuslabs.com/${c.category}/${e}/${f}/${v}`,c.fetchJson=i,c.fetchText=d,o.config.debug&&o.env.isBrowser&&(window._venueData=c),c.queueTypes&&(c.securityQueueTypes=(()=>{const e=c.queueTypes.find((e=>"SecurityLane"===e.id));return e?e.subtypes.map((e=>e.id)):[]})()),o.bus.send("venueData/venueDataLoaded",{venueData:c}),l.resolve(c),l}function b(e){const t={id:"venueDataLoader"};return e.id!==i.venueId&&(t.vid=e.id),t.lang=o.i18n().language,"prod"!==e.assetStage&&(t.stage=e.assetStage),o.bus.send("deepLinking/notifyState",t),e}o.bus.on("debugTools/fileDrop",(async({file:e,content:t})=>{if("application/json"===e.type){const e=JSON.parse(t);if(e.basemap&&e["basemap.venue"])return n=JSON.parse(t),void o.bus.send("map/replaceTheme",{theme:n});if(e.metadata&&e.metadata["mapbox:type"])return a=t,void o.bus.send("map/replaceStyle",{styleSrc:a})}var a,n}));async function m(e){const t={...e},a=await o.bus.get("poi/getAll");return Object.values(t).forEach((e=>e.filter((e=>"poi"===e.properties.aiLayer&&"Point"===e.geometry.type)).forEach((e=>{const t=a[e.properties.id];t?t.mapLabel?e.properties.text=t.mapLabel:!1!==i.copyPOINamesToMap&&(e.properties.text=function(e){let t=e.name;return i.poiMapNameXForm?(Object.keys(i.poiMapNameXForm).filter((t=>((e,t)=>e===t||0===e.indexOf(t+"."))(e.category,t))).forEach((e=>{i.poiMapNameXForm[e].forEach((e=>t=t.replace(new RegExp(e.replace),e.with)))})),t):t}(t)):d.warn(`Unknown poi in style: ${e.properties.id}`)})))),t}const h=(t,a,n,s)=>{const r=t.replace(/-[^-]*$/,""),u=r===n?"landscape-background":`ordinal: ${s.find(e.hasPath(["levels",t])).levels[t].ordinal}`;return a.map((a=>{var s,o,i;return s="properties",o={venueId:n,structureId:r,ordinalId:u,levelId:t},i=a,a=e.over(e.lensProp(s),(t=>e.mergeRight(t||{},o)),i),a=e.assoc("id",a.properties.subid,a)}))};o.bus.on("venueData/loadMap",(async()=>{l.then((async a=>{const n=await a.fetchText(a.files.style),s=await a.fetchJson(a.files.theme),r=a.files.spritesheet,u=a.files.glyphs,{id:d,bounds:l,structures:p,venueCenter:v,venueRadius:g,defaultOrdinal:f}=a,b=a.venueList[d].mapTokens?{[d]:[]}:await async function(a){return e.pipe(e.prop("structures"),e.map(e.prop("levels")),e.chain(e.keys),e.prepend(a.id),e.map((e=>a.files.geoJson.replace("${geoJsonId}",e))),e.map(a.fetchJson),e.map(e.andThen((e=>[e.id,h(e.id,e.features,a.id,a.structures)]))),(e=>t.all(e)),e.andThen(e.fromPairs))(a)}(a).then(m),y={mapFeatures:b,mapStyleSource:n,mapTheme:s,badgesSpriteUrl:r,mapGlyphsUrl:u,structures:p,defaultOrdinal:f,venueBounds:{n:l.ne.lat,s:l.sw.lat,e:l.ne.lng,w:l.sw.lng},venueId:d,venueCenter:v,venueRadius:g,accountId:i.accountId,secure:void 0!==i.auth,tileServerAuthInfo:a.tileServerAuthInfo};c.resolve(y),o.bus.send("venueData/mapDataLoaded",y)}))}));const y=e=>null==e.shouldDisplay||e.shouldDisplay;o.bus.on("venueData/loadBuildingSelectorData",(()=>l.then((async t=>{const a={buildings:t.structures.filter(y).map(e.evolve({levels:e.pipe(e.values,e.sortWith([e.descend(e.prop("ordinal"))]))})),structureOrder:t.structureOrder,selectorOrder:t.selectorOrder};return o.bus.send("venueData/buildingSelectorDataLoaded",a),a})))),o.bus.on("venueData/normalizeCoords",(({coords:e})=>l.then((t=>a(e,t.bounds)))));const D={edges:[],nodes:[]};o.bus.on("venueData/loadNavGraph",(async()=>l.then((async e=>{const t={navGraphData:e.files.nav?await e.fetchJson(e.files.nav):D,structures:e.structures};return o.bus.send("venueData/navGraphLoaded",t),t})))),o.bus.on("venueData/loadPoiData",(async()=>l.then((async e=>{const t=i.useOldDataModel?e.files.poisOld||e.files.pois:e.files.pois||e.files.poisOld;if(t){const a=await e.fetchJson(t);o.bus.send("venueData/poiDataLoaded",{pois:a,structures:e.structures})}})))),o.bus.on("venueData/getVenueCenter",(async()=>l.then((async e=>({lat:e.venueCenter[0],lng:e.venueCenter[1],ordinal:0}))))),o.bus.on("venueData/getContentUrl",(({type:e,name:t=""})=>l.then((a=>a.files[e]+t)))),o.bus.on("venueData/getFloorIdToNameMap",(()=>l.then(e.pipe(e.prop("structures"),e.map(e.prop("levels")),e.chain(e.values),e.map(e.props(["id","name"])),e.fromPairs)))),o.bus.on("venueData/getFloorIdName",(({floorId:t})=>l.then((async a=>{const n=e.pipe(e.values,e.find(e.hasPath(["levels",t])))(a.structures);return n?{structureId:n.id,structureName:n.name,floorName:n.levels[t].name}:null}))));const I=(t,a)=>()=>l.then(e.pipe(e.prop(t),e.defaultTo(a)));function w(e,t){const a=S(t);if(a.includes(e))return e;const n=e.split("-").slice(1).join("-");return a.find((e=>new RegExp(`${t.baseVenueId}.?.?-${n}`).test(e)))}o.bus.on("venueData/getVenueData",(()=>l)),o.bus.on("venueData/getVenueName",I("name")),o.bus.on("venueData/getVenueCategory",I("category")),o.bus.on("venueData/getVenueTimezone",I("tz")),o.bus.on("venueData/getAccountId",(()=>i.accountId)),o.bus.on("venueData/getVenueId",I("id")),o.bus.on("venueData/getPositioningSupported",I("positioningSupported")),o.bus.on("venueData/getStructures",I("structures")),o.bus.on("venueData/loadNewVenue",(async({venueId:e,accountId:a,assetStage:n=i.assetStage})=>{l.reject(new Error("loadNewVenue called - previous loading ignored")),c.reject(new Error("loadNewVenue called - previous loading ignored")),l=new t,c=new t,f({...i,venueId:e,accountId:a,assetStage:n},[]).then(b)})),o.bus.on("venueData/getPoiImageUrl",(({imageName:e,size:t})=>`https://img.locuslabs.com/resize/${i.accountId}/png/transparent/${t}contain/poi/${e}`)),o.bus.on("venueData/getDistributionId",(()=>l.then((e=>`${e.baseVenueId}-${i.accountId}`)))),o.bus.on("venueData/getCustomKeywords",(()=>l.then((e=>{const t=i.useOldDataModel&&e.files.searchOld||e.files.search;return e.fetchJson(t)})))),o.bus.on("venueData/isGrabEnabled",I("enableGrab")),o.bus.on("venueData/getGrabPoiIds",I("grabPoiIds",[])),o.bus.on("venueData/getAssetsTimestamp",I("version")),o.bus.on("venueData/getTranslatedFloorId",(async({floorId:e})=>l.then((t=>w(e,t)))));const S=e=>e.structures.reduce(((e,t)=>e.concat(Object.keys(t.levels))),[]);o.bus.on("venueData/getQueueTypes",(()=>l.then((e=>{const t=["tsapre","clear","globalEntry"];return e.queueTypes?e.queueTypes.reduce(((e,a)=>{const{id:n,subtypes:s}=a,r=s.map((e=>{const a=t.includes(e.id)&&`security-logo-${e.id.toLowerCase()}`;return{...e,imageId:a}}));return e[n]=r,e}),{}):{}}))));return{init:async()=>{let e=[];null===new URLSearchParams("undefined"==typeof window?"":window.location.search).get("lang")&&(e="undefined"==typeof window?[]:navigator.languages);const t=i.deepLinkProps||{};t.lang&&e.unshift(t.lang);const a=t.vid||i.venueId,n=i.useDynamicUrlParams&&t.stage?t.stage:i.assetStage,s=t.accountId||("alpha"===n?"A1VPTJKREFJWX5":i.accountId);f({...i,venueId:a,accountId:s,assetStage:n},e).then(b)},runTest:async({testRoutine:e,reset:a=!1,venueData:n=null})=>{let s,r;return(a||n)&&(l=new t,c=new t),n&&(l=t.resolve(n)),await e(),l.v&&(s=await l),c.v&&(r=await c),{venueDataObj:s,mapDataObj:r}},internal:{calculateBaseVenueId:g,getDefaultStructureId:p,getTranslatedFloorId:w,setConfigProperty:(e,t)=>{i[e]=t}}}}export{o as create};
|
package/package.json
CHANGED