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

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
@@ -2574,6 +2574,12 @@ interface AddressCardProps {
2574
2574
  enableSetDefault?: boolean;
2575
2575
  /** Display the "Default ... Address" badge @default false */
2576
2576
  showDefaultBadge?: boolean;
2577
+ /**
2578
+ * Display the address-type badge (invoice/delivery chip) @default true.
2579
+ * Set to `false` where the surrounding heading already names the address
2580
+ * type, to avoid a redundant raw-looking chip.
2581
+ */
2582
+ showTypeBadge?: boolean;
2577
2583
  /** Called when address is edited; receives the updated address object */
2578
2584
  onEdit?: (address: Address) => void | Promise<void>;
2579
2585
  /** Called after address edit completes */
@@ -4745,6 +4751,13 @@ interface OrderListProps {
4745
4751
  formatDate?: (dateString: string) => string;
4746
4752
  /** Get status color */
4747
4753
  getStatusColor?: (status: string) => string;
4754
+ /**
4755
+ * Localized display labels for order/quote statuses, keyed by the raw backend
4756
+ * status value (e.g. `{ NEW: 'Nieuw', CONFIRMED: 'Bevestigd', REQUEST:
4757
+ * 'Aangevraagd' }`). Unknown statuses fall back to the raw value. Without
4758
+ * this the list printed the raw enum (NEW/CONFIRMED/REQUEST) to the customer.
4759
+ */
4760
+ statusLabels?: Record<string, string>;
4748
4761
  /** Localization label overrides for UI strings. */
4749
4762
  labels?: {
4750
4763
  /** Text for the per-row "View" action button. */
@@ -4838,6 +4851,19 @@ interface OrderSummaryProps {
4838
4851
  formatDate?: (dateString: string) => string;
4839
4852
  /** Labels for the component */
4840
4853
  labels?: Record<string, string>;
4854
+ /**
4855
+ * Localized order/quote status labels, keyed by the raw backend status
4856
+ * (e.g. `{ NEW: 'Nieuw', REQUEST: 'Aangevraagd' }`). Unknown → raw value.
4857
+ */
4858
+ statusLabels?: Record<string, string>;
4859
+ /**
4860
+ * Localized payment-method names, keyed by the raw method value LOWER-CASED
4861
+ * (e.g. `{ rekening: 'Op rekening', account: 'Op rekening' }`). The backend
4862
+ * sends different raw values on the order vs quote path (REKENING / ACCOUNT),
4863
+ * so mapping both here makes the same method render identically. Unknown →
4864
+ * raw value.
4865
+ */
4866
+ paymethodLabels?: Record<string, string>;
4841
4867
  /** List of countries for resolving codes to names [{code: 'NL', name: 'Netherlands'}, ...] */
4842
4868
  countries?: {
4843
4869
  code: string;
package/dist/index.d.ts CHANGED
@@ -2574,6 +2574,12 @@ interface AddressCardProps {
2574
2574
  enableSetDefault?: boolean;
2575
2575
  /** Display the "Default ... Address" badge @default false */
2576
2576
  showDefaultBadge?: boolean;
2577
+ /**
2578
+ * Display the address-type badge (invoice/delivery chip) @default true.
2579
+ * Set to `false` where the surrounding heading already names the address
2580
+ * type, to avoid a redundant raw-looking chip.
2581
+ */
2582
+ showTypeBadge?: boolean;
2577
2583
  /** Called when address is edited; receives the updated address object */
2578
2584
  onEdit?: (address: Address) => void | Promise<void>;
2579
2585
  /** Called after address edit completes */
@@ -4745,6 +4751,13 @@ interface OrderListProps {
4745
4751
  formatDate?: (dateString: string) => string;
4746
4752
  /** Get status color */
4747
4753
  getStatusColor?: (status: string) => string;
4754
+ /**
4755
+ * Localized display labels for order/quote statuses, keyed by the raw backend
4756
+ * status value (e.g. `{ NEW: 'Nieuw', CONFIRMED: 'Bevestigd', REQUEST:
4757
+ * 'Aangevraagd' }`). Unknown statuses fall back to the raw value. Without
4758
+ * this the list printed the raw enum (NEW/CONFIRMED/REQUEST) to the customer.
4759
+ */
4760
+ statusLabels?: Record<string, string>;
4748
4761
  /** Localization label overrides for UI strings. */
4749
4762
  labels?: {
4750
4763
  /** Text for the per-row "View" action button. */
@@ -4838,6 +4851,19 @@ interface OrderSummaryProps {
4838
4851
  formatDate?: (dateString: string) => string;
4839
4852
  /** Labels for the component */
4840
4853
  labels?: Record<string, string>;
4854
+ /**
4855
+ * Localized order/quote status labels, keyed by the raw backend status
4856
+ * (e.g. `{ NEW: 'Nieuw', REQUEST: 'Aangevraagd' }`). Unknown → raw value.
4857
+ */
4858
+ statusLabels?: Record<string, string>;
4859
+ /**
4860
+ * Localized payment-method names, keyed by the raw method value LOWER-CASED
4861
+ * (e.g. `{ rekening: 'Op rekening', account: 'Op rekening' }`). The backend
4862
+ * sends different raw values on the order vs quote path (REKENING / ACCOUNT),
4863
+ * so mapping both here makes the same method render identically. Unknown →
4864
+ * raw value.
4865
+ */
4866
+ paymethodLabels?: Record<string, string>;
4841
4867
  /** List of countries for resolving codes to names [{code: 'NL', name: 'Netherlands'}, ...] */
4842
4868
  countries?: {
4843
4869
  code: string;
package/dist/index.js CHANGED
@@ -3258,10 +3258,15 @@ function LoginForm(rawProps) {
3258
3258
  ] }) : null,
3259
3259
  props.accountHeaderLoginForm ? /* @__PURE__ */ jsxs("div", { className: "propeller-login-form__footer flex flex-col gap-2 text-sm pt-3 text-center", children: [
3260
3260
  /* @__PURE__ */ jsx(LoginFormForgotPasswordLink, {}),
3261
- /* @__PURE__ */ jsxs("div", { className: "propeller-login-form__register text-xs text-muted-foreground", children: [
3262
- getLabel(props.labels, "noAccount", "Don't have an account?"),
3263
- /* @__PURE__ */ jsx(LoginFormRegisterLink, {})
3264
- ] })
3261
+ /* @__PURE__ */ jsx("div", { className: "propeller-login-form__register text-xs text-muted-foreground", children: (() => {
3262
+ const tpl = getLabel(props.labels, "noAccount", "Don't have an account? {link}");
3263
+ const [before, after = ""] = tpl.split("{link}");
3264
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
3265
+ before,
3266
+ /* @__PURE__ */ jsx(LoginFormRegisterLink, {}),
3267
+ after
3268
+ ] });
3269
+ })() })
3265
3270
  ] }) : null
3266
3271
  ]
3267
3272
  }
@@ -5430,7 +5435,8 @@ function AddressCard(rawProps) {
5430
5435
  ] });
5431
5436
  }
5432
5437
  function AddressCardTypeBadge(props) {
5433
- const { derived } = useAddressCardContext();
5438
+ const { derived, resolved } = useAddressCardContext();
5439
+ if (resolved.showTypeBadge === false) return null;
5434
5440
  if (!derived.addressType) return null;
5435
5441
  return /* @__PURE__ */ jsx(
5436
5442
  "span",
@@ -7129,18 +7135,23 @@ function CartOverview(props) {
7129
7135
  onChange: (event) => setTermsAccepted(event.target.checked)
7130
7136
  }
7131
7137
  ),
7132
- /* @__PURE__ */ jsxs("label", { htmlFor: "cart-overview-terms", className: "text-sm leading-none", children: [
7133
- getLabel(props.labels, "termsPrefix", "I agree to the"),
7134
- /* @__PURE__ */ jsx(
7135
- "a",
7136
- {
7137
- href: "#",
7138
- className: "text-primary hover:underline font-medium",
7139
- onClick: handleTermsLinkClick,
7140
- children: getLabel(props.labels, "termsLink", "Terms and Conditions")
7141
- }
7142
- )
7143
- ] })
7138
+ /* @__PURE__ */ jsx("label", { htmlFor: "cart-overview-terms", className: "text-sm leading-none", children: (() => {
7139
+ const tpl = getLabel(props.labels, "termsConsent", "I agree to the {link}");
7140
+ const [before, after = ""] = tpl.split("{link}");
7141
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
7142
+ before,
7143
+ /* @__PURE__ */ jsx(
7144
+ "a",
7145
+ {
7146
+ href: "#",
7147
+ className: "text-primary hover:underline font-medium",
7148
+ onClick: handleTermsLinkClick,
7149
+ children: getLabel(props.labels, "termsLink", "Terms and Conditions")
7150
+ }
7151
+ ),
7152
+ after
7153
+ ] });
7154
+ })() })
7144
7155
  ] }) : null,
7145
7156
  showPurchaseButton ? /* @__PURE__ */ jsxs(
7146
7157
  "button",
@@ -9905,7 +9916,7 @@ function FavoriteLists(rawProps) {
9905
9916
  ),
9906
9917
  getTotalCount(list),
9907
9918
  "\xA0",
9908
- getLabel(props.labels, "items", "items")
9919
+ getTotalCount(list) === 1 ? getLabel(props.labels, "itemSingular", "item") : getLabel(props.labels, "itemPlural", "items")
9909
9920
  ] }) : null
9910
9921
  ] })
9911
9922
  ] }) : null
@@ -10089,15 +10100,15 @@ function FavoriteLists(rawProps) {
10089
10100
  )
10090
10101
  ] }),
10091
10102
  /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
10092
- /* @__PURE__ */ jsxs("p", { className: "propeller-favorite-lists__delete-prompt", children: [
10093
- getLabel(props.labels, "deleteConfirm", "Are you sure you want to delete"),
10094
- /* @__PURE__ */ jsxs("strong", { children: [
10095
- '"',
10096
- listToDelete?.name,
10097
- '"'
10098
- ] }),
10099
- "?"
10100
- ] }),
10103
+ /* @__PURE__ */ jsx("p", { className: "propeller-favorite-lists__delete-prompt", children: (() => {
10104
+ const tpl = getLabel(props.labels, "deleteConfirm", 'Are you sure you want to delete "{name}"?');
10105
+ const [before, after = ""] = tpl.split("{name}");
10106
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
10107
+ before,
10108
+ /* @__PURE__ */ jsx("strong", { children: listToDelete?.name }),
10109
+ after
10110
+ ] });
10111
+ })() }),
10101
10112
  /* @__PURE__ */ jsx("p", { className: "propeller-favorite-lists__delete-warning text-sm text-destructive", children: getLabel(props.labels, "deleteWarning", "This action cannot be undone.") })
10102
10113
  ] }),
10103
10114
  /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-3 pt-6", children: [
@@ -10681,6 +10692,8 @@ var DEFAULT_LABELS2 = {
10681
10692
  [SortOrder.DESC]: "High to Low",
10682
10693
  clearAll: "Clear All",
10683
10694
  products: " Products",
10695
+ productSingular: "Product",
10696
+ productPlural: "Products",
10684
10697
  from: "from",
10685
10698
  results: "results",
10686
10699
  perPage: " per page",
@@ -10774,7 +10787,8 @@ function GridToolbar(rawProps) {
10774
10787
  /* @__PURE__ */ jsxs("div", { className: "propeller-grid-toolbar__bar flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4 mb-4", children: [
10775
10788
  /* @__PURE__ */ jsx("div", { className: "propeller-grid-toolbar__count text-sm text-muted-foreground font-medium", children: props.itemsFound > 0 ? /* @__PURE__ */ jsxs("span", { children: [
10776
10789
  props.itemsFound,
10777
- getLabel53("products")
10790
+ "\xA0",
10791
+ props.itemsFound === 1 ? getLabel53("productSingular") : getLabel53("productPlural")
10778
10792
  ] }) : null }),
10779
10793
  /* @__PURE__ */ jsxs("div", { className: "propeller-grid-toolbar__controls flex flex-wrap items-center gap-3", children: [
10780
10794
  /* @__PURE__ */ jsx(
@@ -11850,6 +11864,9 @@ function OrderList(rawProps) {
11850
11864
  return "bg-warning/10 text-warning";
11851
11865
  }
11852
11866
  }
11867
+ function statusLabel(status) {
11868
+ return props.statusLabels?.[status] || status;
11869
+ }
11853
11870
  function getColumnLabel(col) {
11854
11871
  if (props.columnConfig && props.columnConfig[col]) {
11855
11872
  return props.columnConfig[col];
@@ -12170,7 +12187,7 @@ function OrderList(rawProps) {
12170
12187
  {
12171
12188
  className: `propeller-order-list__status px-2 inline-flex text-xs leading-5 font-semibold rounded-full ${getStatusColor(order.status)}`,
12172
12189
  "data-status": order.status,
12173
- children: order.status
12190
+ children: statusLabel(order.status)
12174
12191
  }
12175
12192
  ) : null,
12176
12193
  col === "total" ? /* @__PURE__ */ jsx(Fragment, { children: formatPrice17(order.total?.net) }) : null,
@@ -12472,11 +12489,13 @@ function OrderSummary(props) {
12472
12489
  const showRemarks = props.showRemarks !== void 0 ? props.showRemarks : true;
12473
12490
  const orderNumber = order?.id || "";
12474
12491
  const orderDate = order?.createdAt || "";
12475
- const orderStatus = order?.status || "";
12492
+ const rawStatus = order?.status || "";
12493
+ const orderStatus = rawStatus ? props.statusLabels?.[rawStatus] || rawStatus : "";
12476
12494
  const orderTotal = Number(order?.total?.net || 0);
12477
12495
  const orderReference = order?.reference || "";
12478
12496
  const orderRemarks = order?.remarks || "";
12479
- const paymentMethod = order?.paymentData?.method || "";
12497
+ const rawPaymentMethod = order?.paymentData?.method || "";
12498
+ const paymentMethod = rawPaymentMethod ? props.paymethodLabels?.[rawPaymentMethod.toLowerCase()] || rawPaymentMethod : "";
12480
12499
  const carrierName = order?.postageData?.carrier || "";
12481
12500
  const addresses = order?.addresses || [];
12482
12501
  const invoiceAddress = addresses.find((a) => a.type === "invoice") || null;
@@ -16164,18 +16183,23 @@ function QuoteActions(rawProps) {
16164
16183
  onChange: (event) => handleTermsChange(event.target.checked)
16165
16184
  }
16166
16185
  ),
16167
- /* @__PURE__ */ jsxs("label", { htmlFor: "quote-actions-terms", className: "text-sm leading-none", children: [
16168
- getLabel(props.labels, "termsPrefix", "I agree to the"),
16169
- /* @__PURE__ */ jsx(
16170
- "a",
16171
- {
16172
- href: "#",
16173
- className: "text-primary hover:underline font-medium",
16174
- onClick: (event) => handleTermsLinkClick(event),
16175
- children: getLabel(props.labels, "termsLink", "Terms and Conditions")
16176
- }
16177
- )
16178
- ] })
16186
+ /* @__PURE__ */ jsx("label", { htmlFor: "quote-actions-terms", className: "text-sm leading-none", children: (() => {
16187
+ const tpl = getLabel(props.labels, "termsConsent", "I agree to the {link}");
16188
+ const [before, after = ""] = tpl.split("{link}");
16189
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
16190
+ before,
16191
+ /* @__PURE__ */ jsx(
16192
+ "a",
16193
+ {
16194
+ href: "#",
16195
+ className: "text-primary hover:underline font-medium",
16196
+ onClick: (event) => handleTermsLinkClick(event),
16197
+ children: getLabel(props.labels, "termsLink", "Terms and Conditions")
16198
+ }
16199
+ ),
16200
+ after
16201
+ ] });
16202
+ })() })
16179
16203
  ] }) : null,
16180
16204
  /* @__PURE__ */ jsxs(
16181
16205
  "button",