@reevit/react 0.2.5 → 0.2.6

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/index.js CHANGED
@@ -113,7 +113,7 @@ var ReevitAPIClient = class {
113
113
  "Content-Type": "application/json",
114
114
  "X-Reevit-Key": this.publicKey,
115
115
  "X-Reevit-Client": "@reevit/react",
116
- "X-Reevit-Client-Version": "0.2.3"
116
+ "X-Reevit-Client-Version": "0.2.5"
117
117
  };
118
118
  if (method === "POST" || method === "PATCH" || method === "PUT") {
119
119
  headers["Idempotency-Key"] = `${Date.now()}-${Math.random().toString(36).substring(2, 15)}`;
@@ -670,9 +670,18 @@ function PaystackBridge({
670
670
  const initialized = react.useRef(false);
671
671
  const startPayment = react.useCallback(async () => {
672
672
  try {
673
+ if (!publicKey) {
674
+ throw new Error("Paystack public key is required but was empty");
675
+ }
676
+ if (!email) {
677
+ throw new Error("Email is required for Paystack payments");
678
+ }
679
+ if (!amount || amount <= 0) {
680
+ throw new Error("Valid amount is required for Paystack payments");
681
+ }
673
682
  await loadPaystackScript();
674
683
  if (!window.PaystackPop) {
675
- throw new Error("Paystack not available");
684
+ throw new Error("Paystack script loaded but PaystackPop not available");
676
685
  }
677
686
  const handler = window.PaystackPop.setup({
678
687
  key: publicKey,
@@ -704,9 +713,10 @@ function PaystackBridge({
704
713
  });
705
714
  handler.openIframe();
706
715
  } catch (err) {
716
+ const errorMessage = err instanceof Error ? err.message : "Failed to initialize Paystack";
707
717
  const error = {
708
718
  code: "PSP_ERROR",
709
- message: "Failed to initialize Paystack",
719
+ message: errorMessage,
710
720
  recoverable: true,
711
721
  originalError: err
712
722
  };