@mapfirst.ai/react 0.0.44 → 0.0.45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -226,15 +226,15 @@ type SmartFilter = {
226
226
  * }, [mapLibreInstance]);
227
227
  *
228
228
  * // Use search methods
229
- * await propertiesSearch.search({
229
+ * await propertiesSearch({
230
230
  * body: { city: "Paris", country: "France" }
231
231
  * });
232
232
  *
233
- * await smartFilterSearch.search({
233
+ * await smartFilterSearch({
234
234
  * query: "hotels near beach with pool"
235
235
  * });
236
236
  *
237
- * await boundsSearch.perform();
237
+ * await boundsSearch();
238
238
  * ```
239
239
  */
240
240
  declare function useMapFirst(options: BaseMapFirstOptions): {
@@ -243,54 +243,48 @@ declare function useMapFirst(options: BaseMapFirstOptions): {
243
243
  setPrimaryType: (type: PropertyType) => void;
244
244
  setSelectedMarker: (id: number | null) => void;
245
245
  setUseApi: (useApi: boolean, autoLoad?: boolean) => void;
246
- propertiesSearch: {
247
- search: (options: {
248
- body: InitialRequestBody;
249
- beforeApplyProperties?: (data: any) => {
250
- price?: any;
251
- limit?: number;
252
- };
253
- smartFiltersClearable?: boolean;
254
- onError?: (error: unknown) => void;
255
- }) => Promise<{
256
- location_id?: number;
257
- filters: _mapfirst_ai_core.FilterSchema;
258
- properties: Property[];
259
- isComplete: boolean | undefined;
260
- pollingLink: string | undefined;
261
- durationSeconds: number;
262
- } | null>;
263
- };
264
- smartFilterSearch: {
265
- search: (options: {
266
- query?: string;
267
- filters?: SmartFilter[];
268
- onProcessFilters?: (filters: any, location_id?: number) => {
269
- smartFilters?: SmartFilter[];
270
- price?: any;
271
- limit?: number;
272
- language?: string;
273
- };
274
- onError?: (error: unknown) => void;
275
- }) => Promise<{
276
- location_id?: number;
277
- filters: _mapfirst_ai_core.FilterSchema;
278
- properties: Property[];
279
- isComplete: boolean | undefined;
280
- pollingLink: string | undefined;
281
- durationSeconds: number;
282
- } | null>;
283
- };
284
- boundsSearch: {
285
- perform: () => Promise<{
286
- location_id?: number;
287
- filters: _mapfirst_ai_core.FilterSchema;
288
- properties: Property[];
289
- isComplete: boolean | undefined;
290
- pollingLink: string | undefined;
291
- durationSeconds: number;
292
- } | null>;
293
- };
246
+ propertiesSearch: (options: {
247
+ body: InitialRequestBody;
248
+ beforeApplyProperties?: (data: any) => {
249
+ price?: any;
250
+ limit?: number;
251
+ };
252
+ smartFiltersClearable?: boolean;
253
+ onError?: (error: unknown) => void;
254
+ }) => Promise<{
255
+ location_id?: number;
256
+ filters: _mapfirst_ai_core.FilterSchema;
257
+ properties: Property[];
258
+ isComplete: boolean | undefined;
259
+ pollingLink: string | undefined;
260
+ durationSeconds: number;
261
+ } | null>;
262
+ smartFilterSearch: (options: {
263
+ query?: string;
264
+ filters?: SmartFilter[];
265
+ onProcessFilters?: (filters: any, location_id?: number) => {
266
+ smartFilters?: SmartFilter[];
267
+ price?: any;
268
+ limit?: number;
269
+ language?: string;
270
+ };
271
+ onError?: (error: unknown) => void;
272
+ }) => Promise<{
273
+ location_id?: number;
274
+ filters: _mapfirst_ai_core.FilterSchema;
275
+ properties: Property[];
276
+ isComplete: boolean | undefined;
277
+ pollingLink: string | undefined;
278
+ durationSeconds: number;
279
+ } | null>;
280
+ boundsSearch: () => Promise<{
281
+ location_id?: number;
282
+ filters: _mapfirst_ai_core.FilterSchema;
283
+ properties: Property[];
284
+ isComplete: boolean | undefined;
285
+ pollingLink: string | undefined;
286
+ durationSeconds: number;
287
+ } | null>;
294
288
  attachMapLibre: (map: any, maplibregl: MapLibreNamespace, options?: {
295
289
  onMarkerClick?: (marker: Property) => void;
296
290
  }) => void;
package/dist/index.d.ts CHANGED
@@ -226,15 +226,15 @@ type SmartFilter = {
226
226
  * }, [mapLibreInstance]);
227
227
  *
228
228
  * // Use search methods
229
- * await propertiesSearch.search({
229
+ * await propertiesSearch({
230
230
  * body: { city: "Paris", country: "France" }
231
231
  * });
232
232
  *
233
- * await smartFilterSearch.search({
233
+ * await smartFilterSearch({
234
234
  * query: "hotels near beach with pool"
235
235
  * });
236
236
  *
237
- * await boundsSearch.perform();
237
+ * await boundsSearch();
238
238
  * ```
239
239
  */
240
240
  declare function useMapFirst(options: BaseMapFirstOptions): {
@@ -243,54 +243,48 @@ declare function useMapFirst(options: BaseMapFirstOptions): {
243
243
  setPrimaryType: (type: PropertyType) => void;
244
244
  setSelectedMarker: (id: number | null) => void;
245
245
  setUseApi: (useApi: boolean, autoLoad?: boolean) => void;
246
- propertiesSearch: {
247
- search: (options: {
248
- body: InitialRequestBody;
249
- beforeApplyProperties?: (data: any) => {
250
- price?: any;
251
- limit?: number;
252
- };
253
- smartFiltersClearable?: boolean;
254
- onError?: (error: unknown) => void;
255
- }) => Promise<{
256
- location_id?: number;
257
- filters: _mapfirst_ai_core.FilterSchema;
258
- properties: Property[];
259
- isComplete: boolean | undefined;
260
- pollingLink: string | undefined;
261
- durationSeconds: number;
262
- } | null>;
263
- };
264
- smartFilterSearch: {
265
- search: (options: {
266
- query?: string;
267
- filters?: SmartFilter[];
268
- onProcessFilters?: (filters: any, location_id?: number) => {
269
- smartFilters?: SmartFilter[];
270
- price?: any;
271
- limit?: number;
272
- language?: string;
273
- };
274
- onError?: (error: unknown) => void;
275
- }) => Promise<{
276
- location_id?: number;
277
- filters: _mapfirst_ai_core.FilterSchema;
278
- properties: Property[];
279
- isComplete: boolean | undefined;
280
- pollingLink: string | undefined;
281
- durationSeconds: number;
282
- } | null>;
283
- };
284
- boundsSearch: {
285
- perform: () => Promise<{
286
- location_id?: number;
287
- filters: _mapfirst_ai_core.FilterSchema;
288
- properties: Property[];
289
- isComplete: boolean | undefined;
290
- pollingLink: string | undefined;
291
- durationSeconds: number;
292
- } | null>;
293
- };
246
+ propertiesSearch: (options: {
247
+ body: InitialRequestBody;
248
+ beforeApplyProperties?: (data: any) => {
249
+ price?: any;
250
+ limit?: number;
251
+ };
252
+ smartFiltersClearable?: boolean;
253
+ onError?: (error: unknown) => void;
254
+ }) => Promise<{
255
+ location_id?: number;
256
+ filters: _mapfirst_ai_core.FilterSchema;
257
+ properties: Property[];
258
+ isComplete: boolean | undefined;
259
+ pollingLink: string | undefined;
260
+ durationSeconds: number;
261
+ } | null>;
262
+ smartFilterSearch: (options: {
263
+ query?: string;
264
+ filters?: SmartFilter[];
265
+ onProcessFilters?: (filters: any, location_id?: number) => {
266
+ smartFilters?: SmartFilter[];
267
+ price?: any;
268
+ limit?: number;
269
+ language?: string;
270
+ };
271
+ onError?: (error: unknown) => void;
272
+ }) => Promise<{
273
+ location_id?: number;
274
+ filters: _mapfirst_ai_core.FilterSchema;
275
+ properties: Property[];
276
+ isComplete: boolean | undefined;
277
+ pollingLink: string | undefined;
278
+ durationSeconds: number;
279
+ } | null>;
280
+ boundsSearch: () => Promise<{
281
+ location_id?: number;
282
+ filters: _mapfirst_ai_core.FilterSchema;
283
+ properties: Property[];
284
+ isComplete: boolean | undefined;
285
+ pollingLink: string | undefined;
286
+ durationSeconds: number;
287
+ } | null>;
294
288
  attachMapLibre: (map: any, maplibregl: MapLibreNamespace, options?: {
295
289
  onMarkerClick?: (marker: Property) => void;
296
290
  }) => void;
package/dist/index.js CHANGED
@@ -1488,39 +1488,30 @@ function useMapFirst(options) {
1488
1488
  },
1489
1489
  []
1490
1490
  );
1491
- const propertiesSearch = import_react9.default.useMemo(
1492
- () => ({
1493
- search: async (options2) => {
1494
- if (!instanceRef.current) {
1495
- throw new Error("MapFirst instance not available");
1496
- }
1497
- return await instanceRef.current.runPropertiesSearch(options2);
1498
- }
1499
- }),
1500
- []
1501
- );
1502
- const smartFilterSearch = import_react9.default.useMemo(
1503
- () => ({
1504
- search: async (options2) => {
1505
- if (!instanceRef.current) {
1506
- throw new Error("MapFirst instance not available");
1507
- }
1508
- return await instanceRef.current.runSmartFilterSearch(options2);
1491
+ const propertiesSearch = import_react9.default.useCallback(
1492
+ async (options2) => {
1493
+ if (!instanceRef.current) {
1494
+ throw new Error("MapFirst instance not available");
1509
1495
  }
1510
- }),
1496
+ return await instanceRef.current.runPropertiesSearch(options2);
1497
+ },
1511
1498
  []
1512
1499
  );
1513
- const boundsSearch = import_react9.default.useMemo(
1514
- () => ({
1515
- perform: async () => {
1516
- if (!instanceRef.current) {
1517
- return null;
1518
- }
1519
- return await instanceRef.current.performBoundsSearch();
1500
+ const smartFilterSearch = import_react9.default.useCallback(
1501
+ async (options2) => {
1502
+ if (!instanceRef.current) {
1503
+ throw new Error("MapFirst instance not available");
1520
1504
  }
1521
- }),
1505
+ return await instanceRef.current.runSmartFilterSearch(options2);
1506
+ },
1522
1507
  []
1523
1508
  );
1509
+ const boundsSearch = import_react9.default.useCallback(async () => {
1510
+ if (!instanceRef.current) {
1511
+ return null;
1512
+ }
1513
+ return await instanceRef.current.performBoundsSearch();
1514
+ }, []);
1524
1515
  const mapLibreAttachedRef = import_react9.default.useRef(false);
1525
1516
  const attachMapLibre = import_react9.default.useCallback(
1526
1517
  (map, maplibregl, options2) => {
package/dist/index.mjs CHANGED
@@ -1448,39 +1448,30 @@ function useMapFirst(options) {
1448
1448
  },
1449
1449
  []
1450
1450
  );
1451
- const propertiesSearch = React6.useMemo(
1452
- () => ({
1453
- search: async (options2) => {
1454
- if (!instanceRef.current) {
1455
- throw new Error("MapFirst instance not available");
1456
- }
1457
- return await instanceRef.current.runPropertiesSearch(options2);
1458
- }
1459
- }),
1460
- []
1461
- );
1462
- const smartFilterSearch = React6.useMemo(
1463
- () => ({
1464
- search: async (options2) => {
1465
- if (!instanceRef.current) {
1466
- throw new Error("MapFirst instance not available");
1467
- }
1468
- return await instanceRef.current.runSmartFilterSearch(options2);
1451
+ const propertiesSearch = React6.useCallback(
1452
+ async (options2) => {
1453
+ if (!instanceRef.current) {
1454
+ throw new Error("MapFirst instance not available");
1469
1455
  }
1470
- }),
1456
+ return await instanceRef.current.runPropertiesSearch(options2);
1457
+ },
1471
1458
  []
1472
1459
  );
1473
- const boundsSearch = React6.useMemo(
1474
- () => ({
1475
- perform: async () => {
1476
- if (!instanceRef.current) {
1477
- return null;
1478
- }
1479
- return await instanceRef.current.performBoundsSearch();
1460
+ const smartFilterSearch = React6.useCallback(
1461
+ async (options2) => {
1462
+ if (!instanceRef.current) {
1463
+ throw new Error("MapFirst instance not available");
1480
1464
  }
1481
- }),
1465
+ return await instanceRef.current.runSmartFilterSearch(options2);
1466
+ },
1482
1467
  []
1483
1468
  );
1469
+ const boundsSearch = React6.useCallback(async () => {
1470
+ if (!instanceRef.current) {
1471
+ return null;
1472
+ }
1473
+ return await instanceRef.current.performBoundsSearch();
1474
+ }, []);
1484
1475
  const mapLibreAttachedRef = React6.useRef(false);
1485
1476
  const attachMapLibre = React6.useCallback(
1486
1477
  (map, maplibregl, options2) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mapfirst.ai/react",
3
- "version": "0.0.44",
3
+ "version": "0.0.45",
4
4
  "description": "React hooks for MapFirst SDK - Reactive state management for map properties",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",