@odus/checkout 0.20.0-beta.0 → 0.20.0
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 +37 -0
- package/dist/checkout.d.ts +22 -0
- package/dist/checkout.es.js +6886 -3434
- package/dist/index.css +1 -1
- package/dist/package.json +3 -2
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -299,6 +299,32 @@ This approach is useful for:
|
|
|
299
299
|
- Adding custom tracking or analytics before redirecting
|
|
300
300
|
- Implementing custom UI transitions during the authentication flow
|
|
301
301
|
|
|
302
|
+
### Displaying Error Messages Programmatically
|
|
303
|
+
|
|
304
|
+
You can display custom error messages using the checkout's built-in Alert UI. This is particularly useful for showing errors that occur outside the normal payment flow, such as after a failed 3DS redirect:
|
|
305
|
+
|
|
306
|
+
```javascript
|
|
307
|
+
const checkout = new OdusCheckout({
|
|
308
|
+
// ... configuration
|
|
309
|
+
});
|
|
310
|
+
|
|
311
|
+
checkout.mount('#checkout-container');
|
|
312
|
+
|
|
313
|
+
// Display a custom error message (bypasses disableErrorMessages flag)
|
|
314
|
+
checkout.displayError('Payment failed after 3DS authentication. Please try again.');
|
|
315
|
+
|
|
316
|
+
// Clear the error message when needed
|
|
317
|
+
checkout.clearError();
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
**Common use cases:**
|
|
321
|
+
|
|
322
|
+
- Displaying errors after returning from 3DS authentication
|
|
323
|
+
- Showing validation errors from your backend
|
|
324
|
+
- Communicating payment failures that occur outside the checkout flow
|
|
325
|
+
|
|
326
|
+
**Note:** The `displayError` method always displays the message, even when `disableErrorMessages: true` is set in the configuration, since it represents an explicit intent to show a message. Both methods require the checkout to be mounted first.
|
|
327
|
+
|
|
302
328
|
## API Reference
|
|
303
329
|
|
|
304
330
|
### OdusCheckout Class
|
|
@@ -308,9 +334,18 @@ class OdusCheckout {
|
|
|
308
334
|
constructor(config: CheckoutConfig);
|
|
309
335
|
mount(containerId: string): this;
|
|
310
336
|
unmount(): void;
|
|
337
|
+
displayError(message: string): void;
|
|
338
|
+
clearError(): void;
|
|
311
339
|
}
|
|
312
340
|
```
|
|
313
341
|
|
|
342
|
+
#### Methods
|
|
343
|
+
|
|
344
|
+
- **`mount(containerId: string)`** - Mounts the checkout form to the specified container element.
|
|
345
|
+
- **`unmount()`** - Unmounts and cleans up the checkout form.
|
|
346
|
+
- **`displayError(message: string)`** - Displays a custom error message using the checkout's built-in Alert UI. This method bypasses the `disableErrorMessages` configuration flag. Throws an error if called before `mount()`.
|
|
347
|
+
- **`clearError()`** - Removes the currently displayed error message. Throws an error if called before `mount()`.
|
|
348
|
+
|
|
314
349
|
### CheckoutConfig Type
|
|
315
350
|
|
|
316
351
|
```typescript
|
|
@@ -342,6 +377,8 @@ type Locale = 'en' | 'de' | 'es' | 'fr' | 'pl' | 'pt' | 'it' | 'tr';
|
|
|
342
377
|
interface CheckoutInstance {
|
|
343
378
|
mount(containerId: string): this;
|
|
344
379
|
unmount(): void;
|
|
380
|
+
displayError(message: string): void;
|
|
381
|
+
clearError(): void;
|
|
345
382
|
}
|
|
346
383
|
```
|
|
347
384
|
|
package/dist/checkout.d.ts
CHANGED
|
@@ -40,6 +40,8 @@ declare type Appearance = {
|
|
|
40
40
|
phoneNumber?: {
|
|
41
41
|
enabled: boolean;
|
|
42
42
|
label?: string;
|
|
43
|
+
defaultCountry?: string;
|
|
44
|
+
allowedCountries?: string[];
|
|
43
45
|
};
|
|
44
46
|
billingFields?: {
|
|
45
47
|
street?: {
|
|
@@ -133,11 +135,15 @@ export declare interface CheckoutInstance {
|
|
|
133
135
|
mount: (containerId: string) => CheckoutInstance;
|
|
134
136
|
unmount: () => void;
|
|
135
137
|
associatePayment: (paymentId: string, checkoutKey: string) => Promise<void>;
|
|
138
|
+
displayError: (message: string) => void;
|
|
139
|
+
clearError: () => void;
|
|
136
140
|
}
|
|
137
141
|
|
|
138
142
|
export declare const deLocale: {
|
|
139
143
|
"email": "E-Mail",
|
|
140
144
|
"phoneNumber": "Telefonnummer",
|
|
145
|
+
"countrySearch": "Länder suchen",
|
|
146
|
+
"countryNoResults": "Keine Ergebnisse gefunden",
|
|
141
147
|
"cardholderNameLabel": "Name des/der Karteninhaber/in",
|
|
142
148
|
"cardInformation": "Kartendaten",
|
|
143
149
|
"cardholderNamePlaceholder": "Vollständiger Name",
|
|
@@ -193,6 +199,8 @@ export declare const deLocale: {
|
|
|
193
199
|
export declare const enLocale: {
|
|
194
200
|
"email": "Email",
|
|
195
201
|
"phoneNumber": "Phone Number",
|
|
202
|
+
"countrySearch": "Search countries",
|
|
203
|
+
"countryNoResults": "No results found",
|
|
196
204
|
"cardholderNameLabel": "Cardholder name",
|
|
197
205
|
"cardInformation": "Card information",
|
|
198
206
|
"cardholderNamePlaceholder": "Full name on card",
|
|
@@ -250,6 +258,8 @@ declare type Environment = 'test' | 'live';
|
|
|
250
258
|
export declare const esLocale: {
|
|
251
259
|
"email": "Correo electrónico",
|
|
252
260
|
"phoneNumber": "Número de teléfono",
|
|
261
|
+
"countrySearch": "Buscar países",
|
|
262
|
+
"countryNoResults": "No se encontraron resultados",
|
|
253
263
|
"cardholderNameLabel": "Nombre del titular de la tarjeta",
|
|
254
264
|
"cardInformation": "Información de la tarjeta",
|
|
255
265
|
"cardholderNamePlaceholder": "Nombre completo en la tarjeta",
|
|
@@ -305,6 +315,8 @@ export declare const esLocale: {
|
|
|
305
315
|
export declare const frLocale: {
|
|
306
316
|
"email": "E-mail",
|
|
307
317
|
"phoneNumber": "Numéro de téléphone",
|
|
318
|
+
"countrySearch": "Rechercher des pays",
|
|
319
|
+
"countryNoResults": "Aucun résultat trouvé",
|
|
308
320
|
"cardholderNameLabel": "Nom du titulaire de la carte",
|
|
309
321
|
"cardInformation": "Informations de la carte",
|
|
310
322
|
"cardholderNamePlaceholder": "Nom complet figurant sur la carte",
|
|
@@ -368,6 +380,8 @@ declare type InitialValues = {
|
|
|
368
380
|
export declare const itLocale: {
|
|
369
381
|
"email": "Email",
|
|
370
382
|
"phoneNumber": "Numero di telefono",
|
|
383
|
+
"countrySearch": "Cerca paesi",
|
|
384
|
+
"countryNoResults": "Nessun risultato trovato",
|
|
371
385
|
"cardholderNameLabel": "Nome del titolare della carta",
|
|
372
386
|
"cardInformation": "Informazioni sulla carta",
|
|
373
387
|
"cardholderNamePlaceholder": "Nome completo sulla carta",
|
|
@@ -437,6 +451,8 @@ export declare class OdusCheckout {
|
|
|
437
451
|
private handlePaymentResponse;
|
|
438
452
|
private handleAuthorizationError;
|
|
439
453
|
private getPaymentMethod;
|
|
454
|
+
displayError(message: string): void;
|
|
455
|
+
clearError(): void;
|
|
440
456
|
associatePayment(paymentId: string, checkoutKey: string): Promise<void>;
|
|
441
457
|
}
|
|
442
458
|
|
|
@@ -445,6 +461,8 @@ declare type PaymentResult = 'pending' | 'three_ds_requested' | 'authorized' | '
|
|
|
445
461
|
export declare const plLocale: {
|
|
446
462
|
"email": "Adres e-mail",
|
|
447
463
|
"phoneNumber": "Numer telefonu",
|
|
464
|
+
"countrySearch": "Szukaj krajów",
|
|
465
|
+
"countryNoResults": "Brak wyników",
|
|
448
466
|
"cardholderNameLabel": "Imię i nazwisko posiadacza karty",
|
|
449
467
|
"cardInformation": "Informacje o karcie",
|
|
450
468
|
"cardholderNamePlaceholder": "Imię i nazwisko na karcie",
|
|
@@ -500,6 +518,8 @@ export declare const plLocale: {
|
|
|
500
518
|
export declare const ptLocale: {
|
|
501
519
|
"email": "E-mail",
|
|
502
520
|
"phoneNumber": "Número de telefone",
|
|
521
|
+
"countrySearch": "Pesquisar países",
|
|
522
|
+
"countryNoResults": "Nenhum resultado encontrado",
|
|
503
523
|
"cardholderNameLabel": "Nome do titular do cartão",
|
|
504
524
|
"cardInformation": "Informações do cartão",
|
|
505
525
|
"cardholderNamePlaceholder": "Nome completo no cartão",
|
|
@@ -563,6 +583,8 @@ export declare const pushMeasurement: (name: string, value: number, unit?: strin
|
|
|
563
583
|
export declare const trLocale: {
|
|
564
584
|
"email": "E-posta",
|
|
565
585
|
"phoneNumber": "Telefon Numarası",
|
|
586
|
+
"countrySearch": "Ülkeleri ara",
|
|
587
|
+
"countryNoResults": "Sonuç bulunamadı",
|
|
566
588
|
"cardholderNameLabel": "Kart sahibinin adı",
|
|
567
589
|
"cardInformation": "Kart bilgileri",
|
|
568
590
|
"cardholderNamePlaceholder": "Kart üzerindeki tam ad",
|