@yext/pages-components 1.1.7 → 1.1.9

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.cts CHANGED
@@ -144,7 +144,7 @@ interface TemplateProps<T = Record<string, any>> {
144
144
 
145
145
  type TrackProps = {
146
146
  action: Action;
147
- destinationUrl: string;
147
+ destinationUrl?: string;
148
148
  scope?: string;
149
149
  eventName: string;
150
150
  amount?: number;
@@ -1557,6 +1557,41 @@ declare const LegacyRichText: (props: {
1557
1557
  markdown: string;
1558
1558
  }) => ReactElement<any, string | React$1.JSXElementConstructor<any>> | null;
1559
1559
 
1560
+ declare class HoursInterval {
1561
+ end: DateTime;
1562
+ start: DateTime;
1563
+ /**
1564
+ * @param date - DateTime the DateTime for the day on which the interval starts
1565
+ * @param interval - the Yext Streams interval data
1566
+ */
1567
+ constructor(date: DateTime, interval: IntervalType, zone: string);
1568
+ /**
1569
+ * @param date - A moment in time
1570
+ * @returns boolean - True if the given moment is within the interval
1571
+ */
1572
+ contains(date: DateTime): boolean;
1573
+ /**
1574
+ * @param opts - intl.DateTimeFormatOptions
1575
+ * @param locale - defaults to 'en-US'
1576
+ * @returns string - representation of this interval's start time
1577
+ */
1578
+ getStartTime(locale?: string, opts?: Intl.DateTimeFormatOptions): string;
1579
+ /**
1580
+ * @param opts - intl.DateTimeFormatOptions
1581
+ * @param locale - defaults to 'en-US'
1582
+ * @returns string representation of this interval's end time
1583
+ */
1584
+ getEndTime(locale?: string, opts?: Intl.DateTimeFormatOptions): string;
1585
+ /**
1586
+ * @returns boolean if this interval and 'other' have the same start/end
1587
+ */
1588
+ timeIsEqualTo(other: HoursInterval): boolean;
1589
+ /**
1590
+ * @returns boolean if this interval is 24 hours
1591
+ */
1592
+ is24h(): boolean;
1593
+ }
1594
+
1560
1595
  interface WeekType {
1561
1596
  monday?: DayType;
1562
1597
  tuesday?: DayType;
@@ -1567,8 +1602,8 @@ interface WeekType {
1567
1602
  sunday?: DayType;
1568
1603
  }
1569
1604
  interface DayType {
1570
- isClosed: boolean;
1571
- openIntervals: IntervalType[];
1605
+ isClosed?: boolean;
1606
+ openIntervals?: IntervalType[];
1572
1607
  }
1573
1608
  interface HolidayType extends DayType {
1574
1609
  date: string;
@@ -1597,8 +1632,20 @@ interface HoursTableProps {
1597
1632
  collapseDays?: boolean;
1598
1633
  /** Override rendering for the interval on each table row */
1599
1634
  intervalStringsBuilderFn?: (h: HoursTableDayData, t?: Intl.DateTimeFormatOptions) => string[];
1635
+ /** Override values for hardcoded strings */
1636
+ intervalTranslations?: HoursTableIntervalTranslations;
1600
1637
  className?: string;
1601
1638
  }
1639
+ interface HoursTableIntervalTranslations {
1640
+ /** Displayed when an interval is marked as closed */
1641
+ isClosed?: string;
1642
+ /** Displayed when an interval is marked as open 24 hours */
1643
+ open24Hours?: string;
1644
+ /** Displayed when there is a reopen date set */
1645
+ reopenDate?: string;
1646
+ /** Sets the locale for time interval formatting */
1647
+ timeFormatLocale?: string;
1648
+ }
1602
1649
  interface HoursTableDayData {
1603
1650
  dayName: string;
1604
1651
  intervals: HoursInterval[];
@@ -1615,64 +1662,46 @@ declare enum Day {
1615
1662
  Saturday = "SATURDAY",
1616
1663
  Sunday = "SUNDAY"
1617
1664
  }
1618
-
1619
- declare class HoursInterval {
1620
- end: DateTime;
1621
- start: DateTime;
1622
- /**
1623
- * @param date - DateTime the DateTime for the day on which the interval starts
1624
- * @param interval - the Yext Streams interval data
1625
- */
1626
- constructor(date: DateTime, interval: IntervalType, zone: string);
1627
- /**
1628
- * @param date - A moment in time
1629
- * @returns boolean - True if the given moment is within the interval
1630
- */
1631
- contains(date: DateTime): boolean;
1632
- /**
1633
- * @param opts - intl.DateTimeFormatOptions
1634
- * @param locale - defaults to 'en-US'
1635
- * @returns string - representation of this interval's start time
1636
- */
1637
- getStartTime(locale?: string, opts?: Intl.DateTimeFormatOptions): string;
1638
- /**
1639
- * @param opts - intl.DateTimeFormatOptions
1640
- * @param locale - defaults to 'en-US'
1641
- * @returns string representation of this interval's end time
1642
- */
1643
- getEndTime(locale?: string, opts?: Intl.DateTimeFormatOptions): string;
1644
- /**
1645
- * @returns boolean if this interval and 'other' have the same start/end
1646
- */
1647
- timeIsEqualTo(other: HoursInterval): boolean;
1648
- /**
1649
- * @returns boolean if this interval is 24 hours
1650
- */
1651
- is24h(): boolean;
1652
- }
1653
-
1654
1665
  interface StatusParams {
1666
+ /** Whether the entity is currently open */
1655
1667
  isOpen: boolean;
1668
+ /** The first interval that contains the current time */
1656
1669
  currentInterval: HoursInterval | null;
1670
+ /** The next interval that hasn't started */
1657
1671
  futureInterval: HoursInterval | null;
1672
+ /** Formatting intended for the "time" part of this component "Open Now - closes at [[5:00PM]] Monday" */
1658
1673
  timeOptions?: Intl.DateTimeFormatOptions;
1674
+ /** Formatting intended for the "day" part of this component "Open Now - closes at 5:00PM [[Monday]]" */
1659
1675
  dayOptions?: Intl.DateTimeFormatOptions;
1660
1676
  }
1661
1677
  interface TemplateParams {
1662
- currentTemplate?: (s: StatusParams) => React__default.ReactNode;
1663
- separatorTemplate?: (s: StatusParams) => React__default.ReactNode;
1664
- futureTemplate?: (s: StatusParams) => React__default.ReactNode;
1665
- timeTemplate?: (s: StatusParams) => React__default.ReactNode;
1666
- dayOfWeekTemplate?: (s: StatusParams) => React__default.ReactNode;
1678
+ /** Override rendering for the "current" part of this component "[[Open Now]] - closes at 5:00PM Monday" */
1679
+ currentTemplate?: (s: StatusParams) => React.ReactNode;
1680
+ /** Override rendering for the "separator" part of this component "Open Now [[-]] closes at 5:00PM Monday" */
1681
+ separatorTemplate?: (s: StatusParams) => React.ReactNode;
1682
+ /** FutureTemplate override rendering for the "future" part of this component "Open Now - [[closes at]] 5:00PM Monday" */
1683
+ futureTemplate?: (s: StatusParams) => React.ReactNode;
1684
+ /** Override rendering for the "time" part of this component "Open Now - closes at [[5:00PM]] Monday" */
1685
+ timeTemplate?: (s: StatusParams) => React.ReactNode;
1686
+ /** Override rendering for the "dayOfWeek" part of this component "Open Now - closes at 5:00PM [[Monday]]" */
1687
+ dayOfWeekTemplate?: (s: StatusParams) => React.ReactNode;
1688
+ }
1689
+ interface StatusTemplateParams extends StatusParams, TemplateParams {
1667
1690
  }
1668
1691
  interface HoursStatusProps extends TemplateParams {
1692
+ /** Hours data from Yext Streams */
1669
1693
  hours: HoursType;
1694
+ /** The IANA or UTC Offset timezone of the hours data from Yext Streams */
1670
1695
  timezone: string;
1696
+ /** Formatting for the "time" part of this component "Open Now - closes at [[5:00PM]] Monday" */
1671
1697
  timeOptions?: Intl.DateTimeFormatOptions;
1698
+ /** Formatting for the "day" part of this component "Open Now - closes at 5:00PM [[Monday]]" */
1672
1699
  dayOptions?: Intl.DateTimeFormatOptions;
1673
- statusTemplate?: (s: StatusParams) => React__default.ReactNode;
1700
+ /** Completely override rendering for this component */
1701
+ statusTemplate?: (s: StatusParams) => React.ReactNode;
1674
1702
  className?: string;
1675
1703
  }
1704
+
1676
1705
  declare const HoursStatus: React__default.FC<HoursStatusProps>;
1677
1706
 
1678
1707
  declare const HoursTable: React__default.FC<HoursTableProps>;
@@ -1682,82 +1711,10 @@ declare const SchemaWrapper: (json: any) => string;
1682
1711
  declare const BaseSchema: (document: Record<string, any>, schemaType: string) => {
1683
1712
  "@context": string;
1684
1713
  "@type": string;
1685
- name: any;
1686
- };
1714
+ name: string;
1715
+ } | undefined;
1687
1716
 
1688
- declare const Event: (document: Record<string, any>, schemaType?: string) => {
1689
- offers?: {
1690
- "@type": string;
1691
- url: string | undefined;
1692
- priceCurrency: string | undefined;
1693
- price: string | undefined;
1694
- priceValidUntil: string | undefined;
1695
- itemCondition: string | undefined;
1696
- availability: string | undefined;
1697
- } | undefined;
1698
- organizer?: {
1699
- "@type": string;
1700
- name: string | undefined;
1701
- url: string | undefined;
1702
- } | undefined;
1703
- performer?: {
1704
- "@type": string;
1705
- name: string;
1706
- } | undefined;
1707
- startDate: any;
1708
- endDate: any;
1709
- description: any;
1710
- eventAttendanceMode: any;
1711
- eventStatus: any;
1712
- address?: {
1713
- "@type": string;
1714
- streetAddress: string;
1715
- addressLocality: string;
1716
- addressRegion: string | undefined;
1717
- postalCode: string;
1718
- addressCountry: string;
1719
- } | undefined;
1720
- "@type": string;
1721
- name: any;
1722
- image?: undefined;
1723
- "@context": string;
1724
- } | {
1725
- offers?: {
1726
- "@type": string;
1727
- url: string | undefined;
1728
- priceCurrency: string | undefined;
1729
- price: string | undefined;
1730
- priceValidUntil: string | undefined;
1731
- itemCondition: string | undefined;
1732
- availability: string | undefined;
1733
- } | undefined;
1734
- organizer?: {
1735
- "@type": string;
1736
- name: string | undefined;
1737
- url: string | undefined;
1738
- } | undefined;
1739
- performer?: {
1740
- "@type": string;
1741
- name: string;
1742
- } | undefined;
1743
- startDate: any;
1744
- endDate: any;
1745
- description: any;
1746
- eventAttendanceMode: any;
1747
- eventStatus: any;
1748
- address?: {
1749
- "@type": string;
1750
- streetAddress: string;
1751
- addressLocality: string;
1752
- addressRegion: string | undefined;
1753
- postalCode: string;
1754
- addressCountry: string;
1755
- } | undefined;
1756
- "@type": string;
1757
- name: any;
1758
- image: string[];
1759
- "@context": string;
1760
- };
1717
+ declare const Event: (document: Record<string, any>, schemaType?: string) => any;
1761
1718
 
1762
1719
  declare const LocalBusiness: (document: Record<string, any>, schemaType?: string) => {
1763
1720
  description: any;
@@ -1773,9 +1730,9 @@ declare const LocalBusiness: (document: Record<string, any>, schemaType?: string
1773
1730
  postalCode: string;
1774
1731
  addressCountry: string;
1775
1732
  } | undefined;
1776
- "@context": string;
1777
- "@type": string;
1778
- name: any;
1733
+ "@context"?: string | undefined;
1734
+ "@type"?: string | undefined;
1735
+ name?: string | undefined;
1779
1736
  } | {
1780
1737
  description: any;
1781
1738
  telephone: any;
@@ -1790,9 +1747,9 @@ declare const LocalBusiness: (document: Record<string, any>, schemaType?: string
1790
1747
  postalCode: string;
1791
1748
  addressCountry: string;
1792
1749
  } | undefined;
1793
- "@context": string;
1794
- "@type": string;
1795
- name: any;
1750
+ "@context"?: string | undefined;
1751
+ "@type"?: string | undefined;
1752
+ name?: string | undefined;
1796
1753
  } | {
1797
1754
  description: any;
1798
1755
  telephone: any;
@@ -1807,9 +1764,9 @@ declare const LocalBusiness: (document: Record<string, any>, schemaType?: string
1807
1764
  postalCode: string;
1808
1765
  addressCountry: string;
1809
1766
  } | undefined;
1810
- "@context": string;
1811
- "@type": string;
1812
- name: any;
1767
+ "@context"?: string | undefined;
1768
+ "@type"?: string | undefined;
1769
+ name?: string | undefined;
1813
1770
  } | {
1814
1771
  description: any;
1815
1772
  telephone: any;
@@ -1824,88 +1781,12 @@ declare const LocalBusiness: (document: Record<string, any>, schemaType?: string
1824
1781
  postalCode: string;
1825
1782
  addressCountry: string;
1826
1783
  } | undefined;
1827
- "@context": string;
1828
- "@type": string;
1829
- name: any;
1784
+ "@context"?: string | undefined;
1785
+ "@type"?: string | undefined;
1786
+ name?: string | undefined;
1830
1787
  };
1831
1788
 
1832
- declare const Product: (document: Record<string, any>, schemaType?: string) => {
1833
- description: any;
1834
- sku: any;
1835
- mpn: any;
1836
- brand: {
1837
- "@type": string;
1838
- name: any;
1839
- };
1840
- offers?: {
1841
- "@type": string;
1842
- url: string | undefined;
1843
- priceCurrency: string | undefined;
1844
- price: string | undefined;
1845
- priceValidUntil: string | undefined;
1846
- itemCondition: string | undefined;
1847
- availability: string | undefined;
1848
- } | undefined;
1849
- aggregateRating?: {
1850
- "@type": string;
1851
- ratingValue: string | undefined;
1852
- reviewCount: string | undefined;
1853
- } | undefined;
1854
- review?: {
1855
- "@type": string;
1856
- reviewRating: {
1857
- "@type": string;
1858
- ratingValue: string | undefined;
1859
- bestRating: string | undefined;
1860
- };
1861
- author: {
1862
- "@type": string;
1863
- name: string | undefined;
1864
- };
1865
- } | undefined;
1866
- image?: undefined;
1867
- "@context": string;
1868
- "@type": string;
1869
- name: any;
1870
- } | {
1871
- description: any;
1872
- sku: any;
1873
- mpn: any;
1874
- brand: {
1875
- "@type": string;
1876
- name: any;
1877
- };
1878
- offers?: {
1879
- "@type": string;
1880
- url: string | undefined;
1881
- priceCurrency: string | undefined;
1882
- price: string | undefined;
1883
- priceValidUntil: string | undefined;
1884
- itemCondition: string | undefined;
1885
- availability: string | undefined;
1886
- } | undefined;
1887
- aggregateRating?: {
1888
- "@type": string;
1889
- ratingValue: string | undefined;
1890
- reviewCount: string | undefined;
1891
- } | undefined;
1892
- review?: {
1893
- "@type": string;
1894
- reviewRating: {
1895
- "@type": string;
1896
- ratingValue: string | undefined;
1897
- bestRating: string | undefined;
1898
- };
1899
- author: {
1900
- "@type": string;
1901
- name: string | undefined;
1902
- };
1903
- } | undefined;
1904
- image: string[];
1905
- "@context": string;
1906
- "@type": string;
1907
- name: any;
1908
- };
1789
+ declare const Product: (document: Record<string, any>, schemaType?: string) => any;
1909
1790
 
1910
1791
  type RTF2 = {
1911
1792
  json?: Record<string, any>;
@@ -1919,6 +1800,7 @@ type RichTextFAQ = {
1919
1800
  question: string;
1920
1801
  answerV2: RTF2;
1921
1802
  };
1803
+ declare function getRichTextContent(answer: RTF2): string;
1922
1804
  declare const FAQPage: (data: FAQ[]) => {
1923
1805
  "@context": string;
1924
1806
  "@type": string;
@@ -1930,7 +1812,7 @@ declare const FAQPage: (data: FAQ[]) => {
1930
1812
  text: string;
1931
1813
  };
1932
1814
  } | undefined)[];
1933
- };
1815
+ } | undefined;
1934
1816
 
1935
1817
  type Location = {
1936
1818
  name?: string;
@@ -1971,8 +1853,9 @@ type Offer = {
1971
1853
  price?: string;
1972
1854
  priceValidUntil?: string;
1973
1855
  itemCondition?: string;
1974
- availability?: string;
1856
+ availability?: (typeof availabilityOptions)[number];
1975
1857
  };
1858
+ declare const availabilityOptions: string[];
1976
1859
  declare const OfferSchema: (offer?: Offer) => false | {
1977
1860
  offers: {
1978
1861
  "@type": string;
@@ -1997,9 +1880,9 @@ declare const PerformerSchema: (performers?: string[]) => false | {
1997
1880
  };
1998
1881
  declare const OrganizationSchema: (org?: Organization) => false | {
1999
1882
  organizer: {
1883
+ url?: string | undefined;
2000
1884
  "@type": string;
2001
1885
  name: string | undefined;
2002
- url: string | undefined;
2003
1886
  };
2004
1887
  };
2005
1888
 
@@ -2027,16 +1910,16 @@ type AggregateRating = {
2027
1910
  };
2028
1911
  declare const ReviewSchema: (review?: Review) => false | {
2029
1912
  review: {
1913
+ author?: {
1914
+ "@type": string;
1915
+ name: string;
1916
+ } | undefined;
2030
1917
  "@type": string;
2031
1918
  reviewRating: {
2032
1919
  "@type": string;
2033
1920
  ratingValue: string | undefined;
2034
1921
  bestRating: string | undefined;
2035
1922
  };
2036
- author: {
2037
- "@type": string;
2038
- name: string | undefined;
2039
- };
2040
1923
  };
2041
1924
  };
2042
1925
  declare const AggregateRatingSchema: (rating?: AggregateRating) => {
@@ -2059,4 +1942,4 @@ declare const LeafletMaps: MapProvider;
2059
1942
 
2060
1943
  declare const MapQuestMaps: MapProvider;
2061
1944
 
2062
- 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 };
1945
+ 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, type HoursStatusProps, HoursTable, type HoursTableDayData, type HoursTableIntervalTranslations, 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 StatusParams, type StatusTemplateParams, type TemplateParams, type ThumbnailType, type WeekType, debuggingParamDetected, getDirections, getRichTextContent, useAnalytics, useClusterContext, useIdentify, useMapContext, usePageView, useScope, useTrack };