@odus/checkout 0.30.0-beta.3 → 0.30.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/dist/checkout.d.ts +1 -0
- package/dist/checkout.d.ts.map +1 -1
- package/dist/checkout.es.js +418 -400
- package/dist/elements.es.js +22 -14
- package/dist/package.json +6 -1
- package/dist/shared.js +643 -631
- package/package.json +6 -1
package/dist/elements.es.js
CHANGED
|
@@ -331,7 +331,7 @@ class q extends d {
|
|
|
331
331
|
}
|
|
332
332
|
}
|
|
333
333
|
const b = /* @__PURE__ */ new Set(["US", "CA"]);
|
|
334
|
-
class
|
|
334
|
+
class O extends d {
|
|
335
335
|
_value = "";
|
|
336
336
|
_country = "";
|
|
337
337
|
_input = null;
|
|
@@ -433,7 +433,7 @@ class D extends d {
|
|
|
433
433
|
return null;
|
|
434
434
|
}
|
|
435
435
|
}
|
|
436
|
-
class
|
|
436
|
+
class D extends d {
|
|
437
437
|
_value = "";
|
|
438
438
|
_error = null;
|
|
439
439
|
_input = null;
|
|
@@ -448,8 +448,14 @@ class O extends d {
|
|
|
448
448
|
placeholder: e("address.placeholder.street"),
|
|
449
449
|
value: this._value,
|
|
450
450
|
autocomplete: "street-address",
|
|
451
|
+
maxLength: this.options.maxLength,
|
|
451
452
|
onChange: (t) => {
|
|
452
|
-
this._value = t.target.value, this._error = null, this.
|
|
453
|
+
if (this._value = t.target.value, this._error = null, this.options.maxLength && this._value.length >= this.options.maxLength) {
|
|
454
|
+
const r = e("validation.maxLengthExceeded");
|
|
455
|
+
this._error = r.replace("{{max}}", String(this.options.maxLength)), this._input?.setError(!0, this._error);
|
|
456
|
+
} else
|
|
457
|
+
this._input?.setError(!1);
|
|
458
|
+
this.emit("change", this._value);
|
|
453
459
|
}
|
|
454
460
|
}), this._input.addEventListener("blur", () => {
|
|
455
461
|
const { t } = a();
|
|
@@ -1218,6 +1224,7 @@ class ue {
|
|
|
1218
1224
|
_config;
|
|
1219
1225
|
_apiService;
|
|
1220
1226
|
_changeListeners = [];
|
|
1227
|
+
_callbacks;
|
|
1221
1228
|
_paymentState = {};
|
|
1222
1229
|
_fontCleanup;
|
|
1223
1230
|
_card;
|
|
@@ -1236,7 +1243,7 @@ class ue {
|
|
|
1236
1243
|
_error;
|
|
1237
1244
|
elements;
|
|
1238
1245
|
constructor(e) {
|
|
1239
|
-
this._config = e, e.locale && A.setLocale(e.locale), this._apiService = new V(
|
|
1246
|
+
this._config = e, this._callbacks = { ...e.callbacks }, e.locale && A.setLocale(e.locale), this._apiService = new V(
|
|
1240
1247
|
e.apiKey,
|
|
1241
1248
|
e.environment
|
|
1242
1249
|
);
|
|
@@ -1269,7 +1276,7 @@ class ue {
|
|
|
1269
1276
|
});
|
|
1270
1277
|
const o = {};
|
|
1271
1278
|
Object.defineProperty(o, "street", {
|
|
1272
|
-
get: () => (this._addressStreet || (this._addressStreet = new
|
|
1279
|
+
get: () => (this._addressStreet || (this._addressStreet = new D(), this._trackElement(this._addressStreet)), this._addressStreet),
|
|
1273
1280
|
enumerable: !0
|
|
1274
1281
|
}), Object.defineProperty(o, "firstName", {
|
|
1275
1282
|
get: () => (this._addressFirstName || (this._addressFirstName = new j(), this._trackElement(this._addressFirstName)), this._addressFirstName),
|
|
@@ -1281,7 +1288,7 @@ class ue {
|
|
|
1281
1288
|
get: () => (this._addressCity || (this._addressCity = new L(), this._trackElement(this._addressCity)), this._addressCity),
|
|
1282
1289
|
enumerable: !0
|
|
1283
1290
|
}), Object.defineProperty(o, "state", {
|
|
1284
|
-
get: () => (this._addressState || (this._addressState = new
|
|
1291
|
+
get: () => (this._addressState || (this._addressState = new O(), this._trackElement(this._addressState)), this._addressState),
|
|
1285
1292
|
enumerable: !0
|
|
1286
1293
|
}), Object.defineProperty(o, "zipCode", {
|
|
1287
1294
|
get: () => (this._addressZipCode || (this._addressZipCode = new Z(), this._trackElement(this._addressZipCode)), this._addressZipCode),
|
|
@@ -1409,6 +1416,9 @@ class ue {
|
|
|
1409
1416
|
destroy() {
|
|
1410
1417
|
this._fontCleanup?.(), this._card?.destroy(), this._email?.destroy(), this._phone?.destroy(), this._addressStreet?.destroy(), this._addressFirstName?.destroy(), this._addressLastName?.destroy(), this._cardholderName?.destroy(), this._addressCity?.destroy(), this._addressState?.destroy(), this._addressZipCode?.destroy(), this._addressCountry?.destroy(), this._applePay?.destroy(), this._paypal?.destroy(), this._error?.destroy(), this._changeListeners.length = 0;
|
|
1411
1418
|
}
|
|
1419
|
+
setCallbacks(e) {
|
|
1420
|
+
Object.assign(this._callbacks, e);
|
|
1421
|
+
}
|
|
1412
1422
|
_trackElement(e) {
|
|
1413
1423
|
e.on("change", () => {
|
|
1414
1424
|
for (const t of this._changeListeners)
|
|
@@ -1454,22 +1464,20 @@ class ue {
|
|
|
1454
1464
|
}
|
|
1455
1465
|
_handlePaymentResponse(e) {
|
|
1456
1466
|
if (e.latestTransaction.status === "authorized") {
|
|
1457
|
-
this.
|
|
1467
|
+
this._callbacks.onPaymentSucceeded?.(
|
|
1458
1468
|
e.latestTransaction.status
|
|
1459
1469
|
);
|
|
1460
1470
|
return;
|
|
1461
1471
|
}
|
|
1462
1472
|
if (e.latestTransaction.status === "failed") {
|
|
1463
|
-
this.
|
|
1464
|
-
e.latestTransaction.status
|
|
1465
|
-
);
|
|
1473
|
+
this._callbacks.onPaymentFailed?.(e.latestTransaction.status);
|
|
1466
1474
|
return;
|
|
1467
1475
|
}
|
|
1468
|
-
e.status === "requires_action" && this.
|
|
1476
|
+
e.status === "requires_action" && this._callbacks.onActionRequired?.(e.action.redirectUrl);
|
|
1469
1477
|
}
|
|
1470
1478
|
_handleAuthorizationError(e) {
|
|
1471
1479
|
const t = e.details?.message ?? "Payment failed";
|
|
1472
|
-
this.
|
|
1480
|
+
this._callbacks.onPaymentFailed?.(t), this._error?.isMounted && this._error.setError(t);
|
|
1473
1481
|
}
|
|
1474
1482
|
}
|
|
1475
1483
|
export {
|
|
@@ -1477,8 +1485,8 @@ export {
|
|
|
1477
1485
|
T as AddressCountryElement,
|
|
1478
1486
|
j as AddressFirstNameElement,
|
|
1479
1487
|
q as AddressLastNameElement,
|
|
1480
|
-
|
|
1481
|
-
|
|
1488
|
+
O as AddressStateElement,
|
|
1489
|
+
D as AddressStreetElement,
|
|
1482
1490
|
Z as AddressZipCodeElement,
|
|
1483
1491
|
U as ApplePayElement,
|
|
1484
1492
|
d as BaseElement,
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@odus/checkout",
|
|
3
|
-
"version": "0.30.0
|
|
3
|
+
"version": "0.30.0",
|
|
4
4
|
"displayName": "Odus Checkout SDK",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"odus",
|
|
@@ -36,6 +36,11 @@
|
|
|
36
36
|
},
|
|
37
37
|
"nx": {
|
|
38
38
|
"targets": {
|
|
39
|
+
"vite:build": {
|
|
40
|
+
"dependsOn": [
|
|
41
|
+
"^build"
|
|
42
|
+
]
|
|
43
|
+
},
|
|
39
44
|
"test": {
|
|
40
45
|
"cache": true,
|
|
41
46
|
"inputs": [
|