@garagem-ai/site-sdk 0.7.0 → 0.9.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/dist/react.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { m as SearchUi, e as Listing, U as LocationNameTables, S as SearchPathFilters, A as AppliedSearchQuery, t as PhotoSearchItem, u as ListingWithMatchedPhoto, F as FetchLike } from './types-photo-search-OeONNDxl.mjs';
1
+ import { j as SearchUi, J as Listing, ai as LocationNameTables, S as SearchPathFilters, A as AppliedSearchQuery, bn as MapSearchSubscription, an as MapBounds, ar as MapPolygon, at as MapSearchResult, aq as MapPinCluster, O as PhotoSearchItem, U as ListingWithMatchedPhoto, F as FetchLike } from './types-photo-search-D88oevZv.mjs';
2
2
 
3
3
  type SiteIdInput = string | Promise<string> | (() => string | Promise<string>);
4
4
  type PublicSearchSnapshot = {
@@ -13,6 +13,11 @@ type PublicSearchSnapshot = {
13
13
  type UsePublicSearchOptions = {
14
14
  siteId: SiteIdInput;
15
15
  baseUrl?: string;
16
+ /**
17
+ * Site publishable key (`pk_live_…`). Sent on schema, location, and
18
+ * listing requests. Not a secret. Omit it to stay on the anonymous budget.
19
+ */
20
+ publishableKey?: string;
16
21
  /**
17
22
  * Query string without `?`, from the server page's `searchParams`.
18
23
  * The hook must not call Next's search-params hook: that suspends the
@@ -51,6 +56,28 @@ type PublicSearchState = {
51
56
 
52
57
  declare function usePublicSearch(options: UsePublicSearchOptions): PublicSearchState;
53
58
 
59
+ interface UseMapSearchOptions extends Omit<MapSearchSubscription, "bounds" | "polygon"> {
60
+ bounds?: MapBounds | null;
61
+ polygon?: MapPolygon | null;
62
+ /** Grid zoom for `clusterPins`. Changing it does not refetch. Default 14. */
63
+ zoom?: number;
64
+ /** Set false to keep the last result without fetching. */
65
+ enabled?: boolean;
66
+ /** Default 400, matching Foundation's map viewport debounce. */
67
+ debounceMs?: number;
68
+ }
69
+ interface UseMapSearchResult extends MapSearchResult {
70
+ clusters: MapPinCluster[];
71
+ loading: boolean;
72
+ error: Error | null;
73
+ }
74
+ /**
75
+ * Search listings as the map moves. Debounces, aborts the previous request,
76
+ * and clusters the masked pins for the current zoom without another search.
77
+ * Disabling keeps the last result and settles `loading`: abort is not an event.
78
+ */
79
+ declare function useMapSearch(options: UseMapSearchOptions): UseMapSearchResult;
80
+
54
81
  /** Same debounce as the CRM "Foto que combina com a busca" evidence lane. */
55
82
  declare const PHOTO_SEARCH_DEBOUNCE_MS = 400;
56
83
  type UsePublicPhotoSearchOptions = {
@@ -90,4 +117,4 @@ type PublicPhotoSearchState = {
90
117
  };
91
118
  declare function usePublicPhotoSearch(options: UsePublicPhotoSearchOptions): PublicPhotoSearchState;
92
119
 
93
- export { PHOTO_SEARCH_DEBOUNCE_MS, type PublicPhotoSearchState, type PublicSearchSnapshot, type PublicSearchState, type SiteIdInput, type UsePublicPhotoSearchOptions, type UsePublicSearchOptions, usePublicPhotoSearch, usePublicSearch };
120
+ export { PHOTO_SEARCH_DEBOUNCE_MS, type PublicPhotoSearchState, type PublicSearchSnapshot, type PublicSearchState, type SiteIdInput, type UseMapSearchOptions, type UseMapSearchResult, type UsePublicPhotoSearchOptions, type UsePublicSearchOptions, useMapSearch, usePublicPhotoSearch, usePublicSearch };
package/dist/react.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { m as SearchUi, e as Listing, U as LocationNameTables, S as SearchPathFilters, A as AppliedSearchQuery, t as PhotoSearchItem, u as ListingWithMatchedPhoto, F as FetchLike } from './types-photo-search-OeONNDxl.js';
1
+ import { j as SearchUi, J as Listing, ai as LocationNameTables, S as SearchPathFilters, A as AppliedSearchQuery, bn as MapSearchSubscription, an as MapBounds, ar as MapPolygon, at as MapSearchResult, aq as MapPinCluster, O as PhotoSearchItem, U as ListingWithMatchedPhoto, F as FetchLike } from './types-photo-search-D88oevZv.js';
2
2
 
3
3
  type SiteIdInput = string | Promise<string> | (() => string | Promise<string>);
4
4
  type PublicSearchSnapshot = {
@@ -13,6 +13,11 @@ type PublicSearchSnapshot = {
13
13
  type UsePublicSearchOptions = {
14
14
  siteId: SiteIdInput;
15
15
  baseUrl?: string;
16
+ /**
17
+ * Site publishable key (`pk_live_…`). Sent on schema, location, and
18
+ * listing requests. Not a secret. Omit it to stay on the anonymous budget.
19
+ */
20
+ publishableKey?: string;
16
21
  /**
17
22
  * Query string without `?`, from the server page's `searchParams`.
18
23
  * The hook must not call Next's search-params hook: that suspends the
@@ -51,6 +56,28 @@ type PublicSearchState = {
51
56
 
52
57
  declare function usePublicSearch(options: UsePublicSearchOptions): PublicSearchState;
53
58
 
59
+ interface UseMapSearchOptions extends Omit<MapSearchSubscription, "bounds" | "polygon"> {
60
+ bounds?: MapBounds | null;
61
+ polygon?: MapPolygon | null;
62
+ /** Grid zoom for `clusterPins`. Changing it does not refetch. Default 14. */
63
+ zoom?: number;
64
+ /** Set false to keep the last result without fetching. */
65
+ enabled?: boolean;
66
+ /** Default 400, matching Foundation's map viewport debounce. */
67
+ debounceMs?: number;
68
+ }
69
+ interface UseMapSearchResult extends MapSearchResult {
70
+ clusters: MapPinCluster[];
71
+ loading: boolean;
72
+ error: Error | null;
73
+ }
74
+ /**
75
+ * Search listings as the map moves. Debounces, aborts the previous request,
76
+ * and clusters the masked pins for the current zoom without another search.
77
+ * Disabling keeps the last result and settles `loading`: abort is not an event.
78
+ */
79
+ declare function useMapSearch(options: UseMapSearchOptions): UseMapSearchResult;
80
+
54
81
  /** Same debounce as the CRM "Foto que combina com a busca" evidence lane. */
55
82
  declare const PHOTO_SEARCH_DEBOUNCE_MS = 400;
56
83
  type UsePublicPhotoSearchOptions = {
@@ -90,4 +117,4 @@ type PublicPhotoSearchState = {
90
117
  };
91
118
  declare function usePublicPhotoSearch(options: UsePublicPhotoSearchOptions): PublicPhotoSearchState;
92
119
 
93
- export { PHOTO_SEARCH_DEBOUNCE_MS, type PublicPhotoSearchState, type PublicSearchSnapshot, type PublicSearchState, type SiteIdInput, type UsePublicPhotoSearchOptions, type UsePublicSearchOptions, usePublicPhotoSearch, usePublicSearch };
120
+ export { PHOTO_SEARCH_DEBOUNCE_MS, type PublicPhotoSearchState, type PublicSearchSnapshot, type PublicSearchState, type SiteIdInput, type UseMapSearchOptions, type UseMapSearchResult, type UsePublicPhotoSearchOptions, type UsePublicSearchOptions, useMapSearch, usePublicPhotoSearch, usePublicSearch };