Merged in feat/SW-2079-update-booking-page-to-show-points- (pull request #1683)

feat: SW-2079 Show points in confirmation page

* feat: SW-2079 Show points in confirmation page

* feat: SW-2079 Optimized code

* feat: SW-2079 Updated Body to Typography

* feat: SW-2079 Multi-room total cost display

* feat: SW-2079 Add reward nights condition rate title

* feat: SW-2079 Removed extra checks

* feat: SW-2079 Optimmized formatPrice function

* feat: SW-2079 Typo fix


Approved-by: Christian Andolf
This commit is contained in:
Hrishikesh Vaipurkar
2025-04-04 09:39:55 +00:00
parent e30b8a0be3
commit ae1010bfce
24 changed files with 325 additions and 181 deletions

View File

@@ -16,13 +16,24 @@ export function createBookingConfirmationStore(initialState: InitialState) {
fromDate: initialState.fromDate,
toDate: initialState.toDate,
vat: initialState.vat,
formattedTotalCost: initialState.formattedTotalCost,
isVatCurrency: initialState.isVatCurrency,
totalBookingPrice: initialState.totalBookingPrice,
actions: {
setRoom: (room, idx) => {
set((state) => {
const rooms = [...state.rooms]
rooms[idx] = room
const totalBookingPrice = rooms.reduce((acc, room) => {
return acc + (room?.totalPrice ?? 0)
}, 0)
return { rooms }
return { rooms, totalBookingPrice }
})
},
setFormattedTotalCost: (updatedFormattedTotalCost: string) => {
set((state) => {
return { ...state, formattedTotalCost: updatedFormattedTotalCost }
})
},
},

View File

@@ -57,7 +57,7 @@ export const useMyStayTotalPriceStore = create<MyStayTotalPriceState>(
}, 0)
const totalPoints = newRooms.reduce((sum, r) => {
return sum + r.roomPoints
return sum + (r.roomPoints ?? 0)
}, 0)
return {