@odus/checkout 0.6.1 → 0.6.2
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 +49 -13
- package/dist/checkout.d.ts +2 -2
- package/dist/checkout.es.js +45 -44
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -82,6 +82,29 @@ function CheckoutPage() {
|
|
|
82
82
|
|
|
83
83
|
> **Important**: Always import the styles using `import '@odus/checkout/styles'` to ensure the checkout UI renders correctly. Without the styles, the checkout component will not display properly.
|
|
84
84
|
|
|
85
|
+
### TypeScript Support
|
|
86
|
+
|
|
87
|
+
For TypeScript users, we export type definitions to enhance your development experience with proper type checking and autocompletion:
|
|
88
|
+
|
|
89
|
+
```typescript
|
|
90
|
+
// Import the main class and TypeScript types
|
|
91
|
+
import { OdusCheckout, CheckoutConfig, CheckoutInstance, Locale } from '@odus/checkout';
|
|
92
|
+
|
|
93
|
+
// Now you can use these types in your code
|
|
94
|
+
const config: CheckoutConfig = {
|
|
95
|
+
apiKey: 'your_api_key',
|
|
96
|
+
profileId: 'your_profile_id',
|
|
97
|
+
paymentId: 'your_payment_id',
|
|
98
|
+
checkoutKey: 'your_unique_checkout_key',
|
|
99
|
+
returnUrl: 'https://your-website.com/payment-complete',
|
|
100
|
+
environment: 'test',
|
|
101
|
+
locale: 'en', // Type-safe locale values
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
// The checkout instance is properly typed
|
|
105
|
+
const checkout: CheckoutInstance = new OdusCheckout(config);
|
|
106
|
+
```
|
|
107
|
+
|
|
85
108
|
## Getting Started
|
|
86
109
|
|
|
87
110
|
### Basic Implementation
|
|
@@ -138,18 +161,18 @@ Make sure you have a container element in your HTML:
|
|
|
138
161
|
|
|
139
162
|
When initializing the Odus Checkout, you can configure various options:
|
|
140
163
|
|
|
141
|
-
| Option | Type | Required | Description
|
|
142
|
-
| ---------------------- | ------- | -------- |
|
|
143
|
-
| `apiKey` | string | ✅ | Your Odus API key obtained from the dashboard
|
|
144
|
-
| `profileId` | string | ✅ | Your Odus checkout profile ID
|
|
145
|
-
| `checkoutKey` | string | ✅ | Unique checkout key for this payment session
|
|
146
|
-
| `paymentId` | string | ✅ | The ID of the payment being processed
|
|
147
|
-
| `environment` | string | ✅ | API environment to use - either 'test' or 'live'
|
|
148
|
-
| `returnUrl` | string | ✅ | The URL where the customer will be redirected after 3DS authentication or other redirect flows
|
|
149
|
-
| `locale` |
|
|
150
|
-
| `disableErrorMessages` | boolean | | Set to `true` to disable built-in error messages (defaults to `false`)
|
|
151
|
-
| `manualActionHandling` | boolean | | Set to `true` to manually handle 3DS redirects via the `onActionRequired` callback (defaults to `false`)
|
|
152
|
-
| `callbacks` | object | | Event callback functions (see [Callbacks](#callbacks-and-event-handling))
|
|
164
|
+
| Option | Type | Required | Description |
|
|
165
|
+
| ---------------------- | ------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
166
|
+
| `apiKey` | string | ✅ | Your Odus API key obtained from the dashboard's API Keys page |
|
|
167
|
+
| `profileId` | string | ✅ | Your Odus checkout profile ID obtained from the dashboard's Checkout Builder page |
|
|
168
|
+
| `checkoutKey` | string | ✅ | Unique checkout key for this payment session |
|
|
169
|
+
| `paymentId` | string | ✅ | The ID of the payment being processed |
|
|
170
|
+
| `environment` | string | ✅ | API environment to use - either 'test' or 'live' |
|
|
171
|
+
| `returnUrl` | string | ✅ | The URL where the customer will be redirected after 3DS authentication or other redirect flows |
|
|
172
|
+
| `locale` | Locale | | Language code for checkout localization. If not set, automatically defaults to the customer's browser language when supported. If browser language is not supported, falls back to English. |
|
|
173
|
+
| `disableErrorMessages` | boolean | | Set to `true` to disable built-in error messages (defaults to `false`) |
|
|
174
|
+
| `manualActionHandling` | boolean | | Set to `true` to manually handle 3DS redirects via the `onActionRequired` callback (defaults to `false`) |
|
|
175
|
+
| `callbacks` | object | | Event callback functions (see [Callbacks](#callbacks-and-event-handling)) |
|
|
153
176
|
|
|
154
177
|
## Payment Methods
|
|
155
178
|
|
|
@@ -307,10 +330,23 @@ type CheckoutConfig = {
|
|
|
307
330
|
onActionRequired?: (redirectUrl: string) => void;
|
|
308
331
|
onLoadingStateChange?: (isLoading: boolean) => void;
|
|
309
332
|
};
|
|
310
|
-
locale?:
|
|
333
|
+
locale?: Locale;
|
|
311
334
|
disableErrorMessages?: boolean;
|
|
312
335
|
manualActionHandling?: boolean;
|
|
313
336
|
};
|
|
337
|
+
|
|
338
|
+
// Where Locale is a type representing supported languages
|
|
339
|
+
type Locale = 'en' | 'de' | 'es' | 'fr' | 'pl' | 'pt' | 'it' | 'tr';
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
### CheckoutInstance Type
|
|
343
|
+
|
|
344
|
+
```typescript
|
|
345
|
+
// This represents the checkout instance returned when you create a new OdusCheckout
|
|
346
|
+
interface CheckoutInstance {
|
|
347
|
+
mount(containerId: string): this;
|
|
348
|
+
unmount(): void;
|
|
349
|
+
}
|
|
314
350
|
```
|
|
315
351
|
|
|
316
352
|
## Troubleshooting
|
package/dist/checkout.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export declare type CheckoutConfig = {
|
|
|
13
13
|
paymentId: string;
|
|
14
14
|
environment: Environment;
|
|
15
15
|
callbacks?: CheckoutCallbacks;
|
|
16
|
-
locale?: Locale
|
|
16
|
+
locale?: Locale;
|
|
17
17
|
disableErrorMessages?: boolean;
|
|
18
18
|
manualActionHandling?: boolean;
|
|
19
19
|
};
|
|
@@ -155,7 +155,7 @@ export declare const itLocale: {
|
|
|
155
155
|
}
|
|
156
156
|
};
|
|
157
157
|
|
|
158
|
-
declare type Locale = 'en' | 'de' | 'es' | 'fr' | 'pl' | 'pt' | 'it' | 'tr';
|
|
158
|
+
export declare type Locale = 'en' | 'de' | 'es' | 'fr' | 'pl' | 'pt' | 'it' | 'tr';
|
|
159
159
|
|
|
160
160
|
export declare class OdusCheckout {
|
|
161
161
|
private config;
|
package/dist/checkout.es.js
CHANGED
|
@@ -199,7 +199,7 @@ class q {
|
|
|
199
199
|
function k(o) {
|
|
200
200
|
return new q(o);
|
|
201
201
|
}
|
|
202
|
-
function
|
|
202
|
+
function _({
|
|
203
203
|
apiKey: o,
|
|
204
204
|
profileId: e,
|
|
205
205
|
environment: t
|
|
@@ -312,7 +312,7 @@ const N = {
|
|
|
312
312
|
"comcast.net": ["comcast.com", "comcat.net", "comcst.net", "comcastnet", "comcast.nt", "comcas.net"],
|
|
313
313
|
"verizon.net": ["verizon.com", "verizon.nt", "verizonnet", "verizn.net", "verizon.ne", "verzon.net"],
|
|
314
314
|
"att.net": ["att.com", "at.net", "att.nt", "attnet", "att.ne", "attt.net"]
|
|
315
|
-
},
|
|
315
|
+
}, G = (o) => {
|
|
316
316
|
if (!o || o.includes("."))
|
|
317
317
|
return null;
|
|
318
318
|
const e = ["com", "net", "org", "edu", "gov", "io", "co"];
|
|
@@ -373,7 +373,7 @@ const N = {
|
|
|
373
373
|
};
|
|
374
374
|
const r = t.substring(0, a), s = t.substring(a + 1);
|
|
375
375
|
if (!s.includes(".")) {
|
|
376
|
-
const l =
|
|
376
|
+
const l = G(s);
|
|
377
377
|
if (l)
|
|
378
378
|
return {
|
|
379
379
|
isValid: !1,
|
|
@@ -677,7 +677,7 @@ const te = "E-Mail", ie = "Name des/der Karteninhaber/in", ae = "Kartendaten", r
|
|
|
677
677
|
loading: ge,
|
|
678
678
|
buttonTexts: fe,
|
|
679
679
|
validation: ye
|
|
680
|
-
}, Ee = "Correo electrónico", Ce = "Nombre del titular de la tarjeta", be = "Información de la tarjeta", xe = "Nombre completo en la tarjeta", Se = "MM / AA", Fe = "Por favor, no cierre esta ventana", we = { pay: "PAGAR", submit: "ENVIAR", getPlan: "OBTENER MI PLAN", donate: "DONAR", book: "RESERVAR AHORA", order: "ORDENAR AHORA" },
|
|
680
|
+
}, Ee = "Correo electrónico", Ce = "Nombre del titular de la tarjeta", be = "Información de la tarjeta", xe = "Nombre completo en la tarjeta", Se = "MM / AA", Fe = "Por favor, no cierre esta ventana", we = { pay: "PAGAR", submit: "ENVIAR", getPlan: "OBTENER MI PLAN", donate: "DONAR", book: "RESERVAR AHORA", order: "ORDENAR AHORA" }, Le = { emailSuggestion: "¿Quisiste decir {{email}}?", emailInvalid: "Su correo electrónico no es válido", cardExpiryInvalid: "La fecha de vencimiento de la tarjeta ya pasó", cardExpiryFormat: "La fecha de vencimiento de su tarjeta está incompleta", cardSecurityFormat: "El código de seguridad de su tarjeta está incompleto", nameRequired: "Por favor, ingrese el nombre tal como aparece en su tarjeta", cardNumberInvalid: "Su número de tarjeta no es válido" }, Me = {
|
|
681
681
|
email: Ee,
|
|
682
682
|
cardholderNameLabel: Ce,
|
|
683
683
|
cardInformation: be,
|
|
@@ -685,8 +685,8 @@ const te = "E-Mail", ie = "Name des/der Karteninhaber/in", ae = "Kartendaten", r
|
|
|
685
685
|
cardExpiry: Se,
|
|
686
686
|
loading: Fe,
|
|
687
687
|
buttonTexts: we,
|
|
688
|
-
validation:
|
|
689
|
-
}, ke = "E-mail", Te = "Nom du titulaire de la carte", Ie = "Informations de la carte", ze = "Nom complet figurant sur la carte", Pe = "MM / AA", Ne = "Veuillez ne pas fermer cette fenêtre", Ae = { pay: "PAYER", submit: "ENVOYER", getPlan: "OBTENIR MON PLAN", donate: "FAIRE UN DON", book: "RÉSERVER MAINTENANT", order: "COMMANDER MAINTENANT" },
|
|
688
|
+
validation: Le
|
|
689
|
+
}, ke = "E-mail", Te = "Nom du titulaire de la carte", Ie = "Informations de la carte", ze = "Nom complet figurant sur la carte", Pe = "MM / AA", Ne = "Veuillez ne pas fermer cette fenêtre", Ae = { pay: "PAYER", submit: "ENVOYER", getPlan: "OBTENIR MON PLAN", donate: "FAIRE UN DON", book: "RÉSERVER MAINTENANT", order: "COMMANDER MAINTENANT" }, De = { emailSuggestion: "Vouliez-vous dire {{email}}?", emailInvalid: "Votre adresse e-mail n’est pas valide", cardExpiryInvalid: "La date d'expiration de votre carte est dans le passé", cardExpiryFormat: "La date d’expiration de votre carte est incomplète", cardSecurityFormat: "Le code de sécurité de votre carte est incomplet", nameRequired: "Veuillez saisir le nom tel qu’il figure sur votre carte", cardNumberInvalid: "Votre numéro de carte est invalide" }, Ve = {
|
|
690
690
|
email: ke,
|
|
691
691
|
cardholderNameLabel: Te,
|
|
692
692
|
cardInformation: Ie,
|
|
@@ -694,7 +694,7 @@ const te = "E-Mail", ie = "Name des/der Karteninhaber/in", ae = "Kartendaten", r
|
|
|
694
694
|
cardExpiry: Pe,
|
|
695
695
|
loading: Ne,
|
|
696
696
|
buttonTexts: Ae,
|
|
697
|
-
validation:
|
|
697
|
+
validation: De
|
|
698
698
|
}, $e = "Email", Re = "Nome del titolare della carta", Be = "Informazioni sulla carta", Oe = "Nome completo sulla carta", He = "MM / AA", Ke = "Non chiudere la finestra", je = { pay: "PAGA", submit: "INVIA", getPlan: "OTTIENI IL MIO PIANO", donate: "DONARE", book: "PRENOTA ORA", order: "ORDINA ORA" }, Ue = { emailSuggestion: "Intendevi {{email}}?", emailInvalid: "La tua email non è corretta", cardExpiryInvalid: "La data di scadenza della tua carta è nel passato", cardExpiryFormat: "La data di scadenza della tua carta è incompleta", cardSecurityFormat: "Il codice di sicurezza della tua carta è incompleto", nameRequired: "Inserisci il nome come appare sulla tua carta", cardNumberInvalid: "Il numero della tua carta non è valido" }, qe = {
|
|
699
699
|
email: $e,
|
|
700
700
|
cardholderNameLabel: Re,
|
|
@@ -704,9 +704,9 @@ const te = "E-Mail", ie = "Name des/der Karteninhaber/in", ae = "Kartendaten", r
|
|
|
704
704
|
loading: Ke,
|
|
705
705
|
buttonTexts: je,
|
|
706
706
|
validation: Ue
|
|
707
|
-
},
|
|
708
|
-
email:
|
|
709
|
-
cardholderNameLabel:
|
|
707
|
+
}, _e = "Adres e-mail", Ge = "Imię i nazwisko posiadacza karty", Ye = "Informacje o karcie", Ze = "Imię i nazwisko na karcie", Je = "MM / RR", We = "Proszę nie zamykać tego okna", Xe = { pay: "ZAPŁAĆ", submit: "WYŚLIJ", getPlan: "POBIERZ MÓJ PLAN", donate: "PRZEKAŻ DAROWIZNĘ", book: "ZAREZERWUJ TERAZ", order: "ZAMÓW TERAZ" }, Qe = { emailSuggestion: "Czy chodziło Ci o {{email}}?", emailInvalid: "Państwa adres e-mail jest nieprawidłowy", cardExpiryInvalid: "Data ważności Państwa karty jest w przeszłości", cardExpiryFormat: "Data ważności Państwa karty jest niekompletna", cardSecurityFormat: "Kod zabezpieczający Państwa karty jest niekompletny", nameRequired: "Proszę wpisać imię i nazwisko tak, jak widnieje na karcie", cardNumberInvalid: "Numer Państwa karty jest nieprawidłowy" }, et = {
|
|
708
|
+
email: _e,
|
|
709
|
+
cardholderNameLabel: Ge,
|
|
710
710
|
cardInformation: Ye,
|
|
711
711
|
cardholderNamePlaceholder: Ze,
|
|
712
712
|
cardExpiry: Je,
|
|
@@ -734,8 +734,8 @@ const te = "E-Mail", ie = "Name des/der Karteninhaber/in", ae = "Kartendaten", r
|
|
|
734
734
|
}, A = {
|
|
735
735
|
en: ve,
|
|
736
736
|
de: ce,
|
|
737
|
-
es:
|
|
738
|
-
fr:
|
|
737
|
+
es: Me,
|
|
738
|
+
fr: Ve,
|
|
739
739
|
pl: et,
|
|
740
740
|
pt: ct,
|
|
741
741
|
tr: vt,
|
|
@@ -780,7 +780,7 @@ class Et {
|
|
|
780
780
|
});
|
|
781
781
|
}
|
|
782
782
|
}
|
|
783
|
-
const
|
|
783
|
+
const D = [
|
|
784
784
|
"en",
|
|
785
785
|
"de",
|
|
786
786
|
"es",
|
|
@@ -793,7 +793,7 @@ const V = [
|
|
|
793
793
|
function bt(o) {
|
|
794
794
|
const e = new Et(), i = (() => {
|
|
795
795
|
const n = navigator?.language?.split("-")[0]?.toLowerCase();
|
|
796
|
-
return
|
|
796
|
+
return D.includes(n) ? n : Ct;
|
|
797
797
|
})();
|
|
798
798
|
e.setLocale(i);
|
|
799
799
|
const a = k({
|
|
@@ -804,7 +804,7 @@ function bt(o) {
|
|
|
804
804
|
store: a,
|
|
805
805
|
translate: (n, l) => a.getState().translationService.translate(n, l),
|
|
806
806
|
setLocale: (n) => {
|
|
807
|
-
|
|
807
|
+
D.includes(n) && (a.getState().translationService.setLocale(n), a.setState({ locale: n }));
|
|
808
808
|
},
|
|
809
809
|
getLocale: () => a.getValue("locale"),
|
|
810
810
|
subscribe: a.subscribe.bind(a)
|
|
@@ -873,7 +873,7 @@ const xt = bt(), z = () => {
|
|
|
873
873
|
},
|
|
874
874
|
isLoaded: a
|
|
875
875
|
};
|
|
876
|
-
},
|
|
876
|
+
}, M = (o) => Object.entries(o).map(([e, t]) => {
|
|
877
877
|
const i = e.replace(/([A-Z])/g, "-$1").toLowerCase(), a = typeof t == "number" ? `${t}px` : t;
|
|
878
878
|
return `${i}: ${a}`;
|
|
879
879
|
}).join("; ");
|
|
@@ -916,10 +916,10 @@ function wt(o) {
|
|
|
916
916
|
}, r = {
|
|
917
917
|
fontFamily: `${o.styles.fontFamily}, sans-serif`
|
|
918
918
|
}, s = {
|
|
919
|
-
base:
|
|
920
|
-
error:
|
|
921
|
-
focus:
|
|
922
|
-
placeholder:
|
|
919
|
+
base: M(e),
|
|
920
|
+
error: M(i),
|
|
921
|
+
focus: M(a),
|
|
922
|
+
placeholder: M(t)
|
|
923
923
|
};
|
|
924
924
|
return {
|
|
925
925
|
formContainerStyle: r,
|
|
@@ -1096,7 +1096,7 @@ class F {
|
|
|
1096
1096
|
return new h("img", i, r);
|
|
1097
1097
|
}
|
|
1098
1098
|
}
|
|
1099
|
-
class
|
|
1099
|
+
class Lt extends h {
|
|
1100
1100
|
messageComponent;
|
|
1101
1101
|
constructor(e) {
|
|
1102
1102
|
super("div", []);
|
|
@@ -1139,7 +1139,7 @@ class Mt extends h {
|
|
|
1139
1139
|
return this.messageComponent.setText(e), this;
|
|
1140
1140
|
}
|
|
1141
1141
|
}
|
|
1142
|
-
class
|
|
1142
|
+
class V extends h {
|
|
1143
1143
|
titleElement;
|
|
1144
1144
|
constructor(e = {}) {
|
|
1145
1145
|
super("div", ["blur-bg"]);
|
|
@@ -1168,7 +1168,7 @@ class E extends h {
|
|
|
1168
1168
|
return this.span && this.span.classList.add("form-helper-text-hidden"), this;
|
|
1169
1169
|
}
|
|
1170
1170
|
}
|
|
1171
|
-
class
|
|
1171
|
+
class Mt extends h {
|
|
1172
1172
|
constructor(e) {
|
|
1173
1173
|
super("label", ["input-label"], {
|
|
1174
1174
|
for: e.id
|
|
@@ -1182,7 +1182,7 @@ class P extends h {
|
|
|
1182
1182
|
helperText = null;
|
|
1183
1183
|
constructor(e) {
|
|
1184
1184
|
if (super("div", ["input-wrapper"]), e.label && e.styles) {
|
|
1185
|
-
const i = new
|
|
1185
|
+
const i = new Mt({
|
|
1186
1186
|
styles: {
|
|
1187
1187
|
color: e.styles.color,
|
|
1188
1188
|
fontSize: e.styles.fontSize
|
|
@@ -1372,7 +1372,7 @@ class At extends h {
|
|
|
1372
1372
|
return this;
|
|
1373
1373
|
}
|
|
1374
1374
|
}
|
|
1375
|
-
class
|
|
1375
|
+
class Dt extends h {
|
|
1376
1376
|
cardNumber;
|
|
1377
1377
|
cardExpiry;
|
|
1378
1378
|
cardCvv;
|
|
@@ -1427,14 +1427,14 @@ class Vt extends h {
|
|
|
1427
1427
|
fontFamily: t.styles.fontFamily
|
|
1428
1428
|
}
|
|
1429
1429
|
}), this.cardExpiry.addEventListener("blur", b), this.cardExpiry.addEventListener("keydown", (f) => {
|
|
1430
|
-
const
|
|
1430
|
+
const L = f, B = [
|
|
1431
1431
|
"Backspace",
|
|
1432
1432
|
"Delete",
|
|
1433
1433
|
"ArrowLeft",
|
|
1434
1434
|
"ArrowRight",
|
|
1435
1435
|
"Tab"
|
|
1436
1436
|
], O = this.cardExpiry.getValue().replace(/\D/g, "");
|
|
1437
|
-
B.includes(
|
|
1437
|
+
B.includes(L.key) || (!/^\d$/.test(L.key) || O.length >= 4 && !L.isComposing) && L.preventDefault();
|
|
1438
1438
|
});
|
|
1439
1439
|
const R = this.cardExpiry.getElement();
|
|
1440
1440
|
R.style.height = "38.5px";
|
|
@@ -1556,7 +1556,7 @@ class Vt extends h {
|
|
|
1556
1556
|
}
|
|
1557
1557
|
}
|
|
1558
1558
|
}
|
|
1559
|
-
class
|
|
1559
|
+
class Vt {
|
|
1560
1560
|
input;
|
|
1561
1561
|
constructor(e) {
|
|
1562
1562
|
const {
|
|
@@ -1787,7 +1787,7 @@ class qt extends h {
|
|
|
1787
1787
|
translation = z();
|
|
1788
1788
|
iframeHook;
|
|
1789
1789
|
constructor(e) {
|
|
1790
|
-
super("form", ["form-container"]), this.options = e, this.checkoutProfile =
|
|
1790
|
+
super("form", ["form-container"]), this.options = e, this.checkoutProfile = _({
|
|
1791
1791
|
apiKey: e.apiKey,
|
|
1792
1792
|
profileId: e.profileId,
|
|
1793
1793
|
environment: e.environment
|
|
@@ -1908,7 +1908,7 @@ class qt extends h {
|
|
|
1908
1908
|
isCvvValid: !1,
|
|
1909
1909
|
possibleCardType: "unknown"
|
|
1910
1910
|
};
|
|
1911
|
-
this.iframeHook && (r = this.iframeHook.getState()), this.cardSection = new
|
|
1911
|
+
this.iframeHook && (r = this.iframeHook.getState()), this.cardSection = new Dt({
|
|
1912
1912
|
checkoutProfile: e,
|
|
1913
1913
|
isLoading: r.loadingIframe,
|
|
1914
1914
|
isFocused: r.isFocused,
|
|
@@ -2005,7 +2005,7 @@ class qt extends h {
|
|
|
2005
2005
|
createEmailField(e) {
|
|
2006
2006
|
try {
|
|
2007
2007
|
const { formData: t, errors: i, touched: a } = this._getFormStateData();
|
|
2008
|
-
this.emailField = new
|
|
2008
|
+
this.emailField = new Vt({
|
|
2009
2009
|
value: t.email,
|
|
2010
2010
|
onChange: this.handleChange,
|
|
2011
2011
|
onBlur: this.handleBlur,
|
|
@@ -2086,10 +2086,10 @@ class qt extends h {
|
|
|
2086
2086
|
this.options.onLoadingStateChange(e);
|
|
2087
2087
|
return;
|
|
2088
2088
|
}
|
|
2089
|
-
e ? (this.hideSpinner(), this.spinner = new
|
|
2089
|
+
e ? (this.hideSpinner(), this.spinner = new V(), this.element.appendChild(this.spinner.getElement())) : this.hideSpinner();
|
|
2090
2090
|
}
|
|
2091
2091
|
showSpinner(e) {
|
|
2092
|
-
this.hideSpinner(), this.spinner = new
|
|
2092
|
+
this.hideSpinner(), this.spinner = new V({ text: e }), this.element.appendChild(this.spinner.getElement());
|
|
2093
2093
|
}
|
|
2094
2094
|
hideSpinner() {
|
|
2095
2095
|
this.spinner && (this.spinner.getElement().remove(), this.spinner = void 0);
|
|
@@ -2137,7 +2137,7 @@ class qt extends h {
|
|
|
2137
2137
|
* Update the form error message
|
|
2138
2138
|
*/
|
|
2139
2139
|
setErrorMessage(e) {
|
|
2140
|
-
return this.alert && (this.alert.getElement().remove(), this.alert = void 0), this.alert = new
|
|
2140
|
+
return this.alert && (this.alert.getElement().remove(), this.alert = void 0), this.alert = new Lt({ message: e }), this.element.insertBefore(this.alert.getElement(), this.element.firstChild), this;
|
|
2141
2141
|
}
|
|
2142
2142
|
/**
|
|
2143
2143
|
* Clean up resources when the form is destroyed
|
|
@@ -2149,7 +2149,7 @@ class qt extends h {
|
|
|
2149
2149
|
e.key === "Enter" && !this.isFormDisabled() && (e.target instanceof HTMLTextAreaElement || (e.preventDefault(), this.handleSubmit(e)));
|
|
2150
2150
|
};
|
|
2151
2151
|
}
|
|
2152
|
-
class
|
|
2152
|
+
class _t {
|
|
2153
2153
|
container = null;
|
|
2154
2154
|
options;
|
|
2155
2155
|
onSubmit;
|
|
@@ -2180,7 +2180,7 @@ class Gt {
|
|
|
2180
2180
|
this.form && (this.form.destroy(), this.form = null);
|
|
2181
2181
|
}
|
|
2182
2182
|
}
|
|
2183
|
-
class
|
|
2183
|
+
class Gt {
|
|
2184
2184
|
state;
|
|
2185
2185
|
listeners = /* @__PURE__ */ new Set();
|
|
2186
2186
|
constructor(e) {
|
|
@@ -2202,7 +2202,8 @@ class _t {
|
|
|
2202
2202
|
this.listeners.forEach((t) => t(e));
|
|
2203
2203
|
}
|
|
2204
2204
|
}
|
|
2205
|
-
|
|
2205
|
+
const Yt = "en";
|
|
2206
|
+
class Zt {
|
|
2206
2207
|
config;
|
|
2207
2208
|
apiService;
|
|
2208
2209
|
formManager;
|
|
@@ -2211,10 +2212,10 @@ class Yt {
|
|
|
2211
2212
|
this.config = this.validateConfig(e), this.apiService = new H(
|
|
2212
2213
|
this.config.apiKey,
|
|
2213
2214
|
this.config.environment
|
|
2214
|
-
), this.stateManager = new
|
|
2215
|
+
), this.stateManager = new Gt({
|
|
2215
2216
|
mounted: !1,
|
|
2216
2217
|
form: null
|
|
2217
|
-
}), this.formManager = new
|
|
2218
|
+
}), this.formManager = new _t(
|
|
2218
2219
|
{
|
|
2219
2220
|
locale: this.config.locale,
|
|
2220
2221
|
apiKey: this.config.apiKey,
|
|
@@ -2239,7 +2240,7 @@ class Yt {
|
|
|
2239
2240
|
paymentId: e.paymentId,
|
|
2240
2241
|
returnUrl: e.returnUrl,
|
|
2241
2242
|
environment: e.environment,
|
|
2242
|
-
locale: e.locale ||
|
|
2243
|
+
locale: e.locale || Yt,
|
|
2243
2244
|
disableErrorMessages: e.disableErrorMessages ?? !1,
|
|
2244
2245
|
manualActionHandling: e.manualActionHandling ?? !1,
|
|
2245
2246
|
callbacks: {
|
|
@@ -2302,13 +2303,13 @@ class Yt {
|
|
|
2302
2303
|
t && this.formManager.update({ errorMsg: e.details?.message });
|
|
2303
2304
|
}
|
|
2304
2305
|
}
|
|
2305
|
-
typeof globalThis < "u" && (globalThis.OdusCheckout =
|
|
2306
|
+
typeof globalThis < "u" && (globalThis.OdusCheckout = Zt);
|
|
2306
2307
|
export {
|
|
2307
|
-
|
|
2308
|
+
Zt as OdusCheckout,
|
|
2308
2309
|
ce as deLocale,
|
|
2309
2310
|
ve as enLocale,
|
|
2310
|
-
|
|
2311
|
-
|
|
2311
|
+
Me as esLocale,
|
|
2312
|
+
Ve as frLocale,
|
|
2312
2313
|
qe as itLocale,
|
|
2313
2314
|
et as plLocale,
|
|
2314
2315
|
ct as ptLocale,
|
package/dist/package.json
CHANGED