@mappedin/events 6.7.0-beta.0 → 6.9.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,101 @@
1
- import { AnnotationCollection, AnnotationSymbol, AreaCollection, AreaId, Category as MVFCategory, CategoryId, Connection as MVFConnection, Details, EnterpriseCategory as MVFEnterpriseCategory, EnterpriseCategory as MvfEnterpriseCategory, EnterpriseCategoryId as MVFEnterpriseCategoryId, EnterpriseLocation as MVFEnterpriseLocation, EnterpriseLocation as MvfEnterpriseLocation, EnterpriseLocationId as MVFEnterpriseLocationId, EnterpriseLocationInstance, EnterpriseVenue as MVFEnterpriseVenue, EnterpriseVenueType, EntranceCollection, EntranceFeature, Facade as MVFFacade, Feature, Feature as MVFFeature, FeatureCollection, FloorCollection, FloorProperties as MVFFloor, FloorProperties as MvfFloor, FloorStack as MVFFloorStack, FloorStack as MvfFloorStack, Geometry, Hyperlink as MVFHyperlink, Image as MVFImage, Language, LineStringStyle as TMVFLineStringStyle, Location as MVFLocation, LocationId, LocationLink, LocationSocial, LocationState, MultiPolygon, NavigationFlagDeclarations, NodeCollection, NodeCollection as MVFNodeCollection, NodeId, ObstructionCollection, ObstructionFeature, ObstructionId, ObstructionProperties, OpeningHoursSpecification, OperationHours, ParsedMVF, ParsedMVF as TMVF, ParsedMVFLocalePack, Point, PointStyle as TMVFPointStyle, Polygon, PolygonStyle as TMVFPolygonStyle, SiblingGroup, SpaceCollection, SpaceFeature, SpaceId, SpaceProperties, Style as TMVFStyle, StyleCollection as TMVFStyleCollection, TilesetStyle } from '@mappedin/mvf-v2';
1
+ import { AnnotationCollection, AnnotationSymbol, AreaCollection, AreaId, Category as MVFCategory, CategoryId, Connection as MVFConnection, Details, EnterpriseCategory as MVFEnterpriseCategory, EnterpriseCategory as MvfEnterpriseCategory, EnterpriseCategoryId as MVFEnterpriseCategoryId, EnterpriseLocation as MVFEnterpriseLocation, EnterpriseLocation as MvfEnterpriseLocation, EnterpriseLocationId as MVFEnterpriseLocationId, EnterpriseLocationInstance, EnterpriseVenue as MVFEnterpriseVenue, EnterpriseVenueType, EntranceCollection, EntranceFeature, Facade as MVFFacade, Feature, Feature as MVFFeature, FeatureCollection, FloorCollection, FloorProperties as MVFFloor, FloorProperties as MvfFloor, FloorStack as MVFFloorStack, FloorStack as MvfFloorStack, Geometry, Hyperlink as MVFHyperlink, Image as MVFImage, Language, LineStringStyle as TMVFLineStringStyle, Location as MVF2Location, LocationId, LocationLink, LocationSocial, LocationState, MVFv2_STANDARD_MVFv3, MultiPolygon, NavigationFlagDeclarations, NodeCollection, NodeCollection as MVFNodeCollection, NodeId, ObstructionCollection, ObstructionFeature, ObstructionId, ObstructionProperties, OpeningHoursSpecification, OperationHours, ParsedMVF, ParsedMVF as TMVF, ParsedMVFLocalePack, Point, PointStyle as TMVFPointStyle, Polygon, PolygonStyle as TMVFPolygonStyle, SiblingGroup, SpaceCollection, SpaceFeature, SpaceId, SpaceProperties, Style as TMVFStyle, StyleCollection as TMVFStyleCollection, TilesetStyle } from '@mappedin/mvf-v2';
2
2
  import { ParsedMVF } from '@mappedin/mvf-v2/no-validator';
3
3
 
4
+ interface DebouncedFunction<T extends (...args: any[]) => void> {
5
+ (...args: Parameters<T>): void;
6
+ /**
7
+ * Cancels any pending debounced execution
8
+ */
9
+ cancel: () => void;
10
+ }
11
+ declare class PubSub<EVENT_PAYLOAD, EVENT extends keyof EVENT_PAYLOAD = keyof EVENT_PAYLOAD> {
12
+ /**
13
+ * @private
14
+ * @internal
15
+ */
16
+ private _subscribers;
17
+ /**
18
+ * @private
19
+ * @internal
20
+ * AbortController for managing lifecycle and cleanup
21
+ */
22
+ private _abortController;
23
+ /**
24
+ * @protected
25
+ * @internal
26
+ * Tracks all cleanup functions for subscriptions made via on()
27
+ */
28
+ protected _cleanupFunctions: Array<() => void>;
29
+ /**
30
+ * Returns the AbortSignal for this PubSub instance.
31
+ * Use this signal with APIs that support cancellation (fetch, addEventListener, etc.)
32
+ * When the PubSub is destroyed, the signal will be aborted and all listeners using it will be automatically removed.
33
+ *
34
+ * @example
35
+ * ```typescript
36
+ * // Automatically cleaned up when PubSub is destroyed
37
+ * pubsub.addEventListener(window, 'resize', handler, { signal: pubsub.signal });
38
+ * ```
39
+ */
40
+ get signal(): AbortSignal;
41
+ /**
42
+ * @private
43
+ * @internal
44
+ */
45
+ publish<EVENT_NAME extends EVENT>(eventName: EVENT_NAME, data?: EVENT_PAYLOAD[EVENT_NAME]): void;
46
+ /**
47
+ * Subscribe a function to be called when the signal is aborted.
48
+ * @param fn The function to call when the signal is aborted.
49
+ */
50
+ onAbort<T extends (...args: any[]) => void>(fn: T): void;
51
+ /**
52
+ * Subscribe a function to an event.
53
+ *
54
+ * @param eventName An event name which, when fired, will call the provided
55
+ * function.
56
+ * @param fn A callback that gets called when the corresponding event is fired. The
57
+ * callback will get passed an argument with a type that's one of event payloads.
58
+ * @param options Optional options object. If a signal is provided, the subscription will be
59
+ * automatically cleaned up when that signal is aborted.
60
+ * @returns A cleanup function that unsubscribes the event listener when called.
61
+ * @example
62
+ * // Subscribe to the 'click' event
63
+ * const handler = (event) => {
64
+ * const { coordinate } = event;
65
+ * const { latitude, longitude } = coordinate;
66
+ * console.log(`Map was clicked at ${latitude}, ${longitude}`);
67
+ * };
68
+ * map.on('click', handler);
69
+ */
70
+ on<EVENT_NAME extends EVENT>(eventName: EVENT_NAME, fn: (payload: EVENT_PAYLOAD[EVENT_NAME] extends {
71
+ data: null;
72
+ } ? EVENT_PAYLOAD[EVENT_NAME]["data"] : EVENT_PAYLOAD[EVENT_NAME]) => void, options?: {
73
+ signal?: AbortSignal;
74
+ }): () => void;
75
+ /**
76
+ * Unsubscribe a function previously subscribed with {@link on}
77
+ *
78
+ * @param eventName An event name to which the provided function was previously
79
+ * subscribed.
80
+ * @param fn A function that was previously passed to {@link on}. The function must
81
+ * have the same reference as the function that was subscribed.
82
+ * @example
83
+ * // Unsubscribe from the 'click' event
84
+ * const handler = (event) => {
85
+ * console.log('Map was clicked', event);
86
+ * };
87
+ * map.off('click', handler);
88
+ */
89
+ off<EVENT_NAME extends EVENT>(eventName: EVENT_NAME, fn: (payload: EVENT_PAYLOAD[EVENT_NAME] extends {
90
+ data: null;
91
+ } ? EVENT_PAYLOAD[EVENT_NAME]["data"] : EVENT_PAYLOAD[EVENT_NAME]) => void): void;
92
+ /**
93
+ * @private
94
+ * @internal
95
+ * Destroys the PubSub instance and automatically unsubscribes all listeners registered via on().
96
+ */
97
+ destroy(): void;
98
+ }
4
99
  declare const VALID_CONTEXTS: readonly [
5
100
  "websdk",
6
101
  "web",
@@ -71,7 +166,7 @@ declare class AnalyticsInternal {
71
166
  /**
72
167
  * @internal
73
168
  */
74
- sendGetDirectionsEvent: (start: string, end: string, accessible?: boolean | undefined) => void;
169
+ sendGetDirectionsEvent: DebouncedFunction<(start: string, end: string, accessible?: boolean) => void | Promise<Response> | Promise<void>>;
75
170
  sendBlueDotEvents(event: BlueDotEvents): void | Promise<Response> | Promise<void>;
76
171
  }
77
172
  type UpdateStateParam = Partial<Pick<AnalyticState, "geolocationMode" | "context" | "logEvents" | "userPosition" | "mapId" | "sendEvents" | "logEvents" | "accessToken" | "sessionId" | "deviceId">>;
@@ -3909,94 +4004,6 @@ declare function bigint$2<T = unknown>(params?: string | core.$ZodBigIntParams):
3909
4004
  interface ZodCoercedDate<T = unknown> extends schemas$1._ZodDate<core.$ZodDateInternals<T>> {
3910
4005
  }
3911
4006
  declare function date$3<T = unknown>(params?: string | core.$ZodDateParams): ZodCoercedDate<T>;
3912
- declare class PubSub<EVENT_PAYLOAD, EVENT extends keyof EVENT_PAYLOAD = keyof EVENT_PAYLOAD> {
3913
- /**
3914
- * @private
3915
- * @internal
3916
- */
3917
- private _subscribers;
3918
- /**
3919
- * @private
3920
- * @internal
3921
- * AbortController for managing lifecycle and cleanup
3922
- */
3923
- private _abortController;
3924
- /**
3925
- * @protected
3926
- * @internal
3927
- * Tracks all cleanup functions for subscriptions made via on()
3928
- */
3929
- protected _cleanupFunctions: Array<() => void>;
3930
- /**
3931
- * Returns the AbortSignal for this PubSub instance.
3932
- * Use this signal with APIs that support cancellation (fetch, addEventListener, etc.)
3933
- * When the PubSub is destroyed, the signal will be aborted and all listeners using it will be automatically removed.
3934
- *
3935
- * @example
3936
- * ```typescript
3937
- * // Automatically cleaned up when PubSub is destroyed
3938
- * pubsub.addEventListener(window, 'resize', handler, { signal: pubsub.signal });
3939
- * ```
3940
- */
3941
- get signal(): AbortSignal;
3942
- /**
3943
- * @private
3944
- * @internal
3945
- */
3946
- publish<EVENT_NAME extends EVENT>(eventName: EVENT_NAME, data?: EVENT_PAYLOAD[EVENT_NAME]): void;
3947
- /**
3948
- * Subscribe a function to be called when the signal is aborted.
3949
- * @param fn The function to call when the signal is aborted.
3950
- */
3951
- onAbort<T extends (...args: any[]) => void>(fn: T): void;
3952
- /**
3953
- * Subscribe a function to an event.
3954
- *
3955
- * @param eventName An event name which, when fired, will call the provided
3956
- * function.
3957
- * @param fn A callback that gets called when the corresponding event is fired. The
3958
- * callback will get passed an argument with a type that's one of event payloads.
3959
- * @param options Optional options object. If a signal is provided, the subscription will be
3960
- * automatically cleaned up when that signal is aborted.
3961
- * @returns A cleanup function that unsubscribes the event listener when called.
3962
- * @example
3963
- * // Subscribe to the 'click' event
3964
- * const handler = (event) => {
3965
- * const { coordinate } = event;
3966
- * const { latitude, longitude } = coordinate;
3967
- * console.log(`Map was clicked at ${latitude}, ${longitude}`);
3968
- * };
3969
- * map.on('click', handler);
3970
- */
3971
- on<EVENT_NAME extends EVENT>(eventName: EVENT_NAME, fn: (payload: EVENT_PAYLOAD[EVENT_NAME] extends {
3972
- data: null;
3973
- } ? EVENT_PAYLOAD[EVENT_NAME]["data"] : EVENT_PAYLOAD[EVENT_NAME]) => void, options?: {
3974
- signal?: AbortSignal;
3975
- }): () => void;
3976
- /**
3977
- * Unsubscribe a function previously subscribed with {@link on}
3978
- *
3979
- * @param eventName An event name to which the provided function was previously
3980
- * subscribed.
3981
- * @param fn A function that was previously passed to {@link on}. The function must
3982
- * have the same reference as the function that was subscribed.
3983
- * @example
3984
- * // Unsubscribe from the 'click' event
3985
- * const handler = (event) => {
3986
- * console.log('Map was clicked', event);
3987
- * };
3988
- * map.off('click', handler);
3989
- */
3990
- off<EVENT_NAME extends EVENT>(eventName: EVENT_NAME, fn: (payload: EVENT_PAYLOAD[EVENT_NAME] extends {
3991
- data: null;
3992
- } ? EVENT_PAYLOAD[EVENT_NAME]["data"] : EVENT_PAYLOAD[EVENT_NAME]) => void): void;
3993
- /**
3994
- * @private
3995
- * @internal
3996
- * Destroys the PubSub instance and automatically unsubscribes all listeners registered via on().
3997
- */
3998
- destroy(): void;
3999
- }
4000
4007
  type Primitive$1 = null | undefined | string | number | boolean | symbol | bigint;
4001
4008
  type NodeNeighbor = {
4002
4009
  id: string;
@@ -4016,7 +4023,6 @@ type NodeProperties = {
4016
4023
  * */
4017
4024
  [name: string]: any;
4018
4025
  };
4019
- type NodeCollection$1 = FeatureCollection$1<Point$1, NodeProperties>;
4020
4026
  type NodeFeature = Feature$1<Point$1, NodeProperties>;
4021
4027
  declare class Edge {
4022
4028
  /** The originating node of the edge */
@@ -4046,64 +4052,6 @@ declare class Edge {
4046
4052
  multiplicativeDistanceWeightScaling?: boolean;
4047
4053
  });
4048
4054
  }
4049
- declare class NavigationGraph {
4050
- #private;
4051
- readonly edges: {
4052
- [propName: string]: Edge[];
4053
- };
4054
- readonly nodesById: {
4055
- [propName: string]: NodeFeature;
4056
- };
4057
- readonly nodesByGroup: Map<string, NodeFeature[]>;
4058
- constructor({ nodes, groupBy, multiplicativeDistanceWeightScaling, }: {
4059
- nodes: NodeCollection$1;
4060
- groupBy: string;
4061
- multiplicativeDistanceWeightScaling?: boolean;
4062
- });
4063
- /**
4064
- * Calculates the shortest Euclidean distance from the origin node to any of the destination nodes.
4065
- *
4066
- * @param origin - The origin node.
4067
- * @param destinations - An array of destination nodes.
4068
- * @returns The shortest Euclidean distance.
4069
- */
4070
- getShortestEuclideanDistance(origin: NodeFeature, destinations: NodeFeature[]): number;
4071
- hasLineOfSight: (origin: Position, destination: Position, edges?: Position[][], bufferRadius?: number) => boolean;
4072
- /**
4073
- * Performs a Dijkstra search to find nodes within a given travel distance that satisfy a goal function, sorted by distance.
4074
- *
4075
- * @param originId - Origin node ID.
4076
- * @param maxTravelDistance - The maximum travel distance.
4077
- * @param includedNodeIds - Array of node IDs to include in the search.
4078
- * @param obstructionEdges - Array of obstruction edges for line of sight calculations.
4079
- * @param useLineOfSight - Whether to use line of sight checking.
4080
- * @returns An Array of nodes within the travel distance that satisfy the goal function.
4081
- * - feature: The node feature.
4082
- * - distance: The distance to the node.
4083
- * - edges: The edges to the node.
4084
- */
4085
- dijkstraFindWithinTravelDistance(originId: string, maxTravelDistance: number, includedNodeIds: string[], obstructionEdges: Position[][], useLineOfSight: boolean, limitNumberOfResults: number): {
4086
- feature: NodeFeature;
4087
- distance: number;
4088
- }[];
4089
- /**
4090
- * Performs A* pathfinding from specified origins to destinations, considering optional constraints like accessibility.
4091
- *
4092
- * @param {string[]} originIds - Array of origin node IDs.
4093
- * @param {string[]} destinationNodeIds - Array of destination node IDs.
4094
- * @param {Set<string>} [disabledConnectionNodeIds] - Optional set of connection node IDs that are disabled (ie. act as regular nodes).
4095
- * @param {Set<string>} [disabledNodeIds] - Optional set of node IDs which are ignored during pathfinding.
4096
- * @returns {Edge[]} An array of edges representing the shortest path, or an empty array if no path is found.
4097
- */
4098
- aStar({ originIds, destinationNodeIds, disabledConnectionNodeIds, zones, overrideEdgeWeights, disabledNodeIds, }: {
4099
- originIds: string[];
4100
- destinationNodeIds: string[];
4101
- zones: DirectionsZone[];
4102
- disabledConnectionNodeIds?: Set<string>;
4103
- overrideEdgeWeights?: Map<Edge, number>;
4104
- disabledNodeIds?: Set<string>;
4105
- }): Edge[];
4106
- }
4107
4055
  type DirectionProperties = {
4108
4056
  /**
4109
4057
  * Unique identifier for the direction.
@@ -4127,204 +4075,6 @@ type DirectionProperties = {
4127
4075
  };
4128
4076
  type DirectionFeature = Feature$1<Point$1, DirectionProperties>;
4129
4077
  type DirectionsCollection = FeatureCollection$1<Point$1, DirectionProperties>;
4130
- interface DoorGeometry {
4131
- geoJSON: {
4132
- geometry: {
4133
- coordinates: [
4134
- [
4135
- number,
4136
- number
4137
- ],
4138
- [
4139
- number,
4140
- number
4141
- ]
4142
- ];
4143
- };
4144
- };
4145
- }
4146
- type BaseSimplifyOptions = {
4147
- /**
4148
- * Enable or disable simplifying.
4149
- */
4150
- enabled: boolean;
4151
- /**
4152
- * The radius of the buffer around the path to consider when simplifying, in meters.
4153
- * @default 0.4
4154
- */
4155
- radius?: number;
4156
- };
4157
- type GreedyLosOptions = BaseSimplifyOptions & {
4158
- __EXPERIMENTAL_METHOD?: "greedy-los";
4159
- };
4160
- type RdpOptions = BaseSimplifyOptions & {
4161
- __EXPERIMENTAL_METHOD: "rdp";
4162
- /**
4163
- * Whether to include door-adjacent nodes (predecessor/successor of doors) in the must-include set.
4164
- * When true, nodes immediately before and after doors are preserved during simplification.
4165
- * @default true
4166
- */
4167
- mustIncludeDoorBufferNodes?: boolean;
4168
- };
4169
- type DpOptimalOptions = BaseSimplifyOptions & {
4170
- __EXPERIMENTAL_METHOD: "dp-optimal";
4171
- /**
4172
- * Whether to include door buffer nodes in DP simplification.
4173
- * When true, predecessor and successor nodes of doors are marked with preventSmoothing.
4174
- * @default false
4175
- */
4176
- includeDoorBufferNodes?: boolean;
4177
- };
4178
- type SimplifyDirectionsOptions = GreedyLosOptions | RdpOptions | DpOptimalOptions;
4179
- type DirectionsZone = {
4180
- geometry: Feature$1<MultiPolygon$1 | Polygon$1>;
4181
- /**
4182
- * The additional cost for navigation through the zone.
4183
- */
4184
- cost: number;
4185
- /**
4186
- *
4187
- * Additional property specific to the navigator based on the 'groupBy' option.
4188
- */
4189
- [index: string]: any;
4190
- };
4191
- declare class Navigator$1 {
4192
- private groupBy;
4193
- graph: NavigationGraph;
4194
- private geometryEdgesByMapId;
4195
- private flagDeclarations;
4196
- private getDoorByNodeId;
4197
- private disabledNodeIds;
4198
- /**
4199
- * Constructs a Navigator instance to manage pathfinding with optional obstructions and grouping features.
4200
- *
4201
- * @param {NodeCollection} nodes - Collection of nodes for the navigation graph.
4202
- * @param {ObstructionCollection} [obstructions] - Optional collection of obstructions that could block paths.
4203
- * @param {SpaceCollection} [spaces] - Optional collection of spaces that could block paths.
4204
- * @param {string} [groupBy] - Optional property name to group nodes and paths for differentiated processing.
4205
- * @param {Function} getDoorByNodeId - Function to get door object by node ID.
4206
- */
4207
- constructor({ nodes, geojsonCollection, groupBy, multiplicativeDistanceWeightScaling, flagDeclarations, getDoorByNodeId, }: {
4208
- nodes: NodeCollection$1;
4209
- geojsonCollection?: ObstructionCollection | SpaceCollection;
4210
- groupBy?: string;
4211
- multiplicativeDistanceWeightScaling?: boolean;
4212
- flagDeclarations?: NavigationFlagDeclarations;
4213
- getDoorByNodeId: (nodeId: string) => DoorGeometry | undefined;
4214
- });
4215
- private getDisabledNodeIds;
4216
- /**
4217
- * Calculates and returns a set of directions from origin nodes to destination nodes, including detailed properties.
4218
- *
4219
- * @param {DirectionsZone[]} zones - special zones for navigation operations.
4220
- * @param {string[]} originIds - IDs of origin nodes.
4221
- * @param {string[]} destinationNodeIds - IDs of destination nodes.
4222
- * @param {string[]} [disabledConnectionNodeIds] - IDs of connection nodes that are disabled (ie. act as regular nodes).
4223
- * @param {SimplifyDirectionsOptions} [simplify] - Options to simplify the pathfinding result.
4224
- * @returns {DirectionsCollection} A collection of directional features representing the path.
4225
- */
4226
- getDirections({ zones: directionsZones, originIds, from, to, destinationNodeIds, disabledConnectionNodeIds, simplify, multiplicativeDistanceWeightScaling, overrideEdgeWeights, }: {
4227
- originIds: string[];
4228
- destinationNodeIds: string[];
4229
- from: NodeFeature[];
4230
- to: NodeFeature[];
4231
- zones?: DirectionsZone[];
4232
- disabledConnectionNodeIds?: string[];
4233
- simplify?: SimplifyDirectionsOptions;
4234
- multiplicativeDistanceWeightScaling?: boolean;
4235
- overrideEdgeWeights?: Map<Edge, number>;
4236
- }): DirectionsCollection;
4237
- /**
4238
- * Generates a path from a series of edges, constructing a feature collection of directional steps.
4239
- *
4240
- * @param {Edge[]} steps - An array of edges representing the path.
4241
- * @returns {DirectionsCollection} A collection of directional features.
4242
- */
4243
- private generatePath;
4244
- /**
4245
- * Simplifies a sequence of steps by reducing unnecessary nodes using line-of-sight checks.
4246
- *
4247
- * Method Selection:
4248
- * - 'greedy-los': Greedy forward scan with line-of-sight validation. Fastest, O(n) time complexity. Good default choice.
4249
- * - 'rdp': Uses Ramer-Douglas-Peucker preprocessing + line-of-sight validation + door buffer nodes.
4250
- * Better for paths with doors and complex geometry. Medium speed.
4251
- * - 'dp-optimal': Dynamic Programming for globally optimal simplification. Slowest but highest quality, O(n²) complexity.
4252
- * Best when path quality is critical (e.g., indoor navigation with many turns).
4253
- *
4254
- * Performance: greedy-los < rdp < dp-optimal
4255
- * Quality: greedy-los < rdp < dp-optimal
4256
- *
4257
- * @param {Edge[]} steps - The steps to simplify.
4258
- * @param {SimplifyDirectionsOptions} options - Simplification options.
4259
- * @param {boolean} multiplicativeDistanceWeightScaling - Distance weight scaling option.
4260
- * @returns {Edge[]} An array of simplified edges representing a more direct path.
4261
- */
4262
- private simplifyAllSteps;
4263
- /**
4264
- * Finds the nearest nodes on the graph within a given travel distance.
4265
- *
4266
- * @param originId - The ID of the origin node.
4267
- * @param maxDistance - The maximum distance to search.
4268
- * @param floorId - The ID of the floor.
4269
- * @param includedNodeIds - The IDs of the nodes to include.
4270
- * @param useLineOfSight - Whether to use line of sight.
4271
- * @returns An array of nodes within the travel distance that satisfy the goal function.
4272
- */
4273
- findNearestNodesOnGraph: (originId: string, maxDistance: number, floorId: string, includedNodeIds: string[], useLineOfSight?: boolean, limitNumberOfResults?: number) => {
4274
- feature: NodeFeature;
4275
- distance: number;
4276
- }[];
4277
- /**
4278
- * Checks if there is a line of sight between two points on the map.
4279
- *
4280
- * @param origin - The origin point.
4281
- * @param destination - The destination point.
4282
- * @param floorId - The ID of the floor.
4283
- * @param bufferRadius - The buffer radius to use when checking for line of sight.
4284
- * @returns True if there is a line of sight, false otherwise.
4285
- */
4286
- hasLineOfSight: (origin: [
4287
- number,
4288
- number
4289
- ], destination: [
4290
- number,
4291
- number
4292
- ], floorId: string, bufferRadius?: number) => boolean;
4293
- /**
4294
- * Simplifies a section of steps by checking direct lines of sight between steps and eliminating intermediate nodes if unobstructed.
4295
- *
4296
- * @param {Edge[]} steps - The steps to potentially simplify.
4297
- * @param {[number, number][][]} geometryEdges - The geometrical edges of the map used to check for line of sight.
4298
- * @param {number} bufferRadius - The buffer radius to use when simplifying.
4299
- * @returns {Edge[]} An array of simplified edges.
4300
- */
4301
- private simplifySteps;
4302
- private simplifyStepsImprovedWithSimplifyBeforeLoSChecks;
4303
- private simplifyStepsWithDPMethod;
4304
- /**
4305
- * Calculates the approximate distance between two geographic coordinates on Earth's surface.
4306
- *
4307
- * This function uses the equirectangular approximation method to compute the distance, which simplifies
4308
- * the math and speeds up calculations, but is less accurate over long distances compared to other methods
4309
- * like the haversine formula.
4310
- *
4311
- * @param {Position} point1 - The first point's longitude and latitude as [longitude, latitude].
4312
- * @param {Position} point2 - The second point's longitude and latitude as [longitude, latitude].
4313
- * @return
4314
- * @return {number} The approximate distance between the two points in meters.
4315
- */
4316
- getDistance: (point1: Position, point2: Position) => number;
4317
- /**
4318
- * Calculates the angle between two geographic coordinates.
4319
- *
4320
- * @param {Position} point1 - The first point's longitude and latitude as [longitude, latitude].
4321
- * @param {Position} point2 - The second point's longitude and latitude as [longitude, latitude].
4322
- * @hidden
4323
- *
4324
- * @return {number} The angle in radians, calculated clockwise from the north between the two points specified.
4325
- */
4326
- getAngle: (point1: Position, point2: Position) => number;
4327
- }
4328
4078
  declare class Directions {
4329
4079
  #private;
4330
4080
  id: string;
@@ -4375,79 +4125,6 @@ declare class Directions {
4375
4125
  instructions: TDirectionInstruction[];
4376
4126
  };
4377
4127
  }
4378
- declare class DirectionsInternal {
4379
- #private;
4380
- navigator: Navigator$1;
4381
- private readonly connections;
4382
- /**
4383
- * @hidden
4384
- */
4385
- constructor({ nodes, geojsonCollection, connections, groupBy, multiplicativeDistanceWeightScaling, flagDeclarations, getDoorByNodeId, }: {
4386
- nodes: ParsedMVF["node.geojson"];
4387
- geojsonCollection: ParsedMVF["obstruction"] | ParsedMVF["space"];
4388
- connections: ParsedMVF["connection.json"];
4389
- groupBy?: string;
4390
- multiplicativeDistanceWeightScaling?: boolean;
4391
- flagDeclarations?: ParsedMVF["navigationFlags.json"];
4392
- getDoorByNodeId: (nodeId: string) => DoorGeometry | undefined;
4393
- });
4394
- processTargets(fromNodesByTarget: Map<TNavigationTarget, string[]>, toNodesByTarget: Map<TNavigationTarget, string[]>, mapData: MapDataInternal): {
4395
- originIds: string[];
4396
- destinationNodeIds: string[];
4397
- featureToNodeIdsMap: Map<TNavigationTarget, string[]>;
4398
- };
4399
- getDirections: (from: TNavigationTarget[], to: TNavigationTarget[], options: {
4400
- accessible: boolean;
4401
- smoothing: SimplifyDirectionsOptions;
4402
- zones: TDirectionZone[];
4403
- excludedConnections: Connection[];
4404
- connectionIdWeightMap: Record<string, number>;
4405
- }, mapData: MapDataInternal) => Promise<Directions | undefined>;
4406
- /** @deprecated use getDirections instead */
4407
- getDirectionsSync: (from: TNavigationTarget[], to: TNavigationTarget[], options: {
4408
- accessible: boolean;
4409
- smoothing: SimplifyDirectionsOptions;
4410
- zones: TDirectionZone[];
4411
- excludedConnections: Connection[];
4412
- connectionIdWeightMap: Record<string, number>;
4413
- }, mapData: MapDataInternal) => Directions | undefined;
4414
- /**
4415
- * Get the node IDs of connections that do not match the accessibility setting provided.
4416
- * A disabled connection node is a connection node that acts as a regular node
4417
- * (ie. the edges that would cause a floor change are ignored).
4418
- *
4419
- * @hidden
4420
- * @param accessible {boolean}
4421
- */
4422
- getDisabledConnectionNodeIds: (accessible: boolean) => string[];
4423
- /**
4424
- * If the navigation targets are coordinates, make sure to include them in the final directions. For other
4425
- * data types (e.g. POIs, Doors, Spaces), the coordinate should have a coincidental node generated in the
4426
- * navigation graph already, so this is unnecessary.
4427
- *
4428
- * @hidden
4429
- * @param directions
4430
- * @param from {TNavigationTarget[]}
4431
- * @param to {TNavigationTarget[]}
4432
- */
4433
- private addCoordinateDirections;
4434
- /**
4435
- * Create an geojson collection from the parsed MVF.
4436
- *
4437
- * @hidden
4438
- * @param obstructions
4439
- */
4440
- private createCollection;
4441
- /**
4442
- * Create a direction feature.
4443
- *
4444
- * @hidden
4445
- * @param coordinate
4446
- * @param angle
4447
- * @param distance
4448
- */
4449
- private createDirectionFeature;
4450
- }
4451
4128
  declare class Shape implements IFocusable {
4452
4129
  /**
4453
4130
  * id of Shape
@@ -5020,7 +4697,8 @@ declare class ImageMetaData extends BaseMetaData {
5020
4697
  */
5021
4698
  destroy(): void;
5022
4699
  }
5023
- type LocationData = Omit<MVFLocation, "categories" | "spaces" | "obstructions" | "entrances" | "shapes" | "connections" | "annotations" | "areas" | "openingHoursSpecification" | "links" | "pictures" | "website" | "icon"> & {
4700
+ type MVF3Location = Required<MVFv2_STANDARD_MVFv3>["locations"][number];
4701
+ type LocationData = Omit<MVF2Location, "categories" | "spaces" | "obstructions" | "entrances" | "shapes" | "connections" | "annotations" | "areas" | "openingHoursSpecification" | "links" | "pictures" | "website" | "icon"> & {
5024
4702
  links: Hyperlink[];
5025
4703
  images: ImageMetaData[];
5026
4704
  icon?: ImageMetaData;
@@ -5050,8 +4728,13 @@ declare class LocationProfile extends BaseMetaData implements LocationData, IFoc
5050
4728
  * The location's logo
5051
4729
  *
5052
4730
  * @format uri
4731
+ * @deprecated Use the {@link logoImage} property instead
5053
4732
  */
5054
4733
  logo?: string;
4734
+ /**
4735
+ * An image representing the location's logo
4736
+ */
4737
+ logoImage?: ImageMetaData;
5055
4738
  phone?: string;
5056
4739
  /**
5057
4740
  * The location's social media links.
@@ -5075,9 +4758,28 @@ declare class LocationProfile extends BaseMetaData implements LocationData, IFoc
5075
4758
  * @format uri
5076
4759
  */
5077
4760
  icon?: ImageMetaData;
4761
+ /**
4762
+ * Additional user defined data. The type is unknown, so it is recommended to validate the data before use.
4763
+ *
4764
+ * _Only available when loading MVFv3 data._
4765
+ *
4766
+ * ```ts
4767
+ * const mapData = await getMapData({
4768
+ * ...
4769
+ * mvfVersion: '3.0.0',
4770
+ * });
4771
+ *
4772
+ * const locationProfile = mapData.getById('location-profile', id);
4773
+ * if (typeof locationProfile?.extra?.myProperty === 'string') {
4774
+ * // Do something
4775
+ * }
4776
+ * ```
4777
+ */
4778
+ extra?: Record<string, unknown>;
5078
4779
  /** @internal */
5079
4780
  constructor(data: MapDataInternal, options: {
5080
- mvfData: MVFLocation;
4781
+ mvf2Data: MVF2Location;
4782
+ mvf3Data?: MVF3Location;
5081
4783
  });
5082
4784
  /**
5083
4785
  * Gets the {@link Space}s associated with the location.
@@ -5404,7 +5106,16 @@ declare class Space extends DetailedMapData<SpaceFeature> implements IGeoJSONDat
5404
5106
  */
5405
5107
  get type(): TSpaceType;
5406
5108
  /**
5407
- * @internal
5109
+ * Gets the {@link EnterpriseLocation}s attached to this space.
5110
+ *
5111
+ * @returns {EnterpriseLocation[]} An array of enterprise locations.
5112
+ */
5113
+ get enterpriseLocations(): EnterpriseLocation[];
5114
+ /**
5115
+ * Gets the {@link EnterpriseLocation}s attached to this space.
5116
+ *
5117
+ * @deprecated Use {@link enterpriseLocations} instead. This property will be removed in a future release.
5118
+ * @returns {EnterpriseLocation[]} An array of enterprise locations.
5408
5119
  */
5409
5120
  get locations(): EnterpriseLocation[];
5410
5121
  /**
@@ -5755,7 +5466,16 @@ declare class MapObject extends DetailedMapData<ObstructionFeature> implements I
5755
5466
  */
5756
5467
  get type(): string;
5757
5468
  /**
5758
- * @internal
5469
+ * Gets the {@link EnterpriseLocation}s attached to this object.
5470
+ *
5471
+ * @returns {EnterpriseLocation[]} An array of enterprise locations.
5472
+ */
5473
+ get enterpriseLocations(): EnterpriseLocation[];
5474
+ /**
5475
+ * Gets the {@link EnterpriseLocation}s attached to this object.
5476
+ *
5477
+ * @deprecated Use {@link enterpriseLocations} instead. This property will be removed in a future release.
5478
+ * @returns {EnterpriseLocation[]} An array of enterprise locations.
5759
5479
  */
5760
5480
  get locations(): EnterpriseLocation[];
5761
5481
  /**
@@ -5921,6 +5641,7 @@ type TMapDataInternalOptions = {
5921
5641
  binaryBundle?: Uint8Array;
5922
5642
  tokenManager?: TokenManager;
5923
5643
  getMapDataOptions?: TGetMapDataOptions;
5644
+ mvf3?: MVFv2_STANDARD_MVFv3;
5924
5645
  };
5925
5646
  type MVFNodeFeature = MVFNodeCollection["features"][number];
5926
5647
  type MVFFloorFeature = FloorCollection["features"][number];
@@ -6348,15 +6069,20 @@ type MapDataRecords = {
6348
6069
  [floorId: string]: AnnotationCollection["features"][number][];
6349
6070
  };
6350
6071
  mvfAreasById: Record<AreaId, AreaCollection["features"][number]>;
6072
+ mvf3LocationsById: Record<string, Required<MVFv2_STANDARD_MVFv3>["locations"][number]>;
6351
6073
  };
6352
6074
  type EnterpriseMapDataRecords = {
6353
6075
  connectionsByExternalId: Record<string, Connection[]>;
6354
6076
  locationsByExternalId: Record<string, EnterpriseLocation[]>;
6355
6077
  categoriesByExternalId: Record<string, EnterpriseCategory[]>;
6356
6078
  locationsById: Record<MVFEnterpriseLocationId, EnterpriseLocation>;
6079
+ /** Instance locations by ID - separate from locationsById so they don't appear in getByType */
6080
+ locationInstancesById: Record<string, EnterpriseLocation>;
6081
+ /** Instance locations by polygon ID - for space.enterpriseLocations to check instances first */
6082
+ instanceLocationsByPolygonId: Record<string, EnterpriseLocation>;
6357
6083
  categoriesById: Record<MVFEnterpriseCategoryId, EnterpriseCategory>;
6358
6084
  locationIdsByNodeId: Record<string, MVFEnterpriseLocationId[]>;
6359
- locationInstancesById: Record<string, EnterpriseLocationInstance>;
6085
+ mvfLocationInstancesById: Record<string, EnterpriseLocationInstance>;
6360
6086
  venue: MVFEnterpriseVenue;
6361
6087
  mvfCategoriesById: Record<string, MVFEnterpriseCategory>;
6362
6088
  mvfLocationsById: Record<string, MVFEnterpriseLocation>;
@@ -6932,6 +6658,8 @@ declare class MapDataInternal extends PubSub<{
6932
6658
  locationProfilesByAttachedFeatureId: MapDataRecords["locationProfilesByAttachedFeatureId"];
6933
6659
  entranceNodeIdsBySpaceId?: MapDataRecords["entranceNodeIdsBySpaceId"];
6934
6660
  locationsById: EnterpriseMapDataRecords["locationsById"];
6661
+ locationInstancesById: EnterpriseMapDataRecords["locationInstancesById"];
6662
+ instanceLocationsByPolygonId: EnterpriseMapDataRecords["instanceLocationsByPolygonId"];
6935
6663
  categoriesById: EnterpriseMapDataRecords["categoriesById"];
6936
6664
  mvfLocationsByGeometryId: EnterpriseMapDataRecords["mvfLocationsByGeometryId"];
6937
6665
  locationIdsByNodeId: EnterpriseMapDataRecords["locationIdsByNodeId"];