@12-apps/payments-frontend 3.31.0 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@12-apps/payments-frontend",
3
- "version": "3.31.0",
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: copy.pixDescription, icon: <PixIcon /> },
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 }}>
@@ -254,11 +254,9 @@ export function PixView({
254
254
  // The locale is the HOST's (FUT-760): it decides what a buyer reads off the
255
255
  // clock, so it travels with the sentence it feeds rather than being frozen
256
256
  // to the origin host's here.
257
- const validUntil = new Date(pix.expiresAt).toLocaleTimeString(copy.expiryLocale, {
258
- hour: "2-digit",
259
- minute: "2-digit",
260
- });
261
- const sentences = pixSentences(copy, pix.confirmation === "MANUAL");
257
+ const validUntil = new Date(pix.expiresAt).toLocaleTimeString(copy.expiryLocale, { hour: "2-digit", minute: "2-digit" });
258
+ const manual = pix.confirmation === "MANUAL";
259
+ const sentences = pixSentences(copy, manual);
262
260
 
263
261
  return (
264
262
  <Box
@@ -287,7 +285,7 @@ export function PixView({
287
285
  {sentences.validUntil(validUntil)}
288
286
  </Text>
289
287
 
290
- <PixPollFooter error={error} timedOut={timedOut} onCheckAgain={checkAgain} manual={sentences !== copy} />
288
+ <PixPollFooter error={error} timedOut={timedOut} onCheckAgain={checkAgain} manual={manual} />
291
289
  </Box>
292
290
  );
293
291
  }
@@ -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
  },
@@ -44,7 +45,7 @@ export const PT_BR_CHECKOUT_SCREENS_COPY: CheckoutScreensCopy = {
44
45
  instructions: (totalLabel) =>
45
46
  `Pague ${totalLabel} com o QR code ou o código abaixo. A loja confere o recebimento e confirma o seu pedido.`,
46
47
  validUntil: (time) => `A loja confirma o pagamento até ${time}.`,
47
- awaiting: 'Aguardando a loja confirmar o pagamento…',
48
+ awaiting: 'Aguardando confirmação do pagamento pela loja…',
48
49
  },
49
50
  },
50
51
  card: {
@@ -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
- * Optional, and the DEGRADE DIRECTION IS "SAY NOTHING": an older host serves
281
- * no name, and a hand-off screen then describes where the buyer is going
282
- * without naming it, rather than printing the internal `provider` id — a
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;