@yext/pages-components 1.0.0-rc.9 → 1.0.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/THIRD-PARTY-NOTICES +2 -32
- package/dist/debugger-B7hxI1lw.cjs +1 -0
- package/dist/debugger-BZHlGtkp.js +286 -0
- package/dist/{index-B7qp2Vga.js → index-BDDHMUxc.js} +2209 -2256
- package/dist/index-CPtU5eOw.cjs +104 -0
- package/dist/{index-CNu7g_AK.js → index-DaOqO1Xz.js} +11352 -12470
- package/dist/index-De2GfwGG.cjs +45 -0
- package/dist/index.d.cts +69 -107
- package/dist/index.d.ts +69 -107
- package/dist/pages-components.cjs +1 -1
- package/dist/pages-components.js +29 -28
- package/package.json +17 -22
- package/dist/debugger-DzRFl2aD.js +0 -220
- package/dist/debugger-x0jOMtzI.cjs +0 -1
- package/dist/index-5cVqTMnt.cjs +0 -47
- package/dist/index-DJPbIPVY.cjs +0 -103
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { Action } from '@yext/analytics';
|
|
2
3
|
import * as React$1 from 'react';
|
|
3
|
-
import React__default, {
|
|
4
|
-
import { ConversionDetails, Visitor } from '@yext/analytics';
|
|
4
|
+
import React__default, { PropsWithChildren, ReactElement } from 'react';
|
|
5
5
|
import { EditorThemeClasses } from 'lexical';
|
|
6
6
|
import { DateTime } from 'luxon';
|
|
7
7
|
|
|
@@ -132,6 +132,14 @@ interface TemplateProps<T = Record<string, any>> {
|
|
|
132
132
|
document: T;
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
+
type TrackProps = {
|
|
136
|
+
action: Action;
|
|
137
|
+
destinationUrl: string;
|
|
138
|
+
scope?: string;
|
|
139
|
+
eventName?: string;
|
|
140
|
+
amount?: number;
|
|
141
|
+
currency?: string;
|
|
142
|
+
};
|
|
135
143
|
/**
|
|
136
144
|
* The AnalyticsMethod interface specifies the methods that can be used with
|
|
137
145
|
* the Analytics Provider.
|
|
@@ -144,48 +152,26 @@ interface AnalyticsMethods {
|
|
|
144
152
|
* @param eventName - the name of the event, will appear in Yext's Report Builder UI
|
|
145
153
|
* @param conversionData - optional details for tracking an event as a conversion
|
|
146
154
|
*/
|
|
147
|
-
track(
|
|
155
|
+
track(props: TrackProps): Promise<void>;
|
|
148
156
|
/**
|
|
149
157
|
* The identify method will allow you to tie analytics events to a specific user.
|
|
150
158
|
*
|
|
151
159
|
* @param visitor - the Visitor object
|
|
152
160
|
*/
|
|
153
|
-
identify(visitor:
|
|
161
|
+
identify(visitor: Record<string, string>): void;
|
|
154
162
|
/**
|
|
155
163
|
* The pageView method will track a pageview event.
|
|
156
164
|
*/
|
|
157
165
|
pageView(): Promise<void>;
|
|
158
|
-
/**
|
|
159
|
-
* trackClick will return an event handler that delays navigation to allow
|
|
160
|
-
* a click event to send. To use it you simply pass it to the onClick prop,
|
|
161
|
-
* like so:
|
|
162
|
-
* ```ts
|
|
163
|
-
* <a onClick={trackClick('my click')}
|
|
164
|
-
* ```
|
|
165
|
-
*/
|
|
166
|
-
trackClick(eventName: string, conversionData?: ConversionDetails): (e: MouseEvent<HTMLAnchorElement>) => Promise<void>;
|
|
167
166
|
/**
|
|
168
167
|
* The optIn method should be called when a user opts into analytics tracking,
|
|
169
168
|
* e.g. via a Consent Management Banner or other opt-in method.
|
|
170
169
|
*/
|
|
171
170
|
optIn(): Promise<void>;
|
|
172
|
-
/**
|
|
173
|
-
* Use the enableTrackingCookie method to enable conversion tracking on
|
|
174
|
-
* your page. This should be done only if you have conversion tracking
|
|
175
|
-
* configured in your Yext account.
|
|
176
|
-
*/
|
|
177
|
-
enableTrackingCookie(): void;
|
|
178
171
|
/**
|
|
179
172
|
* Use the getDebugEnabled method to retrieve whether debugging is on or off.
|
|
180
173
|
*/
|
|
181
174
|
getDebugEnabled(): boolean;
|
|
182
|
-
/**
|
|
183
|
-
* Use the setDebugEnabled method to toggle debugging on or off. Currently,
|
|
184
|
-
* this will log tracked events to the dev console.
|
|
185
|
-
*
|
|
186
|
-
* @param enabled - boolean value for whethere debugging should be on or off.
|
|
187
|
-
*/
|
|
188
|
-
setDebugEnabled(enabled: boolean): void;
|
|
189
175
|
}
|
|
190
176
|
/**
|
|
191
177
|
* The AnalyticsProviderProps interface represents the component properties
|
|
@@ -194,10 +180,21 @@ interface AnalyticsMethods {
|
|
|
194
180
|
* @public
|
|
195
181
|
*/
|
|
196
182
|
interface AnalyticsProviderProps {
|
|
183
|
+
/**
|
|
184
|
+
* The API Key or OAuth for accessing the Analytics Events API
|
|
185
|
+
*/
|
|
186
|
+
apiKey: string;
|
|
197
187
|
/**
|
|
198
188
|
* The TemplateProps that come from the rendering system
|
|
199
189
|
*/
|
|
200
190
|
templateData: TemplateProps;
|
|
191
|
+
/**
|
|
192
|
+
* The ISO 4217 currency code of the currency the value is expressed in.
|
|
193
|
+
* For example, "USD" for US dollars.
|
|
194
|
+
*
|
|
195
|
+
* For more information see https://www.iso.org/iso-4217-currency-codes.html.
|
|
196
|
+
*/
|
|
197
|
+
currency: string;
|
|
201
198
|
/**
|
|
202
199
|
* requireOptIn should be set to true if your compliance requirements require
|
|
203
200
|
* you to put all marketing analytics behind a user opt-in banner or if you
|
|
@@ -205,23 +202,18 @@ interface AnalyticsProviderProps {
|
|
|
205
202
|
*/
|
|
206
203
|
requireOptIn?: boolean | undefined;
|
|
207
204
|
/**
|
|
208
|
-
*
|
|
209
|
-
* trackable action on your site, such as a page view,
|
|
205
|
+
* disableSessionTracking will set sessionId to undefined in the event payload
|
|
206
|
+
* when a user does any trackable action on your site, such as a page view,
|
|
207
|
+
* click, etc.
|
|
210
208
|
*/
|
|
211
|
-
|
|
209
|
+
disableSessionTracking?: boolean | undefined;
|
|
212
210
|
/**
|
|
213
211
|
* enableDebugging can be set to true if you want to expose tracked events
|
|
214
212
|
* in the developer console.
|
|
215
213
|
*/
|
|
216
214
|
enableDebugging?: boolean | undefined;
|
|
217
215
|
/**
|
|
218
|
-
*
|
|
219
|
-
* the hostname for the site ID is used. The domain string must include the
|
|
220
|
-
* scheme (e.g. https://foo.com).
|
|
221
|
-
*/
|
|
222
|
-
pageDomain?: string;
|
|
223
|
-
/**
|
|
224
|
-
* isStaging() will evaluate to false if the the event is fired from any of
|
|
216
|
+
* isProduction() will evaluate to true if the event is fired from any of
|
|
225
217
|
* provided domains in productionDomains.
|
|
226
218
|
*/
|
|
227
219
|
productionDomains?: string[];
|
|
@@ -254,43 +246,38 @@ interface AnalyticsScopeProps {
|
|
|
254
246
|
* @public
|
|
255
247
|
*/
|
|
256
248
|
declare class Analytics implements AnalyticsMethods {
|
|
249
|
+
private apiKey;
|
|
250
|
+
private defaultCurrency;
|
|
257
251
|
private templateData;
|
|
258
|
-
private
|
|
259
|
-
private productionDomains;
|
|
252
|
+
private enableDebugging;
|
|
260
253
|
private _optedIn;
|
|
261
|
-
private
|
|
262
|
-
private
|
|
263
|
-
private _analyticsReporter;
|
|
254
|
+
private _sessionTrackingEnabled;
|
|
255
|
+
private _analyticsEventService;
|
|
264
256
|
private _pageViewFired;
|
|
265
|
-
private _enableDebugging;
|
|
266
257
|
/**
|
|
267
258
|
* Creates an Analytics instance, will fire a pageview event if requireOptin
|
|
268
259
|
* is false
|
|
269
260
|
*
|
|
261
|
+
* @param apiKey - the Yext API key for authorizing analytics events
|
|
262
|
+
* @param defaultCurrency - the ISO 4217 currency code to use for valued events
|
|
270
263
|
* @param templateData - template data object from the pages system
|
|
271
264
|
* @param requireOptIn - boolean, set to true if you require user opt in before tracking analytics
|
|
265
|
+
* @param disableSessionTracking - turns off session tracking
|
|
266
|
+
* @param enableDebugging - turns debug mode on meaning requests are logged instead
|
|
272
267
|
*/
|
|
273
|
-
constructor(templateData: TemplateProps, requireOptIn?: boolean
|
|
274
|
-
private calculatePageType;
|
|
268
|
+
constructor(apiKey: string, defaultCurrency: string, templateData: TemplateProps, requireOptIn?: boolean, disableSessionTracking?: boolean, enableDebugging?: boolean);
|
|
275
269
|
private makeReporter;
|
|
276
270
|
private canTrack;
|
|
277
|
-
private setupConversionTracking;
|
|
278
|
-
/** {@inheritDoc AnalyticsMethods.enableConversionTracking} */
|
|
279
|
-
enableTrackingCookie(): void;
|
|
280
271
|
/** {@inheritDoc AnalyticsMethods.identify} */
|
|
281
|
-
identify(visitor:
|
|
272
|
+
identify(visitor: Record<string, string>): void;
|
|
282
273
|
/** {@inheritDoc AnalyticsMethods.async} */
|
|
283
274
|
optIn(): Promise<void>;
|
|
284
275
|
/** {@inheritDoc AnalyticsMethods.async} */
|
|
285
276
|
pageView(): Promise<void>;
|
|
286
277
|
/** {@inheritDoc AnalyticsMethods.track} */
|
|
287
|
-
track(
|
|
278
|
+
track(props: TrackProps): Promise<void>;
|
|
288
279
|
/** {@inheritDoc AnalyticsMethods.getDebugEnabled} */
|
|
289
280
|
getDebugEnabled(): boolean;
|
|
290
|
-
/** {@inheritDoc AnalyticsMethods.setDebugEnabled} */
|
|
291
|
-
setDebugEnabled(enabled: boolean): void;
|
|
292
|
-
/** {@inheritDoc AnalyticsMethods.trackClick} */
|
|
293
|
-
trackClick(eventName: string, conversionData?: ConversionDetails): (e: MouseEvent<HTMLAnchorElement>) => Promise<void>;
|
|
294
281
|
}
|
|
295
282
|
|
|
296
283
|
/**
|
|
@@ -307,7 +294,7 @@ declare global {
|
|
|
307
294
|
}
|
|
308
295
|
/**
|
|
309
296
|
* The useAnalytics hook can be used anywhere in the tree below a configured
|
|
310
|
-
* AnalyticsProvider.
|
|
297
|
+
* AnalyticsProvider. Calling it will return an object to give you access to
|
|
311
298
|
* the analytics convenience methods for use in your components,
|
|
312
299
|
* such as track(), pageView(), optIn() etc.
|
|
313
300
|
*
|
|
@@ -319,9 +306,9 @@ declare function useAnalytics(): AnalyticsMethods | null;
|
|
|
319
306
|
*
|
|
320
307
|
* @public
|
|
321
308
|
*/
|
|
322
|
-
declare const useTrack: () => ((
|
|
309
|
+
declare const useTrack: () => ((props: TrackProps) => Promise<void>) | undefined;
|
|
323
310
|
/**
|
|
324
|
-
* Simpler hook that just returns
|
|
311
|
+
* Simpler hook that just returns the analytics pageView method
|
|
325
312
|
*
|
|
326
313
|
* @public
|
|
327
314
|
*/
|
|
@@ -331,7 +318,7 @@ declare const usePageView: () => (() => Promise<void>) | undefined;
|
|
|
331
318
|
*
|
|
332
319
|
* @public
|
|
333
320
|
*/
|
|
334
|
-
declare const useIdentify: () => ((visitor:
|
|
321
|
+
declare const useIdentify: () => ((visitor: Record<string, string>) => void) | undefined;
|
|
335
322
|
|
|
336
323
|
/**
|
|
337
324
|
* The main Analytics component for you to use. Sets up the proper react context
|
|
@@ -532,9 +519,22 @@ interface CTA {
|
|
|
532
519
|
* Configuration options available for any usages of the Link component.
|
|
533
520
|
*/
|
|
534
521
|
interface LinkConfig extends React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement> {
|
|
522
|
+
/** Obfuscates the href and label. */
|
|
535
523
|
obfuscate?: boolean;
|
|
524
|
+
/** The custom name of the event. */
|
|
536
525
|
eventName?: string;
|
|
537
|
-
|
|
526
|
+
/** Scope the specific link event. Overrides the scope set by the provider. */
|
|
527
|
+
scope?: string;
|
|
528
|
+
/**
|
|
529
|
+
* The ISO 4217 currency code of the currency the value is expressed in.
|
|
530
|
+
* Overrides the defaultCurrency set on the provider.
|
|
531
|
+
* For example, "USD" for US dollars.
|
|
532
|
+
*
|
|
533
|
+
* For more information see https://www.iso.org/iso-4217-currency-codes.html.
|
|
534
|
+
*/
|
|
535
|
+
currency?: string;
|
|
536
|
+
/** The monetary value of the event. */
|
|
537
|
+
amount?: number;
|
|
538
538
|
}
|
|
539
539
|
/**
|
|
540
540
|
* The shape of the data passed to {@link Link} when directly passing an HREF to the Link component.
|
|
@@ -1062,7 +1062,7 @@ interface MapProps {
|
|
|
1062
1062
|
className?: string;
|
|
1063
1063
|
clientKey?: string;
|
|
1064
1064
|
children?: any;
|
|
1065
|
-
controls
|
|
1065
|
+
controls?: boolean;
|
|
1066
1066
|
defaultCenter?: Coordinate;
|
|
1067
1067
|
defaultZoom?: number;
|
|
1068
1068
|
mapRef?: React__default.MutableRefObject<Map$1 | null>;
|
|
@@ -1072,13 +1072,13 @@ interface MapProps {
|
|
|
1072
1072
|
right: number | (() => number);
|
|
1073
1073
|
top: number | (() => number);
|
|
1074
1074
|
};
|
|
1075
|
-
panHandler
|
|
1075
|
+
panHandler?: (previousBounds: GeoBounds, currentBounds: GeoBounds) => void;
|
|
1076
1076
|
panStartHandler?: (currentBounds: GeoBounds) => void;
|
|
1077
|
-
provider
|
|
1077
|
+
provider?: MapProvider;
|
|
1078
1078
|
providerOptions?: {
|
|
1079
1079
|
[key: string]: any;
|
|
1080
1080
|
};
|
|
1081
|
-
singleZoom
|
|
1081
|
+
singleZoom?: number;
|
|
1082
1082
|
}
|
|
1083
1083
|
interface MarkerProps {
|
|
1084
1084
|
children?: React__default.ReactChild;
|
|
@@ -1086,9 +1086,9 @@ interface MarkerProps {
|
|
|
1086
1086
|
hideOffscreen?: boolean;
|
|
1087
1087
|
icon?: JSX.Element;
|
|
1088
1088
|
id: string;
|
|
1089
|
-
onClick
|
|
1090
|
-
onHover
|
|
1091
|
-
onFocus
|
|
1089
|
+
onClick?: (id: string) => void;
|
|
1090
|
+
onHover?: (hovered: boolean, id: string) => void;
|
|
1091
|
+
onFocus?: (focused: boolean, id: string) => void;
|
|
1092
1092
|
statusOptions?: {
|
|
1093
1093
|
[key: string]: boolean;
|
|
1094
1094
|
};
|
|
@@ -1113,39 +1113,9 @@ interface ClustererContextType {
|
|
|
1113
1113
|
}
|
|
1114
1114
|
|
|
1115
1115
|
declare function useMapContext(): Map$1;
|
|
1116
|
-
declare const Map: {
|
|
1117
|
-
({ apiKey, bounds, children, className, clientKey, controls, defaultCenter, defaultZoom, mapRef, padding, panStartHandler, panHandler, provider, providerOptions, singleZoom, }: MapProps): react_jsx_runtime.JSX.Element;
|
|
1118
|
-
defaultProps: {
|
|
1119
|
-
controls: boolean;
|
|
1120
|
-
defaultCenter: {
|
|
1121
|
-
latitude: number;
|
|
1122
|
-
longitude: number;
|
|
1123
|
-
};
|
|
1124
|
-
defaultZoom: number;
|
|
1125
|
-
padding: {
|
|
1126
|
-
bottom: number;
|
|
1127
|
-
left: number;
|
|
1128
|
-
right: number;
|
|
1129
|
-
top: number;
|
|
1130
|
-
};
|
|
1131
|
-
panHandler: () => null;
|
|
1132
|
-
panStartHandler: () => null;
|
|
1133
|
-
provider: any;
|
|
1134
|
-
providerOptions: {};
|
|
1135
|
-
singleZoom: number;
|
|
1136
|
-
};
|
|
1137
|
-
};
|
|
1116
|
+
declare const Map: ({ apiKey, bounds, children, className, clientKey, controls, defaultCenter, defaultZoom, mapRef, padding, panHandler, panStartHandler, provider, providerOptions, singleZoom, }: MapProps) => react_jsx_runtime.JSX.Element;
|
|
1138
1117
|
|
|
1139
|
-
declare const Marker: {
|
|
1140
|
-
({ children, coordinate, hideOffscreen, id, icon, onClick, onFocus, onHover, zIndex, }: MarkerProps): JSX.Element | null;
|
|
1141
|
-
defaultProps: {
|
|
1142
|
-
hideOffscreen: boolean;
|
|
1143
|
-
icon: react_jsx_runtime.JSX.Element;
|
|
1144
|
-
onClick: () => null;
|
|
1145
|
-
onHover: () => null;
|
|
1146
|
-
onFocus: () => null;
|
|
1147
|
-
};
|
|
1148
|
-
};
|
|
1118
|
+
declare const Marker: ({ children, coordinate, hideOffscreen, id, icon, onClick, onFocus, onHover, zIndex, }: MarkerProps) => JSX.Element | null;
|
|
1149
1119
|
|
|
1150
1120
|
declare function useClusterContext(): ClustererContextType;
|
|
1151
1121
|
declare const Clusterer: ({ clusterRadius, children, ClusterTemplate, }: ClustererProps) => react_jsx_runtime.JSX.Element;
|
|
@@ -1160,15 +1130,7 @@ interface LocationMapProps extends MapProps {
|
|
|
1160
1130
|
onFocus?: (focused: boolean, id: string) => void;
|
|
1161
1131
|
}
|
|
1162
1132
|
|
|
1163
|
-
declare const LocationMap: {
|
|
1164
|
-
({ children, coordinate, linkSameTab, pinUrl, onClick, onHover, onFocus, ...mapProps }: LocationMapProps): react_jsx_runtime.JSX.Element;
|
|
1165
|
-
defaultProps: {
|
|
1166
|
-
controls: boolean;
|
|
1167
|
-
panHandler: () => null;
|
|
1168
|
-
provider: any;
|
|
1169
|
-
singleZoom: number;
|
|
1170
|
-
};
|
|
1171
|
-
};
|
|
1133
|
+
declare const LocationMap: ({ children, coordinate, linkSameTab, pinUrl, onClick, onHover, onFocus, ...mapProps }: LocationMapProps) => react_jsx_runtime.JSX.Element;
|
|
1172
1134
|
|
|
1173
1135
|
/**
|
|
1174
1136
|
* The shape of data passed to {@link LexicalRichText}.
|
|
@@ -1345,4 +1307,4 @@ declare const LeafletMaps: any;
|
|
|
1345
1307
|
*/
|
|
1346
1308
|
declare const MapQuestMaps: any;
|
|
1347
1309
|
|
|
1348
|
-
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, Day, type DayOfWeekNames, type DayType, type GetDirectionsConfig, GoogleMaps, type HREFLinkProps, type HolidayType, HoursStatus, HoursTable, type HoursTableDayData, type HoursTableProps, type HoursType, Image, type ImageLayout, ImageLayoutOption, type ImageProps, type ImageType, type IntervalType, LeafletMaps, LegacyRichText, LexicalRichText, type LexicalRichTextProps, Link, type LinkProps, type LinkType, LinkTypes, type ListingPublisher, ListingPublisherOption, type ListingType, 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 };
|
|
1310
|
+
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, Coordinate$1 as CoordinateClass, Day, type DayOfWeekNames, type DayType, type GetDirectionsConfig, GoogleMaps, type HREFLinkProps, type HolidayType, HoursStatus, HoursTable, type HoursTableDayData, type HoursTableProps, type HoursType, Image, type ImageLayout, ImageLayoutOption, type ImageProps, type ImageType, type IntervalType, LeafletMaps, LegacyRichText, LexicalRichText, type LexicalRichTextProps, Link, type LinkProps, type LinkType, LinkTypes, type ListingPublisher, ListingPublisherOption, type ListingType, 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { Action } from '@yext/analytics';
|
|
2
3
|
import * as React$1 from 'react';
|
|
3
|
-
import React__default, {
|
|
4
|
-
import { ConversionDetails, Visitor } from '@yext/analytics';
|
|
4
|
+
import React__default, { PropsWithChildren, ReactElement } from 'react';
|
|
5
5
|
import { EditorThemeClasses } from 'lexical';
|
|
6
6
|
import { DateTime } from 'luxon';
|
|
7
7
|
|
|
@@ -132,6 +132,14 @@ interface TemplateProps<T = Record<string, any>> {
|
|
|
132
132
|
document: T;
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
+
type TrackProps = {
|
|
136
|
+
action: Action;
|
|
137
|
+
destinationUrl: string;
|
|
138
|
+
scope?: string;
|
|
139
|
+
eventName?: string;
|
|
140
|
+
amount?: number;
|
|
141
|
+
currency?: string;
|
|
142
|
+
};
|
|
135
143
|
/**
|
|
136
144
|
* The AnalyticsMethod interface specifies the methods that can be used with
|
|
137
145
|
* the Analytics Provider.
|
|
@@ -144,48 +152,26 @@ interface AnalyticsMethods {
|
|
|
144
152
|
* @param eventName - the name of the event, will appear in Yext's Report Builder UI
|
|
145
153
|
* @param conversionData - optional details for tracking an event as a conversion
|
|
146
154
|
*/
|
|
147
|
-
track(
|
|
155
|
+
track(props: TrackProps): Promise<void>;
|
|
148
156
|
/**
|
|
149
157
|
* The identify method will allow you to tie analytics events to a specific user.
|
|
150
158
|
*
|
|
151
159
|
* @param visitor - the Visitor object
|
|
152
160
|
*/
|
|
153
|
-
identify(visitor:
|
|
161
|
+
identify(visitor: Record<string, string>): void;
|
|
154
162
|
/**
|
|
155
163
|
* The pageView method will track a pageview event.
|
|
156
164
|
*/
|
|
157
165
|
pageView(): Promise<void>;
|
|
158
|
-
/**
|
|
159
|
-
* trackClick will return an event handler that delays navigation to allow
|
|
160
|
-
* a click event to send. To use it you simply pass it to the onClick prop,
|
|
161
|
-
* like so:
|
|
162
|
-
* ```ts
|
|
163
|
-
* <a onClick={trackClick('my click')}
|
|
164
|
-
* ```
|
|
165
|
-
*/
|
|
166
|
-
trackClick(eventName: string, conversionData?: ConversionDetails): (e: MouseEvent<HTMLAnchorElement>) => Promise<void>;
|
|
167
166
|
/**
|
|
168
167
|
* The optIn method should be called when a user opts into analytics tracking,
|
|
169
168
|
* e.g. via a Consent Management Banner or other opt-in method.
|
|
170
169
|
*/
|
|
171
170
|
optIn(): Promise<void>;
|
|
172
|
-
/**
|
|
173
|
-
* Use the enableTrackingCookie method to enable conversion tracking on
|
|
174
|
-
* your page. This should be done only if you have conversion tracking
|
|
175
|
-
* configured in your Yext account.
|
|
176
|
-
*/
|
|
177
|
-
enableTrackingCookie(): void;
|
|
178
171
|
/**
|
|
179
172
|
* Use the getDebugEnabled method to retrieve whether debugging is on or off.
|
|
180
173
|
*/
|
|
181
174
|
getDebugEnabled(): boolean;
|
|
182
|
-
/**
|
|
183
|
-
* Use the setDebugEnabled method to toggle debugging on or off. Currently,
|
|
184
|
-
* this will log tracked events to the dev console.
|
|
185
|
-
*
|
|
186
|
-
* @param enabled - boolean value for whethere debugging should be on or off.
|
|
187
|
-
*/
|
|
188
|
-
setDebugEnabled(enabled: boolean): void;
|
|
189
175
|
}
|
|
190
176
|
/**
|
|
191
177
|
* The AnalyticsProviderProps interface represents the component properties
|
|
@@ -194,10 +180,21 @@ interface AnalyticsMethods {
|
|
|
194
180
|
* @public
|
|
195
181
|
*/
|
|
196
182
|
interface AnalyticsProviderProps {
|
|
183
|
+
/**
|
|
184
|
+
* The API Key or OAuth for accessing the Analytics Events API
|
|
185
|
+
*/
|
|
186
|
+
apiKey: string;
|
|
197
187
|
/**
|
|
198
188
|
* The TemplateProps that come from the rendering system
|
|
199
189
|
*/
|
|
200
190
|
templateData: TemplateProps;
|
|
191
|
+
/**
|
|
192
|
+
* The ISO 4217 currency code of the currency the value is expressed in.
|
|
193
|
+
* For example, "USD" for US dollars.
|
|
194
|
+
*
|
|
195
|
+
* For more information see https://www.iso.org/iso-4217-currency-codes.html.
|
|
196
|
+
*/
|
|
197
|
+
currency: string;
|
|
201
198
|
/**
|
|
202
199
|
* requireOptIn should be set to true if your compliance requirements require
|
|
203
200
|
* you to put all marketing analytics behind a user opt-in banner or if you
|
|
@@ -205,23 +202,18 @@ interface AnalyticsProviderProps {
|
|
|
205
202
|
*/
|
|
206
203
|
requireOptIn?: boolean | undefined;
|
|
207
204
|
/**
|
|
208
|
-
*
|
|
209
|
-
* trackable action on your site, such as a page view,
|
|
205
|
+
* disableSessionTracking will set sessionId to undefined in the event payload
|
|
206
|
+
* when a user does any trackable action on your site, such as a page view,
|
|
207
|
+
* click, etc.
|
|
210
208
|
*/
|
|
211
|
-
|
|
209
|
+
disableSessionTracking?: boolean | undefined;
|
|
212
210
|
/**
|
|
213
211
|
* enableDebugging can be set to true if you want to expose tracked events
|
|
214
212
|
* in the developer console.
|
|
215
213
|
*/
|
|
216
214
|
enableDebugging?: boolean | undefined;
|
|
217
215
|
/**
|
|
218
|
-
*
|
|
219
|
-
* the hostname for the site ID is used. The domain string must include the
|
|
220
|
-
* scheme (e.g. https://foo.com).
|
|
221
|
-
*/
|
|
222
|
-
pageDomain?: string;
|
|
223
|
-
/**
|
|
224
|
-
* isStaging() will evaluate to false if the the event is fired from any of
|
|
216
|
+
* isProduction() will evaluate to true if the event is fired from any of
|
|
225
217
|
* provided domains in productionDomains.
|
|
226
218
|
*/
|
|
227
219
|
productionDomains?: string[];
|
|
@@ -254,43 +246,38 @@ interface AnalyticsScopeProps {
|
|
|
254
246
|
* @public
|
|
255
247
|
*/
|
|
256
248
|
declare class Analytics implements AnalyticsMethods {
|
|
249
|
+
private apiKey;
|
|
250
|
+
private defaultCurrency;
|
|
257
251
|
private templateData;
|
|
258
|
-
private
|
|
259
|
-
private productionDomains;
|
|
252
|
+
private enableDebugging;
|
|
260
253
|
private _optedIn;
|
|
261
|
-
private
|
|
262
|
-
private
|
|
263
|
-
private _analyticsReporter;
|
|
254
|
+
private _sessionTrackingEnabled;
|
|
255
|
+
private _analyticsEventService;
|
|
264
256
|
private _pageViewFired;
|
|
265
|
-
private _enableDebugging;
|
|
266
257
|
/**
|
|
267
258
|
* Creates an Analytics instance, will fire a pageview event if requireOptin
|
|
268
259
|
* is false
|
|
269
260
|
*
|
|
261
|
+
* @param apiKey - the Yext API key for authorizing analytics events
|
|
262
|
+
* @param defaultCurrency - the ISO 4217 currency code to use for valued events
|
|
270
263
|
* @param templateData - template data object from the pages system
|
|
271
264
|
* @param requireOptIn - boolean, set to true if you require user opt in before tracking analytics
|
|
265
|
+
* @param disableSessionTracking - turns off session tracking
|
|
266
|
+
* @param enableDebugging - turns debug mode on meaning requests are logged instead
|
|
272
267
|
*/
|
|
273
|
-
constructor(templateData: TemplateProps, requireOptIn?: boolean
|
|
274
|
-
private calculatePageType;
|
|
268
|
+
constructor(apiKey: string, defaultCurrency: string, templateData: TemplateProps, requireOptIn?: boolean, disableSessionTracking?: boolean, enableDebugging?: boolean);
|
|
275
269
|
private makeReporter;
|
|
276
270
|
private canTrack;
|
|
277
|
-
private setupConversionTracking;
|
|
278
|
-
/** {@inheritDoc AnalyticsMethods.enableConversionTracking} */
|
|
279
|
-
enableTrackingCookie(): void;
|
|
280
271
|
/** {@inheritDoc AnalyticsMethods.identify} */
|
|
281
|
-
identify(visitor:
|
|
272
|
+
identify(visitor: Record<string, string>): void;
|
|
282
273
|
/** {@inheritDoc AnalyticsMethods.async} */
|
|
283
274
|
optIn(): Promise<void>;
|
|
284
275
|
/** {@inheritDoc AnalyticsMethods.async} */
|
|
285
276
|
pageView(): Promise<void>;
|
|
286
277
|
/** {@inheritDoc AnalyticsMethods.track} */
|
|
287
|
-
track(
|
|
278
|
+
track(props: TrackProps): Promise<void>;
|
|
288
279
|
/** {@inheritDoc AnalyticsMethods.getDebugEnabled} */
|
|
289
280
|
getDebugEnabled(): boolean;
|
|
290
|
-
/** {@inheritDoc AnalyticsMethods.setDebugEnabled} */
|
|
291
|
-
setDebugEnabled(enabled: boolean): void;
|
|
292
|
-
/** {@inheritDoc AnalyticsMethods.trackClick} */
|
|
293
|
-
trackClick(eventName: string, conversionData?: ConversionDetails): (e: MouseEvent<HTMLAnchorElement>) => Promise<void>;
|
|
294
281
|
}
|
|
295
282
|
|
|
296
283
|
/**
|
|
@@ -307,7 +294,7 @@ declare global {
|
|
|
307
294
|
}
|
|
308
295
|
/**
|
|
309
296
|
* The useAnalytics hook can be used anywhere in the tree below a configured
|
|
310
|
-
* AnalyticsProvider.
|
|
297
|
+
* AnalyticsProvider. Calling it will return an object to give you access to
|
|
311
298
|
* the analytics convenience methods for use in your components,
|
|
312
299
|
* such as track(), pageView(), optIn() etc.
|
|
313
300
|
*
|
|
@@ -319,9 +306,9 @@ declare function useAnalytics(): AnalyticsMethods | null;
|
|
|
319
306
|
*
|
|
320
307
|
* @public
|
|
321
308
|
*/
|
|
322
|
-
declare const useTrack: () => ((
|
|
309
|
+
declare const useTrack: () => ((props: TrackProps) => Promise<void>) | undefined;
|
|
323
310
|
/**
|
|
324
|
-
* Simpler hook that just returns
|
|
311
|
+
* Simpler hook that just returns the analytics pageView method
|
|
325
312
|
*
|
|
326
313
|
* @public
|
|
327
314
|
*/
|
|
@@ -331,7 +318,7 @@ declare const usePageView: () => (() => Promise<void>) | undefined;
|
|
|
331
318
|
*
|
|
332
319
|
* @public
|
|
333
320
|
*/
|
|
334
|
-
declare const useIdentify: () => ((visitor:
|
|
321
|
+
declare const useIdentify: () => ((visitor: Record<string, string>) => void) | undefined;
|
|
335
322
|
|
|
336
323
|
/**
|
|
337
324
|
* The main Analytics component for you to use. Sets up the proper react context
|
|
@@ -532,9 +519,22 @@ interface CTA {
|
|
|
532
519
|
* Configuration options available for any usages of the Link component.
|
|
533
520
|
*/
|
|
534
521
|
interface LinkConfig extends React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement> {
|
|
522
|
+
/** Obfuscates the href and label. */
|
|
535
523
|
obfuscate?: boolean;
|
|
524
|
+
/** The custom name of the event. */
|
|
536
525
|
eventName?: string;
|
|
537
|
-
|
|
526
|
+
/** Scope the specific link event. Overrides the scope set by the provider. */
|
|
527
|
+
scope?: string;
|
|
528
|
+
/**
|
|
529
|
+
* The ISO 4217 currency code of the currency the value is expressed in.
|
|
530
|
+
* Overrides the defaultCurrency set on the provider.
|
|
531
|
+
* For example, "USD" for US dollars.
|
|
532
|
+
*
|
|
533
|
+
* For more information see https://www.iso.org/iso-4217-currency-codes.html.
|
|
534
|
+
*/
|
|
535
|
+
currency?: string;
|
|
536
|
+
/** The monetary value of the event. */
|
|
537
|
+
amount?: number;
|
|
538
538
|
}
|
|
539
539
|
/**
|
|
540
540
|
* The shape of the data passed to {@link Link} when directly passing an HREF to the Link component.
|
|
@@ -1062,7 +1062,7 @@ interface MapProps {
|
|
|
1062
1062
|
className?: string;
|
|
1063
1063
|
clientKey?: string;
|
|
1064
1064
|
children?: any;
|
|
1065
|
-
controls
|
|
1065
|
+
controls?: boolean;
|
|
1066
1066
|
defaultCenter?: Coordinate;
|
|
1067
1067
|
defaultZoom?: number;
|
|
1068
1068
|
mapRef?: React__default.MutableRefObject<Map$1 | null>;
|
|
@@ -1072,13 +1072,13 @@ interface MapProps {
|
|
|
1072
1072
|
right: number | (() => number);
|
|
1073
1073
|
top: number | (() => number);
|
|
1074
1074
|
};
|
|
1075
|
-
panHandler
|
|
1075
|
+
panHandler?: (previousBounds: GeoBounds, currentBounds: GeoBounds) => void;
|
|
1076
1076
|
panStartHandler?: (currentBounds: GeoBounds) => void;
|
|
1077
|
-
provider
|
|
1077
|
+
provider?: MapProvider;
|
|
1078
1078
|
providerOptions?: {
|
|
1079
1079
|
[key: string]: any;
|
|
1080
1080
|
};
|
|
1081
|
-
singleZoom
|
|
1081
|
+
singleZoom?: number;
|
|
1082
1082
|
}
|
|
1083
1083
|
interface MarkerProps {
|
|
1084
1084
|
children?: React__default.ReactChild;
|
|
@@ -1086,9 +1086,9 @@ interface MarkerProps {
|
|
|
1086
1086
|
hideOffscreen?: boolean;
|
|
1087
1087
|
icon?: JSX.Element;
|
|
1088
1088
|
id: string;
|
|
1089
|
-
onClick
|
|
1090
|
-
onHover
|
|
1091
|
-
onFocus
|
|
1089
|
+
onClick?: (id: string) => void;
|
|
1090
|
+
onHover?: (hovered: boolean, id: string) => void;
|
|
1091
|
+
onFocus?: (focused: boolean, id: string) => void;
|
|
1092
1092
|
statusOptions?: {
|
|
1093
1093
|
[key: string]: boolean;
|
|
1094
1094
|
};
|
|
@@ -1113,39 +1113,9 @@ interface ClustererContextType {
|
|
|
1113
1113
|
}
|
|
1114
1114
|
|
|
1115
1115
|
declare function useMapContext(): Map$1;
|
|
1116
|
-
declare const Map: {
|
|
1117
|
-
({ apiKey, bounds, children, className, clientKey, controls, defaultCenter, defaultZoom, mapRef, padding, panStartHandler, panHandler, provider, providerOptions, singleZoom, }: MapProps): react_jsx_runtime.JSX.Element;
|
|
1118
|
-
defaultProps: {
|
|
1119
|
-
controls: boolean;
|
|
1120
|
-
defaultCenter: {
|
|
1121
|
-
latitude: number;
|
|
1122
|
-
longitude: number;
|
|
1123
|
-
};
|
|
1124
|
-
defaultZoom: number;
|
|
1125
|
-
padding: {
|
|
1126
|
-
bottom: number;
|
|
1127
|
-
left: number;
|
|
1128
|
-
right: number;
|
|
1129
|
-
top: number;
|
|
1130
|
-
};
|
|
1131
|
-
panHandler: () => null;
|
|
1132
|
-
panStartHandler: () => null;
|
|
1133
|
-
provider: any;
|
|
1134
|
-
providerOptions: {};
|
|
1135
|
-
singleZoom: number;
|
|
1136
|
-
};
|
|
1137
|
-
};
|
|
1116
|
+
declare const Map: ({ apiKey, bounds, children, className, clientKey, controls, defaultCenter, defaultZoom, mapRef, padding, panHandler, panStartHandler, provider, providerOptions, singleZoom, }: MapProps) => react_jsx_runtime.JSX.Element;
|
|
1138
1117
|
|
|
1139
|
-
declare const Marker: {
|
|
1140
|
-
({ children, coordinate, hideOffscreen, id, icon, onClick, onFocus, onHover, zIndex, }: MarkerProps): JSX.Element | null;
|
|
1141
|
-
defaultProps: {
|
|
1142
|
-
hideOffscreen: boolean;
|
|
1143
|
-
icon: react_jsx_runtime.JSX.Element;
|
|
1144
|
-
onClick: () => null;
|
|
1145
|
-
onHover: () => null;
|
|
1146
|
-
onFocus: () => null;
|
|
1147
|
-
};
|
|
1148
|
-
};
|
|
1118
|
+
declare const Marker: ({ children, coordinate, hideOffscreen, id, icon, onClick, onFocus, onHover, zIndex, }: MarkerProps) => JSX.Element | null;
|
|
1149
1119
|
|
|
1150
1120
|
declare function useClusterContext(): ClustererContextType;
|
|
1151
1121
|
declare const Clusterer: ({ clusterRadius, children, ClusterTemplate, }: ClustererProps) => react_jsx_runtime.JSX.Element;
|
|
@@ -1160,15 +1130,7 @@ interface LocationMapProps extends MapProps {
|
|
|
1160
1130
|
onFocus?: (focused: boolean, id: string) => void;
|
|
1161
1131
|
}
|
|
1162
1132
|
|
|
1163
|
-
declare const LocationMap: {
|
|
1164
|
-
({ children, coordinate, linkSameTab, pinUrl, onClick, onHover, onFocus, ...mapProps }: LocationMapProps): react_jsx_runtime.JSX.Element;
|
|
1165
|
-
defaultProps: {
|
|
1166
|
-
controls: boolean;
|
|
1167
|
-
panHandler: () => null;
|
|
1168
|
-
provider: any;
|
|
1169
|
-
singleZoom: number;
|
|
1170
|
-
};
|
|
1171
|
-
};
|
|
1133
|
+
declare const LocationMap: ({ children, coordinate, linkSameTab, pinUrl, onClick, onHover, onFocus, ...mapProps }: LocationMapProps) => react_jsx_runtime.JSX.Element;
|
|
1172
1134
|
|
|
1173
1135
|
/**
|
|
1174
1136
|
* The shape of data passed to {@link LexicalRichText}.
|
|
@@ -1345,4 +1307,4 @@ declare const LeafletMaps: any;
|
|
|
1345
1307
|
*/
|
|
1346
1308
|
declare const MapQuestMaps: any;
|
|
1347
1309
|
|
|
1348
|
-
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, Day, type DayOfWeekNames, type DayType, type GetDirectionsConfig, GoogleMaps, type HREFLinkProps, type HolidayType, HoursStatus, HoursTable, type HoursTableDayData, type HoursTableProps, type HoursType, Image, type ImageLayout, ImageLayoutOption, type ImageProps, type ImageType, type IntervalType, LeafletMaps, LegacyRichText, LexicalRichText, type LexicalRichTextProps, Link, type LinkProps, type LinkType, LinkTypes, type ListingPublisher, ListingPublisherOption, type ListingType, 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 };
|
|
1310
|
+
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, Coordinate$1 as CoordinateClass, Day, type DayOfWeekNames, type DayType, type GetDirectionsConfig, GoogleMaps, type HREFLinkProps, type HolidayType, HoursStatus, HoursTable, type HoursTableDayData, type HoursTableProps, type HoursType, Image, type ImageLayout, ImageLayoutOption, type ImageProps, type ImageType, type IntervalType, LeafletMaps, LegacyRichText, LexicalRichText, type LexicalRichTextProps, Link, type LinkProps, type LinkType, LinkTypes, type ListingPublisher, ListingPublisherOption, type ListingType, 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 };
|