@devtravelcode/widget-native 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +18 -0
- package/dist/App.d.ts +10 -0
- package/dist/App.js +192 -0
- package/dist/TravelHubWidget.d.ts +12 -0
- package/dist/TravelHubWidget.js +58 -0
- package/dist/components/ErrorBoundary.d.ts +18 -0
- package/dist/components/ErrorBoundary.js +63 -0
- package/dist/components/ui/Modal.d.ts +11 -0
- package/dist/components/ui/Modal.js +66 -0
- package/dist/components/ui/Skeleton.d.ts +8 -0
- package/dist/components/ui/Skeleton.js +33 -0
- package/dist/components/ui/badge.d.ts +11 -0
- package/dist/components/ui/badge.js +54 -0
- package/dist/components/ui/button.d.ts +14 -0
- package/dist/components/ui/button.js +101 -0
- package/dist/components/ui/card.d.ts +16 -0
- package/dist/components/ui/card.js +51 -0
- package/dist/components/ui/input.d.ts +8 -0
- package/dist/components/ui/input.js +61 -0
- package/dist/components/ui/label.d.ts +8 -0
- package/dist/components/ui/label.js +17 -0
- package/dist/context/WidgetContext.d.ts +29 -0
- package/dist/context/WidgetContext.js +64 -0
- package/dist/icons/CarIcon.d.ts +4 -0
- package/dist/icons/CarIcon.js +3 -0
- package/dist/icons/CloseIcon.d.ts +7 -0
- package/dist/icons/CloseIcon.js +3 -0
- package/dist/icons/FlightIcon.d.ts +4 -0
- package/dist/icons/FlightIcon.js +3 -0
- package/dist/icons/HotelIcon.d.ts +4 -0
- package/dist/icons/HotelIcon.js +3 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/lib/utils.js +3 -0
- package/dist/locales/widgetTranslations.d.ts +1 -0
- package/dist/locales/widgetTranslations.js +732 -0
- package/dist/modules/hooks/useAirportSearch.d.ts +21 -0
- package/dist/modules/hooks/useAirportSearch.js +48 -0
- package/dist/modules/hooks/useCarOffers.d.ts +7 -0
- package/dist/modules/hooks/useCarOffers.js +47 -0
- package/dist/modules/hooks/useCountriesByCodes.d.ts +4 -0
- package/dist/modules/hooks/useCountriesByCodes.js +60 -0
- package/dist/modules/hooks/useCountriesSearch.d.ts +11 -0
- package/dist/modules/hooks/useCountriesSearch.js +55 -0
- package/dist/modules/hooks/useDefaultHotelLocation.d.ts +7 -0
- package/dist/modules/hooks/useDefaultHotelLocation.js +44 -0
- package/dist/modules/hooks/useDetectNationality.d.ts +1 -0
- package/dist/modules/hooks/useDetectNationality.js +20 -0
- package/dist/modules/hooks/useFlightSearch.d.ts +20 -0
- package/dist/modules/hooks/useFlightSearch.js +243 -0
- package/dist/modules/hooks/useHotelDetails.d.ts +7 -0
- package/dist/modules/hooks/useHotelDetails.js +80 -0
- package/dist/modules/hooks/useHotelLocations.d.ts +5 -0
- package/dist/modules/hooks/useHotelLocations.js +42 -0
- package/dist/modules/hooks/useHotelMapData.d.ts +12 -0
- package/dist/modules/hooks/useHotelMapData.js +78 -0
- package/dist/modules/hooks/useHotelOffers.d.ts +11 -0
- package/dist/modules/hooks/useHotelOffers.js +122 -0
- package/dist/modules/hooks/useHotelSearchSSE.d.ts +18 -0
- package/dist/modules/hooks/useHotelSearchSSE.js +411 -0
- package/dist/modules/hooks/useSearchExpiration.d.ts +6 -0
- package/dist/modules/hooks/useSearchExpiration.js +35 -0
- package/dist/modules/hooks/useTranslationsHub.d.ts +5 -0
- package/dist/modules/hooks/useTranslationsHub.js +48 -0
- package/dist/modules/navbar/Navbar.d.ts +8 -0
- package/dist/modules/navbar/Navbar.js +69 -0
- package/dist/modules/search-form/AgeSelector.d.ts +9 -0
- package/dist/modules/search-form/AgeSelector.js +109 -0
- package/dist/modules/search-form/CustomSelect.d.ts +14 -0
- package/dist/modules/search-form/CustomSelect.js +94 -0
- package/dist/modules/search-form/FiltersSkeleton.d.ts +6 -0
- package/dist/modules/search-form/FiltersSkeleton.js +35 -0
- package/dist/modules/search-form/NationalityInput.d.ts +18 -0
- package/dist/modules/search-form/NationalityInput.js +172 -0
- package/dist/modules/search-form/Pagination.d.ts +8 -0
- package/dist/modules/search-form/Pagination.js +84 -0
- package/dist/modules/search-form/SearchExpiredPopup.d.ts +10 -0
- package/dist/modules/search-form/SearchExpiredPopup.js +91 -0
- package/dist/modules/search-form/SkeletonWidget.d.ts +2 -0
- package/dist/modules/search-form/SkeletonWidget.js +33 -0
- package/dist/modules/search-form/TimePicker.d.ts +9 -0
- package/dist/modules/search-form/TimePicker.js +182 -0
- package/dist/modules/search-form/cars/CarEmptyState.d.ts +6 -0
- package/dist/modules/search-form/cars/CarEmptyState.js +42 -0
- package/dist/modules/search-form/cars/CarFiltersSkeleton.d.ts +6 -0
- package/dist/modules/search-form/cars/CarFiltersSkeleton.js +35 -0
- package/dist/modules/search-form/cars/CarOffersList.d.ts +43 -0
- package/dist/modules/search-form/cars/CarOffersList.js +214 -0
- package/dist/modules/search-form/cars/CarResults.d.ts +25 -0
- package/dist/modules/search-form/cars/CarResults.js +116 -0
- package/dist/modules/search-form/cars/CarSearchForm.d.ts +19 -0
- package/dist/modules/search-form/cars/CarSearchForm.js +173 -0
- package/dist/modules/search-form/cars/CarSkeleton.d.ts +6 -0
- package/dist/modules/search-form/cars/CarSkeleton.js +46 -0
- package/dist/modules/search-form/cars/CarTopOffersSlider.d.ts +20 -0
- package/dist/modules/search-form/cars/CarTopOffersSlider.js +100 -0
- package/dist/modules/search-form/cars/car-filters/CarFilters.d.ts +8 -0
- package/dist/modules/search-form/cars/car-filters/CarFilters.js +318 -0
- package/dist/modules/search-form/cars/car-filters/FilterSection.d.ts +9 -0
- package/dist/modules/search-form/cars/car-filters/FilterSection.js +30 -0
- package/dist/modules/search-form/cars/car-filters/index.d.ts +6 -0
- package/dist/modules/search-form/cars/car-filters/index.js +3 -0
- package/dist/modules/search-form/cars/car-filters/useCarFilters.d.ts +24 -0
- package/dist/modules/search-form/cars/car-filters/useCarFilters.js +121 -0
- package/dist/modules/search-form/flight/AirlinesSelector.d.ts +8 -0
- package/dist/modules/search-form/flight/AirlinesSelector.js +235 -0
- package/dist/modules/search-form/flight/CabinClassSelector.d.ts +9 -0
- package/dist/modules/search-form/flight/CabinClassSelector.js +63 -0
- package/dist/modules/search-form/flight/DatePicker.d.ts +12 -0
- package/dist/modules/search-form/flight/DatePicker.js +536 -0
- package/dist/modules/search-form/flight/FlightSearchForm.d.ts +18 -0
- package/dist/modules/search-form/flight/FlightSearchForm.js +147 -0
- package/dist/modules/search-form/flight/LocationInput.d.ts +11 -0
- package/dist/modules/search-form/flight/LocationInput.js +294 -0
- package/dist/modules/search-form/flight/PassengersPicker.d.ts +16 -0
- package/dist/modules/search-form/flight/PassengersPicker.js +203 -0
- package/dist/modules/search-form/flight/SwitchLocationBtn.d.ts +9 -0
- package/dist/modules/search-form/flight/SwitchLocationBtn.js +48 -0
- package/dist/modules/search-form/flight/flight-filters/FiltersContent.d.ts +21 -0
- package/dist/modules/search-form/flight/flight-filters/FiltersContent.js +145 -0
- package/dist/modules/search-form/flight/flight-filters/FlightFiltersDynamic.d.ts +11 -0
- package/dist/modules/search-form/flight/flight-filters/FlightFiltersDynamic.js +213 -0
- package/dist/modules/search-form/flight/flight-filters/RangeBlock.d.ts +22 -0
- package/dist/modules/search-form/flight/flight-filters/RangeBlock.js +164 -0
- package/dist/modules/search-form/flight/flight-filters/index.d.ts +1 -0
- package/dist/modules/search-form/flight/flight-filters/index.js +1 -0
- package/dist/modules/search-form/flight/flight-results/FlightAdditionalInfo.d.ts +16 -0
- package/dist/modules/search-form/flight/flight-results/FlightAdditionalInfo.js +229 -0
- package/dist/modules/search-form/flight/flight-results/FlightBaggageToggle.d.ts +15 -0
- package/dist/modules/search-form/flight/flight-results/FlightBaggageToggle.js +110 -0
- package/dist/modules/search-form/flight/flight-results/FlightCard.d.ts +14 -0
- package/dist/modules/search-form/flight/flight-results/FlightCard.js +436 -0
- package/dist/modules/search-form/flight/flight-results/FlightInfo.d.ts +12 -0
- package/dist/modules/search-form/flight/flight-results/FlightInfo.js +48 -0
- package/dist/modules/search-form/flight/flight-results/FlightPriceBlock.d.ts +11 -0
- package/dist/modules/search-form/flight/flight-results/FlightPriceBlock.js +36 -0
- package/dist/modules/search-form/flight/flight-results/FlightResults.d.ts +22 -0
- package/dist/modules/search-form/flight/flight-results/FlightResults.js +109 -0
- package/dist/modules/search-form/flight/flight-results/FlightSegments.d.ts +40 -0
- package/dist/modules/search-form/flight/flight-results/FlightSegments.js +162 -0
- package/dist/modules/search-form/flight/flight-results/FlightsSkeleton.d.ts +6 -0
- package/dist/modules/search-form/flight/flight-results/FlightsSkeleton.js +52 -0
- package/dist/modules/search-form/flight/flight-results/ProvidersLoader.d.ts +9 -0
- package/dist/modules/search-form/flight/flight-results/ProvidersLoader.js +242 -0
- package/dist/modules/search-form/hotel/DatePicker.d.ts +1 -0
- package/dist/modules/search-form/hotel/DatePicker.js +1 -0
- package/dist/modules/search-form/hotel/GuestSelector.d.ts +13 -0
- package/dist/modules/search-form/hotel/GuestSelector.js +272 -0
- package/dist/modules/search-form/hotel/GuestSelectorMobilePopup.d.ts +2 -0
- package/dist/modules/search-form/hotel/GuestSelectorMobilePopup.js +1 -0
- package/dist/modules/search-form/hotel/HotelLocation.d.ts +17 -0
- package/dist/modules/search-form/hotel/HotelLocation.js +178 -0
- package/dist/modules/search-form/hotel/HotelLocationMobilePopup.d.ts +2 -0
- package/dist/modules/search-form/hotel/HotelLocationMobilePopup.js +1 -0
- package/dist/modules/search-form/hotel/HotelResults.d.ts +21 -0
- package/dist/modules/search-form/hotel/HotelResults.js +333 -0
- package/dist/modules/search-form/hotel/HotelSearchForm.d.ts +13 -0
- package/dist/modules/search-form/hotel/HotelSearchForm.js +130 -0
- package/dist/modules/search-form/hotel/HotelsSkeleton.d.ts +6 -0
- package/dist/modules/search-form/hotel/HotelsSkeleton.js +40 -0
- package/dist/modules/search-form/hotel/PassengersPicker.d.ts +2 -0
- package/dist/modules/search-form/hotel/PassengersPicker.js +1 -0
- package/dist/modules/search-form/hotel/components/HotelCard.d.ts +11 -0
- package/dist/modules/search-form/hotel/components/HotelCard.js +180 -0
- package/dist/modules/search-form/hotel/components/HotelEmptyState.d.ts +6 -0
- package/dist/modules/search-form/hotel/components/HotelEmptyState.js +34 -0
- package/dist/modules/search-form/hotel/components/HotelGallery.d.ts +6 -0
- package/dist/modules/search-form/hotel/components/HotelGallery.js +77 -0
- package/dist/modules/search-form/hotel/components/HotelList.d.ts +9 -0
- package/dist/modules/search-form/hotel/components/HotelList.js +12 -0
- package/dist/modules/search-form/hotel/components/HotelMap.d.ts +26 -0
- package/dist/modules/search-form/hotel/components/HotelMap.js +707 -0
- package/dist/modules/search-form/hotel/components/HotelPin.d.ts +7 -0
- package/dist/modules/search-form/hotel/components/HotelPin.js +1 -0
- package/dist/modules/search-form/hotel/hotel-filters/HotelFilters.d.ts +29 -0
- package/dist/modules/search-form/hotel/hotel-filters/HotelFilters.js +339 -0
- package/dist/modules/search-form/hotel/hotel-filters/HotelFiltersBar.d.ts +3 -0
- package/dist/modules/search-form/hotel/hotel-filters/HotelFiltersBar.js +2 -0
- package/dist/modules/search-form/hotel/hotel-filters/HotelFiltersContent.d.ts +2 -0
- package/dist/modules/search-form/hotel/hotel-filters/HotelFiltersContent.js +1 -0
- package/dist/modules/search-form/hotel/hotel-filters/HotelFiltersDynamic.d.ts +2 -0
- package/dist/modules/search-form/hotel/hotel-filters/HotelFiltersDynamic.js +1 -0
- package/dist/modules/search-form/hotel/hotel-filters/HotelFiltersMobilePopup.d.ts +2 -0
- package/dist/modules/search-form/hotel/hotel-filters/HotelFiltersMobilePopup.js +1 -0
- package/dist/modules/search-form/hotel/hotel-filters/RangeBlock.d.ts +1 -0
- package/dist/modules/search-form/hotel/hotel-filters/RangeBlock.js +1 -0
- package/dist/modules/search-form/hotel/hotel-filters/index.d.ts +1 -0
- package/dist/modules/search-form/hotel/hotel-filters/index.js +1 -0
- package/dist/modules/tabs/FlightsTab.d.ts +1 -0
- package/dist/modules/tabs/FlightsTab.js +1 -0
- package/dist/modules/tabs/HotelsTab.d.ts +1 -0
- package/dist/modules/tabs/HotelsTab.js +1 -0
- package/dist/store/index.d.ts +22 -0
- package/dist/store/index.js +19 -0
- package/dist/theme/colors.d.ts +56 -0
- package/dist/theme/colors.js +56 -0
- package/dist/theme/formStyles.d.ts +76 -0
- package/dist/theme/formStyles.js +78 -0
- package/dist/utils/applyWidgetColors.d.ts +1 -0
- package/dist/utils/applyWidgetColors.js +2 -0
- package/dist/utils/dateTime.d.ts +2 -0
- package/dist/utils/dateTime.js +23 -0
- package/dist/utils/fetchSSE.d.ts +23 -0
- package/dist/utils/fetchSSE.js +104 -0
- package/dist/utils/getToken.d.ts +3 -0
- package/dist/utils/getToken.js +12 -0
- package/package.json +64 -0
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { View, Text, TouchableOpacity, StyleSheet, Linking, } from "react-native";
|
|
3
|
+
import HotelGallery from "./HotelGallery";
|
|
4
|
+
import { useApiToken } from "../../../../utils/getToken";
|
|
5
|
+
import { useWidget } from "../../../../context/WidgetContext";
|
|
6
|
+
import { Colors, Spacing, BorderRadius, FontSize } from "../../../../theme/colors";
|
|
7
|
+
const StarIcon = () => (_jsx(Text, { style: starStyles.star, children: "\u2605" }));
|
|
8
|
+
const starStyles = StyleSheet.create({
|
|
9
|
+
star: {
|
|
10
|
+
fontSize: FontSize.sm,
|
|
11
|
+
color: "#F5A623",
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
const HotelCard = ({ hotel, index, total, translations, lang, onToggleDescription, }) => {
|
|
15
|
+
const token = useApiToken();
|
|
16
|
+
const { config } = useWidget();
|
|
17
|
+
const name = hotel.hotelNames?.mainName || hotel.propertyName || hotel.name || "Unnamed";
|
|
18
|
+
const address = hotel.address || "";
|
|
19
|
+
const description = hotel.description || "";
|
|
20
|
+
const stars = hotel.ratings?.star || 0;
|
|
21
|
+
const reviewsCount = hotel.ratings?.count || 0;
|
|
22
|
+
const ratingText = hotel.ratings?.text || "";
|
|
23
|
+
const ratingValue = hotel.ratings?.overall || "";
|
|
24
|
+
const nightlyPrice = hotel.nightlyPrice;
|
|
25
|
+
const totalPrice = hotel.totalPrice;
|
|
26
|
+
const isSoldOut = hotel.soldOut === true;
|
|
27
|
+
const currencySign = hotel.currencySign || "$";
|
|
28
|
+
const heroImages = hotel.heroImages || [];
|
|
29
|
+
const HOST_URL = config?.additional?.basket_link?.trim() || "https://travel-code.com";
|
|
30
|
+
const url = `${HOST_URL}${hotel.url || "#"}&accessToken=${token}&language=${lang}`;
|
|
31
|
+
const handleOpenUrl = () => {
|
|
32
|
+
Linking.openURL(url).catch(() => { });
|
|
33
|
+
};
|
|
34
|
+
const truncatedDescription = description.length > 300
|
|
35
|
+
? `${description.slice(0, 300)}...`
|
|
36
|
+
: description;
|
|
37
|
+
return (_jsxs(View, { style: styles.card, children: [_jsx(HotelGallery, { images: heroImages }), _jsxs(View, { style: styles.content, children: [_jsx(TouchableOpacity, { onPress: handleOpenUrl, activeOpacity: 0.7, children: _jsx(Text, { style: styles.hotelName, numberOfLines: 2, children: name }) }), stars > 0 && (_jsx(View, { style: styles.starsRow, children: Array.from({ length: stars }).map((_, i) => (_jsx(StarIcon, {}, i))) })), address ? (_jsx(Text, { style: styles.address, numberOfLines: 1, children: address })) : null, description ? (_jsxs(View, { style: styles.descriptionContainer, children: [_jsx(Text, { style: styles.descriptionText, children: hotel.showFullDescription
|
|
38
|
+
? description
|
|
39
|
+
: truncatedDescription }), description.length > 300 && (_jsx(TouchableOpacity, { onPress: onToggleDescription, children: _jsx(Text, { style: styles.toggleDescription, children: hotel.showFullDescription
|
|
40
|
+
? translations["hotels_hide_description"] || "Hide"
|
|
41
|
+
: translations["hotels_show_description"] || "Show more" }) }))] })) : null, hotel.availableRooms === 1 && (_jsx(Text, { style: styles.warningText, children: translations["hotels_only_1_room"] ||
|
|
42
|
+
"Only 1 room left at this price" })), hotel.availableRooms > 1 && hotel.availableRooms < 5 && (_jsx(Text, { style: styles.warningText, children: translations["hotels_only_few_rooms"]
|
|
43
|
+
? translations["hotels_only_few_rooms"].replace("{availableRooms}", String(hotel.availableRooms))
|
|
44
|
+
: `Only ${hotel.availableRooms} rooms left at this price` }))] }), _jsx(View, { style: styles.priceSection, children: isSoldOut ? (_jsx(View, { style: styles.soldOutBlock, children: _jsx(Text, { style: styles.soldOutText, children: translations["hotels_sold_out"] || "Sold Out" }) })) : (_jsxs(_Fragment, { children: [hotel.refundable && (_jsx(Text, { style: styles.refundableText, children: translations["hotels_refundable"] || "Free cancellation" })), _jsxs(View, { style: styles.priceBlock, children: [_jsxs(Text, { style: styles.nightlyPrice, children: [currencySign, nightlyPrice, _jsxs(Text, { style: styles.perNightLabel, children: [" ", translations["hotels_price_per_night"] || "/ night"] })] }), _jsxs(Text, { style: styles.totalPriceText, children: [translations["hotels_total_price"] || "Total:", " ", currencySign, totalPrice] }), _jsx(Text, { style: styles.taxesText, children: translations["hotels_taxes_included"] ||
|
|
45
|
+
"(incl. taxes & fees)" })] }), ratingValue ? (_jsxs(View, { style: styles.ratingBlock, children: [_jsx(View, { style: [styles.ratingBadge, { backgroundColor: parseFloat(ratingValue) >= 4 ? '#1a8917' : Colors.textTertiary }], children: _jsx(Text, { style: styles.ratingBadgeText, children: ratingValue }) }), _jsxs(View, { children: [_jsx(Text, { style: styles.ratingLabel, children: ratingText }), reviewsCount > 0 && (_jsxs(Text, { style: styles.ratingCount, children: [reviewsCount, " ", translations["hotels_reviews"] || "reviews"] }))] })] })) : null, _jsx(TouchableOpacity, { style: styles.viewButton, onPress: handleOpenUrl, activeOpacity: 0.8, children: _jsx(Text, { style: styles.viewButtonText, children: translations["hotels_view_button"] || "View deal" }) })] })) })] }));
|
|
46
|
+
};
|
|
47
|
+
const styles = StyleSheet.create({
|
|
48
|
+
card: {
|
|
49
|
+
backgroundColor: Colors.surface,
|
|
50
|
+
borderRadius: BorderRadius.lg,
|
|
51
|
+
marginHorizontal: Spacing.lg,
|
|
52
|
+
marginBottom: Spacing.lg,
|
|
53
|
+
shadowColor: Colors.black,
|
|
54
|
+
shadowOffset: { width: 0, height: 2 },
|
|
55
|
+
shadowOpacity: 0.08,
|
|
56
|
+
shadowRadius: 8,
|
|
57
|
+
elevation: 3,
|
|
58
|
+
overflow: "hidden",
|
|
59
|
+
},
|
|
60
|
+
cardLast: {
|
|
61
|
+
marginBottom: 0,
|
|
62
|
+
},
|
|
63
|
+
content: {
|
|
64
|
+
padding: Spacing.md,
|
|
65
|
+
},
|
|
66
|
+
hotelName: {
|
|
67
|
+
fontSize: FontSize.lg,
|
|
68
|
+
fontWeight: "600",
|
|
69
|
+
color: Colors.text,
|
|
70
|
+
},
|
|
71
|
+
starsRow: {
|
|
72
|
+
flexDirection: "row",
|
|
73
|
+
gap: 2,
|
|
74
|
+
marginTop: Spacing.xs,
|
|
75
|
+
},
|
|
76
|
+
address: {
|
|
77
|
+
fontSize: FontSize.sm,
|
|
78
|
+
color: Colors.textSecondary,
|
|
79
|
+
marginTop: Spacing.xs,
|
|
80
|
+
},
|
|
81
|
+
descriptionContainer: {
|
|
82
|
+
marginTop: Spacing.sm,
|
|
83
|
+
},
|
|
84
|
+
descriptionText: {
|
|
85
|
+
fontSize: FontSize.sm,
|
|
86
|
+
color: Colors.textSecondary,
|
|
87
|
+
lineHeight: 18,
|
|
88
|
+
},
|
|
89
|
+
toggleDescription: {
|
|
90
|
+
fontSize: FontSize.sm,
|
|
91
|
+
color: Colors.primary,
|
|
92
|
+
fontWeight: "500",
|
|
93
|
+
marginTop: Spacing.xs,
|
|
94
|
+
},
|
|
95
|
+
warningText: {
|
|
96
|
+
fontSize: FontSize.xs,
|
|
97
|
+
color: Colors.warning,
|
|
98
|
+
fontWeight: "500",
|
|
99
|
+
marginTop: Spacing.sm,
|
|
100
|
+
},
|
|
101
|
+
priceSection: {
|
|
102
|
+
padding: Spacing.md,
|
|
103
|
+
},
|
|
104
|
+
soldOutBlock: {
|
|
105
|
+
alignItems: "center",
|
|
106
|
+
paddingVertical: Spacing.md,
|
|
107
|
+
},
|
|
108
|
+
soldOutText: {
|
|
109
|
+
fontSize: FontSize.lg,
|
|
110
|
+
fontWeight: "600",
|
|
111
|
+
color: Colors.error,
|
|
112
|
+
},
|
|
113
|
+
refundableText: {
|
|
114
|
+
fontSize: FontSize.xs,
|
|
115
|
+
color: Colors.success,
|
|
116
|
+
fontWeight: "500",
|
|
117
|
+
marginBottom: Spacing.sm,
|
|
118
|
+
},
|
|
119
|
+
priceBlock: {
|
|
120
|
+
marginBottom: Spacing.sm,
|
|
121
|
+
},
|
|
122
|
+
nightlyPrice: {
|
|
123
|
+
fontSize: FontSize.xl,
|
|
124
|
+
fontWeight: "700",
|
|
125
|
+
color: Colors.text,
|
|
126
|
+
},
|
|
127
|
+
perNightLabel: {
|
|
128
|
+
fontSize: FontSize.sm,
|
|
129
|
+
fontWeight: "400",
|
|
130
|
+
color: Colors.textSecondary,
|
|
131
|
+
},
|
|
132
|
+
totalPriceText: {
|
|
133
|
+
fontSize: FontSize.sm,
|
|
134
|
+
color: Colors.textSecondary,
|
|
135
|
+
marginTop: 2,
|
|
136
|
+
},
|
|
137
|
+
taxesText: {
|
|
138
|
+
fontSize: FontSize.xs,
|
|
139
|
+
color: Colors.textTertiary,
|
|
140
|
+
marginTop: 2,
|
|
141
|
+
},
|
|
142
|
+
ratingBlock: {
|
|
143
|
+
flexDirection: "row",
|
|
144
|
+
alignItems: "center",
|
|
145
|
+
gap: Spacing.sm,
|
|
146
|
+
marginBottom: Spacing.md,
|
|
147
|
+
},
|
|
148
|
+
ratingBadge: {
|
|
149
|
+
backgroundColor: Colors.primary,
|
|
150
|
+
borderRadius: BorderRadius.sm,
|
|
151
|
+
paddingHorizontal: Spacing.sm,
|
|
152
|
+
paddingVertical: Spacing.xs,
|
|
153
|
+
},
|
|
154
|
+
ratingBadgeText: {
|
|
155
|
+
fontSize: FontSize.sm,
|
|
156
|
+
fontWeight: "700",
|
|
157
|
+
color: Colors.textOnPrimary,
|
|
158
|
+
},
|
|
159
|
+
ratingLabel: {
|
|
160
|
+
fontSize: FontSize.sm,
|
|
161
|
+
fontWeight: "500",
|
|
162
|
+
color: Colors.text,
|
|
163
|
+
},
|
|
164
|
+
ratingCount: {
|
|
165
|
+
fontSize: FontSize.xs,
|
|
166
|
+
color: Colors.textTertiary,
|
|
167
|
+
},
|
|
168
|
+
viewButton: {
|
|
169
|
+
backgroundColor: Colors.primary,
|
|
170
|
+
borderRadius: BorderRadius.md,
|
|
171
|
+
paddingVertical: Spacing.md,
|
|
172
|
+
alignItems: "center",
|
|
173
|
+
},
|
|
174
|
+
viewButtonText: {
|
|
175
|
+
fontSize: FontSize.md,
|
|
176
|
+
fontWeight: "600",
|
|
177
|
+
color: Colors.textOnPrimary,
|
|
178
|
+
},
|
|
179
|
+
});
|
|
180
|
+
export default HotelCard;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { View, Text, StyleSheet } from "react-native";
|
|
3
|
+
import { Colors, Spacing, FontSize } from "../../../../theme/colors";
|
|
4
|
+
const HotelEmptyState = ({ translations }) => (_jsxs(View, { style: styles.container, children: [_jsx(Text, { style: styles.title, children: translations["hotels_not_found_title"] || "No hotels found" }), _jsxs(View, { style: styles.content, children: [_jsx(Text, { style: styles.hint, children: translations["hotels_not_found_hint"] ||
|
|
5
|
+
"Try adjusting your search parameters:" }), _jsxs(Text, { style: styles.option, children: ["\u2022", " ", translations["hotels_not_found_option_1"] || "Change stay dates"] }), _jsxs(Text, { style: styles.option, children: ["\u2022", " ", translations["hotels_not_found_option_2"] ||
|
|
6
|
+
"Choose a different city or hotel"] }), _jsxs(Text, { style: styles.option, children: ["\u2022", " ", translations["hotels_not_found_option_3"] || "Remove some filters"] })] })] }));
|
|
7
|
+
const styles = StyleSheet.create({
|
|
8
|
+
container: {
|
|
9
|
+
padding: Spacing.xxl,
|
|
10
|
+
alignItems: "center",
|
|
11
|
+
},
|
|
12
|
+
title: {
|
|
13
|
+
fontSize: FontSize.xl,
|
|
14
|
+
fontWeight: "600",
|
|
15
|
+
color: Colors.text,
|
|
16
|
+
marginBottom: Spacing.md,
|
|
17
|
+
textAlign: "center",
|
|
18
|
+
},
|
|
19
|
+
content: {
|
|
20
|
+
alignItems: "flex-start",
|
|
21
|
+
},
|
|
22
|
+
hint: {
|
|
23
|
+
fontSize: FontSize.md,
|
|
24
|
+
color: Colors.textSecondary,
|
|
25
|
+
marginBottom: Spacing.sm,
|
|
26
|
+
},
|
|
27
|
+
option: {
|
|
28
|
+
fontSize: FontSize.md,
|
|
29
|
+
color: Colors.textSecondary,
|
|
30
|
+
marginBottom: Spacing.xs,
|
|
31
|
+
paddingLeft: Spacing.sm,
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
export default HotelEmptyState;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useRef, useCallback } from "react";
|
|
3
|
+
import { View, Text, Image, FlatList, StyleSheet, Dimensions, } from "react-native";
|
|
4
|
+
import { Colors, Spacing, BorderRadius, FontSize } from "../../../../theme/colors";
|
|
5
|
+
const SCREEN_WIDTH = Dimensions.get("window").width;
|
|
6
|
+
const GALLERY_WIDTH = SCREEN_WIDTH - Spacing.lg * 2;
|
|
7
|
+
const GALLERY_HEIGHT = 180;
|
|
8
|
+
const PLACEHOLDER_IMAGE = "https://via.placeholder.com/400x200?text=No+Photo";
|
|
9
|
+
const HotelGallery = ({ images }) => {
|
|
10
|
+
const slides = images?.length ? images : [PLACEHOLDER_IMAGE];
|
|
11
|
+
const hasMultiple = slides.length > 1;
|
|
12
|
+
const [activeIndex, setActiveIndex] = useState(0);
|
|
13
|
+
const onViewableItemsChanged = useRef(({ viewableItems }) => {
|
|
14
|
+
if (viewableItems.length > 0 && viewableItems[0].index != null) {
|
|
15
|
+
setActiveIndex(viewableItems[0].index);
|
|
16
|
+
}
|
|
17
|
+
}).current;
|
|
18
|
+
const viewabilityConfig = useRef({
|
|
19
|
+
itemVisiblePercentThreshold: 50,
|
|
20
|
+
}).current;
|
|
21
|
+
const renderItem = useCallback(({ item }) => (_jsx(Image, { source: { uri: item }, style: styles.image, resizeMode: "cover" })), []);
|
|
22
|
+
return (_jsxs(View, { style: styles.container, children: [_jsx(FlatList, { data: slides, renderItem: renderItem, keyExtractor: (_, index) => String(index), horizontal: true, pagingEnabled: true, showsHorizontalScrollIndicator: false, scrollEnabled: hasMultiple, onViewableItemsChanged: onViewableItemsChanged, viewabilityConfig: viewabilityConfig, snapToInterval: GALLERY_WIDTH, decelerationRate: "fast", getItemLayout: (_, index) => ({
|
|
23
|
+
length: GALLERY_WIDTH,
|
|
24
|
+
offset: GALLERY_WIDTH * index,
|
|
25
|
+
index,
|
|
26
|
+
}) }), hasMultiple && slides.length <= 10 && (_jsx(View, { style: styles.dotsContainer, children: slides.map((_, index) => (_jsx(View, { style: [
|
|
27
|
+
styles.dot,
|
|
28
|
+
index === activeIndex && styles.dotActive,
|
|
29
|
+
] }, index))) })), hasMultiple && slides.length > 10 && (_jsx(View, { style: styles.counterBadge, children: _jsxs(Text, { style: styles.counterText, children: [activeIndex + 1, "/", slides.length] }) }))] }));
|
|
30
|
+
};
|
|
31
|
+
const styles = StyleSheet.create({
|
|
32
|
+
container: {
|
|
33
|
+
width: "100%",
|
|
34
|
+
height: GALLERY_HEIGHT,
|
|
35
|
+
position: "relative",
|
|
36
|
+
},
|
|
37
|
+
image: {
|
|
38
|
+
width: GALLERY_WIDTH,
|
|
39
|
+
height: GALLERY_HEIGHT,
|
|
40
|
+
},
|
|
41
|
+
dotsContainer: {
|
|
42
|
+
position: "absolute",
|
|
43
|
+
bottom: Spacing.sm,
|
|
44
|
+
left: 0,
|
|
45
|
+
right: 0,
|
|
46
|
+
flexDirection: "row",
|
|
47
|
+
justifyContent: "center",
|
|
48
|
+
gap: 4,
|
|
49
|
+
},
|
|
50
|
+
dot: {
|
|
51
|
+
width: 6,
|
|
52
|
+
height: 6,
|
|
53
|
+
borderRadius: 3,
|
|
54
|
+
backgroundColor: "rgba(255,255,255,0.5)",
|
|
55
|
+
},
|
|
56
|
+
dotActive: {
|
|
57
|
+
backgroundColor: Colors.surface,
|
|
58
|
+
width: 8,
|
|
59
|
+
height: 8,
|
|
60
|
+
borderRadius: 4,
|
|
61
|
+
},
|
|
62
|
+
counterBadge: {
|
|
63
|
+
position: "absolute",
|
|
64
|
+
bottom: Spacing.sm,
|
|
65
|
+
right: Spacing.sm,
|
|
66
|
+
backgroundColor: "rgba(0,0,0,0.5)",
|
|
67
|
+
borderRadius: BorderRadius.sm,
|
|
68
|
+
paddingHorizontal: Spacing.sm,
|
|
69
|
+
paddingVertical: 2,
|
|
70
|
+
},
|
|
71
|
+
counterText: {
|
|
72
|
+
fontSize: FontSize.xs,
|
|
73
|
+
color: Colors.surface,
|
|
74
|
+
fontWeight: "600",
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
export default HotelGallery;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
type HotelListProps = {
|
|
3
|
+
offers: any[];
|
|
4
|
+
translations: Record<string, string>;
|
|
5
|
+
lang: string;
|
|
6
|
+
onToggleDescription: (hotelIndex: number) => void;
|
|
7
|
+
};
|
|
8
|
+
declare const HotelList: React.FC<HotelListProps>;
|
|
9
|
+
export default HotelList;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { View, StyleSheet } from "react-native";
|
|
3
|
+
import HotelCard from "./HotelCard";
|
|
4
|
+
const HotelList = ({ offers, translations, lang, onToggleDescription, }) => {
|
|
5
|
+
return (_jsx(View, { style: styles.container, children: offers.map((hotel, index) => (_jsx(HotelCard, { hotel: hotel, index: index, total: offers.length, translations: translations, lang: lang, onToggleDescription: () => onToggleDescription(index) }, String(hotel.id || hotel.propertyId || index)))) }));
|
|
6
|
+
};
|
|
7
|
+
const styles = StyleSheet.create({
|
|
8
|
+
container: {
|
|
9
|
+
flex: 1,
|
|
10
|
+
},
|
|
11
|
+
});
|
|
12
|
+
export default HotelList;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type HotelMapPin = {
|
|
3
|
+
id: number;
|
|
4
|
+
hotelId: number;
|
|
5
|
+
lat: number;
|
|
6
|
+
lng: number;
|
|
7
|
+
price: number;
|
|
8
|
+
currency: string;
|
|
9
|
+
name: string;
|
|
10
|
+
soldOut?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export declare function pinsFromOffers(hotels: any[], currency: string): HotelMapPin[];
|
|
13
|
+
type HotelMapProps = {
|
|
14
|
+
pins: Array<HotelMapPin>;
|
|
15
|
+
allHotels?: any[];
|
|
16
|
+
streamCompleted?: boolean;
|
|
17
|
+
loading?: boolean;
|
|
18
|
+
selectedHotelId?: number | null;
|
|
19
|
+
onHotelSelect?: (hotelId: number) => void;
|
|
20
|
+
onRefreshSearch?: () => void;
|
|
21
|
+
translations: Record<string, string>;
|
|
22
|
+
lang: string;
|
|
23
|
+
searchParams?: Record<string, any> | null;
|
|
24
|
+
};
|
|
25
|
+
declare const HotelMap: React.FC<HotelMapProps>;
|
|
26
|
+
export default HotelMap;
|