@expofp/floorplan 3.3.8 → 3.4.0
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/browser/{CookieConsent-DhAS93Nm.js → CookieConsent-BgzFI0o5.js} +8 -8
- package/dist/browser/{Debug-DciNEVl6.js → Debug-DwwZ0jVT.js} +9 -9
- package/dist/browser/{Demo-Dh3K6IRU.js → Demo-Bhv7muKd.js} +9 -9
- package/dist/browser/{Free-BHUzZwj9.js → Free-EaDzP7U5.js} +11 -11
- package/dist/browser/{Gallery-C0nPxxJB.js → Gallery-BFio06PY.js} +10 -10
- package/dist/browser/{GpsLoader-De8VPIEW.js → GpsLoader-BhYirpWa.js} +35 -35
- package/dist/browser/{KioskStore-D1jnGTbv.js → KioskStore-DiTPaFb2.js} +5 -5
- package/dist/browser/MaplibreAdapter-BKj3sK8A.js +35131 -0
- package/dist/browser/{Modal-D8kuOldj.js → Modal-DVY124d5.js} +10 -10
- package/dist/browser/{PermissionNotice-v9vhrWnr.js → PermissionNotice-CrAxf_da.js} +7 -7
- package/dist/browser/{SetKioskMode-D2cDGv9V.js → SetKioskMode-Cj1IbMbn.js} +18 -18
- package/dist/browser/ShowKiosk-CqmJT8yJ.js +26 -0
- package/dist/browser/{TouchHand-hrkQyTE4.js → TouchHand-BdZWU_I1.js} +4 -4
- package/dist/browser/{ViewerMenuPanel-BVfEToAO.js → ViewerMenuPanel-DbVIwrJO.js} +17 -17
- package/dist/browser/{add-debug-secret-listener-CdWQ5IqR.js → add-debug-secret-listener-B8gxDWmn.js} +1 -1
- package/dist/browser/{boolean-editor-D24_ATfB.js → boolean-editor-CIT7g6C5.js} +10 -10
- package/dist/browser/{bootIntercom-DSRi4yws.js → bootIntercom-CcgHFRAw.js} +2 -2
- package/dist/browser/{box-BXDPYk7M.js → box-CydZk4HJ.js} +5 -5
- package/dist/browser/{browser-Dk-lVBqy.js → browser-DlMYMMvJ.js} +2 -2
- package/dist/browser/bundle.json +61 -64
- package/dist/browser/{classnames-DNY5NR54.js → classnames-DmdaKMoa.js} +2 -2
- package/dist/browser/{client-CWN096Nx.js → client-8ygU_jvu.js} +4 -4
- package/dist/browser/{components-D9o158HA.js → components-BgwIl1Lu.js} +2073 -3912
- package/dist/browser/createWayfinding-D9tuHHx5.js +1889 -0
- package/dist/browser/{debug-overlay-DQG-UfZv.js → debug-overlay-Dos3Ate2.js} +11 -11
- package/dist/browser/{debug-ui-yYN-_8G_.js → debug-ui-BjmKfkgV.js} +6 -6
- package/dist/browser/{dist-uPMox8hh.js → dist-B3Y58WKJ.js} +6 -6
- package/dist/browser/{dist-CAs4SFEJ.js → dist-Bm6VKnC2.js} +3 -3
- package/dist/browser/{dist-7_sOACbd.js → dist-_wJOZ0rm.js} +5 -5
- package/dist/browser/{efp-debug-init-Dwp-psKk.js → efp-debug-init-yyCWZRTx.js} +5 -4
- package/dist/browser/{enum-editor-PV_iv0tr.js → enum-editor-D8X_uabc.js} +11 -11
- package/dist/browser/{event-not-found-BjBg31r7.js → event-not-found-Bm_W5xxA.js} +1 -1
- package/dist/browser/{exports-lMrT2XbM.js → exports-DnHrfjiU.js} +1 -1
- package/dist/browser/{favicon-qwrv2N2K.js → favicon-Bnz633J6.js} +1 -1
- package/dist/browser/{fetch-retry.umd-D_06P7tx.js → fetch-retry.umd-BunUcQza.js} +2 -2
- package/dist/browser/{flex-DMyWG2k5.js → flex-DwDJlblp.js} +6 -6
- package/dist/browser/{flex.props-DJYmgUbO.js → flex.props-BAGkFvkN.js} +2 -2
- package/dist/browser/{floorplan.loader-CkEu28br.js → floorplan.loader-B3PUqtqn.js} +30 -31
- package/dist/browser/{floorplan.ready-CL42thhp.js → floorplan.ready-BAnq_GdS.js} +251 -251
- package/dist/browser/{fuse-BrJpK9Lv.js → fuse-Bhsd7fBU.js} +2 -2
- package/dist/browser/{i18n-ST-5I_Xd.js → i18n-C5BBGKZk.js} +5 -5
- package/dist/browser/index.js +13 -13
- package/dist/browser/{jsx-runtime-z-VgZsNI.js → jsx-runtime-Dk2--jeN.js} +2 -2
- package/dist/browser/{lib-resthkmx.js → lib-Brd2BCh_.js} +4 -4
- package/dist/browser/locales/ar.json +0 -1
- package/dist/browser/locales/de.json +0 -1
- package/dist/browser/locales/es.json +0 -1
- package/dist/browser/locales/fr.json +0 -1
- package/dist/browser/locales/he.json +0 -1
- package/dist/browser/locales/it.json +0 -1
- package/dist/browser/locales/kk.json +0 -1
- package/dist/browser/locales/ko.json +0 -1
- package/dist/browser/locales/mn.json +0 -1
- package/dist/browser/locales/nl.json +0 -1
- package/dist/browser/locales/pl.json +0 -1
- package/dist/browser/locales/pt.json +0 -1
- package/dist/browser/locales/ru.json +0 -1
- package/dist/browser/locales/sv.json +0 -1
- package/dist/browser/locales/th.json +0 -1
- package/dist/browser/locales/tr.json +0 -1
- package/dist/browser/locales/uk.json +0 -1
- package/dist/browser/locales/vi.json +0 -1
- package/dist/browser/locales/zh.json +0 -1
- package/dist/browser/{main-BOaUt8eX.js → main-pIcuVUIg.js} +1 -1
- package/dist/browser/{mobx-BGVJo_6r.js → mobx-BfCD0EQ-.js} +4 -4
- package/dist/browser/{particles.min-D3-LD_RC.js → particles.min-ChGMv-bm.js} +2 -2
- package/dist/browser/{prop-types-xS5Y65WT.js → prop-types-xdXFFTmm.js} +2 -2
- package/dist/browser/{react-CDDaD-I1.js → react-BbZc5Oeq.js} +2 -2
- package/dist/browser/{react-dom-B1aPQ40g.js → react-dom-BBDOhlbP.js} +3 -3
- package/dist/browser/{reset-all-settings-DHgz1Ud7.js → reset-all-settings-BQC7zljW.js} +7 -7
- package/dist/browser/{rolldown-runtime-Bb8iYlSJ.js → rolldown-runtime-DS4W77DU.js} +1 -1
- package/dist/browser/{settings-BD9hHBVE.js → settings-CK-qRFM8.js} +2 -2
- package/dist/browser/{settings-item-BMJ0aBEh.js → settings-item-CUnGC7xO.js} +6 -6
- package/dist/browser/{storage-B0mOBJql.js → storage-0QGL3b8S.js} +3 -3
- package/dist/browser/{store-Dyrv6nnP.js → store-Bm4aFC2V.js} +4453 -4897
- package/dist/browser/{string-editor-DoAiUhFX.js → string-editor-BNry84Oh.js} +8 -8
- package/dist/browser/{theme-7rduvM4D.js → theme-BIXywNMw.js} +8 -8
- package/dist/browser/{ui-CgRQk7e0.js → ui-AzubEvGd.js} +8 -8
- package/dist/browser/{useRenderTarget-rq9Hu7Z3.js → useRenderTarget-Bf7cQRFi.js} +4 -4
- package/dist/esm/_misc_to_move/manifest.d.ts +1 -0
- package/dist/esm/components/Controls.js +1 -1
- package/dist/esm/components/Exhibitor.js +1 -1
- package/dist/esm/components/Layout.js +1 -1
- package/dist/esm/components/LevelSelector.js +1 -1
- package/dist/esm/components/LogoOverlay.js +1 -1
- package/dist/esm/components/Map/Map.js +1 -1
- package/dist/esm/components/Map/drawing/config/config-booth-bg.js +1 -1
- package/dist/esm/components/Map/drawing/config/config-booth-border.js +1 -1
- package/dist/esm/components/Map/drawing/config/config-booths.js +1 -1
- package/dist/esm/components/Map/drawing/config/config-load-layer.js +1 -1
- package/dist/esm/components/Map/traffic/useManageTraffic.js +1 -1
- package/dist/esm/components/Maplibre/MaplibreAdapter.d.ts +14 -0
- package/dist/esm/components/Maplibre/MaplibreAdapter.js +1 -0
- package/dist/esm/components/Maplibre/MaplibreWrapper.d.ts +69 -0
- package/dist/esm/components/Maplibre/MaplibreWrapper.js +1 -0
- package/dist/esm/components/Maplibre/useCameraReactions.d.ts +10 -0
- package/dist/esm/components/Maplibre/useCameraReactions.js +1 -0
- package/dist/esm/components/Maplibre/useDimming.d.ts +16 -0
- package/dist/esm/components/Maplibre/useDimming.js +1 -0
- package/dist/esm/components/Maplibre/useLayerVisibilitySync.d.ts +11 -0
- package/dist/esm/components/Maplibre/useLayerVisibilitySync.js +1 -0
- package/dist/esm/components/Maplibre/useRendererEvents.d.ts +9 -0
- package/dist/esm/components/Maplibre/useRendererEvents.js +1 -0
- package/dist/esm/components/Maplibre/useWayfindingAndMarkers.d.ts +8 -0
- package/dist/esm/components/Maplibre/useWayfindingAndMarkers.js +1 -0
- package/dist/esm/components/Maplibre/utils/geo-config.d.ts +30 -0
- package/dist/esm/components/Maplibre/utils/geo-config.js +1 -0
- package/dist/esm/components/Maplibre/utils/layer-defs.d.ts +4 -0
- package/dist/esm/components/Maplibre/utils/layer-defs.js +1 -0
- package/dist/esm/components/Maplibre/utils/map-helpers.d.ts +9 -0
- package/dist/esm/components/Maplibre/utils/map-helpers.js +1 -0
- package/dist/esm/components/Maplibre/utils/solver.d.ts +24 -0
- package/dist/esm/components/Maplibre/utils/solver.js +1 -0
- package/dist/esm/data/Flags.d.ts +1 -0
- package/dist/esm/data/fpGeo.d.ts +20 -1
- package/dist/esm/floorplan.loader.d.ts +1 -0
- package/dist/esm/floorplan.loader.js +1 -1
- package/dist/esm/floorplan.ready.js +1 -1
- package/dist/esm/renderer/RendererService.d.ts +5 -0
- package/dist/esm/renderer/RendererService.js +1 -1
- package/dist/esm/services/routing.js +1 -1
- package/dist/esm/store/MaplibreStore.d.ts +22 -0
- package/dist/esm/store/MaplibreStore.js +1 -0
- package/dist/esm/store/RootStore.d.ts +2 -2
- package/dist/esm/store/RootStore.js +1 -1
- package/dist/esm/store/RouteStore.js +1 -1
- package/dist/esm/store/init/init-booths.js +1 -1
- package/dist/esm/types.d.ts +9 -0
- package/dist/esm/utils/dimming.d.ts +16 -0
- package/dist/esm/utils/dimming.js +1 -0
- package/dist/esm/wayfinding/core/position/gpsThreshold.d.ts +1 -1
- package/package.json +5 -9
- package/dist/browser/Mapbox-CzVyYzjj.js +0 -120
- package/dist/browser/ShowKiosk-DjrDUQUM.js +0 -26
- package/dist/browser/ThreeComponent-CUKVDY94.js +0 -1494
- package/dist/browser/data-ZH4_sxkL.js +0 -27967
- package/dist/browser/vendor/mapbox/mapbox-gl.css +0 -1
- package/dist/esm/components/Mapbox/Button.d.ts +0 -10
- package/dist/esm/components/Mapbox/Button.js +0 -1
- package/dist/esm/components/Mapbox/Dot.d.ts +0 -10
- package/dist/esm/components/Mapbox/Dot.js +0 -1
- package/dist/esm/components/Mapbox/MapLoader.d.ts +0 -4
- package/dist/esm/components/Mapbox/MapLoader.js +0 -1
- package/dist/esm/components/Mapbox/Mapbox.d.ts +0 -4
- package/dist/esm/components/Mapbox/Mapbox.js +0 -1
- package/dist/esm/components/Mapbox/utils/data.d.ts +0 -38
- package/dist/esm/components/Mapbox/utils/data.js +0 -1
- package/dist/esm/components/Threejs/ThreeComponent.d.ts +0 -7
- package/dist/esm/components/Threejs/ThreeComponent.js +0 -1
- package/dist/esm/components/Threejs/UIManager.d.ts +0 -28
- package/dist/esm/components/Threejs/UIManager.js +0 -1
- package/dist/esm/components/Threejs/common/BoothMesh.d.ts +0 -20
- package/dist/esm/components/Threejs/common/BoothMesh.js +0 -1
- package/dist/esm/components/Threejs/common/Scene.d.ts +0 -13
- package/dist/esm/components/Threejs/common/Scene.js +0 -1
- package/dist/esm/components/Threejs/common/SpriteMesh.d.ts +0 -5
- package/dist/esm/components/Threejs/common/SpriteMesh.js +0 -1
- package/dist/esm/components/Threejs/common/dataLoader.d.ts +0 -31
- package/dist/esm/components/Threejs/common/dataLoader.js +0 -1
- package/dist/esm/components/Threejs/common/modelLoader.d.ts +0 -3
- package/dist/esm/components/Threejs/common/modelLoader.js +0 -1
- package/dist/esm/components/Threejs/common/sceneLoader.d.ts +0 -7
- package/dist/esm/components/Threejs/common/sceneLoader.js +0 -1
- package/dist/esm/components/Threejs/index.d.ts +0 -4
- package/dist/esm/components/Threejs/index.js +0 -1
- package/dist/esm/components/Threejs/mapbox/configureWebGLForMapbox.d.ts +0 -2
- package/dist/esm/components/Threejs/mapbox/configureWebGLForMapbox.js +0 -1
- package/dist/esm/components/Threejs/mapbox/index_mapbox.d.ts +0 -4
- package/dist/esm/components/Threejs/mapbox/index_mapbox.js +0 -1
- package/dist/esm/components/Threejs/mapbox/init-mapbox.d.ts +0 -3
- package/dist/esm/components/Threejs/mapbox/init-mapbox.js +0 -1
- package/dist/esm/components/Threejs/utils/canvasFromText.d.ts +0 -2
- package/dist/esm/components/Threejs/utils/canvasFromText.js +0 -1
- package/dist/esm/components/Threejs/utils/textureMerger.d.ts +0 -60
- package/dist/esm/components/Threejs/utils/textureMerger.js +0 -1
- package/dist/esm/store/MapboxStore.d.ts +0 -13
- package/dist/esm/store/MapboxStore.js +0 -1
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import 'maplibre-gl/dist/maplibre-gl.css';
|
|
2
|
+
import { Renderer, type SceneDef } from '@expofp/renderer';
|
|
3
|
+
import type { LngLatBoundsLike, StyleSpecification } from 'maplibre-gl';
|
|
4
|
+
import { Map as MaplibreMap } from 'maplibre-gl';
|
|
5
|
+
export declare const MAP_DIM_LAYER_ID = "expofp-map-dim";
|
|
6
|
+
/**
|
|
7
|
+
* Configuration for the map tile source.
|
|
8
|
+
* Abstracted so we can swap between online and offline (PMTiles) later
|
|
9
|
+
* without touching MaplibreWrapper.
|
|
10
|
+
*/
|
|
11
|
+
export interface TileSourceConfig {
|
|
12
|
+
/** Maplibre style URL or inline style JSON object */
|
|
13
|
+
style: string | StyleSpecification;
|
|
14
|
+
}
|
|
15
|
+
export interface CameraPaddingOptions {
|
|
16
|
+
top: number;
|
|
17
|
+
bottom: number;
|
|
18
|
+
left: number;
|
|
19
|
+
right: number;
|
|
20
|
+
}
|
|
21
|
+
/** Geographic configuration derived from fpGeo.properties */
|
|
22
|
+
export interface GeoConfig {
|
|
23
|
+
/** Center of the venue in [lng, lat] */
|
|
24
|
+
center: [number, number];
|
|
25
|
+
/** Map bearing in degrees */
|
|
26
|
+
bearing: number;
|
|
27
|
+
/** Initial zoom level */
|
|
28
|
+
zoom: number;
|
|
29
|
+
/** Optional initial bounds. When present, MapLibre computes the initial zoom. */
|
|
30
|
+
bounds?: LngLatBoundsLike;
|
|
31
|
+
/** Padding used with initial bounds. */
|
|
32
|
+
fitPadding?: CameraPaddingOptions;
|
|
33
|
+
/** Small correction after bounds-based initial fit. */
|
|
34
|
+
zoomAdjustment?: number;
|
|
35
|
+
}
|
|
36
|
+
export interface MapOptions {
|
|
37
|
+
pitch?: number;
|
|
38
|
+
maxPitch?: number;
|
|
39
|
+
minZoom?: number;
|
|
40
|
+
maxZoom?: number;
|
|
41
|
+
maxBounds?: LngLatBoundsLike;
|
|
42
|
+
}
|
|
43
|
+
export interface MaplibreWrapperProps {
|
|
44
|
+
/** The scene definition to render inside the map */
|
|
45
|
+
sceneDef: SceneDef;
|
|
46
|
+
/** Geographic configuration for map positioning and floorplan locking */
|
|
47
|
+
geoConfig: GeoConfig;
|
|
48
|
+
/** Static SVG-to-Mercator transform prepared by the adapter */
|
|
49
|
+
staticTransform: number[];
|
|
50
|
+
/** Tile source configuration (online style URL for now) */
|
|
51
|
+
tileSource: TileSourceConfig;
|
|
52
|
+
/** Map camera constraints and defaults */
|
|
53
|
+
mapOptions?: MapOptions;
|
|
54
|
+
/** Called when the renderer instance is ready for external interaction */
|
|
55
|
+
onRendererReady?: (renderer: Renderer, map: MaplibreMap, sceneDef: SceneDef, requestRepaint: () => void) => void;
|
|
56
|
+
/** Called when the dim overlay layer is available for paint updates. */
|
|
57
|
+
onMapDimLayerReady?: (map: MaplibreMap) => void;
|
|
58
|
+
/** Called when the map style cannot be loaded. */
|
|
59
|
+
onMapLoadError?: (error: unknown) => void;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* A pure, state-agnostic React component that renders a Maplibre map
|
|
63
|
+
* with the ExpoFP floorplan embedded via CustomLayerInterface.
|
|
64
|
+
*
|
|
65
|
+
* This component does NOT import MobX or any application state.
|
|
66
|
+
* All state synchronization is done externally via the onRendererReady callback.
|
|
67
|
+
*/
|
|
68
|
+
export default function MaplibreWrapper({ sceneDef, geoConfig, staticTransform, tileSource, mapOptions, onRendererReady, onMapDimLayerReady, onMapLoadError, }: MaplibreWrapperProps): import("react").JSX.Element;
|
|
69
|
+
//# sourceMappingURL=MaplibreWrapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as T}from"react/jsx-runtime";import"maplibre-gl/dist/maplibre-gl.css";import{Renderer as Z}from"@expofp/renderer";import{addProtocol as B,Map as N}from"maplibre-gl";import{Protocol as G}from"pmtiles";import{useEffect as R,useRef as s}from"react";export const MAP_DIM_LAYER_ID="expofp-map-dim";const y="expofp-map-dim-source",U="3d-expofp";let g=null;const Y=["coalesce",["get","name:en"],["get","name_en"],["get","name:latin"],["get","name"]],k={type:"Feature",geometry:{type:"Polygon",coordinates:[[[-180,-85],[180,-85],[180,85],[-180,85],[-180,-85]]]},properties:{}};function S(e){if(!e||typeof e!="object")return!1;const r=e.length;if(typeof r!="number"||r<16)return!1;const o=e[0];return typeof o=="number"&&Number.isFinite(o)}function H(e){if(S(e))return Array.from(e);const o=e?.defaultProjectionData?.mainMatrix;return S(o)?Array.from(o):(console.warn("Maplibre custom layer received an unsupported projection matrix payload.",e),null)}function b(e){return typeof e=="string"?e.includes("name"):Array.isArray(e)?e.some(r=>b(r)):!e||typeof e!="object"?!1:Object.values(e).some(r=>b(r))}function J(e){return e.type!=="symbol"||!e.id||!e.layout?!1:b(e.layout["text-field"])}function V(e){const r=e.getStyle();for(const o of r.layers??[])J(o)&&e.setLayoutProperty(o.id,"text-field",Y)}function W(){if(!g){g=new G;try{B("pmtiles",g.tile)}catch(e){console.warn("Maplibre PMTiles protocol registration failed.",e)}}}export default function X({sceneDef:e,geoConfig:r,staticTransform:o,tileSource:D,mapOptions:E,onRendererReady:x,onMapDimLayerReady:L,onMapLoadError:M}){const f=s(null),P=s(null),c=s(null),h=s(x),_=s(L),j=s(M),O=s({sceneDef:e,geoConfig:r,staticTransform:o,tileSource:D,mapOptions:E});return R(()=>{h.current=x,_.current=L,j.current=M}),R(()=>{if(!f.current)return;const{sceneDef:d,geoConfig:n,staticTransform:I,tileSource:w,mapOptions:u}=O.current;let p=!1;const l={...d};l.rootLayer={...d.rootLayer};const C=d.rootLayer.children;l.rootLayer.children=C.filter(i=>i?.name?.toString().toLowerCase()!=="areamap"),l.background=void 0,l.staticTransform=I,W();const F=n.bounds?{bounds:n.bounds,fitBoundsOptions:{padding:n.fitPadding,bearing:n.bearing}}:{center:n.center,zoom:n.zoom},t=new N({container:f.current,style:w.style,...F,bearing:n.bearing,pitch:u?.pitch??30,maxPitch:u?.maxPitch??70,minZoom:u?.minZoom,maxZoom:u?.maxZoom,maxBounds:u?.maxBounds,canvasContextAttributes:{antialias:!0}});n.zoomAdjustment&&t.jumpTo({zoom:t.getZoom()+n.zoomAdjustment}),P.current=t,t.once("error",i=>{t.isStyleLoaded()||j.current?.(i?.error??i)});const z={id:U,type:"custom",renderingMode:"3d",onAdd(i,m){if(p)return;const a=new Z({canvas:t.getCanvas(),gl:m});if(p){a.dispose();return}a.init(l),c.current=a,h.current?.(a,t,l,()=>t.triggerRepaint())},render(i,m){if(!c.current||c.current.isDisposed)return;const a=H(m??i);a&&c.current.render(a)}},A=()=>{V(t),t.getSource(y)||t.addSource(y,{type:"geojson",data:k}),t.getLayer(MAP_DIM_LAYER_ID)||t.addLayer({id:MAP_DIM_LAYER_ID,type:"fill",source:y,paint:{"fill-color":"#000000","fill-opacity":0,"fill-opacity-transition":{duration:0,delay:0}}}),_.current?.(t),t.addLayer(z)};return t.on("style.load",A),()=>{p=!0,t.off("style.load",A),c.current?.dispose(),c.current=null,t.remove(),P.current=null}},[]),T("div",{ref:f,style:{position:"absolute",top:0,left:0,width:"100%",height:"100%"}})}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Map as MaplibreMap } from 'maplibre-gl';
|
|
2
|
+
import type { RefObject } from 'react';
|
|
3
|
+
import type { GeoConfig } from './utils/geo-config';
|
|
4
|
+
/**
|
|
5
|
+
* Bundles all camera-related MobX reactions: moveToBooths, moveToRect,
|
|
6
|
+
* zoomBy, moveToLocation, and centerMap. Each watches a uiState trigger,
|
|
7
|
+
* moves the camera, and clears the trigger.
|
|
8
|
+
*/
|
|
9
|
+
export declare function useCameraReactions(mapRef: RefObject<MaplibreMap | null>, geoConfig: GeoConfig | null): void;
|
|
10
|
+
//# sourceMappingURL=useCameraReactions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import y from"../../core/Rect";import{svgArea as T}from"../../data/svg";import f,{uiState as c}from"../../store";import{convertLocalToGps as b}from"../../utils/gps";import{useReaction as u}from"../../utils/mobx";import{fitMapToLocalRect as p}from"./utils/geo-config";const i=c;export function useCameraReactions(s,e){u(()=>i.moveToBooths,r=>{const t=s.current;if(!r||!t||!e)return;const o=r.filter(m=>m.rect);if(o.length===0)return;const n=o.map(m=>m.rect),a=y.fromMultiple(n);p(t,a,e),i.moveToBooths=null}),u(()=>i.moveToRect,r=>{const t=s.current;!r||!t||!e||(p(t,r,e),i.moveToRect=null)}),u(()=>i.zoomBy,r=>{const t=s.current;!r||!t||(t.flyTo({zoom:t.getZoom()+(r>1?.5:-.5),animate:!0,duration:500}),i.zoomBy=null)}),u(()=>c.moveToLocation,r=>{const t=s.current,o=f.routeStore.currentPosition;if(!r||!t||!o)return;const{lng:n,lat:a}=o,m=typeof n=="number"&&Number.isFinite(n)&&typeof a=="number"&&Number.isFinite(a);let l;if(m)l=[n,a];else{if(!e)return;l=b(o.x,o.y,e.gpsConfig)}t.flyTo({center:l,animate:!0,duration:1e3}),t.once("moveend",()=>{c.moveToLocation=!1})}),u(()=>c.centerMap,r=>{const t=s.current;if(!r||!t||!e)return;if(!(c.list.type==="search"&&!c.list.text)){const n=f.layerStore.rectangle||T;p(t,n,e,{padding:0})}c.centerMap=!1})}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Map as MaplibreMap } from 'maplibre-gl';
|
|
2
|
+
import type { RefObject } from 'react';
|
|
3
|
+
import type { RendererService } from '../../renderer/RendererService';
|
|
4
|
+
import type { DimmingAnimator } from '../../utils/dimming';
|
|
5
|
+
export interface DimmingControls {
|
|
6
|
+
mapDimAnimatorRef: RefObject<DimmingAnimator | null>;
|
|
7
|
+
venueDimAnimatorRef: RefObject<DimmingAnimator | null>;
|
|
8
|
+
handleMapDimLayerReady: (map: MaplibreMap) => void;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Manages scene dimming: creates map and venue dim animators,
|
|
12
|
+
* keeps them in sync with uiState.dimmed via a MobX reaction,
|
|
13
|
+
* and provides a callback for when the map dim layer is ready.
|
|
14
|
+
*/
|
|
15
|
+
export declare function useDimming(mapRef: RefObject<MaplibreMap | null>, rendererService: RendererService): DimmingControls;
|
|
16
|
+
//# sourceMappingURL=useDimming.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useCallback as I,useEffect as c,useRef as o}from"react";import{uiState as l}from"../../store";import{applyVenueDimValue as T,createDimmingAnimator as s,DIM_INTENSITY as p,VENUE_DIM_INTENSITY as V}from"../../utils/dimming";import{useReaction as d}from"../../utils/mobx";import{applyMapDimValue as f}from"./utils/map-helpers";export function useDimming(i,u){const a=o(u);c(()=>{a.current=u},[u]);const e=o(null),r=o(null);c(()=>{const t=s(m=>{f(i.current,m*p)}),n=s(m=>{T(a.current,m*V)});return e.current=t,r.current=n,()=>{t.stop(),n.stop(),e.current=null,r.current=null}},[i]),d(()=>l.dimmed,t=>{e.current?.setTarget(t),r.current?.setTarget(t)});const D=I(t=>{const n=e.current?.getValue()??(l.dimmed?1:0);f(t,n*p)},[]);return{mapDimAnimatorRef:e,venueDimAnimatorRef:r,handleMapDimLayerReady:D}}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Map as MaplibreMap } from 'maplibre-gl';
|
|
2
|
+
import type { RefObject } from 'react';
|
|
3
|
+
import type { RendererService } from '../../renderer/RendererService';
|
|
4
|
+
import type { GeoConfig } from './utils/geo-config';
|
|
5
|
+
/**
|
|
6
|
+
* Keeps the 3D scene layer visibility in sync with LayerStore.
|
|
7
|
+
* When a layer's visibility changes, updates the corresponding LayerDefs
|
|
8
|
+
* and fits the camera to the newly visible floor.
|
|
9
|
+
*/
|
|
10
|
+
export declare function useLayerVisibilitySync(rendererService: RendererService, mapRef: RefObject<MaplibreMap | null>, geoConfig: GeoConfig | null): void;
|
|
11
|
+
//# sourceMappingURL=useLayerVisibilitySync.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useRef as m}from"react";import s from"../../store";import{useReaction as p}from"../../utils/mobx";import{fitMapToLocalRect as L}from"./utils/geo-config";import{collectLayerDefsByName as b}from"./utils/layer-defs";export function useLayerVisibilitySync(a,y,u){const t=m(null),f=m(null);p(()=>s.layerStore.layers.map(e=>`${e.name}:${e.visible?1:0}`),()=>{const e=a.scene;if(!e)return;t.current?.rootLayer!==e.rootLayer&&(t.current={rootLayer:e.rootLayer,defsByName:b(e.rootLayer)});const d=t.current.defsByName,n=[];for(const o of s.layerStore.layers){const c=d.get(o.name);if(c?.length)for(const i of c){const l=!o.visible;i.hidden!==l&&(i.hidden=l,n.push(i))}}n.length&&a.update(...n);const r=s.layerStore.layers.find(o=>o.visible&&!o.frozen&&!o.rootParent&&!o.pathway);!r||f.current===r.name||(f.current=r.name,L(y.current,r.viewbox??r.rect,u))})}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Renderer } from '@expofp/renderer';
|
|
2
|
+
import type { RendererService } from '../../renderer/RendererService';
|
|
3
|
+
/**
|
|
4
|
+
* Attaches pointer and navigation event listeners to the renderer.
|
|
5
|
+
* Listeners are set up when the renderer becomes available and
|
|
6
|
+
* cleaned up when it changes or the component unmounts.
|
|
7
|
+
*/
|
|
8
|
+
export declare function useRendererEvents(renderer: Renderer | null, rendererService: RendererService): void;
|
|
9
|
+
//# sourceMappingURL=useRendererEvents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useEffect as g}from"react";import{pickDefaultScene as p}from"../../renderer/engine-core/defs";import l,{uiState as o}from"../../store";import{LayerMode as u}from"../../store/LayerStore";import k from"../Map/booth-by-xy";import{getMarkerFromClick as L}from"../Map/drawing/config/config-markers";import{getBooth as E}from"./utils/layer-defs";const C=o;export function useRendererEvents(t,m){g(()=>{if(!t)return;const v=({data:s})=>{if(o.setKioskModeEnabled)return;const{point:e,defs:r}=p(s),n=k(e.x,e.y),i=E(r[0]);C.hoveredBooth=n||i},d=()=>{o.setKioskModeEnabled||(C.hoveredBooth=null)},f=({data:s})=>{if(!o?.rootElement)return;window.__resett?.(),o.overlayPosition==="bottom"&&o.overlaySize==="full"&&l.showMap();const{point:e,defs:r}=p(s),{x:n,y:i}=e;if(o.onGetCoordsClick){const a=l.layerStore.layers.find(c=>c.visible&&(c.mode===u.TurnedOn||c.mode===u.TurnedOff));o.onGetCoordsClick({x:n,y:i,z:a?.name||null})}if(o.setKioskModeEnabled)return;if(o.onMarkerClick){const a=L(n,i,m.scale);o.onMarkerClick(a)}const y=k(e.x,e.y),b=E(r[0]);l.clickBooth(y||b)},h=()=>window.__resett?.();return t.events.addEventListener("pointer:move",v),t.events.addEventListener("pointer:out",d),t.events.addEventListener("pointer:click",f),t.events.addEventListener("navigation:change",h),()=>{t.events.removeEventListener("pointer:move",v),t.events.removeEventListener("pointer:out",d),t.events.removeEventListener("pointer:click",f),t.events.removeEventListener("navigation:change",h)}},[t,m])}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Renderer } from '@expofp/renderer';
|
|
2
|
+
import type { RendererService } from '../../renderer/RendererService';
|
|
3
|
+
/**
|
|
4
|
+
* Sets up wayfinding and markers when the renderer becomes available,
|
|
5
|
+
* and tears them down when the renderer changes or the component unmounts.
|
|
6
|
+
*/
|
|
7
|
+
export declare function useWayfindingAndMarkers(renderer: Renderer | null, rendererService: RendererService): void;
|
|
8
|
+
//# sourceMappingURL=useWayfindingAndMarkers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useEffect as a}from"react";import{createWayfinding as i}from"../../wayfinding/createWayfinding";import{configMarkers as m}from"../Map/drawing/config/config-markers";export function useWayfindingAndMarkers(n,f){a(()=>{if(!n)return;const o=i(f),t=m(f);return()=>{o?.(),t?.()}},[n,f])}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { LngLatBoundsLike, Map as MaplibreMap } from 'maplibre-gl';
|
|
2
|
+
import type CoreRect from '../../../core/Rect';
|
|
3
|
+
import type { GeoConfig as MaplibreGeoConfig } from '../MaplibreWrapper';
|
|
4
|
+
import type { TransformGeoConfig } from './solver';
|
|
5
|
+
export interface GeoConfig extends MaplibreGeoConfig {
|
|
6
|
+
gpsConfig: TransformGeoConfig;
|
|
7
|
+
}
|
|
8
|
+
export interface CameraPaddingOptions {
|
|
9
|
+
top: number;
|
|
10
|
+
bottom: number;
|
|
11
|
+
left: number;
|
|
12
|
+
right: number;
|
|
13
|
+
}
|
|
14
|
+
export interface FitMapOptions {
|
|
15
|
+
duration?: number;
|
|
16
|
+
padding?: number;
|
|
17
|
+
}
|
|
18
|
+
export declare const MAP_BOUNDS_PADDING_FACTOR = 3;
|
|
19
|
+
export declare const MAP_BOUNDS_MIN_PADDING_DEGREES = 0.02;
|
|
20
|
+
export declare const INITIAL_FIT_ZOOM_ADJUSTMENT = 0.15;
|
|
21
|
+
export declare function deriveVenueMapBounds(config: TransformGeoConfig): LngLatBoundsLike | undefined;
|
|
22
|
+
export declare function getLocalRectGeoBounds(rect: CoreRect, config: TransformGeoConfig): LngLatBoundsLike;
|
|
23
|
+
export declare function getVisibleRectFitPadding(extraPadding?: number): CameraPaddingOptions;
|
|
24
|
+
/**
|
|
25
|
+
* Derive the geographic configuration from the fpGeo data.
|
|
26
|
+
* Returns null if geo data is not available.
|
|
27
|
+
*/
|
|
28
|
+
export declare function deriveGeoConfig(): GeoConfig | null;
|
|
29
|
+
export declare function fitMapToLocalRect(map: MaplibreMap | null, rect: CoreRect | null, geoConfig: GeoConfig | null, options?: FitMapOptions): void;
|
|
30
|
+
//# sourceMappingURL=geo-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{fpGeo as h}from"../../../data/fpGeo";import{svgArea as s}from"../../../data/svg";import{uiState as M}from"../../../store";import{convertLocalToGps as m}from"../../../utils/gps";export const MAP_BOUNDS_PADDING_FACTOR=3,MAP_BOUNDS_MIN_PADDING_DEGREES=.02,INITIAL_FIT_ZOOM_ADJUSTMENT=.15;export function deriveVenueMapBounds(t){const n=[[s.x1,s.y1],[s.x2,s.y1],[s.x2,s.y2],[s.x1,s.y2]].map(([r,p])=>m(r,p,t));if(!n.every(([r,p])=>Number.isFinite(r)&&Number.isFinite(p)))return;const o=n.map(([r])=>r),i=n.map(([,r])=>r),a=Math.min(...o),e=Math.max(...o),c=Math.min(...i),u=Math.max(...i),x=Math.max((e-a)*MAP_BOUNDS_PADDING_FACTOR,MAP_BOUNDS_MIN_PADDING_DEGREES),f=Math.max((u-c)*MAP_BOUNDS_PADDING_FACTOR,MAP_BOUNDS_MIN_PADDING_DEGREES);return[[a-x,c-f],[e+x,u+f]]}export function getLocalRectGeoBounds(t,n){const o=[m(t.x1,t.y1,n),m(t.x2,t.y1,n),m(t.x2,t.y2,n),m(t.x1,t.y2,n)],i=o.map(([e])=>e),a=o.map(([,e])=>e);return[[Math.min(...i),Math.min(...a)],[Math.max(...i),Math.max(...a)]]}export function getVisibleRectFitPadding(t=0){const n=M.canvasVisibleRectPx,o=M.screenSize;return!n||!o?{top:t,bottom:t,left:t,right:t}:{top:Math.max(0,n.y1)+t,bottom:Math.max(0,o.height-n.y2)+t,left:Math.max(0,n.x1)+t,right:Math.max(0,o.width-n.x2)+t}}export function deriveGeoConfig(){if(!h?.properties?.config)return null;const t=h.properties.config,n=(t.p0.lng+t.p2.lng)/2,o=(t.p0.lat+t.p2.lat)/2;return{center:[n,o],bearing:t.bearing??0,zoom:16,gpsConfig:t}}export function fitMapToLocalRect(t,n,o,i={}){if(!t||!n||!o||n.h===1/0||n.w===1/0||n.h<=0||n.w<=0)return;const a=getLocalRectGeoBounds(n,o.gpsConfig),e=getVisibleRectFitPadding(i.padding??50);t.fitBounds(a,{padding:e,duration:i.duration??1e3,bearing:o.bearing})}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { LayerDef, ShapeDef } from '@expofp/renderer';
|
|
2
|
+
export declare function collectLayerDefsByName(layer: LayerDef, acc?: Map<string, LayerDef[]>): Map<string, LayerDef[]>;
|
|
3
|
+
export declare function getBooth(shapeDef: ShapeDef): import("../../../store/BoothStore").Booth | null | undefined;
|
|
4
|
+
//# sourceMappingURL=layer-defs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{boothStore as t}from"../../../store";export function collectLayerDefsByName(e,n=new Map){if(e.name){const o=n.get(e.name)??[];o.push(e),n.set(e.name,o)}for(const o of e.children??[])o&&"children"in o&&collectLayerDefsByName(o,n);return n}export function getBooth(e){return e?.shape?t.booths.find(n=>n.shapes?.some(o=>o.shape===e.shape)):null}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Map as MaplibreMap } from 'maplibre-gl';
|
|
2
|
+
import type { MapOptions, TileSourceConfig } from '../MaplibreWrapper';
|
|
3
|
+
export declare const DEFAULT_TILE_SOURCE: TileSourceConfig;
|
|
4
|
+
export declare const DEFAULT_MAP_OPTIONS: MapOptions;
|
|
5
|
+
export declare const MAP_2D_OPTIONS: MapOptions;
|
|
6
|
+
export declare function applyMapDimValue(map: MaplibreMap | null, value: number): void;
|
|
7
|
+
export declare function applyMapOptions(map: MaplibreMap | null, mapOptions: MapOptions, animatePitch?: boolean): void;
|
|
8
|
+
export declare function getTileSource(): TileSourceConfig;
|
|
9
|
+
//# sourceMappingURL=map-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import s from"../../../store";import{MAP_DIM_LAYER_ID as c}from"../MaplibreWrapper";export const DEFAULT_TILE_SOURCE={style:"https://basemaps.cartocdn.com/gl/positron-gl-style/style.json"},DEFAULT_MAP_OPTIONS={pitch:30,maxPitch:70,minZoom:14},MAP_2D_OPTIONS={pitch:0,maxPitch:0,minZoom:14};export function applyMapDimValue(t,e){t?.getLayer(c)&&(t.setPaintProperty(c,"fill-opacity",u(e)),t.triggerRepaint())}function u(t){return Math.min(Math.max(t,0),1)}export function applyMapOptions(t,e,i=!1){if(!t)return;t.setMinZoom(e.minZoom??null),t.setMaxZoom(e.maxZoom??null),t.setMaxBounds(e.maxBounds??null);const o=e.pitch,n=e.maxPitch,r=t.getPitch(),l=!!(i&&o!=null&&n!=null&&n<r);n!=null&&!l&&t.setMaxPitch(e.maxPitch),!(o==null||r===o)&&(i?(t.easeTo({pitch:o,duration:300}),l&&t.once("moveend",()=>t.setMaxPitch(n))):t.jumpTo({pitch:o}))}export function getTileSource(){const t=s.fp?.maplibre??window.__efpMaplibre;return t?.style?{style:t.style}:t?.styleUrl?{style:t.styleUrl}:DEFAULT_TILE_SOURCE}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
interface GeoAnchorPoint {
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
lat: number;
|
|
5
|
+
lng: number;
|
|
6
|
+
}
|
|
7
|
+
export interface TransformGeoConfig {
|
|
8
|
+
p0: GeoAnchorPoint;
|
|
9
|
+
p1?: GeoAnchorPoint;
|
|
10
|
+
p2: GeoAnchorPoint;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Calculates an affine transformation matrix that maps SVG floorplan
|
|
14
|
+
* coordinates to Mercator coordinates. This matrix is used as the
|
|
15
|
+
* `staticTransform` in the `SceneDef` so the renderer can position
|
|
16
|
+
* the floorplan correctly inside a Maplibre `CustomLayerInterface`.
|
|
17
|
+
*
|
|
18
|
+
* The solver uses 3 anchor points (p0, p1, p2) from the geo config
|
|
19
|
+
* to set up a system of linear equations, then solves via Gaussian
|
|
20
|
+
* elimination with partial pivoting.
|
|
21
|
+
*/
|
|
22
|
+
export declare function calculateTransformMatrix(geoConfig: TransformGeoConfig, units?: string | null): number[];
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=solver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{MercatorCoordinate as A}from"maplibre-gl";const F=1e-12,S=3.28084,b=6371e3;export function calculateTransformMatrix(n,i){const o=n.p1??_(n),s=[n.p0,o,n.p2],r=[],t=[],a=[];for(const h of s){N(h),t.push([h.x,h.y]);const p=A.fromLngLat([h.lng,h.lat],0),d=p.meterInMercatorCoordinateUnits();u(p.x),u(p.y),u(d),r.push(d),a.push([p.x,p.y])}const c=[],e=[];for(let h=0;h<3;h++){const[p,d]=t[h],[L,T]=a[h];c.push([p,d,1,0,0,0]),e.push(L),c.push([0,0,0,p,d,1]),e.push(T)}const l=k(c,e),[f,E,y,w,P,v]=l,R=i?.toLowerCase?.().trim()==="ft"?1/S:1,I=r.reduce((h,p)=>h+p,0)/r.length*R,x=[f,w,0,0,E,P,0,0,0,0,I,0,y,v,0,1];if(!x.every(Number.isFinite))throw new Error("Cannot calculate Maplibre transform: geo anchor points produced a non-finite matrix.");return x}function _(n){const i=n.p2.x-n.p0.x,o=n.p2.y-n.p0.y;if(i===0&&o===0)throw new Error("Cannot calculate Maplibre transform: p0 and p2 have identical SVG coordinates.");const s=n.p0.x-o,r=n.p0.y+i,t=D(n.p0.lat,n.p0.lng,n.p2.lat,n.p2.lng),a=Z(n.p0.lat,n.p0.lng,n.p2.lat,n.p2.lng),[c,e]=j(n.p0.lat,n.p0.lng,t,a+90);return{x:s,y:r,lat:e,lng:c}}function N(n){u(n.x),u(n.y),u(n.lat),u(n.lng)}function u(n){if(!Number.isFinite(n))throw new Error("Cannot calculate Maplibre transform: geo anchor points contain invalid coordinates.")}function M(n){return n*Math.PI/180}function m(n){return n*180/Math.PI}function D(n,i,o,s){const r=M(n),t=M(o),a=M(o-n),c=M(s-i),e=Math.sin(a/2)*Math.sin(a/2)+Math.cos(r)*Math.cos(t)*Math.sin(c/2)*Math.sin(c/2),l=2*Math.atan2(Math.sqrt(e),Math.sqrt(1-e));return b*l}function Z(n,i,o,s){const r=M(n),t=M(o),a=M(s-i),c=Math.sin(a)*Math.cos(t),e=Math.cos(r)*Math.sin(t)-Math.sin(r)*Math.cos(t)*Math.cos(a);return(m(Math.atan2(c,e))+360)%360}function j(n,i,o,s){const r=o/b,t=M(s),a=M(n),c=M(i),e=Math.asin(Math.sin(a)*Math.cos(r)+Math.cos(a)*Math.sin(r)*Math.cos(t)),l=c+Math.atan2(Math.sin(t)*Math.sin(r)*Math.cos(a),Math.cos(r)-Math.sin(a)*Math.sin(e));return[m(l),m(e)]}function k(n,i){const o=n.length,s=n.map((t,a)=>[...t,i[a]]);for(let t=0;t<o;t++){let a=t;for(let c=t+1;c<o;c++)Math.abs(s[c][t])>Math.abs(s[a][t])&&(a=c);if([s[t],s[a]]=[s[a],s[t]],Math.abs(s[t][t])<F)throw new Error("Cannot calculate Maplibre transform: geo anchor points are collinear or invalid.");for(let c=t+1;c<o;c++){const e=s[c][t]/s[t][t];for(let l=t;l<=o;l++)s[c][l]-=e*s[t][l]}}const r=new Array(o);for(let t=o-1;t>=0;t--){r[t]=s[t][o];for(let a=t+1;a<o;a++)r[t]-=s[t][a]*r[a];r[t]/=s[t][t]}return r}
|
package/dist/esm/data/Flags.d.ts
CHANGED
package/dist/esm/data/fpGeo.d.ts
CHANGED
|
@@ -4,8 +4,27 @@ interface ImageData {
|
|
|
4
4
|
data: string;
|
|
5
5
|
points: [][];
|
|
6
6
|
}
|
|
7
|
+
interface GeoAnchorPoint {
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
lat: number;
|
|
11
|
+
lng: number;
|
|
12
|
+
}
|
|
13
|
+
interface FpGeoProperties {
|
|
14
|
+
bearing?: number;
|
|
15
|
+
config?: {
|
|
16
|
+
p0: GeoAnchorPoint;
|
|
17
|
+
p1?: GeoAnchorPoint;
|
|
18
|
+
p2: GeoAnchorPoint;
|
|
19
|
+
bearing?: number;
|
|
20
|
+
snapThreshold?: number;
|
|
21
|
+
};
|
|
22
|
+
mpViewbox?: number[];
|
|
23
|
+
useMaplibre?: boolean;
|
|
24
|
+
[key: string]: unknown;
|
|
25
|
+
}
|
|
7
26
|
interface ExtendFeatureCollection extends FeatureCollection {
|
|
8
|
-
properties:
|
|
27
|
+
properties: FpGeoProperties;
|
|
9
28
|
images: ImageData[];
|
|
10
29
|
}
|
|
11
30
|
export declare const fpGeo: ExtendFeatureCollection;
|
|
@@ -16,6 +16,7 @@ export default class FloorPlanLoader implements FloorPlan {
|
|
|
16
16
|
readonly onInit: (fp: FloorPlan) => void;
|
|
17
17
|
readonly disableRuntimeAlerts: boolean;
|
|
18
18
|
readonly viewerMode: boolean;
|
|
19
|
+
readonly maplibre: FloorPlanOptions["maplibre"];
|
|
19
20
|
protected efpStyleLoadHandler: (e: Event) => void;
|
|
20
21
|
protected resolveReady: () => void;
|
|
21
22
|
readonly icons: Map<FloorPlanIcon, HTMLImageElement>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{PREVIEW_MODE_ATTRIBUTE as T}from"./constants";import
|
|
1
|
+
import{PREVIEW_MODE_ATTRIBUTE as T}from"./constants";import c from"./tools/base-runtime-url";import{buildRebookingUrl as F,getRebookingToken as A,retainRebookingToken as V}from"./tools/rebookingUrl";import{loadCss as I,loadFont as g,loadJs as k}from"./tools/loaders";import U from"./tools/logger";import{sleep as H}from"./utils";import{initI18n as z}from"./utils/i18n";import S from"./utils/is-webview";import{loadCustomCss as G}from"./utils/loadCustomCss";import{loadIcons as N}from"./utils/loadIcons";import Q from"./utils/mergeExhibitors";import E from"./utils/use-shadow";import q from"./utils/is-debug";import W from"./utils/is-localhost";import{initSentry as $}from"./tools/sentry";import{shouldLoadIntercom as J}from"./intercom";function t(){throw new Error("FloorPlan not ready")}export default class K{options;renderTarget;_ready;element;eventId;dataUrl;noOverlay;offHistory;ignoreQuery;allowConsent;onInit;disableRuntimeAlerts;viewerMode;maplibre;efpStyleLoadHandler;resolveReady;icons=new Map;enableRotation=!0;alwaysShowSidebar=!1;get ready(){return this._ready}get previewMode(){return this.options.previewMode||this.element.hasAttribute(T)}onBoothClick;onBookmarkClick;onVisitedClick;onCategoryClick;onFpConfigured;onDirection;onDetails;onExhibitorCustomButtonClick;onGetCoordsClick;onMarkerClick;onLeaveEvent;selectBooth(e){t()}selectExhibitor(e){t()}selectRoute(e,r){t()}getOptimizedRoutes(e){t()}selectCurrentPosition(e,r,h){t()}setBookmarks(e){t()}setEntitiesBookmarks(e){t()}setEntitiesVisited(e){t()}setMarkers(e){t()}updateLayerVisibility(e,r){t()}getCenterCoordinates(){t()}applyParameters(e){t()}exhibitorsList(){t()}boothsList(){t()}categoriesList(){t()}selectCategory(e){t()}getVisibility(){t()}setVisibility(e){t()}findLocation(){t()}zoomIn(){t()}zoomOut(){t()}zoomTo(e,r){t()}switchView(){t()}fitBounds(){t()}getBounds(e){t()}getBoothRect(e){t()}convertToGeo(e,r){t()}unstable_destroy(){t()}highlightExhibitors(e){t()}highlightBooths(e){t()}onCurrentPositionChanged(e){t()}search(e){t()}getFloors(){t()}onFloorActivated(e){t()}activateFloor(e){t()}showPathway(e,r){t()}showPathwayOnly(e,r){t()}hidePathways(){t()}showSearch(){t()}changeLanguage(e){t()}isGpsTrackingEnabled(){t()}setGpsTrackingEnabled(e){t()}deselectCurrentPosition(){t()}deselectRoute(){t()}reset(){t()}selectAccessibleRoute(e){t()}constructor(e){this.options=e,this.noOverlay=!!e.noOverlay,this.offHistory=!!e.offHistory,this.ignoreQuery=e.ignoreQuery,this.allowConsent=W&&!q?!1:e.allowConsent,this.onBoothClick=e.onBoothClick,this.onBookmarkClick=e.onBookmarkClick,this.onVisitedClick=e.onVisitedClick,this.onCategoryClick=e.onCategoryClick,this.onDetails=e.onDetails,this.onExhibitorCustomButtonClick=e.onExhibitorCustomButtonClick,this.onGetCoordsClick=e.onGetCoordsClick,this.onMarkerClick=e.onMarkerClick,this.onFpConfigured=e.onFpConfigured,this.onDirection=e.onDirection,this.onInit=e.onInit,this.onCurrentPositionChanged=e.onCurrentPositionChanged,this.onFloorActivated=e.onFloorActivated,this.onLeaveEvent=e.onLeaveEvent,this.viewerMode=!!e.viewerMode,this.disableRuntimeAlerts=e.disableRuntimeAlerts??!0,this.maplibre=e.maplibre,window.__efpMaplibre=e.maplibre,this._ready=new Promise((l,a)=>{this.resolveReady=l});const r=e.element;if(this.element=r,r.__expofp)throw new Error("Element already in use");if(r.__expofp=this,r.getAttribute("data-event-id")||r.getAttribute("data-event"))throw new Error("data-xxx attributes are removed, use options instead");const h=e.expo||e.event;if(!h)throw new Error("`expo` option is required");$({eventId:h||"",isWebview:S}),this.eventId=h,window.__efpEvent=h,window.__efpElement=r;const m=document.createElement("div");m.style.height="100%",m.style.width="100%",r.appendChild(m);let n;if(S&&(this.allowConsent=!0),e.allowConsent===void 0){const a=new URL(window.location.href).searchParams.get("allowConsent");a&&(this.allowConsent=a==="true")}if(E){n=m.attachShadow({mode:"open"});const l=n,a=document;l.createElement=(...i)=>a.createElement(...i),l.createElementNS=(...i)=>a.createElementNS(...i),l.createTextNode=(...i)=>a.createTextNode(...i)}else n=m;const y=document.createElement("div");if(y.style.height="100%",y.style.width="100%",n.appendChild(y),E&&Object.defineProperty(y,"ownerDocument",{value:n}),window.__efpShadowDOMStyleParent=E?n:void 0,this.renderTarget=y,r.getAttribute("data-data-url"))throw new Error("data-xxx attributes are removed, use options instead");const u=e.legacyDataUrlBase;window.__dataUrlBase=u,this.dataUrl=u,U.log("Instantiating ExpoFP floorplan",e.element,h);const L=u+"data.js",O=u+"wf.data.js",x=u+"fp.svg.js",B=[k(O),k(L),k(x)];let v=0;this.efpStyleLoadHandler=function(l){const a=window.__efpStyleElements;for(;v<a.length;){const i=a[v];n.appendChild(i),v++}},window.addEventListener("__efpStyleLoad",this.efpStyleLoadHandler);const b=this;(async function(){await Promise.all(B);let a=0;for(;window.__fpPending&&!window.__fp;)await H(2e3),await k(x+`?v=${++a}`);const i=window.__data;if(!i){const{showEventNotFound:o}=await import("./tools/event-not-found");o(r);return}const P=J(i);P&&import("./intercom/bootIntercom").then(({bootIntercom:o})=>o(P)).catch(()=>{}),await z();const w=new URLSearchParams(window.location.search);let f,C;if(i?.trackerUrl)try{f=new URL(i.trackerUrl),C=f.searchParams.get("expoId")}catch(o){console.error(o)}const R=async o=>{if(!f||!C)return Promise.reject(new Error("trackerUrl or expoId is missing"));const s=new URL(o.dataUrl,f.origin),d=await fetch(s.toString(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({expoId:C,token:decodeURIComponent(w.get("t"))})});let p=[];d.ok&&(p=(await d.json()).map(o.dataMapper)),window.__heatmapDataYah={yah:p}};if(w.get("heatmap")==="true")try{if(w.get("type")==="yah")w.get("subtype")==="kiosk"?await R({dataUrl:"/api/kiosks/list/viewer",dataMapper:o=>({...o,id:o.key,name:`Kiosk ${o.key}`})}):await R({dataUrl:"/api/v1/you-are-here/qr-code/list/viewer",dataMapper:(o,s)=>({...o,name:`QR Code #${s+1}`})});else{const o=new URL("/api/fp-stats/get",f.origin);o.searchParams.set("expoId",C),o.searchParams.set("type","booview"),o.searchParams.set("t",decodeURIComponent(w.get("t")));const s=new URL("api/fp-stats/get",f.origin);s.searchParams.set("expoId",C),s.searchParams.set("type","exview"),s.searchParams.set("t",decodeURIComponent(w.get("t")));const[d,p]=await Promise.all([fetch(o.toString()),fetch(s.toString())]),[_,M]=await Promise.all([d.json(),p.json()]);window.__heatmapData={booths:_,exhibitors:M}}}catch(o){console.error("Heatmap: Initialization error",o)}try{const o=A();if(o){V(o);const s=F("api/rebooking-data",{rt:o,expoKey:h}),d=await fetch(s);if(d.ok){const p=await d.json();Q(i,p)}i.isRebooking=d.ok}else i.isRebooking=!1}catch(o){console.error(o)}const D=[I(c+"vendor/sanitize-css/sanitize.css",n),I(c+"vendor/perfect-scrollbar/css/perfect-scrollbar.css",n),g("Oswald",c+"fonts/oswald-v17-cyrillic_latin-300.woff",{weight:300}),g("Oswald",c+"fonts/oswald-v17-cyrillic_latin-500.woff",{weight:500}),g("Inter",c+"fonts/inter-400.woff2",{weight:400}),g("Inter",c+"fonts/inter-500.woff2",{weight:500}),g("Inter",c+"fonts/inter-600.woff2",{weight:600}),g("efp-symbols",c+"fonts/efp-symbols.woff",{weight:400}),G(i,n),N(b.icons)];await Promise.all(D),b.enableRotation=i?.enableRotation??!1,b.alwaysShowSidebar=i?.alwaysShowSidebar??!1,U.log("Data loaded");const{default:j}=await import("./floorplan.ready");for(document.querySelectorAll(".expofp-floorplan-loader").forEach(o=>o.remove());r.firstChild&&r.firstChild!==m;)r.removeChild(r.firstChild);Object.setPrototypeOf(b,j.prototype).init()})()}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as g,Fragment as L,jsxs as C}from"react/jsx-runtime";import{reaction as T}from"mobx";import{createRoot as R}from"react-dom/client";import{install as I}from"resize-observer";import V from"./components/Layout";import $ from"./floorplan.loader";import{applyParameters as M,destroyHistory as j,initRouting as z}from"./services/routing";import t from"./store";import{Route as S,findBooth as x,separateExternalIds as E}from"./store/RouteStore";import{destroyUiHandlers as G}from"./store/init/init-ui";import{GaEventActions as P,destroyGtag as _,sendEventToGa as w,setConsentSettings as q}from"./tools/gtag";import N from"./tools/report-error";import{resetGlobalVariables as Y}from"./tools/reset";import H from"./tools/track-event";import{fpGeo as B}from"./data/fpGeo";import{convertLocalToGps as O,isValidPointCoords as d}from"./utils/gps";import m from"./core/Rect";import{mapEntity as y}from"./utils/mapEntity";import{LANG_KEY as X,MAX_ROUTE_WAYPOINTS as p,PATHWAY_KEY as U}from"./constants";import{getStorage as v}from"./utils/entity-storage";import{ErrorBoundary as D}from"@sentry/react";import{POISelectorsSchema as F,BoundsSchema as K,ZoomToOptionsSchema as A}from"./schemas/sdk.schemas";import W from"debug";import{optimizeWaypointOrder as Q}from"./wayfinding/core/routing/optimizeWaypointOrder";import{hasLocale as Z,getLocales as J}from"./utils/i18n";const b=W("efp:api");I();export default class ee extends ${root;init(){this.ignoreQuery||z(this.offHistory),H("load"),t.fp=this,q(this.allowConsent),w(P.Load,""),this.root=R(this.renderTarget),this.root.render(g(D,{children:g(V,{offHistory:this.offHistory,allowConsent:this.allowConsent})})),w(P.Rendered,""),T(()=>t.layerStore.layersLoaded,()=>{this.resolveReady(),t.initialized||this.onInit?.(this),t.initialized=!0})}selectBooth(e){if(typeof e!="string"&&!Array.isArray(e)){a("selectBooth","Parameter must be a string or an array of strings.","EFP000000");return}const i=t.boothStore.booths.filter(o=>typeof e=="string"?o.name===e||o.externalId===e:e.includes(o.name)||e.includes(o.externalId));t.selectBooth(i)}selectExhibitor(e){if(typeof e!="string"&&!Array.isArray(e)){a("selectExhibitor","Parameter must be a string or an array of strings.","EFP000100");return}if(!e?.length){t.uiState.menu=!1,t.searchStore.resetSearchBox(),t.uiState.details=null;return}const i=t.exhibitorStore.exhibitors.filter(s=>typeof e=="string"?s.name===e||s.externalId===e:e.includes(s.name)||e.includes(s.externalId));if(!i?.length)return;if(typeof e=="string"){t.selectExhibitor(i[0]),t.moveToList([i[0]]);return}const o=i.flatMap(s=>s.booths.map(r=>r.layer)),{description:n}=o.reduce((s,r)=>(s.freq[r.description]=(s.freq[r.description]||0)+1,s.freq[r.description]>s.maxCount&&(s.maxCount=s.freq[r.description],s.mostFrequent=r),s),{freq:{},mostFrequent:o[0],maxCount:0}).mostFrequent;t.layerStore.updateVisibility(n,!0),t.uiState.menu=!1,t.searchStore.resetSearchBox(),t.uiState.details=null,t.uiState.list={type:"filter",items:i,query:{key:"exhibitors",value:i.map(s=>s.externalId).join(",")}},t.moveToList()}highlightExhibitors(e){Array.isArray(e)||a("highlightExhibitors","Parameter must be an array of strings.","EFP000200"),t.boothStore.highlightedByExternalIds=[],t.exhibitorStore.highlightedByExternalIds=[...e]}highlightBooths(e){Array.isArray(e)||a("highlightBooths","Parameter must be an array of strings.","EFP000300"),t.exhibitorStore.highlightedByExternalIds=[],t.boothStore.highlightedByExternalIds=[...e]}highlightEntities(e){Array.isArray(e)||a("highlightEntities","Parameter must be an array of strings.","EFP000400");const{boothExternalIds:i,exhibitorExternalIds:o}=E(e);t.boothStore.highlightedByExternalIds=[...i],t.exhibitorStore.highlightedByExternalIds=[...o]}selectRoute(e,i){if(Array.isArray(e)){let o=[...e];const n=o.shift(),s=o.pop();if(o.length>p)throw new Error(`The maximum number of waypoints is ${p}.`);if(!n||!s){a("selectRoute","Invalid route format: When providing an array, it must include at least two points: a start and a destination.","EFP000401");return}t.routeStore.selectRoute(new S(f(n),f(s),o.map(f)));return}e||a("selectRoute","At a minimum, the starting point must be passed.","EFP000402"),t.routeStore.selectRoute(new S(f(e),f(i)))}getOptimizedRoutes(e){if(!Array.isArray(e))return a("getOptimizedRoutes","Parameter must be an array.","EFP000500"),[];if(e.length>p)throw new Error(`The maximum number of waypoints is ${p}.`);const i=e.map(f).filter(n=>!!n);if(!i.length)throw new Error("No booths found for the provided waypoints.");const o=new Map;for(const n of i){const s=n.layer?.name??"",r=o.get(s);r?r.push(n):o.set(s,[n])}return Array.from(o.values()).map(n=>({waypoints:Q(n.map(s=>[s.name,{cx:s.rect.cx,cy:s.rect.cy}]))}))}selectCurrentPosition(e,i,o){const n=d(e.x)&&d(e.y),s=d(e.lng)&&d(e.lat);!n&&!s&&a("selectCurrentPosition","A point must be passed. Either (x,y) or (lat,lng) are required.","EFP000600"),t.routeStore.selectCurrentPosition(e,i,o),this.onCurrentPositionChanged?.(e)}setBookmarks(e){(!Array.isArray(e)||!e.length)&&a("setBookmarks","Parameter must be an array.","EFP000700"),e.forEach(i=>{const o=t.exhibitorStore.exhibitors.find(n=>n.name===i.name||n.externalId===i.externalId);o&&(o.bookmarked=i.bookmarked)})}setEntitiesBookmarks(e){if(!Array.isArray(e)||!e.length){a("setEntitiesBookmarks","Parameter must be an array.","EFP000701");return}const i=["exhibitor","event","speaker","booth"],o=e.find(r=>!r.type||!i.includes(r.type));if(o){a("setEntitiesBookmarks",`Invalid entity type: ${o.type}. Must be one of: ${i.join(", ")}.`,"EFP000702");return}const n=v("bookmarked"),s={exhibitor:{existingIds:new Set(n.exhibitors||[]),finder:r=>t.exhibitorStore.findExhibitor(r),replacer:r=>t.exhibitorStore.replaceBookmarked(r)},event:{existingIds:new Set(n.events||[]),finder:r=>t.eventStore.findByNameOrSlug(r),replacer:r=>t.eventStore.replaceBookmarked(r)},speaker:{existingIds:new Set(n.speakers||[]),finder:r=>t.speakerStore.speakers.find(l=>l.name===r||l.externalId===r||l.slug===r),replacer:r=>t.speakerStore.replaceBookmarked(r)},booth:{existingIds:new Set(n.booths||[]),finder:r=>{const l=t.boothStore.findBooth(r);return l?.exhibitors.length===0?l:void 0},replacer:r=>t.boothStore.replaceBookmarked(r)}};e.forEach(r=>{const l=s[r.type],h=r.name||r.externalId||"",c=l.finder(h);c?r.bookmarked?l.existingIds.add(c.id):l.existingIds.delete(c.id):console.warn(`Entity not found: ${r.type} with query "${h}"`)}),Object.values(s).forEach(r=>{r.replacer(Array.from(r.existingIds))})}setEntitiesVisited(e){if(!Array.isArray(e)||!e.length){a("setEntitiesVisited","Parameter must be an array.","EFP000703");return}const i=["exhibitor","event"],o=e.find(r=>!r.type||!i.includes(r.type));if(o){a("setEntitiesVisited",`Invalid entity type: ${o.type}. Must be one of: ${i.join(", ")}.`,"EFP000704");return}const n=v("visited"),s={exhibitor:{existingIds:new Set(n.exhibitors||[]),finder:r=>t.exhibitorStore.findExhibitor(r),replacer:r=>t.exhibitorStore.replaceVisited(r)},event:{existingIds:new Set(n.events||[]),finder:r=>t.eventStore.findByNameOrSlug(r),replacer:r=>t.eventStore.replaceVisited(r)}};e.forEach(r=>{const l=s[r.type],h=r.name||r.externalId||"",c=l.finder(h);c?r.visited?l.existingIds.add(c.id):l.existingIds.delete(c.id):console.warn(`Entity not found: ${r.type} with query "${h}"`)}),Object.values(s).forEach(r=>{r.replacer(Array.from(r.existingIds))})}setMarkers(e){if(!e||!Array.isArray(e.icons)||!Array.isArray(e.markers)){a("setMarkers","Invalid input.","EFP000800");return}t.routeStore.setMarkers(e)}selectMarker(e,i=!0){return typeof e!="string"&&a("selectMarker","The identifier must be passed.","EFP000900"),t.routeStore.selectMarker(e,i)}drawCircles(e){Array.isArray(e)||a("drawCircles","Invalid input.","EFP000A00"),t.uiState.debugCircles=e}checkRoutes(){t.routeStore.checkRoutes()}updateLayerVisibility(e,i){typeof e!="string"&&a("updateLayerVisibility","The layer name (string) must be passed.","EFP000B00"),i||a("updateLayerVisibility","Passing a false value to visible will have no effect.","EFP000B01"),t.layerStore.updateVisibility(e,i)}getCenterCoordinates(){return t.fp.getCenterCoordinates()}exhibitorsList(){return t.exhibitorStore.exhibitors.map(e=>y(e))}boothsList(){return t.boothStore.booths.map(e=>y(e))}categoriesList(){return t.categoryStore.categories.map(e=>y(e))}selectCategory(e){if(e==null||typeof e!="string"){t.searchStore.selectSearch();return}const i=e?.toLowerCase(),o=t.categoryStore.categories.find(({name:n,slug:s})=>n?.toLowerCase()===i||s?.toLowerCase()===i);if(!o){a("selectCategory",`Category ${e} not found.`,"EFP000C01");return}t.selectCategory(o)}applyParameters(e){typeof e!="string"&&a("applyParameters","A query string must be passed.","EFP000D00"),M(e)}getVisibility(){return t.uiState.visibility}setVisibility(e){(typeof e!="object"||!Object.keys(e).length)&&a("setVisibility","The parameter must be passed.","EFP000E00"),t.uiState.setVisibility(e)}findLocation(){t.routeStore.findLocation()}zoomIn(){t.uiState.zoomIn()}zoomOut(){t.uiState.zoomOut()}switchView(){t.mapboxStore.activateMapbox()}zoomTo(e,i){b("zoomTo called with selectors=%O options=%O",e,i);const o=F.safeParse(e);if(!o.success){a("zoomTo",o.error.message,"EFP001600");return}const n=A.safeParse(i);if(!n.success){a("zoomTo",n.error.message,"EFP001601");return}const s=this.getBounds(e);s&&this.fitBounds(s,i)}getBounds(e){b("getBounds called with selectors=%O",e);const i=F.safeParse(e);if(!i.success){a("getBounds",i.error.message,"EFP001400");return}const o=[];if(e.booths?.forEach(s=>{let r;s.externalId?r=t.boothStore.boothByExternalId.get(s.externalId):s.name&&(r=t.boothStore.boothByName.get(s.name.toLowerCase())),r?.rect&&o.push(r.rect)}),e.exhibitors?.forEach(s=>{let r;s.externalId?r=t.exhibitorStore.exhibitorByExternalId.get(s.externalId):s.name&&(r=t.exhibitorStore.exhibitorByName.get(s.name.toLowerCase())),r?.booths?.forEach(l=>{l.rect&&o.push(l.rect)})}),o.length===0)return;const n=m.fromMultiple(o);return{leftTop:{x:n.x1,y:n.y1},rightBottom:{x:n.x2,y:n.y2}}}fitBounds(e,i){if(b("fitBounds called with bounds=%O options=%O",e,i),!e){t.uiState.fitBounds();return}const o=K.safeParse(e);if(!o.success){a("fitBounds",o.error.message,"EFP001500");return}const n=A.safeParse(i);if(!n.success){a("fitBounds",n.error.message,"EFP001501");return}let s;if(i?.padding){const r=i.padding;s=m.fromX1y1x2y2(e.leftTop.x-r,e.leftTop.y-r,e.rightBottom.x+r,e.rightBottom.y+r)}else s=m.fromX1y1x2y2(e.leftTop.x,e.leftTop.y,e.rightBottom.x,e.rightBottom.y);t.uiState.moveToRect=s}getBoothRect(e){return typeof e!="string"&&a("getBoothRect","A booth name must be passed.","EFP000F00"),x(e)?.rect}convertToGeo(e,i){if(!B?.properties?.config){a("convertToGeo","The coordinates cannot be converted because the GPS configuration is not defined.","EFP001000");return}if(!e||!i){a("convertToGeo","Both coordinates must be passed.","EFP001001");return}return O(e,i,B.properties.config)}unstable_destroy(){let e=window.__efpElement.firstChild;Y(),window.removeEventListener("__efpStyleLoad",this.efpStyleLoadHandler),window.removeEventListener("error",N),j(),G(),_(),[...document.getElementsByTagName("script")].filter(o=>o.src.indexOf("/fp.svg")>-1||o.src.indexOf("/wf.data.js")>-1||o.src.indexOf("/data.js")>-1).forEach(o=>o.remove()),this.root.unmount(),e.remove()}search(e){return typeof e!="string"&&a("search","A search string must be passed.","EFP001100"),t.fuzzySearchEngineStore.loadEngine().then(()=>(t.searchStore.selectSearch(e),t.uiState.fuzzySearchItems.map(i=>({item:y(i.item),score:i.score}))))}getFloors(){return t.layerStore.floors.map(e=>({name:e.name,shortName:e.shortName,description:e.description,active:e.active,disabled:e.disabled,index:e.index}))}activateFloor(e){if(!e?.name&&e?.index==null){a("activateFloor","Invalid floorId. It must contain either a name or an index.","EFP001200");return}const i=this.getFloors();if(e.name){const o=i.find(n=>n.name===e.name||n.shortName===e.name);if(!o){a("activateFloor",`Floor with name "${e.name}" not found.`,"EFP001201");return}if(o.active)return;this.updateLayerVisibility(o.name,!0);return}if(e.index!==null){const o=i.find(s=>s.index===e.index),n=o?.name;if(!n){a("activateFloor",`Floor at index ${e.index} does not exist.`,"EFP001203");return}if(o.active)return;this.updateLayerVisibility(n,!0);return}}showPathway(e,i){const o=new URLSearchParams;if(o.set(U,e),i?.length){const{boothExternalIds:n,exhibitorExternalIds:s}=E(i);n.length>0&&o.set("booths",n.join(",")),s.length>0&&o.set("exhibitors",s.join(","))}this.applyParameters(o.toString())}showPathwayOnly(e,i){this.activateFloor({name:i}),t.layerStore.showPathWay(e),t.uiState.setPathwayOnlyMode(!0);const o=t.layerStore.findLayer(e),n=t.layerStore.findLayer(i),s=o?.rect||o?.viewbox?o:n;if(s?.rect||s?.viewbox){const r=s.viewbox??s.rect;t.uiState.moveToRect=m.fromX1y1x2y2(r.x1,r.y1,r.x2,r.y2)}}hidePathways(){this.highlightBooths([]),t.layerStore.hidePathways(),t.uiState.setPathwayOnlyMode(!1)}showSearch(){t.selectSearch("")}changeLanguage(e){const i=e?.toLowerCase?.();if(!Z(i)){a("changeLanguage",`Language "${e}" was not found. Available languages: ${J().map(n=>n.id).join(",")}`,"EFP001300");return}const o=new URLSearchParams;o.set(X,i),this.applyParameters(o.toString())}isGpsTrackingEnabled(){return t.routeStore.gpsEnabled}setGpsTrackingEnabled(e){t.routeStore.setGpsTrackingEnabled(e)}deselectCurrentPosition(){t.routeStore.selectCurrentPosition(null,!1)}deselectRoute(){t.routeStore.selectRoute(null),t.routeStore.setOnlyAccessible(!1)}reset(){this.selectBooth(""),this.selectExhibitor(""),this.selectCategory(),this.deselectCurrentPosition(),this.deselectRoute(),this.highlightEntities([]),t.uiState.kioskData&&t.resetCameraFn?t.resetCameraFn?.():this.fitBounds()}selectAccessibleRoute(e){t.routeStore.setOnlyAccessible(!0),this.selectRoute(e)}}function f(u){return typeof u=="string"?x(u):t.routeStore.getNearestBooth(u)}let k=0;function a(u,e,i){const o=`Error calling "${u}" SDK method.`,n=`${e.endsWith(".")?e:e+"."} More information at`;let s="https://js-sdk.expofp.com/api/packages";if(i&&(s+=`#error-${i}`),console.error(`${o} ${n} ${s}`),t.fp.disableRuntimeAlerts)return;t.uiState.setGlobalErrorMessage({title:o,body:C(L,{children:[n," ",g("a",{href:s,target:"_blank",rel:"noreferrer",children:s})]})}),clearTimeout(k);const r=8e3;k=window.setTimeout(()=>{const l=async()=>{t.uiState.globalErrorMessages.length>0&&(t.uiState.popGlobalErrorMessage(),await new Promise(h=>setTimeout(h,r/2)),l())};l()},r)}
|
|
1
|
+
import{jsx as g,Fragment as L,jsxs as C}from"react/jsx-runtime";import{reaction as T}from"mobx";import{createRoot as R}from"react-dom/client";import{install as I}from"resize-observer";import V from"./components/Layout";import $ from"./floorplan.loader";import{applyParameters as M,destroyHistory as j,initRouting as z}from"./services/routing";import t from"./store";import{Route as S,findBooth as x,separateExternalIds as E}from"./store/RouteStore";import{destroyUiHandlers as G}from"./store/init/init-ui";import{GaEventActions as P,destroyGtag as _,sendEventToGa as w,setConsentSettings as q}from"./tools/gtag";import N from"./tools/report-error";import{resetGlobalVariables as Y}from"./tools/reset";import H from"./tools/track-event";import{fpGeo as B}from"./data/fpGeo";import{convertLocalToGps as O,isValidPointCoords as d}from"./utils/gps";import m from"./core/Rect";import{mapEntity as y}from"./utils/mapEntity";import{LANG_KEY as X,MAX_ROUTE_WAYPOINTS as p,PATHWAY_KEY as U}from"./constants";import{getStorage as v}from"./utils/entity-storage";import{ErrorBoundary as D}from"@sentry/react";import{POISelectorsSchema as F,BoundsSchema as K,ZoomToOptionsSchema as A}from"./schemas/sdk.schemas";import W from"debug";import{optimizeWaypointOrder as Q}from"./wayfinding/core/routing/optimizeWaypointOrder";import{hasLocale as Z,getLocales as J}from"./utils/i18n";const b=W("efp:api");I();export default class ee extends ${root;init(){this.ignoreQuery||z(this.offHistory),H("load"),t.fp=this,q(this.allowConsent),w(P.Load,""),this.root=R(this.renderTarget),this.root.render(g(D,{children:g(V,{offHistory:this.offHistory,allowConsent:this.allowConsent})})),w(P.Rendered,""),T(()=>t.layerStore.layersLoaded,()=>{this.resolveReady(),t.initialized||this.onInit?.(this),t.initialized=!0})}selectBooth(e){if(typeof e!="string"&&!Array.isArray(e)){a("selectBooth","Parameter must be a string or an array of strings.","EFP000000");return}const i=t.boothStore.booths.filter(o=>typeof e=="string"?o.name===e||o.externalId===e:e.includes(o.name)||e.includes(o.externalId));t.selectBooth(i)}selectExhibitor(e){if(typeof e!="string"&&!Array.isArray(e)){a("selectExhibitor","Parameter must be a string or an array of strings.","EFP000100");return}if(!e?.length){t.uiState.menu=!1,t.searchStore.resetSearchBox(),t.uiState.details=null;return}const i=t.exhibitorStore.exhibitors.filter(s=>typeof e=="string"?s.name===e||s.externalId===e:e.includes(s.name)||e.includes(s.externalId));if(!i?.length)return;if(typeof e=="string"){t.selectExhibitor(i[0]),t.moveToList([i[0]]);return}const o=i.flatMap(s=>s.booths.map(r=>r.layer)),{description:n}=o.reduce((s,r)=>(s.freq[r.description]=(s.freq[r.description]||0)+1,s.freq[r.description]>s.maxCount&&(s.maxCount=s.freq[r.description],s.mostFrequent=r),s),{freq:{},mostFrequent:o[0],maxCount:0}).mostFrequent;t.layerStore.updateVisibility(n,!0),t.uiState.menu=!1,t.searchStore.resetSearchBox(),t.uiState.details=null,t.uiState.list={type:"filter",items:i,query:{key:"exhibitors",value:i.map(s=>s.externalId).join(",")}},t.moveToList()}highlightExhibitors(e){Array.isArray(e)||a("highlightExhibitors","Parameter must be an array of strings.","EFP000200"),t.boothStore.highlightedByExternalIds=[],t.exhibitorStore.highlightedByExternalIds=[...e]}highlightBooths(e){Array.isArray(e)||a("highlightBooths","Parameter must be an array of strings.","EFP000300"),t.exhibitorStore.highlightedByExternalIds=[],t.boothStore.highlightedByExternalIds=[...e]}highlightEntities(e){Array.isArray(e)||a("highlightEntities","Parameter must be an array of strings.","EFP000400");const{boothExternalIds:i,exhibitorExternalIds:o}=E(e);t.boothStore.highlightedByExternalIds=[...i],t.exhibitorStore.highlightedByExternalIds=[...o]}selectRoute(e,i){if(Array.isArray(e)){let o=[...e];const n=o.shift(),s=o.pop();if(o.length>p)throw new Error(`The maximum number of waypoints is ${p}.`);if(!n||!s){a("selectRoute","Invalid route format: When providing an array, it must include at least two points: a start and a destination.","EFP000401");return}t.routeStore.selectRoute(new S(f(n),f(s),o.map(f)));return}e||a("selectRoute","At a minimum, the starting point must be passed.","EFP000402"),t.routeStore.selectRoute(new S(f(e),f(i)))}getOptimizedRoutes(e){if(!Array.isArray(e))return a("getOptimizedRoutes","Parameter must be an array.","EFP000500"),[];if(e.length>p)throw new Error(`The maximum number of waypoints is ${p}.`);const i=e.map(f).filter(n=>!!n);if(!i.length)throw new Error("No booths found for the provided waypoints.");const o=new Map;for(const n of i){const s=n.layer?.name??"",r=o.get(s);r?r.push(n):o.set(s,[n])}return Array.from(o.values()).map(n=>({waypoints:Q(n.map(s=>[s.name,{cx:s.rect.cx,cy:s.rect.cy}]))}))}selectCurrentPosition(e,i,o){const n=d(e.x)&&d(e.y),s=d(e.lng)&&d(e.lat);!n&&!s&&a("selectCurrentPosition","A point must be passed. Either (x,y) or (lat,lng) are required.","EFP000600"),t.routeStore.selectCurrentPosition(e,i,o),this.onCurrentPositionChanged?.(e)}setBookmarks(e){(!Array.isArray(e)||!e.length)&&a("setBookmarks","Parameter must be an array.","EFP000700"),e.forEach(i=>{const o=t.exhibitorStore.exhibitors.find(n=>n.name===i.name||n.externalId===i.externalId);o&&(o.bookmarked=i.bookmarked)})}setEntitiesBookmarks(e){if(!Array.isArray(e)||!e.length){a("setEntitiesBookmarks","Parameter must be an array.","EFP000701");return}const i=["exhibitor","event","speaker","booth"],o=e.find(r=>!r.type||!i.includes(r.type));if(o){a("setEntitiesBookmarks",`Invalid entity type: ${o.type}. Must be one of: ${i.join(", ")}.`,"EFP000702");return}const n=v("bookmarked"),s={exhibitor:{existingIds:new Set(n.exhibitors||[]),finder:r=>t.exhibitorStore.findExhibitor(r),replacer:r=>t.exhibitorStore.replaceBookmarked(r)},event:{existingIds:new Set(n.events||[]),finder:r=>t.eventStore.findByNameOrSlug(r),replacer:r=>t.eventStore.replaceBookmarked(r)},speaker:{existingIds:new Set(n.speakers||[]),finder:r=>t.speakerStore.speakers.find(l=>l.name===r||l.externalId===r||l.slug===r),replacer:r=>t.speakerStore.replaceBookmarked(r)},booth:{existingIds:new Set(n.booths||[]),finder:r=>{const l=t.boothStore.findBooth(r);return l?.exhibitors.length===0?l:void 0},replacer:r=>t.boothStore.replaceBookmarked(r)}};e.forEach(r=>{const l=s[r.type],h=r.name||r.externalId||"",c=l.finder(h);c?r.bookmarked?l.existingIds.add(c.id):l.existingIds.delete(c.id):console.warn(`Entity not found: ${r.type} with query "${h}"`)}),Object.values(s).forEach(r=>{r.replacer(Array.from(r.existingIds))})}setEntitiesVisited(e){if(!Array.isArray(e)||!e.length){a("setEntitiesVisited","Parameter must be an array.","EFP000703");return}const i=["exhibitor","event"],o=e.find(r=>!r.type||!i.includes(r.type));if(o){a("setEntitiesVisited",`Invalid entity type: ${o.type}. Must be one of: ${i.join(", ")}.`,"EFP000704");return}const n=v("visited"),s={exhibitor:{existingIds:new Set(n.exhibitors||[]),finder:r=>t.exhibitorStore.findExhibitor(r),replacer:r=>t.exhibitorStore.replaceVisited(r)},event:{existingIds:new Set(n.events||[]),finder:r=>t.eventStore.findByNameOrSlug(r),replacer:r=>t.eventStore.replaceVisited(r)}};e.forEach(r=>{const l=s[r.type],h=r.name||r.externalId||"",c=l.finder(h);c?r.visited?l.existingIds.add(c.id):l.existingIds.delete(c.id):console.warn(`Entity not found: ${r.type} with query "${h}"`)}),Object.values(s).forEach(r=>{r.replacer(Array.from(r.existingIds))})}setMarkers(e){if(!e||!Array.isArray(e.icons)||!Array.isArray(e.markers)){a("setMarkers","Invalid input.","EFP000800");return}t.routeStore.setMarkers(e)}selectMarker(e,i=!0){return typeof e!="string"&&a("selectMarker","The identifier must be passed.","EFP000900"),t.routeStore.selectMarker(e,i)}drawCircles(e){Array.isArray(e)||a("drawCircles","Invalid input.","EFP000A00"),t.uiState.debugCircles=e}checkRoutes(){t.routeStore.checkRoutes()}updateLayerVisibility(e,i){typeof e!="string"&&a("updateLayerVisibility","The layer name (string) must be passed.","EFP000B00"),i||a("updateLayerVisibility","Passing a false value to visible will have no effect.","EFP000B01"),t.layerStore.updateVisibility(e,i)}getCenterCoordinates(){return t.fp.getCenterCoordinates()}exhibitorsList(){return t.exhibitorStore.exhibitors.map(e=>y(e))}boothsList(){return t.boothStore.booths.map(e=>y(e))}categoriesList(){return t.categoryStore.categories.map(e=>y(e))}selectCategory(e){if(e==null||typeof e!="string"){t.searchStore.selectSearch();return}const i=e?.toLowerCase(),o=t.categoryStore.categories.find(({name:n,slug:s})=>n?.toLowerCase()===i||s?.toLowerCase()===i);if(!o){a("selectCategory",`Category ${e} not found.`,"EFP000C01");return}t.selectCategory(o)}applyParameters(e){typeof e!="string"&&a("applyParameters","A query string must be passed.","EFP000D00"),M(e)}getVisibility(){return t.uiState.visibility}setVisibility(e){(typeof e!="object"||!Object.keys(e).length)&&a("setVisibility","The parameter must be passed.","EFP000E00"),t.uiState.setVisibility(e)}findLocation(){t.routeStore.findLocation()}zoomIn(){t.uiState.zoomIn()}zoomOut(){t.uiState.zoomOut()}switchView(){t.maplibreStore.activateMaplibre()}zoomTo(e,i){b("zoomTo called with selectors=%O options=%O",e,i);const o=F.safeParse(e);if(!o.success){a("zoomTo",o.error.message,"EFP001600");return}const n=A.safeParse(i);if(!n.success){a("zoomTo",n.error.message,"EFP001601");return}const s=this.getBounds(e);s&&this.fitBounds(s,i)}getBounds(e){b("getBounds called with selectors=%O",e);const i=F.safeParse(e);if(!i.success){a("getBounds",i.error.message,"EFP001400");return}const o=[];if(e.booths?.forEach(s=>{let r;s.externalId?r=t.boothStore.boothByExternalId.get(s.externalId):s.name&&(r=t.boothStore.boothByName.get(s.name.toLowerCase())),r?.rect&&o.push(r.rect)}),e.exhibitors?.forEach(s=>{let r;s.externalId?r=t.exhibitorStore.exhibitorByExternalId.get(s.externalId):s.name&&(r=t.exhibitorStore.exhibitorByName.get(s.name.toLowerCase())),r?.booths?.forEach(l=>{l.rect&&o.push(l.rect)})}),o.length===0)return;const n=m.fromMultiple(o);return{leftTop:{x:n.x1,y:n.y1},rightBottom:{x:n.x2,y:n.y2}}}fitBounds(e,i){if(b("fitBounds called with bounds=%O options=%O",e,i),!e){t.uiState.fitBounds();return}const o=K.safeParse(e);if(!o.success){a("fitBounds",o.error.message,"EFP001500");return}const n=A.safeParse(i);if(!n.success){a("fitBounds",n.error.message,"EFP001501");return}let s;if(i?.padding){const r=i.padding;s=m.fromX1y1x2y2(e.leftTop.x-r,e.leftTop.y-r,e.rightBottom.x+r,e.rightBottom.y+r)}else s=m.fromX1y1x2y2(e.leftTop.x,e.leftTop.y,e.rightBottom.x,e.rightBottom.y);t.uiState.moveToRect=s}getBoothRect(e){return typeof e!="string"&&a("getBoothRect","A booth name must be passed.","EFP000F00"),x(e)?.rect}convertToGeo(e,i){if(!B?.properties?.config){a("convertToGeo","The coordinates cannot be converted because the GPS configuration is not defined.","EFP001000");return}if(!e||!i){a("convertToGeo","Both coordinates must be passed.","EFP001001");return}return O(e,i,B.properties.config)}unstable_destroy(){let e=window.__efpElement.firstChild;Y(),window.removeEventListener("__efpStyleLoad",this.efpStyleLoadHandler),window.removeEventListener("error",N),t.maplibreStore.dispose(),j(),G(),_(),[...document.getElementsByTagName("script")].filter(o=>o.src.indexOf("/fp.svg")>-1||o.src.indexOf("/wf.data.js")>-1||o.src.indexOf("/data.js")>-1).forEach(o=>o.remove()),this.root.unmount(),e.remove()}search(e){return typeof e!="string"&&a("search","A search string must be passed.","EFP001100"),t.fuzzySearchEngineStore.loadEngine().then(()=>(t.searchStore.selectSearch(e),t.uiState.fuzzySearchItems.map(i=>({item:y(i.item),score:i.score}))))}getFloors(){return t.layerStore.floors.map(e=>({name:e.name,shortName:e.shortName,description:e.description,active:e.active,disabled:e.disabled,index:e.index}))}activateFloor(e){if(!e?.name&&e?.index==null){a("activateFloor","Invalid floorId. It must contain either a name or an index.","EFP001200");return}const i=this.getFloors();if(e.name){const o=i.find(n=>n.name===e.name||n.shortName===e.name);if(!o){a("activateFloor",`Floor with name "${e.name}" not found.`,"EFP001201");return}if(o.active)return;this.updateLayerVisibility(o.name,!0);return}if(e.index!==null){const o=i.find(s=>s.index===e.index),n=o?.name;if(!n){a("activateFloor",`Floor at index ${e.index} does not exist.`,"EFP001203");return}if(o.active)return;this.updateLayerVisibility(n,!0);return}}showPathway(e,i){const o=new URLSearchParams;if(o.set(U,e),i?.length){const{boothExternalIds:n,exhibitorExternalIds:s}=E(i);n.length>0&&o.set("booths",n.join(",")),s.length>0&&o.set("exhibitors",s.join(","))}this.applyParameters(o.toString())}showPathwayOnly(e,i){this.activateFloor({name:i}),t.layerStore.showPathWay(e),t.uiState.setPathwayOnlyMode(!0);const o=t.layerStore.findLayer(e),n=t.layerStore.findLayer(i),s=o?.rect||o?.viewbox?o:n;if(s?.rect||s?.viewbox){const r=s.viewbox??s.rect;t.uiState.moveToRect=m.fromX1y1x2y2(r.x1,r.y1,r.x2,r.y2)}}hidePathways(){this.highlightBooths([]),t.layerStore.hidePathways(),t.uiState.setPathwayOnlyMode(!1)}showSearch(){t.selectSearch("")}changeLanguage(e){const i=e?.toLowerCase?.();if(!Z(i)){a("changeLanguage",`Language "${e}" was not found. Available languages: ${J().map(n=>n.id).join(",")}`,"EFP001300");return}const o=new URLSearchParams;o.set(X,i),this.applyParameters(o.toString())}isGpsTrackingEnabled(){return t.routeStore.gpsEnabled}setGpsTrackingEnabled(e){t.routeStore.setGpsTrackingEnabled(e)}deselectCurrentPosition(){t.routeStore.selectCurrentPosition(null,!1)}deselectRoute(){t.routeStore.selectRoute(null),t.routeStore.setOnlyAccessible(!1)}reset(){this.selectBooth(""),this.selectExhibitor(""),this.selectCategory(),this.deselectCurrentPosition(),this.deselectRoute(),this.highlightEntities([]),t.uiState.kioskData&&t.resetCameraFn?t.resetCameraFn?.():this.fitBounds()}selectAccessibleRoute(e){t.routeStore.setOnlyAccessible(!0),this.selectRoute(e)}}function f(u){return typeof u=="string"?x(u):t.routeStore.getNearestBooth(u)}let k=0;function a(u,e,i){const o=`Error calling "${u}" SDK method.`,n=`${e.endsWith(".")?e:e+"."} More information at`;let s="https://js-sdk.expofp.com/api/packages";if(i&&(s+=`#error-${i}`),console.error(`${o} ${n} ${s}`),t.fp.disableRuntimeAlerts)return;t.uiState.setGlobalErrorMessage({title:o,body:C(L,{children:[n," ",g("a",{href:s,target:"_blank",rel:"noreferrer",children:s})]})}),clearTimeout(k);const r=8e3;k=window.setTimeout(()=>{const l=async()=>{t.uiState.globalErrorMessages.length>0&&(t.uiState.popGlobalErrorMessage(),await new Promise(h=>setTimeout(h,r/2)),l())};l()},r)}
|
|
@@ -5,6 +5,9 @@ export declare class RendererService {
|
|
|
5
5
|
private _renderer;
|
|
6
6
|
private _scene;
|
|
7
7
|
private _fontUrls;
|
|
8
|
+
private requestRepaint;
|
|
9
|
+
private currentPtScale;
|
|
10
|
+
private rendererEventsCleanup;
|
|
8
11
|
readonly ptScaleRegistry: HandlerRegistry<PtScaleHandler>;
|
|
9
12
|
readonly rollRegistry: HandlerRegistry<RollHandler>;
|
|
10
13
|
readonly layerImagesRegistry: HandlerRegistry<LayerImagesHandler>;
|
|
@@ -16,7 +19,9 @@ export declare class RendererService {
|
|
|
16
19
|
get angle(): number;
|
|
17
20
|
create(options: RendererOptions): Renderer;
|
|
18
21
|
start(scene: SceneDef): void;
|
|
22
|
+
attach(renderer: Renderer, scene: SceneDef, requestRepaint?: () => void): void;
|
|
19
23
|
dispose(): void;
|
|
24
|
+
disposeIfCurrent(renderer: Renderer | null): void;
|
|
20
25
|
onPtScale(name: string, handler: PtScaleHandler): Disposer;
|
|
21
26
|
onRoll(name: string, handler: RollHandler): Disposer;
|
|
22
27
|
onLayerImages(name: string, handler: LayerImagesHandler): Disposer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Renderer as
|
|
1
|
+
import{Renderer as h}from"@expofp/renderer";import{HandlerRegistry as a}from"./HandlerRegistry";import{loadCustomFontsUrls as o}from"./index";import d from"../tools/logger";import{isDefaultScene as c}from"./engine-core/defs";export class RendererService{_renderer=null;_scene=null;_fontUrls=[];requestRepaint=null;currentPtScale=null;rendererEventsCleanup=null;ptScaleRegistry=new a;rollRegistry=new a;layerImagesRegistry=new a;get renderer(){return this._renderer?.isInitialized?this._renderer:null}get scene(){return this._scene}get fontUrls(){return this._fontUrls}getCameraState(){if(!this._renderer?.isInitialized){d.warn("Renderer is not initialized. Cannot get camera state.");return}return this._renderer.controls.getCameraState()}get scale(){return this.currentPtScale!==null?this.currentPtScale:this._renderer?.isInitialized?this._renderer.controls.getCameraState()?.ptScale??1:1}get angle(){return this._renderer?.isInitialized?this._renderer.controls.getCameraState()?.roll??0:0}create(e){return this._renderer=new h(e),this._fontUrls=o(),this.setupEventListeners(),this._renderer}start(e){if(this._scene=e,this.requestRepaint=null,!this._renderer)throw new Error("RendererService: renderer is not created.");this._renderer.init(e),this._renderer.start()}attach(e,r,s){this._renderer=e,this._scene=r,this._fontUrls=o(),this.requestRepaint=s??null,this.setupEventListeners()}dispose(){this.rendererEventsCleanup?.(),this.rendererEventsCleanup=null,this.ptScaleRegistry.clear(),this.rollRegistry.clear(),this.layerImagesRegistry.clear(),this._renderer?.dispose(),this._renderer=null,this._scene=null,this._fontUrls=[],this.requestRepaint=null,this.currentPtScale=null}disposeIfCurrent(e){if(!e||this._renderer!==e){e?.dispose();return}this.dispose()}onPtScale(e,r){return this.ptScaleRegistry.register(e,r)}onRoll(e,r){return this.rollRegistry.register(e,r)}onLayerImages(e,r){return this.layerImagesRegistry.register(e,r)}update(...e){if(this._renderer){if(!this._renderer.isInitialized){d.warn("Renderer is not initialized. Cannot update.");return}this._renderer.update(...e),this.requestRepaint?.()}}setupEventListeners(){this.rendererEventsCleanup?.(),this.rendererEventsCleanup=null;const e=this._renderer;if(!e)return;const r=l=>{const{ptScale:t,sceneId:n}=p(l);if(!c(n)||!Number.isFinite(t))return;this.currentPtScale=t;const u=[...this.ptScaleRegistry.invoke(t)];u.length&&this.update(...u)},s=l=>{if(!Number.isFinite(l))return;const t=[];for(const n of this.rollRegistry.invoke(l))Array.isArray(n)?t.push(...n):t.push(n);t.length&&this.update(...t)};e.events.addEventListener("viewport:ptscale",r),e.events.addEventListener("navigation:roll",s),this.rendererEventsCleanup=()=>{e.events.removeEventListener("viewport:ptscale",r),e.events.removeEventListener("navigation:roll",s)}}}function p(i){return typeof i=="number"?{ptScale:i}:i}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createBrowserHistory as te}from"history";import{autorun as O,reaction as k}from"mobx";import{handleCustomCommand as oe}from"../utils/customCommands";import{BUILD_ROUTE_KEY as se,KIOSK_ENABLE_KEY as A,MAP_SETTINGS_KEY as re,PREVIEW_MODE_QUERY as E,PREVIEW_MODE_STORAGE_KEY as F,SEPARATOR as R,PATHWAY_KEY as N,PLANNER_KEY as P,PLANNER_SOURCE_KEY as W,PLANNER_FROM_KEY as $,LANG_KEY as K,UI_SCALE_PARAM_KEY as Y,UI_SCALE_RESET_PARAM_KEY as V,VIEWER_MODE_QUERY as I,VIEWER_MODE_STORAGE_KEY as H,LANGUAGE_TYPE as x}from"../constants";import v from"../data";import s,{uiState as i}from"../store";import{CurrentPosition as ae,extractRoute as ie,findBooth as ne}from"../store/RouteStore";import{setConsentSettings as G}from"../tools/gtag";import U from"../tools/logger";import{isLocalStorageAvailable as L}from"../utils/localStorage";import{areLayersEnabled as le}from"../utils/areLayersEnabled";import ce from"../core/Rect";import{getMostFrequent as ue}from"../utils/getMostFrequent";import{runInAction as D}from"mobx";import{recoverKioskFromUrlPrams as he}from"../components/Kiosk/recoverKioskFromUrlPrams";import{hasLocale as fe,setLocale as de}from"../utils/i18n";let m=!1,C=!1,z=null,j=null,q=null,Q;const h=te(),_=window.location.pathname,S=[];export function getLocationHistory(){return S}function b(t){return _+t}function me(t){m||h.push(b(t))}export function historyReplace(t){m||h.push(b(t))}function f(t){return t.replace(/=&/g,"&").replace(/=$/,"")}function J(){let t="";const n=i.selectedExhibitor,a=i.selectedBooth,e=i.selectedEventItem,o=i.selectedRoute,r=i.selectedSpeaker,l=i.setKioskModeEnabled;if(i.list.type==="route-planner"&&!n&&!a&&!e){const d=s.routePlannerStore;if(d.source==="bookmarks")t=`${P}&${W}=bookmarks`;else{const w=d.items.map(g=>g.entity.slug).filter(Boolean).join(R);t=`${P}=${w}`}const p=d.startPoint?.slug;p&&(t+=`&${$}=${p}`)}else if(o&&!i.isMultiPointRoute){const d=o.from?`:${o.from.slug}`:"",p=o.to?`:${o.to.slug}`:"",w=s.routeStore.onlyAccessible?":true":":false",g=o.waypoints?.map(u=>`:${u.slug}`).join("");t=`route${p}${d}${w}${g||""}`}else if(n)t=n.slug;else if(a)t=a.slug;else if(e)t=e.slug;else if(r)t=r.slug;else if(l)t="";else switch(i.list.type){case"bookmarks":t="bookmarks";break;case"visited":t="visited";break;case"category":t=i.selectedCategory.slug;break;case"search":t=i.list.text||"";break;case x:t=x;break;case"filter":t=`${i.list.query.key}=${i.list.query.value}`;break;case"sessions":t="sessions";break;case"exhibitors":t="exhibitors";break;case"speakers":t="speakers";break;case"tours":t="tours";break;case"multi-point-tour":t=`tour=${i.list.tourId}`;break;default:throw new Error("Unkown list.type")}if(C)return;const c=t?"?"+encodeURIComponent(t):"";h.location.search!==c&&(n!==z||a!==j||e!==q?me(c):historyReplace(c),z=n,j=a,q=e)}function X(){const t=i.selectedExhibitor,n=i.selectedEventItem,a=i.selectedSpeaker;let e="";t?e=t.name:n?e=n.name:a?e=a.name:i.list.type==="search"&&i.list.text?e="`"+(i.list.text||"")+"`":i.list.type==="multi-point-tour"&&i.tourTitle&&(e=i.tourTitle),e.length&&(e+=" \u2013 "),e+=v.title,v.subtitle&&(e+=" \u2013 "+v.subtitle),e+=" \u2013 Expo Floor Plan by ExpoFP",document.title=e}function B(){const t=h.location.search.length>1?decodeURIComponent(h.location.search.substring(1)):"";return oe(t)}function y(){const t=h.location.search.length>1?decodeURIComponent(h.location.search.substring(1)):"";C=!0;const n=s.boothStore.booths.find(e=>e.slug?.toLowerCase()===t?.toLowerCase()||e.externalId?.toLowerCase()===t?.toLowerCase()||e.externalId?.toLowerCase()?.replace(/\s+/g,"")===t?.toLowerCase()),a=new URLSearchParams(decodeURIComponent(window.location.search));if(he(a),pe(a),!B())if(a.has(A)){const e=a.get(A);e==="1"?i.kiosk=!0:e==="0"&&(i.kiosk=!1,i.resetUIScale())}else if(t==="tours")s.selectTours();else if(t.startsWith("tour=")){const e=t.split("=")[1],o=s.toursStore.getTourById(e);o?s.toursStore.launchTour(o,o.name,o.description):(console.warn(`Route with id "${e}" not found`),s.selectTours())}else if(a.has(P)){const e=a.get(W),o=a.get($),r=o?ne(o):null;if(e==="bookmarks")s.routePlannerStore.launchFromBookmarks(r??void 0);else{const l=(a.get(P)||"").split(R).filter(Boolean);s.routePlannerStore.launchFromSlugs(l,r??void 0)}}else if(t.startsWith("route")){const e=t.split(R);s.routeStore.setOnlyAccessible(e[3]==="true");const o=ie(e[2],e[1],e.slice(4));s.routeStore.selectRoute(o);const l=e.slice(4).length>0;s.uiState.setIsMultiPointRoute(l);const d=new URLSearchParams(window.location.search).get("title");d&&s.uiState.setRouteTitle(d)}else if(t==="bookmarks")s.selectBookmarks();else if(t==="visited")s.selectVisited();else if(t===x)s.selectLanguage();else if(a.has(K)){const e=a.get(K)?.toLowerCase();fe(e)&&de(e)}else if(t==="sessions")s.selectSessions();else if(t==="exhibitors")s.selectExhibitors();else if(t==="speakers")s.selectSpeakers();else if(t==="-pdf")s.uiState.printingPdf=!0;else if(t.startsWith("hide"))s.uiState.setVisibility(new URLSearchParams(t).get("hide").split(",").filter(Boolean).reduce((e,o)=>({...e,[o]:!1}),{}));else if(n)setTimeout(()=>s.selectBooth(n),250);else if(t===se)s.uiState.startBuildRoute();else if(a.get(N)){const e=a.get(N),o=a.get("booths")?.split(",")||[],r=a.get("exhibitors")?.split(",")||[],l=a.get("tour");if(l){const u=s.toursStore.getTourById(l);u&&D(()=>{s.uiState.setTourTitle(u.name),s.uiState.setTourDescription(u.description),s.uiState.setIsMultiPointTour(!0),s.uiState.setMultiPointTourList(u.id)})}const c=s.boothStore.booths,d=s.exhibitorStore.exhibitors,p=c.filter(u=>o.includes(u.externalId)),w=d.filter(u=>r.includes(u.externalId)).flatMap(u=>u.booths),g=[...p,...w];if(le()){const u=g.map(ee=>ee.layer.name),M=ue(u);M&&s.fp.activateFloor({name:M})}(o.length>0||r.length>0)&&s.fp.highlightEntities([...o,...r]),s.layerStore.showPathWay(e),g.length>0&&D(()=>{s.uiState.moveToRect=ce.fromMultiple(g.map(u=>u.rect).filter(Boolean)),s.uiState.rollReset=!0})}else{const e=s.eventStore.eventItems.find(o=>o.slug?.toLowerCase()===t?.toLowerCase()||o.externalId?.toLowerCase()===t?.toLowerCase());if(e)s.selectEventItem(e,!0);else{const o=s.exhibitorStore.exhibitors.find(r=>r.slug?.toLowerCase()===t?.toLowerCase()||r.externalId?.toLowerCase()===t?.toLowerCase());if(t.startsWith("exhibitors")){const r=t.split("=")[1].split(",");setTimeout(()=>s.fp.selectExhibitor(r),250)}else if(o)setTimeout(()=>s.clickExhibitor(o),250);else if(t.includes("=")&&(t.startsWith("categories=")||t.startsWith("poiType=")))U.log("Skipping filter parameter in dispatchFromUrl:",t);else{const l=s.categoryStore.categories.find(c=>c.slug===t);if(l)s.selectCategory(l);else{const c=s.speakerStore.findBySlug(t);c?s.selectSpeaker(c,!0):t.includes("heatmap=true")||s.searchStore.selectSearch(t)}}}}C=!1,J(),X()}function T(){const t=h.location.search;if(t.includes("heatmap")){const e=new URL(window.location.href);if(e.searchParams.get("heatmap")==="true")if(e.searchParams.get("type")==="yah"){let r=f(e.search);m=!0,historyReplace(r),s.uiState.heatmapYah=!0,s.uiState.monochrome=!0,s.uiState.hideLogoInBooth=!0,s.uiState.hideHeaderLogo=!0,s.uiState.disableBookmarked=!0}else{e.searchParams.delete("heatmap");let r=f(e.search);m=!0,historyReplace(r),s.uiState.heatmap=!0}}if(t.startsWith("?preview="))historyReplace("?");else if(t.startsWith("?b="))historyReplace("?bookmarks");else if(t.startsWith("?ba=")){const e=new URL(window.location.href),o=parseInt(e.searchParams.get("ba")),r=s.exhibitorStore.exhibitorById.get(o);historyReplace(r?"?"+r.slug:"?bookmarks")}else t.startsWith("?mapbox=false")&&(s.mapboxStore.isMapbox=!1,historyReplace("?"));if(t.includes("blue-dot")){const e=new URL(window.location.href),o=e.searchParams.get("blue-dot").split(",");if(e.searchParams.delete("blue-dot"),o.length>1){const l=s.layerStore.findLayer(o[2])?.name,c=new ae(Number(o[0])||void 0,Number(o[1])||void 0,l,void 0,Number(o[3])||void 0,Number(o[4])||void 0);s.layerStore.layersLoaded?s.routeStore.selectCurrentPosition(c,!0,1):k(()=>s.layerStore.layersLoaded,()=>{s.routeStore.selectCurrentPosition(c,!0,1)})}let r=f(e.search);historyReplace(r)}if(t.includes("copy_exh")){const e=new URL(window.location.href),o=e.searchParams.get("copy_exh");e.searchParams.delete("copy_exh"),historyReplace("?")}if(t.includes("noOverlay")){const e=new URL(window.location.href),o=e.searchParams.get("noOverlay");e.searchParams.delete("noOverlay");let r=f(e.search);o==="true"?s.uiState.hideOverlay=!0:o==="false"&&(s.uiState.hideOverlay=!1),historyReplace(r)}if(t.includes("allowConsent")){const e=new URL(window.location.href),o=e.searchParams.get("allowConsent");e.searchParams.delete("allowConsent");const r=f(e.search);o==="true"?G(!0):o==="false"&&G(!1),historyReplace(r)}if(t.includes("hideHeaderLogo")){const e=new URL(window.location.href),o=e.searchParams.get("hideHeaderLogo");e.searchParams.delete("hideHeaderLogo");const r=f(e.search);o==="true"&&(i.hideHeaderLogo=!0),historyReplace(r)}if(t.includes("hideLogoInBooth")){const e=new URL(window.location.href),o=e.searchParams.get("hideLogoInBooth");e.searchParams.delete("hideLogoInBooth");const r=f(e.search);o==="true"&&(i.hideLogoInBooth=!0),historyReplace(r)}if(t.includes("disableFeatured")){const e=new URL(window.location.href),o=e.searchParams.get("disableFeatured");e.searchParams.delete("disableFeatured");const r=f(e.search);o==="true"&&s.exhibitorStore.exhibitors.forEach(l=>l.featured=!1),historyReplace(r)}if(t.includes("disableBookmarked")){const e=new URL(window.location.href),o=e.searchParams.get("disableBookmarked");e.searchParams.delete("disableBookmarked");const r=f(e.search);o==="true"&&(i.disableBookmarked=!0),historyReplace(r)}if(t.includes("disableGps")){const e=new URL(window.location.href),o=e.searchParams.get("disableGps");e.searchParams.delete("disableGps");const r=f(e.search);o==="true"&&s.routeStore.setGpsTrackingEnabled(!1),historyReplace(r)}if(t.includes("monochrome")){const e=new URL(window.location.href),o=e.searchParams.get("monochrome");e.searchParams.delete("monochrome");const r=f(e.search);o==="true"&&(i.monochrome=!0),historyReplace(r)}if((t.startsWith("?fbclid")||t.startsWith("?_ga"))&&historyReplace("?"),t.includes(I)){const e=new URL(window.location.href),o=e.searchParams.get(I);o==="1"||o==="true"?L&&localStorage.setItem(H,"1"):(o==="0"||o==="false")&&L&&localStorage.removeItem(H),e.searchParams.delete(I),historyReplace(f(e.search))}if(t.includes(E)){const e=new URL(window.location.href),o=e.searchParams.get(E);o==="true"?L&&localStorage.setItem(F,"1"):o==="false"&&L&&localStorage.removeItem(F),e.searchParams.delete(E),historyReplace(f(e.search))}if(i.previewExhibitor&&historyReplace("?"+i.previewExhibitor.slug),h.location.search.includes("&")||h.location.search.includes("%26")){let e=h.location.search;e=e.startsWith("?")?e.slice(1):e;const o=e.includes("&")?"&":"%26",l=e.split(o).map(c=>{const d=s.exhibitorStore.exhibitors.find(p=>p.slug===c||p.externalId===c);return d?d.name:c}).join("&");historyReplace("?"+l)}const n=new URLSearchParams(window.location.search);if(n.has(V)){s.uiState.resetUIScale();const e=new URL(window.location.href);e.searchParams.delete(V);let o=f(e.search);m=!0,historyReplace(o),m=!1}const a=n.get(Y);if(a){const e=a.replace(",","."),o=parseFloat(e);!isNaN(o)&&o>=.8&&o<=1.4?s.uiState.setUIScale(o,!0):U.warn(`Invalid ui-scale parameter: ${a}. Must be a number between 0.8 and 1.4.`);const r=new URL(window.location.href);r.searchParams.delete(Y);let l=f(r.search);m=!0,historyReplace(l),m=!1}}export function initRouting(t=!1){m=t,!m&&b(h.location.search)===_&&S.push(b(h.location.search)),Q=h.listen((n,a)=>{m||(S.push(b(n.search)),U.log("history",a,n),a==="POP"&&y())}),T(),B(),k(()=>s.layerStore.layersLoaded,()=>{s.urlFilterManager&&!s.urlFilterManager.isInitialized&&s.urlFilterManager.initialize(),y(),O(X),O(J),i.viewerMode&&(i.menu=!0)})}export function applyParameters(t=""){historyReplace("?"+decodeURIComponent(t.toString())),s.layerStore.layersLoaded?(T(),y()):(B(),k(()=>s.layerStore.layersLoaded,()=>{T(),y()}))}export function destroyHistory(){Q()}export function goBack(){if(console.log("goBack"),S.length>1){S.pop();const n=S[S.length-1].replace(_,"");return m=!0,h.replace(n),m=!1,y(),!0}else return h.go(-1),!1}function pe(t){try{let n={};const a=i.defaultMapSettings;if(new Set(t.keys()).size)n=Z(Object.fromEntries(t.entries()),a);else{const e=sessionStorage.getItem(re);e&&(n=Z(JSON.parse(e),a))}if(i.setMapSettings(n),n.z){const e=s.layerStore.layers.find(o=>o.name===n.z);e&&s.layerStore.updateVisibility(e,!0)}}catch(n){console.error("Failed to process or save map settings.",n)}}function Z(t,n){const a={};for(const e in t){if(!Object.prototype.hasOwnProperty.call(n,e)||!Object.prototype.hasOwnProperty.call(t,e))continue;const o=t[e];typeof n[e]=="number"&&typeof o=="string"?a[e]=parseFloat(o):a[e]=o}return a}
|
|
1
|
+
import{createBrowserHistory as te}from"history";import{autorun as O,reaction as k}from"mobx";import{handleCustomCommand as oe}from"../utils/customCommands";import{BUILD_ROUTE_KEY as se,KIOSK_ENABLE_KEY as A,MAP_SETTINGS_KEY as re,PREVIEW_MODE_QUERY as E,PREVIEW_MODE_STORAGE_KEY as F,SEPARATOR as R,PATHWAY_KEY as N,PLANNER_KEY as P,PLANNER_SOURCE_KEY as $,PLANNER_FROM_KEY as W,LANG_KEY as K,UI_SCALE_PARAM_KEY as Y,UI_SCALE_RESET_PARAM_KEY as V,VIEWER_MODE_QUERY as I,VIEWER_MODE_STORAGE_KEY as H,LANGUAGE_TYPE as x}from"../constants";import v from"../data";import s,{uiState as i}from"../store";import{CurrentPosition as ae,extractRoute as ie,findBooth as ne}from"../store/RouteStore";import{setConsentSettings as G}from"../tools/gtag";import U from"../tools/logger";import{isLocalStorageAvailable as L}from"../utils/localStorage";import{areLayersEnabled as le}from"../utils/areLayersEnabled";import ce from"../core/Rect";import{getMostFrequent as ue}from"../utils/getMostFrequent";import{runInAction as D}from"mobx";import{recoverKioskFromUrlPrams as he}from"../components/Kiosk/recoverKioskFromUrlPrams";import{hasLocale as fe,setLocale as de}from"../utils/i18n";let m=!1,C=!1,z=null,j=null,q=null,Q;const h=te(),_=window.location.pathname,S=[];export function getLocationHistory(){return S}function b(t){return _+t}function me(t){m||h.push(b(t))}export function historyReplace(t){m||h.push(b(t))}function f(t){return t.replace(/=&/g,"&").replace(/=$/,"")}function J(){let t="";const n=i.selectedExhibitor,a=i.selectedBooth,e=i.selectedEventItem,o=i.selectedRoute,r=i.selectedSpeaker,l=i.setKioskModeEnabled;if(i.list.type==="route-planner"&&!n&&!a&&!e){const d=s.routePlannerStore;if(d.source==="bookmarks")t=`${P}&${$}=bookmarks`;else{const w=d.items.map(g=>g.entity.slug).filter(Boolean).join(R);t=`${P}=${w}`}const p=d.startPoint?.slug;p&&(t+=`&${W}=${p}`)}else if(o&&!i.isMultiPointRoute){const d=o.from?`:${o.from.slug}`:"",p=o.to?`:${o.to.slug}`:"",w=s.routeStore.onlyAccessible?":true":":false",g=o.waypoints?.map(u=>`:${u.slug}`).join("");t=`route${p}${d}${w}${g||""}`}else if(n)t=n.slug;else if(a)t=a.slug;else if(e)t=e.slug;else if(r)t=r.slug;else if(l)t="";else switch(i.list.type){case"bookmarks":t="bookmarks";break;case"visited":t="visited";break;case"category":t=i.selectedCategory.slug;break;case"search":t=i.list.text||"";break;case x:t=x;break;case"filter":t=`${i.list.query.key}=${i.list.query.value}`;break;case"sessions":t="sessions";break;case"exhibitors":t="exhibitors";break;case"speakers":t="speakers";break;case"tours":t="tours";break;case"multi-point-tour":t=`tour=${i.list.tourId}`;break;default:throw new Error("Unkown list.type")}if(C)return;const c=t?"?"+encodeURIComponent(t):"";h.location.search!==c&&(n!==z||a!==j||e!==q?me(c):historyReplace(c),z=n,j=a,q=e)}function X(){const t=i.selectedExhibitor,n=i.selectedEventItem,a=i.selectedSpeaker;let e="";t?e=t.name:n?e=n.name:a?e=a.name:i.list.type==="search"&&i.list.text?e="`"+(i.list.text||"")+"`":i.list.type==="multi-point-tour"&&i.tourTitle&&(e=i.tourTitle),e.length&&(e+=" \u2013 "),e+=v.title,v.subtitle&&(e+=" \u2013 "+v.subtitle),e+=" \u2013 Expo Floor Plan by ExpoFP",document.title=e}function B(){const t=h.location.search.length>1?decodeURIComponent(h.location.search.substring(1)):"";return oe(t)}function y(){const t=h.location.search.length>1?decodeURIComponent(h.location.search.substring(1)):"";C=!0;const n=s.boothStore.booths.find(e=>e.slug?.toLowerCase()===t?.toLowerCase()||e.externalId?.toLowerCase()===t?.toLowerCase()||e.externalId?.toLowerCase()?.replace(/\s+/g,"")===t?.toLowerCase()),a=new URLSearchParams(decodeURIComponent(window.location.search));if(he(a),pe(a),!B())if(a.has(A)){const e=a.get(A);e==="1"?i.kiosk=!0:e==="0"&&(i.kiosk=!1,i.resetUIScale())}else if(t==="tours")s.selectTours();else if(t.startsWith("tour=")){const e=t.split("=")[1],o=s.toursStore.getTourById(e);o?s.toursStore.launchTour(o,o.name,o.description):(console.warn(`Route with id "${e}" not found`),s.selectTours())}else if(a.has(P)){const e=a.get($),o=a.get(W),r=o?ne(o):null;if(e==="bookmarks")s.routePlannerStore.launchFromBookmarks(r??void 0);else{const l=(a.get(P)||"").split(R).filter(Boolean);s.routePlannerStore.launchFromSlugs(l,r??void 0)}}else if(t.startsWith("route")){const e=t.split(R);s.routeStore.setOnlyAccessible(e[3]==="true");const o=ie(e[2],e[1],e.slice(4));s.routeStore.selectRoute(o);const l=e.slice(4).length>0;s.uiState.setIsMultiPointRoute(l);const d=new URLSearchParams(window.location.search).get("title");d&&s.uiState.setRouteTitle(d)}else if(t==="bookmarks")s.selectBookmarks();else if(t==="visited")s.selectVisited();else if(t===x)s.selectLanguage();else if(a.has(K)){const e=a.get(K)?.toLowerCase();fe(e)&&de(e)}else if(t==="sessions")s.selectSessions();else if(t==="exhibitors")s.selectExhibitors();else if(t==="speakers")s.selectSpeakers();else if(t==="-pdf")s.uiState.printingPdf=!0;else if(t.startsWith("hide"))s.uiState.setVisibility(new URLSearchParams(t).get("hide").split(",").filter(Boolean).reduce((e,o)=>({...e,[o]:!1}),{}));else if(n)setTimeout(()=>s.selectBooth(n),250);else if(t===se)s.uiState.startBuildRoute();else if(a.get(N)){const e=a.get(N),o=a.get("booths")?.split(",")||[],r=a.get("exhibitors")?.split(",")||[],l=a.get("tour");if(l){const u=s.toursStore.getTourById(l);u&&D(()=>{s.uiState.setTourTitle(u.name),s.uiState.setTourDescription(u.description),s.uiState.setIsMultiPointTour(!0),s.uiState.setMultiPointTourList(u.id)})}const c=s.boothStore.booths,d=s.exhibitorStore.exhibitors,p=c.filter(u=>o.includes(u.externalId)),w=d.filter(u=>r.includes(u.externalId)).flatMap(u=>u.booths),g=[...p,...w];if(le()){const u=g.map(ee=>ee.layer.name),M=ue(u);M&&s.fp.activateFloor({name:M})}(o.length>0||r.length>0)&&s.fp.highlightEntities([...o,...r]),s.layerStore.showPathWay(e),g.length>0&&D(()=>{s.uiState.moveToRect=ce.fromMultiple(g.map(u=>u.rect).filter(Boolean)),s.uiState.rollReset=!0})}else{const e=s.eventStore.eventItems.find(o=>o.slug?.toLowerCase()===t?.toLowerCase()||o.externalId?.toLowerCase()===t?.toLowerCase());if(e)s.selectEventItem(e,!0);else{const o=s.exhibitorStore.exhibitors.find(r=>r.slug?.toLowerCase()===t?.toLowerCase()||r.externalId?.toLowerCase()===t?.toLowerCase());if(t.startsWith("exhibitors")){const r=t.split("=")[1].split(",");setTimeout(()=>s.fp.selectExhibitor(r),250)}else if(o)setTimeout(()=>s.clickExhibitor(o),250);else if(t.includes("=")&&(t.startsWith("categories=")||t.startsWith("poiType=")))U.log("Skipping filter parameter in dispatchFromUrl:",t);else{const l=s.categoryStore.categories.find(c=>c.slug===t);if(l)s.selectCategory(l);else{const c=s.speakerStore.findBySlug(t);c?s.selectSpeaker(c,!0):t.includes("heatmap=true")||s.searchStore.selectSearch(t)}}}}C=!1,J(),X()}function T(){const t=h.location.search;if(t.includes("heatmap")){const e=new URL(window.location.href);if(e.searchParams.get("heatmap")==="true")if(e.searchParams.get("type")==="yah"){let r=f(e.search);m=!0,historyReplace(r),s.uiState.heatmapYah=!0,s.uiState.monochrome=!0,s.uiState.hideLogoInBooth=!0,s.uiState.hideHeaderLogo=!0,s.uiState.disableBookmarked=!0}else{e.searchParams.delete("heatmap");let r=f(e.search);m=!0,historyReplace(r),s.uiState.heatmap=!0}}if(t.startsWith("?preview="))historyReplace("?");else if(t.startsWith("?b="))historyReplace("?bookmarks");else if(t.startsWith("?ba=")){const e=new URL(window.location.href),o=parseInt(e.searchParams.get("ba")),r=s.exhibitorStore.exhibitorById.get(o);historyReplace(r?"?"+r.slug:"?bookmarks")}if(t.includes("blue-dot")){const e=new URL(window.location.href),o=e.searchParams.get("blue-dot").split(",");if(e.searchParams.delete("blue-dot"),o.length>1){const l=s.layerStore.findLayer(o[2])?.name,c=new ae(Number(o[0])||void 0,Number(o[1])||void 0,l,void 0,Number(o[3])||void 0,Number(o[4])||void 0);s.layerStore.layersLoaded?s.routeStore.selectCurrentPosition(c,!0,1):k(()=>s.layerStore.layersLoaded,()=>{s.routeStore.selectCurrentPosition(c,!0,1)})}let r=f(e.search);historyReplace(r)}if(t.includes("copy_exh")){const e=new URL(window.location.href),o=e.searchParams.get("copy_exh");e.searchParams.delete("copy_exh"),historyReplace("?")}if(t.includes("noOverlay")){const e=new URL(window.location.href),o=e.searchParams.get("noOverlay");e.searchParams.delete("noOverlay");let r=f(e.search);o==="true"?s.uiState.hideOverlay=!0:o==="false"&&(s.uiState.hideOverlay=!1),historyReplace(r)}if(t.includes("allowConsent")){const e=new URL(window.location.href),o=e.searchParams.get("allowConsent");e.searchParams.delete("allowConsent");const r=f(e.search);o==="true"?G(!0):o==="false"&&G(!1),historyReplace(r)}if(t.includes("hideHeaderLogo")){const e=new URL(window.location.href),o=e.searchParams.get("hideHeaderLogo");e.searchParams.delete("hideHeaderLogo");const r=f(e.search);o==="true"&&(i.hideHeaderLogo=!0),historyReplace(r)}if(t.includes("hideLogoInBooth")){const e=new URL(window.location.href),o=e.searchParams.get("hideLogoInBooth");e.searchParams.delete("hideLogoInBooth");const r=f(e.search);o==="true"&&(i.hideLogoInBooth=!0),historyReplace(r)}if(t.includes("disableFeatured")){const e=new URL(window.location.href),o=e.searchParams.get("disableFeatured");e.searchParams.delete("disableFeatured");const r=f(e.search);o==="true"&&s.exhibitorStore.exhibitors.forEach(l=>l.featured=!1),historyReplace(r)}if(t.includes("disableBookmarked")){const e=new URL(window.location.href),o=e.searchParams.get("disableBookmarked");e.searchParams.delete("disableBookmarked");const r=f(e.search);o==="true"&&(i.disableBookmarked=!0),historyReplace(r)}if(t.includes("disableGps")){const e=new URL(window.location.href),o=e.searchParams.get("disableGps");e.searchParams.delete("disableGps");const r=f(e.search);o==="true"&&s.routeStore.setGpsTrackingEnabled(!1),historyReplace(r)}if(t.includes("monochrome")){const e=new URL(window.location.href),o=e.searchParams.get("monochrome");e.searchParams.delete("monochrome");const r=f(e.search);o==="true"&&(i.monochrome=!0),historyReplace(r)}if((t.startsWith("?fbclid")||t.startsWith("?_ga"))&&historyReplace("?"),t.includes(I)){const e=new URL(window.location.href),o=e.searchParams.get(I);o==="1"||o==="true"?L&&localStorage.setItem(H,"1"):(o==="0"||o==="false")&&L&&localStorage.removeItem(H),e.searchParams.delete(I),historyReplace(f(e.search))}if(t.includes(E)){const e=new URL(window.location.href),o=e.searchParams.get(E);o==="true"?L&&localStorage.setItem(F,"1"):o==="false"&&L&&localStorage.removeItem(F),e.searchParams.delete(E),historyReplace(f(e.search))}if(i.previewExhibitor&&historyReplace("?"+i.previewExhibitor.slug),h.location.search.includes("&")||h.location.search.includes("%26")){let e=h.location.search;e=e.startsWith("?")?e.slice(1):e;const o=e.includes("&")?"&":"%26",l=e.split(o).map(c=>{const d=s.exhibitorStore.exhibitors.find(p=>p.slug===c||p.externalId===c);return d?d.name:c}).join("&");historyReplace("?"+l)}const n=new URLSearchParams(window.location.search);if(n.has(V)){s.uiState.resetUIScale();const e=new URL(window.location.href);e.searchParams.delete(V);let o=f(e.search);m=!0,historyReplace(o),m=!1}const a=n.get(Y);if(a){const e=a.replace(",","."),o=parseFloat(e);!isNaN(o)&&o>=.8&&o<=1.4?s.uiState.setUIScale(o,!0):U.warn(`Invalid ui-scale parameter: ${a}. Must be a number between 0.8 and 1.4.`);const r=new URL(window.location.href);r.searchParams.delete(Y);let l=f(r.search);m=!0,historyReplace(l),m=!1}}export function initRouting(t=!1){m=t,!m&&b(h.location.search)===_&&S.push(b(h.location.search)),Q=h.listen((n,a)=>{m||(S.push(b(n.search)),U.log("history",a,n),a==="POP"&&y())}),T(),B(),k(()=>s.layerStore.layersLoaded,()=>{s.urlFilterManager&&!s.urlFilterManager.isInitialized&&s.urlFilterManager.initialize(),y(),O(X),O(J),i.viewerMode&&(i.menu=!0)})}export function applyParameters(t=""){historyReplace("?"+decodeURIComponent(t.toString())),s.layerStore.layersLoaded?(T(),y()):(B(),k(()=>s.layerStore.layersLoaded,()=>{T(),y()}))}export function destroyHistory(){Q()}export function goBack(){if(console.log("goBack"),S.length>1){S.pop();const n=S[S.length-1].replace(_,"");return m=!0,h.replace(n),m=!1,y(),!0}else return h.go(-1),!1}function pe(t){try{let n={};const a=i.defaultMapSettings;if(new Set(t.keys()).size)n=Z(Object.fromEntries(t.entries()),a);else{const e=sessionStorage.getItem(re);e&&(n=Z(JSON.parse(e),a))}if(i.setMapSettings(n),n.z){const e=s.layerStore.layers.find(o=>o.name===n.z);e&&s.layerStore.updateVisibility(e,!0)}}catch(n){console.error("Failed to process or save map settings.",n)}}function Z(t,n){const a={};for(const e in t){if(!Object.prototype.hasOwnProperty.call(n,e)||!Object.prototype.hasOwnProperty.call(t,e))continue;const o=t[e];typeof n[e]=="number"&&typeof o=="string"?a[e]=parseFloat(o):a[e]=o}return a}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type RootStore from "./RootStore";
|
|
2
|
+
export type MaplibreViewMode = "floorplan" | "map2d" | "map3d";
|
|
3
|
+
export default class MaplibreStore {
|
|
4
|
+
rootStore: RootStore;
|
|
5
|
+
mapViewMode: MaplibreViewMode;
|
|
6
|
+
maplibreSelected: boolean;
|
|
7
|
+
isOnline: boolean;
|
|
8
|
+
private readonly handleOnline;
|
|
9
|
+
private readonly handleOffline;
|
|
10
|
+
constructor(rootStore: RootStore);
|
|
11
|
+
dispose(): void;
|
|
12
|
+
setOnline(isOnline: boolean): void;
|
|
13
|
+
activateMaplibre(): void;
|
|
14
|
+
deactivateMaplibre(): void;
|
|
15
|
+
get hideModeSwitchButton(): boolean;
|
|
16
|
+
get maplibreEnabled(): boolean;
|
|
17
|
+
get useMaplibreMap(): boolean;
|
|
18
|
+
get showMaplibre(): boolean;
|
|
19
|
+
get isMap3d(): boolean;
|
|
20
|
+
private getInitialViewMode;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=MaplibreStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__esDecorate as i,__runInitializers as l}from"tslib";import{action as d,computed as r,observable as o}from"mobx";import{fpGeo as y}from"../data/fpGeo";import n from"../data";const I=import.meta.env?.VITE_EXPOFP_USE_MAPLIBRE_MAP==="true",z=import.meta.env?.VITE_EXPOFP_DISABLE_3D_TOGGLE!=="false";function A(){return typeof window>"u"||window.navigator.onLine}let B=(()=>{let a=[],p,m=[],c=[],h,f=[],b=[],u,M=[],_=[],w,v,g,O,S,E,V,k;return class{static{const t=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;p=[o],h=[o],u=[o],w=[d],v=[d],g=[d],O=[r({keepAlive:!0})],S=[r({keepAlive:!0})],E=[r({keepAlive:!0})],V=[r({keepAlive:!0})],k=[r({keepAlive:!0})],i(this,null,w,{kind:"method",name:"setOnline",static:!1,private:!1,access:{has:e=>"setOnline"in e,get:e=>e.setOnline},metadata:t},null,a),i(this,null,v,{kind:"method",name:"activateMaplibre",static:!1,private:!1,access:{has:e=>"activateMaplibre"in e,get:e=>e.activateMaplibre},metadata:t},null,a),i(this,null,g,{kind:"method",name:"deactivateMaplibre",static:!1,private:!1,access:{has:e=>"deactivateMaplibre"in e,get:e=>e.deactivateMaplibre},metadata:t},null,a),i(this,null,O,{kind:"getter",name:"hideModeSwitchButton",static:!1,private:!1,access:{has:e=>"hideModeSwitchButton"in e,get:e=>e.hideModeSwitchButton},metadata:t},null,a),i(this,null,S,{kind:"getter",name:"maplibreEnabled",static:!1,private:!1,access:{has:e=>"maplibreEnabled"in e,get:e=>e.maplibreEnabled},metadata:t},null,a),i(this,null,E,{kind:"getter",name:"useMaplibreMap",static:!1,private:!1,access:{has:e=>"useMaplibreMap"in e,get:e=>e.useMaplibreMap},metadata:t},null,a),i(this,null,V,{kind:"getter",name:"showMaplibre",static:!1,private:!1,access:{has:e=>"showMaplibre"in e,get:e=>e.showMaplibre},metadata:t},null,a),i(this,null,k,{kind:"getter",name:"isMap3d",static:!1,private:!1,access:{has:e=>"isMap3d"in e,get:e=>e.isMap3d},metadata:t},null,a),i(null,null,p,{kind:"field",name:"mapViewMode",static:!1,private:!1,access:{has:e=>"mapViewMode"in e,get:e=>e.mapViewMode,set:(e,s)=>{e.mapViewMode=s}},metadata:t},m,c),i(null,null,h,{kind:"field",name:"maplibreSelected",static:!1,private:!1,access:{has:e=>"maplibreSelected"in e,get:e=>e.maplibreSelected,set:(e,s)=>{e.maplibreSelected=s}},metadata:t},f,b),i(null,null,u,{kind:"field",name:"isOnline",static:!1,private:!1,access:{has:e=>"isOnline"in e,get:e=>e.isOnline,set:(e,s)=>{e.isOnline=s}},metadata:t},M,_),t&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})}rootStore=l(this,a);mapViewMode=l(this,m,"floorplan");maplibreSelected=(l(this,c),l(this,f,!1));isOnline=(l(this,b),l(this,M,A()));handleOnline=(l(this,_),()=>this.setOnline(!0));handleOffline=()=>this.setOnline(!1);constructor(t){this.rootStore=t,this.mapViewMode=this.getInitialViewMode(),this.maplibreSelected=this.mapViewMode!=="floorplan",typeof window<"u"&&(window.addEventListener("online",this.handleOnline),window.addEventListener("offline",this.handleOffline))}dispose(){typeof window>"u"||(window.removeEventListener("online",this.handleOnline),window.removeEventListener("offline",this.handleOffline))}setOnline(t){this.isOnline=t}activateMaplibre(){this.maplibreEnabled&&(this.mapViewMode=n.allow3dView&&this.mapViewMode!=="map3d"?"map3d":"map2d",this.maplibreSelected=!0)}deactivateMaplibre(){this.mapViewMode="floorplan",this.maplibreSelected=!1}get hideModeSwitchButton(){return!this.maplibreEnabled||!n.allow3dView||z||n.hideModeSwitchButton}get maplibreEnabled(){const t=this.rootStore.fp?.maplibre??window.__efpMaplibre,e=!!t?.offline&&(!!t.style||!!t.styleUrl);return this.useMaplibreMap&&!!y?.properties?.config&&!this.rootStore.uiState.kiosk&&(this.isOnline||e)}get useMaplibreMap(){const t=n.flags?.enableExperimentalMaplibre;return typeof t=="boolean"?t:I}get showMaplibre(){return this.maplibreEnabled&&(this.mapViewMode==="map2d"||this.mapViewMode==="map3d")}get isMap3d(){return this.maplibreEnabled&&this.mapViewMode==="map3d"}getInitialViewMode(){return this.maplibreEnabled?n.allow3dView&&!n.hide3dMapDefault?"map3d":"map2d":"floorplan"}}})();export default B;
|
|
@@ -8,7 +8,7 @@ import { Speaker } from "./SpeakerStore";
|
|
|
8
8
|
import HeatmapStore from "./HeatmapStore";
|
|
9
9
|
import IntercomStore from "./IntercomStore";
|
|
10
10
|
import LayerStore from "./LayerStore";
|
|
11
|
-
import
|
|
11
|
+
import MaplibreStore from "./MaplibreStore";
|
|
12
12
|
import RouteStore from "./RouteStore";
|
|
13
13
|
import RoutePlannerStore from "./RoutePlannerStore";
|
|
14
14
|
import ToursStore from "./ToursStore";
|
|
@@ -33,7 +33,7 @@ export default class RootStore {
|
|
|
33
33
|
readonly routeStore: RouteStore;
|
|
34
34
|
readonly routePlannerStore: RoutePlannerStore;
|
|
35
35
|
readonly toursStore: ToursStore;
|
|
36
|
-
readonly
|
|
36
|
+
readonly maplibreStore: MaplibreStore;
|
|
37
37
|
readonly layerStore: LayerStore;
|
|
38
38
|
readonly intercomStore: IntercomStore;
|
|
39
39
|
readonly eventStore: EventStore;
|