@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.mjs CHANGED
@@ -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
  }