@yext/pages-components 1.0.4 → 1.1.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.
package/dist/index.d.ts CHANGED
@@ -146,7 +146,7 @@ type TrackProps = {
146
146
  action: Action;
147
147
  destinationUrl: string;
148
148
  scope?: string;
149
- eventName?: string;
149
+ eventName: string;
150
150
  amount?: number;
151
151
  currency?: string;
152
152
  customTags?: Record<string, string>;
@@ -500,22 +500,12 @@ type ImageProps = OtherImageProps | FixedImageProps | AspectImageProps;
500
500
  */
501
501
  declare const Image: ({ image, className, width, height, aspectRatio, layout, placeholder, imgOverrides, style, loading, }: ImageProps) => react_jsx_runtime.JSX.Element;
502
502
 
503
- /**
504
- * Constants for available link types.
505
- *
506
- * @public
507
- */
508
- declare const LinkTypes: {
509
- readonly URL: "URL";
510
- readonly Email: "Email";
511
- readonly Phone: "Phone";
512
- };
513
503
  /**
514
504
  * Type of link types that might be received from the platform.
515
505
  *
516
506
  * @public
517
507
  */
518
- type LinkType = (typeof LinkTypes)[keyof typeof LinkTypes];
508
+ type LinkType = "URL" | "Email" | "EMAIL" | "Phone" | "PHONE" | "DRIVING_DIRECTIONS" | "CLICK_TO_WEBSITE" | "OTHER";
519
509
  /**
520
510
  * Type for CTA field
521
511
  * Note that when coming from the platform the label will always be a string
@@ -618,348 +608,566 @@ type LinkProps = CTALinkProps | HREFLinkProps;
618
608
  */
619
609
  declare const Link: React$1.ForwardRefExoticComponent<(Omit<HREFLinkProps, "ref"> | Omit<CTAWithChildrenLinkProps, "ref"> | Omit<CTAWithoutChildrenLinkProps, "ref">) & React$1.RefAttributes<HTMLAnchorElement>>;
620
610
 
611
+ declare enum Unit {
612
+ DEGREE = "deg",
613
+ KILOMETER = "km",
614
+ MILE = "mi",
615
+ RADIAN = "r"
616
+ }
617
+ declare enum Projection {
618
+ MERCATOR = "mercator",
619
+ SPHERICAL = "spherical"
620
+ }
621
+
621
622
  /**
622
623
  * This class represents a point on a sphere defined by latitude and longitude.
623
624
  * Latitude is a degree number in the range [-90, 90].
624
625
  * Longitude is a degree number without limits but is normalized to [-180, 180).
625
626
  */
626
627
  declare class Coordinate$1 {
628
+ _lat: number;
629
+ _lon: number;
627
630
  /**
628
631
  * Constructor takes either 1 or 2 arguments.
629
632
  * 2 arguments: latitude and longitude.
630
- * 1 argument: an object with at least one {@link module:@yext/components-geo~Coordinate~LATITUDE_ALIASES latitude alias}
631
- * and one one {@link module:@yext/components-geo~CoordinateCoordinate~LONGITUDE_ALIASES longitude alias}.
632
- * @param {number|Object} latitudeOrObject
633
- * @param {number} [longitude] Optional only if the first argument is a {@link module:@yext/components-geo~Coordinate Coordinate}-like object
633
+ * 1 argument: an object with at least one {@link LATITUDE_ALIASES | latitude alias}
634
+ * and one one {@link LONGITUDE_ALIASES | longitude alias}.
635
+ * @param longitude - Optional only if the first argument is a {@link Coordinate}-like object
634
636
  */
635
- constructor(latitudeOrObject: number | Object, longitude?: number | undefined);
636
- set latitude(newLat: number);
637
+ constructor(latitudeOrObject: number | object, long?: number);
637
638
  /**
638
639
  * Degrees latitude in the range [-90, 90].
639
640
  * If setting a value outside this range, it will be set to -90 or 90, whichever is closer.
640
- * @type {number}
641
641
  */
642
642
  get latitude(): number;
643
- set longitude(newLon: number);
643
+ set latitude(newLat: number);
644
644
  /**
645
645
  * Degrees longitude in the range [-Infinity, Infinity].
646
- * @type {number}
647
646
  */
648
647
  get longitude(): number;
648
+ set longitude(newLon: number);
649
649
  /**
650
650
  * Degrees longitude in the range [-180, 180).
651
651
  * If the coordinate's longitude is outside this range, the equivalent value within it is used.
652
- * Examples: 123 => 123, 270 => -90, -541 => 179
653
- * @type {number}
652
+ * Examples: 123 =\> 123, 270 =\> -90, -541 =\> 179
654
653
  */
655
654
  get normalLon(): number;
656
- _lat: number | undefined;
657
- _lon: number | undefined;
658
655
  /**
659
656
  * Add distance to the coordinate to change its position.
660
- * @param {number} latDist latitude distance
661
- * @param {number} lonDist longitude distance
662
- * @param {module:@yext/components-geo~Unit} [unit=Unit.DEGREE] The unit of latDist and lonDist
663
- * @param {module:@yext/components-geo~Projection} [projection=Projection.SPHERICAL] The projection of Earth (not relevant when using a physical distance unit, e.g. Mile)
657
+ * @param latDist - latitude distance
658
+ * @param lonDist - longitude distance
659
+ * @param unit - The unit of latDist and lonDist
660
+ * @param projection - The projection of Earth (not relevant when using a physical distance unit, e.g. Mile)
664
661
  */
665
- add(latDist: number, lonDist: number, unit?: any, projection?: any): void;
662
+ add(latDist: number, lonDist: number, unit?: Unit, projection?: Projection): void;
666
663
  /**
667
664
  * Calculate the distance from this coordinate to another coordinate.
668
- * @param {module:@yext/components-geo~Coordinate} coordinate
669
- * @param {module:@yext/components-geo~Unit} [unit=Unit.MILE] The unit of distance
670
- * @param {module:@yext/components-geo~Projection} [projection=Projection.SPHERICAL] The projection of Earth (not relevant when using a physical distance unit, e.g. Mile)
671
- * @returns {number} Distance in the requested unit
665
+ * @param unit - The unit of distance
666
+ * @param projection - The projection of Earth (not relevant when using a physical distance unit, e.g. Mile)
667
+ * @returns Distance in the requested unit
672
668
  */
673
- distanceTo(coordinate: any, unit?: any, projection?: any): number;
669
+ distanceTo(coordinate: Coordinate$1, unit?: Unit, projection?: Projection): number;
674
670
  /**
675
671
  * Test if this coordinate has the same latitude and longitude as another.
676
- * @param {module:@yext/components-geo~Coordinate} coordinate
677
- * @returns {boolean}
678
672
  */
679
- equals(coordinate: any): boolean;
673
+ equals(coordinate: Coordinate$1): boolean;
680
674
  /**
681
675
  * Get the coordinate as a string that can be used in a search query.
682
- * Example: {latitude: -45, longitude: 123} => '-45,123'
683
- * @returns {string}
676
+ * Example: \{latitude: -45, longitude: 123\} =\> '-45,123'
684
677
  */
685
678
  searchQueryString(): string;
686
679
  }
687
680
 
688
681
  /**
689
682
  * This class represents a bounded coordinate region of a sphere.
690
- * The bounds are defined by two {@link module:@yext/components-geo~Coordinate Coordinates}: southwest and northeast.
683
+ * The bounds are defined by two {@link Coordinates}: southwest and northeast.
691
684
  * If the northeast coordinate does not have a greater latitude and longitude than the soutwest
692
685
  * coordinate, the behavior of this object is undefined.
693
686
  */
694
687
  declare class GeoBounds {
688
+ _ne: Coordinate$1;
689
+ _sw: Coordinate$1;
695
690
  /**
696
- * Create a new {@link module:@yext/components-geo~GeoBounds GeoBounds} with minimal area that
691
+ * Create a new {@link GeoBounds} with minimal area that
697
692
  * contains all the given coordinates
698
- * @param {module:@yext/components-geo~Coordinate[]} coordinates
699
- * @returns {module:@yext/components-geo~GeoBounds}
700
693
  */
701
- static fit(coordinates: any): any;
694
+ static fit(coordinates: Coordinate$1[]): GeoBounds;
702
695
  /**
703
- * @param {module:@yext/components-geo~Coordinate} sw Southwest coordinate
704
- * @param {module:@yext/components-geo~Coordinate} ne Northeast coordinate
696
+ * @param sw - Southwest coordinate
697
+ * @param ne - Northeast coordinate
705
698
  */
706
- constructor(sw: any, ne: any);
707
- _ne: Coordinate$1;
708
- _sw: Coordinate$1;
709
- set ne(newNE: any);
699
+ constructor(sw: Coordinate$1, ne: Coordinate$1);
710
700
  /**
711
701
  * Northeast coordinate
712
- * @type {module:@yext/components-geo~Coordinate}
713
702
  */
714
- get ne(): any;
715
- set sw(newSW: any);
703
+ get ne(): Coordinate$1;
704
+ set ne(newNE: Coordinate$1);
716
705
  /**
717
706
  * Southwest coordinate
718
- * @type {module:@yext/components-geo~Coordinate}
719
707
  */
720
- get sw(): any;
708
+ get sw(): Coordinate$1;
709
+ set sw(newSW: Coordinate$1);
721
710
  /**
722
711
  * Whether the coordinate lies within the region defined by the bounds.
723
- * {@link module:@yext/components-geo~Coordinate#normalLon Normalized longitudes} are used for the
712
+ * {@link Normalized | longitudes} are used for the
724
713
  * bounds and the coordinate.
725
- * @param {module:@yext/components-geo~Coordinate} coordinate
726
- * @returns {boolean}
727
714
  */
728
- contains(coordinate: any): boolean;
715
+ contains(coordinate: Coordinate$1): boolean;
729
716
  /**
730
717
  * Extend the bounds if necessary so that the coordinate is contained by them.
731
- * @param {module:@yext/components-geo~Coordinate} coordinate
732
718
  */
733
- extend(coordinate: any): void;
719
+ extend(coordinate: Coordinate$1): void;
734
720
  /**
735
721
  * Calculate the center of the bounds using the given projection.
736
722
  * To find the visual center on a Mercator map, use Projection.MERCATOR.
737
723
  * To find the center for geolocation or geosearch purposes, use Projection.SPHERICAL.
738
- * @param {module:@yext/components-geo~Projection} [projection=Projection.SPHERICAL]
739
- * @returns {module:@yext/components-geo~Coordinate}
740
724
  */
741
- getCenter(projection?: any): any;
725
+ getCenter(projection?: Projection): Coordinate$1;
742
726
  }
743
727
 
744
728
  /**
745
- * An interactive map that supports various map providers, such as Google Maps and Mapbox, with a
746
- * single API. Code written using this class functions approximately the same regardless of the map
747
- * provider used. Any map provider can be supported via an instance of {@link module:@yext/components-maps~MapProvider MapProvider}.
729
+ * {@link ProviderMap} options class
748
730
  */
749
- declare class Map$1 {
731
+ declare class ProviderMapOptions {
750
732
  /**
751
- * The {@link module:@yext/components-maps~MapProvider MapProvider} for the map must be loaded
752
- * before calling this constructor.
753
- * @param {module:@yext/components-maps~MapOptions} options
754
- */
755
- constructor(options: any);
756
- _defaultCenter: any;
757
- _defaultZoom: any;
758
- _legendPins: any;
759
- _provider: any;
760
- _singlePinZoom: any;
761
- _wrapper: any;
762
- _padding: {};
763
- _cachedBounds: GeoBounds | null;
764
- _resolveIdle: () => null;
765
- _resolveMoving: () => null;
766
- _idlePromise: Promise<void>;
767
- _panHandlerRunning: boolean;
768
- _panStartHandlerRunning: boolean;
769
- _map: any;
770
- _currentBounds: any;
733
+ * @param wrapper - The wrapper element that the map will be inserted into
734
+ */
735
+ providerMapClass: typeof ProviderMap;
736
+ wrapper: HTMLElement | null;
737
+ controlEnabled: boolean;
738
+ panHandler: PanHandler;
739
+ panStartHandler: PanStartHandler;
740
+ providerOptions: {
741
+ [key: string]: any;
742
+ };
743
+ constructor(provider: MapProvider, wrapper: HTMLElement | null);
771
744
  /**
772
- * Set the map bounds so that all the given coordinates are within the {@link module:@yext/components-maps~MapOptions#withPadding padded}
773
- * view.
774
- * @param {module:@yext/components-tsx-geo~Coordinate[]} coordinates
775
- * @param {boolean} [animated=false] Whether to transition smoothly to the new bounds
776
- * @param {number} [maxZoom=singlePinZoom] The max zoom level after fitting. Uses {@link module:@yext/components-maps~MapOptions#withSinglePinZoom singlePinZoom}
777
- * by default.
745
+ * @param controlEnabled - Whether the user can interact with the map
778
746
  */
779
- fitCoordinates(coordinates: any, animated?: boolean | undefined, maxZoom?: number | undefined): void;
747
+ withControlEnabled(controlEnabled: boolean): ProviderMapOptions;
780
748
  /**
781
- * Get the current visible region of the map. If the map is zoomed out to show multiple copies of
782
- * the world, the longitude bounds will be outside [-180, 180) but the center will always be
783
- * within [-180, 180).
784
- * @returns {module:@yext/components-tsx-geo~GeoBounds}
749
+ * @param panHandler - Function called after the map bounds change
785
750
  */
786
- getBounds(): any;
751
+ withPanHandler(panHandler: PanHandler): ProviderMapOptions;
787
752
  /**
788
- * @returns {module:@yext/components-tsx-geo~Coordinate} The center of the current visible region of
789
- * the map
753
+ * @param panStartHandler - Function called before the map bounds change
790
754
  */
791
- getCenter(): any;
755
+ withPanStartHandler(panStartHandler: PanStartHandler): ProviderMapOptions;
792
756
  /**
793
- * Intended for internal use only
794
- * @returns {module:@yext/components-maps~ProviderMap} The map's {@link module:@yext/components-maps~ProviderMap ProviderMap}
795
- * instance
757
+ * @param providerOptions - A free-form object used to set any additional provider-specific
758
+ * options, usually by passing the object to the map's constructor
796
759
  */
797
- getProviderMap(): any;
760
+ withProviderOptions(providerOptions: object): ProviderMapOptions;
798
761
  /**
799
- * To standardize zoom for all providers, zoom level is calculated with this formula:
800
- * zoom = log2(pixel width of equator) - 8.
801
- * At zoom = 0, the entire world is 256 pixels wide.
802
- * At zoom = 1, the entire world is 512 pixels wide.
803
- * Zoom 2 → 1024 pixels, zoom 3 → 2056 pixels, etc.
804
- * Negative and non-integer zoom levels are valid and follow the formula.
805
- * @returns {number} The current zoom level of the map
762
+ * @returns An instance of a subclass of {@link ProviderMap}
763
+ * for the given {@link MapProvider}
764
+ */
765
+ build(): ProviderMap;
766
+ }
767
+ /**
768
+ * This class is an interface that should be implemented for each map provider, such as Google Maps.
769
+ * It is used as an API for a {@link Map} to control a
770
+ * provider-specific map instance. Ideally, this class should have minimal functionality so that
771
+ * adding a new provider is easy and behavior is as consistent as possible across all providers.
772
+ */
773
+ declare class ProviderMap {
774
+ /**
775
+ * The constructor creates a map instance using the provider's API and initializes it with all the
776
+ * given options. See {@link ProviderMapOptions}
777
+ * for the supported options.
778
+ */
779
+ _panHandler: PanHandler;
780
+ _panStartHandler: PanStartHandler;
781
+ constructor(options: ProviderMapOptions);
782
+ /**
783
+ * The current center of the map
784
+ */
785
+ getCenter(): Coordinate$1;
786
+ /**
787
+ * Zoom level complies with the specifications in {@link Map#getZoom}
788
+ * @returns The current zoom level of the map
806
789
  */
807
790
  getZoom(): number;
808
791
  /**
809
- * Returns when the map is not moving.
810
- * Use map.idle().then(callback) to run callback immediately if the map is currently idle or once
811
- * the map becomes idle if it's not.
792
+ * @param coordinate - The new center for the map
793
+ * @param animated - Whether to transition smoothly to the new center
812
794
  */
813
- idle(): Promise<void>;
795
+ setCenter(_: Coordinate$1, __: boolean): void;
814
796
  /**
815
- * Returns when the map is moving.
816
- * Use map.moving().then(callback) to run callback immediately if the map is currently moving or
817
- * once the map starts moving if it's not.
797
+ * Zoom level complies with the specifications in {@link Map#getZoom}
798
+ * @param zoom - The new zoom level for the map
799
+ * @param animated - Whether to transition smoothly to the new zoom
818
800
  */
819
- moving(): Promise<void>;
801
+ setZoom(_: number, __: boolean): void;
820
802
  /**
821
- * @returns {module:@yext/components-maps~MapPinOptions} A {@link module:@yext/components-maps~MapPinOptions MapPinOptions}
822
- * instance with the same provider as this map
803
+ * @param center - Must be convertible to {@link Coordinate}
804
+ * @param animated - Whether to transition smoothly to the new bounds
805
+ * @see ProviderMap#setZoom
806
+ * @see ProviderMap#setCenter
823
807
  */
824
- newPinOptions(): any;
808
+ setZoomCenter(zoom: number, center: Coordinate$1, animated: boolean): void;
809
+ }
810
+
811
+ /**
812
+ * {@link ProviderPin} options class
813
+ */
814
+ declare class ProviderPinOptions {
815
+ providerPinClass: typeof ProviderPin;
816
+ clickHandler: PinClickHandler;
817
+ focusHandler: PinFocusHandler;
818
+ hoverHandler: PinHoverHandler;
819
+ icons: {
820
+ [key: string]: string;
821
+ };
822
+ hasPinUrl: boolean;
823
+ constructor(provider: MapProvider);
825
824
  /**
826
- * Called when the map has finished moving, at most once per animation frame.
827
- * Passes the current and previous bounds to the custom pan handler given by {@link module:@yext/components-maps~MapOptions#withPanHandler MapOptions#withPanHandler}
825
+ * @param clickHandler - Function called when the pin is clicked
828
826
  */
829
- panHandler(): void;
827
+ withClickHandler(clickHandler: PinClickHandler): ProviderPinOptions;
830
828
  /**
831
- * Called when the map has started moving, at most once per animation frame.
832
- * Passes the current bounds to the custom pan handler given by {@link module:@yext/components-maps~MapOptions#withPanStartHandler MapOptions#withPanStartHandler}
829
+ * @param focusHandler - Function called when the pin becomes (un)focused
833
830
  */
834
- panStartHandler(): void;
831
+ withFocusHandler(focusHandler: PinFocusHandler): ProviderPinOptions;
835
832
  /**
836
- * @param {Object} bounds
837
- * @param {Object} bounds.ne The northeast corner of the bounds -- must be convertible to {@link module:@yext/components-tsx-geo~Coordinate Coordinate}
838
- * @param {Object} bounds.sw The southwest corner of the bounds -- must be convertible to {@link module:@yext/components-tsx-geo~Coordinate Coordinate}
839
- * @param {boolean} [animated=false] Whether to transition smoothly to the new bounds
840
- * @param {Object} [padding={}]
841
- * @param {number|module:@yext/components-maps~PaddingFunction} padding.bottom Minimum number of
842
- * pixels between the map's bottom edge and a pin
843
- * @param {number|module:@yext/components-maps~PaddingFunction} padding.left Minimum number of
844
- * pixels between the map's left edge and a pin
845
- * @param {number|module:@yext/components-maps~PaddingFunction} padding.right Minimum number of
846
- * pixels between the map's right edge and a pin
847
- * @param {number|module:@yext/components-maps~PaddingFunction} padding.top Minimum number of
848
- * pixels between the map's top edge and a pin
849
- * @param {number} [maxZoom=Infinity]
850
- */
851
- setBounds({ ne, sw }: {
852
- ne: Object;
853
- sw: Object;
854
- }, animated?: boolean | undefined, padding?: Object | undefined, maxZoom?: number | undefined): void;
855
- /**
856
- * @param {Object} coordinate Must be convertible to {@link module:@yext/components-tsx-geo~Coordinate Coordinate}
857
- * @param {boolean} [animated=false] Whether to transition smoothly to the new center
858
- */
859
- setCenter(coordinate: Object, animated?: boolean | undefined): void;
860
- /**
861
- * Padding is used by {@link module:@yext/components-maps~Map#fitCoordinates Map#fitCoordinates}.
862
- * Padding can either be constant values or funtions that return a padding value.
863
- * Constant values are good if the map should always have the same padding on every breakpoint.
864
- * Functions are useful if the map should have different padding at different breakpoints/layouts.
865
- * The function can check window.innerWidth or any other condition before returning a number.
866
- * @param {Object} padding
867
- * @param {number|module:@yext/components-maps~PaddingFunction} padding.bottom Minimum number of
868
- * pixels between the map's bottom edge and a pin
869
- * @param {number|module:@yext/components-maps~PaddingFunction} padding.left Minimum number of
870
- * pixels between the map's left edge and a pin
871
- * @param {number|module:@yext/components-maps~PaddingFunction} padding.right Minimum number of
872
- * pixels between the map's right edge and a pin
873
- * @param {number|module:@yext/components-maps~PaddingFunction} padding.top Minimum number of
874
- * pixels between the map's top edge and a pin
875
- * @returns {module:@yext/components-maps~Map}
833
+ * @param hoverHandler - Function called when the pin becomes (un)hovered
834
+ */
835
+ withHoverHandler(hoverHandler: PinHoverHandler): ProviderPinOptions;
836
+ /**
837
+ * Similar to {@link MapPinOptions#withIcon},
838
+ * but all icons are given as a map of key =\> icon. If a provider pin instance needs an icon to be
839
+ * a specialized class rather than a simple URL, the icons in this object can be converted in this
840
+ * function and assigned back to the icons object instead of being recreated from the URL every
841
+ * time the pin's icon changes.
842
+ * @param icons - Map of a string key to the URL or data URI of an image
843
+ */
844
+ withIcons(icons: {
845
+ [key: string]: string;
846
+ }): ProviderPinOptions;
847
+ /**
848
+ * @param hasPinUrl - Pass through from MapPin class
849
+ * @returns
876
850
  */
877
- setPadding({ bottom, left, right, top, }: Object): any;
851
+ withHasPinUrl(hasPinUrl: boolean): this;
878
852
  /**
879
- * @param {module:@yext/components-maps~Map~panHandler} panHandler
853
+ * @returns An instance of a subclass of {@link ProviderPin}
854
+ * for the given {@link MapProvider}
880
855
  */
881
- setPanHandler(panHandler: any): void;
882
- _panHandler: any;
856
+ build(): ProviderPin;
857
+ }
858
+ /**
859
+ * This class is an interface that should be implemented for each map provider, such as Google Maps.
860
+ * It is used as an API for a {@link MapPin} to control a
861
+ * provider-specific pin instance. Ideally, this class should have minimal functionality so that
862
+ * adding a new provider is easy and behavior is as consistent as possible across all providers.
863
+ */
864
+ declare class ProviderPin {
865
+ _clickHandler: PinClickHandler;
866
+ _focusHandler: PinFocusHandler;
867
+ _hoverHandler: PinHoverHandler;
868
+ _icons: {
869
+ [key: string]: string;
870
+ };
883
871
  /**
884
- * @param {module:@yext/components-maps~Map~panStartHandler} panStartHandler
872
+ * The constructor creates a pin instance using the provider's API and initializes it with all the
873
+ * given options. See {@link ProviderPinOptions}
874
+ * for the supported options.
885
875
  */
886
- setPanStartHandler(panStartHandler: any): void;
887
- _panStartHandler: any;
876
+ constructor(options: ProviderPinOptions);
888
877
  /**
889
- * @param {number} zoom
890
- * @param {boolean} [animated=false] Whether to transition smoothly to the new zoom
891
- * @see module:@yext/components-maps~Map#getZoom
878
+ * @param coordinate - The position of the pin
892
879
  */
893
- setZoom(zoom: number, animated?: boolean | undefined): void;
880
+ setCoordinate(_: Coordinate$1): void;
894
881
  /**
895
- * @param {number} zoom
896
- * @param {Object} center Must be convertible to {@link module:@yext/components-tsx-geo~Coordinate Coordinate}
897
- * @param {boolean} [animated=false] Whether to transition smoothly to the new bounds
898
- * @see module:@yext/components-maps~Map#setZoom
899
- * @see module:@yext/components-maps~Map#setCenter
882
+ * Remove the pin from its current map and, if newMap is not null, add it to the new map.
883
+ * @param newMap - The new map -- if null, the pin will not be
884
+ * shown on any map
885
+ * @param currentMap - The current map -- if null, the pin is
886
+ * not shown on any map
900
887
  */
901
- setZoomCenter(zoom: number, center: Object, animated?: boolean | undefined): void;
888
+ setMap(_: Map$1 | null, __: Map$1 | null): void;
902
889
  /**
903
- * Set the map state to idle
904
- * @protected
890
+ * Apply the given properties to modify the appearance of the pin.
891
+ * @see PinProperties
905
892
  */
906
- protected _setIdle(): void;
907
- _movingPromise: Promise<any> | undefined;
893
+ setProperties(_: PinProperties): void;
894
+ }
895
+
896
+ type ProviderLoadFunction = (resolve: () => void, reject: () => void, apiKey: string, options: object) => void;
897
+ /**
898
+ * {@link MapProvider} options class
899
+ */
900
+ declare class MapProviderOptions {
901
+ loadFunction: ProviderLoadFunction;
902
+ mapClass: typeof ProviderMap;
903
+ pinClass: typeof ProviderPin;
904
+ providerName: string;
905
+ constructor();
906
+ withLoadFunction(loadFunction: ProviderLoadFunction): MapProviderOptions;
908
907
  /**
909
- * Set the map state to moving
910
- * @protected
908
+ * @param mapClass - Subclass of {@link ProviderMap}
909
+ * for the provider
910
+ */
911
+ withMapClass(mapClass: typeof ProviderMap): MapProviderOptions;
912
+ /**
913
+ * @param pinClass - Subclass of {@link ProviderPin} for the provider
914
+ */
915
+ withPinClass(pinClass: typeof ProviderPin): MapProviderOptions;
916
+ /**
917
+ * @param providerName - Name of the map provider
918
+ */
919
+ withProviderName(providerName: string): MapProviderOptions;
920
+ build(): MapProvider;
921
+ }
922
+ /**
923
+ * This class is used for loading the API for a map provider such as Google Maps and creating {@link ProviderMap}
924
+ * and {@link ProviderPin} instances.
925
+ * Provider map implementations return an instance of this class for their provider that you can use
926
+ * to load the API and pass in to {@link MapOptions} and {@link MapPinOptions} objects as the provider.
927
+ * Example using {@link GoogleMaps}, an instance of this
928
+ * class: GoogleMaps.load().then(() =\> map = new MapOptions().withProvider(GoogleMaps).build());
929
+ */
930
+ declare class MapProvider {
931
+ _loadFunction: ProviderLoadFunction;
932
+ _mapClass: typeof ProviderMap;
933
+ _pinClass: typeof ProviderPin;
934
+ _providerName: string;
935
+ _loadPromise: Promise<void>;
936
+ _resolveLoad?: () => void;
937
+ _rejectLoad?: () => void;
938
+ _apiKey: string;
939
+ _loadInvoked: boolean;
940
+ _loaded: boolean;
941
+ _options: any;
942
+ constructor(options: MapProviderOptions);
943
+ /**
944
+ * Returns true if the map provider has been successfully loaded
945
+ */
946
+ get loaded(): boolean;
947
+ /**
948
+ * @see ~MapProviderOptions#withMapClass
949
+ */
950
+ getMapClass(): typeof ProviderMap;
951
+ /**
952
+ * @see MapProviderOptions#withPinClass
953
+ */
954
+ getPinClass(): typeof ProviderPin;
955
+ /**
956
+ * @see MapProviderOptions#withProviderName
957
+ */
958
+ getProviderName(): string;
959
+ /**
960
+ * Call {@link loadFunction}
961
+ * and resolve or reject when loading succeeds or fails
962
+ * @param apiKey - Provider API key -- uses value from {@link MapProvider#setLoadOptions}
963
+ * if not passed
964
+ * @param options - Additional provider-specific options -- uses value from {@link MapProvider#setLoadOptions}
965
+ * if not passed
966
+ */
967
+ load(apiKey?: string, options?: any): Promise<void>;
968
+ /**
969
+ * Resolves or rejects when the map provider has loaded successfully or unsuccessfully
970
+ */
971
+ ready(): Promise<void>;
972
+ /**
973
+ * Set the API key and provider options used on load. Does nothing if load was already called.
974
+ * @param apiKey - Provider API key
975
+ * @param options - Additional provider-specific options
976
+ */
977
+ setLoadOptions(apiKey: string, options?: object | null): void;
978
+ }
979
+
980
+ /**
981
+ * This class is used to set the appearance of a {@link MapPin}.
982
+ * Most properties are supported by all providers, but some are only supported by providers that
983
+ * implement {@link HTMLProviderPin}.
984
+ */
985
+ declare class PinProperties {
986
+ _anchorX: number;
987
+ _anchorY: number;
988
+ _height: number;
989
+ _icon: string;
990
+ _srText: string;
991
+ _width: number;
992
+ _zIndex: number;
993
+ _class: string;
994
+ _element: HTMLElement | null;
995
+ constructor();
996
+ /**
997
+ * @returns The point in the pin that should be positioned over the coordinate, from 0
998
+ * (left edge) to 1 (right edge)
999
+ */
1000
+ getAnchorX(): number;
1001
+ /**
1002
+ * @returns The point in the pin that should be positioned over the coordinate, from 0
1003
+ * (top edge) to 1 (bottom edge)
1004
+ */
1005
+ getAnchorY(): number;
1006
+ /**
1007
+ * {@link HTMLProviderPins} only
1008
+ * @returns The class of the wrapper element for an HTML pin
1009
+ */
1010
+ getClass(): string;
1011
+ /**
1012
+ * {@link HTMLProviderPins} only
1013
+ * @returns The HTML pin element
1014
+ */
1015
+ getElement(): HTMLElement | null;
1016
+ /**
1017
+ * @returns The pixel height of the pin
1018
+ */
1019
+ getHeight(): number;
1020
+ /**
1021
+ * This returns a string key that can be used with {@link MapPin#getIcon}
1022
+ * to get the icon image for a pin.
1023
+ * @returns The unique name of the icon
1024
+ */
1025
+ getIcon(): string;
1026
+ /**
1027
+ * @returns The text that a screen reader reads when focused on the pin
1028
+ */
1029
+ getSRText(): string;
1030
+ /**
1031
+ * @returns The pixel width of the pin
1032
+ */
1033
+ getWidth(): number;
1034
+ /**
1035
+ * @returns The z-index of the pin
1036
+ */
1037
+ getZIndex(): number;
1038
+ /**
1039
+ * @see PinProperties#getAnchorX
1040
+ */
1041
+ setAnchorX(anchorX: number): PinProperties;
1042
+ /**
1043
+ * @see PinProperties#getAnchorY
1044
+ */
1045
+ setAnchorY(anchorY: number): PinProperties;
1046
+ /**
1047
+ * @see PinProperties#getClass
1048
+ */
1049
+ setClass(className: string): PinProperties;
1050
+ /**
1051
+ * @see PinProperties#getElement
1052
+ */
1053
+ setElement(element: HTMLElement): PinProperties;
1054
+ /**
1055
+ * @see PinProperties#getHeight
911
1056
  */
912
- protected _setMoving(): void;
1057
+ setHeight(height: number): PinProperties;
1058
+ /**
1059
+ * @see PinProperties#getIcon
1060
+ */
1061
+ setIcon(icon: string): PinProperties;
1062
+ /**
1063
+ * @see PinProperties#getSRText
1064
+ */
1065
+ setSRText(srText: string): PinProperties;
1066
+ /**
1067
+ * @see PinProperties#getWidth
1068
+ */
1069
+ setWidth(width: number): PinProperties;
1070
+ /**
1071
+ * @see PinProperties#getZIndex
1072
+ */
1073
+ setZIndex(zIndex: number): PinProperties;
913
1074
  }
914
1075
 
1076
+ type PropertiesForStatus = (status: object) => PinProperties;
1077
+ type PinClickHandler = () => void;
1078
+ type PinFocusHandler = (focused: boolean) => void;
1079
+ type PinHoverHandler = (hovered: boolean) => void;
915
1080
  /**
916
- * A pin for a {@link module:@yext/components-maps~Map Map} that displays at a given {@link module:@yext/components-tsx-geo~Coordinate Coordinate}.
1081
+ * {@link MapPin} options class
1082
+ */
1083
+ declare class MapPinOptions {
1084
+ /**
1085
+ * Initialize with default options
1086
+ */
1087
+ coordinate: Coordinate$1;
1088
+ hideOffscreen: boolean;
1089
+ icons: {
1090
+ [key: string]: string;
1091
+ };
1092
+ propertiesForStatus: PropertiesForStatus;
1093
+ provider: MapProvider | null;
1094
+ type: string;
1095
+ hasPinUrl: boolean;
1096
+ constructor();
1097
+ /**
1098
+ * @param coordinate - Must be convertible to {@link Coordinate}
1099
+ */
1100
+ withCoordinate(coordinate: Coordinate$1): MapPinOptions;
1101
+ /**
1102
+ * @param hideOffscreen - If true, the pin will only be rendered if it's in the visible
1103
+ * portion of the map to improve performance
1104
+ */
1105
+ withHideOffscreen(hideOffscreen: boolean): MapPinOptions;
1106
+ /**
1107
+ * @param key - The unique name for the icon, used in {@link PinProperties#getIcon}
1108
+ * and {@link PinProperties#setIcon}
1109
+ * @param icon - The URL or data URI of the icon image
1110
+ */
1111
+ withIcon(key: string, icon: string): MapPinOptions;
1112
+ withPropertiesForStatus(propertiesForStatus: PropertiesForStatus): MapPinOptions;
1113
+ withProvider(provider: MapProvider | null): MapPinOptions;
1114
+ /**
1115
+ * @param hasPinUrl - If true, the pin's HTML element will be a div instead of a button since there is a nested anchor tag within the pin. This will fix current accessibility issues.
1116
+ */
1117
+ withHasPinUrl(hasPinUrl: boolean): MapPinOptions;
1118
+ /**
1119
+ * @param type - A string describing the type of the pin
1120
+ */
1121
+ withType(type: string): MapPinOptions;
1122
+ build(): MapPin;
1123
+ }
1124
+ /**
1125
+ * A pin for a {@link Map} that displays at a given {@link Coordinate}.
917
1126
  * A MapPin can be displayed on at most one Map at a time. Pins support event handlers for clicking,
918
1127
  * hovering, and focusing. The pin can change its appearance based on its current status, which is
919
- * changed by {@link module:@yext/components-maps~MapPin#setStatus setStatus}.
1128
+ * changed by {@link setStatus}.
920
1129
  */
921
1130
  declare class MapPin {
922
- /**
923
- * @param {module:@yext/components-maps~MapPinOptions} options
924
- */
925
- constructor(options: any);
926
- _coordinate: any;
927
- _hideOffscreen: any;
928
- _icons: any;
929
- _propertiesForStatus: any;
930
- _type: any;
931
- _clickHandler: () => null;
932
- _focusHandler: (focused: any) => null;
933
- _hoverHandler: (hovered: any) => null;
1131
+ _coordinate: Coordinate$1;
1132
+ _hideOffscreen: boolean;
1133
+ _icons: {
1134
+ [key: string]: string;
1135
+ };
1136
+ _propertiesForStatus: PropertiesForStatus;
1137
+ _type: string;
1138
+ _clickHandler: PinClickHandler;
1139
+ _focusHandler: PinFocusHandler;
1140
+ _hoverHandler: PinHoverHandler;
934
1141
  _hidden: boolean;
935
- _cancelHiddenUpdater: () => null;
936
- _map: any;
937
- _pin: any;
938
- _status: {};
1142
+ _cancelHiddenUpdater: () => void;
1143
+ _map: Map$1 | null;
1144
+ _pin: ProviderPin;
1145
+ _status: object;
1146
+ constructor(options: MapPinOptions);
939
1147
  /**
940
- * @returns {module:@yext/components-tsx-geo~Coordinate} The coordinate of the pin
1148
+ * @returns The coordinate of the pin
941
1149
  */
942
- getCoordinate(): any;
1150
+ getCoordinate(): Coordinate$1;
943
1151
  /**
944
1152
  * Get the icon for a string key, such as 'default', 'hovered', or 'selected'
945
- * @param {string} key The unique name of the icon
946
- * @returns {string} The URL or data URI of the icon image
947
- * @see module:@yext/components-maps~MapPinOptions#withIcon
1153
+ * @param key - The unique name of the icon
1154
+ * @returns The URL or data URI of the icon image
1155
+ * @see MapPinOptions#withIcon
948
1156
  */
949
1157
  getIcon(key: string): string;
950
1158
  /**
951
- * @returns {module:@yext/components-maps~Map} The map that the pin is currently on, or null if
1159
+ * @returns The map that the pin is currently on, or null if
952
1160
  * not on a map
953
1161
  */
954
- getMap(): any;
1162
+ getMap(): Map$1 | null;
955
1163
  /**
956
1164
  * Intended for internal use only
957
- * @returns {module:@yext/components-maps~ProviderPin} The pin's {@link module:@yext/components-maps~ProviderPin ProviderPin}
1165
+ * @returns The pin's {@link ProviderPin}
958
1166
  * instance
959
1167
  */
960
- getProviderPin(): any;
1168
+ getProviderPin(): ProviderPin;
961
1169
  /**
962
- * @returns {string} The string describing the type of pin
1170
+ * @returns The string describing the type of pin
963
1171
  */
964
1172
  getType(): string;
965
1173
  /**
@@ -968,107 +1176,269 @@ declare class MapPin {
968
1176
  remove(): void;
969
1177
  /**
970
1178
  * Set a handler function for when the pin is clicked, replacing any previously set click handler.
971
- * @param {module:@yext/components-maps~PinClickHandler} clickHandler
972
1179
  */
973
- setClickHandler(clickHandler: any): void;
1180
+ setClickHandler(clickHandler: PinClickHandler): void;
974
1181
  /**
975
- * @param {Object} coordinate Must be convertible to {@link module:@yext/components-tsx-geo~Coordinate Coordinate}
1182
+ * @param coordinate - Must be convertible to {@link Coordinate}
976
1183
  */
977
- setCoordinate(coordinate: Object): void;
1184
+ setCoordinate(coordinate: Coordinate$1): void;
978
1185
  /**
979
1186
  * Set a handler function for when the pin is (un)focused, replacing any previously set focus handler.
980
- * @param {module:@yext/components-maps~PinFocusHandler} focusHandler
981
1187
  */
982
- setFocusHandler(focusHandler: any): void;
1188
+ setFocusHandler(focusHandler: PinFocusHandler): void;
983
1189
  /**
984
1190
  * Set a handler function for when the pin is (un)hovered, replacing any previously set hover handler.
985
- * @param {module:@yext/components-maps~PinHoverHandler} hoverHandler
986
1191
  */
987
- setHoverHandler(hoverHandler: any): void;
1192
+ setHoverHandler(hoverHandler: PinHoverHandler): void;
988
1193
  /**
989
1194
  * Add the pin to a map, removing it from its current map if on one.
990
- * @param {?Map} map
991
1195
  */
992
1196
  setMap(map: Map$1 | null): void;
993
1197
  /**
994
1198
  * Assign all properties in an object to the pin's status.
995
- * Example: if the pin's status is { a: true, b: true }, passing in { a: false, c: true } will
996
- * change the pin's status to { a: false, b: true, c: true }
997
- * @param {Object} status
1199
+ * Example: if the pin's status is \{ a: true, b: true \}, passing in \{ a: false, c: true \} will
1200
+ * change the pin's status to \{ a: false, b: true, c: true \}
998
1201
  */
999
- setStatus(status: Object): void;
1202
+ setStatus(status: object): void;
1000
1203
  /**
1001
1204
  * Add or remove the pin from the map based on whether its coordinate is within the current bounds
1002
- * @protected
1003
1205
  */
1004
- protected _hideIfOffscreen(): void;
1206
+ _hideIfOffscreen(): void;
1005
1207
  }
1006
1208
 
1209
+ type PaddingFunction = () => number;
1210
+ type PanHandler = (previousBounds?: GeoBounds, currentBounds?: GeoBounds) => void;
1211
+ type PanStartHandler = (currentBounds?: GeoBounds) => void;
1212
+ type PaddingObject = {
1213
+ bottom?: number | PaddingFunction;
1214
+ left?: number | PaddingFunction;
1215
+ right?: number | PaddingFunction;
1216
+ top?: number | PaddingFunction;
1217
+ };
1007
1218
  /**
1008
- * This class is used for loading the API for a map provider such as Google Maps and creating {@link module:@yext/components-maps~ProviderMap ProviderMap}
1009
- * and {@link module:@yext/components-maps~ProviderPin ProviderPin} instances.
1010
- * Provider map implementations return an instance of this class for their provider that you can use
1011
- * to load the API and pass in to {@link module:@yext/components-maps~MapOptions MapOptions} and {@link module:@yext/components-maps~MapPinOptions MapPinOptions} objects as the provider.
1012
- * Example using {@link module:@yext/components-maps~GoogleMaps GoogleMaps}, an instance of this
1013
- * class: GoogleMaps.load().then(() => map = new MapOptions().withProvider(GoogleMaps).build());
1219
+ * {@link Map} options class
1014
1220
  */
1015
- declare class MapProvider {
1221
+ declare class MapOptions {
1222
+ controlEnabled: boolean;
1223
+ defaultCenter: Coordinate$1;
1224
+ defaultZoom: number;
1225
+ legendPins: MapPin[];
1226
+ padding: PaddingObject;
1227
+ panHandler: PanHandler;
1228
+ panStartHandler: PanStartHandler;
1229
+ provider: MapProvider | null;
1230
+ providerOptions: ProviderMapOptions | object;
1231
+ singlePinZoom: number;
1232
+ wrapper: HTMLElement | null;
1016
1233
  /**
1017
- * @param {module:@yext/components-maps~MapProviderOptions} options
1234
+ * Initialize with default options
1018
1235
  */
1019
- constructor(options: any);
1020
- _loadFunction: any;
1021
- _mapClass: any;
1022
- _pinClass: any;
1023
- _providerName: any;
1024
- _loadPromise: Promise<any>;
1025
- _resolveLoad: (value: any) => void;
1026
- _rejectLoad: (reason?: any) => void;
1027
- _apiKey: string;
1028
- _loadInvoked: boolean;
1029
- _loaded: boolean;
1030
- _options: {};
1236
+ constructor();
1031
1237
  /**
1032
- * Returns true if the map provider has been successfully loaded
1033
- * @type {boolean}
1238
+ * @param controlEnabled - Whether the user can move and zoom the map
1034
1239
  */
1035
- get loaded(): boolean;
1240
+ withControlEnabled(controlEnabled: boolean): MapOptions;
1036
1241
  /**
1037
- * @returns {module:@yext/components-maps~ProviderMap}
1038
- * @see module:@yext/components-maps~MapProviderOptions#withMapClass
1242
+ * @param defaultCenter - The center on initial load and
1243
+ * when calling {@link Map#fitCoordinates} with an empty array
1039
1244
  */
1040
- getMapClass(): any;
1245
+ withDefaultCenter(defaultCenter: Coordinate$1): MapOptions;
1041
1246
  /**
1042
- * @returns {module:@yext/components-maps~ProviderPin}
1043
- * @see module:@yext/components-maps~MapProviderOptions#withPinClass
1247
+ * @param defaultZoom - The zoom on initial load and when calling {@link Map#fitCoordinates}
1248
+ * with an empty array
1044
1249
  */
1045
- getPinClass(): any;
1250
+ withDefaultZoom(defaultZoom: number): MapOptions;
1046
1251
  /**
1047
- * @returns {string}
1048
- * @see module:@yext/components-maps~MapProviderOptions#withProviderName
1252
+ * GENERATOR TODO Map legend not yet implemented
1253
+ * @param legendPins - Pins used to construct the map legend
1049
1254
  */
1050
- getProviderName(): string;
1255
+ withLegendPins(legendPins: MapPin[]): MapOptions;
1051
1256
  /**
1052
- * Call {@link module:@yext/components-maps~MapPinOptions~loadFunction MapPinOptions~loadFunction}
1053
- * and resolve or reject when loading succeeds or fails
1054
- * @async
1055
- * @param {string} [apiKey] Provider API key -- uses value from {@link module:@yext/components-maps~MapProvider#setLoadOptions MapProvider#setLoadOptions}
1056
- * if not passed
1057
- * @param {Object} [options] Additional provider-specific options -- uses value from {@link module:@yext/components-maps~MapProvider#setLoadOptions MapProvider#setLoadOptions}
1058
- * if not passed
1257
+ * Padding is used by {@link Map#fitCoordinates}.
1258
+ * Padding can either be constant values or funtions that return a padding value.
1259
+ * See {@link Map#setPadding} for more information.
1260
+ * @see {@link Map#setPadding}
1059
1261
  */
1060
- load(apiKey?: string | undefined, options?: Object | undefined): Promise<void>;
1262
+ withPadding(padding: {
1263
+ bottom: number | PaddingFunction;
1264
+ left: number | PaddingFunction;
1265
+ right: number | PaddingFunction;
1266
+ top: number | PaddingFunction;
1267
+ }): MapOptions;
1268
+ withPanHandler(panHandler: PanHandler): MapOptions;
1269
+ withPanStartHandler(panStartHandler: PanStartHandler): MapOptions;
1061
1270
  /**
1062
- * Resolves or rejects when the map provider has loaded successfully or unsuccessfully
1063
- * @async
1271
+ * The {@link MapProvider} must be loaded before
1272
+ * constructing the {@link Map}.
1064
1273
  */
1065
- ready(): Promise<void>;
1274
+ withProvider(provider: MapProvider): MapOptions;
1066
1275
  /**
1067
- * Set the API key and provider options used on load. Does nothing if load was already called.
1068
- * @param {string} apiKey Provider API key
1069
- * @param {?Object} [options=null] Additional provider-specific options
1276
+ * @param providerOptions - A free-form object used to set any additional provider-specific
1277
+ * options in the {@link ProviderMap}
1278
+ */
1279
+ withProviderOptions(providerOptions: object): MapOptions;
1280
+ /**
1281
+ * @param singlePinZoom - The zoom when calling {@link Map#fitCoordinates}
1282
+ * with an array containing one coordinate
1283
+ */
1284
+ withSinglePinZoom(singlePinZoom: number): MapOptions;
1285
+ /**
1286
+ * @param wrapper - The wrapper element that the map will be inserted into. The
1287
+ * existing contents of the element will be removed.
1288
+ */
1289
+ withWrapper(wrapper: HTMLElement | null): MapOptions;
1290
+ build(): Map$1;
1291
+ }
1292
+ /**
1293
+ * An interactive map that supports various map providers, such as Google Maps and Mapbox, with a
1294
+ * single API. Code written using this class functions approximately the same regardless of the map
1295
+ * provider used. Any map provider can be supported via an instance of {@link MapProvider}.
1296
+ */
1297
+ declare class Map$1 {
1298
+ /**
1299
+ * The {@link MapProvider} for the map must be loaded
1300
+ * before calling this constructor.
1301
+ */
1302
+ _defaultCenter: Coordinate$1;
1303
+ _defaultZoom: number;
1304
+ _legendPins: MapPin[];
1305
+ _padding: PaddingObject;
1306
+ _provider: MapProvider | null;
1307
+ _singlePinZoom: number;
1308
+ _wrapper: HTMLElement | null;
1309
+ _cachedBounds: GeoBounds | null;
1310
+ _resolveIdle: () => void;
1311
+ _resolveMoving: () => void;
1312
+ _idlePromise: Promise<void>;
1313
+ _panHandlerRunning: boolean;
1314
+ _panStartHandlerRunning: boolean;
1315
+ _currentBounds: GeoBounds;
1316
+ _movingPromise?: Promise<void>;
1317
+ _panHandler?: PanHandler;
1318
+ _panStartHandler?: PanStartHandler;
1319
+ _map: ProviderMap;
1320
+ constructor(options: MapOptions);
1321
+ /**
1322
+ * Set the map bounds so that all the given coordinates are within the {@link padded}
1323
+ * view.
1324
+ * @param animated - Whether to transition smoothly to the new bounds
1325
+ * @param maxZoom - The max zoom level after fitting. Uses {@link singlePinZoom}
1326
+ * by default.
1327
+ */
1328
+ fitCoordinates(coordinates: Coordinate$1[], animated?: boolean, maxZoom?: number): void;
1329
+ /**
1330
+ * Get the current visible region of the map. If the map is zoomed out to show multiple copies of
1331
+ * the world, the longitude bounds will be outside [-180, 180) but the center will always be
1332
+ * within [-180, 180).
1333
+ */
1334
+ getBounds(): GeoBounds;
1335
+ /**
1336
+ * @returns The center of the current visible region of
1337
+ * the map
1338
+ */
1339
+ getCenter(): Coordinate$1;
1340
+ /**
1341
+ * Intended for internal use only
1342
+ * @returns The map's {@link ProviderMap}
1343
+ * instance
1344
+ */
1345
+ getProviderMap(): ProviderMap;
1346
+ /**
1347
+ * To standardize zoom for all providers, zoom level is calculated with this formula:
1348
+ * zoom = log2(pixel width of equator) - 8.
1349
+ * At zoom = 0, the entire world is 256 pixels wide.
1350
+ * At zoom = 1, the entire world is 512 pixels wide.
1351
+ * Zoom 2 → 1024 pixels, zoom 3 → 2056 pixels, etc.
1352
+ * Negative and non-integer zoom levels are valid and follow the formula.
1353
+ * @returns The current zoom level of the map
1354
+ */
1355
+ getZoom(): number;
1356
+ /**
1357
+ * Returns when the map is not moving.
1358
+ * Use map.idle().then(callback) to run callback immediately if the map is currently idle or once
1359
+ * the map becomes idle if it's not.
1360
+ */
1361
+ idle(): Promise<void>;
1362
+ /**
1363
+ * Returns when the map is moving.
1364
+ * Use map.moving().then(callback) to run callback immediately if the map is currently moving or
1365
+ * once the map starts moving if it's not.
1366
+ */
1367
+ moving(): Promise<void>;
1368
+ /**
1369
+ * @returns A {@link MapPinOptions}
1370
+ * instance with the same provider as this map
1371
+ */
1372
+ newPinOptions(): MapPinOptions;
1373
+ /**
1374
+ * Called when the map has finished moving, at most once per animation frame.
1375
+ * Passes the current and previous bounds to the custom pan handler given by {@link MapOptions#withPanHandler}
1376
+ */
1377
+ panHandler(): void;
1378
+ /**
1379
+ * Called when the map has started moving, at most once per animation frame.
1380
+ * Passes the current bounds to the custom pan handler given by {@link MapOptions#withPanStartHandler}
1381
+ */
1382
+ panStartHandler(): void;
1383
+ /**
1384
+ * @param bounds - bounds.ne: The northeast corner of the bounds -- must be convertible to {@link Coordinate}
1385
+ * bounds.se: The southwest corner of the bounds -- must be convertible to {@link Coordinate}
1386
+ * @param animated - Whether to transition smoothly to the new bounds
1387
+ * @param padding - padding.bottom: Minimum number of pixels between the map's bottom edge and a pin
1388
+ * padding.left: Minimum number of pixels between the map's left edge and a pin
1389
+ * padding.right: Minimum number of pixels between the map's right edge and a pin
1390
+ * padding.top: Minimum number of pixels between the map's top edge and a pin
1391
+ */
1392
+ setBounds({ ne, sw }: GeoBounds, animated?: boolean, padding?: {
1393
+ bottom?: number | PaddingFunction;
1394
+ left?: number | PaddingFunction;
1395
+ right?: number | PaddingFunction;
1396
+ top?: number | PaddingFunction;
1397
+ }, maxZoom?: number): void;
1398
+ /**
1399
+ * @param coordinate - Must be convertible to {@link Coordinate}
1400
+ * @param animated - Whether to transition smoothly to the new center
1401
+ */
1402
+ setCenter(coordinate: object, animated?: boolean): void;
1403
+ /**
1404
+ * Padding is used by {@link Map#fitCoordinates}.
1405
+ * Padding can either be constant values or funtions that return a padding value.
1406
+ * Constant values are good if the map should always have the same padding on every breakpoint.
1407
+ * Functions are useful if the map should have different padding at different breakpoints/layouts.
1408
+ * The function can check window.innerWidth or any other condition before returning a number.
1409
+ * @param padding - padding.bottom: Minimum number of pixels between the map's bottom edge and a pin
1410
+ * padding.left: Minimum number of pixels between the map's left edge and a pin
1411
+ * padding.right: Minimum number of pixels between the map's right edge and a pin
1412
+ * padding.top: Minimum number of pixels between the map's top edge and a pin
1070
1413
  */
1071
- setLoadOptions(apiKey: string, options?: Object | null | undefined): void;
1414
+ setPadding({ bottom, left, right, top, }: {
1415
+ bottom?: number | PaddingFunction;
1416
+ left?: number | PaddingFunction;
1417
+ right?: number | PaddingFunction;
1418
+ top?: number | PaddingFunction;
1419
+ }): Map$1;
1420
+ setPanHandler(panHandler: PanHandler): void;
1421
+ setPanStartHandler(panStartHandler: PanStartHandler): void;
1422
+ /**
1423
+ * @param animated - Whether to transition smoothly to the new zoom
1424
+ * @see Map#getZoom
1425
+ */
1426
+ setZoom(zoom: number, animated?: boolean): void;
1427
+ /**
1428
+ * @param center - Must be convertible to {@link Coordinate}
1429
+ * @param animated - Whether to transition smoothly to the new bounds
1430
+ * @see Map#setZoom
1431
+ * @see Map#setCenter
1432
+ */
1433
+ setZoomCenter(zoom: number, center: Coordinate$1, animated?: boolean): void;
1434
+ /**
1435
+ * Set the map state to idle
1436
+ */
1437
+ _setIdle(): void;
1438
+ /**
1439
+ * Set the map state to moving
1440
+ */
1441
+ _setMoving(): void;
1072
1442
  }
1073
1443
 
1074
1444
  interface Coordinate {
@@ -1089,14 +1459,14 @@ interface MapProps {
1089
1459
  defaultCenter?: Coordinate;
1090
1460
  defaultZoom?: number;
1091
1461
  mapRef?: React__default.MutableRefObject<Map$1 | null>;
1092
- padding?: number | {
1093
- bottom: number | (() => number);
1094
- left: number | (() => number);
1095
- right: number | (() => number);
1096
- top: number | (() => number);
1462
+ padding?: {
1463
+ bottom: number | PaddingFunction;
1464
+ left: number | PaddingFunction;
1465
+ right: number | PaddingFunction;
1466
+ top: number | PaddingFunction;
1097
1467
  };
1098
- panHandler?: (previousBounds: GeoBounds, currentBounds: GeoBounds) => void;
1099
- panStartHandler?: (currentBounds: GeoBounds) => void;
1468
+ panHandler?: PanHandler;
1469
+ panStartHandler?: PanStartHandler;
1100
1470
  provider?: MapProvider;
1101
1471
  providerOptions?: {
1102
1472
  [key: string]: any;
@@ -1534,31 +1904,33 @@ declare const Product: (document: Record<string, any>, schemaType?: string) => {
1534
1904
  type RTF2 = {
1535
1905
  json?: Record<string, any>;
1536
1906
  };
1537
- type FAQ = {
1907
+ type FAQ = PlainTextFAQ | RichTextFAQ;
1908
+ type PlainTextFAQ = {
1538
1909
  question: string;
1539
1910
  answer: string;
1540
- } | {
1911
+ };
1912
+ type RichTextFAQ = {
1541
1913
  question: string;
1542
1914
  answerV2: RTF2;
1543
1915
  };
1544
1916
  declare const FAQPage: (data: FAQ[]) => {
1545
1917
  "@context": string;
1546
1918
  "@type": string;
1547
- mainEntity: {
1919
+ mainEntity: ({
1548
1920
  "@type": string;
1549
1921
  name: string;
1550
1922
  acceptedAnswer: {
1551
1923
  "@type": string;
1552
1924
  text: string;
1553
1925
  };
1554
- }[];
1926
+ } | undefined)[];
1555
1927
  };
1556
1928
 
1557
1929
  type Location = {
1558
1930
  name?: string;
1559
1931
  address?: AddressType;
1560
1932
  };
1561
- declare const AddressSchema: (address?: AddressType) => {
1933
+ declare const AddressSchema: (address?: AddressType) => false | {
1562
1934
  address: {
1563
1935
  "@type": string;
1564
1936
  streetAddress: string;
@@ -1567,8 +1939,8 @@ declare const AddressSchema: (address?: AddressType) => {
1567
1939
  postalCode: string;
1568
1940
  addressCountry: string;
1569
1941
  };
1570
- } | undefined;
1571
- declare const LocationSchema: (location?: Location) => {
1942
+ };
1943
+ declare const LocationSchema: (location?: Location) => false | {
1572
1944
  address?: {
1573
1945
  "@type": string;
1574
1946
  streetAddress: string;
@@ -1579,7 +1951,7 @@ declare const LocationSchema: (location?: Location) => {
1579
1951
  } | undefined;
1580
1952
  "@type": string;
1581
1953
  name: string | undefined;
1582
- } | undefined;
1954
+ };
1583
1955
 
1584
1956
  declare const OpeningHoursSchema: (hours?: HoursType) => {
1585
1957
  openingHours?: undefined;
@@ -1595,7 +1967,7 @@ type Offer = {
1595
1967
  itemCondition?: string;
1596
1968
  availability?: string;
1597
1969
  };
1598
- declare const OfferSchema: (offer?: Offer) => {
1970
+ declare const OfferSchema: (offer?: Offer) => false | {
1599
1971
  offers: {
1600
1972
  "@type": string;
1601
1973
  url: string | undefined;
@@ -1605,25 +1977,25 @@ declare const OfferSchema: (offer?: Offer) => {
1605
1977
  itemCondition: string | undefined;
1606
1978
  availability: string | undefined;
1607
1979
  };
1608
- } | undefined;
1980
+ };
1609
1981
 
1610
1982
  type Organization = {
1611
1983
  name?: string;
1612
1984
  url?: string;
1613
1985
  };
1614
- declare const PerformerSchema: (performers?: string[]) => {
1986
+ declare const PerformerSchema: (performers?: string[]) => false | {
1615
1987
  performer: {
1616
1988
  "@type": string;
1617
1989
  name: string;
1618
1990
  };
1619
- } | undefined;
1620
- declare const OrganizationSchema: (org?: Organization) => {
1991
+ };
1992
+ declare const OrganizationSchema: (org?: Organization) => false | {
1621
1993
  organizer: {
1622
1994
  "@type": string;
1623
1995
  name: string | undefined;
1624
1996
  url: string | undefined;
1625
1997
  };
1626
- } | undefined;
1998
+ };
1627
1999
 
1628
2000
  type PhotoGallery = Photo[];
1629
2001
  type Photo = {
@@ -1634,9 +2006,9 @@ declare const PhotoGallerySchema: (gallery?: PhotoGallery) => {
1634
2006
  } | {
1635
2007
  image: string[];
1636
2008
  };
1637
- declare const PhotoSchema: (photo?: Photo) => {
2009
+ declare const PhotoSchema: (photo?: Photo) => false | {
1638
2010
  image: string;
1639
- } | undefined;
2011
+ };
1640
2012
 
1641
2013
  type Review = {
1642
2014
  ratingValue?: string;
@@ -1647,7 +2019,7 @@ type AggregateRating = {
1647
2019
  ratingValue?: string;
1648
2020
  reviewCount?: string;
1649
2021
  };
1650
- declare const ReviewSchema: (review?: Review) => {
2022
+ declare const ReviewSchema: (review?: Review) => false | {
1651
2023
  review: {
1652
2024
  "@type": string;
1653
2025
  reviewRating: {
@@ -1660,7 +2032,7 @@ declare const ReviewSchema: (review?: Review) => {
1660
2032
  name: string | undefined;
1661
2033
  };
1662
2034
  };
1663
- } | undefined;
2035
+ };
1664
2036
  declare const AggregateRatingSchema: (rating?: AggregateRating) => {
1665
2037
  aggregateRating: {
1666
2038
  "@type": string;
@@ -1669,34 +2041,16 @@ declare const AggregateRatingSchema: (rating?: AggregateRating) => {
1669
2041
  };
1670
2042
  } | undefined;
1671
2043
 
1672
- /**
1673
- * @type {module:@yext/components-maps~MapProvider}
1674
- */
1675
- declare const BaiduMaps: any;
2044
+ declare const BaiduMaps: MapProvider;
1676
2045
 
1677
- /**
1678
- * @type {module:@yext/components-maps~MapProvider}
1679
- */
1680
- declare const BingMaps: any;
2046
+ declare const BingMaps: MapProvider;
1681
2047
 
1682
- /**
1683
- * @type {module:@yext/components-maps~MapProvider}
1684
- */
1685
- declare const GoogleMaps: any;
2048
+ declare const GoogleMaps: MapProvider;
1686
2049
 
1687
- /**
1688
- * @type {module:@yext/components-maps~MapProvider}
1689
- */
1690
- declare const MapboxMaps: any;
2050
+ declare const MapboxMaps: MapProvider;
1691
2051
 
1692
- /**
1693
- * @type {module:@yext/components-maps~MapProvider}
1694
- */
1695
- declare const LeafletMaps: any;
2052
+ declare const LeafletMaps: MapProvider;
1696
2053
 
1697
- /**
1698
- * @type {module:@yext/components-maps~MapProvider}
1699
- */
1700
- declare const MapQuestMaps: any;
2054
+ declare const MapQuestMaps: MapProvider;
1701
2055
 
1702
- export { Address, type AddressLine, type AddressLineProps, type AddressProps, AddressSchema, type AddressType, type AggregateRating, AggregateRatingSchema, Analytics, AnalyticsContext, AnalyticsProvider, AnalyticsScopeProvider, BaiduMaps, BaseSchema, BingMaps, type CTA, type CTAWithChildrenLinkProps, type CTAWithoutChildrenLinkProps, type ClusterTemplateProps, Clusterer, type ClustererContextType, type ClustererProps, type ComplexImageType, type Coordinate, Coordinate$1 as CoordinateClass, Day, type DayOfWeekNames, type DayType, type DirectionCoordinate, Event, FAQPage, type GetDirectionsConfig, GoogleMaps, type HREFLinkProps, type HolidayType, HoursStatus, HoursTable, type HoursTableDayData, type HoursTableProps, type HoursType, Image, type ImageLayout, ImageLayoutOption, type ImageProps, type ImageType, type IntervalType, LeafletMaps, LegacyRichText, LexicalRichText, type LexicalRichTextProps, Link, type LinkProps, type LinkType, LinkTypes, type ListingPublisher, ListingPublisherOption, type ListingType, LocalBusiness, type Location, LocationMap, type LocationMapProps, LocationSchema, Map, type MapContextType, type MapProps, type MapProvider$1 as MapProvider, MapProviderOption, MapQuestMaps, MapboxMaps, Marker, type MarkerProps, type Offer, OfferSchema, OpeningHoursSchema, type Organization, OrganizationSchema, PerformerSchema, type PhotoGallery, PhotoGallerySchema, PhotoSchema, type PinStoreType, Product, type Review, ReviewSchema, SchemaWrapper, type ThumbnailType, type WeekType, debuggingParamDetected, getDirections, useAnalytics, useClusterContext, useIdentify, useMapContext, usePageView, useScope, useTrack };
2056
+ export { Address, type AddressLine, type AddressLineProps, type AddressProps, AddressSchema, type AddressType, type AggregateRating, AggregateRatingSchema, Analytics, AnalyticsContext, AnalyticsProvider, AnalyticsScopeProvider, BaiduMaps, BaseSchema, BingMaps, type CTA, type CTAWithChildrenLinkProps, type CTAWithoutChildrenLinkProps, type ClusterTemplateProps, Clusterer, type ClustererContextType, type ClustererProps, type ComplexImageType, type Coordinate, Coordinate$1 as CoordinateClass, Day, type DayOfWeekNames, type DayType, type DirectionCoordinate, Event, FAQPage, type GetDirectionsConfig, GoogleMaps, type HREFLinkProps, type HolidayType, HoursStatus, HoursTable, type HoursTableDayData, type HoursTableProps, type HoursType, Image, type ImageLayout, ImageLayoutOption, type ImageProps, type ImageType, type IntervalType, LeafletMaps, LegacyRichText, LexicalRichText, type LexicalRichTextProps, Link, type LinkProps, type LinkType, type ListingPublisher, ListingPublisherOption, type ListingType, LocalBusiness, type Location, LocationMap, type LocationMapProps, LocationSchema, Map, type MapContextType, type MapProps, type MapProvider$1 as MapProvider, MapProviderOption, MapQuestMaps, MapboxMaps, Marker, type MarkerProps, type Offer, OfferSchema, OpeningHoursSchema, type Organization, OrganizationSchema, PerformerSchema, type PhotoGallery, PhotoGallerySchema, PhotoSchema, type PinStoreType, Product, type Review, ReviewSchema, SchemaWrapper, type ThumbnailType, type WeekType, debuggingParamDetected, getDirections, useAnalytics, useClusterContext, useIdentify, useMapContext, usePageView, useScope, useTrack };