@propeller-commerce/propeller-v2-react-ui 0.13.0 → 0.14.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 +31 -0
- package/dist/index.cjs +43 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +43 -22
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -5278,6 +5278,10 @@ interface OrderListProps {
|
|
|
5278
5278
|
showCompanyOrders?: boolean;
|
|
5279
5279
|
/** Hide pagination controls. Defaults to false. */
|
|
5280
5280
|
hidePagination?: boolean;
|
|
5281
|
+
/** Hide the column header row. Defaults to false. */
|
|
5282
|
+
hideHeader?: boolean;
|
|
5283
|
+
/** Drop the results container's card chrome (background/border/shadow). Defaults to false. */
|
|
5284
|
+
flat?: boolean;
|
|
5281
5285
|
/** Filter orders by channel IDs */
|
|
5282
5286
|
channelIds?: number[];
|
|
5283
5287
|
/** Format price */
|
|
@@ -7048,6 +7052,20 @@ interface PurchaseAuthorizationRequestsProps {
|
|
|
7048
7052
|
user?: Contact | Customer;
|
|
7049
7053
|
/** The companyId of the current selected company. Resolved from PropellerProvider when omitted. */
|
|
7050
7054
|
companyId?: number;
|
|
7055
|
+
/** Limit the number of requests shown (e.g. 3 = last 3 modified). undefined = show all */
|
|
7056
|
+
limit?: number;
|
|
7057
|
+
/** Columns to display, in order. Keys: 'date' | 'quantity' | 'total' | 'requestedBy' | 'action'. Defaults to all five. */
|
|
7058
|
+
columns?: string[];
|
|
7059
|
+
/** Label mapping for columns */
|
|
7060
|
+
columnConfig?: Record<string, string>;
|
|
7061
|
+
/** Show the actions column and its buttons. Defaults to true. */
|
|
7062
|
+
showActions?: boolean;
|
|
7063
|
+
/** Hide the column header row. Defaults to false. */
|
|
7064
|
+
hideHeader?: boolean;
|
|
7065
|
+
/** Drop the results container's card chrome (background/border/shadow). Defaults to false. */
|
|
7066
|
+
flat?: boolean;
|
|
7067
|
+
/** Hide the component's own title. Defaults to false. */
|
|
7068
|
+
hideTitle?: boolean;
|
|
7051
7069
|
/**
|
|
7052
7070
|
* Override: fires instead of the default CartService.acceptPurchaseAuthorizationRequest() call.
|
|
7053
7071
|
* Receives the cartId string.
|
package/dist/index.d.ts
CHANGED
|
@@ -5278,6 +5278,10 @@ interface OrderListProps {
|
|
|
5278
5278
|
showCompanyOrders?: boolean;
|
|
5279
5279
|
/** Hide pagination controls. Defaults to false. */
|
|
5280
5280
|
hidePagination?: boolean;
|
|
5281
|
+
/** Hide the column header row. Defaults to false. */
|
|
5282
|
+
hideHeader?: boolean;
|
|
5283
|
+
/** Drop the results container's card chrome (background/border/shadow). Defaults to false. */
|
|
5284
|
+
flat?: boolean;
|
|
5281
5285
|
/** Filter orders by channel IDs */
|
|
5282
5286
|
channelIds?: number[];
|
|
5283
5287
|
/** Format price */
|
|
@@ -7048,6 +7052,20 @@ interface PurchaseAuthorizationRequestsProps {
|
|
|
7048
7052
|
user?: Contact | Customer;
|
|
7049
7053
|
/** The companyId of the current selected company. Resolved from PropellerProvider when omitted. */
|
|
7050
7054
|
companyId?: number;
|
|
7055
|
+
/** Limit the number of requests shown (e.g. 3 = last 3 modified). undefined = show all */
|
|
7056
|
+
limit?: number;
|
|
7057
|
+
/** Columns to display, in order. Keys: 'date' | 'quantity' | 'total' | 'requestedBy' | 'action'. Defaults to all five. */
|
|
7058
|
+
columns?: string[];
|
|
7059
|
+
/** Label mapping for columns */
|
|
7060
|
+
columnConfig?: Record<string, string>;
|
|
7061
|
+
/** Show the actions column and its buttons. Defaults to true. */
|
|
7062
|
+
showActions?: boolean;
|
|
7063
|
+
/** Hide the column header row. Defaults to false. */
|
|
7064
|
+
hideHeader?: boolean;
|
|
7065
|
+
/** Drop the results container's card chrome (background/border/shadow). Defaults to false. */
|
|
7066
|
+
flat?: boolean;
|
|
7067
|
+
/** Hide the component's own title. Defaults to false. */
|
|
7068
|
+
hideTitle?: boolean;
|
|
7051
7069
|
/**
|
|
7052
7070
|
* Override: fires instead of the default CartService.acceptPurchaseAuthorizationRequest() call.
|
|
7053
7071
|
* Receives the cartId string.
|
package/dist/index.js
CHANGED
|
@@ -13886,9 +13886,9 @@ function OrderList(rawProps) {
|
|
|
13886
13886
|
)
|
|
13887
13887
|
] })
|
|
13888
13888
|
] }) : null,
|
|
13889
|
-
!loading || orders.length > 0 ? /* @__PURE__ */ jsx(Fragment, { children: orders.length > 0 ? /* @__PURE__ */ jsxs("div", { className:
|
|
13889
|
+
!loading || orders.length > 0 ? /* @__PURE__ */ jsx(Fragment, { children: orders.length > 0 ? /* @__PURE__ */ jsxs("div", { className: `propeller-order-list__results${props.flat ? "" : " bg-card rounded-container shadow"} overflow-hidden`, children: [
|
|
13890
13890
|
/* @__PURE__ */ jsx("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxs("table", { className: "propeller-order-list__table min-w-full divide-y divide-border", children: [
|
|
13891
|
-
/* @__PURE__ */ jsx("thead", { className: "propeller-order-list__thead bg-surface-hover", children: /* @__PURE__ */ jsx("tr", { children: columns?.map((col) => /* @__PURE__ */ jsx(
|
|
13891
|
+
!props.hideHeader ? /* @__PURE__ */ jsx("thead", { className: "propeller-order-list__thead bg-surface-hover", children: /* @__PURE__ */ jsx("tr", { children: columns?.map((col) => /* @__PURE__ */ jsx(
|
|
13892
13892
|
"th",
|
|
13893
13893
|
{
|
|
13894
13894
|
"data-column": col,
|
|
@@ -13896,7 +13896,7 @@ function OrderList(rawProps) {
|
|
|
13896
13896
|
children: getColumnLabel(col)
|
|
13897
13897
|
},
|
|
13898
13898
|
col
|
|
13899
|
-
)) }) }),
|
|
13899
|
+
)) }) }) : null,
|
|
13900
13900
|
/* @__PURE__ */ jsx("tbody", { className: "propeller-order-list__tbody bg-card divide-y divide-border", children: orders?.map((order) => /* @__PURE__ */ jsx(
|
|
13901
13901
|
"tr",
|
|
13902
13902
|
{
|
|
@@ -14003,7 +14003,7 @@ function OrderList(rawProps) {
|
|
|
14003
14003
|
) })
|
|
14004
14004
|
] })
|
|
14005
14005
|
] }) : null
|
|
14006
|
-
] }) : /* @__PURE__ */ jsx("div", { className:
|
|
14006
|
+
] }) : /* @__PURE__ */ jsx("div", { className: `propeller-order-list__empty${props.flat ? "" : " bg-card rounded-container shadow"} p-8 text-center`, children: /* @__PURE__ */ jsx("p", { className: "text-muted-foreground mb-4", children: getLabel(props.labels, "noOrders", "No orders found.") }) }) }) : /* @__PURE__ */ jsx("div", { className: "propeller-order-list__loading p-8 text-center text-muted-foreground", children: getLabel(props.labels, "loading", "Loading orders...") })
|
|
14007
14007
|
] });
|
|
14008
14008
|
}
|
|
14009
14009
|
var OrderList_default = OrderList;
|
|
@@ -17170,6 +17170,10 @@ function PurchaseAuthorizationConfigurator(rawProps) {
|
|
|
17170
17170
|
var PurchaseAuthorizationConfigurator_default = PurchaseAuthorizationConfigurator;
|
|
17171
17171
|
function PurchaseAuthorizationRequests(rawProps) {
|
|
17172
17172
|
const props = useInfraProps(rawProps);
|
|
17173
|
+
const showActions = props.showActions !== false;
|
|
17174
|
+
const columns = (props.columns || ["date", "quantity", "total", "requestedBy", "action"]).filter(
|
|
17175
|
+
(col) => showActions || col !== "action"
|
|
17176
|
+
);
|
|
17173
17177
|
const {
|
|
17174
17178
|
carts,
|
|
17175
17179
|
loading,
|
|
@@ -17203,6 +17207,17 @@ function PurchaseAuthorizationRequests(rawProps) {
|
|
|
17203
17207
|
await handleDeleteRequest();
|
|
17204
17208
|
setShowDeleteConfirm(false);
|
|
17205
17209
|
};
|
|
17210
|
+
const displayedCarts = useMemo(() => {
|
|
17211
|
+
if (props.limit && props.limit > 0) {
|
|
17212
|
+
const sorted = [...carts].sort((a, b) => {
|
|
17213
|
+
const dateA = new Date(a.lastModifiedAt || "").getTime();
|
|
17214
|
+
const dateB = new Date(b.lastModifiedAt || "").getTime();
|
|
17215
|
+
return dateB - dateA;
|
|
17216
|
+
});
|
|
17217
|
+
return sorted.slice(0, props.limit);
|
|
17218
|
+
}
|
|
17219
|
+
return carts;
|
|
17220
|
+
}, [carts, props.limit]);
|
|
17206
17221
|
function formatDate(dateStr) {
|
|
17207
17222
|
if (props.formatDate) return props.formatDate(dateStr);
|
|
17208
17223
|
if (!dateStr) return "-";
|
|
@@ -17216,6 +17231,18 @@ function PurchaseAuthorizationRequests(rawProps) {
|
|
|
17216
17231
|
if (props.formatPrice) return props.formatPrice(price);
|
|
17217
17232
|
return formatPrice(price, { symbol: props.currency ?? "\u20AC" });
|
|
17218
17233
|
}
|
|
17234
|
+
const columnLabelKeys = {
|
|
17235
|
+
date: ["colDate", "Date"],
|
|
17236
|
+
quantity: ["colQuantity", "Quantity"],
|
|
17237
|
+
total: ["colTotal", "Total"],
|
|
17238
|
+
requestedBy: ["colRequestedBy", "Requested by"],
|
|
17239
|
+
action: ["colActions", "Actions"]
|
|
17240
|
+
};
|
|
17241
|
+
function getColumnLabel(col) {
|
|
17242
|
+
if (props.columnConfig?.[col]) return props.columnConfig[col];
|
|
17243
|
+
const [key, fallback] = columnLabelKeys[col] || [col, col];
|
|
17244
|
+
return getLabel(props.labels, key, fallback);
|
|
17245
|
+
}
|
|
17219
17246
|
function getProductName5(item) {
|
|
17220
17247
|
const lang = props.language || "NL";
|
|
17221
17248
|
const fromNames = getLanguageString(item?.product?.names, lang, "");
|
|
@@ -17225,27 +17252,21 @@ function PurchaseAuthorizationRequests(rawProps) {
|
|
|
17225
17252
|
return item?.product?.sku || "";
|
|
17226
17253
|
}
|
|
17227
17254
|
return /* @__PURE__ */ jsx("div", { className: `propeller-purchase-authorization-requests ${props.className || ""}`, children: isAuthManager ? /* @__PURE__ */ jsxs("div", { className: "propeller-purchase-authorization-requests__content space-y-4", children: [
|
|
17228
|
-
/* @__PURE__ */ jsx("h2", { className: "propeller-purchase-authorization-requests__title text-xl font-semibold", children: getLabel(props.labels, "title", "Authorization Requests") }),
|
|
17255
|
+
!props.hideTitle ? /* @__PURE__ */ jsx("h2", { className: "propeller-purchase-authorization-requests__title text-xl font-semibold", children: getLabel(props.labels, "title", "Authorization Requests") }) : null,
|
|
17229
17256
|
loading ? /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center py-12", children: /* @__PURE__ */ jsx("div", { className: "w-8 h-8 border-4 border-primary border-t-transparent rounded-full animate-spin" }) }) : null,
|
|
17230
17257
|
!loading ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
17231
17258
|
carts.length === 0 ? /* @__PURE__ */ jsx("div", { className: "text-center py-12 text-muted-foreground", children: getLabel(props.labels, "empty", "No pending authorization requests") }) : null,
|
|
17232
|
-
carts.length > 0 ? /* @__PURE__ */ jsx("div", { className:
|
|
17233
|
-
/* @__PURE__ */ jsx("thead", { className: "bg-muted/50 border-b border-border", children: /* @__PURE__ */
|
|
17234
|
-
|
|
17235
|
-
|
|
17236
|
-
|
|
17237
|
-
|
|
17238
|
-
/* @__PURE__ */
|
|
17239
|
-
] }) }),
|
|
17240
|
-
/* @__PURE__ */ jsx("tbody", { className: "divide-y divide-border", children: carts.map((cart, index) => /* @__PURE__ */ jsxs("tr", { className: "hover:bg-muted/30 transition-colors", children: [
|
|
17241
|
-
/* @__PURE__ */ jsx("td", { className: "px-4 py-3 text-muted-foreground", children: formatDate(cart.lastModifiedAt ?? "") }),
|
|
17242
|
-
/* @__PURE__ */ jsx("td", { className: "px-4 py-3", children: getTotalQuantity(cart) }),
|
|
17243
|
-
/* @__PURE__ */ jsx("td", { className: "px-4 py-3 font-medium", children: formatPrice17(cart.total?.totalNet ?? 0) }),
|
|
17244
|
-
/* @__PURE__ */ jsxs("td", { className: "px-4 py-3", children: [
|
|
17259
|
+
carts.length > 0 ? /* @__PURE__ */ jsx("div", { className: `propeller-purchase-authorization-requests__results overflow-x-auto${props.flat ? "" : " rounded-lg border border-border bg-card shadow-sm"}`, children: /* @__PURE__ */ jsxs("table", { className: "w-full text-sm", children: [
|
|
17260
|
+
!props.hideHeader ? /* @__PURE__ */ jsx("thead", { className: "bg-muted/50 border-b border-border", children: /* @__PURE__ */ jsx("tr", { children: columns.map((col) => /* @__PURE__ */ jsx("th", { className: "text-left px-4 py-3 font-medium text-muted-foreground", children: getColumnLabel(col) }, col)) }) }) : null,
|
|
17261
|
+
/* @__PURE__ */ jsx("tbody", { className: "divide-y divide-border", children: displayedCarts.map((cart, index) => /* @__PURE__ */ jsx("tr", { className: "hover:bg-muted/30 transition-colors", children: columns.map((col) => /* @__PURE__ */ jsxs("td", { className: `px-4 py-3${col === "date" ? " text-muted-foreground" : ""}${col === "total" ? " font-medium" : ""}`, children: [
|
|
17262
|
+
col === "date" ? formatDate(cart.lastModifiedAt ?? "") : null,
|
|
17263
|
+
col === "quantity" ? getTotalQuantity(cart) : null,
|
|
17264
|
+
col === "total" ? formatPrice17(cart.total?.totalNet ?? 0) : null,
|
|
17265
|
+
col === "requestedBy" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
17245
17266
|
/* @__PURE__ */ jsx("div", { className: "font-medium", children: getContactName(cart.contact) }),
|
|
17246
17267
|
/* @__PURE__ */ jsx("div", { className: "text-xs text-muted-foreground mt-0.5", children: cart.contact?.email })
|
|
17247
|
-
] }),
|
|
17248
|
-
|
|
17268
|
+
] }) : null,
|
|
17269
|
+
col === "action" ? /* @__PURE__ */ jsx(
|
|
17249
17270
|
"button",
|
|
17250
17271
|
{
|
|
17251
17272
|
type: "button",
|
|
@@ -17253,8 +17274,8 @@ function PurchaseAuthorizationRequests(rawProps) {
|
|
|
17253
17274
|
onClick: () => handleViewCart(cart),
|
|
17254
17275
|
children: getLabel(props.labels, "view", "View")
|
|
17255
17276
|
}
|
|
17256
|
-
)
|
|
17257
|
-
] }, index)) })
|
|
17277
|
+
) : null
|
|
17278
|
+
] }, col)) }, index)) })
|
|
17258
17279
|
] }) }) : null
|
|
17259
17280
|
] }) : null,
|
|
17260
17281
|
selectedCart ? /* @__PURE__ */ jsxs("div", { className: "propeller-purchase-authorization-requests__modal fixed inset-0 z-50 flex items-center justify-center px-4", children: [
|