@reevit/react 0.3.1 → 0.3.3

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.mjs CHANGED
@@ -111,7 +111,7 @@ var ReevitAPIClient = class {
111
111
  "Content-Type": "application/json",
112
112
  "X-Reevit-Key": this.publicKey,
113
113
  "X-Reevit-Client": "@reevit/react",
114
- "X-Reevit-Client-Version": "0.2.5"
114
+ "X-Reevit-Client-Version": "0.3.2"
115
115
  };
116
116
  if (method === "POST" || method === "PATCH" || method === "PUT") {
117
117
  headers["Idempotency-Key"] = `${Date.now()}-${Math.random().toString(36).substring(2, 15)}`;
@@ -242,7 +242,7 @@ function reevitReducer(state, action) {
242
242
  ...state,
243
243
  status: "ready",
244
244
  paymentIntent: action.payload,
245
- selectedMethod: action.payload.availableMethods?.length === 1 ? action.payload.availableMethods[0] : state.selectedMethod
245
+ selectedMethod: action.payload.availableMethods?.length === 1 ? action.payload.availableMethods[0] : null
246
246
  };
247
247
  case "INIT_ERROR":
248
248
  return { ...state, status: "failed", error: action.payload };
@@ -892,10 +892,10 @@ function ReevitCheckout({
892
892
  }
893
893
  }, [isOpen, status, initialize, initialPaymentIntent]);
894
894
  useEffect(() => {
895
- if (isOpen && (selectedMethod === "card" || selectedMethod === "mobile_money") && !showPSPBridge) {
896
- if (selectedMethod === "card" && paymentIntent) {
895
+ if (isOpen && selectedMethod && paymentIntent && !showPSPBridge) {
896
+ if (selectedMethod === "card") {
897
897
  setShowPSPBridge(true);
898
- } else if (selectedMethod === "mobile_money" && paymentIntent && (momoData?.phone || phone)) {
898
+ } else if (selectedMethod === "mobile_money" && (momoData?.phone || phone)) {
899
899
  setShowPSPBridge(true);
900
900
  }
901
901
  }