@mapfirst.ai/react 0.0.43 → 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
@@ -1450,6 +1450,14 @@ function useMapFirst(options) {
1450
1450
  onSearchingStateChange: (searching) => {
1451
1451
  updateStateField(setState, "isSearching", searching);
1452
1452
  forwardCallback(optionsRef, "onSearchingStateChange", searching);
1453
+ },
1454
+ onFirstCallDoneChange: (firstCallDone) => {
1455
+ updateStateField(setState, "firstCallDone", firstCallDone);
1456
+ forwardCallback(optionsRef, "onFirstCallDoneChange", firstCallDone);
1457
+ },
1458
+ onIsFlyToAnimatingChange: (animating) => {
1459
+ updateStateField(setState, "isFlyToAnimating", animating);
1460
+ forwardCallback(optionsRef, "onIsFlyToAnimatingChange", animating);
1453
1461
  }
1454
1462
  }
1455
1463
  };
@@ -1480,39 +1488,30 @@ function useMapFirst(options) {
1480
1488
  },
1481
1489
  []
1482
1490
  );
1483
- const propertiesSearch = import_react9.default.useMemo(
1484
- () => ({
1485
- search: async (options2) => {
1486
- if (!instanceRef.current) {
1487
- throw new Error("MapFirst instance not available");
1488
- }
1489
- return await instanceRef.current.runPropertiesSearch(options2);
1490
- }
1491
- }),
1492
- []
1493
- );
1494
- const smartFilterSearch = import_react9.default.useMemo(
1495
- () => ({
1496
- search: async (options2) => {
1497
- if (!instanceRef.current) {
1498
- throw new Error("MapFirst instance not available");
1499
- }
1500
- 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");
1501
1495
  }
1502
- }),
1496
+ return await instanceRef.current.runPropertiesSearch(options2);
1497
+ },
1503
1498
  []
1504
1499
  );
1505
- const boundsSearch = import_react9.default.useMemo(
1506
- () => ({
1507
- perform: async () => {
1508
- if (!instanceRef.current) {
1509
- return null;
1510
- }
1511
- 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");
1512
1504
  }
1513
- }),
1505
+ return await instanceRef.current.runSmartFilterSearch(options2);
1506
+ },
1514
1507
  []
1515
1508
  );
1509
+ const boundsSearch = import_react9.default.useCallback(async () => {
1510
+ if (!instanceRef.current) {
1511
+ return null;
1512
+ }
1513
+ return await instanceRef.current.performBoundsSearch();
1514
+ }, []);
1516
1515
  const mapLibreAttachedRef = import_react9.default.useRef(false);
1517
1516
  const attachMapLibre = import_react9.default.useCallback(
1518
1517
  (map, maplibregl, options2) => {
package/dist/index.mjs CHANGED
@@ -1410,6 +1410,14 @@ function useMapFirst(options) {
1410
1410
  onSearchingStateChange: (searching) => {
1411
1411
  updateStateField(setState, "isSearching", searching);
1412
1412
  forwardCallback(optionsRef, "onSearchingStateChange", searching);
1413
+ },
1414
+ onFirstCallDoneChange: (firstCallDone) => {
1415
+ updateStateField(setState, "firstCallDone", firstCallDone);
1416
+ forwardCallback(optionsRef, "onFirstCallDoneChange", firstCallDone);
1417
+ },
1418
+ onIsFlyToAnimatingChange: (animating) => {
1419
+ updateStateField(setState, "isFlyToAnimating", animating);
1420
+ forwardCallback(optionsRef, "onIsFlyToAnimatingChange", animating);
1413
1421
  }
1414
1422
  }
1415
1423
  };
@@ -1440,39 +1448,30 @@ function useMapFirst(options) {
1440
1448
  },
1441
1449
  []
1442
1450
  );
1443
- const propertiesSearch = React6.useMemo(
1444
- () => ({
1445
- search: async (options2) => {
1446
- if (!instanceRef.current) {
1447
- throw new Error("MapFirst instance not available");
1448
- }
1449
- return await instanceRef.current.runPropertiesSearch(options2);
1450
- }
1451
- }),
1452
- []
1453
- );
1454
- const smartFilterSearch = React6.useMemo(
1455
- () => ({
1456
- search: async (options2) => {
1457
- if (!instanceRef.current) {
1458
- throw new Error("MapFirst instance not available");
1459
- }
1460
- 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");
1461
1455
  }
1462
- }),
1456
+ return await instanceRef.current.runPropertiesSearch(options2);
1457
+ },
1463
1458
  []
1464
1459
  );
1465
- const boundsSearch = React6.useMemo(
1466
- () => ({
1467
- perform: async () => {
1468
- if (!instanceRef.current) {
1469
- return null;
1470
- }
1471
- 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");
1472
1464
  }
1473
- }),
1465
+ return await instanceRef.current.runSmartFilterSearch(options2);
1466
+ },
1474
1467
  []
1475
1468
  );
1469
+ const boundsSearch = React6.useCallback(async () => {
1470
+ if (!instanceRef.current) {
1471
+ return null;
1472
+ }
1473
+ return await instanceRef.current.performBoundsSearch();
1474
+ }, []);
1476
1475
  const mapLibreAttachedRef = React6.useRef(false);
1477
1476
  const attachMapLibre = React6.useCallback(
1478
1477
  (map, maplibregl, options2) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mapfirst.ai/react",
3
- "version": "0.0.43",
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",
@@ -40,7 +40,7 @@
40
40
  "react": ">=17"
41
41
  },
42
42
  "dependencies": {
43
- "@mapfirst.ai/core": "0.0.37"
43
+ "@mapfirst.ai/core": "0.0.38"
44
44
  },
45
45
  "scripts": {
46
46
  "build": "tsup src/index.tsx --format esm,cjs --dts --clean"