@heyama/pay-react-native 1.0.0 → 1.0.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/dist/checkout-core/messages/en.d.ts +1 -0
- package/dist/checkout-core/messages/en.js +1 -0
- package/dist/checkout-core/messages/fr.js +1 -0
- package/dist/checkout-core/models/checkout.enum.d.ts +3 -1
- package/dist/checkout-core/models/checkout.enum.js +2 -0
- package/dist/components/PaymentSheetModal.js +6 -1
- package/dist/components/SheetChosenMethod.d.ts +3 -0
- package/dist/components/SheetChosenMethod.js +60 -0
- package/dist/components/SheetCodeField.js +3 -1
- package/dist/components/SheetForm.d.ts +2 -1
- package/dist/components/SheetForm.js +4 -3
- package/dist/components/SheetLayout.d.ts +5 -4
- package/dist/components/SheetLayout.js +22 -9
- package/dist/components/SheetMethodCard.d.ts +2 -2
- package/dist/components/SheetMethodCard.js +5 -12
- package/dist/components/SheetPhoneField.js +4 -2
- package/dist/models/sheet.interface.d.ts +8 -1
- package/package.json +1 -1
|
@@ -217,6 +217,7 @@ export default {
|
|
|
217
217
|
method: 'This method is not available right now. Pick another one.',
|
|
218
218
|
phone: 'This number does not belong to this method’s country.',
|
|
219
219
|
code: 'Enter the payment code you generated.',
|
|
220
|
+
busy: 'Your earlier attempts are still in progress. Wait for their answer before trying again.',
|
|
220
221
|
},
|
|
221
222
|
toast: {
|
|
222
223
|
copied: 'Reference copied',
|
|
@@ -218,6 +218,7 @@ const messages = {
|
|
|
218
218
|
method: "Ce moyen n'est pas disponible pour le moment. Choisissez-en un autre.",
|
|
219
219
|
phone: "Ce numéro n'est pas du pays de ce moyen.",
|
|
220
220
|
code: 'Saisissez le code de paiement que vous avez généré.',
|
|
221
|
+
busy: 'Vos tentatives précédentes sont encore en cours. Attendez leur réponse avant de réessayer.',
|
|
221
222
|
},
|
|
222
223
|
toast: {
|
|
223
224
|
copied: 'Référence copiée',
|
|
@@ -55,7 +55,9 @@ export declare enum PayRefusalEnum {
|
|
|
55
55
|
METHOD = "method",
|
|
56
56
|
PHONE = "phone",
|
|
57
57
|
/** An OTP method came without a valid code. */
|
|
58
|
-
CODE = "code"
|
|
58
|
+
CODE = "code",
|
|
59
|
+
/** Earlier attempts still pending could use up the payment's tries. */
|
|
60
|
+
BUSY = "busy"
|
|
59
61
|
}
|
|
60
62
|
/**
|
|
61
63
|
* What a provider's card fields page and the checkout tell each other through
|
|
@@ -64,6 +64,8 @@ export var PayRefusalEnum;
|
|
|
64
64
|
PayRefusalEnum["PHONE"] = "phone";
|
|
65
65
|
/** An OTP method came without a valid code. */
|
|
66
66
|
PayRefusalEnum["CODE"] = "code";
|
|
67
|
+
/** Earlier attempts still pending could use up the payment's tries. */
|
|
68
|
+
PayRefusalEnum["BUSY"] = "busy";
|
|
67
69
|
})(PayRefusalEnum || (PayRefusalEnum = {}));
|
|
68
70
|
/**
|
|
69
71
|
* What a provider's card fields page and the checkout tell each other through
|
|
@@ -60,7 +60,10 @@ export function PaymentSheetModal({ calls, request, onClose, }) {
|
|
|
60
60
|
] }) }), _jsx(Animated.View, { style: [
|
|
61
61
|
styles.stage,
|
|
62
62
|
{ transform: [{ translateY: motion.translateY }] },
|
|
63
|
-
], children: _jsx(
|
|
63
|
+
], children: _jsx(View, { style: [styles.stage, { paddingTop: motion.topGap }], children: _jsxs(KeyboardAvoidingView, { behavior: "padding", style: styles.sheet, children: [_jsx(View, { testID: "payment-sheet-floor", style: [
|
|
64
|
+
styles.floor,
|
|
65
|
+
{ backgroundColor: theme.colors.surface },
|
|
66
|
+
] }), _jsx(IntlProvider, { locale: lang, messages: MESSAGES[lang], timeZone: TIME_ZONE, children: _jsx(SheetThemeContext, { value: theme, children: _jsx(SheetContent, { calls: calls, watched: watched, fontsReady: fontsLoaded || fontsError !== null, deviceLocale: deviceLocale, onClose: close, dragHandlers: motion.dragHandlers }) }) })] }) }) })] }) }));
|
|
64
67
|
}
|
|
65
68
|
const styles = StyleSheet.create({
|
|
66
69
|
screen: { flex: 1 },
|
|
@@ -69,4 +72,6 @@ const styles = StyleSheet.create({
|
|
|
69
72
|
// The app's dim shows through around the sheet.
|
|
70
73
|
stage: { flex: 1, justifyContent: 'flex-end', pointerEvents: 'box-none' },
|
|
71
74
|
sheet: { flexShrink: 1 },
|
|
75
|
+
// Under the sheet's rounded top, down to the screen's bottom.
|
|
76
|
+
floor: { position: 'absolute', top: 14, right: 0, bottom: 0, left: 0 },
|
|
72
77
|
});
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ChosenMethodProps } from '../models/sheet.interface.js';
|
|
2
|
+
/** The method picked, on one row, with Change back to the list: as on the web checkout. */
|
|
3
|
+
export declare function SheetChosenMethod({ logo, name, sub, onChange, }: ChosenMethodProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { StyleSheet, TouchableOpacity, View } from 'react-native';
|
|
3
|
+
import { useTranslations } from 'use-intl';
|
|
4
|
+
import { LOGO_SIZE } from "../checkout-core/models/checkout.constants.js";
|
|
5
|
+
import { useSheetTheme } from "../hooks/use-sheet-theme.js";
|
|
6
|
+
import { FigtreeEnum } from "../models/sheet.enum.js";
|
|
7
|
+
import { SheetLogo } from "./SheetLogo.js";
|
|
8
|
+
import { SheetText } from "./SheetText.js";
|
|
9
|
+
/** The method picked, on one row, with Change back to the list: as on the web checkout. */
|
|
10
|
+
export function SheetChosenMethod({ logo, name, sub, onChange, }) {
|
|
11
|
+
const t = useTranslations('checkout');
|
|
12
|
+
const { colors, brand } = useSheetTheme();
|
|
13
|
+
return (_jsxs(View, { testID: "chosen-method", style: [
|
|
14
|
+
styles.row,
|
|
15
|
+
{ borderColor: colors.line2, backgroundColor: colors.surface },
|
|
16
|
+
], children: [_jsxs(View, { children: [_jsx(SheetLogo, { logo: logo, size: LOGO_SIZE.ROW }), _jsx(View, { style: [
|
|
17
|
+
styles.badge,
|
|
18
|
+
{ borderColor: colors.surface, backgroundColor: brand },
|
|
19
|
+
], children: _jsx(View, { style: styles.check }) })] }), _jsxs(View, { style: styles.text, children: [_jsx(SheetText, { weight: FigtreeEnum.SEMI_BOLD, size: 14, numberOfLines: 1, children: name }), _jsx(SheetText, { size: 12, color: colors.muted, numberOfLines: 1, children: sub })] }), _jsx(TouchableOpacity, { onPress: onChange, activeOpacity: 0.7, accessibilityRole: "button", accessibilityLabel: t('change'), hitSlop: 6, style: styles.change, children: _jsx(SheetText, { weight: FigtreeEnum.BOLD, size: 12, color: brand, children: t('change') }) })] }));
|
|
20
|
+
}
|
|
21
|
+
const styles = StyleSheet.create({
|
|
22
|
+
row: {
|
|
23
|
+
flexDirection: 'row',
|
|
24
|
+
alignItems: 'center',
|
|
25
|
+
gap: 12,
|
|
26
|
+
height: 48,
|
|
27
|
+
marginTop: 12,
|
|
28
|
+
borderWidth: 1,
|
|
29
|
+
borderRadius: 12,
|
|
30
|
+
paddingLeft: 8,
|
|
31
|
+
paddingRight: 6,
|
|
32
|
+
},
|
|
33
|
+
badge: {
|
|
34
|
+
position: 'absolute',
|
|
35
|
+
right: -4,
|
|
36
|
+
bottom: -4,
|
|
37
|
+
width: 16,
|
|
38
|
+
height: 16,
|
|
39
|
+
alignItems: 'center',
|
|
40
|
+
justifyContent: 'center',
|
|
41
|
+
borderWidth: 2,
|
|
42
|
+
borderRadius: 8,
|
|
43
|
+
},
|
|
44
|
+
check: {
|
|
45
|
+
width: 3.5,
|
|
46
|
+
height: 6.5,
|
|
47
|
+
marginTop: -1,
|
|
48
|
+
borderColor: 'white',
|
|
49
|
+
borderRightWidth: 1.6,
|
|
50
|
+
borderBottomWidth: 1.6,
|
|
51
|
+
transform: [{ rotate: '45deg' }],
|
|
52
|
+
},
|
|
53
|
+
text: { flex: 1, minWidth: 0 },
|
|
54
|
+
change: {
|
|
55
|
+
height: 32,
|
|
56
|
+
justifyContent: 'center',
|
|
57
|
+
borderRadius: 8,
|
|
58
|
+
paddingHorizontal: 10,
|
|
59
|
+
},
|
|
60
|
+
});
|
|
@@ -47,7 +47,9 @@ export function SheetCodeField({ core }) {
|
|
|
47
47
|
actions.cannotDial();
|
|
48
48
|
});
|
|
49
49
|
};
|
|
50
|
-
return (_jsxs(View, { style: styles.section, children: [_jsx(SheetText, { weight: FigtreeEnum.BOLD, style: styles.label, children: t('otp_label') }), _jsx(SheetInput, { ref: field, accessibilityLabel: t('otp_label'), keyboardType: "number-pad", textContentType: "oneTimeCode", autoComplete: "sms-otp",
|
|
50
|
+
return (_jsxs(View, { style: styles.section, children: [_jsx(SheetText, { weight: FigtreeEnum.BOLD, style: styles.label, children: t('otp_label') }), _jsx(SheetInput, { ref: field, accessibilityLabel: t('otp_label'), keyboardType: "number-pad", textContentType: "oneTimeCode", autoComplete: "sms-otp",
|
|
51
|
+
// iOS's number keypads have no Go key: asking for one adds a bar above them.
|
|
52
|
+
returnKeyType: Platform.OS === 'android' ? 'go' : undefined, maxLength: OTP_MAX_LENGTH, value: ui.code, onChangeText: actions.setCode, onFocus: () => setFocused(true), onBlur: () => setFocused(false), onSubmitEditing: actions.pay, editable: !ui.submitting, style: [styles.input, { borderColor: focused ? brand : colors.line3 }] }), _jsxs(View, { style: [styles.help, { backgroundColor: colors.fill2 }], children: [_jsx(SheetText, { size: 13, color: colors.ink2, style: styles.grow, children: t('otp_help', { method: method.name }) }), _jsxs(TouchableOpacity, { onPress: dial, activeOpacity: 0.7, accessibilityRole: "button", accessibilityLabel: t('sheet.dial', { code }), style: [
|
|
51
53
|
styles.dial,
|
|
52
54
|
{ borderColor: colors.line3, backgroundColor: colors.surface },
|
|
53
55
|
], children: [_jsx(View, { style: [styles.phone, { borderColor: colors.ink }], children: _jsx(View, { style: [styles.speaker, { backgroundColor: colors.ink }] }) }), _jsx(SheetText, { weight: FigtreeEnum.BOLD, size: 14, children: code })] })] })] }));
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { SheetFormProps } from '../models/sheet.interface.js';
|
|
2
2
|
/**
|
|
3
3
|
* The form of design A: the country when there are several, the Mobile
|
|
4
|
-
* Money / Card tabs, the methods two by two
|
|
4
|
+
* Money / Card tabs, the methods two by two (the one picked on its own row),
|
|
5
|
+
* the number, the payment code
|
|
5
6
|
* of an OTP method, and a card's fields.
|
|
6
7
|
*/
|
|
7
8
|
export declare function SheetForm({ core, phoneRef, cardFields }: SheetFormProps): import("react").JSX.Element;
|
|
@@ -7,6 +7,7 @@ import { useSheetTheme } from "../hooks/use-sheet-theme.js";
|
|
|
7
7
|
import { FigtreeEnum } from "../models/sheet.enum.js";
|
|
8
8
|
import { flagOf } from "../models/sheet.utils.js";
|
|
9
9
|
import { SheetCardFields } from "./SheetCardFields.js";
|
|
10
|
+
import { SheetChosenMethod } from "./SheetChosenMethod.js";
|
|
10
11
|
import { SheetCodeField } from "./SheetCodeField.js";
|
|
11
12
|
import { SheetMethodCard } from "./SheetMethodCard.js";
|
|
12
13
|
import { SheetPhoneField } from "./SheetPhoneField.js";
|
|
@@ -21,7 +22,8 @@ function MethodGrid({ cards }) {
|
|
|
21
22
|
}
|
|
22
23
|
/**
|
|
23
24
|
* The form of design A: the country when there are several, the Mobile
|
|
24
|
-
* Money / Card tabs, the methods two by two
|
|
25
|
+
* Money / Card tabs, the methods two by two (the one picked on its own row),
|
|
26
|
+
* the number, the payment code
|
|
25
27
|
* of an OTP method, and a card's fields.
|
|
26
28
|
*/
|
|
27
29
|
export function SheetForm({ core, phoneRef, cardFields }) {
|
|
@@ -39,7 +41,6 @@ export function SheetForm({ core, phoneRef, cardFields }) {
|
|
|
39
41
|
logo: logoOf(method),
|
|
40
42
|
name: method.name,
|
|
41
43
|
sub: subOf(method),
|
|
42
|
-
checked: derived.selected?.id === method.id,
|
|
43
44
|
muted: method.state !== MethodStateEnum.AVAILABLE,
|
|
44
45
|
onSelect: () => actions.selectMethod(method),
|
|
45
46
|
});
|
|
@@ -60,7 +61,7 @@ export function SheetForm({ core, phoneRef, cardFields }) {
|
|
|
60
61
|
? { backgroundColor: colors.ink, borderColor: colors.ink }
|
|
61
62
|
: { borderColor: colors.line3 },
|
|
62
63
|
], children: [_jsx(SheetText, { size: 14, children: flagOf(country) }), _jsx(SheetText, { weight: FigtreeEnum.SEMI_BOLD, size: 13, color: on ? colors.surface : colors.ink, children: t(`countries.${country}`) })] }, country));
|
|
63
|
-
}) })), _jsxs(View, { accessibilityRole: "tablist", style: [styles.tabs, { backgroundColor: colors.fill }], children: [tab(CheckoutTabEnum.MOBILE_MONEY, t('tab_wallet')), tab(CheckoutTabEnum.CARD, t('card'))] }), _jsx(MethodGrid, { cards: cards }), !onCard && _jsx(SheetPhoneField, { core: core, phoneRef: phoneRef }), !onCard && derived.selected?.flow === MethodFlowEnum.OTP && (_jsx(SheetCodeField, { core: core })), onCard && derived.selected?.flow === MethodFlowEnum.CARD_FIELDS && (_jsx(SheetCardFields, { core: core, bridge: cardFields }))] }));
|
|
64
|
+
}) })), _jsxs(View, { accessibilityRole: "tablist", style: [styles.tabs, { backgroundColor: colors.fill }], children: [tab(CheckoutTabEnum.MOBILE_MONEY, t('tab_wallet')), tab(CheckoutTabEnum.CARD, t('card'))] }), derived.selected ? (_jsx(SheetChosenMethod, { logo: logoOf(derived.selected), name: derived.selected.name, sub: derived.selected.network, onChange: actions.openPicker })) : (_jsx(MethodGrid, { cards: cards })), !onCard && _jsx(SheetPhoneField, { core: core, phoneRef: phoneRef }), !onCard && derived.selected?.flow === MethodFlowEnum.OTP && (_jsx(SheetCodeField, { core: core })), onCard && derived.selected?.flow === MethodFlowEnum.CARD_FIELDS && (_jsx(SheetCardFields, { core: core, bridge: cardFields }))] }));
|
|
64
65
|
}
|
|
65
66
|
const styles = StyleSheet.create({
|
|
66
67
|
form: { paddingHorizontal: 18, paddingTop: 14, paddingBottom: 8 },
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { SheetLayoutProps } from '../models/sheet.interface.js';
|
|
2
2
|
/**
|
|
3
|
-
* What scrolls, then
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
3
|
+
* What scrolls, then "Payment secured by Brissoto Pay" over the actions
|
|
4
|
+
* pinned at the bottom, so Pay sits right on the keyboard. What scrolls is
|
|
5
|
+
* as tall as it is, until the sheet runs out of room. The keyboard pushes
|
|
6
|
+
* the actions up, without the room kept for the home bar: what scrolls
|
|
7
|
+
* follows to its end, where the number is.
|
|
7
8
|
*/
|
|
8
9
|
export declare function SheetLayout({ children, foot, secure, }: SheetLayoutProps): import("react").JSX.Element;
|
|
@@ -1,25 +1,37 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useRef } from 'react';
|
|
3
|
-
import { Keyboard, ScrollView, StyleSheet, View } from 'react-native';
|
|
2
|
+
import { useEffect, useRef, useState } from 'react';
|
|
3
|
+
import { Keyboard, Platform, ScrollView, StyleSheet, View } from 'react-native';
|
|
4
4
|
import { useTranslations } from 'use-intl';
|
|
5
5
|
import { useSheetTheme } from "../hooks/use-sheet-theme.js";
|
|
6
6
|
import { FigtreeEnum } from "../models/sheet.enum.js";
|
|
7
7
|
import { SheetText } from "./SheetText.js";
|
|
8
8
|
/**
|
|
9
|
-
* What scrolls, then
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
9
|
+
* What scrolls, then "Payment secured by Brissoto Pay" over the actions
|
|
10
|
+
* pinned at the bottom, so Pay sits right on the keyboard. What scrolls is
|
|
11
|
+
* as tall as it is, until the sheet runs out of room. The keyboard pushes
|
|
12
|
+
* the actions up, without the room kept for the home bar: what scrolls
|
|
13
|
+
* follows to its end, where the number is.
|
|
13
14
|
*/
|
|
14
15
|
export function SheetLayout({ children, foot, secure = true, }) {
|
|
15
16
|
const t = useTranslations('checkout');
|
|
16
17
|
const { colors } = useSheetTheme();
|
|
17
18
|
const scroller = useRef(null);
|
|
19
|
+
const [keyboard, setKeyboard] = useState(false);
|
|
18
20
|
useEffect(() => {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
// iOS tells before the keyboard moves, Android only once it has.
|
|
22
|
+
const ios = Platform.OS === 'ios';
|
|
23
|
+
const listeners = [
|
|
24
|
+
Keyboard.addListener('keyboardDidShow', () => scroller.current?.scrollToEnd()),
|
|
25
|
+
Keyboard.addListener(ios ? 'keyboardWillShow' : 'keyboardDidShow', () => setKeyboard(true)),
|
|
26
|
+
Keyboard.addListener(ios ? 'keyboardWillHide' : 'keyboardDidHide', () => setKeyboard(false)),
|
|
27
|
+
];
|
|
28
|
+
return () => listeners.forEach((listener) => listener.remove());
|
|
21
29
|
}, []);
|
|
22
|
-
return (_jsxs(_Fragment, { children: [_jsx(ScrollView, { ref: scroller, style: styles.body, contentContainerStyle: styles.content, keyboardShouldPersistTaps: "handled", keyboardDismissMode: "interactive", children: children }), (foot || secure) && (_jsxs(View, {
|
|
30
|
+
return (_jsxs(_Fragment, { children: [_jsx(ScrollView, { ref: scroller, style: styles.body, contentContainerStyle: styles.content, keyboardShouldPersistTaps: "handled", keyboardDismissMode: "interactive", children: children }), (foot || secure) && (_jsxs(View, { testID: "sheet-foot", style: [
|
|
31
|
+
styles.foot,
|
|
32
|
+
keyboard && styles.footOnKeyboard,
|
|
33
|
+
{ borderColor: colors.line },
|
|
34
|
+
], children: [secure && (_jsxs(SheetText, { size: 11.5, color: colors.muted, style: styles.secure, children: [t('secured_by'), ' ', _jsx(SheetText, { weight: FigtreeEnum.BOLD, size: 11.5, children: "Brissoto Pay" })] })), foot] }))] }));
|
|
23
35
|
}
|
|
24
36
|
const styles = StyleSheet.create({
|
|
25
37
|
body: { flexGrow: 0, flexShrink: 1, marginTop: 6 },
|
|
@@ -31,5 +43,6 @@ const styles = StyleSheet.create({
|
|
|
31
43
|
paddingBottom: 28,
|
|
32
44
|
gap: 10,
|
|
33
45
|
},
|
|
46
|
+
footOnKeyboard: { paddingBottom: 12 },
|
|
34
47
|
secure: { textAlign: 'center' },
|
|
35
48
|
});
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { MethodCardProps } from '../models/sheet.interface.js';
|
|
2
|
-
/** One method of the grid: logo and radio dot, then its name and network, or why it is greyed. */
|
|
3
|
-
export declare function SheetMethodCard({ logo, name, sub,
|
|
2
|
+
/** One method of the grid: logo and radio dot, then its name and network, or why it is greyed. Picked, it becomes the chosen row. */
|
|
3
|
+
export declare function SheetMethodCard({ logo, name, sub, muted, onSelect, }: MethodCardProps): import("react").JSX.Element;
|
|
@@ -5,19 +5,12 @@ import { useSheetTheme } from "../hooks/use-sheet-theme.js";
|
|
|
5
5
|
import { FigtreeEnum } from "../models/sheet.enum.js";
|
|
6
6
|
import { SheetLogo } from "./SheetLogo.js";
|
|
7
7
|
import { SheetText } from "./SheetText.js";
|
|
8
|
-
/** One method of the grid: logo and radio dot, then its name and network, or why it is greyed. */
|
|
9
|
-
export function SheetMethodCard({ logo, name, sub,
|
|
10
|
-
const { colors
|
|
11
|
-
return (_jsxs(TouchableOpacity, { onPress: onSelect, disabled: muted, activeOpacity: 0.7, accessibilityRole: "radio", accessibilityLabel: `${name}, ${sub}`, accessibilityState: { checked, disabled: muted }, style: [
|
|
12
|
-
styles.card,
|
|
13
|
-
checked
|
|
14
|
-
? { borderColor: brand, borderWidth: 2, padding: 11 }
|
|
15
|
-
: { borderColor: colors.line2 },
|
|
16
|
-
], children: [_jsxs(View, { style: styles.top, children: [_jsx(SheetLogo, { logo: logo, size: LOGO_SIZE.ROW, muted: muted }), _jsx(View, { style: [
|
|
8
|
+
/** One method of the grid: logo and radio dot, then its name and network, or why it is greyed. Picked, it becomes the chosen row. */
|
|
9
|
+
export function SheetMethodCard({ logo, name, sub, muted, onSelect, }) {
|
|
10
|
+
const { colors } = useSheetTheme();
|
|
11
|
+
return (_jsxs(TouchableOpacity, { onPress: onSelect, disabled: muted, activeOpacity: 0.7, accessibilityRole: "radio", accessibilityLabel: `${name}, ${sub}`, accessibilityState: { checked: false, disabled: muted }, style: [styles.card, { borderColor: colors.line2 }], children: [_jsxs(View, { style: styles.top, children: [_jsx(SheetLogo, { logo: logo, size: LOGO_SIZE.ROW, muted: muted }), _jsx(View, { style: [
|
|
17
12
|
styles.radio,
|
|
18
|
-
|
|
19
|
-
? { borderColor: brand, borderWidth: 6 }
|
|
20
|
-
: { borderColor: muted ? colors.line2 : colors.line4 },
|
|
13
|
+
{ borderColor: muted ? colors.line2 : colors.line4 },
|
|
21
14
|
] })] }), _jsx(SheetText, { weight: FigtreeEnum.BOLD, size: 15, numberOfLines: 1, color: muted ? colors.muted : colors.ink, children: name }), _jsx(SheetText, { size: 12.5, numberOfLines: 1, color: muted ? colors.warnInk : colors.muted, children: sub })] }));
|
|
22
15
|
}
|
|
23
16
|
const styles = StyleSheet.create({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Pressable, StyleSheet, View } from 'react-native';
|
|
2
|
+
import { Platform, Pressable, StyleSheet, View } from 'react-native';
|
|
3
3
|
import { useTranslations } from 'use-intl';
|
|
4
4
|
import { useSheetTheme } from "../hooks/use-sheet-theme.js";
|
|
5
5
|
import { FigtreeEnum } from "../models/sheet.enum.js";
|
|
@@ -22,7 +22,9 @@ export function SheetPhoneField({ core, phoneRef }) {
|
|
|
22
22
|
? brand
|
|
23
23
|
: colors.line3,
|
|
24
24
|
},
|
|
25
|
-
], children: [_jsxs(View, { style: [styles.dial, { borderColor: colors.line2 }], children: [_jsx(SheetText, { size: 16, children: flagOf(ui.country) }), _jsx(SheetText, { weight: FigtreeEnum.SEMI_BOLD, size: 16, children: `+${phone.dial}` })] }), _jsx(SheetInput, { ref: phoneRef, accessibilityLabel: t('phone_label'), keyboardType: "phone-pad", textContentType: "telephoneNumber", autoComplete: "tel",
|
|
25
|
+
], children: [_jsxs(View, { style: [styles.dial, { borderColor: colors.line2 }], children: [_jsx(SheetText, { size: 16, children: flagOf(ui.country) }), _jsx(SheetText, { weight: FigtreeEnum.SEMI_BOLD, size: 16, children: `+${phone.dial}` })] }), _jsx(SheetInput, { ref: phoneRef, accessibilityLabel: t('phone_label'), keyboardType: "phone-pad", textContentType: "telephoneNumber", autoComplete: "tel",
|
|
26
|
+
// iOS's number keypads have no Go key: asking for one adds a bar above them.
|
|
27
|
+
returnKeyType: Platform.OS === 'android' ? 'go' : undefined, placeholder: phone.placeholder, value: phone.value, onChangeText: (text) => void phone.type(text, text.length), onFocus: phone.onFocus, onBlur: phone.onBlur, onSubmitEditing: actions.pay, editable: !ui.submitting, style: styles.input })] }), _jsx(View, { accessibilityLiveRegion: "polite", style: styles.message, children: error ? (_jsx(SheetText, { weight: FigtreeEnum.MEDIUM, size: 13, color: colors.danger, children: t(`phone_errors.${error}`) })) : mismatch ? (_jsxs(View, { style: styles.mismatch, children: [_jsx(SheetLogo, { logo: mismatch.logos[0] }), _jsx(SheetText, { size: 13, color: colors.ink2, style: styles.grow, children: t('mismatch', { method: mismatch.name }) }), _jsx(Pressable, { onPress: actions.switchToDetected, accessibilityRole: "button", hitSlop: 6, style: [styles.switch, { borderColor: colors.line3 }], children: _jsx(SheetText, { weight: FigtreeEnum.SEMI_BOLD, size: 13, children: t('switch_to') }) })] })) : (selected && (_jsx(SheetText, { size: 13, color: colors.muted, children: t('helper', { method: selected.name }) }))) })] }));
|
|
26
28
|
}
|
|
27
29
|
const styles = StyleSheet.create({
|
|
28
30
|
section: { marginTop: 18 },
|
|
@@ -175,11 +175,18 @@ export interface MethodCardProps {
|
|
|
175
175
|
logo: ProviderLogoEnum;
|
|
176
176
|
name: string;
|
|
177
177
|
sub: string;
|
|
178
|
-
checked: boolean;
|
|
179
178
|
/** Greyed and not pressable: in maintenance, or not offered yet. */
|
|
180
179
|
muted: boolean;
|
|
181
180
|
onSelect?: () => void;
|
|
182
181
|
}
|
|
182
|
+
export interface ChosenMethodProps {
|
|
183
|
+
logo: ProviderLogoEnum;
|
|
184
|
+
name: string;
|
|
185
|
+
/** Its network. */
|
|
186
|
+
sub: string;
|
|
187
|
+
/** Back to the list. */
|
|
188
|
+
onChange: () => void;
|
|
189
|
+
}
|
|
183
190
|
export interface MethodGridCard extends MethodCardProps {
|
|
184
191
|
id: string;
|
|
185
192
|
}
|