@expofp/floorplan
Version:
Interactive floor plan library for expos and events
151 lines • 6.89 kB
TypeScript
import { type Consent } from '@expofp/config';
import { type Camera, type ListPanel, type PlannerOptions } from '@expofp/schema';
import { type InternalSettings } from './internal-settings.js';
import type { CurrentPosition, Floor, FloorPlan, FloorPlanBookmarkClickEvent, FloorPlanBoothClickEvent, FloorPlanCategory, FloorPlanCustomButtonEvent, FloorPlanDetailsEvent, FloorPlanDirectionEvent, FloorPlanGetCoordsEvent, FloorPlanIcon, FloorPlanMarkerEvent, FloorPlanOptions, FloorPlanVisitedClickEvent, GeoConfig, MaplibreOptions, MarkersData, RouteInfo, RouteWaypoint, Visibility } from './types';
import { type Bounds, type POISelectors } from './types/sdk.types';
/**
* A host element carries the plan occupying it, so a second `load()` into the
* same container can be refused and {@link FloorPlan.destroy} can hand the
* element back by clearing the mark.
*/
export type FloorPlanHostElement = HTMLDivElement & {
__expofp?: FloorPlan;
};
/** Rejection reason for {@link FloorPlan.ready} when the plan is destroyed mid-load. */
export declare const DESTROYED_BEFORE_READY = "FloorPlan destroyed before it finished loading";
export default class FloorPlanLoader implements FloorPlan {
protected readonly renderTarget: HTMLDivElement;
private readonly _ready;
readonly element: HTMLDivElement;
readonly eventId: string;
readonly noOverlay: boolean;
readonly offHistory: boolean;
readonly ignoreQuery: boolean;
protected readonly consent: Consent;
readonly onInit: (fp: FloorPlan) => void;
readonly disableRuntimeAlerts: boolean;
readonly viewerMode: boolean;
readonly maplibre: MaplibreOptions | undefined;
/** Called with an event by the `__efpStyleLoad` listener, and bare to drain the registry on construction. */
protected efpStyleLoadHandler: (e?: Event) => void;
protected resolveReady: () => void;
/** Counterpart of {@link resolveReady}, called by {@link destroy}; same assignment caveat. */
protected rejectReady: (reason: Error) => void;
readonly icons: Map<FloorPlanIcon, HTMLImageElement>;
enableRotation: boolean;
alwaysShowSidebar: boolean;
/** Set by {@link destroy}; checked by `init()` so a plan destroyed mid-load never mounts. */
protected destroyed: boolean;
get ready(): Promise<void>;
get previewMode(): boolean;
/** @deprecated The consent decision lives on the config — set the `consent` option instead. */
get allowConsent(): boolean | undefined;
/** Grey surface for mobile SDKs — see internal-settings.ts; deliberately not on `FloorPlan`. */
getInternalSettings(): InternalSettings;
onBoothClick: (e: FloorPlanBoothClickEvent) => void;
onBookmarkClick: (e: FloorPlanBookmarkClickEvent) => void;
onVisitedClick: (e: FloorPlanVisitedClickEvent) => void;
onCategoryClick: (e: FloorPlanCategory) => void;
onFpConfigured: () => void;
onDirection: (e: FloorPlanDirectionEvent | null) => void;
onDetails: (e: FloorPlanDetailsEvent) => void;
onExhibitorCustomButtonClick: (e: FloorPlanCustomButtonEvent) => void;
onGetCoordsClick: (e: FloorPlanGetCoordsEvent) => void;
onMarkerClick: (e: FloorPlanMarkerEvent) => void;
onLeaveEvent?: () => void;
selectBooth(nameOrExternalId: string | string[]): void;
selectExhibitor(nameOrExternalId: string | string[]): void;
selectRoute(startOrWaypoints: RouteWaypoint | RouteWaypoint[], to?: RouteWaypoint): void;
getOptimizedRoutes(waypoints: RouteWaypoint[]): RouteInfo[];
selectCurrentPosition(point: CurrentPosition, focus: boolean, icon?: number): void;
setBookmarks(bookmarks: {
name?: string;
externalId?: string;
bookmarked: boolean;
}[]): void;
setEntitiesBookmarks(bookmarks: {
type: 'exhibitor' | 'event' | 'speaker' | 'booth';
name?: string;
externalId?: string;
bookmarked: boolean;
}[]): void;
setEntitiesVisited(entities: {
type: 'exhibitor' | 'event';
name?: string;
externalId?: string;
visited: boolean;
}[]): void;
setMarkers(markersData: MarkersData): void;
/** @deprecated Use activateFloor instead */
updateLayerVisibility(layer: string, visible: boolean): void;
getCenterCoordinates(): any;
applyParameters(parameters: string): void;
exhibitorsList(): any;
boothsList(): any;
categoriesList(): any;
selectCategory(nameOrSlug?: string): void;
select(slugOrExternalId: string): void;
showList(list: ListPanel): void;
selectTour(tourId: string): void;
openPlanner(options?: PlannerOptions): void;
startBuildRoute(): void;
getVisibility(): any;
setVisibility(visibility: Visibility): void;
findLocation(): void;
zoomIn(): void;
zoomOut(): void;
zoomTo(selector: POISelectors, options?: {
padding?: number;
}): void;
switchView(): void;
setCamera(camera: Camera): void;
getCamera(): Camera;
fitBounds(): void;
getBounds(selectors: POISelectors): Bounds | undefined;
getBoothRect(name: string): any;
convertToGeo(x: number, y: number): any;
getGeoConfig(): GeoConfig | null;
/**
* Raises the `destroyed` flag — which the pending `init()` checks before it
* mounts anything — settles {@link ready}, then hands the state-specific
* teardown to {@link releaseResources}. The guard lives here so both states
* are idempotent through one implementation.
*/
destroy(): void;
/** @deprecated Renamed to {@link destroy}. */
unstable_destroy(): void;
/**
* Undoes the constructor's side effects — the teardown for a plan destroyed
* while still loading, where there is no mounted UI yet.
*
* `FloorPlanReady` overrides this to unwind the mounted plan first, then
* calls back here through `super`.
*/
protected releaseResources(): void;
highlightExhibitors(externalIds: string[]): void;
highlightBooths(externalIds: string[]): void;
onCurrentPositionChanged(point: CurrentPosition): void;
search(term: string): Promise<{
item: unknown;
score: number;
}[]>;
getFloors(): Floor[];
onFloorActivated(floor: Floor): void;
activateFloor(floorId: {
name?: string;
index?: number;
}): void;
showPathway(name: string, boothExternalIds: string[]): void;
showPathwayOnly(pathwayId: string, floorId: string): void;
hidePathways(): void;
showSearch(): void;
changeLanguage(langId: string): void;
isGpsTrackingEnabled(): boolean;
setGpsTrackingEnabled(value: boolean): void;
deselectCurrentPosition(): void;
deselectRoute(): void;
reset(): void;
selectAccessibleRoute(waypoints: RouteWaypoint[]): void;
constructor(options: FloorPlanOptions, element: HTMLDivElement);
}
//# sourceMappingURL=floorplan.loader.d.ts.map