@propeller-commerce/propeller-v2-react-ui 0.4.23 → 0.4.24

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/dist/index.d.cts CHANGED
@@ -3051,6 +3051,12 @@ interface CartIconAndSidebarProps {
3051
3051
  * continueShopping, qty, total, checkoutButton, cartPageButton, closeLabel
3052
3052
  */
3053
3053
  labels?: Record<string, string>;
3054
+ /**
3055
+ * Labels forwarded to the inner CartItem rows (e.g. `qtyPrefix`). Without
3056
+ * this the sidebar's line items fell back to English ("Qty:") even on a
3057
+ * localized page. Keys match CartItem's label map.
3058
+ */
3059
+ cartItemLabels?: Record<string, string>;
3054
3060
  /** Logged-in user — used to determine purchaser role and authorization limit */
3055
3061
  user?: Contact | Customer;
3056
3062
  /** Configuration object passed to the component */
@@ -3165,6 +3171,14 @@ interface CartPaymethodsProps {
3165
3171
  currency?: string;
3166
3172
  /** Labels for the component */
3167
3173
  labels?: Record<string, string>;
3174
+ /**
3175
+ * Localized display names for payment methods, keyed by the method **code**
3176
+ * (lower-cased, e.g. `{ pickup: 'Bij afhalen', on_account: 'Op rekening' }`).
3177
+ * The backend `method.name` is often an un-localized English string (e.g.
3178
+ * "On pickup"), so this map lets the host override it per locale. Lookup
3179
+ * order: `paymethodLabels[code]` → `method.name` → `method.code`.
3180
+ */
3181
+ paymethodLabels?: Record<string, string>;
3168
3182
  }
3169
3183
  /**
3170
3184
  * Renders the cart's available payment methods as a selectable grid. Hides the
package/dist/index.d.ts CHANGED
@@ -3051,6 +3051,12 @@ interface CartIconAndSidebarProps {
3051
3051
  * continueShopping, qty, total, checkoutButton, cartPageButton, closeLabel
3052
3052
  */
3053
3053
  labels?: Record<string, string>;
3054
+ /**
3055
+ * Labels forwarded to the inner CartItem rows (e.g. `qtyPrefix`). Without
3056
+ * this the sidebar's line items fell back to English ("Qty:") even on a
3057
+ * localized page. Keys match CartItem's label map.
3058
+ */
3059
+ cartItemLabels?: Record<string, string>;
3054
3060
  /** Logged-in user — used to determine purchaser role and authorization limit */
3055
3061
  user?: Contact | Customer;
3056
3062
  /** Configuration object passed to the component */
@@ -3165,6 +3171,14 @@ interface CartPaymethodsProps {
3165
3171
  currency?: string;
3166
3172
  /** Labels for the component */
3167
3173
  labels?: Record<string, string>;
3174
+ /**
3175
+ * Localized display names for payment methods, keyed by the method **code**
3176
+ * (lower-cased, e.g. `{ pickup: 'Bij afhalen', on_account: 'Op rekening' }`).
3177
+ * The backend `method.name` is often an un-localized English string (e.g.
3178
+ * "On pickup"), so this map lets the host override it per locale. Lookup
3179
+ * order: `paymethodLabels[code]` → `method.name` → `method.code`.
3180
+ */
3181
+ paymethodLabels?: Record<string, string>;
3168
3182
  }
3169
3183
  /**
3170
3184
  * Renders the cart's available payment methods as a selectable grid. Hides the
package/dist/index.js CHANGED
@@ -6910,6 +6910,7 @@ function CartIconAndSidebar(rawProps) {
6910
6910
  language: props.language,
6911
6911
  configuration: props.configuration,
6912
6912
  companyId: props.companyId,
6913
+ labels: props.cartItemLabels,
6913
6914
  cardFrame: false,
6914
6915
  showDelete: false,
6915
6916
  readOnlyQuantity: true,
@@ -7015,11 +7016,11 @@ function CartOverview(props) {
7015
7016
  function requestDate() {
7016
7017
  const date = props.cart?.postageData?.requestDate;
7017
7018
  if (!date) return "";
7018
- try {
7019
- return new Date(date).toLocaleDateString();
7020
- } catch {
7021
- return date;
7022
- }
7019
+ const d = new Date(date);
7020
+ if (isNaN(d.getTime())) return date;
7021
+ const day = String(d.getDate()).padStart(2, "0");
7022
+ const month = String(d.getMonth() + 1).padStart(2, "0");
7023
+ return `${day}-${month}-${d.getFullYear()}`;
7023
7024
  }
7024
7025
  function handleTermsLinkClick(event) {
7025
7026
  event.preventDefault();
@@ -7182,6 +7183,10 @@ function CartPaymethods(rawProps) {
7182
7183
  if (props.formatPrice) return props.formatPrice(price);
7183
7184
  return formatPrice(price || 0, { symbol: props.currency ?? "\u20AC" });
7184
7185
  }
7186
+ function methodName(method) {
7187
+ const code = (method.code || "").toLowerCase();
7188
+ return props.paymethodLabels?.[code] || method.name || method.code || "";
7189
+ }
7185
7190
  function handleSelect(method) {
7186
7191
  setSelectedCode(method.code);
7187
7192
  if (props.onPaymethodSelect) props.onPaymethodSelect(method);
@@ -7212,10 +7217,10 @@ function CartPaymethods(rawProps) {
7212
7217
  {
7213
7218
  className: "propeller-cart-paymethods__method-logo max-h-10 max-w-[80%] w-auto object-contain",
7214
7219
  src: logoUrl,
7215
- alt: method.name || method.code
7220
+ alt: methodName(method)
7216
7221
  }
7217
7222
  ) }) : null,
7218
- /* @__PURE__ */ jsx("span", { className: "propeller-cart-paymethods__method-name font-medium text-sm", children: method.name || method.code })
7223
+ /* @__PURE__ */ jsx("span", { className: "propeller-cart-paymethods__method-name font-medium text-sm", children: methodName(method) })
7219
7224
  ]
7220
7225
  },
7221
7226
  method.code
@@ -9672,10 +9677,11 @@ function FavoriteLists(rawProps) {
9672
9677
  if (props.formatDate) return props.formatDate(dateString);
9673
9678
  if (!dateString) return "-";
9674
9679
  const d = new Date(dateString);
9680
+ if (isNaN(d.getTime())) return dateString;
9675
9681
  const day = String(d.getDate()).padStart(2, "0");
9676
9682
  const month = String(d.getMonth() + 1).padStart(2, "0");
9677
9683
  const year = d.getFullYear();
9678
- return `${day}/${month}/${year}`;
9684
+ return `${day}-${month}-${year}`;
9679
9685
  }
9680
9686
  function getProductCount(list) {
9681
9687
  const products = list.products;
@@ -11820,7 +11826,11 @@ function OrderList(rawProps) {
11820
11826
  function formatDate(dateString) {
11821
11827
  if (props.formatDate) return props.formatDate(dateString);
11822
11828
  if (!dateString) return "-";
11823
- return new Date(dateString).toLocaleDateString();
11829
+ const d = new Date(dateString);
11830
+ if (isNaN(d.getTime())) return dateString;
11831
+ const day = String(d.getDate()).padStart(2, "0");
11832
+ const month = String(d.getMonth() + 1).padStart(2, "0");
11833
+ return `${day}-${month}-${d.getFullYear()}`;
11824
11834
  }
11825
11835
  function formatPrice17(price) {
11826
11836
  if (props.formatPrice) return props.formatPrice(price);
@@ -12257,7 +12267,10 @@ function OrderShipments(props) {
12257
12267
  function formatDate(dateStr) {
12258
12268
  if (!dateStr) return "-";
12259
12269
  const d = new Date(dateStr);
12260
- return `${d.getDate()}.${d.getMonth() + 1}.${d.getFullYear()}`;
12270
+ if (isNaN(d.getTime())) return dateStr;
12271
+ const day = String(d.getDate()).padStart(2, "0");
12272
+ const month = String(d.getMonth() + 1).padStart(2, "0");
12273
+ return `${day}-${month}-${d.getFullYear()}`;
12261
12274
  }
12262
12275
  function getOrderItemForShipmentItem(shipmentItem) {
12263
12276
  if (!props.order?.items || !shipmentItem.orderItemId) return null;
@@ -12474,15 +12487,18 @@ function OrderSummary(props) {
12474
12487
  }
12475
12488
  return formatPrice(price || 0, { symbol: props.currency ?? "\u20AC" });
12476
12489
  }
12490
+ function numericDate(dateString) {
12491
+ const d = new Date(dateString);
12492
+ if (isNaN(d.getTime())) return dateString;
12493
+ const day = String(d.getDate()).padStart(2, "0");
12494
+ const month = String(d.getMonth() + 1).padStart(2, "0");
12495
+ return `${day}-${month}-${d.getFullYear()}`;
12496
+ }
12477
12497
  function formatOrderDate(dateString) {
12478
12498
  if (props.formatDate) {
12479
12499
  return props.formatDate(dateString);
12480
12500
  }
12481
- try {
12482
- return new Date(dateString).toLocaleDateString("en-US");
12483
- } catch {
12484
- return dateString;
12485
- }
12501
+ return numericDate(dateString);
12486
12502
  }
12487
12503
  const requestDateRaw = order?.postageData?.requestDate;
12488
12504
  let requestDate = "";
@@ -12490,11 +12506,7 @@ function OrderSummary(props) {
12490
12506
  if (props.formatDate) {
12491
12507
  requestDate = props.formatDate(requestDateRaw);
12492
12508
  } else {
12493
- try {
12494
- requestDate = new Date(requestDateRaw).toLocaleDateString("en-US");
12495
- } catch {
12496
- requestDate = requestDateRaw;
12497
- }
12509
+ requestDate = numericDate(requestDateRaw);
12498
12510
  }
12499
12511
  }
12500
12512
  const getCountryName$1 = (code) => getCountryName(code, props.countries);
@@ -15915,7 +15927,10 @@ function PurchaseAuthorizationRequests(rawProps) {
15915
15927
  if (props.formatDate) return props.formatDate(dateStr);
15916
15928
  if (!dateStr) return "-";
15917
15929
  const d = new Date(dateStr);
15918
- return `${d.getDate()}.${d.getMonth() + 1}.${d.getFullYear()}`;
15930
+ if (isNaN(d.getTime())) return dateStr;
15931
+ const day = String(d.getDate()).padStart(2, "0");
15932
+ const month = String(d.getMonth() + 1).padStart(2, "0");
15933
+ return `${day}-${month}-${d.getFullYear()}`;
15919
15934
  }
15920
15935
  function formatPrice17(price) {
15921
15936
  if (props.formatPrice) return props.formatPrice(price);