@asteby/storefront-react 0.23.0 → 0.25.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/dist/account.css CHANGED
@@ -259,6 +259,14 @@
259
259
  border-top: 1px solid var(--sf-account-line, color-mix(in srgb, currentColor 14%, transparent));
260
260
  }
261
261
 
262
+ /* Paquetería sobre el nombre del envío (el texto lo escribe `shipment.carrier`). */
263
+ [data-sf-shipment-eyebrow] {
264
+ display: block;
265
+ font-size: 0.75em;
266
+ font-weight: 500;
267
+ color: var(--sf-account-muted, color-mix(in srgb, currentColor 72%, transparent));
268
+ }
269
+
262
270
  /*
263
271
  * <ProductThumb>, <ProductPreview>, <ProductThumbStack>: la foto del producto y la línea de producto de la tienda.
264
272
  * CSS plano sobre los tokens de la tienda (--foreground, --background, --border, --muted-foreground, --radius); en tema
@@ -292,6 +292,18 @@ declare const ES: {
292
292
  readonly 'payment.status.partially_refunded': "Reembolsado parcialmente";
293
293
  readonly 'payment.status.unknown': "En proceso";
294
294
  readonly 'payment.paidOn': "Pagado el {date}";
295
+ readonly 'payment.method.card': "Tarjeta";
296
+ readonly 'payment.method.credit_card': "Tarjeta de crédito";
297
+ readonly 'payment.method.debit_card': "Tarjeta de débito";
298
+ readonly 'payment.method.cash_voucher': "Efectivo con ficha (OXXO, tienda de conveniencia)";
299
+ readonly 'payment.method.oxxo': "Efectivo en OXXO";
300
+ readonly 'payment.method.spei': "Transferencia SPEI";
301
+ readonly 'payment.method.transfer': "Transferencia bancaria";
302
+ readonly 'payment.method.bank_deposit': "Depósito bancario";
303
+ readonly 'payment.method.wallet': "Billetera digital";
304
+ readonly 'payment.method.cash': "Efectivo";
305
+ readonly 'payment.method.other': "Otro medio de pago";
306
+ readonly 'payment.method.unknown': "Medio de pago";
295
307
  readonly 'section.error': "No pudimos cargar esta sección.";
296
308
  readonly 'section.retry': "Reintentar";
297
309
  readonly 'section.loading': "Cargando";
@@ -502,6 +514,26 @@ type PendingPaymentListProps = AccountTextProps & Pick<PendingPaymentCardProps,
502
514
  /** "Pendientes de pago": the valid vouchers first, then the expired ones. Renders nothing when there are none. */
503
515
  declare function PendingPaymentList({ payments, voucherHref, shopName, classNames, listClassNames: lc, headingLevel, ...text }: PendingPaymentListProps): react.JSX.Element | null;
504
516
 
517
+ /**
518
+ * The friendly name of how an order was paid. The server sends `family` (a short enum) and `method_label` (its own
519
+ * text, which an older or English-locale server may fill with the provider's raw word: `Card`, `credit_card`, `oxxo`).
520
+ * The buyer never reads a raw provider key: the label is built from the SDK's texts (es/en), extended by the store.
521
+ */
522
+
523
+ type PaymentMethodKey = 'card' | 'credit_card' | 'debit_card' | 'cash_voucher' | 'oxxo' | 'spei' | 'transfer' | 'bank_deposit' | 'wallet' | 'cash' | 'other';
524
+ /** The method family of a payment (`card`, `oxxo`, `spei`...), for the store's own icon or styling; `null` when unknown. */
525
+ declare function paymentMethodKey(p: PaymentInfo): PaymentMethodKey | null;
526
+ type PaymentLabelOptions = {
527
+ /** The store's own words for a payment (by organization, provider...). Return a string to use it; `null`/`undefined` falls through to the SDK's. */
528
+ override?: (payment: PaymentInfo) => string | null | undefined;
529
+ };
530
+ /**
531
+ * `Tarjeta Visa •••• 1234`, `Efectivo con ficha (OXXO…)`, `Transferencia SPEI`… in the buyer's language. A label the
532
+ * server already wrote as a sentence (it carries its own detail) is kept; a raw key becomes a readable text and never
533
+ * shows as it came; with nothing to go on, a neutral "Medio de pago".
534
+ */
535
+ declare function paymentLabel(p: PaymentInfo, m: AccountMessages, options?: PaymentLabelOptions): string;
536
+
505
537
  type RefundListClassNames = Partial<Record<'root' | 'title' | 'list' | 'item' | 'amount' | 'status' | 'meta' | 'empty' | 'error' | 'retry', string>>;
506
538
  type RefundListProps = AccountTextProps & {
507
539
  refunds?: readonly Refund[] | null;
@@ -517,10 +549,12 @@ declare function RefundList({ refunds, showEmpty, degraded, onRetry, headingLeve
517
549
  type PaymentSummaryProps = AccountTextProps & {
518
550
  payments?: readonly PaymentInfo[] | null;
519
551
  headingLevel?: 2 | 3 | 4;
552
+ /** The store's own name for a payment (by organization, provider...); `null` falls through to the SDK's es/en text. */
553
+ methodLabel?: PaymentLabelOptions['override'];
520
554
  classNames?: Partial<Record<'root' | 'title' | 'list' | 'item' | 'status' | 'meta', string>>;
521
555
  };
522
556
  /** What the buyer paid with (card, voucher...) and its status. Renders nothing when the order has no payments. */
523
- declare function PaymentSummary({ payments, headingLevel, classNames: cx, ...text }: PaymentSummaryProps): react.JSX.Element | null;
557
+ declare function PaymentSummary({ payments, headingLevel, methodLabel, classNames: cx, ...text }: PaymentSummaryProps): react.JSX.Element | null;
524
558
 
525
559
  /**
526
560
  * Data hooks of the account screens. They talk to the client of the `StorefrontProvider` (or `client`), which must carry
@@ -623,4 +657,4 @@ declare function barcodeGeometry(value: string, opts?: {
623
657
  height?: number;
624
658
  }): BarcodeGeometry | null;
625
659
 
626
- export { AccountAuth, type AccountAuthClassNames, type AccountAuthMessages, type AccountAuthProps, type AccountAuthView, type AccountFormProps, type AccountMessageKey, type AccountMessages, type AccountStatus, type AccountTextProps, AuthActionData, AuthErrorCode, AuthStep, Barcode, type BarcodeGeometry, type BarcodeProps, InvoiceList, type InvoiceListClassNames, type InvoiceListProps, NextActionBar, type NextActionBarClassNames, type NextActionBarProps, OrderCard, type OrderCardClassNames, type OrderCardProps, OrderLines, type OrderLinesClassNames, type OrderLinesProps, OrderList, type OrderListClassNames, type OrderListProps, OrderProductsStack, OrderProgress, type OrderProgressClassNames, type OrderProgressProps, OrderStatusBadge, type OrderStatusBadgeProps, type OrderTone, PaymentSummary, type PaymentSummaryProps, PendingPaymentCard, type PendingPaymentCardClassNames, type PendingPaymentCardProps, PendingPaymentList, type PendingPaymentListProps, PostPurchaseAccountPrompt, type PostPurchaseAccountPromptClassNames, type PostPurchaseAccountPromptMessages, type PostPurchaseAccountPromptProps, RefundList, type RefundListClassNames, type RefundListProps, ShipmentCard, type ShipmentCardClassNames, type ShipmentCardProps, type ShipmentMapSlotProps, type UseConnectionResult, type UseCustomerOrderOptions, type UseCustomerOrderResult, type UseCustomerOrdersOptions, type UsePendingPaymentsOptions, type VoucherView, accountAuthMessages, accountMessages, barcodeGeometry, barcodeValue, code128Modules, enumText, lineImage, postPurchaseAccountPromptMessages, stageTone, useCustomerOrder, useCustomerOrders, usePendingPayments, voucherOf };
660
+ export { AccountAuth, type AccountAuthClassNames, type AccountAuthMessages, type AccountAuthProps, type AccountAuthView, type AccountFormProps, type AccountMessageKey, type AccountMessages, type AccountStatus, type AccountTextProps, AuthActionData, AuthErrorCode, AuthStep, Barcode, type BarcodeGeometry, type BarcodeProps, InvoiceList, type InvoiceListClassNames, type InvoiceListProps, NextActionBar, type NextActionBarClassNames, type NextActionBarProps, OrderCard, type OrderCardClassNames, type OrderCardProps, OrderLines, type OrderLinesClassNames, type OrderLinesProps, OrderList, type OrderListClassNames, type OrderListProps, OrderProductsStack, OrderProgress, type OrderProgressClassNames, type OrderProgressProps, OrderStatusBadge, type OrderStatusBadgeProps, type OrderTone, type PaymentLabelOptions, type PaymentMethodKey, PaymentSummary, type PaymentSummaryProps, PendingPaymentCard, type PendingPaymentCardClassNames, type PendingPaymentCardProps, PendingPaymentList, type PendingPaymentListProps, PostPurchaseAccountPrompt, type PostPurchaseAccountPromptClassNames, type PostPurchaseAccountPromptMessages, type PostPurchaseAccountPromptProps, RefundList, type RefundListClassNames, type RefundListProps, ShipmentCard, type ShipmentCardClassNames, type ShipmentCardProps, type ShipmentMapSlotProps, type UseConnectionResult, type UseCustomerOrderOptions, type UseCustomerOrderResult, type UseCustomerOrdersOptions, type UsePendingPaymentsOptions, type VoucherView, accountAuthMessages, accountMessages, barcodeGeometry, barcodeValue, code128Modules, enumText, lineImage, paymentLabel, paymentMethodKey, postPurchaseAccountPromptMessages, stageTone, useCustomerOrder, useCustomerOrders, usePendingPayments, voucherOf };
package/dist/account.d.ts CHANGED
@@ -292,6 +292,18 @@ declare const ES: {
292
292
  readonly 'payment.status.partially_refunded': "Reembolsado parcialmente";
293
293
  readonly 'payment.status.unknown': "En proceso";
294
294
  readonly 'payment.paidOn': "Pagado el {date}";
295
+ readonly 'payment.method.card': "Tarjeta";
296
+ readonly 'payment.method.credit_card': "Tarjeta de crédito";
297
+ readonly 'payment.method.debit_card': "Tarjeta de débito";
298
+ readonly 'payment.method.cash_voucher': "Efectivo con ficha (OXXO, tienda de conveniencia)";
299
+ readonly 'payment.method.oxxo': "Efectivo en OXXO";
300
+ readonly 'payment.method.spei': "Transferencia SPEI";
301
+ readonly 'payment.method.transfer': "Transferencia bancaria";
302
+ readonly 'payment.method.bank_deposit': "Depósito bancario";
303
+ readonly 'payment.method.wallet': "Billetera digital";
304
+ readonly 'payment.method.cash': "Efectivo";
305
+ readonly 'payment.method.other': "Otro medio de pago";
306
+ readonly 'payment.method.unknown': "Medio de pago";
295
307
  readonly 'section.error': "No pudimos cargar esta sección.";
296
308
  readonly 'section.retry': "Reintentar";
297
309
  readonly 'section.loading': "Cargando";
@@ -502,6 +514,26 @@ type PendingPaymentListProps = AccountTextProps & Pick<PendingPaymentCardProps,
502
514
  /** "Pendientes de pago": the valid vouchers first, then the expired ones. Renders nothing when there are none. */
503
515
  declare function PendingPaymentList({ payments, voucherHref, shopName, classNames, listClassNames: lc, headingLevel, ...text }: PendingPaymentListProps): react.JSX.Element | null;
504
516
 
517
+ /**
518
+ * The friendly name of how an order was paid. The server sends `family` (a short enum) and `method_label` (its own
519
+ * text, which an older or English-locale server may fill with the provider's raw word: `Card`, `credit_card`, `oxxo`).
520
+ * The buyer never reads a raw provider key: the label is built from the SDK's texts (es/en), extended by the store.
521
+ */
522
+
523
+ type PaymentMethodKey = 'card' | 'credit_card' | 'debit_card' | 'cash_voucher' | 'oxxo' | 'spei' | 'transfer' | 'bank_deposit' | 'wallet' | 'cash' | 'other';
524
+ /** The method family of a payment (`card`, `oxxo`, `spei`...), for the store's own icon or styling; `null` when unknown. */
525
+ declare function paymentMethodKey(p: PaymentInfo): PaymentMethodKey | null;
526
+ type PaymentLabelOptions = {
527
+ /** The store's own words for a payment (by organization, provider...). Return a string to use it; `null`/`undefined` falls through to the SDK's. */
528
+ override?: (payment: PaymentInfo) => string | null | undefined;
529
+ };
530
+ /**
531
+ * `Tarjeta Visa •••• 1234`, `Efectivo con ficha (OXXO…)`, `Transferencia SPEI`… in the buyer's language. A label the
532
+ * server already wrote as a sentence (it carries its own detail) is kept; a raw key becomes a readable text and never
533
+ * shows as it came; with nothing to go on, a neutral "Medio de pago".
534
+ */
535
+ declare function paymentLabel(p: PaymentInfo, m: AccountMessages, options?: PaymentLabelOptions): string;
536
+
505
537
  type RefundListClassNames = Partial<Record<'root' | 'title' | 'list' | 'item' | 'amount' | 'status' | 'meta' | 'empty' | 'error' | 'retry', string>>;
506
538
  type RefundListProps = AccountTextProps & {
507
539
  refunds?: readonly Refund[] | null;
@@ -517,10 +549,12 @@ declare function RefundList({ refunds, showEmpty, degraded, onRetry, headingLeve
517
549
  type PaymentSummaryProps = AccountTextProps & {
518
550
  payments?: readonly PaymentInfo[] | null;
519
551
  headingLevel?: 2 | 3 | 4;
552
+ /** The store's own name for a payment (by organization, provider...); `null` falls through to the SDK's es/en text. */
553
+ methodLabel?: PaymentLabelOptions['override'];
520
554
  classNames?: Partial<Record<'root' | 'title' | 'list' | 'item' | 'status' | 'meta', string>>;
521
555
  };
522
556
  /** What the buyer paid with (card, voucher...) and its status. Renders nothing when the order has no payments. */
523
- declare function PaymentSummary({ payments, headingLevel, classNames: cx, ...text }: PaymentSummaryProps): react.JSX.Element | null;
557
+ declare function PaymentSummary({ payments, headingLevel, methodLabel, classNames: cx, ...text }: PaymentSummaryProps): react.JSX.Element | null;
524
558
 
525
559
  /**
526
560
  * Data hooks of the account screens. They talk to the client of the `StorefrontProvider` (or `client`), which must carry
@@ -623,4 +657,4 @@ declare function barcodeGeometry(value: string, opts?: {
623
657
  height?: number;
624
658
  }): BarcodeGeometry | null;
625
659
 
626
- export { AccountAuth, type AccountAuthClassNames, type AccountAuthMessages, type AccountAuthProps, type AccountAuthView, type AccountFormProps, type AccountMessageKey, type AccountMessages, type AccountStatus, type AccountTextProps, AuthActionData, AuthErrorCode, AuthStep, Barcode, type BarcodeGeometry, type BarcodeProps, InvoiceList, type InvoiceListClassNames, type InvoiceListProps, NextActionBar, type NextActionBarClassNames, type NextActionBarProps, OrderCard, type OrderCardClassNames, type OrderCardProps, OrderLines, type OrderLinesClassNames, type OrderLinesProps, OrderList, type OrderListClassNames, type OrderListProps, OrderProductsStack, OrderProgress, type OrderProgressClassNames, type OrderProgressProps, OrderStatusBadge, type OrderStatusBadgeProps, type OrderTone, PaymentSummary, type PaymentSummaryProps, PendingPaymentCard, type PendingPaymentCardClassNames, type PendingPaymentCardProps, PendingPaymentList, type PendingPaymentListProps, PostPurchaseAccountPrompt, type PostPurchaseAccountPromptClassNames, type PostPurchaseAccountPromptMessages, type PostPurchaseAccountPromptProps, RefundList, type RefundListClassNames, type RefundListProps, ShipmentCard, type ShipmentCardClassNames, type ShipmentCardProps, type ShipmentMapSlotProps, type UseConnectionResult, type UseCustomerOrderOptions, type UseCustomerOrderResult, type UseCustomerOrdersOptions, type UsePendingPaymentsOptions, type VoucherView, accountAuthMessages, accountMessages, barcodeGeometry, barcodeValue, code128Modules, enumText, lineImage, postPurchaseAccountPromptMessages, stageTone, useCustomerOrder, useCustomerOrders, usePendingPayments, voucherOf };
660
+ export { AccountAuth, type AccountAuthClassNames, type AccountAuthMessages, type AccountAuthProps, type AccountAuthView, type AccountFormProps, type AccountMessageKey, type AccountMessages, type AccountStatus, type AccountTextProps, AuthActionData, AuthErrorCode, AuthStep, Barcode, type BarcodeGeometry, type BarcodeProps, InvoiceList, type InvoiceListClassNames, type InvoiceListProps, NextActionBar, type NextActionBarClassNames, type NextActionBarProps, OrderCard, type OrderCardClassNames, type OrderCardProps, OrderLines, type OrderLinesClassNames, type OrderLinesProps, OrderList, type OrderListClassNames, type OrderListProps, OrderProductsStack, OrderProgress, type OrderProgressClassNames, type OrderProgressProps, OrderStatusBadge, type OrderStatusBadgeProps, type OrderTone, type PaymentLabelOptions, type PaymentMethodKey, PaymentSummary, type PaymentSummaryProps, PendingPaymentCard, type PendingPaymentCardClassNames, type PendingPaymentCardProps, PendingPaymentList, type PendingPaymentListProps, PostPurchaseAccountPrompt, type PostPurchaseAccountPromptClassNames, type PostPurchaseAccountPromptMessages, type PostPurchaseAccountPromptProps, RefundList, type RefundListClassNames, type RefundListProps, ShipmentCard, type ShipmentCardClassNames, type ShipmentCardProps, type ShipmentMapSlotProps, type UseConnectionResult, type UseCustomerOrderOptions, type UseCustomerOrderResult, type UseCustomerOrdersOptions, type UsePendingPaymentsOptions, type VoucherView, accountAuthMessages, accountMessages, barcodeGeometry, barcodeValue, code128Modules, enumText, lineImage, paymentLabel, paymentMethodKey, postPurchaseAccountPromptMessages, stageTone, useCustomerOrder, useCustomerOrders, usePendingPayments, voucherOf };
package/dist/account.js CHANGED
@@ -1,4 +1,4 @@
1
- import { fill } from './chunk-VE7WQPMY.js';
1
+ import { fill } from './chunk-5XYQLOE3.js';
2
2
  import { barcodeGeometry, voucherOf, barcodeValue } from './chunk-TXEYBDFG.js';
3
3
  export { barcodeGeometry, barcodeValue, code128Modules, voucherOf } from './chunk-TXEYBDFG.js';
4
4
  import { useFieldErrors, CheckoutField, ErrorSummary } from './chunk-DFGLCIEG.js';
@@ -493,6 +493,18 @@ var ES3 = {
493
493
  "payment.status.partially_refunded": "Reembolsado parcialmente",
494
494
  "payment.status.unknown": "En proceso",
495
495
  "payment.paidOn": "Pagado el {date}",
496
+ "payment.method.card": "Tarjeta",
497
+ "payment.method.credit_card": "Tarjeta de cr\xE9dito",
498
+ "payment.method.debit_card": "Tarjeta de d\xE9bito",
499
+ "payment.method.cash_voucher": "Efectivo con ficha (OXXO, tienda de conveniencia)",
500
+ "payment.method.oxxo": "Efectivo en OXXO",
501
+ "payment.method.spei": "Transferencia SPEI",
502
+ "payment.method.transfer": "Transferencia bancaria",
503
+ "payment.method.bank_deposit": "Dep\xF3sito bancario",
504
+ "payment.method.wallet": "Billetera digital",
505
+ "payment.method.cash": "Efectivo",
506
+ "payment.method.other": "Otro medio de pago",
507
+ "payment.method.unknown": "Medio de pago",
496
508
  // sections
497
509
  "section.error": "No pudimos cargar esta secci\xF3n.",
498
510
  "section.retry": "Reintentar",
@@ -653,6 +665,18 @@ var EN3 = {
653
665
  "payment.status.partially_refunded": "Partially refunded",
654
666
  "payment.status.unknown": "In progress",
655
667
  "payment.paidOn": "Paid on {date}",
668
+ "payment.method.card": "Card",
669
+ "payment.method.credit_card": "Credit card",
670
+ "payment.method.debit_card": "Debit card",
671
+ "payment.method.cash_voucher": "Cash with a voucher (OXXO, convenience store)",
672
+ "payment.method.oxxo": "Cash at OXXO",
673
+ "payment.method.spei": "SPEI transfer",
674
+ "payment.method.transfer": "Bank transfer",
675
+ "payment.method.bank_deposit": "Bank deposit",
676
+ "payment.method.wallet": "Digital wallet",
677
+ "payment.method.cash": "Cash",
678
+ "payment.method.other": "Other payment method",
679
+ "payment.method.unknown": "Payment method",
656
680
  "section.error": "We could not load this section.",
657
681
  "section.retry": "Try again",
658
682
  "section.loading": "Loading"
@@ -982,6 +1006,10 @@ function ShipmentCard({ shipment, testMode = "hide", eventsPreview = 3, renderCa
982
1006
  /* @__PURE__ */ jsxs("header", { className: cx.header, "data-sf-shipment-header": true, children: [
983
1007
  renderCarrierMark && !test ? /* @__PURE__ */ jsx("span", { "data-sf-shipment-mark": true, children: renderCarrierMark(shipment) }) : null,
984
1008
  /* @__PURE__ */ jsxs(Heading, { id: titleId, className: cx.carrier, "data-sf-shipment-title": true, children: [
1009
+ carrier && !test ? /* @__PURE__ */ jsxs("span", { "data-sf-shipment-eyebrow": true, children: [
1010
+ m["shipment.carrier"],
1011
+ /* @__PURE__ */ jsx(Hidden, { children: ": " })
1012
+ ] }) : null,
985
1013
  isReturn ? m["shipment.return"] : carrier ?? m["shipment.title"],
986
1014
  isReturn && carrier ? /* @__PURE__ */ jsxs(Fragment, { children: [
987
1015
  " \xB7 ",
@@ -1225,6 +1253,69 @@ function PendingPaymentList({ payments, voucherHref, shopName, classNames, listC
1225
1253
  /* @__PURE__ */ jsx("ul", { className: lc.list, children: sorted.map((p) => /* @__PURE__ */ jsx("li", { className: lc.item, children: /* @__PURE__ */ jsx(PendingPaymentCard, { payment: p, ...voucherHref ? { voucherHref } : {}, ...shopName ? { shopName } : {}, ...classNames ? { classNames } : {}, headingLevel: cardHeading, ...text }) }, p.id)) })
1226
1254
  ] });
1227
1255
  }
1256
+
1257
+ // src/account/payment-method.ts
1258
+ var FAMILY = {
1259
+ card: "card",
1260
+ credit_card: "credit_card",
1261
+ debit_card: "debit_card",
1262
+ cash_voucher: "cash_voucher",
1263
+ oxxo: "oxxo",
1264
+ spei: "spei",
1265
+ transfer: "transfer",
1266
+ bank_transfer: "transfer",
1267
+ bank_deposit: "bank_deposit",
1268
+ wallet: "wallet",
1269
+ cash: "cash",
1270
+ other: "other"
1271
+ };
1272
+ var KEYWORDS = [
1273
+ [/oxxo/, "oxxo"],
1274
+ [/spei/, "spei"],
1275
+ [/d[eé]bit/, "debit_card"],
1276
+ [/cr[eé]dit/, "credit_card"],
1277
+ [/card|tarjeta/, "card"],
1278
+ [/deposit|dep[oó]sito/, "bank_deposit"],
1279
+ [/transfer/, "transfer"],
1280
+ [/wallet|billetera|paypal|mercado ?pago|apple ?pay|google ?pay/, "wallet"],
1281
+ [/voucher|ficha|convenience|conveniencia|store|tienda/, "cash_voucher"],
1282
+ [/cash|efectivo/, "cash"]
1283
+ ];
1284
+ var BRANDS = { visa: "Visa", mastercard: "Mastercard", master: "Mastercard", amex: "American Express", american_express: "American Express", carnet: "Carnet", discover: "Discover" };
1285
+ var RAW = /^[A-Za-z0-9_.:-]+(?: [A-Za-z0-9_.:-]+)?$/;
1286
+ function paymentMethodKey(p) {
1287
+ return keyOf(p);
1288
+ }
1289
+ function keyOf(p) {
1290
+ const fam = typeof p.family === "string" ? p.family.toLowerCase() : "";
1291
+ const byLabel = () => {
1292
+ const label = typeof p.method_label === "string" ? p.method_label.toLowerCase().replace(/[_-]+/g, " ") : "";
1293
+ for (const [re, key] of KEYWORDS) if (re.test(label)) return key;
1294
+ return null;
1295
+ };
1296
+ if (fam && fam !== "other" && FAMILY[fam]) {
1297
+ const l = byLabel();
1298
+ return fam === "card" && (l === "credit_card" || l === "debit_card") ? l : FAMILY[fam];
1299
+ }
1300
+ return byLabel() ?? (fam === "other" ? "other" : null);
1301
+ }
1302
+ function paymentLabel(p, m, options = {}) {
1303
+ const custom = options.override?.(p);
1304
+ if (typeof custom === "string" && custom.trim()) return custom.trim();
1305
+ const raw = typeof p.method_label === "string" ? p.method_label.trim() : "";
1306
+ const key = keyOf(p);
1307
+ const human = raw && !RAW.test(raw);
1308
+ if (human && /\d{4}/.test(raw)) return raw;
1309
+ if (key) {
1310
+ const base = m[`payment.method.${key}`];
1311
+ if (key !== "card" && key !== "credit_card" && key !== "debit_card") return human && key === "other" ? raw : base;
1312
+ const brandRaw = typeof p.brand === "string" ? p.brand.trim() : "";
1313
+ const brand = brandRaw ? BRANDS[brandRaw.toLowerCase().replace(/[ -]/g, "_")] ?? brandRaw : "";
1314
+ const last4 = typeof p.last4 === "string" && /^\d{2,4}$/.test(p.last4.trim()) ? p.last4.trim() : "";
1315
+ return `${base}${brand ? ` ${brand}` : ""}${last4 ? ` \u2022\u2022\u2022\u2022 ${last4}` : ""}`;
1316
+ }
1317
+ return human ? raw : m["payment.method.unknown"];
1318
+ }
1228
1319
  var tone = (s) => s === "completed" ? "done" : s === "failed" ? "problem" : "current";
1229
1320
  function RefundList({ refunds, showEmpty = false, degraded, onRetry, headingLevel = 3, classNames: cx = {}, ...text }) {
1230
1321
  const { m, locale, date } = useAccountText(text);
@@ -1250,7 +1341,7 @@ function RefundList({ refunds, showEmpty = false, degraded, onRetry, headingLeve
1250
1341
  /* @__PURE__ */ jsxs("span", { className: cx.meta, children: [
1251
1342
  str(r.method_label) ? /* @__PURE__ */ jsxs(Fragment, { children: [
1252
1343
  " \xB7 ",
1253
- str(r.method_label)
1344
+ paymentLabel({ method_label: r.method_label ?? "", status: "paid", amount: r.amount }, m)
1254
1345
  ] }) : null,
1255
1346
  r.completed_at ? /* @__PURE__ */ jsxs(Fragment, { children: [
1256
1347
  " \xB7 ",
@@ -1263,7 +1354,7 @@ function RefundList({ refunds, showEmpty = false, degraded, onRetry, headingLeve
1263
1354
  ] }, r.id)) })
1264
1355
  ] });
1265
1356
  }
1266
- function PaymentSummary({ payments, headingLevel = 3, classNames: cx = {}, ...text }) {
1357
+ function PaymentSummary({ payments, headingLevel = 3, methodLabel, classNames: cx = {}, ...text }) {
1267
1358
  const { m, locale, date } = useAccountText(text);
1268
1359
  const titleId = `sf-payments-${useId().replace(/:/g, "")}`;
1269
1360
  const items = (Array.isArray(payments) ? payments : []).filter((p) => !!p && typeof p === "object" && typeof p.method_label === "string");
@@ -1271,8 +1362,8 @@ function PaymentSummary({ payments, headingLevel = 3, classNames: cx = {}, ...te
1271
1362
  const Heading = `h${headingLevel}`;
1272
1363
  return /* @__PURE__ */ jsxs("section", { className: cx.root, "aria-labelledby": titleId, "data-sf-payments": true, children: [
1273
1364
  /* @__PURE__ */ jsx(Heading, { id: titleId, className: cx.title, children: m["payment.title"] }),
1274
- /* @__PURE__ */ jsx("ul", { className: cx.list, children: items.map((p, i) => /* @__PURE__ */ jsxs("li", { className: cx.item, "data-sf-payment": true, "data-sf-payment-status": typeof p.status === "string" ? p.status : "unknown", children: [
1275
- /* @__PURE__ */ jsx("span", { children: p.method_label }),
1365
+ /* @__PURE__ */ jsx("ul", { className: cx.list, children: items.map((p, i) => /* @__PURE__ */ jsxs("li", { className: cx.item, "data-sf-payment": true, "data-sf-payment-method-key": paymentMethodKey(p) ?? "unknown", "data-sf-payment-status": typeof p.status === "string" ? p.status : "unknown", children: [
1366
+ /* @__PURE__ */ jsx("span", { "data-sf-payment-method": true, children: paymentLabel(p, m, methodLabel ? { override: methodLabel } : {}) }),
1276
1367
  moneyText(p.amount, locale) ? /* @__PURE__ */ jsxs(Fragment, { children: [
1277
1368
  " \xB7 ",
1278
1369
  /* @__PURE__ */ jsx("span", { children: moneyText(p.amount, locale) })
@@ -1420,6 +1511,6 @@ function useCustomerOrder(id, { client, initial, poll } = {}) {
1420
1511
  return { status: mine ? state.status : "loading", order, error: mine ? state.error : null, refreshing: mine && refreshing, reload };
1421
1512
  }
1422
1513
 
1423
- export { AccountAuth, Barcode, InvoiceList, NextActionBar, OrderCard, OrderLines, OrderList, OrderProductsStack, OrderProgress, OrderStatusBadge, PaymentSummary, PendingPaymentCard, PendingPaymentList, PostPurchaseAccountPrompt, RefundList, ShipmentCard, accountAuthMessages, accountMessages, enumText, lineImage, postPurchaseAccountPromptMessages, stageTone, useCustomerOrder, useCustomerOrders, usePendingPayments };
1514
+ export { AccountAuth, Barcode, InvoiceList, NextActionBar, OrderCard, OrderLines, OrderList, OrderProductsStack, OrderProgress, OrderStatusBadge, PaymentSummary, PendingPaymentCard, PendingPaymentList, PostPurchaseAccountPrompt, RefundList, ShipmentCard, accountAuthMessages, accountMessages, enumText, lineImage, paymentLabel, paymentMethodKey, postPurchaseAccountPromptMessages, stageTone, useCustomerOrder, useCustomerOrders, usePendingPayments };
1424
1515
  //# sourceMappingURL=account.js.map
1425
1516
  //# sourceMappingURL=account.js.map