@roomstay/frontend 2.1.16 → 2.1.18

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.
Files changed (80) hide show
  1. package/dist/201.bundle.js +1 -1
  2. package/dist/535.bundle.js +2 -0
  3. package/dist/559.bundle.js +1 -1
  4. package/dist/760.bundle.js +1 -1
  5. package/dist/882.bundle.js +1 -1
  6. package/dist/main.bundle.js +1 -1
  7. package/dist/src/api/AvailabilityAPI.d.ts +9 -0
  8. package/dist/src/api/AvailabilityAPI.js +12 -0
  9. package/dist/src/api/AvailabilityAPI.js.map +1 -1
  10. package/dist/src/components/generic/BookingWizard/BookingWizard.js.map +1 -1
  11. package/dist/src/components/generic/BookingWizard/BookingWizardContent.js +37 -0
  12. package/dist/src/components/generic/BookingWizard/BookingWizardContent.js.map +1 -1
  13. package/dist/src/components/generic/BookingWizard/BookingWizardContext.d.ts +1 -0
  14. package/dist/src/components/generic/BookingWizard/BookingWizardContext.js.map +1 -1
  15. package/dist/src/components/generic/BookingWizard/BookingWizardGuestSelector/BookingWizardGuestSelector.js +1 -1
  16. package/dist/src/components/generic/BookingWizard/BookingWizardGuestSelector/BookingWizardGuestSelector.js.map +1 -1
  17. package/dist/src/components/generic/BookingWizard/BookingWizardHotelSelector/BookingWizardHotelSelector.js +1 -0
  18. package/dist/src/components/generic/BookingWizard/BookingWizardHotelSelector/BookingWizardHotelSelector.js.map +1 -1
  19. package/dist/src/components/generic/BookingWizard/BookingWizardPromoCode/BookingWizardPromoCode.d.ts +8 -0
  20. package/dist/src/components/generic/BookingWizard/BookingWizardPromoCode/BookingWizardPromoCode.js +64 -0
  21. package/dist/src/components/generic/BookingWizard/BookingWizardPromoCode/BookingWizardPromoCode.js.map +1 -0
  22. package/dist/src/components/generic/PromoCodeInput.d.ts +1 -0
  23. package/dist/src/components/generic/PromoCodeInput.js +1 -1
  24. package/dist/src/components/generic/PromoCodeInput.js.map +1 -1
  25. package/dist/src/components/generic/Select/Select.js +1 -1
  26. package/dist/src/components/generic/Select/Select.js.map +1 -1
  27. package/dist/src/components/generic/TextBox.d.ts +1 -0
  28. package/dist/src/components/generic/TextBox.js +1 -1
  29. package/dist/src/components/generic/TextBox.js.map +1 -1
  30. package/dist/src/components/navigation/Header.js +15 -15
  31. package/dist/src/components/navigation/Header.js.map +1 -1
  32. package/dist/src/components/steps/addons/AddonCard.js +11 -11
  33. package/dist/src/components/steps/addons/AddonCard.js.map +1 -1
  34. package/dist/src/components/steps/confirmation/StepConfirmationAcknowledgement.d.ts +6 -3
  35. package/dist/src/components/steps/confirmation/StepConfirmationAcknowledgement.js +9 -19
  36. package/dist/src/components/steps/confirmation/StepConfirmationAcknowledgement.js.map +1 -1
  37. package/dist/src/components/steps/confirmation/StepConfirmationForm.js +28 -15
  38. package/dist/src/components/steps/confirmation/StepConfirmationForm.js.map +1 -1
  39. package/dist/src/components/steps/confirmation/additionalOffers/AdditionalOffersColumn.js +2 -1
  40. package/dist/src/components/steps/confirmation/additionalOffers/AdditionalOffersColumn.js.map +1 -1
  41. package/dist/src/components/steps/confirmation/additionalOffers/AdditionalOffersModal.js +10 -10
  42. package/dist/src/components/steps/confirmation/additionalOffers/AdditionalOffersModal.js.map +1 -1
  43. package/dist/src/components/steps/room/ImageGallerySlider.js +2 -1
  44. package/dist/src/components/steps/room/ImageGallerySlider.js.map +1 -1
  45. package/dist/src/components/steps/room/MemberSignInModal/MemberSignInModal.js +16 -17
  46. package/dist/src/components/steps/room/MemberSignInModal/MemberSignInModal.js.map +1 -1
  47. package/dist/src/components/steps/room/RoomListCrossSellBlock.js +17 -18
  48. package/dist/src/components/steps/room/RoomListCrossSellBlock.js.map +1 -1
  49. package/dist/src/contexts/ConfirmationStepContext/ConfirmationStepContextTypes.d.ts +1 -1
  50. package/dist/src/contexts/ConfirmationStepContext/ConfirmationStepContextTypes.js.map +1 -1
  51. package/dist/src/contexts/ConfirmationStepContext/ConfirmationStepContextWrapper.js +8 -9
  52. package/dist/src/contexts/ConfirmationStepContext/ConfirmationStepContextWrapper.js.map +1 -1
  53. package/dist/src/contexts/index.d.ts +22 -22
  54. package/dist/src/contexts/index.js +22 -22
  55. package/dist/src/contexts/index.js.map +1 -1
  56. package/dist/src/models/Client/Hotel/Hotel.d.ts +1 -0
  57. package/dist/src/models/Client/Hotel/Hotel.js.map +1 -1
  58. package/dist/src/models/Confirmation.d.ts +0 -2
  59. package/dist/src/models/Confirmation.js.map +1 -1
  60. package/dist/src/pages/findReservation/FindReservation.js +12 -12
  61. package/dist/src/pages/findReservation/FindReservation.js.map +1 -1
  62. package/dist/src/pages/hotel/HotelInfo.js +7 -8
  63. package/dist/src/pages/hotel/HotelInfo.js.map +1 -1
  64. package/dist/src/pages/steps/StepConfirmation/StepConfirmationComponent.js +2 -1
  65. package/dist/src/pages/steps/StepConfirmation/StepConfirmationComponent.js.map +1 -1
  66. package/dist/src/providers/ImageProvider.d.ts +2 -1
  67. package/dist/src/providers/ImageProvider.js +1 -0
  68. package/dist/src/providers/ImageProvider.js.map +1 -1
  69. package/dist/src/translations/Translation.d.ts +6 -0
  70. package/dist/src/translations/Translation.js +6 -0
  71. package/dist/src/translations/Translation.js.map +1 -1
  72. package/dist/src/translations/languages/en-gb.js +6 -0
  73. package/dist/src/translations/languages/en-gb.js.map +1 -1
  74. package/dist/src/util/Color.js +1 -1
  75. package/dist/src/util/Color.js.map +1 -1
  76. package/dist/test.bundle.js +1 -1
  77. package/dist/vendors.bundle.js +1 -1
  78. package/package.json +1 -1
  79. package/dist/399.bundle.js +0 -2
  80. /package/dist/{399.bundle.js.LICENSE.txt → 535.bundle.js.LICENSE.txt} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"ImageGallerySlider.js","sourceRoot":"/","sources":["src/components/steps/room/ImageGallerySlider.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,iCAA6C;AAE7C,yDAA4C;AAC5C,2CAAwD;AACxD,0EAA2C;AA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E,8BAAC,cAAI,IAAC,IAAI,EAAE,eAAQ,CAAC,WAAW,EAAE,KAAK,EAAE,aAAK,CAAC,KAAK,EAAE,IAAI,EAAC,MAAM,GAAG,CAClE,CACT,CACC,CACT,CAAC;AACN,CAAC;AAxJD,qCAwJC","sourcesContent":["import React from 'react';\nimport { useState, useContext } from 'react';\n\nimport { useDrag } from 'react-use-gesture';\nimport { useSpring, animated } from '@react-spring/web';\nimport useMeasure from 'react-use-measure';\nimport Icon, { IconType } from '@/components/generic/Icon/Icon';\nimport { Color } from '@/util/Color';\nimport FsLightbox from 'fslightbox-react';\n\nimport ScreenSize from '@/util/ScreenSize';\nimport { FullGestureState, StateKey } from 'react-use-gesture/dist/types';\nimport { ImageSize } from '@/providers/ImageProvider';\nimport ImageLoader from '@/components/generic/loader/ImageLoader';\nimport { createPortal } from 'react-dom';\nimport { BookingEngineContext } from '@frontend/contexts';\n\ninterface ImageGallerySliderProps {\n images: string[];\n\n imageSize?: ImageSize;\n hideLightboxIcon?: boolean;\n}\n\nexport default function ImageGallerySlider(props: ImageGallerySliderProps) {\n const context = useContext(BookingEngineContext);\n\n const [{ x }, set] = useSpring(() => ({ x: 0 }));\n const [ref, bounds] = useMeasure();\n const [prevReleasePosition, setPrevRelPos] = useState(0);\n const images = props.images ?? [];\n\n const [toggler, setToggler] = useState(false);\n const [lastReleaseX, setLastReleaseX] = useState(0);\n const [lastIndex, setLastIndex] = useState(0);\n\n const [isDragging, setIsDragging] = useState(false);\n\n let sliderVelocity = 0;\n\n const handleDrag = ({ down, movement: [mx], velocity }: FullGestureState<StateKey<'drag'>>) => {\n if (context.screenSize <= ScreenSize.Medium) {\n velocity = velocity * 0.5;\n sliderVelocity = velocity > 2 ? 2 : velocity < 1 ? 1 : velocity;\n } else {\n sliderVelocity = 1;\n }\n\n const cardWidth = bounds.width;\n const maxX = images.length * cardWidth;\n\n if (!down) {\n const releasePosition = lastReleaseX + mx * sliderVelocity;\n\n let restingLocation = 0;\n let last = 0;\n\n if (releasePosition > 0) {\n restingLocation = 0;\n last = 0;\n } else if (releasePosition < -(maxX - cardWidth)) {\n restingLocation = -(maxX - cardWidth);\n last = images.length - 1;\n } else {\n const magic = -releasePosition / cardWidth;\n if (releasePosition >= prevReleasePosition) {\n last = releasePosition % cardWidth > -cardWidth / 0.001 ? Math.floor(magic) : Math.ceil(magic);\n setPrevRelPos(releasePosition + (-releasePosition % cardWidth));\n restingLocation = -(last * cardWidth);\n } else {\n last = releasePosition % cardWidth > -cardWidth / 1000 ? Math.floor(magic) : Math.ceil(magic);\n setPrevRelPos(releasePosition - (cardWidth - (-releasePosition % cardWidth)));\n restingLocation = -(last * cardWidth);\n }\n }\n\n let inPercent = 0;\n if (restingLocation !== 0) {\n inPercent = restingLocation / maxX;\n }\n\n setLastIndex(last);\n set({ x: inPercent });\n setLastReleaseX(restingLocation);\n\n setTimeout(() => {\n setIsDragging(false);\n }, 50);\n } else {\n let inPercent = 0;\n const newReleasePx = lastReleaseX + mx;\n inPercent = newReleasePx / maxX;\n\n set({ x: inPercent });\n if (mx) {\n setIsDragging(true);\n }\n }\n };\n\n // Set the drag hook and define component movement based on gesture data\n const bind = useDrag((event) => {\n handleDrag(event);\n });\n\n const nextImage = () => {\n handleDrag({ down: false, movement: [-bounds.width, 0], velocity: 1 } as any);\n };\n\n const prevImage = () => {\n handleDrag({ down: false, movement: [bounds.width, 0], velocity: 1 } as any);\n };\n\n const onClickPrevImage = () => {\n return prevImage();\n };\n const toggleToggler = () => {\n return setToggler(!toggler);\n };\n const nextImageOnClick = () => {\n return nextImage();\n };\n const toggleClickHandler = () => {\n if (!isDragging) {\n setToggler(!toggler);\n }\n };\n\n return (\n <div ref={ref} className=\"room-gallery-slider\">\n {images.length > 1 && (\n <div className=\"room-gallery-slider__icon-left\" onClick={onClickPrevImage}>\n <Icon icon={IconType.ArrowLeft2} color={Color.White} size=\"24px\" />\n </div>\n )}\n <animated.div className=\"room-gallery-slider__animation\" {...bind()} style={{ left: x.to((perc) => `${perc * 100 * images.length}%`) }} onClick={toggleClickHandler}>\n <ul className=\"room-gallery-slider__track\" style={{ width: `${images.length * 100}%` }}>\n {images.map((image: any, index: number) => {\n return (\n <li\n key={index}\n className=\"room-gallery-slider__item\"\n style={{\n width: `${100 / images.length}%`,\n overflow: 'hidden',\n }}\n >\n <ImageLoader\n visible={lastIndex >= index}\n size={props.imageSize}\n draggable={false}\n src={image}\n style={{ objectFit: 'cover', objectPosition: 'center', height: '100%', width: '100%' }}\n />\n </li>\n );\n })}\n </ul>\n </animated.div>\n {!!images.length && (\n <>\n {!props.hideLightboxIcon && (\n <div className=\"room-gallery-slider__icon-lightbox\" onClick={toggleToggler}>\n <Icon icon={IconType.Fullscreen} color={Color.White} size=\"20px\" />\n </div>\n )}\n {createPortal(<FsLightbox toggler={toggler} sources={images} type=\"image\" loadOnlyCurrentSource />, document.body)}\n </>\n )}\n {images.length > 1 && (\n <div className=\"room-gallery-slider__icon-right\" onClick={nextImageOnClick}>\n <Icon icon={IconType.ArrowRight2} color={Color.White} size=\"24px\" />\n </div>\n )}\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"ImageGallerySlider.js","sourceRoot":"/","sources":["src/components/steps/room/ImageGallerySlider.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,iCAA6C;AAE7C,yDAA4C;AAC5C,2CAAwD;AACxD,0EAA2C;AAC3C,uEAAgE;AAChE,wCAAqC;AACrC,wEAA0C;AAE1C,mEAA2C;AAE3C,2EAAqE;AACrE,0FAAkE;AAClE,yCAAyC;AACzC,iDAA0D;AAS1D,SAAwB,kBAAkB,CAAC,KAA8B;;IACrE,MAAM,OAAO,GAAG,IAAA,kBAAU,EAAC,+BAAoB,CAAC,CAAC;IAEjD,MAAM,CAAC,EAAE,CAAC,EAAE,EAAE,GAAG,CAAC,GAAG,IAAA,eAAS,EAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,C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rag } from 'react-use-gesture';\nimport { useSpring, animated } from '@react-spring/web';\nimport useMeasure from 'react-use-measure';\nimport Icon, { IconType } from '@/components/generic/Icon/Icon';\nimport { Color } from '@/util/Color';\nimport FsLightbox from 'fslightbox-react';\n\nimport ScreenSize from '@/util/ScreenSize';\nimport { FullGestureState, StateKey } from 'react-use-gesture/dist/types';\nimport ImageProvider, { ImageSize } from '@/providers/ImageProvider';\nimport ImageLoader from '@/components/generic/loader/ImageLoader';\nimport { createPortal } from 'react-dom';\nimport { BookingEngineContext } from '@frontend/contexts';\n\ninterface ImageGallerySliderProps {\n images: string[];\n\n imageSize?: ImageSize;\n hideLightboxIcon?: boolean;\n}\n\nexport default function ImageGallerySlider(props: ImageGallerySliderProps) {\n const context = useContext(BookingEngineContext);\n\n const [{ x }, set] = useSpring(() => ({ x: 0 }));\n const [ref, bounds] = useMeasure();\n const [prevReleasePosition, setPrevRelPos] = useState(0);\n const images = props.images ?? [];\n\n const [toggler, setToggler] = useState(false);\n const [lastReleaseX, setLastReleaseX] = useState(0);\n const [lastIndex, setLastIndex] = useState(0);\n\n const [isDragging, setIsDragging] = useState(false);\n\n let sliderVelocity = 0;\n\n const handleDrag = ({ down, movement: [mx], velocity }: FullGestureState<StateKey<'drag'>>) => {\n if (context.screenSize <= ScreenSize.Medium) {\n velocity = velocity * 0.5;\n sliderVelocity = velocity > 2 ? 2 : velocity < 1 ? 1 : velocity;\n } else {\n sliderVelocity = 1;\n }\n\n const cardWidth = bounds.width;\n const maxX = images.length * cardWidth;\n\n if (!down) {\n const releasePosition = lastReleaseX + mx * sliderVelocity;\n\n let restingLocation = 0;\n let last = 0;\n\n if (releasePosition > 0) {\n restingLocation = 0;\n last = 0;\n } else if (releasePosition < -(maxX - cardWidth)) {\n restingLocation = -(maxX - cardWidth);\n last = images.length - 1;\n } else {\n const magic = -releasePosition / cardWidth;\n if (releasePosition >= prevReleasePosition) {\n last = releasePosition % cardWidth > -cardWidth / 0.001 ? Math.floor(magic) : Math.ceil(magic);\n setPrevRelPos(releasePosition + (-releasePosition % cardWidth));\n restingLocation = -(last * cardWidth);\n } else {\n last = releasePosition % cardWidth > -cardWidth / 1000 ? Math.floor(magic) : Math.ceil(magic);\n setPrevRelPos(releasePosition - (cardWidth - (-releasePosition % cardWidth)));\n restingLocation = -(last * cardWidth);\n }\n }\n\n let inPercent = 0;\n if (restingLocation !== 0) {\n inPercent = restingLocation / maxX;\n }\n\n setLastIndex(last);\n set({ x: inPercent });\n setLastReleaseX(restingLocation);\n\n setTimeout(() => {\n setIsDragging(false);\n }, 50);\n } else {\n let inPercent = 0;\n const newReleasePx = lastReleaseX + mx;\n inPercent = newReleasePx / maxX;\n\n set({ x: inPercent });\n if (mx) {\n setIsDragging(true);\n }\n }\n };\n\n // Set the drag hook and define component movement based on gesture data\n const bind = useDrag((event) => {\n handleDrag(event);\n });\n\n const nextImage = () => {\n handleDrag({ down: false, movement: [-bounds.width, 0], velocity: 1 } as any);\n };\n\n const prevImage = () => {\n handleDrag({ down: false, movement: [bounds.width, 0], velocity: 1 } as any);\n };\n\n const onClickPrevImage = () => {\n return prevImage();\n };\n const toggleToggler = () => {\n return setToggler(!toggler);\n };\n const nextImageOnClick = () => {\n return nextImage();\n };\n const toggleClickHandler = () => {\n if (!isDragging) {\n setToggler(!toggler);\n }\n };\n\n return (\n <div ref={ref} className=\"room-gallery-slider\">\n {images.length > 1 && (\n <div className=\"room-gallery-slider__icon-left\" onClick={onClickPrevImage}>\n <Icon icon={IconType.ArrowLeft2} color={Color.White} size=\"24px\" />\n </div>\n )}\n <animated.div className=\"room-gallery-slider__animation\" {...bind()} style={{ left: x.to((perc) => `${perc * 100 * images.length}%`) }} onClick={toggleClickHandler}>\n <ul className=\"room-gallery-slider__track\" style={{ width: `${images.length * 100}%` }}>\n {images.map((image: any, index: number) => {\n return (\n <li\n key={index}\n className=\"room-gallery-slider__item\"\n style={{\n width: `${100 / images.length}%`,\n overflow: 'hidden',\n }}\n >\n <ImageLoader\n visible={lastIndex >= index}\n size={props.imageSize}\n draggable={false}\n src={image}\n style={{ objectFit: 'cover', objectPosition: 'center', height: '100%', width: '100%' }}\n />\n </li>\n );\n })}\n </ul>\n </animated.div>\n {!!images.length && (\n <>\n {!props.hideLightboxIcon && (\n <div className=\"room-gallery-slider__icon-lightbox\" onClick={toggleToggler}>\n <Icon icon={IconType.Fullscreen} color={Color.White} size=\"20px\" />\n </div>\n )}\n {createPortal(\n <FsLightbox toggler={toggler} sources={images.map((image) => ImageProvider.resizeImage(image, ImageSize.Original))} type=\"image\" loadOnlyCurrentSource />,\n document.body\n )}\n </>\n )}\n {images.length > 1 && (\n <div className=\"room-gallery-slider__icon-right\" onClick={nextImageOnClick}>\n <Icon icon={IconType.ArrowRight2} color={Color.White} size=\"24px\" />\n </div>\n )}\n </div>\n );\n}\n"]}
@@ -52,8 +52,7 @@ const Color_1 = require("../../../../util/Color");
52
52
  const Headline_1 = __importDefault(require("../../../generic/Headline"));
53
53
  const Text_1 = __importStar(require("../../../generic/Text"));
54
54
  const BEButton_1 = __importDefault(require("../../../generic/BEButton"));
55
- const react_1 = __importDefault(require("react"));
56
- const react_2 = require("react");
55
+ const react_1 = __importStar(require("react"));
57
56
  const TextBox_1 = __importDefault(require("../../../generic/TextBox"));
58
57
  const react_hook_form_1 = require("react-hook-form");
59
58
  const BookingAPI_1 = __importDefault(require("../../../../api/BookingAPI"));
@@ -64,10 +63,10 @@ const Sentry = __importStar(require("@sentry/browser"));
64
63
  const Translation_1 = require("translations/Translation");
65
64
  const react_i18next_1 = require("react-i18next");
66
65
  const hooks_1 = require("../../../../hooks/index.js");
67
- const contexts_2 = require("../../../../contexts/index.js");
68
66
  const InputGroup_1 = __importDefault(require("../../../generic/InputGroup/InputGroup"));
69
67
  const RoomstayThemeEngine_1 = __importDefault(require("../../../../providers/RoomstayThemeEngine"));
70
68
  const Validation_1 = require("../../../../util/Validation");
69
+ const ImageProvider_1 = __importStar(require("../../../../providers/ImageProvider"));
71
70
  const MemberOnlyModalDefaultInputs = {
72
71
  Lines: [
73
72
  {
@@ -109,19 +108,19 @@ const MemberOnlyModalDefaultInputs = {
109
108
  function MemberSignInModal(props) {
110
109
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
111
110
  const { t } = (0, react_i18next_1.useTranslation)();
112
- const context = (0, react_2.useContext)(contexts_1.BookingEngineContext);
113
- const basketContext = (0, react_2.useContext)(contexts_1.BasketContext);
114
- const ccx = (0, react_2.useContext)(contexts_2.CompanyContext);
111
+ const context = (0, react_1.useContext)(contexts_1.BookingEngineContext);
112
+ const basketContext = (0, react_1.useContext)(contexts_1.BasketContext);
113
+ const ccx = (0, react_1.useContext)(contexts_1.CompanyContext);
115
114
  const { hotel } = (0, hooks_1.useCurrentHotel)();
116
- const [isLoading, setIsLoading] = (0, react_2.useState)(false);
117
- const [showErrors, setShowErrors] = (0, react_2.useState)(false);
118
- const [captchaScriptLoaded, setCaptchaScriptLoaded] = (0, react_2.useState)(false);
119
- const [captchaRendered, setCaptchaRendered] = (0, react_2.useState)(false);
120
- const [reCaptchaSecret, setReCaptchaSecret] = (0, react_2.useState)(null);
121
- const [captchaError, setCaptchaError] = (0, react_2.useState)(null);
122
- const captchaRef = (0, react_2.useRef)(null);
115
+ const [isLoading, setIsLoading] = (0, react_1.useState)(false);
116
+ const [showErrors, setShowErrors] = (0, react_1.useState)(false);
117
+ const [captchaScriptLoaded, setCaptchaScriptLoaded] = (0, react_1.useState)(false);
118
+ const [captchaRendered, setCaptchaRendered] = (0, react_1.useState)(false);
119
+ const [reCaptchaSecret, setReCaptchaSecret] = (0, react_1.useState)(null);
120
+ const [captchaError, setCaptchaError] = (0, react_1.useState)(null);
121
+ const captchaRef = (0, react_1.useRef)(null);
123
122
  const shouldLoadCaptcha = !!((_a = hotel === null || hotel === void 0 ? void 0 : hotel.googleReCaptcha) === null || _a === void 0 ? void 0 : _a.loadForMembers) && !!((_b = hotel === null || hotel === void 0 ? void 0 : hotel.googleReCaptcha) === null || _b === void 0 ? void 0 : _b.siteKey);
124
- (0, react_2.useEffect)(() => {
123
+ (0, react_1.useEffect)(() => {
125
124
  let cancelled = false;
126
125
  if (shouldLoadCaptcha) {
127
126
  RoomstayThemeEngine_1.default.loadScript('https://www.google.com/recaptcha/api.js', 'Google ReCaptcha').then(() => {
@@ -141,7 +140,7 @@ function MemberSignInModal(props) {
141
140
  cancelled = true;
142
141
  };
143
142
  }, [hotel]);
144
- (0, react_2.useEffect)(() => {
143
+ (0, react_1.useEffect)(() => {
145
144
  if (shouldLoadCaptcha && captchaScriptLoaded && (captchaRef === null || captchaRef === void 0 ? void 0 : captchaRef.current) && !captchaRendered && props.isOpen) {
146
145
  try {
147
146
  setTimeout(() => {
@@ -163,7 +162,7 @@ function MemberSignInModal(props) {
163
162
  }
164
163
  }
165
164
  }, [props.isOpen, captchaScriptLoaded, captchaRef, captchaRef === null || captchaRef === void 0 ? void 0 : captchaRef.current, captchaRendered]);
166
- (0, react_2.useEffect)(() => {
165
+ (0, react_1.useEffect)(() => {
167
166
  if (!props.isOpen) {
168
167
  setReCaptchaSecret(null);
169
168
  setCaptchaError(null);
@@ -254,7 +253,7 @@ function MemberSignInModal(props) {
254
253
  return (react_1.default.createElement(SimpleModal_1.default, { open: props.isOpen, onClose: loadingOnClose, size: SimpleModal_1.SimpleModalSize.Normal, alignCenter: true },
255
254
  react_1.default.createElement("div", { className: "row" },
256
255
  react_1.default.createElement("div", { className: "col-md-6 u-mh-none", style: {
257
- background: 'url("' + modalLeadImage + '")',
256
+ background: 'url("' + (modalLeadImage && ImageProvider_1.default.resizeImage(modalLeadImage, ImageProvider_1.ImageSize.Original)) + '")',
258
257
  backgroundRepeat: 'no-repeat',
259
258
  backgroundPosition: 'center',
260
259
  backgroundSize: 'cover',
@@ -1 +1 @@
1
- {"version":3,"file":"MemberSignInModal.js","sourceRoot":"/","sources":["src/components/steps/room/MemberSignInModal/MemberSignInModal.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;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modal/SimpleModal';\nimport Icon, { IconType } from '@/components/generic/Icon/Icon';\nimport { Color } from '@/util/Color';\nimport Headline from '@/components/generic/Headline';\nimport Text, { TextType } from '@/components/generic/Text';\nimport BEButton from '@/components/generic/BEButton';\nimport React from 'react';\nimport { useContext, useState, useEffect, useRef } from 'react';\nimport TextBox from '@/components/generic/TextBox';\nimport { FormProvider, useForm } from 'react-hook-form';\nimport API from '@/api/BookingAPI';\nimport { ErrorHandler } from 'contexts/ErrorContext';\nimport { BasketContext, BookingEngineContext } from '@frontend/contexts';\nimport ScreenSize from '@/util/ScreenSize';\nimport * as Sentry from '@sentry/browser';\nimport { Translation } from 'translations/Translation';\nimport { useTranslation } from 'react-i18next';\n\nimport { useCurrentHotel } from '@frontend/hooks';\n\nimport { CompanyContext } from '@frontend/contexts';\nimport InputGroup from '@/components/generic/InputGroup/InputGroup';\nimport { MemberOnlyModalInputs } from '@/components/steps/room/MemberSignInModal/MemberSignInModal.types';\nimport RoomstayThemeEngine from '@/providers/RoomstayThemeEngine';\nimport { EMAIL_REGEX } from '@/util/Validation';\n\ninterface MemberSignInModalProps {\n onClose?: () => void;\n isOpen?: boolean;\n}\n\nconst MemberOnlyModalDefaultInputs: MemberOnlyModalInputs = {\n Lines: [\n {\n Dimension: '2/2',\n Inputs: [\n {\n name: 'FirstName',\n type: 'TextBox',\n placeholder: 'First Name',\n isRequired: true,\n },\n {\n name: 'LastName',\n type: 'TextBox',\n placeholder: 'Last Name',\n isRequired: true,\n },\n ],\n },\n {\n Dimension: '1',\n Inputs: [\n {\n name: 'Email',\n type: 'TextBox',\n placeholder: 'Email Address',\n isRequired: true,\n validate: (input: string) => {\n if (!input.match(EMAIL_REGEX)) {\n return 'Invalid Email Address';\n }\n return true;\n },\n },\n ],\n },\n ],\n};\n\nexport default function MemberSignInModal(props: MemberSignInModalProps) {\n const { t } = useTranslation();\n\n const context = useContext(BookingEngineContext);\n const basketContext = useContext(BasketContext);\n const ccx = useContext(CompanyContext);\n\n const { hotel } = useCurrentHotel();\n\n const [isLoading, setIsLoading] = useState(false);\n const [showErrors, setShowErrors] = useState(false);\n\n const [captchaScriptLoaded, setCaptchaScriptLoaded] = useState(false);\n const [captchaRendered, setCaptchaRendered] = useState(false);\n const [reCaptchaSecret, setReCaptchaSecret] = useState<string | null>(null);\n const [captchaError, setCaptchaError] = useState<string | null | undefined>(null);\n\n const captchaRef = useRef(null);\n\n const shouldLoadCaptcha = !!hotel?.googleReCaptcha?.loadForMembers && !!hotel?.googleReCaptcha?.siteKey;\n\n useEffect(() => {\n let cancelled = false;\n\n if (shouldLoadCaptcha) {\n RoomstayThemeEngine.loadScript('https://www.google.com/recaptcha/api.js', 'Google ReCaptcha').then(() => {\n try {\n (window as any).grecaptcha.ready(() => {\n if (!cancelled) {\n setCaptchaScriptLoaded(true);\n }\n });\n } catch (ex) {\n console.log('Captcha loaded too quickly, will try again');\n }\n });\n }\n\n return () => {\n cancelled = true;\n };\n }, [hotel]);\n\n useEffect(() => {\n if (shouldLoadCaptcha && captchaScriptLoaded && captchaRef?.current && !captchaRendered && props.isOpen) {\n try {\n setTimeout(() => {\n const captchaCallback = (secret: string) => {\n setReCaptchaSecret(secret);\n setCaptchaError(undefined);\n };\n\n (window as any).grecaptcha.render(captchaRef.current, {\n sitekey: hotel.googleReCaptcha?.siteKey,\n callback: captchaCallback,\n });\n\n setCaptchaRendered(true);\n }, 5);\n } catch (ex) {\n console.log(ex);\n\n Sentry.captureException(ex);\n }\n }\n }, [props.isOpen, captchaScriptLoaded, captchaRef, captchaRef?.current, captchaRendered]);\n\n useEffect(() => {\n if (!props.isOpen) {\n setReCaptchaSecret(null);\n setCaptchaError(null);\n setCaptchaRendered(false);\n }\n }, [props.isOpen]);\n\n const getValidationClass = (name: string) => {\n if (errors && (formState.touchedFields[name] || showErrors)) {\n if (errors[name]) {\n return 'error';\n } else {\n return 'success';\n }\n }\n };\n\n const methods = useForm({\n mode: 'onChange',\n });\n\n const { formState, register } = methods;\n const errors = methods.formState.errors;\n\n const onSubmit = async () => {\n if (shouldLoadCaptcha && (!reCaptchaSecret || reCaptchaSecret === '')) {\n setCaptchaError(t(Translation.MemberOnlyPopup.Errors.ReCaptcha.PleaseTick));\n return;\n }\n\n await signUpMember();\n };\n\n const signUpMember = async () => {\n setIsLoading(true);\n const { FirstName, LastName, Email, ...extra } = methods.getValues();\n\n if (!FirstName || !LastName || !Email) {\n setIsLoading(false);\n ErrorHandler.add({\n title: 'Required fields in the Member Signup are missing.',\n message: 'First Name, Last Name, and Email Mandatory Fields, make sure that these fields are present to avoid loss of data.',\n });\n\n return;\n }\n\n try {\n const extraFields = Object.keys(extra).map((extraFieldKey: string) => {\n return { name: extraFieldKey, value: extra[extraFieldKey] };\n });\n\n const response = await API.Member.addMember(FirstName, LastName, Email, extraFields, hotel?.hotelID as string, reCaptchaSecret as string);\n\n if (response.error) {\n setCaptchaError(t(Translation.MemberOnlyPopup.Errors.ReCaptcha.ValidationError));\n } else {\n ccx.signUserIn(Email);\n\n if (hotel?.memberOnlyPromoCode && !ccx.memberOnlyModalPromotion?.memberOnlyDisableDefaultPromo) {\n basketContext.currentBasketRows?.forEach((row) => {\n row.setPromoCode(hotel?.memberOnlyPromoCode as string);\n basketContext.updateBasketRow(row);\n });\n }\n }\n } catch (e) {\n ErrorHandler.add({\n title: t(Translation.MemberOnlyPopup.Errors.SignupFailed.Title),\n message: t(Translation.MemberOnlyPopup.Errors.SignupFailed.Message),\n });\n } finally {\n setIsLoading(false);\n }\n };\n\n const modalInputs: MemberOnlyModalInputs = hotel?.memberOnlySignupInputs ?? MemberOnlyModalDefaultInputs;\n\n const loadingOnClose = () => {\n setIsLoading(false);\n if (props.onClose) {\n props.onClose();\n }\n };\n const buttonOnClickHandler = async () => {\n await methods.handleSubmit(onSubmit)();\n setShowErrors(true);\n\n return false;\n };\n\n const modalTitle =\n ccx?.memberOnlyModalPromotion?.memberOnlyModalTitle ??\n t(Translation.MemberOnlyPopup.Headline, {\n companyShort: ccx?.companyShort,\n });\n\n const modalSubtitle = ccx?.memberOnlyModalPromotion?.memberOnlyModalSubtitle ?? t(Translation.MemberOnlyPopup.Subtitle);\n\n const modalButtonText = ccx?.memberOnlyModalPromotion?.memberOnlyModalButtonText ?? t(Translation.MemberOnlyPopup.SubmitButtonText);\n const modalLeadImage = ccx?.memberOnlyModalPromotion?.memberOnlyModalImage ?? hotel?.heroImage;\n\n const modalPrimaryColor = hotel?.memberOnlyModalUsePrimaryColor ? Color.Accent : Color.Success;\n\n return (\n <SimpleModal open={props.isOpen} onClose={loadingOnClose} size={SimpleModalSize.Normal} alignCenter>\n <div className=\"row\">\n <div\n className=\"col-md-6 u-mh-none\"\n style={{\n background: 'url(\"' + modalLeadImage + '\")',\n backgroundRepeat: 'no-repeat',\n backgroundPosition: 'center',\n backgroundSize: 'cover',\n }}\n />\n <div className=\"col-md-6\">\n <div className=\"u-pad u-pad-heavy@m-\">\n <div className=\"u-marg-bottom-half\">\n <Icon\n icon={IconType.Money}\n size=\"24px\"\n color={modalPrimaryColor}\n useColorAsBackground={hotel?.memberOnlyModalUsePrimaryColor}\n backgroundColor={Color.SuccessTint}\n />\n </div>\n <div className=\"u-marg-bottom-half\">\n <Headline bold color={modalPrimaryColor}>\n <div\n style={{ color: modalPrimaryColor }}\n dangerouslySetInnerHTML={{\n __html: modalTitle as string,\n }}\n ></div>\n </Headline>\n </div>\n <div className=\"u-marg-bottom\">\n <Text type={TextType.Small} color={Color.DarkGrey}>\n <span dangerouslySetInnerHTML={{ __html: modalSubtitle as string }}></span>\n </Text>\n </div>\n <FormProvider {...methods}>\n <div>\n {modalInputs.Lines.map((inputLine, lineIndex) => {\n return (\n <InputGroup dimensions={inputLine.Dimension} key={lineIndex}>\n {inputLine.Inputs.map((input, inputIndex) => {\n switch (input.type) {\n case 'TextBox':\n return (\n <TextBox\n key={inputIndex}\n wide\n placeholder={input.placeholder}\n required={input.isRequired}\n validationStatus={getValidationClass(input.name)}\n {...register(input.name, {\n required: input.isRequired,\n validate: input.validate,\n })}\n />\n );\n }\n })}\n </InputGroup>\n );\n })}\n </div>\n <div className=\"u-marg-top--light\" style={{ marginBottom: '45px' }}>\n {captchaScriptLoaded && (\n <>\n {captchaError && (\n <Text type={TextType.Label} color={Color.Alert}>\n {captchaError}\n </Text>\n )}\n <div ref={captchaRef} className=\"u-marg-bottom\"></div>\n </>\n )}\n <BEButton\n size=\"normal\"\n filled\n primary={hotel?.memberOnlyModalUsePrimaryColor}\n success={!hotel?.memberOnlyModalUsePrimaryColor}\n isLoading={isLoading}\n stopIconAnimation\n icon={context.screenSize > ScreenSize.Mobile ? IconType.ArrowRight : undefined}\n onClick={buttonOnClickHandler}\n >\n {modalButtonText}\n </BEButton>\n </div>\n </FormProvider>\n <Text type={TextType.Label} color={Color.DarkGrey}>\n <span dangerouslySetInnerHTML={{ __html: t(Translation.MemberOnlyPopup.AgreeToReceiveDeals, { companyShort: ccx?.companyShort }) }}></span>\n </Text>{' '}\n <Text type={TextType.Label} color={Color.DarkGrey}>\n <span dangerouslySetInnerHTML={{ __html: t(Translation.MemberOnlyPopup.UnsubscribeAnytime) }}></span>\n </Text>\n </div>\n </div>\n </div>\n </SimpleModal>\n );\n}\n"]}
1
+ {"version":3,"file":"MemberSignInModal.js","sourceRoot":"/","sources":["src/components/steps/room/MemberSignInModal/MemberSignInModal.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sFAAsF;AACtF,uEAAgE;AAChE,wCAAqC;AACrC,6EAAqD;AACrD,kEAA2D;AAC3D,6EAAqD;AACrD,+CAAuE;AACvE,2EAAmD;AACnD,qDAAwD;AACxD,kEAAmC;AACnC,wDAAqD;AACrD,iDAAyF;AACzF,mEAA2C;AAC3C,wDAA0C;AAC1C,0DAAuD;AACvD,iDAA+C;AAE/C,2CAAkD;AAClD,4FAAoE;AAEpE,0FAAkE;AAClE,kDAAgD;AAChD,2EAAqE;AAOrE,MAAM,4BAA4B,GAA0B;I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L,KAAK,CAAE,8BAA8B,EAC9C,OAAO,EAAE,CAAC,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,8BAA8B,CAAA,EAC/C,SAAS,EAAE,SAAS,EACpB,iBAAiB,QACjB,IAAI,EAAE,OAAO,CAAC,UAAU,GAAG,oBAAU,CAAC,MAAM,CAAC,CAAC,CAAC,eAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,EAC9E,OAAO,EAAE,oBAAoB,IAE5B,eAAe,CACT,CACT,CACK;oBACf,8BAAC,cAAI,IAAC,IAAI,EAAE,eAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,aAAK,CAAC,QAAQ;wBAC7C,wCAAM,uBAAuB,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,yBAAW,CAAC,eAAe,CAAC,mBAAmB,EAAE,EAAE,YAAY,EAAE,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,YAAY,EAAE,CAAC,EAAE,GAAS,CACxI;oBAAC,GAAG;oBACX,8BAAC,cAAI,IAAC,IAAI,EAAE,eAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,aAAK,CAAC,QAAQ;wBAC7C,wCAAM,uBAAuB,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,yBAAW,CAAC,eAAe,CAAC,kBAAkB,CAAC,EAAE,GAAS,CAClG,CACL,CACJ,CACJ,CACI,CACjB,CAAC;AACN,CAAC;AAjRD,oCAiRC","sourcesContent":["import SimpleModal, { SimpleModalSize } from '@/components/generic/modal/SimpleModal';\nimport Icon, { IconType } from '@/components/generic/Icon/Icon';\nimport { Color } from '@/util/Color';\nimport Headline from '@/components/generic/Headline';\nimport Text, { TextType } from '@/components/generic/Text';\nimport BEButton from '@/components/generic/BEButton';\nimport React, { useContext, useEffect, useRef, useState } from 'react';\nimport TextBox from '@/components/generic/TextBox';\nimport { FormProvider, useForm } from 'react-hook-form';\nimport API from '@/api/BookingAPI';\nimport { ErrorHandler } from 'contexts/ErrorContext';\nimport { BasketContext, BookingEngineContext, CompanyContext } from '@frontend/contexts';\nimport ScreenSize from '@/util/ScreenSize';\nimport * as Sentry from '@sentry/browser';\nimport { Translation } from 'translations/Translation';\nimport { useTranslation } from 'react-i18next';\n\nimport { useCurrentHotel } from '@frontend/hooks';\nimport InputGroup from '@/components/generic/InputGroup/InputGroup';\nimport { MemberOnlyModalInputs } from '@/components/steps/room/MemberSignInModal/MemberSignInModal.types';\nimport RoomstayThemeEngine from '@/providers/RoomstayThemeEngine';\nimport { EMAIL_REGEX } from '@/util/Validation';\nimport ImageProvider, { ImageSize } from '@/providers/ImageProvider';\n\ninterface MemberSignInModalProps {\n onClose?: () => void;\n isOpen?: boolean;\n}\n\nconst MemberOnlyModalDefaultInputs: MemberOnlyModalInputs = {\n Lines: [\n {\n Dimension: '2/2',\n Inputs: [\n {\n name: 'FirstName',\n type: 'TextBox',\n placeholder: 'First Name',\n isRequired: true,\n },\n {\n name: 'LastName',\n type: 'TextBox',\n placeholder: 'Last Name',\n isRequired: true,\n },\n ],\n },\n {\n Dimension: '1',\n Inputs: [\n {\n name: 'Email',\n type: 'TextBox',\n placeholder: 'Email Address',\n isRequired: true,\n validate: (input: string) => {\n if (!input.match(EMAIL_REGEX)) {\n return 'Invalid Email Address';\n }\n return true;\n },\n },\n ],\n },\n ],\n};\n\nexport default function MemberSignInModal(props: MemberSignInModalProps) {\n const { t } = useTranslation();\n\n const context = useContext(BookingEngineContext);\n const basketContext = useContext(BasketContext);\n const ccx = useContext(CompanyContext);\n\n const { hotel } = useCurrentHotel();\n\n const [isLoading, setIsLoading] = useState(false);\n const [showErrors, setShowErrors] = useState(false);\n\n const [captchaScriptLoaded, setCaptchaScriptLoaded] = useState(false);\n const [captchaRendered, setCaptchaRendered] = useState(false);\n const [reCaptchaSecret, setReCaptchaSecret] = useState<string | null>(null);\n const [captchaError, setCaptchaError] = useState<string | null | undefined>(null);\n\n const captchaRef = useRef(null);\n\n const shouldLoadCaptcha = !!hotel?.googleReCaptcha?.loadForMembers && !!hotel?.googleReCaptcha?.siteKey;\n\n useEffect(() => {\n let cancelled = false;\n\n if (shouldLoadCaptcha) {\n RoomstayThemeEngine.loadScript('https://www.google.com/recaptcha/api.js', 'Google ReCaptcha').then(() => {\n try {\n (window as any).grecaptcha.ready(() => {\n if (!cancelled) {\n setCaptchaScriptLoaded(true);\n }\n });\n } catch (ex) {\n console.log('Captcha loaded too quickly, will try again');\n }\n });\n }\n\n return () => {\n cancelled = true;\n };\n }, [hotel]);\n\n useEffect(() => {\n if (shouldLoadCaptcha && captchaScriptLoaded && captchaRef?.current && !captchaRendered && props.isOpen) {\n try {\n setTimeout(() => {\n const captchaCallback = (secret: string) => {\n setReCaptchaSecret(secret);\n setCaptchaError(undefined);\n };\n\n (window as any).grecaptcha.render(captchaRef.current, {\n sitekey: hotel.googleReCaptcha?.siteKey,\n callback: captchaCallback,\n });\n\n setCaptchaRendered(true);\n }, 5);\n } catch (ex) {\n console.log(ex);\n\n Sentry.captureException(ex);\n }\n }\n }, [props.isOpen, captchaScriptLoaded, captchaRef, captchaRef?.current, captchaRendered]);\n\n useEffect(() => {\n if (!props.isOpen) {\n setReCaptchaSecret(null);\n setCaptchaError(null);\n setCaptchaRendered(false);\n }\n }, [props.isOpen]);\n\n const getValidationClass = (name: string) => {\n if (errors && (formState.touchedFields[name] || showErrors)) {\n if (errors[name]) {\n return 'error';\n } else {\n return 'success';\n }\n }\n };\n\n const methods = useForm({\n mode: 'onChange',\n });\n\n const { formState, register } = methods;\n const errors = methods.formState.errors;\n\n const onSubmit = async () => {\n if (shouldLoadCaptcha && (!reCaptchaSecret || reCaptchaSecret === '')) {\n setCaptchaError(t(Translation.MemberOnlyPopup.Errors.ReCaptcha.PleaseTick));\n return;\n }\n\n await signUpMember();\n };\n\n const signUpMember = async () => {\n setIsLoading(true);\n const { FirstName, LastName, Email, ...extra } = methods.getValues();\n\n if (!FirstName || !LastName || !Email) {\n setIsLoading(false);\n ErrorHandler.add({\n title: 'Required fields in the Member Signup are missing.',\n message: 'First Name, Last Name, and Email Mandatory Fields, make sure that these fields are present to avoid loss of data.',\n });\n\n return;\n }\n\n try {\n const extraFields = Object.keys(extra).map((extraFieldKey: string) => {\n return { name: extraFieldKey, value: extra[extraFieldKey] };\n });\n\n const response = await API.Member.addMember(FirstName, LastName, Email, extraFields, hotel?.hotelID as string, reCaptchaSecret as string);\n\n if (response.error) {\n setCaptchaError(t(Translation.MemberOnlyPopup.Errors.ReCaptcha.ValidationError));\n } else {\n ccx.signUserIn(Email);\n\n if (hotel?.memberOnlyPromoCode && !ccx.memberOnlyModalPromotion?.memberOnlyDisableDefaultPromo) {\n basketContext.currentBasketRows?.forEach((row) => {\n row.setPromoCode(hotel?.memberOnlyPromoCode as string);\n basketContext.updateBasketRow(row);\n });\n }\n }\n } catch (e) {\n ErrorHandler.add({\n title: t(Translation.MemberOnlyPopup.Errors.SignupFailed.Title),\n message: t(Translation.MemberOnlyPopup.Errors.SignupFailed.Message),\n });\n } finally {\n setIsLoading(false);\n }\n };\n\n const modalInputs: MemberOnlyModalInputs = hotel?.memberOnlySignupInputs ?? MemberOnlyModalDefaultInputs;\n\n const loadingOnClose = () => {\n setIsLoading(false);\n if (props.onClose) {\n props.onClose();\n }\n };\n const buttonOnClickHandler = async () => {\n await methods.handleSubmit(onSubmit)();\n setShowErrors(true);\n\n return false;\n };\n\n const modalTitle =\n ccx?.memberOnlyModalPromotion?.memberOnlyModalTitle ??\n t(Translation.MemberOnlyPopup.Headline, {\n companyShort: ccx?.companyShort,\n });\n\n const modalSubtitle = ccx?.memberOnlyModalPromotion?.memberOnlyModalSubtitle ?? t(Translation.MemberOnlyPopup.Subtitle);\n\n const modalButtonText = ccx?.memberOnlyModalPromotion?.memberOnlyModalButtonText ?? t(Translation.MemberOnlyPopup.SubmitButtonText);\n const modalLeadImage = ccx?.memberOnlyModalPromotion?.memberOnlyModalImage ?? hotel?.heroImage;\n\n const modalPrimaryColor = hotel?.memberOnlyModalUsePrimaryColor ? Color.Accent : Color.Success;\n\n return (\n <SimpleModal open={props.isOpen} onClose={loadingOnClose} size={SimpleModalSize.Normal} alignCenter>\n <div className=\"row\">\n <div\n className=\"col-md-6 u-mh-none\"\n style={{\n background: 'url(\"' + (modalLeadImage && ImageProvider.resizeImage(modalLeadImage, ImageSize.Original)) + '\")',\n backgroundRepeat: 'no-repeat',\n backgroundPosition: 'center',\n backgroundSize: 'cover',\n }}\n />\n <div className=\"col-md-6\">\n <div className=\"u-pad u-pad-heavy@m-\">\n <div className=\"u-marg-bottom-half\">\n <Icon\n icon={IconType.Money}\n size=\"24px\"\n color={modalPrimaryColor}\n useColorAsBackground={hotel?.memberOnlyModalUsePrimaryColor}\n backgroundColor={Color.SuccessTint}\n />\n </div>\n <div className=\"u-marg-bottom-half\">\n <Headline bold color={modalPrimaryColor}>\n <div\n style={{ color: modalPrimaryColor }}\n dangerouslySetInnerHTML={{\n __html: modalTitle as string,\n }}\n ></div>\n </Headline>\n </div>\n <div className=\"u-marg-bottom\">\n <Text type={TextType.Small} color={Color.DarkGrey}>\n <span dangerouslySetInnerHTML={{ __html: modalSubtitle as string }}></span>\n </Text>\n </div>\n <FormProvider {...methods}>\n <div>\n {modalInputs.Lines.map((inputLine, lineIndex) => {\n return (\n <InputGroup dimensions={inputLine.Dimension} key={lineIndex}>\n {inputLine.Inputs.map((input, inputIndex) => {\n switch (input.type) {\n case 'TextBox':\n return (\n <TextBox\n key={inputIndex}\n wide\n placeholder={input.placeholder}\n required={input.isRequired}\n validationStatus={getValidationClass(input.name)}\n {...register(input.name, {\n required: input.isRequired,\n validate: input.validate,\n })}\n />\n );\n }\n })}\n </InputGroup>\n );\n })}\n </div>\n <div className=\"u-marg-top--light\" style={{ marginBottom: '45px' }}>\n {captchaScriptLoaded && (\n <>\n {captchaError && (\n <Text type={TextType.Label} color={Color.Alert}>\n {captchaError}\n </Text>\n )}\n <div ref={captchaRef} className=\"u-marg-bottom\"></div>\n </>\n )}\n <BEButton\n size=\"normal\"\n filled\n primary={hotel?.memberOnlyModalUsePrimaryColor}\n success={!hotel?.memberOnlyModalUsePrimaryColor}\n isLoading={isLoading}\n stopIconAnimation\n icon={context.screenSize > ScreenSize.Mobile ? IconType.ArrowRight : undefined}\n onClick={buttonOnClickHandler}\n >\n {modalButtonText}\n </BEButton>\n </div>\n </FormProvider>\n <Text type={TextType.Label} color={Color.DarkGrey}>\n <span dangerouslySetInnerHTML={{ __html: t(Translation.MemberOnlyPopup.AgreeToReceiveDeals, { companyShort: ccx?.companyShort }) }}></span>\n </Text>{' '}\n <Text type={TextType.Label} color={Color.DarkGrey}>\n <span dangerouslySetInnerHTML={{ __html: t(Translation.MemberOnlyPopup.UnsubscribeAnytime) }}></span>\n </Text>\n </div>\n </div>\n </div>\n </SimpleModal>\n );\n}\n"]}
@@ -30,8 +30,7 @@ const Headline_1 = __importDefault(require("../../generic/Headline"));
30
30
  const Text_1 = __importStar(require("../../generic/Text"));
31
31
  const Color_1 = require("../../../util/Color");
32
32
  const Icon_1 = __importStar(require("../../generic/Icon/Icon"));
33
- const react_1 = __importDefault(require("react"));
34
- const react_2 = require("react");
33
+ const react_1 = __importStar(require("react"));
35
34
  const react_i18next_1 = require("react-i18next");
36
35
  const Translation_1 = require("translations/Translation");
37
36
  const ScreenSize_1 = __importDefault(require("../../../util/ScreenSize"));
@@ -40,19 +39,20 @@ const BookingAPI_1 = __importDefault(require("../../../api/BookingAPI"));
40
39
  const contexts_1 = require("../../../contexts/index.js");
41
40
  const BaseAPI_1 = require("../../../api/BaseAPI");
42
41
  const SmallSpinner_1 = __importDefault(require("../../generic/loader/SmallSpinner"));
42
+ const ImageProvider_1 = __importStar(require("../../../providers/ImageProvider"));
43
43
  function RoomListCrossSellBlock(props) {
44
44
  const { t } = (0, react_i18next_1.useTranslation)();
45
- const context = (0, react_2.useContext)(contexts_1.BookingEngineContext);
46
- const basketContext = (0, react_2.useContext)(contexts_1.BasketContext);
47
- const [isAvailable, setIsAvailable] = (0, react_2.useState)(false); // True if the dates were found with a calendar search
48
- const [isReallyAvailable, setIsReallyAvailable] = (0, react_2.useState)(true); // True if the dates were found with an availability search
49
- const [isLoading, setIsLoading] = (0, react_2.useState)(true);
50
- const [imageUrl, setImageUrl] = (0, react_2.useState)('');
51
- const [name, setName] = (0, react_2.useState)('');
52
- const [description, setDescription] = (0, react_2.useState)('');
53
- const [link, setLink] = (0, react_2.useState)('');
54
- const [rooms, setRooms] = (0, react_2.useState)([]);
55
- (0, react_2.useEffect)(() => {
45
+ const context = (0, react_1.useContext)(contexts_1.BookingEngineContext);
46
+ const basketContext = (0, react_1.useContext)(contexts_1.BasketContext);
47
+ const [isAvailable, setIsAvailable] = (0, react_1.useState)(false); // True if the dates were found with a calendar search
48
+ const [isReallyAvailable, setIsReallyAvailable] = (0, react_1.useState)(true); // True if the dates were found with an availability search
49
+ const [isLoading, setIsLoading] = (0, react_1.useState)(true);
50
+ const [imageUrl, setImageUrl] = (0, react_1.useState)('');
51
+ const [name, setName] = (0, react_1.useState)('');
52
+ const [description, setDescription] = (0, react_1.useState)('');
53
+ const [link, setLink] = (0, react_1.useState)('');
54
+ const [rooms, setRooms] = (0, react_1.useState)([]);
55
+ (0, react_1.useEffect)(() => {
56
56
  const row = basketContext.selectedBasketRow;
57
57
  if (!row) {
58
58
  return;
@@ -105,19 +105,18 @@ function RoomListCrossSellBlock(props) {
105
105
  }, [basketContext.selectedBasketRow]);
106
106
  return isAvailable ? (react_1.default.createElement("div", { className: "u-marg-top--heavy u-marg-bottom" },
107
107
  react_1.default.createElement("div", { className: "cross-sell-module" },
108
- react_1.default.createElement("div", { className: "cross-sell-module--image", style: { backgroundImage: `url('${imageUrl}')` } }),
108
+ react_1.default.createElement("div", { className: "cross-sell-module--image", style: { backgroundImage: `url('${ImageProvider_1.default.resizeImage(imageUrl, ImageProvider_1.ImageSize.Original)}')` } }),
109
109
  react_1.default.createElement("div", { className: "cross-sell-module--content u-pad--heavy u-pad@m-" },
110
110
  react_1.default.createElement("div", { className: "u-marg-bottom--heavy" },
111
111
  react_1.default.createElement("div", { className: "cross-sell-module--content-title u-marg-bottom--light" },
112
112
  react_1.default.createElement(Headline_1.default, { bold: true, size: isReallyAvailable ? 'large' : 'normal' }, isLoading
113
- ? 'A nearby hotel may have availability on your dates...'
113
+ ? t(Translation_1.Translation.Step.Room.CrossSellBlock.AvailabilityNearBy1)
114
114
  : isReallyAvailable
115
- ? 'Nearby hotel has availability on your dates!'
116
- : 'Sorry, we checked and your dates are also unavailable in our nearby hotels')),
115
+ ? t(Translation_1.Translation.Step.Room.CrossSellBlock.AvailabilityNearBy2)
116
+ : t(Translation_1.Translation.Step.Room.CrossSellBlock.DateUnavailable))),
117
117
  isReallyAvailable && (react_1.default.createElement("div", { className: "cross-sell-module--content-description u-marg-bottom--light" },
118
118
  react_1.default.createElement(Text_1.default, { color: Color_1.Color.DarkGrey, type: Text_1.TextType.Body },
119
119
  react_1.default.createElement("strong", { style: { color: Color_1.Color.Accent } }, name),
120
- " ",
121
120
  react_1.default.createElement("div", { dangerouslySetInnerHTML: { __html: description } }))))),
122
121
  isLoading ? (react_1.default.createElement(SmallSpinner_1.default, null)) : (react_1.default.createElement(react_1.default.Fragment, null, rooms.slice(0, 4).map((room, index) => {
123
122
  const roomLink = link + '&room=' + room.code;
@@ -1 +1 @@
1
- {"version":3,"file":"RoomListCrossSellBlock.js","sourceRoot":"/","sources":["src/components/steps/room/RoomListCrossSellBlock.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6EAAqD;AACrD,kEAA2D;AAC3D,wCAAqC;AACrC,uEAAgE;AAChE,kDAA4C;AAC5C,iCAAwD;AACxD,iDAA+C;AAC/C,0DAAuD;AACvD,mEAA2C;AAC3C,6EAAqD;AACrD,kEAAmC;AACnC,iDAAyE;AACzE,2CAAgD;AAChD,4FAAoE;AAOpE,SAAwB,sBAAsB,CAAC,KAAkC;IAC7E,MAAM,EAAE,CAAC,EAAE,GAAG,IAAA,8BAAc,GAAE,CAAC;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AC/C,IAAI,CAAC,IAAI,CACP;4BACP,8BAAC,cAAI,IAAC,IAAI,EAAE,eAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,aAAK,CAAC,QAAQ;;gCACrC,IAAI,CAAC,SAAS,CACnB,CACL;wBACN,uCAAK,SAAS,EAAC,uDAAuD;4BAClE,8BAAC,cAAI,IAAC,IAAI,EAAE,eAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,aAAK,CAAC,QAAQ,EAAE,MAAM,UACpD,CAAC,CAAC,yBAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CACtB;4BACP,8BAAC,cAAI,IAAC,IAAI,EAAE,eAAQ,CAAC,IAAI,EAAE,KAAK,EAAE,aAAK,CAAC,MAAM,EAAE,IAAI;gCAChD,8BAAC,kBAAQ,QAAE,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAY,CAC7C,CACL,CACN,CACP,CAAC;gBACN,CAAC,CAAC,CACH,CACN;gBAEA,iBAAiB,IAAI,CAClB,uCAAK,SAAS,EAAC,6EAA6E;oBACxF,qCACI,SAAS,EAAE,gEAAgE,GAAG,CAAC,OAAO,CAAC,UAAU,IAAI,oBAAU,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,EACxI,QAAQ,EAAE,CAAC,EACX,IAAI,EAAC,QAAQ,EACb,IAAI,EAAE,IAAI,EACV,MAAM,EAAC,QAAQ,EACf,GAAG,EAAC,YAAY;wBAEhB;;4BACa,KAAK,CAAC,MAAM;;4BACrB,8BAAC,cAAI,IAAC,IAAI,EAAE,eAAQ,CAAC,UAAU,EAAE,IAAI,EAAC,KAAK,GAAG,CAC3C,CACP,CACF,CACT,CACC,CACJ,CACJ,CACT,CAAC,CAAC,CAAC,IAAI,CAAC;AACb,CAAC;AApJD,yCAoJC","sourcesContent":["import Headline from '@/components/generic/Headline';\nimport Text, { TextType } from '@/components/generic/Text';\nimport { Color } from '@/util/Color';\nimport Icon, { IconType } from '@/components/generic/Icon/Icon';\nimport React, { ReactElement } from 'react';\nimport { useContext, useEffect, useState } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { Translation } from 'translations/Translation';\nimport ScreenSize from '@/util/ScreenSize';\nimport Currency from '@/components/generic/Currency';\nimport API from '@/api/BookingAPI';\nimport { BasketContext, BookingEngineContext } from '@frontend/contexts';\nimport { API_DATE_FORMAT } from '@/api/BaseAPI';\nimport SmallSpinner from '@/components/generic/loader/SmallSpinner';\nimport { Room } from '@/models/Room/Room';\n\nexport interface RoomListCrossSellBlockProps {\n hotelId: string;\n}\n\nexport default function RoomListCrossSellBlock(props: RoomListCrossSellBlockProps): ReactElement | null {\n const { t } = useTranslation();\n const context = useContext(BookingEngineContext);\n const basketContext = useContext(BasketContext);\n\n const [isAvailable, setIsAvailable] = useState(false); // True if the dates were found with a calendar search\n const [isReallyAvailable, setIsReallyAvailable] = useState(true); // True if the dates were found with an availability search\n const [isLoading, setIsLoading] = useState(true);\n const [imageUrl, setImageUrl] = useState('');\n const [name, setName] = useState('');\n const [description, setDescription] = useState('');\n const [link, setLink] = useState('');\n const [rooms, setRooms] = useState<Room[]>([]);\n\n useEffect(() => {\n const row = basketContext.selectedBasketRow;\n\n if (!row) {\n return;\n }\n\n API.Availability.getCheapestPricePerDay(row.getStartDate(), row.getEndDate(), row.getAdults(), row.getChildren(), row.getPromoCode(), props.hotelId, true)\n .catch()\n .then((dayPrices) => {\n if (dayPrices) {\n let allFound = true;\n for (let date = row.getStartDate(); date.isBefore(row.getEndDate(), 'day'); date = date.add(1, 'day')) {\n if (!dayPrices[date.format(API_DATE_FORMAT)]) {\n allFound = false;\n break;\n }\n }\n setIsAvailable(allFound);\n setIsReallyAvailable(true);\n if (allFound) {\n setIsLoading(true);\n const crossSellHotelInfo = API.Availability.getCrossSellHotelInfo(props.hotelId);\n setName(crossSellHotelInfo.name);\n setImageUrl(crossSellHotelInfo.image);\n setDescription(crossSellHotelInfo.description);\n\n const params: string[] = ['arrive=' + row.getStartDate().format('YYYY-M-D'), 'depart=' + row.getEndDate().format('YYYY-M-D')];\n if (row.getAdults() > 1) {\n params.push('adults=' + row.getAdults());\n }\n if (row.getChildren() > 0) {\n params.push('children=' + row.getChildren());\n }\n if (row.getPromoCode()) {\n params.push('promocode=' + row.getPromoCode());\n }\n setLink(crossSellHotelInfo.checkoutUrl + '#/step/room/?' + params.join('&'));\n\n API.Availability.fetchAvailabilityData(row, props.hotelId)\n .catch((_) => [])\n .then((hotelRooms) => {\n if (hotelRooms?.length) {\n setRooms(hotelRooms);\n setIsLoading(false);\n } else {\n setIsReallyAvailable(false);\n setIsLoading(false);\n }\n });\n }\n }\n });\n }, [basketContext.selectedBasketRow]);\n\n return isAvailable ? (\n <div className=\"u-marg-top--heavy u-marg-bottom\">\n <div className=\"cross-sell-module\">\n <div className=\"cross-sell-module--image\" style={{ backgroundImage: `url('${imageUrl}')` }} />\n <div className=\"cross-sell-module--content u-pad--heavy u-pad@m-\">\n <div className=\"u-marg-bottom--heavy\">\n <div className=\"cross-sell-module--content-title u-marg-bottom--light\">\n <Headline bold size={isReallyAvailable ? 'large' : 'normal'}>\n {isLoading\n ? 'A nearby hotel may have availability on your dates...'\n : isReallyAvailable\n ? 'Nearby hotel has availability on your dates!'\n : 'Sorry, we checked and your dates are also unavailable in our nearby hotels'}\n </Headline>\n </div>\n {isReallyAvailable && (\n <div className=\"cross-sell-module--content-description u-marg-bottom--light\">\n <Text color={Color.DarkGrey} type={TextType.Body}>\n <strong style={{ color: Color.Accent }}>{name}</strong> <div dangerouslySetInnerHTML={{ __html: description }}></div>\n </Text>\n </div>\n )}\n </div>\n\n {isLoading ? (\n <SmallSpinner />\n ) : (\n <>\n {rooms.slice(0, 4).map((room, index) => {\n const roomLink = link + '&room=' + room.code;\n let classNames = 'u-flex align-items-end';\n if (index < rooms.length - 1) {\n classNames += ' u-pad-bottom u-border-bottom u-marg-bottom';\n }\n return (\n <a key={room.code} className={classNames} href={roomLink} target=\"_blank\" rel=\"noreferrer\">\n <div className=\"u-flex flex-column align-items-start justify-content-start\">\n <Text type={TextType.Body} color={Color.Accent} bold>\n {room.name}\n </Text>\n <Text type={TextType.Small} color={Color.DarkGrey}>\n Sleeps {room.occupancy}\n </Text>\n </div>\n <div className=\"u-flex flex-column align-items-end align-items-md-end\">\n <Text type={TextType.Small} color={Color.DarkGrey} inline>\n {t(Translation.Misc.From)}\n </Text>\n <Text type={TextType.Body} color={Color.Accent} bold>\n <Currency>{room.getLowestPrice(true)}</Currency>\n </Text>\n </div>\n </a>\n );\n })}\n </>\n )}\n\n {isReallyAvailable && (\n <div className=\"u-marg-top--light u-flex justify-content-start u-w-100@m- u-marg-top--heavy\">\n <a\n className={'link-button --primary --filled --success --icon-right --normal' + (context.screenSize <= ScreenSize.Medium ? ' --wide' : '')}\n tabIndex={0}\n type=\"button\"\n href={link}\n target=\"_blank\"\n rel=\"noreferrer\"\n >\n <span>\n See all {rooms.length} rooms\n <Icon icon={IconType.ArrowRight} size=\"1em\" />\n </span>\n </a>\n </div>\n )}\n </div>\n </div>\n </div>\n ) : null;\n}\n"]}
1
+ {"version":3,"file":"RoomListCrossSellBlock.js","sourceRoot":"/","sources":["src/components/steps/room/RoomListCrossSellBlock.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6EAAqD;AACrD,kEAA2D;AAC3D,wCAAqC;AACrC,uEAAgE;AAChE,+CAA6E;AAC7E,iDAA+C;AAC/C,0DAAuD;AACvD,mEAA2C;AAC3C,6EAAqD;AACrD,kEAAmC;AACnC,iDAAyE;AACzE,2CAAgD;AAChD,4FAAoE;AAEpE,2EAAqE;AAMrE,SAAwB,sBAAsB,CAAC,KAAkC;IAC7E,MAAM,EAAE,CAAC,EAAE,GAAG,IAAA,8BAAc,GAAE,CAAC;IAC/B,MAAM,OAAO,GAAG,IAAA,kBAAU,EAAC,+BAAoB,CAAC,CAAC;IACjD,MAAM,aAAa,GAAG,IAAA,kBAAU,EAAC,wBAAa,CAA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C,IAAI,CAAC;AACb,CAAC;AArJD,yCAqJC","sourcesContent":["import Headline from '@/components/generic/Headline';\nimport Text, { TextType } from '@/components/generic/Text';\nimport { Color } from '@/util/Color';\nimport Icon, { IconType } from '@/components/generic/Icon/Icon';\nimport React, { ReactElement, useContext, useEffect, useState } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { Translation } from 'translations/Translation';\nimport ScreenSize from '@/util/ScreenSize';\nimport Currency from '@/components/generic/Currency';\nimport API from '@/api/BookingAPI';\nimport { BasketContext, BookingEngineContext } from '@frontend/contexts';\nimport { API_DATE_FORMAT } from '@/api/BaseAPI';\nimport SmallSpinner from '@/components/generic/loader/SmallSpinner';\nimport { Room } from '@/models/Room/Room';\nimport ImageProvider, { ImageSize } from '@/providers/ImageProvider';\n\nexport interface RoomListCrossSellBlockProps {\n hotelId: string;\n}\n\nexport default function RoomListCrossSellBlock(props: RoomListCrossSellBlockProps): ReactElement | null {\n const { t } = useTranslation();\n const context = useContext(BookingEngineContext);\n const basketContext = useContext(BasketContext);\n\n const [isAvailable, setIsAvailable] = useState(false); // True if the dates were found with a calendar search\n const [isReallyAvailable, setIsReallyAvailable] = useState(true); // True if the dates were found with an availability search\n const [isLoading, setIsLoading] = useState(true);\n const [imageUrl, setImageUrl] = useState('');\n const [name, setName] = useState('');\n const [description, setDescription] = useState('');\n const [link, setLink] = useState('');\n const [rooms, setRooms] = useState<Room[]>([]);\n\n useEffect(() => {\n const row = basketContext.selectedBasketRow;\n\n if (!row) {\n return;\n }\n\n API.Availability.getCheapestPricePerDay(row.getStartDate(), row.getEndDate(), row.getAdults(), row.getChildren(), row.getPromoCode(), props.hotelId, true)\n .catch()\n .then((dayPrices) => {\n if (dayPrices) {\n let allFound = true;\n for (let date = row.getStartDate(); date.isBefore(row.getEndDate(), 'day'); date = date.add(1, 'day')) {\n if (!dayPrices[date.format(API_DATE_FORMAT)]) {\n allFound = false;\n break;\n }\n }\n setIsAvailable(allFound);\n setIsReallyAvailable(true);\n if (allFound) {\n setIsLoading(true);\n const crossSellHotelInfo = API.Availability.getCrossSellHotelInfo(props.hotelId);\n setName(crossSellHotelInfo.name);\n setImageUrl(crossSellHotelInfo.image);\n setDescription(crossSellHotelInfo.description);\n\n const params: string[] = ['arrive=' + row.getStartDate().format('YYYY-M-D'), 'depart=' + row.getEndDate().format('YYYY-M-D')];\n if (row.getAdults() > 1) {\n params.push('adults=' + row.getAdults());\n }\n if (row.getChildren() > 0) {\n params.push('children=' + row.getChildren());\n }\n if (row.getPromoCode()) {\n params.push('promocode=' + row.getPromoCode());\n }\n setLink(crossSellHotelInfo.checkoutUrl + '#/step/room/?' + params.join('&'));\n\n API.Availability.fetchAvailabilityData(row, props.hotelId)\n .catch((_) => [])\n .then((hotelRooms) => {\n if (hotelRooms?.length) {\n setRooms(hotelRooms);\n setIsLoading(false);\n } else {\n setIsReallyAvailable(false);\n setIsLoading(false);\n }\n });\n }\n }\n });\n }, [basketContext.selectedBasketRow]);\n\n return isAvailable ? (\n <div className=\"u-marg-top--heavy u-marg-bottom\">\n <div className=\"cross-sell-module\">\n <div className=\"cross-sell-module--image\" style={{ backgroundImage: `url('${ImageProvider.resizeImage(imageUrl, ImageSize.Original)}')` }} />\n <div className=\"cross-sell-module--content u-pad--heavy u-pad@m-\">\n <div className=\"u-marg-bottom--heavy\">\n <div className=\"cross-sell-module--content-title u-marg-bottom--light\">\n <Headline bold size={isReallyAvailable ? 'large' : 'normal'}>\n {isLoading\n ? t(Translation.Step.Room.CrossSellBlock.AvailabilityNearBy1)\n : isReallyAvailable\n ? t(Translation.Step.Room.CrossSellBlock.AvailabilityNearBy2)\n : t(Translation.Step.Room.CrossSellBlock.DateUnavailable)}\n </Headline>\n </div>\n {isReallyAvailable && (\n <div className=\"cross-sell-module--content-description u-marg-bottom--light\">\n <Text color={Color.DarkGrey} type={TextType.Body}>\n <strong style={{ color: Color.Accent }}>{name}</strong>\n <div dangerouslySetInnerHTML={{ __html: description }}></div>\n </Text>\n </div>\n )}\n </div>\n\n {isLoading ? (\n <SmallSpinner />\n ) : (\n <>\n {rooms.slice(0, 4).map((room, index) => {\n const roomLink = link + '&room=' + room.code;\n let classNames = 'u-flex align-items-end';\n if (index < rooms.length - 1) {\n classNames += ' u-pad-bottom u-border-bottom u-marg-bottom';\n }\n return (\n <a key={room.code} className={classNames} href={roomLink} target=\"_blank\" rel=\"noreferrer\">\n <div className=\"u-flex flex-column align-items-start justify-content-start\">\n <Text type={TextType.Body} color={Color.Accent} bold>\n {room.name}\n </Text>\n <Text type={TextType.Small} color={Color.DarkGrey}>\n Sleeps {room.occupancy}\n </Text>\n </div>\n <div className=\"u-flex flex-column align-items-end align-items-md-end\">\n <Text type={TextType.Small} color={Color.DarkGrey} inline>\n {t(Translation.Misc.From)}\n </Text>\n <Text type={TextType.Body} color={Color.Accent} bold>\n <Currency>{room.getLowestPrice(true)}</Currency>\n </Text>\n </div>\n </a>\n );\n })}\n </>\n )}\n\n {isReallyAvailable && (\n <div className=\"u-marg-top--light u-flex justify-content-start u-w-100@m- u-marg-top--heavy\">\n <a\n className={'link-button --primary --filled --success --icon-right --normal' + (context.screenSize <= ScreenSize.Medium ? ' --wide' : '')}\n tabIndex={0}\n type=\"button\"\n href={link}\n target=\"_blank\"\n rel=\"noreferrer\"\n >\n <span>\n See all {rooms.length} rooms\n <Icon icon={IconType.ArrowRight} size=\"1em\" />\n </span>\n </a>\n </div>\n )}\n </div>\n </div>\n </div>\n ) : null;\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  import { FBookGetPaymentDetails, FBookSuccessCallback, FBookValidateFunction, FBookValidationCallback } from '../../models/Confirmation';
2
2
  import ReservationsDTO from '../../models/Api/ReservationsDTO';
3
3
  export interface ConfirmationContextProps {
4
- book?: (getPaymentDetails: FBookGetPaymentDetails, preValidate?: FBookValidateFunction, onPostValidationError?: FBookValidationCallback, onSuccess?: FBookSuccessCallback) => Promise<void>;
4
+ book?: (getPaymentDetails: FBookGetPaymentDetails, comments?: string, preValidate?: FBookValidateFunction, onPostValidationError?: FBookValidationCallback, onSuccess?: FBookSuccessCallback) => Promise<void>;
5
5
  commitReservation?: (resData: ReservationsDTO) => Promise<void>;
6
6
  rollbackReservation?: () => Promise<void>;
7
7
  isLoading?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"ConfirmationStepContextTypes.js","sourceRoot":"/","sources":["src/contexts/ConfirmationStepContext/ConfirmationStepContextTypes.ts"],"names":[],"mappings":"","sourcesContent":["import { FBookGetPaymentDetails, FBookSuccessCallback, FBookValidateFunction, FBookValidationCallback } from '../../models/Confirmation';\nimport ReservationsDTO from '../../models/Api/ReservationsDTO';\nexport interface ConfirmationContextProps {\n book?: (\n getPaymentDetails: FBookGetPaymentDetails,\n preValidate?: FBookValidateFunction,\n onPostValidationError?: FBookValidationCallback,\n onSuccess?: FBookSuccessCallback\n ) => Promise<void>;\n commitReservation?: (resData: ReservationsDTO) => Promise<void>;\n rollbackReservation?: () => Promise<void>;\n\n isLoading?: boolean;\n apiErrors?: string;\n clearApiErrors?: () => void;\n isBackFromPlanpay?: boolean;\n}\n"]}
1
+ {"version":3,"file":"ConfirmationStepContextTypes.js","sourceRoot":"/","sources":["src/contexts/ConfirmationStepContext/ConfirmationStepContextTypes.ts"],"names":[],"mappings":"","sourcesContent":["import { FBookGetPaymentDetails, FBookSuccessCallback, FBookValidateFunction, FBookValidationCallback } from '../../models/Confirmation';\nimport ReservationsDTO from '../../models/Api/ReservationsDTO';\nexport interface ConfirmationContextProps {\n book?: (\n getPaymentDetails: FBookGetPaymentDetails,\n comments?: string,\n preValidate?: FBookValidateFunction,\n onPostValidationError?: FBookValidationCallback,\n onSuccess?: FBookSuccessCallback\n ) => Promise<void>;\n commitReservation?: (resData: ReservationsDTO) => Promise<void>;\n rollbackReservation?: () => Promise<void>;\n\n isLoading?: boolean;\n apiErrors?: string;\n clearApiErrors?: () => void;\n isBackFromPlanpay?: boolean;\n}\n"]}
@@ -36,8 +36,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
36
36
  };
37
37
  Object.defineProperty(exports, "__esModule", { value: true });
38
38
  exports.ConfirmationStepContextWrapper = void 0;
39
- const react_1 = __importDefault(require("react"));
40
- const react_2 = require("react");
39
+ const react_1 = __importStar(require("react"));
41
40
  const BookingAPI_1 = __importDefault(require("../../api/BookingAPI"));
42
41
  const contexts_1 = require("../index.js");
43
42
  const hooks_1 = require("../../hooks/index.js");
@@ -50,12 +49,12 @@ const ConfirmationStepContext_1 = require("./ConfirmationStepContext");
50
49
  const ConfirmationStepContextProvider = ConfirmationStepContext_1.ConfirmationStepContext.Provider;
51
50
  const ConfirmationStepContextWrapper = ({ children }) => {
52
51
  const { queryPaymentMethod, queryRoomstayId: queryReservationId, queryPlanpayCheckoutId } = (0, ConfirmationQuery_1.useConfirmationQuery)();
53
- const [isLoading, setIsLoading] = (0, react_2.useState)(false);
54
- const [apiErrors, setApiErrors] = (0, react_2.useState)('');
52
+ const [isLoading, setIsLoading] = (0, react_1.useState)(false);
53
+ const [apiErrors, setApiErrors] = (0, react_1.useState)('');
55
54
  const methods = (0, react_hook_form_1.useForm)({
56
55
  mode: 'onChange',
57
56
  });
58
- const basketContext = (0, react_2.useContext)(contexts_1.BasketContext);
57
+ const basketContext = (0, react_1.useContext)(contexts_1.BasketContext);
59
58
  const basketRows = basketContext.getAllValidRows();
60
59
  const basketAddonRows = basketContext.basketAddonRows;
61
60
  const { hotel } = (0, hooks_1.useCurrentHotel)();
@@ -99,7 +98,7 @@ const ConfirmationStepContextWrapper = ({ children }) => {
99
98
  };
100
99
  }
101
100
  });
102
- const onSubmit = (getPaymentDetails, preValidate, onPostValidationError, onSuccess) => (formValues) => __awaiter(void 0, void 0, void 0, function* () {
101
+ const onSubmit = (getPaymentDetails, comments, preValidate, onPostValidationError, onSuccess) => (formValues) => __awaiter(void 0, void 0, void 0, function* () {
103
102
  var _a;
104
103
  DataLayer_1.default.instance.sendInteraction('Complete Booking', DataLayer_1.InteractionType.BUTTON, DataLayer_1.InteractionStep.GUEST_DETAILS);
105
104
  setIsLoading(true);
@@ -111,7 +110,7 @@ const ConfirmationStepContextWrapper = ({ children }) => {
111
110
  }
112
111
  const payment = yield getPaymentDetails();
113
112
  try {
114
- data = yield BookingAPI_1.default.Reservation.bookNow(basketRows, toUserProfiles(formValues), payment, basketAddonRows, formValues.comment || '', hotel === null || hotel === void 0 ? void 0 : hotel.hotelID);
113
+ data = yield BookingAPI_1.default.Reservation.bookNow(basketRows, toUserProfiles(formValues), payment, basketAddonRows, comments || '', hotel === null || hotel === void 0 ? void 0 : hotel.hotelID);
115
114
  basketContext.booked(data);
116
115
  const validationResult = yield validateReservation(data);
117
116
  if (validationResult) {
@@ -200,8 +199,8 @@ const ConfirmationStepContextWrapper = ({ children }) => {
200
199
  }
201
200
  });
202
201
  const clearApiErrors = () => setApiErrors('');
203
- const book = (getPaymentDetails, preValidate, onPostValidationError, onSuccess) => __awaiter(void 0, void 0, void 0, function* () {
204
- yield methods.handleSubmit(onSubmit(getPaymentDetails, preValidate, onPostValidationError, onSuccess))();
202
+ const book = (getPaymentDetails, comments, preValidate, onPostValidationError, onSuccess) => __awaiter(void 0, void 0, void 0, function* () {
203
+ yield methods.handleSubmit(onSubmit(getPaymentDetails, comments, preValidate, onPostValidationError, onSuccess))();
205
204
  });
206
205
  return (react_1.default.createElement(react_hook_form_1.FormProvider, Object.assign({}, methods),
207
206
  react_1.default.createElement(ConfirmationStepContextProvider, { value: {
@@ -1 +1 @@
1
- {"version":3,"file":"ConfirmationStepContextWrapper.js","sourceRoot":"/","sources":["src/contexts/ConfirmationStepContext/ConfirmationStepContextWrapper.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,iCAAoE;AAGpE,sEAAuC;AAEvC,iDAAiE;AACjE,2CAAkD;AAElD,wDAA0C;AAC1C,yCAAyC;AAEzC,qDAAwD;AACxD,kEAAmF;AACnF,iEAAiE;AACjE,uEAAoE;AAEpE,MAA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AC,KAAK,CAAC,CAAC;SACvB;IACL,CAAC,CAAA,CAAC;IAEF,MAAM,cAAc,GAAG,GAAG,EAAE,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;IAE9C,MAAM,IAAI,GAAG,CACT,iBAAyC,EACzC,WAAmC,EACnC,qBAA+C,EAC/C,SAAgC,EAClC,EAAE;QACA,MAAM,OAAO,CAAC,YAAY,CAAC,QAAQ,CAAC,iBAAiB,EAAE,WAAW,EAAE,qBAAqB,EAAE,SAAS,CAAC,CAAC,EAAE,CAAC;IAC7G,CAAC,CAAA,CAAC;IAEF,OAAO,CACH,8BAAC,8BAAY,oBAAK,OAAO;QACrB,8BAAC,+BAA+B,IAC5B,KAAK,EAAE;gBACH,IAAI;gBACJ,iBAAiB;gBACjB,mBAAmB;gBAEnB,SAAS;gBACT,SAAS;gBACT,cAAc;gBACd,iBAAiB;aACpB,IAEA,QAAQ,CACqB,CACvB,CAClB,CAAC;AACN,CAAC,CAAC;AApLW,QAAA,8BAA8B,kCAoLzC","sourcesContent":["import React from 'react';\nimport { FC, PropsWithChildren, useContext, useState } from 'react';\nimport ReservationsDTO from '../../models/Api/ReservationsDTO';\nimport reservationsDTO, { ReservationDTO } from '../../models/Api/ReservationsDTO';\nimport API from '../../api/BookingAPI';\nimport UserProfile from '../../models/UserProfile';\nimport { BasketContext, ErrorHandler } from '@frontend/contexts';\nimport { useCurrentHotel } from '@frontend/hooks';\nimport BasketRowDifferences from '../../models/BasketRowDifferences';\nimport * as Sentry from '@sentry/browser';\nimport { Severity } from '@sentry/types';\nimport { ConfirmationFormValues, FBookGetPaymentDetails, FBookSuccessCallback, FBookValidateFunction, FBookValidationCallback, IBookValidationResult } from '@/models/Confirmation';\nimport { FormProvider, useForm } from 'react-hook-form';\nimport DataLayer, { InteractionStep, InteractionType } from '../../util/DataLayer';\nimport { useConfirmationQuery } from '@/hooks/ConfirmationQuery';\nimport { ConfirmationStepContext } from './ConfirmationStepContext';\n\nconst ConfirmationStepContextProvider = ConfirmationStepContext.Provider;\nexport const ConfirmationStepContextWrapper: FC<PropsWithChildren<any>> = ({ children }) => {\n const { queryPaymentMethod, queryRoomstayId: queryReservationId, queryPlanpayCheckoutId } = useConfirmationQuery();\n\n const [isLoading, setIsLoading] = useState<boolean>(false);\n const [apiErrors, setApiErrors] = useState<string>('');\n const methods = useForm<ConfirmationFormValues>({\n mode: 'onChange',\n });\n const basketContext = useContext(BasketContext);\n const basketRows = basketContext.getAllValidRows();\n const basketAddonRows = basketContext.basketAddonRows;\n const { hotel } = useCurrentHotel();\n\n const toUserProfiles = (formValues: ConfirmationFormValues): UserProfile[] => {\n return formValues.userProfiles.map((values) => ({\n FirstName: values.Forename,\n LastName: values.Surname,\n Phone: values.Phone.replace(' ', ''),\n Email: values.Email,\n Address: {\n Line1: values.Address,\n City: values.City,\n PostalCode: values.PostCode,\n Country: values.Country,\n },\n MarketingOptIn: false,\n }));\n };\n\n const validateReservation = async (data: reservationsDTO): Promise<IBookValidationResult | undefined> => {\n const apiDifferences: BasketRowDifferences[] = [];\n if (data.reservations) {\n data.reservations.forEach((reservation: ReservationDTO, index) => {\n const diff = basketContext.currentBasketRows[index].checkDiffFromReservation(reservation);\n\n if (diff) {\n apiDifferences.push(diff);\n }\n });\n } else {\n Sentry.addBreadcrumb({\n level: Severity.Error,\n message: 'No reservation data: ' + JSON.stringify(data),\n });\n throw new Error('The reservation could not be completed due to an unexpected issue, please try again');\n }\n\n // If there are differences, we want to display them to make sure the booking still needs to proceed\n if (apiDifferences.length || (data.warnings && data.warnings.length)) {\n return {\n differences: apiDifferences,\n warnings: data.warnings as string[],\n };\n }\n };\n\n const onSubmit =\n (getPaymentDetails: FBookGetPaymentDetails, preValidate?: FBookValidateFunction, onPostValidationError?: FBookValidationCallback, onSuccess?: FBookSuccessCallback) =>\n async (formValues: ConfirmationFormValues): Promise<void> => {\n DataLayer.instance.sendInteraction('Complete Booking', InteractionType.BUTTON, InteractionStep.GUEST_DETAILS);\n setIsLoading(true);\n let data: ReservationsDTO | undefined;\n const validateResult = !preValidate || (await preValidate());\n if (!validateResult) {\n setIsLoading(false);\n return;\n }\n\n const payment = await getPaymentDetails();\n\n try {\n data = await API.Reservation.bookNow(basketRows, toUserProfiles(formValues), payment, basketAddonRows, formValues.comment || '', hotel?.hotelID as string);\n basketContext.booked(data);\n const validationResult = await validateReservation(data);\n if (validationResult) {\n setIsLoading(false);\n onPostValidationError?.(validationResult);\n } else onSuccess?.(data);\n } catch (error: any) {\n console.log(error);\n setApiErrors(error?.Message ?? 'Unexpected error returned from the booking database.');\n // We don't want to stop the isLoading on a succesful flow to avoid clicking checkout twice\n setIsLoading(false);\n }\n };\n\n const isBackFromPlanpay = !!queryPlanpayCheckoutId && !!queryReservationId && !!queryPaymentMethod;\n\n const parseReservationIdsFromData = (data: ReservationsDTO) => {\n return data?.reservations?.map((reservation) => reservation.reservationNumber);\n };\n\n const commitReservation = async (resData: ReservationsDTO) => {\n try {\n setIsLoading(true);\n if (resData) {\n const reservationIds = parseReservationIdsFromData(resData);\n if (reservationIds.length) {\n try {\n API.Reservation.commit(reservationIds, resData.itineraryNumber, hotel?.hotelID as string, queryPlanpayCheckoutId || undefined)\n .then((response: ReservationsDTO) => {\n try {\n DataLayer.instance.sendReservationConfirmed(basketContext.getAllValidRows(), basketContext.basketAddonRows, response);\n } catch (ex) {\n Sentry.captureException('Failed to read reservations from GTM code: ' + JSON.stringify(ex));\n }\n basketContext.checkedOut(response);\n })\n .catch((ex: any) => {\n console.log(ex);\n setApiErrors('Unexpected error');\n })\n .finally(() => {\n setIsLoading(false);\n });\n } catch (error: any) {\n setApiErrors(error?.Message ?? 'Unexpected error returned from the booking database.');\n }\n } else {\n setApiErrors('Committing reservation failed due to an unexpected error');\n ErrorHandler.add({ message: 'Committing reservation failed due to an unexpected error' });\n Sentry.captureException('No reservation IDs found when attempting to commit: ' + JSON.stringify(resData));\n }\n }\n } catch (ex) {\n setApiErrors('Failed to commit reservation');\n console.log('Failed to commit reservation ');\n console.error(ex);\n Sentry.captureException(ex);\n }\n };\n\n const rollbackReservation = async () => {\n if (!basketContext.reservationData) return;\n try {\n const reservationIds = parseReservationIdsFromData(basketContext.reservationData);\n if (reservationIds.length) {\n setIsLoading(true);\n await API.Reservation.rollback(reservationIds, basketContext.reservationData.itineraryNumber, hotel?.hotelID as string);\n } else {\n Sentry.captureException('No reservation IDs found when attempting to rollback: ' + JSON.stringify(basketContext.reservationData));\n }\n } catch (ex) {\n console.log('Failed to rollback reservations');\n Sentry.captureException(ex);\n } finally {\n basketContext.rollback();\n setIsLoading(false);\n }\n };\n\n const clearApiErrors = () => setApiErrors('');\n\n const book = async (\n getPaymentDetails: FBookGetPaymentDetails,\n preValidate?: FBookValidateFunction,\n onPostValidationError?: FBookValidationCallback,\n onSuccess?: FBookSuccessCallback\n ) => {\n await methods.handleSubmit(onSubmit(getPaymentDetails, preValidate, onPostValidationError, onSuccess))();\n };\n\n return (\n <FormProvider {...methods}>\n <ConfirmationStepContextProvider\n value={{\n book,\n commitReservation,\n rollbackReservation,\n\n isLoading,\n apiErrors,\n clearApiErrors,\n isBackFromPlanpay,\n }}\n >\n {children}\n </ConfirmationStepContextProvider>\n </FormProvider>\n );\n};\n"]}
1
+ {"version":3,"file":"ConfirmationStepContextWrapper.js","sourceRoot":"/","sources":["src/contexts/ConfirmationStepContext/ConfirmationStepContextWrapper.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA2E;AAG3E,sEAAuC;AAEvC,iDAAiE;AACjE,2CAAkD;AAElD,wDAA0C;AAC1C,yCAAyC;AAEzC,qDAAwD;AACxD,kEAAmF;AACnF,iEAAiE;AACjE,uEAAoE;AAEpE,MAAM,+BAA+B,GAAG,iDAAuB,CAAC,QAAQ,CAAC;AAClE,MAAM,8BAA8B,GAA+B,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;IACvF,MAAM,EAAE,kBAAkB,EAAE,eAAe,EAAE,kBAAkB,EAA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zC,QAAiB,EACjB,WAAmC,EACnC,qBAA+C,EAC/C,SAAgC,EAClC,EAAE;QACA,MAAM,OAAO,CAAC,YAAY,CAAC,QAAQ,CAAC,iBAAiB,EAAE,QAAQ,EAAE,WAAW,EAAE,qBAAqB,EAAE,SAAS,CAAC,CAAC,EAAE,CAAC;IACvH,CAAC,CAAA,CAAC;IAEF,OAAO,CACH,8BAAC,8BAAY,oBAAK,OAAO;QACrB,8BAAC,+BAA+B,IAC5B,KAAK,EAAE;gBACH,IAAI;gBACJ,iBAAiB;gBACjB,mBAAmB;gBAEnB,SAAS;gBACT,SAAS;gBACT,cAAc;gBACd,iBAAiB;aACpB,IAEA,QAAQ,CACqB,CACvB,CAClB,CAAC;AACN,CAAC,CAAC;AA3LW,QAAA,8BAA8B,kCA2LzC","sourcesContent":["import React, { FC, PropsWithChildren, useContext, useState } from 'react';\nimport ReservationsDTO from '../../models/Api/ReservationsDTO';\nimport reservationsDTO, { ReservationDTO } from '../../models/Api/ReservationsDTO';\nimport API from '../../api/BookingAPI';\nimport UserProfile from '../../models/UserProfile';\nimport { BasketContext, ErrorHandler } from '@frontend/contexts';\nimport { useCurrentHotel } from '@frontend/hooks';\nimport BasketRowDifferences from '../../models/BasketRowDifferences';\nimport * as Sentry from '@sentry/browser';\nimport { Severity } from '@sentry/types';\nimport { ConfirmationFormValues, FBookGetPaymentDetails, FBookSuccessCallback, FBookValidateFunction, FBookValidationCallback, IBookValidationResult } from '@/models/Confirmation';\nimport { FormProvider, useForm } from 'react-hook-form';\nimport DataLayer, { InteractionStep, InteractionType } from '../../util/DataLayer';\nimport { useConfirmationQuery } from '@/hooks/ConfirmationQuery';\nimport { ConfirmationStepContext } from './ConfirmationStepContext';\n\nconst ConfirmationStepContextProvider = ConfirmationStepContext.Provider;\nexport const ConfirmationStepContextWrapper: FC<PropsWithChildren<any>> = ({ children }) => {\n const { queryPaymentMethod, queryRoomstayId: queryReservationId, queryPlanpayCheckoutId } = useConfirmationQuery();\n\n const [isLoading, setIsLoading] = useState<boolean>(false);\n const [apiErrors, setApiErrors] = useState<string>('');\n const methods = useForm<ConfirmationFormValues>({\n mode: 'onChange',\n });\n const basketContext = useContext(BasketContext);\n const basketRows = basketContext.getAllValidRows();\n const basketAddonRows = basketContext.basketAddonRows;\n const { hotel } = useCurrentHotel();\n\n const toUserProfiles = (formValues: ConfirmationFormValues): UserProfile[] => {\n return formValues.userProfiles.map((values) => ({\n FirstName: values.Forename,\n LastName: values.Surname,\n Phone: values.Phone.replace(' ', ''),\n Email: values.Email,\n Address: {\n Line1: values.Address,\n City: values.City,\n PostalCode: values.PostCode,\n Country: values.Country,\n },\n MarketingOptIn: false,\n }));\n };\n\n const validateReservation = async (data: reservationsDTO): Promise<IBookValidationResult | undefined> => {\n const apiDifferences: BasketRowDifferences[] = [];\n if (data.reservations) {\n data.reservations.forEach((reservation: ReservationDTO, index) => {\n const diff = basketContext.currentBasketRows[index].checkDiffFromReservation(reservation);\n\n if (diff) {\n apiDifferences.push(diff);\n }\n });\n } else {\n Sentry.addBreadcrumb({\n level: Severity.Error,\n message: 'No reservation data: ' + JSON.stringify(data),\n });\n throw new Error('The reservation could not be completed due to an unexpected issue, please try again');\n }\n\n // If there are differences, we want to display them to make sure the booking still needs to proceed\n if (apiDifferences.length || (data.warnings && data.warnings.length)) {\n return {\n differences: apiDifferences,\n warnings: data.warnings as string[],\n };\n }\n };\n\n const onSubmit =\n (\n getPaymentDetails: FBookGetPaymentDetails,\n comments?: string,\n preValidate?: FBookValidateFunction,\n onPostValidationError?: FBookValidationCallback,\n onSuccess?: FBookSuccessCallback\n ) =>\n async (formValues: ConfirmationFormValues): Promise<void> => {\n DataLayer.instance.sendInteraction('Complete Booking', InteractionType.BUTTON, InteractionStep.GUEST_DETAILS);\n setIsLoading(true);\n let data: ReservationsDTO | undefined;\n const validateResult = !preValidate || (await preValidate());\n if (!validateResult) {\n setIsLoading(false);\n return;\n }\n\n const payment = await getPaymentDetails();\n\n try {\n data = await API.Reservation.bookNow(basketRows, toUserProfiles(formValues), payment, basketAddonRows, comments || '', hotel?.hotelID as string);\n basketContext.booked(data);\n const validationResult = await validateReservation(data);\n if (validationResult) {\n setIsLoading(false);\n onPostValidationError?.(validationResult);\n } else onSuccess?.(data);\n } catch (error: any) {\n console.log(error);\n setApiErrors(error?.Message ?? 'Unexpected error returned from the booking database.');\n // We don't want to stop the isLoading on a succesful flow to avoid clicking checkout twice\n setIsLoading(false);\n }\n };\n\n const isBackFromPlanpay = !!queryPlanpayCheckoutId && !!queryReservationId && !!queryPaymentMethod;\n\n const parseReservationIdsFromData = (data: ReservationsDTO) => {\n return data?.reservations?.map((reservation) => reservation.reservationNumber);\n };\n\n const commitReservation = async (resData: ReservationsDTO) => {\n try {\n setIsLoading(true);\n if (resData) {\n const reservationIds = parseReservationIdsFromData(resData);\n if (reservationIds.length) {\n try {\n API.Reservation.commit(reservationIds, resData.itineraryNumber, hotel?.hotelID as string, queryPlanpayCheckoutId || undefined)\n .then((response: ReservationsDTO) => {\n try {\n DataLayer.instance.sendReservationConfirmed(basketContext.getAllValidRows(), basketContext.basketAddonRows, response);\n } catch (ex) {\n Sentry.captureException('Failed to read reservations from GTM code: ' + JSON.stringify(ex));\n }\n basketContext.checkedOut(response);\n })\n .catch((ex: any) => {\n console.log(ex);\n setApiErrors('Unexpected error');\n })\n .finally(() => {\n setIsLoading(false);\n });\n } catch (error: any) {\n setApiErrors(error?.Message ?? 'Unexpected error returned from the booking database.');\n }\n } else {\n setApiErrors('Committing reservation failed due to an unexpected error');\n ErrorHandler.add({ message: 'Committing reservation failed due to an unexpected error' });\n Sentry.captureException('No reservation IDs found when attempting to commit: ' + JSON.stringify(resData));\n }\n }\n } catch (ex) {\n setApiErrors('Failed to commit reservation');\n console.log('Failed to commit reservation ');\n console.error(ex);\n Sentry.captureException(ex);\n }\n };\n\n const rollbackReservation = async () => {\n if (!basketContext.reservationData) return;\n try {\n const reservationIds = parseReservationIdsFromData(basketContext.reservationData);\n if (reservationIds.length) {\n setIsLoading(true);\n await API.Reservation.rollback(reservationIds, basketContext.reservationData.itineraryNumber, hotel?.hotelID as string);\n } else {\n Sentry.captureException('No reservation IDs found when attempting to rollback: ' + JSON.stringify(basketContext.reservationData));\n }\n } catch (ex) {\n console.log('Failed to rollback reservations');\n Sentry.captureException(ex);\n } finally {\n basketContext.rollback();\n setIsLoading(false);\n }\n };\n\n const clearApiErrors = () => setApiErrors('');\n\n const book = async (\n getPaymentDetails: FBookGetPaymentDetails,\n comments?: string,\n preValidate?: FBookValidateFunction,\n onPostValidationError?: FBookValidationCallback,\n onSuccess?: FBookSuccessCallback\n ) => {\n await methods.handleSubmit(onSubmit(getPaymentDetails, comments, preValidate, onPostValidationError, onSuccess))();\n };\n\n return (\n <FormProvider {...methods}>\n <ConfirmationStepContextProvider\n value={{\n book,\n commitReservation,\n rollbackReservation,\n\n isLoading,\n apiErrors,\n clearApiErrors,\n isBackFromPlanpay,\n }}\n >\n {children}\n </ConfirmationStepContextProvider>\n </FormProvider>\n );\n};\n"]}