@propeller-commerce/propeller-v2-react-ui 0.4.28 → 0.4.29
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 +13 -0
- package/dist/index.cjs +10 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +10 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,19 @@ once it reaches 1.0. Until then (the `0.x` line) the public API may change
|
|
|
8
8
|
between minor versions; breaking changes are called out below and in
|
|
9
9
|
[MIGRATION.md](./MIGRATION.md).
|
|
10
10
|
|
|
11
|
+
## [0.4.29] - 2026-07-21
|
|
12
|
+
|
|
13
|
+
### Fixed
|
|
14
|
+
|
|
15
|
+
- **`SearchBar` autosuggest now filters results by the active language.**
|
|
16
|
+
Follow-up to 0.4.28's category-search routing: the backend search matches
|
|
17
|
+
across all languages, so FR/ES-only products leaked into an EN preview. The
|
|
18
|
+
autosuggest now drops results with no name in the active language (and
|
|
19
|
+
adjusts the "View all (N)" total by the dropped count), and the result row
|
|
20
|
+
displays the name in the active language (falling back to the first
|
|
21
|
+
available) instead of always the first name in the array. Restores the
|
|
22
|
+
behaviour of the pre-package local search bar.
|
|
23
|
+
|
|
11
24
|
## [0.4.28] - 2026-07-21
|
|
12
25
|
|
|
13
26
|
### Fixed
|
package/dist/index.cjs
CHANGED
|
@@ -2177,6 +2177,7 @@ function useProductSearch(options) {
|
|
|
2177
2177
|
);
|
|
2178
2178
|
const isLoading = !isControlled && internalLoading;
|
|
2179
2179
|
function filterByLanguage(products, lang) {
|
|
2180
|
+
if (!lang) return products;
|
|
2180
2181
|
return products.filter((p) => {
|
|
2181
2182
|
const names = p.names || p.names || [];
|
|
2182
2183
|
if (!names || names.length === 0) return true;
|
|
@@ -2438,9 +2439,12 @@ function useProductSearch(options) {
|
|
|
2438
2439
|
};
|
|
2439
2440
|
const response = await service.getCategory(variables);
|
|
2440
2441
|
const productsResponse = response?.products;
|
|
2441
|
-
const
|
|
2442
|
+
const rawItems = productsResponse?.items ?? [];
|
|
2443
|
+
const items = filterByLanguage(rawItems, language);
|
|
2444
|
+
const untranslated = rawItems.length - items.length;
|
|
2445
|
+
const apiTotal = productsResponse?.itemsFound ?? rawItems.length;
|
|
2442
2446
|
setSearchResults(items);
|
|
2443
|
-
setSearchItemsFound(
|
|
2447
|
+
setSearchItemsFound(Math.max(0, apiTotal - untranslated));
|
|
2444
2448
|
} catch {
|
|
2445
2449
|
setSearchResults([]);
|
|
2446
2450
|
setSearchItemsFound(0);
|
|
@@ -17227,7 +17231,7 @@ function RegisterForm(rawProps) {
|
|
|
17227
17231
|
] });
|
|
17228
17232
|
}
|
|
17229
17233
|
var RegisterForm_default = RegisterForm;
|
|
17230
|
-
function mapToSearchBarResult(item) {
|
|
17234
|
+
function mapToSearchBarResult(item, language) {
|
|
17231
17235
|
const isCluster = "clusterId" in item;
|
|
17232
17236
|
const displayItem = isCluster ? item.defaultProduct : item;
|
|
17233
17237
|
const id = isCluster ? item.clusterId : item.productId;
|
|
@@ -17235,9 +17239,10 @@ function mapToSearchBarResult(item) {
|
|
|
17235
17239
|
const url = isCluster ? "/cluster/" + id + "/" + slug : "/product/" + id + "/" + slug;
|
|
17236
17240
|
const priceNet = displayItem?.price?.net || 0;
|
|
17237
17241
|
const priceGross = displayItem?.price?.gross || 0;
|
|
17242
|
+
const localizedName = language && item.names?.find((n) => n.language === language)?.value || item.names?.[0]?.value || "Product";
|
|
17238
17243
|
return {
|
|
17239
17244
|
id,
|
|
17240
|
-
name:
|
|
17245
|
+
name: localizedName,
|
|
17241
17246
|
sku: item.sku || displayItem?.sku || "",
|
|
17242
17247
|
// `price` stays the gross value for back-compat; the row picks net/gross
|
|
17243
17248
|
// from the two explicit fields below per the toggle.
|
|
@@ -17264,7 +17269,7 @@ function SearchBar(rawProps) {
|
|
|
17264
17269
|
orderlistIds: props.orderlistIds,
|
|
17265
17270
|
applyOrderlists: props.applyOrderlists
|
|
17266
17271
|
});
|
|
17267
|
-
const results = searchResults.slice(0, maxResults).map((item) => mapToSearchBarResult(item));
|
|
17272
|
+
const results = searchResults.slice(0, maxResults).map((item) => mapToSearchBarResult(item, props.language));
|
|
17268
17273
|
const itemsFound = searchItemsFound;
|
|
17269
17274
|
function formatItemPrice(price) {
|
|
17270
17275
|
if (props.formatPrice) {
|