atriusmaps-node-sdk 3.3.907 → 3.3.908

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.
@@ -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.907";
6
+ var version = "3.3.908";
7
7
  var license = "UNLICENSED";
8
8
  var type = "module";
9
9
  var main = "src/main.ts";
@@ -117,7 +117,7 @@ function create(app, config = {}) {
117
117
  for (const poiId of idArray) {
118
118
  const poi = await app.bus.get("poi/getById", { id: poiId });
119
119
  if (poi) {
120
- nameMap[poiId] = poi._originalName ?? poi.name;
120
+ nameMap[poiId] = poi.staticName ?? poi.name;
121
121
  }
122
122
  }
123
123
  return nameMap;
@@ -264,12 +264,17 @@ async function create(app) {
264
264
  });
265
265
  app.bus.on("poi/setCoreAttributes", (idAttributesMap) => {
266
266
  poisLoaded.then((pois) => {
267
+ const updatedPois = [];
267
268
  for (const poiId in idAttributesMap) {
268
- const changed = applyCorePoiAttributes(pois, poiId, idAttributesMap[poiId]);
269
+ const changed = applyPoiNameOverride(pois, poiId, idAttributesMap[poiId]?.name);
269
270
  if (changed) {
270
271
  app.bus.send("map/mutateFeature", { poiId, name: pois[poiId].name });
272
+ updatedPois.push(pois[poiId]);
271
273
  }
272
274
  }
275
+ if (updatedPois.length > 0) {
276
+ app.bus.send("poi/updated", { pois: updatedPois });
277
+ }
273
278
  });
274
279
  });
275
280
  const runTest = async (testRoutine) => {
@@ -282,24 +287,18 @@ async function create(app) {
282
287
  internal: {
283
288
  addImages,
284
289
  pseudoTransPoi,
285
- applyCorePoiAttributes
290
+ applyPoiNameOverride
286
291
  }
287
292
  };
288
293
  }
289
- function applyCorePoiAttributes(pois, poiId, attributes) {
294
+ function applyPoiNameOverride(pois, poiId, name) {
290
295
  if (!pois[poiId]) {
291
296
  return false;
292
297
  }
293
- const { name } = attributes;
294
298
  if (!name) {
295
- pois[poiId] = R__namespace.mergeRight(pois[poiId], {
296
- name: pois[poiId]._originalName ?? pois[poiId].name
297
- });
299
+ pois[poiId].name = pois[poiId].staticName;
298
300
  } else {
299
- if (!pois[poiId]._originalName) {
300
- pois[poiId] = R__namespace.mergeRight(pois[poiId], { _originalName: pois[poiId].name });
301
- }
302
- pois[poiId] = R__namespace.mergeRight(pois[poiId], { name });
301
+ pois[poiId].name = name;
303
302
  }
304
303
  return true;
305
304
  }
@@ -324,4 +323,5 @@ function pseudoTransPoi(poi, lang) {
324
323
  return poi;
325
324
  }
326
325
 
326
+ exports.applyPoiNameOverride = applyPoiNameOverride;
327
327
  exports.create = create;
@@ -28,10 +28,11 @@ function createPOISearch(pois, lang) {
28
28
  prepareIndexEntries(pois).forEach(([id, content]) => index.add(id, content));
29
29
  function prepareIndexEntries(pois2) {
30
30
  return Object.values(pois2).map((poi) => {
31
- const { poiId, category = "", name, keywords = [], roomId = "" } = poi;
31
+ const { poiId, category = "", name, staticName, keywords = [], roomId = "" } = poi;
32
32
  const grabTags = R__namespace.path(["dynamicData", "grab", "tags"], poi) || [];
33
33
  const searchKeywords = keywords.filter(R__namespace.prop("isUserSearchable")).map(R__namespace.prop("name"));
34
- const content = `${name} ${category.split(".").join(" ")} ${roomId} ${searchKeywords.join(" ")} ${grabTags.join(" ")}`;
34
+ const staticNamePart = staticName && staticName !== name ? staticName : "";
35
+ const content = `${name} ${staticNamePart} ${category.split(".").join(" ")} ${roomId} ${searchKeywords.join(" ")} ${grabTags.join(" ")}`;
35
36
  return [Number(poiId), content];
36
37
  });
37
38
  }
@@ -139,6 +139,14 @@ function create(app, config) {
139
139
  (pois) => state.indexesCreated.then(() => state.poiSearch.updateMultiple(pois))
140
140
  );
141
141
  });
142
+ app.bus.on("poi/updated", async ({ pois }) => {
143
+ if (!pois || pois.length === 0) {
144
+ return;
145
+ }
146
+ await state.indexesCreated;
147
+ state.poiSearch.updateMultiple(pois);
148
+ state.typeahead.updatePOIs(pois);
149
+ });
142
150
  const runTest = async (initialState, testRoutine) => {
143
151
  await testRoutine();
144
152
  return state;
@@ -23,15 +23,34 @@ function createSearchTypeahead(pois, poiSearch, lang) {
23
23
  const addKeyword = (keyword) => {
24
24
  suggestedKeywordsSearch.add(keyword);
25
25
  };
26
- return { query, addKeyword };
26
+ const updatePOIs = (updatedPois) => {
27
+ const allPois = suggestedKeywordsSearch.getAllPois();
28
+ const mergedPois = { ...allPois };
29
+ for (const poi of updatedPois) {
30
+ mergedPois[poi.poiId] = poi;
31
+ }
32
+ suggestedKeywordsSearch.update(mergedPois);
33
+ };
34
+ return { query, addKeyword, updatePOIs };
27
35
  }
28
- function createSuggestedKeywordsSearch(pois, lang) {
36
+ function buildKeywordsAndIndex(pois, lang) {
29
37
  const categories = extractParentCategories(pois);
30
38
  const poisKeywords = R.pipe(R.values, R.chain(R.prop("keywords")), R.filter(R.prop("isUserSearchable")), R.pluck("name"))(pois);
31
- const allPotentialKeywords = [...categories, ...poisKeywords];
39
+ const poiNames = R.pipe(R.values, R.pluck("name"))(pois);
40
+ const poiStaticNames = R.pipe(
41
+ R.values,
42
+ R.filter((poi) => poi.staticName && poi.staticName !== poi.name),
43
+ R.pluck("staticName")
44
+ )(pois);
45
+ const allPotentialKeywords = [...categories, ...poisKeywords, ...poiNames, ...poiStaticNames];
32
46
  const keywords = Array.from(/* @__PURE__ */ new Set([...allPotentialKeywords]));
33
47
  const index = utils.getFlexSearchInstance({ lang});
34
48
  keywords.forEach((keyword, i) => index.add(i, keyword));
49
+ return { keywords, index };
50
+ }
51
+ function createSuggestedKeywordsSearch(pois, lang) {
52
+ let allPois = pois;
53
+ let { keywords, index } = buildKeywordsAndIndex(pois, lang);
35
54
  const search = (queryParams) => {
36
55
  const ids = index.search(queryParams);
37
56
  return ids.map((index2) => keywords[index2]);
@@ -40,7 +59,14 @@ function createSuggestedKeywordsSearch(pois, lang) {
40
59
  keywords.push(newKeyword);
41
60
  index.add(keywords.length - 1, newKeyword);
42
61
  };
43
- return { search, add };
62
+ const update = (newPois) => {
63
+ allPois = newPois;
64
+ const built = buildKeywordsAndIndex(newPois, lang);
65
+ keywords = built.keywords;
66
+ index = built.index;
67
+ };
68
+ const getAllPois = () => allPois;
69
+ return { search, add, update, getAllPois };
44
70
  }
45
71
  function extractParentCategories(pois) {
46
72
  return Object.values(pois).map((poi) => poi.category).map((fullCategory) => fullCategory.split(".")).map((subcategories) => subcategories[0]);
@@ -1 +1 @@
1
- var t="web-engine",e="3.3.907",s="UNLICENSED",r="module",o="src/main.ts",i=["demo","deploy","nodesdk","src/extModules/flexapi","services/*","libraries/*"],a={"build-storybook":"storybook build",colors:"cat utils/colors1.txt && node utils/processColors.ts | pbcopy && cat utils/colors2.txt",demo:"cd demo/ && yarn start",dev:"yarn mol e2e","format:check":"yarn prettier . --check","format:fix":"yarn prettier . --write",goProd:"cd deploy && scripts/goProd.sh",goStaging:"deploy/scripts/goStaging.sh","icons:convert":"node scripts/convertSvgToJsx.mjs",lint:"eslint . --ext .js,.jsx,.ts,.tsx",mod:"demo/startMod.sh",mol:"demo/startMol.sh","mol:build":"demo/startMolBuild.sh",molProd:"cd deploy && yarn buildAndRunMol","playwright:ci":"yarn playwright test --grep-invert sdk","playwright:ci:failed":"yarn playwright test --last-failed --grep-invert sdk","playwright:sdk":"yarn start-server-and-test 'cd ./deploy && yarn buildDev && yarn serveLocal' 8085 'cd ./test/sdk && npx http-server' 8080 'yarn playwright test sdk --ui'","playwright:ui":"yarn playwright test --ui --grep-invert sdk",prepare:"husky",storybook:"storybook dev -p 6006",test:"vitest run --project unit","test-watch":"vitest --watch","test:comp":"vitest run --project browser","test:comp:ci":"vitest run --project browser --reporter=dot","test:comp:ui":"VITE_COMP_UI=1 vitest --project browser --ui --browser.headless=false","test:all":"yarn lint && yarn format:check && yarn test && yarn playwright:ci","test:mod":"playwright test --config=playwright.mod.config.ts",typecheck:"tsc -p tsconfig.checkjs.json","typecheck:strict":"tsc -p tsconfig.strict.json"},l=["defaults"],n={"@azure/event-hubs":"^5.12.2","@csstools/normalize.css":"^11.0.1","@dnd-kit/core":"^6.3.1","@dnd-kit/modifiers":"^9.0.0","@dnd-kit/sortable":"^10.0.0","@dnd-kit/utilities":"^3.2.2","@mapbox/mapbox-gl-draw":"^1.5.0","@mapbox/mapbox-gl-draw-static-mode":"^1.0.1","@microsoft/applicationinsights-web":"^3.3.6","@styled-system/prop-types":"^5.1.5","@turf/area":"^7.2.0","@turf/bbox-clip":"^7.2.0","@turf/bbox-polygon":"^7.2.0","@turf/bearing":"^7.2.0","@turf/circle":"^7.2.0","@turf/helpers":"^7.2.0","@turf/point-to-line-distance":"^7.2.0","@vitejs/plugin-react":"^5.2.0","@zumer/snapdom":"^2.9.0","axe-core":"^4.10.3",browserslist:"^4.27.0","crypto-browserify":"^3.12.1",dompurify:"^3.3.3","file-loader":"^6.2.0",flexsearch:"^0.7.43","h3-js":"^4.1.0",i18next:"^26.0.0","i18next-browser-languagedetector":"^6.1.1",jsdom:"^25.0.1",jsonschema:"^1.5.0",luxon:"^3.5.0","maplibre-gl":"^4.7.1","mini-css-extract-plugin":"^2.9.2","node-polyfill-webpack-plugin":"^4.1.0","path-browserify":"^1.0.1",pmtiles:"^4.4.0","prop-types":"^15.8.1","qrcode.react":"^4.2.0",ramda:"^0.30.1",react:"^19.2.4","react-compound-slider":"^3.4.0","react-dom":"^19.2.4","react-json-editor-ajrm":"^2.5.14","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","styled-system":"^5.1.5","styled-tools":"^1.7.2","throttle-debounce":"^5.0.2","ua-parser-js":"^0.7.40",uuid:"^11.1.0",zousan:"^3.0.1","zousan-plus":"^4.0.1"},p={"@applitools/eyes-playwright":"^1.46.8","@axe-core/playwright":"^4.10.2","@azure/identity":"^4.13.0","@azure/playwright":"^1.0.0","@playwright/test":"~1.59.1","@rollup/plugin-typescript":"^12.3.0","@storybook/addon-essentials":"^8.6.15","@storybook/blocks":"^8.6.15","@storybook/react":"^8.6.15","@storybook/react-vite":"^8.6.15","@testing-library/dom":"^10.4.1","@testing-library/jest-dom":"^6.6.3","@testing-library/react":"^16.3.0","@testing-library/user-event":"^14.5.2","@types/luxon":"^3.7.2","@types/react":"^19.0.10","@types/react-dom":"^19.0.4","@types/styled-system":"^5.1.25","@typescript-eslint/eslint-plugin":"^8.26.1","@typescript-eslint/parser":"^8.26.1","@vitest/browser":"4.1.6","@vitest/browser-playwright":"4.1.6","@vitest/ui":"4.1.6","css-loader":"^7.1.2",eslint:"^8.57.1","eslint-config-prettier":"^10.1.8","eslint-import-resolver-alias":"^1.1.2","eslint-plugin-playwright":"^2.2.2","eslint-plugin-react":"^7.37.4","eslint-plugin-vitest":"^0.5.4","fetch-mock":"^12.6.0",glob:"^11.0.1",husky:"^9.1.7","lint-staged":"^16.4.0","node-fetch":"^2.7.0",nx:"19.8.14","nx-remotecache-azure":"^19.0.0","os-browserify":"^0.3.0",prettier:"^3.8.3","rollup-plugin-esbuild":"^6.2.1","start-server-and-test":"^2.0.11",storybook:"^8.6.15",typescript:"^5.8.2",vite:"^7.3.2",vitest:"^4.1.8","webpack-merge":"^6.0.1"},c="yarn@4.13.0",d={node:"24.x"},y={},u={name:t,version:e,private:!0,license:s,type:r,main:o,workspaces:i,scripts:a,"lint-staged":{"*.{js,ts,tsx}":["eslint --fix","prettier --check"],"*.{json,md,css,ts,tsx,jsx}":["prettier --check"],"src/i18n/**/*.json":["node utils/sort-json.ts","prettier --write"]},browserslist:l,dependencies:n,devDependencies:p,packageManager:c,engines:d,nx:y};export{l as browserslist,u as default,n as dependencies,p as devDependencies,d as engines,s as license,o as main,t as name,y as nx,c as packageManager,a as scripts,r as type,e as version,i as workspaces};
1
+ var t="web-engine",e="3.3.908",s="UNLICENSED",r="module",o="src/main.ts",i=["demo","deploy","nodesdk","src/extModules/flexapi","services/*","libraries/*"],a={"build-storybook":"storybook build",colors:"cat utils/colors1.txt && node utils/processColors.ts | pbcopy && cat utils/colors2.txt",demo:"cd demo/ && yarn start",dev:"yarn mol e2e","format:check":"yarn prettier . --check","format:fix":"yarn prettier . --write",goProd:"cd deploy && scripts/goProd.sh",goStaging:"deploy/scripts/goStaging.sh","icons:convert":"node scripts/convertSvgToJsx.mjs",lint:"eslint . --ext .js,.jsx,.ts,.tsx",mod:"demo/startMod.sh",mol:"demo/startMol.sh","mol:build":"demo/startMolBuild.sh",molProd:"cd deploy && yarn buildAndRunMol","playwright:ci":"yarn playwright test --grep-invert sdk","playwright:ci:failed":"yarn playwright test --last-failed --grep-invert sdk","playwright:sdk":"yarn start-server-and-test 'cd ./deploy && yarn buildDev && yarn serveLocal' 8085 'cd ./test/sdk && npx http-server' 8080 'yarn playwright test sdk --ui'","playwright:ui":"yarn playwright test --ui --grep-invert sdk",prepare:"husky",storybook:"storybook dev -p 6006",test:"vitest run --project unit","test-watch":"vitest --watch","test:comp":"vitest run --project browser","test:comp:ci":"vitest run --project browser --reporter=dot","test:comp:ui":"VITE_COMP_UI=1 vitest --project browser --ui --browser.headless=false","test:all":"yarn lint && yarn format:check && yarn test && yarn playwright:ci","test:mod":"playwright test --config=playwright.mod.config.ts",typecheck:"tsc -p tsconfig.checkjs.json","typecheck:strict":"tsc -p tsconfig.strict.json"},l=["defaults"],n={"@azure/event-hubs":"^5.12.2","@csstools/normalize.css":"^11.0.1","@dnd-kit/core":"^6.3.1","@dnd-kit/modifiers":"^9.0.0","@dnd-kit/sortable":"^10.0.0","@dnd-kit/utilities":"^3.2.2","@mapbox/mapbox-gl-draw":"^1.5.0","@mapbox/mapbox-gl-draw-static-mode":"^1.0.1","@microsoft/applicationinsights-web":"^3.3.6","@styled-system/prop-types":"^5.1.5","@turf/area":"^7.2.0","@turf/bbox-clip":"^7.2.0","@turf/bbox-polygon":"^7.2.0","@turf/bearing":"^7.2.0","@turf/circle":"^7.2.0","@turf/helpers":"^7.2.0","@turf/point-to-line-distance":"^7.2.0","@vitejs/plugin-react":"^5.2.0","@zumer/snapdom":"^2.9.0","axe-core":"^4.10.3",browserslist:"^4.27.0","crypto-browserify":"^3.12.1",dompurify:"^3.3.3","file-loader":"^6.2.0",flexsearch:"^0.7.43","h3-js":"^4.1.0",i18next:"^26.0.0","i18next-browser-languagedetector":"^6.1.1",jsdom:"^25.0.1",jsonschema:"^1.5.0",luxon:"^3.5.0","maplibre-gl":"^4.7.1","mini-css-extract-plugin":"^2.9.2","node-polyfill-webpack-plugin":"^4.1.0","path-browserify":"^1.0.1",pmtiles:"^4.4.0","prop-types":"^15.8.1","qrcode.react":"^4.2.0",ramda:"^0.30.1",react:"^19.2.4","react-compound-slider":"^3.4.0","react-dom":"^19.2.4","react-json-editor-ajrm":"^2.5.14","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","styled-system":"^5.1.5","styled-tools":"^1.7.2","throttle-debounce":"^5.0.2","ua-parser-js":"^0.7.40",uuid:"^11.1.0",zousan:"^3.0.1","zousan-plus":"^4.0.1"},p={"@applitools/eyes-playwright":"^1.46.8","@axe-core/playwright":"^4.10.2","@azure/identity":"^4.13.0","@azure/playwright":"^1.0.0","@playwright/test":"~1.59.1","@rollup/plugin-typescript":"^12.3.0","@storybook/addon-essentials":"^8.6.15","@storybook/blocks":"^8.6.15","@storybook/react":"^8.6.15","@storybook/react-vite":"^8.6.15","@testing-library/dom":"^10.4.1","@testing-library/jest-dom":"^6.6.3","@testing-library/react":"^16.3.0","@testing-library/user-event":"^14.5.2","@types/luxon":"^3.7.2","@types/react":"^19.0.10","@types/react-dom":"^19.0.4","@types/styled-system":"^5.1.25","@typescript-eslint/eslint-plugin":"^8.26.1","@typescript-eslint/parser":"^8.26.1","@vitest/browser":"4.1.6","@vitest/browser-playwright":"4.1.6","@vitest/ui":"4.1.6","css-loader":"^7.1.2",eslint:"^8.57.1","eslint-config-prettier":"^10.1.8","eslint-import-resolver-alias":"^1.1.2","eslint-plugin-playwright":"^2.2.2","eslint-plugin-react":"^7.37.4","eslint-plugin-vitest":"^0.5.4","fetch-mock":"^12.6.0",glob:"^11.0.1",husky:"^9.1.7","lint-staged":"^16.4.0","node-fetch":"^2.7.0",nx:"19.8.14","nx-remotecache-azure":"^19.0.0","os-browserify":"^0.3.0",prettier:"^3.8.3","rollup-plugin-esbuild":"^6.2.1","start-server-and-test":"^2.0.11",storybook:"^8.6.15",typescript:"^5.8.2",vite:"^7.3.2",vitest:"^4.1.8","webpack-merge":"^6.0.1"},c="yarn@4.13.0",d={node:"24.x"},y={},u={name:t,version:e,private:!0,license:s,type:r,main:o,workspaces:i,scripts:a,"lint-staged":{"*.{js,ts,tsx}":["eslint --fix","prettier --check"],"*.{json,md,css,ts,tsx,jsx}":["prettier --check"],"src/i18n/**/*.json":["node utils/sort-json.ts","prettier --write"]},browserslist:l,dependencies:n,devDependencies:p,packageManager:c,engines:d,nx:y};export{l as browserslist,u as default,n as dependencies,p as devDependencies,d as engines,s as license,o as main,t as name,y as nx,c as packageManager,a as scripts,r as type,e as version,i as workspaces};
@@ -1 +1 @@
1
- import t from"zousan";import{processParkingPOIS as e,processOpenClosedPois as n,processSecurityWaitTimes as a,mutateSecurityCheckpointLabel as s,processRoutingPois as o,mutatePoiName as i}from"./processors.js";let c=3e4;const r="x-account-id";function u(u,y={}){const l={dynamicDataNotPending:new t},d=u.gt();y._overrideRefreshFrequency&&(c=y._overrideRefreshFrequency);const m=new Map;u.bus.on("system/readywhenyouare",()=>l.dynamicDataNotPending),u.bus.on("dynamicPois/getSecurityWaitTimes",async({isOpen:t}={})=>{const e=await u.bus.get("poi/getAll");return Object.values(e).filter(e=>{return"security.checkpoint"===e.category&&e?.dynamicData?.security&&(n=e?.dynamicData?.security,"object"==typeof n&&null!==n&&!Array.isArray(n))&&(void 0===t||e?.dynamicData?.security?.isTemporarilyClosed!==t);var n}).map(t=>({id:t.poiId,name:t.name,...t.dynamicData.security}))});const p=async t=>{const e={};for(const n of t){const t=await u.bus.get("poi/getById",{id:n});t&&(e[n]=t.name)}return e},f=async t=>{const e={};for(const n of t){const t=await u.bus.get("poi/getById",{id:n});t&&(e[n]=t._originalName??t.name)}return e};return{init:async()=>{const[t,y]=await Promise.all([u.bus.get("venueData/getAccountId"),u.bus.get("venueData/getVenueId")]),g=`https://marketplace.locuslabs.com/venueId/${y}/dynamic-poi`;let b,D=0,h=0;const v=async()=>{const c=await fetch(g,{headers:{[r]:t}});if(c.ok)return c.json().then(({data:t})=>async function(t){(function(t){const n=e(t);u.bus.send("poi/setDynamicData",{plugin:"parking",idValuesMap:n})})(t),function(t){const e=n(t);u.bus.send("poi/setDynamicData",{plugin:"open-closed-status",idValuesMap:e})}(t),async function(t){const e=a(t);u.bus.send("poi/setDynamicData",{plugin:"security",idValuesMap:e});const n=await p(Object.keys(e));u.bus.send("map/mutateFeature",{functor:s(d,e,n)})}(t),async function(t){const e=await o(t);u.bus.send("poi/setDynamicRouting",{plugin:"routing",idValuesMap:e})}(t),async function(t){const e={};for(const[n,a]of Object.entries(t)){const t=a?.dynamicData?.poiAttributes?.name??null,s=m.get(n);void 0===s?null!==t&&(e[n]={name:t},m.set(n,t)):s!==t&&(e[n]={name:t},m.set(n,t))}for(const[n,a]of m.entries())n in t||null===a||(e[n]={name:null},m.set(n,null));if(Object.keys(e).length>0){u.bus.send("poi/setCoreAttributes",e);const t=await f(Object.keys(e));u.bus.send("map/mutateFeature",{functor:i(d,e,t)})}}(t)}(t)).then(()=>{h++}).catch(console.error);console.warn("dynamicPois: fetch response status not ok",c),D++,D>=3&&D>h&&clearInterval(b)};return await v().then(()=>{b=setInterval(v,c),"function"==typeof b.unref&&b.unref()}).finally(()=>l.dynamicDataNotPending.resolve(!0)),()=>clearInterval(b)}}}export{u as create};
1
+ import t from"zousan";import{processParkingPOIS as e,processOpenClosedPois as n,processSecurityWaitTimes as a,mutateSecurityCheckpointLabel as s,processRoutingPois as o,mutatePoiName as i}from"./processors.js";let c=3e4;const r="x-account-id";function u(u,y={}){const l={dynamicDataNotPending:new t},d=u.gt();y._overrideRefreshFrequency&&(c=y._overrideRefreshFrequency);const m=new Map;u.bus.on("system/readywhenyouare",()=>l.dynamicDataNotPending),u.bus.on("dynamicPois/getSecurityWaitTimes",async({isOpen:t}={})=>{const e=await u.bus.get("poi/getAll");return Object.values(e).filter(e=>{return"security.checkpoint"===e.category&&e?.dynamicData?.security&&(n=e?.dynamicData?.security,"object"==typeof n&&null!==n&&!Array.isArray(n))&&(void 0===t||e?.dynamicData?.security?.isTemporarilyClosed!==t);var n}).map(t=>({id:t.poiId,name:t.name,...t.dynamicData.security}))});const p=async t=>{const e={};for(const n of t){const t=await u.bus.get("poi/getById",{id:n});t&&(e[n]=t.name)}return e},f=async t=>{const e={};for(const n of t){const t=await u.bus.get("poi/getById",{id:n});t&&(e[n]=t.staticName??t.name)}return e};return{init:async()=>{const[t,y]=await Promise.all([u.bus.get("venueData/getAccountId"),u.bus.get("venueData/getVenueId")]),g=`https://marketplace.locuslabs.com/venueId/${y}/dynamic-poi`;let b,D=0,h=0;const v=async()=>{const c=await fetch(g,{headers:{[r]:t}});if(c.ok)return c.json().then(({data:t})=>async function(t){(function(t){const n=e(t);u.bus.send("poi/setDynamicData",{plugin:"parking",idValuesMap:n})})(t),function(t){const e=n(t);u.bus.send("poi/setDynamicData",{plugin:"open-closed-status",idValuesMap:e})}(t),async function(t){const e=a(t);u.bus.send("poi/setDynamicData",{plugin:"security",idValuesMap:e});const n=await p(Object.keys(e));u.bus.send("map/mutateFeature",{functor:s(d,e,n)})}(t),async function(t){const e=await o(t);u.bus.send("poi/setDynamicRouting",{plugin:"routing",idValuesMap:e})}(t),async function(t){const e={};for(const[n,a]of Object.entries(t)){const t=a?.dynamicData?.poiAttributes?.name??null,s=m.get(n);void 0===s?null!==t&&(e[n]={name:t},m.set(n,t)):s!==t&&(e[n]={name:t},m.set(n,t))}for(const[n,a]of m.entries())n in t||null===a||(e[n]={name:null},m.set(n,null));if(Object.keys(e).length>0){u.bus.send("poi/setCoreAttributes",e);const t=await f(Object.keys(e));u.bus.send("map/mutateFeature",{functor:i(d,e,t)})}}(t)}(t)).then(()=>{h++}).catch(console.error);console.warn("dynamicPois: fetch response status not ok",c),D++,D>=3&&D>h&&clearInterval(b)};return await v().then(()=>{b=setInterval(v,c),"function"==typeof b.unref&&b.unref()}).finally(()=>l.dynamicDataNotPending.resolve(!0)),()=>clearInterval(b)}}}export{u as create};
@@ -1 +1 @@
1
- import*as e from"ramda";import o from"zousan";import{buildStructuresLookup as t}from"../../../src/utils/buildStructureLookup.js";import{debugIsTrue as a}from"../../../src/utils/configUtils.js";import{toLang as i}from"../../../src/utils/i18n.js";async function n(i){const n=i.log.sublog("poiDataManager"),u=()=>{i.bus.send("venueData/loadPoiData")};let p=new o;const l=(e,o)=>{const{position:t}=e,a=o.floorIdToStructure(t.floorId);if(!a)return n.error(`No structure found for floorId: ${t.floorId} for POI ${e.poiId}`),{...e};const i=o.floorIdToFloor(t.floorId),r={...t,structureName:a.name,buildingId:a.id,floorName:i.name,floorOrdinal:i.ordinal};return{...e,position:r}},d=(e,o)=>{e.roomInfo||(e.roomInfo=[]),e.roomInfo.push(o)},c=e.pipe(e.propOr([],"externalIds"),e.find(e.propEq("roomId","type")),e.prop("id"),e.unless(e.isNil,e.tail));i.bus.on("venueData/poiDataLoaded",async({pois:o,structures:r})=>{if(o=((o,t)=>e.pipe(e.values,e.map(e=>{e.distance=null,e.staticName=e.name,e.isNavigable=void 0===e.isNavigable||!0===e.isNavigable,e.capacity&&d(e,{name:`Seats ${e.capacity.join("-")}`,svgId:"number-of-seats"}),e.category.startsWith("meeting")&&d(e,{name:i.gt()("poiView:Conference Room"),svgId:"conference-room"});const o=c(e);return o&&(e.roomId=o),[e.poiId,l(e,t)]}),e.fromPairs)(o))(o,t(r)),a(i,"pseudoTransPois"))for(const e in o)o[e]=s(o[e],i.i18n().language);o=function(e){const o=[];return Object.values(e).forEach(e=>{try{const t=e.position;t?["buildingId","structureName","floorId","floorName","floorOrdinal","latitude","longitude"].forEach(a=>{null!==t[a]&&void 0!==t[a]||o.push({id:e.poiId,e:`invalid position property: ${a}: ${t[a]}`})}):o.push({poi:e,e:"No position information"})}catch(t){n.error(t),o.push({id:e.poiId,e:t.message})}}),o.length&&(n.warn("badPois:",o),o.forEach(o=>{delete e[o.id]})),e}(o),await async function(e){for(const o of Object.values(e))await I(o);return e}(o),p.resolve(o),i.config.debug&&i.env.isBrowser&&(window._pois=o),i.config.debug&&async function(e){const o=Date.now(),t=[],a=await i.bus.get("wayfinder/_getNavGraph");Object.values(e).forEach(e=>{try{const o=e.position;a.findClosestNode(o.floorId,o.latitude,o.longitude)||t.push({id:e.poiId,e:"No closest Navgraph Node"})}catch(o){n.error(o),t.push({id:e.poiId,e:o.message})}}),t.length&&n.warn("badPois:",t),n(`Total time for navgraph POI check: ${Date.now()-o}ms`)}(o)}),i.bus.on("poi/getById",async({id:e})=>p.then(o=>o[e])),i.bus.on("poi/getByFloorId",async({floorId:o})=>p.then(e.pickBy(e.pathEq(o,["position","floorId"])))),i.bus.on("poi/getByCategoryId",async({categoryId:o})=>p.then(e.pickBy(e=>e.category===o||e.category.startsWith(o+".")))),i.bus.on("poi/getAll",async()=>p);const m=["queue","primaryQueueId"],g=(o,t,a)=>{const i=e.path(["queue","queueType"],t);if(!i)return null;const n=o[i],r=e.path(m,t);return a.filter(e.pathEq(r,m)).filter(e=>e.poiId!==t.poiId).map(o=>{const t=e.path(["queue","queueSubtype"],o),a=f(t)(n);return{poiId:o.poiId,...a}})},f=o=>{return e.pipe(e.find(e.propEq(o,"id")),(t=`No queue found with ID: ${o}`,e=>{if(null!=e)return e;throw Error(t)}),e.pick(["displayText","imageId"]));var t};i.bus.on("poi/addOtherSecurityLanes",({poi:o})=>(async o=>{if(!e.path(m,o))return o;const t=await i.bus.get("venueData/getQueueTypes"),a=await i.bus.get("poi/getByCategoryId",{categoryId:"security"}),n=Object.values(a);return o.queue.otherQueues=g(t,o,n),o})(o));const y=e=>!!e?.startsWith("https:");async function I(t){if(!t)return;const a="undefined"==typeof window?1:window.devicePixelRatio||1,n=`${Math.round(351*a)}x${Math.round(197*a)}`;return e.length(t.images)?y(t.images[0])||(t.images=await o.all(t.images.map(e=>i.bus.get("venueData/getPoiImageUrl",{imageName:e,size:n})))):t.images=[],e.length(t.fullImages)?y(t.fullImages[0]?.url)||(t.fullImages=await o.all(t.fullImages.map(async({url:e,...o})=>({url:await i.bus.get("venueData/getPoiImageUrl",{imageName:e,size:n}),...o})))):t.fullImages=[],t}const h=e.memoizeWith(e.identity,e.pipe(e.pluck("category"),e.values,e.uniq));i.bus.on("poi/getAllCategories",async()=>p.then(h)),i.bus.on("venueData/loadNewVenue",()=>{p=new o,u()}),i.bus.on("poi/setDynamicData",({plugin:o,idValuesMap:t})=>{p.then(a=>{for(const i in t){const n=a[i].dynamicData||{};n[o]={...t[i]};const r=e.mergeRight(a[i],{dynamicData:n});a[i]=r}})}),i.bus.on("poi/setCoreAttributes",e=>{p.then(o=>{for(const t in e){r(o,t,e[t])&&i.bus.send("map/mutateFeature",{poiId:t,name:o[t].name})}})});return{init:u,runTest:async e=>(await e(),p),internal:{addImages:I,pseudoTransPoi:s,applyCorePoiAttributes:r}}}function r(o,t,a){if(!o[t])return!1;const{name:i}=a;return i?(o[t]._originalName||(o[t]=e.mergeRight(o[t],{_originalName:o[t].name})),o[t]=e.mergeRight(o[t],{name:i})):o[t]=e.mergeRight(o[t],{name:o[t]._originalName??o[t].name}),!0}function s(e,o){return["description","nearbyLandmark","name","phone","operationHours"].forEach(t=>{e[t]&&(e[t]=i(e[t],o))}),e.keywords&&(e.keywords=e.keywords.map(e=>(e.name=i(e.name,o),e))),e.position.floorName&&(e.position.floorName=i(e.position.floorName,o)),e.position.structureName&&(e.position.structureName=i(e.position.structureName,o)),e}export{n as create};
1
+ import*as e from"ramda";import o from"zousan";import{buildStructuresLookup as t}from"../../../src/utils/buildStructureLookup.js";import{debugIsTrue as a}from"../../../src/utils/configUtils.js";import{toLang as i}from"../../../src/utils/i18n.js";async function n(i){const n=i.log.sublog("poiDataManager"),u=()=>{i.bus.send("venueData/loadPoiData")};let p=new o;const d=(e,o)=>{const{position:t}=e,a=o.floorIdToStructure(t.floorId);if(!a)return n.error(`No structure found for floorId: ${t.floorId} for POI ${e.poiId}`),{...e};const i=o.floorIdToFloor(t.floorId),r={...t,structureName:a.name,buildingId:a.id,floorName:i.name,floorOrdinal:i.ordinal};return{...e,position:r}},l=(e,o)=>{e.roomInfo||(e.roomInfo=[]),e.roomInfo.push(o)},c=e.pipe(e.propOr([],"externalIds"),e.find(e.propEq("roomId","type")),e.prop("id"),e.unless(e.isNil,e.tail));i.bus.on("venueData/poiDataLoaded",async({pois:o,structures:r})=>{if(o=((o,t)=>e.pipe(e.values,e.map(e=>{e.distance=null,e.staticName=e.name,e.isNavigable=void 0===e.isNavigable||!0===e.isNavigable,e.capacity&&l(e,{name:`Seats ${e.capacity.join("-")}`,svgId:"number-of-seats"}),e.category.startsWith("meeting")&&l(e,{name:i.gt()("poiView:Conference Room"),svgId:"conference-room"});const o=c(e);return o&&(e.roomId=o),[e.poiId,d(e,t)]}),e.fromPairs)(o))(o,t(r)),a(i,"pseudoTransPois"))for(const e in o)o[e]=s(o[e],i.i18n().language);o=function(e){const o=[];return Object.values(e).forEach(e=>{try{const t=e.position;t?["buildingId","structureName","floorId","floorName","floorOrdinal","latitude","longitude"].forEach(a=>{null!==t[a]&&void 0!==t[a]||o.push({id:e.poiId,e:`invalid position property: ${a}: ${t[a]}`})}):o.push({poi:e,e:"No position information"})}catch(t){n.error(t),o.push({id:e.poiId,e:t.message})}}),o.length&&(n.warn("badPois:",o),o.forEach(o=>{delete e[o.id]})),e}(o),await async function(e){for(const o of Object.values(e))await I(o);return e}(o),p.resolve(o),i.config.debug&&i.env.isBrowser&&(window._pois=o),i.config.debug&&async function(e){const o=Date.now(),t=[],a=await i.bus.get("wayfinder/_getNavGraph");Object.values(e).forEach(e=>{try{const o=e.position;a.findClosestNode(o.floorId,o.latitude,o.longitude)||t.push({id:e.poiId,e:"No closest Navgraph Node"})}catch(o){n.error(o),t.push({id:e.poiId,e:o.message})}}),t.length&&n.warn("badPois:",t),n(`Total time for navgraph POI check: ${Date.now()-o}ms`)}(o)}),i.bus.on("poi/getById",async({id:e})=>p.then(o=>o[e])),i.bus.on("poi/getByFloorId",async({floorId:o})=>p.then(e.pickBy(e.pathEq(o,["position","floorId"])))),i.bus.on("poi/getByCategoryId",async({categoryId:o})=>p.then(e.pickBy(e=>e.category===o||e.category.startsWith(o+".")))),i.bus.on("poi/getAll",async()=>p);const m=["queue","primaryQueueId"],f=(o,t,a)=>{const i=e.path(["queue","queueType"],t);if(!i)return null;const n=o[i],r=e.path(m,t);return a.filter(e.pathEq(r,m)).filter(e=>e.poiId!==t.poiId).map(o=>{const t=e.path(["queue","queueSubtype"],o),a=g(t)(n);return{poiId:o.poiId,...a}})},g=o=>{return e.pipe(e.find(e.propEq(o,"id")),(t=`No queue found with ID: ${o}`,e=>{if(null!=e)return e;throw Error(t)}),e.pick(["displayText","imageId"]));var t};i.bus.on("poi/addOtherSecurityLanes",({poi:o})=>(async o=>{if(!e.path(m,o))return o;const t=await i.bus.get("venueData/getQueueTypes"),a=await i.bus.get("poi/getByCategoryId",{categoryId:"security"}),n=Object.values(a);return o.queue.otherQueues=f(t,o,n),o})(o));const y=e=>!!e?.startsWith("https:");async function I(t){if(!t)return;const a="undefined"==typeof window?1:window.devicePixelRatio||1,n=`${Math.round(351*a)}x${Math.round(197*a)}`;return e.length(t.images)?y(t.images[0])||(t.images=await o.all(t.images.map(e=>i.bus.get("venueData/getPoiImageUrl",{imageName:e,size:n})))):t.images=[],e.length(t.fullImages)?y(t.fullImages[0]?.url)||(t.fullImages=await o.all(t.fullImages.map(async({url:e,...o})=>({url:await i.bus.get("venueData/getPoiImageUrl",{imageName:e,size:n}),...o})))):t.fullImages=[],t}const h=e.memoizeWith(e.identity,e.pipe(e.pluck("category"),e.values,e.uniq));i.bus.on("poi/getAllCategories",async()=>p.then(h)),i.bus.on("venueData/loadNewVenue",()=>{p=new o,u()}),i.bus.on("poi/setDynamicData",({plugin:o,idValuesMap:t})=>{p.then(a=>{for(const i in t){const n=a[i].dynamicData||{};n[o]={...t[i]};const r=e.mergeRight(a[i],{dynamicData:n});a[i]=r}})}),i.bus.on("poi/setCoreAttributes",e=>{p.then(o=>{const t=[];for(const a in e){r(o,a,e[a]?.name)&&(i.bus.send("map/mutateFeature",{poiId:a,name:o[a].name}),t.push(o[a]))}t.length>0&&i.bus.send("poi/updated",{pois:t})})});return{init:u,runTest:async e=>(await e(),p),internal:{addImages:I,pseudoTransPoi:s,applyPoiNameOverride:r}}}function r(e,o,t){return!!e[o]&&(e[o].name=t||e[o].staticName,!0)}function s(e,o){return["description","nearbyLandmark","name","phone","operationHours"].forEach(t=>{e[t]&&(e[t]=i(e[t],o))}),e.keywords&&(e.keywords=e.keywords.map(e=>(e.name=i(e.name,o),e))),e.position.floorName&&(e.position.floorName=i(e.position.floorName,o)),e.position.structureName&&(e.position.structureName=i(e.position.structureName,o)),e}export{r as applyPoiNameOverride,n as create};
@@ -1 +1 @@
1
- import*as t from"ramda";import{getFlexSearchInstance as a}from"./utils.js";function r(r,e){const o=a({lang:e});function n(a){return Object.values(a).map(a=>{const{poiId:r,category:e="",name:o,keywords:n=[],roomId:i=""}=a,c=t.path(["dynamicData","grab","tags"],a)||[],s=n.filter(t.prop("isUserSearchable")).map(t.prop("name")),p=`${o} ${e.split(".").join(" ")} ${i} ${s.join(" ")} ${c.join(" ")}`;return[Number(r),p]})}return n(r).forEach(([t,a])=>o.add(t,a)),{search:function(a){const e={...a};e.limit||(e.limit=5e3);const n=o.search(e);return Object.values(t.pick(n,r))},updateMultiple:function(t){n(t).forEach(([t,a])=>o.update(t,a))}}}export{r as default};
1
+ import*as t from"ramda";import{getFlexSearchInstance as a}from"./utils.js";function r(r,e){const o=a({lang:e});function n(a){return Object.values(a).map(a=>{const{poiId:r,category:e="",name:o,staticName:n,keywords:i=[],roomId:c=""}=a,s=t.path(["dynamicData","grab","tags"],a)||[],p=i.filter(t.prop("isUserSearchable")).map(t.prop("name")),u=`${o} ${n&&n!==o?n:""} ${e.split(".").join(" ")} ${c} ${p.join(" ")} ${s.join(" ")}`;return[Number(r),u]})}return n(r).forEach(([t,a])=>o.add(t,a)),{search:function(a){const e={...a};e.limit||(e.limit=5e3);const n=o.search(e);return Object.values(t.pick(n,r))},updateMultiple:function(t){n(t).forEach(([t,a])=>o.update(t,a))}}}export{r as default};
@@ -1 +1 @@
1
- import*as e from"ramda";import r from"zousan";import{getLocalized as a}from"../../../src/utils/configUtils.js";import{randomizeArray as s,arrayPick as t}from"../../../src/utils/rand.js";import n from"./poiSearch.js";import o from"./searchTypeahead.js";function i(i,c){const u={poiSearch:null,typeahead:null,indexesCreated:new r,defaultSearchTerms:null,specialQueryTerms:{}},d=async()=>{const e=await i.bus.get("poi/getAll");u.poiSearch=n(e,i.i18n().language),u.typeahead=o(e,u.poiSearch.search,i.i18n().language),u.defaultSearchTerms=a(c,"defaultSearchTerms",i.i18n().language),u.indexesCreated.resolve()};async function y(){const r=await i.bus.getFirst("user/getPhysicalLocation");if(!r?.floorId)return[];const a=await i.bus.get("poi/getByFloorId",{floorId:r?.floorId}),s=Object.values(e.pickBy(e=>-1===e.category.indexOf("portal")&&"element.door"!==e.category,a)),t=await i.bus.get("wayfinder/addPathTimeMultiple",{pois:s,startLocation:r});return e.sortBy(e.prop("distance"),Object.values(t)).slice(0,50)}i.bus.on("search/queryNearby",async()=>{const e=await y();return i.bus.send("search/showNearby",{pois:e,term:"Nearby"}),e}),i.bus.on("search/queryNearbyAsync",y),i.bus.on("search/queryCategory",async({category:e,categoryName:r,searchTerm:a})=>{const s=await u.indexesCreated.then(()=>u.poiSearch.search({query:a||e}));return i.bus.send("search/showCategory",{pois:s,category:e,categoryName:r}),s}),i.bus.on("search/query",({term:e})=>u.indexesCreated.then(()=>{const r=u.poiSearch.search({query:e});return i.bus.send("search/showSearchResults",{results:r,term:e}),r})),i.bus.on("search/queryAsync",({term:e})=>u.indexesCreated.then(()=>u.poiSearch.search({query:e}))),i.bus.on("search/queryWithSpecial",({term:e})=>{if(u.specialQueryTerms[e]){const{event:r,params:a}=u.specialQueryTerms[e];return i.bus.send(r,a)}return i.bus.get("search/query",{term:e})}),i.bus.on("search/getDefaultSearchTerms",async({limit:e=5}={})=>{const r=u.defaultSearchTerms,a=r&&r.length?r:await async function(e){const r=(await i.bus.send("poi/getAllCategories"))[0],a=Array.from(new Set(r));return s(a).slice(0,e)}(e);return i.bus.send("search/showDefaultSearchKeywords",{keywords:a}),a}),i.bus.on("search/getDefaultSearchPois",async({limit:r=5}={})=>{const a=await i.bus.get("poi/getAll"),s=e.pickBy(e=>e.isNavigable,a);return t(Object.values(s),r)}),i.bus.on("search/registerSpecialQuery",({term:e,event:r,params:a,addKeyword:s=!0})=>{u.indexesCreated.then(()=>{s&&u.typeahead.addKeyword(e),u.specialQueryTerms[e]={event:r,params:a}})}),i.bus.on("search/addKeywords",({keywords:e})=>u.indexesCreated.then(()=>e.forEach(e=>u.typeahead.addKeyword(e)))),i.bus.on("search/typeahead",({term:e,limit:r})=>u.indexesCreated.then(()=>{const{keywords:a,pois:s}=u.typeahead.query(e,r);return{keywords:a,pois:s,term:e}})),i.bus.on("venueData/loadNewVenue",()=>{u.indexesCreated=new r,d()}),i.bus.on("poi/setDynamicData",async({plugin:e,idValuesMap:r})=>{if("grab"!==e)return;const a=Object.keys(r).map(e=>i.bus.get("poi/getById",{id:e}));return Promise.all(a).then(e=>u.indexesCreated.then(()=>u.poiSearch.updateMultiple(e)))});return{init:d,runTest:async(e,r)=>(await r(),u)}}export{i as create};
1
+ import*as e from"ramda";import a from"zousan";import{getLocalized as r}from"../../../src/utils/configUtils.js";import{randomizeArray as s,arrayPick as t}from"../../../src/utils/rand.js";import n from"./poiSearch.js";import o from"./searchTypeahead.js";function i(i,c){const u={poiSearch:null,typeahead:null,indexesCreated:new a,defaultSearchTerms:null,specialQueryTerms:{}},d=async()=>{const e=await i.bus.get("poi/getAll");u.poiSearch=n(e,i.i18n().language),u.typeahead=o(e,u.poiSearch.search,i.i18n().language),u.defaultSearchTerms=r(c,"defaultSearchTerms",i.i18n().language),u.indexesCreated.resolve()};async function y(){const a=await i.bus.getFirst("user/getPhysicalLocation");if(!a?.floorId)return[];const r=await i.bus.get("poi/getByFloorId",{floorId:a?.floorId}),s=Object.values(e.pickBy(e=>-1===e.category.indexOf("portal")&&"element.door"!==e.category,r)),t=await i.bus.get("wayfinder/addPathTimeMultiple",{pois:s,startLocation:a});return e.sortBy(e.prop("distance"),Object.values(t)).slice(0,50)}i.bus.on("search/queryNearby",async()=>{const e=await y();return i.bus.send("search/showNearby",{pois:e,term:"Nearby"}),e}),i.bus.on("search/queryNearbyAsync",y),i.bus.on("search/queryCategory",async({category:e,categoryName:a,searchTerm:r})=>{const s=await u.indexesCreated.then(()=>u.poiSearch.search({query:r||e}));return i.bus.send("search/showCategory",{pois:s,category:e,categoryName:a}),s}),i.bus.on("search/query",({term:e})=>u.indexesCreated.then(()=>{const a=u.poiSearch.search({query:e});return i.bus.send("search/showSearchResults",{results:a,term:e}),a})),i.bus.on("search/queryAsync",({term:e})=>u.indexesCreated.then(()=>u.poiSearch.search({query:e}))),i.bus.on("search/queryWithSpecial",({term:e})=>{if(u.specialQueryTerms[e]){const{event:a,params:r}=u.specialQueryTerms[e];return i.bus.send(a,r)}return i.bus.get("search/query",{term:e})}),i.bus.on("search/getDefaultSearchTerms",async({limit:e=5}={})=>{const a=u.defaultSearchTerms,r=a&&a.length?a:await async function(e){const a=(await i.bus.send("poi/getAllCategories"))[0],r=Array.from(new Set(a));return s(r).slice(0,e)}(e);return i.bus.send("search/showDefaultSearchKeywords",{keywords:r}),r}),i.bus.on("search/getDefaultSearchPois",async({limit:a=5}={})=>{const r=await i.bus.get("poi/getAll"),s=e.pickBy(e=>e.isNavigable,r);return t(Object.values(s),a)}),i.bus.on("search/registerSpecialQuery",({term:e,event:a,params:r,addKeyword:s=!0})=>{u.indexesCreated.then(()=>{s&&u.typeahead.addKeyword(e),u.specialQueryTerms[e]={event:a,params:r}})}),i.bus.on("search/addKeywords",({keywords:e})=>u.indexesCreated.then(()=>e.forEach(e=>u.typeahead.addKeyword(e)))),i.bus.on("search/typeahead",({term:e,limit:a})=>u.indexesCreated.then(()=>{const{keywords:r,pois:s}=u.typeahead.query(e,a);return{keywords:r,pois:s,term:e}})),i.bus.on("venueData/loadNewVenue",()=>{u.indexesCreated=new a,d()}),i.bus.on("poi/setDynamicData",async({plugin:e,idValuesMap:a})=>{if("grab"!==e)return;const r=Object.keys(a).map(e=>i.bus.get("poi/getById",{id:e}));return Promise.all(r).then(e=>u.indexesCreated.then(()=>u.poiSearch.updateMultiple(e)))}),i.bus.on("poi/updated",async({pois:e})=>{e&&0!==e.length&&(await u.indexesCreated,u.poiSearch.updateMultiple(e),u.typeahead.updatePOIs(e))});return{init:d,runTest:async(e,a)=>(await a(),u)}}export{i as create};
@@ -1 +1 @@
1
- import{pipe as r,values as e,chain as t,prop as a,filter as n,pluck as o}from"ramda";import{getFlexSearchInstance as i}from"./utils.js";function s(s,d,u){const c=function(s,d){const u=function(r){return Object.values(r).map(r=>r.category).map(r=>r.split(".")).map(r=>r[0])}(s),c=r(e,t(a("keywords")),n(a("isUserSearchable")),o("name"))(s),m=[...u,...c],l=Array.from(new Set([...m])),p=i({lang:d});l.forEach((r,e)=>p.add(e,r));return{search:r=>p.search(r).map(r=>l[r]),add:r=>{l.push(r),p.add(l.length-1,r)}}}(s,u);return{query:(r,e)=>{const t=c.search({query:r,limit:e}),a=!(r.length<3)&&t.length,n=e-t.length,o=a?function(r,e){const t=d({query:r,limit:e}),a=d({query:r,suggest:!0,limit:e}),n=t.map(r=>r.poiId),o=a.filter(r=>-1===n.indexOf(r.poiId));return t.concat(o)}(r,n):[];return{keywords:t,pois:o}},addKeyword:r=>{c.add(r)}}}export{s as default};
1
+ import{pipe as e,values as t,chain as r,prop as n,filter as a,pluck as o}from"ramda";import{getFlexSearchInstance as s}from"./utils.js";function i(e,t,r){const n=function(e,t){let r=e,{keywords:n,index:a}=d(e,t);const o=e=>{r=e;const o=d(e,t);n=o.keywords,a=o.index};return{search:e=>a.search(e).map(e=>n[e]),add:e=>{n.push(e),a.add(n.length-1,e)},update:o,getAllPois:()=>r}}(e,r);return{query:(e,r)=>{const a=n.search({query:e,limit:r}),o=!(e.length<3)&&a.length,s=r-a.length,i=o?function(e,r){const n=t({query:e,limit:r}),a=t({query:e,suggest:!0,limit:r}),o=n.map(e=>e.poiId),s=a.filter(e=>-1===o.indexOf(e.poiId));return n.concat(s)}(e,s):[];return{keywords:a,pois:i}},addKeyword:e=>{n.add(e)},updatePOIs:e=>{const t={...n.getAllPois()};for(const r of e)t[r.poiId]=r;n.update(t)}}}function d(i,d){const c=function(e){return Object.values(e).map(e=>e.category).map(e=>e.split(".")).map(e=>e[0])}(i),u=[...c,...e(t,r(n("keywords")),a(n("isUserSearchable")),o("name"))(i),...e(t,o("name"))(i),...e(t,a(e=>e.staticName&&e.staticName!==e.name),o("staticName"))(i)],m=Array.from(new Set([...u])),l=s({lang:d});return m.forEach((e,t)=>l.add(t,e)),{keywords:m,index:l}}export{i as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "atriusmaps-node-sdk",
3
- "version": "3.3.907",
3
+ "version": "3.3.908",
4
4
  "description": "This project provides an API to Atrius Personal Wayfinder maps within a Node environment. See the README.md for more information",
5
5
  "keywords": [
6
6
  "map",