@12-apps/payments-frontend 3.47.0 → 3.47.1
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@12-apps/payments-frontend",
|
|
3
|
-
"version": "3.47.
|
|
3
|
+
"version": "3.47.1",
|
|
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.",
|
|
@@ -300,6 +300,24 @@ function noPick(): void {
|
|
|
300
300
|
// No bank flow: nothing to remember.
|
|
301
301
|
}
|
|
302
302
|
|
|
303
|
+
/**
|
|
304
|
+
* The way to the bank app on the after-copy face, or `undefined` off a phone.
|
|
305
|
+
* With a bank chosen, one line says what to do there, in place of the
|
|
306
|
+
* checklist (FUT-3612) — unless the STORE confirms this Pix: its checklist's
|
|
307
|
+
* "A loja confirma o pagamento — até 14:32" is then the only place that says
|
|
308
|
+
* who confirms and by when, so it stays — under the six banks too. No line in
|
|
309
|
+
* the host's copy: the checklist stays too. Otherwise the six banks replace it.
|
|
310
|
+
*/
|
|
311
|
+
function bankFace(flow: BankFlow | null, pix: PixCharge, stale: boolean): { node: JSX.Element; replacesChecklist: boolean } | undefined {
|
|
312
|
+
if (!flow?.os) return undefined;
|
|
313
|
+
const storeConfirms = pix.confirmation === "MANUAL";
|
|
314
|
+
const oneLine = Boolean(flow.bank.copy.appHint) && !storeConfirms;
|
|
315
|
+
return {
|
|
316
|
+
node: <PixBanks bank={flow.bank} state={flow.state} stale={stale} hint={oneLine} />,
|
|
317
|
+
replacesChecklist: oneLine || (flow.state.chosen === null && !storeConfirms),
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
|
|
303
321
|
/** Both faces of the list's Pix, and the bar under them. */
|
|
304
322
|
export function ListPixFace(props: ListPixFaceProps & { mode: PaymentListMode }): JSX.Element {
|
|
305
323
|
const { Text } = useCheckoutComponents();
|
|
@@ -311,7 +329,7 @@ export function ListPixFace(props: ListPixFaceProps & { mode: PaymentListMode })
|
|
|
311
329
|
// On a phone the bank flow takes the copy: "Copiar e abrir o Nubank", the
|
|
312
330
|
// toast, the app. Without it — or on a computer — the copy is today's.
|
|
313
331
|
const onCopy = flow ? copies.copy : props.onCopy;
|
|
314
|
-
const banks = flow
|
|
332
|
+
const banks = bankFace(flow, pix, stale);
|
|
315
333
|
return (
|
|
316
334
|
<Box data-testid="list-pix" sx={{ display: "flex", flexDirection: "column", gap: 1.5 }}>
|
|
317
335
|
<Text variant="body" size="md" weight="bold" as="p" style={{ margin: 0 }} data-testid="list-pix-title">
|
|
@@ -182,13 +182,16 @@ function AppHint({ text }: { text: string }): JSX.Element {
|
|
|
182
182
|
);
|
|
183
183
|
}
|
|
184
184
|
|
|
185
|
-
/**
|
|
186
|
-
|
|
185
|
+
/**
|
|
186
|
+
* The grid, or the bank being opened — with, when `hint`, the line that says
|
|
187
|
+
* what to do there (the face then drops its checklist; see `ListPixFace`).
|
|
188
|
+
*/
|
|
189
|
+
export function PixBanks({ bank, state, stale, hint }: { bank: CheckoutPixBank; state: PixBankState; stale: boolean; hint: boolean }): JSX.Element {
|
|
187
190
|
if (!state.chosen) return <Grid bank={bank} state={state} stale={stale} />;
|
|
188
191
|
return (
|
|
189
192
|
<Box sx={{ display: "flex", flexDirection: "column", gap: 1 }}>
|
|
190
193
|
<Opening bank={bank} state={state} chosen={state.chosen} />
|
|
191
|
-
{bank.copy.appHint ? <AppHint text={bank.copy.appHint} /> : null}
|
|
194
|
+
{hint && bank.copy.appHint ? <AppHint text={bank.copy.appHint} /> : null}
|
|
192
195
|
</Box>
|
|
193
196
|
);
|
|
194
197
|
}
|
|
@@ -126,12 +126,28 @@ interface PixAfterCopyProps {
|
|
|
126
126
|
/**
|
|
127
127
|
* The way to the bank app, on a phone (FUT-3612): drawn where the heading
|
|
128
128
|
* was — the toast already said the code was copied and the bar says what it
|
|
129
|
-
* waits for — and,
|
|
129
|
+
* waits for — and, when `replacesChecklist`, in place of the checklist. The
|
|
130
|
+
* column then sits as tight as the prototype's (8px).
|
|
130
131
|
*/
|
|
131
132
|
banks?: { node: ReactNode; replacesChecklist: boolean };
|
|
132
133
|
}
|
|
133
134
|
|
|
134
|
-
/**
|
|
135
|
+
/**
|
|
136
|
+
* The pair's leading icons. On a phone's card (the pair under 360px) they go,
|
|
137
|
+
* as in the prototype: beside the icon, "Copiar de novo" took two lines in its
|
|
138
|
+
* 159px column ("novo" alone). A computer's column is wider and keeps them.
|
|
139
|
+
* `button` in the selector outranks the library Button's own icon rule, which
|
|
140
|
+
* otherwise wins or loses on style insertion order.
|
|
141
|
+
*/
|
|
142
|
+
const ICON_SLOT = "& button .MuiButton-startIcon, & button .MuiButton-start";
|
|
143
|
+
/** The pair's own width, never the pane's. */
|
|
144
|
+
const ACTIONS_NARROW = "@container pixactions (max-width: 359.95px)";
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* The narrow layout's two secondaries side by side — 140px columns, so the pair
|
|
148
|
+
* fits a 390px phone's card (two of 180px did not, and stacked) and stacks only
|
|
149
|
+
* at 320 — wide, the card link joins the row.
|
|
150
|
+
*/
|
|
135
151
|
function Actions({ justCopied, onCopyAgain, onShowQr, onPreferCard }: Pick<PixAfterCopyProps, "justCopied" | "onCopyAgain" | "onShowQr" | "onPreferCard">): JSX.Element {
|
|
136
152
|
const { Button } = useCheckoutComponents();
|
|
137
153
|
const copy = useCheckoutCopy().screens.pix;
|
|
@@ -139,7 +155,7 @@ function Actions({ justCopied, onCopyAgain, onShowQr, onPreferCard }: Pick<PixAf
|
|
|
139
155
|
// (FUT-3535): copying it again would only hand the buyer the wrong amount.
|
|
140
156
|
const stale = usePaymentStale();
|
|
141
157
|
return (
|
|
142
|
-
<Box sx={{ display: "grid", gridTemplateColumns: "repeat(auto-fit, minmax(
|
|
158
|
+
<Box sx={{ display: "grid", gridTemplateColumns: "repeat(auto-fit, minmax(140px, 1fr))", gap: 1.25, "& button": { minHeight: 48, height: "100%" }, "& button, & button *": { fontWeight: 700 }, containerType: "inline-size", containerName: "pixactions", [ACTIONS_NARROW]: { [ICON_SLOT]: { display: "none" } }, [PIX_WIDE]: { display: "flex", flexWrap: "wrap", alignItems: "center", gap: 1.5, "& button": { height: "auto" } } }}>
|
|
143
159
|
{/* Narrow, a grid cell; wide, its own width beside the link (the prototype's row). */}
|
|
144
160
|
<Box sx={{ minWidth: 0, [PIX_WIDE]: { flex: "none", "& > *": { width: "auto" } } }}>
|
|
145
161
|
<Button variant="outline" color="neutral" size="md" fullWidth icon={<ContentCopyIcon fontSize="small" />} onClick={onCopyAgain} disabled={stale} dataTestId="pix-copy-again">
|
|
@@ -169,7 +185,7 @@ export function PixAfterCopy(props: PixAfterCopyProps): JSX.Element {
|
|
|
169
185
|
const stale = usePaymentStale();
|
|
170
186
|
return (
|
|
171
187
|
<Box data-testid="pix-after-copy" sx={{ display: "flex", flexWrap: "wrap", gap: 4, alignItems: "flex-start" }}>
|
|
172
|
-
<Box sx={{ flex: "999 1 420px", minWidth: 0, display: "flex", flexDirection: "column", gap: 2.5 }}>
|
|
188
|
+
<Box sx={{ flex: "999 1 420px", minWidth: 0, display: "flex", flexDirection: "column", gap: props.banks?.replacesChecklist ? 1 : 2.5 }}>
|
|
173
189
|
{props.banks ? props.banks.node : <Heading words={words} totalLabel={totalLabel} />}
|
|
174
190
|
{props.banks?.replacesChecklist ? null : <Checklist words={words} deadline={deadline} />}
|
|
175
191
|
<Actions {...props} />
|