@12-apps/payments-frontend 3.32.0 → 3.33.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@12-apps/payments-frontend",
3
- "version": "3.32.0",
3
+ "version": "3.33.0",
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.",
@@ -66,7 +66,7 @@ function pixWaitMs(expiresAt: string | undefined): number {
66
66
  }
67
67
 
68
68
  /** The copyable "copia e cola" strip with its copy button. */
69
- function PixCodeBox({ pix }: { pix: PixCharge }): JSX.Element {
69
+ function PixCodeBox({ pix, onCopied }: { pix: PixCharge; onCopied: () => void }): JSX.Element {
70
70
  const { Button, Text } = useCheckoutComponents();
71
71
  const copy = useCheckoutCopy().screens.pix;
72
72
  const [copied, setCopied] = useState(false);
@@ -75,6 +75,7 @@ function PixCodeBox({ pix }: { pix: PixCharge }): JSX.Element {
75
75
  try {
76
76
  await navigator.clipboard?.writeText(pix.copyPaste);
77
77
  setCopied(true);
78
+ onCopied();
78
79
  setTimeout(() => setCopied(false), 2000);
79
80
  } catch {
80
81
  /* clipboard unavailable — the code is still visible to copy manually */
@@ -200,6 +201,43 @@ function PixPollFooter({
200
201
  );
201
202
  }
202
203
 
204
+ /**
205
+ * What a store-confirmed Pix says once its code is copied (FUT-3232).
206
+ *
207
+ * The footer's caption already names the store's wait, but in a grey line
208
+ * under the QR that a buyer on their way to the bank app does not read. Copying
209
+ * is that moment, so it answers with a notice that stays: the wait can run for
210
+ * minutes, and "volte para esta tela" is the instruction that keeps the buyer
211
+ * where the confirmation will land.
212
+ */
213
+ function ManualCopiedNotice({ manual, copied }: { manual: boolean; copied: boolean }): JSX.Element | null {
214
+ const { Alert } = useCheckoutComponents();
215
+ const notice = useCheckoutCopy().screens.pix.manual?.copied;
216
+ if (!manual || !copied || !notice) return null;
217
+ return (
218
+ <Box sx={{ width: "100%", maxWidth: 420, textAlign: "left" }}>
219
+ <Alert
220
+ variant="info"
221
+ title={notice.title}
222
+ description={notice.description}
223
+ showIcon
224
+ data-testid="pix-manual-copied"
225
+ />
226
+ </Box>
227
+ );
228
+ }
229
+
230
+ /** The code strip and, once it has been copied, what that copy means. */
231
+ function PixCopyRow({ pix, manual }: { pix: PixCharge; manual: boolean }): JSX.Element {
232
+ const [copied, setCopied] = useState(false);
233
+ return (
234
+ <>
235
+ <PixCodeBox pix={pix} onCopied={() => setCopied(true)} />
236
+ <ManualCopiedNotice manual={manual} copied={copied} />
237
+ </>
238
+ );
239
+ }
240
+
203
241
  /**
204
242
  * The pane's two sentences that depend on who confirms. A store-confirmed Pix
205
243
  * must not say "a confirmação é automática": nothing confirms it but the store.
@@ -279,7 +317,7 @@ export function PixView({
279
317
  <QRCode value={pix.copyPaste} size={200} />
280
318
  </Box>
281
319
 
282
- <PixCodeBox pix={pix} />
320
+ <PixCopyRow pix={pix} manual={manual} />
283
321
 
284
322
  <Text variant="caption" size="xs" color="secondary" as="p" data-testid="pix-expiry">
285
323
  {sentences.validUntil(validUntil)}
@@ -123,6 +123,13 @@ export interface PixPaneCopy {
123
123
  instructions(totalLabel: string): string;
124
124
  validUntil(time: string): string;
125
125
  awaiting: string;
126
+ /**
127
+ * Shown once the buyer copies the code, and kept: copying is the moment
128
+ * they leave for their bank app, so it is when they must learn the wait
129
+ * that follows is the STORE's, and that the answer arrives on this screen.
130
+ * Optional so a host's own copy without it simply shows no notice.
131
+ */
132
+ copied?: { title: string; description: string };
126
133
  };
127
134
  }
128
135
 
@@ -57,6 +57,11 @@ export const EN_US_CHECKOUT_SCREENS_COPY: CheckoutScreensCopy = {
57
57
  `Pay ${totalLabel} with the QR code or the code below. The store checks it arrived and confirms your order.`,
58
58
  validUntil: (time) => `The store confirms the payment by ${time}.`,
59
59
  awaiting: 'Waiting for the store to confirm the payment…',
60
+ copied: {
61
+ title: 'Code copied. Now pay in your bank app',
62
+ description:
63
+ 'Once you have paid, come back to this screen and wait: the store checks it arrived and confirms your order right here.',
64
+ },
60
65
  },
61
66
  },
62
67
  card: {
@@ -46,6 +46,11 @@ export const PT_BR_CHECKOUT_SCREENS_COPY: CheckoutScreensCopy = {
46
46
  `Pague ${totalLabel} com o QR code ou o código abaixo. A loja confere o recebimento e confirma o seu pedido.`,
47
47
  validUntil: (time) => `A loja confirma o pagamento até ${time}.`,
48
48
  awaiting: 'Aguardando confirmação do pagamento pela loja…',
49
+ copied: {
50
+ title: 'Código copiado. Agora pague no app do seu banco',
51
+ description:
52
+ 'Depois de pagar, volte para esta tela e aguarde: a loja confere o recebimento e confirma o seu pedido aqui mesmo.',
53
+ },
49
54
  },
50
55
  },
51
56
  card: {