@brissoto/pay-react-native 1.6.2 → 1.6.3

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.
@@ -54,6 +54,10 @@ export function SheetContent({ payment, fontsReady, deviceLocale, ipCountry, onC
54
54
  const terminal = TERMINAL_KIND[screen];
55
55
  const { step } = derived;
56
56
  const details = step === CheckoutStepEnum.DETAILS;
57
+ // PayPal's own button names no amount: the summary stays over its details.
58
+ const paysOwnWay = details &&
59
+ !!derived.selected &&
60
+ FLOW_TRAITS[derived.selected.flow].ownButton;
57
61
  const busy = ui.submitting || ui.cardPaying;
58
62
  // The form shows: the methods, or the details of the method picked.
59
63
  const onForm = !loading &&
@@ -116,7 +120,7 @@ export function SheetContent({ payment, fontsReady, deviceLocale, ipCountry, onC
116
120
  : t('pay_plain', {
117
121
  amount: formatAmount(derived.total.amount, derived.total.currency),
118
122
  currency: CURRENCY_LABEL[derived.total.currency],
119
- }), busy: busy, inactive: !derived.canPay, onPress: actions.pay })) : (_jsx(SheetButton, { label: t('continue'), inactive: !derived.selected, onPress: actions.continueToDetails })), children: _jsxs(SheetStep, { core: core, phoneRef: phoneRef, children: [!details && _jsx(SheetSummary, { total: derived.total }), _jsx(SheetForm, { core: core, phoneRef: phoneRef, cardFields: cardFields, store: store })] }) }));
123
+ }), busy: busy, inactive: !derived.canPay, onPress: actions.pay })) : (_jsx(SheetButton, { label: t('continue'), inactive: !derived.selected, onPress: actions.continueToDetails })), children: _jsxs(SheetStep, { core: core, phoneRef: phoneRef, children: [(!details || paysOwnWay) && (_jsx(SheetSummary, { total: derived.total, storePrice: onStore ? store.offer.displayPrice : undefined })), _jsx(SheetForm, { core: core, phoneRef: phoneRef, cardFields: cardFields, store: store })] }) }));
120
124
  }
121
125
  return (_jsxs(View, { testID: "payment-sheet", accessibilityViewIsModal: true, onAccessibilityEscape: onClose, style: [styles.sheet, { backgroundColor: colors.surface }], children: [_jsx(SheetHeader, { view: view, loading: loading, onClose: onClose, onBack: canGoBack ? back : undefined, dragHandlers: dragHandlers }), body, _jsx(SheetToast, { toast: core.toast })] }));
122
126
  }
@@ -11,7 +11,13 @@ export function SheetMethodCard({ logo, name, sub, muted, checked, missing, alon
11
11
  const { colors, brand } = useSheetTheme();
12
12
  const red = missing && !muted && !checked;
13
13
  const texts = (_jsxs(_Fragment, { children: [_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 })] }));
14
- return (_jsxs(TouchableOpacity, { onPress: onSelect, disabled: muted, activeOpacity: PRESSED_OPACITY, accessibilityRole: "radio", accessibilityLabel: `${name}, ${sub}`, accessibilityState: { checked, disabled: muted }, style: [
14
+ return (_jsxs(TouchableOpacity
15
+ // Greyed, it still takes a tap: the controller says why it cannot be picked.
16
+ , {
17
+ // Greyed, it still takes a tap: the controller says why it cannot be picked.
18
+ onPress: onSelect, activeOpacity: muted ? 1 : PRESSED_OPACITY, accessibilityRole: "radio", accessibilityLabel: `${name}, ${sub}`,
19
+ // Not `disabled`: React Native would drop the tap that says why.
20
+ accessibilityState: { checked }, style: [
15
21
  styles.card,
16
22
  checked
17
23
  ? [styles.cardRinged, { borderColor: brand }]
@@ -1,3 +1,6 @@
1
1
  import type { SheetSummaryProps } from '../models/sheet.interface.js';
2
- /** The amount to pay, in PayPal's currency while it is picked. The order and its lines stay on the web checkout. */
3
- export declare function SheetSummary({ total }: SheetSummaryProps): import("react").JSX.Element;
2
+ /**
3
+ * The amount to pay, in PayPal's currency while it is picked, or the store's
4
+ * own price on its tab. The order and its lines stay on the web checkout.
5
+ */
6
+ export declare function SheetSummary({ total, storePrice }: SheetSummaryProps): import("react").JSX.Element;
@@ -6,12 +6,15 @@ import { formatAmount } from "../checkout-core/models/checkout.money.utils.js";
6
6
  import { useSheetTheme } from "../hooks/use-sheet-theme.js";
7
7
  import { FigtreeEnum } from "../models/sheet.enum.js";
8
8
  import { SheetText } from "./SheetText.js";
9
- /** The amount to pay, in PayPal's currency while it is picked. The order and its lines stay on the web checkout. */
10
- export function SheetSummary({ total }) {
9
+ /**
10
+ * The amount to pay, in PayPal's currency while it is picked, or the store's
11
+ * own price on its tab. The order and its lines stay on the web checkout.
12
+ */
13
+ export function SheetSummary({ total, storePrice }) {
11
14
  const t = useTranslations('checkout');
12
15
  const { colors } = useSheetTheme();
13
16
  const { amount, currency } = total;
14
- return (_jsxs(View, { style: [styles.summary, { borderColor: colors.line }], children: [_jsx(SheetText, { size: 13, color: colors.muted, children: t('total_label') }), _jsxs(View, { style: styles.amountRow, children: [_jsx(SheetText, { weight: FigtreeEnum.EXTRA_BOLD, size: 34, style: styles.amount, children: formatAmount(amount, currency) }), _jsx(SheetText, { weight: FigtreeEnum.SEMI_BOLD, size: 16, color: colors.ink2, children: CURRENCY_LABEL[currency] })] })] }));
17
+ return (_jsxs(View, { style: [styles.summary, { borderColor: colors.line }], children: [_jsx(SheetText, { size: 13, color: colors.muted, children: t('total_label') }), _jsxs(View, { testID: "sheet-amount", style: styles.amountRow, children: [_jsx(SheetText, { weight: FigtreeEnum.EXTRA_BOLD, size: 34, style: styles.amount, children: storePrice ?? formatAmount(amount, currency) }), !storePrice && (_jsx(SheetText, { weight: FigtreeEnum.SEMI_BOLD, size: 16, color: colors.ink2, children: CURRENCY_LABEL[currency] }))] })] }));
15
18
  }
16
19
  const styles = StyleSheet.create({
17
20
  summary: {
@@ -139,6 +139,8 @@ export interface SheetHeaderProps {
139
139
  export interface SheetSummaryProps {
140
140
  /** What the payer pays: the picked method's price (ADR 0012). */
141
141
  total: Price;
142
+ /** On a store's tab: the store's own price, as it writes it (`$1.99`). */
143
+ storePrice?: string;
142
144
  }
143
145
  export interface SheetPaypalButtonProps {
144
146
  busy: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brissoto/pay-react-native",
3
- "version": "1.6.2",
3
+ "version": "1.6.3",
4
4
  "description": "Brissoto Pay for Expo and React Native apps: the payment sheet.",
5
5
  "license": "MIT",
6
6
  "sideEffects": false,