@12-apps/payments-frontend 3.11.0 → 3.12.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/package.json +1 -1
- package/src/card/copy.ts +12 -0
- package/src/card/fields.tsx +1 -1
- package/src/card/format.ts +2 -2
- package/src/card/pt-BR.ts +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@12-apps/payments-frontend",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.12.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Browser half of the vendor-agnostic payments platform: plug-and-play MUI components for the per-provider settings page (credential form from each provider's schema, masked hints, verify/enable) and the checkout page (PIX QR + polling, card tokenization, hosted-checkout redirect), plus the headless hooks and fetch clients they build on. Talks only to the host's payments HTTP surface — never to a provider directly. Microfrontend-ready: no app coupling, host injects theme and auth.",
|
|
6
6
|
"exports": {
|
package/src/card/copy.ts
CHANGED
|
@@ -42,6 +42,12 @@ export interface CardFieldCopy {
|
|
|
42
42
|
*/
|
|
43
43
|
expiryLabel: string;
|
|
44
44
|
cvvLabel: string;
|
|
45
|
+
/**
|
|
46
|
+
* The expiry field holds something that is not yet `MM/AA` at all — too few
|
|
47
|
+
* digits, or the wrong shape. Distinct from {@link monthInvalid}, which is a
|
|
48
|
+
* well-formed date with an impossible month.
|
|
49
|
+
*/
|
|
50
|
+
expiryIncomplete: string;
|
|
45
51
|
/** A month outside 1–12 — a typo, not an expiry. */
|
|
46
52
|
monthInvalid: string;
|
|
47
53
|
/** A well-formed date that has already passed. */
|
|
@@ -66,6 +72,12 @@ export interface CardFieldCopy {
|
|
|
66
72
|
cpfInvalid: string;
|
|
67
73
|
/** The saved-cards radio group's own label. */
|
|
68
74
|
savedCardsLabel: string;
|
|
75
|
+
/**
|
|
76
|
+
* A saved card's second line — the expiry, already zero-padded and split
|
|
77
|
+
* into month and year. The WORD in front of it is this host's; the order it
|
|
78
|
+
* reads in is the same order {@link expiryLabel} promised.
|
|
79
|
+
*/
|
|
80
|
+
savedCardExpiry(month: string, year: number): string;
|
|
69
81
|
/** The trailing option that opens the new-card form. */
|
|
70
82
|
newCard: string;
|
|
71
83
|
newCardDescription: string;
|
package/src/card/fields.tsx
CHANGED
|
@@ -41,7 +41,7 @@ export function SavedCardsPicker({
|
|
|
41
41
|
...savedCards.map((saved) => ({
|
|
42
42
|
value: saved.id,
|
|
43
43
|
label: `${saved.brand} •••• ${saved.last4}`,
|
|
44
|
-
description:
|
|
44
|
+
description: copy.savedCardExpiry(String(saved.expMonth).padStart(2, "0"), saved.expYear),
|
|
45
45
|
})),
|
|
46
46
|
{ value: NEW_CARD, label: copy.newCard, description: copy.newCardDescription },
|
|
47
47
|
]}
|
package/src/card/format.ts
CHANGED
|
@@ -97,10 +97,10 @@ export function validateExpiry(
|
|
|
97
97
|
now: Date = new Date(),
|
|
98
98
|
): string | undefined {
|
|
99
99
|
const match = /^(\d{2})\/(\d{2})$/.exec(value.trim());
|
|
100
|
-
if (!match) return
|
|
100
|
+
if (!match) return copy.expiryIncomplete;
|
|
101
101
|
const mm = match[1];
|
|
102
102
|
const yy = match[2];
|
|
103
|
-
if (mm === undefined || yy === undefined) return
|
|
103
|
+
if (mm === undefined || yy === undefined) return copy.expiryIncomplete;
|
|
104
104
|
const month = Number(mm);
|
|
105
105
|
if (month < 1 || month > 12) return copy.monthInvalid;
|
|
106
106
|
const endOfMonth = new Date(2000 + Number(yy), month, 0, 23, 59, 59, 999);
|
package/src/card/pt-BR.ts
CHANGED
|
@@ -20,6 +20,7 @@ export const PT_BR_CARD_COPY: CardCopy = {
|
|
|
20
20
|
holderRequired: 'Informe o nome impresso no cartão.',
|
|
21
21
|
expiryLabel: 'Validade (MM/AA)',
|
|
22
22
|
cvvLabel: 'CVV',
|
|
23
|
+
expiryIncomplete: 'Validade incompleta (MM/AA).',
|
|
23
24
|
monthInvalid: 'Mês inválido.',
|
|
24
25
|
expired: 'Cartão expirado.',
|
|
25
26
|
expiryInvalid: 'Validade inválida ou expirada.',
|
|
@@ -29,6 +30,7 @@ export const PT_BR_CARD_COPY: CardCopy = {
|
|
|
29
30
|
cpfRequired: 'CPF obrigatório.',
|
|
30
31
|
cpfInvalid: 'CPF inválido.',
|
|
31
32
|
savedCardsLabel: 'Cartão',
|
|
33
|
+
savedCardExpiry: (month, year) => `Validade ${month}/${year}`,
|
|
32
34
|
newCard: 'Novo cartão',
|
|
33
35
|
newCardDescription: 'Inserir outro cartão',
|
|
34
36
|
saveCard: 'Salvar cartão para próximas compras',
|