@12-apps/payments-frontend 3.31.1 → 3.31.2
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/components/checkout/checkout-steps.tsx +1 -0
- package/src/components/checkout/method-picker.tsx +10 -4
- package/src/components/checkout/screens-copy.ts +6 -0
- package/src/components/checkout/screens-en-US.ts +1 -0
- package/src/components/checkout/screens-pt-BR.ts +1 -0
- package/src/components/checkout/types.ts +7 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@12-apps/payments-frontend",
|
|
3
|
-
"version": "3.31.
|
|
3
|
+
"version": "3.31.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"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.",
|
|
@@ -289,6 +289,7 @@ export function PaymentStep({
|
|
|
289
289
|
onChange={onMethodChange}
|
|
290
290
|
cardUnavailable={choice.cardUnavailable}
|
|
291
291
|
offered={choice.offered}
|
|
292
|
+
pixByStore={config?.chain?.find((link) => link.methods.includes("PIX"))?.confirmation === "MANUAL"}
|
|
292
293
|
/>
|
|
293
294
|
)}
|
|
294
295
|
|
|
@@ -22,9 +22,11 @@ interface MethodOption {
|
|
|
22
22
|
* host's Portuguese. The order and the icons are still ours — that is layout,
|
|
23
23
|
* not language.
|
|
24
24
|
*/
|
|
25
|
-
function methodOptions(copy: MethodPickerCopy): MethodOption[] {
|
|
25
|
+
function methodOptions(copy: MethodPickerCopy, pixByStore: boolean): MethodOption[] {
|
|
26
|
+
// A Pix the store confirms by hand is not "aprovação imediata" (FUT-3232).
|
|
27
|
+
const pixDescription = (pixByStore ? copy.pixManualDescription : undefined) ?? copy.pixDescription;
|
|
26
28
|
return [
|
|
27
|
-
{ value: "PIX", label: copy.pixLabel, description:
|
|
29
|
+
{ value: "PIX", label: copy.pixLabel, description: pixDescription, icon: <PixIcon /> },
|
|
28
30
|
{
|
|
29
31
|
value: "CARD",
|
|
30
32
|
label: copy.cardLabel,
|
|
@@ -125,8 +127,9 @@ function MethodTile({
|
|
|
125
127
|
function visibleOptions(
|
|
126
128
|
copy: MethodPickerCopy,
|
|
127
129
|
offered: PaymentMethod[] | null,
|
|
130
|
+
pixByStore: boolean,
|
|
128
131
|
): MethodOption[] {
|
|
129
|
-
return methodOptions(copy).filter(
|
|
132
|
+
return methodOptions(copy, pixByStore).filter(
|
|
130
133
|
(option) => offered === null || offered.includes(option.value),
|
|
131
134
|
);
|
|
132
135
|
}
|
|
@@ -136,6 +139,7 @@ export function MethodPicker({
|
|
|
136
139
|
onChange,
|
|
137
140
|
cardUnavailable = false,
|
|
138
141
|
offered = null,
|
|
142
|
+
pixByStore = false,
|
|
139
143
|
}: {
|
|
140
144
|
/** The chosen method, or `null` before the buyer has picked one. */
|
|
141
145
|
value: PaymentMethod | null;
|
|
@@ -144,10 +148,12 @@ export function MethodPicker({
|
|
|
144
148
|
cardUnavailable?: boolean;
|
|
145
149
|
/** Methods the store's chain can charge, or `null` while unknown (fail open). */
|
|
146
150
|
offered?: PaymentMethod[] | null;
|
|
151
|
+
/** True ⇒ the chain's first PIX provider is one the STORE confirms by hand. */
|
|
152
|
+
pixByStore?: boolean;
|
|
147
153
|
}): JSX.Element {
|
|
148
154
|
const { Text } = useCheckoutComponents();
|
|
149
155
|
const copy = useCheckoutCopy().screens.method;
|
|
150
|
-
const options = visibleOptions(copy, offered);
|
|
156
|
+
const options = visibleOptions(copy, offered, pixByStore);
|
|
151
157
|
return (
|
|
152
158
|
<Box>
|
|
153
159
|
<Text variant="body" size="sm" weight="bold" as="p" style={{ marginBottom: 8 }}>
|
|
@@ -32,6 +32,12 @@ export interface MethodPickerCopy {
|
|
|
32
32
|
cardLabel: string;
|
|
33
33
|
/** What each method is like to use — shown under its name. */
|
|
34
34
|
pixDescription: string;
|
|
35
|
+
/**
|
|
36
|
+
* PIX's line when the store confirms it by hand (the chain's first PIX
|
|
37
|
+
* provider declares `confirmation: 'MANUAL'`). Optional; absent falls back
|
|
38
|
+
* to `pixDescription`, so a host enabling such a provider should set it.
|
|
39
|
+
*/
|
|
40
|
+
pixManualDescription?: string;
|
|
35
41
|
cardDescription: string;
|
|
36
42
|
/** This store's providers cannot take that method. */
|
|
37
43
|
unavailableHere: string;
|
|
@@ -22,6 +22,7 @@ export const EN_US_CHECKOUT_SCREENS_COPY: CheckoutScreensCopy = {
|
|
|
22
22
|
pixLabel: 'PIX',
|
|
23
23
|
cardLabel: 'Card',
|
|
24
24
|
pixDescription: 'Approved instantly',
|
|
25
|
+
pixManualDescription: 'Confirmed by the store',
|
|
25
26
|
cardDescription: 'Credit, paid in full',
|
|
26
27
|
unavailableHere: 'Unavailable in this store',
|
|
27
28
|
},
|
|
@@ -15,6 +15,7 @@ export const PT_BR_CHECKOUT_SCREENS_COPY: CheckoutScreensCopy = {
|
|
|
15
15
|
pixLabel: 'PIX',
|
|
16
16
|
cardLabel: 'Cartão',
|
|
17
17
|
pixDescription: 'Aprovação imediata',
|
|
18
|
+
pixManualDescription: 'Confirmado pela loja',
|
|
18
19
|
cardDescription: 'Crédito à vista',
|
|
19
20
|
unavailableHere: 'Indisponível nesta loja',
|
|
20
21
|
},
|
|
@@ -275,15 +275,15 @@ export interface CheckoutChainLink {
|
|
|
275
275
|
provider: string;
|
|
276
276
|
/**
|
|
277
277
|
* The provider's own name as a BUYER should read it ("InfinitePay"), which
|
|
278
|
-
* `GET /api/checkout/config` publishes per entry.
|
|
279
|
-
*
|
|
280
|
-
*
|
|
281
|
-
*
|
|
282
|
-
*
|
|
283
|
-
* buyer shown "infinitepay" learns less than one shown nothing, and learns
|
|
284
|
-
* it in a vocabulary that is ours rather than theirs.
|
|
278
|
+
* `GET /api/checkout/config` publishes per entry. Optional, and the DEGRADE
|
|
279
|
+
* DIRECTION IS "SAY NOTHING": an older host serves no name, and a hand-off
|
|
280
|
+
* screen then describes where the buyer is going without naming it, rather
|
|
281
|
+
* than printing the internal `provider` id — a buyer shown "infinitepay"
|
|
282
|
+
* learns less than one shown nothing, in a vocabulary ours rather than theirs.
|
|
285
283
|
*/
|
|
286
284
|
displayName?: string | null;
|
|
285
|
+
/** `MANUAL`: only the store confirms this entry's charges (`pixmanual`); absent is automatic. */
|
|
286
|
+
confirmation?: "AUTOMATIC" | "MANUAL";
|
|
287
287
|
tokenization: "NONE" | "PUBLIC_KEY" | "SDK" | "REDIRECT";
|
|
288
288
|
publicKey: string | null;
|
|
289
289
|
mockTokenization: boolean;
|