@garagem-ai/site-sdk 0.4.2 → 0.4.4
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 +16 -11
- package/dist/index.d.mts +130 -3
- package/dist/index.d.ts +130 -3
- package/dist/index.js +431 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +417 -3
- package/dist/index.mjs.map +1 -1
- package/dist/react.js +1 -1
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +1 -1
- package/dist/react.mjs.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +51 -0
- package/src/fetchers.ts +2 -1
- package/src/index.ts +33 -0
- package/src/leads.ts +343 -0
- package/src/react/styles/search-chrome-css.generated.ts +1 -1
- package/src/schedule.ts +236 -0
- package/src/studio-contract.ts +32 -2
package/README.md
CHANGED
|
@@ -54,17 +54,22 @@ raw escape hatch when you need full control.
|
|
|
54
54
|
|
|
55
55
|
### Friendly layer (recommended for most use cases)
|
|
56
56
|
|
|
57
|
-
| API
|
|
58
|
-
|
|
|
59
|
-
| `getListings({ siteId, filters?, next? })`
|
|
60
|
-
| `getListing({ siteId, listingId, next? })`
|
|
61
|
-
| `getSimilarListings({ siteId, listingId, limit?, next? })`
|
|
62
|
-
| `getSite({ siteId? \| domain?, next? })`
|
|
63
|
-
| `getCmsCollections({ siteId })`
|
|
64
|
-
| `getCmsCollection({ siteId, slug })`
|
|
65
|
-
| `getCmsEntries({ siteId, collection, limit?, offset? })`
|
|
66
|
-
| `getCmsEntry({ siteId, collection, slug })`
|
|
67
|
-
| `
|
|
57
|
+
| API | Description |
|
|
58
|
+
| ------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
59
|
+
| `getListings({ siteId, filters?, next? })` | Paginated listings for a site, with simple `filters` (`city`, `businessType`, `propertyType`, `neighborhood`, `minPrice`, `maxPrice`, `limit`, `offset`) |
|
|
60
|
+
| `getListing({ siteId, listingId, next? })` | Full detail of a single listing |
|
|
61
|
+
| `getSimilarListings({ siteId, listingId, limit?, next? })` | Similar listings carousel (same card shape as `getListings`) |
|
|
62
|
+
| `getSite({ siteId? \| domain?, next? })` | Public site profile (returns `null` if unknown) |
|
|
63
|
+
| `getCmsCollections({ siteId })` | List CMS collections |
|
|
64
|
+
| `getCmsCollection({ siteId, slug })` | One CMS collection schema |
|
|
65
|
+
| `getCmsEntries({ siteId, collection, limit?, offset? })` | Published CMS entries only |
|
|
66
|
+
| `getCmsEntry({ siteId, collection, slug })` | One published CMS entry |
|
|
67
|
+
| `getSearchUi({ siteId, next? })` | Tenant search schema (filters, slugs) |
|
|
68
|
+
| `getLeadUi({ siteId, next? })` | Visit-default lead dialog schema (weekday hours, Sat/Sun flags) |
|
|
69
|
+
| `submitVisitLead({ siteId, listingId, … })` | POST a visit lead (`listing.id` UUID; civil `visitDate` or `Date`/ISO instant normalized in the schedule timezone) |
|
|
70
|
+
| `submitContactLead({ siteId, listingId, … })` | POST a contact lead (no date/time) |
|
|
71
|
+
| `slotsForDate` / `normalizeVisitDate` / `expandVisitSchedule` | Pure schedule helpers (`America/Sao_Paulo`, default Mon–Fri 06:00–22:00) |
|
|
72
|
+
| `resolvePublicSiteId({ host?, fallback? })` | Preview uses `fallback` (`GARAGEM_SITE_ID`); live hosts resolve via `getSite({ domain })` |
|
|
68
73
|
|
|
69
74
|
### Advanced layer (when the friendly one isn't enough)
|
|
70
75
|
|
package/dist/index.d.mts
CHANGED
|
@@ -147,6 +147,116 @@ declare function getCmsEntries(options: GetCmsEntriesOptions): Promise<CmsEntrie
|
|
|
147
147
|
/** Fetch one published CMS entry by slug. */
|
|
148
148
|
declare function getCmsEntry(options: GetCmsEntryOptions): Promise<CmsEntry>;
|
|
149
149
|
|
|
150
|
+
/**
|
|
151
|
+
* Visit-lead schedule: hours in, slots out. Pure — no fetch, no React.
|
|
152
|
+
* Calendar dates are civil dates in `timeZone` (America/Sao_Paulo), never
|
|
153
|
+
* UTC midnight from `new Date("YYYY-MM-DD")`.
|
|
154
|
+
*/
|
|
155
|
+
declare const VISIT_TIME_ZONE: "America/Sao_Paulo";
|
|
156
|
+
type HHmm = string;
|
|
157
|
+
type VisitHours = {
|
|
158
|
+
start: HHmm;
|
|
159
|
+
end: HHmm;
|
|
160
|
+
};
|
|
161
|
+
type VisitScheduleConfig = {
|
|
162
|
+
timeZone: typeof VISIT_TIME_ZONE;
|
|
163
|
+
saturday: boolean;
|
|
164
|
+
sunday: boolean;
|
|
165
|
+
weekday: VisitHours;
|
|
166
|
+
weekend: VisitHours | null;
|
|
167
|
+
minHoursAhead: number;
|
|
168
|
+
};
|
|
169
|
+
type VisitSchedule = VisitScheduleConfig & {
|
|
170
|
+
disabledDays: number[];
|
|
171
|
+
weekdayTimeSlots: HHmm[];
|
|
172
|
+
weekendTimeSlots: HHmm[];
|
|
173
|
+
timeSlots: HHmm[];
|
|
174
|
+
};
|
|
175
|
+
declare function expandVisitTimeSlots(hours: VisitHours): HHmm[];
|
|
176
|
+
declare function expandVisitSchedule(config: VisitScheduleConfig): VisitSchedule;
|
|
177
|
+
declare const STUDIO_DEFAULT_VISIT_SCHEDULE: VisitSchedule;
|
|
178
|
+
/** Normalize a civil date or ISO instant to YYYY-MM-DD in `timeZone`. */
|
|
179
|
+
declare function normalizeVisitDate(date: Date | string, timeZone?: string): string | null;
|
|
180
|
+
declare function slotsForDate(schedule: VisitSchedule, date: Date | string, now?: Date): HHmm[];
|
|
181
|
+
declare function isVisitSlotAllowed(schedule: VisitSchedule, visitDate: Date | string, visitTime: HHmm, now?: Date): boolean;
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Headless visit / contact leads. Schema via GET /leads/ui; POST always
|
|
185
|
+
* goes to the webhook (`source: "site-sdk"`). v0 draws the dialog.
|
|
186
|
+
*/
|
|
187
|
+
|
|
188
|
+
type LeadFieldId = "name" | "email" | "phone" | "message";
|
|
189
|
+
type LeadField = {
|
|
190
|
+
id: LeadFieldId;
|
|
191
|
+
required: boolean;
|
|
192
|
+
};
|
|
193
|
+
type LeadUi = {
|
|
194
|
+
defaultVariant: "visit";
|
|
195
|
+
timeZone: "America/Sao_Paulo";
|
|
196
|
+
variants: {
|
|
197
|
+
visit: {
|
|
198
|
+
ctaLabel: string;
|
|
199
|
+
requireDateTime: true;
|
|
200
|
+
schedule: VisitSchedule;
|
|
201
|
+
fields: LeadField[];
|
|
202
|
+
};
|
|
203
|
+
contact: {
|
|
204
|
+
ctaLabel: string;
|
|
205
|
+
requireDateTime: false;
|
|
206
|
+
whatsappPhone: string | null;
|
|
207
|
+
fields: LeadField[];
|
|
208
|
+
};
|
|
209
|
+
};
|
|
210
|
+
};
|
|
211
|
+
type GetLeadUiOptions = {
|
|
212
|
+
siteId: string;
|
|
213
|
+
baseUrl?: string;
|
|
214
|
+
fetch?: FetchLike;
|
|
215
|
+
next?: RequestNextOptions;
|
|
216
|
+
};
|
|
217
|
+
type LeadContact = {
|
|
218
|
+
name: string;
|
|
219
|
+
email?: string;
|
|
220
|
+
phone?: string;
|
|
221
|
+
message?: string;
|
|
222
|
+
};
|
|
223
|
+
type LeadSubmitBase = LeadContact & {
|
|
224
|
+
siteId: string;
|
|
225
|
+
baseUrl?: string;
|
|
226
|
+
fetch?: FetchLike;
|
|
227
|
+
listingId: string;
|
|
228
|
+
visitorId?: string;
|
|
229
|
+
brokerRef?: string;
|
|
230
|
+
referrer?: string;
|
|
231
|
+
};
|
|
232
|
+
type VisitLeadInput = LeadSubmitBase & {
|
|
233
|
+
visitDate: Date | string;
|
|
234
|
+
visitTime: HHmm;
|
|
235
|
+
schedule?: VisitSchedule;
|
|
236
|
+
};
|
|
237
|
+
type ContactLeadInput = LeadSubmitBase;
|
|
238
|
+
type LeadSubmitResult = {
|
|
239
|
+
ok: true;
|
|
240
|
+
status: 202;
|
|
241
|
+
id: string;
|
|
242
|
+
};
|
|
243
|
+
type LeadSubmitErrorCode = "invalid_listing_id" | "invalid_contact" | "invalid_slot" | "rate_limited" | "not_found" | "http" | "network";
|
|
244
|
+
declare class LeadSubmitError extends Error {
|
|
245
|
+
readonly code: LeadSubmitErrorCode;
|
|
246
|
+
readonly status?: number;
|
|
247
|
+
readonly retryAfterSeconds?: number;
|
|
248
|
+
constructor(message: string, info: {
|
|
249
|
+
code: LeadSubmitErrorCode;
|
|
250
|
+
status?: number;
|
|
251
|
+
retryAfterSeconds?: number;
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
/** Fallback when GET /leads/ui fails — same default the API publishes. */
|
|
255
|
+
declare function studioDefaultLeadUi(): LeadUi;
|
|
256
|
+
declare function getLeadUi(options: GetLeadUiOptions): Promise<LeadUi>;
|
|
257
|
+
declare function submitVisitLead(input: VisitLeadInput): Promise<LeadSubmitResult>;
|
|
258
|
+
declare function submitContactLead(input: ContactLeadInput): Promise<LeadSubmitResult>;
|
|
259
|
+
|
|
150
260
|
/** Public listing URLs. Prefer `listing.path` from the API; fallback is `/imoveis/id-{listingCode}`. */
|
|
151
261
|
declare function listingLookupKey(raw: string): string;
|
|
152
262
|
declare function listingPublicPath(listing: {
|
|
@@ -248,10 +358,10 @@ declare const STUDIO_SDK_CONTRACT: {
|
|
|
248
358
|
/**
|
|
249
359
|
* Exact pin for generated Studio sites. Must be ≥ `selfInjectSince` so
|
|
250
360
|
* prompts that skip the layout chrome tag match the tarball v0 installs.
|
|
251
|
-
* This PR’s changeset publishes that tarball as 0.4.
|
|
361
|
+
* This PR’s changeset publishes that tarball as 0.4.3 — do not generate
|
|
252
362
|
* against this floor until Version Packages is on npm.
|
|
253
363
|
*/
|
|
254
|
-
readonly minNpmVersion: "0.4.
|
|
364
|
+
readonly minNpmVersion: "0.4.3";
|
|
255
365
|
/** First release where ListingCard and ResultsSkeleton inject the sheet. */
|
|
256
366
|
readonly selfInjectSince: "0.4.2";
|
|
257
367
|
readonly chromeStrategy: "self-inject";
|
|
@@ -268,13 +378,17 @@ declare const STUDIO_SDK_CONTRACT: {
|
|
|
268
378
|
readonly SearchChromeStyles: "0.4.1";
|
|
269
379
|
};
|
|
270
380
|
readonly forbiddenImports: readonly ["@garagem-ai/site-sdk/react/search.css"];
|
|
381
|
+
readonly leadStrategy: "visit-default";
|
|
382
|
+
readonly leadExports: readonly ["getLeadUi", "submitVisitLead", "submitContactLead", "slotsForDate", "expandVisitSchedule", "expandVisitTimeSlots", "isVisitSlotAllowed", "STUDIO_DEFAULT_VISIT_SCHEDULE"];
|
|
271
383
|
};
|
|
272
384
|
type StudioSdkContract = typeof STUDIO_SDK_CONTRACT;
|
|
385
|
+
declare function hasShowcaseLeadsPostUrl(text: string): boolean;
|
|
273
386
|
declare function coerceNpmVersion(raw: unknown): string | null;
|
|
274
387
|
declare function compareSemver(a: string, b: string): number;
|
|
275
388
|
declare function parseReactSdkNamedImports(source: string): string[];
|
|
276
389
|
declare function unavailableReactImports(source: string, pin: string): string[];
|
|
277
390
|
declare function studioSdkPinInstruction(): string;
|
|
391
|
+
declare function studioLeadInstruction(): string;
|
|
278
392
|
declare function studioChromeInstruction(): string;
|
|
279
393
|
/**
|
|
280
394
|
* Tokens that must not appear in Studio codegen (prompts, recipes, repair).
|
|
@@ -366,6 +480,19 @@ interface GaragemClient {
|
|
|
366
480
|
siteId?: string;
|
|
367
481
|
next?: RequestNextOptions;
|
|
368
482
|
}): Promise<CmsEntry>;
|
|
483
|
+
/** Visit/contact dialog schema (slots, labels). */
|
|
484
|
+
getLeadUi(args?: {
|
|
485
|
+
siteId?: string;
|
|
486
|
+
next?: RequestNextOptions;
|
|
487
|
+
}): Promise<LeadUi>;
|
|
488
|
+
/** POST a visit lead (`leadType: "visit"`). */
|
|
489
|
+
submitVisitLead(args: Omit<VisitLeadInput, "siteId" | "baseUrl" | "fetch"> & {
|
|
490
|
+
siteId?: string;
|
|
491
|
+
}): Promise<LeadSubmitResult>;
|
|
492
|
+
/** POST a contact lead (`leadType: "contact"`). */
|
|
493
|
+
submitContactLead(args: Omit<ContactLeadInput, "siteId" | "baseUrl" | "fetch"> & {
|
|
494
|
+
siteId?: string;
|
|
495
|
+
}): Promise<LeadSubmitResult>;
|
|
369
496
|
}
|
|
370
497
|
/**
|
|
371
498
|
* Bind base URL, fetch and site to a single client object. Useful when
|
|
@@ -377,4 +504,4 @@ interface GaragemClient {
|
|
|
377
504
|
*/
|
|
378
505
|
declare function createGaragemClient(options?: CreateGaragemClientOptions): GaragemClient;
|
|
379
506
|
|
|
380
|
-
export { AppliedSearchChange, AppliedSearchQuery, CmsCollection, CmsEntriesResult, CmsEntry, type CreateGaragemClientOptions, type FetchLike, type GaragemClient, GaragemSdkError, type GetCmsCollectionOptions, type GetCmsCollectionsOptions, type GetCmsEntriesOptions, type GetCmsEntryOptions, type GetListingOptions, type GetListingsOptions, type GetSearchUiOptions, type GetSimilarListingsOptions, type GetSiteOptions, ListingDetail, ListingFilters, ListingsResult, type LocationFilterInput, QueryListingsFilters, type QueryListingsOptions, QueryListingsParams, QueryListingsResult, RequestNextOptions, type ResolvePublicSiteIdOptions, SEARCH_CSS_RECIPE, SEARCH_CSS_VARS, STUDIO_SDK_CONTRACT, STUDIO_SDK_PACKAGE, type SearchListingsOptions, SearchListingsParams, SearchListingsResult, SearchPathFilters, SearchUi, SearchUiDictionary, SimilarListingsResult, Site, type StudioSdkContract, coerceNpmVersion, compareSemver, composeSearchPublicHref, composeSearchPublicPath, createGaragemClient, formatAreaM2, formatGroupedInteger, formatListingPrice, getCmsCollection, getCmsCollections, getCmsEntries, getCmsEntry, getListing, getListings, getSearchUi, getSimilarListings, getSite, isStudioPreviewHost, listingBusinessLabel, listingLookupKey, listingPublicPath, mergeAppliedSearchQueryIntoSearch, parseAppliedSearchQuery, parseGroupedInteger, parseReactSdkNamedImports, parseSearchPublicPath, pathFiltersToQueryFilters, pathLocationToFilterInput, queryListings, reduceAppliedSearchQuery, resolvePublicSiteId, searchListings, serializeAppliedSearchQuery, studioChromeInstruction, studioCodegenContractViolations, studioSdkPinInstruction, unavailableReactImports };
|
|
507
|
+
export { AppliedSearchChange, AppliedSearchQuery, CmsCollection, CmsEntriesResult, CmsEntry, type ContactLeadInput, type CreateGaragemClientOptions, type FetchLike, type GaragemClient, GaragemSdkError, type GetCmsCollectionOptions, type GetCmsCollectionsOptions, type GetCmsEntriesOptions, type GetCmsEntryOptions, type GetLeadUiOptions, type GetListingOptions, type GetListingsOptions, type GetSearchUiOptions, type GetSimilarListingsOptions, type GetSiteOptions, type HHmm, type LeadContact, type LeadField, type LeadFieldId, LeadSubmitError, type LeadSubmitErrorCode, type LeadSubmitResult, type LeadUi, ListingDetail, ListingFilters, ListingsResult, type LocationFilterInput, QueryListingsFilters, type QueryListingsOptions, QueryListingsParams, QueryListingsResult, RequestNextOptions, type ResolvePublicSiteIdOptions, SEARCH_CSS_RECIPE, SEARCH_CSS_VARS, STUDIO_DEFAULT_VISIT_SCHEDULE, STUDIO_SDK_CONTRACT, STUDIO_SDK_PACKAGE, type SearchListingsOptions, SearchListingsParams, SearchListingsResult, SearchPathFilters, SearchUi, SearchUiDictionary, SimilarListingsResult, Site, type StudioSdkContract, VISIT_TIME_ZONE, type VisitHours, type VisitLeadInput, type VisitSchedule, type VisitScheduleConfig, coerceNpmVersion, compareSemver, composeSearchPublicHref, composeSearchPublicPath, createGaragemClient, expandVisitSchedule, expandVisitTimeSlots, formatAreaM2, formatGroupedInteger, formatListingPrice, getCmsCollection, getCmsCollections, getCmsEntries, getCmsEntry, getLeadUi, getListing, getListings, getSearchUi, getSimilarListings, getSite, hasShowcaseLeadsPostUrl, isStudioPreviewHost, isVisitSlotAllowed, listingBusinessLabel, listingLookupKey, listingPublicPath, mergeAppliedSearchQueryIntoSearch, normalizeVisitDate, parseAppliedSearchQuery, parseGroupedInteger, parseReactSdkNamedImports, parseSearchPublicPath, pathFiltersToQueryFilters, pathLocationToFilterInput, queryListings, reduceAppliedSearchQuery, resolvePublicSiteId, searchListings, serializeAppliedSearchQuery, slotsForDate, studioChromeInstruction, studioCodegenContractViolations, studioDefaultLeadUi, studioLeadInstruction, studioSdkPinInstruction, submitContactLead, submitVisitLead, unavailableReactImports };
|
package/dist/index.d.ts
CHANGED
|
@@ -147,6 +147,116 @@ declare function getCmsEntries(options: GetCmsEntriesOptions): Promise<CmsEntrie
|
|
|
147
147
|
/** Fetch one published CMS entry by slug. */
|
|
148
148
|
declare function getCmsEntry(options: GetCmsEntryOptions): Promise<CmsEntry>;
|
|
149
149
|
|
|
150
|
+
/**
|
|
151
|
+
* Visit-lead schedule: hours in, slots out. Pure — no fetch, no React.
|
|
152
|
+
* Calendar dates are civil dates in `timeZone` (America/Sao_Paulo), never
|
|
153
|
+
* UTC midnight from `new Date("YYYY-MM-DD")`.
|
|
154
|
+
*/
|
|
155
|
+
declare const VISIT_TIME_ZONE: "America/Sao_Paulo";
|
|
156
|
+
type HHmm = string;
|
|
157
|
+
type VisitHours = {
|
|
158
|
+
start: HHmm;
|
|
159
|
+
end: HHmm;
|
|
160
|
+
};
|
|
161
|
+
type VisitScheduleConfig = {
|
|
162
|
+
timeZone: typeof VISIT_TIME_ZONE;
|
|
163
|
+
saturday: boolean;
|
|
164
|
+
sunday: boolean;
|
|
165
|
+
weekday: VisitHours;
|
|
166
|
+
weekend: VisitHours | null;
|
|
167
|
+
minHoursAhead: number;
|
|
168
|
+
};
|
|
169
|
+
type VisitSchedule = VisitScheduleConfig & {
|
|
170
|
+
disabledDays: number[];
|
|
171
|
+
weekdayTimeSlots: HHmm[];
|
|
172
|
+
weekendTimeSlots: HHmm[];
|
|
173
|
+
timeSlots: HHmm[];
|
|
174
|
+
};
|
|
175
|
+
declare function expandVisitTimeSlots(hours: VisitHours): HHmm[];
|
|
176
|
+
declare function expandVisitSchedule(config: VisitScheduleConfig): VisitSchedule;
|
|
177
|
+
declare const STUDIO_DEFAULT_VISIT_SCHEDULE: VisitSchedule;
|
|
178
|
+
/** Normalize a civil date or ISO instant to YYYY-MM-DD in `timeZone`. */
|
|
179
|
+
declare function normalizeVisitDate(date: Date | string, timeZone?: string): string | null;
|
|
180
|
+
declare function slotsForDate(schedule: VisitSchedule, date: Date | string, now?: Date): HHmm[];
|
|
181
|
+
declare function isVisitSlotAllowed(schedule: VisitSchedule, visitDate: Date | string, visitTime: HHmm, now?: Date): boolean;
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Headless visit / contact leads. Schema via GET /leads/ui; POST always
|
|
185
|
+
* goes to the webhook (`source: "site-sdk"`). v0 draws the dialog.
|
|
186
|
+
*/
|
|
187
|
+
|
|
188
|
+
type LeadFieldId = "name" | "email" | "phone" | "message";
|
|
189
|
+
type LeadField = {
|
|
190
|
+
id: LeadFieldId;
|
|
191
|
+
required: boolean;
|
|
192
|
+
};
|
|
193
|
+
type LeadUi = {
|
|
194
|
+
defaultVariant: "visit";
|
|
195
|
+
timeZone: "America/Sao_Paulo";
|
|
196
|
+
variants: {
|
|
197
|
+
visit: {
|
|
198
|
+
ctaLabel: string;
|
|
199
|
+
requireDateTime: true;
|
|
200
|
+
schedule: VisitSchedule;
|
|
201
|
+
fields: LeadField[];
|
|
202
|
+
};
|
|
203
|
+
contact: {
|
|
204
|
+
ctaLabel: string;
|
|
205
|
+
requireDateTime: false;
|
|
206
|
+
whatsappPhone: string | null;
|
|
207
|
+
fields: LeadField[];
|
|
208
|
+
};
|
|
209
|
+
};
|
|
210
|
+
};
|
|
211
|
+
type GetLeadUiOptions = {
|
|
212
|
+
siteId: string;
|
|
213
|
+
baseUrl?: string;
|
|
214
|
+
fetch?: FetchLike;
|
|
215
|
+
next?: RequestNextOptions;
|
|
216
|
+
};
|
|
217
|
+
type LeadContact = {
|
|
218
|
+
name: string;
|
|
219
|
+
email?: string;
|
|
220
|
+
phone?: string;
|
|
221
|
+
message?: string;
|
|
222
|
+
};
|
|
223
|
+
type LeadSubmitBase = LeadContact & {
|
|
224
|
+
siteId: string;
|
|
225
|
+
baseUrl?: string;
|
|
226
|
+
fetch?: FetchLike;
|
|
227
|
+
listingId: string;
|
|
228
|
+
visitorId?: string;
|
|
229
|
+
brokerRef?: string;
|
|
230
|
+
referrer?: string;
|
|
231
|
+
};
|
|
232
|
+
type VisitLeadInput = LeadSubmitBase & {
|
|
233
|
+
visitDate: Date | string;
|
|
234
|
+
visitTime: HHmm;
|
|
235
|
+
schedule?: VisitSchedule;
|
|
236
|
+
};
|
|
237
|
+
type ContactLeadInput = LeadSubmitBase;
|
|
238
|
+
type LeadSubmitResult = {
|
|
239
|
+
ok: true;
|
|
240
|
+
status: 202;
|
|
241
|
+
id: string;
|
|
242
|
+
};
|
|
243
|
+
type LeadSubmitErrorCode = "invalid_listing_id" | "invalid_contact" | "invalid_slot" | "rate_limited" | "not_found" | "http" | "network";
|
|
244
|
+
declare class LeadSubmitError extends Error {
|
|
245
|
+
readonly code: LeadSubmitErrorCode;
|
|
246
|
+
readonly status?: number;
|
|
247
|
+
readonly retryAfterSeconds?: number;
|
|
248
|
+
constructor(message: string, info: {
|
|
249
|
+
code: LeadSubmitErrorCode;
|
|
250
|
+
status?: number;
|
|
251
|
+
retryAfterSeconds?: number;
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
/** Fallback when GET /leads/ui fails — same default the API publishes. */
|
|
255
|
+
declare function studioDefaultLeadUi(): LeadUi;
|
|
256
|
+
declare function getLeadUi(options: GetLeadUiOptions): Promise<LeadUi>;
|
|
257
|
+
declare function submitVisitLead(input: VisitLeadInput): Promise<LeadSubmitResult>;
|
|
258
|
+
declare function submitContactLead(input: ContactLeadInput): Promise<LeadSubmitResult>;
|
|
259
|
+
|
|
150
260
|
/** Public listing URLs. Prefer `listing.path` from the API; fallback is `/imoveis/id-{listingCode}`. */
|
|
151
261
|
declare function listingLookupKey(raw: string): string;
|
|
152
262
|
declare function listingPublicPath(listing: {
|
|
@@ -248,10 +358,10 @@ declare const STUDIO_SDK_CONTRACT: {
|
|
|
248
358
|
/**
|
|
249
359
|
* Exact pin for generated Studio sites. Must be ≥ `selfInjectSince` so
|
|
250
360
|
* prompts that skip the layout chrome tag match the tarball v0 installs.
|
|
251
|
-
* This PR’s changeset publishes that tarball as 0.4.
|
|
361
|
+
* This PR’s changeset publishes that tarball as 0.4.3 — do not generate
|
|
252
362
|
* against this floor until Version Packages is on npm.
|
|
253
363
|
*/
|
|
254
|
-
readonly minNpmVersion: "0.4.
|
|
364
|
+
readonly minNpmVersion: "0.4.3";
|
|
255
365
|
/** First release where ListingCard and ResultsSkeleton inject the sheet. */
|
|
256
366
|
readonly selfInjectSince: "0.4.2";
|
|
257
367
|
readonly chromeStrategy: "self-inject";
|
|
@@ -268,13 +378,17 @@ declare const STUDIO_SDK_CONTRACT: {
|
|
|
268
378
|
readonly SearchChromeStyles: "0.4.1";
|
|
269
379
|
};
|
|
270
380
|
readonly forbiddenImports: readonly ["@garagem-ai/site-sdk/react/search.css"];
|
|
381
|
+
readonly leadStrategy: "visit-default";
|
|
382
|
+
readonly leadExports: readonly ["getLeadUi", "submitVisitLead", "submitContactLead", "slotsForDate", "expandVisitSchedule", "expandVisitTimeSlots", "isVisitSlotAllowed", "STUDIO_DEFAULT_VISIT_SCHEDULE"];
|
|
271
383
|
};
|
|
272
384
|
type StudioSdkContract = typeof STUDIO_SDK_CONTRACT;
|
|
385
|
+
declare function hasShowcaseLeadsPostUrl(text: string): boolean;
|
|
273
386
|
declare function coerceNpmVersion(raw: unknown): string | null;
|
|
274
387
|
declare function compareSemver(a: string, b: string): number;
|
|
275
388
|
declare function parseReactSdkNamedImports(source: string): string[];
|
|
276
389
|
declare function unavailableReactImports(source: string, pin: string): string[];
|
|
277
390
|
declare function studioSdkPinInstruction(): string;
|
|
391
|
+
declare function studioLeadInstruction(): string;
|
|
278
392
|
declare function studioChromeInstruction(): string;
|
|
279
393
|
/**
|
|
280
394
|
* Tokens that must not appear in Studio codegen (prompts, recipes, repair).
|
|
@@ -366,6 +480,19 @@ interface GaragemClient {
|
|
|
366
480
|
siteId?: string;
|
|
367
481
|
next?: RequestNextOptions;
|
|
368
482
|
}): Promise<CmsEntry>;
|
|
483
|
+
/** Visit/contact dialog schema (slots, labels). */
|
|
484
|
+
getLeadUi(args?: {
|
|
485
|
+
siteId?: string;
|
|
486
|
+
next?: RequestNextOptions;
|
|
487
|
+
}): Promise<LeadUi>;
|
|
488
|
+
/** POST a visit lead (`leadType: "visit"`). */
|
|
489
|
+
submitVisitLead(args: Omit<VisitLeadInput, "siteId" | "baseUrl" | "fetch"> & {
|
|
490
|
+
siteId?: string;
|
|
491
|
+
}): Promise<LeadSubmitResult>;
|
|
492
|
+
/** POST a contact lead (`leadType: "contact"`). */
|
|
493
|
+
submitContactLead(args: Omit<ContactLeadInput, "siteId" | "baseUrl" | "fetch"> & {
|
|
494
|
+
siteId?: string;
|
|
495
|
+
}): Promise<LeadSubmitResult>;
|
|
369
496
|
}
|
|
370
497
|
/**
|
|
371
498
|
* Bind base URL, fetch and site to a single client object. Useful when
|
|
@@ -377,4 +504,4 @@ interface GaragemClient {
|
|
|
377
504
|
*/
|
|
378
505
|
declare function createGaragemClient(options?: CreateGaragemClientOptions): GaragemClient;
|
|
379
506
|
|
|
380
|
-
export { AppliedSearchChange, AppliedSearchQuery, CmsCollection, CmsEntriesResult, CmsEntry, type CreateGaragemClientOptions, type FetchLike, type GaragemClient, GaragemSdkError, type GetCmsCollectionOptions, type GetCmsCollectionsOptions, type GetCmsEntriesOptions, type GetCmsEntryOptions, type GetListingOptions, type GetListingsOptions, type GetSearchUiOptions, type GetSimilarListingsOptions, type GetSiteOptions, ListingDetail, ListingFilters, ListingsResult, type LocationFilterInput, QueryListingsFilters, type QueryListingsOptions, QueryListingsParams, QueryListingsResult, RequestNextOptions, type ResolvePublicSiteIdOptions, SEARCH_CSS_RECIPE, SEARCH_CSS_VARS, STUDIO_SDK_CONTRACT, STUDIO_SDK_PACKAGE, type SearchListingsOptions, SearchListingsParams, SearchListingsResult, SearchPathFilters, SearchUi, SearchUiDictionary, SimilarListingsResult, Site, type StudioSdkContract, coerceNpmVersion, compareSemver, composeSearchPublicHref, composeSearchPublicPath, createGaragemClient, formatAreaM2, formatGroupedInteger, formatListingPrice, getCmsCollection, getCmsCollections, getCmsEntries, getCmsEntry, getListing, getListings, getSearchUi, getSimilarListings, getSite, isStudioPreviewHost, listingBusinessLabel, listingLookupKey, listingPublicPath, mergeAppliedSearchQueryIntoSearch, parseAppliedSearchQuery, parseGroupedInteger, parseReactSdkNamedImports, parseSearchPublicPath, pathFiltersToQueryFilters, pathLocationToFilterInput, queryListings, reduceAppliedSearchQuery, resolvePublicSiteId, searchListings, serializeAppliedSearchQuery, studioChromeInstruction, studioCodegenContractViolations, studioSdkPinInstruction, unavailableReactImports };
|
|
507
|
+
export { AppliedSearchChange, AppliedSearchQuery, CmsCollection, CmsEntriesResult, CmsEntry, type ContactLeadInput, type CreateGaragemClientOptions, type FetchLike, type GaragemClient, GaragemSdkError, type GetCmsCollectionOptions, type GetCmsCollectionsOptions, type GetCmsEntriesOptions, type GetCmsEntryOptions, type GetLeadUiOptions, type GetListingOptions, type GetListingsOptions, type GetSearchUiOptions, type GetSimilarListingsOptions, type GetSiteOptions, type HHmm, type LeadContact, type LeadField, type LeadFieldId, LeadSubmitError, type LeadSubmitErrorCode, type LeadSubmitResult, type LeadUi, ListingDetail, ListingFilters, ListingsResult, type LocationFilterInput, QueryListingsFilters, type QueryListingsOptions, QueryListingsParams, QueryListingsResult, RequestNextOptions, type ResolvePublicSiteIdOptions, SEARCH_CSS_RECIPE, SEARCH_CSS_VARS, STUDIO_DEFAULT_VISIT_SCHEDULE, STUDIO_SDK_CONTRACT, STUDIO_SDK_PACKAGE, type SearchListingsOptions, SearchListingsParams, SearchListingsResult, SearchPathFilters, SearchUi, SearchUiDictionary, SimilarListingsResult, Site, type StudioSdkContract, VISIT_TIME_ZONE, type VisitHours, type VisitLeadInput, type VisitSchedule, type VisitScheduleConfig, coerceNpmVersion, compareSemver, composeSearchPublicHref, composeSearchPublicPath, createGaragemClient, expandVisitSchedule, expandVisitTimeSlots, formatAreaM2, formatGroupedInteger, formatListingPrice, getCmsCollection, getCmsCollections, getCmsEntries, getCmsEntry, getLeadUi, getListing, getListings, getSearchUi, getSimilarListings, getSite, hasShowcaseLeadsPostUrl, isStudioPreviewHost, isVisitSlotAllowed, listingBusinessLabel, listingLookupKey, listingPublicPath, mergeAppliedSearchQueryIntoSearch, normalizeVisitDate, parseAppliedSearchQuery, parseGroupedInteger, parseReactSdkNamedImports, parseSearchPublicPath, pathFiltersToQueryFilters, pathLocationToFilterInput, queryListings, reduceAppliedSearchQuery, resolvePublicSiteId, searchListings, serializeAppliedSearchQuery, slotsForDate, studioChromeInstruction, studioCodegenContractViolations, studioDefaultLeadUi, studioLeadInstruction, studioSdkPinInstruction, submitContactLead, submitVisitLead, unavailableReactImports };
|