@roomstay/frontend 2.9.0 → 2.9.1-1
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/177.bundle.js +1 -1
- package/dist/219.bundle.js +2 -0
- package/dist/288.bundle.js +1 -1
- package/dist/291.bundle.js +1 -0
- package/dist/446.bundle.js +1 -1
- package/dist/537.bundle.js +1 -1
- package/dist/596.bundle.js +1 -1
- package/dist/625.bundle.js +1 -1
- package/dist/836.bundle.js +1 -1
- package/dist/main.bundle.js +1 -1
- package/dist/src/components/generic/BookingWizard/BookingWizardBottomSheet/BookingWizardBottomSheet.js +6 -0
- package/dist/src/components/generic/BookingWizard/BookingWizardBottomSheet/BookingWizardBottomSheet.js.map +1 -1
- package/dist/src/components/generic/BookingWizard/BookingWizardBottomSheet/ShadowDomBottomSheet.d.ts +22 -0
- package/dist/src/components/generic/BookingWizard/BookingWizardBottomSheet/ShadowDomBottomSheet.js +131 -0
- package/dist/src/components/generic/BookingWizard/BookingWizardBottomSheet/ShadowDomBottomSheet.js.map +1 -0
- package/dist/src/components/generic/Portal/Portal.js +5 -1
- package/dist/src/components/generic/Portal/Portal.js.map +1 -1
- package/dist/src/components/generic/Select/InputSelect.js +3 -2
- package/dist/src/components/generic/Select/InputSelect.js.map +1 -1
- package/dist/src/components/generic/Select/Select.js +5 -5
- package/dist/src/components/generic/Select/Select.js.map +1 -1
- package/dist/src/components/generic/custom/EnhancedPhoneNumberField/EnhancedPhoneNumberField.d.ts +2 -2
- package/dist/src/components/generic/custom/EnhancedPhoneNumberField/EnhancedPhoneNumberField.js.map +1 -1
- package/dist/src/components/members/SignInModal/EmailAndFullnameMemberModal.d.ts +4 -0
- package/dist/src/components/members/SignInModal/EmailAndFullnameMemberModal.js +105 -30
- package/dist/src/components/members/SignInModal/EmailAndFullnameMemberModal.js.map +1 -1
- package/dist/src/components/members/SignInModal/ExternalMemberModal.d.ts +9 -3
- package/dist/src/components/members/SignInModal/ExternalMemberModal.js +45 -6
- package/dist/src/components/members/SignInModal/ExternalMemberModal.js.map +1 -1
- package/dist/src/components/steps/confirmation/RoomContactDetails.js +2 -3
- package/dist/src/components/steps/confirmation/RoomContactDetails.js.map +1 -1
- package/dist/src/components/steps/date/BEPeoplePickerBlock.js +3 -1
- package/dist/src/components/steps/date/BEPeoplePickerBlock.js.map +1 -1
- package/dist/src/components/steps/room/roomBuilderProgress/RoomBuilderProgressRow.js +2 -0
- package/dist/src/components/steps/room/roomBuilderProgress/RoomBuilderProgressRow.js.map +1 -1
- package/dist/src/components/summary/BESummaryRoomRow.js.map +1 -1
- package/dist/src/contexts/BasketContext/BasketContextWrapper.js +1 -1
- package/dist/src/contexts/BasketContext/BasketContextWrapper.js.map +1 -1
- package/dist/src/contexts/ConfirmationStepContext/ConfirmationStepContextWrapper.js +1 -0
- package/dist/src/contexts/ConfirmationStepContext/ConfirmationStepContextWrapper.js.map +1 -1
- package/dist/src/contexts/ShadowDomContext/ShadowDomContext.d.ts +10 -0
- package/dist/src/contexts/ShadowDomContext/ShadowDomContext.js +12 -0
- package/dist/src/contexts/ShadowDomContext/ShadowDomContext.js.map +1 -0
- package/dist/src/contexts/ShadowDomContext/ShadowDomContextProvider.d.ts +8 -0
- package/dist/src/contexts/ShadowDomContext/ShadowDomContextProvider.js +13 -0
- package/dist/src/contexts/ShadowDomContext/ShadowDomContextProvider.js.map +1 -0
- package/dist/src/contexts/index.d.ts +2 -0
- package/dist/src/contexts/index.js +2 -0
- package/dist/src/contexts/index.js.map +1 -1
- package/dist/src/engines/BaseEngine.d.ts +13 -0
- package/dist/src/engines/BaseEngine.js +32 -0
- package/dist/src/engines/BaseEngine.js.map +1 -1
- package/dist/src/engines/BookingWizardEngine/BookingWizardEngine.js +1 -0
- package/dist/src/engines/BookingWizardEngine/BookingWizardEngine.js.map +1 -1
- package/dist/src/engines/BookingWizardEngine/BookingWizardEngineElement.js +3 -1
- package/dist/src/engines/BookingWizardEngine/BookingWizardEngineElement.js.map +1 -1
- package/dist/src/engines/InlineRoomMiniEngine/InlineRoomMiniEngine.js +1 -0
- package/dist/src/engines/InlineRoomMiniEngine/InlineRoomMiniEngine.js.map +1 -1
- package/dist/src/engines/InlineRoomMiniEngine/InlineRoomMiniEngineElement.js +12 -10
- package/dist/src/engines/InlineRoomMiniEngine/InlineRoomMiniEngineElement.js.map +1 -1
- package/dist/src/engines/MemberPortalWidget/MemberPortalWidget.js +1 -0
- package/dist/src/engines/MemberPortalWidget/MemberPortalWidget.js.map +1 -1
- package/dist/src/engines/MemberPortalWidget/MemberPortalWidgetElement.js +11 -9
- package/dist/src/engines/MemberPortalWidget/MemberPortalWidgetElement.js.map +1 -1
- package/dist/src/engines/RecentSearchesEngine/RecentSearchesEngine.js +1 -0
- package/dist/src/engines/RecentSearchesEngine/RecentSearchesEngine.js.map +1 -1
- package/dist/src/engines/RecentSearchesEngine/RecentSearchesEngineElement.js +4 -2
- package/dist/src/engines/RecentSearchesEngine/RecentSearchesEngineElement.js.map +1 -1
- package/dist/src/handlers/membership/SalesforceMemberHandler.js +1 -1
- package/dist/src/handlers/membership/SalesforceMemberHandler.js.map +1 -1
- package/dist/src/hooks/BodyClickHook.d.ts +2 -2
- package/dist/src/hooks/BodyClickHook.js +7 -3
- package/dist/src/hooks/BodyClickHook.js.map +1 -1
- package/dist/src/pages/findReservation/FindReservationResults.js +1 -1
- package/dist/src/pages/findReservation/FindReservationResults.js.map +1 -1
- package/dist/src/pages/findReservation/ReservationRow.js +10 -9
- package/dist/src/pages/findReservation/ReservationRow.js.map +1 -1
- package/dist/src/pages/hotel/HotelInfo.js +7 -6
- package/dist/src/pages/hotel/HotelInfo.js.map +1 -1
- package/dist/src/providers/RoomstayThemeEngine.js +7 -2
- package/dist/src/providers/RoomstayThemeEngine.js.map +1 -1
- package/dist/src/providers/ShadowDomManager.d.ts +21 -0
- package/dist/src/providers/ShadowDomManager.js +55 -0
- package/dist/src/providers/ShadowDomManager.js.map +1 -0
- package/dist/src/providers/StyleInjector.d.ts +42 -0
- package/dist/src/providers/StyleInjector.js +118 -0
- package/dist/src/providers/StyleInjector.js.map +1 -0
- package/dist/src/providers/storage/SessionProvider.js.map +1 -1
- package/dist/src/stories/EnhancedPhoneNumberField.stories.d.ts +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/src/util/Analytics/Analytics.js +1 -0
- package/dist/src/util/Analytics/Analytics.js.map +1 -1
- package/dist/src/util/ObjectHelper.d.ts +1 -0
- package/dist/src/util/ObjectHelper.js +5 -1
- package/dist/src/util/ObjectHelper.js.map +1 -1
- package/dist/test.bundle.js +1 -1
- package/dist/vendors.bundle.js +1 -1
- package/package.json +1 -1
- package/dist/326.bundle.js +0 -2
- package/dist/686.bundle.js +0 -1
- /package/dist/{326.bundle.js.LICENSE.txt → 219.bundle.js.LICENSE.txt} +0 -0
|
@@ -18,7 +18,7 @@ const salesforceMemberHandler = (hotel) => {
|
|
|
18
18
|
isAvailable: (_b = (_a = hotel === null || hotel === void 0 ? void 0 : hotel.integrations) === null || _a === void 0 ? void 0 : _a.includes(core_1.EIntegration.Salesforce)) !== null && _b !== void 0 ? _b : false,
|
|
19
19
|
renderSignInModal: () => {
|
|
20
20
|
var _a, _b;
|
|
21
|
-
return (react_1.default.createElement(EmailAndFullnameMemberModal_1.default, { title: t(Translation_1.Translation.ExternalMemberPopup.SalesforceTitle), subTitle: t(Translation_1.Translation.ExternalMemberPopup.SalesforceSubTitle), image: ((_a = hotel === null || hotel === void 0 ? void 0 : hotel.memberOnlyModalImages) === null || _a === void 0 ? void 0 : _a[core_1.EMembershipProvider.Salesforce]) || (hotel === null || hotel === void 0 ? void 0 : hotel.memberOnlyModalImage) || RoomstayThemeEngine_1.default.getImageAssetUrl('salesforce-login.png'), isOpen: true, imageSize: (_b = hotel === null || hotel === void 0 ? void 0 : hotel.memberOnlyModalImageSize) !== null && _b !== void 0 ? _b : 'cover', provider: core_1.EMembershipProvider.Salesforce }));
|
|
21
|
+
return (react_1.default.createElement(EmailAndFullnameMemberModal_1.default, { title: t(Translation_1.Translation.ExternalMemberPopup.SalesforceTitle), subTitle: t(Translation_1.Translation.ExternalMemberPopup.SalesforceSubTitle), image: ((_a = hotel === null || hotel === void 0 ? void 0 : hotel.memberOnlyModalImages) === null || _a === void 0 ? void 0 : _a[core_1.EMembershipProvider.Salesforce]) || (hotel === null || hotel === void 0 ? void 0 : hotel.memberOnlyModalImage) || RoomstayThemeEngine_1.default.getImageAssetUrl('salesforce-login.png'), isOpen: true, imageSize: (_b = hotel === null || hotel === void 0 ? void 0 : hotel.memberOnlyModalImageSize) !== null && _b !== void 0 ? _b : 'cover', provider: core_1.EMembershipProvider.Salesforce, enablePostcode: true, enableMobilePhone: true, enableMarketingOptIn: true }));
|
|
22
22
|
},
|
|
23
23
|
memberOnlyImage: ((_c = hotel === null || hotel === void 0 ? void 0 : hotel.memberOnlyImages) === null || _c === void 0 ? void 0 : _c[core_1.EMembershipProvider.Salesforce]) || (hotel === null || hotel === void 0 ? void 0 : hotel.memberOnlyImage) || RoomstayThemeEngine_1.default.getImageAssetUrl('salesforce-login.png'),
|
|
24
24
|
title: t(Translation_1.Translation.ExternalMemberPopup.SalesforceTitle),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SalesforceMemberHandler.js","sourceRoot":"/","sources":["src/handlers/membership/SalesforceMemberHandler.tsx"],"names":[],"mappings":";;;;;;AAAA,yCAAmE;AACnE,kDAA0B;AAC1B,iDAA+C;AAE/C,+HAAuG;AAGvG,0FAAkE;AAClE,4DAAyD;AAElD,MAAM,uBAAuB,GAAG,CAAC,KAAa,EAAqB,EAAE;;IACxE,MAAM,EAAE,CAAC,EAAE,GAAG,IAAA,8BAAc,GAAE,CAAC;IAE/B,OAAO;QACH,QAAQ,EAAE,0BAAmB,CAAC,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;;YAAC,OAAA,CACrB,8BAAC,qCAA2B,IACxB,KAAK,EAAE,CAAC,CAAC,yBAAW,CAAC,mBAAmB,CAAC,eAAe,CAAC,EACzD,QAAQ,EAAE,CAAC,CAAC,yBAAW,CAAC,mBAAmB,CAAC,kBAAkB,CAAC,EAC/D,KAAK,EACD,CAAA,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,qBAAqB,0CAAG,0BAAmB,CAAC,UAAU,CAAC,MAAI,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,oBAAoB,CAAA,IAAI,6BAAmB,CAAC,gBAAgB,CAAC,sBAAsB,CAAC,EAEjK,MAAM,QACN,SAAS,EAAE,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,wBAAwB,mCAAI,OAAO,EACrD,QAAQ,EAAE,0BAAmB,CAAC,UAAU,EACxC,cAAc,QACd,iBAAiB,QACjB,oBAAoB,SACtB,CACL,CAAA;SAAA;QACD,eAAe,EAAE,CAAA,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,gBAAgB,0CAAG,0BAAmB,CAAC,UAAU,CAAC,MAAI,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,eAAe,CAAA,IAAI,6BAAmB,CAAC,gBAAgB,CAAC,sBAAsB,CAAC;QACpK,KAAK,EAAE,CAAC,CAAC,yBAAW,CAAC,mBAAmB,CAAC,eAAe,CAAC;QACzD,IAAI,EAAE,CAAC,CAAC,yBAAW,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,UAAU,CAAC;KACnE,CAAC;AACN,CAAC,CAAC;AAzBW,QAAA,uBAAuB,2BAyBlC","sourcesContent":["import { EIntegration, EMembershipProvider } from '@roomstay/core';\nimport React from 'react';\nimport { useTranslation } from 'react-i18next';\n\nimport EmailAndFullnameMemberModal from '@/components/members/SignInModal/EmailAndFullnameMemberModal';\nimport { MembershipHandler } from '@/handlers/membership/MembershipHandler';\nimport { Hotel } from '@/models/Client/Hotel/Hotel';\nimport RoomstayThemeEngine from '@/providers/RoomstayThemeEngine';\nimport { Translation } from '@/translations/Translation';\n\nexport const salesforceMemberHandler = (hotel?: Hotel): MembershipHandler => {\n const { t } = useTranslation();\n\n return {\n provider: EMembershipProvider.Salesforce,\n isAvailable: hotel?.integrations?.includes(EIntegration.Salesforce) ?? false,\n renderSignInModal: () => (\n <EmailAndFullnameMemberModal\n title={t(Translation.ExternalMemberPopup.SalesforceTitle)}\n subTitle={t(Translation.ExternalMemberPopup.SalesforceSubTitle)}\n image={\n hotel?.memberOnlyModalImages?.[EMembershipProvider.Salesforce] || hotel?.memberOnlyModalImage || RoomstayThemeEngine.getImageAssetUrl('salesforce-login.png')\n }\n isOpen\n imageSize={hotel?.memberOnlyModalImageSize ?? 'cover'}\n provider={EMembershipProvider.Salesforce}\n enablePostcode\n enableMobilePhone\n enableMarketingOptIn\n />\n ),\n memberOnlyImage: hotel?.memberOnlyImages?.[EMembershipProvider.Salesforce] || hotel?.memberOnlyImage || RoomstayThemeEngine.getImageAssetUrl('salesforce-login.png'),\n title: t(Translation.ExternalMemberPopup.SalesforceTitle),\n name: t(Translation.Step.Room.RoomInfo.MemberOnlyRow.Salesforce),\n };\n};\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export declare const useBodyClick: () => {
|
|
2
|
-
onBodyClick: (event: EventListener, target?:
|
|
2
|
+
onBodyClick: (event: EventListener, target?: EventTarget | null) => {
|
|
3
3
|
remove: () => void;
|
|
4
4
|
};
|
|
5
|
-
onBodyClickExcept: (event: EventListener, ignore: HTMLElement, target?:
|
|
5
|
+
onBodyClickExcept: (event: EventListener, ignore: HTMLElement, target?: EventTarget | null) => {
|
|
6
6
|
remove: () => void;
|
|
7
7
|
};
|
|
8
8
|
};
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useBodyClick = void 0;
|
|
4
|
+
const ShadowDomContext_1 = require("../contexts/ShadowDomContext/ShadowDomContext");
|
|
4
5
|
const useBodyClick = () => {
|
|
5
|
-
const
|
|
6
|
+
const { isShadowDom, shadowRoot } = (0, ShadowDomContext_1.useShadowDom)();
|
|
7
|
+
// Default event target: shadow root when in Shadow DOM, document otherwise
|
|
8
|
+
const defaultTarget = isShadowDom && shadowRoot ? shadowRoot : document;
|
|
9
|
+
const removeEvent = (event, target = defaultTarget) => {
|
|
6
10
|
target === null || target === void 0 ? void 0 : target.removeEventListener('click', event);
|
|
7
11
|
};
|
|
8
|
-
const onBodyClick = (event, target =
|
|
12
|
+
const onBodyClick = (event, target = defaultTarget) => {
|
|
9
13
|
const mappedEvent = (e) => {
|
|
10
14
|
return event(e);
|
|
11
15
|
};
|
|
@@ -16,7 +20,7 @@ const useBodyClick = () => {
|
|
|
16
20
|
},
|
|
17
21
|
};
|
|
18
22
|
};
|
|
19
|
-
const onBodyClickExcept = (event, ignore, target =
|
|
23
|
+
const onBodyClickExcept = (event, ignore, target = defaultTarget) => {
|
|
20
24
|
const response = onBodyClick((e) => {
|
|
21
25
|
var _a;
|
|
22
26
|
for (const element of e.composedPath()) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BodyClickHook.js","sourceRoot":"/","sources":["src/hooks/BodyClickHook.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"BodyClickHook.js","sourceRoot":"/","sources":["src/hooks/BodyClickHook.ts"],"names":[],"mappings":";;;AAAA,mFAA4E;AAErE,MAAM,YAAY,GAAG,GAAG,EAAE;IAC7B,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,IAAA,+BAAY,GAAE,CAAC;IAEnD,2EAA2E;IAC3E,MAAM,aAAa,GAAgB,WAAW,IAAI,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC;IAErF,MAAM,WAAW,GAAG,CAAC,KAAoB,EAAE,SAA6B,aAAa,EAAE,EAAE;QACrF,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,mBAAmB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAChD,CAAC,CAAC;IAEF,MAAM,WAAW,GAAG,CAAC,KAAoB,EAAE,SAA6B,aAAa,EAAE,EAAE;QACrF,MAAM,WAAW,GAAG,CAAC,CAAQ,EAAE,EAAE;YAC7B,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC;QACpB,CAAC,CAAC;QAEF,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,gBAAgB,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;QAE/C,OAAO;YACH,MAAM,EAAE,GAAG,EAAE;gBACT,MAAM,IAAI,WAAW,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;YAC/C,CAAC;SACJ,CAAC;IACN,CAAC,CAAC;IAEF,MAAM,iBAAiB,GAAG,CAAC,KAAoB,EAAE,MAAmB,EAAE,SAA6B,aAAa,EAAE,EAAE;QAChH,MAAM,QAAQ,GAAG,WAAW,CAAC,CAAC,CAAQ,EAAE,EAAE;;YACtC,KAAK,MAAM,OAAO,IAAI,CAAC,CAAC,YAAY,EAAmB,EAAE,CAAC;gBACtD,IAAI,MAAA,OAAO,CAAC,UAAU,wDAAG,MAAM,CAAC,EAAE,CAAC;oBAC/B,uEAAuE;oBACvE,OAAO;gBACX,CAAC;YACL,CAAC;YAED,yEAAyE;YACzE,KAAK,CAAC,CAAC,CAAC,CAAC;QACb,CAAC,EAAE,MAAM,CAAC,CAAC;QAEX,OAAO,QAAQ,CAAC;IACpB,CAAC,CAAC;IACF,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,CAAC;AAC9C,CAAC,CAAC;AAxCW,QAAA,YAAY,gBAwCvB","sourcesContent":["import { useShadowDom } from '@/contexts/ShadowDomContext/ShadowDomContext';\n\nexport const useBodyClick = () => {\n const { isShadowDom, shadowRoot } = useShadowDom();\n\n // Default event target: shadow root when in Shadow DOM, document otherwise\n const defaultTarget: EventTarget = isShadowDom && shadowRoot ? shadowRoot : document;\n\n const removeEvent = (event: EventListener, target: EventTarget | null = defaultTarget) => {\n target?.removeEventListener('click', event);\n };\n\n const onBodyClick = (event: EventListener, target: EventTarget | null = defaultTarget) => {\n const mappedEvent = (e: Event) => {\n return event(e);\n };\n\n target?.addEventListener('click', mappedEvent);\n\n return {\n remove: () => {\n target && removeEvent(mappedEvent, target);\n },\n };\n };\n\n const onBodyClickExcept = (event: EventListener, ignore: HTMLElement, target: EventTarget | null = defaultTarget) => {\n const response = onBodyClick((e: Event) => {\n for (const element of e.composedPath() as HTMLElement[]) {\n if (element.isSameNode?.(ignore)) {\n // Preventing the event from taking place, as it's in the ignored list.\n return;\n }\n }\n\n // Assuming target click isn't in the ignore area, proceed with the event\n event(e);\n }, target);\n\n return response;\n };\n return { onBodyClick, onBodyClickExcept };\n};\n"]}
|
|
@@ -133,7 +133,7 @@ function FindReservationResults() {
|
|
|
133
133
|
}, [bookingInformation]);
|
|
134
134
|
const addons = [];
|
|
135
135
|
const comments = [];
|
|
136
|
-
const total = (0, react_1.
|
|
136
|
+
const total = (0, react_1.useMemo)(() => {
|
|
137
137
|
if (bookingInformation === null || bookingInformation === void 0 ? void 0 : bookingInformation.reservations) {
|
|
138
138
|
return core_1.TotalCalculator.calculateTotalForReservation(bookingInformation, dismissAddonNightCount);
|
|
139
139
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FindReservationResults.js","sourceRoot":"/","sources":["src/pages/findReservation/FindReservationResults.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,yCAkMC;AAhOD,iDAAoD;AACpD,2CAA4D;AAC5D,yCAA0H;AAC1H,kDAA0B;AAC1B,+CAA4E;AAC5E,iDAA+C;AAC/C,uDAA0D;AAC1D,0DAAuD;AAEvD,iFAAyD;AACzD,kEAAmC;AACnC,oEAA8D;AAC9D,iFAAyD;AACzD,6EAAqD;AAC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AAI,IAAC,IAAI,EAAE,eAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,yBAAS,CAAC,KAAK,EAAE,KAAK,EAAE,aAAK,CAAC,QAAQ;gBACrE,8BAAC,uCAAkB,OAAG,CACnB,CACR,CACN,CACC,CACT,CAAC;AACN,CAAC","sourcesContent":["import { CompanyContext } from '@frontend/contexts';\nimport { useCurrentHotel, useEvent } from '@frontend/hooks';\nimport { ReservationAddonDTO, ReservationDTO, ReservationsDTO, SimpleItemisedFee, TotalCalculator } from '@roomstay/core';\nimport dayjs from 'dayjs';\nimport React, { useCallback, useContext, useEffect, useState } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { useNavigate, useParams } from 'react-router-dom';\nimport { Translation } from 'translations/Translation';\n\nimport AutoAutoHeight from '@/animations/AutoAutoHeight';\nimport API from '@/api/BookingAPI';\nimport Alert, { AlertType } from '@/components/generic/Alert';\nimport BackButton from '@/components/generic/BackButton';\nimport Currency from '@/components/generic/Currency';\nimport Headline from '@/components/generic/Headline';\nimport { HtmlContentViewer } from '@/components/generic/HtmlContentViewer';\nimport { IconType } from '@/components/generic/Icon/Icon';\nimport LineBreak from '@/components/generic/LineBreak';\nimport LargeLoader from '@/components/generic/loader/LargeLoader';\nimport { PageTitle } from '@/components/generic/PageTitle';\nimport { TaxInclusionNotice } from '@/components/generic/TaxInclusionNotice/TaxInclusionNotice';\nimport Text, { TextType } from '@/components/generic/Text';\nimport { CommonAddonSummary } from '@/components/steps/common/CommonAddonSummary/CommonAddonSummary';\nimport { ItemisedFeesSummary } from '@/components/steps/common/ItemisedFeesSummary/ItemisedFeesSummary';\nimport { FindReservationResultsViewEvent } from '@/events';\nimport { IEventReservation } from '@/models/Api/IEventReservation';\nimport ReservationRow from '@/pages/findReservation/ReservationRow';\nimport { Color } from '@/util/Color';\nimport { TextAlign } from '@/util/TextAlignment';\n\nexport default function FindReservationResults() {\n const params: any = useParams();\n const navigate = useNavigate();\n\n const { hotel } = useCurrentHotel();\n const ccx = useContext(CompanyContext);\n\n const { t } = useTranslation();\n\n const [bookingInformation, setBookingInformation] = useState<ReservationsDTO | null>(null);\n const [isLoading, setIsLoading] = useState(false);\n\n const [cancellationMessage, setCancellationMessage] = useState('');\n const [cancellationTrigger, setCancellationTrigger] = useState(0);\n\n const [data, setData] = useState<ReservationsDTO | null>(null);\n const [itemisedFees, setItemisedFees] = useState<SimpleItemisedFee[]>([]);\n\n const pushHistoryOnClick = () => {\n navigate('../');\n };\n\n /**\n * Determines whether addon night count should be dismissed.\n * This is true when the booking is not from Roomstay, indicated by:\n * - the itinerary number not starting with 'RS', and\n * - the hotel not preferring provider booking IDs.\n */\n const dismissAddonNightCount = !bookingInformation?.itineraryNumber?.startsWith('RS') && !hotel?.preferProviderBookingId;\n\n useEffect(() => {\n let isCancelled = false;\n\n setIsLoading(true);\n\n const handleSuccess = (data: ReservationsDTO) => {\n if (!isCancelled) {\n setBookingInformation(data);\n setIsLoading(false);\n setData(data);\n }\n };\n\n if (params?.ref) {\n API.Reservation.findReservation(params.ref, params.email, hotel?.hotelID as string)\n .then((data: ReservationsDTO) => {\n if (data.hotelFrontendId && data.hotelFrontendId !== hotel?.hotelID) {\n // User has searched for a booking that belongs to a different hotel (but within the same company).\n // Let's redirect the user to the correct hotel.\n ccx.getHotel(data.hotelFrontendId)\n .then((hotel) => {\n const findReservationUrl = `${hotel.hotelUrl}/${hotel.checkoutUrl}/#/find-reservation/${params.ref}/${params.email}`;\n window.location.href = findReservationUrl;\n })\n .catch((error) => {\n console.error(`Failed to find hotel: ${error}. Continuing with current hotel.`);\n handleSuccess(data);\n });\n } else {\n handleSuccess(data);\n }\n })\n .catch(() => {\n navigate('/find-reservation');\n });\n } else {\n navigate('/find-reservation');\n }\n\n return () => {\n isCancelled = true;\n };\n }, [cancellationTrigger]);\n\n useEffect(() => {\n setItemisedFees(bookingInformation?.feesSummary || []);\n }, [bookingInformation]);\n\n const addons: ReservationAddonDTO[] = [];\n const comments: string[] = [];\n\n const total = useCallback(() => {\n if (bookingInformation?.reservations) {\n return TotalCalculator.calculateTotalForReservation(bookingInformation, dismissAddonNightCount);\n }\n\n return 0;\n }, [bookingInformation, dismissAddonNightCount]);\n\n const { raise } = useEvent();\n useEffect(() => {\n if (!data) return;\n\n const reservations: IEventReservation[] =\n data.reservations?.map((obj: ReservationDTO) => {\n const nightKeys = Object.keys(obj.nights);\n const dateFormat = 'YYYY-MM-DDTHH:mm:ss';\n\n return {\n reservationId: obj.reservationNumber,\n checkInTime: dayjs(nightKeys[0]).format(dateFormat),\n checkOutTime: dayjs(nightKeys[nightKeys.length - 1])\n .add(1, 'day')\n .format(dateFormat),\n totalPrice: obj.total.afterTax,\n priceCurrency: ccx.currentCurrency,\n };\n }) ?? [];\n\n const event = new FindReservationResultsViewEvent(reservations);\n raise(event);\n }, [data]);\n\n return (\n <div className=\"container u-pad--heavy-plus u-pad-left u-pad-right\">\n <PageTitle step=\"FindReservation\" />\n {isLoading ? (\n <LargeLoader />\n ) : (\n <>\n <div className=\"u-marg-bottom\">\n <BackButton onClick={pushHistoryOnClick} />\n </div>\n <Headline size=\"extra-large\">{t(Translation.FindReservation.YourItinerary)}</Headline>\n <Headline color={Color.DarkGrey}>#{bookingInformation?.itineraryNumber}</Headline>\n <div className=\"row u-marg-top--heavy\">\n <AutoAutoHeight open={!!cancellationMessage}>\n <Alert>{cancellationMessage}</Alert>\n </AutoAutoHeight>\n {bookingInformation?.reservations?.map((obj: ReservationDTO, index: number) => {\n if (obj.addons) {\n const nights = Object.keys(obj.nights);\n obj.addons.forEach((addon) => {\n if (dismissAddonNightCount) {\n addons.push(addon);\n } else {\n addons.push({ ...addon, nights: nights.length });\n }\n });\n }\n\n if (obj.comments && index === 0) {\n obj.comments.map((comment: string) => {\n comments.push(comment);\n });\n }\n\n return (\n <div className=\"col-lg-6\" key={obj.reservationNumber}>\n <ReservationRow reservation={obj} key={obj.reservationNumber} />\n </div>\n );\n })}\n </div>\n {hotel?.itineraryNote && (\n <Alert icon={IconType.Info} type={AlertType.Alert}>\n <Text type={TextType.Small} asDiv>\n <HtmlContentViewer content={hotel.itineraryNote}></HtmlContentViewer>\n </Text>\n </Alert>\n )}\n <LineBreak />\n <CommonAddonSummary addons={addons} />\n {comments.length >= 1 && (\n <>\n <div className=\"u-marg-bottom\">\n <Text type={TextType.Label} color={Color.Grey}>\n {t(Translation.Step.Confirmation.Comments)}\n </Text>\n </div>\n {comments.map((comment, index: number) => (\n <Text key={index} type={TextType.Small}>\n {comment}\n </Text>\n ))}\n <LineBreak />\n </>\n )}\n\n <ItemisedFeesSummary fees={itemisedFees} />\n\n <Text type={TextType.Small} align={TextAlign.Right}>\n {t(Translation.Misc.Total)}\n </Text>\n <Headline bold size=\"large\" align={TextAlign.Right}>\n <Currency>{total}</Currency>\n </Headline>\n <Text type={TextType.Small} align={TextAlign.Right} color={Color.DarkGrey}>\n <TaxInclusionNotice />\n </Text>\n </>\n )}\n </div>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"FindReservationResults.js","sourceRoot":"/","sources":["src/pages/findReservation/FindReservationResults.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,yCAkMC;AAhOD,iDAAoD;AACpD,2CAA4D;AAC5D,yCAA0H;AAC1H,kDAA0B;AAC1B,+CAAwE;AACxE,iDAA+C;AAC/C,uDAA0D;AAC1D,0DAAuD;AAEvD,iFAAyD;AACzD,kEAAmC;AACnC,oEAA8D;AAC9D,iFAAyD;AACzD,6EAAqD;AACrD,6EAAqD;AACrD,8EAA2E;AAC3E,yDAA0D;AAC1D,+EAAuD;AACvD,0FAAkE;AAClE,8DAA2D;AAC3D,mGAAgG;AAChG,kEAA2D;AAC3D,wGAAqG;AACrG,2GAAwG;AACxG,qCAA2D;AAE3D,4FAAoE;AACpE,wCAAqC;AACrC,wDAAiD;AAEjD,SAAwB,sBAAsB;;IAC1C,MAAM,MAAM,GAAQ,IAAA,4BAAS,GAAE,CAAC;IAChC,MAAM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a,GAAsB,CAClE,CACH,CACX;YACD,8BAAC,mBAAS,OAAG;YACb,8BAAC,uCAAkB,IAAC,MAAM,EAAE,MAAM,GAAI;YACrC,QAAQ,CAAC,MAAM,IAAI,CAAC,IAAI,CACrB;gBACI,uCAAK,SAAS,EAAC,eAAe;oBAC1B,8BAAC,cAAI,IAAC,IAAI,EAAE,eAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,aAAK,CAAC,IAAI,IACxC,CAAC,CAAC,yBAAW,CAAC,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CACvC,CACL;gBACL,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,KAAa,EAAE,EAAE,CAAC,CACtC,8BAAC,cAAI,IAAC,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,eAAQ,CAAC,KAAK,IACjC,OAAO,CACL,CACV,CAAC;gBACF,8BAAC,mBAAS,OAAG,CACd,CACN;YAED,8BAAC,yCAAmB,IAAC,IAAI,EAAE,YAAY,GAAI;YAE3C,8BAAC,cAAI,IAAC,IAAI,EAAE,eAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,yBAAS,CAAC,KAAK,IAC7C,CAAC,CAAC,yBAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CACvB;YACP,8BAAC,kBAAQ,IAAC,IAAI,QAAC,IAAI,EAAC,OAAO,EAAC,KAAK,EAAE,yBAAS,CAAC,KAAK;gBAC9C,8BAAC,kBAAQ,QAAE,KAAK,CAAY,CACrB;YACX,8BAAC,cAAI,IAAC,IAAI,EAAE,eAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,yBAAS,CAAC,KAAK,EAAE,KAAK,EAAE,aAAK,CAAC,QAAQ;gBACrE,8BAAC,uCAAkB,OAAG,CACnB,CACR,CACN,CACC,CACT,CAAC;AACN,CAAC","sourcesContent":["import { CompanyContext } from '@frontend/contexts';\nimport { useCurrentHotel, useEvent } from '@frontend/hooks';\nimport { ReservationAddonDTO, ReservationDTO, ReservationsDTO, SimpleItemisedFee, TotalCalculator } from '@roomstay/core';\nimport dayjs from 'dayjs';\nimport React, { useContext, useEffect, useMemo, useState } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { useNavigate, useParams } from 'react-router-dom';\nimport { Translation } from 'translations/Translation';\n\nimport AutoAutoHeight from '@/animations/AutoAutoHeight';\nimport API from '@/api/BookingAPI';\nimport Alert, { AlertType } from '@/components/generic/Alert';\nimport BackButton from '@/components/generic/BackButton';\nimport Currency from '@/components/generic/Currency';\nimport Headline from '@/components/generic/Headline';\nimport { HtmlContentViewer } from '@/components/generic/HtmlContentViewer';\nimport { IconType } from '@/components/generic/Icon/Icon';\nimport LineBreak from '@/components/generic/LineBreak';\nimport LargeLoader from '@/components/generic/loader/LargeLoader';\nimport { PageTitle } from '@/components/generic/PageTitle';\nimport { TaxInclusionNotice } from '@/components/generic/TaxInclusionNotice/TaxInclusionNotice';\nimport Text, { TextType } from '@/components/generic/Text';\nimport { CommonAddonSummary } from '@/components/steps/common/CommonAddonSummary/CommonAddonSummary';\nimport { ItemisedFeesSummary } from '@/components/steps/common/ItemisedFeesSummary/ItemisedFeesSummary';\nimport { FindReservationResultsViewEvent } from '@/events';\nimport { IEventReservation } from '@/models/Api/IEventReservation';\nimport ReservationRow from '@/pages/findReservation/ReservationRow';\nimport { Color } from '@/util/Color';\nimport { TextAlign } from '@/util/TextAlignment';\n\nexport default function FindReservationResults() {\n const params: any = useParams();\n const navigate = useNavigate();\n\n const { hotel } = useCurrentHotel();\n const ccx = useContext(CompanyContext);\n\n const { t } = useTranslation();\n\n const [bookingInformation, setBookingInformation] = useState<ReservationsDTO | null>(null);\n const [isLoading, setIsLoading] = useState(false);\n\n const [cancellationMessage, setCancellationMessage] = useState('');\n const [cancellationTrigger, setCancellationTrigger] = useState(0);\n\n const [data, setData] = useState<ReservationsDTO | null>(null);\n const [itemisedFees, setItemisedFees] = useState<SimpleItemisedFee[]>([]);\n\n const pushHistoryOnClick = () => {\n navigate('../');\n };\n\n /**\n * Determines whether addon night count should be dismissed.\n * This is true when the booking is not from Roomstay, indicated by:\n * - the itinerary number not starting with 'RS', and\n * - the hotel not preferring provider booking IDs.\n */\n const dismissAddonNightCount = !bookingInformation?.itineraryNumber?.startsWith('RS') && !hotel?.preferProviderBookingId;\n\n useEffect(() => {\n let isCancelled = false;\n\n setIsLoading(true);\n\n const handleSuccess = (data: ReservationsDTO) => {\n if (!isCancelled) {\n setBookingInformation(data);\n setIsLoading(false);\n setData(data);\n }\n };\n\n if (params?.ref) {\n API.Reservation.findReservation(params.ref, params.email, hotel?.hotelID as string)\n .then((data: ReservationsDTO) => {\n if (data.hotelFrontendId && data.hotelFrontendId !== hotel?.hotelID) {\n // User has searched for a booking that belongs to a different hotel (but within the same company).\n // Let's redirect the user to the correct hotel.\n ccx.getHotel(data.hotelFrontendId)\n .then((hotel) => {\n const findReservationUrl = `${hotel.hotelUrl}/${hotel.checkoutUrl}/#/find-reservation/${params.ref}/${params.email}`;\n window.location.href = findReservationUrl;\n })\n .catch((error) => {\n console.error(`Failed to find hotel: ${error}. Continuing with current hotel.`);\n handleSuccess(data);\n });\n } else {\n handleSuccess(data);\n }\n })\n .catch(() => {\n navigate('/find-reservation');\n });\n } else {\n navigate('/find-reservation');\n }\n\n return () => {\n isCancelled = true;\n };\n }, [cancellationTrigger]);\n\n useEffect(() => {\n setItemisedFees(bookingInformation?.feesSummary || []);\n }, [bookingInformation]);\n\n const addons: ReservationAddonDTO[] = [];\n const comments: string[] = [];\n\n const total = useMemo(() => {\n if (bookingInformation?.reservations) {\n return TotalCalculator.calculateTotalForReservation(bookingInformation, dismissAddonNightCount);\n }\n\n return 0;\n }, [bookingInformation, dismissAddonNightCount]);\n\n const { raise } = useEvent();\n useEffect(() => {\n if (!data) return;\n\n const reservations: IEventReservation[] =\n data.reservations?.map((obj: ReservationDTO) => {\n const nightKeys = Object.keys(obj.nights);\n const dateFormat = 'YYYY-MM-DDTHH:mm:ss';\n\n return {\n reservationId: obj.reservationNumber,\n checkInTime: dayjs(nightKeys[0]).format(dateFormat),\n checkOutTime: dayjs(nightKeys[nightKeys.length - 1])\n .add(1, 'day')\n .format(dateFormat),\n totalPrice: obj.total.afterTax,\n priceCurrency: ccx.currentCurrency,\n };\n }) ?? [];\n\n const event = new FindReservationResultsViewEvent(reservations);\n raise(event);\n }, [data]);\n\n return (\n <div className=\"container u-pad--heavy-plus u-pad-left u-pad-right\">\n <PageTitle step=\"FindReservation\" />\n {isLoading ? (\n <LargeLoader />\n ) : (\n <>\n <div className=\"u-marg-bottom\">\n <BackButton onClick={pushHistoryOnClick} />\n </div>\n <Headline size=\"extra-large\">{t(Translation.FindReservation.YourItinerary)}</Headline>\n <Headline color={Color.DarkGrey}>#{bookingInformation?.itineraryNumber}</Headline>\n <div className=\"row u-marg-top--heavy\">\n <AutoAutoHeight open={!!cancellationMessage}>\n <Alert>{cancellationMessage}</Alert>\n </AutoAutoHeight>\n {bookingInformation?.reservations?.map((obj: ReservationDTO, index: number) => {\n if (obj.addons) {\n const nights = Object.keys(obj.nights);\n obj.addons.forEach((addon) => {\n if (dismissAddonNightCount) {\n addons.push(addon);\n } else {\n addons.push({ ...addon, nights: nights.length });\n }\n });\n }\n\n if (obj.comments && index === 0) {\n obj.comments.map((comment: string) => {\n comments.push(comment);\n });\n }\n\n return (\n <div className=\"col-lg-6\" key={obj.reservationNumber}>\n <ReservationRow reservation={obj} key={obj.reservationNumber} />\n </div>\n );\n })}\n </div>\n {hotel?.itineraryNote && (\n <Alert icon={IconType.Info} type={AlertType.Alert}>\n <Text type={TextType.Small} asDiv>\n <HtmlContentViewer content={hotel.itineraryNote}></HtmlContentViewer>\n </Text>\n </Alert>\n )}\n <LineBreak />\n <CommonAddonSummary addons={addons} />\n {comments.length >= 1 && (\n <>\n <div className=\"u-marg-bottom\">\n <Text type={TextType.Label} color={Color.Grey}>\n {t(Translation.Step.Confirmation.Comments)}\n </Text>\n </div>\n {comments.map((comment, index: number) => (\n <Text key={index} type={TextType.Small}>\n {comment}\n </Text>\n ))}\n <LineBreak />\n </>\n )}\n\n <ItemisedFeesSummary fees={itemisedFees} />\n\n <Text type={TextType.Small} align={TextAlign.Right}>\n {t(Translation.Misc.Total)}\n </Text>\n <Headline bold size=\"large\" align={TextAlign.Right}>\n <Currency>{total}</Currency>\n </Headline>\n <Text type={TextType.Small} align={TextAlign.Right} color={Color.DarkGrey}>\n <TaxInclusionNotice />\n </Text>\n </>\n )}\n </div>\n );\n}\n"]}
|
|
@@ -59,7 +59,7 @@ const DataLayer_1 = __importDefault(require("../../util/DataLayer"));
|
|
|
59
59
|
const StringHelper_1 = __importDefault(require("../../util/StringHelper"));
|
|
60
60
|
const TextAlignment_1 = require("../../util/TextAlignment");
|
|
61
61
|
function ReservationRow(props) {
|
|
62
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
62
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
63
63
|
const { t } = (0, react_i18next_1.useTranslation)();
|
|
64
64
|
const { hotel } = (0, hooks_1.useCurrentHotel)();
|
|
65
65
|
const { formatReservationDate } = (0, hooks_1.useGuestDateFormat)();
|
|
@@ -93,7 +93,8 @@ function ReservationRow(props) {
|
|
|
93
93
|
const firstNight = (0, dayjs_1.default)(nightKeys[0]);
|
|
94
94
|
const lastNight = (0, dayjs_1.default)(nightKeys[nightKeys.length - 1]).add(1, 'day');
|
|
95
95
|
let images = obj.images;
|
|
96
|
-
|
|
96
|
+
// Prevent Uncaught TypeError when refreshing reservation result
|
|
97
|
+
if ((!images || !images.length) && ((_a = hotel === null || hotel === void 0 ? void 0 : hotel.rooms) === null || _a === void 0 ? void 0 : _a[obj.roomCode])) {
|
|
97
98
|
images = hotel === null || hotel === void 0 ? void 0 : hotel.rooms[obj.roomCode].images;
|
|
98
99
|
}
|
|
99
100
|
const cancelRow = () => {
|
|
@@ -115,7 +116,7 @@ function ReservationRow(props) {
|
|
|
115
116
|
});
|
|
116
117
|
});
|
|
117
118
|
};
|
|
118
|
-
const roomName = obj.roomType ? obj.roomType : (
|
|
119
|
+
const roomName = obj.roomType ? obj.roomType : (_c = (_b = hotel === null || hotel === void 0 ? void 0 : hotel.rooms) === null || _b === void 0 ? void 0 : _b[obj.roomCode]) === null || _c === void 0 ? void 0 : _c.name;
|
|
119
120
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
120
121
|
react_1.default.createElement("div", { className: "reservation-row" },
|
|
121
122
|
react_1.default.createElement("div", { className: "room-details +is-open " },
|
|
@@ -137,8 +138,8 @@ function ReservationRow(props) {
|
|
|
137
138
|
react_1.default.createElement(Text_1.default, { color: Color_1.Color.DarkGrey, type: Text_1.TextType.Small },
|
|
138
139
|
react_1.default.createElement(react_1.default.Fragment, null, hotel === null || hotel === void 0 ? void 0 :
|
|
139
140
|
hotel.name,
|
|
140
|
-
" - ", (
|
|
141
|
-
|
|
141
|
+
" - ", (_d = hotel === null || hotel === void 0 ? void 0 : hotel.address) === null || _d === void 0 ? void 0 :
|
|
142
|
+
_d.line1)))),
|
|
142
143
|
react_1.default.createElement("div", { className: "" },
|
|
143
144
|
react_1.default.createElement("ul", null,
|
|
144
145
|
react_1.default.createElement("li", { className: "u-flex justify-content-start u-marg-bottom--light" },
|
|
@@ -165,10 +166,10 @@ function ReservationRow(props) {
|
|
|
165
166
|
react_1.default.createElement(Icon_1.default, { icon: Icon_1.IconType.CreditCard, color: Color_1.Color.Grey }),
|
|
166
167
|
react_1.default.createElement("div", { className: "u-marg-left--light" },
|
|
167
168
|
react_1.default.createElement(Text_1.default, { type: Text_1.TextType.Small }, (obj === null || obj === void 0 ? void 0 : obj.paymentMethod) === core_1.EBookingPaymentMethod.Planpay ? (t(Translation_1.Translation.Step.Confirmation.PaidWithPlanpay)) : (react_1.default.createElement(react_1.default.Fragment, null,
|
|
168
|
-
"\u2022\u2022\u2022\u2022 \u2022\u2022\u2022\u2022 \u2022\u2022\u2022\u2022 ", (
|
|
169
|
+
"\u2022\u2022\u2022\u2022 \u2022\u2022\u2022\u2022 \u2022\u2022\u2022\u2022 ", (_f = (_e = obj.paymentCard) === null || _e === void 0 ? void 0 : _e.last4) !== null && _f !== void 0 ? _f : 'N/A',
|
|
169
170
|
' ',
|
|
170
171
|
react_1.default.createElement("span", { style: { color: Color_1.Color.DarkGrey } },
|
|
171
|
-
"(", (
|
|
172
|
+
"(", (_h = (_g = obj.paymentCard) === null || _g === void 0 ? void 0 : _g.type) !== null && _h !== void 0 ? _h : 'N/A',
|
|
172
173
|
")")))))))))),
|
|
173
174
|
react_1.default.createElement("div", { className: "reservation-row--actions" },
|
|
174
175
|
react_1.default.createElement("div", { className: "u-flex justify-content-start align-items-center" },
|
|
@@ -180,10 +181,10 @@ function ReservationRow(props) {
|
|
|
180
181
|
react_1.default.createElement("div", { className: "u-marg-left" },
|
|
181
182
|
!isCancelled ? (react_1.default.createElement(Text_1.default, { color: Color_1.Color.Navy },
|
|
182
183
|
react_1.default.createElement("strong", null,
|
|
183
|
-
react_1.default.createElement(Currency_1.default, null, (
|
|
184
|
+
react_1.default.createElement(Currency_1.default, null, (_j = obj.total.beforeFees) !== null && _j !== void 0 ? _j : obj.total.afterTax)))) : (react_1.default.createElement(Text_1.default, { color: Color_1.Color.Navy },
|
|
184
185
|
react_1.default.createElement("del", null,
|
|
185
186
|
react_1.default.createElement("strong", { className: "u-flex u-flex-direction-row align-items-center" },
|
|
186
|
-
react_1.default.createElement(Currency_1.default, null, (
|
|
187
|
+
react_1.default.createElement(Currency_1.default, null, (_k = obj.total.beforeFees) !== null && _k !== void 0 ? _k : obj.total.afterTax))))),
|
|
187
188
|
react_1.default.createElement(Text_1.default, { color: Color_1.Color.DarkGrey, type: Text_1.TextType.Small, align: TextAlignment_1.TextAlign.Right },
|
|
188
189
|
react_1.default.createElement(TaxInclusionNotice_1.TaxInclusionNotice, null)))))),
|
|
189
190
|
react_1.default.createElement(ReservationRowModal_1.default, { open: isModalOpen, onClose: closeModalOnClick, reservation: props.reservation, images: images }),
|
|
@@ -1 +1 @@
|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CAAC,KAAK,EAAE,KAAK,EAAE,aAAK,CAAC,QAAQ,IAC5C,CAAC,CAAC,yBAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CACvB;oBACP,uCAAK,SAAS,EAAC,aAAa;wBACvB,CAAC,WAAW,CAAC,CAAC,CAAC,CACZ,8BAAC,cAAI,IAAC,KAAK,EAAE,aAAK,CAAC,IAAI;4BACnB;gCACI,8BAAC,kBAAQ,QAAE,MAAA,GAAG,CAAC,KAAK,CAAC,UAAU,mCAAI,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAY,CAC5D,CACN,CACV,CAAC,CAAC,CAAC,CACA,8BAAC,cAAI,IAAC,KAAK,EAAE,aAAK,CAAC,IAAI;4BACnB;gCACI,0CAAQ,SAAS,EAAC,gDAAgD;oCAC9D,8BAAC,kBAAQ,QAAE,MAAA,GAAG,CAAC,KAAK,CAAC,UAAU,mCAAI,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAY,CAC5D,CACP,CACH,CACV;wBACD,8BAAC,cAAI,IAAC,KAAK,EAAE,aAAK,CAAC,QAAQ,EAAE,IAAI,EAAE,eAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,yBAAS,CAAC,KAAK;4BACrE,8BAAC,uCAAkB,OAAG,CACnB,CACL,CACJ,CACJ,CACJ;QACN,8BAAC,6BAAmB,IAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,KAAK,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,GAAI;QACtH,8BAAC,2BAAiB,IAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAC,mDAAmD,EAAC,SAAS,EAAE,gBAAgB,EAAE,OAAO,EAAE,uBAAuB,GAAI,CACpK,CACN,CAAC;AACN,CAAC","sourcesContent":["import { ErrorHandler } from '@frontend/contexts';\nimport { useCurrentHotel, useEvent, useGuestDateFormat } from '@frontend/hooks';\nimport { EBookingPaymentMethod, ReservationDTO } from '@roomstay/core';\nimport dayjs from 'dayjs';\nimport React, { useState } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { Translation } from 'translations/Translation';\n\nimport API from '@/api/BookingAPI';\nimport BEButton from '@/components/generic/BEButton';\nimport Currency from '@/components/generic/Currency';\nimport Icon, { IconType } from '@/components/generic/Icon/Icon';\nimport ConfirmationModal from '@/components/generic/modal/ConfirmationModal';\nimport { TaxInclusionNotice } from '@/components/generic/TaxInclusionNotice/TaxInclusionNotice';\nimport Text, { TextType } from '@/components/generic/Text';\nimport ImageGallerySlider from '@/components/steps/room/ImageGallerySlider';\nimport { CancelledBookingEvent } from '@/events/views/CancelledBookingEvent';\nimport ReservationRowModal from '@/pages/findReservation/ReservationRowModal';\nimport { Color } from '@/util/Color';\nimport DataLayer from '@/util/DataLayer';\nimport StringHelper from '@/util/StringHelper';\nimport { TextAlign } from '@/util/TextAlignment';\n\ninterface ReservationRowProps {\n reservation: ReservationDTO;\n onCancelled?: () => void;\n}\n\nexport default function ReservationRow(props: ReservationRowProps) {\n const { t } = useTranslation();\n const { hotel } = useCurrentHotel();\n const { formatReservationDate } = useGuestDateFormat();\n const { raise } = useEvent();\n\n const obj = props.reservation;\n\n const [isModalOpen, setIsModalOpen] = useState(false);\n const [isCancelled, setIsCancelled] = useState(obj.status === 'Cancelled');\n const [isCancelLoading, setIsCancelLoading] = useState(false);\n\n const [confirmOpen, setConfirmOpen] = useState(false);\n\n let adultsAndChildren = StringHelper.pluralWithDictAndCount(obj.guestCounts.adults, Translation.Step.Date.Adult, t);\n\n if (obj.guestCounts.children) {\n adultsAndChildren += ', ' + StringHelper.pluralWithDictAndCount(obj.guestCounts.children, Translation.Step.Date.Child, t);\n }\n\n const nightKeys = Object.keys(obj.nights);\n\n const openModalOnClick = () => {\n setIsModalOpen(true);\n };\n const closeModalOnClick = () => {\n setIsModalOpen(false);\n };\n const confirmModalOnClick = () => {\n setConfirmOpen(true);\n };\n const onConfirmHandler = () => {\n cancelRow();\n setConfirmOpen(false);\n };\n const openConfirmationHandler = () => {\n setConfirmOpen(false);\n };\n\n const firstNight = dayjs(nightKeys[0]);\n const lastNight = dayjs(nightKeys[nightKeys.length - 1]).add(1, 'day');\n\n let images: string[] = obj.images;\n\n if ((!images || !images.length) && hotel?.rooms[obj.roomCode]) {\n images = hotel?.rooms[obj.roomCode].images;\n }\n\n const cancelRow = () => {\n setIsCancelLoading(true);\n\n API.Reservation.cancelReservation(obj.reservationNumber, obj.guest.email, hotel?.hotelID as string)\n .then(() => {\n DataLayer.instance.sendCancellation(obj);\n raise(new CancelledBookingEvent(obj.reservationNumber, obj.guest.email));\n\n setIsCancelled(true);\n setIsCancelLoading(false);\n\n if (props.onCancelled) {\n props.onCancelled();\n }\n })\n .catch((ex) => {\n ErrorHandler.add({\n title: t(Translation.Step.Thanks.Errors.CancelFailed),\n message: ex.Message,\n });\n });\n };\n\n const roomName = obj.roomType ? obj.roomType : hotel?.rooms[obj.roomCode]?.name;\n\n return (\n <>\n <div className=\"reservation-row\">\n <div className=\"room-details +is-open \">\n <div className=\"room-details--image\">\n <ImageGallerySlider images={images} />\n </div>\n <div className=\"room-details--content u-pad--heavy u-pad@m-\">\n <div className=\"u-marg-bottom\">\n <div className=\"room-details--content-title u-marg-bottom--light\">\n {!isCancelled ? (\n <Text>\n <strong>{roomName}</strong>\n <small style={{ color: Color.Grey }}> #{obj.reservationNumber}</small>\n </Text>\n ) : (\n <Text>\n <del>\n <strong>{roomName}</strong>\n </del>\n <small style={{ color: Color.Alert }}> {t(Translation.Misc.Cancelled)}</small>\n </Text>\n )}\n </div>\n <div className=\"room-details--content-description u-marg-bottom--light\">\n <Text color={Color.DarkGrey} type={TextType.Small}>\n <>\n {hotel?.name} - {hotel?.address?.line1}\n </>\n </Text>\n </div>\n </div>\n\n <div className=\"\">\n <ul>\n <li className=\"u-flex justify-content-start u-marg-bottom--light\">\n <Icon color={Color.Grey} icon={IconType.Person} />\n <div className=\"u-marg-left--light\">\n <Text type={TextType.Small}>\n {obj.guest.firstName} {obj.guest.lastName} <span style={{ color: Color.DarkGrey }}>- {adultsAndChildren}</span>\n </Text>\n </div>\n </li>\n <li className=\"u-flex justify-content-start u-marg-bottom--light\">\n <Icon icon={IconType.Email} color={Color.Grey} />\n <div className=\"u-marg-left--light\">\n <Text type={TextType.Small}>{obj.guest.email}</Text>\n </div>\n </li>\n <li className=\"u-flex justify-content-start u-marg-bottom--light\">\n <Icon icon={IconType.Calendar} color={Color.Grey} />\n <div className=\"u-marg-left--light\">\n <Text type={TextType.Small}>{formatReservationDate(firstNight)}</Text>\n <Text type={TextType.Small}>{formatReservationDate(lastNight)}</Text>\n </div>\n </li>\n <li className=\"u-flex justify-content-start\">\n <Icon icon={IconType.CreditCard} color={Color.Grey} />\n <div className=\"u-marg-left--light\">\n <Text type={TextType.Small}>\n {obj?.paymentMethod === EBookingPaymentMethod.Planpay ? (\n t(Translation.Step.Confirmation.PaidWithPlanpay)\n ) : (\n <>\n •••• •••• •••• {obj.paymentCard?.last4 ?? 'N/A'}{' '}\n <span style={{ color: Color.DarkGrey }}>({obj.paymentCard?.type ?? 'N/A'})</span>\n </>\n )}\n </Text>\n </div>\n </li>\n </ul>\n </div>\n </div>\n </div>\n <div className=\"reservation-row--actions\">\n <div className=\"u-flex justify-content-start align-items-center\">\n <div className=\"u-marg-right--heavy u-inline-flex\">\n <BEButton icon={IconType.ArrowRight2} isText primary size=\"tiny\" iconPosition=\"right\" onClick={openModalOnClick}>\n {t(Translation.Step.Room.RoomInfo.MoreDetails)}\n </BEButton>\n </div>\n <div className=\"u-inline-flex\">\n {hotel?.preventCancellation !== true && (\n <BEButton\n isText\n size=\"tiny\"\n isLoading={isCancelLoading}\n disabled={!obj.isCancelable || isCancelled}\n textColor={Color.DarkGrey}\n onClick={confirmModalOnClick}\n >\n {t(Translation.Misc.Cancel)}\n </BEButton>\n )}\n </div>\n </div>\n <div className=\"u-flex u-flex-direction-row align-items-center\">\n <Text type={TextType.Small} color={Color.DarkGrey}>\n {t(Translation.Misc.Total)}\n </Text>\n <div className=\"u-marg-left\">\n {!isCancelled ? (\n <Text color={Color.Navy}>\n <strong>\n <Currency>{obj.total.beforeFees ?? obj.total.afterTax}</Currency>\n </strong>\n </Text>\n ) : (\n <Text color={Color.Navy}>\n <del>\n <strong className=\"u-flex u-flex-direction-row align-items-center\">\n <Currency>{obj.total.beforeFees ?? obj.total.afterTax}</Currency>\n </strong>\n </del>\n </Text>\n )}\n <Text color={Color.DarkGrey} type={TextType.Small} align={TextAlign.Right}>\n <TaxInclusionNotice />\n </Text>\n </div>\n </div>\n </div>\n </div>\n <ReservationRowModal open={isModalOpen} onClose={closeModalOnClick} reservation={props.reservation} images={images} />\n <ConfirmationModal open={confirmOpen} message=\"Are you sure you want to cancel this reservation?\" onConfirm={onConfirmHandler} onClose={openConfirmationHandler} />\n </>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ReservationRow.js","sourceRoot":"/","sources":["src/pages/findReservation/ReservationRow.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,iCA0MC;AAtOD,iDAAkD;AAClD,2CAAgF;AAChF,yCAAuE;AACvE,kDAA0B;AAC1B,+CAAwC;AACxC,iDAA+C;AAC/C,0DAAuD;AAEvD,kEAAmC;AACnC,6EAAqD;AACrD,6EAAqD;AACrD,uEAAgE;AAChE,qGAA6E;AAC7E,mGAAgG;AAChG,kEAA2D;AAC3D,oGAA4E;AAC5E,gFAA6E;AAC7E,sGAA8E;AAC9E,wCAAqC;AACrC,iEAAyC;AACzC,uEAA+C;AAC/C,wDAAiD;AAOjD,SAAwB,cAAc,CAAC,KAA0B;;IAC7D,MAAM,EAAE,CAAC,EAAE,GAAG,IAAA,8BAAc,GAAE,CAAC;IAC/B,MAAM,EAAE,KAAK,EAAE,GAAG,IAAA,uBAAe,GAAE,CAAC;IACpC,MAAM,EAAE,qBAAqB,EAAE,GAAG,IAAA,0BAAkB,GAAE,CAAC;IACvD,MAAM,EAAE,KAAK,EAA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AQ,CAAC,KAAK,EAAE,KAAK,EAAE,yBAAS,CAAC,KAAK;4BACrE,8BAAC,uCAAkB,OAAG,CACnB,CACL,CACJ,CACJ,CACJ;QACN,8BAAC,6BAAmB,IAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,KAAK,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,GAAI;QACtH,8BAAC,2BAAiB,IAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAC,mDAAmD,EAAC,SAAS,EAAE,gBAAgB,EAAE,OAAO,EAAE,uBAAuB,GAAI,CACpK,CACN,CAAC;AACN,CAAC","sourcesContent":["import { ErrorHandler } from '@frontend/contexts';\nimport { useCurrentHotel, useEvent, useGuestDateFormat } from '@frontend/hooks';\nimport { EBookingPaymentMethod, ReservationDTO } from '@roomstay/core';\nimport dayjs from 'dayjs';\nimport React, { useState } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { Translation } from 'translations/Translation';\n\nimport API from '@/api/BookingAPI';\nimport BEButton from '@/components/generic/BEButton';\nimport Currency from '@/components/generic/Currency';\nimport Icon, { IconType } from '@/components/generic/Icon/Icon';\nimport ConfirmationModal from '@/components/generic/modal/ConfirmationModal';\nimport { TaxInclusionNotice } from '@/components/generic/TaxInclusionNotice/TaxInclusionNotice';\nimport Text, { TextType } from '@/components/generic/Text';\nimport ImageGallerySlider from '@/components/steps/room/ImageGallerySlider';\nimport { CancelledBookingEvent } from '@/events/views/CancelledBookingEvent';\nimport ReservationRowModal from '@/pages/findReservation/ReservationRowModal';\nimport { Color } from '@/util/Color';\nimport DataLayer from '@/util/DataLayer';\nimport StringHelper from '@/util/StringHelper';\nimport { TextAlign } from '@/util/TextAlignment';\n\ninterface ReservationRowProps {\n reservation: ReservationDTO;\n onCancelled?: () => void;\n}\n\nexport default function ReservationRow(props: ReservationRowProps) {\n const { t } = useTranslation();\n const { hotel } = useCurrentHotel();\n const { formatReservationDate } = useGuestDateFormat();\n const { raise } = useEvent();\n\n const obj = props.reservation;\n\n const [isModalOpen, setIsModalOpen] = useState(false);\n const [isCancelled, setIsCancelled] = useState(obj.status === 'Cancelled');\n const [isCancelLoading, setIsCancelLoading] = useState(false);\n\n const [confirmOpen, setConfirmOpen] = useState(false);\n\n let adultsAndChildren = StringHelper.pluralWithDictAndCount(obj.guestCounts.adults, Translation.Step.Date.Adult, t);\n\n if (obj.guestCounts.children) {\n adultsAndChildren += ', ' + StringHelper.pluralWithDictAndCount(obj.guestCounts.children, Translation.Step.Date.Child, t);\n }\n\n const nightKeys = Object.keys(obj.nights);\n\n const openModalOnClick = () => {\n setIsModalOpen(true);\n };\n const closeModalOnClick = () => {\n setIsModalOpen(false);\n };\n const confirmModalOnClick = () => {\n setConfirmOpen(true);\n };\n const onConfirmHandler = () => {\n cancelRow();\n setConfirmOpen(false);\n };\n const openConfirmationHandler = () => {\n setConfirmOpen(false);\n };\n\n const firstNight = dayjs(nightKeys[0]);\n const lastNight = dayjs(nightKeys[nightKeys.length - 1]).add(1, 'day');\n\n let images: string[] = obj.images;\n\n // Prevent Uncaught TypeError when refreshing reservation result\n if ((!images || !images.length) && hotel?.rooms?.[obj.roomCode]) {\n images = hotel?.rooms[obj.roomCode].images;\n }\n\n const cancelRow = () => {\n setIsCancelLoading(true);\n\n API.Reservation.cancelReservation(obj.reservationNumber, obj.guest.email, hotel?.hotelID as string)\n .then(() => {\n DataLayer.instance.sendCancellation(obj);\n raise(new CancelledBookingEvent(obj.reservationNumber, obj.guest.email));\n\n setIsCancelled(true);\n setIsCancelLoading(false);\n\n if (props.onCancelled) {\n props.onCancelled();\n }\n })\n .catch((ex) => {\n ErrorHandler.add({\n title: t(Translation.Step.Thanks.Errors.CancelFailed),\n message: ex.Message,\n });\n });\n };\n\n const roomName = obj.roomType ? obj.roomType : hotel?.rooms?.[obj.roomCode]?.name;\n\n return (\n <>\n <div className=\"reservation-row\">\n <div className=\"room-details +is-open \">\n <div className=\"room-details--image\">\n <ImageGallerySlider images={images} />\n </div>\n <div className=\"room-details--content u-pad--heavy u-pad@m-\">\n <div className=\"u-marg-bottom\">\n <div className=\"room-details--content-title u-marg-bottom--light\">\n {!isCancelled ? (\n <Text>\n <strong>{roomName}</strong>\n <small style={{ color: Color.Grey }}> #{obj.reservationNumber}</small>\n </Text>\n ) : (\n <Text>\n <del>\n <strong>{roomName}</strong>\n </del>\n <small style={{ color: Color.Alert }}> {t(Translation.Misc.Cancelled)}</small>\n </Text>\n )}\n </div>\n <div className=\"room-details--content-description u-marg-bottom--light\">\n <Text color={Color.DarkGrey} type={TextType.Small}>\n <>\n {hotel?.name} - {hotel?.address?.line1}\n </>\n </Text>\n </div>\n </div>\n\n <div className=\"\">\n <ul>\n <li className=\"u-flex justify-content-start u-marg-bottom--light\">\n <Icon color={Color.Grey} icon={IconType.Person} />\n <div className=\"u-marg-left--light\">\n <Text type={TextType.Small}>\n {obj.guest.firstName} {obj.guest.lastName} <span style={{ color: Color.DarkGrey }}>- {adultsAndChildren}</span>\n </Text>\n </div>\n </li>\n <li className=\"u-flex justify-content-start u-marg-bottom--light\">\n <Icon icon={IconType.Email} color={Color.Grey} />\n <div className=\"u-marg-left--light\">\n <Text type={TextType.Small}>{obj.guest.email}</Text>\n </div>\n </li>\n <li className=\"u-flex justify-content-start u-marg-bottom--light\">\n <Icon icon={IconType.Calendar} color={Color.Grey} />\n <div className=\"u-marg-left--light\">\n <Text type={TextType.Small}>{formatReservationDate(firstNight)}</Text>\n <Text type={TextType.Small}>{formatReservationDate(lastNight)}</Text>\n </div>\n </li>\n <li className=\"u-flex justify-content-start\">\n <Icon icon={IconType.CreditCard} color={Color.Grey} />\n <div className=\"u-marg-left--light\">\n <Text type={TextType.Small}>\n {obj?.paymentMethod === EBookingPaymentMethod.Planpay ? (\n t(Translation.Step.Confirmation.PaidWithPlanpay)\n ) : (\n <>\n •••• •••• •••• {obj.paymentCard?.last4 ?? 'N/A'}{' '}\n <span style={{ color: Color.DarkGrey }}>({obj.paymentCard?.type ?? 'N/A'})</span>\n </>\n )}\n </Text>\n </div>\n </li>\n </ul>\n </div>\n </div>\n </div>\n <div className=\"reservation-row--actions\">\n <div className=\"u-flex justify-content-start align-items-center\">\n <div className=\"u-marg-right--heavy u-inline-flex\">\n <BEButton icon={IconType.ArrowRight2} isText primary size=\"tiny\" iconPosition=\"right\" onClick={openModalOnClick}>\n {t(Translation.Step.Room.RoomInfo.MoreDetails)}\n </BEButton>\n </div>\n <div className=\"u-inline-flex\">\n {hotel?.preventCancellation !== true && (\n <BEButton\n isText\n size=\"tiny\"\n isLoading={isCancelLoading}\n disabled={!obj.isCancelable || isCancelled}\n textColor={Color.DarkGrey}\n onClick={confirmModalOnClick}\n >\n {t(Translation.Misc.Cancel)}\n </BEButton>\n )}\n </div>\n </div>\n <div className=\"u-flex u-flex-direction-row align-items-center\">\n <Text type={TextType.Small} color={Color.DarkGrey}>\n {t(Translation.Misc.Total)}\n </Text>\n <div className=\"u-marg-left\">\n {!isCancelled ? (\n <Text color={Color.Navy}>\n <strong>\n <Currency>{obj.total.beforeFees ?? obj.total.afterTax}</Currency>\n </strong>\n </Text>\n ) : (\n <Text color={Color.Navy}>\n <del>\n <strong className=\"u-flex u-flex-direction-row align-items-center\">\n <Currency>{obj.total.beforeFees ?? obj.total.afterTax}</Currency>\n </strong>\n </del>\n </Text>\n )}\n <Text color={Color.DarkGrey} type={TextType.Small} align={TextAlign.Right}>\n <TaxInclusionNotice />\n </Text>\n </div>\n </div>\n </div>\n </div>\n <ReservationRowModal open={isModalOpen} onClose={closeModalOnClick} reservation={props.reservation} images={images} />\n <ConfirmationModal open={confirmOpen} message=\"Are you sure you want to cancel this reservation?\" onConfirm={onConfirmHandler} onClose={openConfirmationHandler} />\n </>\n );\n}\n"]}
|
|
@@ -47,6 +47,7 @@ const react_i18next_1 = require("react-i18next");
|
|
|
47
47
|
const Translation_1 = require("translations/Translation");
|
|
48
48
|
const BEButton_1 = __importDefault(require("../../components/generic/BEButton"));
|
|
49
49
|
const Headline_1 = __importDefault(require("../../components/generic/Headline"));
|
|
50
|
+
const HtmlContentViewer_1 = require("../../components/generic/HtmlContentViewer");
|
|
50
51
|
const Icon_1 = __importStar(require("../../components/generic/Icon/Icon"));
|
|
51
52
|
const BEHotelLocationMapBlock_1 = __importDefault(require("../../components/generic/map/BEHotelLocationMapBlock"));
|
|
52
53
|
const PageTitle_1 = require("../../components/generic/PageTitle");
|
|
@@ -59,7 +60,7 @@ const Color_1 = require("../../util/Color");
|
|
|
59
60
|
const ScreenSize_1 = __importDefault(require("../../util/ScreenSize"));
|
|
60
61
|
const StepManager_1 = __importDefault(require("../../util/StepManager"));
|
|
61
62
|
function HotelInfo() {
|
|
62
|
-
var _a, _b, _c, _d, _e
|
|
63
|
+
var _a, _b, _c, _d, _e;
|
|
63
64
|
const { hotel } = (0, hooks_1.useCurrentHotel)();
|
|
64
65
|
const historyConsistentPush = (0, HistoryConsistentPush_1.useHistoryConsistentPush)();
|
|
65
66
|
const { t } = (0, react_i18next_1.useTranslation)();
|
|
@@ -154,15 +155,15 @@ function HotelInfo() {
|
|
|
154
155
|
react_1.default.createElement("div", { className: "u-marg-bottom u-marg-bottom--heavy" },
|
|
155
156
|
react_1.default.createElement(Headline_1.default, { className: "rs-hotelinfo-about", bold: true }, t(Translation_1.Translation.Step.Hotel.About))),
|
|
156
157
|
react_1.default.createElement("div", { className: "u-marg-bottom u-marg-bottom--heavy" },
|
|
157
|
-
react_1.default.createElement(Text_1.default, { type: Text_1.TextType.Small },
|
|
158
|
-
react_1.default.createElement(
|
|
158
|
+
react_1.default.createElement(Text_1.default, { type: Text_1.TextType.Small, asDiv: true },
|
|
159
|
+
react_1.default.createElement(HtmlContentViewer_1.HtmlContentViewer, { content: (hotel === null || hotel === void 0 ? void 0 : hotel.description) || '' })),
|
|
159
160
|
!!(hotel === null || hotel === void 0 ? void 0 : hotel.locationDescription) && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
160
161
|
react_1.default.createElement("div", { className: "u-marg-top" },
|
|
161
162
|
react_1.default.createElement(Text_1.default, { type: Text_1.TextType.Small },
|
|
162
163
|
react_1.default.createElement("strong", null, t(Translation_1.Translation.Step.Hotel.Location)))),
|
|
163
|
-
react_1.default.createElement(Text_1.default, { type: Text_1.TextType.Small },
|
|
164
|
-
react_1.default.createElement(
|
|
165
|
-
!!((
|
|
164
|
+
react_1.default.createElement(Text_1.default, { type: Text_1.TextType.Small, asDiv: true },
|
|
165
|
+
react_1.default.createElement(HtmlContentViewer_1.HtmlContentViewer, { content: hotel.locationDescription }))))),
|
|
166
|
+
!!((_e = hotel === null || hotel === void 0 ? void 0 : hotel.perks) === null || _e === void 0 ? void 0 : _e.length) && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
166
167
|
react_1.default.createElement("div", { className: "u-marg-bottom u-marg-bottom--heavy" },
|
|
167
168
|
react_1.default.createElement(Text_1.default, { type: Text_1.TextType.Small },
|
|
168
169
|
react_1.default.createElement("strong", { className: "rs-hotelinfo-andyougetall" }, hotel.perkTitle || t(Translation_1.Translation.Step.Hotel.AndYouGetAll)))),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HotelInfo.js","sourceRoot":"/","sources":["src/pages/hotel/HotelInfo.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,4BA4QC;AAnSD,6CAA0D;AAC1D,2CAA4D;AAC5D,4DAAoC;AACpC,wEAA0C;AAC1C,uEAAuE;AACvE,+CAA+D;AAC/D,iDAA+C;AAC/C,0DAAuD;AAEvD,6EAAqD;AACrD,6EAAqD;AACrD,uEAAgE;AAChE,+GAAuF;AACvF,8DAA2D;AAC3D,kEAA2D;AAC3D,mGAA0E;AAC1E,2HAAmG;AACnG,mCAA+C;AAC/C,2EAAqE;AACrE,wCAAqC;AACrC,mEAA2C;AAC3C,qEAA6C;AAE7C,SAAwB,SAAS;;IAC7B,MAAM,EAAE,KAAK,EAAE,GAAG,IAAA,uBAAe,GA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;QAEf,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;QAChD,OAAO,GAAG,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;IACpE,CAAC,EAAE,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC;IAE5B,OAAO,CACH,uCAAK,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,IACnE,GAAG,IAAI,CACJ,uCACI,GAAG,EAAE,GAAG,EACR,GAAG,EAAC,OAAO,EACX,KAAK,EAAE;YACH,KAAK,EAAE,MAAM;YACb,MAAM,EAAE,QAAQ,IAAI,WAAW,CAAC,CAAC,CAAC,GAAG,WAAW,IAAI,CAAC,CAAC,CAAC,MAAM;YAC7D,SAAS,EAAE,SAAS,EAAE,6CAA6C;YACnE,OAAO,EAAE,OAAO,EAAE,mCAAmC;YACrD,MAAM,EAAE,QAAQ,EAAE,+BAA+B;SACpD,GACH,CACL,CACC,CACT,CAAC;AACN,CAAC,CAAC","sourcesContent":["import { StepHotelInfoViewEvent } from '@frontend/events';\nimport { useCurrentHotel, useEvent } from '@frontend/hooks';\nimport classNames from 'classnames';\nimport FsLightbox from 'fslightbox-react';\nimport { useHistoryConsistentPush } from 'hooks/HistoryConsistentPush';\nimport React, { useContext, useEffect, useState } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { Translation } from 'translations/Translation';\n\nimport BEButton from '@/components/generic/BEButton';\nimport Headline from '@/components/generic/Headline';\nimport Icon, { IconType } from '@/components/generic/Icon/Icon';\nimport BEHotelLocationMapBlock from '@/components/generic/map/BEHotelLocationMapBlock';\nimport { PageTitle } from '@/components/generic/PageTitle';\nimport Text, { TextType } from '@/components/generic/Text';\nimport HotelInfoPerkRow from '@/components/steps/hotel/HotelInfoPerksRow';\nimport TransportDistanceFromHotelBlock from '@/components/summary/TransportDistanceFromHotelBlock';\nimport { BookingEngineContext } from '@/index';\nimport ImageProvider, { ImageSize } from '@/providers/ImageProvider';\nimport { Color } from '@/util/Color';\nimport ScreenSize from '@/util/ScreenSize';\nimport StepManager from '@/util/StepManager';\n\nexport default function HotelInfo() {\n const { hotel } = useCurrentHotel();\n const historyConsistentPush = useHistoryConsistentPush();\n const { t } = useTranslation();\n const context = useContext(BookingEngineContext);\n const isMobile = context.screenSize <= ScreenSize.Large;\n\n const imageUrl = hotel?.heroImage;\n\n const { line1, line2, postalCode, country } = hotel?.address ?? {};\n\n const [lightboxController, setLightboxController] = useState({ toggler: false, slide: 1 });\n const [images, setImages] = useState<string[]>([]);\n\n const openSlider = (slide: number) => {\n setLightboxController((controller) => ({ toggler: !controller.toggler, slide: slide + 1 }));\n };\n const openSliderOnClick = () => {\n openSlider(4);\n };\n\n const { raise } = useEvent();\n\n useEffect(() => {\n const event = new StepHotelInfoViewEvent();\n raise(event);\n }, []);\n\n useEffect(() => {\n const newImages: string[] = [];\n\n if (hotel?.images?.length) {\n newImages.push(...hotel.images);\n }\n\n if (hotel?.rooms) {\n for (const room of Object.values(hotel?.rooms)) {\n room.images?.forEach((image) => {\n newImages.push(image);\n });\n }\n }\n\n setImages(newImages);\n }, [hotel?.images, hotel?.rooms]);\n\n const onBookNowClick = () => {\n historyConsistentPush(StepManager.getFirstStep().getStepUrl());\n };\n\n const getImage = (index: number) => {\n const openSliderOnClickHandler = () => {\n openSlider(index);\n };\n\n const resizedUrl = ImageProvider.resizeImage(images[index], ImageSize.Small);\n\n return (\n <div\n style={{ backgroundImage: `url('${resizedUrl}')`, paddingTop: '75%' }}\n className=\"c-images u-block u-w-100 u-marg-bottom u-marg-bottom--heavy\"\n onClick={openSliderOnClickHandler}\n />\n );\n };\n\n const hotelServices = hotel?.hotelServices?.filter(({ name }) => !!name) || [];\n const quoteImage = isMobile ? hotel?.quoteImageMobile : hotel?.quoteImageDesktop;\n\n return (\n <>\n <PageTitle step=\"HotelInfo\" />\n <div\n style={{ backgroundImage: `url('${imageUrl && ImageProvider.resizeImage(imageUrl, ImageSize.Original)}')` }}\n className={classNames('c-masthead has-tint', 'rs-background-hotel-info', `rs-background-${hotel?.hotelID}`)}\n >\n <div className=\"container\">\n <div className=\"c-masthead__body u-fill-white u-pad--heavy u-shadow-accent\">\n <h1 className=\"c-masthead__header\">{hotel?.name}</h1>\n <h2 className=\"c-masthead__sub-header\">\n {hotel?.countryPrefix ?? ''} {hotel?.address?.country}\n </h2>\n </div>\n </div>\n </div>\n <div className=\"u-fill-snow u-pad--heavy-med u-pad-top-bottom--heavy@m-\">\n <div className=\"container\">\n <div className=\"row\">\n <div className=\"col-md-6 u-flex align-items-center\">\n <ul>\n <li className=\"u-flex u-marg-bottom--heavy\">\n <Icon icon={IconType.Map} size=\"1.3em\" color={Color.Accent} />\n <span className=\"u-flex__item u-marg-left\">\n {line1}\n <br />\n {line2} {postalCode}, {country}\n </span>\n </li>\n <li className=\"u-flex u-marg-bottom--heavy\">\n <Icon icon={IconType.Phone} size=\"1.3em\" color={Color.Accent} />\n <span className=\"u-flex__item u-marg-left\">{hotel?.phone}</span>\n </li>\n <li className=\"u-flex u-marg-bottom--heavy\">\n <Icon icon={IconType.Hotel2} size=\"1.3em\" color={Color.Accent} />\n <span className=\"u-flex__item u-marg-left\">\n <a href={hotel?.hotelUrl} style={{ color: 'var(--rs-color-accent-1)' }}>\n {hotel?.name}\n </a>\n </span>\n </li>\n <li className=\"u-flex\">\n <BEButton icon={IconType.ArrowRight} primary filled iconPosition=\"right\" onClick={onBookNowClick}>\n {t(Translation.Misc.BookNow)}\n </BEButton>\n </li>\n </ul>\n </div>\n <div className=\"col-md-6\">\n <div className=\"c-overlap\">\n <div className=\"u-marg-bottom u-marg-bottom--heavy u-marg-top u-marg-top--heavy rs-summary-hotel-location-map\" style={{ height: '240px' }}>\n <BEHotelLocationMapBlock />\n </div>\n <div className=\"u-flex u-flex-column justify-content-center rs-hotelinfo-transport-distance u-w-100\">\n <TransportDistanceFromHotelBlock hotel={hotel} />\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n <div className=\"u-pad u-pad--heavy-plus u-pad-top-bottom--heavy@m-\">\n <div className=\"container rs-hotelinfo\">\n <div className=\"row\">\n <div className=\"col-lg-6\">\n <div className=\"u-marg-bottom u-marg-bottom--heavy\">\n <div className=\"u-marg-bottom u-marg-bottom--heavy\">\n <Headline className=\"rs-hotelinfo-about\" bold>\n {t(Translation.Step.Hotel.About)}\n </Headline>\n </div>\n <div className=\"u-marg-bottom u-marg-bottom--heavy\">\n <Text type={TextType.Small}>\n <span dangerouslySetInnerHTML={{ __html: hotel?.description?.replace('\\r\\n', '<br/><br/>') || '' }} />\n </Text>\n {!!hotel?.locationDescription && (\n <>\n <div className=\"u-marg-top\">\n <Text type={TextType.Small}>\n <strong>{t(Translation.Step.Hotel.Location)}</strong>\n </Text>\n </div>\n <Text type={TextType.Small}>\n <span dangerouslySetInnerHTML={{ __html: hotel?.locationDescription?.replace('\\r\\n', '<br/><br/>') }} />\n </Text>\n </>\n )}\n </div>\n {!!hotel?.perks?.length && (\n <>\n <div className=\"u-marg-bottom u-marg-bottom--heavy\">\n <Text type={TextType.Small}>\n <strong className=\"rs-hotelinfo-andyougetall\">{hotel.perkTitle || t(Translation.Step.Hotel.AndYouGetAll)}</strong>\n </Text>\n </div>\n <div className=\"row\">\n <HotelInfoPerkRow hotel={hotel} />\n </div>\n {hotel?.perksShowDisclaimer && (\n <div className=\"row u-marg-top--lighter\">\n <small className=\"col-12\">{t(Translation.Misc.PerksDisclaimer)}</small>\n </div>\n )}\n </>\n )}\n </div>\n {!!hotelServices.length && (\n <div className=\"u-marg-bottom u-marg-bottom--heavy\">\n <div className=\"u-marg-bottom--heavy\">\n <Headline className=\"rs-hotelinfo-hotelamenities\" bold>\n {t(Translation.Step.Hotel.HotelAmenities)}\n </Headline>\n </div>\n <div className=\"row\">\n {hotelServices.map((hotelService, index) => {\n return (\n <div key={index} className=\"col-md-6\">\n <div className=\"u-flex u-marg-bottom\">\n <Icon icon={IconType.Check} color={Color.White} backgroundColor={Color.Accent} borderRadius=\"round\" noPadding size=\"16px\" />\n <span className=\"u-flex__item u-marg-left--light\">\n <Text type={TextType.Small}>{hotelService.name}</Text>\n </span>\n </div>\n </div>\n );\n })}\n </div>\n </div>\n )}\n {!!hotel?.policies && (\n <div className=\"u-marg-bottom u-marg-bottom--heavy\">\n <div className=\"u-marg-bottom--heavy\">\n <Headline className=\"rs-hotelinfo-policies\" bold>\n {t(Translation.Step.Hotel.Policies)}\n </Headline>\n </div>\n <Text type={TextType.Small}>\n <a href={hotel?.policies} target=\"_blank\" style={{ color: hotel?.colors.accent }} rel=\"noreferrer\">\n {hotel?.policies}\n </a>\n </Text>\n </div>\n )}\n\n {quoteImage && (\n <div className=\"u-marg-bottom u-marg-bottom--heavy\">\n <QuoteImage\n isMobile={isMobile}\n className={classNames('u-marg-bottom--heavy rs-hotelinfo-quote-images', {\n '--mobile': isMobile,\n '--desktop': !isMobile,\n })}\n src={quoteImage}\n ></QuoteImage>\n </div>\n )}\n </div>\n <div className=\"col-lg-6\">\n <div className=\"u-marg-bottom u-marg-bottom--heavy\">\n <div className=\"u-marg-bottom u-marg-bottom--heavy\">\n <Headline className=\"rs-hotelinfo-gallery\" bold>\n {t(Translation.Step.Hotel.Gallery)}\n </Headline>\n </div>\n {images.length >= 1 && getImage(0)}\n <div className=\"row\">\n {[1, 2, 3].map((index) => {\n if (images.length > index) {\n return (\n <div key={index} className=\"col-6\">\n {getImage(index)}\n </div>\n );\n }\n })}\n {images.length > 5 && (\n <div className=\"col-6\">\n <div className=\"c-images c-images--more\" onClick={openSliderOnClick}>\n {getImage(4)}\n <span>+ {images.length - 5}</span>\n </div>\n </div>\n )}\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n {!!images?.length && (\n <FsLightbox\n toggler={lightboxController.toggler}\n slide={lightboxController.slide}\n sources={images.map((image) => ImageProvider.resizeImage(image, ImageSize.Original))}\n type=\"image\"\n />\n )}\n </>\n );\n}\n\nconst QuoteImage = ({ src, className, isMobile }: { src: string; className?: string; isMobile: boolean }) => {\n const [aspectRatio, setAspectRatio] = useState<number | null>(null);\n const [imageHeight, setImageHeight] = useState<number | null>(null);\n\n useEffect(() => {\n if (!src) return;\n\n const img = new Image();\n img.src = src;\n img.onload = () => setAspectRatio(img.width > 0 ? img.height / img.width : 1); // Fallback aspect ratio\n img.onerror = () => {\n console.error('Failed to load image');\n setAspectRatio(1);\n };\n }, [src]);\n\n useEffect(() => {\n if (!isMobile || aspectRatio === null || typeof window === 'undefined') return;\n\n const updateHeight = () => setImageHeight(window.innerWidth * aspectRatio);\n updateHeight();\n\n window.addEventListener('resize', updateHeight);\n return () => window.removeEventListener('resize', updateHeight);\n }, [aspectRatio, isMobile]);\n\n return (\n <div className={className} style={{ width: '100%', textAlign: 'center' }}>\n {src && (\n <img\n src={src}\n alt=\"Quote\"\n style={{\n width: '100%',\n height: isMobile && imageHeight ? `${imageHeight}px` : 'auto',\n objectFit: 'contain', // Ensures full image is visible, no cropping\n display: 'block', // Prevents inline whitespace issue\n margin: '0 auto', // Centers the image in the div\n }}\n />\n )}\n </div>\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"HotelInfo.js","sourceRoot":"/","sources":["src/pages/hotel/HotelInfo.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,4BA6QC;AArSD,6CAA0D;AAC1D,2CAA4D;AAC5D,4DAAoC;AACpC,wEAA0C;AAC1C,uEAAuE;AACvE,+CAA+D;AAC/D,iDAA+C;AAC/C,0DAAuD;AAEvD,6EAAqD;AACrD,6EAAqD;AACrD,8EAA2E;AAC3E,uEAAgE;AAChE,+GAAuF;AACvF,8DAA2D;AAC3D,kEAA2D;AAC3D,mGAA0E;AAC1E,2HAAmG;AACnG,mCAA+C;AAC/C,2EAAqE;AACrE,wCAAqC;AACrC,mEAA2C;AAC3C,qEAA6C;AAE7C,SAAwB,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AAC;QAChD,OAAO,GAAG,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;IACpE,CAAC,EAAE,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC;IAE5B,OAAO,CACH,uCAAK,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,IACnE,GAAG,IAAI,CACJ,uCACI,GAAG,EAAE,GAAG,EACR,GAAG,EAAC,OAAO,EACX,KAAK,EAAE;YACH,KAAK,EAAE,MAAM;YACb,MAAM,EAAE,QAAQ,IAAI,WAAW,CAAC,CAAC,CAAC,GAAG,WAAW,IAAI,CAAC,CAAC,CAAC,MAAM;YAC7D,SAAS,EAAE,SAAS,EAAE,6CAA6C;YACnE,OAAO,EAAE,OAAO,EAAE,mCAAmC;YACrD,MAAM,EAAE,QAAQ,EAAE,+BAA+B;SACpD,GACH,CACL,CACC,CACT,CAAC;AACN,CAAC,CAAC","sourcesContent":["import { StepHotelInfoViewEvent } from '@frontend/events';\nimport { useCurrentHotel, useEvent } from '@frontend/hooks';\nimport classNames from 'classnames';\nimport FsLightbox from 'fslightbox-react';\nimport { useHistoryConsistentPush } from 'hooks/HistoryConsistentPush';\nimport React, { useContext, useEffect, useState } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { Translation } from 'translations/Translation';\n\nimport BEButton from '@/components/generic/BEButton';\nimport Headline from '@/components/generic/Headline';\nimport { HtmlContentViewer } from '@/components/generic/HtmlContentViewer';\nimport Icon, { IconType } from '@/components/generic/Icon/Icon';\nimport BEHotelLocationMapBlock from '@/components/generic/map/BEHotelLocationMapBlock';\nimport { PageTitle } from '@/components/generic/PageTitle';\nimport Text, { TextType } from '@/components/generic/Text';\nimport HotelInfoPerkRow from '@/components/steps/hotel/HotelInfoPerksRow';\nimport TransportDistanceFromHotelBlock from '@/components/summary/TransportDistanceFromHotelBlock';\nimport { BookingEngineContext } from '@/index';\nimport ImageProvider, { ImageSize } from '@/providers/ImageProvider';\nimport { Color } from '@/util/Color';\nimport ScreenSize from '@/util/ScreenSize';\nimport StepManager from '@/util/StepManager';\n\nexport default function HotelInfo() {\n const { hotel } = useCurrentHotel();\n const historyConsistentPush = useHistoryConsistentPush();\n const { t } = useTranslation();\n const context = useContext(BookingEngineContext);\n const isMobile = context.screenSize <= ScreenSize.Large;\n\n const imageUrl = hotel?.heroImage;\n\n const { line1, line2, postalCode, country } = hotel?.address ?? {};\n\n const [lightboxController, setLightboxController] = useState({ toggler: false, slide: 1 });\n const [images, setImages] = useState<string[]>([]);\n\n const openSlider = (slide: number) => {\n setLightboxController((controller) => ({ toggler: !controller.toggler, slide: slide + 1 }));\n };\n const openSliderOnClick = () => {\n openSlider(4);\n };\n\n const { raise } = useEvent();\n\n useEffect(() => {\n const event = new StepHotelInfoViewEvent();\n raise(event);\n }, []);\n\n useEffect(() => {\n const newImages: string[] = [];\n\n if (hotel?.images?.length) {\n newImages.push(...hotel.images);\n }\n\n if (hotel?.rooms) {\n for (const room of Object.values(hotel?.rooms)) {\n room.images?.forEach((image) => {\n newImages.push(image);\n });\n }\n }\n\n setImages(newImages);\n }, [hotel?.images, hotel?.rooms]);\n\n const onBookNowClick = () => {\n historyConsistentPush(StepManager.getFirstStep().getStepUrl());\n };\n\n const getImage = (index: number) => {\n const openSliderOnClickHandler = () => {\n openSlider(index);\n };\n\n const resizedUrl = ImageProvider.resizeImage(images[index], ImageSize.Small);\n\n return (\n <div\n style={{ backgroundImage: `url('${resizedUrl}')`, paddingTop: '75%' }}\n className=\"c-images u-block u-w-100 u-marg-bottom u-marg-bottom--heavy\"\n onClick={openSliderOnClickHandler}\n />\n );\n };\n\n const hotelServices = hotel?.hotelServices?.filter(({ name }) => !!name) || [];\n const quoteImage = isMobile ? hotel?.quoteImageMobile : hotel?.quoteImageDesktop;\n\n return (\n <>\n <PageTitle step=\"HotelInfo\" />\n <div\n style={{ backgroundImage: `url('${imageUrl && ImageProvider.resizeImage(imageUrl, ImageSize.Original)}')` }}\n className={classNames('c-masthead has-tint', 'rs-background-hotel-info', `rs-background-${hotel?.hotelID}`)}\n >\n <div className=\"container\">\n <div className=\"c-masthead__body u-fill-white u-pad--heavy u-shadow-accent\">\n <h1 className=\"c-masthead__header\">{hotel?.name}</h1>\n <h2 className=\"c-masthead__sub-header\">\n {hotel?.countryPrefix ?? ''} {hotel?.address?.country}\n </h2>\n </div>\n </div>\n </div>\n <div className=\"u-fill-snow u-pad--heavy-med u-pad-top-bottom--heavy@m-\">\n <div className=\"container\">\n <div className=\"row\">\n <div className=\"col-md-6 u-flex align-items-center\">\n <ul>\n <li className=\"u-flex u-marg-bottom--heavy\">\n <Icon icon={IconType.Map} size=\"1.3em\" color={Color.Accent} />\n <span className=\"u-flex__item u-marg-left\">\n {line1}\n <br />\n {line2} {postalCode}, {country}\n </span>\n </li>\n <li className=\"u-flex u-marg-bottom--heavy\">\n <Icon icon={IconType.Phone} size=\"1.3em\" color={Color.Accent} />\n <span className=\"u-flex__item u-marg-left\">{hotel?.phone}</span>\n </li>\n <li className=\"u-flex u-marg-bottom--heavy\">\n <Icon icon={IconType.Hotel2} size=\"1.3em\" color={Color.Accent} />\n <span className=\"u-flex__item u-marg-left\">\n <a href={hotel?.hotelUrl} style={{ color: 'var(--rs-color-accent-1)' }}>\n {hotel?.name}\n </a>\n </span>\n </li>\n <li className=\"u-flex\">\n <BEButton icon={IconType.ArrowRight} primary filled iconPosition=\"right\" onClick={onBookNowClick}>\n {t(Translation.Misc.BookNow)}\n </BEButton>\n </li>\n </ul>\n </div>\n <div className=\"col-md-6\">\n <div className=\"c-overlap\">\n <div className=\"u-marg-bottom u-marg-bottom--heavy u-marg-top u-marg-top--heavy rs-summary-hotel-location-map\" style={{ height: '240px' }}>\n <BEHotelLocationMapBlock />\n </div>\n <div className=\"u-flex u-flex-column justify-content-center rs-hotelinfo-transport-distance u-w-100\">\n <TransportDistanceFromHotelBlock hotel={hotel} />\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n <div className=\"u-pad u-pad--heavy-plus u-pad-top-bottom--heavy@m-\">\n <div className=\"container rs-hotelinfo\">\n <div className=\"row\">\n <div className=\"col-lg-6\">\n <div className=\"u-marg-bottom u-marg-bottom--heavy\">\n <div className=\"u-marg-bottom u-marg-bottom--heavy\">\n <Headline className=\"rs-hotelinfo-about\" bold>\n {t(Translation.Step.Hotel.About)}\n </Headline>\n </div>\n <div className=\"u-marg-bottom u-marg-bottom--heavy\">\n <Text type={TextType.Small} asDiv>\n <HtmlContentViewer content={hotel?.description || ''} />\n </Text>\n\n {!!hotel?.locationDescription && (\n <>\n <div className=\"u-marg-top\">\n <Text type={TextType.Small}>\n <strong>{t(Translation.Step.Hotel.Location)}</strong>\n </Text>\n </div>\n <Text type={TextType.Small} asDiv>\n <HtmlContentViewer content={hotel.locationDescription} />\n </Text>\n </>\n )}\n </div>\n {!!hotel?.perks?.length && (\n <>\n <div className=\"u-marg-bottom u-marg-bottom--heavy\">\n <Text type={TextType.Small}>\n <strong className=\"rs-hotelinfo-andyougetall\">{hotel.perkTitle || t(Translation.Step.Hotel.AndYouGetAll)}</strong>\n </Text>\n </div>\n <div className=\"row\">\n <HotelInfoPerkRow hotel={hotel} />\n </div>\n {hotel?.perksShowDisclaimer && (\n <div className=\"row u-marg-top--lighter\">\n <small className=\"col-12\">{t(Translation.Misc.PerksDisclaimer)}</small>\n </div>\n )}\n </>\n )}\n </div>\n {!!hotelServices.length && (\n <div className=\"u-marg-bottom u-marg-bottom--heavy\">\n <div className=\"u-marg-bottom--heavy\">\n <Headline className=\"rs-hotelinfo-hotelamenities\" bold>\n {t(Translation.Step.Hotel.HotelAmenities)}\n </Headline>\n </div>\n <div className=\"row\">\n {hotelServices.map((hotelService, index) => {\n return (\n <div key={index} className=\"col-md-6\">\n <div className=\"u-flex u-marg-bottom\">\n <Icon icon={IconType.Check} color={Color.White} backgroundColor={Color.Accent} borderRadius=\"round\" noPadding size=\"16px\" />\n <span className=\"u-flex__item u-marg-left--light\">\n <Text type={TextType.Small}>{hotelService.name}</Text>\n </span>\n </div>\n </div>\n );\n })}\n </div>\n </div>\n )}\n {!!hotel?.policies && (\n <div className=\"u-marg-bottom u-marg-bottom--heavy\">\n <div className=\"u-marg-bottom--heavy\">\n <Headline className=\"rs-hotelinfo-policies\" bold>\n {t(Translation.Step.Hotel.Policies)}\n </Headline>\n </div>\n <Text type={TextType.Small}>\n <a href={hotel?.policies} target=\"_blank\" style={{ color: hotel?.colors.accent }} rel=\"noreferrer\">\n {hotel?.policies}\n </a>\n </Text>\n </div>\n )}\n\n {quoteImage && (\n <div className=\"u-marg-bottom u-marg-bottom--heavy\">\n <QuoteImage\n isMobile={isMobile}\n className={classNames('u-marg-bottom--heavy rs-hotelinfo-quote-images', {\n '--mobile': isMobile,\n '--desktop': !isMobile,\n })}\n src={quoteImage}\n ></QuoteImage>\n </div>\n )}\n </div>\n <div className=\"col-lg-6\">\n <div className=\"u-marg-bottom u-marg-bottom--heavy\">\n <div className=\"u-marg-bottom u-marg-bottom--heavy\">\n <Headline className=\"rs-hotelinfo-gallery\" bold>\n {t(Translation.Step.Hotel.Gallery)}\n </Headline>\n </div>\n {images.length >= 1 && getImage(0)}\n <div className=\"row\">\n {[1, 2, 3].map((index) => {\n if (images.length > index) {\n return (\n <div key={index} className=\"col-6\">\n {getImage(index)}\n </div>\n );\n }\n })}\n {images.length > 5 && (\n <div className=\"col-6\">\n <div className=\"c-images c-images--more\" onClick={openSliderOnClick}>\n {getImage(4)}\n <span>+ {images.length - 5}</span>\n </div>\n </div>\n )}\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n {!!images?.length && (\n <FsLightbox\n toggler={lightboxController.toggler}\n slide={lightboxController.slide}\n sources={images.map((image) => ImageProvider.resizeImage(image, ImageSize.Original))}\n type=\"image\"\n />\n )}\n </>\n );\n}\n\nconst QuoteImage = ({ src, className, isMobile }: { src: string; className?: string; isMobile: boolean }) => {\n const [aspectRatio, setAspectRatio] = useState<number | null>(null);\n const [imageHeight, setImageHeight] = useState<number | null>(null);\n\n useEffect(() => {\n if (!src) return;\n\n const img = new Image();\n img.src = src;\n img.onload = () => setAspectRatio(img.width > 0 ? img.height / img.width : 1); // Fallback aspect ratio\n img.onerror = () => {\n console.error('Failed to load image');\n setAspectRatio(1);\n };\n }, [src]);\n\n useEffect(() => {\n if (!isMobile || aspectRatio === null || typeof window === 'undefined') return;\n\n const updateHeight = () => setImageHeight(window.innerWidth * aspectRatio);\n updateHeight();\n\n window.addEventListener('resize', updateHeight);\n return () => window.removeEventListener('resize', updateHeight);\n }, [aspectRatio, isMobile]);\n\n return (\n <div className={className} style={{ width: '100%', textAlign: 'center' }}>\n {src && (\n <img\n src={src}\n alt=\"Quote\"\n style={{\n width: '100%',\n height: isMobile && imageHeight ? `${imageHeight}px` : 'auto',\n objectFit: 'contain', // Ensures full image is visible, no cropping\n display: 'block', // Prevents inline whitespace issue\n margin: '0 auto', // Centers the image in the div\n }}\n />\n )}\n </div>\n );\n};\n"]}
|
|
@@ -82,10 +82,14 @@ class RoomstayThemeEngine {
|
|
|
82
82
|
this.registerStyles(newCompany.colors);
|
|
83
83
|
};
|
|
84
84
|
this.changeTheme = (profile) => __awaiter(this, void 0, void 0, function* () {
|
|
85
|
+
var _a;
|
|
85
86
|
const styleOverrides = this.createElementOrReuseExisting('style', 'engine-styles');
|
|
86
87
|
styleOverrides.setAttribute('rel', 'preload');
|
|
88
|
+
// Use :host when inside Shadow DOM, :root for light DOM
|
|
89
|
+
const isInShadowDom = ((_a = this.EngineContainer) === null || _a === void 0 ? void 0 : _a.getRootNode()) instanceof ShadowRoot;
|
|
90
|
+
const selector = isInShadowDom ? ':host' : ':root';
|
|
87
91
|
styleOverrides.innerHTML = `
|
|
88
|
-
|
|
92
|
+
${selector} {
|
|
89
93
|
${(0, Color_1.getAccentOverrideStyleContent)(profile)}
|
|
90
94
|
}`;
|
|
91
95
|
});
|
|
@@ -123,7 +127,8 @@ class RoomstayThemeEngine {
|
|
|
123
127
|
});
|
|
124
128
|
this.loadScript = (src, name, alwaysExecute = false, timeout = 5000) => new Promise((resolve, reject) => {
|
|
125
129
|
var _a;
|
|
126
|
-
|
|
130
|
+
// Always use document.head for scripts — they need document scope (especially in Shadow DOM)
|
|
131
|
+
const container = document.head;
|
|
127
132
|
const existingScript = container.querySelector(`script[name="roomstay-script-${name}"]`);
|
|
128
133
|
if (existingScript) {
|
|
129
134
|
if (alwaysExecute) {
|