@expofp/floorplan 3.46.0 → 3.46.1
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/{Button-CJtSs2s5.js → Button-OKcMiyWO.js} +5 -5
- package/dist/browser/{CookieConsent-C4fi9Tyh.js → CookieConsent-6ulFPlqA.js} +7 -7
- package/dist/browser/{Debug-Cd610X28.js → Debug-BxskUF4D.js} +7 -7
- package/dist/browser/{DebugTools-D9g4_7Cc.js → DebugTools-C1is5dXX.js} +6 -6
- package/dist/browser/{Demo-CryvOcgl.js → Demo-Dx8IKR7Q.js} +9 -9
- package/dist/browser/{Free-CJXdChTu.js → Free-BaIZnChc.js} +10 -10
- package/dist/browser/{GalleryContainer-DJEByROk.js → GalleryContainer-BXomiMwG.js} +11 -11
- package/dist/browser/{GpsLoader-DSsG-xT8.js → GpsLoader-Ccwug0hj.js} +14 -14
- package/dist/browser/{KioskStore-DOB-av5O.js → KioskStore-D_Ejv_K0.js} +13 -13
- package/dist/browser/{LayerStore-CRZuLMs5.js → LayerStore-DKg7vekG.js} +268 -249
- package/dist/browser/{MaplibreAdapter-C_5hoa-Y.js → MaplibreAdapter-Dh_ASXEG.js} +148 -148
- package/dist/browser/{ModalContainer-Ch8bqPHR.js → ModalContainer-DXN2lQG-.js} +10 -10
- package/dist/browser/{PermissionNotice-CiR8SfU0.js → PermissionNotice-CljwxHGD.js} +6 -6
- package/dist/browser/{RouteStore-D5yYhhPl.js → RouteStore-4r6xqu2L.js} +334 -319
- package/dist/browser/{SetKioskMode-PiwwpWpN.js → SetKioskMode-3YCa73LZ.js} +12 -12
- package/dist/browser/{ShowKiosk-uWNhreCd.js → ShowKiosk-CmozIEWm.js} +10 -10
- package/dist/browser/{UIState-Bi4-Ri9M.js → UIState-DOVwNW-h.js} +97 -97
- package/dist/browser/{ViewerMenuPanel-B3vtTFpG.js → ViewerMenuPanel-ukfCjPlv.js} +11 -11
- package/dist/browser/{add-debug-secret-listener-Db76vB7o.js → add-debug-secret-listener-DiW9122w.js} +1 -1
- package/dist/browser/{adopt-global-settings-67S2v_mo.js → adopt-global-settings-C8NxCufU.js} +9 -9
- package/dist/browser/{boolean-editor-B1nYYAEd.js → boolean-editor-DAUiSxaZ.js} +9 -9
- package/dist/browser/{bootIntercom-BQDnVlyT.js → bootIntercom-Cxu_tGyN.js} +2 -2
- package/dist/browser/bundle.json +87 -87
- package/dist/browser/{camera-events-dIlK_9kU.js → camera-events-BzkvmmVT.js} +1 -1
- package/dist/browser/{classnames-CnT6VKND.js → classnames-ht7j544T.js} +2 -2
- package/dist/browser/{client-iKoOfnTw.js → client-cb0OfXbM.js} +5 -5
- package/dist/browser/{components-CEmFE-HF.js → components-D1hWFJkH.js} +164 -164
- package/dist/browser/{create-live-plan-VYe8zgCt.js → create-live-plan-BYQmwyu_.js} +110 -110
- package/dist/browser/{debug-context-SM4t83oS.js → debug-context-D-Az5hsc.js} +6 -6
- package/dist/browser/{debug-overlay-BLs-zKon.js → debug-overlay-Cx_TzAOa.js} +10 -10
- package/dist/browser/{debug-ui-COzdQWZH.js → debug-ui-BWGZ29bU.js} +6 -6
- package/dist/browser/{dist-Dxs4B_bo.js → dist-CxdNXcdm.js} +6 -6
- package/dist/browser/{dist-B-cTdqLW.js → dist-DI0TDNHP.js} +5 -5
- package/dist/browser/{dist-C7DmTDRb.js → dist-TE6VoTiX.js} +3 -3
- package/dist/browser/{efp-debug-init-B_S1vuGu.js → efp-debug-init-pyajqRUx.js} +3 -3
- package/dist/browser/{enum-editor-CNXjKr2S.js → enum-editor-CtGMxTY9.js} +4 -4
- package/dist/browser/{es5-DXybUgTP.js → es5-CaaQfpSO.js} +2 -2
- package/dist/browser/{event-head-ClLbm9Br.js → event-head-BM-eM_Bb.js} +1 -1
- package/dist/browser/{event-not-found-DH79zTW9.js → event-not-found-B65hzXQP.js} +3 -3
- package/dist/browser/{event-scoped-cache-DpaRX7uc.js → event-scoped-cache-Dy_k6CT0.js} +2 -2
- package/dist/browser/{expofpUrl-n296mHS4.js → expofpUrl-CtHaWZhI.js} +1 -1
- package/dist/browser/{exports-lzdhlipZ.js → exports-B117IH-s.js} +1 -1
- package/dist/browser/{favicon-DIM65QuL.js → favicon-BZ8MgZoI.js} +1 -1
- package/dist/browser/{fetch-retry.umd-vSI4xMC_.js → fetch-retry.umd-CZoakvnh.js} +2 -2
- package/dist/browser/{flex-BAVIARsK.js → flex-DqZnQXWR.js} +5 -5
- package/dist/browser/{floorplan.loader-eMUdl6jt.js → floorplan.loader-Dj1p_2Uj.js} +12 -12
- package/dist/browser/{floorplan.ready-1Txw5bTb.js → floorplan.ready-DV6RYY5y.js} +265 -239
- package/dist/browser/{framing-rect-BTpvle_p.js → framing-rect-BPQPxCHJ.js} +426 -351
- package/dist/browser/{freeBanner-F3TTYS8Q.js → freeBanner-CV-7PVgM.js} +2 -2
- package/dist/browser/{fuse-CaTg1KbU.js → fuse-o5_aSzm4.js} +2 -2
- package/dist/browser/{i18n-C_4TK-u4.js → i18n-DT4SjeA3.js} +6 -6
- package/dist/browser/index.js +17 -17
- package/dist/browser/{index.module-DRBCPeTj.js → index.module-AwGISzVZ.js} +4 -4
- package/dist/browser/{init-ui-BYGB5Nye.js → init-ui-_JZLWvuF.js} +19 -19
- package/dist/browser/{integrateKiosk-BYXxa3GA.js → integrateKiosk-LP784XEO.js} +6 -6
- package/dist/browser/{is-debug-D3IYeseH.js → is-debug-sgFB2_R1.js} +4 -4
- package/dist/browser/{is-own-domain-Sd0Gyaz6.js → is-own-domain-Cgslc30X.js} +1 -1
- package/dist/browser/{is-webview-DkUEFd5j.js → is-webview-Cbjly4fl.js} +1 -1
- package/dist/browser/{jsx-runtime-Z0-uGdH1.js → jsx-runtime-DJq9zytl.js} +2 -2
- package/dist/browser/{kiosk-mode-D9JdlNtc.js → kiosk-mode-D0Muk9LN.js} +3 -3
- package/dist/browser/{kiosk-record-U7MDU1j1.js → kiosk-record-QLKP2NTE.js} +1 -1
- package/dist/browser/{kioskApi-CZmWdnyx.js → kioskApi-Cm0aHEDq.js} +7 -7
- package/dist/browser/{ktx2-DBt1EdxU.js → ktx2-D9vr5u5B.js} +2 -2
- package/dist/browser/{lib-Bpc7qOXg.js → lib-Cu-YSKSO.js} +3 -3
- package/dist/browser/{loadImage-Dy1_5knL.js → loadImage-DC3BioQw.js} +1 -1
- package/dist/browser/{logDeviceInfo-DFiuu0JW.js → logDeviceInfo-U-dghNEE.js} +9 -9
- package/dist/browser/{mobx-NvAhKUmy.js → mobx-B3ugy_Uo.js} +4 -4
- package/dist/browser/{mobx.module-Bv5V3v5d.js → mobx.module-C9pJfT4z.js} +1 -1
- package/dist/browser/{optional-boolean-editor-BEOwiXCN.js → optional-boolean-editor-B6peoFdP.js} +3 -3
- package/dist/browser/{optional-enum-editor-C6KjlpRA.js → optional-enum-editor-DdGc6bGo.js} +4 -4
- package/dist/browser/{optional-string-editor-CFrCSmMd.js → optional-string-editor-D-mZ5TcA.js} +4 -4
- package/dist/browser/{particles.min-C2A0DA4i.js → particles.min-r05NeIIO.js} +2 -2
- package/dist/browser/{react-CabZjr3N.js → react-CAiPe_Qk.js} +2 -2
- package/dist/browser/{react-dom-RP6YFh3Z.js → react-dom-B-n3e4uH.js} +3 -3
- package/dist/browser/{rolldown-runtime-fogUk23q.js → rolldown-runtime-BkAGFH-3.js} +1 -1
- package/dist/browser/{scene-DuvbPaPD.js → scene-DBB57-1M.js} +10 -10
- package/dist/browser/{scheduler-k2rbX-LJ.js → scheduler-Btu7810I.js} +2 -2
- package/dist/browser/{select-DDC9fvlH.js → select-1x7gpaD6.js} +10 -10
- package/dist/browser/{settings-BozBuwXD.js → settings-Clb327Gp.js} +2 -2
- package/dist/browser/{settings-item-D4rlEKz6.js → settings-item-9ehuHN7w.js} +6 -6
- package/dist/browser/{store-CbRrBMLs.js → store-B618He5O.js} +2 -2
- package/dist/browser/{string-editor-CExhbakJ.js → string-editor-zH6d37oA.js} +4 -4
- package/dist/browser/{text-field-BV3Vp6cI.js → text-field-hTc5zeaz.js} +5 -5
- package/dist/browser/{theme-E8keDBEa.js → theme-rkMDBBl_.js} +8 -8
- package/dist/browser/{three.core-C_nLFu2C.js → three.core-CoaBWF0W.js} +1 -1
- package/dist/browser/{ui-CgHs1m5h.js → ui-d7u7XbmX.js} +8 -8
- package/dist/browser/{useRenderTarget-D7wRx7QW.js → useRenderTarget-Dsf3ugHo.js} +4 -4
- package/dist/browser/{viewport-BH6xyD06.js → viewport-BDI0afn8.js} +3 -3
- package/dist/browser/{wayfinding-BiZuXF9Q.js → wayfinding-BkpHRhUO.js} +516 -510
- package/dist/esm/components/Map/drawing/config/booth-badge-anchor.d.ts +57 -5
- package/dist/esm/components/Map/drawing/config/booth-badge-anchor.js +1 -1
- package/dist/esm/components/Map/drawing/config/booth-fill-color.d.ts +16 -0
- package/dist/esm/components/Map/drawing/config/booth-fill-color.js +1 -0
- package/dist/esm/components/Map/drawing/config/config-booth-badge.js +1 -1
- package/dist/esm/components/Map/drawing/config/config-booth-bg.js +1 -1
- package/dist/esm/floorplan.ready.js +1 -1
- package/dist/esm/store/RootStore.js +1 -1
- package/dist/esm/store/RouteStore.d.ts +9 -1
- package/dist/esm/store/RouteStore.js +1 -1
- package/dist/esm/test/store-harness.js +1 -1
- package/dist/esm/utils/gps.d.ts +5 -1
- package/dist/esm/utils/gps.js +1 -1
- package/package.json +10 -10
|
@@ -1,7 +1,31 @@
|
|
|
1
|
-
import { Box } from '@expofp/geometry';
|
|
1
|
+
import { Box, Polygon } from '@expofp/geometry';
|
|
2
2
|
import { type RegularBooth } from '../../../../store/BoothStore.js';
|
|
3
3
|
/** What a badge's anchor search reads off its booth. */
|
|
4
4
|
export type BadgeBooth = Pick<RegularBooth, 'rect' | 'rotate'>;
|
|
5
|
+
/** What a booth's badge must fit in. */
|
|
6
|
+
export interface BadgeFootprint {
|
|
7
|
+
/** The body's shape, built once for the outline and the badge's anchor search alike. */
|
|
8
|
+
readonly geometry: BadgeGeometry;
|
|
9
|
+
/** How far the outline reaches into the body; 0 without one. */
|
|
10
|
+
readonly outlineInset: number;
|
|
11
|
+
}
|
|
12
|
+
/** A footprint's shape, as the anchor search reads it. */
|
|
13
|
+
export interface BadgeGeometry {
|
|
14
|
+
/** The booth's body (its first path) as triangles; empty without paths. */
|
|
15
|
+
readonly triangles: number[][][];
|
|
16
|
+
readonly polygon: Polygon;
|
|
17
|
+
/** The footprint's outer edge. */
|
|
18
|
+
readonly edges: FootprintEdge[];
|
|
19
|
+
readonly bbox: Box | null;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The badge's footprint: the booth's first path. Later paths are usually an outline drawn as a band
|
|
23
|
+
* over the body's edge, so their reach into the body comes along for the badge to keep clear of. A
|
|
24
|
+
* path that does not reach the edge is an inner element, not an outline, and is left out.
|
|
25
|
+
* @param booth - The booth.
|
|
26
|
+
* @returns The body and the outline's reach into it.
|
|
27
|
+
*/
|
|
28
|
+
export declare function getBoothBadgeFootprint(booth: Pick<RegularBooth, 'paths' | 'layer'>): BadgeFootprint;
|
|
5
29
|
/** Where a badge sits in one booth corner, and how large it may grow there. */
|
|
6
30
|
export interface BadgeFit {
|
|
7
31
|
/** The x of the badge's top-left corner on the plan, before rotation. */
|
|
@@ -26,7 +50,6 @@ export interface BadgeFit {
|
|
|
26
50
|
*/
|
|
27
51
|
export declare class BoothBadgeAnchors {
|
|
28
52
|
private readonly booth;
|
|
29
|
-
private readonly triangles;
|
|
30
53
|
private readonly border;
|
|
31
54
|
private readonly source;
|
|
32
55
|
/** The badges with corners still to work out while the page is idle, in the order queued. */
|
|
@@ -35,17 +58,20 @@ export declare class BoothBadgeAnchors {
|
|
|
35
58
|
private readonly fits;
|
|
36
59
|
/** The rotation at corner 0 the idle work counts quarter turns from. */
|
|
37
60
|
private prefetchRotation;
|
|
61
|
+
private readonly triangles;
|
|
38
62
|
private readonly polygon;
|
|
63
|
+
/** The footprint's outer edge. */
|
|
64
|
+
private readonly edges;
|
|
39
65
|
private readonly bbox;
|
|
40
66
|
/** The booth's distinct vertices in first-seen order, built on the first search. */
|
|
41
67
|
private vertices;
|
|
42
68
|
/**
|
|
43
69
|
* @param booth - The booth the badge belongs to.
|
|
44
|
-
* @param
|
|
70
|
+
* @param geometry - The booth's footprint, from {@link buildBadgeGeometry}.
|
|
45
71
|
* @param border - How far the badge stays in from the booth's edge.
|
|
46
72
|
* @param source - The badge's width and height at scale 1.
|
|
47
73
|
*/
|
|
48
|
-
constructor(booth: BadgeBooth,
|
|
74
|
+
constructor(booth: BadgeBooth, geometry: BadgeGeometry, border: number, source: {
|
|
49
75
|
readonly x: number;
|
|
50
76
|
readonly y: number;
|
|
51
77
|
});
|
|
@@ -80,12 +106,21 @@ export declare class BoothBadgeAnchors {
|
|
|
80
106
|
*/
|
|
81
107
|
private prefetchNext;
|
|
82
108
|
/**
|
|
83
|
-
* Searches a corner: the anchor,
|
|
109
|
+
* Searches a corner: the anchor, the largest scale at it, then the move off slanted sides.
|
|
84
110
|
* @param corner - The booth corner, clockwise from top-left (0).
|
|
85
111
|
* @param rotation - The badge's rotation at that corner, in radians.
|
|
86
112
|
* @returns The corner's fit.
|
|
87
113
|
*/
|
|
88
114
|
private compute;
|
|
115
|
+
/**
|
|
116
|
+
* Moves the anchor along the badge's axes where a slanted booth side comes nearer than the border
|
|
117
|
+
* to the badge's left or top side.
|
|
118
|
+
* @param anchor - The badge's anchor.
|
|
119
|
+
* @param scale - The badge's largest scale.
|
|
120
|
+
* @param rotation - The badge's rotation, in radians.
|
|
121
|
+
* @returns The moved anchor; `null` when no move is needed or it would leave the booth.
|
|
122
|
+
*/
|
|
123
|
+
private nudge;
|
|
89
124
|
/**
|
|
90
125
|
* The largest scale the booth's rect allows. At odd corners the badge's width and height lie
|
|
91
126
|
* along the booth's height and width.
|
|
@@ -115,6 +150,15 @@ export declare class BoothBadgeAnchors {
|
|
|
115
150
|
* @returns The scale; the cap itself when the booth has no footprint or the anchor lies outside.
|
|
116
151
|
*/
|
|
117
152
|
private clampScale;
|
|
153
|
+
/**
|
|
154
|
+
* Whether the badge's three corners away from the anchor lie inside the booth's footprint.
|
|
155
|
+
* @param anchorX - The badge's anchor.
|
|
156
|
+
* @param anchorY - The badge's anchor.
|
|
157
|
+
* @param scale - The badge's scale.
|
|
158
|
+
* @param rotation - The badge's rotation, in radians.
|
|
159
|
+
* @returns Whether they do.
|
|
160
|
+
*/
|
|
161
|
+
private fitsAt;
|
|
118
162
|
/**
|
|
119
163
|
* The booth's distinct vertices, in the order the triangles first name them.
|
|
120
164
|
* @returns The vertices, built once.
|
|
@@ -127,4 +171,12 @@ export declare class BoothBadgeAnchors {
|
|
|
127
171
|
* @returns The box, or `null` when there are no triangles.
|
|
128
172
|
*/
|
|
129
173
|
export declare function trianglesBoundingBox(triangles: number[][][]): Box | null;
|
|
174
|
+
/** A segment of a footprint's outer edge. */
|
|
175
|
+
export type FootprintEdge = [number[], number[]];
|
|
176
|
+
/**
|
|
177
|
+
* The shape the anchor search reads off a footprint's triangles.
|
|
178
|
+
* @param triangles - The triangles.
|
|
179
|
+
* @returns The triangles with their polygon, outer edge and bounding box.
|
|
180
|
+
*/
|
|
181
|
+
export declare function buildBadgeGeometry(triangles: number[][][]): BadgeGeometry;
|
|
130
182
|
//# sourceMappingURL=booth-badge-anchor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Box as
|
|
1
|
+
import{Box as P,pointRotate as p,Polygon as R}from"@expofp/geometry";import{getTrianglesFromFpPaths as M}from"../../../../data/svg.js";const T=.5,v=.3,w=10,$=.01,b=8,C=2,G=.01,k=8,A=4,D=50;export function getBoothBadgeFootprint(f){const[t,...s]=f.paths??[],e=f.layer?.name||"",n=t?M(t.index,e):[],i=buildBadgeGeometry(n);if(!s.length)return{geometry:i,outlineInset:0};const{polygon:c,edges:o}=i;let r=0;for(const l of s){let a=0,h=!1;for(const u of M(l.index,e))for(const[y,m]of u){const x={x:y,y:m};if(c.containsPoint(x,{areaTolerance:0})){const d=S(x,o);a=Math.max(a,d),d<=$&&(h=!0)}else h=!0}h&&(r=Math.max(r,a))}return{geometry:i,outlineInset:r}}export class BoothBadgeAnchors{static{this.idle=new Set}static{this.idleScheduled=!1}constructor(t,s,e,n){this.booth=t,this.border=e,this.source=n,this.fits=[],this.prefetchRotation=0,this.vertices=null,{triangles:this.triangles,polygon:this.polygon,edges:this.edges,bbox:this.bbox}=s}fit(t,s){let e=this.fits[t];return e||(this.fits[t]=e=this.compute(t,s),this.fits.filter(Boolean).length===4&&(this.vertices=null)),e}prefetch(t){BoothBadgeAnchors.idle.has(this)||(this.prefetchRotation=t,BoothBadgeAnchors.idle.add(this),BoothBadgeAnchors.scheduleIdle())}cancelPrefetch(){BoothBadgeAnchors.idle.delete(this)}static scheduleIdle(){BoothBadgeAnchors.idleScheduled||!BoothBadgeAnchors.idle.size||(BoothBadgeAnchors.idleScheduled=!0,typeof requestIdleCallback=="function"?requestIdleCallback(BoothBadgeAnchors.runIdle):typeof requestAnimationFrame=="function"?requestAnimationFrame(()=>setTimeout(BoothBadgeAnchors.runSlice,0)):setTimeout(BoothBadgeAnchors.runSlice,D))}static runSlice(){const t=performance.now()+A;BoothBadgeAnchors.runIdle({timeRemaining:()=>t-performance.now()})}static runIdle(t){BoothBadgeAnchors.idleScheduled=!1;const s=performance.now()+k;try{for(const e of BoothBadgeAnchors.idle){if(t.timeRemaining()<=0||performance.now()>=s)break;let n=!1;try{n=e.prefetchNext()}finally{n||BoothBadgeAnchors.idle.delete(e)}}}finally{BoothBadgeAnchors.scheduleIdle()}}prefetchNext(){for(let t=1;t<4;t++)if(!this.fits[t])return this.fit(t,this.prefetchRotation+t*Math.PI/2),t<3;return!1}compute(t,s){const e=t===0||t===3?1:-1,n=t===0||t===1?1:-1;let i=this.findAnchor(e,n),c=this.clampScale(i.x,i.y,this.rectMaxScale(t%2===1),s);const o=(this.booth.rotate??0)+t*Math.PI/2;for(let r=0;r<C;r++){const l=this.nudge(i,c,o);if(!l)break;i=l,this.fitsAt(i.x,i.y,c,s)||(c=this.clampScale(i.x,i.y,c,s))}return{x:i.x,y:i.y,maxScale:c}}nudge(t,s,e){if(!this.triangles.length||!s)return null;const n=Math.cos(e),i=Math.sin(e),c=this.source.x*s,o=this.source.y*s,r=(y,m)=>{let x=0;for(let d=0;d<=b;d++){const g={x:t.x+y*d/b,y:t.y+m*d/b},I=S(g,this.edges),E=this.polygon.containsPoint(g);x=Math.max(x,E?this.border-I:this.border+I)}return x},l=r(-i*o,n*o),a=r(n*c,i*c),h=this.border*G;if(l<=h&&a<=h)return null;const u={x:t.x+Math.max(l,0)*n-Math.max(a,0)*i,y:t.y+Math.max(l,0)*i+Math.max(a,0)*n};return this.polygon.containsPoint(u)?u:null}rectMaxScale(t){const s=this.booth.rect.size.width,e=this.booth.rect.size.height,n=t?e:s,i=t?s:e;return Math.min(n>0?n*T/this.source.x:1/0,i>0?i*v/this.source.y:1/0)}findAnchor(t,s){const{booth:e,border:n,bbox:i}=this;if(i){const l=t>0?i.min.x:i.max.x,a=s>0?i.min.y:i.max.y,h=[];for(const[u,y]of this.distinctVertices()){const m=u+n*t,x=y+n*s,d=Math.abs(m-l)+Math.abs(x-a);d<1/0&&h.push({x:m,y:x,score:d,order:h.length})}h.sort((u,y)=>u.score-y.score||u.order-y.order);for(const u of h){const y={x:u.x,y:u.y};if(this.polygon.containsPoint(y))return y}}const c=t>0?e.rect.min.x+n:e.rect.max.x-n,o=s>0?e.rect.min.y+n:e.rect.max.y-n,r=e.rotate??0;return r?p({x:c,y:o},r,e.rect.center):{x:c,y:o}}clampScale(t,s,e,n){const{polygon:i}=this;if(!this.triangles.length)return e;const c={x:t,y:s};if(!i.containsPoint(c))return e;let o=0,r=e;for(let l=0;l<w;l++){const a=(o+r)/2;this.fitsAt(t,s,a,n)?o=a:r=a}return o}fitsAt(t,s,e,n){const{polygon:i,source:c}=this,o={x:t,y:s},r=c.x*e,l=c.y*e;return i.containsPoint(p({x:t+r,y:s},n,o))&&i.containsPoint(p({x:t,y:s+l},n,o))&&i.containsPoint(p({x:t+r,y:s+l},n,o))}distinctVertices(){if(this.vertices)return this.vertices;const t=new Set,s=[];for(const e of this.triangles)for(const n of e){const i=`${n[0]},${n[1]}`;t.has(i)||(t.add(i),s.push([n[0],n[1]]))}return this.vertices=s}}export function trianglesBoundingBox(f){if(!f.length)return null;let t=1/0,s=1/0,e=-1/0,n=-1/0;for(const i of f)for(const[c,o]of i)c<t&&(t=c),o<s&&(s=o),c>e&&(e=c),o>n&&(n=o);return P.fromMinMax({x:t,y:s},{x:e,y:n})}function L(f){const t=[],s=[];for(const e of f){const n=t.length;t.push({x:e[0][0],y:e[0][1]}),t.push({x:e[1][0],y:e[1][1]}),t.push({x:e[2][0],y:e[2][1]}),s.push([n,n+1,n+2])}return new R(t,s)}export function buildBadgeGeometry(f){return{triangles:f,polygon:L(f),edges:N(f),bbox:trianglesBoundingBox(f)}}function N(f){const t=new Map;for(const e of f)for(let n=0;n<3;n++){const i=e[n],c=e[(n+1)%3],o=`${i[0]},${i[1]}`,r=`${c[0]},${c[1]}`,l=o<r?`${o}|${r}`:`${r}|${o}`,a=t.get(l);a?a.count++:t.set(l,{edge:[i,c],count:1})}const s=[];for(const{edge:e,count:n}of t.values())n===1&&s.push(e);return s}function S(f,t){let s=1/0;for(const[[e,n],[i,c]]of t){const o=i-e,r=c-n,l=o*o+r*r,a=l?Math.max(0,Math.min(1,((f.x-e)*o+(f.y-n)*r)/l)):0;s=Math.min(s,Math.hypot(f.x-e-a*o,f.y-n-a*r))}return s}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type Booth } from '../../../../store/BoothStore';
|
|
2
|
+
/**
|
|
3
|
+
* A booth's fill by status (hold, sold, available or rebooking), before hover, selection or heatmap.
|
|
4
|
+
* @param booth - The booth.
|
|
5
|
+
* @returns A color that parses, falling back to the default booth color.
|
|
6
|
+
*/
|
|
7
|
+
export declare function getBoothStatusColor(booth: Booth): string;
|
|
8
|
+
/**
|
|
9
|
+
* A booth's body fill at rest: its first path's own color, otherwise its status color. Later paths
|
|
10
|
+
* are usually an outline. A heatmap paints the whole booth; monochrome plans gray it, as the booth's
|
|
11
|
+
* own drawer does.
|
|
12
|
+
* @param booth - The booth.
|
|
13
|
+
* @returns The fill color.
|
|
14
|
+
*/
|
|
15
|
+
export declare function getBoothFillColor(booth: Booth): string;
|
|
16
|
+
//# sourceMappingURL=booth-fill-color.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import n from"color";import f from"../../../../data";import{heatmapStore as u,uiState as i}from"../../../../store";import{RegularBooth as c,SpecialBooth as m}from"../../../../store/BoothStore";import{RebookingState as p}from"../../../../store/ExhibitorStore";import{rebookingStateConfig as s}from"../../../../tools/rebooking-config";import e from"../../../../tools/settings";const g=o=>{if(!o||o==="transparent"||o==="none")return!1;try{return n(o),!0}catch{return!1}};function d(o){if(o.length===0)return null;const r=o[0];return o.every(l=>l===r)?r:null}export function getBoothStatusColor(o){let r=e.colors.booths.default;if(o instanceof m)r=o.color||e.colors.booths.empty;else if(o instanceof c){if(f.isRebooking){if(!o.exhibitors?.length)return s[p.Unasked].color.primary;const l=d((o.exhibitors??[]).map(a=>a.rebookingState));return l!==null?s[l].color.primary:"#000000"}const t=e.colors.booths;o.onHold?r=o.holdColor||t.defaultHold:o.exhibitors.length||o.reserved?r=o.soldColor||t.defaultSold:r=o.availColor||t.empty}try{r==="none"&&(r=e.colors.booths.default),n(r)}catch(t){r=e.colors.booths.default,console.error("Booth: defaultColor",t)}return r}export function getBoothFillColor(o){if(i.heatmap)return u.getHeatmapColorForBooth(o).rgb().string();const r=o.paths?.[0]?.color,t=g(r)?r:getBoothStatusColor(o);return i.monochrome||i.heatmapYah?n(t).grayscale().rgb().string():t}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{pointRotate as
|
|
1
|
+
import{pointRotate as M,Rect as W}from"@expofp/geometry";import{update as v}from"@expofp/renderer";import z from"color";import{reaction as T}from"mobx";import{SEPARATOR as _}from"../../../../constants";import w from"../../../../data";import{createShapeDef as Y,createTextDef as Z,createTextDefLines as Q}from"../../../../engine/defs";import{loadCustomFontsUrls as V}from"../../../../engine/fonts";import{getQuarterTurns as j,getRollValue as q}from"../../../../engine/update-def";import{boothStore as J,uiState as L}from"../../../../store";import{RegularBooth as K}from"../../../../store/BoothStore";import{getContrastTextColor as tt}from"../../../../utils/getContrastTextColor";import et from"../../../../utils/is-phone";import{BoothBadgeAnchors as ot,getBoothBadgeFootprint as nt}from"./booth-badge-anchor";import{getBoothFillColor as rt}from"./booth-fill-color.js";import{getFont as it}from"./canvases";import{isBoothBadgeEligible as st}from"./config-booth-badge-eligibility";import{getBadgeScale as at}from"./config-booth-badge-scale";import{getBadgeFontWeight as ct,getFontUrlByWeight as lt}from"./config-booth-labels";const P=15,ht=et?16:18,I=30,dt=6,mt=4,F=.8,H=I*F,U=document.createElement("canvas").getContext("2d");function gt(t){return t.length<=P?t:t.slice(0,P-1)+"\u2026"}export function createBoothBadge(t){const n=gt(t.title||t.name),e=rt(t),r=tt(z(e).hex()),a=ct(),h=it(I,a);U.font=h;const i=U.measureText(n).width,c=Math.ceil(i+dt*2),m=I+mt*2,{geometry:E,outlineInset:$}=nt(t),X=Math.max((t.borderWidth||J.borderWidth)/2,$),N=c*F,R=m*F,A=new ot(t,E,X,{x:N,y:R});let d=t.rotate??0,b=0,g=0,u=0,D=0;const O=()=>{const o=A.fit(b,d);g=o.x,u=o.y,D=o.maxScale};O();const C=(o,S)=>{const y=o/2,B=S/2,k=M({x:g+y,y:u+B},d,{x:g,y:u});return new W(k,{x:o,y:S},d,t.elevation)},G=lt(a,V()),s=Y(C(1,1),e);s.hidden=!0,s.dim=t.skipDim?0:void 0;const l=Z(Q([[n],[]],r,0,[G,G]),C(1,1),[0,0],{horizontal:"center",vertical:"center"});l.hidden=!0,l.dim=t.skipDim?0:void 0;const f={booth:t,anchor:{x:g,y:u},source:{x:N,y:R},rotation:d,maxScale:D,bg:s,text:l},p=new BoothBadgeDrawer(f);s.onScale=({pixelSize:o})=>p.layOutBg(o),l.onScale=({pixelSize:o})=>p.layOutText(o);const x=[];return x.push(T(()=>t.skipDim,o=>{s.dim=o?0:void 0,l.dim=o?0:void 0,v(s,l)})),x.push(T(()=>t.layer?.visible??!0,o=>{s.hidden=!o,l.hidden=!o,v(s,l)})),x.push(T(()=>L.mapSettings,({roll:o})=>{q(o??0)&&(A.prefetch(t.rotate??0),s.onRoll=({roll:S,pixelSize:y})=>{const B=j(S,d);if(B!==0)return d+=B*Math.PI/2,b=((b+B)%4+4)%4,O(),f.anchor.x=g,f.anchor.y=u,f.rotation=d,f.maxScale=D,p.invalidate(),[...p.layOutBg(y),...p.layOutText(y)]})},{fireImmediately:!0}),()=>A.cancelPrefetch()),{bg:s,text:l,dispose:()=>{x.forEach(o=>o()),x.length=0}}}export class BoothBadgeDrawer{constructor(n){this.placement=n,this.bgScale=NaN,this.textScale=NaN}invalidate(){this.bgScale=NaN,this.textScale=NaN}layOutBg(n){const{bg:e}=this.placement,r=this.scaleFor(n);return r===this.bgScale?[]:(this.bgScale=r,e.shape=this.rectAt(r),e.hidden=this.isHidden(),e.hidden?[]:[e])}layOutText(n){const{text:e}=this.placement,r=this.scaleFor(n);return r===this.textScale?[]:(this.textScale=r,e.lines[0].fontSize=H*r,e.bounds=this.rectAt(r),e.hidden=this.isHidden(),e.hidden?[]:[e])}scaleFor(n){return at({pixelSize:n,fontSize:ht,plateFontSize:H,maxScale:this.placement.maxScale})}rectAt(n){const{anchor:e,booth:r,source:a,rotation:h}=this.placement,i=a.x*n,c=a.y*n,m=M({x:e.x+i/2,y:e.y+c/2},h,e);return new W(m,{x:i,y:c},h,r.elevation)}isHidden(){const{booth:n}=this.placement;return!!(n.layer&&!n.layer.visible)}}export function configBoothsBadges(t,n){const e=[],r=[],a=[];for(const i of n)if(i instanceof K&&st({hideExhibitorBoothNumber:w.hideExhibitorBoothNumber,hideBoothBadges:w.hideBoothBadges,hideLogoInBooth:L.hideLogoInBooth,noLabels:i.noLabels,hasExhibitors:i.exhibitors.length>0,hasLogoInBooth:i.exhibitors.some(c=>c.logoInBooth&&c.logo)})){const{bg:c,text:m,dispose:E}=createBoothBadge(i);e.push(c),r.push(m),a.push(E)}const h=()=>{a.forEach(i=>i()),a.length=0};return e.length?{layer:{name:`${t}${_}badges`,children:[{name:`${t}${_}badgeBgs`,children:e},{name:`${t}${_}badgeTexts`,children:r}]},cleanup:h}:{layer:null,cleanup:h}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__decorate as
|
|
1
|
+
import{__decorate as f}from"tslib";import{Rect as C}from"@expofp/geometry";import{update as B}from"@expofp/renderer";import s from"color";import S from"color-interpolate";import{computed as d}from"mobx";import m from"../../../../data";import{getFpSvgJs as y}from"../../../../data/fp-payloads";import{createShapeDef as k}from"../../../../engine/defs";import D,{boothStore as I,heatmapStore as L,layersStore as u,uiState as i}from"../../../../store";import{LayersMode as P}from"../../../../store/LayerStore";import l from"../../../../tools/settings";import{planReaction as g}from"../../../../utils/plan-reactions.js";import{getBoothStatusColor as v}from"./booth-fill-color.js";import{BoothDrawerBaseWithoutPainter as w}from"./BoothDrawerBase";import{buildPathDef as x}from"./config-bg";export default function A(h){return new n(h)}export function pathToShapeDef(h,o){const e=[];for(const t of h){const r=x({index:t.index,color:t.color,unblinking:t.unblinking},o);r&&e.push(r)}return e}class n extends w{constructor(o){if(super(o),o.paths){const e=pathToShapeDef(o.paths,D.layerStore.mode!==P.Default?o.layer.name:"");o.shapes=e.map(t=>{const r=i.monochrome?s(t.color).grayscale().rgb().string():this.getBoothColor().string();return t.color==="transparent"?t.color=r:t.defaultColor=t.color,t})}else{const e=o.borderColor==="none"?0:isNaN(o.borderWidth)?I.borderWidth:o.borderWidth,t=this.booth.rect.expand(-e/2),r=this.getBoothColor().string();o.shapes=[k(new C(t.center,t.size,this.booth.rotate,this.booth.elevation),r)]}g(()=>this.booth.hover,()=>!this.booth.selected&&this.update()),g(()=>[u.layersLoaded,this.booth.skipDim,this.booth.selected,this.boothShape.selectBgAnimationPart],()=>this.update())}getShape(){return this.booth.shapes}update(){if(u.layersLoaded)for(const o of this.booth.shapes){if(o.dim=this.booth.skipDim?0:void 0,o.color&&!o.unblinking){const e=o.defaultColor?this.getBoothPathColor(o.defaultColor):this.getBoothColor();o.color=e.string()}B(o)}}get poiHighlighted(){const o=this.booth;return!o.selected&&o.poiTypeId!=null&&o.skipDim}getBoothPathColor(o){if(i.heatmap)return this.getHeatmapColor();const e=this.booth,t=l.colors.booths.selected;let r=s(this.poiHighlighted?t:o).hsl();if(e.selected){if(y().__fpSettings?.fpVer){const c=this.selectedColorInterpolateFunc(this.boothShape.selectBgAnimationPart),p=s(c==="none"?t:c);return i.monochrome?p.grayscale():p}const a=s(t).hsl(),b=a.lightness()*this.boothShape.selectBgAnimationPart;r=r.hue(a.hue()).lightness(b)}else e.hover&&(r=r.darken(.1));return i.monochrome&&(r=r.grayscale()),r}getHeatmapColor(){const o=this.booth,e=L.getHeatmapColorForBooth(o);if(o.selected){const t=this.selectedColorInterpolateFunc(this.boothShape.selectBgAnimationPart);return s(t==="none"?"#f33":t)}return o.hover?e.darken(.2).alpha(e.alpha()*1.5):e}get defaultColor(){return v(this.booth)}get selectedColorInterpolateFunc(){const o=l.colors.booths.seectedLight||(s(this.booth.labelColor||l.boothLabelColor).isLight()?"#000":"#fff"),e=i.selectedRoute?l?.colors?.booths?.wayfinding?.selected:l?.colors?.booths?.selected;return S([o,e])}getBoothColor(){const o=this.booth;if(i.heatmap)return this.getHeatmapColor();let e;o.error?e="#f33":m.isRebooking?e=this.defaultColor:o.selected?e=this.selectedColorInterpolateFunc(this.boothShape.selectBgAnimationPart):this.poiHighlighted?e=l.colors.booths.selected:e=this.defaultColor;let t;try{t=s(e==="none"?"#f33":e)}catch{t=s(this.defaultColor)}return(o.hover&&!o.selected||o.selected&&m.isRebooking)&&(t=t.darken(.2).alpha(t.alpha()*1.5)),(i.monochrome||i.heatmapYah)&&(t=t.grayscale()),t}}f([d({keepAlive:!0})],n.prototype,"defaultColor",null),f([d({keepAlive:!0})],n.prototype,"selectedColorInterpolateFunc",null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Fragment as I,jsx as x,jsxs as M}from"react/jsx-runtime";import{Box as w}from"@expofp/geometry";import{CameraSchema as R,SessionsFiltersSchema as $}from"@expofp/schema";import{optimizeWaypointOrder as V}from"@expofp/wayfinding";import{ErrorBoundary as z}from"@sentry/react";import j from"debug";import{reaction as G,runInAction as N}from"mobx";import{createRoot as O}from"react-dom/client";import{install as q}from"resize-observer";import D from"./components/Layout";import{bindBoothHitTest as Y}from"./components/Map/booth-by-xy.js";import{MAX_ROUTE_WAYPOINTS as y}from"./constants";import H from"./data";import{getFpGeo as P}from"./data/fpGeo.js";import U from"./floorplan.loader";import{shouldLoadIntercom as W}from"./intercom";import{registerPlanDisposer as S}from"./plan-lifecycle.js";import{BoundsSchema as X,POISelectorsSchema as k,ZoomToOptionsSchema as v}from"./schemas/sdk.schemas";import{applyDeclarativeConfig as K,applyParameters as Q,applyPathway as Z,initUrlRouting as J}from"./services/url-dispatch";import r,{uiState as _}from"./store";import{bindDetailsEvents as ee}from"./store/details-events";import{bindRootElement as te}from"./store/init/init-ui.js";import{findBooth as b,Route as B,separateExternalIds as F}from"./store/RouteStore";import{GaEventActions as C,initGtag as re,sendEventToGa as L,setConsentSettings as oe}from"./tools/gtag.js";import ie from"./tools/track-event.js";import{cameraToMapSettings as se,mapSettingsToCamera as ne}from"./utils/camera-map-settings";import{getStorage as A}from"./utils/entity-storage";import{getMostFrequent as ae}from"./utils/getMostFrequent";import{convertLocalToGps as he,isValidPointCoords as g}from"./utils/gps";import{getLocales as le,hasLocale as ce,setLocale as ue}from"./utils/i18n";import{mapEntity as p}from"./utils/mapEntity";const d=j("efp:api");q();export default class fe extends U{init(){re(),K(),this.ignoreQuery||J(this.offHistory),ie("load"),te(r),r.fp=this,S(ee()),Y(),oe(this.consent),L(C.Load,""),this.root=O(this.renderTarget),this.root.render(x(z,{children:x(D,{offHistory:this.offHistory,consent:this.consent})})),L(C.Rendered,""),S(G(()=>r.layerStore.layersLoaded,()=>{const t=this.renderTarget.getRootNode(),o=t instanceof ShadowRoot?t.host:this.renderTarget.parentElement;for(document.querySelectorAll(".expofp-floorplan-loader").forEach(s=>s.remove());o&&this.element.firstChild&&this.element.firstChild!==o;)this.element.removeChild(this.element.firstChild);this.resolveReady(),r.initialized||this.onInit?.(this),r.initialized=!0})),S(()=>clearTimeout(E));const e=W(H);e&&import("./intercom/bootIntercom").then(({bootIntercom:t})=>t(e)).catch(()=>{})}selectBooth(e){if(typeof e!="string"&&!Array.isArray(e)){a("selectBooth","Parameter must be a string or an array of strings.","EFP000000");return}const t=r.boothStore.booths.filter(o=>typeof e=="string"?o.name===e||o.externalId===e:e.includes(o.name)||e.includes(o.externalId));r.selectBooth(t)}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){r.uiState.menu=!1,r.searchStore.resetSearchBox(),r.uiState.details=null;return}const t=r.exhibitorStore.exhibitors.filter(i=>typeof e=="string"?i.name===e||i.externalId===e:e.includes(i.name)||e.includes(i.externalId));if(!t?.length)return;if(typeof e=="string"){r.selectExhibitor(t[0]),r.moveToList([t[0]]);return}const o=t.flatMap(i=>i.booths.map(n=>n.layer)),s=ae(o.map(i=>i.description));s&&r.layerStore.updateVisibility(s,!0),r.uiState.menu=!1,r.searchStore.resetSearchBox(),r.uiState.details=null,r.uiState.list={type:"filter",items:t,query:{key:"exhibitors",value:t.map(i=>i.name).join(",")}},r.moveToList()}highlightExhibitors(e){Array.isArray(e)||a("highlightExhibitors","Parameter must be an array of strings.","EFP000200"),r.boothStore.highlightedByExternalIds=[],r.exhibitorStore.highlightedByExternalIds=[...e]}highlightBooths(e){Array.isArray(e)||a("highlightBooths","Parameter must be an array of strings.","EFP000300"),r.exhibitorStore.highlightedByExternalIds=[],r.boothStore.highlightedByExternalIds=[...e]}highlightEntities(e){Array.isArray(e)||a("highlightEntities","Parameter must be an array of strings.","EFP000400");const{boothExternalIds:t,exhibitorExternalIds:o}=F(e);r.boothStore.highlightedByExternalIds=[...t],r.exhibitorStore.highlightedByExternalIds=[...o]}selectRoute(e,t){if(Array.isArray(e)){const o=[...e],s=o.shift(),i=o.pop();if(o.length>y)throw new Error(`The maximum number of waypoints is ${y}.`);if(!s||!i){a("selectRoute","Invalid route format: When providing an array, it must include at least two points: a start and a destination.","EFP000401");return}const n=o.map(m).filter(h=>h!==null);r.routeStore.selectRoute(new B(m(s),m(i),n));return}e||a("selectRoute","At a minimum, the starting point must be passed.","EFP000402"),r.routeStore.selectRoute(new B(m(e),t?m(t):null))}getOptimizedRoutes(e){if(!Array.isArray(e))return a("getOptimizedRoutes","Parameter must be an array.","EFP000500"),[];if(e.length>y)throw new Error(`The maximum number of waypoints is ${y}.`);const t=e.map(m).filter(s=>!!s);if(!t.length)throw new Error("No booths found for the provided waypoints.");const o=new Map;for(const s of t){const i=s.layer?.name??"",n=o.get(i);n?n.push(s):o.set(i,[s])}return Array.from(o.values()).map(s=>({waypoints:V(s.map(i=>[i.name,{x:i.rect.center.x,y:i.rect.center.y}]))}))}selectCurrentPosition(e,t,o){const s=g(e.x)&&g(e.y),i=g(e.lng)&&g(e.lat);!s&&!i&&a("selectCurrentPosition","A point must be passed. Either (x,y) or (lat,lng) are required.","EFP000600"),r.routeStore.selectCurrentPosition(e,t,o),this.onCurrentPositionChanged?.(e)}setBookmarks(e){(!Array.isArray(e)||!e.length)&&a("setBookmarks","Parameter must be an array.","EFP000700"),e.forEach(t=>{const o=r.exhibitorStore.exhibitors.find(s=>s.name===t.name||s.externalId===t.externalId);o&&(o.bookmarked=t.bookmarked)})}setEntitiesBookmarks(e){if(!Array.isArray(e)||!e.length){a("setEntitiesBookmarks","Parameter must be an array.","EFP000701");return}const t=["exhibitor","event","speaker","booth"],o=e.find(n=>!n.type||!t.includes(n.type));if(o){a("setEntitiesBookmarks",`Invalid entity type: ${o.type}. Must be one of: ${t.join(", ")}.`,"EFP000702");return}const s=A("bookmarked"),i={exhibitor:{existingIds:new Set(s.exhibitors||[]),finder:n=>r.exhibitorStore.findExhibitor(n),replacer:n=>r.exhibitorStore.replaceBookmarked(n)},event:{existingIds:new Set(s.events||[]),finder:n=>r.eventStore.findByNameOrSlug(n),replacer:n=>r.eventStore.replaceBookmarked(n)},speaker:{existingIds:new Set(s.speakers||[]),finder:n=>r.speakerStore.speakers.find(h=>h.name===n||h.externalId===n||h.slug===n),replacer:n=>r.speakerStore.replaceBookmarked(n)},booth:{existingIds:new Set(s.booths||[]),finder:n=>{const h=r.boothStore.findBooth(n);return h?.exhibitors.length===0?h:void 0},replacer:n=>r.boothStore.replaceBookmarked(n)}};e.forEach(n=>{const h=i[n.type],u=n.name||n.externalId||"",l=h.finder(u);l?n.bookmarked?h.existingIds.add(l.id):h.existingIds.delete(l.id):console.warn(`Entity not found: ${n.type} with query "${u}"`)}),Object.values(i).forEach(n=>{n.replacer(Array.from(n.existingIds))})}setEntitiesVisited(e){if(!Array.isArray(e)||!e.length){a("setEntitiesVisited","Parameter must be an array.","EFP000703");return}const t=["exhibitor","event"],o=e.find(n=>!n.type||!t.includes(n.type));if(o){a("setEntitiesVisited",`Invalid entity type: ${o.type}. Must be one of: ${t.join(", ")}.`,"EFP000704");return}const s=A("visited"),i={exhibitor:{existingIds:new Set(s.exhibitors||[]),finder:n=>r.exhibitorStore.findExhibitor(n),replacer:n=>r.exhibitorStore.replaceVisited(n)},event:{existingIds:new Set(s.events||[]),finder:n=>r.eventStore.findByNameOrSlug(n),replacer:n=>r.eventStore.replaceVisited(n)}};e.forEach(n=>{const h=i[n.type],u=n.name||n.externalId||"",l=h.finder(u);l?n.visited?h.existingIds.add(l.id):h.existingIds.delete(l.id):console.warn(`Entity not found: ${n.type} with query "${u}"`)}),Object.values(i).forEach(n=>{n.replacer(Array.from(n.existingIds))})}setMarkers(e){if(!e||!Array.isArray(e.icons)||!Array.isArray(e.markers)){a("setMarkers","Invalid input.","EFP000800");return}r.routeStore.setMarkers(e)}selectMarker(e,t=!0){return typeof e!="string"&&a("selectMarker","The identifier must be passed.","EFP000900"),r.routeStore.selectMarker(e,t)}drawCircles(e){Array.isArray(e)||a("drawCircles","Invalid input.","EFP000A00"),r.uiState.debugCircles=e}checkRoutes(){r.routeStore.checkRoutes()}updateLayerVisibility(e,t){typeof e!="string"&&a("updateLayerVisibility","The layer name (string) must be passed.","EFP000B00"),t||a("updateLayerVisibility","Passing a false value to visible will have no effect.","EFP000B01"),r.layerStore.updateVisibility(e,t)}getCenterCoordinates(){return r.fp.getCenterCoordinates()}exhibitorsList(){return r.exhibitorStore.exhibitors.map(e=>p(e))}boothsList(){return r.boothStore.booths.map(e=>p(e))}categoriesList(){return r.categoryStore.categories.map(e=>p(e))}selectCategory(e){if(e==null||typeof e!="string"){r.searchStore.selectSearch();return}const t=e?.toLowerCase(),o=r.categoryStore.categories.find(({name:s,slug:i})=>s?.toLowerCase()===t||i?.toLowerCase()===t);if(!o){a("selectCategory",`Category ${e} not found.`,"EFP000C01");return}r.selectCategory(o)}select(e){if(typeof e!="string"){a("select","Parameter must be a string.","EFP001700");return}const t=e,o=t?.toLowerCase(),s=r.boothStore.booths.find(l=>l.slug?.toLowerCase()===o||l.externalId?.toLowerCase()===o||l.externalId?.toLowerCase()?.replace(/\s+/g,"")===o);if(s){setTimeout(()=>r.selectBooth(s),250);return}const i=r.eventStore.eventItems.find(l=>l.slug?.toLowerCase()===o||l.externalId?.toLowerCase()===o);if(i){r.selectEventItem(i,!0);return}const n=r.exhibitorStore.exhibitors.find(l=>l.slug?.toLowerCase()===o||l.externalId?.toLowerCase()===o);if(n){setTimeout(()=>r.clickExhibitor(n),250);return}const h=r.categoryStore.categories.find(l=>l.slug===t);if(h){r.selectCategory(h);return}const u=r.speakerStore.findBySlug(t);if(u){r.selectSpeaker(u,!0);return}t.includes("heatmap=true")||r.searchStore.selectSearch(t)}showList(e){const t={bookmarks:()=>r.selectBookmarks(),visited:()=>r.selectVisited(),sessions:()=>r.selectSessions(),exhibitors:()=>r.selectExhibitors(),speakers:()=>r.selectSpeakers(),tours:()=>r.selectTours(),language:()=>r.selectLanguage()},o=t[e];if(!o){a("showList",`Unknown list "${e}". Must be one of: ${Object.keys(t).join(", ")}.`,"EFP001800");return}o()}showSessions(e={}){d("showSessions called with filters=%O",e);const t=$.safeParse(e);if(!t.success){a("showSessions",t.error.message,"EFP001C00");return}const o=t.data,{eventStore:s,sessionsFilterStore:i}=r;N(()=>{_.details=null,r.selectSessions(),i.closeFilter(),i.setPending("selectedTracks",T(o.tracks,s.tracks,"track")),i.setPending("selectedVenues",T(o.venues,s.venues,"venue")),i.setPending("date",o.date??"all"),i.setPending("timeOfDay",o.time??"all"),i.setPending("showBookmarksOnly",o.bookmarked??!1),i.setPending("showLiveOnly",o.live??!1),i.commitFilters()})}selectTour(e){if(typeof e!="string"||!e){a("selectTour","A tour id must be passed.","EFP001900");return}const t=r.toursStore.getTourById(e);t?r.toursStore.launchTour(t,t.name,t.description):(console.warn(`Route with id "${e}" not found`),r.selectTours())}openPlanner(e={}){if(typeof e!="object"||e===null){a("openPlanner","An options object must be passed.","EFP001A00");return}const t=e.from?b(e.from):null;e.fromBookmarks?r.routePlannerStore.launchFromBookmarks(t??void 0):r.routePlannerStore.launchFromSlugs(e.items??[],t??void 0)}startBuildRoute(){r.uiState.startBuildRoute()}applyParameters(e){typeof e!="string"&&a("applyParameters","A query string must be passed.","EFP000D00"),Q(e)}getVisibility(){return r.uiState.visibility}setVisibility(e){(typeof e!="object"||!Object.keys(e).length)&&a("setVisibility","The parameter must be passed.","EFP000E00"),r.uiState.setVisibility(e)}findLocation(){r.routeStore.findLocation()}zoomIn(){r.uiState.zoomIn()}zoomOut(){r.uiState.zoomOut()}switchView(){r.maplibreStore.activateMaplibre()}setCamera(e){d("setCamera called with camera=%O",e);const t=R.safeParse(e);if(!t.success){a("setCamera",t.error.message,"EFP001B00");return}r.uiState.setMapSettings(se(t.data))}getCamera(){return ne(r.uiState.mapSettings)}zoomTo(e,t){d("zoomTo called with selectors=%O options=%O",e,t);const o=k.safeParse(e);if(!o.success){a("zoomTo",o.error.message,"EFP001600");return}const s=v.safeParse(t);if(!s.success){a("zoomTo",s.error.message,"EFP001601");return}const i=this.getBounds(e);i&&this.fitBounds(i,t)}getBounds(e){d("getBounds called with selectors=%O",e);const t=k.safeParse(e);if(!t.success){a("getBounds",t.error.message,"EFP001400");return}const o=[];if(e.booths?.forEach(i=>{let n;i.externalId?n=r.boothStore.boothByExternalId.get(i.externalId):i.name&&(n=r.boothStore.boothByName.get(i.name.toLowerCase())),n?.rect&&o.push(n.rect)}),e.exhibitors?.forEach(i=>{let n;i.externalId?n=r.exhibitorStore.exhibitorByExternalId.get(i.externalId):i.name&&(n=r.exhibitorStore.exhibitorByName.get(i.name.toLowerCase())),n?.booths?.forEach(h=>{h.rect&&o.push(h.rect)})}),o.length===0)return;const s=w.fromUnion(...o);return{leftTop:{x:s.min.x,y:s.min.y},rightBottom:{x:s.max.x,y:s.max.y}}}fitBounds(e,t){if(d("fitBounds called with bounds=%O options=%O",e,t),!e){r.uiState.fitBounds();return}const o=X.safeParse(e);if(!o.success){a("fitBounds",o.error.message,"EFP001500");return}const s=v.safeParse(t);if(!s.success){a("fitBounds",s.error.message,"EFP001501");return}const i=w.fromMinMax({x:e.leftTop.x,y:e.leftTop.y},{x:e.rightBottom.x,y:e.rightBottom.y});r.uiState.moveToRect=t?.padding?i.expand(t.padding):i}getBoothRect(e){typeof e!="string"&&a("getBoothRect","A booth name must be passed.","EFP000F00");const t=b(e)?.rect;return t?c.fromBox(t):void 0}convertToGeo(e,t){const o=P()?.properties?.config;if(!o){a("convertToGeo","The coordinates cannot be converted because the GPS configuration is not defined.","EFP001000");return}if(!e||!t){a("convertToGeo","Both coordinates must be passed.","EFP001001");return}return he(e,t,o)}getGeoConfig(){const e=P()?.properties?.config;return e?{bearing:e.bearing??0,p0:e.p0,p1:e.p1,p2:e.p2}:null}releaseResources(){r.maplibreStore.dispose(),this.root?.unmount(),super.releaseResources()}search(e){return typeof e!="string"&&a("search","A search string must be passed.","EFP001100"),r.fuzzySearchEngineStore.loadEngine().then(()=>(r.searchStore.selectSearch(e),r.uiState.fuzzySearchItems.map(t=>({item:p(t.item),score:t.score}))))}getFloors(){return r.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 t=this.getFloors();if(e.name){const o=t.find(s=>s.name===e.name||s.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=t.find(i=>i.index===e.index),s=o?.name;if(!s){a("activateFloor",`Floor at index ${e.index} does not exist.`,"EFP001203");return}if(o.active)return;this.updateLayerVisibility(s,!0);return}}showPathway(e,t){const{boothExternalIds:o,exhibitorExternalIds:s}=t?.length?F(t):{boothExternalIds:[],exhibitorExternalIds:[]};Z({pathwayId:e,boothIds:o,exhibitorIds:s})}showPathwayOnly(e,t){this.activateFloor({name:t}),r.layerStore.showPathWay(e),r.uiState.setPathwayOnlyMode(!0);const o=r.layerStore.findLayer(e),s=r.layerStore.findLayer(t),i=o?.rect||o?.viewbox?o:s,n=i?.viewbox??i?.rect;n&&(r.uiState.moveToRect=n.clone())}hidePathways(){this.highlightBooths([]),r.layerStore.hidePathways(),r.uiState.setPathwayOnlyMode(!1)}showSearch(){r.selectSearch("")}changeLanguage(e){const t=e?.toLowerCase?.();if(!ce(t)){a("changeLanguage",`Language "${e}" was not found. Available languages: ${le().map(o=>o.id).join(",")}`,"EFP001300");return}ue(t)}isGpsTrackingEnabled(){return r.routeStore.gpsEnabled}setGpsTrackingEnabled(e){r.routeStore.setGpsTrackingEnabled(e)}deselectCurrentPosition(){r.routeStore.selectCurrentPosition(null,!1)}deselectRoute(){r.routeStore.selectRoute(null),r.routeStore.setOnlyAccessible(!1)}reset(){this.selectBooth(""),this.selectExhibitor(""),this.selectCategory(),this.deselectCurrentPosition(),this.deselectRoute(),this.highlightEntities([]),r.uiState.kioskData&&r.resetCameraFn?r.resetCameraFn?.():this.fitBounds()}selectAccessibleRoute(e){r.routeStore.setOnlyAccessible(!0),this.selectRoute(e)}}function T(f=[],e,t){const o=new Set;for(const s of f){const i=s.toLowerCase(),n=e.find(h=>String(h.id)===s)??e.find(h=>h.externalId?.toLowerCase()===i)??e.find(h=>h.name?.toLowerCase()===i||h.slug?.toLowerCase()===i);n?o.add(n.id):console.warn(`Entity not found: ${t} with query "${s}"`)}return[...o]}function m(f){return(typeof f=="string"?b(f):r.routeStore.getNearestBooth(f))??null}let E=0;function a(f,e,t){const o=`Error calling "${f}" SDK method.`,s=`${e.endsWith(".")?e:e+"."} More information at`;let i="https://js-sdk.expofp.com/api/packages";if(t&&(i+=`#error-${t}`),console.error(`${o} ${s} ${i}`),r.fp.disableRuntimeAlerts)return;r.uiState.setGlobalErrorMessage({title:o,body:M(I,{children:[s," ",x("a",{href:i,target:"_blank",rel:"noreferrer",children:i})]})}),clearTimeout(E);const n=8e3;E=window.setTimeout(()=>{const h=async()=>{r.uiState.globalErrorMessages.length>0&&(r.uiState.popGlobalErrorMessage(),await new Promise(u=>setTimeout(u,n/2)),h())};h()},n)}class c{get h(){return Math.abs(this.y2-this.y1)}get w(){return Math.abs(this.x2-this.x1)}get cx(){return(this.x1+this.x2)/2}get cy(){return(this.y1+this.y2)/2}constructor(e,t,o,s){if(e>o){const i=e;e=o,o=i}if(t>s){const i=t;t=s,s=i}this.x1=e,this.y1=t,this.x2=o,this.y2=s}static fromBox(e){return new c(e.min.x,e.min.y,e.max.x,e.max.y)}static fromCxcywh(e,t,o,s){return new c(e-o/2,t-s/2,e+o/2,t+s/2)}contains(e){return e.x1>=this.x1&&e.x2<=this.x2&&e.y1>=this.y1&&e.y2<=this.y2}intersects(e){const t=Math.max(this.x1,e.x1),o=Math.min(this.x2,e.x2),s=Math.max(this.y1,e.y1),i=Math.min(this.y2,e.y2);return o>=t&&i>=s}getIntersection(e){const t=Math.max(this.x1,e.x1),o=Math.min(this.x2,e.x2),s=Math.max(this.y1,e.y1),i=Math.min(this.y2,e.y2);return o>=t&&i>=s?new c(t,s,o,i):new c(0,0,0,0)}getRotated90(){return c.fromCxcywh(this.cx,this.cy,this.h,this.w)}normalize(e,t){return new c(this.x1/e,this.y1/t,this.x2/e,this.y2/t)}withPadding(e,t=e){return this.w<e*2||this.h<t*2?this:c.fromCxcywh(this.cx,this.cy,this.w-e*2,this.h-t*2)}scale(e){return new c(this.x1*e,this.y1*e,this.x2*e,this.y2*e)}getArea(){return this.w*this.h}clone(){return new c(this.x1,this.y1,this.x2,this.y2)}translate(e,t){return this.x1+=e,this.x2+=e,this.y1+=t,this.y2+=t,this}equals(e){return e.x1===this.x1&&e.x2===this.x2&&e.y1===this.y1&&e.y2===this.y2}toString(){return this.x1+","+this.y1+","+this.w+","+this.h}containsPoint(e,t){return e>=this.x1&&e<=this.x2&&t>=this.y1&&t<=this.y2}}
|
|
1
|
+
import{Fragment as I,jsx as x,jsxs as M}from"react/jsx-runtime";import{Box as w}from"@expofp/geometry";import{CameraSchema as R,SessionsFiltersSchema as $}from"@expofp/schema";import{optimizeWaypointOrder as V}from"@expofp/wayfinding";import{ErrorBoundary as z}from"@sentry/react";import j from"debug";import{reaction as G,runInAction as N}from"mobx";import{createRoot as O}from"react-dom/client";import{install as q}from"resize-observer";import D from"./components/Layout";import{bindBoothHitTest as Y}from"./components/Map/booth-by-xy.js";import{MAX_ROUTE_WAYPOINTS as y}from"./constants";import H from"./data";import{getFpGeo as P}from"./data/fpGeo.js";import U from"./floorplan.loader";import{shouldLoadIntercom as W}from"./intercom";import{registerPlanDisposer as S}from"./plan-lifecycle.js";import{BoundsSchema as X,POISelectorsSchema as v,ZoomToOptionsSchema as k}from"./schemas/sdk.schemas";import{applyDeclarativeConfig as K,applyParameters as Q,applyPathway as Z,initUrlRouting as J}from"./services/url-dispatch";import r,{uiState as _}from"./store";import{bindDetailsEvents as ee}from"./store/details-events";import{bindRootElement as te}from"./store/init/init-ui.js";import{findBooth as b,Route as B,separateExternalIds as F}from"./store/RouteStore";import{GaEventActions as C,initGtag as re,sendEventToGa as L,setConsentSettings as oe}from"./tools/gtag.js";import ie from"./tools/track-event.js";import{cameraToMapSettings as se,mapSettingsToCamera as ne}from"./utils/camera-map-settings";import{getStorage as A}from"./utils/entity-storage";import{getMostFrequent as ae}from"./utils/getMostFrequent";import{convertLocalToGps as he,isCoordinate as g}from"./utils/gps";import{getLocales as le,hasLocale as ce,setLocale as ue}from"./utils/i18n";import{mapEntity as p}from"./utils/mapEntity";const d=j("efp:api");q();export default class fe extends U{init(){re(),K(),this.ignoreQuery||J(this.offHistory),ie("load"),te(r),r.fp=this,S(ee()),Y(),oe(this.consent),L(C.Load,""),this.root=O(this.renderTarget),this.root.render(x(z,{children:x(D,{offHistory:this.offHistory,consent:this.consent})})),L(C.Rendered,""),S(G(()=>r.layerStore.layersLoaded,()=>{const t=this.renderTarget.getRootNode(),o=t instanceof ShadowRoot?t.host:this.renderTarget.parentElement;for(document.querySelectorAll(".expofp-floorplan-loader").forEach(s=>s.remove());o&&this.element.firstChild&&this.element.firstChild!==o;)this.element.removeChild(this.element.firstChild);this.resolveReady(),r.initialized||this.onInit?.(this),r.initialized=!0})),S(()=>clearTimeout(E));const e=W(H);e&&import("./intercom/bootIntercom").then(({bootIntercom:t})=>t(e)).catch(()=>{})}selectBooth(e){if(typeof e!="string"&&!Array.isArray(e)){a("selectBooth","Parameter must be a string or an array of strings.","EFP000000");return}const t=r.boothStore.booths.filter(o=>typeof e=="string"?o.name===e||o.externalId===e:e.includes(o.name)||e.includes(o.externalId));r.selectBooth(t)}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){r.uiState.menu=!1,r.searchStore.resetSearchBox(),r.uiState.details=null;return}const t=r.exhibitorStore.exhibitors.filter(i=>typeof e=="string"?i.name===e||i.externalId===e:e.includes(i.name)||e.includes(i.externalId));if(!t?.length)return;if(typeof e=="string"){r.selectExhibitor(t[0]),r.moveToList([t[0]]);return}const o=t.flatMap(i=>i.booths.map(n=>n.layer)),s=ae(o.map(i=>i.description));s&&r.layerStore.updateVisibility(s,!0),r.uiState.menu=!1,r.searchStore.resetSearchBox(),r.uiState.details=null,r.uiState.list={type:"filter",items:t,query:{key:"exhibitors",value:t.map(i=>i.name).join(",")}},r.moveToList()}highlightExhibitors(e){if(!Array.isArray(e)){a("highlightExhibitors","Parameter must be an array of strings.","EFP000200");return}r.boothStore.highlightedByExternalIds=[],r.exhibitorStore.highlightedByExternalIds=[...e]}highlightBooths(e){if(!Array.isArray(e)){a("highlightBooths","Parameter must be an array of strings.","EFP000300");return}r.exhibitorStore.highlightedByExternalIds=[],r.boothStore.highlightedByExternalIds=[...e]}highlightEntities(e){if(!Array.isArray(e)){a("highlightEntities","Parameter must be an array of strings.","EFP000400");return}const{boothExternalIds:t,exhibitorExternalIds:o}=F(e);r.boothStore.highlightedByExternalIds=[...t],r.exhibitorStore.highlightedByExternalIds=[...o]}selectRoute(e,t){if(Array.isArray(e)){const o=[...e],s=o.shift(),i=o.pop();if(o.length>y)throw new Error(`The maximum number of waypoints is ${y}.`);if(!s||!i){a("selectRoute","Invalid route format: When providing an array, it must include at least two points: a start and a destination.","EFP000401");return}const n=o.map(m).filter(h=>h!==null);r.routeStore.selectRoute(new B(m(s),m(i),n));return}e||a("selectRoute","At a minimum, the starting point must be passed.","EFP000402"),r.routeStore.selectRoute(new B(m(e),t?m(t):null))}getOptimizedRoutes(e){if(!Array.isArray(e))return a("getOptimizedRoutes","Parameter must be an array.","EFP000500"),[];if(e.length>y)throw new Error(`The maximum number of waypoints is ${y}.`);const t=e.map(m).filter(s=>!!s);if(!t.length)throw new Error("No booths found for the provided waypoints.");const o=new Map;for(const s of t){const i=s.layer?.name??"",n=o.get(i);n?n.push(s):o.set(i,[s])}return Array.from(o.values()).map(s=>({waypoints:V(s.map(i=>[i.name,{x:i.rect.center.x,y:i.rect.center.y}]))}))}selectCurrentPosition(e,t,o){const s=g(e.x)&&g(e.y),i=g(e.lng)&&g(e.lat);if(!s&&!i){a("selectCurrentPosition","A point must be passed. Either (x,y) or (lat,lng) are required.","EFP000600");return}r.routeStore.selectCurrentPosition(e,t,o),this.onCurrentPositionChanged?.(e)}setBookmarks(e){if(!Array.isArray(e)||!e.length){a("setBookmarks","Parameter must be an array.","EFP000700");return}e.forEach(t=>{const o=r.exhibitorStore.exhibitors.find(s=>s.name===t.name||s.externalId===t.externalId);o&&(o.bookmarked=t.bookmarked)})}setEntitiesBookmarks(e){if(!Array.isArray(e)||!e.length){a("setEntitiesBookmarks","Parameter must be an array.","EFP000701");return}const t=["exhibitor","event","speaker","booth"],o=e.find(n=>!n.type||!t.includes(n.type));if(o){a("setEntitiesBookmarks",`Invalid entity type: ${o.type}. Must be one of: ${t.join(", ")}.`,"EFP000702");return}const s=A("bookmarked"),i={exhibitor:{existingIds:new Set(s.exhibitors||[]),finder:n=>r.exhibitorStore.findExhibitor(n),replacer:n=>r.exhibitorStore.replaceBookmarked(n)},event:{existingIds:new Set(s.events||[]),finder:n=>r.eventStore.findByNameOrSlug(n),replacer:n=>r.eventStore.replaceBookmarked(n)},speaker:{existingIds:new Set(s.speakers||[]),finder:n=>r.speakerStore.speakers.find(h=>h.name===n||h.externalId===n||h.slug===n),replacer:n=>r.speakerStore.replaceBookmarked(n)},booth:{existingIds:new Set(s.booths||[]),finder:n=>{const h=r.boothStore.findBooth(n);return h?.exhibitors.length===0?h:void 0},replacer:n=>r.boothStore.replaceBookmarked(n)}};e.forEach(n=>{const h=i[n.type],u=n.name||n.externalId||"",l=h.finder(u);l?n.bookmarked?h.existingIds.add(l.id):h.existingIds.delete(l.id):console.warn(`Entity not found: ${n.type} with query "${u}"`)}),Object.values(i).forEach(n=>{n.replacer(Array.from(n.existingIds))})}setEntitiesVisited(e){if(!Array.isArray(e)||!e.length){a("setEntitiesVisited","Parameter must be an array.","EFP000703");return}const t=["exhibitor","event"],o=e.find(n=>!n.type||!t.includes(n.type));if(o){a("setEntitiesVisited",`Invalid entity type: ${o.type}. Must be one of: ${t.join(", ")}.`,"EFP000704");return}const s=A("visited"),i={exhibitor:{existingIds:new Set(s.exhibitors||[]),finder:n=>r.exhibitorStore.findExhibitor(n),replacer:n=>r.exhibitorStore.replaceVisited(n)},event:{existingIds:new Set(s.events||[]),finder:n=>r.eventStore.findByNameOrSlug(n),replacer:n=>r.eventStore.replaceVisited(n)}};e.forEach(n=>{const h=i[n.type],u=n.name||n.externalId||"",l=h.finder(u);l?n.visited?h.existingIds.add(l.id):h.existingIds.delete(l.id):console.warn(`Entity not found: ${n.type} with query "${u}"`)}),Object.values(i).forEach(n=>{n.replacer(Array.from(n.existingIds))})}setMarkers(e){if(!e||!Array.isArray(e.icons)||!Array.isArray(e.markers)){a("setMarkers","Invalid input.","EFP000800");return}r.routeStore.setMarkers(e)}selectMarker(e,t=!0){return typeof e!="string"&&a("selectMarker","The identifier must be passed.","EFP000900"),r.routeStore.selectMarker(e,t)}drawCircles(e){if(!Array.isArray(e)){a("drawCircles","Invalid input.","EFP000A00");return}r.uiState.debugCircles=e}checkRoutes(){r.routeStore.checkRoutes()}updateLayerVisibility(e,t){typeof e!="string"&&a("updateLayerVisibility","The layer name (string) must be passed.","EFP000B00"),t||a("updateLayerVisibility","Passing a false value to visible will have no effect.","EFP000B01"),r.layerStore.updateVisibility(e,t)}getCenterCoordinates(){return r.fp.getCenterCoordinates()}exhibitorsList(){return r.exhibitorStore.exhibitors.map(e=>p(e))}boothsList(){return r.boothStore.booths.map(e=>p(e))}categoriesList(){return r.categoryStore.categories.map(e=>p(e))}selectCategory(e){if(e==null||typeof e!="string"){r.searchStore.selectSearch();return}const t=e?.toLowerCase(),o=r.categoryStore.categories.find(({name:s,slug:i})=>s?.toLowerCase()===t||i?.toLowerCase()===t);if(!o){a("selectCategory",`Category ${e} not found.`,"EFP000C01");return}r.selectCategory(o)}select(e){if(typeof e!="string"){a("select","Parameter must be a string.","EFP001700");return}const t=e,o=t?.toLowerCase(),s=r.boothStore.booths.find(l=>l.slug?.toLowerCase()===o||l.externalId?.toLowerCase()===o||l.externalId?.toLowerCase()?.replace(/\s+/g,"")===o);if(s){setTimeout(()=>r.selectBooth(s),250);return}const i=r.eventStore.eventItems.find(l=>l.slug?.toLowerCase()===o||l.externalId?.toLowerCase()===o);if(i){r.selectEventItem(i,!0);return}const n=r.exhibitorStore.exhibitors.find(l=>l.slug?.toLowerCase()===o||l.externalId?.toLowerCase()===o);if(n){setTimeout(()=>r.clickExhibitor(n),250);return}const h=r.categoryStore.categories.find(l=>l.slug===t);if(h){r.selectCategory(h);return}const u=r.speakerStore.findBySlug(t);if(u){r.selectSpeaker(u,!0);return}t.includes("heatmap=true")||r.searchStore.selectSearch(t)}showList(e){const t={bookmarks:()=>r.selectBookmarks(),visited:()=>r.selectVisited(),sessions:()=>r.selectSessions(),exhibitors:()=>r.selectExhibitors(),speakers:()=>r.selectSpeakers(),tours:()=>r.selectTours(),language:()=>r.selectLanguage()},o=t[e];if(!o){a("showList",`Unknown list "${e}". Must be one of: ${Object.keys(t).join(", ")}.`,"EFP001800");return}o()}showSessions(e={}){d("showSessions called with filters=%O",e);const t=$.safeParse(e);if(!t.success){a("showSessions",t.error.message,"EFP001C00");return}const o=t.data,{eventStore:s,sessionsFilterStore:i}=r;N(()=>{_.details=null,r.selectSessions(),i.closeFilter(),i.setPending("selectedTracks",T(o.tracks,s.tracks,"track")),i.setPending("selectedVenues",T(o.venues,s.venues,"venue")),i.setPending("date",o.date??"all"),i.setPending("timeOfDay",o.time??"all"),i.setPending("showBookmarksOnly",o.bookmarked??!1),i.setPending("showLiveOnly",o.live??!1),i.commitFilters()})}selectTour(e){if(typeof e!="string"||!e){a("selectTour","A tour id must be passed.","EFP001900");return}const t=r.toursStore.getTourById(e);t?r.toursStore.launchTour(t,t.name,t.description):(console.warn(`Route with id "${e}" not found`),r.selectTours())}openPlanner(e={}){if(typeof e!="object"||e===null){a("openPlanner","An options object must be passed.","EFP001A00");return}const t=e.from?b(e.from):null;e.fromBookmarks?r.routePlannerStore.launchFromBookmarks(t??void 0):r.routePlannerStore.launchFromSlugs(e.items??[],t??void 0)}startBuildRoute(){r.uiState.startBuildRoute()}applyParameters(e){typeof e!="string"&&a("applyParameters","A query string must be passed.","EFP000D00"),Q(e)}getVisibility(){return r.uiState.visibility}setVisibility(e){(typeof e!="object"||!Object.keys(e).length)&&a("setVisibility","The parameter must be passed.","EFP000E00"),r.uiState.setVisibility(e)}findLocation(){r.routeStore.findLocation()}zoomIn(){r.uiState.zoomIn()}zoomOut(){r.uiState.zoomOut()}switchView(){r.maplibreStore.activateMaplibre()}setCamera(e){d("setCamera called with camera=%O",e);const t=R.safeParse(e);if(!t.success){a("setCamera",t.error.message,"EFP001B00");return}r.uiState.setMapSettings(se(t.data))}getCamera(){return ne(r.uiState.mapSettings)}zoomTo(e,t){d("zoomTo called with selectors=%O options=%O",e,t);const o=v.safeParse(e);if(!o.success){a("zoomTo",o.error.message,"EFP001600");return}const s=k.safeParse(t);if(!s.success){a("zoomTo",s.error.message,"EFP001601");return}const i=this.getBounds(e);i&&this.fitBounds(i,t)}getBounds(e){d("getBounds called with selectors=%O",e);const t=v.safeParse(e);if(!t.success){a("getBounds",t.error.message,"EFP001400");return}const o=[];if(e.booths?.forEach(i=>{let n;i.externalId?n=r.boothStore.boothByExternalId.get(i.externalId):i.name&&(n=r.boothStore.boothByName.get(i.name.toLowerCase())),n?.rect&&o.push(n.rect)}),e.exhibitors?.forEach(i=>{let n;i.externalId?n=r.exhibitorStore.exhibitorByExternalId.get(i.externalId):i.name&&(n=r.exhibitorStore.exhibitorByName.get(i.name.toLowerCase())),n?.booths?.forEach(h=>{h.rect&&o.push(h.rect)})}),o.length===0)return;const s=w.fromUnion(...o);return{leftTop:{x:s.min.x,y:s.min.y},rightBottom:{x:s.max.x,y:s.max.y}}}fitBounds(e,t){if(d("fitBounds called with bounds=%O options=%O",e,t),!e){r.uiState.fitBounds();return}const o=X.safeParse(e);if(!o.success){a("fitBounds",o.error.message,"EFP001500");return}const s=k.safeParse(t);if(!s.success){a("fitBounds",s.error.message,"EFP001501");return}const i=w.fromMinMax({x:e.leftTop.x,y:e.leftTop.y},{x:e.rightBottom.x,y:e.rightBottom.y});r.uiState.moveToRect=t?.padding?i.expand(t.padding):i}getBoothRect(e){if(typeof e!="string"){a("getBoothRect","A booth name must be passed.","EFP000F00");return}const t=b(e)?.rect;return t?c.fromBox(t):void 0}convertToGeo(e,t){const o=P()?.properties?.config;if(!o){a("convertToGeo","The coordinates cannot be converted because the GPS configuration is not defined.","EFP001000");return}if(!e||!t){a("convertToGeo","Both coordinates must be passed.","EFP001001");return}return he(e,t,o)}getGeoConfig(){const e=P()?.properties?.config;return e?{bearing:e.bearing??0,p0:e.p0,p1:e.p1,p2:e.p2}:null}releaseResources(){r.maplibreStore.dispose(),this.root?.unmount(),super.releaseResources()}search(e){return typeof e!="string"?(a("search","A search string must be passed.","EFP001100"),Promise.resolve([])):r.fuzzySearchEngineStore.loadEngine().then(()=>(r.searchStore.selectSearch(e),r.uiState.fuzzySearchItems.map(t=>({item:p(t.item),score:t.score}))))}getFloors(){return r.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 t=this.getFloors();if(e.name){const o=t.find(s=>s.name===e.name||s.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=t.find(i=>i.index===e.index),s=o?.name;if(!s){a("activateFloor",`Floor at index ${e.index} does not exist.`,"EFP001203");return}if(o.active)return;this.updateLayerVisibility(s,!0);return}}showPathway(e,t){const{boothExternalIds:o,exhibitorExternalIds:s}=t?.length?F(t):{boothExternalIds:[],exhibitorExternalIds:[]};Z({pathwayId:e,boothIds:o,exhibitorIds:s})}showPathwayOnly(e,t){this.activateFloor({name:t}),r.layerStore.showPathWay(e),r.uiState.setPathwayOnlyMode(!0);const o=r.layerStore.findLayer(e),s=r.layerStore.findLayer(t),i=o?.rect||o?.viewbox?o:s,n=i?.viewbox??i?.rect;n&&(r.uiState.moveToRect=n.clone())}hidePathways(){this.highlightBooths([]),r.layerStore.hidePathways(),r.uiState.setPathwayOnlyMode(!1)}showSearch(){r.selectSearch("")}changeLanguage(e){const t=e?.toLowerCase?.();if(!ce(t)){a("changeLanguage",`Language "${e}" was not found. Available languages: ${le().map(o=>o.id).join(",")}`,"EFP001300");return}ue(t)}isGpsTrackingEnabled(){return r.routeStore.gpsEnabled}setGpsTrackingEnabled(e){r.routeStore.setGpsTrackingEnabled(e)}deselectCurrentPosition(){r.routeStore.selectCurrentPosition(null,!1)}deselectRoute(){r.routeStore.selectRoute(null),r.routeStore.setOnlyAccessible(!1)}reset(){this.selectBooth(""),this.selectExhibitor(""),this.selectCategory(),this.deselectCurrentPosition(),this.deselectRoute(),this.highlightEntities([]),r.uiState.kioskData&&r.resetCameraFn?r.resetCameraFn?.():this.fitBounds()}selectAccessibleRoute(e){r.routeStore.setOnlyAccessible(!0),this.selectRoute(e)}}function T(f=[],e,t){const o=new Set;for(const s of f){const i=s.toLowerCase(),n=e.find(h=>String(h.id)===s)??e.find(h=>h.externalId?.toLowerCase()===i)??e.find(h=>h.name?.toLowerCase()===i||h.slug?.toLowerCase()===i);n?o.add(n.id):console.warn(`Entity not found: ${t} with query "${s}"`)}return[...o]}function m(f){return(typeof f=="string"?b(f):r.routeStore.getNearestBooth(f))??null}let E=0;function a(f,e,t){const o=`Error calling "${f}" SDK method.`,s=`${e.endsWith(".")?e:e+"."} More information at`;let i="https://js-sdk.expofp.com/api/packages";if(t&&(i+=`#error-${t}`),console.error(`${o} ${s} ${i}`),r.fp.disableRuntimeAlerts)return;r.uiState.setGlobalErrorMessage({title:o,body:M(I,{children:[s," ",x("a",{href:i,target:"_blank",rel:"noreferrer",children:i})]})}),clearTimeout(E);const n=8e3;E=window.setTimeout(()=>{const h=async()=>{r.uiState.globalErrorMessages.length>0&&(r.uiState.popGlobalErrorMessage(),await new Promise(u=>setTimeout(u,n/2)),h())};h()},n)}class c{get h(){return Math.abs(this.y2-this.y1)}get w(){return Math.abs(this.x2-this.x1)}get cx(){return(this.x1+this.x2)/2}get cy(){return(this.y1+this.y2)/2}constructor(e,t,o,s){if(e>o){const i=e;e=o,o=i}if(t>s){const i=t;t=s,s=i}this.x1=e,this.y1=t,this.x2=o,this.y2=s}static fromBox(e){return new c(e.min.x,e.min.y,e.max.x,e.max.y)}static fromCxcywh(e,t,o,s){return new c(e-o/2,t-s/2,e+o/2,t+s/2)}contains(e){return e.x1>=this.x1&&e.x2<=this.x2&&e.y1>=this.y1&&e.y2<=this.y2}intersects(e){const t=Math.max(this.x1,e.x1),o=Math.min(this.x2,e.x2),s=Math.max(this.y1,e.y1),i=Math.min(this.y2,e.y2);return o>=t&&i>=s}getIntersection(e){const t=Math.max(this.x1,e.x1),o=Math.min(this.x2,e.x2),s=Math.max(this.y1,e.y1),i=Math.min(this.y2,e.y2);return o>=t&&i>=s?new c(t,s,o,i):new c(0,0,0,0)}getRotated90(){return c.fromCxcywh(this.cx,this.cy,this.h,this.w)}normalize(e,t){return new c(this.x1/e,this.y1/t,this.x2/e,this.y2/t)}withPadding(e,t=e){return this.w<e*2||this.h<t*2?this:c.fromCxcywh(this.cx,this.cy,this.w-e*2,this.h-t*2)}scale(e){return new c(this.x1*e,this.y1*e,this.x2*e,this.y2*e)}getArea(){return this.w*this.h}clone(){return new c(this.x1,this.y1,this.x2,this.y2)}translate(e,t){return this.x1+=e,this.x2+=e,this.y1+=t,this.y2+=t,this}equals(e){return e.x1===this.x1&&e.x2===this.x2&&e.y1===this.y1&&e.y2===this.y2}toString(){return this.x1+","+this.y1+","+this.w+","+this.h}containsPoint(e,t){return e>=this.x1&&e<=this.x2&&t>=this.y1&&t<=this.y2}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__decorate as o}from"tslib";import{action as s,computed as y,observable as S,runInAction as c}from"mobx";import{LANGUAGE_TYPE as w}from"../constants";import{URLFilterManager as v}from"../services/URLFilterManager";import{GaEventActions as n,sendEventToGa as p}from"../tools/gtag";import b from"../tools/logger";import{isWebGlSupported as g}from"../utils";import{resetLocale as k}from"../utils/i18n";import h from"../utils/is-mobile";import u from"../utils/is-webview";import{sanitizeSearch as x}from"../utils/sanitizeText";import B from"./BookmarksStore";import _,{BoothBase as f,RegularBooth as L}from"./BoothStore";import E from"./CategoryFilterStore";import C,{Category as T}from"./CategoryStore";import I,{EventItem as F}from"./EventStore";import M,{Exhibitor as m}from"./ExhibitorStore";import O from"./FuzzySearchEngineStore";import z from"./HeatmapStore";import A from"./IntercomStore";import R,{LayersMode as d}from"./LayerStore";import P from"./MaplibreStore";import V from"./OverlayStore";import G from"./PoiMarkerStore";import q from"./PoiTypeStore";import{SearchShortcutProvider as N}from"./providers/SearchShortcutProvider";import{SessionsShortcutProvider as U}from"./providers/SessionsShortcutProvider";import{SpeakerShortcutProvider as W}from"./providers/SpeakerShortcutProvider";import j from"./RoutePlannerStore";import D from"./RouteStore";import H from"./SearchButtonsStore";import K from"./SearchStore";import Y from"./SessionsFilterStore";import{ShortcutRegistry as $}from"./ShortcutRegistry";import J from"./SpeakerFilterStore";import Q from"./SpeakerStore";import{SpeakerItem as X}from"./SpeakerStore";import Z from"./ToursStore";import tt from"./UIState";export default class i{setResetCameraFn(t){this.resetCameraFn=t}constructor(){this.initialized=!1,this.categoryStore=new C(this),this.exhibitorStore=new M(this),this.boothStore=new _(this),this.routeStore=new D(this),this.routePlannerStore=new j(this),this.toursStore=new Z(this),this.uiState=new tt(this),this.overlayStore=new V(this),this.maplibreStore=new P(this),this.layerStore=new R,this.intercomStore=new A,this.eventStore=new I(this),this.heatmapStore=new z,this.poiTypeStore=new q(this),this.poiMarkerStore=new G(this),this.fuzzySearchEngineStore=new O(["name","title","fullName","booths.name"]),this.categoryFilterStore=new E(this),this.sessionsFilterStore=new Y(this),this.speakerStore=new Q(this),this.speakerFilterStore=new J(this),this.searchStore=new K(this),this.searchButtonsStore=new H(this),this.bookmarksStore=new B(this),this.urlFilterManager=new v(this),this.shortcutRegistry=new $,this.registerShortcutProviders()}selectExhibitor(t,r=!0){this.uiState.hoveredExhibitor=null,this.uiState.details=t;var e=t.booths.filter(a=>a.visible),l=t.booths.filter(a=>!a.visible);!e.length&&l.length&&this.layerStore.updateVisibility(l[0].layer,!0),r&&setTimeout(()=>this.moveToList(t.booths.filter(a=>a.visible)),u||h?500:50)}selectBooth(t,r=!0){let e=Array.isArray(t)?t:[t];this.uiState.details=e[0],e.length===1&&e[0].schedule?.length&&(this.uiState.desiredOverlaySize="medium"),e.length===1&&e[0].layer&&!e[0].visible&&this.layerStore.mode===d.Radio&&this.layerStore.updateVisibility(e[0].layer,!0),r&&setTimeout(()=>this.moveToList(e),u||h?500:50)}reset(){const t=window.__searchi;t&&t.querySelector&&t.querySelector("input[type=search]")&&t.querySelector("input[type=search]").blur&&t.querySelector("input[type=search]").blur(),window.setTimeout(()=>{this.uiState.setKioskModeEnabled||k().then(()=>{c(()=>{this.selectSearch(""),this.uiState.details=null,this.resetCameraFn?.(),this.uiState.menu=!1,this.searchStore.resetSearchBox(),this.searchButtonsStore.clearAllFilters()}),setTimeout(()=>{c(()=>{this.uiState.inIdle=!0})},100)})},1e3)}selectNone(){window.__resett&&window.__resett(),this.uiState.details=this.uiState.selectedCategory}selectBookmarks(){this.uiState.details=null,this.uiState.list={type:"bookmarks"}}selectVisited(){this.uiState.details=null,this.uiState.list={type:"visited"}}selectLanguage(){this.uiState.details=null,this.uiState.list={type:w}}selectCategory(t){window.__resett&&window.__resett(),this.uiState.details=t,this.uiState.list={type:"category",category:t},this.uiState.desiredOverlaySize="full",t.exhibitors.find(e=>e.booths.find(l=>l.visible))||this.layerStore.updateVisibility(t.exhibitors[0]?.booths[0]?.layer,!0),setTimeout(()=>{this.uiState.moveToBooths=t.exhibitors.filter(e=>e.booths.find(l=>l.visible)).flatMap(e=>e.booths)},200)}selectEventItem(t,r=!0){if(this.uiState.hoveredExhibitor=null,this.uiState.details=t,this.uiState.desiredOverlaySize="medium",t.boothId){const e=this.boothStore.booths.find(l=>l.id===t.boothId);e&&e.layer&&!e.visible&&this.layerStore.mode===d.Radio&&this.layerStore.updateVisibility(e.layer,!0)}r&&setTimeout(()=>{if(t.boothId){const e=this.boothStore.booths.find(l=>l.id===t.boothId);e&&this.moveToList([e])}},u||h?500:50)}selectSearch(t){window.__resett&&window.__resett(),this.uiState.details=null,this.speakerStore.clearSelectedSpeaker(),this.uiState.list={type:"search",text:x(t,Object.keys(this.uiState.mapSettings).map(r=>`${r}=`)),focused:!1},this.uiState.activeListIndex=-1}clickBookmarks(){window.__resett&&window.__resett(),this.uiState.menu=!1,this.selectBookmarks(),this.moveToList(),this.showMap()}clickVisited(){window.__resett&&window.__resett(),this.uiState.menu=!1,this.selectVisited(),this.moveToList(),this.showMap()}clickLanguage(){window.__resett&&window.__resett(),this.uiState.menu=!1,this.selectLanguage()}clickCategory(t){window.__resett&&window.__resett(),this.uiState.menu=!1,this.selectCategory(t),this.uiState.onCategoryClick&&this.uiState.onCategoryClick({id:t.id,name:t.name,exhibitors:t.exhibitors.map(r=>r.id)}),setTimeout(()=>{this.moveToList(),this.showMap()},100)}clickSeminars(){this.clickCategory(this.categoryStore.seminarsCategory)}clickBoothInList(t){window.__resett&&window.__resett(),this.uiState.hoveredBooth=null,this.selectBooth(t),this.moveToList([t]),this.showMap()}clickBoothInList2(t){window.__resett&&window.__resett(),this.uiState.hoveredBooth=null,this.selectBooth(t,!1),window.setTimeout(()=>{this.moveToList([t]),this.showMap()},navigator.userAgent.toLowerCase().indexOf("android")>-1?400:50)}clickBooth(t){const r=this.uiState.details;if(this.uiState.menu=!1,this.uiState.list.type==="sessions"&&this.searchStore.selectSearch(),this.uiState.list.type==="speakers"&&this.searchStore.selectSearch(),this.uiState.list.type==="tours"&&this.searchStore.selectSearch(),this.uiState.list.type==="multi-point-tour"&&this.searchStore.selectSearch(),!(this.uiState.selectedRoute?.from&&this.uiState.selectedRoute?.to)){if(this.uiState.selectedRoute?.to&&!this.uiState.selectedRoute?.from&&t){this.routeStore.setStartPoint(t);return}if(t)this.routeStore.tempToBooth=t;else{this.uiState.details=null,this.fp.hidePathways(),this.uiState.list={type:"search",text:"",focused:!1},this.uiState.onBoothClick&&this.uiState.onBoothClick({target:null});return}if(this.uiState.onBoothClick){const e={name:"",description:""},l={target:{...t,layer:t.layer||e}};this.uiState.onBoothClick(l)}if(t.exhibitors.length===1&&t instanceof L){const e=t.exhibitors[0];r===e?p(n.ViewBooth,t.name):this.heatmapStore.forceTrack={action:n.ViewBooth,label:t.name,exhibitor:e},this.selectExhibitor(e,!1)}else r===t&&p(n.ViewBooth,t.name),this.selectBooth(t,!1);this.showMap()}}clickExhibitor2(t){this.selectExhibitor(t,!0),this.showMap()}clickExhibitor(t){window.setTimeout(()=>{this.clickExhibitor2(t)},navigator.userAgent.toLowerCase().indexOf("android")>-1?400:50)}showMap(){this.uiState.overlayPosition==="bottom"&&g&&(this.uiState.desiredOverlaySize="medium")}showOverlay(){this.uiState.overlayPosition==="bottom"&&(this.uiState.desiredOverlaySize="full")}toggleMapOverlay(){this.uiState.overlayPosition==="bottom"&&this.uiState.overlaySize==="full"?this.uiState.desiredOverlaySize="medium":this.uiState.overlayPosition==="bottom"&&this.uiState.overlaySize!=="full"&&(this.uiState.desiredOverlaySize="full")}moveToList(t){t=t||this.uiState.listItems;const r=[];t.forEach(e=>{if(e instanceof m)r.push(...e.booths.filter(l=>l.visible));else if(e instanceof f)e.visible&&r.push(e);else if(e instanceof F&&e.boothId){const l=this.boothStore.boothById.get(e.boothId);l?.visible&&r.push(l)}else e instanceof X&&this.speakerStore.getEventsBySpeaker(e.id).forEach(l=>{if(!l.boothId)return;const a=this.boothStore.boothById.get(l.boothId);a?.visible&&r.push(a)})}),this.uiState.moveToBooths=r}moveToExhibitor(t){this.moveToList([t])}changeActiveListIndex(t){let r=this.uiState.activeListIndex+t;r=Math.max(0,Math.min(this.uiState.listItems.length-1,r)),this.uiState.activeListIndex=r}toggleModal(t){this.uiState.modalActive[t]=!this.uiState.modalActive[t]}openGallery(){this.uiState.galleryActive=!0}closeGallery(){this.uiState.galleryActive=!1}openActiveListItem(){const t=this.uiState.listItems[this.uiState.activeListIndex];t&&(b.log("Opening",t),t instanceof m?this.clickExhibitor(t):t instanceof T?this.clickCategory(t):t instanceof f&&this.clickBoothInList2(t))}toggleCategoryFilter(){this.uiState.categoryFilterOpen=!this.uiState.categoryFilterOpen}applyCategoryFilters(t){this.uiState.selectedCategoryFilters=t,this.uiState.categoryFilterOpen=!1}get filteredExhibitors(){return this.uiState.selectedCategoryFilters.length===0?this.exhibitorStore.exhibitors:this.exhibitorStore.exhibitors.filter(t=>this.uiState.selectedCategoryFilters.some(r=>t.categories.some(e=>e.id===r.id)))}selectSessions(){this.uiState.list={type:"sessions",text:"",focused:!1},this.uiState.menu=!1,this.uiState.selectedTrack=null,this.searchButtonsStore.setSubButtonId(null),this.searchButtonsStore.subButtonsEnabled&&this.searchButtonsStore.showSubButtons("sessions"),h&&(this.uiState.desiredOverlaySize="full")}selectExhibitors(){this.uiState.list={type:"exhibitors",text:"",focused:!1},this.uiState.menu=!1,h&&(this.uiState.desiredOverlaySize="full")}selectTours(){this.uiState.list={type:"tours",text:"",focused:!1},this.uiState.menu=!1,h&&(this.uiState.desiredOverlaySize="full")}selectSpeakers(){this.uiState.list={type:"speakers",text:"",focused:!1},this.uiState.menu=!1,h&&(this.uiState.desiredOverlaySize="full")}selectSpeaker(t,r=!0){this.speakerStore.selectSpeaker(t,r)}resetFilters(){this.searchButtonsStore.clearAllFilters()}registerShortcutProviders(){this.shortcutRegistry.register(new U(this)),this.shortcutRegistry.register(new W(this)),this.shortcutRegistry.register(new N(this))}}o([S],i.prototype,"initialized",void 0),o([S],i.prototype,"resetCameraFn",void 0),o([s],i.prototype,"setResetCameraFn",null),o([s],i.prototype,"selectExhibitor",null),o([s],i.prototype,"selectBooth",null),o([s],i.prototype,"reset",null),o([s],i.prototype,"selectNone",null),o([s],i.prototype,"selectBookmarks",null),o([s],i.prototype,"selectVisited",null),o([s],i.prototype,"selectLanguage",null),o([s],i.prototype,"selectCategory",null),o([s],i.prototype,"selectEventItem",null),o([s],i.prototype,"selectSearch",null),o([s],i.prototype,"clickBookmarks",null),o([s],i.prototype,"clickVisited",null),o([s],i.prototype,"clickLanguage",null),o([s],i.prototype,"clickCategory",null),o([s],i.prototype,"clickSeminars",null),o([s],i.prototype,"clickBoothInList",null),o([s],i.prototype,"clickBoothInList2",null),o([s],i.prototype,"clickBooth",null),o([s],i.prototype,"clickExhibitor2",null),o([s],i.prototype,"clickExhibitor",null),o([s],i.prototype,"showMap",null),o([s],i.prototype,"showOverlay",null),o([s],i.prototype,"toggleMapOverlay",null),o([s],i.prototype,"moveToList",null),o([s],i.prototype,"moveToExhibitor",null),o([s],i.prototype,"changeActiveListIndex",null),o([s],i.prototype,"toggleModal",null),o([s],i.prototype,"openGallery",null),o([s],i.prototype,"closeGallery",null),o([s],i.prototype,"openActiveListItem",null),o([s],i.prototype,"toggleCategoryFilter",null),o([s],i.prototype,"applyCategoryFilters",null),o([y],i.prototype,"filteredExhibitors",null),o([s],i.prototype,"selectSessions",null),o([s],i.prototype,"selectExhibitors",null),o([s],i.prototype,"selectTours",null),o([s],i.prototype,"selectSpeakers",null),o([s],i.prototype,"selectSpeaker",null),o([s],i.prototype,"resetFilters",null);
|
|
1
|
+
import{__decorate as o}from"tslib";import{action as s,computed as y,observable as S,runInAction as c}from"mobx";import{LANGUAGE_TYPE as w}from"../constants";import{URLFilterManager as v}from"../services/URLFilterManager";import{GaEventActions as n,sendEventToGa as p}from"../tools/gtag";import b from"../tools/logger";import{isWebGlSupported as g}from"../utils";import{resetLocale as k}from"../utils/i18n";import h from"../utils/is-mobile";import u from"../utils/is-webview";import{sanitizeSearch as x}from"../utils/sanitizeText";import B from"./BookmarksStore";import _,{BoothBase as f,RegularBooth as L}from"./BoothStore";import E from"./CategoryFilterStore";import C,{Category as T}from"./CategoryStore";import I,{EventItem as F}from"./EventStore";import M,{Exhibitor as m}from"./ExhibitorStore";import O from"./FuzzySearchEngineStore";import z from"./HeatmapStore";import A from"./IntercomStore";import R,{LayersMode as d}from"./LayerStore";import P from"./MaplibreStore";import V from"./OverlayStore";import G from"./PoiMarkerStore";import q from"./PoiTypeStore";import{SearchShortcutProvider as N}from"./providers/SearchShortcutProvider";import{SessionsShortcutProvider as U}from"./providers/SessionsShortcutProvider";import{SpeakerShortcutProvider as W}from"./providers/SpeakerShortcutProvider";import j from"./RoutePlannerStore";import D from"./RouteStore";import H from"./SearchButtonsStore";import K from"./SearchStore";import Y from"./SessionsFilterStore";import{ShortcutRegistry as $}from"./ShortcutRegistry";import J from"./SpeakerFilterStore";import Q from"./SpeakerStore";import{SpeakerItem as X}from"./SpeakerStore";import Z from"./ToursStore";import tt from"./UIState";export default class i{setResetCameraFn(t){this.resetCameraFn=t}constructor(){this.initialized=!1,this.categoryStore=new C(this),this.exhibitorStore=new M(this),this.boothStore=new _(this),this.routeStore=new D(this),this.routePlannerStore=new j(this),this.toursStore=new Z(this),this.uiState=new tt(this),this.overlayStore=new V(this),this.maplibreStore=new P(this),this.layerStore=new R,this.intercomStore=new A,this.eventStore=new I(this),this.heatmapStore=new z,this.poiTypeStore=new q(this),this.poiMarkerStore=new G(this),this.fuzzySearchEngineStore=new O(["name","title","fullName","booths.name"]),this.categoryFilterStore=new E(this),this.sessionsFilterStore=new Y(this),this.speakerStore=new Q(this),this.speakerFilterStore=new J(this),this.searchStore=new K(this),this.searchButtonsStore=new H(this),this.bookmarksStore=new B(this),this.urlFilterManager=new v(this),this.shortcutRegistry=new $,this.registerShortcutProviders()}selectExhibitor(t,r=!0){this.uiState.hoveredExhibitor=null,this.uiState.details=t;var e=t.booths.filter(a=>a.visible),l=t.booths.filter(a=>!a.visible);!e.length&&l.length&&this.layerStore.updateVisibility(l[0].layer,!0),r&&setTimeout(()=>this.moveToList(t.booths.filter(a=>a.visible)),u||h?500:50)}selectBooth(t,r=!0){let e=Array.isArray(t)?t:[t];this.uiState.details=e[0]??null,e.length===1&&e[0].schedule?.length&&(this.uiState.desiredOverlaySize="medium"),e.length===1&&e[0].layer&&!e[0].visible&&this.layerStore.mode===d.Radio&&this.layerStore.updateVisibility(e[0].layer,!0),r&&setTimeout(()=>this.moveToList(e),u||h?500:50)}reset(){const t=window.__searchi;t&&t.querySelector&&t.querySelector("input[type=search]")&&t.querySelector("input[type=search]").blur&&t.querySelector("input[type=search]").blur(),window.setTimeout(()=>{this.uiState.setKioskModeEnabled||k().then(()=>{c(()=>{this.selectSearch(""),this.uiState.details=null,this.resetCameraFn?.(),this.uiState.menu=!1,this.searchStore.resetSearchBox(),this.searchButtonsStore.clearAllFilters()}),setTimeout(()=>{c(()=>{this.uiState.inIdle=!0})},100)})},1e3)}selectNone(){window.__resett&&window.__resett(),this.uiState.details=this.uiState.selectedCategory}selectBookmarks(){this.uiState.details=null,this.uiState.list={type:"bookmarks"}}selectVisited(){this.uiState.details=null,this.uiState.list={type:"visited"}}selectLanguage(){this.uiState.details=null,this.uiState.list={type:w}}selectCategory(t){window.__resett&&window.__resett(),this.uiState.details=t,this.uiState.list={type:"category",category:t},this.uiState.desiredOverlaySize="full",t.exhibitors.find(e=>e.booths.find(l=>l.visible))||this.layerStore.updateVisibility(t.exhibitors[0]?.booths[0]?.layer,!0),setTimeout(()=>{this.uiState.moveToBooths=t.exhibitors.filter(e=>e.booths.find(l=>l.visible)).flatMap(e=>e.booths)},200)}selectEventItem(t,r=!0){if(this.uiState.hoveredExhibitor=null,this.uiState.details=t,this.uiState.desiredOverlaySize="medium",t.boothId){const e=this.boothStore.booths.find(l=>l.id===t.boothId);e&&e.layer&&!e.visible&&this.layerStore.mode===d.Radio&&this.layerStore.updateVisibility(e.layer,!0)}r&&setTimeout(()=>{if(t.boothId){const e=this.boothStore.booths.find(l=>l.id===t.boothId);e&&this.moveToList([e])}},u||h?500:50)}selectSearch(t){window.__resett&&window.__resett(),this.uiState.details=null,this.speakerStore.clearSelectedSpeaker(),this.uiState.list={type:"search",text:x(t,Object.keys(this.uiState.mapSettings).map(r=>`${r}=`)),focused:!1},this.uiState.activeListIndex=-1}clickBookmarks(){window.__resett&&window.__resett(),this.uiState.menu=!1,this.selectBookmarks(),this.moveToList(),this.showMap()}clickVisited(){window.__resett&&window.__resett(),this.uiState.menu=!1,this.selectVisited(),this.moveToList(),this.showMap()}clickLanguage(){window.__resett&&window.__resett(),this.uiState.menu=!1,this.selectLanguage()}clickCategory(t){window.__resett&&window.__resett(),this.uiState.menu=!1,this.selectCategory(t),this.uiState.onCategoryClick&&this.uiState.onCategoryClick({id:t.id,name:t.name,exhibitors:t.exhibitors.map(r=>r.id)}),setTimeout(()=>{this.moveToList(),this.showMap()},100)}clickSeminars(){this.clickCategory(this.categoryStore.seminarsCategory)}clickBoothInList(t){window.__resett&&window.__resett(),this.uiState.hoveredBooth=null,this.selectBooth(t),this.moveToList([t]),this.showMap()}clickBoothInList2(t){window.__resett&&window.__resett(),this.uiState.hoveredBooth=null,this.selectBooth(t,!1),window.setTimeout(()=>{this.moveToList([t]),this.showMap()},navigator.userAgent.toLowerCase().indexOf("android")>-1?400:50)}clickBooth(t){const r=this.uiState.details;if(this.uiState.menu=!1,this.uiState.list.type==="sessions"&&this.searchStore.selectSearch(),this.uiState.list.type==="speakers"&&this.searchStore.selectSearch(),this.uiState.list.type==="tours"&&this.searchStore.selectSearch(),this.uiState.list.type==="multi-point-tour"&&this.searchStore.selectSearch(),!(this.uiState.selectedRoute?.from&&this.uiState.selectedRoute?.to)){if(this.uiState.selectedRoute?.to&&!this.uiState.selectedRoute?.from&&t){this.routeStore.setStartPoint(t);return}if(t)this.routeStore.tempToBooth=t;else{this.uiState.details=null,this.fp.hidePathways(),this.uiState.list={type:"search",text:"",focused:!1},this.uiState.onBoothClick&&this.uiState.onBoothClick({target:null});return}if(this.uiState.onBoothClick){const e={name:"",description:""},l={target:{...t,layer:t.layer||e}};this.uiState.onBoothClick(l)}if(t.exhibitors.length===1&&t instanceof L){const e=t.exhibitors[0];r===e?p(n.ViewBooth,t.name):this.heatmapStore.forceTrack={action:n.ViewBooth,label:t.name,exhibitor:e},this.selectExhibitor(e,!1)}else r===t&&p(n.ViewBooth,t.name),this.selectBooth(t,!1);this.showMap()}}clickExhibitor2(t){this.selectExhibitor(t,!0),this.showMap()}clickExhibitor(t){window.setTimeout(()=>{this.clickExhibitor2(t)},navigator.userAgent.toLowerCase().indexOf("android")>-1?400:50)}showMap(){this.uiState.overlayPosition==="bottom"&&g&&(this.uiState.desiredOverlaySize="medium")}showOverlay(){this.uiState.overlayPosition==="bottom"&&(this.uiState.desiredOverlaySize="full")}toggleMapOverlay(){this.uiState.overlayPosition==="bottom"&&this.uiState.overlaySize==="full"?this.uiState.desiredOverlaySize="medium":this.uiState.overlayPosition==="bottom"&&this.uiState.overlaySize!=="full"&&(this.uiState.desiredOverlaySize="full")}moveToList(t){t=t||this.uiState.listItems;const r=[];t.forEach(e=>{if(e instanceof m)r.push(...e.booths.filter(l=>l.visible));else if(e instanceof f)e.visible&&r.push(e);else if(e instanceof F&&e.boothId){const l=this.boothStore.boothById.get(e.boothId);l?.visible&&r.push(l)}else e instanceof X&&this.speakerStore.getEventsBySpeaker(e.id).forEach(l=>{if(!l.boothId)return;const a=this.boothStore.boothById.get(l.boothId);a?.visible&&r.push(a)})}),this.uiState.moveToBooths=r}moveToExhibitor(t){this.moveToList([t])}changeActiveListIndex(t){let r=this.uiState.activeListIndex+t;r=Math.max(0,Math.min(this.uiState.listItems.length-1,r)),this.uiState.activeListIndex=r}toggleModal(t){this.uiState.modalActive[t]=!this.uiState.modalActive[t]}openGallery(){this.uiState.galleryActive=!0}closeGallery(){this.uiState.galleryActive=!1}openActiveListItem(){const t=this.uiState.listItems[this.uiState.activeListIndex];t&&(b.log("Opening",t),t instanceof m?this.clickExhibitor(t):t instanceof T?this.clickCategory(t):t instanceof f&&this.clickBoothInList2(t))}toggleCategoryFilter(){this.uiState.categoryFilterOpen=!this.uiState.categoryFilterOpen}applyCategoryFilters(t){this.uiState.selectedCategoryFilters=t,this.uiState.categoryFilterOpen=!1}get filteredExhibitors(){return this.uiState.selectedCategoryFilters.length===0?this.exhibitorStore.exhibitors:this.exhibitorStore.exhibitors.filter(t=>this.uiState.selectedCategoryFilters.some(r=>t.categories.some(e=>e.id===r.id)))}selectSessions(){this.uiState.list={type:"sessions",text:"",focused:!1},this.uiState.menu=!1,this.uiState.selectedTrack=null,this.searchButtonsStore.setSubButtonId(null),this.searchButtonsStore.subButtonsEnabled&&this.searchButtonsStore.showSubButtons("sessions"),h&&(this.uiState.desiredOverlaySize="full")}selectExhibitors(){this.uiState.list={type:"exhibitors",text:"",focused:!1},this.uiState.menu=!1,h&&(this.uiState.desiredOverlaySize="full")}selectTours(){this.uiState.list={type:"tours",text:"",focused:!1},this.uiState.menu=!1,h&&(this.uiState.desiredOverlaySize="full")}selectSpeakers(){this.uiState.list={type:"speakers",text:"",focused:!1},this.uiState.menu=!1,h&&(this.uiState.desiredOverlaySize="full")}selectSpeaker(t,r=!0){this.speakerStore.selectSpeaker(t,r)}resetFilters(){this.searchButtonsStore.clearAllFilters()}registerShortcutProviders(){this.shortcutRegistry.register(new U(this)),this.shortcutRegistry.register(new W(this)),this.shortcutRegistry.register(new N(this))}}o([S],i.prototype,"initialized",void 0),o([S],i.prototype,"resetCameraFn",void 0),o([s],i.prototype,"setResetCameraFn",null),o([s],i.prototype,"selectExhibitor",null),o([s],i.prototype,"selectBooth",null),o([s],i.prototype,"reset",null),o([s],i.prototype,"selectNone",null),o([s],i.prototype,"selectBookmarks",null),o([s],i.prototype,"selectVisited",null),o([s],i.prototype,"selectLanguage",null),o([s],i.prototype,"selectCategory",null),o([s],i.prototype,"selectEventItem",null),o([s],i.prototype,"selectSearch",null),o([s],i.prototype,"clickBookmarks",null),o([s],i.prototype,"clickVisited",null),o([s],i.prototype,"clickLanguage",null),o([s],i.prototype,"clickCategory",null),o([s],i.prototype,"clickSeminars",null),o([s],i.prototype,"clickBoothInList",null),o([s],i.prototype,"clickBoothInList2",null),o([s],i.prototype,"clickBooth",null),o([s],i.prototype,"clickExhibitor2",null),o([s],i.prototype,"clickExhibitor",null),o([s],i.prototype,"showMap",null),o([s],i.prototype,"showOverlay",null),o([s],i.prototype,"toggleMapOverlay",null),o([s],i.prototype,"moveToList",null),o([s],i.prototype,"moveToExhibitor",null),o([s],i.prototype,"changeActiveListIndex",null),o([s],i.prototype,"toggleModal",null),o([s],i.prototype,"openGallery",null),o([s],i.prototype,"closeGallery",null),o([s],i.prototype,"openActiveListItem",null),o([s],i.prototype,"toggleCategoryFilter",null),o([s],i.prototype,"applyCategoryFilters",null),o([y],i.prototype,"filteredExhibitors",null),o([s],i.prototype,"selectSessions",null),o([s],i.prototype,"selectExhibitors",null),o([s],i.prototype,"selectTours",null),o([s],i.prototype,"selectSpeakers",null),o([s],i.prototype,"selectSpeaker",null),o([s],i.prototype,"resetFilters",null);
|
|
@@ -19,6 +19,10 @@ export default class RouteStore {
|
|
|
19
19
|
prevMarkers: Marker[];
|
|
20
20
|
/** Cancels the camera move still waiting for a floor to come on screen (see `revealLayer`). */
|
|
21
21
|
private pendingReveal;
|
|
22
|
+
/** The last `onDirection` sent; `undefined` before the first. */
|
|
23
|
+
private lastDirection;
|
|
24
|
+
private directionScheduled;
|
|
25
|
+
private pendingDetails;
|
|
22
26
|
showAccessible: boolean;
|
|
23
27
|
onlyAccessible: boolean;
|
|
24
28
|
currentRouteLayer: Layer | null;
|
|
@@ -74,7 +78,11 @@ export default class RouteStore {
|
|
|
74
78
|
} | null;
|
|
75
79
|
updateRoute(routeLines: RouteLine[], distance?: number): void;
|
|
76
80
|
updateRouteDistance(distance: number): void;
|
|
77
|
-
|
|
81
|
+
/** Wayfinding reports a route in steps; they share one flush that reads the final state (#1756). */
|
|
82
|
+
private scheduleDirection;
|
|
83
|
+
private directionPayload;
|
|
84
|
+
/** Drops a repeat of the last event; an explicit `null` always goes out. */
|
|
85
|
+
private emitDirection;
|
|
78
86
|
checkRoutes(): void;
|
|
79
87
|
isGpsTrackingEnabled: boolean;
|
|
80
88
|
setGpsTrackingEnabled(value: boolean): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__decorate as n}from"tslib";import{Box as x,boxContainsPoint as z,pointDistance as S}from"@expofp/geometry";import{action as f,computed as y,observable as u}from"mobx";import{getName as F}from"../components/Kiosk/SetKiosk";import{mapCamera as L}from"../components/Map/camera";import{DEFAULT_UNITS as T,ORIENTATION_GRANTED_KEY as G}from"../constants";import E from"../data";import{getFpGeo as P}from"../data/fpGeo.js";import{getLayerSvg as U,getSvgArea as $}from"../data/svg.js";import{GaEventActions as V,sendEventToGa as K}from"../tools/gtag";import w from"../tools/logger";import{areLayersEnabled as W}from"../utils/areLayersEnabled";import{calcSpeed as D}from"../utils/calcSpeed";import{calcTravelTime as A}from"../utils/calcTravelTime";import{calculateRelativeBearing as Z,convertGpsToLocal as I,isValidPointCoords as g}from"../utils/gps";import{boothToEndpoint as C,buildRoute as q,CURRENT_LOCATION_NAME as j,CURRENT_POSITION_POINT_ID as X,isWayfindingReady as Y,KIOSK_ANCHOR_POINT_ID as H,toArbitraryPoint as M}from"../wayfinding";import c,{layersStore as b,uiState as p}from".";import{BoothBase as m}from"./BoothStore";import{LayersMode as J}from"./LayerStore";import{revealLayer as N}from"./reveal-layer.js";function d(r){return typeof r=="string"?Number(r.replace(",",".")):r}export default class i{constructor(t){this.routeLines=[],this.routeDistance=null,this.currentPosition=null,this.requestCompass=!1,this.iconType=0,this.tappedBooth=null,this.focusEnabled=!0,this.prevZ=null,this.markersData={icons:[],markers:[]},this.prevMarkers=[],this.pendingReveal=null,this.showAccessible=!1,this.onlyAccessible=!1,this.currentRouteLayer=null,this.currentRouteExhibitor=null,this.routeUnits=T,this.isGpsTrackingEnabled=!0,this.rootStore=t,this.focusEnabled=!window.location.search}get tempToBooth(){const t=this.tappedBooth;return t?.exhibitors.some(e=>e===p.details)?t:null}set tempToBooth(t){this.tappedBooth=t}get canFindLocation(){return!!p.kioskData||!!this.currentPosition}selectRoute(t,e=!0,o=!1){if(e&&(p.list={type:"search",text:"",focused:!1}),t&&!t.from&&t.to){const s=this.resolveFallbackFrom();s&&(t=new Route(s,t.to,t.waypoints))}t?.from&&t?.to&&t.from===t.to&&(t=null);const a=[];t?.from&&t?.to&&window.setTimeout(()=>{this.rootStore.showMap()},navigator.userAgent.toLowerCase().indexOf("android")>-1?400:50),t?.from instanceof m&&t.from.visible&&a.push(t.from),t?.to instanceof m&&t.to.visible&&(this.tempToBooth=null,a.push(t.to)),!t&&c.fp.onDirection&&c.fp.onDirection(null);const l=f(()=>{if(this.rootStore.moveToList(a),p.details=t,t&&(!t.from||!t.to)&&p.overlayBottom&&(p.desiredOverlaySize="medium"),t?.to&&t?.from){const s=Q(t.from);s&&this.rootStore.layerStore.updateVisibility(s,!0)}if(!this.currentRouteLayer){const s=O(this.rootStore.layerStore,t?.from),h=O(this.rootStore.layerStore,t?.to);s?this.currentRouteLayer=s:h&&(this.currentRouteLayer=h)}e&&t?.from&&t?.to&&K(V.ClickDirections,`${t?.from?"From "+t.from.name:""} ${t?.to?"To "+t.to.name:""}`)});o?l():setTimeout(l,200)}rebuildRouteFromPosition(t){const e=p.selectedRoute;e?.to&&this.selectRoute(new Route(t,e.to,e.waypoints),!1,!0)}resolveFallbackFrom(){if(this.currentPosition)return M(this.currentPosition,j,X);const t=p.kioskData;return t?M({x:t.x,y:t.y,z:t.z??void 0},F(),H):null}setStartPoint(t){const e=p.selectedRoute;if(e?.to&&!e?.from&&t){const o=new Route(t,e.to,e.waypoints);this.selectRoute(o)}}get pathLayers(){return c.routeStore.routeLines?.map(t=>t.p0.layer)?.filter((t,e,o)=>o.indexOf(t)===e).map((t,e)=>({id:e+1,layer:c.layerStore.findLayer(t)}))}getNearestBooth(t){if(!t)return null;const e=this.rootStore.layerStore.findLayer(t.z),o=P()?.properties.config,a=!!(t.lat&&t.lng),l=o&&a?I(t,o):t;return!l||!g(l.x)||!g(l.y)?null:this.rootStore.boothStore.booths.filter(s=>b.mode===J.Default||!e?s.visible&&s.rect:s.rect&&(typeof t.z!="number"&&!t.z&&s.visible||e.name===s.layer?.name)).sort((s,h)=>S(l,s.rect.center)-S(l,h.rect.center))[0]||null}setMarkers(t){this.markersData.markers=(t?.markers??[]).map(tt),this.markersData.icons=t?.icons??[]}selectMarker(t,e){const o=this.markersData.markers.find(l=>l.id===t);this.markersData.markers.forEach(l=>l.active=!1),o&&(o.active=!0);const a=c.layerStore.findLayer(o?.z);if(e&&o){a&&!a?.visible&&b.updateVisibility(a,!0);const l=L();return l?l.api.panTo({x:o.x,y:o.y}):(w.warn("Map camera is not mounted. Cannot pan to marker."),Promise.resolve())}return Promise.resolve()}get selectedMarkers(){return this.markersData.markers.filter(t=>t.active)}get layers(){const t=[];return c.routeStore.routeLines?.map(e=>e.p0.layer).forEach(e=>{t.indexOf(e)===-1&&t.push(e)}),t.map(e=>c.layerStore.layers.find(o=>o.name===e)).filter(e=>!!e)}clickRoute(t,e){window.__resett&&window.__resett(),this.rootStore.uiState.menu=!1,p.list.type==="route-planner"&&(p.list={type:"search",text:"",focused:!1}),this.selectRoute(new Route(t,e))}selectCurrentPosition(t,e=!0,o){clearTimeout(this.cpTimeout),t&&(t.x=d(t.x),t.y=d(t.y),t.lat!==void 0&&(t.lat=d(t.lat)),t.lng!==void 0&&(t.lng=d(t.lng)),W()||(t.z=void 0));const a=e&&this.rootStore.uiState.details&&!(this.rootStore.uiState.details instanceof Route),l=e&&!a&&(this.focusEnabled||this.prevZ!=t?.z);this.focusEnabled&&(this.focusEnabled=!1),this.prevZ=t?.z?.toString()??null,this.iconType=o?1:0;const s=t?et(t):null;if(!t||!s){this.currentPosition=null;return}const h=c.layerStore.findLayer(t.z),R=new CurrentPosition(s.x,s.y,h?.name||this.currentRouteLayer?.name,Z(s),t.lat,t.lng);let k=!this.routeLines?.length;h&&this.routeLines?.length&&(k=!!this.routeLines.find(v=>v.p0.layer===h.name||v.p1.layer===h.name));const _=l&&k;this.currentPosition=R,_&&this.focusOnPosition(R,h),this.gpsEnabled||(this.cpTimeout=setTimeout(()=>{this.currentPosition&&this.selectCurrentPosition(null,!1)},30*1e3))}findLocation(){if(!this.canFindLocation)return;const t=this.currentPosition??p.kioskData;t&&(this.currentPosition&&localStorage.getItem(G)==="false"&&(c.routeStore.requestCompass=!0),this.pendingReveal?.(),this.pendingReveal=N({layer:c.layerStore.findLayer(t.z),show:e=>b.updateVisibility(e,!0),then:()=>{p.moveToRect=this.findLocationRect(t)}}))}findLocationRect(t){const e=x.fromCenter(t,{x:100,y:100}),o=$();if(e.intersects(o))return e;const a=Math.max(o.min.x,Math.min(t.x,o.max.x)),l=Math.max(o.min.y,Math.min(t.y,o.max.y)),s=Math.min(o.size.width,o.size.height)*.3,h=x.fromCenter({x:a,y:l},{x:s,y:s}).intersection(o);return h?x.fromUnion(e,h):e}focusOnPosition(t,e){this.pendingReveal?.(),this.pendingReveal=N({layer:e,show:o=>b.updateVisibility(o,!0),then:()=>{if(c.maplibreStore.showMaplibre){p.moveToLocation=!0;return}const o=L();if(o){o.api.panTo({x:t.x,y:t.y});return}w.warn("Map camera is not mounted. Cannot pan to current position.")}})}get routeInfo(){const t=this.routeDistance,e=this.routeUnits;return t?{distance:`${t}${e}`,units:e,time:A(t,D(e))}:null}updateRoute(t,e){!t?.length&&!this.routeLines.length||(this.routeLines=t,this.updateRoutePoints())}updateRouteDistance(t){if(t==null)return;const e=U(),o=(e.getAttribute("units")||T).toLowerCase?.().trim(),a=e.getAttribute("fp-ver")?.startsWith("5")??!1;this.routeDistance=Math.round(t/(a?1:10)),this.routeUnits=o,this.updateRoutePoints()}updateRoutePoints(){const t=p.selectedRoute,e=this.routeDistance,o=this.routeUnits;c.fp.onDirection&&setTimeout(()=>{c.fp.onDirection({from:B(t?.from??null),to:B(t?.to??null),lines:this.routeLines,distance:e==null?"":`${e}${o}`,units:o,time:A(e??0,D(o))})},200)}checkRoutes(){if(!Y()){console.warn("checkRoutes: wayfinding is not initialized \u2014 call createWayfinding() first. Skipping route check.");return}const t=c.boothStore.booths;console.info(`Route check started ${t.length}.... `);for(let e=0;e<t.length;e++){const o=t[e];for(let a=e+1;a<t.length;a++){const l=t[a];q(C(o),C(l)).lines.length||console.warn(`No route found from ${o.name} to ${l.name}`)}}console.info("Route check done....")}setGpsTrackingEnabled(t){this.isGpsTrackingEnabled=t}get gpsEnabled(){return E.autoTrackingGps&&this.isGpsTrackingEnabled&&!E.enableIPS}setOnlyAccessible(t){this.onlyAccessible=t}}n([u],i.prototype,"routeLines",void 0),n([u],i.prototype,"routeDistance",void 0),n([u],i.prototype,"currentPosition",void 0),n([u],i.prototype,"requestCompass",void 0),n([u],i.prototype,"iconType",void 0),n([u],i.prototype,"tappedBooth",void 0),n([u],i.prototype,"focusEnabled",void 0),n([u],i.prototype,"prevZ",void 0),n([u],i.prototype,"markersData",void 0),n([u],i.prototype,"prevMarkers",void 0),n([u],i.prototype,"showAccessible",void 0),n([u],i.prototype,"onlyAccessible",void 0),n([u],i.prototype,"currentRouteLayer",void 0),n([u],i.prototype,"currentRouteExhibitor",void 0),n([y],i.prototype,"canFindLocation",null),n([f],i.prototype,"selectRoute",null),n([f],i.prototype,"rebuildRouteFromPosition",null),n([f],i.prototype,"setStartPoint",null),n([y({keepAlive:!0})],i.prototype,"pathLayers",null),n([f],i.prototype,"setMarkers",null),n([f],i.prototype,"selectMarker",null),n([y({keepAlive:!0})],i.prototype,"selectedMarkers",null),n([y({keepAlive:!0})],i.prototype,"layers",null),n([f],i.prototype,"clickRoute",null),n([f],i.prototype,"selectCurrentPosition",null),n([f],i.prototype,"findLocation",null),n([u],i.prototype,"routeUnits",void 0),n([y],i.prototype,"routeInfo",null),n([f],i.prototype,"updateRoute",null),n([f],i.prototype,"updateRouteDistance",null),n([f],i.prototype,"updateRoutePoints",null),n([f],i.prototype,"checkRoutes",null),n([u],i.prototype,"isGpsTrackingEnabled",void 0),n([f],i.prototype,"setGpsTrackingEnabled",null),n([y({keepAlive:!0})],i.prototype,"gpsEnabled",null),n([f],i.prototype,"setOnlyAccessible",null);function Q(r){if(r)return r instanceof m?r.layer?.name:r.layer}function O(r,t){return t?t instanceof m?t.layer??null:r.findLayer(t.layer):null}function tt(r){return{...r,x:d(r.x),y:d(r.y),lat:r.lat===void 0?void 0:d(r.lat),lng:r.lng===void 0?void 0:d(r.lng)}}function et(r){const t=P()?.properties.config??null;let e=null;return t&&z({min:t.p0,max:t.p2},r)?e={...r}:t&&g(r.lat)&&g(r.lng)?e=I(r,t):t||(e=r),e||null}export function findBooth(r){return c.boothStore.findBooth(r)||c.exhibitorStore.findExhibitor(r)?.booths[0]}export function findEntityByExternalId(r){const t=c.boothStore.boothByExternalId.get(r);if(t)return{type:"booth",entity:t};const e=c.exhibitorStore.exhibitorByExternalId.get(r);if(e)return{type:"exhibitor",entity:e}}export function separateExternalIds(r){const t=[],e=[];for(const o of r){const a=findEntityByExternalId(o);a&&(a.type==="booth"?t.push(o):e.push(o))}return{boothExternalIds:t,exhibitorExternalIds:e}}export function extractRoute(r,t,e){return new Route(findBooth(r)??null,findBooth(t)??null,e?.map(o=>findBooth(o)).filter(o=>!!o))}export class Route{constructor(t,e,o){this.from=t,this.to=e,this.waypoints=o;const a=t instanceof m?t.id:void 0,l=e instanceof m?e.id:void 0;this.waypoints=o?.filter(s=>s&&s.id!==a&&s.id!==l)}}function B(r){return r?r instanceof m?{id:r.id,name:r.name,externalId:r.externalId,layer:{name:r.layer?.name,description:r.layer?.description}}:{id:Number.MAX_SAFE_INTEGER,name:r.name,externalId:void 0,layer:{name:r.layer,description:void 0}}:null}export class CurrentPosition{constructor(t,e,o,a,l,s){this.x=t,this.y=e,this.z=o,this.angle=a,this.lat=l,this.lng=s}}
|
|
1
|
+
import{__decorate as n}from"tslib";import{Box as S,boxContainsPoint as z,pointDistance as v}from"@expofp/geometry";import{action as d,comparer as F,computed as y,observable as f}from"mobx";import{getName as G}from"../components/Kiosk/SetKiosk";import{mapCamera as L}from"../components/Map/camera";import{DEFAULT_UNITS as D,ORIENTATION_GRANTED_KEY as U}from"../constants";import T from"../data";import{getFpGeo as E}from"../data/fpGeo.js";import{getLayerSvg as $,getSvgArea as V}from"../data/svg.js";import{GaEventActions as K,sendEventToGa as Z}from"../tools/gtag";import P from"../tools/logger";import{areLayersEnabled as q}from"../utils/areLayersEnabled";import{calcSpeed as w}from"../utils/calcSpeed";import{calcTravelTime as A}from"../utils/calcTravelTime";import{calculateRelativeBearing as W,convertGpsToLocal as C,isValidPointCoords as b,toCoordinate as p}from"../utils/gps";import{boothToEndpoint as I,buildRoute as j,CURRENT_LOCATION_NAME as X,CURRENT_POSITION_POINT_ID as Y,isWayfindingReady as H,KIOSK_ANCHOR_POINT_ID as J,toArbitraryPoint as M}from"../wayfinding";import h,{layersStore as x,uiState as u}from".";import{BoothBase as m}from"./BoothStore";import{LayersMode as Q}from"./LayerStore";import{revealLayer as N}from"./reveal-layer.js";export default class r{constructor(t){this.routeLines=[],this.routeDistance=null,this.currentPosition=null,this.requestCompass=!1,this.iconType=0,this.tappedBooth=null,this.focusEnabled=!0,this.prevZ=null,this.markersData={icons:[],markers:[]},this.prevMarkers=[],this.pendingReveal=null,this.lastDirection=void 0,this.directionScheduled=!1,this.showAccessible=!1,this.onlyAccessible=!1,this.currentRouteLayer=null,this.currentRouteExhibitor=null,this.routeUnits=D,this.isGpsTrackingEnabled=!0,this.rootStore=t,this.focusEnabled=!window.location.search}get tempToBooth(){const t=this.tappedBooth;return t?.exhibitors.some(e=>e===u.details)?t:null}set tempToBooth(t){this.tappedBooth=t}get canFindLocation(){return!!u.kioskData||!!this.currentPosition}selectRoute(t,e=!0,o=!1){if(e&&(u.list={type:"search",text:"",focused:!1}),t&&!t.from&&t.to){const c=this.resolveFallbackFrom();c&&(t=new Route(c,t.to,t.waypoints))}t?.from&&t?.to&&t.from===t.to&&(t=null);const s=[];t?.from&&t?.to&&window.setTimeout(()=>{this.rootStore.showMap()},navigator.userAgent.toLowerCase().indexOf("android")>-1?400:50),t?.from instanceof m&&t.from.visible&&s.push(t.from),t?.to instanceof m&&t.to.visible&&(this.tempToBooth=null,s.push(t.to)),t||this.emitDirection(null);const a=d(()=>{if(this.rootStore.moveToList(s),u.details=t,t&&(this.lastDirection=void 0),t&&(!t.from||!t.to)&&u.overlayBottom&&(u.desiredOverlaySize="medium"),t?.to&&t?.from){const c=tt(t.from);c&&this.rootStore.layerStore.updateVisibility(c,!0)}if(!this.currentRouteLayer){const c=O(this.rootStore.layerStore,t?.from),g=O(this.rootStore.layerStore,t?.to);c?this.currentRouteLayer=c:g&&(this.currentRouteLayer=g)}e&&t?.from&&t?.to&&Z(K.ClickDirections,`${t?.from?"From "+t.from.name:""} ${t?.to?"To "+t.to.name:""}`)});if(clearTimeout(this.pendingDetails),this.pendingDetails=void 0,o||!t){a();return}const l=u.details;this.pendingDetails=window.setTimeout(()=>{this.pendingDetails=void 0,u.details===l&&a()},200)}rebuildRouteFromPosition(t){if(this.pendingDetails!==void 0)return;const e=u.selectedRoute;e?.to&&this.selectRoute(new Route(t,e.to,e.waypoints),!1,!0)}resolveFallbackFrom(){if(this.currentPosition)return M(this.currentPosition,X,Y);const t=u.kioskData;return t?M({x:t.x,y:t.y,z:t.z??void 0},G(),J):null}setStartPoint(t){const e=u.selectedRoute;if(e?.to&&!e?.from&&t){const o=new Route(t,e.to,e.waypoints);this.selectRoute(o)}}get pathLayers(){return h.routeStore.routeLines?.map(t=>t.p0.layer)?.filter((t,e,o)=>o.indexOf(t)===e).map((t,e)=>({id:e+1,layer:h.layerStore.findLayer(t)}))}getNearestBooth(t){if(!t)return null;const e=this.rootStore.layerStore.findLayer(t.z),o=E()?.properties.config,s=!!(t.lat&&t.lng),a=o&&s?C(t,o):t;return!a||!b(a.x)||!b(a.y)?null:this.rootStore.boothStore.booths.filter(l=>x.mode===Q.Default||!e?l.visible&&l.rect:l.rect&&(typeof t.z!="number"&&!t.z&&l.visible||e.name===l.layer?.name)).sort((l,c)=>v(a,l.rect.center)-v(a,c.rect.center))[0]||null}setMarkers(t){this.markersData.markers=(t?.markers??[]).map(et),this.markersData.icons=t?.icons??[]}selectMarker(t,e){const o=this.markersData.markers.find(a=>a.id===t);this.markersData.markers.forEach(a=>a.active=!1),o&&(o.active=!0);const s=h.layerStore.findLayer(o?.z);if(e&&o){s&&!s?.visible&&x.updateVisibility(s,!0);const a=L();return a?a.api.panTo({x:o.x,y:o.y}):(P.warn("Map camera is not mounted. Cannot pan to marker."),Promise.resolve())}return Promise.resolve()}get selectedMarkers(){return this.markersData.markers.filter(t=>t.active)}get layers(){const t=[];return h.routeStore.routeLines?.map(e=>e.p0.layer).forEach(e=>{t.indexOf(e)===-1&&t.push(e)}),t.map(e=>h.layerStore.layers.find(o=>o.name===e)).filter(e=>!!e)}clickRoute(t,e){window.__resett&&window.__resett(),this.rootStore.uiState.menu=!1,u.list.type==="route-planner"&&(u.list={type:"search",text:"",focused:!1}),this.selectRoute(new Route(t,e))}selectCurrentPosition(t,e=!0,o){clearTimeout(this.cpTimeout),t&&(t.x=p(t.x),t.y=p(t.y),t.lat!==void 0&&(t.lat=p(t.lat)),t.lng!==void 0&&(t.lng=p(t.lng)),q()||(t.z=void 0));const s=e&&this.rootStore.uiState.details&&!(this.rootStore.uiState.details instanceof Route),a=e&&!s&&(this.focusEnabled||this.prevZ!=t?.z);this.focusEnabled&&(this.focusEnabled=!1),this.prevZ=t?.z?.toString()??null,this.iconType=o?1:0;const l=t?ot(t):null;if(!t||!l){this.currentPosition=null;return}const c=h.layerStore.findLayer(t.z),g=new CurrentPosition(l.x,l.y,c?.name||this.currentRouteLayer?.name,W(l),t.lat,t.lng);let k=!this.routeLines?.length;c&&this.routeLines?.length&&(k=!!this.routeLines.find(R=>R.p0.layer===c.name||R.p1.layer===c.name));const _=a&&k;this.currentPosition=g,_&&this.focusOnPosition(g,c),this.gpsEnabled||(this.cpTimeout=setTimeout(()=>{this.currentPosition&&this.selectCurrentPosition(null,!1)},30*1e3))}findLocation(){if(!this.canFindLocation)return;const t=this.currentPosition??u.kioskData;t&&(this.currentPosition&&localStorage.getItem(U)==="false"&&(h.routeStore.requestCompass=!0),this.pendingReveal?.(),this.pendingReveal=N({layer:h.layerStore.findLayer(t.z),show:e=>x.updateVisibility(e,!0),then:()=>{u.moveToRect=this.findLocationRect(t)}}))}findLocationRect(t){const e=S.fromCenter(t,{x:100,y:100}),o=V();if(e.intersects(o))return e;const s=Math.max(o.min.x,Math.min(t.x,o.max.x)),a=Math.max(o.min.y,Math.min(t.y,o.max.y)),l=Math.min(o.size.width,o.size.height)*.3,c=S.fromCenter({x:s,y:a},{x:l,y:l}).intersection(o);return c?S.fromUnion(e,c):e}focusOnPosition(t,e){this.pendingReveal?.(),this.pendingReveal=N({layer:e,show:o=>x.updateVisibility(o,!0),then:()=>{if(h.maplibreStore.showMaplibre){u.moveToLocation=!0;return}const o=L();if(o){o.api.panTo({x:t.x,y:t.y});return}P.warn("Map camera is not mounted. Cannot pan to current position.")}})}get routeInfo(){const t=this.routeDistance,e=this.routeUnits;return t?{distance:`${t}${e}`,units:e,time:A(t,w(e))}:null}updateRoute(t,e){!t?.length&&!this.routeLines.length||(this.routeLines=t,this.scheduleDirection())}updateRouteDistance(t){if(t==null)return;const e=$(),o=(e.getAttribute("units")||D).toLowerCase?.().trim(),s=e.getAttribute("fp-ver")?.startsWith("5")??!1;this.routeDistance=Math.round(t/(s?1:10)),this.routeUnits=o,this.scheduleDirection()}scheduleDirection(){this.directionScheduled||(this.directionScheduled=!0,Promise.resolve().then(()=>{this.directionScheduled=!1,this.emitDirection(this.directionPayload())}))}directionPayload(){const t=u.selectedRoute,e=this.routeDistance,o=this.routeUnits;return{from:B(t?.from??null),to:B(t?.to??null),lines:this.routeLines,distance:e==null?"":`${e}${o}`,units:o,time:A(e??0,w(o))}}emitDirection(t){t&&it(this.lastDirection,t)||(this.lastDirection=t,this.rootStore.fp.onDirection?.(t))}checkRoutes(){if(!H()){console.warn("checkRoutes: wayfinding is not initialized \u2014 call createWayfinding() first. Skipping route check.");return}const t=h.boothStore.booths;console.info(`Route check started ${t.length}.... `);for(let e=0;e<t.length;e++){const o=t[e];for(let s=e+1;s<t.length;s++){const a=t[s];j(I(o),I(a)).lines.length||console.warn(`No route found from ${o.name} to ${a.name}`)}}console.info("Route check done....")}setGpsTrackingEnabled(t){this.isGpsTrackingEnabled=t}get gpsEnabled(){return T.autoTrackingGps&&this.isGpsTrackingEnabled&&!T.enableIPS}setOnlyAccessible(t){this.onlyAccessible=t}}n([f],r.prototype,"routeLines",void 0),n([f],r.prototype,"routeDistance",void 0),n([f],r.prototype,"currentPosition",void 0),n([f],r.prototype,"requestCompass",void 0),n([f],r.prototype,"iconType",void 0),n([f],r.prototype,"tappedBooth",void 0),n([f],r.prototype,"focusEnabled",void 0),n([f],r.prototype,"prevZ",void 0),n([f],r.prototype,"markersData",void 0),n([f],r.prototype,"prevMarkers",void 0),n([f],r.prototype,"showAccessible",void 0),n([f],r.prototype,"onlyAccessible",void 0),n([f],r.prototype,"currentRouteLayer",void 0),n([f],r.prototype,"currentRouteExhibitor",void 0),n([y],r.prototype,"canFindLocation",null),n([d],r.prototype,"selectRoute",null),n([d],r.prototype,"rebuildRouteFromPosition",null),n([d],r.prototype,"setStartPoint",null),n([y({keepAlive:!0})],r.prototype,"pathLayers",null),n([d],r.prototype,"setMarkers",null),n([d],r.prototype,"selectMarker",null),n([y({keepAlive:!0})],r.prototype,"selectedMarkers",null),n([y({keepAlive:!0})],r.prototype,"layers",null),n([d],r.prototype,"clickRoute",null),n([d],r.prototype,"selectCurrentPosition",null),n([d],r.prototype,"findLocation",null),n([f],r.prototype,"routeUnits",void 0),n([y],r.prototype,"routeInfo",null),n([d],r.prototype,"updateRoute",null),n([d],r.prototype,"updateRouteDistance",null),n([d],r.prototype,"checkRoutes",null),n([f],r.prototype,"isGpsTrackingEnabled",void 0),n([d],r.prototype,"setGpsTrackingEnabled",null),n([y({keepAlive:!0})],r.prototype,"gpsEnabled",null),n([d],r.prototype,"setOnlyAccessible",null);function tt(i){if(i)return i instanceof m?i.layer?.name:i.layer}function O(i,t){return t?t instanceof m?t.layer??null:i.findLayer(t.layer):null}function et(i){return{...i,x:p(i.x),y:p(i.y),lat:i.lat===void 0?void 0:p(i.lat),lng:i.lng===void 0?void 0:p(i.lng)}}function ot(i){const t=E()?.properties.config??null;let e=null;return t&&z({min:t.p0,max:t.p2},i)?e={...i}:t&&b(i.lat)&&b(i.lng)?e=C(i,t):t||(e=i),e||null}export function findBooth(i){return h.boothStore.findBooth(i)||h.exhibitorStore.findExhibitor(i)?.booths[0]}export function findEntityByExternalId(i){const t=h.boothStore.boothByExternalId.get(i);if(t)return{type:"booth",entity:t};const e=h.exhibitorStore.exhibitorByExternalId.get(i);if(e)return{type:"exhibitor",entity:e}}export function separateExternalIds(i){const t=[],e=[];for(const o of i){const s=findEntityByExternalId(o);s&&(s.type==="booth"?t.push(o):e.push(o))}return{boothExternalIds:t,exhibitorExternalIds:e}}export function extractRoute(i,t,e){return new Route(findBooth(i)??null,findBooth(t)??null,e?.map(o=>findBooth(o)).filter(o=>!!o))}export class Route{constructor(t,e,o){this.from=t,this.to=e,this.waypoints=o;const s=t instanceof m?t.id:void 0,a=e instanceof m?e.id:void 0;this.waypoints=o?.filter(l=>l&&l.id!==s&&l.id!==a)}}function B(i){return i?i instanceof m?{id:i.id,name:i.name,externalId:i.externalId,layer:{name:i.layer?.name,description:i.layer?.description}}:{id:Number.MAX_SAFE_INTEGER,name:i.name,externalId:void 0,layer:{name:i.layer,description:void 0}}:null}function it(i,t){return i===void 0?!1:i===null?!t.from&&!t.to&&!t.lines.length:F.structural(i,t)}export class CurrentPosition{constructor(t,e,o,s,a,l){this.x=t,this.y=e,this.z=o,this.angle=s,this.lat=a,this.lng=l}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{setConfig as d}from"@expofp/config";import{vi as t}from"vitest";let c={};async function S(r={}){
|
|
1
|
+
import{setConfig as d}from"@expofp/config";import{vi as t}from"vitest";let c={};async function S(r={}){g();const{default:e}=await import("../store/UIState.js"),n={fp:{},...r};return n.uiState=c=new e(n),n}export async function createUIState(r={}){return(await S(r)).uiState}export async function createRouteStore(r={}){const e=await S({fp:{},moveToList:t.fn(),showMap:t.fn(),layerStore:{layers:[],updateVisibility:t.fn(),findLayer:t.fn(()=>null)},...r}),{default:n,Route:o}=await import("../store/RouteStore.js"),a=new n(e);return e.routeStore=a,{routeStore:a,uiState:e.uiState,rootStore:e,Route:o}}export async function createSearchButtonsStore(r={}){const{routeStore:e,uiState:n,rootStore:o,Route:a}=await createRouteStore({fp:{hidePathways:t.fn(),getOptimizedRoutes:()=>[]},boothStore:{booths:[]},poiTypeStore:{poiTypes:[]},categoryFilterStore:{state:{selectedItems:[],pendingItems:[]},openFilter:t.fn()},searchStore:{selectSearchAndFocus:t.fn(),setFocused:t.fn()},...r}),{default:f}=await import("../store/RoutePlannerStore.js"),{URLFilterManager:l}=await import("../services/URLFilterManager.js"),{default:p}=await import("../store/search-buttons/SearchButtonsStore.js"),s=new f(o);o.routePlannerStore=s;const i=new p(o);o.searchButtonsStore=i;const u=new l(o);return o.urlFilterManager=u,{searchButtonsStore:i,routePlannerStore:s,routeStore:e,urlFilterManager:u,uiState:n,rootStore:o,Route:a}}function g(){window.__efpEvent="demo",HTMLCanvasElement.prototype.getContext=(()=>new Proxy({},{get:()=>()=>{}})),t.doMock("../store/index.js",()=>({get uiState(){return c}})),t.doMock("../data/svg.js",()=>({svgArea:()=>null,svgAreaExplicit:()=>null,getLayerSvg:()=>document.createElementNS("http://www.w3.org/2000/svg","svg")})),t.doMock("../tools/gtag.js",()=>({hasUserConsent:()=>!1,sendEventToGa:t.fn(),GaEventActions:{}})),d({expo:"demo",fpSvgJsRef:{},fpSvgLayerJsRefs:{}})}
|
package/dist/esm/utils/gps.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CurrentPosition } from '../store/RouteStore';
|
|
1
|
+
import { type CurrentPosition } from '../store/RouteStore';
|
|
2
2
|
export interface GpsConfig {
|
|
3
3
|
p0: {
|
|
4
4
|
x: number;
|
|
@@ -25,6 +25,10 @@ export interface PointWithAngle {
|
|
|
25
25
|
angle?: number;
|
|
26
26
|
}
|
|
27
27
|
export declare function isValidPointCoords(value: unknown): value is number;
|
|
28
|
+
/** A coordinate as the SDK may deliver it — `1.5`, or `"1,5"` from a comma locale. */
|
|
29
|
+
export declare function toCoordinate(value: string | number): number;
|
|
30
|
+
/** Whether `toCoordinate` turns `value` into a finite number; a blank string does not count. */
|
|
31
|
+
export declare function isCoordinate(value: unknown): boolean;
|
|
28
32
|
export declare function convertGpsToLocal({ lat, lng, angle }: Pick<CurrentPosition, 'lat' | 'lng' | 'angle'>, config: GpsConfig): PointWithAngle | null;
|
|
29
33
|
export declare function convertLocalToGps(x: number, y: number, geoConfig: GpsConfig): [number, number];
|
|
30
34
|
export declare function calculateRelativeBearing(point: PointWithAngle): number;
|
package/dist/esm/utils/gps.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{haversineDistance as m,lineCenter as x,lineLength as d,pointDistance as
|
|
1
|
+
import{haversineDistance as m,lineCenter as x,lineLength as d,pointDistance as b,projectGpsToLocal as y,projectLocalToGps as G}from"@expofp/geometry";import{getFpGeo as N}from"../data/fpGeo.js";import a from"../tools/logger";import{planBearing as C}from"./planBearing";function c(n){return[{local:{x:n.p0.x,y:n.p0.y},geo:{lat:n.p0.lat,lng:n.p0.lng}},{local:{x:n.p2.x,y:n.p2.y},geo:{lat:n.p2.lat,lng:n.p2.lng}}]}export function isValidPointCoords(n){return typeof n=="number"&&Number.isFinite(n)}export function toCoordinate(n){return typeof n=="string"?Number(n.replace(",",".")):n}export function isCoordinate(n){return typeof n=="string"?n.trim()!==""&&isValidPointCoords(toCoordinate(n)):isValidPointCoords(n)}export function convertGpsToLocal({lat:n,lng:t,angle:o},i){if(!(isValidPointCoords(n)&&isValidPointCoords(t)))return null;const{p0:e,p2:r}=i,p=m(e,r);if(!isValidPointCoords(p)||p<=0)return a.warn("Invalid GPS config: zero or negative distance",{fullGpsDistance:p,p0:e,p2:r}),null;const[s,u]=c(i),l=y({lat:n,lng:t},s,u),g=d({p0:l,p1:x({p0:e,p1:r})}),f=b(e,r);return g>5*f?(a.warn("Current position too far"),null):{...l,angle:o}}export function convertLocalToGps(n,t,o){const[i,e]=c(o),{lat:r,lng:p}=G({x:n,y:t},i,e);return[p,r]}export function calculateRelativeBearing(n){const t=N()?.properties?.config,o=t?C(t.p0,t.p2):NaN,i=Number.isFinite(o)?o:t?.bearing??0;return n?.angle===null?0:((((n.angle??NaN)-i)%360+360)%360-90+360)%360}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expofp/floorplan",
|
|
3
|
-
"version": "3.46.
|
|
3
|
+
"version": "3.46.1",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/expofp/efp-app.git",
|
|
@@ -69,15 +69,15 @@
|
|
|
69
69
|
"tslib": "^2.3.0",
|
|
70
70
|
"uuid": "^9.0.1",
|
|
71
71
|
"zod": "4.4.3",
|
|
72
|
-
"@expofp/config": "3.46.
|
|
73
|
-
"@expofp/debug": "3.46.
|
|
74
|
-
"@expofp/geometry": "3.46.
|
|
75
|
-
"@expofp/renderer": "3.46.
|
|
76
|
-
"@expofp/resolve": "3.46.
|
|
77
|
-
"@expofp/schema": "3.46.
|
|
78
|
-
"@expofp/ui": "3.46.
|
|
79
|
-
"@expofp/utils": "3.46.
|
|
80
|
-
"@expofp/wayfinding": "3.46.
|
|
72
|
+
"@expofp/config": "3.46.1",
|
|
73
|
+
"@expofp/debug": "3.46.1",
|
|
74
|
+
"@expofp/geometry": "3.46.1",
|
|
75
|
+
"@expofp/renderer": "3.46.1",
|
|
76
|
+
"@expofp/resolve": "3.46.1",
|
|
77
|
+
"@expofp/schema": "3.46.1",
|
|
78
|
+
"@expofp/ui": "3.46.1",
|
|
79
|
+
"@expofp/utils": "3.46.1",
|
|
80
|
+
"@expofp/wayfinding": "3.46.1"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
83
|
"@babel/plugin-proposal-decorators": "^8.0.2",
|