@mappedin/events 6.8.0-beta.0 → 6.9.1-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 MVF2Location, LocationId, LocationLink, LocationSocial, LocationState, MultiPolygon, NavigationFlagDeclarations, NodeCollection, NodeCollection as MVFNodeCollection, NodeId, ObstructionCollection, ObstructionFeature, ObstructionId, ObstructionProperties, OpeningHoursSpecification, OperationHours, ParsedMVF, ParsedMVF as TMVF, ParsedMVFLocalePack, ParsedMVFv3, 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;
@@ -4690,7 +4697,7 @@ declare class ImageMetaData extends BaseMetaData {
4690
4697
  */
4691
4698
  destroy(): void;
4692
4699
  }
4693
- type MVF3Location = Required<ParsedMVFv3>["locations"][number];
4700
+ type MVF3Location = Required<MVFv2_STANDARD_MVFv3>["locations"][number];
4694
4701
  type LocationData = Omit<MVF2Location, "categories" | "spaces" | "obstructions" | "entrances" | "shapes" | "connections" | "annotations" | "areas" | "openingHoursSpecification" | "links" | "pictures" | "website" | "icon"> & {
4695
4702
  links: Hyperlink[];
4696
4703
  images: ImageMetaData[];
@@ -4721,8 +4728,13 @@ declare class LocationProfile extends BaseMetaData implements LocationData, IFoc
4721
4728
  * The location's logo
4722
4729
  *
4723
4730
  * @format uri
4731
+ * @deprecated Use the {@link logoImage} property instead
4724
4732
  */
4725
4733
  logo?: string;
4734
+ /**
4735
+ * An image representing the location's logo
4736
+ */
4737
+ logoImage?: ImageMetaData;
4726
4738
  phone?: string;
4727
4739
  /**
4728
4740
  * The location's social media links.
@@ -5094,7 +5106,16 @@ declare class Space extends DetailedMapData<SpaceFeature> implements IGeoJSONDat
5094
5106
  */
5095
5107
  get type(): TSpaceType;
5096
5108
  /**
5097
- * @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.
5098
5119
  */
5099
5120
  get locations(): EnterpriseLocation[];
5100
5121
  /**
@@ -5445,7 +5466,16 @@ declare class MapObject extends DetailedMapData<ObstructionFeature> implements I
5445
5466
  */
5446
5467
  get type(): string;
5447
5468
  /**
5448
- * @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.
5449
5479
  */
5450
5480
  get locations(): EnterpriseLocation[];
5451
5481
  /**
@@ -5611,7 +5641,7 @@ type TMapDataInternalOptions = {
5611
5641
  binaryBundle?: Uint8Array;
5612
5642
  tokenManager?: TokenManager;
5613
5643
  getMapDataOptions?: TGetMapDataOptions;
5614
- mvf3?: ParsedMVFv3;
5644
+ mvf3?: MVFv2_STANDARD_MVFv3;
5615
5645
  };
5616
5646
  type MVFNodeFeature = MVFNodeCollection["features"][number];
5617
5647
  type MVFFloorFeature = FloorCollection["features"][number];
@@ -6039,16 +6069,20 @@ type MapDataRecords = {
6039
6069
  [floorId: string]: AnnotationCollection["features"][number][];
6040
6070
  };
6041
6071
  mvfAreasById: Record<AreaId, AreaCollection["features"][number]>;
6042
- mvf3LocationsById: Record<string, Required<ParsedMVFv3>["locations"][number]>;
6072
+ mvf3LocationsById: Record<string, Required<MVFv2_STANDARD_MVFv3>["locations"][number]>;
6043
6073
  };
6044
6074
  type EnterpriseMapDataRecords = {
6045
6075
  connectionsByExternalId: Record<string, Connection[]>;
6046
6076
  locationsByExternalId: Record<string, EnterpriseLocation[]>;
6047
6077
  categoriesByExternalId: Record<string, EnterpriseCategory[]>;
6048
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>;
6049
6083
  categoriesById: Record<MVFEnterpriseCategoryId, EnterpriseCategory>;
6050
6084
  locationIdsByNodeId: Record<string, MVFEnterpriseLocationId[]>;
6051
- locationInstancesById: Record<string, EnterpriseLocationInstance>;
6085
+ mvfLocationInstancesById: Record<string, EnterpriseLocationInstance>;
6052
6086
  venue: MVFEnterpriseVenue;
6053
6087
  mvfCategoriesById: Record<string, MVFEnterpriseCategory>;
6054
6088
  mvfLocationsById: Record<string, MVFEnterpriseLocation>;
@@ -6624,6 +6658,8 @@ declare class MapDataInternal extends PubSub<{
6624
6658
  locationProfilesByAttachedFeatureId: MapDataRecords["locationProfilesByAttachedFeatureId"];
6625
6659
  entranceNodeIdsBySpaceId?: MapDataRecords["entranceNodeIdsBySpaceId"];
6626
6660
  locationsById: EnterpriseMapDataRecords["locationsById"];
6661
+ locationInstancesById: EnterpriseMapDataRecords["locationInstancesById"];
6662
+ instanceLocationsByPolygonId: EnterpriseMapDataRecords["instanceLocationsByPolygonId"];
6627
6663
  categoriesById: EnterpriseMapDataRecords["categoriesById"];
6628
6664
  mvfLocationsByGeometryId: EnterpriseMapDataRecords["mvfLocationsByGeometryId"];
6629
6665
  locationIdsByNodeId: EnterpriseMapDataRecords["locationIdsByNodeId"];