@mappedin/mappedin-js 4.0.18 → 4.0.21

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.
@@ -58,7 +58,7 @@ declare module '@mappedin/mappedin-js/lib/esm/get-venue' {
58
58
  };
59
59
  };
60
60
  export { MAP_RENDER_MODE };
61
- export function getVenueMVF(userOptions: TGetVenueOptions): Promise<Mappedin>;
61
+ export function getVenueMVF(userOptions: TGetVenueBundleOptions): Promise<Mappedin>;
62
62
  /**
63
63
  * Get Venue Data for a Mappedin Venue
64
64
  */
@@ -106,7 +106,7 @@ declare module '@mappedin/mappedin-js/lib/esm/get-venue' {
106
106
  /**
107
107
  * @internal
108
108
  */
109
- export function downloadVenueBundleMVF(options: TGetVenueOptions,
109
+ export function downloadVenueBundleMVF(options: TGetVenueBundleOptions,
110
110
  /**
111
111
  * use Web Workers to speed up MVF parsing. This is likely only benefitial for larger venues,
112
112
  * and may be determental to smaller ones, hence it is off by default
@@ -173,6 +173,7 @@ declare module '@mappedin/mappedin-js/lib/esm/get-venue/get-venue/Mappedin' {
173
173
  import { MappedinTheme } from '@mappedin/mappedin-js/lib/esm/get-venue/get-venue/MappedinTheme';
174
174
  import { MappedinVenue } from '@mappedin/mappedin-js/lib/esm/get-venue/get-venue/MappedinVenue';
175
175
  import { MappedinVortex } from '@mappedin/mappedin-js/lib/esm/get-venue/get-venue/MappedinVortex';
176
+ import Analytics from '@mappedin/mappedin-js/lib/esm/get-venue/get-venue/Mappedin.Analytics';
176
177
  export const defaultOptions: TGetVenueOptionsInternal & TGetVenueOptions;
177
178
  export enum MappedinCollectionType {
178
179
  CATEGORY = "categories",
@@ -401,9 +402,11 @@ declare module '@mappedin/mappedin-js/lib/esm/get-venue/get-venue/Mappedin' {
401
402
  */
402
403
  hydrate(mappedinSerializableData: string | object, shouldPopulateBundledImagesAsBlobs?: boolean): Promise<undefined>;
403
404
  images: any;
405
+ imageBinaries?: Map<string, Uint8Array>;
404
406
  scenes: any;
405
407
  fetch(): Promise<void>;
406
408
  constructor(options: TGetVenueOptionsInternal & TGetVenueOptions);
409
+ analytics: Analytics;
407
410
  /**
408
411
  * @hidden
409
412
  */
@@ -551,6 +554,7 @@ declare module '@mappedin/mappedin-js/lib/esm/get-venue/get-venue/MappedinPolygo
551
554
  y: number;
552
555
  z: number;
553
556
  };
557
+ _isAbsolutelyPositioned?: boolean;
554
558
  };
555
559
  holes?: unknown[];
556
560
  textures?: {
@@ -1410,179 +1414,192 @@ declare module '@mappedin/mappedin-js/lib/esm/get-venue/get-venue/Mappedin.API.t
1410
1414
  venue: TVenue;
1411
1415
  vortexes: TVortex[];
1412
1416
  locationStates?: TLocationState[];
1417
+ imageBinaries?: Map<string, Uint8Array>;
1413
1418
  };
1414
1419
  }
1415
1420
 
1416
1421
  declare module '@mappedin/mappedin-js/lib/esm/get-venue/get-venue/Mappedin.MVF.types' {
1417
- import { FeatureCollection, Polygon, Point, MultiPolygon } from 'geojson';
1422
+ import { FeatureCollection, Polygon, Point, MultiPolygon, Position } from 'geojson';
1418
1423
  type ManifestFile = {
1419
- type: 'file';
1420
- name: string;
1424
+ type: 'file';
1425
+ name: string;
1421
1426
  };
1422
1427
  type ManifestFolder = {
1423
- type: 'folder';
1424
- name: string;
1425
- children: ManifestFile[];
1428
+ type: 'folder';
1429
+ name: string;
1430
+ children: ManifestFile[];
1426
1431
  };
1427
1432
  type OpeningHours = {
1428
- opens: string;
1429
- closes: string;
1430
- dayOfWeek: string;
1431
- validFrom?: string;
1432
- validThrough?: string;
1433
+ opens: string;
1434
+ closes: string;
1435
+ dayOfWeek: string;
1436
+ validFrom?: string;
1437
+ validThrough?: string;
1433
1438
  };
1434
1439
  type Image = {
1435
- original?: string;
1436
- xlarge?: string;
1437
- xxlarge?: string;
1438
- medium?: string;
1439
- '140x140'?: string;
1440
- xsmall?: string;
1441
- xxsmall?: string;
1442
- '66x66'?: string;
1443
- small?: string;
1444
- large?: string;
1440
+ original?: string;
1441
+ xlarge?: string;
1442
+ xxlarge?: string;
1443
+ medium?: string;
1444
+ '140x140'?: string;
1445
+ xsmall?: string;
1446
+ xxsmall?: string;
1447
+ '66x66'?: string;
1448
+ small?: string;
1449
+ large?: string;
1445
1450
  };
1446
1451
  type PolygonImage = string;
1447
1452
  type Phone = {
1448
- number: string;
1449
- extension?: string;
1453
+ number: string;
1454
+ extension?: string;
1450
1455
  };
1451
1456
  type Link = {
1452
- label: string;
1453
- url: string;
1457
+ label: string;
1458
+ url: string;
1454
1459
  };
1455
1460
  type Social = {
1456
- facebook?: string;
1457
- twitter?: string;
1458
- instagram?: string;
1459
- website?: string;
1461
+ facebook?: string;
1462
+ twitter?: string;
1463
+ instagram?: string;
1464
+ website?: string;
1460
1465
  };
1461
1466
  type LocationState = {
1462
- type: string;
1463
- start?: string;
1464
- end?: string;
1465
- };
1466
- type ImageTransform = {
1467
- position: {
1468
- x: number;
1469
- y: number;
1470
- z: number;
1471
- };
1472
- rotation: number;
1473
- scale: {
1474
- x: number;
1475
- y: number;
1476
- };
1467
+ type: string;
1468
+ start?: string;
1469
+ end?: string;
1477
1470
  };
1478
1471
  type SiblingGroup = {
1479
- label: string;
1480
- siblings: string[];
1472
+ label: string;
1473
+ siblings: string[];
1481
1474
  };
1482
1475
  export type MILocationProperties = {
1483
- id: string;
1484
- address?: string | null;
1485
- categories: string[];
1486
- description?: string | null;
1487
- email?: string | null;
1488
- externalId?: string | null;
1489
- hours?: OpeningHours[] | null;
1490
- links?: Link[] | null;
1491
- logo?: Image | null;
1492
- name: string;
1493
- phone?: Phone | null;
1494
- picture?: Image | null;
1495
- services?: string | null;
1496
- siblingGroups?: SiblingGroup[] | null;
1497
- social?: Social | null;
1498
- spaces?: TLocationSpaceReference[] | null;
1499
- states?: LocationState[] | null;
1500
- type: string;
1476
+ id: string;
1477
+ address?: string | null;
1478
+ categories: string[];
1479
+ description?: string | null;
1480
+ email?: string | null;
1481
+ externalId?: string | null;
1482
+ hours?: OpeningHours[] | null;
1483
+ links?: Link[] | null;
1484
+ logo?: Image | null;
1485
+ name: string;
1486
+ phone?: Phone | null;
1487
+ picture?: Image | null;
1488
+ services?: string | null;
1489
+ siblingGroups?: SiblingGroup[] | null;
1490
+ social?: Social | null;
1491
+ spaces?: TLocationSpaceReference[] | null;
1492
+ states?: LocationState[] | null;
1493
+ type: string;
1501
1494
  };
1502
1495
  export type MICategoryProperties = {
1503
- id: string;
1504
- name: string;
1505
- picture?: Image;
1496
+ id: string;
1497
+ name: string;
1498
+ picture?: Image;
1506
1499
  };
1507
1500
  export type MIBuildingProperties = {
1508
- id: string;
1509
- name: string;
1510
- venue: string;
1501
+ id: string;
1502
+ name: string;
1503
+ venue: string;
1511
1504
  };
1512
1505
  export type MILevelProperties = {
1513
- id: string;
1514
- abbreviation?: string;
1515
- building?: string;
1516
- elevation?: number;
1517
- name: string;
1506
+ id: string;
1507
+ abbreviation?: string;
1508
+ building?: string;
1509
+ elevation?: number;
1510
+ name: string;
1518
1511
  };
1519
1512
  export type MIPolygonlikeProperties = {
1520
- id: string;
1521
- altitude?: string;
1522
- color?: string;
1523
- externalId?: string | null;
1524
- height?: string;
1525
- layer?: string;
1526
- level: string;
1527
- parent?: string | null;
1513
+ id: string;
1514
+ altitude?: string;
1515
+ color?: string;
1516
+ externalId?: string | null;
1517
+ height?: string;
1518
+ layer?: string;
1519
+ level: string;
1520
+ parent?: string | null;
1528
1521
  };
1529
1522
  type TPseudoNodeSpaceReference = {
1530
- node: string;
1531
- map: string;
1523
+ node: string;
1524
+ map: string;
1532
1525
  };
1533
1526
  export type TRealSpaceReference = {
1534
- id: string;
1535
- map: string;
1527
+ id: string;
1528
+ map: string;
1536
1529
  };
1537
1530
  type TLocationSpaceReference = TPseudoNodeSpaceReference | TRealSpaceReference;
1538
1531
  export type TEntrances = {
1539
- id: string;
1540
- level: string;
1532
+ id: string;
1533
+ level: string;
1541
1534
  };
1542
1535
  export type MISpaceProperties = MIPolygonlikeProperties & {
1543
- entrances: TEntrances[];
1536
+ entrances: TEntrances[];
1544
1537
  };
1545
1538
  export type MIObstructionProperties = MIPolygonlikeProperties;
1546
1539
  export type MIConnectionProperties = {
1547
- id: string;
1548
- accessible: boolean;
1549
- destinations: string[];
1550
- level: string;
1551
- multiplier: number;
1552
- name: string;
1553
- type: string;
1554
- weight: number;
1540
+ id: string;
1541
+ accessible: boolean;
1542
+ destinations: string[];
1543
+ level: string;
1544
+ multiplier: number;
1545
+ name: string;
1546
+ type: string;
1547
+ weight: number;
1555
1548
  };
1556
1549
  export type MINodeProperties = {
1557
- id: string;
1558
- accessible: boolean;
1559
- externalId: string | null;
1560
- level: string;
1561
- multiplier: number;
1562
- neighbors: string[];
1563
- weight: number;
1550
+ id: string;
1551
+ accessible: boolean;
1552
+ externalId: string | null;
1553
+ level: string;
1554
+ multiplier: number;
1555
+ neighbors: string[];
1556
+ weight: number;
1564
1557
  };
1565
1558
  export type MIManifestProperties = {
1566
- name: string;
1567
- folder_struct: (ManifestFolder | ManifestFile)[];
1568
- version: string;
1569
- time: string;
1559
+ name: string;
1560
+ folder_struct: (ManifestFolder | ManifestFile)[];
1561
+ version: string;
1562
+ time: string;
1570
1563
  };
1571
- export type MILayerStyleProperties = {
1572
- layer: string;
1573
- altitude: number;
1574
- color: string;
1575
- height: number;
1576
- opacity: number;
1564
+ export type MIStyle = {
1565
+ id: string;
1566
+ /** The altitude of the bottom of the geometry, in metres. */
1567
+ altitude: number;
1568
+ color: string;
1569
+ height: number;
1570
+ image?: PolygonImage;
1571
+ opacity: number;
1577
1572
  };
1578
- export type MIPolygonStyleProperties = {
1579
- id: string;
1580
- altitude: number;
1581
- color: string;
1582
- height: number;
1583
- image: PolygonImage;
1584
- imageTransform: ImageTransform;
1585
- opacity: number;
1573
+ export type MIImageInstance = {
1574
+ /** The local path or URL of the image. */
1575
+ path: string;
1576
+ /** The position of the centre of the image, in [long, lat] form. */
1577
+ position: Position;
1578
+ /** The altitude of the image, in metres. */
1579
+ altitude: number;
1580
+ /** Euler angles representing the rotation of the image, in degrees. Angles are in XYZ order. */
1581
+ rotation: {
1582
+ x: number;
1583
+ y: number;
1584
+ z: number;
1585
+ };
1586
+ /** The size of the image, in metres. */
1587
+ size: {
1588
+ x: number;
1589
+ y: number;
1590
+ };
1591
+ /** The portion of the image to display. */
1592
+ viewBox: {
1593
+ top: number;
1594
+ left: number;
1595
+ width: number;
1596
+ height: number;
1597
+ };
1598
+ /**
1599
+ * A space or obstruction to associate this image with. If provided,
1600
+ * changes to the polygon's visibility will affect this image.
1601
+ * */
1602
+ polygonId?: string;
1586
1603
  };
1587
1604
  export type MIGeoJSONManifestCollection = FeatureCollection<Point, MIManifestProperties>;
1588
1605
  export type MIGeoJSONBuildingCollection = FeatureCollection<Polygon, MIBuildingProperties>;
@@ -1593,25 +1610,35 @@ declare module '@mappedin/mappedin-js/lib/esm/get-venue/get-venue/Mappedin.MVF.t
1593
1610
  export type MIGeoJSONNodeCollection = FeatureCollection<Point, MINodeProperties>;
1594
1611
  export type MIGeoJSONLocationCollection = FeatureCollection<null, MILocationProperties>;
1595
1612
  export type MIGeoJSONCategoryCollection = FeatureCollection<null, MICategoryProperties>;
1596
- export type MIGeoJSONLayerStyleCollection = FeatureCollection<null, MILayerStyleProperties>;
1597
- export type MIGeoJSONPolygonStyleCollection = FeatureCollection<null, MIPolygonStyleProperties>;
1598
1613
  export type WithIDs<T> = Map<string, T>;
1614
+ export type MIStyleCollection = MIStyle[];
1599
1615
  /**
1600
- * The entire data collection for an MVF, in a single JSON collection.
1601
- *
1602
- */
1603
- export type MVFData = {
1604
- connection: WithIDs<MIGeoJSONConnectionCollection>;
1605
- level: WithIDs<MIGeoJSONLevelCollection>;
1606
- node: WithIDs<MIGeoJSONNodeCollection>;
1607
- obstruction: WithIDs<MIGeoJSONObstructionCollection>;
1608
- polygonStyle: WithIDs<MIGeoJSONPolygonStyleCollection>;
1609
- space: WithIDs<MIGeoJSONSpaceCollection>;
1610
- building: MIGeoJSONBuildingCollection;
1611
- category: MIGeoJSONCategoryCollection;
1612
- layerStyle: MIGeoJSONLayerStyleCollection;
1613
- location: MIGeoJSONLocationCollection;
1614
- manifest: MIGeoJSONManifestCollection;
1616
+ * A mapping of polygon IDs to style IDs;
1617
+ */
1618
+ export type MIPolygonStyle = {
1619
+ [key in string]: string;
1620
+ };
1621
+ export type MIImageInstanceCollection = MIImageInstance[];
1622
+ /**
1623
+ * The entire data collection for an MVF, in a single JSON collection.
1624
+ *
1625
+ */
1626
+ export type MVFDataJSON = {
1627
+ connection: WithIDs<MIGeoJSONConnectionCollection>;
1628
+ level: WithIDs<MIGeoJSONLevelCollection>;
1629
+ node: WithIDs<MIGeoJSONNodeCollection>;
1630
+ obstruction: WithIDs<MIGeoJSONObstructionCollection>;
1631
+ space: WithIDs<MIGeoJSONSpaceCollection>;
1632
+ building: MIGeoJSONBuildingCollection;
1633
+ category: MIGeoJSONCategoryCollection;
1634
+ style: MIStyleCollection;
1635
+ polygonStyle: WithIDs<MIPolygonStyle>;
1636
+ imageInstance: WithIDs<MIImageInstanceCollection>;
1637
+ location: MIGeoJSONLocationCollection;
1638
+ manifest: MIGeoJSONManifestCollection;
1639
+ };
1640
+ export type MVFData = MVFDataJSON & {
1641
+ imageBinaries: WithIDs<Uint8Array>;
1615
1642
  };
1616
1643
  export {};
1617
1644
  }
@@ -1665,6 +1692,90 @@ declare module '@mappedin/mappedin-js/lib/esm/get-venue/get-venue/MappedinTheme'
1665
1692
  }
1666
1693
  }
1667
1694
 
1695
+ declare module '@mappedin/mappedin-js/lib/esm/get-venue/get-venue/Mappedin.Analytics' {
1696
+ type AnalyticsOptions = {
1697
+ clientId?: string;
1698
+ clientSecret?: string;
1699
+ accessToken?: string;
1700
+ noAuth?: boolean;
1701
+ venue: string;
1702
+ testMode?: boolean | string;
1703
+ context?: string;
1704
+ };
1705
+ /**
1706
+ * A class to access the Mappedin Analytics platform. Correct usage will improve Smart Search results, and lead to more accurate insights.
1707
+ * This will be created for you as part of Mappedin.{{#crossLink "Mappedin/initialize:method"}}{{/crossLink}}, but you can also create one manually. You are mostly going to use `locationSelected`.
1708
+ *
1709
+ * @type {any}
1710
+ *
1711
+ * @class Analytics
1712
+ * @param options {Object} A list of configuration options for the Analytics API.
1713
+ * @param [options.clientId] {String} The same key you are using for getVenue. Handled automatically in Mapview.initialize()
1714
+ * @param [options.clientSecret] {String} The same secret you are using for getVenue. Handled automatically in Mapview.initialize()
1715
+ * @param [options.venue] {String} The same venue slug you are using for getVenue. Handled automatically in MapView.initialize()
1716
+ * @param [options.context] {String} The context to pass with the analytics request. Defaults to "websdk".
1717
+ * @param [options.noAuth] {Boolean} Whether authentication should not be sent with analytics requests.
1718
+ * @param [options.testMode] {Boolean} Whether analytics events should be dropped because this is running in a test environment.
1719
+ */
1720
+ class Analytics {
1721
+ #private;
1722
+ constructor(options: AnalyticsOptions);
1723
+ track(target: any, query: any): void;
1724
+ /**
1725
+ * Whenever a location is selected, you should fire this event. What "selected" means can vary by venue,
1726
+ * but a good rule of thumb is that you fire the event whenever you would show the location's details.
1727
+ * Typically this is when the user taps it's polygon on the map, picks it from search results or a category list.
1728
+ * or deep links directly into the map.
1729
+ * @method locationSelected
1730
+ * @param location {MappedinLocation} The location the user selected.
1731
+ */
1732
+ locationSelected(location: any): void;
1733
+ /**
1734
+ * Whenever a category is selected, you should fire this event.
1735
+ * @method categorySelected
1736
+ * @param category {MappedinCategory} The category the user selected.
1737
+ */
1738
+ categorySelected(category: any): void;
1739
+ mapViewLoaded(type: any, forced: any, benchmark: any, reason: any): void;
1740
+ /**
1741
+ * Whenever a user requests directions, you should fire this event.
1742
+ * @method getDirections
1743
+ * @param start {MappedinLocation} The start location for wayfinding.
1744
+ * @param end {MappedinLocation} The end location for wayfinding.
1745
+ */
1746
+ getDirections(start: any, end: any): void;
1747
+ getSessionID(): string;
1748
+ getDeviceID(): string;
1749
+ /**
1750
+ * @param mode {Boolean} Indicates whether the user's geolocation is enabled.
1751
+ */
1752
+ setGeolocationMode(mode: any): void;
1753
+ /**
1754
+ * Track an event.
1755
+ * @method trackBlueDotEvent
1756
+ * @param event {String}
1757
+ * event param should be a property of the {{#crossLink "Analytics/BLUEDOT_EVENT:property"}}{{/crossLink}} property.
1758
+ */
1759
+ trackBlueDotEvent(blueDotEvent: any): void;
1760
+ trackSearch(searchAnalyticsObject: any): void;
1761
+ trackSearchSuggest(searchAnalyticsObject: any): void;
1762
+ /**
1763
+ * Enum of valid bluedot events.
1764
+ * Pass a property of this into the {{#crossLink "Analytics/trackBlueDotEvent:method"}}{{/crossLink}} method.
1765
+ * Valid properties are: ATTEMPT_BLUEDOT, FOUND_POSITION, FOUND_FLOOR.
1766
+ * @property BLUEDOT_EVENT {Object}
1767
+ * @example
1768
+ * Analytics.trackBlueDotEvent(Analytics.BLUEDOT_EVENT.ATTEMPT_BLUEDOT)
1769
+ */
1770
+ static BLUEDOT_EVENT: {
1771
+ ATTEMPT_BLUEDOT: string;
1772
+ FOUND_POSITION: string;
1773
+ FOUND_FLOOR: string;
1774
+ };
1775
+ }
1776
+ export default Analytics;
1777
+ }
1778
+
1668
1779
  declare module '@mappedin/mappedin-js/lib/esm/get-venue/get-venue' {
1669
1780
  import type { TGetVenueOptions } from '@mappedin/mappedin-js/lib/esm/get-venue/get-venue/Mappedin.types';
1670
1781
  import { Mappedin } from '@mappedin/mappedin-js/lib/esm/get-venue/get-venue/Mappedin';
@@ -1721,7 +1832,7 @@ declare module '@mappedin/mappedin-js/lib/esm/get-venue/get-venue' {
1721
1832
  };
1722
1833
  };
1723
1834
  export { MAP_RENDER_MODE };
1724
- export function getVenueMVF(userOptions: TGetVenueOptions): Promise<Mappedin>;
1835
+ export function getVenueMVF(userOptions: TGetVenueBundleOptions): Promise<Mappedin>;
1725
1836
  /**
1726
1837
  * Get Venue Data for a Mappedin Venue
1727
1838
  */
@@ -1769,7 +1880,7 @@ declare module '@mappedin/mappedin-js/lib/esm/get-venue/get-venue' {
1769
1880
  /**
1770
1881
  * @internal
1771
1882
  */
1772
- export function downloadVenueBundleMVF(options: TGetVenueOptions,
1883
+ export function downloadVenueBundleMVF(options: TGetVenueBundleOptions,
1773
1884
  /**
1774
1885
  * use Web Workers to speed up MVF parsing. This is likely only benefitial for larger venues,
1775
1886
  * and may be determental to smaller ones, hence it is off by default