@brissoto/pay-react-native 1.5.0 → 1.5.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/README.md +10 -10
- package/dist/checkout-core/messages/en.d.ts +0 -8
- package/dist/checkout-core/messages/en.js +0 -8
- package/dist/checkout-core/messages/fr.js +0 -8
- package/dist/checkout-core/models/checkout.enum.d.ts +1 -7
- package/dist/checkout-core/models/checkout.enum.js +0 -6
- package/dist/checkout-core/models/checkout.view.utils.js +0 -5
- package/dist/components/SheetContent.js +0 -2
- package/dist/components/SheetTerminal.d.ts +1 -4
- package/dist/components/SheetTerminal.js +2 -13
- package/dist/models/sheet.interface.d.ts +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -139,16 +139,16 @@ Open the sheet with it: `presentPayment({ paymentId })`. Ship on the `payment.pa
|
|
|
139
139
|
|
|
140
140
|
## Results
|
|
141
141
|
|
|
142
|
-
| `result.status` | When
|
|
143
|
-
| --------------- |
|
|
144
|
-
| `paid` | The payment is paid.
|
|
145
|
-
| `pending` | The payer closed the sheet while a prompt waited on their phone: it may still go through.
|
|
146
|
-
| `closed` | The payer closed the sheet with the payment still open.
|
|
147
|
-
| `cancelled` | The payment was cancelled.
|
|
148
|
-
| `expired` | The payment expired.
|
|
149
|
-
| `locked` | Too many failed tries: the payment can no longer be paid.
|
|
150
|
-
| `refunded` | A store refunded the payment.
|
|
151
|
-
| `unavailable` | No method could take the payment (`payment.unavailable`):
|
|
142
|
+
| `result.status` | When |
|
|
143
|
+
| --------------- | --------------------------------------------------------------------------------------------- |
|
|
144
|
+
| `paid` | The payment is paid. |
|
|
145
|
+
| `pending` | The payer closed the sheet while a prompt waited on their phone: it may still go through. |
|
|
146
|
+
| `closed` | The payer closed the sheet with the payment still open. |
|
|
147
|
+
| `cancelled` | The payment was cancelled. |
|
|
148
|
+
| `expired` | The payment expired. |
|
|
149
|
+
| `locked` | Too many failed tries: the payment can no longer be paid. |
|
|
150
|
+
| `refunded` | A store refunded the payment. |
|
|
151
|
+
| `unavailable` | No method could take the payment (`payment.unavailable`): its tabs said so. Nothing was paid. |
|
|
152
152
|
|
|
153
153
|
When the sheet could not show the payment, `status` is `closed` and `result.error` says why: `not_found` (no payment has this id) or `network` (it could not load).
|
|
154
154
|
|
|
@@ -214,14 +214,6 @@ declare const _default: {
|
|
|
214
214
|
title: string;
|
|
215
215
|
body: string;
|
|
216
216
|
};
|
|
217
|
-
no_method: {
|
|
218
|
-
title: string;
|
|
219
|
-
body: string;
|
|
220
|
-
};
|
|
221
|
-
unavailable_screen: {
|
|
222
|
-
title: string;
|
|
223
|
-
body: string;
|
|
224
|
-
};
|
|
225
217
|
contact_support: string;
|
|
226
218
|
get_help: string;
|
|
227
219
|
returning: string;
|
|
@@ -214,14 +214,6 @@ export default {
|
|
|
214
214
|
title: "This link isn't valid",
|
|
215
215
|
body: "We couldn't find this payment. The link may be incomplete. Open it again from the app you were paying in.",
|
|
216
216
|
},
|
|
217
|
-
no_method: {
|
|
218
|
-
title: 'No way to pay right now',
|
|
219
|
-
body: '{app} offers no payment method at the moment. Try again later.',
|
|
220
|
-
},
|
|
221
|
-
unavailable_screen: {
|
|
222
|
-
title: 'Payment unavailable',
|
|
223
|
-
body: 'No payment method is available in your country yet.',
|
|
224
|
-
},
|
|
225
217
|
contact_support: 'Contact support',
|
|
226
218
|
get_help: 'Get help',
|
|
227
219
|
returning: 'Returning to {app}…',
|
|
@@ -214,14 +214,6 @@ const messages = {
|
|
|
214
214
|
title: "Ce lien n'est pas valide",
|
|
215
215
|
body: "Nous ne trouvons pas ce paiement. Le lien est peut-être incomplet. Rouvrez-le depuis l'application où vous payiez.",
|
|
216
216
|
},
|
|
217
|
-
no_method: {
|
|
218
|
-
title: 'Aucun moyen de paiement pour le moment',
|
|
219
|
-
body: '{app} ne propose aucun moyen de paiement en ce moment. Réessayez plus tard.',
|
|
220
|
-
},
|
|
221
|
-
unavailable_screen: {
|
|
222
|
-
title: 'Paiement indisponible',
|
|
223
|
-
body: "Aucun moyen de paiement n'est encore disponible dans votre pays.",
|
|
224
|
-
},
|
|
225
217
|
contact_support: 'Contacter le support',
|
|
226
218
|
get_help: "Obtenir de l'aide",
|
|
227
219
|
returning: 'Retour à {app}…',
|
|
@@ -10,10 +10,6 @@ export declare enum CheckoutScreenEnum {
|
|
|
10
10
|
CANCELLED = "cancelled",
|
|
11
11
|
LOCKED = "locked",
|
|
12
12
|
INVALID = "invalid",
|
|
13
|
-
/** Every method went off since the link was made: nothing to pay with. */
|
|
14
|
-
NO_METHOD = "no_method",
|
|
15
|
-
/** No method could take it when it was made: it never will. */
|
|
16
|
-
UNAVAILABLE = "unavailable",
|
|
17
13
|
REDIRECT = "redirect"
|
|
18
14
|
}
|
|
19
15
|
/** The form's two steps: pick a method, then what it needs (the number and its code, or the card). */
|
|
@@ -191,9 +187,7 @@ export declare enum TerminalKindEnum {
|
|
|
191
187
|
EXPIRED = "expired",
|
|
192
188
|
CANCELLED = "cancelled",
|
|
193
189
|
LOCKED = "locked",
|
|
194
|
-
INVALID = "invalid"
|
|
195
|
-
NO_METHOD = "no_method",
|
|
196
|
-
UNAVAILABLE = "unavailable"
|
|
190
|
+
INVALID = "invalid"
|
|
197
191
|
}
|
|
198
192
|
export declare enum CheckoutButtonVariantEnum {
|
|
199
193
|
PRIMARY = "primary",
|
|
@@ -11,10 +11,6 @@ export var CheckoutScreenEnum;
|
|
|
11
11
|
CheckoutScreenEnum["CANCELLED"] = "cancelled";
|
|
12
12
|
CheckoutScreenEnum["LOCKED"] = "locked";
|
|
13
13
|
CheckoutScreenEnum["INVALID"] = "invalid";
|
|
14
|
-
/** Every method went off since the link was made: nothing to pay with. */
|
|
15
|
-
CheckoutScreenEnum["NO_METHOD"] = "no_method";
|
|
16
|
-
/** No method could take it when it was made: it never will. */
|
|
17
|
-
CheckoutScreenEnum["UNAVAILABLE"] = "unavailable";
|
|
18
14
|
CheckoutScreenEnum["REDIRECT"] = "redirect";
|
|
19
15
|
})(CheckoutScreenEnum || (CheckoutScreenEnum = {}));
|
|
20
16
|
/** The form's two steps: pick a method, then what it needs (the number and its code, or the card). */
|
|
@@ -214,8 +210,6 @@ export var TerminalKindEnum;
|
|
|
214
210
|
TerminalKindEnum["CANCELLED"] = "cancelled";
|
|
215
211
|
TerminalKindEnum["LOCKED"] = "locked";
|
|
216
212
|
TerminalKindEnum["INVALID"] = "invalid";
|
|
217
|
-
TerminalKindEnum["NO_METHOD"] = "no_method";
|
|
218
|
-
TerminalKindEnum["UNAVAILABLE"] = "unavailable";
|
|
219
213
|
})(TerminalKindEnum || (TerminalKindEnum = {}));
|
|
220
214
|
export var CheckoutButtonVariantEnum;
|
|
221
215
|
(function (CheckoutButtonVariantEnum) {
|
|
@@ -87,8 +87,6 @@ export function screenOf(view, ui) {
|
|
|
87
87
|
const terminal = TERMINAL_SCREEN[view.status];
|
|
88
88
|
if (terminal)
|
|
89
89
|
return terminal;
|
|
90
|
-
if (view.unavailable)
|
|
91
|
-
return CheckoutScreenEnum.UNAVAILABLE;
|
|
92
90
|
// A store product's price comes once the sheet said it opened.
|
|
93
91
|
if (!view.priced)
|
|
94
92
|
return CheckoutScreenEnum.LOADING;
|
|
@@ -99,9 +97,6 @@ export function screenOf(view, ui) {
|
|
|
99
97
|
: null;
|
|
100
98
|
if (shown === AttemptStatusEnum.PENDING)
|
|
101
99
|
return CheckoutScreenEnum.WAITING;
|
|
102
|
-
// The app offers nothing any more: no form to fill, no other method to try.
|
|
103
|
-
if (view.methods.length === 0)
|
|
104
|
-
return CheckoutScreenEnum.NO_METHOD;
|
|
105
100
|
// A store's sheet closed with nothing bought: back on the form, no failure.
|
|
106
101
|
if (shown === AttemptStatusEnum.FAILED &&
|
|
107
102
|
attempt.failureReason !== FailureReasonEnum.CANCELLED) {
|
|
@@ -29,8 +29,6 @@ const TERMINAL_KIND = {
|
|
|
29
29
|
[CheckoutScreenEnum.EXPIRED]: TerminalKindEnum.EXPIRED,
|
|
30
30
|
[CheckoutScreenEnum.CANCELLED]: TerminalKindEnum.CANCELLED,
|
|
31
31
|
[CheckoutScreenEnum.LOCKED]: TerminalKindEnum.LOCKED,
|
|
32
|
-
[CheckoutScreenEnum.NO_METHOD]: TerminalKindEnum.NO_METHOD,
|
|
33
|
-
[CheckoutScreenEnum.UNAVAILABLE]: TerminalKindEnum.UNAVAILABLE,
|
|
34
32
|
};
|
|
35
33
|
/** The sheet's screens, driven by the shared checkout controller. */
|
|
36
34
|
export function SheetContent({ payment, fontsReady, deviceLocale, ipCountry, onClose, dragHandlers, backRef, }) {
|
|
@@ -1,6 +1,3 @@
|
|
|
1
1
|
import type { SheetTerminalProps } from '../models/sheet.interface.js';
|
|
2
|
-
/**
|
|
3
|
-
* A payment that cannot be paid any more, said plainly, and the way back to
|
|
4
|
-
* the app. One no method could ever take has a single Close.
|
|
5
|
-
*/
|
|
2
|
+
/** A payment that cannot be paid any more, said plainly, and the way back to the app. */
|
|
6
3
|
export declare function SheetTerminal({ core, kind, onClose }: SheetTerminalProps): import("react").JSX.Element;
|
|
@@ -9,23 +9,12 @@ const COPY_KEY = {
|
|
|
9
9
|
[TerminalKindEnum.EXPIRED]: 'expired',
|
|
10
10
|
[TerminalKindEnum.CANCELLED]: 'cancelled',
|
|
11
11
|
[TerminalKindEnum.LOCKED]: 'locked_screen',
|
|
12
|
-
[TerminalKindEnum.NO_METHOD]: 'no_method',
|
|
13
|
-
[TerminalKindEnum.UNAVAILABLE]: 'unavailable_screen',
|
|
14
12
|
};
|
|
15
|
-
/**
|
|
16
|
-
* A payment that cannot be paid any more, said plainly, and the way back to
|
|
17
|
-
* the app. One no method could ever take has a single Close.
|
|
18
|
-
*/
|
|
13
|
+
/** A payment that cannot be paid any more, said plainly, and the way back to the app. */
|
|
19
14
|
export function SheetTerminal({ core, kind, onClose }) {
|
|
20
15
|
const t = useTranslations('checkout');
|
|
21
16
|
const app = core.view.app.name;
|
|
22
17
|
const key = COPY_KEY[kind];
|
|
23
18
|
const locked = kind === TerminalKindEnum.LOCKED;
|
|
24
|
-
|
|
25
|
-
let icon = SheetIconEnum.CLOCK;
|
|
26
|
-
if (locked)
|
|
27
|
-
icon = SheetIconEnum.LOCK;
|
|
28
|
-
else if (unavailable)
|
|
29
|
-
icon = SheetIconEnum.BAN;
|
|
30
|
-
return (_jsx(SheetLayout, { foot: _jsx(SheetButton, { label: unavailable ? t('close') : t('return_to', { app }), onPress: onClose }), children: _jsx(SheetMessage, { title: t(`${key}.title`), body: t(`${key}.body`, { app }), icon: icon, danger: locked }) }));
|
|
19
|
+
return (_jsx(SheetLayout, { foot: _jsx(SheetButton, { label: t('return_to', { app }), onPress: onClose }), children: _jsx(SheetMessage, { title: t(`${key}.title`), body: t(`${key}.body`, { app }), icon: locked ? SheetIconEnum.LOCK : SheetIconEnum.CLOCK, danger: locked }) }));
|
|
31
20
|
}
|
|
@@ -7,8 +7,8 @@ import type { CardFieldsMessage, CheckoutColors, CheckoutCore, CheckoutToast, Ch
|
|
|
7
7
|
import type { FigtreeEnum, SheetIconEnum, StoreProductTypeEnum, WebBrowserResultEnum } from './sheet.enum.js';
|
|
8
8
|
/**
|
|
9
9
|
* How the sheet ended. `closed`: the payer closed it with the payment still
|
|
10
|
-
* open. `unavailable`: no method could take the payment, so
|
|
11
|
-
* so and
|
|
10
|
+
* open. `unavailable`: no method could take the payment, so its tabs said
|
|
11
|
+
* so and nothing was paid (`payment.unavailable` on the server). A hint only: ship on `payment.paid` from the webhook or `getPayment`.
|
|
12
12
|
*/
|
|
13
13
|
export type PaymentSheetStatus = 'paid' | 'pending' | 'cancelled' | 'expired' | 'locked' | 'refunded' | 'closed'
|
|
14
14
|
/** No payment method could take the payment: the sheet said so, nothing was paid. */
|