@mapfirst.ai/react 0.0.7 β 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -1
- package/dist/index.d.mts +169 -60
- package/dist/index.d.ts +169 -60
- package/dist/index.js +10 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
# @mapfirst/react
|
|
2
2
|
|
|
3
|
-
React hooks for the MapFirst SDK supporting MapLibre, Google Maps, and Mapbox.
|
|
3
|
+
React hooks and components for the MapFirst SDK supporting MapLibre, Google Maps, and Mapbox.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- πΊοΈ **Multi-Platform Support**: Works with MapLibre GL JS, Google Maps, and Mapbox GL JS
|
|
8
|
+
- π **SmartFilter Component**: AI-powered search with interactive filter chips
|
|
9
|
+
- βοΈ **React Hooks**: Reactive state management for properties, filters, and map state
|
|
10
|
+
- π¨ **Customizable**: Native React styles (CSS-in-JS) - no framework dependencies
|
|
11
|
+
- π± **Responsive**: Adapts to different screen sizes and orientations
|
|
12
|
+
- βΏ **Accessible**: Full keyboard navigation and ARIA support
|
|
13
|
+
- π **i18n Ready**: Built-in translations with extensibility
|
|
4
14
|
|
|
5
15
|
## Installation
|
|
6
16
|
|
|
@@ -12,6 +22,39 @@ pnpm add @mapfirst/react @mapfirst/core
|
|
|
12
22
|
yarn add @mapfirst/react @mapfirst/core
|
|
13
23
|
```
|
|
14
24
|
|
|
25
|
+
## Quick Start - SmartFilter Component
|
|
26
|
+
|
|
27
|
+
```tsx
|
|
28
|
+
import { useMapFirstCore, SmartFilter } from "@mapfirst/react";
|
|
29
|
+
import { useState } from "react";
|
|
30
|
+
|
|
31
|
+
function App() {
|
|
32
|
+
const { mapFirst, state } = useMapFirstCore({
|
|
33
|
+
initialLocationData: {
|
|
34
|
+
city: "New York",
|
|
35
|
+
country: "United States",
|
|
36
|
+
currency: "USD",
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const [filters, setFilters] = useState([]);
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<SmartFilter
|
|
44
|
+
mapFirst={mapFirst}
|
|
45
|
+
filters={filters}
|
|
46
|
+
isSearching={state?.isSearching}
|
|
47
|
+
onSearch={async (query) => {
|
|
48
|
+
// Implement search logic
|
|
49
|
+
}}
|
|
50
|
+
onFilterChange={setFilters}
|
|
51
|
+
/>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
See [SMARTFILTER.md](./SMARTFILTER.md) for complete SmartFilter documentation.
|
|
57
|
+
|
|
15
58
|
## Usage
|
|
16
59
|
|
|
17
60
|
The React SDK supports a two-phase initialization pattern:
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,169 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
2
|
+
import * as _mapfirst_ai_core from '@mapfirst.ai/core';
|
|
3
|
+
import { PropertyType, PriceLevel, MapFirstCore, BaseMapFirstOptions, MapState, Property, MapLibreNamespace, GoogleMapsNamespace, MapboxNamespace, MapFirstOptions } from '@mapfirst.ai/core';
|
|
4
|
+
import * as React$1 from 'react';
|
|
5
|
+
import React__default, { FunctionComponent, CSSProperties, ReactNode } from 'react';
|
|
6
|
+
|
|
7
|
+
type Filter = {
|
|
8
|
+
id: string;
|
|
9
|
+
label: string | React.ReactNode;
|
|
10
|
+
type: "amenity" | "hotelStyle" | "priceRange" | "minRating" | "starRating" | "primary_type" | "transformed_query" | "selected_restaurant_price_levels";
|
|
11
|
+
value: string;
|
|
12
|
+
numericValue?: number;
|
|
13
|
+
icon?: React.ReactNode;
|
|
14
|
+
priceRange?: PriceRangeValue;
|
|
15
|
+
propertyType?: PropertyType;
|
|
16
|
+
priceLevels?: PriceLevel[];
|
|
17
|
+
};
|
|
18
|
+
type PriceRangeValue = {
|
|
19
|
+
min?: number;
|
|
20
|
+
max?: number;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
interface SmartFilterProps {
|
|
24
|
+
mapFirst: MapFirstCore | null;
|
|
25
|
+
filters: Filter[];
|
|
26
|
+
value?: string;
|
|
27
|
+
isSearching?: boolean;
|
|
28
|
+
placeholder?: string;
|
|
29
|
+
onSearch: (query: string, filters?: Filter[]) => Promise<void> | void;
|
|
30
|
+
onFilterChange: (filters: Filter[]) => Promise<void> | void;
|
|
31
|
+
onValueChange?: (value: string) => void;
|
|
32
|
+
showTypingPrompt?: boolean;
|
|
33
|
+
customTranslations?: Record<string, string>;
|
|
34
|
+
currency?: string;
|
|
35
|
+
style?: CSSProperties;
|
|
36
|
+
inputStyle?: CSSProperties;
|
|
37
|
+
containerStyle?: CSSProperties;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* SmartFilter component for AI-powered search with filter chips.
|
|
41
|
+
* Provides a search input with smart filtering capabilities.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```tsx
|
|
45
|
+
* const { mapFirst, state } = useMapFirstCore({ ... });
|
|
46
|
+
* const [filters, setFilters] = useState<Filter[]>([]);
|
|
47
|
+
* const [searchValue, setSearchValue] = useState("");
|
|
48
|
+
*
|
|
49
|
+
* const handleSearch = async (query: string, currentFilters?: Filter[]) => {
|
|
50
|
+
* // Perform search using mapFirst.runSmartFilterSearch
|
|
51
|
+
* const result = await mapFirst.runSmartFilterSearch({
|
|
52
|
+
* query,
|
|
53
|
+
* filters: currentFilters
|
|
54
|
+
* });
|
|
55
|
+
* // Update filters based on response
|
|
56
|
+
* };
|
|
57
|
+
*
|
|
58
|
+
* return (
|
|
59
|
+
* <SmartFilter
|
|
60
|
+
* mapFirst={mapFirst}
|
|
61
|
+
* filters={filters}
|
|
62
|
+
* value={searchValue}
|
|
63
|
+
* isSearching={state?.isSearching}
|
|
64
|
+
* onSearch={handleSearch}
|
|
65
|
+
* onFilterChange={setFilters}
|
|
66
|
+
* onValueChange={setSearchValue}
|
|
67
|
+
* />
|
|
68
|
+
* );
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
declare const SmartFilter$1: FunctionComponent<SmartFilterProps>;
|
|
72
|
+
|
|
73
|
+
interface IconProps {
|
|
74
|
+
className?: string;
|
|
75
|
+
style?: CSSProperties;
|
|
76
|
+
}
|
|
77
|
+
declare const SearchIcon: React__default.FC<IconProps>;
|
|
78
|
+
declare const CloseIcon: React__default.FC<IconProps>;
|
|
79
|
+
declare const EditIcon: React__default.FC<IconProps>;
|
|
80
|
+
declare const NextIcon: React__default.FC<IconProps>;
|
|
81
|
+
declare const StarIcon: React__default.FC<IconProps & {
|
|
82
|
+
fill?: string;
|
|
83
|
+
}>;
|
|
84
|
+
|
|
85
|
+
interface ChipProps {
|
|
86
|
+
label: string | ReactNode;
|
|
87
|
+
icon?: ReactNode;
|
|
88
|
+
remove: () => void;
|
|
89
|
+
style?: CSSProperties;
|
|
90
|
+
}
|
|
91
|
+
declare const Chip: React__default.FC<ChipProps>;
|
|
92
|
+
|
|
93
|
+
interface FilterChipsProps {
|
|
94
|
+
filters: Filter[];
|
|
95
|
+
isPortrait: boolean;
|
|
96
|
+
currency: string;
|
|
97
|
+
minRatingSuffix: string;
|
|
98
|
+
clearAllLabel: string;
|
|
99
|
+
previousFiltersLabel: string;
|
|
100
|
+
nextFiltersLabel: string;
|
|
101
|
+
formatCurrency: (value: number, currency?: string) => string;
|
|
102
|
+
onFilterChange: (filters: Filter[], clearAll?: boolean) => void | Promise<void>;
|
|
103
|
+
onResetFilters: () => void;
|
|
104
|
+
onClearAll: () => void;
|
|
105
|
+
}
|
|
106
|
+
declare const FilterChips: FunctionComponent<FilterChipsProps>;
|
|
107
|
+
|
|
108
|
+
declare const MinRatingFilterChip: FunctionComponent<{
|
|
109
|
+
star?: boolean;
|
|
110
|
+
rating: number;
|
|
111
|
+
onChange: (rating: number) => void;
|
|
112
|
+
onRemove: () => void;
|
|
113
|
+
}>;
|
|
114
|
+
|
|
115
|
+
declare const PriceRangeFilterChip: FunctionComponent<{
|
|
116
|
+
priceRange: PriceRangeValue;
|
|
117
|
+
currency: string;
|
|
118
|
+
onChange: (range: PriceRangeValue) => void;
|
|
119
|
+
onRemove: () => void;
|
|
120
|
+
}>;
|
|
121
|
+
|
|
122
|
+
interface RestaurantPriceLevelChipProps {
|
|
123
|
+
values: PriceLevel[];
|
|
124
|
+
onChange: (values: PriceLevel[]) => void;
|
|
125
|
+
onRemove: () => void;
|
|
126
|
+
}
|
|
127
|
+
declare const RestaurantPriceLevelChip: FunctionComponent<RestaurantPriceLevelChipProps>;
|
|
128
|
+
|
|
129
|
+
interface TransformedQueryChipProps {
|
|
130
|
+
value: string;
|
|
131
|
+
onChange: (nextValue: string) => void;
|
|
132
|
+
onRemove: () => void;
|
|
133
|
+
}
|
|
134
|
+
declare const TransformedQueryChip: FunctionComponent<TransformedQueryChipProps>;
|
|
135
|
+
|
|
136
|
+
declare const renderStars: (rating: number) => ReactNode[];
|
|
137
|
+
declare const createMinRatingFilterLabel: (rating: number, suffix?: string) => ReactNode;
|
|
138
|
+
declare const formatRatingValue: (rating: number) => string;
|
|
139
|
+
declare const createPriceRangeFilterLabel: (min: number, max: number | undefined, currency: string | undefined, formatCurrencyFn: (value: number, currency?: string) => string) => string;
|
|
140
|
+
|
|
141
|
+
declare const useFilterScroll: (dependency: number) => {
|
|
142
|
+
scrollerRef: React$1.RefObject<HTMLDivElement | null>;
|
|
143
|
+
atStart: boolean;
|
|
144
|
+
atEnd: boolean;
|
|
145
|
+
scrollByDir: (dir: "prev" | "next") => void;
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Hook to detect if the viewport is in portrait orientation.
|
|
150
|
+
* Updates on window resize.
|
|
151
|
+
*/
|
|
152
|
+
declare const useIsPortrait: () => boolean;
|
|
153
|
+
|
|
154
|
+
type Locale = "en" | "es" | "de" | "fr" | "it" | "pt";
|
|
155
|
+
type TranslationFunction = (key: string, params?: Record<string, any>) => string;
|
|
156
|
+
type FormatCurrencyFunction = (value: number, currency?: string) => string;
|
|
157
|
+
/**
|
|
158
|
+
* Simple translation hook with default English translations.
|
|
159
|
+
* Can be extended with custom translations and locales.
|
|
160
|
+
*/
|
|
161
|
+
declare const useTranslation: (customTranslations?: Record<string, string>, customFormatCurrency?: FormatCurrencyFunction) => {
|
|
162
|
+
t: TranslationFunction;
|
|
163
|
+
locale: Locale;
|
|
164
|
+
setLocale: React$1.Dispatch<React$1.SetStateAction<Locale>>;
|
|
165
|
+
formatCurrency: (value: number, currency?: string) => string;
|
|
166
|
+
};
|
|
4
167
|
|
|
5
168
|
type InitialRequestBody = {
|
|
6
169
|
initial?: boolean;
|
|
@@ -221,7 +384,7 @@ declare function useMapboxAttachment({ mapFirst, map, mapboxgl, onMarkerClick, }
|
|
|
221
384
|
*
|
|
222
385
|
* @deprecated Use useMapFirstCore and platform-specific attachment hooks instead
|
|
223
386
|
*/
|
|
224
|
-
declare function useMapFirst(options: MapFirstOptions | null):
|
|
387
|
+
declare function useMapFirst(options: MapFirstOptions | null): React__default.RefObject<MapFirstCore | null>;
|
|
225
388
|
/**
|
|
226
389
|
* Hook to run properties search with the MapFirst SDK.
|
|
227
390
|
* Returns a function to trigger the search and loading state.
|
|
@@ -257,34 +420,7 @@ declare function usePropertiesSearch(mapFirst: MapFirstCore | null): {
|
|
|
257
420
|
smartFiltersClearable?: boolean;
|
|
258
421
|
}) => Promise<{
|
|
259
422
|
location_id?: number;
|
|
260
|
-
filters:
|
|
261
|
-
amenities?: string[];
|
|
262
|
-
hotelStyle?: string[];
|
|
263
|
-
price?: {
|
|
264
|
-
min: number;
|
|
265
|
-
max: number;
|
|
266
|
-
} | null;
|
|
267
|
-
minRating?: number;
|
|
268
|
-
starRating?: number;
|
|
269
|
-
numAdults: number;
|
|
270
|
-
numRooms: number;
|
|
271
|
-
checkIn: string;
|
|
272
|
-
checkOut: string;
|
|
273
|
-
location?: {
|
|
274
|
-
locationId: number | null;
|
|
275
|
-
city: string | null;
|
|
276
|
-
state: string | null;
|
|
277
|
-
country: string | null;
|
|
278
|
-
longitude: number | null;
|
|
279
|
-
latitude: number | null;
|
|
280
|
-
} | null;
|
|
281
|
-
currency: string;
|
|
282
|
-
limit?: number;
|
|
283
|
-
language?: "en" | "es" | "de" | "fr" | "it" | "pt";
|
|
284
|
-
primary_type?: PropertyType;
|
|
285
|
-
transformed_query?: string;
|
|
286
|
-
selected_restaurant_price_levels?: ("Mid Range" | "Fine Dining" | "Cheap Eats")[];
|
|
287
|
-
};
|
|
423
|
+
filters: _mapfirst_ai_core.FilterSchema;
|
|
288
424
|
properties: Property[];
|
|
289
425
|
isComplete: boolean | undefined;
|
|
290
426
|
pollingLink: string | undefined;
|
|
@@ -331,34 +467,7 @@ declare function useSmartFilterSearch(mapFirst: MapFirstCore | null): {
|
|
|
331
467
|
};
|
|
332
468
|
}) => Promise<{
|
|
333
469
|
location_id?: number;
|
|
334
|
-
filters:
|
|
335
|
-
amenities?: string[];
|
|
336
|
-
hotelStyle?: string[];
|
|
337
|
-
price?: {
|
|
338
|
-
min: number;
|
|
339
|
-
max: number;
|
|
340
|
-
} | null;
|
|
341
|
-
minRating?: number;
|
|
342
|
-
starRating?: number;
|
|
343
|
-
numAdults: number;
|
|
344
|
-
numRooms: number;
|
|
345
|
-
checkIn: string;
|
|
346
|
-
checkOut: string;
|
|
347
|
-
location?: {
|
|
348
|
-
locationId: number | null;
|
|
349
|
-
city: string | null;
|
|
350
|
-
state: string | null;
|
|
351
|
-
country: string | null;
|
|
352
|
-
longitude: number | null;
|
|
353
|
-
latitude: number | null;
|
|
354
|
-
} | null;
|
|
355
|
-
currency: string;
|
|
356
|
-
limit?: number;
|
|
357
|
-
language?: "en" | "es" | "de" | "fr" | "it" | "pt";
|
|
358
|
-
primary_type?: PropertyType;
|
|
359
|
-
transformed_query?: string;
|
|
360
|
-
selected_restaurant_price_levels?: ("Mid Range" | "Fine Dining" | "Cheap Eats")[];
|
|
361
|
-
};
|
|
470
|
+
filters: _mapfirst_ai_core.FilterSchema;
|
|
362
471
|
properties: Property[];
|
|
363
472
|
isComplete: boolean | undefined;
|
|
364
473
|
pollingLink: string | undefined;
|
|
@@ -375,4 +484,4 @@ declare function MarkerDebugList({ markers }: {
|
|
|
375
484
|
markers: Property[];
|
|
376
485
|
}): react_jsx_runtime.JSX.Element;
|
|
377
486
|
|
|
378
|
-
export { MarkerDebugList, useGoogleMapsAttachment, useMapFirst, useMapFirstCore, useMapFirstProperties, useMapFirstSelectedProperty, useMapLibreAttachment, useMapboxAttachment, usePrimaryType, usePropertiesSearch, useSelectedMarker, useSmartFilterSearch };
|
|
487
|
+
export { Chip, type ChipProps, CloseIcon, EditIcon, type Filter, FilterChips, type FilterChipsProps, type IconProps, type Locale, MarkerDebugList, MinRatingFilterChip, NextIcon, PriceRangeFilterChip, type PriceRangeValue, RestaurantPriceLevelChip, type RestaurantPriceLevelChipProps, SearchIcon, SmartFilter$1 as SmartFilter, type SmartFilterProps, StarIcon, TransformedQueryChip, type TransformedQueryChipProps, createMinRatingFilterLabel, createPriceRangeFilterLabel, formatRatingValue, renderStars, useFilterScroll, useGoogleMapsAttachment, useIsPortrait, useMapFirst, useMapFirstCore, useMapFirstProperties, useMapFirstSelectedProperty, useMapLibreAttachment, useMapboxAttachment, usePrimaryType, usePropertiesSearch, useSelectedMarker, useSmartFilterSearch, useTranslation };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,169 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
2
|
+
import * as _mapfirst_ai_core from '@mapfirst.ai/core';
|
|
3
|
+
import { PropertyType, PriceLevel, MapFirstCore, BaseMapFirstOptions, MapState, Property, MapLibreNamespace, GoogleMapsNamespace, MapboxNamespace, MapFirstOptions } from '@mapfirst.ai/core';
|
|
4
|
+
import * as React$1 from 'react';
|
|
5
|
+
import React__default, { FunctionComponent, CSSProperties, ReactNode } from 'react';
|
|
6
|
+
|
|
7
|
+
type Filter = {
|
|
8
|
+
id: string;
|
|
9
|
+
label: string | React.ReactNode;
|
|
10
|
+
type: "amenity" | "hotelStyle" | "priceRange" | "minRating" | "starRating" | "primary_type" | "transformed_query" | "selected_restaurant_price_levels";
|
|
11
|
+
value: string;
|
|
12
|
+
numericValue?: number;
|
|
13
|
+
icon?: React.ReactNode;
|
|
14
|
+
priceRange?: PriceRangeValue;
|
|
15
|
+
propertyType?: PropertyType;
|
|
16
|
+
priceLevels?: PriceLevel[];
|
|
17
|
+
};
|
|
18
|
+
type PriceRangeValue = {
|
|
19
|
+
min?: number;
|
|
20
|
+
max?: number;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
interface SmartFilterProps {
|
|
24
|
+
mapFirst: MapFirstCore | null;
|
|
25
|
+
filters: Filter[];
|
|
26
|
+
value?: string;
|
|
27
|
+
isSearching?: boolean;
|
|
28
|
+
placeholder?: string;
|
|
29
|
+
onSearch: (query: string, filters?: Filter[]) => Promise<void> | void;
|
|
30
|
+
onFilterChange: (filters: Filter[]) => Promise<void> | void;
|
|
31
|
+
onValueChange?: (value: string) => void;
|
|
32
|
+
showTypingPrompt?: boolean;
|
|
33
|
+
customTranslations?: Record<string, string>;
|
|
34
|
+
currency?: string;
|
|
35
|
+
style?: CSSProperties;
|
|
36
|
+
inputStyle?: CSSProperties;
|
|
37
|
+
containerStyle?: CSSProperties;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* SmartFilter component for AI-powered search with filter chips.
|
|
41
|
+
* Provides a search input with smart filtering capabilities.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```tsx
|
|
45
|
+
* const { mapFirst, state } = useMapFirstCore({ ... });
|
|
46
|
+
* const [filters, setFilters] = useState<Filter[]>([]);
|
|
47
|
+
* const [searchValue, setSearchValue] = useState("");
|
|
48
|
+
*
|
|
49
|
+
* const handleSearch = async (query: string, currentFilters?: Filter[]) => {
|
|
50
|
+
* // Perform search using mapFirst.runSmartFilterSearch
|
|
51
|
+
* const result = await mapFirst.runSmartFilterSearch({
|
|
52
|
+
* query,
|
|
53
|
+
* filters: currentFilters
|
|
54
|
+
* });
|
|
55
|
+
* // Update filters based on response
|
|
56
|
+
* };
|
|
57
|
+
*
|
|
58
|
+
* return (
|
|
59
|
+
* <SmartFilter
|
|
60
|
+
* mapFirst={mapFirst}
|
|
61
|
+
* filters={filters}
|
|
62
|
+
* value={searchValue}
|
|
63
|
+
* isSearching={state?.isSearching}
|
|
64
|
+
* onSearch={handleSearch}
|
|
65
|
+
* onFilterChange={setFilters}
|
|
66
|
+
* onValueChange={setSearchValue}
|
|
67
|
+
* />
|
|
68
|
+
* );
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
declare const SmartFilter$1: FunctionComponent<SmartFilterProps>;
|
|
72
|
+
|
|
73
|
+
interface IconProps {
|
|
74
|
+
className?: string;
|
|
75
|
+
style?: CSSProperties;
|
|
76
|
+
}
|
|
77
|
+
declare const SearchIcon: React__default.FC<IconProps>;
|
|
78
|
+
declare const CloseIcon: React__default.FC<IconProps>;
|
|
79
|
+
declare const EditIcon: React__default.FC<IconProps>;
|
|
80
|
+
declare const NextIcon: React__default.FC<IconProps>;
|
|
81
|
+
declare const StarIcon: React__default.FC<IconProps & {
|
|
82
|
+
fill?: string;
|
|
83
|
+
}>;
|
|
84
|
+
|
|
85
|
+
interface ChipProps {
|
|
86
|
+
label: string | ReactNode;
|
|
87
|
+
icon?: ReactNode;
|
|
88
|
+
remove: () => void;
|
|
89
|
+
style?: CSSProperties;
|
|
90
|
+
}
|
|
91
|
+
declare const Chip: React__default.FC<ChipProps>;
|
|
92
|
+
|
|
93
|
+
interface FilterChipsProps {
|
|
94
|
+
filters: Filter[];
|
|
95
|
+
isPortrait: boolean;
|
|
96
|
+
currency: string;
|
|
97
|
+
minRatingSuffix: string;
|
|
98
|
+
clearAllLabel: string;
|
|
99
|
+
previousFiltersLabel: string;
|
|
100
|
+
nextFiltersLabel: string;
|
|
101
|
+
formatCurrency: (value: number, currency?: string) => string;
|
|
102
|
+
onFilterChange: (filters: Filter[], clearAll?: boolean) => void | Promise<void>;
|
|
103
|
+
onResetFilters: () => void;
|
|
104
|
+
onClearAll: () => void;
|
|
105
|
+
}
|
|
106
|
+
declare const FilterChips: FunctionComponent<FilterChipsProps>;
|
|
107
|
+
|
|
108
|
+
declare const MinRatingFilterChip: FunctionComponent<{
|
|
109
|
+
star?: boolean;
|
|
110
|
+
rating: number;
|
|
111
|
+
onChange: (rating: number) => void;
|
|
112
|
+
onRemove: () => void;
|
|
113
|
+
}>;
|
|
114
|
+
|
|
115
|
+
declare const PriceRangeFilterChip: FunctionComponent<{
|
|
116
|
+
priceRange: PriceRangeValue;
|
|
117
|
+
currency: string;
|
|
118
|
+
onChange: (range: PriceRangeValue) => void;
|
|
119
|
+
onRemove: () => void;
|
|
120
|
+
}>;
|
|
121
|
+
|
|
122
|
+
interface RestaurantPriceLevelChipProps {
|
|
123
|
+
values: PriceLevel[];
|
|
124
|
+
onChange: (values: PriceLevel[]) => void;
|
|
125
|
+
onRemove: () => void;
|
|
126
|
+
}
|
|
127
|
+
declare const RestaurantPriceLevelChip: FunctionComponent<RestaurantPriceLevelChipProps>;
|
|
128
|
+
|
|
129
|
+
interface TransformedQueryChipProps {
|
|
130
|
+
value: string;
|
|
131
|
+
onChange: (nextValue: string) => void;
|
|
132
|
+
onRemove: () => void;
|
|
133
|
+
}
|
|
134
|
+
declare const TransformedQueryChip: FunctionComponent<TransformedQueryChipProps>;
|
|
135
|
+
|
|
136
|
+
declare const renderStars: (rating: number) => ReactNode[];
|
|
137
|
+
declare const createMinRatingFilterLabel: (rating: number, suffix?: string) => ReactNode;
|
|
138
|
+
declare const formatRatingValue: (rating: number) => string;
|
|
139
|
+
declare const createPriceRangeFilterLabel: (min: number, max: number | undefined, currency: string | undefined, formatCurrencyFn: (value: number, currency?: string) => string) => string;
|
|
140
|
+
|
|
141
|
+
declare const useFilterScroll: (dependency: number) => {
|
|
142
|
+
scrollerRef: React$1.RefObject<HTMLDivElement | null>;
|
|
143
|
+
atStart: boolean;
|
|
144
|
+
atEnd: boolean;
|
|
145
|
+
scrollByDir: (dir: "prev" | "next") => void;
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Hook to detect if the viewport is in portrait orientation.
|
|
150
|
+
* Updates on window resize.
|
|
151
|
+
*/
|
|
152
|
+
declare const useIsPortrait: () => boolean;
|
|
153
|
+
|
|
154
|
+
type Locale = "en" | "es" | "de" | "fr" | "it" | "pt";
|
|
155
|
+
type TranslationFunction = (key: string, params?: Record<string, any>) => string;
|
|
156
|
+
type FormatCurrencyFunction = (value: number, currency?: string) => string;
|
|
157
|
+
/**
|
|
158
|
+
* Simple translation hook with default English translations.
|
|
159
|
+
* Can be extended with custom translations and locales.
|
|
160
|
+
*/
|
|
161
|
+
declare const useTranslation: (customTranslations?: Record<string, string>, customFormatCurrency?: FormatCurrencyFunction) => {
|
|
162
|
+
t: TranslationFunction;
|
|
163
|
+
locale: Locale;
|
|
164
|
+
setLocale: React$1.Dispatch<React$1.SetStateAction<Locale>>;
|
|
165
|
+
formatCurrency: (value: number, currency?: string) => string;
|
|
166
|
+
};
|
|
4
167
|
|
|
5
168
|
type InitialRequestBody = {
|
|
6
169
|
initial?: boolean;
|
|
@@ -221,7 +384,7 @@ declare function useMapboxAttachment({ mapFirst, map, mapboxgl, onMarkerClick, }
|
|
|
221
384
|
*
|
|
222
385
|
* @deprecated Use useMapFirstCore and platform-specific attachment hooks instead
|
|
223
386
|
*/
|
|
224
|
-
declare function useMapFirst(options: MapFirstOptions | null):
|
|
387
|
+
declare function useMapFirst(options: MapFirstOptions | null): React__default.RefObject<MapFirstCore | null>;
|
|
225
388
|
/**
|
|
226
389
|
* Hook to run properties search with the MapFirst SDK.
|
|
227
390
|
* Returns a function to trigger the search and loading state.
|
|
@@ -257,34 +420,7 @@ declare function usePropertiesSearch(mapFirst: MapFirstCore | null): {
|
|
|
257
420
|
smartFiltersClearable?: boolean;
|
|
258
421
|
}) => Promise<{
|
|
259
422
|
location_id?: number;
|
|
260
|
-
filters:
|
|
261
|
-
amenities?: string[];
|
|
262
|
-
hotelStyle?: string[];
|
|
263
|
-
price?: {
|
|
264
|
-
min: number;
|
|
265
|
-
max: number;
|
|
266
|
-
} | null;
|
|
267
|
-
minRating?: number;
|
|
268
|
-
starRating?: number;
|
|
269
|
-
numAdults: number;
|
|
270
|
-
numRooms: number;
|
|
271
|
-
checkIn: string;
|
|
272
|
-
checkOut: string;
|
|
273
|
-
location?: {
|
|
274
|
-
locationId: number | null;
|
|
275
|
-
city: string | null;
|
|
276
|
-
state: string | null;
|
|
277
|
-
country: string | null;
|
|
278
|
-
longitude: number | null;
|
|
279
|
-
latitude: number | null;
|
|
280
|
-
} | null;
|
|
281
|
-
currency: string;
|
|
282
|
-
limit?: number;
|
|
283
|
-
language?: "en" | "es" | "de" | "fr" | "it" | "pt";
|
|
284
|
-
primary_type?: PropertyType;
|
|
285
|
-
transformed_query?: string;
|
|
286
|
-
selected_restaurant_price_levels?: ("Mid Range" | "Fine Dining" | "Cheap Eats")[];
|
|
287
|
-
};
|
|
423
|
+
filters: _mapfirst_ai_core.FilterSchema;
|
|
288
424
|
properties: Property[];
|
|
289
425
|
isComplete: boolean | undefined;
|
|
290
426
|
pollingLink: string | undefined;
|
|
@@ -331,34 +467,7 @@ declare function useSmartFilterSearch(mapFirst: MapFirstCore | null): {
|
|
|
331
467
|
};
|
|
332
468
|
}) => Promise<{
|
|
333
469
|
location_id?: number;
|
|
334
|
-
filters:
|
|
335
|
-
amenities?: string[];
|
|
336
|
-
hotelStyle?: string[];
|
|
337
|
-
price?: {
|
|
338
|
-
min: number;
|
|
339
|
-
max: number;
|
|
340
|
-
} | null;
|
|
341
|
-
minRating?: number;
|
|
342
|
-
starRating?: number;
|
|
343
|
-
numAdults: number;
|
|
344
|
-
numRooms: number;
|
|
345
|
-
checkIn: string;
|
|
346
|
-
checkOut: string;
|
|
347
|
-
location?: {
|
|
348
|
-
locationId: number | null;
|
|
349
|
-
city: string | null;
|
|
350
|
-
state: string | null;
|
|
351
|
-
country: string | null;
|
|
352
|
-
longitude: number | null;
|
|
353
|
-
latitude: number | null;
|
|
354
|
-
} | null;
|
|
355
|
-
currency: string;
|
|
356
|
-
limit?: number;
|
|
357
|
-
language?: "en" | "es" | "de" | "fr" | "it" | "pt";
|
|
358
|
-
primary_type?: PropertyType;
|
|
359
|
-
transformed_query?: string;
|
|
360
|
-
selected_restaurant_price_levels?: ("Mid Range" | "Fine Dining" | "Cheap Eats")[];
|
|
361
|
-
};
|
|
470
|
+
filters: _mapfirst_ai_core.FilterSchema;
|
|
362
471
|
properties: Property[];
|
|
363
472
|
isComplete: boolean | undefined;
|
|
364
473
|
pollingLink: string | undefined;
|
|
@@ -375,4 +484,4 @@ declare function MarkerDebugList({ markers }: {
|
|
|
375
484
|
markers: Property[];
|
|
376
485
|
}): react_jsx_runtime.JSX.Element;
|
|
377
486
|
|
|
378
|
-
export { MarkerDebugList, useGoogleMapsAttachment, useMapFirst, useMapFirstCore, useMapFirstProperties, useMapFirstSelectedProperty, useMapLibreAttachment, useMapboxAttachment, usePrimaryType, usePropertiesSearch, useSelectedMarker, useSmartFilterSearch };
|
|
487
|
+
export { Chip, type ChipProps, CloseIcon, EditIcon, type Filter, FilterChips, type FilterChipsProps, type IconProps, type Locale, MarkerDebugList, MinRatingFilterChip, NextIcon, PriceRangeFilterChip, type PriceRangeValue, RestaurantPriceLevelChip, type RestaurantPriceLevelChipProps, SearchIcon, SmartFilter$1 as SmartFilter, type SmartFilterProps, StarIcon, TransformedQueryChip, type TransformedQueryChipProps, createMinRatingFilterLabel, createPriceRangeFilterLabel, formatRatingValue, renderStars, useFilterScroll, useGoogleMapsAttachment, useIsPortrait, useMapFirst, useMapFirstCore, useMapFirstProperties, useMapFirstSelectedProperty, useMapLibreAttachment, useMapboxAttachment, usePrimaryType, usePropertiesSearch, useSelectedMarker, useSmartFilterSearch, useTranslation };
|