@roomstay/frontend 2.6.72 → 2.6.74
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/288.bundle.js +1 -1
- package/dist/659.bundle.js +1 -1
- package/dist/903.bundle.js +1 -1
- package/dist/978.bundle.js +1 -1
- package/dist/984.bundle.js +1 -0
- package/dist/main.bundle.js +1 -1
- package/dist/src/components/members/SignInModal/EmailAndFullnameMemberModal.d.ts +4 -1
- package/dist/src/components/members/SignInModal/EmailAndFullnameMemberModal.js +15 -1
- package/dist/src/components/members/SignInModal/EmailAndFullnameMemberModal.js.map +1 -1
- package/dist/src/components/members/SignInModal/ExternalMemberModal.d.ts +2 -0
- package/dist/src/components/members/SignInModal/ExternalMemberModal.js +5 -3
- package/dist/src/components/members/SignInModal/ExternalMemberModal.js.map +1 -1
- package/dist/src/components/members/SignInModal/MemberSignInModal.js +2 -0
- package/dist/src/components/members/SignInModal/MemberSignInModal.js.map +1 -1
- package/dist/src/components/steps/addons/AddonCard.js +3 -1
- package/dist/src/components/steps/addons/AddonCard.js.map +1 -1
- package/dist/src/components/steps/common/CommonAddonSummary/CommonAddonSummary.js +4 -4
- package/dist/src/components/steps/common/CommonAddonSummary/CommonAddonSummary.js.map +1 -1
- package/dist/src/components/steps/confirmation/additionalOffers/AdditionalOffersModal.js +3 -1
- package/dist/src/components/steps/confirmation/additionalOffers/AdditionalOffersModal.js.map +1 -1
- package/dist/src/components/steps/room/RoomList.js +1 -4
- package/dist/src/components/steps/room/RoomList.js.map +1 -1
- package/dist/src/components/steps/room/TabGroupedRooms/TabGroupedRoomList.js +1 -4
- package/dist/src/components/steps/room/TabGroupedRooms/TabGroupedRoomList.js.map +1 -1
- package/dist/src/components/steps/room/TabGroupedRooms/TabGroupedRooms.js +6 -2
- package/dist/src/components/steps/room/TabGroupedRooms/TabGroupedRooms.js.map +1 -1
- package/dist/src/components/steps/room/roomDetails/roomRates/RoomRates.js +6 -5
- package/dist/src/components/steps/room/roomDetails/roomRates/RoomRates.js.map +1 -1
- package/dist/src/components/summary/BESummaryRoomRow.js +6 -1
- package/dist/src/components/summary/BESummaryRoomRow.js.map +1 -1
- package/dist/src/contexts/BookingEngineContext/BookingEngineContextType.types.d.ts +2 -0
- package/dist/src/contexts/BookingEngineContext/BookingEngineContextType.types.js.map +1 -1
- package/dist/src/contexts/BookingEngineContext/BookingEngineContextWrapper.js +3 -0
- package/dist/src/contexts/BookingEngineContext/BookingEngineContextWrapper.js.map +1 -1
- package/dist/src/contexts/CompanyContext/CompanyContextWrapper.js +5 -1
- package/dist/src/contexts/CompanyContext/CompanyContextWrapper.js.map +1 -1
- package/dist/src/contexts/FullPageEngineContext/FullPageEngineContextWrapper.js +8 -3
- package/dist/src/contexts/FullPageEngineContext/FullPageEngineContextWrapper.js.map +1 -1
- package/dist/src/contexts/HotelOverridesContext.js +4 -0
- package/dist/src/contexts/HotelOverridesContext.js.map +1 -1
- package/dist/src/events/index.d.ts +1 -1
- package/dist/src/events/index.js +1 -1
- package/dist/src/events/index.js.map +1 -1
- package/dist/src/events/state/SelectedHotelChangeEvent.js.map +1 -1
- package/dist/src/hooks/RoomRateAvailabilityListFromApi.js +56 -2
- package/dist/src/hooks/RoomRateAvailabilityListFromApi.js.map +1 -1
- package/dist/src/models/Api/HotelDTO.js.map +1 -1
- package/dist/src/models/Api/HotelOverrideDTO.d.ts +5 -0
- package/dist/src/models/Api/HotelOverrideDTO.js.map +1 -1
- package/dist/src/models/Client/Hotel/Hotel.d.ts +8 -0
- package/dist/src/models/Client/Hotel/Hotel.js.map +1 -1
- package/dist/src/models/Room/RoomRate.js +2 -0
- package/dist/src/models/Room/RoomRate.js.map +1 -1
- package/dist/src/translations/Translation.d.ts +3 -0
- package/dist/src/translations/Translation.js +3 -0
- package/dist/src/translations/Translation.js.map +1 -1
- package/dist/src/translations/languages/en-gb.js +3 -0
- package/dist/src/translations/languages/en-gb.js.map +1 -1
- package/dist/test.bundle.js +1 -1
- package/dist/tests/offline/entry/config/hotelSpecDefault.js +2 -0
- package/dist/tests/offline/entry/config/hotelSpecDefault.js.map +1 -1
- package/dist/vendors.bundle.js +1 -1
- package/package.json +2 -2
- package/dist/663.bundle.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RoomList.js","sourceRoot":"/","sources":["src/components/steps/room/RoomList.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAgG;AAChG,2CAAkD;AAClD,+CAAsE;AAEtE,0FAAkE;AAClE,kGAA0E;AAC1E,4GAAoF;AACpF,6FAA6F;AAE7F,oFAA4D;AAC5D,iEAAyC;AACzC,mEAA2C;AAE3C,4EAAoD;AACpD,iFAA8E;AAC9E,mDAAgD;AAChD,2DAAwD;AAExD,SAAwB,QAAQ;IAC5B,MAAM,aAAa,GAAG,IAAA,kBAAU,EAAC,wBAAa,CAAC,CAAC;IAChD,MAAM,SAAS,GAAG,IAAA,kBAAU,EAAC,+BAAoB,CAAC,CAAC;IACnD,MAAM,EAAE,yBAAyB,EAAE,GAAG,IAAA,kBAAU,EAAC,gCAAqB,CAAC,CAAC;IAExE,MAAM,EAAE,KAAK,EAAE,GAAG,IAAA,uBAAe,GAAE,CAAC;IACpC,MAAM,EAAE,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,EAAE,GAAG,IAAA,oEAAkC,GAAE,CAAC;IAC5H,MAAM,WAAW,GAAG,IAAA,cAAM,EAAwB,IAAI,CAAC,CAAC;IACxD,MAAM,UAAU,GAAG,IAAA,cAAM,EAAwB,IAAI,CAAC,CAAC;IAEvD,MAAM,MAAM,GAAG,SAAS,CAAC,eAAe,CAAC;IACzC,IAAI,oBAAoB,GAAkB,IAAI,CAAC;IAE/C,MAAM,cAAc,GAAG,GAAG,EAAE;QACxB,IAAI,WAAW,CAAC,OAAO,IAAI,oBAAoB,KAAK,KAAK,EAAE;YACvD,oBAAoB,GAA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CAAC,8BAAC,qCAAiB,OAAG,CAAC,CAAC,CAAC,8BAAC,2BAAiB,OAAG,EAC3D,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,iBAAiB;eAAE,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CACxC,8BAAC,gCAAsB,IAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,GAAI,CAC7D,CAAC,CACH,CACN,CACC,CACT,CAAC;QAEF,mBAAS,CAAC,QAAQ,CAAC,mBAAmB,EAAE,CAAC;QAEzC,OAAO,CACH;YACI,8BAAC,6BAAa,QAAE,CAAC,SAAS,IAAI,eAAe,CAAC,CAAC,CAAC,8BAAC,+CAAsB,IAAC,GAAG,EAAE,eAAe,CAAC,IAAI,EAAE,IAAI,EAAE,eAAe,GAAI,CAAC,CAAC,CAAC,IAAI,CAAiB;YACnJ,QAAQ,CACV,CACN,CAAC;IACN,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC,cAAc,EAAE,aAAa,CAAC,eAAe,EAAE,aAAa,CAAC,gBAAgB,EAAE,yBAAyB,CAAC,CAAC,CAAC;AACnL,CAAC;AAtFD,2BAsFC","sourcesContent":["import { BasketContext, BookingEngineContext, HotelOverridesContext } from '@frontend/contexts';\nimport { useCurrentHotel } from '@frontend/hooks';\nimport React, { useContext, useEffect, useMemo, useRef } from 'react';\n\nimport LargeLoader from '@/components/generic/loader/LargeLoader';\nimport RoomDetails from '@/components/steps/room/roomDetails/RoomDetails';\nimport RoomListCrossSellBlock from '@/components/steps/room/RoomListCrossSellBlock';\nimport { useRoomRateAvailabilityListFromApi } from '@/hooks/RoomRateAvailabilityListFromApi';\nimport { Room } from '@/models/Room/Room';\nimport RoomSortProvider from '@/providers/RoomSortProvider';\nimport DataLayer from '@/util/DataLayer';\nimport ScreenSize from '@/util/ScreenSize';\n\nimport NoRoomsFoundBlock from './NoRoomsFoundBlock';\nimport { RoomDetailsRetargeting } from './roomDetails/RoomDetailsRetargeting';\nimport { RoomListAlert } from './RoomListAlert';\nimport { StepRoomErrorForm } from './StepRoomErrorForm';\n\nexport default function RoomList() {\n const basketContext = useContext(BasketContext);\n const beContext = useContext(BookingEngineContext);\n const { orderUnavailableRoomsLast } = useContext(HotelOverridesContext);\n\n const { hotel } = useCurrentHotel();\n const { rooms, loadingAttempted, isLoading, openRoom, apiHasError, retargetingRoom } = useRoomRateAvailabilityListFromApi();\n const roomListRef = useRef<HTMLDivElement | null>(null);\n const timeoutRef = useRef<NodeJS.Timeout | null>(null);\n\n const sortBy = beContext.currentRoomSort;\n let listWhenLastScrolled: Room[] | null = null;\n\n const scrollIntoView = () => {\n if (roomListRef.current && listWhenLastScrolled !== rooms) {\n listWhenLastScrolled = rooms;\n const offset = beContext.screenSize <= ScreenSize.Medium ? 185 : 350;\n\n window.scrollTo({\n top: window.scrollY + (roomListRef.current.getBoundingClientRect().top - offset),\n behavior: 'smooth',\n });\n }\n };\n\n useEffect(() => {\n return () => {\n // Clear timeout on unmount or before next effect\n if (timeoutRef.current) {\n clearTimeout(timeoutRef.current);\n }\n };\n }, []);\n\n return useMemo(() => {\n const sortedRooms = [...rooms];\n if (sortedRooms.length !== 0) {\n sortedRooms.sort(RoomSortProvider.getSortByFunction(sortBy));\n }\n\n if (hotel?.showUnavailableRooms) {\n if (orderUnavailableRoomsLast) {\n sortedRooms.sort((a, b) => {\n if (a.isAvailable() && !b.isAvailable()) return -1;\n if (!a.isAvailable() && b.isAvailable()) return 1;\n return 0;\n });\n }\n }\n\n if (!basketContext.isDatePickerOpen && !isLoading && sortedRooms.length > 0) {\n if (timeoutRef.current) {\n clearTimeout(timeoutRef.current);\n }\n\n timeoutRef.current = setTimeout(() => {\n scrollIntoView();\n }, 100);\n }\n\n const elements = (\n <div ref={roomListRef}>\n {isLoading || !loadingAttempted ? (\n <LargeLoader />\n ) : sortedRooms.length ? (\n sortedRooms.map((room, index) => <RoomDetails key={room.code} room={room} disableMarginBottom={index === sortedRooms.length - 1} />)\n ) : (\n <>\n {apiHasError ? <StepRoomErrorForm /> : <NoRoomsFoundBlock />}\n {hotel?.crossSellHotelIds?.map((hotelId) => (\n <RoomListCrossSellBlock key={hotelId} hotelId={hotelId} />\n ))}\n </>\n )}\n </div>\n );\n\n DataLayer.instance.sendRoomImpressions();\n\n return (\n <>\n <RoomListAlert>{!isLoading && retargetingRoom ? <RoomDetailsRetargeting key={retargetingRoom.code} room={retargetingRoom} /> : null}</RoomListAlert>\n {elements}\n </>\n );\n }, [rooms, isLoading, loadingAttempted, openRoom, sortBy, beContext.currentFilters, basketContext.loadedPromotion, basketContext.isDatePickerOpen, orderUnavailableRoomsLast]);\n}\n"]}
|
|
@@ -46,7 +46,7 @@ const TabGroupedRoomList = (props) => {
|
|
|
46
46
|
return Object.keys(group.filters || {});
|
|
47
47
|
}, [group.filters]);
|
|
48
48
|
const roomList = (0, react_1.useMemo)(() => {
|
|
49
|
-
|
|
49
|
+
const sortedRooms = [...rooms];
|
|
50
50
|
if (sortedRooms.length !== 0) {
|
|
51
51
|
sortedRooms.sort(RoomSortProvider_1.default.getSortByFunction(sortBy));
|
|
52
52
|
}
|
|
@@ -61,9 +61,6 @@ const TabGroupedRoomList = (props) => {
|
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
-
else {
|
|
65
|
-
sortedRooms = sortedRooms.filter((r) => r.isAvailable());
|
|
66
|
-
}
|
|
67
64
|
return sortedRooms
|
|
68
65
|
.filter((room) => {
|
|
69
66
|
var _a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabGroupedRoomList.js","sourceRoot":"/","sources":["src/components/steps/room/TabGroupedRooms/TabGroupedRoomList.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAiF;AACjF,+CAA6D;AAE7D,6EAAqD;AACrD,+DAA4D;AAC5D,mCAA0C;AAG1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AK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;gBACnE,MAAM,YAAY,GAAG,MAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAG,SAAS,CAAC,mCAAI,MAAC,OAAO,CAAC,CAAC,CAAS,0CAAE,KAAK,CAAC;gBAE/E,MAAM,mBAAmB,GAAG,CAAC,KAAa,EAAE,EAAE;oBAC1C,iBAAiB,CAAC,CAAC,IAAI,EAAE,EAAE;wBACvB,MAAM,MAAM,mCAAQ,IAAI,KAAE,CAAC,SAAS,CAAC,EAAE,KAAK,GAAE,CAAC;wBAE/C,SAAS,CAAC,4BAA4B,CAAC,MAAM,CAAC,CAAC;wBAE/C,OAAO,MAAM,CAAC;oBAClB,CAAC,CAAC,CAAC;gBACP,CAAC,CAAC;gBAEF,OAAO,CACH,uCAAK,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,wCAAM,CAAC,UAAU;oBAC7C,uCAAK,SAAS,EAAE,wCAAM,CAAC,kBAAkB,CAAC;wBAAG,MAAM,CAAC,IAAI;4BAAQ;oBAChE,8BAAC,eAAM,IAAC,OAAO,EAAC,OAAO,EAAC,SAAS,EAAC,OAAO,EAAC,OAAO,EAAE,OAAc,EAAE,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,mBAAmB,GAAW,CAC9H,CACT,CAAC;aACL;QACL,CAAC,CAAC,CACA,CACT;QACA,QAAQ,CACP,CACT,CAAC;AACN,CAAC,CAAC;AApFW,QAAA,kBAAkB,sBAoF7B","sourcesContent":["import { BookingEngineContext, HotelOverridesContext } from '@frontend/contexts';\nimport React, { useContext, useMemo, useState } from 'react';\n\nimport Headline from '@/components/generic/Headline';\nimport { Select } from '@/components/generic/Select/Select';\nimport { useCurrentHotel } from '@/hooks';\nimport { HotelRoomGroupsDTO } from '@/models/Api/HotelDTO';\nimport { Room } from '@/models/Room/Room';\nimport RoomSortProvider from '@/providers/RoomSortProvider';\n\nimport RoomDetails from '../roomDetails/RoomDetails';\nimport styles from './TabGroupedRoomList.module.scss';\n\ntype TabGroupedRoomListProps = {\n rooms: Room[];\n group: HotelRoomGroupsDTO[number];\n};\n\nexport const TabGroupedRoomList = (props: TabGroupedRoomListProps) => {\n const beContext = useContext(BookingEngineContext);\n const { orderUnavailableRoomsLast } = useContext(HotelOverridesContext);\n const { hotel } = useCurrentHotel();\n\n const sortBy = beContext.currentRoomSort;\n const { rooms, group } = props;\n const [appliedFilters, setAppliedFilters] = useState<{ [id: string]: any }>({});\n\n const filterKeys = useMemo(() => {\n return Object.keys(group.filters || {});\n }, [group.filters]);\n\n const roomList = useMemo(() => {\n const sortedRooms = [...rooms];\n if (sortedRooms.length !== 0) {\n sortedRooms.sort(RoomSortProvider.getSortByFunction(sortBy));\n }\n\n if (hotel?.showUnavailableRooms) {\n if (orderUnavailableRoomsLast) {\n sortedRooms.sort((a, b) => {\n if (a.isAvailable() && !b.isAvailable()) return -1;\n if (!a.isAvailable() && b.isAvailable()) return 1;\n return 0;\n });\n }\n }\n\n return sortedRooms\n .filter((room) => {\n for (const filter of Object.keys(appliedFilters)) {\n if (room.auxiliaryValues?.[filter] && appliedFilters[filter] && !room.auxiliaryValues[filter].includes(`${appliedFilters[filter]}`)) {\n return false;\n }\n }\n\n return room;\n })\n .map((room, index) => {\n return <RoomDetails key={room.code} room={room} disableMarginBottom={index === rooms.length - 1} />;\n });\n }, [rooms, appliedFilters, sortBy, orderUnavailableRoomsLast]);\n\n return (\n <div className={styles.groupedRoomList}>\n {!!group.groupName && (\n <div className={styles.groupedRoomListHeader}>\n <Headline bold>{group.groupName}</Headline>\n </div>\n )}\n\n {!!filterKeys?.length && rooms.length > 1 && (\n <div className={styles.filterContainer}>\n {filterKeys.map((filterKey) => {\n const filter = group.filters?.[filterKey];\n\n if (filter.type === 'select') {\n const options = [{ label: 'All', value: null }, ...filter.options];\n const currentValue = appliedFilters?.[filterKey] ?? (options[0] as any)?.value;\n\n const localOnFilterChange = (value: string) => {\n setAppliedFilters((prev) => {\n const filter = { ...prev, [filterKey]: value };\n\n beContext.setCurrentGroupedRoomFilters(filter);\n\n return filter;\n });\n };\n\n return (\n <div key={filterKey} className={styles.filterItem}>\n <div className={styles['filterItem-label']}>{filter.name}:</div>\n <Select keyName=\"value\" labelName=\"label\" options={options as any} value={currentValue} onChange={localOnFilterChange}></Select>\n </div>\n );\n }\n })}\n </div>\n )}\n {roomList}\n </div>\n );\n};\n"]}
|
|
@@ -27,6 +27,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.TabGroupedRooms = void 0;
|
|
30
|
+
const contexts_1 = require("../../../../contexts/index.js");
|
|
30
31
|
const hooks_1 = require("../../../../hooks/index.js");
|
|
31
32
|
const react_1 = __importStar(require("react"));
|
|
32
33
|
const LargeLoader_1 = __importDefault(require("../../../generic/loader/LargeLoader"));
|
|
@@ -42,6 +43,7 @@ const DataLayer_1 = __importDefault(require("../../../../util/DataLayer"));
|
|
|
42
43
|
const TabGroupedRooms = () => {
|
|
43
44
|
var _a;
|
|
44
45
|
const { hotel } = (0, hooks_1.useCurrentHotel)();
|
|
46
|
+
const { disableGroupRoomsAllTab } = (0, react_1.useContext)(contexts_1.HotelOverridesContext);
|
|
45
47
|
const { rooms, isLoading, loadingAttempted, apiHasError } = (0, RoomRateAvailabilityListFromApi_1.useRoomRateAvailabilityListFromApi)();
|
|
46
48
|
const params = (0, Query_1.useHashQuery)();
|
|
47
49
|
const groupedRooms = (0, react_1.useMemo)(() => {
|
|
@@ -113,9 +115,11 @@ const TabGroupedRooms = () => {
|
|
|
113
115
|
onlyGroups.splice(0, 1);
|
|
114
116
|
return (react_1.default.createElement("div", { style: { maxWidth: '100%', overflow: 'hidden' } },
|
|
115
117
|
react_1.default.createElement(Tabs_1.default, { fullBleedOnLineBreak: false, activeKey: defaultTab },
|
|
116
|
-
react_1.default.createElement(Tab_1.Tab, { title: "All Accommodation", navPath: "list-all", key: "list-all", preventScrollTop: true },
|
|
118
|
+
react_1.default.createElement(Tab_1.Tab, { title: "All Accommodation", navPath: "list-all", key: "list-all", preventScrollTop: true }, disableGroupRoomsAllTab ? (react_1.default.createElement(TabGroupedRoomList_1.TabGroupedRoomList, { group: groupedRooms[0], rooms: rooms })) : (
|
|
119
|
+
// We're not starting at 1 here as we want to display these rooms, even if they're not ordered
|
|
120
|
+
groupedRooms === null || groupedRooms === void 0 ? void 0 : groupedRooms.filter((item) => item.rooms.length).map((group) => {
|
|
117
121
|
return react_1.default.createElement(TabGroupedRoomList_1.TabGroupedRoomList, { group: group, rooms: group.rooms, key: group.id });
|
|
118
|
-
})),
|
|
122
|
+
}))),
|
|
119
123
|
onlyGroups.map((group) => (react_1.default.createElement(Tab_1.Tab, { title: group.groupName, navPath: group.groupName, key: group.id, preventScrollTop: true },
|
|
120
124
|
react_1.default.createElement(TabGroupedRoomList_1.TabGroupedRoomList, { group: group, rooms: group.rooms })))))));
|
|
121
125
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabGroupedRooms.js","sourceRoot":"/","sources":["src/components/steps/room/TabGroupedRooms/TabGroupedRooms.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAAkD;AAClD,+CAAuC;AAEvC,0FAAkE;AAClE,uDAAoD;AACpD,0EAAkD;AAClD,kGAA0E;AAC1E,4GAAoF;AACpF,iFAA8E;AAC9E,mGAAgG;AAChG,yCAA6C;AAC7C,6FAA6F;AAG7F,iEAAyC;AAElC,MAAM,eAAe,GAAG,GAAG,EAAE;;IAChC,MAAM,EAAE,KAAK,EAAE,GAAG,IAAA,uBAAe,GAAE,CAAC;IAEpC,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,WAAW,EAAE,GAAG,IAAA,oEAAkC,GAAE,CAAC;IACjG,MAAM,MAAM,GAAG,IAA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E,gBAAgB;oBAClF,8BAAC,uCAAkB,IAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,GAAI,CACtD,CACT,CAAC,CACC,CACL,CACT,CAAC;KACL;IAED,yEAAyE;IACzE,OAAO,CACH;QACK,WAAW,CAAC,CAAC,CAAC,8BAAC,qCAAiB,OAAG,CAAC,CAAC,CAAC,8BAAC,2BAAiB,OAAG,EAC3D,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,iBAAiB;WAAE,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CACxC,8BAAC,gCAAsB,IAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,GAAI,CAC7D,CAAC,CACH,CACN,CAAC;AACN,CAAC,CAAC;AAzHW,QAAA,eAAe,mBAyH1B","sourcesContent":["import { useCurrentHotel } from '@frontend/hooks';\nimport React, { useMemo } from 'react';\n\nimport LargeLoader from '@/components/generic/loader/LargeLoader';\nimport { Tab } from '@/components/generic/Tabs/Tab';\nimport Tabs from '@/components/generic/Tabs/Tabs';\nimport NoRoomsFoundBlock from '@/components/steps/room/NoRoomsFoundBlock';\nimport RoomListCrossSellBlock from '@/components/steps/room/RoomListCrossSellBlock';\nimport { StepRoomErrorForm } from '@/components/steps/room/StepRoomErrorForm';\nimport { TabGroupedRoomList } from '@/components/steps/room/TabGroupedRooms/TabGroupedRoomList';\nimport { useHashQuery } from '@/hooks/Query';\nimport { useRoomRateAvailabilityListFromApi } from '@/hooks/RoomRateAvailabilityListFromApi';\nimport { HotelRoomGroupsDTO } from '@/models/Api/HotelDTO';\nimport { Room } from '@/models/Room/Room';\nimport DataLayer from '@/util/DataLayer';\n\nexport const TabGroupedRooms = () => {\n const { hotel } = useCurrentHotel();\n\n const { rooms, isLoading, loadingAttempted, apiHasError } = useRoomRateAvailabilityListFromApi();\n const params = useHashQuery();\n\n const groupedRooms: (HotelRoomGroupsDTO[number] & { rooms: Room[] })[] = useMemo(() => {\n if (!hotel) {\n return [];\n }\n\n const sortingGroup: { [id: string]: HotelRoomGroupsDTO[number] & { rooms: Room[] } } = {\n 'list-all': {\n id: 'list-all',\n groupName: 'All Accommodations',\n filters: {},\n rooms: [],\n },\n };\n\n for (const roomGroup of hotel?.roomGroups ?? []) {\n sortingGroup[roomGroup.id] = {\n ...roomGroup,\n rooms: [],\n };\n }\n\n for (const room of rooms) {\n let groupId = !!room.roomGroupId ? room.roomGroupId : 'list-all';\n\n if (!sortingGroup[groupId]) {\n const foundGroup = hotel?.roomGroups?.find((group) => group.id === groupId);\n\n if (foundGroup) {\n sortingGroup[groupId] = {\n ...foundGroup,\n rooms: [],\n };\n } else {\n // Can't find the specific room, defaulting to \"unsorted\" rooms\n groupId = 'list-all';\n }\n }\n\n // Actual bit that puts the right room in the right location\n sortingGroup[groupId].rooms.push(room);\n }\n\n for (const sortedGroupKey of Object.keys(sortingGroup)) {\n if (sortingGroup[sortedGroupKey]?.rooms?.length === 0 && sortedGroupKey !== 'list-all') {\n delete sortingGroup[sortedGroupKey];\n }\n }\n\n // Sort the rooms by the display order\n const valuedSortedGroups = Object.values(sortingGroup).filter((item) => !!item);\n\n if (valuedSortedGroups.length === 1 && valuedSortedGroups[0].rooms.length === 0) {\n valuedSortedGroups.splice(0, 1);\n }\n\n DataLayer.instance.sendRoomImpressions();\n\n return valuedSortedGroups;\n }, [rooms, hotel?.roomGroups]);\n\n const defaultTab = useMemo(() => {\n return params.get('defaultTab') ?? undefined;\n }, []);\n\n if (isLoading || !loadingAttempted) {\n return <LargeLoader />;\n }\n\n if (groupedRooms.length > 0 && groupedRooms.length <= 2) {\n let groupObject = { groupName: '', filters: {}, id: '' };\n let rooms = [];\n if (groupedRooms.length === 2) {\n groupObject = groupedRooms[1];\n rooms = groupedRooms[1].rooms;\n } else {\n rooms = groupedRooms[0].rooms;\n }\n\n return <TabGroupedRoomList group={groupObject} rooms={rooms} />;\n } else if (groupedRooms.length > 2) {\n const onlyGroups = [...groupedRooms];\n // Update onlyGroups to be the same as groupedRooms, but without the first element\n onlyGroups.splice(0, 1);\n\n return (\n <div style={{ maxWidth: '100%', overflow: 'hidden' }}>\n <Tabs fullBleedOnLineBreak={false} activeKey={defaultTab}>\n <Tab title=\"All Accommodation\" navPath=\"list-all\" key=\"list-all\" preventScrollTop>\n {/* We're not starting at 1 here as we want to display these rooms, even if they're not ordered */}\n {groupedRooms\n ?.filter((item) => item.rooms.length)\n .map((group) => {\n return <TabGroupedRoomList group={group} rooms={group.rooms} key={group.id} />;\n })}\n </Tab>\n {/* Reason we've got to splice here is 0 index will always be unsorted rooms */}\n {onlyGroups.map((group) => (\n <Tab title={group.groupName} navPath={group.groupName} key={group.id} preventScrollTop>\n <TabGroupedRoomList group={group} rooms={group.rooms} />\n </Tab>\n ))}\n </Tabs>\n </div>\n );\n }\n\n // No rooms found, so let's display the crossell block, or no rooms found\n return (\n <>\n {apiHasError ? <StepRoomErrorForm /> : <NoRoomsFoundBlock />}\n {hotel?.crossSellHotelIds?.map((hotelId) => (\n <RoomListCrossSellBlock key={hotelId} hotelId={hotelId} />\n ))}\n </>\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"TabGroupedRooms.js","sourceRoot":"/","sources":["src/components/steps/room/TabGroupedRooms/TabGroupedRooms.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA2D;AAC3D,2CAAkD;AAClD,+CAAmD;AAEnD,0FAAkE;AAClE,uDAAoD;AACpD,0EAAkD;AAClD,kGAA0E;AAC1E,4GAAoF;AACpF,iFAA8E;AAC9E,mGAAgG;AAChG,yCAA6C;AAC7C,6FAA6F;AAG7F,iEAAyC;AAElC,MAAM,eAAe,GAAG,GAAG,EAAE;;IAChC,MAAM,EAAE,KAAK,EAAE,GAAG,IAAA,uBAAe,GAAE,CAAC;IACpC,MAAM,EAAE,uBAAuB,EAAE,GAAG,IAAA,kBAAU,EAAC,gCAAqB,CAAC,CAAC;IACtE,MAAM,EAA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AK,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,GAAI,CAAC;gBACnF,CAAC,CAAC,CACT,CACC;gBAEL,UAAU,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CACvB,8BAAC,SAAG,IAAC,KAAK,EAAE,KAAK,CAAC,SAAS,EAAE,OAAO,EAAE,KAAK,CAAC,SAAS,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,gBAAgB;oBAClF,8BAAC,uCAAkB,IAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,GAAI,CACtD,CACT,CAAC,CACC,CACL,CACT,CAAC;KACL;IAED,yEAAyE;IACzE,OAAO,CACH;QACK,WAAW,CAAC,CAAC,CAAC,8BAAC,qCAAiB,OAAG,CAAC,CAAC,CAAC,8BAAC,2BAAiB,OAAG,EAC3D,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,iBAAiB;WAAE,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CACxC,8BAAC,gCAAsB,IAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,GAAI,CAC7D,CAAC,CACH,CACN,CAAC;AACN,CAAC,CAAC;AA7HW,QAAA,eAAe,mBA6H1B","sourcesContent":["import { HotelOverridesContext } from '@frontend/contexts';\nimport { useCurrentHotel } from '@frontend/hooks';\nimport React, { useContext, useMemo } from 'react';\n\nimport LargeLoader from '@/components/generic/loader/LargeLoader';\nimport { Tab } from '@/components/generic/Tabs/Tab';\nimport Tabs from '@/components/generic/Tabs/Tabs';\nimport NoRoomsFoundBlock from '@/components/steps/room/NoRoomsFoundBlock';\nimport RoomListCrossSellBlock from '@/components/steps/room/RoomListCrossSellBlock';\nimport { StepRoomErrorForm } from '@/components/steps/room/StepRoomErrorForm';\nimport { TabGroupedRoomList } from '@/components/steps/room/TabGroupedRooms/TabGroupedRoomList';\nimport { useHashQuery } from '@/hooks/Query';\nimport { useRoomRateAvailabilityListFromApi } from '@/hooks/RoomRateAvailabilityListFromApi';\nimport { HotelRoomGroupsDTO } from '@/models/Api/HotelDTO';\nimport { Room } from '@/models/Room/Room';\nimport DataLayer from '@/util/DataLayer';\n\nexport const TabGroupedRooms = () => {\n const { hotel } = useCurrentHotel();\n const { disableGroupRoomsAllTab } = useContext(HotelOverridesContext);\n const { rooms, isLoading, loadingAttempted, apiHasError } = useRoomRateAvailabilityListFromApi();\n const params = useHashQuery();\n\n const groupedRooms: (HotelRoomGroupsDTO[number] & { rooms: Room[] })[] = useMemo(() => {\n if (!hotel) {\n return [];\n }\n\n const sortingGroup: { [id: string]: HotelRoomGroupsDTO[number] & { rooms: Room[] } } = {\n 'list-all': {\n id: 'list-all',\n groupName: 'All Accommodations',\n filters: {},\n rooms: [],\n },\n };\n\n for (const roomGroup of hotel?.roomGroups ?? []) {\n sortingGroup[roomGroup.id] = {\n ...roomGroup,\n rooms: [],\n };\n }\n\n for (const room of rooms) {\n let groupId = !!room.roomGroupId ? room.roomGroupId : 'list-all';\n\n if (!sortingGroup[groupId]) {\n const foundGroup = hotel?.roomGroups?.find((group) => group.id === groupId);\n\n if (foundGroup) {\n sortingGroup[groupId] = {\n ...foundGroup,\n rooms: [],\n };\n } else {\n // Can't find the specific room, defaulting to \"unsorted\" rooms\n groupId = 'list-all';\n }\n }\n\n // Actual bit that puts the right room in the right location\n sortingGroup[groupId].rooms.push(room);\n }\n\n for (const sortedGroupKey of Object.keys(sortingGroup)) {\n if (sortingGroup[sortedGroupKey]?.rooms?.length === 0 && sortedGroupKey !== 'list-all') {\n delete sortingGroup[sortedGroupKey];\n }\n }\n\n // Sort the rooms by the display order\n const valuedSortedGroups = Object.values(sortingGroup).filter((item) => !!item);\n\n if (valuedSortedGroups.length === 1 && valuedSortedGroups[0].rooms.length === 0) {\n valuedSortedGroups.splice(0, 1);\n }\n\n DataLayer.instance.sendRoomImpressions();\n\n return valuedSortedGroups;\n }, [rooms, hotel?.roomGroups]);\n\n const defaultTab = useMemo(() => {\n return params.get('defaultTab') ?? undefined;\n }, []);\n\n if (isLoading || !loadingAttempted) {\n return <LargeLoader />;\n }\n\n if (groupedRooms.length > 0 && groupedRooms.length <= 2) {\n let groupObject = { groupName: '', filters: {}, id: '' };\n let rooms = [];\n if (groupedRooms.length === 2) {\n groupObject = groupedRooms[1];\n rooms = groupedRooms[1].rooms;\n } else {\n rooms = groupedRooms[0].rooms;\n }\n\n return <TabGroupedRoomList group={groupObject} rooms={rooms} />;\n } else if (groupedRooms.length > 2) {\n const onlyGroups = [...groupedRooms];\n // Update onlyGroups to be the same as groupedRooms, but without the first element\n onlyGroups.splice(0, 1);\n\n return (\n <div style={{ maxWidth: '100%', overflow: 'hidden' }}>\n <Tabs fullBleedOnLineBreak={false} activeKey={defaultTab}>\n <Tab title=\"All Accommodation\" navPath=\"list-all\" key=\"list-all\" preventScrollTop>\n {disableGroupRoomsAllTab ? (\n <TabGroupedRoomList group={groupedRooms[0]} rooms={rooms} />\n ) : (\n // We're not starting at 1 here as we want to display these rooms, even if they're not ordered\n groupedRooms\n ?.filter((item) => item.rooms.length)\n .map((group) => {\n return <TabGroupedRoomList group={group} rooms={group.rooms} key={group.id} />;\n })\n )}\n </Tab>\n {/* Reason we've got to splice here is 0 index will always be unsorted rooms */}\n {onlyGroups.map((group) => (\n <Tab title={group.groupName} navPath={group.groupName} key={group.id} preventScrollTop>\n <TabGroupedRoomList group={group} rooms={group.rooms} />\n </Tab>\n ))}\n </Tabs>\n </div>\n );\n }\n\n // No rooms found, so let's display the crossell block, or no rooms found\n return (\n <>\n {apiHasError ? <StepRoomErrorForm /> : <NoRoomsFoundBlock />}\n {hotel?.crossSellHotelIds?.map((hotelId) => (\n <RoomListCrossSellBlock key={hotelId} hotelId={hotelId} />\n ))}\n </>\n );\n};\n"]}
|
|
@@ -52,7 +52,6 @@ function RoomRates(props) {
|
|
|
52
52
|
const { hotel } = (0, hooks_1.useCurrentHotel)();
|
|
53
53
|
const { rates, isCardLayout } = props;
|
|
54
54
|
const numOfRatesToShowFirst = beContext.screenSize <= ScreenSize_1.default.Medium ? 2 : 3;
|
|
55
|
-
const sortBy = beContext.currentRoomSort;
|
|
56
55
|
(0, react_1.useEffect)(() => {
|
|
57
56
|
var _a;
|
|
58
57
|
if (((_a = basketContext.selectedBasketRow) === null || _a === void 0 ? void 0 : _a.getRoom()) && basketContext.selectedBasketRow.getRoom().code === props.roomCode) {
|
|
@@ -63,8 +62,10 @@ function RoomRates(props) {
|
|
|
63
62
|
DataLayer_1.default.instance.sendRoomImpressions();
|
|
64
63
|
}, [showingMoreOpen]);
|
|
65
64
|
return (0, react_1.useMemo)(() => {
|
|
66
|
-
var _a, _b;
|
|
67
|
-
|
|
65
|
+
var _a, _b, _c;
|
|
66
|
+
// Use currentRoomRateSort if defined, otherwise fallback to currentRoomSort
|
|
67
|
+
const sortBy = (_a = beContext.currentRoomRateSort) !== null && _a !== void 0 ? _a : beContext.currentRoomSort;
|
|
68
|
+
const featuredRates = (_b = props.featuredRates) === null || _b === void 0 ? void 0 : _b.filter((rate) => !!rate);
|
|
68
69
|
const hasFeaturedRates = !!featuredRates && featuredRates.length > 0;
|
|
69
70
|
let sortedRates;
|
|
70
71
|
if (rates.length !== 0) {
|
|
@@ -119,7 +120,7 @@ function RoomRates(props) {
|
|
|
119
120
|
if (!isCardLayout && (!hasFeaturedRates || showingMoreOpen)) {
|
|
120
121
|
if (!props.hideMemberOnlyRow &&
|
|
121
122
|
!!(hotel === null || hotel === void 0 ? void 0 : hotel.memberOnlyPromoCode) &&
|
|
122
|
-
(!ccx.signedInUser || (hotel === null || hotel === void 0 ? void 0 : hotel.memberOnlyPromoCode) === ((
|
|
123
|
+
(!ccx.signedInUser || (hotel === null || hotel === void 0 ? void 0 : hotel.memberOnlyPromoCode) === ((_c = basketContext === null || basketContext === void 0 ? void 0 : basketContext.selectedBasketRow) === null || _c === void 0 ? void 0 : _c.getPromoCode()))) {
|
|
123
124
|
if (hotel === null || hotel === void 0 ? void 0 : hotel.memberOnlyRenderRateLast) {
|
|
124
125
|
itemsToRender.push(react_1.default.createElement(MembersOnlyRow_1.default, null));
|
|
125
126
|
}
|
|
@@ -139,7 +140,7 @@ function RoomRates(props) {
|
|
|
139
140
|
rowsLeftToOpen,
|
|
140
141
|
" ",
|
|
141
142
|
t(Translation_1.Translation.Step.Room.RoomInfo.MoreRates))))));
|
|
142
|
-
}, [props.featuredRates, rates, beContext.currentRoomSort, showingMoreOpen, basketContext === null || basketContext === void 0 ? void 0 : basketContext.loadedPromotion, hotel === null || hotel === void 0 ? void 0 : hotel.memberOnlyRenderRateLast]);
|
|
143
|
+
}, [props.featuredRates, rates, beContext.currentRoomSort, beContext.currentRoomRateSort, showingMoreOpen, basketContext === null || basketContext === void 0 ? void 0 : basketContext.loadedPromotion, hotel === null || hotel === void 0 ? void 0 : hotel.memberOnlyRenderRateLast]);
|
|
143
144
|
}
|
|
144
145
|
exports.default = RoomRates;
|
|
145
146
|
//# sourceMappingURL=RoomRates.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RoomRates.js","sourceRoot":"/","sources":["src/components/steps/room/roomDetails/roomRates/RoomRates.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAyF;AACzF,2CAAkD;AAClD,4DAAoC;AACpC,+CAAwE;AACxE,iDAA+C;AAC/C,0DAAuD;AAEvD,6EAAqD;AACrD,yDAA0D;AAC1D,kHAA0F;AAC1F,4GAAoF;AAGpF,wHAAgG;AAChG,oFAA4D;AAC5D,wCAAqC;AACrC,iEAAyC;AACzC,mEAA2C;AAE3C,gFAAwD;AACxD,yFAAsF;AAkBtF,SAAwB,SAAS,CAAC,KAAqB;IACnD,MAAM,EAAE,CAAC,EAAE,GAAG,IAAA,8BAAc,GAAE,CAAC;IAC/B,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IAE9D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import { BasketContext, BookingEngineContext, CompanyContext } from '@frontend/contexts';\nimport { useCurrentHotel } from '@frontend/hooks';\nimport classNames from 'classnames';\nimport React, { useContext, useEffect, useMemo, useState } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { Translation } from 'translations/Translation';\n\nimport BEButton from '@/components/generic/BEButton';\nimport { IconType } from '@/components/generic/Icon/Icon';\nimport MembersOnlyRow from '@/components/steps/room/roomDetails/roomRates/MembersOnlyRow';\nimport RoomRateRow from '@/components/steps/room/roomDetails/roomRates/RoomRateRow';\nimport { InlineRoomMiniEngineConfig } from '@/engines/InlineRoomMiniEngine/InlineRoomMiniEngine';\nimport { RoomRate } from '@/models/Room/RoomRate';\nimport RoomRateReadMoreVersionFeature from '@/providers/feature/RoomRateReadMoreVersionFeature';\nimport RoomSortProvider from '@/providers/RoomSortProvider';\nimport { Color } from '@/util/Color';\nimport DataLayer from '@/util/DataLayer';\nimport ScreenSize from '@/util/ScreenSize';\n\nimport ReadMoreRoomRateRow from './ReadMoreRoomRateRow';\nimport { RoomRateListPromotion } from './RoomRateListPromotion/RoomRateListPromotion';\n\nexport interface RoomRatesProps extends Pick<InlineRoomMiniEngineConfig, 'policy' | 'priceDescription'> {\n roomCode: string;\n rates: RoomRate[];\n\n featuredRates?: RoomRate[];\n\n classNames?: string;\n\n hideMemberOnlyRow?: boolean;\n\n // Inline Booking Widget overrides\n getButtonLabel?: (isRoomSelectedAndEditing: boolean, isThisSelectedRow: boolean) => string;\n onAddToBasketOverride?: (rate: RoomRate) => void;\n isCardLayout?: boolean;\n}\n\nexport default function RoomRates(props: RoomRatesProps) {\n const { t } = useTranslation();\n const [showingMoreOpen, setShowingMoreOpen] = useState(false);\n\n const basketContext = useContext(BasketContext);\n const beContext = useContext(BookingEngineContext);\n\n const ccx = useContext(CompanyContext);\n\n const { hotel } = useCurrentHotel();\n\n const { rates, isCardLayout } = props;\n\n const numOfRatesToShowFirst = beContext.screenSize <= ScreenSize.Medium ? 2 : 3;\n\n const sortBy = beContext.currentRoomSort;\n\n useEffect(() => {\n if (basketContext.selectedBasketRow?.getRoom() && basketContext.selectedBasketRow.getRoom().code === props.roomCode) {\n setShowingMoreOpen(true);\n }\n }, [basketContext.selectedBasketRow]);\n\n useEffect(() => {\n DataLayer.instance.sendRoomImpressions();\n }, [showingMoreOpen]);\n\n return useMemo(() => {\n const featuredRates = props.featuredRates?.filter((rate) => !!rate);\n const hasFeaturedRates = !!featuredRates && featuredRates.length > 0;\n\n let sortedRates: RoomRate[];\n\n if (rates.length !== 0) {\n sortedRates = rates.sort(RoomSortProvider.getSortByFunction(sortBy));\n }\n\n // Need two sorts because of MOD\n sortedRates = rates.sort((a, b) => {\n if (a.isMemberOnly) {\n return -1;\n } else if (b.isMemberOnly) {\n return 1;\n } else {\n return 0;\n }\n });\n\n const showMoreOnClick = () => {\n setShowingMoreOpen(true);\n };\n\n const itemsToRender = [];\n\n const renderRoomRateRow = (rate: RoomRate, isPromo = false) => {\n if (RoomRateReadMoreVersionFeature.isActive()) {\n return (\n <ReadMoreRoomRateRow\n key={rate.name}\n rate={rate}\n getButtonLabel={props.getButtonLabel}\n onAddToBasketOverride={props.onAddToBasketOverride}\n isPromoRate={isPromo}\n />\n );\n }\n\n return (\n <RoomRateRow\n key={rate.name}\n rate={rate}\n getButtonLabel={props.getButtonLabel}\n onAddToBasketOverride={props.onAddToBasketOverride}\n isPromoRate={isPromo}\n isCardLayout={isCardLayout}\n policy={props.policy}\n priceDescription={props.priceDescription}\n />\n );\n };\n\n const maxRows = hasFeaturedRates && !showingMoreOpen ? featuredRates.length : numOfRatesToShowFirst;\n let rowsLeftToOpen = 0;\n\n if (featuredRates && featuredRates.length) {\n featuredRates.sort(RoomSortProvider.getSortByFunction(sortBy));\n // First we add Featured Rates to the top of the list - no limits there\n featuredRates.forEach((row) => {\n if (row) {\n itemsToRender.push(renderRoomRateRow(row, true));\n }\n });\n }\n\n if (basketContext.loadedPromotion) {\n itemsToRender.push(<RoomRateListPromotion promotion={basketContext.loadedPromotion} />);\n }\n\n // Then we add the remaining rates to the render list - stop adding if we hit `maxRows`\n sortedRates.forEach((rate: RoomRate) => {\n if (isCardLayout || itemsToRender.length < maxRows || showingMoreOpen) {\n itemsToRender.push(renderRoomRateRow(rate));\n } else {\n rowsLeftToOpen++;\n }\n });\n\n // Then we do a tricky check to see if MOD intent should be displayed\n if (!isCardLayout && (!hasFeaturedRates || showingMoreOpen)) {\n if (\n !props.hideMemberOnlyRow &&\n !!hotel?.memberOnlyPromoCode &&\n (!ccx.signedInUser || hotel?.memberOnlyPromoCode === basketContext?.selectedBasketRow?.getPromoCode())\n ) {\n if (hotel?.memberOnlyRenderRateLast) {\n itemsToRender.push(<MembersOnlyRow />);\n } else {\n itemsToRender.unshift(<MembersOnlyRow />);\n }\n }\n }\n\n return (\n <div className={classNames(props.classNames)}>\n {itemsToRender.map((item: any, index: number) => {\n return <React.Fragment key={index}>{item}</React.Fragment>;\n })}\n {rowsLeftToOpen > 0 && (\n <div className=\"room-show-more\">\n <BEButton icon={IconType.ArrowDown2} iconPosition=\"right\" stopIconAnimation isText textColor={Color.Navy} onClick={showMoreOnClick}>\n {t(Translation.Step.Room.RoomInfo.Show)} {rowsLeftToOpen} {t(Translation.Step.Room.RoomInfo.MoreRates)}\n </BEButton>\n </div>\n )}\n </div>\n );\n }, [props.featuredRates, rates, beContext.currentRoomSort, showingMoreOpen, basketContext?.loadedPromotion, hotel?.memberOnlyRenderRateLast]);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"RoomRates.js","sourceRoot":"/","sources":["src/components/steps/room/roomDetails/roomRates/RoomRates.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAyF;AACzF,2CAAkD;AAClD,4DAAoC;AACpC,+CAAwE;AACxE,iDAA+C;AAC/C,0DAAuD;AAEvD,6EAAqD;AACrD,yDAA0D;AAC1D,kHAA0F;AAC1F,4GAAoF;AAGpF,wHAAgG;AAChG,oFAA4D;AAC5D,wC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AC,QAAQ,CAAC,SAAS,CAAC,CAC/F,CACT,CACT,CACC,CACT,CAAC;IACN,CAAC,EAAE,CAAC,KAAK,CAAC,aAAa,EAAE,KAAK,EAAE,SAAS,CAAC,eAAe,EAAE,SAAS,CAAC,mBAAmB,EAAE,eAAe,EAAE,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,eAAe,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,wBAAwB,CAAC,CAAC,CAAC;AACjL,CAAC;AAzID,4BAyIC","sourcesContent":["import { BasketContext, BookingEngineContext, CompanyContext } from '@frontend/contexts';\nimport { useCurrentHotel } from '@frontend/hooks';\nimport classNames from 'classnames';\nimport React, { useContext, useEffect, useMemo, useState } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { Translation } from 'translations/Translation';\n\nimport BEButton from '@/components/generic/BEButton';\nimport { IconType } from '@/components/generic/Icon/Icon';\nimport MembersOnlyRow from '@/components/steps/room/roomDetails/roomRates/MembersOnlyRow';\nimport RoomRateRow from '@/components/steps/room/roomDetails/roomRates/RoomRateRow';\nimport { InlineRoomMiniEngineConfig } from '@/engines/InlineRoomMiniEngine/InlineRoomMiniEngine';\nimport { RoomRate } from '@/models/Room/RoomRate';\nimport RoomRateReadMoreVersionFeature from '@/providers/feature/RoomRateReadMoreVersionFeature';\nimport RoomSortProvider from '@/providers/RoomSortProvider';\nimport { Color } from '@/util/Color';\nimport DataLayer from '@/util/DataLayer';\nimport ScreenSize from '@/util/ScreenSize';\n\nimport ReadMoreRoomRateRow from './ReadMoreRoomRateRow';\nimport { RoomRateListPromotion } from './RoomRateListPromotion/RoomRateListPromotion';\n\nexport interface RoomRatesProps extends Pick<InlineRoomMiniEngineConfig, 'policy' | 'priceDescription'> {\n roomCode: string;\n rates: RoomRate[];\n\n featuredRates?: RoomRate[];\n\n classNames?: string;\n\n hideMemberOnlyRow?: boolean;\n\n // Inline Booking Widget overrides\n getButtonLabel?: (isRoomSelectedAndEditing: boolean, isThisSelectedRow: boolean) => string;\n onAddToBasketOverride?: (rate: RoomRate) => void;\n isCardLayout?: boolean;\n}\n\nexport default function RoomRates(props: RoomRatesProps) {\n const { t } = useTranslation();\n const [showingMoreOpen, setShowingMoreOpen] = useState(false);\n\n const basketContext = useContext(BasketContext);\n const beContext = useContext(BookingEngineContext);\n\n const ccx = useContext(CompanyContext);\n\n const { hotel } = useCurrentHotel();\n\n const { rates, isCardLayout } = props;\n\n const numOfRatesToShowFirst = beContext.screenSize <= ScreenSize.Medium ? 2 : 3;\n\n useEffect(() => {\n if (basketContext.selectedBasketRow?.getRoom() && basketContext.selectedBasketRow.getRoom().code === props.roomCode) {\n setShowingMoreOpen(true);\n }\n }, [basketContext.selectedBasketRow]);\n\n useEffect(() => {\n DataLayer.instance.sendRoomImpressions();\n }, [showingMoreOpen]);\n\n return useMemo(() => {\n // Use currentRoomRateSort if defined, otherwise fallback to currentRoomSort\n const sortBy = beContext.currentRoomRateSort ?? beContext.currentRoomSort;\n const featuredRates = props.featuredRates?.filter((rate) => !!rate);\n const hasFeaturedRates = !!featuredRates && featuredRates.length > 0;\n\n let sortedRates: RoomRate[];\n\n if (rates.length !== 0) {\n sortedRates = rates.sort(RoomSortProvider.getSortByFunction(sortBy));\n }\n\n // Need two sorts because of MOD\n sortedRates = rates.sort((a, b) => {\n if (a.isMemberOnly) {\n return -1;\n } else if (b.isMemberOnly) {\n return 1;\n } else {\n return 0;\n }\n });\n\n const showMoreOnClick = () => {\n setShowingMoreOpen(true);\n };\n\n const itemsToRender = [];\n\n const renderRoomRateRow = (rate: RoomRate, isPromo = false) => {\n if (RoomRateReadMoreVersionFeature.isActive()) {\n return (\n <ReadMoreRoomRateRow\n key={rate.name}\n rate={rate}\n getButtonLabel={props.getButtonLabel}\n onAddToBasketOverride={props.onAddToBasketOverride}\n isPromoRate={isPromo}\n />\n );\n }\n\n return (\n <RoomRateRow\n key={rate.name}\n rate={rate}\n getButtonLabel={props.getButtonLabel}\n onAddToBasketOverride={props.onAddToBasketOverride}\n isPromoRate={isPromo}\n isCardLayout={isCardLayout}\n policy={props.policy}\n priceDescription={props.priceDescription}\n />\n );\n };\n\n const maxRows = hasFeaturedRates && !showingMoreOpen ? featuredRates.length : numOfRatesToShowFirst;\n let rowsLeftToOpen = 0;\n\n if (featuredRates && featuredRates.length) {\n featuredRates.sort(RoomSortProvider.getSortByFunction(sortBy));\n // First we add Featured Rates to the top of the list - no limits there\n featuredRates.forEach((row) => {\n if (row) {\n itemsToRender.push(renderRoomRateRow(row, true));\n }\n });\n }\n\n if (basketContext.loadedPromotion) {\n itemsToRender.push(<RoomRateListPromotion promotion={basketContext.loadedPromotion} />);\n }\n\n // Then we add the remaining rates to the render list - stop adding if we hit `maxRows`\n sortedRates.forEach((rate: RoomRate) => {\n if (isCardLayout || itemsToRender.length < maxRows || showingMoreOpen) {\n itemsToRender.push(renderRoomRateRow(rate));\n } else {\n rowsLeftToOpen++;\n }\n });\n\n // Then we do a tricky check to see if MOD intent should be displayed\n if (!isCardLayout && (!hasFeaturedRates || showingMoreOpen)) {\n if (\n !props.hideMemberOnlyRow &&\n !!hotel?.memberOnlyPromoCode &&\n (!ccx.signedInUser || hotel?.memberOnlyPromoCode === basketContext?.selectedBasketRow?.getPromoCode())\n ) {\n if (hotel?.memberOnlyRenderRateLast) {\n itemsToRender.push(<MembersOnlyRow />);\n } else {\n itemsToRender.unshift(<MembersOnlyRow />);\n }\n }\n }\n\n return (\n <div className={classNames(props.classNames)}>\n {itemsToRender.map((item: any, index: number) => {\n return <React.Fragment key={index}>{item}</React.Fragment>;\n })}\n {rowsLeftToOpen > 0 && (\n <div className=\"room-show-more\">\n <BEButton icon={IconType.ArrowDown2} iconPosition=\"right\" stopIconAnimation isText textColor={Color.Navy} onClick={showMoreOnClick}>\n {t(Translation.Step.Room.RoomInfo.Show)} {rowsLeftToOpen} {t(Translation.Step.Room.RoomInfo.MoreRates)}\n </BEButton>\n </div>\n )}\n </div>\n );\n }, [props.featuredRates, rates, beContext.currentRoomSort, beContext.currentRoomRateSort, showingMoreOpen, basketContext?.loadedPromotion, hotel?.memberOnlyRenderRateLast]);\n}\n"]}
|
|
@@ -119,10 +119,15 @@ function BESummaryRoomRow(props) {
|
|
|
119
119
|
t(Translation_1.Translation.Misc.PerNight),
|
|
120
120
|
")"),
|
|
121
121
|
react_1.default.createElement(Text_1.default, { type: Text_1.TextType.Small, color: textWhiteOr(Color_1.Color.DarkGrey) },
|
|
122
|
-
react_1.default.createElement(Currency_1.default, null, rate === null || rate === void 0 ? void 0 : rate.
|
|
122
|
+
react_1.default.createElement(Currency_1.default, null, rate === null || rate === void 0 ? void 0 : rate.getAveragePriceBeforeDiscount(true)))),
|
|
123
123
|
promoApplied && (react_1.default.createElement("div", { className: "u-marg-bottom--light u-flex" },
|
|
124
124
|
react_1.default.createElement(Text_1.default, { type: Text_1.TextType.Small, color: textWhiteOr() }, t(Translation_1.Translation.Step.Date.PromoCode)),
|
|
125
125
|
react_1.default.createElement(Text_1.default, { type: Text_1.TextType.Small, color: textWhiteOr(Color_1.Color.DarkGrey) }, row.getPromoCode()))),
|
|
126
|
+
rate && (rate === null || rate === void 0 ? void 0 : rate.getTotalDiscount()) > 0 && (react_1.default.createElement("div", { className: "u-marg-bottom--light u-flex" },
|
|
127
|
+
react_1.default.createElement(Text_1.default, { type: Text_1.TextType.Small, color: textWhiteOr() }, t(Translation_1.Translation.Misc.Discount)),
|
|
128
|
+
react_1.default.createElement(Text_1.default, { type: Text_1.TextType.Small, color: textWhiteOr(Color_1.Color.DarkGrey) },
|
|
129
|
+
react_1.default.createElement("span", { className: "u-ellip-overflow" }, "-"),
|
|
130
|
+
react_1.default.createElement(Currency_1.default, null, rate === null || rate === void 0 ? void 0 : rate.getTotalDiscount())))),
|
|
126
131
|
react_1.default.createElement("div", { className: "u-marg-bottom--light u-flex" },
|
|
127
132
|
react_1.default.createElement(Text_1.default, { type: Text_1.TextType.Small, color: textWhiteOr() }, t(Translation_1.Translation.Step.General.RoomTotal)),
|
|
128
133
|
react_1.default.createElement(Text_1.default, { type: Text_1.TextType.Small, color: textWhiteOr(Color_1.Color.DarkGrey) },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BESummaryRoomRow.js","sourceRoot":"/","sources":["src/components/summary/BESummaryRoomRow.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA0E;AAC1E,2CAAkD;AAClD,yCAA4D;AAC5D,+CAA0C;AAC1C,iDAA+C;AAC/C,uDAA+C;AAC/C,0DAAuD;AAEvD,6EAAqD;AACrD,6EAAqD;AACrD,+EAAuD;AACvD,kEAA2D;AAC3D,mFAA2D;AAC3D,oGAA4E;AAC5E,mEAAgE;AAEhE,6DAAsD;AACtD,wCAAqC;AACrC,qEAA6C;AAC7C,uEAA+C;AAU/C,SAAwB,gBAAgB,CAAC,KAA4B;;IACjE,MAAM,aAAa,GAAG,IAAA,kBAAU,EAAC,wBAAa,CAAC,CAAC;IAChD,MAAM,EAAE,WAAW,EAAE,GAAG,IAAA,kBAAU,EAAC,gCAAqB,CAAC,CAAC;IAC1D,MAAM,EAAE,kBAAkB,EAAE,KAAK,EAAE,GAAG,IAAA,uBAAe,GAAE,CAAC;IAExD,MAAM,EAAE,CAAC,EAAE,GAAG,IAAA,8BAAc,GAAE,CAAC;IAC/B,MAAM,QAAQ,GAAG,IAAA,8BAAW,GAAE,CAAC;IAC/B,MAAM,EAAE,YAAY,EAAE,GAAG,IAAA,uCAAkB,GAAE,CAAC;IAE9C,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,KAAK,CAAC;IAEzC,MAAM,UAAU,GAAG,GAAG,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAC3C,MAAM,IAAI,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC;IAE3B,MAAM,UAAU,GAAG,CAAA,MAAA,aAAa,CAAC,iBAAiB,0CAAE,KAAK,EAAE,MAAK,GAAG,CAAC,KAAK,EAA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ourcesContent":["import { BasketContext, FullPageEngineContext } from '@frontend/contexts';\nimport { useCurrentHotel } from '@frontend/hooks';\nimport { getFilteredBookingRateFees } from '@roomstay/core';\nimport React, { useContext } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { useNavigate } from 'react-router-dom';\nimport { Translation } from 'translations/Translation';\n\nimport BEButton from '@/components/generic/BEButton';\nimport Currency from '@/components/generic/Currency';\nimport LineBreak from '@/components/generic/LineBreak';\nimport Text, { TextType } from '@/components/generic/Text';\nimport Tooltip from '@/components/generic/Tooltip/Tooltip';\nimport ImageGallerySlider from '@/components/steps/room/ImageGallerySlider';\nimport { useSearchScopeHook } from '@/hooks/useSearchScopeHook';\nimport BasketRow from '@/models/BasketRow';\nimport { ImageSize } from '@/providers/ImageProvider';\nimport { Color } from '@/util/Color';\nimport getStepRoom from '@/util/GetStepRoom';\nimport StringHelper from '@/util/StringHelper';\n\ninterface BESummaryRoomRowProps {\n index: number;\n row: BasketRow;\n showImages: boolean;\n\n onEditPropertyClicked?: () => void;\n}\n\nexport default function BESummaryRoomRow(props: BESummaryRoomRowProps) {\n const basketContext = useContext(BasketContext);\n const { currentStep } = useContext(FullPageEngineContext);\n const { isAccent2ColorDark, hotel } = useCurrentHotel();\n\n const { t } = useTranslation();\n const navigate = useNavigate();\n const { showChildren } = useSearchScopeHook();\n\n const { index, row, showImages } = props;\n\n const totalPrice = row.getTotalPrice(true);\n const rate = row.getRate();\n\n const isSelected = basketContext.selectedBasketRow?.getID() === row.getID();\n const isOnlyRate = basketContext.currentBasketRows.length === 1;\n\n const removeRate = t(isOnlyRate ? Translation.Step.Room.Summary.NoRemoveLastRate : Translation.Step.Room.Summary.RemoveThisRate);\n\n const rowFees = row.getRate()?.getTotalFees();\n const rowTaxes = row.getRate()?.getTotalTaxes();\n const rowItemisedFees = hotel && row.getRate()?.getItemisedFees(getFilteredBookingRateFees(hotel.fees ?? []));\n\n const cancelEditBasketRowOnClick = () => basketContext.clearSelectedRates(); //Set the selected basket row to null, ensuring that no row is selected for editing.\n const editOnClickHandler = () => {\n if (currentStep !== getStepRoom()) {\n navigate(getStepRoom().getStepUrl());\n }\n basketContext.selectBasketRow(row);\n\n if (props.onEditPropertyClicked) {\n props.onEditPropertyClicked();\n }\n };\n const removeOnClickHandler = () => {\n if (currentStep !== getStepRoom()) {\n navigate(getStepRoom().getStepUrl());\n }\n basketContext.removeBasketRow(row);\n };\n\n const promoApplied = row.isPromoCodeValid();\n\n const shouldTextBeWhite = isAccent2ColorDark && isSelected;\n const textWhiteOr = (color = Color.Graphite) => {\n return shouldTextBeWhite ? Color.White : color;\n };\n\n return (\n <>\n {index >= 1 && <LineBreak noMargins darker />}\n <div key={row.getID()} className={'booking-engine-summary--row' + (isSelected ? ' --selected' : '')}>\n {showImages && (\n <div className=\"u-border-rounded\" style={{ height: '190px' }}>\n <ImageGallerySlider images={row.getRoom().getImages()} imageSize={ImageSize.Tiny} />\n </div>\n )}\n <div className=\"u-marg-top--light\">\n <Text type={TextType.Label} color={textWhiteOr(Color.DarkGrey)}>\n <strong>\n {t(Translation.Step.Date.Room)} {index + 1}\n </strong>\n </Text>\n </div>\n <div className=\"u-marg-bottom--light\">\n <Text color={textWhiteOr(Color.Navy)}>\n <strong>{rate?.getRoom().name}</strong>\n </Text>\n </div>\n <div className=\"u-marg-bottom--light\">\n <Text type={TextType.Small} color={textWhiteOr()}>\n {rate?.name}\n </Text>\n </div>\n <div className=\"u-marg-bottom--light u-flex\">\n <Text type={TextType.Small} color={textWhiteOr()}>\n {t(Translation.Step.Date.Arrival)}\n </Text>\n <Text type={TextType.Small} color={textWhiteOr(Color.Accent)}>\n {row.getArrivalDate()}\n </Text>\n </div>\n <div className=\"u-marg-bottom--light u-flex\">\n <Text type={TextType.Small} color={textWhiteOr()}>\n {t(Translation.Step.Date.Departure)}\n </Text>\n <Text type={TextType.Small} color={textWhiteOr(Color.Accent)}>\n {row.getDepartureDate()}\n </Text>\n </div>\n <div className=\"u-marg-bottom--medium u-flex\">\n <Text type={TextType.Small} color={textWhiteOr()}>\n {[\n StringHelper.pluralWithDictAndCount(row.getAdults(), Translation.Step.Date.Adult, t),\n showChildren ? StringHelper.pluralWithDictAndCount(row.getChildren(), Translation.Step.Date.Child, t) : null,\n hotel?.childConfiguration?.supportInfants ? StringHelper.pluralWithDictAndCount(row.getInfants(), Translation.Step.Date.Infant, t) : null,\n ]\n .filter((item) => !!item)\n .join(`, `)}\n </Text>\n </div>\n <div className=\"u-marg-top--light u-marg-bottom--light u-flex\">\n <Text type={TextType.Small} color={textWhiteOr()}>\n {t(Translation.Misc.Rates)} ({t(Translation.Misc.PerNight)})\n </Text>\n <Text type={TextType.Small} color={textWhiteOr(Color.DarkGrey)}>\n <Currency>{rate?.getAveragePrice(true)}</Currency>\n </Text>\n </div>\n {promoApplied && (\n <div className=\"u-marg-bottom--light u-flex\">\n <Text type={TextType.Small} color={textWhiteOr()}>\n {t(Translation.Step.Date.PromoCode)}\n </Text>\n <Text type={TextType.Small} color={textWhiteOr(Color.DarkGrey)}>\n {row.getPromoCode()}\n </Text>\n </div>\n )}\n <div className=\"u-marg-bottom--light u-flex\">\n <Text type={TextType.Small} color={textWhiteOr()}>\n {t(Translation.Step.General.RoomTotal)}\n </Text>\n <Text type={TextType.Small} color={textWhiteOr(Color.DarkGrey)}>\n <Currency>{totalPrice}</Currency>\n </Text>\n </div>\n {!!rowFees && !rowItemisedFees && (\n // Only show fees if we don't have itemised fees. If we have itemised fees they will be shown later.\n <div className=\"u-marg-bottom--light u-flex\">\n <Text type={TextType.Small} color={textWhiteOr()}>\n {t(Translation.Step.Room.Summary.Fees)}\n </Text>\n <Text type={TextType.Small} color={textWhiteOr(Color.DarkGrey)}>\n <Currency>{rowFees}</Currency>\n </Text>\n </div>\n )}\n {!!rowTaxes && (\n <div className=\"u-marg-bottom--light u-flex\">\n <Text type={TextType.Small} color={textWhiteOr()}>\n {t(Translation.Step.Room.Summary.Taxes)}\n </Text>\n <Text type={TextType.Small} color={textWhiteOr(Color.DarkGrey)}>\n <Currency>{rowTaxes}</Currency>\n </Text>\n </div>\n )}\n <div className=\"u-marg-top u-marg-bottom u-flex justify-content-start\">\n {isSelected ? (\n <Tooltip title={t(Translation.Misc.Cancel)}>\n <div>\n <BEButton isText size=\"tiny\" primary onClick={cancelEditBasketRowOnClick} textColor={textWhiteOr(Color.Accent)}>\n {t(Translation.Misc.Cancel)}\n </BEButton>\n </div>\n </Tooltip>\n ) : (\n <Tooltip title={t(Translation.Step.Confirmation.EditThisProperty)}>\n <div>\n <BEButton isText size=\"tiny\" primary onClick={editOnClickHandler} textColor={textWhiteOr(Color.Accent)}>\n {t(Translation.Misc.Edit)}\n </BEButton>\n </div>\n </Tooltip>\n )}\n\n <span className=\"u-pad-left--light u-pad-right--light\" style={{ color: Color.LightGrey }}>\n |\n </span>\n <Tooltip title={removeRate}>\n <div>\n <BEButton isText size=\"tiny\" primary disabled={isOnlyRate} onClick={removeOnClickHandler} textColor={textWhiteOr(Color.Accent)}>\n {t(Translation.Misc.Remove)}\n </BEButton>\n </div>\n </Tooltip>\n </div>\n </div>\n </>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"BESummaryRoomRow.js","sourceRoot":"/","sources":["src/components/summary/BESummaryRoomRow.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA0E;AAC1E,2CAAkD;AAClD,yCAA4D;AAC5D,+CAA0C;AAC1C,iDAA+C;AAC/C,uDAA+C;AAC/C,0DAAuD;AAEvD,6EAAqD;AACrD,6EAAqD;AACrD,+EAAuD;AACvD,kEAA2D;AAC3D,mFAA2D;AAC3D,oGAA4E;AAC5E,mEAAgE;AAEhE,6DAAsD;AACtD,wCAAqC;AACrC,qEAA6C;AAC7C,uEAA+C;AAU/C,SAAwB,gBAAgB,CAAC,KAA4B;;IACjE,MAAM,aAAa,GAAG,IAAA,kBAAU,EAAC,wBAAa,CAAC,CAAC;IAChD,MAAM,EAAE,WAAW,EAAE,GAAG,IAAA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C,CAAC,CACV,8BAAC,iBAAO,IAAC,KAAK,EAAE,CAAC,CAAC,yBAAW,CAAC,IAAI,CAAC,MAAM,CAAC;oBACtC;wBACI,8BAAC,kBAAQ,IAAC,MAAM,QAAC,IAAI,EAAC,MAAM,EAAC,OAAO,QAAC,OAAO,EAAE,0BAA0B,EAAE,SAAS,EAAE,WAAW,CAAC,aAAK,CAAC,MAAM,CAAC,IACzG,CAAC,CAAC,yBAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CACpB,CACT,CACA,CACb,CAAC,CAAC,CAAC,CACA,8BAAC,iBAAO,IAAC,KAAK,EAAE,CAAC,CAAC,yBAAW,CAAC,IAAI,CAAC,YAAY,CAAC,gBAAgB,CAAC;oBAC7D;wBACI,8BAAC,kBAAQ,IAAC,MAAM,QAAC,IAAI,EAAC,MAAM,EAAC,OAAO,QAAC,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,WAAW,CAAC,aAAK,CAAC,MAAM,CAAC,IACjG,CAAC,CAAC,yBAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAClB,CACT,CACA,CACb;gBAED,wCAAM,SAAS,EAAC,sCAAsC,EAAC,KAAK,EAAE,EAAE,KAAK,EAAE,aAAK,CAAC,SAAS,EAAE,QAEjF;gBACP,8BAAC,iBAAO,IAAC,KAAK,EAAE,UAAU;oBACtB;wBACI,8BAAC,kBAAQ,IAAC,MAAM,QAAC,IAAI,EAAC,MAAM,EAAC,OAAO,QAAC,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,oBAAoB,EAAE,SAAS,EAAE,WAAW,CAAC,aAAK,CAAC,MAAM,CAAC,IACzH,CAAC,CAAC,yBAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CACpB,CACT,CACA,CACR,CACJ,CACP,CACN,CAAC;AACN,CAAC;AAhMD,mCAgMC","sourcesContent":["import { BasketContext, FullPageEngineContext } from '@frontend/contexts';\nimport { useCurrentHotel } from '@frontend/hooks';\nimport { getFilteredBookingRateFees } from '@roomstay/core';\nimport React, { useContext } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { useNavigate } from 'react-router-dom';\nimport { Translation } from 'translations/Translation';\n\nimport BEButton from '@/components/generic/BEButton';\nimport Currency from '@/components/generic/Currency';\nimport LineBreak from '@/components/generic/LineBreak';\nimport Text, { TextType } from '@/components/generic/Text';\nimport Tooltip from '@/components/generic/Tooltip/Tooltip';\nimport ImageGallerySlider from '@/components/steps/room/ImageGallerySlider';\nimport { useSearchScopeHook } from '@/hooks/useSearchScopeHook';\nimport BasketRow from '@/models/BasketRow';\nimport { ImageSize } from '@/providers/ImageProvider';\nimport { Color } from '@/util/Color';\nimport getStepRoom from '@/util/GetStepRoom';\nimport StringHelper from '@/util/StringHelper';\n\ninterface BESummaryRoomRowProps {\n index: number;\n row: BasketRow;\n showImages: boolean;\n\n onEditPropertyClicked?: () => void;\n}\n\nexport default function BESummaryRoomRow(props: BESummaryRoomRowProps) {\n const basketContext = useContext(BasketContext);\n const { currentStep } = useContext(FullPageEngineContext);\n const { isAccent2ColorDark, hotel } = useCurrentHotel();\n\n const { t } = useTranslation();\n const navigate = useNavigate();\n const { showChildren } = useSearchScopeHook();\n\n const { index, row, showImages } = props;\n\n const totalPrice = row.getTotalPrice(true);\n const rate = row.getRate();\n\n const isSelected = basketContext.selectedBasketRow?.getID() === row.getID();\n const isOnlyRate = basketContext.currentBasketRows.length === 1;\n\n const removeRate = t(isOnlyRate ? Translation.Step.Room.Summary.NoRemoveLastRate : Translation.Step.Room.Summary.RemoveThisRate);\n\n const rowFees = row.getRate()?.getTotalFees();\n const rowTaxes = row.getRate()?.getTotalTaxes();\n const rowItemisedFees = hotel && row.getRate()?.getItemisedFees(getFilteredBookingRateFees(hotel.fees ?? []));\n\n const cancelEditBasketRowOnClick = () => basketContext.clearSelectedRates(); //Set the selected basket row to null, ensuring that no row is selected for editing.\n const editOnClickHandler = () => {\n if (currentStep !== getStepRoom()) {\n navigate(getStepRoom().getStepUrl());\n }\n basketContext.selectBasketRow(row);\n\n if (props.onEditPropertyClicked) {\n props.onEditPropertyClicked();\n }\n };\n const removeOnClickHandler = () => {\n if (currentStep !== getStepRoom()) {\n navigate(getStepRoom().getStepUrl());\n }\n basketContext.removeBasketRow(row);\n };\n\n const promoApplied = row.isPromoCodeValid();\n\n const shouldTextBeWhite = isAccent2ColorDark && isSelected;\n const textWhiteOr = (color = Color.Graphite) => {\n return shouldTextBeWhite ? Color.White : color;\n };\n\n return (\n <>\n {index >= 1 && <LineBreak noMargins darker />}\n <div key={row.getID()} className={'booking-engine-summary--row' + (isSelected ? ' --selected' : '')}>\n {showImages && (\n <div className=\"u-border-rounded\" style={{ height: '190px' }}>\n <ImageGallerySlider images={row.getRoom().getImages()} imageSize={ImageSize.Tiny} />\n </div>\n )}\n <div className=\"u-marg-top--light\">\n <Text type={TextType.Label} color={textWhiteOr(Color.DarkGrey)}>\n <strong>\n {t(Translation.Step.Date.Room)} {index + 1}\n </strong>\n </Text>\n </div>\n <div className=\"u-marg-bottom--light\">\n <Text color={textWhiteOr(Color.Navy)}>\n <strong>{rate?.getRoom().name}</strong>\n </Text>\n </div>\n <div className=\"u-marg-bottom--light\">\n <Text type={TextType.Small} color={textWhiteOr()}>\n {rate?.name}\n </Text>\n </div>\n <div className=\"u-marg-bottom--light u-flex\">\n <Text type={TextType.Small} color={textWhiteOr()}>\n {t(Translation.Step.Date.Arrival)}\n </Text>\n <Text type={TextType.Small} color={textWhiteOr(Color.Accent)}>\n {row.getArrivalDate()}\n </Text>\n </div>\n <div className=\"u-marg-bottom--light u-flex\">\n <Text type={TextType.Small} color={textWhiteOr()}>\n {t(Translation.Step.Date.Departure)}\n </Text>\n <Text type={TextType.Small} color={textWhiteOr(Color.Accent)}>\n {row.getDepartureDate()}\n </Text>\n </div>\n <div className=\"u-marg-bottom--medium u-flex\">\n <Text type={TextType.Small} color={textWhiteOr()}>\n {[\n StringHelper.pluralWithDictAndCount(row.getAdults(), Translation.Step.Date.Adult, t),\n showChildren ? StringHelper.pluralWithDictAndCount(row.getChildren(), Translation.Step.Date.Child, t) : null,\n hotel?.childConfiguration?.supportInfants ? StringHelper.pluralWithDictAndCount(row.getInfants(), Translation.Step.Date.Infant, t) : null,\n ]\n .filter((item) => !!item)\n .join(`, `)}\n </Text>\n </div>\n <div className=\"u-marg-top--light u-marg-bottom--light u-flex\">\n <Text type={TextType.Small} color={textWhiteOr()}>\n {t(Translation.Misc.Rates)} ({t(Translation.Misc.PerNight)})\n </Text>\n <Text type={TextType.Small} color={textWhiteOr(Color.DarkGrey)}>\n <Currency>{rate?.getAveragePriceBeforeDiscount(true)}</Currency>\n </Text>\n </div>\n {promoApplied && (\n <div className=\"u-marg-bottom--light u-flex\">\n <Text type={TextType.Small} color={textWhiteOr()}>\n {t(Translation.Step.Date.PromoCode)}\n </Text>\n <Text type={TextType.Small} color={textWhiteOr(Color.DarkGrey)}>\n {row.getPromoCode()}\n </Text>\n </div>\n )}\n {rate && rate?.getTotalDiscount() > 0 && (\n <div className=\"u-marg-bottom--light u-flex\">\n <Text type={TextType.Small} color={textWhiteOr()}>\n {t(Translation.Misc.Discount)}\n </Text>\n <Text type={TextType.Small} color={textWhiteOr(Color.DarkGrey)}>\n <span className=\"u-ellip-overflow\">-</span>\n <Currency>{rate?.getTotalDiscount()}</Currency>\n </Text>\n </div>\n )}\n <div className=\"u-marg-bottom--light u-flex\">\n <Text type={TextType.Small} color={textWhiteOr()}>\n {t(Translation.Step.General.RoomTotal)}\n </Text>\n <Text type={TextType.Small} color={textWhiteOr(Color.DarkGrey)}>\n <Currency>{totalPrice}</Currency>\n </Text>\n </div>\n {!!rowFees && !rowItemisedFees && (\n // Only show fees if we don't have itemised fees. If we have itemised fees they will be shown later.\n <div className=\"u-marg-bottom--light u-flex\">\n <Text type={TextType.Small} color={textWhiteOr()}>\n {t(Translation.Step.Room.Summary.Fees)}\n </Text>\n <Text type={TextType.Small} color={textWhiteOr(Color.DarkGrey)}>\n <Currency>{rowFees}</Currency>\n </Text>\n </div>\n )}\n {!!rowTaxes && (\n <div className=\"u-marg-bottom--light u-flex\">\n <Text type={TextType.Small} color={textWhiteOr()}>\n {t(Translation.Step.Room.Summary.Taxes)}\n </Text>\n <Text type={TextType.Small} color={textWhiteOr(Color.DarkGrey)}>\n <Currency>{rowTaxes}</Currency>\n </Text>\n </div>\n )}\n <div className=\"u-marg-top u-marg-bottom u-flex justify-content-start\">\n {isSelected ? (\n <Tooltip title={t(Translation.Misc.Cancel)}>\n <div>\n <BEButton isText size=\"tiny\" primary onClick={cancelEditBasketRowOnClick} textColor={textWhiteOr(Color.Accent)}>\n {t(Translation.Misc.Cancel)}\n </BEButton>\n </div>\n </Tooltip>\n ) : (\n <Tooltip title={t(Translation.Step.Confirmation.EditThisProperty)}>\n <div>\n <BEButton isText size=\"tiny\" primary onClick={editOnClickHandler} textColor={textWhiteOr(Color.Accent)}>\n {t(Translation.Misc.Edit)}\n </BEButton>\n </div>\n </Tooltip>\n )}\n\n <span className=\"u-pad-left--light u-pad-right--light\" style={{ color: Color.LightGrey }}>\n |\n </span>\n <Tooltip title={removeRate}>\n <div>\n <BEButton isText size=\"tiny\" primary disabled={isOnlyRate} onClick={removeOnClickHandler} textColor={textWhiteOr(Color.Accent)}>\n {t(Translation.Misc.Remove)}\n </BEButton>\n </div>\n </Tooltip>\n </div>\n </div>\n </>\n );\n}\n"]}
|
|
@@ -6,6 +6,7 @@ import type SessionProvider from '../../providers/storage/SessionProvider';
|
|
|
6
6
|
import type ScreenSize from '../../util/ScreenSize';
|
|
7
7
|
export type BookingEngineContextType = {
|
|
8
8
|
currentRoomSort: RoomSort;
|
|
9
|
+
currentRoomRateSort?: RoomSort | undefined;
|
|
9
10
|
currentFilters: EngineFilterType;
|
|
10
11
|
currentGroupedRoomFilters: EngineFilterType;
|
|
11
12
|
screenSize: ScreenSize;
|
|
@@ -13,6 +14,7 @@ export type BookingEngineContextType = {
|
|
|
13
14
|
sessionProvider: SessionProvider;
|
|
14
15
|
storageProvider: LocalStorageProvider;
|
|
15
16
|
setCurrentRoomSort: (sort: RoomSort) => void;
|
|
17
|
+
setCurrentRoomRateSort: (sort: RoomSort | undefined) => void;
|
|
16
18
|
setCurrentFilters: (filters: EngineFilterType) => void;
|
|
17
19
|
setCurrentGroupedRoomFilters: (filters: GroupedRoomFilters) => void;
|
|
18
20
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BookingEngineContextType.types.js","sourceRoot":"/","sources":["src/contexts/BookingEngineContext/BookingEngineContextType.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { BaseEngine, BaseEngineConfig } from '@/engines/BaseEngine';\nimport type Filter from '@/models/Room/Filters/Filter';\nimport type { RoomSort } from '@/providers/RoomSortProvider';\nimport type LocalStorageProvider from '@/providers/storage/LocalStorageProvider';\nimport type SessionProvider from '@/providers/storage/SessionProvider';\nimport type ScreenSize from '@/util/ScreenSize';\n\n// TODO: Re-factor to a general Engine / UI Context, to leave the FullPageBookingEngine Logic separate i.e the filters & room sort values\nexport type BookingEngineContextType = {\n currentRoomSort: RoomSort;\n currentFilters: EngineFilterType;\n currentGroupedRoomFilters: EngineFilterType;\n\n screenSize: ScreenSize;\n\n engine: BaseEngine<BaseEngineConfig>;\n sessionProvider: SessionProvider;\n storageProvider: LocalStorageProvider;\n\n setCurrentRoomSort: (sort: RoomSort) => void;\n setCurrentFilters: (filters: EngineFilterType) => void;\n setCurrentGroupedRoomFilters: (filters: GroupedRoomFilters) => void;\n};\n\nexport type EngineFilterType = { [code: string]: Filter | null };\nexport type GroupedRoomFilters = { [id: string]: any };\n"]}
|
|
1
|
+
{"version":3,"file":"BookingEngineContextType.types.js","sourceRoot":"/","sources":["src/contexts/BookingEngineContext/BookingEngineContextType.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { BaseEngine, BaseEngineConfig } from '@/engines/BaseEngine';\nimport type Filter from '@/models/Room/Filters/Filter';\nimport type { RoomSort } from '@/providers/RoomSortProvider';\nimport type LocalStorageProvider from '@/providers/storage/LocalStorageProvider';\nimport type SessionProvider from '@/providers/storage/SessionProvider';\nimport type ScreenSize from '@/util/ScreenSize';\n\n// TODO: Re-factor to a general Engine / UI Context, to leave the FullPageBookingEngine Logic separate i.e the filters & room sort values\nexport type BookingEngineContextType = {\n currentRoomSort: RoomSort;\n currentRoomRateSort?: RoomSort | undefined;\n currentFilters: EngineFilterType;\n currentGroupedRoomFilters: EngineFilterType;\n\n screenSize: ScreenSize;\n\n engine: BaseEngine<BaseEngineConfig>;\n sessionProvider: SessionProvider;\n storageProvider: LocalStorageProvider;\n\n setCurrentRoomSort: (sort: RoomSort) => void;\n setCurrentRoomRateSort: (sort: RoomSort | undefined) => void;\n setCurrentFilters: (filters: EngineFilterType) => void;\n setCurrentGroupedRoomFilters: (filters: GroupedRoomFilters) => void;\n};\n\nexport type EngineFilterType = { [code: string]: Filter | null };\nexport type GroupedRoomFilters = { [id: string]: any };\n"]}
|
|
@@ -36,6 +36,7 @@ function BookingEngineContextWrapper({ engine, children }) {
|
|
|
36
36
|
const storageProvider = engine.getStorageProvider();
|
|
37
37
|
const [screenSize, setScreenSize] = (0, react_1.useState)(null);
|
|
38
38
|
const [currentRoomSort, setCurrentRoomSort] = (0, react_1.useState)(RoomSortProvider_1.RoomSort.PriceLow);
|
|
39
|
+
const [currentRoomRateSort, setCurrentRoomRateSort] = (0, react_1.useState)(undefined);
|
|
39
40
|
const [currentFilters, setCurrentFilters] = (0, react_1.useState)({});
|
|
40
41
|
const [currentGroupedRoomFilters, setCurrentGroupedRoomFilters] = (0, react_1.useState)({});
|
|
41
42
|
(0, react_1.useEffect)(() => {
|
|
@@ -59,11 +60,13 @@ function BookingEngineContextWrapper({ engine, children }) {
|
|
|
59
60
|
}, []);
|
|
60
61
|
const bookingEngineContext = {
|
|
61
62
|
currentRoomSort,
|
|
63
|
+
currentRoomRateSort,
|
|
62
64
|
currentFilters,
|
|
63
65
|
currentGroupedRoomFilters,
|
|
64
66
|
screenSize: screenSize,
|
|
65
67
|
// Setters
|
|
66
68
|
setCurrentRoomSort,
|
|
69
|
+
setCurrentRoomRateSort,
|
|
67
70
|
setCurrentFilters,
|
|
68
71
|
setCurrentGroupedRoomFilters,
|
|
69
72
|
engine,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BookingEngineContextWrapper.js","sourceRoot":"/","sources":["src/contexts/BookingEngineContext/BookingEngineContextWrapper.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA0H;AAC1H,+CAAmD;AAGnD,mEAAwD;AACxD,mEAA2C;AAO3C,SAAgB,2BAA2B,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAoC;IAC9F,MAAM,eAAe,GAAG,MAAM,CAAC,kBAAkB,EAAE,CAAC;IACpD,MAAM,eAAe,GAAG,MAAM,CAAC,kBAAkB,EAAE,CAAC;IAEpD,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,IAAA,gBAAQ,EAAoB,IAAI,CAAC,CAAC;IAEtE,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,IAAA,gBAAQ,EAAW,2BAAQ,CAAC,QAAQ,CAAC,CAAC;IACpF,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,IAAA,gBAAQ,EAAmB,EAAE,CAAC,CAAC;IAC3E,MAAM,CAAC,yBAAyB,EAAE,4BAA4B,CAAC,GAAG,IAAA,gBAAQ,EAAqB,EAAE,CAAC,CAAC;IAEnG,IAAA,iBAAS,EAAC,GAAG,EAAE;QACX,IAAI,WAAW,GAAG,KAAK,CAAC;QAExB,MAAM,QAAQ,GAAG,GAAG,EAAE;YAClB,IAAI,CAAC,WAAW,EAAE;gBACd,KAAK,MAAM,IAAI,IAAI,oBAAU,EAAE;oBAC3B,IAAI,MAAM,CAAC,UAAU,IAAI,MAAM,CAAC,IAAI,CAAC,EAAE;wBACnC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;wBAC5B,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terType, GroupedRoomFilters } from '@frontend/contexts';\nimport React, { useEffect, useState } from 'react';\n\nimport type { BaseEngine, BaseEngineConfig } from '@/engines/BaseEngine';\nimport { RoomSort } from '@/providers/RoomSortProvider';\nimport ScreenSize from '@/util/ScreenSize';\n\nexport interface BookingEngineContextWrapperProps {\n children: React.ReactNode;\n engine: BaseEngine<BaseEngineConfig>;\n}\n\nexport function BookingEngineContextWrapper({ engine, children }: BookingEngineContextWrapperProps) {\n const sessionProvider = engine.getSessionProvider();\n const storageProvider = engine.getStorageProvider();\n\n const [screenSize, setScreenSize] = useState<ScreenSize | null>(null);\n\n const [currentRoomSort, setCurrentRoomSort] = useState<RoomSort>(RoomSort.PriceLow);\n const [currentRoomRateSort, setCurrentRoomRateSort] = useState<RoomSort | undefined>(undefined);\n const [currentFilters, setCurrentFilters] = useState<EngineFilterType>({});\n const [currentGroupedRoomFilters, setCurrentGroupedRoomFilters] = useState<GroupedRoomFilters>({});\n\n useEffect(() => {\n let isCancelled = false;\n\n const onResize = () => {\n if (!isCancelled) {\n for (const size in ScreenSize) {\n if (window.innerWidth <= Number(size)) {\n setScreenSize(Number(size));\n break;\n }\n }\n }\n };\n\n onResize();\n\n window.addEventListener('resize', onResize);\n\n return () => {\n isCancelled = true;\n\n window.removeEventListener('resize', onResize);\n };\n }, []);\n\n const bookingEngineContext: BookingEngineContextType = {\n currentRoomSort,\n currentRoomRateSort,\n currentFilters,\n currentGroupedRoomFilters,\n\n screenSize: screenSize as ScreenSize,\n\n // Setters\n setCurrentRoomSort,\n setCurrentRoomRateSort,\n setCurrentFilters,\n setCurrentGroupedRoomFilters,\n\n engine,\n sessionProvider,\n storageProvider,\n };\n\n return <BookingEngineContext.Provider value={bookingEngineContext}>{children}</BookingEngineContext.Provider>;\n}\n"]}
|
|
@@ -105,6 +105,9 @@ const CompanyContextWrapper = ({ configCompany: company, children }) => {
|
|
|
105
105
|
else if (integrations === null || integrations === void 0 ? void 0 : integrations.includes(core_1.EIntegration.Salesforce)) {
|
|
106
106
|
return core_1.EIntegration.Salesforce;
|
|
107
107
|
}
|
|
108
|
+
else if (integrations === null || integrations === void 0 ? void 0 : integrations.includes(core_1.EIntegration.RAC)) {
|
|
109
|
+
return core_1.EIntegration.RAC;
|
|
110
|
+
}
|
|
108
111
|
}, [selectedHotel]);
|
|
109
112
|
(0, react_1.useEffect)(() => {
|
|
110
113
|
var _a;
|
|
@@ -112,7 +115,8 @@ const CompanyContextWrapper = ({ configCompany: company, children }) => {
|
|
|
112
115
|
provider === core_1.EIntegration.Top10 ||
|
|
113
116
|
provider === core_1.EIntegration.RmsTop10 ||
|
|
114
117
|
provider === core_1.EIntegration.Gday ||
|
|
115
|
-
provider === core_1.EIntegration.Salesforce
|
|
118
|
+
provider === core_1.EIntegration.Salesforce ||
|
|
119
|
+
provider === core_1.EIntegration.RAC)) || false;
|
|
116
120
|
setIsExternalMemberHotel(isExternalProvider);
|
|
117
121
|
raise(new events_1.SelectedHotelChangeEvent(selectedHotel));
|
|
118
122
|
}, [selectedHotel]);
|