@travories/frontend-sdk 0.1.1 → 0.1.2
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 +159 -8
- package/dist/index.d.ts +159 -8
- package/dist/index.js +416 -41
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +413 -42
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -183,6 +183,38 @@ interface HomeSectionsResponse {
|
|
|
183
183
|
trending: HomePackageCard[];
|
|
184
184
|
moreToExplore: HomePackageCard[];
|
|
185
185
|
}
|
|
186
|
+
interface AgencyHostDetails {
|
|
187
|
+
id: string;
|
|
188
|
+
username: string;
|
|
189
|
+
agencyName: string;
|
|
190
|
+
agencyCreatedDate: string;
|
|
191
|
+
rating: number;
|
|
192
|
+
review: number;
|
|
193
|
+
description: string;
|
|
194
|
+
logo: TravoriesImage | null;
|
|
195
|
+
slug: string;
|
|
196
|
+
}
|
|
197
|
+
interface AgencyHostResponse {
|
|
198
|
+
success: boolean;
|
|
199
|
+
message: string;
|
|
200
|
+
hostDetails: AgencyHostDetails;
|
|
201
|
+
}
|
|
202
|
+
interface AgencyAssociationItem {
|
|
203
|
+
id: string;
|
|
204
|
+
name: string;
|
|
205
|
+
url: string;
|
|
206
|
+
image: TravoriesImage | null;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* The bundle `client.agencies.getBundle()` returns — drives `<AgencyDetailView />`.
|
|
210
|
+
* `packages` are this agency's tour packages (`HomePackageCard` shape so the
|
|
211
|
+
* landing carousel components can render them directly).
|
|
212
|
+
*/
|
|
213
|
+
interface AgencyBundle {
|
|
214
|
+
agency: AgencyHostDetails;
|
|
215
|
+
associations: AgencyAssociationItem[];
|
|
216
|
+
packages: HomePackageCard[];
|
|
217
|
+
}
|
|
186
218
|
|
|
187
219
|
declare class PackagesResource {
|
|
188
220
|
private http;
|
|
@@ -211,10 +243,36 @@ declare class PackagesResource {
|
|
|
211
243
|
getBundle(slug: string, options?: HttpRequestOptions): Promise<PackageBundle | null>;
|
|
212
244
|
}
|
|
213
245
|
|
|
246
|
+
/** All agency-scoped endpoints live here so the resource stays focused. */
|
|
247
|
+
declare class AgenciesResource {
|
|
248
|
+
private http;
|
|
249
|
+
constructor(http: HttpClient);
|
|
250
|
+
/** Public profile of an agency by its slug. Null on 404. */
|
|
251
|
+
getBySlug(slug: string, options?: HttpRequestOptions): Promise<AgencyHostResponse | null>;
|
|
252
|
+
/** Partner / association badges shown on the agency profile. */
|
|
253
|
+
getAssociations(slug: string, options?: HttpRequestOptions): Promise<AgencyAssociationItem[]>;
|
|
254
|
+
/**
|
|
255
|
+
* Packages published by this agency. Returns the same card shape as the home
|
|
256
|
+
* sections so `<PackagesCarousel>` / `<PackageCard>` render them directly.
|
|
257
|
+
*/
|
|
258
|
+
getPackages(slug: string, params?: {
|
|
259
|
+
limit?: number;
|
|
260
|
+
page?: number;
|
|
261
|
+
}, options?: HttpRequestOptions): Promise<HomePackageCard[]>;
|
|
262
|
+
/**
|
|
263
|
+
* Convenience: fetch the full agency bundle (profile + associations + their
|
|
264
|
+
* packages) in parallel. Drives `<AgencyDetailView />`.
|
|
265
|
+
*/
|
|
266
|
+
getBundle(slug: string, params?: {
|
|
267
|
+
packagesLimit?: number;
|
|
268
|
+
}, options?: HttpRequestOptions): Promise<AgencyBundle | null>;
|
|
269
|
+
}
|
|
270
|
+
|
|
214
271
|
interface TravoriesClientConfig extends HttpClientConfig {
|
|
215
272
|
}
|
|
216
273
|
/**
|
|
217
|
-
* Main entry point for the Travories SDK.
|
|
274
|
+
* Main entry point for the Travories SDK. Holds the HTTP client and exposes
|
|
275
|
+
* resource modules grouped by domain (packages, agencies).
|
|
218
276
|
*
|
|
219
277
|
* @example
|
|
220
278
|
* ```ts
|
|
@@ -222,17 +280,19 @@ interface TravoriesClientConfig extends HttpClientConfig {
|
|
|
222
280
|
* baseUrl: "https://api.travories.com",
|
|
223
281
|
* });
|
|
224
282
|
*
|
|
225
|
-
* const pkg
|
|
283
|
+
* const pkg = await travories.packages.getBySlug("everest-base-camp");
|
|
284
|
+
* const agency = await travories.agencies.getBySlug("travel-route-pvt-ltd");
|
|
226
285
|
* ```
|
|
227
286
|
*/
|
|
228
287
|
declare class TravoriesClient {
|
|
229
288
|
private http;
|
|
230
289
|
packages: PackagesResource;
|
|
290
|
+
agencies: AgenciesResource;
|
|
231
291
|
constructor(config: TravoriesClientConfig);
|
|
232
|
-
/** Shortcut for `client.packages.getBySlug(slug)`. */
|
|
233
292
|
getPackageBySlug: (slug: string) => Promise<TravoriesPackage | null>;
|
|
234
|
-
/** Shortcut for `client.packages.getBundle(slug)` — package + host + attractions in one call. */
|
|
235
293
|
getPackageBundle: (slug: string) => Promise<PackageBundle | null>;
|
|
294
|
+
getAgencyBySlug: (slug: string) => Promise<AgencyHostResponse | null>;
|
|
295
|
+
getAgencyBundle: (slug: string) => Promise<AgencyBundle | null>;
|
|
236
296
|
}
|
|
237
297
|
/** Factory form, in case you prefer a function over `new`. */
|
|
238
298
|
declare function createTravoriesClient(config: TravoriesClientConfig): TravoriesClient;
|
|
@@ -276,6 +336,19 @@ interface UseHomeSectionsResult {
|
|
|
276
336
|
*/
|
|
277
337
|
declare function useHomeSections(client: TravoriesClient | null): UseHomeSectionsResult;
|
|
278
338
|
|
|
339
|
+
interface UseAgencyBundleResult {
|
|
340
|
+
data: AgencyBundle | null;
|
|
341
|
+
loading: boolean;
|
|
342
|
+
error: Error | null;
|
|
343
|
+
refetch: () => void;
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Fetches an agency profile + associations + their packages in one call.
|
|
347
|
+
* Re-runs when `slug` or `client` changes. Pass `null` slug or client to skip
|
|
348
|
+
* the fetch (useful when consumer already has data via `initialBundle`).
|
|
349
|
+
*/
|
|
350
|
+
declare function useAgencyBundle(client: TravoriesClient | null, slug: string | null | undefined): UseAgencyBundleResult;
|
|
351
|
+
|
|
279
352
|
interface HomeSectionsProps {
|
|
280
353
|
/** Required when `initialSections` is not provided. */
|
|
281
354
|
client?: TravoriesClient;
|
|
@@ -391,7 +464,9 @@ interface PackageCardProps {
|
|
|
391
464
|
* in a new tab. Requires `href`. `onSelect` is NOT called on a normal click
|
|
392
465
|
* in this mode — the browser handles navigation. */
|
|
393
466
|
openInNewTab?: boolean;
|
|
394
|
-
/** When true, show the heart (wishlist) icon. Default
|
|
467
|
+
/** When true, show the heart (wishlist) icon. Default `false` — wishlist
|
|
468
|
+
* state is user-specific and requires the consumer to wire auth + storage.
|
|
469
|
+
* Pass `liked` + `onLike` together to opt in. */
|
|
395
470
|
showHeart?: boolean;
|
|
396
471
|
/** Initial wishlist state. */
|
|
397
472
|
liked?: boolean;
|
|
@@ -420,6 +495,13 @@ interface PackageDetailViewProps {
|
|
|
420
495
|
currency?: string;
|
|
421
496
|
/** Called when the user hits Reserve. If omitted, the button shows a disabled state. */
|
|
422
497
|
onReserve?: (pkg: TravoriesPackage) => void;
|
|
498
|
+
/** Called when the user clicks the host card. Receives the host. */
|
|
499
|
+
onSelectHost?: (host: PackageHost) => void;
|
|
500
|
+
/** When set, host card renders as `<a href={agencyHrefFor(host)}>` — enables
|
|
501
|
+
* cmd/ctrl-click → open in new tab natively. */
|
|
502
|
+
agencyHrefFor?: (host: PackageHost) => string;
|
|
503
|
+
/** Open host link in a new tab (requires `agencyHrefFor`). */
|
|
504
|
+
openAgencyInNewTab?: boolean;
|
|
423
505
|
/** Optional extra class on the root wrapper. */
|
|
424
506
|
className?: string;
|
|
425
507
|
/** Loading state override. */
|
|
@@ -427,7 +509,7 @@ interface PackageDetailViewProps {
|
|
|
427
509
|
/** Not-found state override. */
|
|
428
510
|
renderNotFound?: () => React.ReactNode;
|
|
429
511
|
}
|
|
430
|
-
declare function PackageDetailView({ client, slug, initialBundle, currency, onReserve, className, renderLoading, renderNotFound, }: PackageDetailViewProps): react_jsx_runtime.JSX.Element;
|
|
512
|
+
declare function PackageDetailView({ client, slug, initialBundle, currency, onReserve, onSelectHost, agencyHrefFor, openAgencyInNewTab, className, renderLoading, renderNotFound, }: PackageDetailViewProps): react_jsx_runtime.JSX.Element;
|
|
431
513
|
|
|
432
514
|
/**
|
|
433
515
|
* Legacy view-model types — identical shape to frontend's `types/package.ts`.
|
|
@@ -578,8 +660,28 @@ interface PackageExcludedAndToPackProps {
|
|
|
578
660
|
}
|
|
579
661
|
declare const PackageExcludedAndToPack: React.FC<PackageExcludedAndToPackProps>;
|
|
580
662
|
|
|
663
|
+
/**
|
|
664
|
+
* Common shape both `PackageHost` (returned by the package detail endpoint)
|
|
665
|
+
* and `AgencyHostDetails` (returned by the agency profile endpoint) satisfy.
|
|
666
|
+
* `agencyName` is optional — when present it's preferred over `username`.
|
|
667
|
+
*/
|
|
668
|
+
interface HostCardData {
|
|
669
|
+
username: string;
|
|
670
|
+
agencyName?: string;
|
|
671
|
+
agencyCreatedDate: string;
|
|
672
|
+
rating: number;
|
|
673
|
+
review: number;
|
|
674
|
+
logo: TravoriesImage | null;
|
|
675
|
+
slug: string;
|
|
676
|
+
}
|
|
581
677
|
interface HostCardProps {
|
|
582
|
-
hostData: PackageHost;
|
|
678
|
+
hostData: HostCardData | PackageHost | AgencyHostDetails;
|
|
679
|
+
/** Called when the user clicks the card. Receives the host slug. */
|
|
680
|
+
onAgencyClick?: (slug: string) => void;
|
|
681
|
+
/** When set, the card wraps in `<a href>` so cmd/ctrl-click opens in a new tab. */
|
|
682
|
+
href?: string;
|
|
683
|
+
/** When true (with `href`), the anchor gets `target="_blank"`. */
|
|
684
|
+
openInNewTab?: boolean;
|
|
583
685
|
className?: string;
|
|
584
686
|
}
|
|
585
687
|
declare const HostCard: React.FC<HostCardProps>;
|
|
@@ -625,9 +727,58 @@ declare const buildGalleryMedia: (pkg: TravoriesPackage) => MediaItem[];
|
|
|
625
727
|
declare const buildTopData: (pkg: TravoriesPackage, host: PackageHost | null) => TopData;
|
|
626
728
|
declare const buildDescriptionData: (pkg: TravoriesPackage) => DescriptionData;
|
|
627
729
|
|
|
730
|
+
interface AgencyDetailViewProps {
|
|
731
|
+
/** Required when `initialBundle` is not provided. */
|
|
732
|
+
client?: TravoriesClient;
|
|
733
|
+
/** Agency slug to fetch. */
|
|
734
|
+
slug?: string;
|
|
735
|
+
/** Pre-fetched bundle (SSR pattern). When set, no client-side fetch runs. */
|
|
736
|
+
initialBundle?: AgencyBundle | null;
|
|
737
|
+
/** Currency code for package cards (default "USD"). */
|
|
738
|
+
currency?: string;
|
|
739
|
+
/** Called when the user clicks a package card. */
|
|
740
|
+
onSelectPackage?: (pkg: HomePackageCard) => void;
|
|
741
|
+
/** When set, package cards render as `<a href>` instead of buttons. */
|
|
742
|
+
packageHrefFor?: (pkg: HomePackageCard) => string;
|
|
743
|
+
/** Open package cards in a new tab. Requires `packageHrefFor`. */
|
|
744
|
+
openPackagesInNewTab?: boolean;
|
|
745
|
+
/** Optional class on the root scope wrapper. */
|
|
746
|
+
className?: string;
|
|
747
|
+
/** Render override for the loading state. */
|
|
748
|
+
renderLoading?: () => React.ReactNode;
|
|
749
|
+
/** Render override for the not-found state. */
|
|
750
|
+
renderNotFound?: () => React.ReactNode;
|
|
751
|
+
}
|
|
752
|
+
/**
|
|
753
|
+
* Public agency profile page — drop-in equivalent to `<PackageDetailView />`
|
|
754
|
+
* for the agency route. Pass `client` + `slug` to let the SDK fetch, or
|
|
755
|
+
* `initialBundle` to use server-fetched data (no client-side fetch).
|
|
756
|
+
*
|
|
757
|
+
* Sections rendered (top → bottom):
|
|
758
|
+
* 1. Breadcrumb + title
|
|
759
|
+
* 2. HostCard (left) | Overview block (right)
|
|
760
|
+
* 3. Agency associations / partner badges (if any)
|
|
761
|
+
* 4. Popular packages carousel
|
|
762
|
+
*
|
|
763
|
+
* Reviews / ratings are intentionally not included in this view — they require
|
|
764
|
+
* user-data plumbing that's out of scope for a static SDK component.
|
|
765
|
+
*/
|
|
766
|
+
declare function AgencyDetailView({ client, slug, initialBundle, currency, onSelectPackage, packageHrefFor, openPackagesInNewTab, className, renderLoading, renderNotFound, }: AgencyDetailViewProps): react_jsx_runtime.JSX.Element;
|
|
767
|
+
|
|
768
|
+
interface AgencyAssociationsProps {
|
|
769
|
+
associations: AgencyAssociationItem[];
|
|
770
|
+
title?: string;
|
|
771
|
+
className?: string;
|
|
772
|
+
}
|
|
773
|
+
/**
|
|
774
|
+
* Partner / affiliation badge strip for an agency. Each badge is a link to the
|
|
775
|
+
* partner site (opens in a new tab). Renders nothing if `associations` is empty.
|
|
776
|
+
*/
|
|
777
|
+
declare const AgencyAssociations: React.FC<AgencyAssociationsProps>;
|
|
778
|
+
|
|
628
779
|
declare function pickImageUrl(img: TravoriesImage | null | undefined): string;
|
|
629
780
|
declare function startingPrice(prices: PackagePriceTier[] | undefined): number;
|
|
630
781
|
declare function formatCurrency(amount: number, currency?: string): string;
|
|
631
782
|
declare function formatRating(rating: number | undefined): string;
|
|
632
783
|
|
|
633
|
-
export { BookingCardLite, type DescriptionData, DescriptionSection, GallerySection, type HomePackageCard, type HomeSectionKey, HomeSections, type HomeSectionsContextValue, type HomeSectionsProps, HomeSectionsProvider, type HomeSectionsProviderProps, type HomeSectionsResponse, HostAbout, HostCard, type HttpClientConfig, type HttpRequestOptions, Itinerary, type MajorAttractionItem, type MajorAttractionsResponse, type MediaItem, type PackageBundle, PackageCard, type PackageDay, type PackageDayLocation, PackageDetailView, type PackageDetailViewProps, type PackageDiscount, PackageExcludedAndToPack, type PackageHost, type PackageHostResponse, PackageIncluded, PackageMap, PackageOverview, type PackagePriceTier, type PackageRoute, type PackageRouteGeometry, type PackageRoutesDay, type PackageRoutesResponse, PackagesCarousel, PackagesResource, PackagesSection, type PackagesSectionProps, type ThingItem, type TopData, TopSection, TravoriesApiError, TravoriesClient, type TravoriesClientConfig, type TravoriesImage, type TravoriesImageUrls, type TravoriesPackage, type UseHomeSectionsResult, type UsePackageBundleResult, type UsePackageBySlugResult, buildDescriptionData, buildGalleryMedia, buildTopData, createTravoriesClient, formatCurrency, formatRating, pickImageUrl, startingPrice, useHomeSections, useHomeSectionsContext, usePackageBundle, usePackageBySlug };
|
|
784
|
+
export { AgenciesResource, type AgencyAssociationItem, AgencyAssociations, type AgencyBundle, AgencyDetailView, type AgencyDetailViewProps, type AgencyHostDetails, type AgencyHostResponse, BookingCardLite, type DescriptionData, DescriptionSection, GallerySection, type HomePackageCard, type HomeSectionKey, HomeSections, type HomeSectionsContextValue, type HomeSectionsProps, HomeSectionsProvider, type HomeSectionsProviderProps, type HomeSectionsResponse, HostAbout, HostCard, type HttpClientConfig, type HttpRequestOptions, Itinerary, type MajorAttractionItem, type MajorAttractionsResponse, type MediaItem, type PackageBundle, PackageCard, type PackageDay, type PackageDayLocation, PackageDetailView, type PackageDetailViewProps, type PackageDiscount, PackageExcludedAndToPack, type PackageHost, type PackageHostResponse, PackageIncluded, PackageMap, PackageOverview, type PackagePriceTier, type PackageRoute, type PackageRouteGeometry, type PackageRoutesDay, type PackageRoutesResponse, PackagesCarousel, PackagesResource, PackagesSection, type PackagesSectionProps, type ThingItem, type TopData, TopSection, TravoriesApiError, TravoriesClient, type TravoriesClientConfig, type TravoriesImage, type TravoriesImageUrls, type TravoriesPackage, type UseAgencyBundleResult, type UseHomeSectionsResult, type UsePackageBundleResult, type UsePackageBySlugResult, buildDescriptionData, buildGalleryMedia, buildTopData, createTravoriesClient, formatCurrency, formatRating, pickImageUrl, startingPrice, useAgencyBundle, useHomeSections, useHomeSectionsContext, usePackageBundle, usePackageBySlug };
|
package/dist/index.d.ts
CHANGED
|
@@ -183,6 +183,38 @@ interface HomeSectionsResponse {
|
|
|
183
183
|
trending: HomePackageCard[];
|
|
184
184
|
moreToExplore: HomePackageCard[];
|
|
185
185
|
}
|
|
186
|
+
interface AgencyHostDetails {
|
|
187
|
+
id: string;
|
|
188
|
+
username: string;
|
|
189
|
+
agencyName: string;
|
|
190
|
+
agencyCreatedDate: string;
|
|
191
|
+
rating: number;
|
|
192
|
+
review: number;
|
|
193
|
+
description: string;
|
|
194
|
+
logo: TravoriesImage | null;
|
|
195
|
+
slug: string;
|
|
196
|
+
}
|
|
197
|
+
interface AgencyHostResponse {
|
|
198
|
+
success: boolean;
|
|
199
|
+
message: string;
|
|
200
|
+
hostDetails: AgencyHostDetails;
|
|
201
|
+
}
|
|
202
|
+
interface AgencyAssociationItem {
|
|
203
|
+
id: string;
|
|
204
|
+
name: string;
|
|
205
|
+
url: string;
|
|
206
|
+
image: TravoriesImage | null;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* The bundle `client.agencies.getBundle()` returns — drives `<AgencyDetailView />`.
|
|
210
|
+
* `packages` are this agency's tour packages (`HomePackageCard` shape so the
|
|
211
|
+
* landing carousel components can render them directly).
|
|
212
|
+
*/
|
|
213
|
+
interface AgencyBundle {
|
|
214
|
+
agency: AgencyHostDetails;
|
|
215
|
+
associations: AgencyAssociationItem[];
|
|
216
|
+
packages: HomePackageCard[];
|
|
217
|
+
}
|
|
186
218
|
|
|
187
219
|
declare class PackagesResource {
|
|
188
220
|
private http;
|
|
@@ -211,10 +243,36 @@ declare class PackagesResource {
|
|
|
211
243
|
getBundle(slug: string, options?: HttpRequestOptions): Promise<PackageBundle | null>;
|
|
212
244
|
}
|
|
213
245
|
|
|
246
|
+
/** All agency-scoped endpoints live here so the resource stays focused. */
|
|
247
|
+
declare class AgenciesResource {
|
|
248
|
+
private http;
|
|
249
|
+
constructor(http: HttpClient);
|
|
250
|
+
/** Public profile of an agency by its slug. Null on 404. */
|
|
251
|
+
getBySlug(slug: string, options?: HttpRequestOptions): Promise<AgencyHostResponse | null>;
|
|
252
|
+
/** Partner / association badges shown on the agency profile. */
|
|
253
|
+
getAssociations(slug: string, options?: HttpRequestOptions): Promise<AgencyAssociationItem[]>;
|
|
254
|
+
/**
|
|
255
|
+
* Packages published by this agency. Returns the same card shape as the home
|
|
256
|
+
* sections so `<PackagesCarousel>` / `<PackageCard>` render them directly.
|
|
257
|
+
*/
|
|
258
|
+
getPackages(slug: string, params?: {
|
|
259
|
+
limit?: number;
|
|
260
|
+
page?: number;
|
|
261
|
+
}, options?: HttpRequestOptions): Promise<HomePackageCard[]>;
|
|
262
|
+
/**
|
|
263
|
+
* Convenience: fetch the full agency bundle (profile + associations + their
|
|
264
|
+
* packages) in parallel. Drives `<AgencyDetailView />`.
|
|
265
|
+
*/
|
|
266
|
+
getBundle(slug: string, params?: {
|
|
267
|
+
packagesLimit?: number;
|
|
268
|
+
}, options?: HttpRequestOptions): Promise<AgencyBundle | null>;
|
|
269
|
+
}
|
|
270
|
+
|
|
214
271
|
interface TravoriesClientConfig extends HttpClientConfig {
|
|
215
272
|
}
|
|
216
273
|
/**
|
|
217
|
-
* Main entry point for the Travories SDK.
|
|
274
|
+
* Main entry point for the Travories SDK. Holds the HTTP client and exposes
|
|
275
|
+
* resource modules grouped by domain (packages, agencies).
|
|
218
276
|
*
|
|
219
277
|
* @example
|
|
220
278
|
* ```ts
|
|
@@ -222,17 +280,19 @@ interface TravoriesClientConfig extends HttpClientConfig {
|
|
|
222
280
|
* baseUrl: "https://api.travories.com",
|
|
223
281
|
* });
|
|
224
282
|
*
|
|
225
|
-
* const pkg
|
|
283
|
+
* const pkg = await travories.packages.getBySlug("everest-base-camp");
|
|
284
|
+
* const agency = await travories.agencies.getBySlug("travel-route-pvt-ltd");
|
|
226
285
|
* ```
|
|
227
286
|
*/
|
|
228
287
|
declare class TravoriesClient {
|
|
229
288
|
private http;
|
|
230
289
|
packages: PackagesResource;
|
|
290
|
+
agencies: AgenciesResource;
|
|
231
291
|
constructor(config: TravoriesClientConfig);
|
|
232
|
-
/** Shortcut for `client.packages.getBySlug(slug)`. */
|
|
233
292
|
getPackageBySlug: (slug: string) => Promise<TravoriesPackage | null>;
|
|
234
|
-
/** Shortcut for `client.packages.getBundle(slug)` — package + host + attractions in one call. */
|
|
235
293
|
getPackageBundle: (slug: string) => Promise<PackageBundle | null>;
|
|
294
|
+
getAgencyBySlug: (slug: string) => Promise<AgencyHostResponse | null>;
|
|
295
|
+
getAgencyBundle: (slug: string) => Promise<AgencyBundle | null>;
|
|
236
296
|
}
|
|
237
297
|
/** Factory form, in case you prefer a function over `new`. */
|
|
238
298
|
declare function createTravoriesClient(config: TravoriesClientConfig): TravoriesClient;
|
|
@@ -276,6 +336,19 @@ interface UseHomeSectionsResult {
|
|
|
276
336
|
*/
|
|
277
337
|
declare function useHomeSections(client: TravoriesClient | null): UseHomeSectionsResult;
|
|
278
338
|
|
|
339
|
+
interface UseAgencyBundleResult {
|
|
340
|
+
data: AgencyBundle | null;
|
|
341
|
+
loading: boolean;
|
|
342
|
+
error: Error | null;
|
|
343
|
+
refetch: () => void;
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Fetches an agency profile + associations + their packages in one call.
|
|
347
|
+
* Re-runs when `slug` or `client` changes. Pass `null` slug or client to skip
|
|
348
|
+
* the fetch (useful when consumer already has data via `initialBundle`).
|
|
349
|
+
*/
|
|
350
|
+
declare function useAgencyBundle(client: TravoriesClient | null, slug: string | null | undefined): UseAgencyBundleResult;
|
|
351
|
+
|
|
279
352
|
interface HomeSectionsProps {
|
|
280
353
|
/** Required when `initialSections` is not provided. */
|
|
281
354
|
client?: TravoriesClient;
|
|
@@ -391,7 +464,9 @@ interface PackageCardProps {
|
|
|
391
464
|
* in a new tab. Requires `href`. `onSelect` is NOT called on a normal click
|
|
392
465
|
* in this mode — the browser handles navigation. */
|
|
393
466
|
openInNewTab?: boolean;
|
|
394
|
-
/** When true, show the heart (wishlist) icon. Default
|
|
467
|
+
/** When true, show the heart (wishlist) icon. Default `false` — wishlist
|
|
468
|
+
* state is user-specific and requires the consumer to wire auth + storage.
|
|
469
|
+
* Pass `liked` + `onLike` together to opt in. */
|
|
395
470
|
showHeart?: boolean;
|
|
396
471
|
/** Initial wishlist state. */
|
|
397
472
|
liked?: boolean;
|
|
@@ -420,6 +495,13 @@ interface PackageDetailViewProps {
|
|
|
420
495
|
currency?: string;
|
|
421
496
|
/** Called when the user hits Reserve. If omitted, the button shows a disabled state. */
|
|
422
497
|
onReserve?: (pkg: TravoriesPackage) => void;
|
|
498
|
+
/** Called when the user clicks the host card. Receives the host. */
|
|
499
|
+
onSelectHost?: (host: PackageHost) => void;
|
|
500
|
+
/** When set, host card renders as `<a href={agencyHrefFor(host)}>` — enables
|
|
501
|
+
* cmd/ctrl-click → open in new tab natively. */
|
|
502
|
+
agencyHrefFor?: (host: PackageHost) => string;
|
|
503
|
+
/** Open host link in a new tab (requires `agencyHrefFor`). */
|
|
504
|
+
openAgencyInNewTab?: boolean;
|
|
423
505
|
/** Optional extra class on the root wrapper. */
|
|
424
506
|
className?: string;
|
|
425
507
|
/** Loading state override. */
|
|
@@ -427,7 +509,7 @@ interface PackageDetailViewProps {
|
|
|
427
509
|
/** Not-found state override. */
|
|
428
510
|
renderNotFound?: () => React.ReactNode;
|
|
429
511
|
}
|
|
430
|
-
declare function PackageDetailView({ client, slug, initialBundle, currency, onReserve, className, renderLoading, renderNotFound, }: PackageDetailViewProps): react_jsx_runtime.JSX.Element;
|
|
512
|
+
declare function PackageDetailView({ client, slug, initialBundle, currency, onReserve, onSelectHost, agencyHrefFor, openAgencyInNewTab, className, renderLoading, renderNotFound, }: PackageDetailViewProps): react_jsx_runtime.JSX.Element;
|
|
431
513
|
|
|
432
514
|
/**
|
|
433
515
|
* Legacy view-model types — identical shape to frontend's `types/package.ts`.
|
|
@@ -578,8 +660,28 @@ interface PackageExcludedAndToPackProps {
|
|
|
578
660
|
}
|
|
579
661
|
declare const PackageExcludedAndToPack: React.FC<PackageExcludedAndToPackProps>;
|
|
580
662
|
|
|
663
|
+
/**
|
|
664
|
+
* Common shape both `PackageHost` (returned by the package detail endpoint)
|
|
665
|
+
* and `AgencyHostDetails` (returned by the agency profile endpoint) satisfy.
|
|
666
|
+
* `agencyName` is optional — when present it's preferred over `username`.
|
|
667
|
+
*/
|
|
668
|
+
interface HostCardData {
|
|
669
|
+
username: string;
|
|
670
|
+
agencyName?: string;
|
|
671
|
+
agencyCreatedDate: string;
|
|
672
|
+
rating: number;
|
|
673
|
+
review: number;
|
|
674
|
+
logo: TravoriesImage | null;
|
|
675
|
+
slug: string;
|
|
676
|
+
}
|
|
581
677
|
interface HostCardProps {
|
|
582
|
-
hostData: PackageHost;
|
|
678
|
+
hostData: HostCardData | PackageHost | AgencyHostDetails;
|
|
679
|
+
/** Called when the user clicks the card. Receives the host slug. */
|
|
680
|
+
onAgencyClick?: (slug: string) => void;
|
|
681
|
+
/** When set, the card wraps in `<a href>` so cmd/ctrl-click opens in a new tab. */
|
|
682
|
+
href?: string;
|
|
683
|
+
/** When true (with `href`), the anchor gets `target="_blank"`. */
|
|
684
|
+
openInNewTab?: boolean;
|
|
583
685
|
className?: string;
|
|
584
686
|
}
|
|
585
687
|
declare const HostCard: React.FC<HostCardProps>;
|
|
@@ -625,9 +727,58 @@ declare const buildGalleryMedia: (pkg: TravoriesPackage) => MediaItem[];
|
|
|
625
727
|
declare const buildTopData: (pkg: TravoriesPackage, host: PackageHost | null) => TopData;
|
|
626
728
|
declare const buildDescriptionData: (pkg: TravoriesPackage) => DescriptionData;
|
|
627
729
|
|
|
730
|
+
interface AgencyDetailViewProps {
|
|
731
|
+
/** Required when `initialBundle` is not provided. */
|
|
732
|
+
client?: TravoriesClient;
|
|
733
|
+
/** Agency slug to fetch. */
|
|
734
|
+
slug?: string;
|
|
735
|
+
/** Pre-fetched bundle (SSR pattern). When set, no client-side fetch runs. */
|
|
736
|
+
initialBundle?: AgencyBundle | null;
|
|
737
|
+
/** Currency code for package cards (default "USD"). */
|
|
738
|
+
currency?: string;
|
|
739
|
+
/** Called when the user clicks a package card. */
|
|
740
|
+
onSelectPackage?: (pkg: HomePackageCard) => void;
|
|
741
|
+
/** When set, package cards render as `<a href>` instead of buttons. */
|
|
742
|
+
packageHrefFor?: (pkg: HomePackageCard) => string;
|
|
743
|
+
/** Open package cards in a new tab. Requires `packageHrefFor`. */
|
|
744
|
+
openPackagesInNewTab?: boolean;
|
|
745
|
+
/** Optional class on the root scope wrapper. */
|
|
746
|
+
className?: string;
|
|
747
|
+
/** Render override for the loading state. */
|
|
748
|
+
renderLoading?: () => React.ReactNode;
|
|
749
|
+
/** Render override for the not-found state. */
|
|
750
|
+
renderNotFound?: () => React.ReactNode;
|
|
751
|
+
}
|
|
752
|
+
/**
|
|
753
|
+
* Public agency profile page — drop-in equivalent to `<PackageDetailView />`
|
|
754
|
+
* for the agency route. Pass `client` + `slug` to let the SDK fetch, or
|
|
755
|
+
* `initialBundle` to use server-fetched data (no client-side fetch).
|
|
756
|
+
*
|
|
757
|
+
* Sections rendered (top → bottom):
|
|
758
|
+
* 1. Breadcrumb + title
|
|
759
|
+
* 2. HostCard (left) | Overview block (right)
|
|
760
|
+
* 3. Agency associations / partner badges (if any)
|
|
761
|
+
* 4. Popular packages carousel
|
|
762
|
+
*
|
|
763
|
+
* Reviews / ratings are intentionally not included in this view — they require
|
|
764
|
+
* user-data plumbing that's out of scope for a static SDK component.
|
|
765
|
+
*/
|
|
766
|
+
declare function AgencyDetailView({ client, slug, initialBundle, currency, onSelectPackage, packageHrefFor, openPackagesInNewTab, className, renderLoading, renderNotFound, }: AgencyDetailViewProps): react_jsx_runtime.JSX.Element;
|
|
767
|
+
|
|
768
|
+
interface AgencyAssociationsProps {
|
|
769
|
+
associations: AgencyAssociationItem[];
|
|
770
|
+
title?: string;
|
|
771
|
+
className?: string;
|
|
772
|
+
}
|
|
773
|
+
/**
|
|
774
|
+
* Partner / affiliation badge strip for an agency. Each badge is a link to the
|
|
775
|
+
* partner site (opens in a new tab). Renders nothing if `associations` is empty.
|
|
776
|
+
*/
|
|
777
|
+
declare const AgencyAssociations: React.FC<AgencyAssociationsProps>;
|
|
778
|
+
|
|
628
779
|
declare function pickImageUrl(img: TravoriesImage | null | undefined): string;
|
|
629
780
|
declare function startingPrice(prices: PackagePriceTier[] | undefined): number;
|
|
630
781
|
declare function formatCurrency(amount: number, currency?: string): string;
|
|
631
782
|
declare function formatRating(rating: number | undefined): string;
|
|
632
783
|
|
|
633
|
-
export { BookingCardLite, type DescriptionData, DescriptionSection, GallerySection, type HomePackageCard, type HomeSectionKey, HomeSections, type HomeSectionsContextValue, type HomeSectionsProps, HomeSectionsProvider, type HomeSectionsProviderProps, type HomeSectionsResponse, HostAbout, HostCard, type HttpClientConfig, type HttpRequestOptions, Itinerary, type MajorAttractionItem, type MajorAttractionsResponse, type MediaItem, type PackageBundle, PackageCard, type PackageDay, type PackageDayLocation, PackageDetailView, type PackageDetailViewProps, type PackageDiscount, PackageExcludedAndToPack, type PackageHost, type PackageHostResponse, PackageIncluded, PackageMap, PackageOverview, type PackagePriceTier, type PackageRoute, type PackageRouteGeometry, type PackageRoutesDay, type PackageRoutesResponse, PackagesCarousel, PackagesResource, PackagesSection, type PackagesSectionProps, type ThingItem, type TopData, TopSection, TravoriesApiError, TravoriesClient, type TravoriesClientConfig, type TravoriesImage, type TravoriesImageUrls, type TravoriesPackage, type UseHomeSectionsResult, type UsePackageBundleResult, type UsePackageBySlugResult, buildDescriptionData, buildGalleryMedia, buildTopData, createTravoriesClient, formatCurrency, formatRating, pickImageUrl, startingPrice, useHomeSections, useHomeSectionsContext, usePackageBundle, usePackageBySlug };
|
|
784
|
+
export { AgenciesResource, type AgencyAssociationItem, AgencyAssociations, type AgencyBundle, AgencyDetailView, type AgencyDetailViewProps, type AgencyHostDetails, type AgencyHostResponse, BookingCardLite, type DescriptionData, DescriptionSection, GallerySection, type HomePackageCard, type HomeSectionKey, HomeSections, type HomeSectionsContextValue, type HomeSectionsProps, HomeSectionsProvider, type HomeSectionsProviderProps, type HomeSectionsResponse, HostAbout, HostCard, type HttpClientConfig, type HttpRequestOptions, Itinerary, type MajorAttractionItem, type MajorAttractionsResponse, type MediaItem, type PackageBundle, PackageCard, type PackageDay, type PackageDayLocation, PackageDetailView, type PackageDetailViewProps, type PackageDiscount, PackageExcludedAndToPack, type PackageHost, type PackageHostResponse, PackageIncluded, PackageMap, PackageOverview, type PackagePriceTier, type PackageRoute, type PackageRouteGeometry, type PackageRoutesDay, type PackageRoutesResponse, PackagesCarousel, PackagesResource, PackagesSection, type PackagesSectionProps, type ThingItem, type TopData, TopSection, TravoriesApiError, TravoriesClient, type TravoriesClientConfig, type TravoriesImage, type TravoriesImageUrls, type TravoriesPackage, type UseAgencyBundleResult, type UseHomeSectionsResult, type UsePackageBundleResult, type UsePackageBySlugResult, buildDescriptionData, buildGalleryMedia, buildTopData, createTravoriesClient, formatCurrency, formatRating, pickImageUrl, startingPrice, useAgencyBundle, useHomeSections, useHomeSectionsContext, usePackageBundle, usePackageBySlug };
|