@propeller-commerce/propeller-v2-react-ui 0.4.11 → 0.4.13
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 +32 -0
- package/dist/index.cjs +49 -35
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +49 -35
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +3 -4
package/dist/index.d.cts
CHANGED
|
@@ -3110,6 +3110,8 @@ interface CartPaymethodsProps {
|
|
|
3110
3110
|
paymentsContainerClass?: string;
|
|
3111
3111
|
/** Display the on account payment method for anonymous users */
|
|
3112
3112
|
showOnAccountForGuests?: boolean;
|
|
3113
|
+
/** Display the payment method logo (default: true). Falls back to the name when no logo is set. */
|
|
3114
|
+
showPaymethodLogo?: boolean;
|
|
3113
3115
|
/** Action when a payment method is selected */
|
|
3114
3116
|
onPaymethodSelect?: (paymethod: CartPaymethod) => void;
|
|
3115
3117
|
/** Custom price formatting function */
|
package/dist/index.d.ts
CHANGED
|
@@ -3110,6 +3110,8 @@ interface CartPaymethodsProps {
|
|
|
3110
3110
|
paymentsContainerClass?: string;
|
|
3111
3111
|
/** Display the on account payment method for anonymous users */
|
|
3112
3112
|
showOnAccountForGuests?: boolean;
|
|
3113
|
+
/** Display the payment method logo (default: true). Falls back to the name when no logo is set. */
|
|
3114
|
+
showPaymethodLogo?: boolean;
|
|
3113
3115
|
/** Action when a payment method is selected */
|
|
3114
3116
|
onPaymethodSelect?: (paymethod: CartPaymethod) => void;
|
|
3115
3117
|
/** Custom price formatting function */
|
package/dist/index.js
CHANGED
|
@@ -5877,28 +5877,27 @@ function CartCarriers(props) {
|
|
|
5877
5877
|
}
|
|
5878
5878
|
}, [props.cart, selectedName, props.onCarrierSelect, carriers, props]);
|
|
5879
5879
|
return /* @__PURE__ */ jsxs("div", { className: `propeller-cart-carriers ${containerClass}`, children: [
|
|
5880
|
-
carriers.length > 0 ? /* @__PURE__ */ jsx("div", { className: "propeller-cart-carriers__grid grid grid-cols-
|
|
5881
|
-
"
|
|
5882
|
-
|
|
5883
|
-
|
|
5884
|
-
|
|
5885
|
-
|
|
5886
|
-
|
|
5887
|
-
|
|
5888
|
-
|
|
5889
|
-
|
|
5890
|
-
|
|
5891
|
-
|
|
5892
|
-
|
|
5893
|
-
|
|
5894
|
-
|
|
5895
|
-
|
|
5896
|
-
|
|
5897
|
-
|
|
5898
|
-
|
|
5899
|
-
|
|
5900
|
-
|
|
5901
|
-
)) }) : null,
|
|
5880
|
+
carriers.length > 0 ? /* @__PURE__ */ jsx("div", { className: "propeller-cart-carriers__grid grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-3", children: carriers.map((carrier, index) => {
|
|
5881
|
+
const logoUrl = showLogo ? carrier.logo || "" : "";
|
|
5882
|
+
return /* @__PURE__ */ jsxs(
|
|
5883
|
+
"div",
|
|
5884
|
+
{
|
|
5885
|
+
onClick: () => handleSelect(carrier),
|
|
5886
|
+
"data-selected": selectedName === carrier.name ? "true" : "false",
|
|
5887
|
+
className: `propeller-cart-carriers__carrier relative cursor-pointer border rounded-container p-3 flex flex-col items-center justify-center gap-2 text-center aspect-square transition-all ${selectedName === carrier.name ? "border-secondary bg-secondary/5 shadow-sm" : "border-border hover:border-secondary/30"}`,
|
|
5888
|
+
children: [
|
|
5889
|
+
props.showPrice !== false ? /* @__PURE__ */ jsx("span", { className: "propeller-cart-carriers__carrier-price absolute top-2 right-2 text-xs bg-surface-hover text-muted-foreground px-2 py-0.5 rounded-full", children: formatCarrierPrice(carrier.price) }) : null,
|
|
5890
|
+
logoUrl ? /* @__PURE__ */ jsx("span", { className: "propeller-cart-carriers__carrier-logo-wrap flex items-center justify-center h-10 w-full", children: /* @__PURE__ */ jsx("img", { className: "propeller-cart-carriers__carrier-logo max-h-10 max-w-[80%] w-auto object-contain", src: logoUrl, alt: carrier.name }) }) : null,
|
|
5891
|
+
/* @__PURE__ */ jsx("span", { className: "propeller-cart-carriers__carrier-name font-medium text-sm", children: carrier.name }),
|
|
5892
|
+
carrier.deliveryDeadline ? /* @__PURE__ */ jsxs("p", { className: "propeller-cart-carriers__carrier-deadline text-xs text-muted-foreground", children: [
|
|
5893
|
+
getLabel(props.labels, "deliveryDeadline", "Delivery deadline:"),
|
|
5894
|
+
carrier.deliveryDeadline
|
|
5895
|
+
] }) : null
|
|
5896
|
+
]
|
|
5897
|
+
},
|
|
5898
|
+
`${carrier.name}-${index}`
|
|
5899
|
+
);
|
|
5900
|
+
}) }) : null,
|
|
5902
5901
|
carriers.length === 0 ? /* @__PURE__ */ jsx("p", { className: "propeller-cart-carriers__empty text-muted-foreground italic", children: getLabel(props.labels, "noCarriers", "No carriers available.") }) : null
|
|
5903
5902
|
] });
|
|
5904
5903
|
}
|
|
@@ -7147,11 +7146,15 @@ function isOnAccountMethod(method) {
|
|
|
7147
7146
|
const code = (method.code || "").toLowerCase();
|
|
7148
7147
|
return code === "on_account" || code === "onaccount" || code === "on-account";
|
|
7149
7148
|
}
|
|
7149
|
+
function getLogoUrl(method) {
|
|
7150
|
+
return method.logo || "";
|
|
7151
|
+
}
|
|
7150
7152
|
function CartPaymethods(rawProps) {
|
|
7151
7153
|
const props = useInfraProps(rawProps);
|
|
7152
7154
|
const [selectedCode, setSelectedCode] = useState("");
|
|
7153
7155
|
const containerClass = props.paymentsContainerClass || "cart-paymethods";
|
|
7154
7156
|
const showOnAccountForGuests = !!props.showOnAccountForGuests;
|
|
7157
|
+
const showLogo = props.showPaymethodLogo !== false;
|
|
7155
7158
|
const isGuest = !props.user;
|
|
7156
7159
|
const payMethods = (props.cart?.payMethods || []).filter((m) => {
|
|
7157
7160
|
if (!m?.code) return false;
|
|
@@ -7177,19 +7180,30 @@ function CartPaymethods(rawProps) {
|
|
|
7177
7180
|
}
|
|
7178
7181
|
}, [props.cart, selectedCode, props.onPaymethodSelect, payMethods, props]);
|
|
7179
7182
|
return /* @__PURE__ */ jsxs("div", { className: `propeller-cart-paymethods ${containerClass}`, children: [
|
|
7180
|
-
payMethods.length > 0 ? /* @__PURE__ */ jsx("div", { className: "propeller-cart-paymethods__grid grid grid-cols-
|
|
7181
|
-
"
|
|
7182
|
-
|
|
7183
|
-
|
|
7184
|
-
|
|
7185
|
-
|
|
7186
|
-
|
|
7187
|
-
|
|
7188
|
-
|
|
7189
|
-
|
|
7190
|
-
|
|
7191
|
-
|
|
7192
|
-
|
|
7183
|
+
payMethods.length > 0 ? /* @__PURE__ */ jsx("div", { className: "propeller-cart-paymethods__grid grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-3", children: payMethods.map((method, index) => {
|
|
7184
|
+
const logoUrl = showLogo ? getLogoUrl(method) : "";
|
|
7185
|
+
return /* @__PURE__ */ jsxs(
|
|
7186
|
+
"div",
|
|
7187
|
+
{
|
|
7188
|
+
onClick: () => handleSelect(method),
|
|
7189
|
+
"data-selected": selectedCode === method.code ? "true" : "false",
|
|
7190
|
+
className: `propeller-cart-paymethods__method relative cursor-pointer border rounded-container p-3 flex flex-col items-center justify-center gap-2 text-center aspect-square transition-all ${selectedCode === method.code ? "border-secondary bg-secondary/5 shadow-sm" : "border-border hover:border-secondary/30"}`,
|
|
7191
|
+
children: [
|
|
7192
|
+
method.price > 0 ? /* @__PURE__ */ jsx("span", { className: "propeller-cart-paymethods__method-price absolute top-2 right-2 text-xs bg-surface-hover text-muted-foreground px-2 py-0.5 rounded-full", children: formatMethodPrice(method.price) }) : null,
|
|
7193
|
+
logoUrl ? /* @__PURE__ */ jsx("span", { className: "propeller-cart-paymethods__method-logo-wrap flex items-center justify-center h-10 w-full", children: /* @__PURE__ */ jsx(
|
|
7194
|
+
"img",
|
|
7195
|
+
{
|
|
7196
|
+
className: "propeller-cart-paymethods__method-logo max-h-10 max-w-[80%] w-auto object-contain",
|
|
7197
|
+
src: logoUrl,
|
|
7198
|
+
alt: method.name || method.code
|
|
7199
|
+
}
|
|
7200
|
+
) }) : null,
|
|
7201
|
+
/* @__PURE__ */ jsx("span", { className: "propeller-cart-paymethods__method-name font-medium text-sm", children: method.name || method.code })
|
|
7202
|
+
]
|
|
7203
|
+
},
|
|
7204
|
+
method.code
|
|
7205
|
+
);
|
|
7206
|
+
}) }) : null,
|
|
7193
7207
|
payMethods.length === 0 ? /* @__PURE__ */ jsx("p", { className: "propeller-cart-paymethods__empty text-muted-foreground italic", children: getLabel(props.labels, "noMethods", "No payment methods available.") }) : null
|
|
7194
7208
|
] });
|
|
7195
7209
|
}
|