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AcrG,GAC3EuC,EAAQmE,QAAQ,CAAE9D,OAAQD,EAAO4D,YACrC,GAuGkL1I,sBAnD5J/G,GAAapB,EAAUqB,UAAM,OAAQ,GAAQ,YACnE,MAAMP,QAAe,QAAiCwE,EAAM4I,YAAa9M,GACzE,MAAS,WAAYN,EAAmB,GAATA,CACnC,IAgD+NkL,OAAQ1G,EAAM+J,QAAUT,EA/C1O,IAAM5O,EAAUqB,UAAM,OAAQ,GAAQ,YAC1CoL,GAAkB1K,UAGjB,QAAmBuD,EAAM4I,YAAanM,EAAMH,EAAYC,EAAW4K,EAAc8C,kBACvF0B,OAAOrE,SAASsE,MAAO,QAAO,SAClC,MA0CJ,C","sources":["webpack://App/./Client/include/api-ito/ExcursionsApi.ts","webpack://App/./Client/src/ExcursionDescription/components/ExcursionToolbar.tsx","webpack://App/./Client/src/ExcursionDescription/components/ExcursionToolbarContainer.tsx"],"sourcesContent":["var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n};\r\nimport { api } from 'network/network.ts';\r\n/**\r\n * Возвращает приблизительные даты доступности экскурсии на указанный месяц.\r\n */\r\nexport function fetchExcursionAvailabilityApprox(id, monthIso) {\r\n return __awaiter(this, void 0, void 0, function* () {\r\n const q = { month: monthIso };\r\n const result = yield api('get', '/Excursion/' + id + '/Availability', q);\r\n return !result.errors ? result.response : { errors: result.errors };\r\n });\r\n}\r\n/**\r\n * Подбирает стоимость экскурсии.\r\n */\r\nexport function fetchExcursionPrice(id, dateIso, adultCount, childAges, tourId) {\r\n return __awaiter(this, void 0, void 0, function* () {\r\n const q = { date: dateIso, adultCount, childAges, tourId };\r\n const result = yield api('get', '/Excursion/' + id + '/Price', q);\r\n return !result.errors ? result.response : { errors: result.errors };\r\n });\r\n}\r\n/**\r\n * Добавляет экскурсию в корзину.\r\n */\r\nexport function addExcursionToCart(id, dateIso, adultCount, childAges, serializedPrice) {\r\n return __awaiter(this, void 0, void 0, function* () {\r\n const body = { date: dateIso, adultCount, childAges, excursionSerialized: serializedPrice };\r\n const result = yield api('post', '/Excursion/' + id + '/AddToCart', body);\r\n return !result.errors ? [] : result.errors;\r\n });\r\n}\r\n","import React, { Fragment, useMemo, useState } from 'react';\r\nimport moment from 'moment';\r\nimport Box from '@material-ui/core/Box';\r\nimport Button from '@material-ui/core/Button';\r\nimport CircularProgress from '@material-ui/core/CircularProgress';\r\nimport ClickAwayListener from '@material-ui/core/ClickAwayListener';\r\nimport Fade from '@material-ui/core/Fade';\r\nimport Paper from '@material-ui/core/Paper';\r\nimport Popper from '@material-ui/core/Popper';\r\nimport { makeStyles } from '@material-ui/core/styles';\r\nimport Typography from '@material-ui/core/Typography';\r\nimport ErrorIcon from '@material-ui/icons/ErrorOutline';\r\nimport CartIcon from '@material-ui/icons/ShoppingCartOutlined';\r\nimport Alert from '@material-ui/lab/Alert';\r\nimport AlertTitle from '@material-ui/lab/AlertTitle';\r\nimport Grid from '@material-ui/core/Grid';\r\nimport CheckIcon from '@material-ui/icons/CheckCircleOutline';\r\nimport ChevronRightIcon from '@material-ui/icons/ChevronRight';\r\nimport Divider from '@material-ui/core/Divider';\r\nimport { _T } from 'appI18n';\r\nimport Cost from 'react-components/Cost';\r\nimport TourAvailabilityDatePicker from 'react-components/AvailabilityDatePicker';\r\nimport { TouristPickerWithPlaceDialog } from '../../../include/react-components/TouristPicker/TouristPickerDialog';\r\nimport { TouristPickerWithPlaceTextField } from '../../../include/react-components/TouristPicker/TouristPickerTextField';\r\nconst useStyles = makeStyles(theme => ({\r\n root: {\r\n background: '#edf2f7',\r\n padding: theme.spacing(1),\r\n borderRadius: `0 0 ${theme.shape.borderRadius}px ${theme.shape.borderRadius}px`,\r\n border: '1px solid #c1ceda',\r\n borderTop: 0,\r\n borderLeft: 0,\r\n borderRight: '1px solid #cdd7e0',\r\n width: '100%',\r\n },\r\n form: {\r\n '& > :not(:last-child)': {\r\n marginBottom: theme.spacing(2),\r\n },\r\n },\r\n arrow: {\r\n position: 'absolute',\r\n fontSize: 7,\r\n '&::before': {\r\n content: '\"\"',\r\n margin: 'auto',\r\n display: 'block',\r\n width: 0,\r\n height: 0,\r\n borderStyle: 'solid',\r\n borderWidth: '1em 0 1em 1em',\r\n borderColor: `transparent transparent transparent ${theme.palette.background.paper}`,\r\n },\r\n right: 0,\r\n marginRight: '-0.9em',\r\n height: '3em',\r\n width: '1em',\r\n filter: 'drop-shadow(1px 2px 1px rgba(0,0,0,.08)) drop-shadow(1px 1px 0 rgba(0,0,0,.1))',\r\n },\r\n errorText: {\r\n color: theme.palette.error.main,\r\n },\r\n pickersContainer: {\r\n '& > :not(:last-child)': {\r\n marginBottom: theme.spacing(1),\r\n },\r\n },\r\n priceContainer: {\r\n marginTop: theme.spacing(1),\r\n },\r\n transportContainer: {},\r\n currentTransport: {\r\n display: 'flex',\r\n alignItems: 'center',\r\n padding: '4px 0 8px',\r\n marginLeft: 4,\r\n color: theme.palette.success.main,\r\n '& > :last-child': { marginRight: theme.spacing(.5) }\r\n },\r\n pricePrefix: {\r\n color: theme.palette.grey[800]\r\n }\r\n}));\r\nfunction labelFunc(date) {\r\n return date ? date.format('L') : _T.EXCURSION_CHOOSE_EXCURSION_DATE;\r\n}\r\nexport default function ExcursionToolbar(props) {\r\n const classes = useStyles();\r\n const [touristPickerOpen, setTouristPickerOpen] = useState(false);\r\n const [pickerRef, setPickerRef] = useState(null);\r\n const [arrowRef, setArrowRef] = useState(null);\r\n const maxDate = useMemo(() => moment().add(1, 'year').day(31).format('YYYY-MM-DD'), []);\r\n const [hintOpen, setHintOpen] = useState(false);\r\n const sortedPrices = useMemo(() => (props.prices || []).sort((a, b) => a.price - b.price), [props.prices]);\r\n const showTransport = sortedPrices.length > 1 || (sortedPrices.length == 1 && sortedPrices[0].vehicleTypeName);\r\n const handleTouristsChanged = (adultCount, childAges) => props.onChange(props.date, adultCount, childAges, props.price);\r\n const handleDateChanged = (date) => props.onChange(date, props.adultCount, props.childAges, props.price);\r\n const handleTransportChanged = (price) => props.onChange(props.date, props.adultCount, props.childAges, price);\r\n const handleAddToCart = () => {\r\n if (props.date) {\r\n props.onBook();\r\n setHintOpen(false);\r\n }\r\n else {\r\n setHintOpen(true);\r\n }\r\n };\r\n const popperModifiers = {\r\n arrow: { enabled: true, element: arrowRef },\r\n preventOverflow: { boundariesElement: 'viewport' },\r\n offset: { enabled: true, offset: '0, 6' },\r\n };\r\n return React.createElement(\"div\", { className: classes.root },\r\n React.createElement(Grid, { container: true },\r\n React.createElement(Grid, { item: true, lg: 8, md: 8, xs: 12, className: classes.form },\r\n React.createElement(\"div\", { className: classes.pickersContainer },\r\n React.createElement(\"div\", null,\r\n React.createElement(TourAvailabilityDatePicker, { fieldLabel: _T.EXCURSION_DATE, calendarLabel: _T.EXCURSION_DATE, labelFunc: labelFunc, date: props.date, maxDate: maxDate, adornment: !props.date ? React.createElement(ErrorIcon, { className: classes.errorText }) : null, fullWidth: true, onChange: handleDateChanged, onAvailabilityRequested: props.onAvailabilityRequest, ref: setPickerRef }),\r\n React.createElement(Popper, { placement: \"bottom\", open: hintOpen, anchorEl: pickerRef, modifiers: popperModifiers, transition: true }, ({ TransitionProps }) => (React.createElement(ClickAwayListener, { onClickAway: () => setHintOpen(false) },\r\n React.createElement(Fade, Object.assign({}, TransitionProps, { timeout: 100 }),\r\n React.createElement(\"div\", null,\r\n React.createElement(\"div\", { className: classes.arrow, ref: setArrowRef }),\r\n React.createElement(Paper, null,\r\n React.createElement(Box, { p: 2, display: \"grid\", gridGap: 8, gridTemplateColumns: \"auto auto\", alignItems: \"center\" },\r\n React.createElement(ErrorIcon, { htmlColor: \"#ff0000\" }),\r\n \" \",\r\n _T.EXCURSION_ERROR_CANT_BOOK_WITHOUT_DATE)))))))),\r\n React.createElement(\"div\", null,\r\n React.createElement(TouristPickerWithPlaceTextField, { adultCount: props.adultCount, childAges: props.childAges, fullWidth: true, onClick: () => setTouristPickerOpen(true) }),\r\n touristPickerOpen &&\r\n React.createElement(TouristPickerWithPlaceDialog, { open: touristPickerOpen, adultCount: props.adultCount, childAges: props.childAges, onChange: handleTouristsChanged, onClose: () => setTouristPickerOpen(false) }) || null)),\r\n showTransport &&\r\n React.createElement(Paper, { className: classes.transportContainer, elevation: 0, variant: \"outlined\" },\r\n React.createElement(Box, { p: 2 },\r\n React.createElement(Typography, { variant: \"subtitle1\", gutterBottom: true }, _T.EXCURSION_AVAILABLE_TRANSPORT_TYPES),\r\n React.createElement(Box, { mt: 3 }, sortedPrices.map((x, i) => React.createElement(Fragment, { key: `${x.id}-${x.vehicleTypeId}` },\r\n React.createElement(Grid, { container: true },\r\n React.createElement(Grid, { item: true, sm: 8 }, x.vehicleTypeName || null),\r\n React.createElement(Grid, { item: true, xs: 2 },\r\n React.createElement(Cost, { amount: x.price, currency: x.currency.name, amountVariant: \"h6\" })),\r\n React.createElement(Grid, { item: true, xs: 2 }, x != props.price\r\n ? React.createElement(Button, { color: \"secondary\", variant: \"outlined\", fullWidth: true, onClick: handleTransportChanged.bind(null, x) },\r\n _T.COMMON_CHOOSE,\r\n \" \",\r\n React.createElement(ChevronRightIcon, null))\r\n : React.createElement(Typography, { className: classes.currentTransport, variant: \"button\", component: \"div\" },\r\n React.createElement(CheckIcon, null),\r\n \" \",\r\n _T.TOUR_SELECTED))),\r\n sortedPrices.length - 1 > i && React.createElement(Box, { my: 1 },\r\n React.createElement(Divider, null)) || null))))),\r\n React.createElement(\"div\", { className: classes.priceContainer },\r\n !props.loading && props.price\r\n ? React.createElement(Typography, { variant: \"h5\" },\r\n React.createElement(\"span\", { className: classes.pricePrefix },\r\n _T.COMMON_TO_PAY,\r\n \": \"),\r\n React.createElement(Cost, { amount: props.price.price, currency: props.price.currency.name, amountVariant: \"h4\", currencyVariant: \"h5\", component: \"span\" })) : null,\r\n !props.loading && props.prices && props.prices.length == 0 &&\r\n React.createElement(Alert, { severity: \"warning\", variant: \"filled\" },\r\n React.createElement(AlertTitle, null, _T.EXCURSION_ERROR_DATE_UNAVAIL_TITLE),\r\n _T.EXCURSION_ERROR_DATE_UNAVAIL_BODY),\r\n props.loading && React.createElement(\"div\", null,\r\n React.createElement(CircularProgress, { size: 30 })) || null,\r\n React.createElement(Box, { mt: 2 },\r\n React.createElement(Button, { color: \"primary\", variant: \"contained\", fullWidth: true, disableElevation: true, onClick: handleAddToCart, disabled: props.loading || !props.price },\r\n React.createElement(CartIcon, { fontSize: \"small\" }),\r\n \"\\u00A0\",\r\n _T.COMMON_BOOK))))));\r\n}\r\n","var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n};\r\nimport React, { useContext, useEffect, useState } from 'react';\r\nimport ExcursionToolbar from './ExcursionToolbar';\r\nimport { addExcursionToCart, fetchExcursionAvailabilityApprox, fetchExcursionPrice } from 'api-ito/ExcursionsApi';\r\nimport { appUrl } from 'utils';\r\nimport { useHistory, useLocation } from 'react-router-dom';\r\nimport moment from 'moment';\r\nimport { api } from '../../../include/network/network';\r\nimport _ from 'lodash';\r\nimport { BackdropContext } from '../../../include/react-components/BackdropProvider';\r\nexport default function ExcursionToolbarContainer(props) {\r\n const [date, setDate] = useState(null);\r\n const [adultCount, setAdultCount] = useState(2);\r\n const [childAges, setChildAges] = useState([]);\r\n const [vehicleTypeId, setVehicleTypeId] = useState(null);\r\n const [prices, setPrices] = useState(null);\r\n const [selectedPrice, setSelectedPrice] = useState();\r\n const [loading, setLoading] = useState(false);\r\n const location = useLocation();\r\n const history = useHistory();\r\n const backdrop = useContext(BackdropContext);\r\n const handleChange = (newDate, newAdultCount, newChildAges, price) => {\r\n const vehicleTypeId = price && price.vehicleTypeId ? price.vehicleTypeId : null;\r\n setDate(newDate);\r\n setAdultCount(newAdultCount);\r\n setChildAges(newChildAges);\r\n setVehicleTypeId(vehicleTypeId);\r\n if (newDate) {\r\n const params = serializeWidgetParams(newDate, newAdultCount, newChildAges, vehicleTypeId);\r\n history.replace({ search: params.toString() });\r\n }\r\n };\r\n // Восстановление параметров поиска из url.\r\n useEffect(() => {\r\n const params = restoreWidgetParams(location.search);\r\n if (!params)\r\n return;\r\n setDate(params.date);\r\n setAdultCount(params.adultCount);\r\n setChildAges(params.childAges);\r\n setVehicleTypeId(parseInt(params.vehicleTypeId || '') || null);\r\n }, [location.search]);\r\n // Поиск цены. Выполняется при изменении любого из параметров.\r\n useEffect(() => {\r\n let abort = false;\r\n if (!date)\r\n return;\r\n setLoading(true);\r\n fetchExcursionPrice(props.excursionId, date, adultCount, childAges, undefined).then((response) => {\r\n if (abort)\r\n return;\r\n if ('errors' in response) {\r\n console.log('fetchExcursionPrice', response.errors);\r\n setPrices([]);\r\n }\r\n else {\r\n setPrices(response);\r\n }\r\n }).catch((err) => {\r\n if (!abort) {\r\n console.error('fetchExcursionPrice exception', err);\r\n setPrices([]);\r\n }\r\n }).finally(() => !abort && setLoading(false));\r\n return () => { abort = true; };\r\n }, [date, adultCount, childAges.map(x => `${x.age}${(x.withPlace ? '*' : '')}`).join(',')]);\r\n // Пост-фильтрация цен по транспорту.\r\n useEffect(() => {\r\n if (prices && prices.length) {\r\n // Выбираем цену с самым подходящим транспортом и самой дешевой ценой.\r\n const matchingPrices = vehicleTypeId\r\n ? prices.filter(x => x.vehicleTypeId == vehicleTypeId)\r\n : prices;\r\n const matchingPrice = matchingPrices.length\r\n ? matchingPrices.sort((a, b) => a.price - b.price)[0]\r\n : prices[0];\r\n setSelectedPrice(matchingPrice);\r\n }\r\n else {\r\n setSelectedPrice(null);\r\n }\r\n }, [prices, vehicleTypeId]);\r\n const loadAvailability = (monthIso) => __awaiter(this, void 0, void 0, function* () {\r\n const result = yield fetchExcursionAvailabilityApprox(props.excursionId, monthIso);\r\n return !('errors' in result) ? result : [];\r\n });\r\n const book = () => __awaiter(this, void 0, void 0, function* () {\r\n if (!selectedPrice || !date)\r\n return;\r\n // TODO: booking & booking errors.\r\n yield addExcursionToCart(props.excursionId, date, adultCount, childAges, selectedPrice.secureSerialized);\r\n window.location.href = appUrl('/Cart');\r\n });\r\n const frameBook = () => __awaiter(this, void 0, void 0, function* () {\r\n if (!selectedPrice || !date)\r\n return;\r\n backdrop.show();\r\n const cart = JSON.parse(sessionStorage.getItem('frame-cart') || '{ \"services\": [] }');\r\n cart.services = [];\r\n const r = yield api('post', `/frame/${props.frameId}/excursion-cart${props.tempFrameId ? `?tempId=${props.tempFrameId}` : ''}`, { excursionId: props.excursionId, date, adultCount, childAges, excursionSerialized: selectedPrice.secureSerialized });\r\n if (r.errors) {\r\n backdrop.hide();\r\n return;\r\n }\r\n cart.services.push({ type: 'excursion', excursionId: props.excursionId, date, adultCount, childAges, excursionSerialized: selectedPrice.secureSerialized, cartData: r.response });\r\n const serviceDatas = cart.services.flatMap(s => s.type == 'hotel' ? [...s.cartData.map(x => x), ...s.cartDataCompulsory.map(x => x)] : [s.cartData]);\r\n cart.price = _.sum(_.map(serviceDatas, s => s.priceInBookingCurrency));\r\n cart.pricePerPerson = _.sum(_.map(serviceDatas, s => (s.priceInBookingCurrency / (s.accommodation.adults + s.accommodation.childs))));\r\n cart.currency = r.response.bookingCurrency;\r\n sessionStorage.setItem('frame-cart', JSON.stringify(cart));\r\n if (props.bookCallback)\r\n props.bookCallback();\r\n backdrop.hide();\r\n });\r\n useEffect(() => {\r\n if (!props.frameId)\r\n return;\r\n const params = new URLSearchParams(location.search);\r\n if (params.get('cartOpen') != \"true\")\r\n return;\r\n //(async () => {\r\n // const r = await api('post', `/frame/${props.frameId}/excursion-cart${props.tempFrameId ? `?tempId=${props.tempFrameId}` : ''}`, { excursionId: props.excursionId, date, adultCount, childAges, excursionSerialized: selectedPrice.secureSerialized });\r\n // if (r.errors) {\r\n // backdrop.hide();\r\n // return;\r\n // }\r\n // const tempCart = JSON.parse(sessionStorage.getItem('frame-cart') || '{ \"services\": [] }') as CartFrameProps;\r\n // if (props.bookCallback && tempCart?.services?.length)\r\n // props.bookCallback();\r\n //})();\r\n frameBook();\r\n }, [selectedPrice, date]);\r\n return React.createElement(\"div\", null,\r\n React.createElement(ExcursionToolbar, { date: date, adultCount: adultCount, childAges: childAges, loading: loading, prices: prices, price: selectedPrice, onChange: handleChange, onAvailabilityRequest: loadAvailability, onBook: props.frameId ? frameBook : book }));\r\n}\r\nfunction serializeWidgetParams(date, adultCount, childAges, vehicleTypeId) {\r\n const params = new URLSearchParams();\r\n params.set('date', date);\r\n params.set('adc', adultCount.toString());\r\n if (childAges.length)\r\n params.set('cag', childAges.map(c => `${c.age}${(c.withPlace ? '*' : '')}`).join(','));\r\n if (vehicleTypeId)\r\n params.set('vtid', vehicleTypeId.toString());\r\n return params;\r\n}\r\nfunction restoreWidgetParams(search) {\r\n if (!search)\r\n return null;\r\n const params = new URLSearchParams(search);\r\n const adc = params.get('adc'), // adult count\r\n cha = params.get('cag'), // child ages\r\n dte = params.get('date'), // excursion date\r\n vtid = params.get('vtid'); // vehicle type id\r\n if (!adc || !dte)\r\n return null;\r\n const adultCount = parseInt(adc);\r\n const childAges = cha && cha.split(',').map(x => ({ age: parseInt(x), withPlace: (x[x.length - 1] == '*') })) || [];\r\n const date = moment(dte);\r\n if (!adultCount || !date.isValid() || (childAges && childAges.findIndex(x => isNaN(x.age)) != -1))\r\n return null;\r\n return { adultCount, childAges, date: date.format('YYYY-MM-DD'), vehicleTypeId: vtid };\r\n}\r\n"],"names":["__awaiter","thisArg","_arguments","P","generator","Promise","resolve","reject","fulfilled","value","step","next","e","rejected","result","done","then","apply","fetchExcursionAvailabilityApprox","id","monthIso","this","q","month","errors","response","fetchExcursionPrice","dateIso","adultCount","childAges","tourId","date","addExcursionToCart","serializedPrice","body","excursionSerialized","useStyles","makeStyles","theme","root","background","padding","spacing","borderRadius","shape","border","borderTop","borderLeft","borderRight","width","form","marginBottom","arrow","position","fontSize","content","margin","display","height","borderStyle","borderWidth","borderColor","palette","paper","right","marginRight","filter","errorText","color","error","main","pickersContainer","priceContainer","marginTop","transportContainer","currentTransport","alignItems","marginLeft","success","pricePrefix","grey","labelFunc","format","_T","EXCURSION_CHOOSE_EXCURSION_DATE","ExcursionToolbar","props","classes","touristPickerOpen","setTouristPickerOpen","useState","pickerRef","setPickerRef","arrowRef","setArrowRef","maxDate","useMemo","add","day","hintOpen","setHintOpen","sortedPrices","prices","sort","a","b","price","showTransport","length","vehicleTypeName","handleTransportChanged","onChange","popperModifiers","enabled","element","preventOverflow","boundariesElement","offset","className","Grid","container","item","lg","md","xs","fieldLabel","EXCURSION_DATE","calendarLabel","adornment","fullWidth","onAvailabilityRequested","onAvailabilityRequest","ref","Popper","placement","open","anchorEl","modifiers","transition","TransitionProps","ClickAwayListener","onClickAway","Fade","Object","assign","timeout","Paper","Box","p","gridGap","gridTemplateColumns","htmlColor","EXCURSION_ERROR_CANT_BOOK_WITHOUT_DATE","onClick","onClose","elevation","variant","Typography","gutterBottom","EXCURSION_AVAILABLE_TRANSPORT_TYPES","mt","map","x","i","Fragment","key","vehicleTypeId","sm","Cost","amount","currency","name","amountVariant","Button","bind","COMMON_CHOOSE","ChevronRight","component","TOUR_SELECTED","my","Divider","loading","COMMON_TO_PAY","currencyVariant","Alert","severity","AlertTitle","EXCURSION_ERROR_DATE_UNAVAIL_TITLE","EXCURSION_ERROR_DATE_UNAVAIL_BODY","CircularProgress","size","disableElevation","onBook","disabled","COMMON_BOOK","ExcursionToolbarContainer","setDate","setAdultCount","setChildAges","setVehicleTypeId","setPrices","selectedPrice","setSelectedPrice","setLoading","location","history","backdrop","useContext","useEffect","params","search","URLSearchParams","adc","get","cha","dte","vtid","parseInt","split","age","withPlace","isValid","findIndex","isNaN","restoreWidgetParams","abort","excursionId","undefined","console","log","catch","err","finally","join","matchingPrices","matchingPrice","frameBook","show","cart","JSON","parse","sessionStorage","getItem","services","r","frameId","tempFrameId","secureSerialized","hide","push","type","cartData","serviceDatas","flatMap","s","cartDataCompulsory","priceInBookingCurrency","pricePerPerson","accommodation","adults","childs","bookingCurrency","setItem","stringify","bookCallback","newDate","newAdultCount","newChildAges","set","toString","c","serializeWidgetParams","replace","window","href"],"sourceRoot":""}