@12-apps/payments-frontend 3.20.1 → 3.21.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.20.1",
3
+ "version": "3.21.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.",
@@ -158,6 +158,7 @@ function ActivationBody({
158
158
  <CardVerification
159
159
  verifyChargeUrl={config.verifyChargeUrl(provider)}
160
160
  provider={provider}
161
+ displayName={displayName}
161
162
  ownerEmail={ownerEmail}
162
163
  onVerified={onVerified}
163
164
  CardSurface={config.CardSurface}
@@ -35,10 +35,13 @@ export type CardSurface = ComponentType<{ children: ReactNode }>;
35
35
  function ChargeForm({
36
36
  verification,
37
37
  amountLabel,
38
+ displayName,
38
39
  validateTaxId,
39
40
  }: {
40
41
  verification: ActivationCharge;
41
42
  amountLabel: string | null;
43
+ /** The provider being activated, as the owner knows it. */
44
+ displayName: string;
42
45
  validateTaxId: (value: string) => string | undefined;
43
46
  }): JSX.Element {
44
47
  const { taxId, actions } = useActivationCopy();
@@ -65,7 +68,7 @@ function ChargeForm({
65
68
  placeholder={taxId.placeholder}
66
69
  value={formatCpf(cpf)}
67
70
  error={Boolean(cpfError)}
68
- helperText={cpfError ?? taxId.hint}
71
+ helperText={cpfError ?? taxId.hint(displayName)}
69
72
  onChange={(event) => setCpf(onlyDigits(event.target.value))}
70
73
  onBlur={() => validateTaxId(cpf)}
71
74
  data-testid="verify-charge-cpf"
@@ -110,6 +113,7 @@ function CardOutcome({
110
113
  export function CardVerification({
111
114
  verifyChargeUrl,
112
115
  provider,
116
+ displayName,
113
117
  ownerEmail,
114
118
  onVerified,
115
119
  CardSurface: Surface,
@@ -118,6 +122,8 @@ export function CardVerification({
118
122
  }: {
119
123
  verifyChargeUrl: string;
120
124
  provider: string;
125
+ /** The name the OWNER reads; `provider` beside it is the machine key. */
126
+ displayName: string;
121
127
  /** Who is paying — the signed-in owner. The host reads its own session. */
122
128
  ownerEmail: string;
123
129
  onVerified: () => void;
@@ -173,6 +179,7 @@ export function CardVerification({
173
179
  <ChargeForm
174
180
  verification={verification}
175
181
  amountLabel={amountLabel}
182
+ displayName={displayName}
176
183
  validateTaxId={validateTaxId}
177
184
  />
178
185
  </Surface>
@@ -88,7 +88,7 @@ export const EN_US_ACTIVATION_STEP_COPY: ActivationStepCopy = {
88
88
  },
89
89
  taxId: {
90
90
  label: "Cardholder's CPF",
91
- hint: 'PagBank requires it on every card charge.',
91
+ hint: (displayName) => `${displayName} requires it on every card charge.`,
92
92
  placeholder: '000.000.000-00',
93
93
  },
94
94
  charge: {
@@ -25,8 +25,10 @@ import type { ActivationStepCopy } from './copy';
25
25
  * sent looking for "Integrated Checkout" is looking for a screen that does not
26
26
  * exist. **CPF** and its `000.000.000-00` mask are a Brazilian document and a
27
27
  * FORMAT — a translated mask shows a shape the field refuses. **PagBank** and
28
- * **InfinitePay** are names. `{provider}` is this package's own placeholder,
29
- * substituted after the sentence is chosen.
28
+ * **InfinitePay** are names PagBank now only as the console label above, since
29
+ * the tax-id hint takes the provider as an ARGUMENT rather than naming one
30
+ * (FUT-675). `{provider}` is this package's own placeholder, substituted after
31
+ * the sentence is chosen.
30
32
  */
31
33
  export const PT_BR_ACTIVATION_STEP_COPY: ActivationStepCopy = {
32
34
  intro: {
@@ -104,7 +106,22 @@ export const PT_BR_ACTIVATION_STEP_COPY: ActivationStepCopy = {
104
106
  },
105
107
  taxId: {
106
108
  label: 'CPF do titular',
107
- hint: 'Exigido pelo PagBank em qualquer cobrança no cartão.',
109
+ // No article, deliberately (FUT-675). This field renders from the CARD
110
+ // flow only — pagbank, stone, stripe — and no single article fits all
111
+ // three: "a Stone" and "a Stripe" are natural where PagBank is
112
+ // conventionally "o PagBank", so the previous round's "A ${displayName}
113
+ // exige" bought Stone's grammar with PagBank's. `por` takes no
114
+ // contraction, so one string is correct for every name.
115
+ //
116
+ // The refusal sentences above still take an article ("A ${displayName}
117
+ // recusou") and are NOT covered by that argument — they belong to the
118
+ // redirect flow, which today renders for InfinitePay alone because
119
+ // `card/tokenize.ts` has a tokenizer for exactly the three names above and
120
+ // everything else FALLS BACK to redirect. That is a default, not a rule, so
121
+ // the second redirect provider ever added inherits this same bug — along
122
+ // with `settledBody`, which takes no `displayName` at all and so tells any
123
+ // such provider's owner that refunds happen in InfinitePay's app.
124
+ hint: (displayName) => `Exigido por ${displayName} em qualquer cobrança no cartão.`,
108
125
  placeholder: '000.000.000-00',
109
126
  },
110
127
  charge: {
@@ -126,7 +126,14 @@ export interface ActivationOutcomeCopy {
126
126
  /** The CPF field the card flow asks for beside the card. */
127
127
  export interface ActivationTaxIdCopy {
128
128
  readonly label: string;
129
- readonly hint: string;
129
+ /**
130
+ * WHO is asking for the document, by name. A parameter rather than a
131
+ * sentence, for the reason the setup guide's `credentials` takes one: the
132
+ * provider is a fact about the connection being activated, not about the
133
+ * language. Both packs had spelled one provider's name into the string, so a
134
+ * Stone activation told the owner PagBank required their CPF (FUT-675).
135
+ */
136
+ readonly hint: (displayName: string) => string;
130
137
  readonly placeholder: string;
131
138
  }
132
139