@propeller-commerce/propeller-v2-react-ui 0.23.0 → 0.24.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 +40 -0
- package/dist/index.cjs +14 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -2
- package/dist/index.d.ts +5 -2
- package/dist/index.js +14 -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;
|
|
@@ -5926,6 +5926,8 @@ interface QuickOrderProps {
|
|
|
5926
5926
|
};
|
|
5927
5927
|
/** Tax zone for price calculation. Defaults to `'NL'`. */
|
|
5928
5928
|
taxZone?: string;
|
|
5929
|
+
/** Show tax-inclusive prices. Resolves from `<PropellerProvider>`. */
|
|
5930
|
+
includeTax?: boolean;
|
|
5929
5931
|
/** Orderlist (contract) ids to scope the catalogue by. */
|
|
5930
5932
|
orderlistIds?: number[];
|
|
5931
5933
|
/** Set `false` to ignore `orderlistIds`. Defaults to true when ids are given. */
|
|
@@ -5976,6 +5978,7 @@ interface QuickOrderProps {
|
|
|
5976
5978
|
colCode?: string;
|
|
5977
5979
|
colName?: string;
|
|
5978
5980
|
colPrice?: string;
|
|
5981
|
+
colPriceInclVat?: string;
|
|
5979
5982
|
colQuantity?: string;
|
|
5980
5983
|
colTotal?: string;
|
|
5981
5984
|
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;
|
|
@@ -5926,6 +5926,8 @@ interface QuickOrderProps {
|
|
|
5926
5926
|
};
|
|
5927
5927
|
/** Tax zone for price calculation. Defaults to `'NL'`. */
|
|
5928
5928
|
taxZone?: string;
|
|
5929
|
+
/** Show tax-inclusive prices. Resolves from `<PropellerProvider>`. */
|
|
5930
|
+
includeTax?: boolean;
|
|
5929
5931
|
/** Orderlist (contract) ids to scope the catalogue by. */
|
|
5930
5932
|
orderlistIds?: number[];
|
|
5931
5933
|
/** Set `false` to ignore `orderlistIds`. Defaults to true when ids are given. */
|
|
@@ -5976,6 +5978,7 @@ interface QuickOrderProps {
|
|
|
5976
5978
|
colCode?: string;
|
|
5977
5979
|
colName?: string;
|
|
5978
5980
|
colPrice?: string;
|
|
5981
|
+
colPriceInclVat?: string;
|
|
5979
5982
|
colQuantity?: string;
|
|
5980
5983
|
colTotal?: string;
|
|
5981
5984
|
addRow?: string;
|
package/dist/index.js
CHANGED
|
@@ -2787,7 +2787,8 @@ function machineLanguageCandidates(machineLanguage, language, extra) {
|
|
|
2787
2787
|
async function resolveMachineAcrossLanguages(candidates, fetchOne) {
|
|
2788
2788
|
for (const language of candidates) {
|
|
2789
2789
|
try {
|
|
2790
|
-
|
|
2790
|
+
const machine = await fetchOne(language);
|
|
2791
|
+
if (machine !== null && machine !== void 0) return { machine, language };
|
|
2791
2792
|
} catch (error) {
|
|
2792
2793
|
if (!isMachineNotFound(error)) throw error;
|
|
2793
2794
|
}
|
|
@@ -14376,6 +14377,7 @@ function blankRow() {
|
|
|
14376
14377
|
productId: null,
|
|
14377
14378
|
name: "",
|
|
14378
14379
|
netPrice: 0,
|
|
14380
|
+
grossPrice: 0,
|
|
14379
14381
|
quantity: 1,
|
|
14380
14382
|
minQuantity: 1,
|
|
14381
14383
|
matches: [],
|
|
@@ -14406,6 +14408,7 @@ function QuickOrderInner(props) {
|
|
|
14406
14408
|
const graphqlClient = props.graphqlClient;
|
|
14407
14409
|
const displayPrice = (n) => props.formatPrice ? props.formatPrice(n) : formatPrice(n, { symbol: currency, locale: localeForLanguage(props.language) });
|
|
14408
14410
|
const L = (key, fallback) => getLabel(labels, key, fallback);
|
|
14411
|
+
const rowPrice = (r) => props.includeTax ? r.netPrice : r.grossPrice;
|
|
14409
14412
|
const { submitting, searchProducts, submit } = useQuickOrder({
|
|
14410
14413
|
graphqlClient,
|
|
14411
14414
|
user,
|
|
@@ -14432,7 +14435,7 @@ function QuickOrderInner(props) {
|
|
|
14432
14435
|
}, []);
|
|
14433
14436
|
const onCodeInput = useCallback(
|
|
14434
14437
|
(key, value) => {
|
|
14435
|
-
patchRow(key, { code: value, productId: null, name: "", netPrice: 0, searched: false });
|
|
14438
|
+
patchRow(key, { code: value, productId: null, name: "", netPrice: 0, grossPrice: 0, searched: false });
|
|
14436
14439
|
setNotice(null);
|
|
14437
14440
|
const timers = searchTimers.current;
|
|
14438
14441
|
if (timers[key]) clearTimeout(timers[key]);
|
|
@@ -14453,7 +14456,7 @@ function QuickOrderInner(props) {
|
|
|
14453
14456
|
const dup = rows.some((r) => r.key !== key && r.productId && r.code === match.sku);
|
|
14454
14457
|
if (dup) {
|
|
14455
14458
|
setNotice(L("alreadyInList", "Product is already in the list"));
|
|
14456
|
-
patchRow(key, { code: "", matches: [], productId: null, name: "", netPrice: 0, searched: false });
|
|
14459
|
+
patchRow(key, { code: "", matches: [], productId: null, name: "", netPrice: 0, grossPrice: 0, searched: false });
|
|
14457
14460
|
return;
|
|
14458
14461
|
}
|
|
14459
14462
|
patchRow(key, {
|
|
@@ -14462,6 +14465,7 @@ function QuickOrderInner(props) {
|
|
|
14462
14465
|
clusterId: match.clusterId,
|
|
14463
14466
|
name: match.name,
|
|
14464
14467
|
netPrice: match.netPrice,
|
|
14468
|
+
grossPrice: match.grossPrice,
|
|
14465
14469
|
quantity: match.minQuantity,
|
|
14466
14470
|
minQuantity: match.minQuantity,
|
|
14467
14471
|
matches: [],
|
|
@@ -14523,6 +14527,7 @@ function QuickOrderInner(props) {
|
|
|
14523
14527
|
clusterId: exact.clusterId,
|
|
14524
14528
|
name: exact.name,
|
|
14525
14529
|
netPrice: exact.netPrice,
|
|
14530
|
+
grossPrice: exact.grossPrice,
|
|
14526
14531
|
quantity: Math.max(exact.minQuantity, line.quantity),
|
|
14527
14532
|
minQuantity: exact.minQuantity
|
|
14528
14533
|
});
|
|
@@ -14592,7 +14597,7 @@ function QuickOrderInner(props) {
|
|
|
14592
14597
|
/* @__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: [
|
|
14593
14598
|
/* @__PURE__ */ jsx("div", { className: "col-span-3", children: L("colCode", "Article no. / SKU") }),
|
|
14594
14599
|
/* @__PURE__ */ jsx("div", { className: "col-span-3", children: L("colName", "Product name") }),
|
|
14595
|
-
/* @__PURE__ */ jsx("div", { className: "col-span-2", children: L("colPrice", "excl. VAT") }),
|
|
14600
|
+
/* @__PURE__ */ jsx("div", { className: "col-span-2", children: props.includeTax ? L("colPriceInclVat", "incl. VAT") : L("colPrice", "excl. VAT") }),
|
|
14596
14601
|
/* @__PURE__ */ jsx("div", { className: "col-span-1", children: L("colQuantity", "Qty") }),
|
|
14597
14602
|
/* @__PURE__ */ jsx("div", { className: "col-span-2 text-right", children: L("colTotal", "Total") }),
|
|
14598
14603
|
/* @__PURE__ */ jsx("div", { className: "col-span-1" })
|
|
@@ -14645,7 +14650,7 @@ function QuickOrderInner(props) {
|
|
|
14645
14650
|
"input",
|
|
14646
14651
|
{
|
|
14647
14652
|
type: "text",
|
|
14648
|
-
value: r.productId ? displayPrice(r
|
|
14653
|
+
value: r.productId ? displayPrice(rowPrice(r)) : "",
|
|
14649
14654
|
disabled: true,
|
|
14650
14655
|
className: "w-full rounded border border-input bg-muted/40 px-2 py-1.5 text-sm text-muted-foreground"
|
|
14651
14656
|
}
|
|
@@ -14665,7 +14670,7 @@ function QuickOrderInner(props) {
|
|
|
14665
14670
|
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"
|
|
14666
14671
|
}
|
|
14667
14672
|
) }),
|
|
14668
|
-
/* @__PURE__ */ jsx("div", { className: "col-span-9 md:col-span-2 text-right text-sm text-foreground whitespace-nowrap", children: r.productId ? displayPrice(r
|
|
14673
|
+
/* @__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) : "" }),
|
|
14669
14674
|
/* @__PURE__ */ jsx("div", { className: "col-span-3 md:col-span-1 flex justify-end", children: /* @__PURE__ */ jsx(
|
|
14670
14675
|
"button",
|
|
14671
14676
|
{
|
|
@@ -17705,8 +17710,8 @@ function PurchaseAuthorizationRequests(rawProps) {
|
|
|
17705
17710
|
/* @__PURE__ */ jsx("thead", { className: "bg-muted/50 border-b border-border", children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
17706
17711
|
/* @__PURE__ */ jsx("th", { className: "text-left px-3 py-2 font-medium text-muted-foreground", children: getLabel(props.labels, "itemProduct", "Product") }),
|
|
17707
17712
|
/* @__PURE__ */ jsx("th", { className: "text-right px-3 py-2 font-medium text-muted-foreground", children: getLabel(props.labels, "itemQty", "Qty") }),
|
|
17708
|
-
/* @__PURE__ */ jsx("th", { className: "text-right px-3 py-2 font-medium text-muted-foreground", children: getLabel(props.labels, "itemUnitPrice", "Unit price") }),
|
|
17709
|
-
/* @__PURE__ */ jsx("th", { className: "text-right px-3 py-2 font-medium text-muted-foreground", children: getLabel(props.labels, "itemTotal", "Total") })
|
|
17713
|
+
/* @__PURE__ */ jsx("th", { className: "text-right px-3 py-2 font-medium text-muted-foreground", children: getLabel(props.labels, "itemUnitPrice", "Unit price excl. VAT") }),
|
|
17714
|
+
/* @__PURE__ */ jsx("th", { className: "text-right px-3 py-2 font-medium text-muted-foreground", children: getLabel(props.labels, "itemTotal", "Total excl. VAT") })
|
|
17710
17715
|
] }) }),
|
|
17711
17716
|
/* @__PURE__ */ jsx("tbody", { className: "divide-y divide-border", children: getModalItems().map((item, idx) => /* @__PURE__ */ jsxs("tr", { children: [
|
|
17712
17717
|
/* @__PURE__ */ jsx("td", { className: "px-3 py-2", children: getProductName5(item) }),
|
|
@@ -17714,7 +17719,7 @@ function PurchaseAuthorizationRequests(rawProps) {
|
|
|
17714
17719
|
/* @__PURE__ */ jsx("td", { className: "px-3 py-2 text-right", children: formatPrice17(
|
|
17715
17720
|
(item.quantity ?? 0) > 0 ? (item.totalSum ?? 0) / (item.quantity ?? 1) : 0
|
|
17716
17721
|
) }),
|
|
17717
|
-
/* @__PURE__ */ jsx("td", { className: "px-3 py-2 text-right font-medium", children: formatPrice17(item.
|
|
17722
|
+
/* @__PURE__ */ jsx("td", { className: "px-3 py-2 text-right font-medium", children: formatPrice17(item.totalSum ?? 0) })
|
|
17718
17723
|
] }, idx)) })
|
|
17719
17724
|
] }) })
|
|
17720
17725
|
] }),
|