@kern-di/trust-carousel 0.1.0 → 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.ts CHANGED
@@ -5,17 +5,51 @@ interface GoogleReview {
5
5
  rating: number;
6
6
  date: string;
7
7
  text: string;
8
+ /** HTTPS is enforced; broken or blocked URLs fall back to initials (e.g. some Google CDN responses). */
8
9
  photoUrl?: string;
9
10
  }
11
+ type GoogleReviewsCarouselLocale = "de" | "en";
10
12
  interface GoogleReviewsCarouselProps {
11
13
  reviews: GoogleReview[];
12
14
  businessName: string;
13
15
  placeUrl: string;
16
+ /**
17
+ * Official overall rating from Google Places (all reviews). When omitted, the
18
+ * header averages the `reviews` array — wrong if you only have a Places API
19
+ * sample (max ~5 reviews).
20
+ */
21
+ aggregateRating?: number;
22
+ /** Official total review count from Google Places. When omitted, uses `reviews.length`. */
23
+ totalReviewCount?: number;
24
+ /** UI copy. Default `de` matches KERN Handwerk sites. */
25
+ locale?: GoogleReviewsCarouselLocale;
14
26
  accentColor?: string;
15
27
  autoPlay?: boolean;
16
28
  autoPlaySpeed?: number;
17
29
  }
18
30
  declare const SAMPLE_REVIEWS: GoogleReview[];
19
- declare function GoogleReviewsCarousel({ reviews, businessName, placeUrl, autoPlay, autoPlaySpeed, }: GoogleReviewsCarouselProps): react_jsx_runtime.JSX.Element;
31
+ declare function GoogleReviewsCarousel({ reviews, businessName, placeUrl, aggregateRating: aggregateRatingProp, totalReviewCount: totalReviewCountProp, locale, autoPlay, autoPlaySpeed, }: GoogleReviewsCarouselProps): react_jsx_runtime.JSX.Element;
20
32
 
21
- export { type GoogleReview, GoogleReviewsCarousel, type GoogleReviewsCarouselProps, SAMPLE_REVIEWS };
33
+ /** JSON body from `GET /api/google-reviews?slug=…` (website serverless handler). */
34
+ type CachedGoogleReviewsResponse = {
35
+ businessName: string;
36
+ placeUrl: string;
37
+ reviews: GoogleReview[];
38
+ fetchedAt: string;
39
+ source: "cache" | "refreshed" | "stale_fallback" | "stale_no_api_key";
40
+ /** Google Places overall rating (all reviews); omit if unknown. */
41
+ aggregateRating?: number;
42
+ totalReviewCount?: number;
43
+ };
44
+ type GoogleReviewsCarouselCachedProps = Omit<GoogleReviewsCarouselProps, "reviews" | "businessName" | "placeUrl"> & {
45
+ slug: string;
46
+ /** Base path or absolute URL; `?slug=` is appended. Default: `/api/google-reviews` */
47
+ reviewsApiPath?: string;
48
+ };
49
+ /**
50
+ * Loads reviews via your backend (Supabase cache + monthly Google Places refresh),
51
+ * then renders {@link GoogleReviewsCarousel}.
52
+ */
53
+ declare function GoogleReviewsCarouselCached({ slug, reviewsApiPath, locale, ...carouselRest }: GoogleReviewsCarouselCachedProps): react_jsx_runtime.JSX.Element;
54
+
55
+ export { type CachedGoogleReviewsResponse, type GoogleReview, GoogleReviewsCarousel, GoogleReviewsCarouselCached, type GoogleReviewsCarouselCachedProps, type GoogleReviewsCarouselLocale, type GoogleReviewsCarouselProps, SAMPLE_REVIEWS };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // src/components/GoogleReviewsCarousel.tsx
2
- import { useState, useEffect, useCallback } from "react";
3
- import { ChevronLeft, ChevronRight, Star, ExternalLink } from "lucide-react";
2
+ import { ChevronLeft, ChevronRight, ExternalLink, Star } from "lucide-react";
3
+ import { useCallback, useEffect, useState } from "react";
4
4
 
5
5
  // src/lib/cn.ts
6
6
  import { clsx } from "clsx";
@@ -11,18 +11,42 @@ function cn(...inputs) {
11
11
 
12
12
  // src/components/GoogleReviewsCarousel.tsx
13
13
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
14
+ var UI_STRINGS = {
15
+ de: {
16
+ eyebrow: "Google-Bewertungen",
17
+ reviewCount: (n) => `(${n} ${n === 1 ? "Bewertung" : "Bewertungen"})`,
18
+ readMore: "Mehr anzeigen",
19
+ showLess: "Weniger anzeigen",
20
+ readAllOnGoogle: "Alle Bewertungen bei Google",
21
+ prevReview: "Vorherige Bewertung",
22
+ nextReview: "N\xE4chste Bewertung",
23
+ goToReview: (i) => `Zu Bewertung ${i}`
24
+ },
25
+ en: {
26
+ eyebrow: "Google reviews",
27
+ reviewCount: (n) => `(${n} ${n === 1 ? "review" : "reviews"})`,
28
+ readMore: "Read more",
29
+ showLess: "Show less",
30
+ readAllOnGoogle: "Read all reviews on Google",
31
+ prevReview: "Previous review",
32
+ nextReview: "Next review",
33
+ goToReview: (i) => `Go to review ${i}`
34
+ }
35
+ };
14
36
  var SAMPLE_REVIEWS = [
15
37
  {
16
38
  author: "Sarah Mitchell",
17
39
  rating: 5,
18
40
  date: "2 weeks ago",
19
- text: "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 \u2014 no hidden charges. Highly recommend to anyone needing reliable plumbing work."
41
+ text: "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 \u2014 no hidden charges. Highly recommend to anyone needing reliable plumbing work.",
42
+ photoUrl: "https://i.pravatar.cc/128?img=47"
20
43
  },
21
44
  {
22
45
  author: "James Thornton",
23
46
  rating: 5,
24
47
  date: "1 month ago",
25
- text: "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."
48
+ text: "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.",
49
+ photoUrl: "https://i.pravatar.cc/128?img=12"
26
50
  },
27
51
  {
28
52
  author: "Maria Chen",
@@ -53,6 +77,13 @@ var AVATAR_COLORS = [
53
77
  function getInitial(name) {
54
78
  return name.charAt(0).toUpperCase();
55
79
  }
80
+ function normalizeProfilePhotoUrl(url) {
81
+ if (!url?.trim()) return void 0;
82
+ let u = url.trim();
83
+ if (u.startsWith("//")) u = `https:${u}`;
84
+ else if (/^http:\/\//i.test(u)) u = `https://${u.slice(7)}`;
85
+ return u;
86
+ }
56
87
  function StarRating({ rating, size = 16 }) {
57
88
  return /* @__PURE__ */ jsx("span", { className: "inline-flex gap-0.5", children: Array.from({ length: 5 }).map((_, i) => /* @__PURE__ */ jsx(
58
89
  Star,
@@ -64,32 +95,86 @@ function StarRating({ rating, size = 16 }) {
64
95
  )) });
65
96
  }
66
97
  function GoogleLogo({ className }) {
67
- return /* @__PURE__ */ jsxs("svg", { className, viewBox: "0 0 272 92", xmlns: "http://www.w3.org/2000/svg", children: [
68
- /* @__PURE__ */ jsx("path", { d: "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", fill: "#EA4335" }),
69
- /* @__PURE__ */ jsx("path", { d: "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", fill: "#FBBC05" }),
70
- /* @__PURE__ */ jsx("path", { d: "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", fill: "#4285F4" }),
71
- /* @__PURE__ */ jsx("path", { d: "M225 3v65h-9.5V3h9.5z", fill: "#34A853" }),
72
- /* @__PURE__ */ jsx("path", { d: "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", fill: "#EA4335" }),
73
- /* @__PURE__ */ jsx("path", { d: "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", fill: "#4285F4" })
74
- ] });
98
+ return /* @__PURE__ */ jsxs(
99
+ "svg",
100
+ {
101
+ className,
102
+ viewBox: "0 0 272 92",
103
+ xmlns: "http://www.w3.org/2000/svg",
104
+ children: [
105
+ /* @__PURE__ */ jsx(
106
+ "path",
107
+ {
108
+ d: "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",
109
+ fill: "#EA4335"
110
+ }
111
+ ),
112
+ /* @__PURE__ */ jsx(
113
+ "path",
114
+ {
115
+ d: "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",
116
+ fill: "#FBBC05"
117
+ }
118
+ ),
119
+ /* @__PURE__ */ jsx(
120
+ "path",
121
+ {
122
+ d: "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",
123
+ fill: "#4285F4"
124
+ }
125
+ ),
126
+ /* @__PURE__ */ jsx("path", { d: "M225 3v65h-9.5V3h9.5z", fill: "#34A853" }),
127
+ /* @__PURE__ */ jsx(
128
+ "path",
129
+ {
130
+ d: "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",
131
+ fill: "#EA4335"
132
+ }
133
+ ),
134
+ /* @__PURE__ */ jsx(
135
+ "path",
136
+ {
137
+ d: "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",
138
+ fill: "#4285F4"
139
+ }
140
+ )
141
+ ]
142
+ }
143
+ );
75
144
  }
76
- function ReviewCard({ review, index }) {
145
+ function ReviewCard({
146
+ review,
147
+ index,
148
+ labels
149
+ }) {
77
150
  const [expanded, setExpanded] = useState(false);
151
+ const [imgFailed, setImgFailed] = useState(false);
78
152
  const shouldTruncate = review.text.length > 150;
153
+ const photoSrc = normalizeProfilePhotoUrl(review.photoUrl);
154
+ useEffect(() => {
155
+ setImgFailed(false);
156
+ }, [photoSrc]);
157
+ const showPhoto = Boolean(photoSrc) && !imgFailed;
79
158
  return /* @__PURE__ */ jsxs("div", { className: "flex h-full flex-col rounded-lg border bg-card p-5 shadow-sm", children: [
80
159
  /* @__PURE__ */ jsxs("div", { className: "mb-3 flex items-center gap-3", children: [
81
- review.photoUrl ? /* @__PURE__ */ jsx(
160
+ showPhoto ? /* @__PURE__ */ jsx(
82
161
  "img",
83
162
  {
84
- src: review.photoUrl,
85
- alt: review.author,
86
- className: "h-10 w-10 rounded-full object-cover"
163
+ src: photoSrc,
164
+ alt: "",
165
+ className: "h-10 w-10 rounded-full object-cover",
166
+ loading: "lazy",
167
+ decoding: "async",
168
+ onError: () => setImgFailed(true)
87
169
  }
88
170
  ) : /* @__PURE__ */ jsx(
89
171
  "div",
90
172
  {
91
173
  className: "flex h-10 w-10 items-center justify-center rounded-full text-sm font-semibold text-white",
92
- style: { backgroundColor: AVATAR_COLORS[index % AVATAR_COLORS.length] },
174
+ style: {
175
+ backgroundColor: AVATAR_COLORS[index % AVATAR_COLORS.length]
176
+ },
177
+ "aria-hidden": true,
93
178
  children: getInitial(review.author)
94
179
  }
95
180
  ),
@@ -108,7 +193,7 @@ function ReviewCard({ review, index }) {
108
193
  className: cn(
109
194
  "mt-1 inline-flex h-auto self-start p-0 text-xs font-medium text-primary underline-offset-4 hover:underline"
110
195
  ),
111
- children: expanded ? "Show less" : "Read more"
196
+ children: expanded ? labels.showLess : labels.readMore
112
197
  }
113
198
  )
114
199
  ] });
@@ -117,21 +202,31 @@ function GoogleReviewsCarousel({
117
202
  reviews,
118
203
  businessName,
119
204
  placeUrl,
205
+ aggregateRating: aggregateRatingProp,
206
+ totalReviewCount: totalReviewCountProp,
207
+ locale = "de",
120
208
  autoPlay = true,
121
209
  autoPlaySpeed = 5e3
122
210
  }) {
211
+ const labels = UI_STRINGS[locale];
123
212
  const [current, setCurrent] = useState(0);
124
213
  const [paused, setPaused] = useState(false);
125
214
  const total = reviews.length;
126
215
  const next = useCallback(() => setCurrent((c) => (c + 1) % total), [total]);
127
- const prev = useCallback(() => setCurrent((c) => (c - 1 + total) % total), [total]);
216
+ const prev = useCallback(
217
+ () => setCurrent((c) => (c - 1 + total) % total),
218
+ [total]
219
+ );
128
220
  useEffect(() => {
129
221
  if (!autoPlay || paused || total <= 1) return;
130
222
  const id = setInterval(next, autoPlaySpeed);
131
223
  return () => clearInterval(id);
132
224
  }, [autoPlay, autoPlaySpeed, paused, next, total]);
133
225
  if (total === 0) return null;
134
- const avgRating = (reviews.reduce((s, r) => s + r.rating, 0) / total).toFixed(1);
226
+ const summaryCount = totalReviewCountProp ?? total;
227
+ const meanFromSample = total > 0 ? reviews.reduce((s, r) => s + r.rating, 0) / total : 0;
228
+ const summaryRating = aggregateRatingProp ?? meanFromSample;
229
+ const ratingLabel = summaryRating.toFixed(1);
135
230
  return /* @__PURE__ */ jsxs(
136
231
  "section",
137
232
  {
@@ -141,18 +236,12 @@ function GoogleReviewsCarousel({
141
236
  children: [
142
237
  /* @__PURE__ */ jsxs("div", { className: "mb-6 flex flex-col items-center gap-2 text-center", children: [
143
238
  /* @__PURE__ */ jsx(GoogleLogo, { className: "h-7" }),
144
- /* @__PURE__ */ jsxs("h3", { className: "text-lg font-semibold text-foreground", children: [
145
- businessName,
146
- " Reviews"
147
- ] }),
239
+ /* @__PURE__ */ jsx("p", { className: "text-xs font-medium uppercase tracking-widest text-muted-foreground", children: labels.eyebrow }),
240
+ /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-foreground", children: businessName }),
148
241
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
149
- /* @__PURE__ */ jsx("span", { className: "text-2xl font-bold text-foreground", children: avgRating }),
150
- /* @__PURE__ */ jsx(StarRating, { rating: Math.round(Number(avgRating)), size: 20 }),
151
- /* @__PURE__ */ jsxs("span", { className: "text-sm text-muted-foreground", children: [
152
- "(",
153
- total,
154
- " reviews)"
155
- ] })
242
+ /* @__PURE__ */ jsx("span", { className: "text-2xl font-bold text-foreground", children: ratingLabel }),
243
+ /* @__PURE__ */ jsx(StarRating, { rating: Math.round(summaryRating), size: 20 }),
244
+ /* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground", children: labels.reviewCount(summaryCount) })
156
245
  ] })
157
246
  ] }),
158
247
  /* @__PURE__ */ jsxs("div", { className: "relative", children: [
@@ -165,7 +254,7 @@ function GoogleReviewsCarousel({
165
254
  "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"
166
255
  ),
167
256
  onClick: prev,
168
- "aria-label": "Previous review",
257
+ "aria-label": labels.prevReview,
169
258
  children: /* @__PURE__ */ jsx(ChevronLeft, { className: "h-4 w-4" })
170
259
  }
171
260
  ),
@@ -177,7 +266,7 @@ function GoogleReviewsCarousel({
177
266
  "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"
178
267
  ),
179
268
  onClick: next,
180
- "aria-label": "Next review",
269
+ "aria-label": labels.nextReview,
181
270
  children: /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4" })
182
271
  }
183
272
  )
@@ -187,7 +276,7 @@ function GoogleReviewsCarousel({
187
276
  {
188
277
  className: "flex transition-transform duration-500 ease-in-out",
189
278
  style: { transform: `translateX(-${current * 100}%)` },
190
- children: reviews.map((review, i) => /* @__PURE__ */ jsx("div", { className: "w-full flex-shrink-0 px-1", children: /* @__PURE__ */ jsx(ReviewCard, { review, index: i }) }, i))
279
+ children: reviews.map((review, i) => /* @__PURE__ */ jsx("div", { className: "w-full flex-shrink-0 px-1", children: /* @__PURE__ */ jsx(ReviewCard, { review, index: i, labels }) }, i))
191
280
  }
192
281
  ) }),
193
282
  total > 1 && /* @__PURE__ */ jsx("div", { className: "mt-4 flex justify-center gap-2", children: reviews.map((_, i) => /* @__PURE__ */ jsx(
@@ -195,7 +284,7 @@ function GoogleReviewsCarousel({
195
284
  {
196
285
  type: "button",
197
286
  onClick: () => setCurrent(i),
198
- "aria-label": `Go to review ${i + 1}`,
287
+ "aria-label": labels.goToReview(i + 1),
199
288
  className: cn(
200
289
  "h-2 w-2 rounded-full transition-all",
201
290
  i === current ? "w-6 bg-primary" : "bg-muted-foreground/30 hover:bg-muted-foreground/50"
@@ -214,7 +303,7 @@ function GoogleReviewsCarousel({
214
303
  "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"
215
304
  ),
216
305
  children: [
217
- "Read all reviews on Google",
306
+ labels.readAllOnGoogle,
218
307
  /* @__PURE__ */ jsx(ExternalLink, { className: "ml-1 h-3.5 w-3.5 shrink-0" })
219
308
  ]
220
309
  }
@@ -223,8 +312,109 @@ function GoogleReviewsCarousel({
223
312
  }
224
313
  );
225
314
  }
315
+
316
+ // src/components/GoogleReviewsCarouselCached.tsx
317
+ import { Loader2 } from "lucide-react";
318
+ import { useEffect as useEffect2, useState as useState2 } from "react";
319
+ import { jsx as jsx2 } from "react/jsx-runtime";
320
+ function buildReviewsUrl(base, slug) {
321
+ const path = base.replace(/\/$/, "");
322
+ const joiner = path.includes("?") ? "&" : "?";
323
+ return `${path}${joiner}slug=${encodeURIComponent(slug)}`;
324
+ }
325
+ function isSuccessPayload(data) {
326
+ if (!data || typeof data !== "object") return false;
327
+ const o = data;
328
+ return typeof o.businessName === "string" && typeof o.placeUrl === "string" && Array.isArray(o.reviews) && typeof o.fetchedAt === "string" && typeof o.source === "string";
329
+ }
330
+ function GoogleReviewsCarouselCached({
331
+ slug,
332
+ reviewsApiPath = "/api/google-reviews",
333
+ locale = "de",
334
+ ...carouselRest
335
+ }) {
336
+ const [data, setData] = useState2(null);
337
+ const [error, setError] = useState2(null);
338
+ const [loading, setLoading] = useState2(true);
339
+ useEffect2(() => {
340
+ let cancelled = false;
341
+ const url = buildReviewsUrl(reviewsApiPath, slug);
342
+ (async () => {
343
+ setLoading(true);
344
+ setError(null);
345
+ try {
346
+ const res = await fetch(url);
347
+ const json = await res.json().catch(() => null);
348
+ if (cancelled) return;
349
+ if (!res.ok) {
350
+ const msg = json && typeof json === "object" && "error" in json && typeof json.error === "string" ? json.error : res.statusText;
351
+ setError(msg);
352
+ setData(null);
353
+ return;
354
+ }
355
+ if (!isSuccessPayload(json)) {
356
+ setError(
357
+ locale === "de" ? "Ung\xFCltige Antwort vom Server." : "Invalid server response."
358
+ );
359
+ setData(null);
360
+ return;
361
+ }
362
+ setData(json);
363
+ } catch {
364
+ if (!cancelled) {
365
+ setError(
366
+ locale === "de" ? "Bewertungen konnten nicht geladen werden." : "Could not load reviews."
367
+ );
368
+ setData(null);
369
+ }
370
+ } finally {
371
+ if (!cancelled) setLoading(false);
372
+ }
373
+ })();
374
+ return () => {
375
+ cancelled = true;
376
+ };
377
+ }, [slug, reviewsApiPath, locale]);
378
+ if (loading) {
379
+ return /* @__PURE__ */ jsx2(
380
+ "div",
381
+ {
382
+ className: "mx-auto flex w-full max-w-2xl justify-center py-16 text-muted-foreground",
383
+ role: "status",
384
+ "aria-live": "polite",
385
+ children: /* @__PURE__ */ jsx2(Loader2, { className: "h-8 w-8 animate-spin", "aria-hidden": true })
386
+ }
387
+ );
388
+ }
389
+ if (error || !data) {
390
+ return /* @__PURE__ */ jsx2(
391
+ "p",
392
+ {
393
+ className: "mx-auto max-w-2xl text-center text-sm text-muted-foreground",
394
+ role: "alert",
395
+ children: error ?? (locale === "de" ? "Keine Bewertungen verf\xFCgbar." : "No reviews available.")
396
+ }
397
+ );
398
+ }
399
+ if (data.reviews.length === 0) {
400
+ return null;
401
+ }
402
+ return /* @__PURE__ */ jsx2(
403
+ GoogleReviewsCarousel,
404
+ {
405
+ reviews: data.reviews,
406
+ businessName: data.businessName,
407
+ placeUrl: data.placeUrl,
408
+ aggregateRating: data.aggregateRating,
409
+ totalReviewCount: data.totalReviewCount,
410
+ locale,
411
+ ...carouselRest
412
+ }
413
+ );
414
+ }
226
415
  export {
227
416
  GoogleReviewsCarousel,
417
+ GoogleReviewsCarouselCached,
228
418
  SAMPLE_REVIEWS
229
419
  };
230
420
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/GoogleReviewsCarousel.tsx","../src/lib/cn.ts"],"sourcesContent":["import * as React from \"react\";\nimport { useState, useEffect, useCallback } from \"react\";\nimport { ChevronLeft, ChevronRight, Star, ExternalLink } from \"lucide-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\tphotoUrl?: string;\n}\n\nexport interface GoogleReviewsCarouselProps {\n\treviews: GoogleReview[];\n\tbusinessName: string;\n\tplaceUrl: string;\n\taccentColor?: string;\n\tautoPlay?: boolean;\n\tautoPlaySpeed?: number;\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},\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},\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\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={i < rating ? \"fill-amber-400 text-amber-400\" : \"text-muted-foreground/30\"}\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 className={className} viewBox=\"0 0 272 92\" xmlns=\"http://www.w3.org/2000/svg\">\n\t\t\t<path d=\"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\" fill=\"#EA4335\"/>\n\t\t\t<path d=\"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\" fill=\"#FBBC05\"/>\n\t\t\t<path d=\"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\" fill=\"#4285F4\"/>\n\t\t\t<path d=\"M225 3v65h-9.5V3h9.5z\" fill=\"#34A853\"/>\n\t\t\t<path d=\"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\" fill=\"#EA4335\"/>\n\t\t\t<path d=\"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\" fill=\"#4285F4\"/>\n\t\t</svg>\n\t);\n}\n\n// ---------- Review Card ----------\nfunction ReviewCard({ review, index }: { review: GoogleReview; index: number }) {\n\tconst [expanded, setExpanded] = useState(false);\n\tconst shouldTruncate = review.text.length > 150;\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{review.photoUrl ? (\n\t\t\t\t\t<img\n\t\t\t\t\t\tsrc={review.photoUrl}\n\t\t\t\t\t\talt={review.author}\n\t\t\t\t\t\tclassName=\"h-10 w-10 rounded-full object-cover\"\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={{ backgroundColor: AVATAR_COLORS[index % AVATAR_COLORS.length] }}\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\">{review.author}</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 ? review.text.slice(0, 150) + \"…\" : 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 ? \"Show less\" : \"Read more\"}\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\tautoPlay = true,\n\tautoPlaySpeed = 5000,\n}: GoogleReviewsCarouselProps) {\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(() => setCurrent((c) => (c - 1 + total) % total), [total]);\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 avgRating = (reviews.reduce((s, r) => s + r.rating, 0) / total).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<h3 className=\"text-lg font-semibold text-foreground\">\n\t\t\t\t\t{businessName} Reviews\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\">{avgRating}</span>\n\t\t\t\t\t<StarRating rating={Math.round(Number(avgRating))} size={20} />\n\t\t\t\t\t<span className=\"text-sm text-muted-foreground\">({total} reviews)</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=\"Previous review\"\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=\"Next review\"\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} />\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={`Go to review ${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\tRead all reviews on Google\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"],"mappings":";AACA,SAAS,UAAU,WAAW,mBAAmB;AACjD,SAAS,aAAa,cAAc,MAAM,oBAAoB;;;ACF9D,SAA0B,YAAY;AACtC,SAAS,eAAe;AAEjB,SAAS,MAAM,QAAsB;AAC3C,SAAO,QAAQ,KAA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}
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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Z;AAAA,QACD;AACA,YAAI,CAAC,iBAAiB,IAAI,GAAG;AAC5B;AAAA,YACC,WAAW,OACR,qCACA;AAAA,UACJ;AACA,kBAAQ,IAAI;AACZ;AAAA,QACD;AACA,gBAAQ,IAAI;AAAA,MACb,QAAQ;AACP,YAAI,CAAC,WAAW;AACf;AAAA,YACC,WAAW,OACR,8CACA;AAAA,UACJ;AACA,kBAAQ,IAAI;AAAA,QACb;AAAA,MACD,UAAE;AACD,YAAI,CAAC,UAAW,YAAW,KAAK;AAAA,MACjC;AAAA,IACD,GAAG;AAEH,WAAO,MAAM;AACZ,kBAAY;AAAA,IACb;AAAA,EACD,GAAG,CAAC,MAAM,gBAAgB,MAAM,CAAC;AAEjC,MAAI,SAAS;AACZ,WACC,gBAAAF;AAAA,MAAC;AAAA;AAAA,QACA,WAAU;AAAA,QACV,MAAK;AAAA,QACL,aAAU;AAAA,QAEV,0BAAAA,KAAC,WAAQ,WAAU,wBAAuB,eAAW,MAAC;AAAA;AAAA,IACvD;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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kern-di/trust-carousel",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Drop-in Google Reviews carousel component for embedding social proof on any site",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",