@asteby/storefront-react 0.23.0 → 0.24.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.cjs +88 -3
- package/dist/account.cjs.map +1 -1
- package/dist/account.d.cts +34 -2
- package/dist/account.d.ts +34 -2
- package/dist/account.js +89 -5
- package/dist/account.js.map +1 -1
- package/dist/{chunk-VE7WQPMY.js → chunk-5XYQLOE3.js} +18 -4
- package/dist/chunk-5XYQLOE3.js.map +1 -0
- package/dist/fiscal-server.cjs +8 -9
- package/dist/fiscal-server.cjs.map +1 -1
- package/dist/fiscal-server.d.cts +8 -5
- package/dist/fiscal-server.d.ts +8 -5
- package/dist/fiscal-server.js +8 -9
- package/dist/fiscal-server.js.map +1 -1
- package/dist/fiscal.cjs +46 -7
- package/dist/fiscal.cjs.map +1 -1
- package/dist/fiscal.d.cts +31 -6
- package/dist/fiscal.d.ts +31 -6
- package/dist/fiscal.js +32 -7
- package/dist/fiscal.js.map +1 -1
- package/dist/{types-CZ3PleG6.d.cts → types-Cgx_65eM.d.cts} +13 -1
- package/dist/{types-CZ3PleG6.d.ts → types-Cgx_65eM.d.ts} +13 -1
- package/package.json +2 -2
- package/dist/chunk-VE7WQPMY.js.map +0 -1
package/dist/account.d.cts
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,24 @@ 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
|
+
type PaymentLabelOptions = {
|
|
525
|
+
/** 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. */
|
|
526
|
+
override?: (payment: PaymentInfo) => string | null | undefined;
|
|
527
|
+
};
|
|
528
|
+
/**
|
|
529
|
+
* `Tarjeta Visa •••• 1234`, `Efectivo con ficha (OXXO…)`, `Transferencia SPEI`… in the buyer's language. A label the
|
|
530
|
+
* server already wrote as a sentence (it carries its own detail) is kept; a raw key becomes a readable text and never
|
|
531
|
+
* shows as it came; with nothing to go on, a neutral "Medio de pago".
|
|
532
|
+
*/
|
|
533
|
+
declare function paymentLabel(p: PaymentInfo, m: AccountMessages, options?: PaymentLabelOptions): string;
|
|
534
|
+
|
|
505
535
|
type RefundListClassNames = Partial<Record<'root' | 'title' | 'list' | 'item' | 'amount' | 'status' | 'meta' | 'empty' | 'error' | 'retry', string>>;
|
|
506
536
|
type RefundListProps = AccountTextProps & {
|
|
507
537
|
refunds?: readonly Refund[] | null;
|
|
@@ -517,10 +547,12 @@ declare function RefundList({ refunds, showEmpty, degraded, onRetry, headingLeve
|
|
|
517
547
|
type PaymentSummaryProps = AccountTextProps & {
|
|
518
548
|
payments?: readonly PaymentInfo[] | null;
|
|
519
549
|
headingLevel?: 2 | 3 | 4;
|
|
550
|
+
/** The store's own name for a payment (by organization, provider...); `null` falls through to the SDK's es/en text. */
|
|
551
|
+
methodLabel?: PaymentLabelOptions['override'];
|
|
520
552
|
classNames?: Partial<Record<'root' | 'title' | 'list' | 'item' | 'status' | 'meta', string>>;
|
|
521
553
|
};
|
|
522
554
|
/** 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;
|
|
555
|
+
declare function PaymentSummary({ payments, headingLevel, methodLabel, classNames: cx, ...text }: PaymentSummaryProps): react.JSX.Element | null;
|
|
524
556
|
|
|
525
557
|
/**
|
|
526
558
|
* Data hooks of the account screens. They talk to the client of the `StorefrontProvider` (or `client`), which must carry
|
|
@@ -623,4 +655,4 @@ declare function barcodeGeometry(value: string, opts?: {
|
|
|
623
655
|
height?: number;
|
|
624
656
|
}): BarcodeGeometry | null;
|
|
625
657
|
|
|
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 };
|
|
658
|
+
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, 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,24 @@ 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
|
+
type PaymentLabelOptions = {
|
|
525
|
+
/** 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. */
|
|
526
|
+
override?: (payment: PaymentInfo) => string | null | undefined;
|
|
527
|
+
};
|
|
528
|
+
/**
|
|
529
|
+
* `Tarjeta Visa •••• 1234`, `Efectivo con ficha (OXXO…)`, `Transferencia SPEI`… in the buyer's language. A label the
|
|
530
|
+
* server already wrote as a sentence (it carries its own detail) is kept; a raw key becomes a readable text and never
|
|
531
|
+
* shows as it came; with nothing to go on, a neutral "Medio de pago".
|
|
532
|
+
*/
|
|
533
|
+
declare function paymentLabel(p: PaymentInfo, m: AccountMessages, options?: PaymentLabelOptions): string;
|
|
534
|
+
|
|
505
535
|
type RefundListClassNames = Partial<Record<'root' | 'title' | 'list' | 'item' | 'amount' | 'status' | 'meta' | 'empty' | 'error' | 'retry', string>>;
|
|
506
536
|
type RefundListProps = AccountTextProps & {
|
|
507
537
|
refunds?: readonly Refund[] | null;
|
|
@@ -517,10 +547,12 @@ declare function RefundList({ refunds, showEmpty, degraded, onRetry, headingLeve
|
|
|
517
547
|
type PaymentSummaryProps = AccountTextProps & {
|
|
518
548
|
payments?: readonly PaymentInfo[] | null;
|
|
519
549
|
headingLevel?: 2 | 3 | 4;
|
|
550
|
+
/** The store's own name for a payment (by organization, provider...); `null` falls through to the SDK's es/en text. */
|
|
551
|
+
methodLabel?: PaymentLabelOptions['override'];
|
|
520
552
|
classNames?: Partial<Record<'root' | 'title' | 'list' | 'item' | 'status' | 'meta', string>>;
|
|
521
553
|
};
|
|
522
554
|
/** 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;
|
|
555
|
+
declare function PaymentSummary({ payments, headingLevel, methodLabel, classNames: cx, ...text }: PaymentSummaryProps): react.JSX.Element | null;
|
|
524
556
|
|
|
525
557
|
/**
|
|
526
558
|
* Data hooks of the account screens. They talk to the client of the `StorefrontProvider` (or `client`), which must carry
|
|
@@ -623,4 +655,4 @@ declare function barcodeGeometry(value: string, opts?: {
|
|
|
623
655
|
height?: number;
|
|
624
656
|
}): BarcodeGeometry | null;
|
|
625
657
|
|
|
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 };
|
|
658
|
+
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, postPurchaseAccountPromptMessages, stageTone, useCustomerOrder, useCustomerOrders, usePendingPayments, voucherOf };
|
package/dist/account.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { fill } from './chunk-
|
|
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"
|
|
@@ -1225,6 +1249,66 @@ function PendingPaymentList({ payments, voucherHref, shopName, classNames, listC
|
|
|
1225
1249
|
/* @__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
1250
|
] });
|
|
1227
1251
|
}
|
|
1252
|
+
|
|
1253
|
+
// src/account/payment-method.ts
|
|
1254
|
+
var FAMILY = {
|
|
1255
|
+
card: "card",
|
|
1256
|
+
credit_card: "credit_card",
|
|
1257
|
+
debit_card: "debit_card",
|
|
1258
|
+
cash_voucher: "cash_voucher",
|
|
1259
|
+
oxxo: "oxxo",
|
|
1260
|
+
spei: "spei",
|
|
1261
|
+
transfer: "transfer",
|
|
1262
|
+
bank_transfer: "transfer",
|
|
1263
|
+
bank_deposit: "bank_deposit",
|
|
1264
|
+
wallet: "wallet",
|
|
1265
|
+
cash: "cash",
|
|
1266
|
+
other: "other"
|
|
1267
|
+
};
|
|
1268
|
+
var KEYWORDS = [
|
|
1269
|
+
[/oxxo/, "oxxo"],
|
|
1270
|
+
[/spei/, "spei"],
|
|
1271
|
+
[/d[eé]bit/, "debit_card"],
|
|
1272
|
+
[/cr[eé]dit/, "credit_card"],
|
|
1273
|
+
[/card|tarjeta/, "card"],
|
|
1274
|
+
[/deposit|dep[oó]sito/, "bank_deposit"],
|
|
1275
|
+
[/transfer/, "transfer"],
|
|
1276
|
+
[/wallet|billetera|paypal|mercado ?pago|apple ?pay|google ?pay/, "wallet"],
|
|
1277
|
+
[/voucher|ficha|convenience|conveniencia|store|tienda/, "cash_voucher"],
|
|
1278
|
+
[/cash|efectivo/, "cash"]
|
|
1279
|
+
];
|
|
1280
|
+
var BRANDS = { visa: "Visa", mastercard: "Mastercard", master: "Mastercard", amex: "American Express", american_express: "American Express", carnet: "Carnet", discover: "Discover" };
|
|
1281
|
+
var RAW = /^[A-Za-z0-9_.:-]+(?: [A-Za-z0-9_.:-]+)?$/;
|
|
1282
|
+
function keyOf(p) {
|
|
1283
|
+
const fam = typeof p.family === "string" ? p.family.toLowerCase() : "";
|
|
1284
|
+
const byLabel = () => {
|
|
1285
|
+
const label = typeof p.method_label === "string" ? p.method_label.toLowerCase().replace(/[_-]+/g, " ") : "";
|
|
1286
|
+
for (const [re, key] of KEYWORDS) if (re.test(label)) return key;
|
|
1287
|
+
return null;
|
|
1288
|
+
};
|
|
1289
|
+
if (fam && fam !== "other" && FAMILY[fam]) {
|
|
1290
|
+
const l = byLabel();
|
|
1291
|
+
return fam === "card" && (l === "credit_card" || l === "debit_card") ? l : FAMILY[fam];
|
|
1292
|
+
}
|
|
1293
|
+
return byLabel() ?? (fam === "other" ? "other" : null);
|
|
1294
|
+
}
|
|
1295
|
+
function paymentLabel(p, m, options = {}) {
|
|
1296
|
+
const custom = options.override?.(p);
|
|
1297
|
+
if (typeof custom === "string" && custom.trim()) return custom.trim();
|
|
1298
|
+
const raw = typeof p.method_label === "string" ? p.method_label.trim() : "";
|
|
1299
|
+
const key = keyOf(p);
|
|
1300
|
+
const human = raw && !RAW.test(raw);
|
|
1301
|
+
if (human && /\d{4}/.test(raw)) return raw;
|
|
1302
|
+
if (key) {
|
|
1303
|
+
const base = m[`payment.method.${key}`];
|
|
1304
|
+
if (key !== "card" && key !== "credit_card" && key !== "debit_card") return human && key === "other" ? raw : base;
|
|
1305
|
+
const brandRaw = typeof p.brand === "string" ? p.brand.trim() : "";
|
|
1306
|
+
const brand = brandRaw ? BRANDS[brandRaw.toLowerCase().replace(/[ -]/g, "_")] ?? brandRaw : "";
|
|
1307
|
+
const last4 = typeof p.last4 === "string" && /^\d{2,4}$/.test(p.last4.trim()) ? p.last4.trim() : "";
|
|
1308
|
+
return `${base}${brand ? ` ${brand}` : ""}${last4 ? ` \u2022\u2022\u2022\u2022 ${last4}` : ""}`;
|
|
1309
|
+
}
|
|
1310
|
+
return human ? raw : m["payment.method.unknown"];
|
|
1311
|
+
}
|
|
1228
1312
|
var tone = (s) => s === "completed" ? "done" : s === "failed" ? "problem" : "current";
|
|
1229
1313
|
function RefundList({ refunds, showEmpty = false, degraded, onRetry, headingLevel = 3, classNames: cx = {}, ...text }) {
|
|
1230
1314
|
const { m, locale, date } = useAccountText(text);
|
|
@@ -1250,7 +1334,7 @@ function RefundList({ refunds, showEmpty = false, degraded, onRetry, headingLeve
|
|
|
1250
1334
|
/* @__PURE__ */ jsxs("span", { className: cx.meta, children: [
|
|
1251
1335
|
str(r.method_label) ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1252
1336
|
" \xB7 ",
|
|
1253
|
-
|
|
1337
|
+
paymentLabel({ method_label: r.method_label ?? "", status: "paid", amount: r.amount }, m)
|
|
1254
1338
|
] }) : null,
|
|
1255
1339
|
r.completed_at ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1256
1340
|
" \xB7 ",
|
|
@@ -1263,7 +1347,7 @@ function RefundList({ refunds, showEmpty = false, degraded, onRetry, headingLeve
|
|
|
1263
1347
|
] }, r.id)) })
|
|
1264
1348
|
] });
|
|
1265
1349
|
}
|
|
1266
|
-
function PaymentSummary({ payments, headingLevel = 3, classNames: cx = {}, ...text }) {
|
|
1350
|
+
function PaymentSummary({ payments, headingLevel = 3, methodLabel, classNames: cx = {}, ...text }) {
|
|
1267
1351
|
const { m, locale, date } = useAccountText(text);
|
|
1268
1352
|
const titleId = `sf-payments-${useId().replace(/:/g, "")}`;
|
|
1269
1353
|
const items = (Array.isArray(payments) ? payments : []).filter((p) => !!p && typeof p === "object" && typeof p.method_label === "string");
|
|
@@ -1272,7 +1356,7 @@ function PaymentSummary({ payments, headingLevel = 3, classNames: cx = {}, ...te
|
|
|
1272
1356
|
return /* @__PURE__ */ jsxs("section", { className: cx.root, "aria-labelledby": titleId, "data-sf-payments": true, children: [
|
|
1273
1357
|
/* @__PURE__ */ jsx(Heading, { id: titleId, className: cx.title, children: m["payment.title"] }),
|
|
1274
1358
|
/* @__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
|
|
1359
|
+
/* @__PURE__ */ jsx("span", { "data-sf-payment-method": true, children: paymentLabel(p, m, methodLabel ? { override: methodLabel } : {}) }),
|
|
1276
1360
|
moneyText(p.amount, locale) ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1277
1361
|
" \xB7 ",
|
|
1278
1362
|
/* @__PURE__ */ jsx("span", { children: moneyText(p.amount, locale) })
|
|
@@ -1420,6 +1504,6 @@ function useCustomerOrder(id, { client, initial, poll } = {}) {
|
|
|
1420
1504
|
return { status: mine ? state.status : "loading", order, error: mine ? state.error : null, refreshing: mine && refreshing, reload };
|
|
1421
1505
|
}
|
|
1422
1506
|
|
|
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 };
|
|
1507
|
+
export { AccountAuth, Barcode, InvoiceList, NextActionBar, OrderCard, OrderLines, OrderList, OrderProductsStack, OrderProgress, OrderStatusBadge, PaymentSummary, PendingPaymentCard, PendingPaymentList, PostPurchaseAccountPrompt, RefundList, ShipmentCard, accountAuthMessages, accountMessages, enumText, lineImage, paymentLabel, postPurchaseAccountPromptMessages, stageTone, useCustomerOrder, useCustomerOrders, usePendingPayments };
|
|
1424
1508
|
//# sourceMappingURL=account.js.map
|
|
1425
1509
|
//# sourceMappingURL=account.js.map
|