Skip to content

Commit

Permalink
Merge pull request #41 from untilhamza/dev/remove-recapture
Browse files Browse the repository at this point in the history
remove recapture feature
  • Loading branch information
untilhamza authored Mar 13, 2023
2 parents 0824463 + 6f73aab commit 3b8cc1e
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 49 deletions.
96 changes: 48 additions & 48 deletions src/components/BookingForm/BookingForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ const schema = yup.object().shape({
});

const BookingForm = ({ onCancel, onConfirm, oldData, slots, onGetSlots, slotStatus, settings }) => {
const [phoneIsVerified, setPhoneIsVerified] = useState(false);
const [isVerifyingPhone, setIsVerifyingPhone] = useState(false);
const [phoneIsVerified, setPhoneIsVerified] = useState(true);
const [isVerifyingPhone, setIsVerifyingPhone] = useState(true);
const [phoneVerificationCode, setPhoneVerificationCode] = useState("");
const [isRecaptchaVerified, setIsRecaptchaVerified] = useState(null);
const [phoneVerificationError, setPhoneVerificationError] = useState("");
Expand Down Expand Up @@ -111,50 +111,50 @@ const BookingForm = ({ onCancel, onConfirm, oldData, slots, onGetSlots, slotStat
return submittedValue.valueOf() < moment().add(-1, "day") || submittedValue.valueOf() >= moment().add(31, "day");
};

useEffect(() => {
if (isRecaptchaVerified !== null && !isRecaptchaVerified) {
history.push("/");
return;
}
}, [isRecaptchaVerified]);
// useEffect(() => {
// if (isRecaptchaVerified !== null && !isRecaptchaVerified) {
// history.push("/");
// return;
// }
// }, [isRecaptchaVerified]);

useEffect(() => {
try {
window.recaptchaVerifier = new RecaptchaVerifier(
"sign-in-button",
{
size: "invisible",
callback: (response) => {
setIsRecaptchaVerified(true);
// reCAPTCHA solved, allow signInWithPhoneNumber.
console.log("reCAPTCHA solved, allow signInWithPhoneNumber.");
//Now handlePhoneVerification(phoneNumber);
},
"expired-callback": () => {
setIsRecaptchaVerified(false);
console.log("reCAPTCHA expired");
// history.go(0);
Swal.fire({
icon: "error",
title: "An error occurred!",
text: "Please refresh the page and try again.",
});
},
},
auth
);
// useEffect(() => {
// try {
// window.recaptchaVerifier = new RecaptchaVerifier(
// "sign-in-button",
// {
// size: "invisible",
// callback: (response) => {
// setIsRecaptchaVerified(true);
// // reCAPTCHA solved, allow signInWithPhoneNumber.
// console.log("reCAPTCHA solved, allow signInWithPhoneNumber.");
// //Now handlePhoneVerification(phoneNumber);
// },
// "expired-callback": () => {
// setIsRecaptchaVerified(false);
// console.log("reCAPTCHA expired");
// // history.go(0);
// Swal.fire({
// icon: "error",
// title: "An error occurred!",
// text: "Please refresh the page and try again.",
// });
// },
// },
// auth
// );

window.recaptchaVerifier.render().then(function (widgetId) {
window.recaptchaWidgetId = widgetId;
});
} catch (e) {
console.log("recapture error", e);
}
// window.recaptchaVerifier.render().then(function (widgetId) {
// window.recaptchaWidgetId = widgetId;
// });
// } catch (e) {
// console.log("recapture error", e);
// }

return () => {
window.recaptchaVerifier.clear();
};
}, []);
// return () => {
// window.recaptchaVerifier.clear();
// };
// }, []);

return (
<Formik
Expand Down Expand Up @@ -209,7 +209,7 @@ const BookingForm = ({ onCancel, onConfirm, oldData, slots, onGetSlots, slotStat
<div className="text-danger font-italic">
<ErrorMessage name="phone" />
</div>
{!phoneIsVerified && !isVerifyingPhone && (
{/* {!phoneIsVerified && !isVerifyingPhone && (
<Button
id="sign-in-button"
onClick={() => {
Expand All @@ -230,7 +230,7 @@ const BookingForm = ({ onCancel, onConfirm, oldData, slots, onGetSlots, slotStat
Verify code
</button>
</div>
)}
)} */}
</Form.Group>

<Form.Group className="mb-3">
Expand Down Expand Up @@ -289,9 +289,9 @@ const BookingForm = ({ onCancel, onConfirm, oldData, slots, onGetSlots, slotStat
variant="success"
type="submit"
className="w-100 me-1"
onClick={() => {
handleConfirmButtonClick();
}}
// onClick={() => {
// handleConfirmButtonClick();
// }}
// disabled={!phoneIsVerified}
>
Confirm Booking
Expand Down
2 changes: 1 addition & 1 deletion version.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "1.5.1"
"version": "1.6.0"
}

0 comments on commit 3b8cc1e

Please sign in to comment.