@propeller-commerce/propeller-v2-react-ui 0.4.12 → 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 CHANGED
@@ -8,6 +8,26 @@ once it reaches 1.0. Until then (the `0.x` line) the public API may change
8
8
  between minor versions; breaking changes are called out below and in
9
9
  [MIGRATION.md](./MIGRATION.md).
10
10
 
11
+ ## [0.4.13] - 2026-06-25
12
+
13
+ ### Added
14
+
15
+ - **Payment-method logos in `CartPaymethods`.** The component now renders each
16
+ method's `logo` (SDK `CartPaymethod.logo`, available in
17
+ `@propeller-commerce/propeller-sdk-v2` `^0.11.3`) as a square tile — logo on
18
+ top, name below — matching the carrier tiles. Falls back to the method name
19
+ when a method has no logo. New `showPaymethodLogo?: boolean` prop (default
20
+ `true`) mirrors `CartCarriers`' `showCarrierLogo`.
21
+
22
+ ### Changed
23
+
24
+ - **`CartPaymethods` and `CartCarriers` now lay out as a square logo grid**
25
+ (`grid-cols-2 sm:3 lg:4`, `aspect-square` tiles, centered logo + name, price
26
+ badge in the corner) instead of the previous single-column name rows. Same
27
+ selection behaviour, BEM classes, and `data-selected` hooks.
28
+ - **Bumped `@propeller-commerce/propeller-sdk-v2` to `^0.11.3`** — adds the
29
+ `logo` field to `CartPaymethod`.
30
+
11
31
  ## [0.4.12] - 2026-06-24
12
32
 
13
33
  ### Changed
package/dist/index.cjs CHANGED
@@ -5897,28 +5897,27 @@ function CartCarriers(props) {
5897
5897
  }
5898
5898
  }, [props.cart, selectedName, props.onCarrierSelect, carriers, props]);
5899
5899
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `propeller-cart-carriers ${containerClass}`, children: [
5900
- carriers.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "propeller-cart-carriers__grid grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3", children: carriers.map((carrier, index) => /* @__PURE__ */ jsxRuntime.jsxs(
5901
- "div",
5902
- {
5903
- onClick: () => handleSelect(carrier),
5904
- "data-selected": selectedName === carrier.name ? "true" : "false",
5905
- className: `propeller-cart-carriers__carrier cursor-pointer border border-border rounded-container p-4 flex flex-col gap-2 transition-all ${selectedName === carrier.name ? "border-secondary bg-secondary/5 shadow-sm" : "hover:border-secondary/30"}`,
5906
- children: [
5907
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "propeller-cart-carriers__carrier-row flex justify-between items-center", children: [
5908
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
5909
- showLogo && (carrier.logo || "") ? /* @__PURE__ */ jsxRuntime.jsx("img", { className: "propeller-cart-carriers__carrier-logo h-6 w-auto", src: carrier.logo || "", alt: carrier.name }) : null,
5910
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "propeller-cart-carriers__carrier-name font-medium", children: carrier.name })
5911
- ] }),
5912
- props.showPrice !== false ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "propeller-cart-carriers__carrier-price text-xs bg-surface-hover text-muted-foreground px-2 py-1 rounded-full", children: formatCarrierPrice(carrier.price) }) : null
5913
- ] }),
5914
- carrier.deliveryDeadline ? /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "propeller-cart-carriers__carrier-deadline text-xs text-muted-foreground", children: [
5915
- propellerV2CoreUi.getLabel(props.labels, "deliveryDeadline", "Delivery deadline:"),
5916
- carrier.deliveryDeadline
5917
- ] }) : null
5918
- ]
5919
- },
5920
- `${carrier.name}-${index}`
5921
- )) }) : null,
5900
+ carriers.length > 0 ? /* @__PURE__ */ jsxRuntime.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) => {
5901
+ const logoUrl = showLogo ? carrier.logo || "" : "";
5902
+ return /* @__PURE__ */ jsxRuntime.jsxs(
5903
+ "div",
5904
+ {
5905
+ onClick: () => handleSelect(carrier),
5906
+ "data-selected": selectedName === carrier.name ? "true" : "false",
5907
+ 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"}`,
5908
+ children: [
5909
+ props.showPrice !== false ? /* @__PURE__ */ jsxRuntime.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,
5910
+ logoUrl ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "propeller-cart-carriers__carrier-logo-wrap flex items-center justify-center h-10 w-full", children: /* @__PURE__ */ jsxRuntime.jsx("img", { className: "propeller-cart-carriers__carrier-logo max-h-10 max-w-[80%] w-auto object-contain", src: logoUrl, alt: carrier.name }) }) : null,
5911
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "propeller-cart-carriers__carrier-name font-medium text-sm", children: carrier.name }),
5912
+ carrier.deliveryDeadline ? /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "propeller-cart-carriers__carrier-deadline text-xs text-muted-foreground", children: [
5913
+ propellerV2CoreUi.getLabel(props.labels, "deliveryDeadline", "Delivery deadline:"),
5914
+ carrier.deliveryDeadline
5915
+ ] }) : null
5916
+ ]
5917
+ },
5918
+ `${carrier.name}-${index}`
5919
+ );
5920
+ }) }) : null,
5922
5921
  carriers.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "propeller-cart-carriers__empty text-muted-foreground italic", children: propellerV2CoreUi.getLabel(props.labels, "noCarriers", "No carriers available.") }) : null
5923
5922
  ] });
5924
5923
  }
@@ -7167,11 +7166,15 @@ function isOnAccountMethod(method) {
7167
7166
  const code = (method.code || "").toLowerCase();
7168
7167
  return code === "on_account" || code === "onaccount" || code === "on-account";
7169
7168
  }
7169
+ function getLogoUrl(method) {
7170
+ return method.logo || "";
7171
+ }
7170
7172
  function CartPaymethods(rawProps) {
7171
7173
  const props = useInfraProps(rawProps);
7172
7174
  const [selectedCode, setSelectedCode] = React6.useState("");
7173
7175
  const containerClass = props.paymentsContainerClass || "cart-paymethods";
7174
7176
  const showOnAccountForGuests = !!props.showOnAccountForGuests;
7177
+ const showLogo = props.showPaymethodLogo !== false;
7175
7178
  const isGuest = !props.user;
7176
7179
  const payMethods = (props.cart?.payMethods || []).filter((m) => {
7177
7180
  if (!m?.code) return false;
@@ -7197,19 +7200,30 @@ function CartPaymethods(rawProps) {
7197
7200
  }
7198
7201
  }, [props.cart, selectedCode, props.onPaymethodSelect, payMethods, props]);
7199
7202
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `propeller-cart-paymethods ${containerClass}`, children: [
7200
- payMethods.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "propeller-cart-paymethods__grid grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3", children: payMethods.map((method, index) => /* @__PURE__ */ jsxRuntime.jsx(
7201
- "div",
7202
- {
7203
- onClick: () => handleSelect(method),
7204
- "data-selected": selectedCode === method.code ? "true" : "false",
7205
- className: `propeller-cart-paymethods__method cursor-pointer border border-border rounded-container p-4 flex flex-col gap-2 transition-all ${selectedCode === method.code ? "border-secondary bg-secondary/5 shadow-sm" : "hover:border-secondary/30"}`,
7206
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "propeller-cart-paymethods__method-row flex justify-between items-center", children: [
7207
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "propeller-cart-paymethods__method-name font-medium", children: method.name || method.code }) }),
7208
- method.price > 0 ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "propeller-cart-paymethods__method-price text-xs bg-surface-hover text-muted-foreground px-2 py-1 rounded-full", children: formatMethodPrice(method.price) }) : null
7209
- ] })
7210
- },
7211
- method.code
7212
- )) }) : null,
7203
+ payMethods.length > 0 ? /* @__PURE__ */ jsxRuntime.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) => {
7204
+ const logoUrl = showLogo ? getLogoUrl(method) : "";
7205
+ return /* @__PURE__ */ jsxRuntime.jsxs(
7206
+ "div",
7207
+ {
7208
+ onClick: () => handleSelect(method),
7209
+ "data-selected": selectedCode === method.code ? "true" : "false",
7210
+ 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"}`,
7211
+ children: [
7212
+ method.price > 0 ? /* @__PURE__ */ jsxRuntime.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,
7213
+ logoUrl ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "propeller-cart-paymethods__method-logo-wrap flex items-center justify-center h-10 w-full", children: /* @__PURE__ */ jsxRuntime.jsx(
7214
+ "img",
7215
+ {
7216
+ className: "propeller-cart-paymethods__method-logo max-h-10 max-w-[80%] w-auto object-contain",
7217
+ src: logoUrl,
7218
+ alt: method.name || method.code
7219
+ }
7220
+ ) }) : null,
7221
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "propeller-cart-paymethods__method-name font-medium text-sm", children: method.name || method.code })
7222
+ ]
7223
+ },
7224
+ method.code
7225
+ );
7226
+ }) }) : null,
7213
7227
  payMethods.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "propeller-cart-paymethods__empty text-muted-foreground italic", children: propellerV2CoreUi.getLabel(props.labels, "noMethods", "No payment methods available.") }) : null
7214
7228
  ] });
7215
7229
  }