import * as React$1 from 'react'; import React__default, { ReactNode } from 'react'; import { CTA, Image as Image$1, Coordinate, OpenIntervals, Holiday, Hours as Hours$1, Day as Day$1 } from '@yext/types'; import styleInject from '../node_modules/style-inject/dist/style-inject.es.js'; import { MapProvider, Map as Map$1, MapPinOptions, PinProperties } from '@yext/components-tsx-maps'; import { GeoBounds } from '@yext/components-tsx-geo'; import { DateTime } from 'luxon'; interface LinkConfig extends React__default.DetailedHTMLProps, HTMLAnchorElement>, StandardProps { linkType?: Yext.LinkType; obfuscate?: boolean; } interface HREFLinkProps extends LinkConfig { href: string; cta: never; } interface CTALinkProps extends LinkConfig { href: never; cta: CTA; } declare type LinkProps = CTALinkProps | HREFLinkProps; declare let Link: any | React__default.ForwardRefRenderFunction; interface StandardProps { yaTrack?: string; yaScope?: string; } declare namespace Yext { type LinkType = 'URL' | 'Email' | 'Phone'; interface CTA { link: string; label: string; linkType?: LinkType; } } declare type ConfigPartial = { [Key in keyof Type]?: Type[Key]; }; interface ComponentProps { Link?: ConfigPartial; } interface ConfigurationProviderContextType { components: ComponentProps; } interface ButtonProps extends StandardProps { onClick: () => void; a?: number; b?: number; } declare const Button: React__default.FC; interface ImagePropsShared extends React__default.DetailedHTMLProps, HTMLImageElement>, StandardProps { bpSizes?: [string, string, string]; customSizes?: Array<[string, string]>; } interface ImagePropsWithSrc extends ImagePropsShared { src: string; imageField?: never; } interface ImagePropsWithField extends ImagePropsShared { src?: never; imageField: Image$1; } /** * The 'Image' component is used to render an HTML element * * @example * ``` * * * * ``` * * @param {ImageType} imageField * Yext Image field, used to generate `src` (and `srcSet`, `sizes` if [bpSizes | customSizes] are specified). * @param {[string, string, string]} bpSizes * Size of requested image at breakpoints [sm, md, lg]. Size in pixels should be unitless in the format `[width]x[height]` ex. `400x600` `400x` `x600` * @param {[[string, string]]} customSizes * Expects format `[[bp, size], ['600px', '300x400'], ...]`. Like bpSizes, but you can define the breakpoints yourself. * @param {string} src * HTML attribute. This overrides the generated value from imageField. * @param {string} srcSet * HTML attribute. This overrides the generated value from [bpSizes | customSizes]. * @param {string} sizes * HTML attribute. This overrides the generated value from [bpSizes | customSizes]. * @param {string} alt * HTML attribute. Defaults to empty string * @param {string} loading * HTML attribute. Defaults to 'lazy' * * @returns {Image} */ declare const Image: React__default.ForwardRefExoticComponent<(Pick | Pick) & React__default.RefAttributes>; var css_248z$1 = "@layer components {\n\thtml {\n\t\t--yxt-breadcrumbs-spacing: 1rem;\n\t}\n\t\t.Breadcrumbs-list {\n\t\t\tdisplay: flex;\n\t\t}\n\n\t\t.Breadcrumbs-separator {\n\t\t\tmargin: 0 var(--yxt-breadcrumbs-spacing);\n\t\t}\n}"; styleInject(css_248z$1); interface BreadcrumbsProps extends StandardProps { separator?: ReactNode; className?: string; } interface BreadcrumbsPropsDefault extends BreadcrumbsProps { breadcrumbs: Array<[string, string]>; } declare const Breadcrumbs: (props: BreadcrumbsPropsDefault) => JSX.Element; interface StreamsBreadcrumbs { dm_directoryParents: Array; } interface StreamsBreadcrumb { slug: string; name: string; } interface BreadcrumbsPropsStreams extends BreadcrumbsProps { streamsBreadcrumbs: StreamsBreadcrumbs; } declare const YextBreadcrumbs: (props: BreadcrumbsPropsStreams) => JSX.Element; declare type MapProps = { apiKey?: string; bounds?: Coordinate[]; clientKey?: string; children?: any; controlEnabled?: boolean; defaultCenter?: Coordinate; defaultZoom?: number; padding?: number | { bottom: number | (() => number); left: number | (() => number); right: number | (() => number); top: number | (() => number); }; panHandler?: (previousBounds: GeoBounds, currentBounds: GeoBounds) => void; panStartHandler?: (currentBounds: GeoBounds) => void; provider: MapProvider; providerOptions?: {}; singlePinZoom?: number; }; declare type MapDefaultProps = { controlEnabled: boolean; defaultCenter: Coordinate; defaultZoom: number; padding: number | { bottom: number | (() => number); left: number | (() => number); right: number | (() => number); top: number | (() => number); }; panHandler: (previousBounds: GeoBounds, currentBounds: GeoBounds) => void; panStartHandler: (currentBounds: GeoBounds) => void; providerOptions: {}; singlePinZoom: number; }; declare function useMapContext(): Map$1; declare const Map: { (props: MapProps & MapDefaultProps): JSX.Element; defaultProps: MapDefaultProps; }; declare type MarkerDefaultProps = { markerClickHandler: (id: string) => void; markerHoverHandler: (hovered: boolean, id: string) => void; markerFocusHandler: (focused: boolean, id: string) => void; markerStatusOptions: { [key: string]: boolean; }; }; interface BaseMarkerProps extends MarkerDefaultProps { hideOffscreen?: boolean; id: string; propertiesForStatus?: (status: string) => PinProperties; } /** * ChildMarker: Pass JSX or a component that renders JSX as the child to Marker * - Coordinate is required in order to place on the map * - mapPinOptions is forbidden to avoid overriding rendered child * - zIndex is optional to control multiple markers */ interface ChildMarker extends BaseMarkerProps { children: React.ReactChild; coordinate: Coordinate; mapPinOptions?: never; zIndex?: number; } /** * MapPinOptions Marker: Build Marker from MapPinOptions * - Use MapPinOptions .withCoordinate(), .withHideOffscreen(), .withIcon(), and .withPropertiesForStatus() * - .withProvider() is done automatically from the provider passed to the Map component in the MapContext * - Coordinate is forbidden as it should be passed to .withCoordinate() * - zIndex is forbedden as it should be added in .withPropertiesForStatus() * - children is forbidden as they won't render anything */ interface MapOptionsMarker extends BaseMarkerProps { mapPinOptions: MapPinOptions; coordinate?: never; zIndex?: never; children?: never; } declare type MarkerProps = ChildMarker | MapOptionsMarker; declare const Marker: { ({ children, coordinate, hideOffscreen, id, mapPinOptions, markerClickHandler, markerFocusHandler, markerHoverHandler, markerStatusOptions, propertiesForStatus, zIndex }: MarkerProps): React__default.ReactPortal | null; defaultProps: MarkerDefaultProps; }; declare enum Day { Monday = "MONDAY", Tuesday = "TUESDAY", Wednesday = "WEDNESDAY", Thursday = "THURSDAY", Friday = "FRIDAY", Saturday = "SATURDAY", Sunday = "SUNDAY" } declare function luxonDateToDay(d: DateTime): Day; declare function defaultDayName(d: Day): string; declare class HoursInterval { end: DateTime; start: DateTime; /** * @param {DateTime} date the DateTime for the day on which the interval starts * @param {interval} interval the Yext Streams interval data */ constructor(date: DateTime, interval: OpenIntervals, zone: string); /** * @param {DateTime} date A moment in time * @returns {boolean} True if the given moment is within the interval */ contains(date: DateTime): boolean; /** * @param {Object} opts intl.DateTimeFormatOptions * @param {string} locale defaults to 'en-US' * @returns {string} representation of this interval's start time */ getStartTime(locale?: string, opts?: Intl.DateTimeFormatOptions): string; /** * @param {Object} opts intl.DateTimeFormatOptions * @param {string} locale defaults to 'en-US' * @returns {string} representation of this interval's end time */ getEndTime(locale?: string, opts?: Intl.DateTimeFormatOptions): string; /** * @param {HoursInterval} other * @returns {boolean} if this interval and 'other' have the same start/end */ timeIsEqualTo(other: HoursInterval): boolean; /** * @returns {boolean} if this interval is 24 hours */ is24h(): boolean; } declare class Hours { holidayHoursByDate: Record; hours: Hours$1; timezone: string; /** * @param {Object} hours Hours object in the format returned by Yext Streams */ constructor(hours: Hours$1, timezone: string); /** * @param {DateTime} date A moment in time * @returns {HoursInterval?} The first interval that contains the given moment, null if none */ getInterval(date: DateTime): HoursInterval | null; /** * @returns {HoursInterval?} The first interval that contains the current time, null if none */ getCurrentInterval(): HoursInterval | null; /** * @param {DateTime} date A moment in time * @returns {HoursInterval?} The next interval that hasn't started as of the given moment */ getIntervalAfter(date: DateTime): HoursInterval | null; getIntervalsForNDays(n: number, startDate: DateTime): HoursInterval[]; /** * @param {DateTime} date The day to get the hours for * @returns {Object?} The daily holiday hours object from the original Streams response for the * given date, null if none */ getHolidayHours(date: DateTime): Holiday | null; /** * @param {DateTime} date The day to get the hours for * @returns {Object?} The daily normal hours object from the original Streams response for the * given date, null if none */ getNormalHours(date: DateTime): Day$1 | null; /** * @param {DateTime} date The day to get the hours for * @returns {Object?} The daily hours object from the original Streams response for the given * date, null if none */ getHours(date: DateTime): Day$1 | null; /** * @returns {HoursInterval?} The next interval that hasn't started as of the current time */ getNextInterval(): HoursInterval | null; /** * @param {DateTime} date A day * @returns {Boolean} True if the given day has holiday hours */ isHoliday(date: DateTime): boolean; /** * Yext platform uses the field `hours.reopenDate` to indicate an entity is * temporarily closed for more than one day. * @param {DateTime} date * @returns {Boolean} True if the given date is before 'reopenDate' */ isTemporarilyClosedAt(targetDate: DateTime): boolean; /** * @param {DateTime} date A moment in time * @returns {Boolean} True if the given moment falls within any interval */ isOpenAt(date: DateTime): boolean; /** * @returns {Boolean} True if the current time falls within any interval */ isOpenNow(): boolean; } /** * @param {Array} arr Any array * @param {number} n amount to shift * @returns {Array} a new array shifted 'n' elements to the right, looping from the end back to the start */ declare function arrayShift(arr: Array, n: number): Array; /** * @param {HoursInterval[]} il1 * @param {HoursInterval[]} il2 * @returns {boolean} whether the two intervals lists are equal */ declare function intervalsListsAreEqual(il1: HoursInterval[], il2: HoursInterval[]): boolean; interface StatusParams { isOpen: boolean; currentInterval: HoursInterval | null; futureInterval: HoursInterval | null; timeOptions?: Intl.DateTimeFormatOptions; dayOptions?: Intl.DateTimeFormatOptions; } interface TemplateParams { currentTemplate?: (s: StatusParams) => React__default.ReactNode; separatorTemplate?: (s: StatusParams) => React__default.ReactNode; futureTemplate?: (s: StatusParams) => React__default.ReactNode; timeTemplate?: (s: StatusParams) => React__default.ReactNode; dayOfWeekTemplate?: (s: StatusParams) => React__default.ReactNode; } interface StatusTemplateParams extends StatusParams, TemplateParams { } interface HoursStatusProps extends TemplateParams { hours: Hours$1; timezone: string; timeOptions?: Intl.DateTimeFormatOptions; dayOptions?: Intl.DateTimeFormatOptions; statusTemplate?: (s: StatusParams) => React__default.ReactNode; className?: string; } declare function isOpen24h(params: StatusParams): boolean; declare function isIndefinitelyClosed(params: StatusParams): boolean; declare function defaultCurrentTemplate(params: StatusParams): React__default.ReactNode; declare function defaultSeparatorTemplate(params: StatusParams): React__default.ReactNode; declare function defaultFutureTemplate(params: StatusParams): React__default.ReactNode; declare function defaultTimeTemplate(params: StatusParams): React__default.ReactNode; declare function defaultDayOfWeekTemplate(params: StatusParams): React__default.ReactNode; declare function defaultStatusTemplate(params: StatusTemplateParams, props?: HoursStatusProps): React__default.ReactNode; declare const HoursStatus: React__default.FC; var css_248z = "@layer components {\n html {\n --yxt-hoursTable-col1-width: 128px;\n --yxt-hoursTable-col2-width: 256px;\n }\n \n .HoursTable-row {\n display: flex;\n }\n \n .HoursTable-day {\n flex: 0 0 var(--yxt-hoursTable-col1-width);\n }\n \n .HoursTable-intervals {\n display: flex;\n flex-direction: column;\n flex: 0 0 var(--yxt-hoursTable-col2-width);\n }\n}\n"; styleInject(css_248z); interface DayOfWeekNames { Sunday?: string; Monday?: string; Tuesday?: string; Wednesday?: string; Thursday?: string; Friday?: string; Saturday?: string; } interface HoursTableProps { hours: Hours$1; dayOfWeekNames?: DayOfWeekNames; startOfWeek?: 'Today' | 'Sunday' | 'Monday' | 'Tuesday' | 'Wednesday' | 'Thursday' | 'Friday' | 'Saturday'; timeOptions?: Intl.DateTimeFormatOptions; collapseDays?: boolean; intervalStringsBuilderFn?: (h: HoursTableDayData, t?: Intl.DateTimeFormatOptions) => string[]; className?: string; } interface HoursTableDayData { dayName: string; intervals: HoursInterval[]; isToday: boolean; startDay: Day; endDay: Day; sortIdx: number; } /** * * @param {HoursTableDayData[]} hoursDays * @returns {HoursTableDayData[]} where adjacent days with the same intervals are combined */ declare function collapseDays(hoursDays: HoursTableDayData[], dayNames?: DayOfWeekNames): HoursTableDayData[]; declare function intervalsToHoursDays(intervals: HoursInterval[], now: DateTime, dayOfWeekNames?: DayOfWeekNames): HoursTableDayData[]; declare const HoursTable: React__default.FC; declare type LocationMapDefaultProps = { controlEnabled: boolean; markerClickHandler: (id: string) => void; markerHoverHandler: (hovered: boolean, id: string) => void; markerFocusHandler: (focused: boolean, id: string) => void; }; interface LocationMapProps extends MapProps { children: React.ReactChild; coordinate: Coordinate; linkSameTab?: boolean; pinUrl?: string; } declare const LocationMap: { (props: LocationMapProps & LocationMapDefaultProps): JSX.Element; defaultProps: LocationMapDefaultProps; }; declare type AddressPart = "line1" | "line2" | "line3" | "postalCode" | "city" | "regionCode" | "region" | "country" | "countryCode" | "extraDescription" | "sublocality"; interface AddressProps extends StandardProps { address: Address; linkToGetDirections?: string; lines?: Array>; } declare const Address: (props: AddressProps) => JSX.Element; declare enum Provider { Google = "GOOGLE", Apple = "APPLE", Bing = "BING" } /** * Get a third-party maps url for a Yext location * * @param {any} profile - Partial of Yext Location entity profile * @param {Provider} provider - Google, Apple, Bing * @param {boolean} directions - Enable driving directions * * @returns {string} - Maps service url */ declare const getDirections: (profile: any, provider?: Provider, directions?: boolean) => string | undefined; declare function useGlobal(): ConfigurationProviderContextType; declare const ConfigurationProvider: React$1.Provider; export { Address, YextBreadcrumbs as Breadcrumbs, Button, ComponentProps, ConfigurationProvider, ConfigurationProviderContextType, Breadcrumbs as CustomBreadcrumbs, Day, DayOfWeekNames, Hours, HoursInterval, HoursStatus, HoursStatusProps, HoursTable, HoursTableDayData, HoursTableProps, Image, Link, LocationMap, Map, Marker, StandardProps, StatusParams, StatusTemplateParams, TemplateParams, Yext, arrayShift, collapseDays, defaultCurrentTemplate, defaultDayName, defaultDayOfWeekTemplate, defaultFutureTemplate, defaultSeparatorTemplate, defaultStatusTemplate, defaultTimeTemplate, getDirections, intervalsListsAreEqual, intervalsToHoursDays, isIndefinitelyClosed, isOpen24h, luxonDateToDay, useGlobal, useMapContext };