@propeller-commerce/propeller-v2-react-ui 0.23.1 → 0.25.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 +45 -0
- package/dist/index.cjs +16 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.js +16 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1542,9 +1542,9 @@ interface QuickOrderMatch {
|
|
|
1542
1542
|
name: string;
|
|
1543
1543
|
/** The product SKU/code (canonical, from the API). */
|
|
1544
1544
|
sku: string;
|
|
1545
|
-
/**
|
|
1545
|
+
/** Unit price incl. VAT. */
|
|
1546
1546
|
netPrice: number;
|
|
1547
|
-
/**
|
|
1547
|
+
/** Unit price excl. VAT. */
|
|
1548
1548
|
grossPrice: number;
|
|
1549
1549
|
/** Minimum order quantity (defaults to 1). */
|
|
1550
1550
|
minQuantity: number;
|
|
@@ -3530,6 +3530,8 @@ interface CartOverviewProps {
|
|
|
3530
3530
|
code: string;
|
|
3531
3531
|
name: string;
|
|
3532
3532
|
}[];
|
|
3533
|
+
/** Maps a lowercased payment-method code to its display name. Falls back to the raw value. */
|
|
3534
|
+
paymethodLabels?: Record<string, string>;
|
|
3533
3535
|
/** Logged-in user — used for the purchase-authorization check. Resolved from PropellerProvider when omitted. */
|
|
3534
3536
|
user?: Contact | Customer | null;
|
|
3535
3537
|
/** Active company ID — used for the purchase-authorization check. Resolved from PropellerProvider when omitted. */
|
|
@@ -5926,6 +5928,8 @@ interface QuickOrderProps {
|
|
|
5926
5928
|
};
|
|
5927
5929
|
/** Tax zone for price calculation. Defaults to `'NL'`. */
|
|
5928
5930
|
taxZone?: string;
|
|
5931
|
+
/** Show tax-inclusive prices. Resolves from `<PropellerProvider>`. */
|
|
5932
|
+
includeTax?: boolean;
|
|
5929
5933
|
/** Orderlist (contract) ids to scope the catalogue by. */
|
|
5930
5934
|
orderlistIds?: number[];
|
|
5931
5935
|
/** Set `false` to ignore `orderlistIds`. Defaults to true when ids are given. */
|
|
@@ -5976,6 +5980,7 @@ interface QuickOrderProps {
|
|
|
5976
5980
|
colCode?: string;
|
|
5977
5981
|
colName?: string;
|
|
5978
5982
|
colPrice?: string;
|
|
5983
|
+
colPriceInclVat?: string;
|
|
5979
5984
|
colQuantity?: string;
|
|
5980
5985
|
colTotal?: string;
|
|
5981
5986
|
addRow?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1542,9 +1542,9 @@ interface QuickOrderMatch {
|
|
|
1542
1542
|
name: string;
|
|
1543
1543
|
/** The product SKU/code (canonical, from the API). */
|
|
1544
1544
|
sku: string;
|
|
1545
|
-
/**
|
|
1545
|
+
/** Unit price incl. VAT. */
|
|
1546
1546
|
netPrice: number;
|
|
1547
|
-
/**
|
|
1547
|
+
/** Unit price excl. VAT. */
|
|
1548
1548
|
grossPrice: number;
|
|
1549
1549
|
/** Minimum order quantity (defaults to 1). */
|
|
1550
1550
|
minQuantity: number;
|
|
@@ -3530,6 +3530,8 @@ interface CartOverviewProps {
|
|
|
3530
3530
|
code: string;
|
|
3531
3531
|
name: string;
|
|
3532
3532
|
}[];
|
|
3533
|
+
/** Maps a lowercased payment-method code to its display name. Falls back to the raw value. */
|
|
3534
|
+
paymethodLabels?: Record<string, string>;
|
|
3533
3535
|
/** Logged-in user — used for the purchase-authorization check. Resolved from PropellerProvider when omitted. */
|
|
3534
3536
|
user?: Contact | Customer | null;
|
|
3535
3537
|
/** Active company ID — used for the purchase-authorization check. Resolved from PropellerProvider when omitted. */
|
|
@@ -5926,6 +5928,8 @@ interface QuickOrderProps {
|
|
|
5926
5928
|
};
|
|
5927
5929
|
/** Tax zone for price calculation. Defaults to `'NL'`. */
|
|
5928
5930
|
taxZone?: string;
|
|
5931
|
+
/** Show tax-inclusive prices. Resolves from `<PropellerProvider>`. */
|
|
5932
|
+
includeTax?: boolean;
|
|
5929
5933
|
/** Orderlist (contract) ids to scope the catalogue by. */
|
|
5930
5934
|
orderlistIds?: number[];
|
|
5931
5935
|
/** Set `false` to ignore `orderlistIds`. Defaults to true when ids are given. */
|
|
@@ -5976,6 +5980,7 @@ interface QuickOrderProps {
|
|
|
5976
5980
|
colCode?: string;
|
|
5977
5981
|
colName?: string;
|
|
5978
5982
|
colPrice?: string;
|
|
5983
|
+
colPriceInclVat?: string;
|
|
5979
5984
|
colQuantity?: string;
|
|
5980
5985
|
colTotal?: string;
|
|
5981
5986
|
addRow?: string;
|
package/dist/index.js
CHANGED
|
@@ -7334,6 +7334,8 @@ function CartItemDelete(props = {}) {
|
|
|
7334
7334
|
className: props.className ?? "propeller-cart-item__delete h-8 w-8 p-0 ml-auto inline-flex items-center justify-center rounded-control text-foreground-subtle hover:text-destructive hover:bg-destructive/10 transition-colors disabled:opacity-50",
|
|
7335
7335
|
onClick: () => handlers.onDelete(),
|
|
7336
7336
|
disabled: state.deleting,
|
|
7337
|
+
"aria-label": getLabel(resolved.labels, "deleteLabel", "Remove item"),
|
|
7338
|
+
title: getLabel(resolved.labels, "deleteLabel", "Remove item"),
|
|
7337
7339
|
children: [
|
|
7338
7340
|
state.deleting ? /* @__PURE__ */ jsx("div", { className: "w-4 h-4 border-2 border-foreground-subtle border-t-transparent rounded-full animate-spin" }) : null,
|
|
7339
7341
|
!state.deleting ? /* @__PURE__ */ jsxs(
|
|
@@ -7714,7 +7716,8 @@ function CartOverview(rawProps) {
|
|
|
7714
7716
|
const invoiceAddress = props.cart?.invoiceAddress;
|
|
7715
7717
|
const deliveryAddress = props.cart?.deliveryAddress;
|
|
7716
7718
|
const getCountryName$1 = (code) => getCountryName(code, props.countries);
|
|
7717
|
-
const
|
|
7719
|
+
const rawPaymentMethod = props.cart?.paymentData?.method || "";
|
|
7720
|
+
const paymentMethod = rawPaymentMethod ? props.paymethodLabels?.[rawPaymentMethod.toLowerCase()] || rawPaymentMethod : "";
|
|
7718
7721
|
const carrierName = props.cart?.postageData?.carrier || "";
|
|
7719
7722
|
function requestDate() {
|
|
7720
7723
|
const date = props.cart?.postageData?.requestDate;
|
|
@@ -14377,6 +14380,7 @@ function blankRow() {
|
|
|
14377
14380
|
productId: null,
|
|
14378
14381
|
name: "",
|
|
14379
14382
|
netPrice: 0,
|
|
14383
|
+
grossPrice: 0,
|
|
14380
14384
|
quantity: 1,
|
|
14381
14385
|
minQuantity: 1,
|
|
14382
14386
|
matches: [],
|
|
@@ -14407,6 +14411,7 @@ function QuickOrderInner(props) {
|
|
|
14407
14411
|
const graphqlClient = props.graphqlClient;
|
|
14408
14412
|
const displayPrice = (n) => props.formatPrice ? props.formatPrice(n) : formatPrice(n, { symbol: currency, locale: localeForLanguage(props.language) });
|
|
14409
14413
|
const L = (key, fallback) => getLabel(labels, key, fallback);
|
|
14414
|
+
const rowPrice = (r) => props.includeTax ? r.netPrice : r.grossPrice;
|
|
14410
14415
|
const { submitting, searchProducts, submit } = useQuickOrder({
|
|
14411
14416
|
graphqlClient,
|
|
14412
14417
|
user,
|
|
@@ -14433,7 +14438,7 @@ function QuickOrderInner(props) {
|
|
|
14433
14438
|
}, []);
|
|
14434
14439
|
const onCodeInput = useCallback(
|
|
14435
14440
|
(key, value) => {
|
|
14436
|
-
patchRow(key, { code: value, productId: null, name: "", netPrice: 0, searched: false });
|
|
14441
|
+
patchRow(key, { code: value, productId: null, name: "", netPrice: 0, grossPrice: 0, searched: false });
|
|
14437
14442
|
setNotice(null);
|
|
14438
14443
|
const timers = searchTimers.current;
|
|
14439
14444
|
if (timers[key]) clearTimeout(timers[key]);
|
|
@@ -14454,7 +14459,7 @@ function QuickOrderInner(props) {
|
|
|
14454
14459
|
const dup = rows.some((r) => r.key !== key && r.productId && r.code === match.sku);
|
|
14455
14460
|
if (dup) {
|
|
14456
14461
|
setNotice(L("alreadyInList", "Product is already in the list"));
|
|
14457
|
-
patchRow(key, { code: "", matches: [], productId: null, name: "", netPrice: 0, searched: false });
|
|
14462
|
+
patchRow(key, { code: "", matches: [], productId: null, name: "", netPrice: 0, grossPrice: 0, searched: false });
|
|
14458
14463
|
return;
|
|
14459
14464
|
}
|
|
14460
14465
|
patchRow(key, {
|
|
@@ -14463,6 +14468,7 @@ function QuickOrderInner(props) {
|
|
|
14463
14468
|
clusterId: match.clusterId,
|
|
14464
14469
|
name: match.name,
|
|
14465
14470
|
netPrice: match.netPrice,
|
|
14471
|
+
grossPrice: match.grossPrice,
|
|
14466
14472
|
quantity: match.minQuantity,
|
|
14467
14473
|
minQuantity: match.minQuantity,
|
|
14468
14474
|
matches: [],
|
|
@@ -14524,6 +14530,7 @@ function QuickOrderInner(props) {
|
|
|
14524
14530
|
clusterId: exact.clusterId,
|
|
14525
14531
|
name: exact.name,
|
|
14526
14532
|
netPrice: exact.netPrice,
|
|
14533
|
+
grossPrice: exact.grossPrice,
|
|
14527
14534
|
quantity: Math.max(exact.minQuantity, line.quantity),
|
|
14528
14535
|
minQuantity: exact.minQuantity
|
|
14529
14536
|
});
|
|
@@ -14593,7 +14600,7 @@ function QuickOrderInner(props) {
|
|
|
14593
14600
|
/* @__PURE__ */ jsxs("div", { className: "hidden md:grid grid-cols-12 gap-2 px-2 pb-2 text-xs font-medium text-muted-foreground border-b border-border", children: [
|
|
14594
14601
|
/* @__PURE__ */ jsx("div", { className: "col-span-3", children: L("colCode", "Article no. / SKU") }),
|
|
14595
14602
|
/* @__PURE__ */ jsx("div", { className: "col-span-3", children: L("colName", "Product name") }),
|
|
14596
|
-
/* @__PURE__ */ jsx("div", { className: "col-span-2", children: L("colPrice", "excl. VAT") }),
|
|
14603
|
+
/* @__PURE__ */ jsx("div", { className: "col-span-2", children: props.includeTax ? L("colPriceInclVat", "incl. VAT") : L("colPrice", "excl. VAT") }),
|
|
14597
14604
|
/* @__PURE__ */ jsx("div", { className: "col-span-1", children: L("colQuantity", "Qty") }),
|
|
14598
14605
|
/* @__PURE__ */ jsx("div", { className: "col-span-2 text-right", children: L("colTotal", "Total") }),
|
|
14599
14606
|
/* @__PURE__ */ jsx("div", { className: "col-span-1" })
|
|
@@ -14646,7 +14653,7 @@ function QuickOrderInner(props) {
|
|
|
14646
14653
|
"input",
|
|
14647
14654
|
{
|
|
14648
14655
|
type: "text",
|
|
14649
|
-
value: r.productId ? displayPrice(r
|
|
14656
|
+
value: r.productId ? displayPrice(rowPrice(r)) : "",
|
|
14650
14657
|
disabled: true,
|
|
14651
14658
|
className: "w-full rounded border border-input bg-muted/40 px-2 py-1.5 text-sm text-muted-foreground"
|
|
14652
14659
|
}
|
|
@@ -14666,7 +14673,7 @@ function QuickOrderInner(props) {
|
|
|
14666
14673
|
className: "w-full rounded border border-input bg-background px-2 py-1.5 text-sm focus:outline-none focus:ring-2 focus:ring-ring disabled:bg-muted/40"
|
|
14667
14674
|
}
|
|
14668
14675
|
) }),
|
|
14669
|
-
/* @__PURE__ */ jsx("div", { className: "col-span-9 md:col-span-2 text-right text-sm text-foreground whitespace-nowrap", children: r.productId ? displayPrice(r
|
|
14676
|
+
/* @__PURE__ */ jsx("div", { className: "col-span-9 md:col-span-2 text-right text-sm text-foreground whitespace-nowrap", children: r.productId ? displayPrice(rowPrice(r) * r.quantity) : "" }),
|
|
14670
14677
|
/* @__PURE__ */ jsx("div", { className: "col-span-3 md:col-span-1 flex justify-end", children: /* @__PURE__ */ jsx(
|
|
14671
14678
|
"button",
|
|
14672
14679
|
{
|
|
@@ -17706,8 +17713,8 @@ function PurchaseAuthorizationRequests(rawProps) {
|
|
|
17706
17713
|
/* @__PURE__ */ jsx("thead", { className: "bg-muted/50 border-b border-border", children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
17707
17714
|
/* @__PURE__ */ jsx("th", { className: "text-left px-3 py-2 font-medium text-muted-foreground", children: getLabel(props.labels, "itemProduct", "Product") }),
|
|
17708
17715
|
/* @__PURE__ */ jsx("th", { className: "text-right px-3 py-2 font-medium text-muted-foreground", children: getLabel(props.labels, "itemQty", "Qty") }),
|
|
17709
|
-
/* @__PURE__ */ jsx("th", { className: "text-right px-3 py-2 font-medium text-muted-foreground", children: getLabel(props.labels, "itemUnitPrice", "Unit price") }),
|
|
17710
|
-
/* @__PURE__ */ jsx("th", { className: "text-right px-3 py-2 font-medium text-muted-foreground", children: getLabel(props.labels, "itemTotal", "Total") })
|
|
17716
|
+
/* @__PURE__ */ jsx("th", { className: "text-right px-3 py-2 font-medium text-muted-foreground", children: getLabel(props.labels, "itemUnitPrice", "Unit price excl. VAT") }),
|
|
17717
|
+
/* @__PURE__ */ jsx("th", { className: "text-right px-3 py-2 font-medium text-muted-foreground", children: getLabel(props.labels, "itemTotal", "Total excl. VAT") })
|
|
17711
17718
|
] }) }),
|
|
17712
17719
|
/* @__PURE__ */ jsx("tbody", { className: "divide-y divide-border", children: getModalItems().map((item, idx) => /* @__PURE__ */ jsxs("tr", { children: [
|
|
17713
17720
|
/* @__PURE__ */ jsx("td", { className: "px-3 py-2", children: getProductName5(item) }),
|
|
@@ -17715,7 +17722,7 @@ function PurchaseAuthorizationRequests(rawProps) {
|
|
|
17715
17722
|
/* @__PURE__ */ jsx("td", { className: "px-3 py-2 text-right", children: formatPrice17(
|
|
17716
17723
|
(item.quantity ?? 0) > 0 ? (item.totalSum ?? 0) / (item.quantity ?? 1) : 0
|
|
17717
17724
|
) }),
|
|
17718
|
-
/* @__PURE__ */ jsx("td", { className: "px-3 py-2 text-right font-medium", children: formatPrice17(item.
|
|
17725
|
+
/* @__PURE__ */ jsx("td", { className: "px-3 py-2 text-right font-medium", children: formatPrice17(item.totalSum ?? 0) })
|
|
17719
17726
|
] }, idx)) })
|
|
17720
17727
|
] }) })
|
|
17721
17728
|
] }),
|