@dynamo-caffeina-dev/locator-frontend 0.0.15 → 0.0.16
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/README.md +0 -8
- package/dist/{GoogleMapsProvider-BvlGYSW3.js → GoogleMapsProvider-C9ozlugV.js} +2 -2
- package/dist/{GoogleMapsProvider-BvlGYSW3.js.map → GoogleMapsProvider-C9ozlugV.js.map} +1 -1
- package/dist/{index-PUL4bgaJ.js → index-9sJqqbiV.js} +2854 -2711
- package/dist/index-9sJqqbiV.js.map +1 -0
- package/dist/index.d.ts +295 -20
- package/dist/index.es.js +4 -2
- package/dist/index.umd.js +55 -55
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/dist/index-PUL4bgaJ.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { ComponentType } from 'react';
|
|
|
4
4
|
import { default as default_2 } from 'react';
|
|
5
5
|
import { ForwardRefExoticComponent } from 'react';
|
|
6
6
|
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
7
|
+
import { LatLngLiteral } from 'google.maps';
|
|
7
8
|
import { LocationCardProps } from '../components/molecules/LocationCard/types';
|
|
8
9
|
import { LucideProps } from 'lucide-react';
|
|
9
10
|
import { PropsWithChildren } from 'react';
|
|
@@ -18,15 +19,74 @@ export declare type ActionDefinition = {
|
|
|
18
19
|
|
|
19
20
|
declare type ActionType = "share" | "directions" | "navigate" | "event" | "calendar" | "email";
|
|
20
21
|
|
|
22
|
+
/**
|
|
23
|
+
* Data structure for area search events
|
|
24
|
+
*/
|
|
25
|
+
export declare interface AreaSearchTrackingData extends BaseTrackingData {
|
|
26
|
+
/**
|
|
27
|
+
* Latitude of the search area center
|
|
28
|
+
*/
|
|
29
|
+
latitude: number;
|
|
30
|
+
/**
|
|
31
|
+
* Longitude of the search area center
|
|
32
|
+
*/
|
|
33
|
+
longitude: number;
|
|
34
|
+
/**
|
|
35
|
+
* Zoom level of the map
|
|
36
|
+
*/
|
|
37
|
+
zoom?: number;
|
|
38
|
+
/**
|
|
39
|
+
* Number of results found
|
|
40
|
+
*/
|
|
41
|
+
result_count?: number;
|
|
42
|
+
}
|
|
43
|
+
|
|
21
44
|
declare type AugmentedClusterType = ClusterType & {
|
|
22
45
|
onMarkerClick: () => Promise<void>;
|
|
23
46
|
};
|
|
24
47
|
|
|
48
|
+
export declare interface AutocompleteItemSelectTrackingData extends BaseTrackingData {
|
|
49
|
+
/**
|
|
50
|
+
* The item's label, as formatted by the map provider's autocomplete services
|
|
51
|
+
*/
|
|
52
|
+
label: string;
|
|
53
|
+
/**
|
|
54
|
+
* The item's address
|
|
55
|
+
*/
|
|
56
|
+
address?: string;
|
|
57
|
+
/**
|
|
58
|
+
* The item's city
|
|
59
|
+
*/
|
|
60
|
+
city?: string;
|
|
61
|
+
/**
|
|
62
|
+
* The item's province
|
|
63
|
+
*/
|
|
64
|
+
province?: string;
|
|
65
|
+
/**
|
|
66
|
+
* The item's region
|
|
67
|
+
*/
|
|
68
|
+
region?: string;
|
|
69
|
+
/**
|
|
70
|
+
* The item's country
|
|
71
|
+
*/
|
|
72
|
+
country?: string;
|
|
73
|
+
}
|
|
74
|
+
|
|
25
75
|
export declare interface BaseMapItem {
|
|
26
76
|
id: string;
|
|
27
77
|
coords: LatLngLiteral;
|
|
28
78
|
}
|
|
29
79
|
|
|
80
|
+
/**
|
|
81
|
+
* Common properties shared across all tracking events
|
|
82
|
+
*/
|
|
83
|
+
export declare interface BaseTrackingData {
|
|
84
|
+
/**
|
|
85
|
+
* Timestamp when the event occurred
|
|
86
|
+
*/
|
|
87
|
+
timestamp?: number;
|
|
88
|
+
}
|
|
89
|
+
|
|
30
90
|
declare type CapabilityGroupType = {
|
|
31
91
|
title?: string;
|
|
32
92
|
capabilities?: CapabilityType[];
|
|
@@ -51,6 +111,24 @@ declare type ComponentPropsMap = {
|
|
|
51
111
|
ctaButton: ButtonProps<"button">;
|
|
52
112
|
};
|
|
53
113
|
|
|
114
|
+
/**
|
|
115
|
+
* Data structure for CTA (Call to Action) events
|
|
116
|
+
*/
|
|
117
|
+
export declare interface CTATrackingData extends BaseTrackingData {
|
|
118
|
+
/**
|
|
119
|
+
* Type of CTA (e.g., primary, secondary)
|
|
120
|
+
*/
|
|
121
|
+
cta_event_type: string;
|
|
122
|
+
/**
|
|
123
|
+
* URL that the CTA points to
|
|
124
|
+
*/
|
|
125
|
+
cta_url?: string;
|
|
126
|
+
/**
|
|
127
|
+
* Label of the CTA
|
|
128
|
+
*/
|
|
129
|
+
cta_label?: string;
|
|
130
|
+
}
|
|
131
|
+
|
|
54
132
|
declare type CustomizableComponents = "locationCard" | "ctaButton";
|
|
55
133
|
|
|
56
134
|
declare interface EndpointDefinition {
|
|
@@ -69,6 +147,28 @@ declare type EndpointMapType = {
|
|
|
69
147
|
[K in EndpointId]?: EndpointDefinition;
|
|
70
148
|
};
|
|
71
149
|
|
|
150
|
+
/**
|
|
151
|
+
* Data structure for geolocation events
|
|
152
|
+
*/
|
|
153
|
+
export declare interface GeolocationTrackingData extends BaseTrackingData {
|
|
154
|
+
/**
|
|
155
|
+
* Whether geolocation was successful
|
|
156
|
+
*/
|
|
157
|
+
success: boolean;
|
|
158
|
+
/**
|
|
159
|
+
* Latitude if geolocation was successful
|
|
160
|
+
*/
|
|
161
|
+
latitude?: number;
|
|
162
|
+
/**
|
|
163
|
+
* Longitude if geolocation was successful
|
|
164
|
+
*/
|
|
165
|
+
longitude?: number;
|
|
166
|
+
/**
|
|
167
|
+
* Error message if geolocation failed
|
|
168
|
+
*/
|
|
169
|
+
error?: string;
|
|
170
|
+
}
|
|
171
|
+
|
|
72
172
|
declare type IconMapType = {
|
|
73
173
|
[K in IconName]: ForwardRefExoticComponent<Omit<LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
|
|
74
174
|
};
|
|
@@ -77,19 +177,35 @@ declare type IconName = "ArrowLeft" | "ArrowUpRight" | "ChevronUp" | "ChevronDow
|
|
|
77
177
|
|
|
78
178
|
declare type LocalizationConfigType = {
|
|
79
179
|
lang: string;
|
|
80
|
-
labels: Record<LocalizationKeysType, string
|
|
180
|
+
labels: Partial<Record<LocalizationKeysType, string>>;
|
|
81
181
|
};
|
|
82
182
|
|
|
83
183
|
declare type LocalizationKeysType = "InfoWindow.CTA_1" | "InfoWindow.CTA_2" | "LocationList.header" | "LocationList.locationDesignator" | "LocationList.noResults" | "Map.areaSearchButton" | "Map.areaSearchTooltip" | "Map.areaSearchVisualCueCTA" | "Search.geolocationButton" | "Search.placeholder" | "ShareSheet.copyLinkErrorNotif" | "ShareSheet.copyLinkSuccessNotif" | "ShareSheet.copyLinkTooltip" | "ShareSheet.genericShareTooltip" | "ShareSheet.shareViaEmailTooltip" | "ShareSheet.title";
|
|
84
184
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
185
|
+
/**
|
|
186
|
+
* Data structure for location selection events
|
|
187
|
+
*/
|
|
188
|
+
export declare interface LocationSelectTrackingData extends BaseTrackingData {
|
|
189
|
+
/**
|
|
190
|
+
* ID of the selected location
|
|
191
|
+
*/
|
|
192
|
+
location_id: string;
|
|
193
|
+
/**
|
|
194
|
+
* Name of the selected location
|
|
195
|
+
*/
|
|
196
|
+
location_name: string;
|
|
197
|
+
/**
|
|
198
|
+
* Address of the selected location
|
|
199
|
+
*/
|
|
200
|
+
location_address?: string;
|
|
201
|
+
/**
|
|
202
|
+
* Coordinates of the selected location
|
|
203
|
+
*/
|
|
204
|
+
location_coordinates?: {
|
|
205
|
+
lat: number;
|
|
206
|
+
lng: number;
|
|
207
|
+
};
|
|
208
|
+
}
|
|
93
209
|
|
|
94
210
|
/**
|
|
95
211
|
* The Locator config returned by a CMS,
|
|
@@ -157,7 +273,7 @@ declare type LocatorFeaturesType = {
|
|
|
157
273
|
* "Cluster": an aggregate of locations
|
|
158
274
|
* "Marker": a single location
|
|
159
275
|
*/
|
|
160
|
-
export declare
|
|
276
|
+
export declare interface LocatorProps extends LocatorConfig {
|
|
161
277
|
/**
|
|
162
278
|
* List of locations to display
|
|
163
279
|
*/
|
|
@@ -168,20 +284,21 @@ export declare type LocatorProps = LocatorConfig & {
|
|
|
168
284
|
*/
|
|
169
285
|
fetchLocations?: () => Promise<MapItem>;
|
|
170
286
|
/**
|
|
171
|
-
*
|
|
172
|
-
* Used to define custom icons that can extend or override default icon sets.
|
|
173
|
-
* Optional property.
|
|
174
|
-
*
|
|
175
|
-
* @type {IconMapType | undefined}
|
|
287
|
+
* Custom icons to override the default ones
|
|
176
288
|
*/
|
|
177
289
|
customIcons?: Partial<IconMapType>;
|
|
178
290
|
/**
|
|
179
|
-
* Custom components
|
|
180
|
-
*
|
|
291
|
+
* Custom components to override the default ones;
|
|
292
|
+
* each component must have the same props signature
|
|
181
293
|
* as the original component it's replacing.
|
|
182
294
|
*/
|
|
183
295
|
customComponents?: ComponentMapType;
|
|
184
|
-
|
|
296
|
+
/**
|
|
297
|
+
* Configuration for tracking events
|
|
298
|
+
* Specifies which events should be tracked and with what tracker functions
|
|
299
|
+
*/
|
|
300
|
+
trackingConfig?: TrackingConfig;
|
|
301
|
+
}
|
|
185
302
|
|
|
186
303
|
/**
|
|
187
304
|
* A higher-order component that wraps the core Locator component with necessary providers and error handling.
|
|
@@ -190,7 +307,7 @@ export declare type LocatorProps = LocatorConfig & {
|
|
|
190
307
|
* It encapsulates the core Locator component within the required context providers and error boundary.
|
|
191
308
|
*
|
|
192
309
|
*/
|
|
193
|
-
declare function LocatorWrapper({ mapProvider, endpoints, apiUrl, children, ...props }: PropsWithChildren<LocatorProps>):
|
|
310
|
+
declare function LocatorWrapper({ mapProvider, endpoints, apiUrl, children, ...props }: PropsWithChildren<LocatorProps>): default_2.JSX.Element;
|
|
194
311
|
|
|
195
312
|
declare namespace LocatorWrapper {
|
|
196
313
|
var displayName: string;
|
|
@@ -205,7 +322,7 @@ export declare enum MAP_DETAIL_LEVEL {
|
|
|
205
322
|
MARKER = 1
|
|
206
323
|
}
|
|
207
324
|
|
|
208
|
-
export declare type MapItem = Array<AugmentedClusterType |
|
|
325
|
+
export declare type MapItem = Array<AugmentedClusterType | MarkerType>;
|
|
209
326
|
|
|
210
327
|
export declare type MapProps = {
|
|
211
328
|
center?: LatLngLiteral;
|
|
@@ -220,8 +337,53 @@ export declare type MapProviderType = Partial<{
|
|
|
220
337
|
config?: Omit<APIProviderProps, "children" | "apiKey">;
|
|
221
338
|
}>;
|
|
222
339
|
|
|
340
|
+
export declare type MarkerType = BaseMapItem & {
|
|
341
|
+
title?: string;
|
|
342
|
+
timestamp?: string;
|
|
343
|
+
address?: string;
|
|
344
|
+
capabilities?: CapabilityGroupType[];
|
|
345
|
+
on_share?: SocialConfigType[];
|
|
346
|
+
actions?: ActionDefinition[];
|
|
347
|
+
};
|
|
348
|
+
|
|
223
349
|
export declare function Search(): default_2.JSX.Element | null;
|
|
224
350
|
|
|
351
|
+
/**
|
|
352
|
+
* Data structure for search events
|
|
353
|
+
*/
|
|
354
|
+
export declare interface SearchTrackingData extends BaseTrackingData {
|
|
355
|
+
/**
|
|
356
|
+
* The search query entered by the user
|
|
357
|
+
*/
|
|
358
|
+
query: string;
|
|
359
|
+
/**
|
|
360
|
+
* The type of search (e.g., text, province, city)
|
|
361
|
+
*/
|
|
362
|
+
search_type?: string;
|
|
363
|
+
/**
|
|
364
|
+
* Number of results returned
|
|
365
|
+
*/
|
|
366
|
+
result_count?: number;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
/**
|
|
370
|
+
* Data structure for share events
|
|
371
|
+
*/
|
|
372
|
+
export declare interface ShareTrackingData extends BaseTrackingData {
|
|
373
|
+
/**
|
|
374
|
+
* Platform being shared to (e.g., facebook, twitter, email)
|
|
375
|
+
*/
|
|
376
|
+
platform?: string;
|
|
377
|
+
/**
|
|
378
|
+
* ID of the location being shared
|
|
379
|
+
*/
|
|
380
|
+
location_id?: string;
|
|
381
|
+
/**
|
|
382
|
+
* URL being shared
|
|
383
|
+
*/
|
|
384
|
+
share_url?: string;
|
|
385
|
+
}
|
|
386
|
+
|
|
225
387
|
declare type SocialConfigType = {
|
|
226
388
|
name: SocialNameType | ("email" | "copy");
|
|
227
389
|
shareURL: string;
|
|
@@ -232,4 +394,117 @@ declare type SocialConfigType = {
|
|
|
232
394
|
|
|
233
395
|
declare type SocialNameType = "facebook" | "x" | "twitter" | "instagram" | "snapchat" | "linkedin" | "whatsapp" | "tiktok" | "youtube";
|
|
234
396
|
|
|
397
|
+
/**
|
|
398
|
+
* Data structure for UI toggle events
|
|
399
|
+
*/
|
|
400
|
+
export declare interface ToggleTrackingData extends BaseTrackingData {
|
|
401
|
+
/**
|
|
402
|
+
* Whether the feature is being turned on or off
|
|
403
|
+
*/
|
|
404
|
+
enabled: boolean;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
/**
|
|
408
|
+
* Type definition for the tracking function provided by the host application
|
|
409
|
+
* The function receives event data and is responsible for mapping it to the host's tracking system
|
|
410
|
+
*/
|
|
411
|
+
export declare type TrackerFunction = (data: Record<string, unknown>) => void;
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* Configuration for tracking events
|
|
415
|
+
*/
|
|
416
|
+
export declare type TrackingConfig = {
|
|
417
|
+
[key in TrackingEvent]?: {
|
|
418
|
+
enabled: boolean;
|
|
419
|
+
tracker: TrackerFunction | null;
|
|
420
|
+
};
|
|
421
|
+
};
|
|
422
|
+
|
|
423
|
+
/**
|
|
424
|
+
* Union type of all possible tracking data structures
|
|
425
|
+
*/
|
|
426
|
+
export declare type TrackingData = SearchTrackingData | LocationSelectTrackingData | GeolocationTrackingData | CTATrackingData | AreaSearchTrackingData | ToggleTrackingData | ShareTrackingData | Record<string, unknown>;
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* Standard tracking events used throughout the Locator library
|
|
430
|
+
*/
|
|
431
|
+
export declare enum TrackingEvent {
|
|
432
|
+
FULLSCREEN_TOGGLE = "fullscreen",
|
|
433
|
+
BACK_BUTTON_CLICK = "back_button",
|
|
434
|
+
SEARCH = "search",
|
|
435
|
+
AUTOCOMPLETE_ITEM_SELECT = "autocomplete_item_select",
|
|
436
|
+
GEOLOCATION = "geolocation",
|
|
437
|
+
LOCATION_CARD_CLICK = "location_card_click",
|
|
438
|
+
LOCATION_CARD_PRIMARY_ACTION = "location_card_primary_action",
|
|
439
|
+
LOCATION_CARD_SECONDARY_ACTION = "location_card_secondary_action",
|
|
440
|
+
INFO_WINDOW_PRIMARY_ACTION = "info_window_primary_action",
|
|
441
|
+
INFO_WINDOW_SECONDARY_ACTION = "info_window_secondary_action",
|
|
442
|
+
CARD_LIST_TOGGLE = "card_list_toggle",
|
|
443
|
+
SHARE_SHEET_OPEN = "share_sheet_open",
|
|
444
|
+
SHARE_SHEET_CLOSE = "share_sheet_close",
|
|
445
|
+
SHARE_SHEET_SHARE = "share_sheet_share",
|
|
446
|
+
AREA_SEARCH_TOGGLE = "area_search_toggle",
|
|
447
|
+
AREA_SEARCH_SUBMIT = "area_search_submit",
|
|
448
|
+
AREA_SEARCH_CANCEL = "area_search_cancel"
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
/**
|
|
452
|
+
* Map of event types to their corresponding data structures
|
|
453
|
+
* This helps with type checking when tracking specific events
|
|
454
|
+
*/
|
|
455
|
+
export declare interface TrackingEventDataMap {
|
|
456
|
+
[TrackingEvent.SEARCH]: SearchTrackingData;
|
|
457
|
+
[TrackingEvent.AUTOCOMPLETE_ITEM_SELECT]: AutocompleteItemSelectTrackingData;
|
|
458
|
+
[TrackingEvent.GEOLOCATION]: GeolocationTrackingData;
|
|
459
|
+
[TrackingEvent.LOCATION_CARD_CLICK]: LocationSelectTrackingData;
|
|
460
|
+
[TrackingEvent.LOCATION_CARD_PRIMARY_ACTION]: CTATrackingData;
|
|
461
|
+
[TrackingEvent.LOCATION_CARD_SECONDARY_ACTION]: CTATrackingData;
|
|
462
|
+
[TrackingEvent.INFO_WINDOW_PRIMARY_ACTION]: CTATrackingData;
|
|
463
|
+
[TrackingEvent.INFO_WINDOW_SECONDARY_ACTION]: CTATrackingData;
|
|
464
|
+
[TrackingEvent.FULLSCREEN_TOGGLE]: ToggleTrackingData;
|
|
465
|
+
[TrackingEvent.CARD_LIST_TOGGLE]: ToggleTrackingData;
|
|
466
|
+
[TrackingEvent.AREA_SEARCH_TOGGLE]: ToggleTrackingData;
|
|
467
|
+
[TrackingEvent.AREA_SEARCH_SUBMIT]: AreaSearchTrackingData;
|
|
468
|
+
[TrackingEvent.AREA_SEARCH_CANCEL]: BaseTrackingData;
|
|
469
|
+
[TrackingEvent.SHARE_SHEET_OPEN]: BaseTrackingData;
|
|
470
|
+
[TrackingEvent.SHARE_SHEET_CLOSE]: BaseTrackingData;
|
|
471
|
+
[TrackingEvent.SHARE_SHEET_SHARE]: ShareTrackingData;
|
|
472
|
+
[TrackingEvent.BACK_BUTTON_CLICK]: BaseTrackingData;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
/**
|
|
476
|
+
* Tracking Service class
|
|
477
|
+
*/
|
|
478
|
+
declare class TrackingService {
|
|
479
|
+
private config;
|
|
480
|
+
private isInitialized;
|
|
481
|
+
private warnedEvents;
|
|
482
|
+
/**
|
|
483
|
+
* Initialize the tracking service with a configuration
|
|
484
|
+
*/
|
|
485
|
+
initialize(config?: TrackingConfig): void;
|
|
486
|
+
/**
|
|
487
|
+
* Check if a specific event is enabled for tracking
|
|
488
|
+
* Components can use this to avoid unnecessary data preparation
|
|
489
|
+
*/
|
|
490
|
+
isEventEnabled(event: TrackingEvent): boolean;
|
|
491
|
+
/**
|
|
492
|
+
* Track an event with event-specific data
|
|
493
|
+
* @template T The specific event type from TrackingEvent enum
|
|
494
|
+
* @param event The tracking event to log
|
|
495
|
+
* @param data The event-specific data
|
|
496
|
+
*/
|
|
497
|
+
track<T extends TrackingEvent>(event: T, data?: Partial<TrackingEventDataMap[T]>): void;
|
|
498
|
+
/**
|
|
499
|
+
* Check if the tracking service has been initialized
|
|
500
|
+
*/
|
|
501
|
+
isTrackerInitialized(): boolean;
|
|
502
|
+
/**
|
|
503
|
+
* Reset the tracking service (mainly for testing purposes)
|
|
504
|
+
*/
|
|
505
|
+
reset(): void;
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
export declare const trackingService: TrackingService;
|
|
509
|
+
|
|
235
510
|
export { }
|
package/dist/index.es.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { M as r, S as s, L as
|
|
1
|
+
import { M as r, S as s, T as t, L as c, t as i } from "./index-9sJqqbiV.js";
|
|
2
2
|
export {
|
|
3
3
|
r as Map,
|
|
4
4
|
s as Search,
|
|
5
|
-
|
|
5
|
+
t as TrackingEvent,
|
|
6
|
+
c as default,
|
|
7
|
+
i as trackingService
|
|
6
8
|
};
|
|
7
9
|
//# sourceMappingURL=index.es.js.map
|