@mappedin/react-native-sdk 4.1.0-beta.0 → 4.1.0-beta.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.
Files changed (3) hide show
  1. package/dist/index.d.ts +126 -34
  2. package/dist/index.js +196 -196
  3. package/package.json +6 -2
package/dist/index.d.ts CHANGED
@@ -27,6 +27,7 @@ declare module '@mappedin/react-native-sdk' {
27
27
  export type TLabelAllLocationCommonOptions = Omit<TLabelAllLocationCommonOptionsBase, 'sortFunction' | 'translationMap'>;
28
28
  export type { IDirectionsResult, MappedinDirections, TMappedinDirective } from '@mappedin/react-native-sdk/core/packages/renderer/index.rn';
29
29
  export type { TShowVenueOptions } from '@mappedin/react-native-sdk/core/packages/renderer/index.rn';
30
+ export { ERROR, ERROR_MESSAGES } from '@mappedin/react-native-sdk/wrappers/common/errors';
30
31
  export { E_GET_DIRECTIONS_MESSAGES, BEARING_TYPE, ACTION_TYPE, MappedinLocation, Mappedin, MappedinPolygon, MappedinNode, MappedinCategory, MappedinMap, MappedinEvent, MappedinMapGroup, MappedinVenue, MappedinVortex, MappedinRankings, MappedinDestinationSet } from '@mappedin/react-native-sdk/core/packages/renderer/index.rn';
31
32
  }
32
33
 
@@ -36,6 +37,7 @@ declare module '@mappedin/react-native-sdk/wrappers/react-native-sdk/src/MiMapVi
36
37
  import { STATE } from '@mappedin/react-native-sdk/wrappers/react-native-sdk/src';
37
38
  import { MapViewStore } from '@mappedin/react-native-sdk/wrappers/react-native-sdk/src/MiMapView.store';
38
39
  import type { TBlueDotPositionUpdate, TBlueDotStateChange, MappedinPolygon, MappedinMap, Mappedin } from '@mappedin/react-native-sdk/core/packages/renderer/index.rn';
40
+ import { ERROR, ERROR_MESSAGES } from '@mappedin/react-native-sdk/wrappers/common/errors';
39
41
  export type TMiMapViewProps = {
40
42
  /**
41
43
  * The MapViewStore instance will be returned here
@@ -100,6 +102,16 @@ declare module '@mappedin/react-native-sdk/wrappers/react-native-sdk/src/MiMapVi
100
102
  onStateChanged?: (prop: {
101
103
  state: STATE;
102
104
  }) => void;
105
+ /**
106
+ * Called if an error occurs loading the venue map
107
+ */
108
+ onVenueLoadError?: (prop: {
109
+ error: {
110
+ name: ERROR;
111
+ message: ERROR_MESSAGES;
112
+ stack?: string;
113
+ };
114
+ }) => void;
103
115
  };
104
116
  /**
105
117
  * Mappedin MapView component
@@ -108,7 +120,7 @@ declare module '@mappedin/react-native-sdk/wrappers/react-native-sdk/src/MiMapVi
108
120
  /**
109
121
  * @category Component
110
122
  */
111
- export const MiMapView: React.MemoExoticComponent<React.ForwardRefExoticComponent<Pick<TMiMapViewProps, "options" | "style" | "onFirstMapLoaded" | "onDataLoaded" | "venueData" | "onPolygonClicked" | "onBlueDotStateChanged" | "onBlueDotPositionUpdated" | "onNothingClicked" | "onMapChanged" | "onStateChanged"> & React.RefAttributes<MapViewStore>>>;
123
+ export const MiMapView: React.MemoExoticComponent<React.ForwardRefExoticComponent<Pick<TMiMapViewProps, "options" | "style" | "onFirstMapLoaded" | "onDataLoaded" | "venueData" | "onPolygonClicked" | "onBlueDotStateChanged" | "onBlueDotPositionUpdated" | "onNothingClicked" | "onMapChanged" | "onStateChanged" | "onVenueLoadError"> & React.RefAttributes<MapViewStore>>>;
112
124
  }
113
125
 
114
126
  declare module '@mappedin/react-native-sdk/wrappers/react-native-sdk/src/MiMiniMap' {
@@ -116,6 +128,7 @@ declare module '@mappedin/react-native-sdk/wrappers/react-native-sdk/src/MiMiniM
116
128
  import { TMiMapViewOptions } from '@mappedin/react-native-sdk/wrappers/common';
117
129
  import { TFocusOnOptions } from '@mappedin/react-native-sdk/core/packages/renderer/index.rn';
118
130
  import type { MappedinLocation, Mappedin } from '@mappedin/react-native-sdk/core/packages/renderer/index.rn';
131
+ import { ERROR, ERROR_MESSAGES } from '@mappedin/react-native-sdk/wrappers/common/errors';
119
132
  export type TMiMiniMapProps = {
120
133
  /**
121
134
  * Options to initialze MiMapView with
@@ -133,6 +146,16 @@ declare module '@mappedin/react-native-sdk/wrappers/react-native-sdk/src/MiMiniM
133
146
  venueData?: Mappedin;
134
147
  location: MappedinLocation['id'] | MappedinLocation;
135
148
  focusOptions?: TFocusOnOptions;
149
+ /**
150
+ * Called if there's an error loading the minimap
151
+ */
152
+ onMiniMapLoadError?: (prop: {
153
+ error: {
154
+ name: ERROR;
155
+ message: ERROR_MESSAGES;
156
+ stack?: string;
157
+ };
158
+ }) => void;
136
159
  };
137
160
  /**
138
161
  * Mappedin MiniMap component
@@ -170,12 +193,12 @@ declare module '@mappedin/react-native-sdk/wrappers/react-native-sdk/src/MiMapVi
170
193
  /**
171
194
  * @hidden
172
195
  */
173
- loadVenue(options: TGetVenueOptions, showVenueOptions: TShowVenueOptions): Promise<Mappedin | undefined>;
196
+ loadVenue(options: TGetVenueOptions, showVenueOptions: TShowVenueOptions): Promise<unknown>;
174
197
  /**
175
198
  *
176
199
  * @hidden
177
200
  */
178
- showVenue(venueData: Mappedin, showVenueOptions: TShowVenueOptions): Promise<void>;
201
+ showVenue(venueData: Mappedin, showVenueOptions: TShowVenueOptions): Promise<unknown>;
179
202
  /**
180
203
  * Clear any cached venue bundles that were downloaded as part of LOAD_VENUE with useBundle: true
181
204
  * This ensure that the next time keys are passed in, we get a fresh bundle
@@ -264,12 +287,12 @@ declare module '@mappedin/react-native-sdk/wrappers/react-native-sdk/src/MiMapVi
264
287
  */
265
288
  setTilt: (tilt: number) => Promise<undefined>;
266
289
  /**
267
- * The current rotation in degrees from north.
290
+ * The current rotation in radians from north.
268
291
  * @deprecated Use CameraControls.rotation instead
269
292
  */
270
293
  rotation: number;
271
294
  /**
272
- * @param rotation The new value to set the rotation to, in degrees from north..
295
+ * @param rotation The new value to set the rotation to, in radians from north..
273
296
  * @deprecated Use CameraControls.setRotation instead
274
297
  */
275
298
  setRotation: (rotation: number) => Promise<undefined>;
@@ -287,7 +310,7 @@ declare module '@mappedin/react-native-sdk/wrappers/react-native-sdk/src/MiMapVi
287
310
  */
288
311
  set: (positionOptions?: TAnimatePositionOptions | undefined) => Promise<unknown>;
289
312
  /**
290
- * The current rotation in degrees from north.
313
+ * The current rotation in radians from north.
291
314
  */
292
315
  rotation: number;
293
316
  /**
@@ -393,6 +416,20 @@ declare module '@mappedin/react-native-sdk/wrappers/common' {
393
416
  export { PubSub } from '@mappedin/react-native-sdk/wrappers/common/pub-sub';
394
417
  }
395
418
 
419
+ declare module '@mappedin/react-native-sdk/wrappers/common/errors' {
420
+ export enum ERROR {
421
+ LOAD_VENUE_FAILED = "LOAD_VENUE_FAILED",
422
+ SHOW_VENUE_FAILED = "SHOW_VENUE_FAILED",
423
+ SET_MAP_FAILED = "SET_MAP_FAILED",
424
+ SHOW_MINIMAP_ERROR = "SHOW_MINIMAP_ERROR",
425
+ LOAD_MINIMAP_ERROR = "LOAD_MINIMAP_ERROR"
426
+ }
427
+ export enum ERROR_MESSAGES {
428
+ GENERIC_LOAD_VENUE_ERROR = "Unable to load Venue. Please check your keys",
429
+ GENERIC_SET_MAP_ERROR = "Unable to set map, check that you're passing a valid map"
430
+ }
431
+ }
432
+
396
433
  declare module '@mappedin/react-native-sdk/wrappers/react-native-sdk/src' {
397
434
  export { MiMapView } from '@mappedin/react-native-sdk/wrappers/react-native-sdk/src/MiMapView';
398
435
  export type { TMiMapViewProps } from '@mappedin/react-native-sdk/wrappers/react-native-sdk/src/MiMapView';
@@ -411,6 +448,7 @@ declare module '@mappedin/react-native-sdk/wrappers/react-native-sdk/src' {
411
448
  export type TLabelAllLocationCommonOptions = Omit<TLabelAllLocationCommonOptionsBase, 'sortFunction' | 'translationMap'>;
412
449
  export type { IDirectionsResult, MappedinDirections, TMappedinDirective } from '@mappedin/react-native-sdk/core/packages/renderer/index.rn';
413
450
  export type { TShowVenueOptions } from '@mappedin/react-native-sdk/core/packages/renderer/index.rn';
451
+ export { ERROR, ERROR_MESSAGES } from '@mappedin/react-native-sdk/wrappers/common/errors';
414
452
  export { E_GET_DIRECTIONS_MESSAGES, BEARING_TYPE, ACTION_TYPE, MappedinLocation, Mappedin, MappedinPolygon, MappedinNode, MappedinCategory, MappedinMap, MappedinEvent, MappedinMapGroup, MappedinVenue, MappedinVortex, MappedinRankings, MappedinDestinationSet } from '@mappedin/react-native-sdk/core/packages/renderer/index.rn';
415
453
  }
416
454
 
@@ -905,6 +943,13 @@ declare module '@mappedin/react-native-sdk/core/packages/renderer/MapView.types'
905
943
  * The rank of the object used when comparing colliders to determine which should be shown.
906
944
  */
907
945
  collisionRank?: COLLISION_RANKING_TIERS;
946
+ /**
947
+ * By default, we don't hide tooltips when they collide. This is
948
+ * so that for floor switching tooltips we don't lose where the elevator is
949
+ * This option will override that behavior
950
+ * @default true
951
+ */
952
+ alwaysVisible?: boolean;
908
953
  };
909
954
  export type TCreateTextTooltipOptions = TCreateTooltipCommonOptions & {
910
955
  /**
@@ -3092,7 +3137,7 @@ declare module '@mappedin/react-native-sdk/core/packages/get-venue/MappedinMap'
3092
3137
  createCoordinate(lat: number, lon: number): MappedinCoordinate;
3093
3138
  /**
3094
3139
  *
3095
- * @returns map rotation in degrees from North
3140
+ * @returns map rotation in radians from north
3096
3141
  */
3097
3142
  getNorth(): any;
3098
3143
  static hydrate(maps: any, mappedin: Mappedin): MappedinMap[];
@@ -3776,7 +3821,7 @@ declare module '@mappedin/react-native-sdk/core/packages/renderer/internal/Mappe
3776
3821
  get strategies(): TColliderStrategy[];
3777
3822
  getCachedSymbol(orientation: any, textAlign: any, xCoordinate: any): any;
3778
3823
  colliderDidMount(): void;
3779
- colliderDidUpdatePosition(x: any, y: any): void;
3824
+ colliderDidUpdatePosition(pos: any): void;
3780
3825
  setPriority(priority: any): void;
3781
3826
  colliderDidUpdateVisiblity(): void;
3782
3827
  colliderDidGoOutsideGrid(): void;
@@ -3998,6 +4043,7 @@ declare module '@mappedin/react-native-sdk/core/packages/renderer/internal/Mappe
3998
4043
  selector?: string;
3999
4044
  map: string;
4000
4045
  padding?: number;
4046
+ alwaysVisible?: boolean;
4001
4047
  collisionRank?: COLLISION_RANKING_TIERS;
4002
4048
  defaultAnchorType?: string;
4003
4049
  enabledAnchorTypes?: {
@@ -4019,6 +4065,7 @@ declare module '@mappedin/react-native-sdk/core/packages/renderer/internal/Mappe
4019
4065
  bottomRight?: boolean;
4020
4066
  };
4021
4067
  class SmartTooltip extends HTMLCollider implements IHTMLCollider {
4068
+ #private;
4022
4069
  className: string;
4023
4070
  _el: Element | null;
4024
4071
  style: TTooltipStyle;
@@ -4027,7 +4074,6 @@ declare module '@mappedin/react-native-sdk/core/packages/renderer/internal/Mappe
4027
4074
  get strategies(): TColliderStrategy[];
4028
4075
  colliderDidMount(): void;
4029
4076
  setAction(action: any): void;
4030
- updateDimensions(): void;
4031
4077
  colliderDidNotFindAHome(): void;
4032
4078
  colliderDidGoOffscreen(): void;
4033
4079
  colliderDidUpdateVisiblity(): void;
@@ -4680,6 +4726,19 @@ declare module '@mappedin/react-native-sdk/core/packages/renderer/MapView' {
4680
4726
  * @param polygon The Polygon you want the primary Location of.
4681
4727
  */
4682
4728
  getPrimaryLocationForPolygon(polygon: MappedinPolygon): MappedinLocation;
4729
+ /**
4730
+ * Finds all polygons that contain the specified MappedinCoordinate. If multiple
4731
+ * polygons are stacked on top of each other, the array of polygons returned will be
4732
+ * in the order of top to bottom.
4733
+ *
4734
+ * By default, this only considers interactive polygons.
4735
+ *
4736
+ * @param coordinate The MappedinCoordinate to check
4737
+ * @param includeNonInteractive Specifies if all polygons should be included rather
4738
+ * than just interactive polygons.
4739
+ * @returns MappedinPolygon[]
4740
+ */
4741
+ getPolygonsAtCoordinate(coordinate: MappedinCoordinate, includeNonInteractive?: boolean): MappedinPolygon[];
4683
4742
  /**
4684
4743
  * Destroy instance and clean up memory
4685
4744
  */
@@ -4792,7 +4851,7 @@ declare module '@mappedin/react-native-sdk/core/packages/get-venue/MappedinTheme
4792
4851
  }
4793
4852
 
4794
4853
  declare module '@mappedin/react-native-sdk/core/packages/renderer/internal/Mappedin.SmartCollider' {
4795
- import { ISmartCollisionEngine } from '@mappedin/react-native-sdk/core/packages/renderer/internal/Mappedin.SmartCollisionEngine';
4854
+ import SmartCollisionEngine from '@mappedin/react-native-sdk/core/packages/renderer/internal/Mappedin.SmartCollisionEngine';
4796
4855
  import { Vector3 } from 'three';
4797
4856
  export type TRange = [number, number, number, number];
4798
4857
  type TCustomCollider<T> = ICollider & T;
@@ -4829,7 +4888,7 @@ declare module '@mappedin/react-native-sdk/core/packages/renderer/internal/Mappe
4829
4888
  setAction: (action: EColliderAction) => void;
4830
4889
  action?: EColliderAction;
4831
4890
  position: Vector3;
4832
- __engine?: ISmartCollisionEngine;
4891
+ __engine?: SmartCollisionEngine;
4833
4892
  enable: () => void;
4834
4893
  disable: () => void;
4835
4894
  enabled: boolean;
@@ -4843,7 +4902,7 @@ declare module '@mappedin/react-native-sdk/core/packages/renderer/internal/Mappe
4843
4902
  colliderDidGoOffscreen?: () => void;
4844
4903
  colliderDidGoOutsideGrid?: () => void;
4845
4904
  colliderDidUpdateVisiblity?: () => void;
4846
- colliderDidUpdatePosition?: (x: number, y: number) => void;
4905
+ colliderDidUpdatePosition?: (prop: [x: number, y: number]) => void;
4847
4906
  }
4848
4907
  class BaseCollider implements ICollider {
4849
4908
  __engine: any;
@@ -4873,7 +4932,7 @@ declare module '@mappedin/react-native-sdk/core/packages/renderer/internal/Mappe
4873
4932
  removeSelf(): void;
4874
4933
  enable(): void;
4875
4934
  disable(): void;
4876
- colliderDidUpdatePosition(x: any, y: any): void;
4935
+ colliderDidUpdatePosition(pos: any): void;
4877
4936
  colliderDidNotFindAHome(): void;
4878
4937
  colliderDidMount(): void;
4879
4938
  colliderDidUpdateVisiblity(): void;
@@ -5096,6 +5155,7 @@ declare module '@mappedin/react-native-sdk/core/packages/renderer/internal/Mappe
5096
5155
  contentEl: any;
5097
5156
  }
5098
5157
  class HTMLCollider extends BaseCollider {
5158
+ #private;
5099
5159
  contentEl: any;
5100
5160
  containerEl: any;
5101
5161
  removeSelf(): void;
@@ -5103,7 +5163,12 @@ declare module '@mappedin/react-native-sdk/core/packages/renderer/internal/Mappe
5103
5163
  disable(): void;
5104
5164
  colliderDidGoOffscreen(): void;
5105
5165
  colliderDidNotFindAHome(): void;
5106
- colliderDidUpdatePosition(x: any, y: any): void;
5166
+ colliderDidUpdatePosition(pos: any): void;
5167
+ updateDimensions(): void;
5168
+ /**
5169
+ * @internal
5170
+ */
5171
+ updateDimensionsImmediately(): void;
5107
5172
  colliderDidMount(): void;
5108
5173
  colliderDidUpdateVisiblity(): void;
5109
5174
  }
@@ -5338,7 +5403,6 @@ declare module '@mappedin/react-native-sdk/core/packages/renderer/internal/Mappe
5338
5403
  get strategies(): TColliderStrategy[];
5339
5404
  colliderDidMount(): void;
5340
5405
  setAction(action: any): void;
5341
- updateDimensions(): void;
5342
5406
  colliderDidGoOffscreen(): void;
5343
5407
  colliderDidUpdateVisiblity(): void;
5344
5408
  }
@@ -5572,27 +5636,55 @@ declare module '@mappedin/react-native-sdk/core/packages/renderer/internal/Mappe
5572
5636
  declare module '@mappedin/react-native-sdk/core/packages/renderer/internal/Mappedin.SmartCollisionEngine' {
5573
5637
  import { Vector3 } from 'three';
5574
5638
  import './Mappedin.SmartCollisionEngine.scss';
5575
- import { ICollider } from '@mappedin/react-native-sdk/core/packages/renderer/internal/Mappedin.SmartCollider';
5639
+ import { ICollider, TRange } from '@mappedin/react-native-sdk/core/packages/renderer/internal/Mappedin.SmartCollider';
5640
+ import { MappedinMap, MapView } from '@mappedin/react-native-sdk/core/packages/renderer';
5576
5641
  export const COLLIDER_STRATEGY_LOW_PRIORITY = "LOW_PRIORITY";
5577
- type TProjectFn = ({ position, mapId }: {
5578
- position: Vector3;
5579
- mapId: string;
5580
- }) => [number, number];
5581
- export interface ISmartCollisionEngine {
5582
- add: (colliderId: string, collider: ICollider) => void;
5583
- remove: (colliderId: string) => void;
5584
- init: (container: HTMLElement, projectFn: TProjectFn) => void;
5585
- resize: (container: HTMLElement) => void;
5586
- resort: () => void;
5587
- updatePosition: () => void;
5588
- updateVisibility: () => void;
5589
- makeCollidersDirty: () => void;
5590
- update: () => void;
5591
- destroy: () => void;
5592
- makeCollidersDirtyThrottled: (time: number) => void;
5593
- _makeCollidersDirtyThrottled?: [() => void, number];
5642
+ class SmartCollisionEngine {
5643
+ #private;
5644
+ _makeCollidersDirtyThrottled: any;
5645
+ colliderCanvas: HTMLCanvasElement;
5646
+ debugCanvas: HTMLCanvasElement;
5647
+ colliderCanvasContext: CanvasRenderingContext2D;
5648
+ debugCanvasContext: CanvasRenderingContext2D;
5649
+ collisionEngineContainerEl: HTMLDivElement;
5650
+ stepsX: any;
5651
+ stepsY: any;
5652
+ totalWidth: any;
5653
+ totalHeight: any;
5654
+ project: any;
5655
+ grid: Uint8Array;
5656
+ colliders: Map<string, ICollider>;
5657
+ offscreenRanges: TRange[];
5658
+ get sortedColliders(): ICollider[];
5659
+ initialized: boolean;
5660
+ mapView: MapView;
5661
+ constructor(mapView: any);
5662
+ init: (container: HTMLDivElement, projectFn: ({ position, mapId }: {
5663
+ position: Vector3;
5664
+ mapId: MappedinMap['id'];
5665
+ }) => {
5666
+ x: number;
5667
+ y: number;
5668
+ }) => void;
5669
+ updatePosition: () => void;
5670
+ updateVisibility: () => void;
5671
+ add: (colliderId: string, collider: ICollider) => void;
5672
+ remove: (colliderId: string) => void;
5673
+ /**
5674
+ * When adding/removing new colliders, or when updating their priorty, we need to make all colliders around them as "dirty",
5675
+ * so they can be reconcilded correctly
5676
+ */
5677
+ makeCollidersDirty: () => void;
5678
+ /**
5679
+ * Allow to throttle making collders dirty. This is useful for things like BlueDot follow mode,
5680
+ * As we follow the BlueDot, colliders will overlap, but constantly updating their visiblity makes
5681
+ * for a bad experience
5682
+ */
5683
+ makeCollidersDirtyThrottled: (time: any) => void;
5684
+ resize: (container: any) => void;
5685
+ update: () => void;
5686
+ destroy: () => void;
5594
5687
  }
5595
- const SmartCollisionEngine: () => ISmartCollisionEngine;
5596
5688
  export default SmartCollisionEngine;
5597
5689
  }
5598
5690