Merged in fix/SW-2887-complete-booking-button-always-enabled (pull request #2227)
fix(SW-2887): don't disable the booking button The complete button shouldn’t be disabled based on validation. This was already correct in desktop, but now it’s also correct in mobile. * fix(SW-2887): don't disable the booking button Approved-by: Tobias Johansson Approved-by: Christian Andolf
This commit is contained in:
@@ -106,10 +106,6 @@ export default function PaymentClient({
|
|||||||
return room.mustBeGuaranteed
|
return room.mustBeGuaranteed
|
||||||
})
|
})
|
||||||
|
|
||||||
const setIsSubmittingDisabled = useEnterDetailsStore(
|
|
||||||
(state) => state.actions.setIsSubmittingDisabled
|
|
||||||
)
|
|
||||||
|
|
||||||
const [refId, setRefId] = useState("")
|
const [refId, setRefId] = useState("")
|
||||||
const [isPollingForBookingStatus, setIsPollingForBookingStatus] =
|
const [isPollingForBookingStatus, setIsPollingForBookingStatus] =
|
||||||
useState(false)
|
useState(false)
|
||||||
@@ -284,16 +280,6 @@ export default function PaymentClient({
|
|||||||
handlePaymentError,
|
handlePaymentError,
|
||||||
])
|
])
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
setIsSubmittingDisabled(
|
|
||||||
!methods.formState.isValid || methods.formState.isSubmitting
|
|
||||||
)
|
|
||||||
}, [
|
|
||||||
methods.formState.isValid,
|
|
||||||
methods.formState.isSubmitting,
|
|
||||||
setIsSubmittingDisabled,
|
|
||||||
])
|
|
||||||
|
|
||||||
const getPaymentMethod = useCallback(
|
const getPaymentMethod = useCallback(
|
||||||
(paymentMethod: string | null | undefined): PaymentMethodEnum => {
|
(paymentMethod: string | null | undefined): PaymentMethodEnum => {
|
||||||
if (hasFlexRates) {
|
if (hasFlexRates) {
|
||||||
@@ -626,7 +612,7 @@ export default function PaymentClient({
|
|||||||
<div className={styles.submitButton}>
|
<div className={styles.submitButton}>
|
||||||
<Button
|
<Button
|
||||||
type="submit"
|
type="submit"
|
||||||
isDisabled={methods.formState.isSubmitting}
|
isDisabled={isSubmitting}
|
||||||
isPending={isSubmitting}
|
isPending={isSubmitting}
|
||||||
typography="Body/Supporting text (caption)/smBold"
|
typography="Body/Supporting text (caption)/smBold"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -21,19 +21,13 @@ export default function SummaryBottomSheet({ children }: PropsWithChildren) {
|
|||||||
const searchParams = useSearchParams()
|
const searchParams = useSearchParams()
|
||||||
const errorCode = searchParams.get("errorCode")
|
const errorCode = searchParams.get("errorCode")
|
||||||
|
|
||||||
const {
|
const { isSummaryOpen, toggleSummaryOpen, totalPrice, isSubmitting } =
|
||||||
isSummaryOpen,
|
useEnterDetailsStore((state) => ({
|
||||||
toggleSummaryOpen,
|
isSummaryOpen: state.isSummaryOpen,
|
||||||
totalPrice,
|
toggleSummaryOpen: state.actions.toggleSummaryOpen,
|
||||||
isSubmittingDisabled,
|
totalPrice: state.totalPrice,
|
||||||
isSubmitting,
|
isSubmitting: state.isSubmitting,
|
||||||
} = useEnterDetailsStore((state) => ({
|
}))
|
||||||
isSummaryOpen: state.isSummaryOpen,
|
|
||||||
toggleSummaryOpen: state.actions.toggleSummaryOpen,
|
|
||||||
totalPrice: state.totalPrice,
|
|
||||||
isSubmittingDisabled: state.isSubmittingDisabled,
|
|
||||||
isSubmitting: state.isSubmitting,
|
|
||||||
}))
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isSummaryOpen) {
|
if (isSummaryOpen) {
|
||||||
@@ -92,7 +86,7 @@ export default function SummaryBottomSheet({ children }: PropsWithChildren) {
|
|||||||
variant="Primary"
|
variant="Primary"
|
||||||
size="Large"
|
size="Large"
|
||||||
type="submit"
|
type="submit"
|
||||||
isDisabled={isSubmittingDisabled}
|
isDisabled={isSubmitting}
|
||||||
isPending={isSubmitting}
|
isPending={isSubmitting}
|
||||||
typography="Body/Supporting text (caption)/smBold"
|
typography="Body/Supporting text (caption)/smBold"
|
||||||
form={formId}
|
form={formId}
|
||||||
|
|||||||
@@ -155,7 +155,6 @@ export function createDetailsStore(
|
|||||||
booking: initialState.booking,
|
booking: initialState.booking,
|
||||||
breakfastPackages,
|
breakfastPackages,
|
||||||
canProceedToPayment: false,
|
canProceedToPayment: false,
|
||||||
isSubmittingDisabled: false,
|
|
||||||
isSubmitting: false,
|
isSubmitting: false,
|
||||||
isSummaryOpen: false,
|
isSummaryOpen: false,
|
||||||
lastRoom: initialState.booking.rooms.length - 1,
|
lastRoom: initialState.booking.rooms.length - 1,
|
||||||
@@ -415,13 +414,6 @@ export function createDetailsStore(
|
|||||||
preSubmitCallbacks: {},
|
preSubmitCallbacks: {},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
setIsSubmittingDisabled(isSubmittingDisabled) {
|
|
||||||
return set(
|
|
||||||
produce((state: DetailsState) => {
|
|
||||||
state.isSubmittingDisabled = isSubmittingDisabled
|
|
||||||
})
|
|
||||||
)
|
|
||||||
},
|
|
||||||
setIsSubmitting(isSubmitting) {
|
setIsSubmitting(isSubmitting) {
|
||||||
return set(
|
return set(
|
||||||
produce((state: DetailsState) => {
|
produce((state: DetailsState) => {
|
||||||
|
|||||||
@@ -85,7 +85,6 @@ export type InitialState = {
|
|||||||
|
|
||||||
export interface DetailsState {
|
export interface DetailsState {
|
||||||
actions: {
|
actions: {
|
||||||
setIsSubmittingDisabled: (isSubmittingDisabled: boolean) => void
|
|
||||||
setIsSubmitting: (isSubmitting: boolean) => void
|
setIsSubmitting: (isSubmitting: boolean) => void
|
||||||
setTotalPrice: (totalPrice: Price) => void
|
setTotalPrice: (totalPrice: Price) => void
|
||||||
toggleSummaryOpen: () => void
|
toggleSummaryOpen: () => void
|
||||||
@@ -96,7 +95,6 @@ export interface DetailsState {
|
|||||||
booking: SelectRateSearchParams
|
booking: SelectRateSearchParams
|
||||||
breakfastPackages: BreakfastPackages
|
breakfastPackages: BreakfastPackages
|
||||||
canProceedToPayment: boolean
|
canProceedToPayment: boolean
|
||||||
isSubmittingDisabled: boolean
|
|
||||||
isSubmitting: boolean
|
isSubmitting: boolean
|
||||||
isSummaryOpen: boolean
|
isSummaryOpen: boolean
|
||||||
lastRoom: number
|
lastRoom: number
|
||||||
|
|||||||
Reference in New Issue
Block a user