@12-apps/payments-frontend 3.38.0 → 3.40.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.
Files changed (31) hide show
  1. package/package.json +1 -1
  2. package/src/card/types.ts +6 -0
  3. package/src/components/checkout/card-sources.ts +11 -2
  4. package/src/components/checkout/list/bank-apps.ts +113 -0
  5. package/src/components/checkout/list/bank-en-US.ts +26 -0
  6. package/src/components/checkout/list/bank-logos.tsx +35 -0
  7. package/src/components/checkout/list/bank-pt-BR.ts +26 -0
  8. package/src/components/checkout/list/charge-runners.tsx +22 -3
  9. package/src/components/checkout/list/choice-list.tsx +4 -1
  10. package/src/components/checkout/list/choice.ts +30 -5
  11. package/src/components/checkout/list/context.tsx +27 -3
  12. package/src/components/checkout/list/en-US.ts +2 -0
  13. package/src/components/checkout/list/list-face.tsx +92 -29
  14. package/src/components/checkout/list/list-memory.ts +96 -0
  15. package/src/components/checkout/list/list-pix.tsx +153 -17
  16. package/src/components/checkout/list/online-content.tsx +11 -4
  17. package/src/components/checkout/list/option-row.tsx +4 -2
  18. package/src/components/checkout/list/payment-list-step.tsx +2 -1
  19. package/src/components/checkout/list/pix-banks.tsx +178 -0
  20. package/src/components/checkout/list/pt-BR.ts +2 -0
  21. package/src/components/checkout/list/types.ts +126 -4
  22. package/src/components/checkout/list/use-capability.ts +15 -10
  23. package/src/components/checkout/list/use-list-charge.ts +37 -12
  24. package/src/components/checkout/list/use-list-state.ts +11 -8
  25. package/src/components/checkout/pix-after-copy.tsx +8 -2
  26. package/src/components/checkout/pix-parts.tsx +56 -0
  27. package/src/components/checkout/pix-view.tsx +2 -0
  28. package/src/components/checkout/transport.ts +3 -1
  29. package/src/components/checkout/types.ts +9 -9
  30. package/src/index.ts +1 -1
  31. package/src/locales.ts +12 -1
@@ -2,11 +2,10 @@
2
2
  * The buyer checkout's payment vocabulary (FUT-7 / FUT-44 / FUT-58, moved into
3
3
  * the library by FUT-564).
4
4
  *
5
- * Pure types with no runtime imports. Everything here is PAYMENT: what a
6
- * charge, an order-in-payment, a buyer identity or a provider protocol looks
7
- * like to the screens in this folder. The host-side halves — the cart, the
8
- * catalog, order CREATION — stay in the host app and reach the flow through
9
- * the ports declared on `CheckoutFlowProps`.
5
+ * Pure types with no runtime imports. Everything here is PAYMENT: what a charge, an
6
+ * order-in-payment, a buyer identity or a provider protocol looks like to the screens in
7
+ * this folder. The host-side halves — the cart, the catalog, order CREATION — stay in the
8
+ * host app and reach the flow through the ports declared on `CheckoutFlowProps`.
10
9
  */
11
10
 
12
11
  import type { CheckoutDecline, CheckoutDeclineReason } from "./decline";
@@ -15,10 +14,9 @@ import type { CheckoutDecline, CheckoutDeclineReason } from "./decline";
15
14
  export type PaymentMethod = "PIX" | "CARD";
16
15
 
17
16
  /**
18
- * The digital wallets a chain entry can charge (FUT-471/472). Mirrors the
19
- * backend's `WalletType` — a wallet is not a fourth method: it is another way
20
- * of producing the CARD instrument, so it rides the CARD tile and the CARD
21
- * charge.
17
+ * The digital wallets a chain entry can charge (FUT-471/472). Mirrors the backend's
18
+ * `WalletType` — a wallet is not a fourth method: it is another way of producing the
19
+ * CARD instrument, so it rides the CARD tile and the CARD charge.
22
20
  */
23
21
  export type CheckoutWalletType = "GOOGLE_PAY" | "APPLE_PAY";
24
22
 
@@ -114,6 +112,8 @@ export interface CheckoutOrder {
114
112
  appliedDiscounts: CheckoutDiscount[];
115
113
  /** Pre-formatted BRL grand total (e.g. `R$ 42,90`). */
116
114
  totalLabel: string;
115
+ /** Cents the provider is asked for when a balance the host holds pays part of {@link totalCents}; absent ⇒ the total. */
116
+ amountDueCents?: number;
117
117
  /** Present only when {@link method} is `"PIX"`. */
118
118
  pix?: PixCharge;
119
119
  /**
package/src/index.ts CHANGED
@@ -56,7 +56,7 @@ export { PT_BR_CHECKOUT_PAYMENT_COPY } from './components/checkout-payment-pt-BR
56
56
  // ---------------------------------------------------------------------------
57
57
  export { CheckoutFlow, type CheckoutCartView, type CheckoutFlowProps } from './components/checkout/checkout-flow';
58
58
  // The Pagamento step as ONE list (FUT-3591/3592) — opt-in via `CheckoutFlowProps.paymentList`.
59
- export type { CheckoutDoorOption, CheckoutListChoice, CheckoutListHold, CheckoutOnlineChoice, CheckoutPaymentList, PaymentListCopy } from './components/checkout/list/types';
59
+ export type { CheckoutDoorOption, CheckoutListChoice, CheckoutListHold, CheckoutOnlineChoice, CheckoutPaymentList, CheckoutPixBank, PaymentListCopy, PixBankCopy, PixBankId, PixBankName } from './components/checkout/list/types';
60
60
  export { PT_BR_PAYMENT_LIST_COPY } from './components/checkout/list/pt-BR';
61
61
  export type { BackActionEmphasis } from './components/checkout/payment-status-parts';
62
62
  export type { CheckoutDeliverySummary, CheckoutSummaryLine } from './components/checkout/payment-summary';
package/src/locales.ts CHANGED
@@ -22,7 +22,9 @@ import type { CheckoutScreensCopy } from './components/checkout/screens-copy';
22
22
  import { PT_BR_CHECKOUT_SCREENS_COPY } from './components/checkout/screens-pt-BR';
23
23
  import { EN_US_PAYMENT_LIST_COPY } from './components/checkout/list/en-US';
24
24
  import { PT_BR_PAYMENT_LIST_COPY } from './components/checkout/list/pt-BR';
25
- import type { PaymentListCopy } from './components/checkout/list/types';
25
+ import { EN_US_PIX_BANK_COPY } from './components/checkout/list/bank-en-US';
26
+ import { PT_BR_PIX_BANK_COPY } from './components/checkout/list/bank-pt-BR';
27
+ import type { PaymentListCopy, PixBankCopy } from './components/checkout/list/types';
26
28
  import type { CheckoutViewCopy, PaymentStatusCopy } from './components/checkout/view-copy';
27
29
  import type { PlatformHomologacaoCopy } from './components/platform/copy';
28
30
  import { EN_US_PLATFORM_HOMOLOGACAO_COPY } from './components/platform/en-US';
@@ -88,6 +90,15 @@ export const PAYMENT_LIST_COPY = {
88
90
  'en-US': EN_US_PAYMENT_LIST_COPY,
89
91
  } as const satisfies LocalePack<PaymentListCopy>;
90
92
 
93
+ /**
94
+ * The Pix-to-bank flow's words (FUT-3612) — `CheckoutFlowProps.paymentList.pixBank.copy`.
95
+ * Read by the SHOPPER.
96
+ */
97
+ export const PIX_BANK_COPY = {
98
+ 'pt-BR': PT_BR_PIX_BANK_COPY,
99
+ 'en-US': EN_US_PIX_BANK_COPY,
100
+ } as const satisfies LocalePack<PixBankCopy>;
101
+
91
102
  export const CHECKOUT_COPY = {
92
103
  'pt-BR': PT_BR_CHECKOUT_COPY,
93
104
  'en-US': EN_US_CHECKOUT_COPY,