@yext/pages-components 1.0.0-rc.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/LICENSE +32 -0
- package/THIRD-PARTY-NOTICES +396 -0
- package/dist/index--cy1NwMF.js +5960 -0
- package/dist/index-QH0gPEMu.cjs +47 -0
- package/dist/index-QPKDAq--.cjs +103 -0
- package/dist/index-i0mhhNq7.js +28418 -0
- package/dist/index.d.cts +1389 -0
- package/dist/index.d.ts +1389 -0
- package/dist/pages-components.cjs +1 -0
- package/dist/pages-components.js +38 -0
- package/dist/style.css +1 -0
- package/package.json +117 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1389 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React$1 from 'react';
|
|
3
|
+
import React__default, { MouseEvent, PropsWithChildren, ReactElement } from 'react';
|
|
4
|
+
import { ConversionDetails, Visitor } from '@yext/analytics';
|
|
5
|
+
import { EditorThemeClasses } from 'lexical';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The type definition for an address.
|
|
9
|
+
*
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
interface AddressType {
|
|
13
|
+
line1: string;
|
|
14
|
+
line2?: string;
|
|
15
|
+
line3?: string;
|
|
16
|
+
city: string;
|
|
17
|
+
region?: string;
|
|
18
|
+
postalCode: string;
|
|
19
|
+
countryCode: string;
|
|
20
|
+
sublocality?: string;
|
|
21
|
+
extraDescription?: string;
|
|
22
|
+
localizedRegionName?: string;
|
|
23
|
+
localizedCountryName?: string;
|
|
24
|
+
}
|
|
25
|
+
type AddressLine = (keyof AddressType | ",")[];
|
|
26
|
+
/**
|
|
27
|
+
* The shape of the data passed to {@link Address}.
|
|
28
|
+
*
|
|
29
|
+
* @public
|
|
30
|
+
*/
|
|
31
|
+
interface AddressProps extends React.HTMLProps<HTMLDivElement> {
|
|
32
|
+
address: AddressType;
|
|
33
|
+
lines?: AddressLine[];
|
|
34
|
+
separator?: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The shape of the data passed to {@link AddressLine}.
|
|
38
|
+
*
|
|
39
|
+
* @public
|
|
40
|
+
*/
|
|
41
|
+
type AddressLineProps = {
|
|
42
|
+
address: AddressType;
|
|
43
|
+
line: AddressLine;
|
|
44
|
+
separator?: string;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* The available listing publishers
|
|
48
|
+
*
|
|
49
|
+
* @public
|
|
50
|
+
*/
|
|
51
|
+
declare const ListingPublisherOption: {
|
|
52
|
+
readonly GOOGLEMYBUSINESS: "GOOGLEMYBUSINESS";
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* The type definition for the listing publisher
|
|
56
|
+
*
|
|
57
|
+
* @public
|
|
58
|
+
*/
|
|
59
|
+
type ListingPublisher = (typeof ListingPublisherOption)[keyof typeof ListingPublisherOption];
|
|
60
|
+
/**
|
|
61
|
+
* The type definition for a Listing
|
|
62
|
+
*
|
|
63
|
+
* @public
|
|
64
|
+
*/
|
|
65
|
+
interface ListingType {
|
|
66
|
+
listingUrl: string;
|
|
67
|
+
publisher?: ListingPublisher;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* The available map providers
|
|
71
|
+
*
|
|
72
|
+
* @public
|
|
73
|
+
*/
|
|
74
|
+
declare const MapProviderOption: {
|
|
75
|
+
readonly GOOGLE: "google";
|
|
76
|
+
readonly APPLE: "apple";
|
|
77
|
+
readonly BING: "bing";
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* The type definition for the map provider
|
|
81
|
+
*
|
|
82
|
+
* @public
|
|
83
|
+
*/
|
|
84
|
+
type MapProvider$1 = (typeof MapProviderOption)[keyof typeof MapProviderOption];
|
|
85
|
+
/**
|
|
86
|
+
* The Yext profile fields used to create a getDirections URL
|
|
87
|
+
*/
|
|
88
|
+
interface GetDirectionsConfig {
|
|
89
|
+
provider?: MapProvider$1;
|
|
90
|
+
route?: boolean;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Renders an HTML address based from the Yext Knowledge Graph. Example of using the component to render
|
|
95
|
+
* a location entity's address from Yext Knowledge Graph:
|
|
96
|
+
* ```
|
|
97
|
+
* import { Address } from "@yext/pages/components";
|
|
98
|
+
*
|
|
99
|
+
* const address = (<Address address={document.address} />);
|
|
100
|
+
* --> 1101 Wilson Blvd., Suite 2300,
|
|
101
|
+
* Arlington, VA, 22201,
|
|
102
|
+
* US
|
|
103
|
+
* const customAddress = (<Address address={document.address} lines={[['line1', 'city', 'region']]} />);
|
|
104
|
+
* --> 1101 Wilson Blvd., Arlington, VA
|
|
105
|
+
* ```
|
|
106
|
+
*
|
|
107
|
+
* @public
|
|
108
|
+
*/
|
|
109
|
+
declare const Address: ({ address, lines, separator, ...props }: AddressProps) => react_jsx_runtime.JSX.Element;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Get a third-party maps url for a Yext location
|
|
113
|
+
*
|
|
114
|
+
* @param address - Yext address
|
|
115
|
+
* @param listings - List of available Yext Listings
|
|
116
|
+
* @param googlePlaceId - Google Place ID
|
|
117
|
+
* @param config - Options for determining URL
|
|
118
|
+
*
|
|
119
|
+
* @returns Maps service url
|
|
120
|
+
*/
|
|
121
|
+
declare const getDirections: (address?: AddressType, listings?: ListingType[], googlePlaceId?: string, config?: GetDirectionsConfig) => string | undefined;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* The shape of the data passed directly to the different template functions with the
|
|
125
|
+
* exception of the render function (getPath, getHeadConfig, etc).
|
|
126
|
+
*
|
|
127
|
+
* @public
|
|
128
|
+
*/
|
|
129
|
+
interface TemplateProps<T = Record<string, any>> {
|
|
130
|
+
/** The entire document returned after applying the stream to a single entity */
|
|
131
|
+
document: T;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* The AnalyticsMethod interface specifies the methods that can be used with
|
|
136
|
+
* the Analytics Provider.
|
|
137
|
+
*
|
|
138
|
+
*/
|
|
139
|
+
interface AnalyticsMethods {
|
|
140
|
+
/**
|
|
141
|
+
* The track method will send a generic analytics event to Yext.
|
|
142
|
+
*
|
|
143
|
+
* @param eventName - the name of the event, will appear in Yext's Report Builder UI
|
|
144
|
+
* @param conversionData - optional details for tracking an event as a conversion
|
|
145
|
+
*/
|
|
146
|
+
track(eventName: string, conversionData?: ConversionDetails): Promise<void>;
|
|
147
|
+
/**
|
|
148
|
+
* The identify method will allow you to tie analytics events to a specific user.
|
|
149
|
+
*
|
|
150
|
+
* @param visitor - the Visitor object
|
|
151
|
+
*/
|
|
152
|
+
identify(visitor: Visitor): void;
|
|
153
|
+
/**
|
|
154
|
+
* The pageView method will track a pageview event.
|
|
155
|
+
*/
|
|
156
|
+
pageView(): Promise<void>;
|
|
157
|
+
/**
|
|
158
|
+
* trackClick will return an event handler that delays navigation to allow
|
|
159
|
+
* a click event to send. To use it you simply pass it to the onClick prop,
|
|
160
|
+
* like so:
|
|
161
|
+
* ```ts
|
|
162
|
+
* <a onClick={trackClick('my click')}
|
|
163
|
+
* ```
|
|
164
|
+
*/
|
|
165
|
+
trackClick(eventName: string, conversionData?: ConversionDetails): (e: MouseEvent<HTMLAnchorElement>) => Promise<void>;
|
|
166
|
+
/**
|
|
167
|
+
* The optIn method should be called when a user opts into analytics tracking,
|
|
168
|
+
* e.g. via a Consent Management Banner or other opt-in method.
|
|
169
|
+
*/
|
|
170
|
+
optIn(): Promise<void>;
|
|
171
|
+
/**
|
|
172
|
+
* Use the enableTrackingCookie method to enable conversion tracking on
|
|
173
|
+
* your page. This should be done only if you have conversion tracking
|
|
174
|
+
* configured in your Yext account.
|
|
175
|
+
*/
|
|
176
|
+
enableTrackingCookie(): void;
|
|
177
|
+
/**
|
|
178
|
+
* Use the setDebugEnabled method to toggle debugging on or off. Currently,
|
|
179
|
+
* this will log tracked events to the dev console.
|
|
180
|
+
*
|
|
181
|
+
* @param enabled - boolean value for whethere debugging should be on or off.
|
|
182
|
+
*/
|
|
183
|
+
setDebugEnabled(enabled: boolean): void;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* The AnalyticsProviderProps interface represents the component properties
|
|
187
|
+
* to be passed into the AnalyticsProvider.
|
|
188
|
+
*
|
|
189
|
+
* @public
|
|
190
|
+
*/
|
|
191
|
+
interface AnalyticsProviderProps {
|
|
192
|
+
/**
|
|
193
|
+
* The TemplateProps that come from the rendering system
|
|
194
|
+
*/
|
|
195
|
+
templateData: TemplateProps;
|
|
196
|
+
/**
|
|
197
|
+
* requireOptIn should be set to true if your compliance requirements require
|
|
198
|
+
* you to put all marketing analytics behind a user opt-in banner or if you
|
|
199
|
+
* use a Compliance Management tool of some kind.
|
|
200
|
+
*/
|
|
201
|
+
requireOptIn?: boolean | undefined;
|
|
202
|
+
/**
|
|
203
|
+
* enableTrackingCookie will set a tracking cookie when a user does any
|
|
204
|
+
* trackable action on your site, such as a page view, click, etc.
|
|
205
|
+
*/
|
|
206
|
+
enableTrackingCookie?: boolean | undefined;
|
|
207
|
+
/**
|
|
208
|
+
* enableDebugging can be set to true if you want to expose tracked events
|
|
209
|
+
* in the developer console.
|
|
210
|
+
*/
|
|
211
|
+
enableDebugging?: boolean | undefined;
|
|
212
|
+
/**
|
|
213
|
+
* The domain of the page to send with API requests. If none is specified,
|
|
214
|
+
* the hostname for the site ID is used. The domain string must include the
|
|
215
|
+
* scheme (e.g. https://foo.com).
|
|
216
|
+
*/
|
|
217
|
+
pageDomain?: string;
|
|
218
|
+
/**
|
|
219
|
+
* isStaging() will evaluate to false if the the event is fired from any of
|
|
220
|
+
* provided domains in productionDomains.
|
|
221
|
+
*/
|
|
222
|
+
productionDomains?: string[];
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* AnalyticsScopeProps defines the component properties required by the
|
|
226
|
+
* AnalyticsScopeProvider component.
|
|
227
|
+
*
|
|
228
|
+
* @public
|
|
229
|
+
*/
|
|
230
|
+
interface AnalyticsScopeProps {
|
|
231
|
+
/**
|
|
232
|
+
* The string to prepend to all analytics events that come from components
|
|
233
|
+
* below the AnalyticsScopeProvider component in the tree.
|
|
234
|
+
*/
|
|
235
|
+
name: string;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* The Analytics class creates a stateful facade in front of the \@yext/analytics
|
|
240
|
+
* Library's pagesAnalyticsProvider class. It takes in some data from the
|
|
241
|
+
* template configuration and uses it to provide configuration to the
|
|
242
|
+
* pagesAnalyticsProvider.
|
|
243
|
+
*
|
|
244
|
+
* Additionally, it provides handlers for controlling user opt-in for compliance
|
|
245
|
+
* requirements as well as for debugging, enabling conversion tracking, saving
|
|
246
|
+
* user identity information, and creating named analytics scopes for
|
|
247
|
+
* easy tagging.
|
|
248
|
+
*
|
|
249
|
+
* @public
|
|
250
|
+
*/
|
|
251
|
+
declare class Analytics implements AnalyticsMethods {
|
|
252
|
+
private templateData;
|
|
253
|
+
private pageDomain?;
|
|
254
|
+
private productionDomains;
|
|
255
|
+
private _optedIn;
|
|
256
|
+
private _conversionTrackingEnabled;
|
|
257
|
+
private _cookieManager;
|
|
258
|
+
private _analyticsReporter;
|
|
259
|
+
private _pageViewFired;
|
|
260
|
+
private _enableDebugging;
|
|
261
|
+
/**
|
|
262
|
+
* Creates an Analytics instance, will fire a pageview event if requireOptin
|
|
263
|
+
* is false
|
|
264
|
+
*
|
|
265
|
+
* @param templateData - template data object from the pages system
|
|
266
|
+
* @param requireOptIn - boolean, set to true if you require user opt in before tracking analytics
|
|
267
|
+
*/
|
|
268
|
+
constructor(templateData: TemplateProps, requireOptIn?: boolean | undefined, pageDomain?: string | undefined, productionDomains?: string[]);
|
|
269
|
+
private calculatePageType;
|
|
270
|
+
private makeReporter;
|
|
271
|
+
private canTrack;
|
|
272
|
+
private setupConversionTracking;
|
|
273
|
+
/** {@inheritDoc AnalyticsMethods.enableConversionTracking} */
|
|
274
|
+
enableTrackingCookie(): void;
|
|
275
|
+
/** {@inheritDoc AnalyticsMethods.identify} */
|
|
276
|
+
identify(visitor: Visitor): void;
|
|
277
|
+
/** {@inheritDoc AnalyticsMethods.async} */
|
|
278
|
+
optIn(): Promise<void>;
|
|
279
|
+
/** {@inheritDoc AnalyticsMethods.async} */
|
|
280
|
+
pageView(): Promise<void>;
|
|
281
|
+
/** {@inheritDoc AnalyticsMethods.track} */
|
|
282
|
+
track(eventName: string, conversionData?: ConversionDetails): Promise<void>;
|
|
283
|
+
/** {@inheritDoc AnalyticsMethods.setDebugEnabled} */
|
|
284
|
+
setDebugEnabled(enabled: boolean): void;
|
|
285
|
+
/** {@inheritDoc AnalyticsMethods.trackClick} */
|
|
286
|
+
trackClick(eventName: string, conversionData?: ConversionDetails): (e: MouseEvent<HTMLAnchorElement>) => Promise<void>;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* Default react context for use with Yext Analytics.
|
|
291
|
+
*
|
|
292
|
+
* @public
|
|
293
|
+
*/
|
|
294
|
+
declare const AnalyticsContext: React$1.Context<AnalyticsMethods | null>;
|
|
295
|
+
|
|
296
|
+
declare global {
|
|
297
|
+
interface Window {
|
|
298
|
+
setAnalyticsOptIn: () => void;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* The useAnalytics hook can be used anywhere in the tree below a configured
|
|
303
|
+
* AnalyticsProvider. Calling it will return an object to give you access to
|
|
304
|
+
* the analytics convenience methods for use in your components,
|
|
305
|
+
* such as track(), pageView(), optIn() etc.
|
|
306
|
+
*
|
|
307
|
+
* @public
|
|
308
|
+
*/
|
|
309
|
+
declare function useAnalytics(): AnalyticsMethods | null;
|
|
310
|
+
/**
|
|
311
|
+
* Simpler hook that just returns the analytics track() method.
|
|
312
|
+
*
|
|
313
|
+
* @public
|
|
314
|
+
*/
|
|
315
|
+
declare const useTrack: () => ((eventName: string, conversionData?: ConversionDetails | undefined) => Promise<void>) | undefined;
|
|
316
|
+
/**
|
|
317
|
+
* Simpler hook that just returns returns the analytics pageView method
|
|
318
|
+
*
|
|
319
|
+
* @public
|
|
320
|
+
*/
|
|
321
|
+
declare const usePageView: () => (() => Promise<void>) | undefined;
|
|
322
|
+
/**
|
|
323
|
+
* Simpler hook that just returns the analytics identify method
|
|
324
|
+
*
|
|
325
|
+
* @public
|
|
326
|
+
*/
|
|
327
|
+
declare const useIdentify: () => ((visitor: Visitor) => void) | undefined;
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* The main Analytics component for you to use. Sets up the proper react context
|
|
331
|
+
* and bootstraps the Analytics reporter.
|
|
332
|
+
*
|
|
333
|
+
* @param props - A PropsWithChildren that implements AnalyticsProviderProps
|
|
334
|
+
*
|
|
335
|
+
* @public
|
|
336
|
+
*/
|
|
337
|
+
declare function AnalyticsProvider(props: PropsWithChildren<AnalyticsProviderProps>): JSX.Element;
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* The useScope hook will return the current scope from the Analytics Scope. For
|
|
341
|
+
* use within the context of an AnalyticsScopeProvider for scoping analytics events.
|
|
342
|
+
*/
|
|
343
|
+
declare const useScope: () => string;
|
|
344
|
+
/**
|
|
345
|
+
* The AnalyticsScopeProvider will allow you to pre-pend a given string to all
|
|
346
|
+
* events that happen in the node tree below where setScope is called.
|
|
347
|
+
* For example, if you call setScope('header') and there is an `a` element
|
|
348
|
+
* below whose onClick calls `track('my link')` the calculated event name
|
|
349
|
+
* that will be sent to Yext Analytics is `header_mylink`
|
|
350
|
+
*
|
|
351
|
+
* @param props - AnalyticsScopeProps
|
|
352
|
+
*/
|
|
353
|
+
declare function AnalyticsScopeProvider(props: PropsWithChildren<AnalyticsScopeProps>): JSX.Element;
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* The type definition for a thumbnail.
|
|
357
|
+
*
|
|
358
|
+
* @public
|
|
359
|
+
*/
|
|
360
|
+
type ThumbnailType = {
|
|
361
|
+
height: number;
|
|
362
|
+
width: number;
|
|
363
|
+
url: string;
|
|
364
|
+
};
|
|
365
|
+
/**
|
|
366
|
+
* The type definition for a complex image.
|
|
367
|
+
*
|
|
368
|
+
* @public
|
|
369
|
+
*/
|
|
370
|
+
type ComplexImageType = {
|
|
371
|
+
image: {
|
|
372
|
+
alternateText?: string;
|
|
373
|
+
height: number;
|
|
374
|
+
width: number;
|
|
375
|
+
url: string;
|
|
376
|
+
thumbnails?: ThumbnailType[];
|
|
377
|
+
};
|
|
378
|
+
};
|
|
379
|
+
/**
|
|
380
|
+
* The type definition for an image.
|
|
381
|
+
*
|
|
382
|
+
* @public
|
|
383
|
+
*/
|
|
384
|
+
type ImageType = {
|
|
385
|
+
alternateText?: string;
|
|
386
|
+
height: number;
|
|
387
|
+
width: number;
|
|
388
|
+
url: string;
|
|
389
|
+
};
|
|
390
|
+
/**
|
|
391
|
+
* Layout option on the Image component.
|
|
392
|
+
*
|
|
393
|
+
* @public
|
|
394
|
+
*/
|
|
395
|
+
declare const ImageLayoutOption: {
|
|
396
|
+
/**
|
|
397
|
+
* The the default layout if one is not specified. An image will be scaled down to fit the
|
|
398
|
+
* container but not exceed the absolute size of the image.
|
|
399
|
+
*/
|
|
400
|
+
readonly INTRINSIC: "intrinsic";
|
|
401
|
+
/**
|
|
402
|
+
* Shows the image in a fixed size. `width` or `height` must be passed in. If both `width` and
|
|
403
|
+
* `height` are passed in, but the aspect ratio does not match the aspect ratio of the image,
|
|
404
|
+
* the image will be centered. This behavior can be adjusted using the `objectFit` and
|
|
405
|
+
* `objectPosition` props of the `style` rpop.
|
|
406
|
+
*/
|
|
407
|
+
readonly FIXED: "fixed";
|
|
408
|
+
/** Shows the image in a fixed aspect ratio. The `aspectRatio` prop must be provided. */
|
|
409
|
+
readonly ASPECT: "aspect";
|
|
410
|
+
/** Always fills the image to 100% of the container's width. */
|
|
411
|
+
readonly FILL: "fill";
|
|
412
|
+
};
|
|
413
|
+
/**
|
|
414
|
+
* The type definition for the image layout.
|
|
415
|
+
*
|
|
416
|
+
* @public
|
|
417
|
+
*/
|
|
418
|
+
type ImageLayout = (typeof ImageLayoutOption)[keyof typeof ImageLayoutOption];
|
|
419
|
+
/**
|
|
420
|
+
* The shape of the data passed to {@link Image}.
|
|
421
|
+
*/
|
|
422
|
+
interface BaseImageProps {
|
|
423
|
+
/** The image field from Knowledge Graph. */
|
|
424
|
+
image: ComplexImageType | ImageType;
|
|
425
|
+
/** Overrides the className on the underlying img tag. */
|
|
426
|
+
className?: string;
|
|
427
|
+
/** Specifies how the image is rendered. */
|
|
428
|
+
layout?: ImageLayout;
|
|
429
|
+
/** The absolute width of the image. Only impacts if layout is set to "fixed". */
|
|
430
|
+
width?: number;
|
|
431
|
+
/** The absolute height of the image. Only impacts if layout is set to "fixed". */
|
|
432
|
+
height?: number;
|
|
433
|
+
/** The aspect ratio of the image. Only impacts if layout is set to "aspect". */
|
|
434
|
+
aspectRatio?: number;
|
|
435
|
+
/** A pass through react component that is displayed when the image is loading. */
|
|
436
|
+
placeholder?: React$1.ReactNode;
|
|
437
|
+
/** Pass through props that are on the native HTML img tag. The Image component may not work if src and/or srcsets are included. */
|
|
438
|
+
imgOverrides?: Record<string, unknown>;
|
|
439
|
+
/** The pass through style of the underlying img tag. */
|
|
440
|
+
style?: React$1.CSSProperties;
|
|
441
|
+
/** Set the loading state of the image. */
|
|
442
|
+
loading?: "eager" | "lazy";
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* The shape of the data passed to {@link Image} when layout is {@link ImageLayoutOption.INTRINSIC},
|
|
446
|
+
* {@link ImageLayoutOption.FILL} or not provided.
|
|
447
|
+
*/
|
|
448
|
+
interface OtherImageProps extends BaseImageProps {
|
|
449
|
+
/** Specifies how the image is rendered. */
|
|
450
|
+
layout?: "intrinsic" | "fill";
|
|
451
|
+
}
|
|
452
|
+
/**
|
|
453
|
+
* The shape of the data passed to {@link Image} when layout is {@link ImageLayoutOption.FIXED}.
|
|
454
|
+
* Extends the {@link BaseImageProps} interface and has the additions of a width and height,
|
|
455
|
+
* at least one of which must be specified.
|
|
456
|
+
*/
|
|
457
|
+
interface FixedImageProps extends BaseImageProps {
|
|
458
|
+
/** Specifies how the image is rendered. */
|
|
459
|
+
layout: "fixed";
|
|
460
|
+
/** The absolute width of the image. Only impacts if layout is set to "fixed". */
|
|
461
|
+
width?: number;
|
|
462
|
+
/** The absolute height of the image. Only impacts if layout is set to "fixed". */
|
|
463
|
+
height?: number;
|
|
464
|
+
}
|
|
465
|
+
/**
|
|
466
|
+
* The shape of the data passed to {@link Image} when layout is {@link ImageLayoutOption.ASPECT}.
|
|
467
|
+
* Extends the {@link BaseImageProps} interface and has the additions of a required aspectRatio.
|
|
468
|
+
*/
|
|
469
|
+
interface AspectImageProps extends BaseImageProps {
|
|
470
|
+
/** Specifies how the image is rendered. */
|
|
471
|
+
layout: "aspect";
|
|
472
|
+
/** The aspect ratio of the image. Only impacts if layout is set to "aspect". */
|
|
473
|
+
aspectRatio: number;
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* The shape of the data passed to {@link Image}.
|
|
477
|
+
*
|
|
478
|
+
* @public
|
|
479
|
+
*/
|
|
480
|
+
type ImageProps = OtherImageProps | FixedImageProps | AspectImageProps;
|
|
481
|
+
|
|
482
|
+
/**
|
|
483
|
+
* Renders an image based from the Yext Knowledge Graph. Example of using the component to render
|
|
484
|
+
* simple and complex image fields from Yext Knowledge Graph:
|
|
485
|
+
* ```
|
|
486
|
+
* import { Image } from "@yext/pages/components";
|
|
487
|
+
*
|
|
488
|
+
* const simpleImage = (<Image image={document.logo} />);
|
|
489
|
+
* const complexImage = (<Image image={document.photoGallery[0]} />);
|
|
490
|
+
* ```
|
|
491
|
+
*
|
|
492
|
+
* @public
|
|
493
|
+
*/
|
|
494
|
+
declare const Image: ({ image, className, width, height, aspectRatio, layout, placeholder, imgOverrides, style, loading, }: ImageProps) => react_jsx_runtime.JSX.Element;
|
|
495
|
+
|
|
496
|
+
/**
|
|
497
|
+
* Constants for available link types.
|
|
498
|
+
*
|
|
499
|
+
* @public
|
|
500
|
+
*/
|
|
501
|
+
declare const LinkTypes: {
|
|
502
|
+
readonly URL: "URL";
|
|
503
|
+
readonly Email: "Email";
|
|
504
|
+
readonly Phone: "Phone";
|
|
505
|
+
};
|
|
506
|
+
/**
|
|
507
|
+
* Type of link types that might be received from the platform.
|
|
508
|
+
*
|
|
509
|
+
* @public
|
|
510
|
+
*/
|
|
511
|
+
type LinkType = (typeof LinkTypes)[keyof typeof LinkTypes];
|
|
512
|
+
/**
|
|
513
|
+
* Type for CTA field
|
|
514
|
+
* Note that when coming from the platform the label will always be a string
|
|
515
|
+
* but ReactNode allows for more general usage.
|
|
516
|
+
*
|
|
517
|
+
* @public
|
|
518
|
+
*/
|
|
519
|
+
interface CTA {
|
|
520
|
+
link: string;
|
|
521
|
+
label?: React.ReactNode;
|
|
522
|
+
linkType?: LinkType;
|
|
523
|
+
}
|
|
524
|
+
/**
|
|
525
|
+
* Configuration options available for any usages of the Link component.
|
|
526
|
+
*/
|
|
527
|
+
interface LinkConfig extends React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement> {
|
|
528
|
+
obfuscate?: boolean;
|
|
529
|
+
eventName?: string;
|
|
530
|
+
conversionDetails?: ConversionDetails | undefined;
|
|
531
|
+
}
|
|
532
|
+
/**
|
|
533
|
+
* The shape of the data passed to {@link Link} when directly passing an HREF to the Link component.
|
|
534
|
+
*
|
|
535
|
+
* @public
|
|
536
|
+
*/
|
|
537
|
+
interface HREFLinkProps extends LinkConfig {
|
|
538
|
+
href: string;
|
|
539
|
+
cta?: never;
|
|
540
|
+
}
|
|
541
|
+
/**
|
|
542
|
+
* The shape of the data passed to {@link Link} when using a CTA field, and not overriding children.
|
|
543
|
+
*
|
|
544
|
+
* @public
|
|
545
|
+
*/
|
|
546
|
+
interface CTAWithChildrenLinkProps extends LinkConfig {
|
|
547
|
+
href?: never;
|
|
548
|
+
cta: CTA;
|
|
549
|
+
children?: React.ReactNode;
|
|
550
|
+
}
|
|
551
|
+
/**
|
|
552
|
+
* The shape of the data passed to {@link Link} when using a CTA field, and overriding children.
|
|
553
|
+
*
|
|
554
|
+
* @public
|
|
555
|
+
*/
|
|
556
|
+
interface CTAWithoutChildrenLinkProps extends LinkConfig {
|
|
557
|
+
href?: never;
|
|
558
|
+
cta: Omit<CTA, "label">;
|
|
559
|
+
children: React.ReactNode;
|
|
560
|
+
}
|
|
561
|
+
/**
|
|
562
|
+
* The shape of the data passed to {@link Link} when using a CTA field.
|
|
563
|
+
*/
|
|
564
|
+
type CTALinkProps = CTAWithChildrenLinkProps | CTAWithoutChildrenLinkProps;
|
|
565
|
+
/**
|
|
566
|
+
* The shape of the data passed to {@link Link}.
|
|
567
|
+
*
|
|
568
|
+
* @public
|
|
569
|
+
*/
|
|
570
|
+
type LinkProps = CTALinkProps | HREFLinkProps;
|
|
571
|
+
|
|
572
|
+
/**
|
|
573
|
+
* Renders an anchor tag using either a directly provided HREF or from a field in the Yext Knowledge Graph.
|
|
574
|
+
*
|
|
575
|
+
* Example of using the component to render
|
|
576
|
+
* a link with and without sourcing from a knowledge graph field:
|
|
577
|
+
*
|
|
578
|
+
* @example
|
|
579
|
+
* ```ts
|
|
580
|
+
* import { Link } from "@yext/pages/components";
|
|
581
|
+
*
|
|
582
|
+
* <Link href="/search">Locator</Link>
|
|
583
|
+
* <Link cta={document.c_exampleCTA} />
|
|
584
|
+
* <Link cta={{link: "https://www.yext.com", label: "Click Here", linkType: "URL"}} />
|
|
585
|
+
* ```
|
|
586
|
+
*
|
|
587
|
+
* @public
|
|
588
|
+
*/
|
|
589
|
+
declare const Link: React__default.ForwardRefExoticComponent<(Omit<HREFLinkProps, "ref"> | Omit<CTAWithChildrenLinkProps, "ref"> | Omit<CTAWithoutChildrenLinkProps, "ref">) & React__default.RefAttributes<HTMLAnchorElement>>;
|
|
590
|
+
|
|
591
|
+
/**
|
|
592
|
+
* This class represents a point on a sphere defined by latitude and longitude.
|
|
593
|
+
* Latitude is a degree number in the range [-90, 90].
|
|
594
|
+
* Longitude is a degree number without limits but is normalized to [-180, 180).
|
|
595
|
+
*/
|
|
596
|
+
declare class Coordinate$1 {
|
|
597
|
+
/**
|
|
598
|
+
* Constructor takes either 1 or 2 arguments.
|
|
599
|
+
* 2 arguments: latitude and longitude.
|
|
600
|
+
* 1 argument: an object with at least one {@link module:@yext/components-geo~Coordinate~LATITUDE_ALIASES latitude alias}
|
|
601
|
+
* and one one {@link module:@yext/components-geo~CoordinateCoordinate~LONGITUDE_ALIASES longitude alias}.
|
|
602
|
+
* @param {number|Object} latitudeOrObject
|
|
603
|
+
* @param {number} [longitude] Optional only if the first argument is a {@link module:@yext/components-geo~Coordinate Coordinate}-like object
|
|
604
|
+
*/
|
|
605
|
+
constructor(latitudeOrObject: number | Object, longitude?: number | undefined);
|
|
606
|
+
set latitude(newLat: number);
|
|
607
|
+
/**
|
|
608
|
+
* Degrees latitude in the range [-90, 90].
|
|
609
|
+
* If setting a value outside this range, it will be set to -90 or 90, whichever is closer.
|
|
610
|
+
* @type {number}
|
|
611
|
+
*/
|
|
612
|
+
get latitude(): number;
|
|
613
|
+
set longitude(newLon: number);
|
|
614
|
+
/**
|
|
615
|
+
* Degrees longitude in the range [-Infinity, Infinity].
|
|
616
|
+
* @type {number}
|
|
617
|
+
*/
|
|
618
|
+
get longitude(): number;
|
|
619
|
+
/**
|
|
620
|
+
* Degrees longitude in the range [-180, 180).
|
|
621
|
+
* If the coordinate's longitude is outside this range, the equivalent value within it is used.
|
|
622
|
+
* Examples: 123 => 123, 270 => -90, -541 => 179
|
|
623
|
+
* @type {number}
|
|
624
|
+
*/
|
|
625
|
+
get normalLon(): number;
|
|
626
|
+
_lat: number | undefined;
|
|
627
|
+
_lon: number | undefined;
|
|
628
|
+
/**
|
|
629
|
+
* Add distance to the coordinate to change its position.
|
|
630
|
+
* @param {number} latDist latitude distance
|
|
631
|
+
* @param {number} lonDist longitude distance
|
|
632
|
+
* @param {module:@yext/components-geo~Unit} [unit=Unit.DEGREE] The unit of latDist and lonDist
|
|
633
|
+
* @param {module:@yext/components-geo~Projection} [projection=Projection.SPHERICAL] The projection of Earth (not relevant when using a physical distance unit, e.g. Mile)
|
|
634
|
+
*/
|
|
635
|
+
add(latDist: number, lonDist: number, unit?: any, projection?: any): void;
|
|
636
|
+
/**
|
|
637
|
+
* Calculate the distance from this coordinate to another coordinate.
|
|
638
|
+
* @param {module:@yext/components-geo~Coordinate} coordinate
|
|
639
|
+
* @param {module:@yext/components-geo~Unit} [unit=Unit.MILE] The unit of distance
|
|
640
|
+
* @param {module:@yext/components-geo~Projection} [projection=Projection.SPHERICAL] The projection of Earth (not relevant when using a physical distance unit, e.g. Mile)
|
|
641
|
+
* @returns {number} Distance in the requested unit
|
|
642
|
+
*/
|
|
643
|
+
distanceTo(coordinate: any, unit?: any, projection?: any): number;
|
|
644
|
+
/**
|
|
645
|
+
* Test if this coordinate has the same latitude and longitude as another.
|
|
646
|
+
* @param {module:@yext/components-geo~Coordinate} coordinate
|
|
647
|
+
* @returns {boolean}
|
|
648
|
+
*/
|
|
649
|
+
equals(coordinate: any): boolean;
|
|
650
|
+
/**
|
|
651
|
+
* Get the coordinate as a string that can be used in a search query.
|
|
652
|
+
* Example: {latitude: -45, longitude: 123} => '-45,123'
|
|
653
|
+
* @returns {string}
|
|
654
|
+
*/
|
|
655
|
+
searchQueryString(): string;
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
/**
|
|
659
|
+
* This class represents a bounded coordinate region of a sphere.
|
|
660
|
+
* The bounds are defined by two {@link module:@yext/components-geo~Coordinate Coordinates}: southwest and northeast.
|
|
661
|
+
* If the northeast coordinate does not have a greater latitude and longitude than the soutwest
|
|
662
|
+
* coordinate, the behavior of this object is undefined.
|
|
663
|
+
*/
|
|
664
|
+
declare class GeoBounds {
|
|
665
|
+
/**
|
|
666
|
+
* Create a new {@link module:@yext/components-geo~GeoBounds GeoBounds} with minimal area that
|
|
667
|
+
* contains all the given coordinates
|
|
668
|
+
* @param {module:@yext/components-geo~Coordinate[]} coordinates
|
|
669
|
+
* @returns {module:@yext/components-geo~GeoBounds}
|
|
670
|
+
*/
|
|
671
|
+
static fit(coordinates: any): any;
|
|
672
|
+
/**
|
|
673
|
+
* @param {module:@yext/components-geo~Coordinate} sw Southwest coordinate
|
|
674
|
+
* @param {module:@yext/components-geo~Coordinate} ne Northeast coordinate
|
|
675
|
+
*/
|
|
676
|
+
constructor(sw: any, ne: any);
|
|
677
|
+
_ne: Coordinate$1;
|
|
678
|
+
_sw: Coordinate$1;
|
|
679
|
+
set ne(newNE: any);
|
|
680
|
+
/**
|
|
681
|
+
* Northeast coordinate
|
|
682
|
+
* @type {module:@yext/components-geo~Coordinate}
|
|
683
|
+
*/
|
|
684
|
+
get ne(): any;
|
|
685
|
+
set sw(newSW: any);
|
|
686
|
+
/**
|
|
687
|
+
* Southwest coordinate
|
|
688
|
+
* @type {module:@yext/components-geo~Coordinate}
|
|
689
|
+
*/
|
|
690
|
+
get sw(): any;
|
|
691
|
+
/**
|
|
692
|
+
* Whether the coordinate lies within the region defined by the bounds.
|
|
693
|
+
* {@link module:@yext/components-geo~Coordinate#normalLon Normalized longitudes} are used for the
|
|
694
|
+
* bounds and the coordinate.
|
|
695
|
+
* @param {module:@yext/components-geo~Coordinate} coordinate
|
|
696
|
+
* @returns {boolean}
|
|
697
|
+
*/
|
|
698
|
+
contains(coordinate: any): boolean;
|
|
699
|
+
/**
|
|
700
|
+
* Extend the bounds if necessary so that the coordinate is contained by them.
|
|
701
|
+
* @param {module:@yext/components-geo~Coordinate} coordinate
|
|
702
|
+
*/
|
|
703
|
+
extend(coordinate: any): void;
|
|
704
|
+
/**
|
|
705
|
+
* Calculate the center of the bounds using the given projection.
|
|
706
|
+
* To find the visual center on a Mercator map, use Projection.MERCATOR.
|
|
707
|
+
* To find the center for geolocation or geosearch purposes, use Projection.SPHERICAL.
|
|
708
|
+
* @param {module:@yext/components-geo~Projection} [projection=Projection.SPHERICAL]
|
|
709
|
+
* @returns {module:@yext/components-geo~Coordinate}
|
|
710
|
+
*/
|
|
711
|
+
getCenter(projection?: any): any;
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
/**
|
|
715
|
+
* An interactive map that supports various map providers, such as Google Maps and Mapbox, with a
|
|
716
|
+
* single API. Code written using this class functions approximately the same regardless of the map
|
|
717
|
+
* provider used. Any map provider can be supported via an instance of {@link module:@yext/components-maps~MapProvider MapProvider}.
|
|
718
|
+
*/
|
|
719
|
+
declare class Map$1 {
|
|
720
|
+
/**
|
|
721
|
+
* The {@link module:@yext/components-maps~MapProvider MapProvider} for the map must be loaded
|
|
722
|
+
* before calling this constructor.
|
|
723
|
+
* @param {module:@yext/components-maps~MapOptions} options
|
|
724
|
+
*/
|
|
725
|
+
constructor(options: any);
|
|
726
|
+
_defaultCenter: any;
|
|
727
|
+
_defaultZoom: any;
|
|
728
|
+
_legendPins: any;
|
|
729
|
+
_provider: any;
|
|
730
|
+
_singlePinZoom: any;
|
|
731
|
+
_wrapper: any;
|
|
732
|
+
_padding: {};
|
|
733
|
+
_cachedBounds: GeoBounds | null;
|
|
734
|
+
_resolveIdle: () => null;
|
|
735
|
+
_resolveMoving: () => null;
|
|
736
|
+
_idlePromise: Promise<void>;
|
|
737
|
+
_panHandlerRunning: boolean;
|
|
738
|
+
_panStartHandlerRunning: boolean;
|
|
739
|
+
_map: any;
|
|
740
|
+
_currentBounds: any;
|
|
741
|
+
/**
|
|
742
|
+
* Set the map bounds so that all the given coordinates are within the {@link module:@yext/components-maps~MapOptions#withPadding padded}
|
|
743
|
+
* view.
|
|
744
|
+
* @param {module:@yext/components-tsx-geo~Coordinate[]} coordinates
|
|
745
|
+
* @param {boolean} [animated=false] Whether to transition smoothly to the new bounds
|
|
746
|
+
* @param {number} [maxZoom=singlePinZoom] The max zoom level after fitting. Uses {@link module:@yext/components-maps~MapOptions#withSinglePinZoom singlePinZoom}
|
|
747
|
+
* by default.
|
|
748
|
+
*/
|
|
749
|
+
fitCoordinates(coordinates: any, animated?: boolean | undefined, maxZoom?: number | undefined): void;
|
|
750
|
+
/**
|
|
751
|
+
* Get the current visible region of the map. If the map is zoomed out to show multiple copies of
|
|
752
|
+
* the world, the longitude bounds will be outside [-180, 180) but the center will always be
|
|
753
|
+
* within [-180, 180).
|
|
754
|
+
* @returns {module:@yext/components-tsx-geo~GeoBounds}
|
|
755
|
+
*/
|
|
756
|
+
getBounds(): any;
|
|
757
|
+
/**
|
|
758
|
+
* @returns {module:@yext/components-tsx-geo~Coordinate} The center of the current visible region of
|
|
759
|
+
* the map
|
|
760
|
+
*/
|
|
761
|
+
getCenter(): any;
|
|
762
|
+
/**
|
|
763
|
+
* Intended for internal use only
|
|
764
|
+
* @returns {module:@yext/components-maps~ProviderMap} The map's {@link module:@yext/components-maps~ProviderMap ProviderMap}
|
|
765
|
+
* instance
|
|
766
|
+
*/
|
|
767
|
+
getProviderMap(): any;
|
|
768
|
+
/**
|
|
769
|
+
* To standardize zoom for all providers, zoom level is calculated with this formula:
|
|
770
|
+
* zoom = log2(pixel width of equator) - 8.
|
|
771
|
+
* At zoom = 0, the entire world is 256 pixels wide.
|
|
772
|
+
* At zoom = 1, the entire world is 512 pixels wide.
|
|
773
|
+
* Zoom 2 → 1024 pixels, zoom 3 → 2056 pixels, etc.
|
|
774
|
+
* Negative and non-integer zoom levels are valid and follow the formula.
|
|
775
|
+
* @returns {number} The current zoom level of the map
|
|
776
|
+
*/
|
|
777
|
+
getZoom(): number;
|
|
778
|
+
/**
|
|
779
|
+
* Returns when the map is not moving.
|
|
780
|
+
* Use map.idle().then(callback) to run callback immediately if the map is currently idle or once
|
|
781
|
+
* the map becomes idle if it's not.
|
|
782
|
+
*/
|
|
783
|
+
idle(): Promise<void>;
|
|
784
|
+
/**
|
|
785
|
+
* Returns when the map is moving.
|
|
786
|
+
* Use map.moving().then(callback) to run callback immediately if the map is currently moving or
|
|
787
|
+
* once the map starts moving if it's not.
|
|
788
|
+
*/
|
|
789
|
+
moving(): Promise<void>;
|
|
790
|
+
/**
|
|
791
|
+
* @returns {module:@yext/components-maps~MapPinOptions} A {@link module:@yext/components-maps~MapPinOptions MapPinOptions}
|
|
792
|
+
* instance with the same provider as this map
|
|
793
|
+
*/
|
|
794
|
+
newPinOptions(): any;
|
|
795
|
+
/**
|
|
796
|
+
* Called when the map has finished moving, at most once per animation frame.
|
|
797
|
+
* Passes the current and previous bounds to the custom pan handler given by {@link module:@yext/components-maps~MapOptions#withPanHandler MapOptions#withPanHandler}
|
|
798
|
+
*/
|
|
799
|
+
panHandler(): void;
|
|
800
|
+
/**
|
|
801
|
+
* Called when the map has started moving, at most once per animation frame.
|
|
802
|
+
* Passes the current bounds to the custom pan handler given by {@link module:@yext/components-maps~MapOptions#withPanStartHandler MapOptions#withPanStartHandler}
|
|
803
|
+
*/
|
|
804
|
+
panStartHandler(): void;
|
|
805
|
+
/**
|
|
806
|
+
* @param {Object} bounds
|
|
807
|
+
* @param {Object} bounds.ne The northeast corner of the bounds -- must be convertible to {@link module:@yext/components-tsx-geo~Coordinate Coordinate}
|
|
808
|
+
* @param {Object} bounds.sw The southwest corner of the bounds -- must be convertible to {@link module:@yext/components-tsx-geo~Coordinate Coordinate}
|
|
809
|
+
* @param {boolean} [animated=false] Whether to transition smoothly to the new bounds
|
|
810
|
+
* @param {Object} [padding={}]
|
|
811
|
+
* @param {number|module:@yext/components-maps~PaddingFunction} padding.bottom Minimum number of
|
|
812
|
+
* pixels between the map's bottom edge and a pin
|
|
813
|
+
* @param {number|module:@yext/components-maps~PaddingFunction} padding.left Minimum number of
|
|
814
|
+
* pixels between the map's left edge and a pin
|
|
815
|
+
* @param {number|module:@yext/components-maps~PaddingFunction} padding.right Minimum number of
|
|
816
|
+
* pixels between the map's right edge and a pin
|
|
817
|
+
* @param {number|module:@yext/components-maps~PaddingFunction} padding.top Minimum number of
|
|
818
|
+
* pixels between the map's top edge and a pin
|
|
819
|
+
* @param {number} [maxZoom=Infinity]
|
|
820
|
+
*/
|
|
821
|
+
setBounds({ ne, sw }: {
|
|
822
|
+
ne: Object;
|
|
823
|
+
sw: Object;
|
|
824
|
+
}, animated?: boolean | undefined, padding?: Object | undefined, maxZoom?: number | undefined): void;
|
|
825
|
+
/**
|
|
826
|
+
* @param {Object} coordinate Must be convertible to {@link module:@yext/components-tsx-geo~Coordinate Coordinate}
|
|
827
|
+
* @param {boolean} [animated=false] Whether to transition smoothly to the new center
|
|
828
|
+
*/
|
|
829
|
+
setCenter(coordinate: Object, animated?: boolean | undefined): void;
|
|
830
|
+
/**
|
|
831
|
+
* Padding is used by {@link module:@yext/components-maps~Map#fitCoordinates Map#fitCoordinates}.
|
|
832
|
+
* Padding can either be constant values or funtions that return a padding value.
|
|
833
|
+
* Constant values are good if the map should always have the same padding on every breakpoint.
|
|
834
|
+
* Functions are useful if the map should have different padding at different breakpoints/layouts.
|
|
835
|
+
* The function can check window.innerWidth or any other condition before returning a number.
|
|
836
|
+
* @param {Object} padding
|
|
837
|
+
* @param {number|module:@yext/components-maps~PaddingFunction} padding.bottom Minimum number of
|
|
838
|
+
* pixels between the map's bottom edge and a pin
|
|
839
|
+
* @param {number|module:@yext/components-maps~PaddingFunction} padding.left Minimum number of
|
|
840
|
+
* pixels between the map's left edge and a pin
|
|
841
|
+
* @param {number|module:@yext/components-maps~PaddingFunction} padding.right Minimum number of
|
|
842
|
+
* pixels between the map's right edge and a pin
|
|
843
|
+
* @param {number|module:@yext/components-maps~PaddingFunction} padding.top Minimum number of
|
|
844
|
+
* pixels between the map's top edge and a pin
|
|
845
|
+
* @returns {module:@yext/components-maps~Map}
|
|
846
|
+
*/
|
|
847
|
+
setPadding({ bottom, left, right, top, }: Object): any;
|
|
848
|
+
/**
|
|
849
|
+
* @param {module:@yext/components-maps~Map~panHandler} panHandler
|
|
850
|
+
*/
|
|
851
|
+
setPanHandler(panHandler: any): void;
|
|
852
|
+
_panHandler: any;
|
|
853
|
+
/**
|
|
854
|
+
* @param {module:@yext/components-maps~Map~panStartHandler} panStartHandler
|
|
855
|
+
*/
|
|
856
|
+
setPanStartHandler(panStartHandler: any): void;
|
|
857
|
+
_panStartHandler: any;
|
|
858
|
+
/**
|
|
859
|
+
* @param {number} zoom
|
|
860
|
+
* @param {boolean} [animated=false] Whether to transition smoothly to the new zoom
|
|
861
|
+
* @see module:@yext/components-maps~Map#getZoom
|
|
862
|
+
*/
|
|
863
|
+
setZoom(zoom: number, animated?: boolean | undefined): void;
|
|
864
|
+
/**
|
|
865
|
+
* @param {number} zoom
|
|
866
|
+
* @param {Object} center Must be convertible to {@link module:@yext/components-tsx-geo~Coordinate Coordinate}
|
|
867
|
+
* @param {boolean} [animated=false] Whether to transition smoothly to the new bounds
|
|
868
|
+
* @see module:@yext/components-maps~Map#setZoom
|
|
869
|
+
* @see module:@yext/components-maps~Map#setCenter
|
|
870
|
+
*/
|
|
871
|
+
setZoomCenter(zoom: number, center: Object, animated?: boolean | undefined): void;
|
|
872
|
+
/**
|
|
873
|
+
* Set the map state to idle
|
|
874
|
+
* @protected
|
|
875
|
+
*/
|
|
876
|
+
protected _setIdle(): void;
|
|
877
|
+
_movingPromise: Promise<any> | undefined;
|
|
878
|
+
/**
|
|
879
|
+
* Set the map state to moving
|
|
880
|
+
* @protected
|
|
881
|
+
*/
|
|
882
|
+
protected _setMoving(): void;
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
/**
|
|
886
|
+
* A pin for a {@link module:@yext/components-maps~Map Map} that displays at a given {@link module:@yext/components-tsx-geo~Coordinate Coordinate}.
|
|
887
|
+
* A MapPin can be displayed on at most one Map at a time. Pins support event handlers for clicking,
|
|
888
|
+
* hovering, and focusing. The pin can change its appearance based on its current status, which is
|
|
889
|
+
* changed by {@link module:@yext/components-maps~MapPin#setStatus setStatus}.
|
|
890
|
+
*/
|
|
891
|
+
declare class MapPin {
|
|
892
|
+
/**
|
|
893
|
+
* @param {module:@yext/components-maps~MapPinOptions} options
|
|
894
|
+
*/
|
|
895
|
+
constructor(options: any);
|
|
896
|
+
_coordinate: any;
|
|
897
|
+
_hideOffscreen: any;
|
|
898
|
+
_icons: any;
|
|
899
|
+
_propertiesForStatus: any;
|
|
900
|
+
_type: any;
|
|
901
|
+
_clickHandler: () => null;
|
|
902
|
+
_focusHandler: (focused: any) => null;
|
|
903
|
+
_hoverHandler: (hovered: any) => null;
|
|
904
|
+
_hidden: boolean;
|
|
905
|
+
_cancelHiddenUpdater: () => null;
|
|
906
|
+
_map: any;
|
|
907
|
+
_pin: any;
|
|
908
|
+
_status: {};
|
|
909
|
+
/**
|
|
910
|
+
* @returns {module:@yext/components-tsx-geo~Coordinate} The coordinate of the pin
|
|
911
|
+
*/
|
|
912
|
+
getCoordinate(): any;
|
|
913
|
+
/**
|
|
914
|
+
* Get the icon for a string key, such as 'default', 'hovered', or 'selected'
|
|
915
|
+
* @param {string} key The unique name of the icon
|
|
916
|
+
* @returns {string} The URL or data URI of the icon image
|
|
917
|
+
* @see module:@yext/components-maps~MapPinOptions#withIcon
|
|
918
|
+
*/
|
|
919
|
+
getIcon(key: string): string;
|
|
920
|
+
/**
|
|
921
|
+
* @returns {module:@yext/components-maps~Map} The map that the pin is currently on, or null if
|
|
922
|
+
* not on a map
|
|
923
|
+
*/
|
|
924
|
+
getMap(): any;
|
|
925
|
+
/**
|
|
926
|
+
* Intended for internal use only
|
|
927
|
+
* @returns {module:@yext/components-maps~ProviderPin} The pin's {@link module:@yext/components-maps~ProviderPin ProviderPin}
|
|
928
|
+
* instance
|
|
929
|
+
*/
|
|
930
|
+
getProviderPin(): any;
|
|
931
|
+
/**
|
|
932
|
+
* @returns {string} The string describing the type of pin
|
|
933
|
+
*/
|
|
934
|
+
getType(): string;
|
|
935
|
+
/**
|
|
936
|
+
* Remove this pin from its current map, if on one.
|
|
937
|
+
*/
|
|
938
|
+
remove(): void;
|
|
939
|
+
/**
|
|
940
|
+
* Set a handler function for when the pin is clicked, replacing any previously set click handler.
|
|
941
|
+
* @param {module:@yext/components-maps~PinClickHandler} clickHandler
|
|
942
|
+
*/
|
|
943
|
+
setClickHandler(clickHandler: any): void;
|
|
944
|
+
/**
|
|
945
|
+
* @param {Object} coordinate Must be convertible to {@link module:@yext/components-tsx-geo~Coordinate Coordinate}
|
|
946
|
+
*/
|
|
947
|
+
setCoordinate(coordinate: Object): void;
|
|
948
|
+
/**
|
|
949
|
+
* Set a handler function for when the pin is (un)focused, replacing any previously set focus handler.
|
|
950
|
+
* @param {module:@yext/components-maps~PinFocusHandler} focusHandler
|
|
951
|
+
*/
|
|
952
|
+
setFocusHandler(focusHandler: any): void;
|
|
953
|
+
/**
|
|
954
|
+
* Set a handler function for when the pin is (un)hovered, replacing any previously set hover handler.
|
|
955
|
+
* @param {module:@yext/components-maps~PinHoverHandler} hoverHandler
|
|
956
|
+
*/
|
|
957
|
+
setHoverHandler(hoverHandler: any): void;
|
|
958
|
+
/**
|
|
959
|
+
* Add the pin to a map, removing it from its current map if on one.
|
|
960
|
+
* @param {?Map} map
|
|
961
|
+
*/
|
|
962
|
+
setMap(map: Map$1 | null): void;
|
|
963
|
+
/**
|
|
964
|
+
* Assign all properties in an object to the pin's status.
|
|
965
|
+
* Example: if the pin's status is { a: true, b: true }, passing in { a: false, c: true } will
|
|
966
|
+
* change the pin's status to { a: false, b: true, c: true }
|
|
967
|
+
* @param {Object} status
|
|
968
|
+
*/
|
|
969
|
+
setStatus(status: Object): void;
|
|
970
|
+
/**
|
|
971
|
+
* Add or remove the pin from the map based on whether its coordinate is within the current bounds
|
|
972
|
+
* @protected
|
|
973
|
+
*/
|
|
974
|
+
protected _hideIfOffscreen(): void;
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
/**
|
|
978
|
+
* 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}
|
|
979
|
+
* and {@link module:@yext/components-maps~ProviderPin ProviderPin} instances.
|
|
980
|
+
* Provider map implementations return an instance of this class for their provider that you can use
|
|
981
|
+
* 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.
|
|
982
|
+
* Example using {@link module:@yext/components-maps~GoogleMaps GoogleMaps}, an instance of this
|
|
983
|
+
* class: GoogleMaps.load().then(() => map = new MapOptions().withProvider(GoogleMaps).build());
|
|
984
|
+
*/
|
|
985
|
+
declare class MapProvider {
|
|
986
|
+
/**
|
|
987
|
+
* @param {module:@yext/components-maps~MapProviderOptions} options
|
|
988
|
+
*/
|
|
989
|
+
constructor(options: any);
|
|
990
|
+
_loadFunction: any;
|
|
991
|
+
_mapClass: any;
|
|
992
|
+
_pinClass: any;
|
|
993
|
+
_providerName: any;
|
|
994
|
+
_loadPromise: Promise<any>;
|
|
995
|
+
_resolveLoad: (value: any) => void;
|
|
996
|
+
_rejectLoad: (reason?: any) => void;
|
|
997
|
+
_apiKey: string;
|
|
998
|
+
_loadInvoked: boolean;
|
|
999
|
+
_loaded: boolean;
|
|
1000
|
+
_options: {};
|
|
1001
|
+
/**
|
|
1002
|
+
* Returns true if the map provider has been successfully loaded
|
|
1003
|
+
* @type {boolean}
|
|
1004
|
+
*/
|
|
1005
|
+
get loaded(): boolean;
|
|
1006
|
+
/**
|
|
1007
|
+
* @returns {module:@yext/components-maps~ProviderMap}
|
|
1008
|
+
* @see module:@yext/components-maps~MapProviderOptions#withMapClass
|
|
1009
|
+
*/
|
|
1010
|
+
getMapClass(): any;
|
|
1011
|
+
/**
|
|
1012
|
+
* @returns {module:@yext/components-maps~ProviderPin}
|
|
1013
|
+
* @see module:@yext/components-maps~MapProviderOptions#withPinClass
|
|
1014
|
+
*/
|
|
1015
|
+
getPinClass(): any;
|
|
1016
|
+
/**
|
|
1017
|
+
* @returns {string}
|
|
1018
|
+
* @see module:@yext/components-maps~MapProviderOptions#withProviderName
|
|
1019
|
+
*/
|
|
1020
|
+
getProviderName(): string;
|
|
1021
|
+
/**
|
|
1022
|
+
* Call {@link module:@yext/components-maps~MapPinOptions~loadFunction MapPinOptions~loadFunction}
|
|
1023
|
+
* and resolve or reject when loading succeeds or fails
|
|
1024
|
+
* @async
|
|
1025
|
+
* @param {string} [apiKey] Provider API key -- uses value from {@link module:@yext/components-maps~MapProvider#setLoadOptions MapProvider#setLoadOptions}
|
|
1026
|
+
* if not passed
|
|
1027
|
+
* @param {Object} [options] Additional provider-specific options -- uses value from {@link module:@yext/components-maps~MapProvider#setLoadOptions MapProvider#setLoadOptions}
|
|
1028
|
+
* if not passed
|
|
1029
|
+
*/
|
|
1030
|
+
load(apiKey?: string | undefined, options?: Object | undefined): Promise<void>;
|
|
1031
|
+
/**
|
|
1032
|
+
* Resolves or rejects when the map provider has loaded successfully or unsuccessfully
|
|
1033
|
+
* @async
|
|
1034
|
+
*/
|
|
1035
|
+
ready(): Promise<void>;
|
|
1036
|
+
/**
|
|
1037
|
+
* Set the API key and provider options used on load. Does nothing if load was already called.
|
|
1038
|
+
* @param {string} apiKey Provider API key
|
|
1039
|
+
* @param {?Object} [options=null] Additional provider-specific options
|
|
1040
|
+
*/
|
|
1041
|
+
setLoadOptions(apiKey: string, options?: Object | null | undefined): void;
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
interface Coordinate {
|
|
1045
|
+
latitude: number;
|
|
1046
|
+
longitude: number;
|
|
1047
|
+
}
|
|
1048
|
+
interface MapContextType {
|
|
1049
|
+
map: Map$1;
|
|
1050
|
+
provider: MapProvider;
|
|
1051
|
+
}
|
|
1052
|
+
interface MapProps {
|
|
1053
|
+
apiKey?: string;
|
|
1054
|
+
bounds?: Coordinate[];
|
|
1055
|
+
className?: string;
|
|
1056
|
+
clientKey?: string;
|
|
1057
|
+
children?: any;
|
|
1058
|
+
controls: boolean;
|
|
1059
|
+
defaultCenter?: Coordinate;
|
|
1060
|
+
defaultZoom?: number;
|
|
1061
|
+
mapRef?: React__default.MutableRefObject<Map$1 | null>;
|
|
1062
|
+
padding?: number | {
|
|
1063
|
+
bottom: number | (() => number);
|
|
1064
|
+
left: number | (() => number);
|
|
1065
|
+
right: number | (() => number);
|
|
1066
|
+
top: number | (() => number);
|
|
1067
|
+
};
|
|
1068
|
+
panHandler: (previousBounds: GeoBounds, currentBounds: GeoBounds) => void;
|
|
1069
|
+
panStartHandler?: (currentBounds: GeoBounds) => void;
|
|
1070
|
+
provider: MapProvider;
|
|
1071
|
+
providerOptions?: {
|
|
1072
|
+
[key: string]: any;
|
|
1073
|
+
};
|
|
1074
|
+
singleZoom: number;
|
|
1075
|
+
}
|
|
1076
|
+
interface MarkerProps {
|
|
1077
|
+
children?: React__default.ReactChild;
|
|
1078
|
+
coordinate: Coordinate;
|
|
1079
|
+
hideOffscreen?: boolean;
|
|
1080
|
+
icon?: JSX.Element;
|
|
1081
|
+
id: string;
|
|
1082
|
+
onClick: (id: string) => void;
|
|
1083
|
+
onHover: (hovered: boolean, id: string) => void;
|
|
1084
|
+
onFocus: (focused: boolean, id: string) => void;
|
|
1085
|
+
statusOptions?: {
|
|
1086
|
+
[key: string]: boolean;
|
|
1087
|
+
};
|
|
1088
|
+
zIndex?: number;
|
|
1089
|
+
}
|
|
1090
|
+
type ClusterTemplateProps = {
|
|
1091
|
+
count?: number;
|
|
1092
|
+
};
|
|
1093
|
+
type ClustererProps = {
|
|
1094
|
+
clusterRadius?: number;
|
|
1095
|
+
children: JSX.Element[] | JSX.Element;
|
|
1096
|
+
ClusterTemplate?: (props: ClusterTemplateProps) => JSX.Element;
|
|
1097
|
+
};
|
|
1098
|
+
type PinStoreType = {
|
|
1099
|
+
id: string;
|
|
1100
|
+
pin: MapPin;
|
|
1101
|
+
};
|
|
1102
|
+
interface ClustererContextType {
|
|
1103
|
+
clusters: PinStoreType[][];
|
|
1104
|
+
clusterIds: string[];
|
|
1105
|
+
setPinStore: React__default.Dispatch<React__default.SetStateAction<PinStoreType[]>>;
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1108
|
+
declare function useMapContext(): Map$1;
|
|
1109
|
+
declare const Map: {
|
|
1110
|
+
({ apiKey, bounds, children, className, clientKey, controls, defaultCenter, defaultZoom, mapRef, padding, panStartHandler, panHandler, provider, providerOptions, singleZoom, }: MapProps): react_jsx_runtime.JSX.Element;
|
|
1111
|
+
defaultProps: {
|
|
1112
|
+
controls: boolean;
|
|
1113
|
+
defaultCenter: {
|
|
1114
|
+
latitude: number;
|
|
1115
|
+
longitude: number;
|
|
1116
|
+
};
|
|
1117
|
+
defaultZoom: number;
|
|
1118
|
+
padding: {
|
|
1119
|
+
bottom: number;
|
|
1120
|
+
left: number;
|
|
1121
|
+
right: number;
|
|
1122
|
+
top: number;
|
|
1123
|
+
};
|
|
1124
|
+
panHandler: () => null;
|
|
1125
|
+
panStartHandler: () => null;
|
|
1126
|
+
provider: any;
|
|
1127
|
+
providerOptions: {};
|
|
1128
|
+
singleZoom: number;
|
|
1129
|
+
};
|
|
1130
|
+
};
|
|
1131
|
+
|
|
1132
|
+
declare const Marker: {
|
|
1133
|
+
({ children, coordinate, hideOffscreen, id, icon, onClick, onFocus, onHover, zIndex, }: MarkerProps): JSX.Element | null;
|
|
1134
|
+
defaultProps: {
|
|
1135
|
+
hideOffscreen: boolean;
|
|
1136
|
+
icon: react_jsx_runtime.JSX.Element;
|
|
1137
|
+
onClick: () => null;
|
|
1138
|
+
onHover: () => null;
|
|
1139
|
+
onFocus: () => null;
|
|
1140
|
+
};
|
|
1141
|
+
};
|
|
1142
|
+
|
|
1143
|
+
declare function useClusterContext(): ClustererContextType;
|
|
1144
|
+
declare const Clusterer: ({ clusterRadius, children, ClusterTemplate, }: ClustererProps) => react_jsx_runtime.JSX.Element;
|
|
1145
|
+
|
|
1146
|
+
interface LocationMapProps extends MapProps {
|
|
1147
|
+
children?: React.ReactChild;
|
|
1148
|
+
coordinate: Coordinate;
|
|
1149
|
+
linkSameTab?: boolean;
|
|
1150
|
+
pinUrl?: string;
|
|
1151
|
+
onClick?: (id: string) => void;
|
|
1152
|
+
onHover?: (hovered: boolean, id: string) => void;
|
|
1153
|
+
onFocus?: (focused: boolean, id: string) => void;
|
|
1154
|
+
}
|
|
1155
|
+
|
|
1156
|
+
declare const LocationMap: {
|
|
1157
|
+
({ children, coordinate, linkSameTab, pinUrl, onClick, onHover, onFocus, ...mapProps }: LocationMapProps): react_jsx_runtime.JSX.Element;
|
|
1158
|
+
defaultProps: {
|
|
1159
|
+
controls: boolean;
|
|
1160
|
+
panHandler: () => null;
|
|
1161
|
+
provider: any;
|
|
1162
|
+
singleZoom: number;
|
|
1163
|
+
};
|
|
1164
|
+
};
|
|
1165
|
+
|
|
1166
|
+
/**
|
|
1167
|
+
* The shape of data passed to {@link LexicalRichText}.
|
|
1168
|
+
*/
|
|
1169
|
+
interface LexicalRichTextProps {
|
|
1170
|
+
/** A JSON-serialized Lexical Dev AST. */
|
|
1171
|
+
serializedAST: string;
|
|
1172
|
+
/** CSS Class names for the various Lexical Node types. */
|
|
1173
|
+
nodeClassNames?: EditorThemeClasses;
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
/**
|
|
1177
|
+
* Renders a read-only view of a Lexical Rich Text field. Styling for the various
|
|
1178
|
+
* types of Rich Text element can be optionally provided. If not provided, Yext default
|
|
1179
|
+
* styling will be applied.
|
|
1180
|
+
*/
|
|
1181
|
+
declare function LexicalRichText({ serializedAST, nodeClassNames, }: LexicalRichTextProps): react_jsx_runtime.JSX.Element;
|
|
1182
|
+
|
|
1183
|
+
/**
|
|
1184
|
+
* A Component for rendering the legacy rich text field. This field's value
|
|
1185
|
+
* is stored as "Yext" Markdown.
|
|
1186
|
+
*/
|
|
1187
|
+
declare const LegacyRichText: (props: {
|
|
1188
|
+
markdown: string;
|
|
1189
|
+
}) => ReactElement<any, string | React$1.JSXElementConstructor<any>> | null;
|
|
1190
|
+
|
|
1191
|
+
declare class HoursIntervalManipulator {
|
|
1192
|
+
end: Date;
|
|
1193
|
+
start: Date;
|
|
1194
|
+
/**
|
|
1195
|
+
* @param date - the Date for the day on which the interval starts
|
|
1196
|
+
* @param interval - the Yext Streams interval data
|
|
1197
|
+
*/
|
|
1198
|
+
constructor(date: Date, interval: IntervalType);
|
|
1199
|
+
/**
|
|
1200
|
+
* @param date - A moment in time
|
|
1201
|
+
* @returns True if the given moment is within the interval
|
|
1202
|
+
*/
|
|
1203
|
+
contains(date: Date): boolean;
|
|
1204
|
+
/**
|
|
1205
|
+
* @param opts - intl.DateTimeFormatOptions
|
|
1206
|
+
* @param locale - defaults to 'en-US'
|
|
1207
|
+
* @returns representation of this interval's start time
|
|
1208
|
+
*/
|
|
1209
|
+
getStartTime(locale?: string, opts?: Intl.DateTimeFormatOptions): string;
|
|
1210
|
+
/**
|
|
1211
|
+
* @param opts - intl.DateTimeFormatOptions
|
|
1212
|
+
* @param locale - defaults to 'en-US'
|
|
1213
|
+
* @returns representation of this interval's end time
|
|
1214
|
+
*/
|
|
1215
|
+
getEndTime(locale?: string, opts?: Intl.DateTimeFormatOptions): string;
|
|
1216
|
+
/**
|
|
1217
|
+
* @param other - HoursIntervalManipulator
|
|
1218
|
+
* @returns if this interval and 'other' have the same start/end
|
|
1219
|
+
*/
|
|
1220
|
+
timeIsEqualTo(other: HoursIntervalManipulator): boolean;
|
|
1221
|
+
}
|
|
1222
|
+
declare class HoursManipulator {
|
|
1223
|
+
holidayHoursByDate: Record<string, HolidayType>;
|
|
1224
|
+
hours: HoursType;
|
|
1225
|
+
/**
|
|
1226
|
+
* @param hours - Hours object in the format returned by Yext Streams
|
|
1227
|
+
*/
|
|
1228
|
+
constructor(hours: HoursType);
|
|
1229
|
+
/**
|
|
1230
|
+
* @param date - A moment in time
|
|
1231
|
+
* @returns The first interval that contains the given moment, null if none
|
|
1232
|
+
*/
|
|
1233
|
+
getInterval(date: Date): HoursIntervalManipulator | null;
|
|
1234
|
+
/**
|
|
1235
|
+
* @returns The first interval that contains the current time, null if none
|
|
1236
|
+
*/
|
|
1237
|
+
getCurrentInterval(): HoursIntervalManipulator | null;
|
|
1238
|
+
/**
|
|
1239
|
+
* @param date - A moment in time
|
|
1240
|
+
* @returns The next interval that hasn't started as of the given moment
|
|
1241
|
+
*/
|
|
1242
|
+
getIntervalAfter(date: Date): HoursIntervalManipulator | null;
|
|
1243
|
+
/**
|
|
1244
|
+
* @returns The next interval that hasn't started as of the current time
|
|
1245
|
+
*/
|
|
1246
|
+
getNextInterval(): HoursIntervalManipulator | null;
|
|
1247
|
+
/**
|
|
1248
|
+
* @param n - number of days to check
|
|
1249
|
+
* @param startDate - first day to check
|
|
1250
|
+
* @returns list of intervals in range [startDate, startDate+7]
|
|
1251
|
+
*/
|
|
1252
|
+
getIntervalsForNDays(n: number, startDate: Date): HoursIntervalManipulator[];
|
|
1253
|
+
/**
|
|
1254
|
+
* @param date - The day to get the hours for
|
|
1255
|
+
* @returns The daily holiday hours object from the original Streams response for the
|
|
1256
|
+
* given date, null if none
|
|
1257
|
+
*/
|
|
1258
|
+
getHolidayHours(date: Date): HolidayType | null;
|
|
1259
|
+
/**
|
|
1260
|
+
* @param date - The day to get the hours for
|
|
1261
|
+
* @returns The daily normal hours object from the original Streams response for the
|
|
1262
|
+
* given date, null if none
|
|
1263
|
+
*/
|
|
1264
|
+
getNormalHours(date: Date): DayType | null;
|
|
1265
|
+
/**
|
|
1266
|
+
* @param date - The day to get the hours for
|
|
1267
|
+
* @returns The daily hours object from the original Streams response for the given
|
|
1268
|
+
* date, null if none
|
|
1269
|
+
*/
|
|
1270
|
+
getHours(date: Date): DayType | HolidayType | null;
|
|
1271
|
+
/**
|
|
1272
|
+
* @param date - A day
|
|
1273
|
+
* @returns True if the given day has holiday hours
|
|
1274
|
+
*/
|
|
1275
|
+
isHoliday(date: Date): boolean;
|
|
1276
|
+
/**
|
|
1277
|
+
* Yext platform uses the field `hours.reopenDate` to indicate an entity is
|
|
1278
|
+
* temporarily closed for more than one day.
|
|
1279
|
+
* @param targetDate - the date to check against
|
|
1280
|
+
* @returns True if the given date is before 'reopenDate'
|
|
1281
|
+
*/
|
|
1282
|
+
isTemporarilyClosedAt(targetDate: Date): boolean;
|
|
1283
|
+
/**
|
|
1284
|
+
* @param date - A moment in time
|
|
1285
|
+
* @returns True if the given moment falls within any interval
|
|
1286
|
+
*/
|
|
1287
|
+
isOpenAt(date: Date): boolean;
|
|
1288
|
+
/**
|
|
1289
|
+
* @returns True if the current time falls within any interval
|
|
1290
|
+
*/
|
|
1291
|
+
isOpenNow(): boolean;
|
|
1292
|
+
/**
|
|
1293
|
+
* Convert ISO Date which have 1-based months, to Yext date string which have 0-based months
|
|
1294
|
+
* @param date - a moment in time
|
|
1295
|
+
* @returns a Yext date string
|
|
1296
|
+
*/
|
|
1297
|
+
transformDateToYext(date: Date): string;
|
|
1298
|
+
}
|
|
1299
|
+
|
|
1300
|
+
interface WeekType {
|
|
1301
|
+
monday?: DayType;
|
|
1302
|
+
tuesday?: DayType;
|
|
1303
|
+
wednesday?: DayType;
|
|
1304
|
+
thursday?: DayType;
|
|
1305
|
+
friday?: DayType;
|
|
1306
|
+
saturday?: DayType;
|
|
1307
|
+
sunday?: DayType;
|
|
1308
|
+
}
|
|
1309
|
+
interface DayType {
|
|
1310
|
+
isClosed: boolean;
|
|
1311
|
+
openIntervals: IntervalType[];
|
|
1312
|
+
}
|
|
1313
|
+
interface HolidayType {
|
|
1314
|
+
date: string;
|
|
1315
|
+
isClosed?: boolean;
|
|
1316
|
+
openIntervals: IntervalType[];
|
|
1317
|
+
isRegularHours: boolean;
|
|
1318
|
+
}
|
|
1319
|
+
interface IntervalType {
|
|
1320
|
+
start: string;
|
|
1321
|
+
end: string;
|
|
1322
|
+
}
|
|
1323
|
+
interface HoursType extends WeekType {
|
|
1324
|
+
holidayHours?: HolidayType[];
|
|
1325
|
+
reopenDate?: string;
|
|
1326
|
+
}
|
|
1327
|
+
type DayOfWeekNames = {
|
|
1328
|
+
[Property in keyof WeekType]?: string;
|
|
1329
|
+
};
|
|
1330
|
+
interface HoursTableProps {
|
|
1331
|
+
/** Hours data from Yext Streams */
|
|
1332
|
+
hours: HoursType;
|
|
1333
|
+
/** Label for each day of week, ordered starting from Sunday */
|
|
1334
|
+
dayOfWeekNames?: DayOfWeekNames;
|
|
1335
|
+
/** Set the day of the first row of the table */
|
|
1336
|
+
startOfWeek?: keyof DayOfWeekNames | "today";
|
|
1337
|
+
timeOptions?: Intl.DateTimeFormatOptions;
|
|
1338
|
+
/** Combine adjacent rows (days) with the same intervals */
|
|
1339
|
+
collapseDays?: boolean;
|
|
1340
|
+
/** Override rendering for the interval on each table row */
|
|
1341
|
+
intervalStringsBuilderFn?: (h: HoursTableDayData, t?: Intl.DateTimeFormatOptions) => string[];
|
|
1342
|
+
className?: string;
|
|
1343
|
+
}
|
|
1344
|
+
interface HoursTableDayData {
|
|
1345
|
+
dayOfWeek: string;
|
|
1346
|
+
intervals: HoursIntervalManipulator[];
|
|
1347
|
+
sortIdx: number;
|
|
1348
|
+
isToday: boolean;
|
|
1349
|
+
startDay?: string;
|
|
1350
|
+
endDay?: string;
|
|
1351
|
+
}
|
|
1352
|
+
|
|
1353
|
+
/**
|
|
1354
|
+
* The HoursTable component uses HoursManipulator data to generate a table
|
|
1355
|
+
* listing the business hours of the entity.
|
|
1356
|
+
*/
|
|
1357
|
+
declare const Hours: React__default.FC<HoursTableProps>;
|
|
1358
|
+
|
|
1359
|
+
/**
|
|
1360
|
+
* @type {module:@yext/components-maps~MapProvider}
|
|
1361
|
+
*/
|
|
1362
|
+
declare const BaiduMaps: any;
|
|
1363
|
+
|
|
1364
|
+
/**
|
|
1365
|
+
* @type {module:@yext/components-maps~MapProvider}
|
|
1366
|
+
*/
|
|
1367
|
+
declare const BingMaps: any;
|
|
1368
|
+
|
|
1369
|
+
/**
|
|
1370
|
+
* @type {module:@yext/components-maps~MapProvider}
|
|
1371
|
+
*/
|
|
1372
|
+
declare const GoogleMaps: any;
|
|
1373
|
+
|
|
1374
|
+
/**
|
|
1375
|
+
* @type {module:@yext/components-maps~MapProvider}
|
|
1376
|
+
*/
|
|
1377
|
+
declare const MapboxMaps: any;
|
|
1378
|
+
|
|
1379
|
+
/**
|
|
1380
|
+
* @type {module:@yext/components-maps~MapProvider}
|
|
1381
|
+
*/
|
|
1382
|
+
declare const LeafletMaps: any;
|
|
1383
|
+
|
|
1384
|
+
/**
|
|
1385
|
+
* @type {module:@yext/components-maps~MapProvider}
|
|
1386
|
+
*/
|
|
1387
|
+
declare const MapQuestMaps: any;
|
|
1388
|
+
|
|
1389
|
+
export { Address, type AddressLine, type AddressLineProps, type AddressProps, type AddressType, Analytics, AnalyticsContext, AnalyticsProvider, AnalyticsScopeProvider, BaiduMaps, BingMaps, type CTA, type CTAWithChildrenLinkProps, type CTAWithoutChildrenLinkProps, type ClusterTemplateProps, Clusterer, type ClustererContextType, type ClustererProps, type ComplexImageType, type Coordinate, type DayOfWeekNames, type DayType, type GetDirectionsConfig, GoogleMaps, type HREFLinkProps, type HolidayType, Hours, HoursManipulator, 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, LocationMap, type LocationMapProps, Map, type MapContextType, type MapProps, type MapProvider$1 as MapProvider, MapProviderOption, MapQuestMaps, MapboxMaps, Marker, type MarkerProps, type PinStoreType, type ThumbnailType, type WeekType, getDirections, useAnalytics, useClusterContext, useIdentify, useMapContext, usePageView, useScope, useTrack };
|