@asteby/storefront-react 0.22.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-PPQEUTXJ.js → chunk-5XYQLOE3.js} +64 -8
- package/dist/chunk-5XYQLOE3.js.map +1 -0
- package/dist/{chunk-Q7UTJIKY.js → chunk-D5L7UZIA.js} +25 -4
- package/dist/chunk-D5L7UZIA.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 +9 -10
- package/dist/fiscal-server.js.map +1 -1
- package/dist/fiscal.cjs +464 -24
- package/dist/fiscal.cjs.map +1 -1
- package/dist/fiscal.css +103 -0
- package/dist/fiscal.d.cts +120 -11
- package/dist/fiscal.d.ts +120 -11
- package/dist/fiscal.js +326 -23
- package/dist/fiscal.js.map +1 -1
- package/dist/{types-BnvSbV6t.d.cts → types-Cgx_65eM.d.cts} +14 -2
- package/dist/{types-BnvSbV6t.d.ts → types-Cgx_65eM.d.ts} +14 -2
- package/package.json +2 -2
- package/dist/chunk-PPQEUTXJ.js.map +0 -1
- package/dist/chunk-Q7UTJIKY.js.map +0 -1
package/dist/account.cjs
CHANGED
|
@@ -1032,6 +1032,18 @@ var ES4 = {
|
|
|
1032
1032
|
"payment.status.partially_refunded": "Reembolsado parcialmente",
|
|
1033
1033
|
"payment.status.unknown": "En proceso",
|
|
1034
1034
|
"payment.paidOn": "Pagado el {date}",
|
|
1035
|
+
"payment.method.card": "Tarjeta",
|
|
1036
|
+
"payment.method.credit_card": "Tarjeta de cr\xE9dito",
|
|
1037
|
+
"payment.method.debit_card": "Tarjeta de d\xE9bito",
|
|
1038
|
+
"payment.method.cash_voucher": "Efectivo con ficha (OXXO, tienda de conveniencia)",
|
|
1039
|
+
"payment.method.oxxo": "Efectivo en OXXO",
|
|
1040
|
+
"payment.method.spei": "Transferencia SPEI",
|
|
1041
|
+
"payment.method.transfer": "Transferencia bancaria",
|
|
1042
|
+
"payment.method.bank_deposit": "Dep\xF3sito bancario",
|
|
1043
|
+
"payment.method.wallet": "Billetera digital",
|
|
1044
|
+
"payment.method.cash": "Efectivo",
|
|
1045
|
+
"payment.method.other": "Otro medio de pago",
|
|
1046
|
+
"payment.method.unknown": "Medio de pago",
|
|
1035
1047
|
// sections
|
|
1036
1048
|
"section.error": "No pudimos cargar esta secci\xF3n.",
|
|
1037
1049
|
"section.retry": "Reintentar",
|
|
@@ -1192,6 +1204,18 @@ var EN4 = {
|
|
|
1192
1204
|
"payment.status.partially_refunded": "Partially refunded",
|
|
1193
1205
|
"payment.status.unknown": "In progress",
|
|
1194
1206
|
"payment.paidOn": "Paid on {date}",
|
|
1207
|
+
"payment.method.card": "Card",
|
|
1208
|
+
"payment.method.credit_card": "Credit card",
|
|
1209
|
+
"payment.method.debit_card": "Debit card",
|
|
1210
|
+
"payment.method.cash_voucher": "Cash with a voucher (OXXO, convenience store)",
|
|
1211
|
+
"payment.method.oxxo": "Cash at OXXO",
|
|
1212
|
+
"payment.method.spei": "SPEI transfer",
|
|
1213
|
+
"payment.method.transfer": "Bank transfer",
|
|
1214
|
+
"payment.method.bank_deposit": "Bank deposit",
|
|
1215
|
+
"payment.method.wallet": "Digital wallet",
|
|
1216
|
+
"payment.method.cash": "Cash",
|
|
1217
|
+
"payment.method.other": "Other payment method",
|
|
1218
|
+
"payment.method.unknown": "Payment method",
|
|
1195
1219
|
"section.error": "We could not load this section.",
|
|
1196
1220
|
"section.retry": "Try again",
|
|
1197
1221
|
"section.loading": "Loading"
|
|
@@ -1972,6 +1996,66 @@ function PendingPaymentList({ payments, voucherHref, shopName, classNames, listC
|
|
|
1972
1996
|
/* @__PURE__ */ jsxRuntime.jsx("ul", { className: lc.list, children: sorted.map((p) => /* @__PURE__ */ jsxRuntime.jsx("li", { className: lc.item, children: /* @__PURE__ */ jsxRuntime.jsx(PendingPaymentCard, { payment: p, ...voucherHref ? { voucherHref } : {}, ...shopName ? { shopName } : {}, ...classNames ? { classNames } : {}, headingLevel: cardHeading, ...text2 }) }, p.id)) })
|
|
1973
1997
|
] });
|
|
1974
1998
|
}
|
|
1999
|
+
|
|
2000
|
+
// src/account/payment-method.ts
|
|
2001
|
+
var FAMILY = {
|
|
2002
|
+
card: "card",
|
|
2003
|
+
credit_card: "credit_card",
|
|
2004
|
+
debit_card: "debit_card",
|
|
2005
|
+
cash_voucher: "cash_voucher",
|
|
2006
|
+
oxxo: "oxxo",
|
|
2007
|
+
spei: "spei",
|
|
2008
|
+
transfer: "transfer",
|
|
2009
|
+
bank_transfer: "transfer",
|
|
2010
|
+
bank_deposit: "bank_deposit",
|
|
2011
|
+
wallet: "wallet",
|
|
2012
|
+
cash: "cash",
|
|
2013
|
+
other: "other"
|
|
2014
|
+
};
|
|
2015
|
+
var KEYWORDS = [
|
|
2016
|
+
[/oxxo/, "oxxo"],
|
|
2017
|
+
[/spei/, "spei"],
|
|
2018
|
+
[/d[eé]bit/, "debit_card"],
|
|
2019
|
+
[/cr[eé]dit/, "credit_card"],
|
|
2020
|
+
[/card|tarjeta/, "card"],
|
|
2021
|
+
[/deposit|dep[oó]sito/, "bank_deposit"],
|
|
2022
|
+
[/transfer/, "transfer"],
|
|
2023
|
+
[/wallet|billetera|paypal|mercado ?pago|apple ?pay|google ?pay/, "wallet"],
|
|
2024
|
+
[/voucher|ficha|convenience|conveniencia|store|tienda/, "cash_voucher"],
|
|
2025
|
+
[/cash|efectivo/, "cash"]
|
|
2026
|
+
];
|
|
2027
|
+
var BRANDS = { visa: "Visa", mastercard: "Mastercard", master: "Mastercard", amex: "American Express", american_express: "American Express", carnet: "Carnet", discover: "Discover" };
|
|
2028
|
+
var RAW = /^[A-Za-z0-9_.:-]+(?: [A-Za-z0-9_.:-]+)?$/;
|
|
2029
|
+
function keyOf(p) {
|
|
2030
|
+
const fam = typeof p.family === "string" ? p.family.toLowerCase() : "";
|
|
2031
|
+
const byLabel = () => {
|
|
2032
|
+
const label = typeof p.method_label === "string" ? p.method_label.toLowerCase().replace(/[_-]+/g, " ") : "";
|
|
2033
|
+
for (const [re, key] of KEYWORDS) if (re.test(label)) return key;
|
|
2034
|
+
return null;
|
|
2035
|
+
};
|
|
2036
|
+
if (fam && fam !== "other" && FAMILY[fam]) {
|
|
2037
|
+
const l = byLabel();
|
|
2038
|
+
return fam === "card" && (l === "credit_card" || l === "debit_card") ? l : FAMILY[fam];
|
|
2039
|
+
}
|
|
2040
|
+
return byLabel() ?? (fam === "other" ? "other" : null);
|
|
2041
|
+
}
|
|
2042
|
+
function paymentLabel(p, m, options = {}) {
|
|
2043
|
+
const custom = options.override?.(p);
|
|
2044
|
+
if (typeof custom === "string" && custom.trim()) return custom.trim();
|
|
2045
|
+
const raw = typeof p.method_label === "string" ? p.method_label.trim() : "";
|
|
2046
|
+
const key = keyOf(p);
|
|
2047
|
+
const human = raw && !RAW.test(raw);
|
|
2048
|
+
if (human && /\d{4}/.test(raw)) return raw;
|
|
2049
|
+
if (key) {
|
|
2050
|
+
const base = m[`payment.method.${key}`];
|
|
2051
|
+
if (key !== "card" && key !== "credit_card" && key !== "debit_card") return human && key === "other" ? raw : base;
|
|
2052
|
+
const brandRaw = typeof p.brand === "string" ? p.brand.trim() : "";
|
|
2053
|
+
const brand = brandRaw ? BRANDS[brandRaw.toLowerCase().replace(/[ -]/g, "_")] ?? brandRaw : "";
|
|
2054
|
+
const last4 = typeof p.last4 === "string" && /^\d{2,4}$/.test(p.last4.trim()) ? p.last4.trim() : "";
|
|
2055
|
+
return `${base}${brand ? ` ${brand}` : ""}${last4 ? ` \u2022\u2022\u2022\u2022 ${last4}` : ""}`;
|
|
2056
|
+
}
|
|
2057
|
+
return human ? raw : m["payment.method.unknown"];
|
|
2058
|
+
}
|
|
1975
2059
|
var tone = (s) => s === "completed" ? "done" : s === "failed" ? "problem" : "current";
|
|
1976
2060
|
function RefundList({ refunds, showEmpty = false, degraded, onRetry, headingLevel = 3, classNames: cx = {}, ...text2 }) {
|
|
1977
2061
|
const { m, locale, date } = useAccountText(text2);
|
|
@@ -1997,7 +2081,7 @@ function RefundList({ refunds, showEmpty = false, degraded, onRetry, headingLeve
|
|
|
1997
2081
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: cx.meta, children: [
|
|
1998
2082
|
str(r.method_label) ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1999
2083
|
" \xB7 ",
|
|
2000
|
-
|
|
2084
|
+
paymentLabel({ method_label: r.method_label ?? "", status: "paid", amount: r.amount }, m)
|
|
2001
2085
|
] }) : null,
|
|
2002
2086
|
r.completed_at ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2003
2087
|
" \xB7 ",
|
|
@@ -2010,7 +2094,7 @@ function RefundList({ refunds, showEmpty = false, degraded, onRetry, headingLeve
|
|
|
2010
2094
|
] }, r.id)) })
|
|
2011
2095
|
] });
|
|
2012
2096
|
}
|
|
2013
|
-
function PaymentSummary({ payments, headingLevel = 3, classNames: cx = {}, ...text2 }) {
|
|
2097
|
+
function PaymentSummary({ payments, headingLevel = 3, methodLabel, classNames: cx = {}, ...text2 }) {
|
|
2014
2098
|
const { m, locale, date } = useAccountText(text2);
|
|
2015
2099
|
const titleId = `sf-payments-${react.useId().replace(/:/g, "")}`;
|
|
2016
2100
|
const items = (Array.isArray(payments) ? payments : []).filter((p) => !!p && typeof p === "object" && typeof p.method_label === "string");
|
|
@@ -2019,7 +2103,7 @@ function PaymentSummary({ payments, headingLevel = 3, classNames: cx = {}, ...te
|
|
|
2019
2103
|
return /* @__PURE__ */ jsxRuntime.jsxs("section", { className: cx.root, "aria-labelledby": titleId, "data-sf-payments": true, children: [
|
|
2020
2104
|
/* @__PURE__ */ jsxRuntime.jsx(Heading, { id: titleId, className: cx.title, children: m["payment.title"] }),
|
|
2021
2105
|
/* @__PURE__ */ jsxRuntime.jsx("ul", { className: cx.list, children: items.map((p, i) => /* @__PURE__ */ jsxRuntime.jsxs("li", { className: cx.item, "data-sf-payment": true, "data-sf-payment-status": typeof p.status === "string" ? p.status : "unknown", children: [
|
|
2022
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { children: p
|
|
2106
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { "data-sf-payment-method": true, children: paymentLabel(p, m, methodLabel ? { override: methodLabel } : {}) }),
|
|
2023
2107
|
moneyText(p.amount, locale) ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2024
2108
|
" \xB7 ",
|
|
2025
2109
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: moneyText(p.amount, locale) })
|
|
@@ -2196,6 +2280,7 @@ exports.barcodeValue = barcodeValue;
|
|
|
2196
2280
|
exports.code128Modules = code128Modules;
|
|
2197
2281
|
exports.enumText = enumText;
|
|
2198
2282
|
exports.lineImage = lineImage;
|
|
2283
|
+
exports.paymentLabel = paymentLabel;
|
|
2199
2284
|
exports.postPurchaseAccountPromptMessages = postPurchaseAccountPromptMessages;
|
|
2200
2285
|
exports.productInitials = productInitials;
|
|
2201
2286
|
exports.stageTone = stageTone;
|