@payment-kit-js/vanilla 0.5.19 → 0.5.20

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * PaymentKit.js v0.5.19
2
+ * PaymentKit.js v0.5.20
3
3
  * https://paymentkit.com
4
4
  *
5
5
  * @license MIT
@@ -42,7 +42,7 @@ var PaymentKit = (() => {
42
42
  });
43
43
 
44
44
  // package.json
45
- var version = "0.5.19";
45
+ var version = "0.5.20";
46
46
 
47
47
  // src/analytics/mock-adapter.ts
48
48
  var MockAnalyticsAdapter = class {
@@ -8576,6 +8576,8 @@ var PaymentKit = (() => {
8576
8576
  return { mount: mountIFrame };
8577
8577
  };
8578
8578
  };
8579
+ var CHECKOUT_FAILURE_STATES = /* @__PURE__ */ new Set(["payment_failed", "checkout_failed"]);
8580
+ var isCheckoutFailure = (result) => CHECKOUT_FAILURE_STATES.has(result.state);
8579
8581
  var defSubmitPayment2 = (states) => {
8580
8582
  const submitPayment = async (fields, options) => {
8581
8583
  if (states._sessionConfigReady) await states._sessionConfigReady;
@@ -8685,6 +8687,20 @@ var PaymentKit = (() => {
8685
8687
  }
8686
8688
  };
8687
8689
  }
8690
+ if (isCheckoutFailure(verifyResult)) {
8691
+ console.log("Card checkout concluded in a failure state after 3DS:", verifyResult);
8692
+ timingTracker.trackFail(
8693
+ verifyResult.checkoutAttemptId || null,
8694
+ verifyResult.errorCode || "payment_failed",
8695
+ verifyResult.errorMessageForCustomer || "Payment failed"
8696
+ );
8697
+ return {
8698
+ errors: {
8699
+ root: verifyResult.errorMessageForCustomer || "Payment failed",
8700
+ checkout_response: verifyResult
8701
+ }
8702
+ };
8703
+ }
8688
8704
  console.log("Card checkout verified \u2705", verifyResult);
8689
8705
  timingTracker.trackSuccess(verifyResult.checkoutAttemptId || "unknown");
8690
8706
  return { data: verifyResult };
@@ -8694,7 +8710,7 @@ var PaymentKit = (() => {
8694
8710
  timingTracker.trackFail(null, "max_actions_exceeded", "Too many authentication attempts");
8695
8711
  return { errors: { root: "Too many authentication attempts. Please try again." } };
8696
8712
  }
8697
- if (currentResult.state === "payment_failed" || currentResult.state === "checkout_failed") {
8713
+ if (isCheckoutFailure(currentResult)) {
8698
8714
  console.log("Card checkout failed:", currentResult);
8699
8715
  timingTracker.trackFail(
8700
8716
  currentResult.checkoutAttemptId || null,