@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.js
CHANGED
|
@@ -216,15 +216,118 @@ var PackagesResource = class {
|
|
|
216
216
|
}
|
|
217
217
|
};
|
|
218
218
|
|
|
219
|
+
// src/api/agencies.ts
|
|
220
|
+
var normalizeImage2 = (img) => ({
|
|
221
|
+
id: img?.id ?? "",
|
|
222
|
+
key: img?.key ?? "",
|
|
223
|
+
type: img?.type ?? "image",
|
|
224
|
+
alt: img?.alt ?? "",
|
|
225
|
+
preview: img?.preview ?? null,
|
|
226
|
+
url: {
|
|
227
|
+
original: img?.url?.original ?? null,
|
|
228
|
+
hero: img?.url?.hero ?? null,
|
|
229
|
+
hero_fit: img?.url?.hero_fit ?? null,
|
|
230
|
+
section: img?.url?.section ?? null,
|
|
231
|
+
portrait: img?.url?.portrait ?? null,
|
|
232
|
+
general: img?.url?.general ?? null,
|
|
233
|
+
jpeg: img?.url?.jpeg ?? null
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
var normalizeAgencyCard = (raw) => ({
|
|
237
|
+
id: raw?.id ?? "",
|
|
238
|
+
title: raw?.title ?? "",
|
|
239
|
+
slug: raw?.slug ?? "",
|
|
240
|
+
agencySlug: raw?.agencySlug ?? "",
|
|
241
|
+
totalDays: Number(raw?.totalDays ?? 0),
|
|
242
|
+
minPrice: Number(raw?.minPrice ?? 0),
|
|
243
|
+
maxPrice: Number(raw?.maxPrice ?? 0),
|
|
244
|
+
rating: Number(raw?.rating ?? 0),
|
|
245
|
+
packageCategory: raw?.packageCategory ?? "",
|
|
246
|
+
thumbnail: normalizeImage2(raw?.thumbnail)
|
|
247
|
+
});
|
|
248
|
+
var AgenciesResource = class {
|
|
249
|
+
constructor(http) {
|
|
250
|
+
this.http = http;
|
|
251
|
+
}
|
|
252
|
+
/** Public profile of an agency by its slug. Null on 404. */
|
|
253
|
+
async getBySlug(slug, options) {
|
|
254
|
+
if (!slug) throw new Error("[TravoriesClient] agencies.getBySlug requires a slug");
|
|
255
|
+
const raw = await this.http.request(`/agency-info/by-slug/${slug}`, {
|
|
256
|
+
silent: true,
|
|
257
|
+
...options
|
|
258
|
+
});
|
|
259
|
+
if (!raw?.hostDetails) return null;
|
|
260
|
+
return {
|
|
261
|
+
success: raw.success,
|
|
262
|
+
message: raw.message,
|
|
263
|
+
hostDetails: {
|
|
264
|
+
...raw.hostDetails,
|
|
265
|
+
logo: raw.hostDetails.logo ? normalizeImage2(raw.hostDetails.logo) : null
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
/** Partner / association badges shown on the agency profile. */
|
|
270
|
+
async getAssociations(slug, options) {
|
|
271
|
+
if (!slug) throw new Error("[TravoriesClient] agencies.getAssociations requires a slug");
|
|
272
|
+
const raw = await this.http.request(
|
|
273
|
+
`/agency-association/agency/slug/${slug}`,
|
|
274
|
+
{ silent: true, ...options }
|
|
275
|
+
);
|
|
276
|
+
if (!Array.isArray(raw)) return [];
|
|
277
|
+
return raw.map((a) => ({
|
|
278
|
+
id: a.id,
|
|
279
|
+
name: a.name,
|
|
280
|
+
url: a.url,
|
|
281
|
+
image: a.image ? normalizeImage2(a.image) : null
|
|
282
|
+
}));
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Packages published by this agency. Returns the same card shape as the home
|
|
286
|
+
* sections so `<PackagesCarousel>` / `<PackageCard>` render them directly.
|
|
287
|
+
*/
|
|
288
|
+
async getPackages(slug, params, options) {
|
|
289
|
+
if (!slug) throw new Error("[TravoriesClient] agencies.getPackages requires a slug");
|
|
290
|
+
const limit = params?.limit ?? 10;
|
|
291
|
+
const page = params?.page ?? 1;
|
|
292
|
+
const raw = await this.http.request(
|
|
293
|
+
`/agency-package/by-agency/${slug}?limit=${limit}&page=${page}`,
|
|
294
|
+
{ silent: true, ...options }
|
|
295
|
+
);
|
|
296
|
+
if (!raw) return [];
|
|
297
|
+
const list = Array.isArray(raw) ? raw : Array.isArray(raw.packages) ? raw.packages : [];
|
|
298
|
+
return list.map(normalizeAgencyCard);
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Convenience: fetch the full agency bundle (profile + associations + their
|
|
302
|
+
* packages) in parallel. Drives `<AgencyDetailView />`.
|
|
303
|
+
*/
|
|
304
|
+
async getBundle(slug, params, options) {
|
|
305
|
+
const [agency, associations, packages] = await Promise.all([
|
|
306
|
+
this.getBySlug(slug, options),
|
|
307
|
+
this.getAssociations(slug, options),
|
|
308
|
+
this.getPackages(slug, { limit: params?.packagesLimit ?? 12 }, options)
|
|
309
|
+
]);
|
|
310
|
+
if (!agency?.hostDetails) return null;
|
|
311
|
+
return {
|
|
312
|
+
agency: agency.hostDetails,
|
|
313
|
+
associations,
|
|
314
|
+
packages
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
};
|
|
318
|
+
|
|
219
319
|
// src/client/TravoriesClient.ts
|
|
220
320
|
var TravoriesClient = class {
|
|
221
321
|
constructor(config) {
|
|
222
|
-
|
|
322
|
+
// ---- Convenience shortcuts on the client itself (no need to remember the
|
|
323
|
+
// resource name for the common one-shot lookups). -------------------
|
|
223
324
|
this.getPackageBySlug = (slug) => this.packages.getBySlug(slug);
|
|
224
|
-
/** Shortcut for `client.packages.getBundle(slug)` — package + host + attractions in one call. */
|
|
225
325
|
this.getPackageBundle = (slug) => this.packages.getBundle(slug);
|
|
326
|
+
this.getAgencyBySlug = (slug) => this.agencies.getBySlug(slug);
|
|
327
|
+
this.getAgencyBundle = (slug) => this.agencies.getBundle(slug);
|
|
226
328
|
this.http = new HttpClient(config);
|
|
227
329
|
this.packages = new PackagesResource(this.http);
|
|
330
|
+
this.agencies = new AgenciesResource(this.http);
|
|
228
331
|
}
|
|
229
332
|
};
|
|
230
333
|
function createTravoriesClient(config) {
|
|
@@ -332,6 +435,40 @@ function useHomeSections(client) {
|
|
|
332
435
|
}, [client]);
|
|
333
436
|
return { data, loading, error, refetch: run };
|
|
334
437
|
}
|
|
438
|
+
function useAgencyBundle(client, slug) {
|
|
439
|
+
const [data, setData] = react.useState(null);
|
|
440
|
+
const [loading, setLoading] = react.useState(Boolean(client && slug));
|
|
441
|
+
const [error, setError] = react.useState(null);
|
|
442
|
+
const reqId = react.useRef(0);
|
|
443
|
+
const run = () => {
|
|
444
|
+
if (!client || !slug) {
|
|
445
|
+
setData(null);
|
|
446
|
+
setLoading(false);
|
|
447
|
+
setError(null);
|
|
448
|
+
return;
|
|
449
|
+
}
|
|
450
|
+
const myReq = ++reqId.current;
|
|
451
|
+
setLoading(true);
|
|
452
|
+
setError(null);
|
|
453
|
+
client.agencies.getBundle(slug).then((res) => {
|
|
454
|
+
if (myReq !== reqId.current) return;
|
|
455
|
+
setData(res);
|
|
456
|
+
}).catch((err) => {
|
|
457
|
+
if (myReq !== reqId.current) return;
|
|
458
|
+
setError(err instanceof Error ? err : new Error(String(err)));
|
|
459
|
+
}).finally(() => {
|
|
460
|
+
if (myReq !== reqId.current) return;
|
|
461
|
+
setLoading(false);
|
|
462
|
+
});
|
|
463
|
+
};
|
|
464
|
+
react.useEffect(() => {
|
|
465
|
+
run();
|
|
466
|
+
return () => {
|
|
467
|
+
reqId.current++;
|
|
468
|
+
};
|
|
469
|
+
}, [client, slug]);
|
|
470
|
+
return { data, loading, error, refetch: run };
|
|
471
|
+
}
|
|
335
472
|
|
|
336
473
|
// src/utils/format.ts
|
|
337
474
|
function pickImageUrl(img) {
|
|
@@ -366,7 +503,7 @@ var PackageCard = ({
|
|
|
366
503
|
onSelect,
|
|
367
504
|
href,
|
|
368
505
|
openInNewTab = false,
|
|
369
|
-
showHeart =
|
|
506
|
+
showHeart = false,
|
|
370
507
|
liked,
|
|
371
508
|
onLike
|
|
372
509
|
}) => {
|
|
@@ -1951,44 +2088,90 @@ var getMonthsHosting = (createdDate) => {
|
|
|
1951
2088
|
);
|
|
1952
2089
|
return Math.max(1, monthsDiff);
|
|
1953
2090
|
};
|
|
1954
|
-
var HostCard = ({
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
] }),
|
|
1972
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between text-center mt-2", children: [
|
|
1973
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1974
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-base md:text-lg text-primary-normal tracking-[-0.02em] font-medium", children: hostData?.review ?? 0 }),
|
|
1975
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm md:text-base text-secondary-normal-hover tracking-[-0.02em]", children: "Reviews" })
|
|
1976
|
-
] }),
|
|
1977
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1978
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-base md:text-lg text-primary-normal tracking-[-0.02em] font-medium", children: (hostData?.rating ?? 0).toFixed(2) }),
|
|
1979
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm md:text-base text-secondary-normal-hover tracking-[-0.02em]", children: "Rating" })
|
|
1980
|
-
] }),
|
|
1981
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1982
|
-
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-base md:text-lg text-primary-normal tracking-[-0.02em] font-medium", children: [
|
|
1983
|
-
getMonthsHosting(hostData?.agencyCreatedDate),
|
|
1984
|
-
" mth"
|
|
1985
|
-
] }),
|
|
1986
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm md:text-base text-secondary-normal-hover tracking-[-0.02em]", children: "Hosting" })
|
|
1987
|
-
] })
|
|
1988
|
-
] })
|
|
1989
|
-
]
|
|
2091
|
+
var HostCard = ({
|
|
2092
|
+
hostData,
|
|
2093
|
+
onAgencyClick,
|
|
2094
|
+
href,
|
|
2095
|
+
openInNewTab,
|
|
2096
|
+
className = ""
|
|
2097
|
+
}) => {
|
|
2098
|
+
const data = hostData;
|
|
2099
|
+
const displayName = data.agencyName || data.username;
|
|
2100
|
+
const logoUrl = pickImageUrl(data?.logo);
|
|
2101
|
+
const isClickable = Boolean(onAgencyClick || href);
|
|
2102
|
+
const handleAnchorClick = (e) => {
|
|
2103
|
+
if (e.metaKey || e.ctrlKey || e.button === 1) return;
|
|
2104
|
+
if (openInNewTab) return;
|
|
2105
|
+
if (onAgencyClick) {
|
|
2106
|
+
e.preventDefault();
|
|
2107
|
+
onAgencyClick(data.slug);
|
|
1990
2108
|
}
|
|
1991
|
-
|
|
2109
|
+
};
|
|
2110
|
+
const body = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-6", children: [
|
|
2111
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-4", children: [
|
|
2112
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative rounded-full h-20 w-20 bg-gray-200 flex items-center justify-center text-xl text-primary-normal overflow-hidden", children: logoUrl ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2113
|
+
"img",
|
|
2114
|
+
{
|
|
2115
|
+
src: logoUrl,
|
|
2116
|
+
alt: `${displayName}'s logo`,
|
|
2117
|
+
className: "object-cover w-full h-full"
|
|
2118
|
+
}
|
|
2119
|
+
) : /* @__PURE__ */ jsxRuntime.jsx("span", { children: getUserInitials(displayName) }) }),
|
|
2120
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[18px] tracking-[-0.02em] font-medium text-primary-normal whitespace-normal break-words", children: displayName })
|
|
2121
|
+
] }),
|
|
2122
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between text-center mt-2", children: [
|
|
2123
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2124
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-base md:text-lg text-primary-normal tracking-[-0.02em] font-medium", children: data?.review ?? 0 }),
|
|
2125
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm md:text-base text-secondary-normal-hover tracking-[-0.02em]", children: "Reviews" })
|
|
2126
|
+
] }),
|
|
2127
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2128
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-base md:text-lg text-primary-normal tracking-[-0.02em] font-medium", children: (data?.rating ?? 0).toFixed(2) }),
|
|
2129
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm md:text-base text-secondary-normal-hover tracking-[-0.02em]", children: "Rating" })
|
|
2130
|
+
] }),
|
|
2131
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2132
|
+
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-base md:text-lg text-primary-normal tracking-[-0.02em] font-medium", children: [
|
|
2133
|
+
getMonthsHosting(data?.agencyCreatedDate),
|
|
2134
|
+
" mth"
|
|
2135
|
+
] }),
|
|
2136
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm md:text-base text-secondary-normal-hover tracking-[-0.02em]", children: "Hosting" })
|
|
2137
|
+
] })
|
|
2138
|
+
] })
|
|
2139
|
+
] });
|
|
2140
|
+
const wrapperClass = `w-full sm:min-w-[320px] rounded-2xl border border-[#E0E4E8] bg-white p-6 lg:p-8 shadow-md ${isClickable ? "cursor-pointer transition-shadow hover:shadow-lg" : ""} ${className}`.trim();
|
|
2141
|
+
if (href) {
|
|
2142
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2143
|
+
"a",
|
|
2144
|
+
{
|
|
2145
|
+
href,
|
|
2146
|
+
target: openInNewTab ? "_blank" : void 0,
|
|
2147
|
+
rel: openInNewTab ? "noopener noreferrer" : void 0,
|
|
2148
|
+
onClick: handleAnchorClick,
|
|
2149
|
+
className: `${wrapperClass} block no-underline text-inherit`,
|
|
2150
|
+
"aria-label": openInNewTab ? `View ${displayName} (opens in a new tab)` : `View ${displayName}`,
|
|
2151
|
+
children: body
|
|
2152
|
+
}
|
|
2153
|
+
);
|
|
2154
|
+
}
|
|
2155
|
+
if (onAgencyClick) {
|
|
2156
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2157
|
+
"div",
|
|
2158
|
+
{
|
|
2159
|
+
role: "button",
|
|
2160
|
+
tabIndex: 0,
|
|
2161
|
+
onClick: () => onAgencyClick(data.slug),
|
|
2162
|
+
onKeyDown: (e) => {
|
|
2163
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
2164
|
+
e.preventDefault();
|
|
2165
|
+
onAgencyClick(data.slug);
|
|
2166
|
+
}
|
|
2167
|
+
},
|
|
2168
|
+
className: wrapperClass,
|
|
2169
|
+
"aria-label": `View ${displayName}`,
|
|
2170
|
+
children: body
|
|
2171
|
+
}
|
|
2172
|
+
);
|
|
2173
|
+
}
|
|
2174
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: wrapperClass, children: body });
|
|
1992
2175
|
};
|
|
1993
2176
|
var HostCard_default = HostCard;
|
|
1994
2177
|
var GalleryImg = ({
|
|
@@ -2278,6 +2461,9 @@ function PackageDetailView({
|
|
|
2278
2461
|
initialBundle,
|
|
2279
2462
|
currency = "USD",
|
|
2280
2463
|
onReserve,
|
|
2464
|
+
onSelectHost,
|
|
2465
|
+
agencyHrefFor,
|
|
2466
|
+
openAgencyInNewTab,
|
|
2281
2467
|
className,
|
|
2282
2468
|
renderLoading,
|
|
2283
2469
|
renderNotFound
|
|
@@ -2311,6 +2497,9 @@ function PackageDetailView({
|
|
|
2311
2497
|
routes: bundle.routes ?? [],
|
|
2312
2498
|
currency,
|
|
2313
2499
|
onReserve,
|
|
2500
|
+
onSelectHost,
|
|
2501
|
+
agencyHrefFor,
|
|
2502
|
+
openAgencyInNewTab,
|
|
2314
2503
|
className
|
|
2315
2504
|
}
|
|
2316
2505
|
);
|
|
@@ -2321,6 +2510,9 @@ function DetailContent({
|
|
|
2321
2510
|
routes,
|
|
2322
2511
|
currency,
|
|
2323
2512
|
onReserve,
|
|
2513
|
+
onSelectHost,
|
|
2514
|
+
agencyHrefFor,
|
|
2515
|
+
openAgencyInNewTab,
|
|
2324
2516
|
className
|
|
2325
2517
|
}) {
|
|
2326
2518
|
const topData = buildTopData(pkg, host);
|
|
@@ -2341,7 +2533,16 @@ function DetailContent({
|
|
|
2341
2533
|
host && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "py-6 sm:py-8 border-b-2 border-gray-200 flex flex-col gap-6", children: [
|
|
2342
2534
|
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-primary-normal text-xl md:text-2xl font-medium tracking-[-0.04em]", children: "Host Details" }),
|
|
2343
2535
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col lg:flex-row gap-8 lg:gap-10 h-full items-start lg:items-center", children: [
|
|
2344
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-6 sm:gap-8 w-full sm:w-[320px]", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2536
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-6 sm:gap-8 w-full sm:w-[320px]", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2537
|
+
HostCard_default,
|
|
2538
|
+
{
|
|
2539
|
+
hostData: host,
|
|
2540
|
+
onAgencyClick: onSelectHost ? () => onSelectHost(host) : void 0,
|
|
2541
|
+
href: agencyHrefFor ? agencyHrefFor(host) : void 0,
|
|
2542
|
+
openInNewTab: openAgencyInNewTab,
|
|
2543
|
+
className: "w-full"
|
|
2544
|
+
}
|
|
2545
|
+
) }),
|
|
2345
2546
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full lg:w-4/5 h-full flex flex-col justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2346
2547
|
HostAbout_default,
|
|
2347
2548
|
{
|
|
@@ -2369,7 +2570,180 @@ function DefaultLoading() {
|
|
|
2369
2570
|
] })
|
|
2370
2571
|
] });
|
|
2371
2572
|
}
|
|
2573
|
+
var AgencyAssociations = ({
|
|
2574
|
+
associations,
|
|
2575
|
+
title = "We are associated with",
|
|
2576
|
+
className
|
|
2577
|
+
}) => {
|
|
2578
|
+
if (!associations?.length) return null;
|
|
2579
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("section", { className: `flex flex-col gap-4 mt-2 ${className ?? ""}`.trim(), children: [
|
|
2580
|
+
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-xl md:text-2xl font-medium tracking-[-0.04em] text-primary-normal", children: title }),
|
|
2581
|
+
/* @__PURE__ */ jsxRuntime.jsx("ul", { className: "flex flex-wrap gap-6 items-center justify-start list-none p-0 m-0", children: associations.map((assoc) => {
|
|
2582
|
+
const img = pickImageUrl(assoc.image);
|
|
2583
|
+
return /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2584
|
+
"a",
|
|
2585
|
+
{
|
|
2586
|
+
href: assoc.url,
|
|
2587
|
+
target: "_blank",
|
|
2588
|
+
rel: "noopener noreferrer",
|
|
2589
|
+
title: assoc.name,
|
|
2590
|
+
"aria-label": assoc.name,
|
|
2591
|
+
className: "relative w-32 h-20 flex items-center justify-center hover:opacity-80 transition-opacity rounded-lg p-2 bg-white border border-[#E0E4E8]",
|
|
2592
|
+
children: img ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2593
|
+
"img",
|
|
2594
|
+
{
|
|
2595
|
+
src: img,
|
|
2596
|
+
alt: assoc.image?.alt || assoc.name,
|
|
2597
|
+
loading: "lazy",
|
|
2598
|
+
className: "max-w-full max-h-full object-contain"
|
|
2599
|
+
}
|
|
2600
|
+
) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[#47586E] text-xs text-center leading-tight", children: assoc.name })
|
|
2601
|
+
}
|
|
2602
|
+
) }, assoc.id);
|
|
2603
|
+
}) })
|
|
2604
|
+
] });
|
|
2605
|
+
};
|
|
2606
|
+
var AgencyAssociations_default = AgencyAssociations;
|
|
2607
|
+
function AgencyDetailView({
|
|
2608
|
+
client,
|
|
2609
|
+
slug,
|
|
2610
|
+
initialBundle,
|
|
2611
|
+
currency = "USD",
|
|
2612
|
+
onSelectPackage,
|
|
2613
|
+
packageHrefFor,
|
|
2614
|
+
openPackagesInNewTab,
|
|
2615
|
+
className,
|
|
2616
|
+
renderLoading,
|
|
2617
|
+
renderNotFound
|
|
2618
|
+
}) {
|
|
2619
|
+
if (!initialBundle && (!client || !slug)) {
|
|
2620
|
+
throw new Error(
|
|
2621
|
+
"[AgencyDetailView] Provide either `initialBundle` or both `client` and `slug`."
|
|
2622
|
+
);
|
|
2623
|
+
}
|
|
2624
|
+
const remote = useAgencyBundle(
|
|
2625
|
+
initialBundle ? null : client ?? null,
|
|
2626
|
+
initialBundle ? null : slug ?? null
|
|
2627
|
+
);
|
|
2628
|
+
const bundle = initialBundle ?? remote.data;
|
|
2629
|
+
const loading = !initialBundle && remote.loading;
|
|
2630
|
+
const error = !initialBundle && remote.error;
|
|
2631
|
+
if (loading) {
|
|
2632
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `tvr-package-detail ${className ?? ""}`.trim(), children: renderLoading ? renderLoading() : /* @__PURE__ */ jsxRuntime.jsx(DefaultLoading2, {}) });
|
|
2633
|
+
}
|
|
2634
|
+
if (error) {
|
|
2635
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `tvr-package-detail ${className ?? ""}`.trim(), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "max-w-screen-xl mx-auto px-6 py-16 text-center text-red-600 text-sm", children: [
|
|
2636
|
+
"Failed to load agency: ",
|
|
2637
|
+
error.message
|
|
2638
|
+
] }) });
|
|
2639
|
+
}
|
|
2640
|
+
if (!bundle?.agency) {
|
|
2641
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `tvr-package-detail ${className ?? ""}`.trim(), children: renderNotFound ? renderNotFound() : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "max-w-screen-xl mx-auto px-6 py-16 text-center text-secondary-normal-hover text-sm", children: "Agency not found." }) });
|
|
2642
|
+
}
|
|
2643
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2644
|
+
DetailContent2,
|
|
2645
|
+
{
|
|
2646
|
+
agency: bundle.agency,
|
|
2647
|
+
associations: bundle.associations,
|
|
2648
|
+
packages: bundle.packages,
|
|
2649
|
+
currency,
|
|
2650
|
+
onSelectPackage,
|
|
2651
|
+
packageHrefFor,
|
|
2652
|
+
openPackagesInNewTab,
|
|
2653
|
+
className
|
|
2654
|
+
}
|
|
2655
|
+
);
|
|
2656
|
+
}
|
|
2657
|
+
function DetailContent2({
|
|
2658
|
+
agency,
|
|
2659
|
+
associations,
|
|
2660
|
+
packages,
|
|
2661
|
+
currency,
|
|
2662
|
+
onSelectPackage,
|
|
2663
|
+
packageHrefFor,
|
|
2664
|
+
openPackagesInNewTab,
|
|
2665
|
+
className
|
|
2666
|
+
}) {
|
|
2667
|
+
const displayName = agency.agencyName || agency.username;
|
|
2668
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `tvr-package-detail ${className ?? ""}`.trim(), children: /* @__PURE__ */ jsxRuntime.jsxs("article", { className: "mx-auto max-w-[1440px] flex flex-col gap-8 md:px-12 px-6 lg:py-10 py-6", children: [
|
|
2669
|
+
/* @__PURE__ */ jsxRuntime.jsxs("header", { className: "flex flex-col gap-2", children: [
|
|
2670
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2671
|
+
"nav",
|
|
2672
|
+
{
|
|
2673
|
+
"aria-label": "Breadcrumb",
|
|
2674
|
+
className: "flex items-center gap-2 text-sm",
|
|
2675
|
+
children: [
|
|
2676
|
+
/* @__PURE__ */ jsxRuntime.jsx("a", { href: "/", className: "text-secondary hover:underline", children: "Home" }),
|
|
2677
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": true, className: "text-secondary", children: "\u203A" }),
|
|
2678
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-secondary underline font-medium", children: displayName })
|
|
2679
|
+
]
|
|
2680
|
+
}
|
|
2681
|
+
),
|
|
2682
|
+
/* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-xl md:text-2xl font-medium text-primary-normal leading-tight", children: displayName })
|
|
2683
|
+
] }),
|
|
2684
|
+
/* @__PURE__ */ jsxRuntime.jsxs("section", { className: "flex flex-col lg:flex-row items-stretch gap-8 pb-8 border-b border-[#E0E4E8]", children: [
|
|
2685
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full lg:w-[320px] flex-shrink-0", children: /* @__PURE__ */ jsxRuntime.jsx(HostCard_default, { hostData: agency, className: "w-full" }) }),
|
|
2686
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 flex flex-col gap-5 pt-2", children: [
|
|
2687
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
2688
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "lg:text-2xl text-xl tracking-[-0.04em] font-medium text-primary-normal", children: "Overview" }),
|
|
2689
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-secondary font-medium md:text-lg text-sm", children: [
|
|
2690
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2691
|
+
react$1.Icon,
|
|
2692
|
+
{
|
|
2693
|
+
icon: "material-symbols:verified-rounded",
|
|
2694
|
+
className: "lg:w-6 lg:h-6 w-4 h-4"
|
|
2695
|
+
}
|
|
2696
|
+
),
|
|
2697
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Verified Agency" })
|
|
2698
|
+
] })
|
|
2699
|
+
] }),
|
|
2700
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "lg:text-lg text-sm text-[#47586E] leading-relaxed", children: agency.description || `Verified Nepal travel agency on Travories.` })
|
|
2701
|
+
] })
|
|
2702
|
+
] }),
|
|
2703
|
+
associations.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2704
|
+
/* @__PURE__ */ jsxRuntime.jsx(AgencyAssociations_default, { associations }),
|
|
2705
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-b border-[#E0E4E8]" })
|
|
2706
|
+
] }),
|
|
2707
|
+
packages.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("section", { className: "flex flex-col gap-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2708
|
+
PackagesCarousel_default,
|
|
2709
|
+
{
|
|
2710
|
+
title: `Popular Packages from ${displayName}`,
|
|
2711
|
+
packages,
|
|
2712
|
+
currency,
|
|
2713
|
+
onSelect: onSelectPackage,
|
|
2714
|
+
hrefFor: packageHrefFor,
|
|
2715
|
+
openInNewTab: openPackagesInNewTab
|
|
2716
|
+
}
|
|
2717
|
+
) })
|
|
2718
|
+
] }) });
|
|
2719
|
+
}
|
|
2720
|
+
function DefaultLoading2() {
|
|
2721
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mx-auto max-w-[1440px] px-6 md:px-12 py-8 animate-pulse", children: [
|
|
2722
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-4 w-32 bg-gray-200 rounded mb-3" }),
|
|
2723
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-8 w-72 bg-gray-200 rounded mb-8" }),
|
|
2724
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col lg:flex-row gap-8 mb-10", children: [
|
|
2725
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full lg:w-[320px] h-48 bg-gray-100 rounded-2xl" }),
|
|
2726
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 space-y-3", children: [
|
|
2727
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-6 w-40 bg-gray-200 rounded" }),
|
|
2728
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-4 w-full bg-gray-100 rounded" }),
|
|
2729
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-4 w-5/6 bg-gray-100 rounded" }),
|
|
2730
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-4 w-2/3 bg-gray-100 rounded" })
|
|
2731
|
+
] })
|
|
2732
|
+
] }),
|
|
2733
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-4 overflow-hidden", children: Array.from({ length: 4 }).map((_, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2734
|
+
"div",
|
|
2735
|
+
{
|
|
2736
|
+
className: "w-[300px] shrink-0 rounded-xl bg-gray-100",
|
|
2737
|
+
style: { height: 280 }
|
|
2738
|
+
},
|
|
2739
|
+
i
|
|
2740
|
+
)) })
|
|
2741
|
+
] });
|
|
2742
|
+
}
|
|
2372
2743
|
|
|
2744
|
+
exports.AgenciesResource = AgenciesResource;
|
|
2745
|
+
exports.AgencyAssociations = AgencyAssociations_default;
|
|
2746
|
+
exports.AgencyDetailView = AgencyDetailView;
|
|
2373
2747
|
exports.BookingCardLite = BookingCardLite_default;
|
|
2374
2748
|
exports.DescriptionSection = DescriptionSection_default;
|
|
2375
2749
|
exports.GallerySection = GallerySection_default;
|
|
@@ -2398,6 +2772,7 @@ exports.formatCurrency = formatCurrency;
|
|
|
2398
2772
|
exports.formatRating = formatRating;
|
|
2399
2773
|
exports.pickImageUrl = pickImageUrl;
|
|
2400
2774
|
exports.startingPrice = startingPrice;
|
|
2775
|
+
exports.useAgencyBundle = useAgencyBundle;
|
|
2401
2776
|
exports.useHomeSections = useHomeSections;
|
|
2402
2777
|
exports.useHomeSectionsContext = useHomeSectionsContext;
|
|
2403
2778
|
exports.usePackageBundle = usePackageBundle;
|