@12-apps/payments-frontend 3.27.0 → 3.27.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.27.0",
3
+ "version": "3.27.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.",
@@ -118,34 +118,70 @@ export function PickedTender<T extends string>({
118
118
  >
119
119
  <CloseIcon fontSize="small" />
120
120
  </IconButton>
121
- <InputBase
121
+ <AmountField
122
+ label={copy.amountLabel(tender.label)}
122
123
  value={value}
123
- onChange={(event) => onType(event.target.value)}
124
- onFocus={(event: FocusEvent<HTMLInputElement>) => event.target.select()}
124
+ currencySign={currencySign}
125
125
  autoFocus={autoFocus}
126
- inputProps={{
127
- inputMode: 'decimal',
128
- 'aria-label': copy.amountLabel(tender.label),
129
- 'data-testid': `${testId}-amount`,
130
- }}
131
- startAdornment={
132
- <Typography variant="caption" color="text.secondary" noWrap sx={{ mr: 0.5 }}>
133
- {shared ? `${currencySign} ${copy.sharedHint}` : currencySign}
134
- </Typography>
135
- }
136
- sx={{
137
- borderBottom: 1.5,
138
- borderColor: 'divider',
139
- fontWeight: 500,
140
- fontVariantNumeric: 'tabular-nums',
141
- '&.Mui-focused': { borderColor: 'primary.main' },
142
- '& input': { textAlign: 'right', py: 0.375, minWidth: 0 },
143
- }}
126
+ testId={`${testId}-amount`}
127
+ onType={onType}
144
128
  />
129
+ {/* Under the field rather than beside it, where a narrow card had no room
130
+ for it and the amount both. */}
131
+ {shared ? (
132
+ <Typography variant="caption" color="text.secondary" sx={{ mt: -0.5 }}>
133
+ {copy.sharedHint}
134
+ </Typography>
135
+ ) : null}
145
136
  </Box>
146
137
  );
147
138
  }
148
139
 
140
+ /** A picked card's amount: the currency sign in front, never squeezed. */
141
+ function AmountField({
142
+ label,
143
+ value,
144
+ currencySign,
145
+ autoFocus,
146
+ testId,
147
+ onType,
148
+ }: {
149
+ label: string;
150
+ value: string;
151
+ currencySign: string;
152
+ autoFocus: boolean;
153
+ testId: string;
154
+ onType: (typed: string) => void;
155
+ }) {
156
+ return (
157
+ <InputBase
158
+ value={value}
159
+ onChange={(event) => onType(event.target.value)}
160
+ onFocus={(event: FocusEvent<HTMLInputElement>) => event.target.select()}
161
+ autoFocus={autoFocus}
162
+ inputProps={{
163
+ inputMode: 'decimal',
164
+ 'aria-label': label,
165
+ 'data-testid': testId,
166
+ }}
167
+ startAdornment={
168
+ // Never shrunk: squeezed by the amount beside it, the sign read "R."
169
+ <Typography variant="caption" color="text.secondary" sx={{ mr: 0.5, flexShrink: 0 }}>
170
+ {currencySign}
171
+ </Typography>
172
+ }
173
+ sx={{
174
+ borderBottom: 1.5,
175
+ borderColor: 'divider',
176
+ fontWeight: 500,
177
+ fontVariantNumeric: 'tabular-nums',
178
+ '&.Mui-focused': { borderColor: 'primary.main' },
179
+ '& input': { textAlign: 'right', py: 0.375, minWidth: 0 },
180
+ }}
181
+ />
182
+ );
183
+ }
184
+
149
185
  function TenderHeading<T extends string>({ tender }: { tender: TenderOption<T> }) {
150
186
  return (
151
187
  <Box sx={{ display: 'flex', alignItems: 'center', gap: 1, pr: 3, minWidth: 0 }}>
@@ -169,7 +169,13 @@ function Actions({
169
169
  return (
170
170
  <Box sx={{ display: 'flex', justifyContent: onCancel ? 'space-between' : 'flex-end', gap: 1 }}>
171
171
  {onCancel ? (
172
- <Button variant="text" color="inherit" onClick={onCancel} data-testid={`${testId}-cancel`}>
172
+ <Button
173
+ variant="text"
174
+ color="inherit"
175
+ onClick={onCancel}
176
+ data-testid={`${testId}-cancel`}
177
+ sx={{ textTransform: 'none' }}
178
+ >
173
179
  {copy.cancel}
174
180
  </Button>
175
181
  ) : null}
@@ -178,6 +184,9 @@ function Actions({
178
184
  disabled={onConfirm === null}
179
185
  onClick={onConfirm ?? undefined}
180
186
  data-testid={`${testId}-confirm`}
187
+ // The confirm reads a sentence with a figure in it — "Falta R$ 2,00" —
188
+ // which MUI's default capitals would shout.
189
+ sx={{ textTransform: 'none' }}
181
190
  >
182
191
  {label}
183
192
  </Button>