@reevit/react 0.3.1 → 0.3.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/dist/index.js CHANGED
@@ -244,7 +244,7 @@ function reevitReducer(state, action) {
244
244
  ...state,
245
245
  status: "ready",
246
246
  paymentIntent: action.payload,
247
- selectedMethod: action.payload.availableMethods?.length === 1 ? action.payload.availableMethods[0] : state.selectedMethod
247
+ selectedMethod: action.payload.availableMethods?.length === 1 ? action.payload.availableMethods[0] : null
248
248
  };
249
249
  case "INIT_ERROR":
250
250
  return { ...state, status: "failed", error: action.payload };
@@ -894,10 +894,10 @@ function ReevitCheckout({
894
894
  }
895
895
  }, [isOpen, status, initialize, initialPaymentIntent]);
896
896
  react.useEffect(() => {
897
- if (isOpen && (selectedMethod === "card" || selectedMethod === "mobile_money") && !showPSPBridge) {
898
- if (selectedMethod === "card" && paymentIntent) {
897
+ if (isOpen && selectedMethod && paymentIntent && !showPSPBridge) {
898
+ if (selectedMethod === "card") {
899
899
  setShowPSPBridge(true);
900
- } else if (selectedMethod === "mobile_money" && paymentIntent && (momoData?.phone || phone)) {
900
+ } else if (selectedMethod === "mobile_money" && (momoData?.phone || phone)) {
901
901
  setShowPSPBridge(true);
902
902
  }
903
903
  }