@reblu/site-blocks 0.31.0 → 0.32.0
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/CHANGELOG.md +12 -0
- package/README.md +51 -0
- package/dist/index.cjs +508 -380
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +58 -2
- package/dist/index.d.ts +58 -2
- package/dist/index.js +508 -381
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @reblu/site-blocks
|
|
2
2
|
|
|
3
|
+
## 0.32.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 93143eb: Reviews (REB-1272). `@reblu/site-contracts` exports the `Review` and `ReviewSource` types of `GET /api/site/reviews`. `@reblu/site-client` adds `client.reviews.list({ pageId?, limit? }, cache?)`: the tenant's published reviews in the order set in nexus, optionally only one page's (404 without the tenant's `reviews` module). `@reblu/site-blocks` adds `Reviews`, a Server Component drop-in: a responsive grid with an accessible star rating, the author, the date, the text and a «Ver en <fuente>» link to the original (new tab, `rel="noopener nofollow"`), plus an optional tenant `notice` above or below the grid. Every existing export and namespace is unchanged.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [25a6af3]
|
|
12
|
+
- Updated dependencies [93143eb]
|
|
13
|
+
- @reblu/site-contracts@1.30.0
|
|
14
|
+
|
|
3
15
|
## 0.31.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -36,6 +36,7 @@ colour on the red background. See `docs/theming/theming.md`.
|
|
|
36
36
|
| `ProductTrustItems`, `DEFAULT_TRUST_ICONS` | `.` | Store-wide trust messages from `ShopConfig.productTrustItems`. Server Component. See "Product trust items" below. |
|
|
37
37
|
| `TrustBadges`, `DEFAULT_TRUST_BADGE_HEADINGS` | `.` | The tenant's trust badges from `client.trustBadges.list()`, grouped by type. Server Component. See "Trust badges" below. |
|
|
38
38
|
| `ArbitrationBadge` | `.` | The consumer-arbitration distinctive with its adhesion number, for the footer. Server Component. See "Consumer arbitration badge" below. |
|
|
39
|
+
| `Reviews` | `.` | The tenant's published, verifiable reviews from `client.reviews.list()`. Server Component. See "Reviews" below. |
|
|
39
40
|
| `buildFaqPageJsonLd`, `collectFaqItems` | `./seo` | schema.org `FAQPage` structured data. Directive-free (also on `.`). See "Page blocks" below. |
|
|
40
41
|
| `useCollection` | `./client` | Headless filterable/sortable/paginated collection hook (facets, category, tag, search). Serves both page and blog indexes. |
|
|
41
42
|
| `Collection` | `./client` | Token-driven presentational grid over `useCollection`. |
|
|
@@ -927,6 +928,56 @@ import { Truck } from 'my-icon-set'
|
|
|
927
928
|
`icons` cannot add a new icon key: an item whose `icon` this version does not
|
|
928
929
|
know is still skipped.
|
|
929
930
|
|
|
931
|
+
## Reviews
|
|
932
|
+
|
|
933
|
+
`Reviews` (REB-1272) renders the tenant's published reviews, managed in nexus
|
|
934
|
+
(«Reseñas») and served by `client.reviews.list()`: a responsive grid of cards
|
|
935
|
+
with the stars, the text, the author, the date and a «Ver en Google» link to
|
|
936
|
+
the original review. Publishing, hiding or reordering a review in nexus changes
|
|
937
|
+
the SITE on the next revalidation, with no deploy.
|
|
938
|
+
|
|
939
|
+
```tsx
|
|
940
|
+
import { Reviews } from '@reblu/site-blocks'
|
|
941
|
+
|
|
942
|
+
export async function HomeReviews() {
|
|
943
|
+
const { data: reviews } = await client.reviews
|
|
944
|
+
.list({ limit: 6 }, { revalidate: 3600 })
|
|
945
|
+
.catch(() => ({ data: [] }))
|
|
946
|
+
return (
|
|
947
|
+
<Reviews
|
|
948
|
+
reviews={reviews}
|
|
949
|
+
heading='Reseñas verificadas'
|
|
950
|
+
notice='Reseñas publicadas en Google y Doctoralia; cada una enlaza a su original.'
|
|
951
|
+
/>
|
|
952
|
+
)
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
// Only the reviews linked to one page (a treatment, a professional's profile):
|
|
956
|
+
const { data: pageReviews } = await client.reviews.list({ pageId: page.id })
|
|
957
|
+
```
|
|
958
|
+
|
|
959
|
+
- **Verifiable or not shown.** A review renders only with an `https://` link to
|
|
960
|
+
its original, a rating of 1 to 5 and an author; anything else is skipped.
|
|
961
|
+
The link opens in a new tab with `rel="noopener nofollow"` and a visually
|
|
962
|
+
hidden «(se abre en una pestaña nueva)» (`newWindowLabel`). Its text is
|
|
963
|
+
`linkLabel(sourceName)`, «Ver en Google» by default.
|
|
964
|
+
- **Notice.** `notice` is the tenant's short text on how its reviews are
|
|
965
|
+
checked. Spanish consumer law asks a business that shows reviews to say
|
|
966
|
+
whether and how it ensures they come from real customers; the exact wording
|
|
967
|
+
is the tenant's (pending legal review, REB-136). It goes below the grid, or
|
|
968
|
+
above it with `noticePosition='above'`.
|
|
969
|
+
- Stars are one `role="img"` labelled «5 de 5 estrellas». A star-only review
|
|
970
|
+
(`text: null`) renders without a quote. The date is the calendar day the
|
|
971
|
+
review was written, formatted in `locale` (default `es-ES`), never shifted
|
|
972
|
+
by the visitor's time zone.
|
|
973
|
+
- `null`, `undefined` or an empty list render nothing — no heading, no notice.
|
|
974
|
+
- `heading` wraps everything in a `<section aria-labelledby={headingId}>`
|
|
975
|
+
(default id `reviews-heading`, level `headingLevel`, default 2).
|
|
976
|
+
- Styling hooks: `className`, `cardClassName` (merge with `cn`);
|
|
977
|
+
`headingClassName`, `gridClassName` and `noticeClassName` follow the REB-997
|
|
978
|
+
slot rule and REPLACE their defaults (`text-xl font-semibold`,
|
|
979
|
+
`sm:grid-cols-2 lg:grid-cols-3`, `text-sm text-muted-foreground`).
|
|
980
|
+
|
|
930
981
|
## Trust badges
|
|
931
982
|
|
|
932
983
|
`TrustBadges` renders the tenant's trust badges — partners, insurers, funding,
|