@garagem-ai/site-sdk 0.5.2 → 0.6.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.
Files changed (42) hide show
  1. package/README.md +16 -25
  2. package/dist/index.d.mts +296 -28
  3. package/dist/index.d.ts +296 -28
  4. package/dist/index.js +469 -53
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.mjs +458 -51
  7. package/dist/index.mjs.map +1 -1
  8. package/dist/react.d.mts +18 -60
  9. package/dist/react.d.ts +18 -60
  10. package/dist/react.js +265 -874
  11. package/dist/react.js.map +1 -1
  12. package/dist/react.mjs +246 -841
  13. package/dist/react.mjs.map +1 -1
  14. package/dist/{search-engine-4ocM0UPk.d.mts → search-engine-CtnLzmwW.d.mts} +13 -181
  15. package/dist/{search-engine-4ocM0UPk.d.ts → search-engine-CtnLzmwW.d.ts} +13 -181
  16. package/package.json +11 -13
  17. package/src/amenity-labels.ts +9 -2
  18. package/src/fetchers.ts +2 -1
  19. package/src/index.ts +20 -2
  20. package/src/internal/url.ts +1 -0
  21. package/src/leads.ts +45 -6
  22. package/src/listing-card-model.ts +4 -1
  23. package/src/listing-detail.ts +8 -2
  24. package/src/phone-countries.ts +97 -0
  25. package/src/phone.ts +431 -0
  26. package/src/presentation.ts +1 -24
  27. package/src/react/index.ts +1 -11
  28. package/src/react/public-search-snapshot.ts +165 -0
  29. package/src/react/staged-filters-mirror.ts +38 -0
  30. package/src/react/types.ts +17 -30
  31. package/src/react/use-public-search.ts +121 -42
  32. package/src/search-engine.ts +3 -0
  33. package/src/studio-contract.ts +63 -21
  34. package/src/types.ts +12 -0
  35. package/src/react/cn.ts +0 -3
  36. package/src/react/listing-card.tsx +0 -98
  37. package/src/react/listing-detail-fields.tsx +0 -119
  38. package/src/react/search-chrome.tsx +0 -29
  39. package/src/react/search.css +0 -214
  40. package/src/react/styles/index.ts +0 -1
  41. package/src/react/styles/search-chrome-css.generated.ts +0 -5
  42. package/src/react/styles/search-chrome-styles.tsx +0 -31
package/dist/react.d.mts CHANGED
@@ -1,34 +1,25 @@
1
- import { ReactNode, CSSProperties, ReactElement } from 'react';
2
- import { w as Listing, E as ListingCardModel, e as SearchUi, j as SearchPathFilters, A as AppliedSearchQuery, W as LocationNameTables, I as ListingDetailFieldsSource, o as AmenityLabelDictionary } from './search-engine-4ocM0UPk.mjs';
1
+ import { e as SearchUi, n as Listing, x as LocationNameTables, o as SearchPathFilters, A as AppliedSearchQuery } from './search-engine-CtnLzmwW.mjs';
3
2
 
4
- type ListingCardClassNames = {
5
- root?: string;
6
- media?: string;
7
- badge?: string;
8
- body?: string;
9
- price?: string;
10
- title?: string;
11
- location?: string;
12
- features?: string;
13
- cta?: string;
14
- };
15
- type ListingCardSlots = {
16
- media?: ReactNode;
17
- badge?: ReactNode;
18
- cta?: ReactNode;
19
- };
20
- type ListingCardProps = {
21
- listing: Listing | ListingCardModel;
22
- href?: string;
23
- className?: string;
24
- classNames?: ListingCardClassNames;
25
- slots?: ListingCardSlots;
26
- style?: CSSProperties;
27
- };
28
3
  type SiteIdInput = string | Promise<string> | (() => string | Promise<string>);
4
+ type PublicSearchSnapshot = {
5
+ schema?: SearchUi | null;
6
+ listings?: Listing[];
7
+ page?: number;
8
+ total?: number;
9
+ totalPages?: number;
10
+ locationNames?: LocationNameTables | null;
11
+ catalogId?: string | null;
12
+ };
29
13
  type UsePublicSearchOptions = {
30
14
  siteId: SiteIdInput;
31
15
  baseUrl?: string;
16
+ /**
17
+ * Query string without `?`, from the server page's `searchParams`.
18
+ * The hook must not call Next's search-params hook: that suspends the
19
+ * tree, and Next leaves the resolved HTML in a hidden node until JS runs.
20
+ */
21
+ search?: string;
22
+ initial?: PublicSearchSnapshot;
32
23
  };
33
24
  type PublicSearchState = {
34
25
  schema: SearchUi | null;
@@ -58,39 +49,6 @@ type PublicSearchState = {
58
49
  locationNames: LocationNameTables | null;
59
50
  };
60
51
 
61
- declare function ListingCard({ listing, href, className, classNames, slots, style, }: ListingCardProps): ReactElement;
62
-
63
- type ListingDetailFieldsClassNames = {
64
- root?: string;
65
- facts?: string;
66
- fact?: string;
67
- values?: string;
68
- value?: string;
69
- amenityGroup?: string;
70
- amenityTitle?: string;
71
- amenityList?: string;
72
- amenityLabel?: string;
73
- };
74
- type ListingDetailFieldsProps = {
75
- listing: ListingDetailFieldsSource;
76
- dictionary?: AmenityLabelDictionary | null;
77
- className?: string;
78
- classNames?: ListingDetailFieldsClassNames;
79
- style?: CSSProperties;
80
- };
81
- /**
82
- * Renders listing facts, values, and amenities. Omits empty rows so JSX
83
- * never prints `undefined`. Theme via `data-slot` / classNames — do not
84
- * reimplement these blocks in generated pages.
85
- */
86
- declare function ListingDetailFields({ listing, dictionary, className, classNames, style, }: ListingDetailFieldsProps): ReactElement | null;
87
-
88
- declare function SearchChromeStyles(): ReactElement | null;
89
-
90
- declare function ResultsSkeleton({ className, }: {
91
- className?: string;
92
- }): ReactElement;
93
-
94
52
  declare function usePublicSearch(options: UsePublicSearchOptions): PublicSearchState;
95
53
 
96
- export { ListingCard, type ListingCardClassNames, type ListingCardProps, type ListingCardSlots, ListingDetailFields, type ListingDetailFieldsClassNames, type ListingDetailFieldsProps, type PublicSearchState, ResultsSkeleton, SearchChromeStyles, type SiteIdInput, type UsePublicSearchOptions, usePublicSearch };
54
+ export { type PublicSearchSnapshot, type PublicSearchState, type SiteIdInput, type UsePublicSearchOptions, usePublicSearch };
package/dist/react.d.ts CHANGED
@@ -1,34 +1,25 @@
1
- import { ReactNode, CSSProperties, ReactElement } from 'react';
2
- import { w as Listing, E as ListingCardModel, e as SearchUi, j as SearchPathFilters, A as AppliedSearchQuery, W as LocationNameTables, I as ListingDetailFieldsSource, o as AmenityLabelDictionary } from './search-engine-4ocM0UPk.js';
1
+ import { e as SearchUi, n as Listing, x as LocationNameTables, o as SearchPathFilters, A as AppliedSearchQuery } from './search-engine-CtnLzmwW.js';
3
2
 
4
- type ListingCardClassNames = {
5
- root?: string;
6
- media?: string;
7
- badge?: string;
8
- body?: string;
9
- price?: string;
10
- title?: string;
11
- location?: string;
12
- features?: string;
13
- cta?: string;
14
- };
15
- type ListingCardSlots = {
16
- media?: ReactNode;
17
- badge?: ReactNode;
18
- cta?: ReactNode;
19
- };
20
- type ListingCardProps = {
21
- listing: Listing | ListingCardModel;
22
- href?: string;
23
- className?: string;
24
- classNames?: ListingCardClassNames;
25
- slots?: ListingCardSlots;
26
- style?: CSSProperties;
27
- };
28
3
  type SiteIdInput = string | Promise<string> | (() => string | Promise<string>);
4
+ type PublicSearchSnapshot = {
5
+ schema?: SearchUi | null;
6
+ listings?: Listing[];
7
+ page?: number;
8
+ total?: number;
9
+ totalPages?: number;
10
+ locationNames?: LocationNameTables | null;
11
+ catalogId?: string | null;
12
+ };
29
13
  type UsePublicSearchOptions = {
30
14
  siteId: SiteIdInput;
31
15
  baseUrl?: string;
16
+ /**
17
+ * Query string without `?`, from the server page's `searchParams`.
18
+ * The hook must not call Next's search-params hook: that suspends the
19
+ * tree, and Next leaves the resolved HTML in a hidden node until JS runs.
20
+ */
21
+ search?: string;
22
+ initial?: PublicSearchSnapshot;
32
23
  };
33
24
  type PublicSearchState = {
34
25
  schema: SearchUi | null;
@@ -58,39 +49,6 @@ type PublicSearchState = {
58
49
  locationNames: LocationNameTables | null;
59
50
  };
60
51
 
61
- declare function ListingCard({ listing, href, className, classNames, slots, style, }: ListingCardProps): ReactElement;
62
-
63
- type ListingDetailFieldsClassNames = {
64
- root?: string;
65
- facts?: string;
66
- fact?: string;
67
- values?: string;
68
- value?: string;
69
- amenityGroup?: string;
70
- amenityTitle?: string;
71
- amenityList?: string;
72
- amenityLabel?: string;
73
- };
74
- type ListingDetailFieldsProps = {
75
- listing: ListingDetailFieldsSource;
76
- dictionary?: AmenityLabelDictionary | null;
77
- className?: string;
78
- classNames?: ListingDetailFieldsClassNames;
79
- style?: CSSProperties;
80
- };
81
- /**
82
- * Renders listing facts, values, and amenities. Omits empty rows so JSX
83
- * never prints `undefined`. Theme via `data-slot` / classNames — do not
84
- * reimplement these blocks in generated pages.
85
- */
86
- declare function ListingDetailFields({ listing, dictionary, className, classNames, style, }: ListingDetailFieldsProps): ReactElement | null;
87
-
88
- declare function SearchChromeStyles(): ReactElement | null;
89
-
90
- declare function ResultsSkeleton({ className, }: {
91
- className?: string;
92
- }): ReactElement;
93
-
94
52
  declare function usePublicSearch(options: UsePublicSearchOptions): PublicSearchState;
95
53
 
96
- export { ListingCard, type ListingCardClassNames, type ListingCardProps, type ListingCardSlots, ListingDetailFields, type ListingDetailFieldsClassNames, type ListingDetailFieldsProps, type PublicSearchState, ResultsSkeleton, SearchChromeStyles, type SiteIdInput, type UsePublicSearchOptions, usePublicSearch };
54
+ export { type PublicSearchSnapshot, type PublicSearchState, type SiteIdInput, type UsePublicSearchOptions, usePublicSearch };