@propeller-commerce/propeller-v2-react-ui 0.4.15 → 0.4.17
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 +37 -0
- package/dist/index.cjs +59 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +160 -63
- package/dist/index.d.ts +160 -63
- package/dist/index.js +59 -20
- package/dist/index.js.map +1 -1
- package/dist/pure.cjs.map +1 -1
- package/dist/pure.d.cts +2 -2
- package/dist/pure.d.ts +2 -2
- package/dist/pure.js.map +1 -1
- package/dist/shared.d.cts +1 -1
- package/dist/shared.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2025,7 +2025,13 @@ function useProductInfo(options) {
|
|
|
2025
2025
|
setError(null);
|
|
2026
2026
|
try {
|
|
2027
2027
|
let orderlistIds = [];
|
|
2028
|
-
|
|
2028
|
+
let applyOrderlists = true;
|
|
2029
|
+
if (options.orderlistIds && options.orderlistIds.length > 0) {
|
|
2030
|
+
orderlistIds = options.orderlistIds;
|
|
2031
|
+
applyOrderlists = options.applyOrderlists !== false;
|
|
2032
|
+
} else if (options.applyOrderlists === false) {
|
|
2033
|
+
applyOrderlists = false;
|
|
2034
|
+
} else if (options.user && options.companyId) {
|
|
2029
2035
|
const orderlistService = createServices(graphqlClient).orderlist;
|
|
2030
2036
|
const searchInput = { companyIds: [options.companyId] };
|
|
2031
2037
|
const orderlists = await orderlistService.getOrderlists(searchInput);
|
|
@@ -2036,7 +2042,7 @@ function useProductInfo(options) {
|
|
|
2036
2042
|
const variables = {
|
|
2037
2043
|
productId,
|
|
2038
2044
|
language,
|
|
2039
|
-
applyOrderlists
|
|
2045
|
+
applyOrderlists,
|
|
2040
2046
|
orderlistIds,
|
|
2041
2047
|
imageSearchFilters: imageSearchFilters ?? configuration.imageSearchFiltersGrid,
|
|
2042
2048
|
imageVariantFilters: imageVariantFilters ?? configuration.imageVariantFiltersLarge ?? configuration.imageVariantFiltersSmall,
|
|
@@ -2220,6 +2226,10 @@ function useProductSearch(options) {
|
|
|
2220
2226
|
const userId = options.user && "contactId" in options.user ? options.user.contactId : options.user && "customerId" in options.user ? options.user.customerId : void 0;
|
|
2221
2227
|
const contactId = options.user && "contactId" in options.user ? options.user.contactId : void 0;
|
|
2222
2228
|
const customerId = options.user && "customerId" in options.user ? options.user.customerId : void 0;
|
|
2229
|
+
const orderlistScope = options.orderlistIds && options.orderlistIds.length > 0 ? {
|
|
2230
|
+
applyOrderlists: options.applyOrderlists !== false,
|
|
2231
|
+
orderlistIds: options.orderlistIds
|
|
2232
|
+
} : { applyOrderlists: false };
|
|
2223
2233
|
const categoryProductSearchInput = {
|
|
2224
2234
|
language: lang,
|
|
2225
2235
|
page: pagination.currentPage,
|
|
@@ -2237,7 +2247,8 @@ function useProductSearch(options) {
|
|
|
2237
2247
|
...priceFilter && { price: priceFilter },
|
|
2238
2248
|
...sortInputs.length && { sortInputs },
|
|
2239
2249
|
...options.companyId && { companyId: options.companyId },
|
|
2240
|
-
...userId !== void 0 && { userId }
|
|
2250
|
+
...userId !== void 0 && { userId },
|
|
2251
|
+
...orderlistScope
|
|
2241
2252
|
};
|
|
2242
2253
|
const priceCalculateProductInput = {
|
|
2243
2254
|
taxZone,
|
|
@@ -7410,7 +7421,7 @@ function CategoryDescription(props) {
|
|
|
7410
7421
|
const plain = html.replace(/<[^>]*>/g, "");
|
|
7411
7422
|
if (plain.length <= maxLen) return html;
|
|
7412
7423
|
const truncated = plain.substring(0, maxLen);
|
|
7413
|
-
return truncated.substring(0, truncated.lastIndexOf(" ")) + "\
|
|
7424
|
+
return truncated.substring(0, truncated.lastIndexOf(" ")) + "\u2026";
|
|
7414
7425
|
}
|
|
7415
7426
|
return /* @__PURE__ */ jsx(Fragment, { children: !!html ? /* @__PURE__ */ jsxs(
|
|
7416
7427
|
"div",
|
|
@@ -10677,7 +10688,8 @@ function GridToolbar(rawProps) {
|
|
|
10677
10688
|
}
|
|
10678
10689
|
function getSortOptions() {
|
|
10679
10690
|
const opts = props.sortOptions || [];
|
|
10680
|
-
|
|
10691
|
+
const base = opts.length > 0 ? opts : ALL_SORT_FIELDS;
|
|
10692
|
+
return props.hidePriceSort ? base.filter((f) => f !== ProductSortField.PRICE) : base;
|
|
10681
10693
|
}
|
|
10682
10694
|
function getOffsetOptions() {
|
|
10683
10695
|
const opts = props.offset || [];
|
|
@@ -11100,10 +11112,12 @@ function Menu(rawProps) {
|
|
|
11100
11112
|
}
|
|
11101
11113
|
function getCategoryUrl(cat) {
|
|
11102
11114
|
const lang = props.language || "NL";
|
|
11103
|
-
|
|
11104
|
-
|
|
11105
|
-
lang
|
|
11106
|
-
|
|
11115
|
+
const category = {
|
|
11116
|
+
categoryId: cat.categoryId,
|
|
11117
|
+
slug: [{ value: cat.slug, language: lang }]
|
|
11118
|
+
};
|
|
11119
|
+
if (props.getUrl) return props.getUrl(category);
|
|
11120
|
+
return props.configuration.urls.getCategoryUrl(category, lang);
|
|
11107
11121
|
}
|
|
11108
11122
|
function getSubCategories(cat) {
|
|
11109
11123
|
return (cat.children || []).filter((sub) => sub.name && sub.slug);
|
|
@@ -13288,7 +13302,8 @@ var RESOLVE_SPEC2 = {
|
|
|
13288
13302
|
addToCartComponent: { grid: "addToCartComponent" },
|
|
13289
13303
|
imageComponent: { grid: "imageComponent" },
|
|
13290
13304
|
badgesComponent: { grid: "badgesComponent" },
|
|
13291
|
-
favoriteComponent: { grid: "favoriteComponent" }
|
|
13305
|
+
favoriteComponent: { grid: "favoriteComponent" },
|
|
13306
|
+
belowName: { grid: "belowName" }
|
|
13292
13307
|
};
|
|
13293
13308
|
var ProductCardContext = createContext(null);
|
|
13294
13309
|
function useProductCard() {
|
|
@@ -13369,6 +13384,7 @@ function ProductCardRoot(rawProps) {
|
|
|
13369
13384
|
/* @__PURE__ */ jsx("div", { className: "propeller-product-card__body flex flex-1 flex-row items-center gap-4 px-4 py-2 min-w-0", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-0.5 flex-1 min-w-0", children: [
|
|
13370
13385
|
props.showSku !== false && sku ? /* @__PURE__ */ jsx(ProductCardSku, {}) : null,
|
|
13371
13386
|
props.showName !== false ? /* @__PURE__ */ jsx(ProductCardName, { linkable: true }) : null,
|
|
13387
|
+
/* @__PURE__ */ jsx(ProductCardBelowName, {}),
|
|
13372
13388
|
textLabelValues.length > 0 ? /* @__PURE__ */ jsx(ProductCardTextLabels, {}) : null,
|
|
13373
13389
|
props.showManufacturer && manufacturer ? /* @__PURE__ */ jsx(ProductCardManufacturer, {}) : null,
|
|
13374
13390
|
props.showShortDescription && shortDescription ? /* @__PURE__ */ jsx(ProductCardShortDescription, {}) : null
|
|
@@ -13384,6 +13400,7 @@ function ProductCardRoot(rawProps) {
|
|
|
13384
13400
|
/* @__PURE__ */ jsxs("div", { className: "propeller-product-card__body flex flex-1 flex-col gap-1.5 p-3 sm:gap-2 sm:p-4", children: [
|
|
13385
13401
|
props.showSku !== false && sku ? /* @__PURE__ */ jsx(ProductCardSku, {}) : null,
|
|
13386
13402
|
props.showName !== false ? /* @__PURE__ */ jsx(ProductCardName, { linkable: true }) : null,
|
|
13403
|
+
/* @__PURE__ */ jsx(ProductCardBelowName, {}),
|
|
13387
13404
|
textLabelValues.length > 0 ? /* @__PURE__ */ jsx(ProductCardTextLabels, {}) : null,
|
|
13388
13405
|
props.showStock && !!product.inventory ? /* @__PURE__ */ jsx("div", { className: "hidden md:block", children: /* @__PURE__ */ jsx(ProductCardStock, {}) }) : null,
|
|
13389
13406
|
props.showManufacturer && manufacturer ? /* @__PURE__ */ jsx(ProductCardManufacturer, {}) : null,
|
|
@@ -13566,6 +13583,13 @@ function ProductCardStock(props) {
|
|
|
13566
13583
|
}
|
|
13567
13584
|
);
|
|
13568
13585
|
}
|
|
13586
|
+
function ProductCardBelowName() {
|
|
13587
|
+
const { product, resolved } = useProductCard();
|
|
13588
|
+
if (!resolved.belowName) return null;
|
|
13589
|
+
const content = resolved.belowName(product);
|
|
13590
|
+
if (content == null || content === false) return null;
|
|
13591
|
+
return /* @__PURE__ */ jsx("div", { className: "propeller-product-card__below-name", children: content });
|
|
13592
|
+
}
|
|
13569
13593
|
function ProductCardPrice(props) {
|
|
13570
13594
|
const { product, derived, resolved } = useProductCard();
|
|
13571
13595
|
if (!product?.price) return null;
|
|
@@ -13644,6 +13668,7 @@ ProductCard.Badges = ProductCardBadges;
|
|
|
13644
13668
|
ProductCard.Favorite = ProductCardFavorite;
|
|
13645
13669
|
ProductCard.Name = ProductCardName;
|
|
13646
13670
|
ProductCard.Sku = ProductCardSku;
|
|
13671
|
+
ProductCard.BelowName = ProductCardBelowName;
|
|
13647
13672
|
ProductCard.ShortDescription = ProductCardShortDescription;
|
|
13648
13673
|
ProductCard.Manufacturer = ProductCardManufacturer;
|
|
13649
13674
|
ProductCard.TextLabels = ProductCardTextLabels;
|
|
@@ -13918,7 +13943,7 @@ function useProductGrid() {
|
|
|
13918
13943
|
const ctx = useContext(ProductGridSearchContext);
|
|
13919
13944
|
if (!ctx) {
|
|
13920
13945
|
throw new Error(
|
|
13921
|
-
"<ProductGrid.X> must be rendered inside <ProductGrid>. Got null context \
|
|
13946
|
+
"<ProductGrid.X> must be rendered inside <ProductGrid>. Got null context \u2014 wrap the subcomponents in <ProductGrid categoryId={...}>...</ProductGrid>."
|
|
13922
13947
|
);
|
|
13923
13948
|
}
|
|
13924
13949
|
return ctx;
|
|
@@ -13939,6 +13964,8 @@ function ProductGrid(rawProps) {
|
|
|
13939
13964
|
categoryId: props.categoryId,
|
|
13940
13965
|
term: props.term,
|
|
13941
13966
|
brand: props.brand,
|
|
13967
|
+
orderlistIds: props.orderlistIds,
|
|
13968
|
+
applyOrderlists: props.applyOrderlists,
|
|
13942
13969
|
language: props.language,
|
|
13943
13970
|
taxZone: props.taxZone,
|
|
13944
13971
|
user: props.user,
|
|
@@ -14024,7 +14051,8 @@ function ProductGrid(rawProps) {
|
|
|
14024
14051
|
badgesComponent: props.badgesComponent,
|
|
14025
14052
|
favoriteComponent: props.favoriteComponent,
|
|
14026
14053
|
productCardComponent: props.productCardComponent,
|
|
14027
|
-
clusterCardComponent: props.clusterCardComponent
|
|
14054
|
+
clusterCardComponent: props.clusterCardComponent,
|
|
14055
|
+
belowName: props.belowName
|
|
14028
14056
|
};
|
|
14029
14057
|
if (rawProps.children !== void 0) {
|
|
14030
14058
|
const compoundCtx = {
|
|
@@ -14341,9 +14369,15 @@ function useProductInfoContext() {
|
|
|
14341
14369
|
}
|
|
14342
14370
|
function ProductInfo(rawProps) {
|
|
14343
14371
|
const props = useInfraProps(rawProps);
|
|
14344
|
-
const { product: fetchedProduct, loading, fetchProduct } = useProductInfo(
|
|
14345
|
-
|
|
14346
|
-
|
|
14372
|
+
const { product: fetchedProduct, loading, fetchProduct } = useProductInfo({
|
|
14373
|
+
graphqlClient: props.graphqlClient ?? {},
|
|
14374
|
+
language: props.language,
|
|
14375
|
+
configuration: props.configuration,
|
|
14376
|
+
user: props.user,
|
|
14377
|
+
companyId: props.companyId,
|
|
14378
|
+
orderlistIds: props.orderlistIds,
|
|
14379
|
+
applyOrderlists: props.applyOrderlists
|
|
14380
|
+
});
|
|
14347
14381
|
const activeProduct = props.product || fetchedProduct;
|
|
14348
14382
|
function getProductName5() {
|
|
14349
14383
|
if (!activeProduct) return "";
|
|
@@ -15061,13 +15095,14 @@ function ProductSpecifications(rawProps) {
|
|
|
15061
15095
|
if (!props.productId || !props.graphqlClient) return;
|
|
15062
15096
|
fetchSpecs(props.productId);
|
|
15063
15097
|
}, [props.productId]);
|
|
15064
|
-
return /* @__PURE__ */ jsx(Fragment, { children: !loading && hasPublicAttributes() ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
|
|
15098
|
+
return /* @__PURE__ */ jsx(Fragment, { children: !loading && (hasPublicAttributes() || props.packageDescription) ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
|
|
15065
15099
|
"div",
|
|
15066
15100
|
{
|
|
15067
15101
|
className: `propeller-product-specifications ${props.className || ""}`,
|
|
15068
15102
|
"data-layout": props.layout === "list" ? "list" : "table",
|
|
15069
15103
|
"data-grouped": props.grouping ? "true" : "false",
|
|
15070
15104
|
children: [
|
|
15105
|
+
props.packageDescription ? /* @__PURE__ */ jsx("p", { className: "propeller-product-specifications__package-description mb-4 text-sm text-muted-foreground", children: props.packageDescription }) : null,
|
|
15071
15106
|
!props.grouping ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
15072
15107
|
props.layout !== "list" ? /* @__PURE__ */ jsx("div", { className: "overflow-hidden rounded-lg border border-border", children: /* @__PURE__ */ jsx("table", { className: "w-full text-sm", children: /* @__PURE__ */ jsx("tbody", { className: "divide-y divide-border", children: getAttributes()?.map((attr, i) => /* @__PURE__ */ jsxs("tr", { className: "propeller-product-specifications__row odd:bg-card even:bg-muted/20", children: [
|
|
15073
15108
|
/* @__PURE__ */ jsx("td", { className: "px-4 py-2 font-medium text-foreground w-1/2", children: getAttributeLabel(attr) }),
|
|
@@ -15296,7 +15331,8 @@ function ProductTabs(rawProps) {
|
|
|
15296
15331
|
attributes: getSpecsAttributes(),
|
|
15297
15332
|
language: props.language,
|
|
15298
15333
|
layout: props.specificationsLayout,
|
|
15299
|
-
grouping: props.specificationsGrouping
|
|
15334
|
+
grouping: props.specificationsGrouping,
|
|
15335
|
+
packageDescription: props.specificationsPackageDescription
|
|
15300
15336
|
}
|
|
15301
15337
|
) }) : null,
|
|
15302
15338
|
isActive("downloads") && isTabVisible("downloads") ? /* @__PURE__ */ jsx(
|
|
@@ -15399,7 +15435,8 @@ function ProductTabs(rawProps) {
|
|
|
15399
15435
|
attributes: getSpecsAttributes(),
|
|
15400
15436
|
language: props.language,
|
|
15401
15437
|
layout: props.specificationsLayout,
|
|
15402
|
-
grouping: props.specificationsGrouping
|
|
15438
|
+
grouping: props.specificationsGrouping,
|
|
15439
|
+
packageDescription: props.specificationsPackageDescription
|
|
15403
15440
|
}
|
|
15404
15441
|
) }) : null
|
|
15405
15442
|
] }) : null,
|
|
@@ -16186,7 +16223,7 @@ function RegisterForm(rawProps) {
|
|
|
16186
16223
|
const contactLabel = props.labels?.contactLabel || "Company";
|
|
16187
16224
|
const customerLabel = props.labels?.customerLabel || "Consumer";
|
|
16188
16225
|
const emailPlaceholder = props.labels?.emailPlaceholder || "name@example.com";
|
|
16189
|
-
const passwordPlaceholder = props.labels?.passwordPlaceholder || "\
|
|
16226
|
+
const passwordPlaceholder = props.labels?.passwordPlaceholder || "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022";
|
|
16190
16227
|
const passwordMismatchText = props.labels?.passwordMismatch || "Passwords do not match";
|
|
16191
16228
|
const loginText = props.labels?.loginText || "Already have an account?";
|
|
16192
16229
|
const loginLinkText = props.labels?.loginLink || "Log in";
|
|
@@ -17090,7 +17127,9 @@ function SearchBar(rawProps) {
|
|
|
17090
17127
|
graphqlClient: props.graphqlClient,
|
|
17091
17128
|
language: props.language,
|
|
17092
17129
|
configuration: props.configuration || {},
|
|
17093
|
-
companyId: props.companyId
|
|
17130
|
+
companyId: props.companyId,
|
|
17131
|
+
orderlistIds: props.orderlistIds,
|
|
17132
|
+
applyOrderlists: props.applyOrderlists
|
|
17094
17133
|
});
|
|
17095
17134
|
const results = searchResults.slice(0, maxResults).map((item) => mapToSearchBarResult(item));
|
|
17096
17135
|
const itemsFound = searchItemsFound;
|