@kern-di/trust-carousel 0.1.1 → 0.1.3
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.ts +10 -7
- package/dist/index.js +25 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -30,26 +30,29 @@ interface GoogleReviewsCarouselProps {
|
|
|
30
30
|
declare const SAMPLE_REVIEWS: GoogleReview[];
|
|
31
31
|
declare function GoogleReviewsCarousel({ reviews, businessName, placeUrl, aggregateRating: aggregateRatingProp, totalReviewCount: totalReviewCountProp, locale, autoPlay, autoPlaySpeed, }: GoogleReviewsCarouselProps): react_jsx_runtime.JSX.Element;
|
|
32
32
|
|
|
33
|
-
/** JSON body from `GET /api/google-reviews
|
|
33
|
+
/** JSON body from `GET /api/google-reviews` (website serverless handler). */
|
|
34
34
|
type CachedGoogleReviewsResponse = {
|
|
35
35
|
businessName: string;
|
|
36
36
|
placeUrl: string;
|
|
37
37
|
reviews: GoogleReview[];
|
|
38
38
|
fetchedAt: string;
|
|
39
|
-
source: "
|
|
39
|
+
source: "live";
|
|
40
40
|
/** Google Places overall rating (all reviews); omit if unknown. */
|
|
41
41
|
aggregateRating?: number;
|
|
42
42
|
totalReviewCount?: number;
|
|
43
43
|
};
|
|
44
44
|
type GoogleReviewsCarouselCachedProps = Omit<GoogleReviewsCarouselProps, "reviews" | "businessName" | "placeUrl"> & {
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
/** Resolved server-side via `GOOGLE_REVIEWS_SLUG_MAP` when `placeId` is omitted. */
|
|
46
|
+
slug?: string;
|
|
47
|
+
/** Google Place ID; avoids slug map. Prefer for single-tenant sites. */
|
|
48
|
+
placeId?: string;
|
|
49
|
+
/** Base path or absolute URL; default `/api/google-reviews` */
|
|
47
50
|
reviewsApiPath?: string;
|
|
48
51
|
};
|
|
49
52
|
/**
|
|
50
|
-
* Loads reviews
|
|
51
|
-
*
|
|
53
|
+
* Loads reviews from your backend (`/api/google-reviews` by default). The server
|
|
54
|
+
* should return cacheable JSON (e.g. Cache-Control at the CDN).
|
|
52
55
|
*/
|
|
53
|
-
declare function GoogleReviewsCarouselCached({ slug, reviewsApiPath, locale, ...carouselRest }: GoogleReviewsCarouselCachedProps): react_jsx_runtime.JSX.Element;
|
|
56
|
+
declare function GoogleReviewsCarouselCached({ slug, placeId, reviewsApiPath, locale, ...carouselRest }: GoogleReviewsCarouselCachedProps): react_jsx_runtime.JSX.Element;
|
|
54
57
|
|
|
55
58
|
export { type CachedGoogleReviewsResponse, type GoogleReview, GoogleReviewsCarousel, GoogleReviewsCarouselCached, type GoogleReviewsCarouselCachedProps, type GoogleReviewsCarouselLocale, type GoogleReviewsCarouselProps, SAMPLE_REVIEWS };
|
package/dist/index.js
CHANGED
|
@@ -230,14 +230,14 @@ function GoogleReviewsCarousel({
|
|
|
230
230
|
return /* @__PURE__ */ jsxs(
|
|
231
231
|
"section",
|
|
232
232
|
{
|
|
233
|
-
className: "mx-auto w-full max-w-
|
|
233
|
+
className: "mx-auto w-full max-w-3xl",
|
|
234
234
|
onMouseEnter: () => setPaused(true),
|
|
235
235
|
onMouseLeave: () => setPaused(false),
|
|
236
236
|
children: [
|
|
237
|
-
/* @__PURE__ */ jsxs("div", { className: "mb-
|
|
238
|
-
/* @__PURE__ */ jsx(GoogleLogo, { className: "h-
|
|
237
|
+
/* @__PURE__ */ jsxs("div", { className: "mb-10 flex flex-col items-center gap-4 py-2 text-center", children: [
|
|
238
|
+
/* @__PURE__ */ jsx(GoogleLogo, { className: "h-8" }),
|
|
239
239
|
/* @__PURE__ */ jsx("p", { className: "text-xs font-medium uppercase tracking-widest text-muted-foreground", children: labels.eyebrow }),
|
|
240
|
-
/* @__PURE__ */ jsx("h3", { className: "text-
|
|
240
|
+
/* @__PURE__ */ jsx("h3", { className: "font-display text-xl font-semibold text-foreground md:text-2xl", children: businessName }),
|
|
241
241
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
242
242
|
/* @__PURE__ */ jsx("span", { className: "text-2xl font-bold text-foreground", children: ratingLabel }),
|
|
243
243
|
/* @__PURE__ */ jsx(StarRating, { rating: Math.round(summaryRating), size: 20 }),
|
|
@@ -317,10 +317,16 @@ function GoogleReviewsCarousel({
|
|
|
317
317
|
import { Loader2 } from "lucide-react";
|
|
318
318
|
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
319
319
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
320
|
-
function buildReviewsUrl(base,
|
|
320
|
+
function buildReviewsUrl(base, params) {
|
|
321
321
|
const path = base.replace(/\/$/, "");
|
|
322
322
|
const joiner = path.includes("?") ? "&" : "?";
|
|
323
|
-
|
|
323
|
+
if (params.placeId?.trim()) {
|
|
324
|
+
return `${path}${joiner}placeId=${encodeURIComponent(params.placeId.trim())}`;
|
|
325
|
+
}
|
|
326
|
+
if (params.slug?.trim()) {
|
|
327
|
+
return `${path}${joiner}slug=${encodeURIComponent(params.slug.trim())}`;
|
|
328
|
+
}
|
|
329
|
+
return path;
|
|
324
330
|
}
|
|
325
331
|
function isSuccessPayload(data) {
|
|
326
332
|
if (!data || typeof data !== "object") return false;
|
|
@@ -329,6 +335,7 @@ function isSuccessPayload(data) {
|
|
|
329
335
|
}
|
|
330
336
|
function GoogleReviewsCarouselCached({
|
|
331
337
|
slug,
|
|
338
|
+
placeId,
|
|
332
339
|
reviewsApiPath = "/api/google-reviews",
|
|
333
340
|
locale = "de",
|
|
334
341
|
...carouselRest
|
|
@@ -338,10 +345,20 @@ function GoogleReviewsCarouselCached({
|
|
|
338
345
|
const [loading, setLoading] = useState2(true);
|
|
339
346
|
useEffect2(() => {
|
|
340
347
|
let cancelled = false;
|
|
341
|
-
const url = buildReviewsUrl(reviewsApiPath, slug);
|
|
348
|
+
const url = buildReviewsUrl(reviewsApiPath, { slug, placeId });
|
|
342
349
|
(async () => {
|
|
343
350
|
setLoading(true);
|
|
344
351
|
setError(null);
|
|
352
|
+
if (!slug?.trim() && !placeId?.trim()) {
|
|
353
|
+
if (!cancelled) {
|
|
354
|
+
setError(
|
|
355
|
+
locale === "de" ? "slug oder placeId ist erforderlich." : "Either slug or placeId is required."
|
|
356
|
+
);
|
|
357
|
+
setData(null);
|
|
358
|
+
setLoading(false);
|
|
359
|
+
}
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
345
362
|
try {
|
|
346
363
|
const res = await fetch(url);
|
|
347
364
|
const json = await res.json().catch(() => null);
|
|
@@ -374,7 +391,7 @@ function GoogleReviewsCarouselCached({
|
|
|
374
391
|
return () => {
|
|
375
392
|
cancelled = true;
|
|
376
393
|
};
|
|
377
|
-
}, [slug, reviewsApiPath, locale]);
|
|
394
|
+
}, [slug, placeId, reviewsApiPath, locale]);
|
|
378
395
|
if (loading) {
|
|
379
396
|
return /* @__PURE__ */ jsx2(
|
|
380
397
|
"div",
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/GoogleReviewsCarousel.tsx","../src/lib/cn.ts","../src/components/GoogleReviewsCarouselCached.tsx"],"sourcesContent":["import { ChevronLeft, ChevronRight, ExternalLink, Star } from \"lucide-react\";\nimport * as React from \"react\";\nimport { useCallback, useEffect, useState } from \"react\";\nimport { cn } from \"../lib/cn\";\n\n// ---------- Types ----------\nexport interface GoogleReview {\n\tauthor: string;\n\trating: number;\n\tdate: string;\n\ttext: string;\n\t/** HTTPS is enforced; broken or blocked URLs fall back to initials (e.g. some Google CDN responses). */\n\tphotoUrl?: string;\n}\n\nexport type GoogleReviewsCarouselLocale = \"de\" | \"en\";\n\nexport interface GoogleReviewsCarouselProps {\n\treviews: GoogleReview[];\n\tbusinessName: string;\n\tplaceUrl: string;\n\t/**\n\t * Official overall rating from Google Places (all reviews). When omitted, the\n\t * header averages the `reviews` array — wrong if you only have a Places API\n\t * sample (max ~5 reviews).\n\t */\n\taggregateRating?: number;\n\t/** Official total review count from Google Places. When omitted, uses `reviews.length`. */\n\ttotalReviewCount?: number;\n\t/** UI copy. Default `de` matches KERN Handwerk sites. */\n\tlocale?: GoogleReviewsCarouselLocale;\n\taccentColor?: string;\n\tautoPlay?: boolean;\n\tautoPlaySpeed?: number;\n}\n\nconst UI_STRINGS: Record<\n\tGoogleReviewsCarouselLocale,\n\t{\n\t\teyebrow: string;\n\t\treviewCount: (n: number) => string;\n\t\treadMore: string;\n\t\tshowLess: string;\n\t\treadAllOnGoogle: string;\n\t\tprevReview: string;\n\t\tnextReview: string;\n\t\tgoToReview: (i: number) => string;\n\t}\n> = {\n\tde: {\n\t\teyebrow: \"Google-Bewertungen\",\n\t\treviewCount: (n) => `(${n} ${n === 1 ? \"Bewertung\" : \"Bewertungen\"})`,\n\t\treadMore: \"Mehr anzeigen\",\n\t\tshowLess: \"Weniger anzeigen\",\n\t\treadAllOnGoogle: \"Alle Bewertungen bei Google\",\n\t\tprevReview: \"Vorherige Bewertung\",\n\t\tnextReview: \"Nächste Bewertung\",\n\t\tgoToReview: (i) => `Zu Bewertung ${i}`,\n\t},\n\ten: {\n\t\teyebrow: \"Google reviews\",\n\t\treviewCount: (n) => `(${n} ${n === 1 ? \"review\" : \"reviews\"})`,\n\t\treadMore: \"Read more\",\n\t\tshowLess: \"Show less\",\n\t\treadAllOnGoogle: \"Read all reviews on Google\",\n\t\tprevReview: \"Previous review\",\n\t\tnextReview: \"Next review\",\n\t\tgoToReview: (i) => `Go to review ${i}`,\n\t},\n};\n\n// ---------- Sample data ----------\nexport const SAMPLE_REVIEWS: GoogleReview[] = [\n\t{\n\t\tauthor: \"Sarah Mitchell\",\n\t\trating: 5,\n\t\tdate: \"2 weeks ago\",\n\t\ttext: \"Absolutely fantastic service! They fixed our burst pipe on a Sunday evening within an hour of calling. The plumber was professional, tidy, and explained everything clearly. Pricing was very fair — no hidden charges. Highly recommend to anyone needing reliable plumbing work.\",\n\t\tphotoUrl: \"https://i.pravatar.cc/128?img=47\",\n\t},\n\t{\n\t\tauthor: \"James Thornton\",\n\t\trating: 5,\n\t\tdate: \"1 month ago\",\n\t\ttext: \"Had a full rewire done on our 1930s semi. The team were punctual every single day, kept the house as clean as possible, and the finish is immaculate. They even helped us plan the socket layout for our new kitchen. Top-notch electricians.\",\n\t\tphotoUrl: \"https://i.pravatar.cc/128?img=12\",\n\t},\n\t{\n\t\tauthor: \"Maria Chen\",\n\t\trating: 5,\n\t\tdate: \"3 weeks ago\",\n\t\ttext: \"Called them for an emergency boiler repair in the middle of winter. They came out the same day and had the heating back on within two hours. Genuine lifesavers — we have young kids and couldn't have waited. Will use again for our annual service.\",\n\t},\n\t{\n\t\tauthor: \"David Okonkwo\",\n\t\trating: 4,\n\t\tdate: \"2 months ago\",\n\t\ttext: \"Great job installing our new bathroom. Tiling work is spotless and the underfloor heating is a dream. Only minor hiccup was a small delay waiting for parts, but they kept us updated throughout. Overall very happy with the result.\",\n\t},\n\t{\n\t\tauthor: \"Emma Richardson\",\n\t\trating: 5,\n\t\tdate: \"1 week ago\",\n\t\ttext: \"We've used this company three times now — blocked drain, leaking shower, and a full kitchen tap replacement. Every time the service has been prompt, friendly, and reasonably priced. It's so hard to find tradespeople you can trust, and these guys are the real deal.\",\n\t},\n];\n\n// ---------- Helpers ----------\nconst AVATAR_COLORS = [\n\t\"hsl(210, 60%, 50%)\",\n\t\"hsl(340, 60%, 50%)\",\n\t\"hsl(160, 55%, 42%)\",\n\t\"hsl(30, 70%, 50%)\",\n\t\"hsl(270, 50%, 55%)\",\n];\n\nfunction getInitial(name: string) {\n\treturn name.charAt(0).toUpperCase();\n}\n\n/** Google profile URLs are often `http://` or protocol-relative; normalize for reliable loading. */\nfunction normalizeProfilePhotoUrl(url: string | undefined): string | undefined {\n\tif (!url?.trim()) return undefined;\n\tlet u = url.trim();\n\tif (u.startsWith(\"//\")) u = `https:${u}`;\n\telse if (/^http:\\/\\//i.test(u)) u = `https://${u.slice(7)}`;\n\treturn u;\n}\n\nfunction StarRating({ rating, size = 16 }: { rating: number; size?: number }) {\n\treturn (\n\t\t<span className=\"inline-flex gap-0.5\">\n\t\t\t{Array.from({ length: 5 }).map((_, i) => (\n\t\t\t\t<Star\n\t\t\t\t\tkey={i}\n\t\t\t\t\tsize={size}\n\t\t\t\t\tclassName={\n\t\t\t\t\t\ti < rating\n\t\t\t\t\t\t\t? \"fill-amber-400 text-amber-400\"\n\t\t\t\t\t\t\t: \"text-muted-foreground/30\"\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t))}\n\t\t</span>\n\t);\n}\n\nfunction GoogleLogo({ className }: { className?: string }) {\n\treturn (\n\t\t<svg\n\t\t\tclassName={className}\n\t\t\tviewBox=\"0 0 272 92\"\n\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t>\n\t\t\t<path\n\t\t\t\td=\"M115.75 47.18c0 12.77-9.99 22.18-22.25 22.18s-22.25-9.41-22.25-22.18C71.25 34.32 81.24 25 93.5 25s22.25 9.32 22.25 22.18zm-9.74 0c0-7.98-5.79-13.44-12.51-13.44S80.99 39.2 80.99 47.18c0 7.9 5.79 13.44 12.51 13.44s12.51-5.55 12.51-13.44z\"\n\t\t\t\tfill=\"#EA4335\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\td=\"M163.75 47.18c0 12.77-9.99 22.18-22.25 22.18s-22.25-9.41-22.25-22.18c0-12.85 9.99-22.18 22.25-22.18s22.25 9.32 22.25 22.18zm-9.74 0c0-7.98-5.79-13.44-12.51-13.44s-12.51 5.46-12.51 13.44c0 7.9 5.79 13.44 12.51 13.44s12.51-5.55 12.51-13.44z\"\n\t\t\t\tfill=\"#FBBC05\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\td=\"M209.75 26.34v39.82c0 16.38-9.66 23.07-21.08 23.07-10.75 0-17.22-7.19-19.66-13.07l8.48-3.53c1.51 3.61 5.21 7.87 11.17 7.87 7.31 0 11.84-4.51 11.84-13v-3.19h-.34c-2.18 2.69-6.38 5.04-11.68 5.04-11.09 0-21.25-9.66-21.25-22.09 0-12.52 10.16-22.26 21.25-22.26 5.29 0 9.49 2.35 11.68 4.96h.34v-3.61h9.25zm-8.56 20.92c0-7.81-5.21-13.52-11.84-13.52-6.72 0-12.35 5.71-12.35 13.52 0 7.73 5.63 13.36 12.35 13.36 6.63 0 11.84-5.63 11.84-13.36z\"\n\t\t\t\tfill=\"#4285F4\"\n\t\t\t/>\n\t\t\t<path d=\"M225 3v65h-9.5V3h9.5z\" fill=\"#34A853\" />\n\t\t\t<path\n\t\t\t\td=\"M262.02 54.48l7.56 5.04c-2.44 3.61-8.32 9.83-18.48 9.83-12.6 0-22.01-9.74-22.01-22.18 0-13.19 9.49-22.18 20.92-22.18 11.51 0 17.14 9.16 18.98 14.11l1.01 2.52-29.65 12.28c2.27 4.45 5.8 6.72 10.75 6.72 4.96 0 8.4-2.44 10.92-6.14zm-23.27-7.98l19.82-8.23c-1.09-2.77-4.37-4.7-8.23-4.7-4.95 0-11.84 4.37-11.59 12.93z\"\n\t\t\t\tfill=\"#EA4335\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\td=\"M35.29 41.19V32H67c.31 1.64.47 3.58.47 5.68 0 7.06-1.93 15.79-8.15 22.01-6.05 6.3-13.78 9.66-24.02 9.66C16.32 69.35.36 53.89.36 34.91.36 15.93 16.32.47 35.3.47c10.5 0 17.98 4.12 23.6 9.49l-6.64 6.64c-4.03-3.78-9.49-6.72-16.97-6.72-13.86 0-24.7 11.17-24.7 25.03 0 13.86 10.84 25.03 24.7 25.03 8.99 0 14.11-3.61 17.39-6.89 2.66-2.66 4.41-6.46 5.1-11.65l-22.49-.01z\"\n\t\t\t\tfill=\"#4285F4\"\n\t\t\t/>\n\t\t</svg>\n\t);\n}\n\n// ---------- Review Card ----------\nfunction ReviewCard({\n\treview,\n\tindex,\n\tlabels,\n}: {\n\treview: GoogleReview;\n\tindex: number;\n\tlabels: (typeof UI_STRINGS)[GoogleReviewsCarouselLocale];\n}) {\n\tconst [expanded, setExpanded] = useState(false);\n\tconst [imgFailed, setImgFailed] = useState(false);\n\tconst shouldTruncate = review.text.length > 150;\n\tconst photoSrc = normalizeProfilePhotoUrl(review.photoUrl);\n\n\tuseEffect(() => {\n\t\tsetImgFailed(false);\n\t}, [photoSrc]);\n\n\tconst showPhoto = Boolean(photoSrc) && !imgFailed;\n\n\treturn (\n\t\t<div className=\"flex h-full flex-col rounded-lg border bg-card p-5 shadow-sm\">\n\t\t\t{/* Author row */}\n\t\t\t<div className=\"mb-3 flex items-center gap-3\">\n\t\t\t\t{showPhoto ? (\n\t\t\t\t\t<img\n\t\t\t\t\t\tsrc={photoSrc}\n\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t\tclassName=\"h-10 w-10 rounded-full object-cover\"\n\t\t\t\t\t\tloading=\"lazy\"\n\t\t\t\t\t\tdecoding=\"async\"\n\t\t\t\t\t\tonError={() => setImgFailed(true)}\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName=\"flex h-10 w-10 items-center justify-center rounded-full text-sm font-semibold text-white\"\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\tbackgroundColor: AVATAR_COLORS[index % AVATAR_COLORS.length],\n\t\t\t\t\t\t}}\n\t\t\t\t\t\taria-hidden\n\t\t\t\t\t>\n\t\t\t\t\t\t{getInitial(review.author)}\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t\t<div className=\"min-w-0\">\n\t\t\t\t\t<p className=\"truncate text-sm font-medium text-foreground\">\n\t\t\t\t\t\t{review.author}\n\t\t\t\t\t</p>\n\t\t\t\t\t<p className=\"text-xs text-muted-foreground\">{review.date}</p>\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t{/* Stars */}\n\t\t\t<StarRating rating={review.rating} />\n\n\t\t\t{/* Text */}\n\t\t\t<p className=\"mt-3 flex-1 text-sm leading-relaxed text-foreground/80\">\n\t\t\t\t{shouldTruncate && !expanded\n\t\t\t\t\t? review.text.slice(0, 150) + \"…\"\n\t\t\t\t\t: review.text}\n\t\t\t</p>\n\t\t\t{shouldTruncate && (\n\t\t\t\t<button\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tonClick={() => setExpanded(!expanded)}\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\"mt-1 inline-flex h-auto self-start p-0 text-xs font-medium text-primary underline-offset-4 hover:underline\",\n\t\t\t\t\t)}\n\t\t\t\t>\n\t\t\t\t\t{expanded ? labels.showLess : labels.readMore}\n\t\t\t\t</button>\n\t\t\t)}\n\t\t</div>\n\t);\n}\n\n// ---------- Main Component ----------\nexport default function GoogleReviewsCarousel({\n\treviews,\n\tbusinessName,\n\tplaceUrl,\n\taggregateRating: aggregateRatingProp,\n\ttotalReviewCount: totalReviewCountProp,\n\tlocale = \"de\",\n\tautoPlay = true,\n\tautoPlaySpeed = 5000,\n}: GoogleReviewsCarouselProps) {\n\tconst labels = UI_STRINGS[locale];\n\tconst [current, setCurrent] = useState(0);\n\tconst [paused, setPaused] = useState(false);\n\tconst total = reviews.length;\n\n\tconst next = useCallback(() => setCurrent((c) => (c + 1) % total), [total]);\n\tconst prev = useCallback(\n\t\t() => setCurrent((c) => (c - 1 + total) % total),\n\t\t[total],\n\t);\n\n\tuseEffect(() => {\n\t\tif (!autoPlay || paused || total <= 1) return;\n\t\tconst id = setInterval(next, autoPlaySpeed);\n\t\treturn () => clearInterval(id);\n\t}, [autoPlay, autoPlaySpeed, paused, next, total]);\n\n\tif (total === 0) return null;\n\n\tconst summaryCount = totalReviewCountProp ?? total;\n\tconst meanFromSample =\n\t\ttotal > 0 ? reviews.reduce((s, r) => s + r.rating, 0) / total : 0;\n\tconst summaryRating = aggregateRatingProp ?? meanFromSample;\n\tconst ratingLabel = summaryRating.toFixed(1);\n\n\treturn (\n\t\t<section\n\t\t\tclassName=\"mx-auto w-full max-w-2xl\"\n\t\t\tonMouseEnter={() => setPaused(true)}\n\t\t\tonMouseLeave={() => setPaused(false)}\n\t\t>\n\t\t\t{/* Header */}\n\t\t\t<div className=\"mb-6 flex flex-col items-center gap-2 text-center\">\n\t\t\t\t<GoogleLogo className=\"h-7\" />\n\t\t\t\t<p className=\"text-xs font-medium uppercase tracking-widest text-muted-foreground\">\n\t\t\t\t\t{labels.eyebrow}\n\t\t\t\t</p>\n\t\t\t\t<h3 className=\"text-lg font-semibold text-foreground\">\n\t\t\t\t\t{businessName}\n\t\t\t\t</h3>\n\t\t\t\t<div className=\"flex items-center gap-2\">\n\t\t\t\t\t<span className=\"text-2xl font-bold text-foreground\">\n\t\t\t\t\t\t{ratingLabel}\n\t\t\t\t\t</span>\n\t\t\t\t\t<StarRating rating={Math.round(summaryRating)} size={20} />\n\t\t\t\t\t<span className=\"text-sm text-muted-foreground\">\n\t\t\t\t\t\t{labels.reviewCount(summaryCount)}\n\t\t\t\t\t</span>\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t{/* Carousel */}\n\t\t\t<div className=\"relative\">\n\t\t\t\t{/* Arrows */}\n\t\t\t\t{total > 1 && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\"absolute -left-4 top-1/2 z-10 flex h-8 w-8 -translate-y-1/2 items-center justify-center rounded-full border border-input bg-background shadow-md ring-offset-background transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2\",\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\tonClick={prev}\n\t\t\t\t\t\t\taria-label={labels.prevReview}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ChevronLeft className=\"h-4 w-4\" />\n\t\t\t\t\t\t</button>\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\"absolute -right-4 top-1/2 z-10 flex h-8 w-8 -translate-y-1/2 items-center justify-center rounded-full border border-input bg-background shadow-md ring-offset-background transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2\",\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\tonClick={next}\n\t\t\t\t\t\t\taria-label={labels.nextReview}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ChevronRight className=\"h-4 w-4\" />\n\t\t\t\t\t\t</button>\n\t\t\t\t\t</>\n\t\t\t\t)}\n\n\t\t\t\t{/* Card viewport */}\n\t\t\t\t<div className=\"overflow-hidden rounded-lg\">\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName=\"flex transition-transform duration-500 ease-in-out\"\n\t\t\t\t\t\tstyle={{ transform: `translateX(-${current * 100}%)` }}\n\t\t\t\t\t>\n\t\t\t\t\t\t{reviews.map((review, i) => (\n\t\t\t\t\t\t\t<div key={i} className=\"w-full flex-shrink-0 px-1\">\n\t\t\t\t\t\t\t\t<ReviewCard review={review} index={i} labels={labels} />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\n\t\t\t\t{/* Dots */}\n\t\t\t\t{total > 1 && (\n\t\t\t\t\t<div className=\"mt-4 flex justify-center gap-2\">\n\t\t\t\t\t\t{reviews.map((_, i) => (\n\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\tkey={i}\n\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\tonClick={() => setCurrent(i)}\n\t\t\t\t\t\t\t\taria-label={labels.goToReview(i + 1)}\n\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\t\"h-2 w-2 rounded-full transition-all\",\n\t\t\t\t\t\t\t\t\ti === current\n\t\t\t\t\t\t\t\t\t\t? \"w-6 bg-primary\"\n\t\t\t\t\t\t\t\t\t\t: \"bg-muted-foreground/30 hover:bg-muted-foreground/50\",\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t</div>\n\n\t\t\t{/* CTA */}\n\t\t\t<div className=\"mt-6 flex justify-center\">\n\t\t\t\t<a\n\t\t\t\t\thref={placeUrl}\n\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\"inline-flex h-11 items-center justify-center gap-2 whitespace-nowrap rounded-md border border-input bg-background px-4 py-2 font-medium ring-offset-background transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2\",\n\t\t\t\t\t)}\n\t\t\t\t>\n\t\t\t\t\t{labels.readAllOnGoogle}\n\t\t\t\t\t<ExternalLink className=\"ml-1 h-3.5 w-3.5 shrink-0\" />\n\t\t\t\t</a>\n\t\t\t</div>\n\t\t</section>\n\t);\n}\n","import { type ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n\treturn twMerge(clsx(inputs));\n}\n","import { Loader2 } from \"lucide-react\";\nimport { useEffect, useState } from \"react\";\nimport GoogleReviewsCarousel, {\n\ttype GoogleReview,\n\ttype GoogleReviewsCarouselProps,\n} from \"./GoogleReviewsCarousel\";\n\n/** JSON body from `GET /api/google-reviews?slug=…` (website serverless handler). */\nexport type CachedGoogleReviewsResponse = {\n\tbusinessName: string;\n\tplaceUrl: string;\n\treviews: GoogleReview[];\n\tfetchedAt: string;\n\tsource: \"cache\" | \"refreshed\" | \"stale_fallback\" | \"stale_no_api_key\";\n\t/** Google Places overall rating (all reviews); omit if unknown. */\n\taggregateRating?: number;\n\ttotalReviewCount?: number;\n};\n\nexport type GoogleReviewsCarouselCachedProps = Omit<\n\tGoogleReviewsCarouselProps,\n\t\"reviews\" | \"businessName\" | \"placeUrl\"\n> & {\n\tslug: string;\n\t/** Base path or absolute URL; `?slug=` is appended. Default: `/api/google-reviews` */\n\treviewsApiPath?: string;\n};\n\nfunction buildReviewsUrl(base: string, slug: string): string {\n\tconst path = base.replace(/\\/$/, \"\");\n\tconst joiner = path.includes(\"?\") ? \"&\" : \"?\";\n\treturn `${path}${joiner}slug=${encodeURIComponent(slug)}`;\n}\n\nfunction isSuccessPayload(data: unknown): data is CachedGoogleReviewsResponse {\n\tif (!data || typeof data !== \"object\") return false;\n\tconst o = data as Record<string, unknown>;\n\treturn (\n\t\ttypeof o.businessName === \"string\" &&\n\t\ttypeof o.placeUrl === \"string\" &&\n\t\tArray.isArray(o.reviews) &&\n\t\ttypeof o.fetchedAt === \"string\" &&\n\t\ttypeof o.source === \"string\"\n\t);\n}\n\n/**\n * Loads reviews via your backend (Supabase cache + monthly Google Places refresh),\n * then renders {@link GoogleReviewsCarousel}.\n */\nexport default function GoogleReviewsCarouselCached({\n\tslug,\n\treviewsApiPath = \"/api/google-reviews\",\n\tlocale = \"de\",\n\t...carouselRest\n}: GoogleReviewsCarouselCachedProps) {\n\tconst [data, setData] = useState<CachedGoogleReviewsResponse | null>(null);\n\tconst [error, setError] = useState<string | null>(null);\n\tconst [loading, setLoading] = useState(true);\n\n\tuseEffect(() => {\n\t\tlet cancelled = false;\n\t\tconst url = buildReviewsUrl(reviewsApiPath, slug);\n\n\t\t(async () => {\n\t\t\tsetLoading(true);\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tconst res = await fetch(url);\n\t\t\t\tconst json: unknown = await res.json().catch(() => null);\n\t\t\t\tif (cancelled) return;\n\t\t\t\tif (!res.ok) {\n\t\t\t\t\tconst msg =\n\t\t\t\t\t\tjson &&\n\t\t\t\t\t\ttypeof json === \"object\" &&\n\t\t\t\t\t\t\"error\" in json &&\n\t\t\t\t\t\ttypeof (json as { error: unknown }).error === \"string\"\n\t\t\t\t\t\t\t? (json as { error: string }).error\n\t\t\t\t\t\t\t: res.statusText;\n\t\t\t\t\tsetError(msg);\n\t\t\t\t\tsetData(null);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (!isSuccessPayload(json)) {\n\t\t\t\t\tsetError(\n\t\t\t\t\t\tlocale === \"de\"\n\t\t\t\t\t\t\t? \"Ungültige Antwort vom Server.\"\n\t\t\t\t\t\t\t: \"Invalid server response.\",\n\t\t\t\t\t);\n\t\t\t\t\tsetData(null);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tsetData(json);\n\t\t\t} catch {\n\t\t\t\tif (!cancelled) {\n\t\t\t\t\tsetError(\n\t\t\t\t\t\tlocale === \"de\"\n\t\t\t\t\t\t\t? \"Bewertungen konnten nicht geladen werden.\"\n\t\t\t\t\t\t\t: \"Could not load reviews.\",\n\t\t\t\t\t);\n\t\t\t\t\tsetData(null);\n\t\t\t\t}\n\t\t\t} finally {\n\t\t\t\tif (!cancelled) setLoading(false);\n\t\t\t}\n\t\t})();\n\n\t\treturn () => {\n\t\t\tcancelled = true;\n\t\t};\n\t}, [slug, reviewsApiPath, locale]);\n\n\tif (loading) {\n\t\treturn (\n\t\t\t<div\n\t\t\t\tclassName=\"mx-auto flex w-full max-w-2xl justify-center py-16 text-muted-foreground\"\n\t\t\t\trole=\"status\"\n\t\t\t\taria-live=\"polite\"\n\t\t\t>\n\t\t\t\t<Loader2 className=\"h-8 w-8 animate-spin\" aria-hidden />\n\t\t\t</div>\n\t\t);\n\t}\n\n\tif (error || !data) {\n\t\treturn (\n\t\t\t<p\n\t\t\t\tclassName=\"mx-auto max-w-2xl text-center text-sm text-muted-foreground\"\n\t\t\t\trole=\"alert\"\n\t\t\t>\n\t\t\t\t{error ??\n\t\t\t\t\t(locale === \"de\"\n\t\t\t\t\t\t? \"Keine Bewertungen verfügbar.\"\n\t\t\t\t\t\t: \"No reviews available.\")}\n\t\t\t</p>\n\t\t);\n\t}\n\n\tif (data.reviews.length === 0) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<GoogleReviewsCarousel\n\t\t\treviews={data.reviews}\n\t\t\tbusinessName={data.businessName}\n\t\t\tplaceUrl={data.placeUrl}\n\t\t\taggregateRating={data.aggregateRating}\n\t\t\ttotalReviewCount={data.totalReviewCount}\n\t\t\tlocale={locale}\n\t\t\t{...carouselRest}\n\t\t/>\n\t);\n}\n"],"mappings":";AAAA,SAAS,aAAa,cAAc,cAAc,YAAY;AAE9D,SAAS,aAAa,WAAW,gBAAgB;;;ACFjD,SAA0B,YAAY;AACtC,SAAS,eAAe;AAEjB,SAAS,MAAM,QAAsB;AAC3C,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC5B;;;ADgII,SA6LC,UA7LD,KAgBF,YAhBE;AAjGJ,IAAM,aAYF;AAAA,EACH,IAAI;AAAA,IACH,SAAS;AAAA,IACT,aAAa,CAAC,MAAM,IAAI,CAAC,IAAI,MAAM,IAAI,cAAc,aAAa;AAAA,IAClE,UAAU;AAAA,IACV,UAAU;AAAA,IACV,iBAAiB;AAAA,IACjB,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,YAAY,CAAC,MAAM,gBAAgB,CAAC;AAAA,EACrC;AAAA,EACA,IAAI;AAAA,IACH,SAAS;AAAA,IACT,aAAa,CAAC,MAAM,IAAI,CAAC,IAAI,MAAM,IAAI,WAAW,SAAS;AAAA,IAC3D,UAAU;AAAA,IACV,UAAU;AAAA,IACV,iBAAiB;AAAA,IACjB,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,YAAY,CAAC,MAAM,gBAAgB,CAAC;AAAA,EACrC;AACD;AAGO,IAAM,iBAAiC;AAAA,EAC7C;AAAA,IACC,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,MAAM;AAAA,IACN,UAAU;AAAA,EACX;AAAA,EACA;AAAA,IACC,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,MAAM;AAAA,IACN,UAAU;AAAA,EACX;AAAA,EACA;AAAA,IACC,QAAQ;AAAA,IACR,QAA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ACvD;AAAA,EAEF;AAEA,MAAI,SAAS,CAAC,MAAM;AACnB,WACC,gBAAAA;AAAA,MAAC;AAAA;AAAA,QACA,WAAU;AAAA,QACV,MAAK;AAAA,QAEJ,oBACC,WAAW,OACT,oCACA;AAAA;AAAA,IACL;AAAA,EAEF;AAEA,MAAI,KAAK,QAAQ,WAAW,GAAG;AAC9B,WAAO;AAAA,EACR;AAEA,SACC,gBAAAA;AAAA,IAAC;AAAA;AAAA,MACA,SAAS,KAAK;AAAA,MACd,cAAc,KAAK;AAAA,MACnB,UAAU,KAAK;AAAA,MACf,iBAAiB,KAAK;AAAA,MACtB,kBAAkB,KAAK;AAAA,MACvB;AAAA,MACC,GAAG;AAAA;AAAA,EACL;AAEF;","names":["useEffect","useState","jsx","useState","useEffect"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/GoogleReviewsCarousel.tsx","../src/lib/cn.ts","../src/components/GoogleReviewsCarouselCached.tsx"],"sourcesContent":["import { ChevronLeft, ChevronRight, ExternalLink, Star } from \"lucide-react\";\nimport * as React from \"react\";\nimport { useCallback, useEffect, useState } from \"react\";\nimport { cn } from \"../lib/cn\";\n\n// ---------- Types ----------\nexport interface GoogleReview {\n\tauthor: string;\n\trating: number;\n\tdate: string;\n\ttext: string;\n\t/** HTTPS is enforced; broken or blocked URLs fall back to initials (e.g. some Google CDN responses). */\n\tphotoUrl?: string;\n}\n\nexport type GoogleReviewsCarouselLocale = \"de\" | \"en\";\n\nexport interface GoogleReviewsCarouselProps {\n\treviews: GoogleReview[];\n\tbusinessName: string;\n\tplaceUrl: string;\n\t/**\n\t * Official overall rating from Google Places (all reviews). When omitted, the\n\t * header averages the `reviews` array — wrong if you only have a Places API\n\t * sample (max ~5 reviews).\n\t */\n\taggregateRating?: number;\n\t/** Official total review count from Google Places. When omitted, uses `reviews.length`. */\n\ttotalReviewCount?: number;\n\t/** UI copy. Default `de` matches KERN Handwerk sites. */\n\tlocale?: GoogleReviewsCarouselLocale;\n\taccentColor?: string;\n\tautoPlay?: boolean;\n\tautoPlaySpeed?: number;\n}\n\nconst UI_STRINGS: Record<\n\tGoogleReviewsCarouselLocale,\n\t{\n\t\teyebrow: string;\n\t\treviewCount: (n: number) => string;\n\t\treadMore: string;\n\t\tshowLess: string;\n\t\treadAllOnGoogle: string;\n\t\tprevReview: string;\n\t\tnextReview: string;\n\t\tgoToReview: (i: number) => string;\n\t}\n> = {\n\tde: {\n\t\teyebrow: \"Google-Bewertungen\",\n\t\treviewCount: (n) => `(${n} ${n === 1 ? \"Bewertung\" : \"Bewertungen\"})`,\n\t\treadMore: \"Mehr anzeigen\",\n\t\tshowLess: \"Weniger anzeigen\",\n\t\treadAllOnGoogle: \"Alle Bewertungen bei Google\",\n\t\tprevReview: \"Vorherige Bewertung\",\n\t\tnextReview: \"Nächste Bewertung\",\n\t\tgoToReview: (i) => `Zu Bewertung ${i}`,\n\t},\n\ten: {\n\t\teyebrow: \"Google reviews\",\n\t\treviewCount: (n) => `(${n} ${n === 1 ? \"review\" : \"reviews\"})`,\n\t\treadMore: \"Read more\",\n\t\tshowLess: \"Show less\",\n\t\treadAllOnGoogle: \"Read all reviews on Google\",\n\t\tprevReview: \"Previous review\",\n\t\tnextReview: \"Next review\",\n\t\tgoToReview: (i) => `Go to review ${i}`,\n\t},\n};\n\n// ---------- Sample data ----------\nexport const SAMPLE_REVIEWS: GoogleReview[] = [\n\t{\n\t\tauthor: \"Sarah Mitchell\",\n\t\trating: 5,\n\t\tdate: \"2 weeks ago\",\n\t\ttext: \"Absolutely fantastic service! They fixed our burst pipe on a Sunday evening within an hour of calling. The plumber was professional, tidy, and explained everything clearly. Pricing was very fair — no hidden charges. Highly recommend to anyone needing reliable plumbing work.\",\n\t\tphotoUrl: \"https://i.pravatar.cc/128?img=47\",\n\t},\n\t{\n\t\tauthor: \"James Thornton\",\n\t\trating: 5,\n\t\tdate: \"1 month ago\",\n\t\ttext: \"Had a full rewire done on our 1930s semi. The team were punctual every single day, kept the house as clean as possible, and the finish is immaculate. They even helped us plan the socket layout for our new kitchen. Top-notch electricians.\",\n\t\tphotoUrl: \"https://i.pravatar.cc/128?img=12\",\n\t},\n\t{\n\t\tauthor: \"Maria Chen\",\n\t\trating: 5,\n\t\tdate: \"3 weeks ago\",\n\t\ttext: \"Called them for an emergency boiler repair in the middle of winter. They came out the same day and had the heating back on within two hours. Genuine lifesavers — we have young kids and couldn't have waited. Will use again for our annual service.\",\n\t},\n\t{\n\t\tauthor: \"David Okonkwo\",\n\t\trating: 4,\n\t\tdate: \"2 months ago\",\n\t\ttext: \"Great job installing our new bathroom. Tiling work is spotless and the underfloor heating is a dream. Only minor hiccup was a small delay waiting for parts, but they kept us updated throughout. Overall very happy with the result.\",\n\t},\n\t{\n\t\tauthor: \"Emma Richardson\",\n\t\trating: 5,\n\t\tdate: \"1 week ago\",\n\t\ttext: \"We've used this company three times now — blocked drain, leaking shower, and a full kitchen tap replacement. Every time the service has been prompt, friendly, and reasonably priced. It's so hard to find tradespeople you can trust, and these guys are the real deal.\",\n\t},\n];\n\n// ---------- Helpers ----------\nconst AVATAR_COLORS = [\n\t\"hsl(210, 60%, 50%)\",\n\t\"hsl(340, 60%, 50%)\",\n\t\"hsl(160, 55%, 42%)\",\n\t\"hsl(30, 70%, 50%)\",\n\t\"hsl(270, 50%, 55%)\",\n];\n\nfunction getInitial(name: string) {\n\treturn name.charAt(0).toUpperCase();\n}\n\n/** Google profile URLs are often `http://` or protocol-relative; normalize for reliable loading. */\nfunction normalizeProfilePhotoUrl(url: string | undefined): string | undefined {\n\tif (!url?.trim()) return undefined;\n\tlet u = url.trim();\n\tif (u.startsWith(\"//\")) u = `https:${u}`;\n\telse if (/^http:\\/\\//i.test(u)) u = `https://${u.slice(7)}`;\n\treturn u;\n}\n\nfunction StarRating({ rating, size = 16 }: { rating: number; size?: number }) {\n\treturn (\n\t\t<span className=\"inline-flex gap-0.5\">\n\t\t\t{Array.from({ length: 5 }).map((_, i) => (\n\t\t\t\t<Star\n\t\t\t\t\tkey={i}\n\t\t\t\t\tsize={size}\n\t\t\t\t\tclassName={\n\t\t\t\t\t\ti < rating\n\t\t\t\t\t\t\t? \"fill-amber-400 text-amber-400\"\n\t\t\t\t\t\t\t: \"text-muted-foreground/30\"\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t))}\n\t\t</span>\n\t);\n}\n\nfunction GoogleLogo({ className }: { className?: string }) {\n\treturn (\n\t\t<svg\n\t\t\tclassName={className}\n\t\t\tviewBox=\"0 0 272 92\"\n\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t>\n\t\t\t<path\n\t\t\t\td=\"M115.75 47.18c0 12.77-9.99 22.18-22.25 22.18s-22.25-9.41-22.25-22.18C71.25 34.32 81.24 25 93.5 25s22.25 9.32 22.25 22.18zm-9.74 0c0-7.98-5.79-13.44-12.51-13.44S80.99 39.2 80.99 47.18c0 7.9 5.79 13.44 12.51 13.44s12.51-5.55 12.51-13.44z\"\n\t\t\t\tfill=\"#EA4335\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\td=\"M163.75 47.18c0 12.77-9.99 22.18-22.25 22.18s-22.25-9.41-22.25-22.18c0-12.85 9.99-22.18 22.25-22.18s22.25 9.32 22.25 22.18zm-9.74 0c0-7.98-5.79-13.44-12.51-13.44s-12.51 5.46-12.51 13.44c0 7.9 5.79 13.44 12.51 13.44s12.51-5.55 12.51-13.44z\"\n\t\t\t\tfill=\"#FBBC05\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\td=\"M209.75 26.34v39.82c0 16.38-9.66 23.07-21.08 23.07-10.75 0-17.22-7.19-19.66-13.07l8.48-3.53c1.51 3.61 5.21 7.87 11.17 7.87 7.31 0 11.84-4.51 11.84-13v-3.19h-.34c-2.18 2.69-6.38 5.04-11.68 5.04-11.09 0-21.25-9.66-21.25-22.09 0-12.52 10.16-22.26 21.25-22.26 5.29 0 9.49 2.35 11.68 4.96h.34v-3.61h9.25zm-8.56 20.92c0-7.81-5.21-13.52-11.84-13.52-6.72 0-12.35 5.71-12.35 13.52 0 7.73 5.63 13.36 12.35 13.36 6.63 0 11.84-5.63 11.84-13.36z\"\n\t\t\t\tfill=\"#4285F4\"\n\t\t\t/>\n\t\t\t<path d=\"M225 3v65h-9.5V3h9.5z\" fill=\"#34A853\" />\n\t\t\t<path\n\t\t\t\td=\"M262.02 54.48l7.56 5.04c-2.44 3.61-8.32 9.83-18.48 9.83-12.6 0-22.01-9.74-22.01-22.18 0-13.19 9.49-22.18 20.92-22.18 11.51 0 17.14 9.16 18.98 14.11l1.01 2.52-29.65 12.28c2.27 4.45 5.8 6.72 10.75 6.72 4.96 0 8.4-2.44 10.92-6.14zm-23.27-7.98l19.82-8.23c-1.09-2.77-4.37-4.7-8.23-4.7-4.95 0-11.84 4.37-11.59 12.93z\"\n\t\t\t\tfill=\"#EA4335\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\td=\"M35.29 41.19V32H67c.31 1.64.47 3.58.47 5.68 0 7.06-1.93 15.79-8.15 22.01-6.05 6.3-13.78 9.66-24.02 9.66C16.32 69.35.36 53.89.36 34.91.36 15.93 16.32.47 35.3.47c10.5 0 17.98 4.12 23.6 9.49l-6.64 6.64c-4.03-3.78-9.49-6.72-16.97-6.72-13.86 0-24.7 11.17-24.7 25.03 0 13.86 10.84 25.03 24.7 25.03 8.99 0 14.11-3.61 17.39-6.89 2.66-2.66 4.41-6.46 5.1-11.65l-22.49-.01z\"\n\t\t\t\tfill=\"#4285F4\"\n\t\t\t/>\n\t\t</svg>\n\t);\n}\n\n// ---------- Review Card ----------\nfunction ReviewCard({\n\treview,\n\tindex,\n\tlabels,\n}: {\n\treview: GoogleReview;\n\tindex: number;\n\tlabels: (typeof UI_STRINGS)[GoogleReviewsCarouselLocale];\n}) {\n\tconst [expanded, setExpanded] = useState(false);\n\tconst [imgFailed, setImgFailed] = useState(false);\n\tconst shouldTruncate = review.text.length > 150;\n\tconst photoSrc = normalizeProfilePhotoUrl(review.photoUrl);\n\n\tuseEffect(() => {\n\t\tsetImgFailed(false);\n\t}, [photoSrc]);\n\n\tconst showPhoto = Boolean(photoSrc) && !imgFailed;\n\n\treturn (\n\t\t<div className=\"flex h-full flex-col rounded-lg border bg-card p-5 shadow-sm\">\n\t\t\t{/* Author row */}\n\t\t\t<div className=\"mb-3 flex items-center gap-3\">\n\t\t\t\t{showPhoto ? (\n\t\t\t\t\t<img\n\t\t\t\t\t\tsrc={photoSrc}\n\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t\tclassName=\"h-10 w-10 rounded-full object-cover\"\n\t\t\t\t\t\tloading=\"lazy\"\n\t\t\t\t\t\tdecoding=\"async\"\n\t\t\t\t\t\tonError={() => setImgFailed(true)}\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName=\"flex h-10 w-10 items-center justify-center rounded-full text-sm font-semibold text-white\"\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\tbackgroundColor: AVATAR_COLORS[index % AVATAR_COLORS.length],\n\t\t\t\t\t\t}}\n\t\t\t\t\t\taria-hidden\n\t\t\t\t\t>\n\t\t\t\t\t\t{getInitial(review.author)}\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t\t<div className=\"min-w-0\">\n\t\t\t\t\t<p className=\"truncate text-sm font-medium text-foreground\">\n\t\t\t\t\t\t{review.author}\n\t\t\t\t\t</p>\n\t\t\t\t\t<p className=\"text-xs text-muted-foreground\">{review.date}</p>\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t{/* Stars */}\n\t\t\t<StarRating rating={review.rating} />\n\n\t\t\t{/* Text */}\n\t\t\t<p className=\"mt-3 flex-1 text-sm leading-relaxed text-foreground/80\">\n\t\t\t\t{shouldTruncate && !expanded\n\t\t\t\t\t? review.text.slice(0, 150) + \"…\"\n\t\t\t\t\t: review.text}\n\t\t\t</p>\n\t\t\t{shouldTruncate && (\n\t\t\t\t<button\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tonClick={() => setExpanded(!expanded)}\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\"mt-1 inline-flex h-auto self-start p-0 text-xs font-medium text-primary underline-offset-4 hover:underline\",\n\t\t\t\t\t)}\n\t\t\t\t>\n\t\t\t\t\t{expanded ? labels.showLess : labels.readMore}\n\t\t\t\t</button>\n\t\t\t)}\n\t\t</div>\n\t);\n}\n\n// ---------- Main Component ----------\nexport default function GoogleReviewsCarousel({\n\treviews,\n\tbusinessName,\n\tplaceUrl,\n\taggregateRating: aggregateRatingProp,\n\ttotalReviewCount: totalReviewCountProp,\n\tlocale = \"de\",\n\tautoPlay = true,\n\tautoPlaySpeed = 5000,\n}: GoogleReviewsCarouselProps) {\n\tconst labels = UI_STRINGS[locale];\n\tconst [current, setCurrent] = useState(0);\n\tconst [paused, setPaused] = useState(false);\n\tconst total = reviews.length;\n\n\tconst next = useCallback(() => setCurrent((c) => (c + 1) % total), [total]);\n\tconst prev = useCallback(\n\t\t() => setCurrent((c) => (c - 1 + total) % total),\n\t\t[total],\n\t);\n\n\tuseEffect(() => {\n\t\tif (!autoPlay || paused || total <= 1) return;\n\t\tconst id = setInterval(next, autoPlaySpeed);\n\t\treturn () => clearInterval(id);\n\t}, [autoPlay, autoPlaySpeed, paused, next, total]);\n\n\tif (total === 0) return null;\n\n\tconst summaryCount = totalReviewCountProp ?? total;\n\tconst meanFromSample =\n\t\ttotal > 0 ? reviews.reduce((s, r) => s + r.rating, 0) / total : 0;\n\tconst summaryRating = aggregateRatingProp ?? meanFromSample;\n\tconst ratingLabel = summaryRating.toFixed(1);\n\n\treturn (\n\t\t<section\n\t\t\tclassName=\"mx-auto w-full max-w-3xl\"\n\t\t\tonMouseEnter={() => setPaused(true)}\n\t\t\tonMouseLeave={() => setPaused(false)}\n\t\t>\n\t\t\t{/* Header */}\n\t\t\t<div className=\"mb-10 flex flex-col items-center gap-4 py-2 text-center\">\n\t\t\t\t<GoogleLogo className=\"h-8\" />\n\t\t\t\t<p className=\"text-xs font-medium uppercase tracking-widest text-muted-foreground\">\n\t\t\t\t\t{labels.eyebrow}\n\t\t\t\t</p>\n\t\t\t\t<h3 className=\"font-display text-xl font-semibold text-foreground md:text-2xl\">\n\t\t\t\t\t{businessName}\n\t\t\t\t</h3>\n\t\t\t\t<div className=\"flex items-center gap-2\">\n\t\t\t\t\t<span className=\"text-2xl font-bold text-foreground\">\n\t\t\t\t\t\t{ratingLabel}\n\t\t\t\t\t</span>\n\t\t\t\t\t<StarRating rating={Math.round(summaryRating)} size={20} />\n\t\t\t\t\t<span className=\"text-sm text-muted-foreground\">\n\t\t\t\t\t\t{labels.reviewCount(summaryCount)}\n\t\t\t\t\t</span>\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t{/* Carousel */}\n\t\t\t<div className=\"relative\">\n\t\t\t\t{/* Arrows */}\n\t\t\t\t{total > 1 && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\"absolute -left-4 top-1/2 z-10 flex h-8 w-8 -translate-y-1/2 items-center justify-center rounded-full border border-input bg-background shadow-md ring-offset-background transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2\",\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\tonClick={prev}\n\t\t\t\t\t\t\taria-label={labels.prevReview}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ChevronLeft className=\"h-4 w-4\" />\n\t\t\t\t\t\t</button>\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\"absolute -right-4 top-1/2 z-10 flex h-8 w-8 -translate-y-1/2 items-center justify-center rounded-full border border-input bg-background shadow-md ring-offset-background transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2\",\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\tonClick={next}\n\t\t\t\t\t\t\taria-label={labels.nextReview}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ChevronRight className=\"h-4 w-4\" />\n\t\t\t\t\t\t</button>\n\t\t\t\t\t</>\n\t\t\t\t)}\n\n\t\t\t\t{/* Card viewport */}\n\t\t\t\t<div className=\"overflow-hidden rounded-lg\">\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName=\"flex transition-transform duration-500 ease-in-out\"\n\t\t\t\t\t\tstyle={{ transform: `translateX(-${current * 100}%)` }}\n\t\t\t\t\t>\n\t\t\t\t\t\t{reviews.map((review, i) => (\n\t\t\t\t\t\t\t<div key={i} className=\"w-full flex-shrink-0 px-1\">\n\t\t\t\t\t\t\t\t<ReviewCard review={review} index={i} labels={labels} />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\n\t\t\t\t{/* Dots */}\n\t\t\t\t{total > 1 && (\n\t\t\t\t\t<div className=\"mt-4 flex justify-center gap-2\">\n\t\t\t\t\t\t{reviews.map((_, i) => (\n\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\tkey={i}\n\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\tonClick={() => setCurrent(i)}\n\t\t\t\t\t\t\t\taria-label={labels.goToReview(i + 1)}\n\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\t\"h-2 w-2 rounded-full transition-all\",\n\t\t\t\t\t\t\t\t\ti === current\n\t\t\t\t\t\t\t\t\t\t? \"w-6 bg-primary\"\n\t\t\t\t\t\t\t\t\t\t: \"bg-muted-foreground/30 hover:bg-muted-foreground/50\",\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t</div>\n\n\t\t\t{/* CTA */}\n\t\t\t<div className=\"mt-6 flex justify-center\">\n\t\t\t\t<a\n\t\t\t\t\thref={placeUrl}\n\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\"inline-flex h-11 items-center justify-center gap-2 whitespace-nowrap rounded-md border border-input bg-background px-4 py-2 font-medium ring-offset-background transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2\",\n\t\t\t\t\t)}\n\t\t\t\t>\n\t\t\t\t\t{labels.readAllOnGoogle}\n\t\t\t\t\t<ExternalLink className=\"ml-1 h-3.5 w-3.5 shrink-0\" />\n\t\t\t\t</a>\n\t\t\t</div>\n\t\t</section>\n\t);\n}\n","import { type ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n\treturn twMerge(clsx(inputs));\n}\n","import { Loader2 } from \"lucide-react\";\nimport { useEffect, useState } from \"react\";\nimport GoogleReviewsCarousel, {\n\ttype GoogleReview,\n\ttype GoogleReviewsCarouselProps,\n} from \"./GoogleReviewsCarousel\";\n\n/** JSON body from `GET /api/google-reviews` (website serverless handler). */\nexport type CachedGoogleReviewsResponse = {\n\tbusinessName: string;\n\tplaceUrl: string;\n\treviews: GoogleReview[];\n\tfetchedAt: string;\n\tsource: \"live\";\n\t/** Google Places overall rating (all reviews); omit if unknown. */\n\taggregateRating?: number;\n\ttotalReviewCount?: number;\n};\n\nexport type GoogleReviewsCarouselCachedProps = Omit<\n\tGoogleReviewsCarouselProps,\n\t\"reviews\" | \"businessName\" | \"placeUrl\"\n> & {\n\t/** Resolved server-side via `GOOGLE_REVIEWS_SLUG_MAP` when `placeId` is omitted. */\n\tslug?: string;\n\t/** Google Place ID; avoids slug map. Prefer for single-tenant sites. */\n\tplaceId?: string;\n\t/** Base path or absolute URL; default `/api/google-reviews` */\n\treviewsApiPath?: string;\n};\n\nfunction buildReviewsUrl(\n\tbase: string,\n\tparams: { slug?: string; placeId?: string },\n): string {\n\tconst path = base.replace(/\\/$/, \"\");\n\tconst joiner = path.includes(\"?\") ? \"&\" : \"?\";\n\tif (params.placeId?.trim()) {\n\t\treturn `${path}${joiner}placeId=${encodeURIComponent(params.placeId.trim())}`;\n\t}\n\tif (params.slug?.trim()) {\n\t\treturn `${path}${joiner}slug=${encodeURIComponent(params.slug.trim())}`;\n\t}\n\treturn path;\n}\n\nfunction isSuccessPayload(data: unknown): data is CachedGoogleReviewsResponse {\n\tif (!data || typeof data !== \"object\") return false;\n\tconst o = data as Record<string, unknown>;\n\treturn (\n\t\ttypeof o.businessName === \"string\" &&\n\t\ttypeof o.placeUrl === \"string\" &&\n\t\tArray.isArray(o.reviews) &&\n\t\ttypeof o.fetchedAt === \"string\" &&\n\t\ttypeof o.source === \"string\"\n\t);\n}\n\n/**\n * Loads reviews from your backend (`/api/google-reviews` by default). The server\n * should return cacheable JSON (e.g. Cache-Control at the CDN).\n */\nexport default function GoogleReviewsCarouselCached({\n\tslug,\n\tplaceId,\n\treviewsApiPath = \"/api/google-reviews\",\n\tlocale = \"de\",\n\t...carouselRest\n}: GoogleReviewsCarouselCachedProps) {\n\tconst [data, setData] = useState<CachedGoogleReviewsResponse | null>(null);\n\tconst [error, setError] = useState<string | null>(null);\n\tconst [loading, setLoading] = useState(true);\n\n\tuseEffect(() => {\n\t\tlet cancelled = false;\n\t\tconst url = buildReviewsUrl(reviewsApiPath, { slug, placeId });\n\n\t\t(async () => {\n\t\t\tsetLoading(true);\n\t\t\tsetError(null);\n\t\t\tif (!slug?.trim() && !placeId?.trim()) {\n\t\t\t\tif (!cancelled) {\n\t\t\t\t\tsetError(\n\t\t\t\t\t\tlocale === \"de\"\n\t\t\t\t\t\t\t? \"slug oder placeId ist erforderlich.\"\n\t\t\t\t\t\t\t: \"Either slug or placeId is required.\",\n\t\t\t\t\t);\n\t\t\t\t\tsetData(null);\n\t\t\t\t\tsetLoading(false);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tconst res = await fetch(url);\n\t\t\t\tconst json: unknown = await res.json().catch(() => null);\n\t\t\t\tif (cancelled) return;\n\t\t\t\tif (!res.ok) {\n\t\t\t\t\tconst msg =\n\t\t\t\t\t\tjson &&\n\t\t\t\t\t\ttypeof json === \"object\" &&\n\t\t\t\t\t\t\"error\" in json &&\n\t\t\t\t\t\ttypeof (json as { error: unknown }).error === \"string\"\n\t\t\t\t\t\t\t? (json as { error: string }).error\n\t\t\t\t\t\t\t: res.statusText;\n\t\t\t\t\tsetError(msg);\n\t\t\t\t\tsetData(null);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (!isSuccessPayload(json)) {\n\t\t\t\t\tsetError(\n\t\t\t\t\t\tlocale === \"de\"\n\t\t\t\t\t\t\t? \"Ungültige Antwort vom Server.\"\n\t\t\t\t\t\t\t: \"Invalid server response.\",\n\t\t\t\t\t);\n\t\t\t\t\tsetData(null);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tsetData(json);\n\t\t\t} catch {\n\t\t\t\tif (!cancelled) {\n\t\t\t\t\tsetError(\n\t\t\t\t\t\tlocale === \"de\"\n\t\t\t\t\t\t\t? \"Bewertungen konnten nicht geladen werden.\"\n\t\t\t\t\t\t\t: \"Could not load reviews.\",\n\t\t\t\t\t);\n\t\t\t\t\tsetData(null);\n\t\t\t\t}\n\t\t\t} finally {\n\t\t\t\tif (!cancelled) setLoading(false);\n\t\t\t}\n\t\t})();\n\n\t\treturn () => {\n\t\t\tcancelled = true;\n\t\t};\n\t}, [slug, placeId, reviewsApiPath, locale]);\n\n\tif (loading) {\n\t\treturn (\n\t\t\t<div\n\t\t\t\tclassName=\"mx-auto flex w-full max-w-2xl justify-center py-16 text-muted-foreground\"\n\t\t\t\trole=\"status\"\n\t\t\t\taria-live=\"polite\"\n\t\t\t>\n\t\t\t\t<Loader2 className=\"h-8 w-8 animate-spin\" aria-hidden />\n\t\t\t</div>\n\t\t);\n\t}\n\n\tif (error || !data) {\n\t\treturn (\n\t\t\t<p\n\t\t\t\tclassName=\"mx-auto max-w-2xl text-center text-sm text-muted-foreground\"\n\t\t\t\trole=\"alert\"\n\t\t\t>\n\t\t\t\t{error ??\n\t\t\t\t\t(locale === \"de\"\n\t\t\t\t\t\t? \"Keine Bewertungen verfügbar.\"\n\t\t\t\t\t\t: \"No reviews available.\")}\n\t\t\t</p>\n\t\t);\n\t}\n\n\tif (data.reviews.length === 0) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<GoogleReviewsCarousel\n\t\t\treviews={data.reviews}\n\t\t\tbusinessName={data.businessName}\n\t\t\tplaceUrl={data.placeUrl}\n\t\t\taggregateRating={data.aggregateRating}\n\t\t\ttotalReviewCount={data.totalReviewCount}\n\t\t\tlocale={locale}\n\t\t\t{...carouselRest}\n\t\t/>\n\t);\n}\n"],"mappings":";AAAA,SAAS,aAAa,cAAc,cAAc,YAAY;AAE9D,SAAS,aAAa,WAAW,gBAAgB;;;ACFjD,SAA0B,YAAY;AACtC,SAAS,eAAe;AAEjB,SAAS,MAAM,QAAsB;AAC3C,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC5B;;;ADgII,SA6LC,UA7LD,KAgBF,YAhBE;AAjGJ,IAAM,aAYF;AAAA,EACH,IAAI;AAAA,IACH,SAAS;AAAA,IACT,aAAa,CAAC,MAAM,IAAI,CAAC,IAAI,MAAM,IAAI,cAAc,aAAa;AAAA,IAClE,UAAU;AAAA,IACV,UAAU;AAAA,IACV,iBAAiB;AAAA,IACjB,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,YAAY,CAAC,MAAM,gBAAgB,CAAC;AAAA,EACrC;AAAA,EACA,IAAI;AAAA,IACH,SAAS;AAAA,IACT,aAAa,CAAC,MAAM,IAAI,CAAC,IAAI,MAAM,IAAI,WAAW,SAAS;AAAA,IAC3D,U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