create-cartbase 0.1.19 → 0.1.20
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/package.json
CHANGED
|
@@ -1297,10 +1297,17 @@ parameterized with `{n}`/`{pct}`/`{name}`/`{mb}`/`{s}`/`{email}` slots
|
|
|
1297
1297
|
|
|
1298
1298
|
### `<ReviewWidget client productId initialData? />` — the PDP section
|
|
1299
1299
|
|
|
1300
|
-
- **Purpose
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1300
|
+
- **Purpose**: the product page's review grid (Loox's Reviews Widget): a
|
|
1301
|
+
header, the review cards (photo reviews first), "Show more reviews",
|
|
1302
|
+
and the lightbox a card opens. The header is one of Loox's three
|
|
1303
|
+
(`ReviewSummaryHeader`): `minimal`, the stars and one fact (the count,
|
|
1304
|
+
the average or nothing) with the breakdown under a chevron; `compact`,
|
|
1305
|
+
the average, the stars and the count on one line; `expanded`, the
|
|
1306
|
+
section title, the big score and the breakdown open beside it. The sort
|
|
1307
|
+
menu (`ReviewSortMenu`, an icon with "Sort by" under it) sits on the
|
|
1308
|
+
right. Renders null at zero reviews (production rule); derives
|
|
1309
|
+
avg/distribution from the loaded page if the aggregate is missing
|
|
1310
|
+
(never a misleading "0.0").
|
|
1304
1311
|
- **SDK calls** — bootstrap: `getWidget(client, productId)` (ONE call:
|
|
1305
1312
|
aggregate + first page per the store's display options; edge-cached
|
|
1306
1313
|
60s) — server-fetch it and pass `initialData` (recommended), else the
|
|
@@ -1309,9 +1316,13 @@ parameterized with `{n}`/`{pct}`/`{name}`/`{mb}`/`{s}`/`{email}` slots
|
|
|
1309
1316
|
- **Mount rules** — client component, PDP below the fold; `id="reviews"`
|
|
1310
1317
|
anchor built in. Verified badge is unconditional (every review is
|
|
1311
1318
|
token-minted — a system tautology, not a flag).
|
|
1312
|
-
- **Settings
|
|
1313
|
-
|
|
1314
|
-
|
|
1319
|
+
- **Settings**: admin, Reviews, Widgets: the header and what the minimal
|
|
1320
|
+
one shows, masonry or list, reviews per page, photo reviews first, and
|
|
1321
|
+
the rating breakdown, the sort menu and the card date, each of which can
|
|
1322
|
+
be switched off. They arrive in `getWidget().options`;
|
|
1323
|
+
`reviewWidgetOptions(options)` fills what an older platform leaves out
|
|
1324
|
+
with Loox's defaults (minimal header with the count, everything shown).
|
|
1325
|
+
Moderation decides visibility.
|
|
1315
1326
|
- Pieces exported for custom layouts: `<StarRow>` (`size="lg"` is the
|
|
1316
1327
|
lightbox's row), `<StarBadge>`, `<RatingDistribution>` (`star-badge`),
|
|
1317
1328
|
`<ReviewList>` (the presentational cards; a click on a card opens it in
|
|
@@ -94,15 +94,30 @@ curl -sf "$BASE/api/store/reviews/aggregate?product_id=prod_01tst000000000000000
|
|
|
94
94
|
"reviews": [ /* PublicReview[] — first page */ ],
|
|
95
95
|
"count": 3,
|
|
96
96
|
"has_more": false,
|
|
97
|
-
"options": {
|
|
97
|
+
"options": {
|
|
98
|
+
"layout": "masonry", // or "list"
|
|
99
|
+
"page_size": 6,
|
|
100
|
+
"photo_first": true,
|
|
101
|
+
"header": "minimal", // "minimal" | "compact" | "expanded"
|
|
102
|
+
"header_content": "count", // the minimal header: "count" | "average" | "stars"
|
|
103
|
+
"show_distribution": true, // the 5 to 1 star breakdown
|
|
104
|
+
"show_sort": true, // the shopper's sort menu
|
|
105
|
+
"show_date": true // the date on each card
|
|
106
|
+
}
|
|
98
107
|
}
|
|
99
108
|
```
|
|
100
109
|
|
|
101
110
|
- **Errors**: `400 validation_failed`.
|
|
102
111
|
- **SDK**: `reviews.getWidget(client, productId)`
|
|
103
|
-
- **Components**: the review widget (masonry/list
|
|
104
|
-
|
|
105
|
-
|
|
112
|
+
- **Components**: the review widget (header, masonry/list, Show more, the
|
|
113
|
+
lightbox) + star badge.
|
|
114
|
+
- **Settings**: admin, Reviews, Widgets: `widget_header`,
|
|
115
|
+
`widget_header_content`, `widget_layout`, `widget_page_size`,
|
|
116
|
+
`widget_photo_first`, `widget_show_distribution`, `widget_show_sort`,
|
|
117
|
+
`widget_show_date`. The three headers are Loox's: `minimal` is the stars
|
|
118
|
+
and one fact (`header_content`) with the breakdown under a chevron,
|
|
119
|
+
`compact` the average, the stars and the count on one line, `expanded`
|
|
120
|
+
the big score with the breakdown open beside it.
|
|
106
121
|
|
|
107
122
|
```bash
|
|
108
123
|
BODY=$(curl -sf "$BASE/api/store/reviews/widget?product_id=prod_01tst00000000000000000001" \
|