@garagem-ai/site-sdk 0.4.5 → 0.4.7
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 +14 -6
- package/dist/index.d.mts +20 -4
- package/dist/index.d.ts +20 -4
- package/dist/index.js +60 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +55 -11
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.mts +5 -2
- package/dist/react.d.ts +5 -2
- package/dist/react.js +7 -5
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +7 -5
- package/dist/react.mjs.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +5 -0
- package/src/leads.ts +8 -2
- package/src/react/search-chrome.tsx +4 -2
- package/src/react/search-page.tsx +5 -2
- package/src/react/search.css +0 -6
- package/src/react/styles/search-chrome-css.generated.ts +2 -2
- package/src/schedule.ts +22 -7
- package/src/studio-contract.ts +39 -4
package/README.md
CHANGED
|
@@ -269,16 +269,24 @@ import { SearchPage, ResultsSkeleton } from "@garagem-ai/site-sdk/react";
|
|
|
269
269
|
|
|
270
270
|
export default function ImoveisPage() {
|
|
271
271
|
return (
|
|
272
|
-
<
|
|
273
|
-
<
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
272
|
+
<main className="w-full">
|
|
273
|
+
<div className="mx-auto w-full max-w-site px-4">
|
|
274
|
+
<Suspense fallback={<ResultsSkeleton />}>
|
|
275
|
+
<SearchPage
|
|
276
|
+
as="div"
|
|
277
|
+
siteId={process.env.NEXT_PUBLIC_GARAGEM_SITE_ID!}
|
|
278
|
+
variant="toolbar"
|
|
279
|
+
/>
|
|
280
|
+
</Suspense>
|
|
281
|
+
</div>
|
|
282
|
+
</main>
|
|
278
283
|
);
|
|
279
284
|
}
|
|
280
285
|
```
|
|
281
286
|
|
|
287
|
+
SearchPage fills its parent. Constrain width with `.max-w-site` and
|
|
288
|
+
`--site-max-width` (`STUDIO_SITE_LAYOUT` — Editor default `80rem` / `px-4`).
|
|
289
|
+
|
|
282
290
|
`variant` is `toolbar` (default), `dialog`, or `sidebar`. Customize with
|
|
283
291
|
CSS variables (`SEARCH_CSS_VARS` / `SEARCH_CSS_RECIPE` in `globals.css`),
|
|
284
292
|
`classNames`, `icons`, and `data-slot`. Home and search should share
|
package/dist/index.d.mts
CHANGED
|
@@ -172,6 +172,7 @@ type VisitSchedule = VisitScheduleConfig & {
|
|
|
172
172
|
weekendTimeSlots: HHmm[];
|
|
173
173
|
timeSlots: HHmm[];
|
|
174
174
|
};
|
|
175
|
+
declare function normalizeVisitTime(value: string): HHmm | null;
|
|
175
176
|
declare function expandVisitTimeSlots(hours: VisitHours): HHmm[];
|
|
176
177
|
declare function expandVisitSchedule(config: VisitScheduleConfig): VisitSchedule;
|
|
177
178
|
declare const STUDIO_DEFAULT_VISIT_SCHEDULE: VisitSchedule;
|
|
@@ -358,10 +359,10 @@ declare const STUDIO_SDK_CONTRACT: {
|
|
|
358
359
|
/**
|
|
359
360
|
* Exact pin for generated Studio sites. Must be ≥ `selfInjectSince` so
|
|
360
361
|
* prompts that skip the layout chrome tag match the tarball v0 installs.
|
|
361
|
-
*
|
|
362
|
-
*
|
|
362
|
+
* 0.4.7 lets SearchPage fill the site wrapper (`as="div"`) with no
|
|
363
|
+
* nested 80rem inset and no padding on the search slot.
|
|
363
364
|
*/
|
|
364
|
-
readonly minNpmVersion: "0.4.
|
|
365
|
+
readonly minNpmVersion: "0.4.7";
|
|
365
366
|
/** First release where ListingCard and ResultsSkeleton inject the sheet. */
|
|
366
367
|
readonly selfInjectSince: "0.4.2";
|
|
367
368
|
readonly chromeStrategy: "self-inject";
|
|
@@ -382,6 +383,21 @@ declare const STUDIO_SDK_CONTRACT: {
|
|
|
382
383
|
readonly leadExports: readonly ["getLeadUi", "submitVisitLead", "submitContactLead", "slotsForDate", "expandVisitSchedule", "expandVisitTimeSlots", "isVisitSlotAllowed", "STUDIO_DEFAULT_VISIT_SCHEDULE"];
|
|
383
384
|
};
|
|
384
385
|
type StudioSdkContract = typeof STUDIO_SDK_CONTRACT;
|
|
386
|
+
/**
|
|
387
|
+
* Global Studio content width. Mirrors Editor default `7xl` / `px-4`
|
|
388
|
+
* without the Marca picker — v0 sites are not `@garagem/ui`.
|
|
389
|
+
* Rem options match packages/ui `MAX_WIDTH_REM` so a later
|
|
390
|
+
* “make it wider” chat only edits `--site-max-width`.
|
|
391
|
+
*/
|
|
392
|
+
declare const STUDIO_SITE_LAYOUT: {
|
|
393
|
+
readonly maxWidthRem: "80rem";
|
|
394
|
+
readonly maxWidthRemOptions: readonly ["64rem", "80rem", "120rem", "160rem", "240rem"];
|
|
395
|
+
readonly surfaceClassName: "w-full";
|
|
396
|
+
readonly wrapperClassName: "mx-auto w-full max-w-site px-4";
|
|
397
|
+
};
|
|
398
|
+
declare function studioSiteWidthCss(): string;
|
|
399
|
+
declare function studioLayoutInstruction(): string;
|
|
400
|
+
declare function studioSearchLandmarkInstruction(): string;
|
|
385
401
|
declare function hasShowcaseLeadsPostUrl(text: string): boolean;
|
|
386
402
|
declare function coerceNpmVersion(raw: unknown): string | null;
|
|
387
403
|
declare function compareSemver(a: string, b: string): number;
|
|
@@ -504,4 +520,4 @@ interface GaragemClient {
|
|
|
504
520
|
*/
|
|
505
521
|
declare function createGaragemClient(options?: CreateGaragemClientOptions): GaragemClient;
|
|
506
522
|
|
|
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 };
|
|
523
|
+
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, STUDIO_SITE_LAYOUT, 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, normalizeVisitTime, parseAppliedSearchQuery, parseGroupedInteger, parseReactSdkNamedImports, parseSearchPublicPath, pathFiltersToQueryFilters, pathLocationToFilterInput, queryListings, reduceAppliedSearchQuery, resolvePublicSiteId, searchListings, serializeAppliedSearchQuery, slotsForDate, studioChromeInstruction, studioCodegenContractViolations, studioDefaultLeadUi, studioLayoutInstruction, studioLeadInstruction, studioSdkPinInstruction, studioSearchLandmarkInstruction, studioSiteWidthCss, submitContactLead, submitVisitLead, unavailableReactImports };
|
package/dist/index.d.ts
CHANGED
|
@@ -172,6 +172,7 @@ type VisitSchedule = VisitScheduleConfig & {
|
|
|
172
172
|
weekendTimeSlots: HHmm[];
|
|
173
173
|
timeSlots: HHmm[];
|
|
174
174
|
};
|
|
175
|
+
declare function normalizeVisitTime(value: string): HHmm | null;
|
|
175
176
|
declare function expandVisitTimeSlots(hours: VisitHours): HHmm[];
|
|
176
177
|
declare function expandVisitSchedule(config: VisitScheduleConfig): VisitSchedule;
|
|
177
178
|
declare const STUDIO_DEFAULT_VISIT_SCHEDULE: VisitSchedule;
|
|
@@ -358,10 +359,10 @@ declare const STUDIO_SDK_CONTRACT: {
|
|
|
358
359
|
/**
|
|
359
360
|
* Exact pin for generated Studio sites. Must be ≥ `selfInjectSince` so
|
|
360
361
|
* prompts that skip the layout chrome tag match the tarball v0 installs.
|
|
361
|
-
*
|
|
362
|
-
*
|
|
362
|
+
* 0.4.7 lets SearchPage fill the site wrapper (`as="div"`) with no
|
|
363
|
+
* nested 80rem inset and no padding on the search slot.
|
|
363
364
|
*/
|
|
364
|
-
readonly minNpmVersion: "0.4.
|
|
365
|
+
readonly minNpmVersion: "0.4.7";
|
|
365
366
|
/** First release where ListingCard and ResultsSkeleton inject the sheet. */
|
|
366
367
|
readonly selfInjectSince: "0.4.2";
|
|
367
368
|
readonly chromeStrategy: "self-inject";
|
|
@@ -382,6 +383,21 @@ declare const STUDIO_SDK_CONTRACT: {
|
|
|
382
383
|
readonly leadExports: readonly ["getLeadUi", "submitVisitLead", "submitContactLead", "slotsForDate", "expandVisitSchedule", "expandVisitTimeSlots", "isVisitSlotAllowed", "STUDIO_DEFAULT_VISIT_SCHEDULE"];
|
|
383
384
|
};
|
|
384
385
|
type StudioSdkContract = typeof STUDIO_SDK_CONTRACT;
|
|
386
|
+
/**
|
|
387
|
+
* Global Studio content width. Mirrors Editor default `7xl` / `px-4`
|
|
388
|
+
* without the Marca picker — v0 sites are not `@garagem/ui`.
|
|
389
|
+
* Rem options match packages/ui `MAX_WIDTH_REM` so a later
|
|
390
|
+
* “make it wider” chat only edits `--site-max-width`.
|
|
391
|
+
*/
|
|
392
|
+
declare const STUDIO_SITE_LAYOUT: {
|
|
393
|
+
readonly maxWidthRem: "80rem";
|
|
394
|
+
readonly maxWidthRemOptions: readonly ["64rem", "80rem", "120rem", "160rem", "240rem"];
|
|
395
|
+
readonly surfaceClassName: "w-full";
|
|
396
|
+
readonly wrapperClassName: "mx-auto w-full max-w-site px-4";
|
|
397
|
+
};
|
|
398
|
+
declare function studioSiteWidthCss(): string;
|
|
399
|
+
declare function studioLayoutInstruction(): string;
|
|
400
|
+
declare function studioSearchLandmarkInstruction(): string;
|
|
385
401
|
declare function hasShowcaseLeadsPostUrl(text: string): boolean;
|
|
386
402
|
declare function coerceNpmVersion(raw: unknown): string | null;
|
|
387
403
|
declare function compareSemver(a: string, b: string): number;
|
|
@@ -504,4 +520,4 @@ interface GaragemClient {
|
|
|
504
520
|
*/
|
|
505
521
|
declare function createGaragemClient(options?: CreateGaragemClientOptions): GaragemClient;
|
|
506
522
|
|
|
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 };
|
|
523
|
+
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, STUDIO_SITE_LAYOUT, 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, normalizeVisitTime, parseAppliedSearchQuery, parseGroupedInteger, parseReactSdkNamedImports, parseSearchPublicPath, pathFiltersToQueryFilters, pathLocationToFilterInput, queryListings, reduceAppliedSearchQuery, resolvePublicSiteId, searchListings, serializeAppliedSearchQuery, slotsForDate, studioChromeInstruction, studioCodegenContractViolations, studioDefaultLeadUi, studioLayoutInstruction, studioLeadInstruction, studioSdkPinInstruction, studioSearchLandmarkInstruction, studioSiteWidthCss, submitContactLead, submitVisitLead, unavailableReactImports };
|
package/dist/index.js
CHANGED
|
@@ -29,6 +29,7 @@ __export(src_exports, {
|
|
|
29
29
|
STUDIO_DEFAULT_VISIT_SCHEDULE: () => STUDIO_DEFAULT_VISIT_SCHEDULE,
|
|
30
30
|
STUDIO_SDK_CONTRACT: () => STUDIO_SDK_CONTRACT,
|
|
31
31
|
STUDIO_SDK_PACKAGE: () => STUDIO_SDK_PACKAGE,
|
|
32
|
+
STUDIO_SITE_LAYOUT: () => STUDIO_SITE_LAYOUT,
|
|
32
33
|
TOOLBAR_PRIMARY_FILTER_IDS: () => TOOLBAR_PRIMARY_FILTER_IDS,
|
|
33
34
|
VISIT_TIME_ZONE: () => VISIT_TIME_ZONE,
|
|
34
35
|
applyPathFilter: () => applyPathFilter,
|
|
@@ -71,6 +72,7 @@ __export(src_exports, {
|
|
|
71
72
|
listingPublicPath: () => listingPublicPath,
|
|
72
73
|
mergeAppliedSearchQueryIntoSearch: () => mergeAppliedSearchQueryIntoSearch2,
|
|
73
74
|
normalizeVisitDate: () => normalizeVisitDate,
|
|
75
|
+
normalizeVisitTime: () => normalizeVisitTime,
|
|
74
76
|
paginationPages: () => paginationPages,
|
|
75
77
|
parseAppliedSearchQuery: () => parseAppliedSearchQuery2,
|
|
76
78
|
parseGroupedInteger: () => parseGroupedInteger,
|
|
@@ -94,8 +96,11 @@ __export(src_exports, {
|
|
|
94
96
|
studioChromeInstruction: () => studioChromeInstruction,
|
|
95
97
|
studioCodegenContractViolations: () => studioCodegenContractViolations,
|
|
96
98
|
studioDefaultLeadUi: () => studioDefaultLeadUi,
|
|
99
|
+
studioLayoutInstruction: () => studioLayoutInstruction,
|
|
97
100
|
studioLeadInstruction: () => studioLeadInstruction,
|
|
98
101
|
studioSdkPinInstruction: () => studioSdkPinInstruction,
|
|
102
|
+
studioSearchLandmarkInstruction: () => studioSearchLandmarkInstruction,
|
|
103
|
+
studioSiteWidthCss: () => studioSiteWidthCss,
|
|
99
104
|
submitContactLead: () => submitContactLead,
|
|
100
105
|
submitVisitLead: () => submitVisitLead,
|
|
101
106
|
toListingCardModel: () => toListingCardModel,
|
|
@@ -425,8 +430,10 @@ async function getCmsEntry(options) {
|
|
|
425
430
|
// src/schedule.ts
|
|
426
431
|
var VISIT_TIME_ZONE = "America/Sao_Paulo";
|
|
427
432
|
var HHMM_RE = /^([01]\d|2[0-3]):([0-5]\d)$/;
|
|
433
|
+
var VISIT_TIME_RE = /^([01]\d|2[0-3]):([0-5]\d)(?::[0-5]\d(?:\.\d+)?)?$/;
|
|
428
434
|
var YMD_RE = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
429
435
|
var ISO_INSTANT_RE = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$/;
|
|
436
|
+
var DATETIME_LOCAL_RE = /^(\d{4}-\d{2}-\d{2})T\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?$/;
|
|
430
437
|
var WEEKDAY_SHORT = {
|
|
431
438
|
Sun: 0,
|
|
432
439
|
Mon: 1,
|
|
@@ -449,6 +456,10 @@ function minutesOfDay(hhmm) {
|
|
|
449
456
|
if (!parsed) return null;
|
|
450
457
|
return parsed.hour * 60 + parsed.minute;
|
|
451
458
|
}
|
|
459
|
+
function normalizeVisitTime(value) {
|
|
460
|
+
const match = VISIT_TIME_RE.exec(value.trim());
|
|
461
|
+
return match ? `${match[1]}:${match[2]}` : null;
|
|
462
|
+
}
|
|
452
463
|
function expandVisitTimeSlots(hours) {
|
|
453
464
|
const start = minutesOfDay(hours.start);
|
|
454
465
|
const end = minutesOfDay(hours.end);
|
|
@@ -530,10 +541,15 @@ function parseYmd(value) {
|
|
|
530
541
|
}
|
|
531
542
|
function normalizeVisitDate(date, timeZone = VISIT_TIME_ZONE) {
|
|
532
543
|
if (typeof date === "string") {
|
|
533
|
-
|
|
534
|
-
if (
|
|
535
|
-
|
|
536
|
-
|
|
544
|
+
const trimmed = date.trim();
|
|
545
|
+
if (parseYmd(trimmed)) return trimmed;
|
|
546
|
+
if (ISO_INSTANT_RE.test(trimmed)) {
|
|
547
|
+
const instant = new Date(trimmed);
|
|
548
|
+
return Number.isFinite(instant.getTime()) ? calendarYmd(instant, timeZone) : null;
|
|
549
|
+
}
|
|
550
|
+
const local = DATETIME_LOCAL_RE.exec(trimmed);
|
|
551
|
+
if (local && parseYmd(local[1])) return local[1];
|
|
552
|
+
return null;
|
|
537
553
|
}
|
|
538
554
|
if (date instanceof Date && Number.isFinite(date.getTime())) {
|
|
539
555
|
return calendarYmd(date, timeZone);
|
|
@@ -569,7 +585,9 @@ function slotsForDate(schedule, date, now = /* @__PURE__ */ new Date()) {
|
|
|
569
585
|
});
|
|
570
586
|
}
|
|
571
587
|
function isVisitSlotAllowed(schedule, visitDate, visitTime, now = /* @__PURE__ */ new Date()) {
|
|
572
|
-
|
|
588
|
+
const time = normalizeVisitTime(visitTime);
|
|
589
|
+
if (!time) return false;
|
|
590
|
+
return slotsForDate(schedule, visitDate, now).includes(time);
|
|
573
591
|
}
|
|
574
592
|
|
|
575
593
|
// src/resolve-site-id.ts
|
|
@@ -784,7 +802,8 @@ async function submitVisitLead(input) {
|
|
|
784
802
|
const prepared = leadPostContext(input);
|
|
785
803
|
const schedule = input.schedule ?? STUDIO_DEFAULT_VISIT_SCHEDULE;
|
|
786
804
|
const visitDate = normalizeVisitDate(input.visitDate, schedule.timeZone);
|
|
787
|
-
|
|
805
|
+
const visitTime = normalizeVisitTime(input.visitTime);
|
|
806
|
+
if (!visitDate || !visitTime || !isVisitSlotAllowed(schedule, visitDate, visitTime)) {
|
|
788
807
|
throw new LeadSubmitError(
|
|
789
808
|
"Garagem SDK: visitDate/visitTime is outside the published schedule.",
|
|
790
809
|
{ code: "invalid_slot" }
|
|
@@ -801,7 +820,7 @@ async function submitVisitLead(input) {
|
|
|
801
820
|
propertyId: prepared.listingId,
|
|
802
821
|
listingId: prepared.listingId,
|
|
803
822
|
visitDate,
|
|
804
|
-
visitTime
|
|
823
|
+
visitTime,
|
|
805
824
|
...prepared.extras
|
|
806
825
|
}
|
|
807
826
|
});
|
|
@@ -1683,10 +1702,10 @@ var STUDIO_SDK_CONTRACT = {
|
|
|
1683
1702
|
/**
|
|
1684
1703
|
* Exact pin for generated Studio sites. Must be ≥ `selfInjectSince` so
|
|
1685
1704
|
* prompts that skip the layout chrome tag match the tarball v0 installs.
|
|
1686
|
-
*
|
|
1687
|
-
*
|
|
1705
|
+
* 0.4.7 lets SearchPage fill the site wrapper (`as="div"`) with no
|
|
1706
|
+
* nested 80rem inset and no padding on the search slot.
|
|
1688
1707
|
*/
|
|
1689
|
-
minNpmVersion: "0.4.
|
|
1708
|
+
minNpmVersion: "0.4.7",
|
|
1690
1709
|
/** First release where ListingCard and ResultsSkeleton inject the sheet. */
|
|
1691
1710
|
selfInjectSince: "0.4.2",
|
|
1692
1711
|
chromeStrategy: "self-inject",
|
|
@@ -1720,6 +1739,31 @@ var STUDIO_SDK_CONTRACT = {
|
|
|
1720
1739
|
"STUDIO_DEFAULT_VISIT_SCHEDULE"
|
|
1721
1740
|
]
|
|
1722
1741
|
};
|
|
1742
|
+
var STUDIO_SITE_LAYOUT = {
|
|
1743
|
+
maxWidthRem: "80rem",
|
|
1744
|
+
maxWidthRemOptions: ["64rem", "80rem", "120rem", "160rem", "240rem"],
|
|
1745
|
+
surfaceClassName: "w-full",
|
|
1746
|
+
wrapperClassName: "mx-auto w-full max-w-site px-4"
|
|
1747
|
+
};
|
|
1748
|
+
function studioSiteWidthCss() {
|
|
1749
|
+
return `:root {
|
|
1750
|
+
--site-max-width: ${STUDIO_SITE_LAYOUT.maxWidthRem};
|
|
1751
|
+
}
|
|
1752
|
+
.max-w-site {
|
|
1753
|
+
max-width: var(--site-max-width);
|
|
1754
|
+
}`;
|
|
1755
|
+
}
|
|
1756
|
+
function studioLayoutInstruction() {
|
|
1757
|
+
const scale = STUDIO_SITE_LAYOUT.maxWidthRemOptions.join(", ");
|
|
1758
|
+
return `Content width (hard rule). In \`app/globals.css\` keep brand tokens and add:
|
|
1759
|
+
\`\`\`css
|
|
1760
|
+
${studioSiteWidthCss()}
|
|
1761
|
+
\`\`\`
|
|
1762
|
+
Every page section is two layers: (1) surface \u2014 \`section\` / header / footer \`${STUDIO_SITE_LAYOUT.surfaceClassName}\`, background to the viewport edges, no max-width class and no horizontal padding; (2) wrapper \u2014 one child \`${STUDIO_SITE_LAYOUT.wrapperClassName}\`. Header and footer use that same inner wrapper. Components fill the wrapper (\`w-full\`). Never nest a second max-width container with extra horizontal padding. ${studioSearchLandmarkInstruction()} Do not use \`ml-auto\` on the content wrapper. To make the site narrower or wider, change ONLY \`--site-max-width\` in \`app/globals.css\` (allowed: ${scale}; default ${STUDIO_SITE_LAYOUT.maxWidthRem}). Do not edit wrapper class names, padding, or per-page containers.`;
|
|
1763
|
+
}
|
|
1764
|
+
function studioSearchLandmarkInstruction() {
|
|
1765
|
+
return `Search at \`/imoveis\` (hard rule). The page landmark is \`<main className="${STUDIO_SITE_LAYOUT.surfaceClassName}">\` with one child \`${STUDIO_SITE_LAYOUT.wrapperClassName}\`. Pass \`as="div"\` to \`SearchPage\` so it is not a second main. Do not wrap \`SearchPage\` in \`<section>\`. The wrapper has no extra vertical padding class.`;
|
|
1766
|
+
}
|
|
1723
1767
|
var REACT_SDK_NAMED_IMPORT_RE = /(?:^|[\n;])\s*import\s+(?!type\b)(?:type\s+)?\{([^}]+)\}\s+from\s+['"]@garagem-ai\/site-sdk\/react['"]/g;
|
|
1724
1768
|
var SHOWCASE_LEADS_POST_URL_RE = /\/api\/sites\/[^\s"']*\/leads(?!\/ui)/;
|
|
1725
1769
|
function hasShowcaseLeadsPostUrl(text) {
|
|
@@ -1788,7 +1832,7 @@ function studioChromeInstruction() {
|
|
|
1788
1832
|
STUDIO_SDK_CONTRACT.minNpmVersion,
|
|
1789
1833
|
STUDIO_SDK_CONTRACT.selfInjectSince
|
|
1790
1834
|
) >= 0 ? "`SearchPage`, `ListingCard`, and `ResultsSkeleton`" : "`SearchPage`";
|
|
1791
|
-
return `Search chrome CSS is injected by ${injectors} (JS \`<style>\` tag). Never \`import "@garagem-ai/site-sdk/react/search.css"\` \u2014 v0 preview cannot load npm CSS. Do not copy SDK layout into the app. Theme via CSS variables in \`app/globals.css\` (\`SEARCH_CSS_RECIPE\` / \`--garagem-*\`), \`classNames\`, and \`data-slot\`.`;
|
|
1835
|
+
return `Search chrome CSS is injected by ${injectors} (JS \`<style>\` tag). Never \`import "@garagem-ai/site-sdk/react/search.css"\` \u2014 v0 preview cannot load npm CSS. Do not copy SDK card/toolbar layout into the app. Theme via CSS variables in \`app/globals.css\` (\`SEARCH_CSS_RECIPE\` / \`--garagem-*\`), \`classNames\`, and \`data-slot\`.`;
|
|
1792
1836
|
}
|
|
1793
1837
|
function studioCodegenContractViolations(text) {
|
|
1794
1838
|
const violations = [];
|
|
@@ -1977,6 +2021,7 @@ function createGaragemClient(options = {}) {
|
|
|
1977
2021
|
STUDIO_DEFAULT_VISIT_SCHEDULE,
|
|
1978
2022
|
STUDIO_SDK_CONTRACT,
|
|
1979
2023
|
STUDIO_SDK_PACKAGE,
|
|
2024
|
+
STUDIO_SITE_LAYOUT,
|
|
1980
2025
|
TOOLBAR_PRIMARY_FILTER_IDS,
|
|
1981
2026
|
VISIT_TIME_ZONE,
|
|
1982
2027
|
applyPathFilter,
|
|
@@ -2019,6 +2064,7 @@ function createGaragemClient(options = {}) {
|
|
|
2019
2064
|
listingPublicPath,
|
|
2020
2065
|
mergeAppliedSearchQueryIntoSearch,
|
|
2021
2066
|
normalizeVisitDate,
|
|
2067
|
+
normalizeVisitTime,
|
|
2022
2068
|
paginationPages,
|
|
2023
2069
|
parseAppliedSearchQuery,
|
|
2024
2070
|
parseGroupedInteger,
|
|
@@ -2042,8 +2088,11 @@ function createGaragemClient(options = {}) {
|
|
|
2042
2088
|
studioChromeInstruction,
|
|
2043
2089
|
studioCodegenContractViolations,
|
|
2044
2090
|
studioDefaultLeadUi,
|
|
2091
|
+
studioLayoutInstruction,
|
|
2045
2092
|
studioLeadInstruction,
|
|
2046
2093
|
studioSdkPinInstruction,
|
|
2094
|
+
studioSearchLandmarkInstruction,
|
|
2095
|
+
studioSiteWidthCss,
|
|
2047
2096
|
submitContactLead,
|
|
2048
2097
|
submitVisitLead,
|
|
2049
2098
|
toListingCardModel,
|