UNPKG

@expofp/floorplan

Version:

Interactive floor plan library for expos and events

2 lines (1 loc) • 1 kB
import{reaction as l}from"mobx";import s,{uiState as i}from"../store";import u from"../tools/settings";import{BoothBase as p}from"./BoothStore";import{Category as d}from"./CategoryStore";import{Exhibitor as m}from"./ExhibitorStore";import{Route as h}from"./RouteStore";export function bindDetailsEvents(){return l(()=>i.details,()=>{if(!i.onDetails)return;if(!i.details){i.onDetails(null);return}let t=i.details;if(u.EXPO==="wineparis"&&(t instanceof m&&(t=t.booths[0]),!t))return;let o=null,r=[];t instanceof m?(o="exhibitor",r=t.booths.map(e=>e.name).sort((e,a)=>e==s.routeStore.tempToBooth?.name?-1:a==s.routeStore.tempToBooth?.name?1:0)):t instanceof p?(o="booth",r=[t.name]):t instanceof h?(o="route",r=[t.from?.name,t.to?.name].filter(e=>!!e)):t instanceof d&&(o="category",r=t.exhibitors.map(e=>e.booths.map(a=>a.name)).flat());const n=t,f={type:o,name:n?.name,id:n?.id,externalId:n?.externalId,boothsNames:r};i.onDetails({...f,...o==="route"?{routeInfo:s.routeStore.routeInfo??void 0}:{}})})}