bukazu-portal-react 2.0.21 → 2.1.4
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/CHANGELOG.MD +11 -0
- package/build/index.css +100 -101
- package/build/index.html +2 -1
- package/build/index.js +6172 -9818
- package/package.json +4 -4
- package/src/_lib/SearchQueries.js +53 -0
- package/src/components/SearchPage/Field.js +7 -5
- package/src/components/SearchPage/Results.js +6 -2
- package/src/components/SearchPage/SearchPage.js +13 -2
- package/src/components/SearchPage/SingleResult.js +26 -10
- package/src/index.js +2 -15
- package/src/locales/de.json +2 -1
- package/src/locales/en.json +2 -1
- package/src/locales/es.json +2 -1
- package/src/locales/fr.json +2 -1
- package/src/locales/it.json +2 -1
- package/src/locales/nl.json +2 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bukazu-portal-react",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.4",
|
|
4
4
|
"description": "A package for loading the calendar and search module from bukazu loading into a react app.",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"repository": "https://github.com/BUKAZU/React-portal",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"@babel/preset-react": "^7.14.5",
|
|
24
24
|
"@cypress/react": "^5.3.3",
|
|
25
25
|
"@cypress/webpack-dev-server": "^1.1.3",
|
|
26
|
-
"@rollup/plugin-commonjs": "^
|
|
26
|
+
"@rollup/plugin-commonjs": "^21.0.0",
|
|
27
27
|
"@rollup/plugin-json": "^4.1.0",
|
|
28
28
|
"autoprefixer": "^10.2.5",
|
|
29
29
|
"babel-core": "^6.26.3",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"postcss-loader": "^5.2.0",
|
|
48
48
|
"postcss-modules": "^4.2.2",
|
|
49
49
|
"postcss-nested": "^5.0.5",
|
|
50
|
-
"postcss-preset-env": "^
|
|
50
|
+
"postcss-preset-env": "^7.4.3",
|
|
51
51
|
"prettier": "^2.3.1",
|
|
52
52
|
"react": "^16.4.1",
|
|
53
53
|
"react-dev-utils": "^5.0.1",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"formik": "^2.2.9",
|
|
72
72
|
"graphql": "^15.6.0",
|
|
73
73
|
"react-date-picker": "^8.1.1",
|
|
74
|
-
"react-intl": "
|
|
74
|
+
"react-intl": "5",
|
|
75
75
|
"react-js-pagination": "^3.0.2"
|
|
76
76
|
},
|
|
77
77
|
"eslintConfig": {
|
|
@@ -50,6 +50,59 @@ export const HOUSES_QUERY = gql`
|
|
|
50
50
|
}
|
|
51
51
|
`;
|
|
52
52
|
|
|
53
|
+
export const HOUSES_PRICE_QUERY = gql`
|
|
54
|
+
query PortalSiteHousesQuery(
|
|
55
|
+
$id: ID!
|
|
56
|
+
$country_id: ID
|
|
57
|
+
$region_id: String
|
|
58
|
+
$city_id: String
|
|
59
|
+
$persons_min: Int
|
|
60
|
+
$persons_max: Int
|
|
61
|
+
$bedrooms_min: Int
|
|
62
|
+
$bathrooms_min: Int
|
|
63
|
+
$arrival_date: String
|
|
64
|
+
$starts_at: Date!
|
|
65
|
+
$ends_at: Date!
|
|
66
|
+
$no_nights: Int
|
|
67
|
+
$properties: String
|
|
68
|
+
$weekprice_max: Int
|
|
69
|
+
$limit: Int
|
|
70
|
+
$skip: Int
|
|
71
|
+
) {
|
|
72
|
+
PortalSite(id: $id) {
|
|
73
|
+
houses(
|
|
74
|
+
country_id: $country_id
|
|
75
|
+
region_id: $region_id
|
|
76
|
+
city_id: $city_id
|
|
77
|
+
persons_min: $persons_min
|
|
78
|
+
persons_max: $persons_max
|
|
79
|
+
bedrooms_min: $bedrooms_min
|
|
80
|
+
bathrooms_min: $bathrooms_min
|
|
81
|
+
arrival_date: $arrival_date
|
|
82
|
+
weekprice_max: $weekprice_max
|
|
83
|
+
no_nights_min: $no_nights
|
|
84
|
+
properties: $properties
|
|
85
|
+
limit: $limit
|
|
86
|
+
skip: $skip
|
|
87
|
+
) {
|
|
88
|
+
id
|
|
89
|
+
name
|
|
90
|
+
persons
|
|
91
|
+
bathrooms
|
|
92
|
+
bedrooms
|
|
93
|
+
description
|
|
94
|
+
image_url
|
|
95
|
+
house_url
|
|
96
|
+
province
|
|
97
|
+
city
|
|
98
|
+
country_name
|
|
99
|
+
minimum_week_price
|
|
100
|
+
booking_price(starts_at: $starts_at, ends_at: $ends_at)
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
`;
|
|
105
|
+
|
|
53
106
|
export const HOUSE_COUNT_QUERY = gql`
|
|
54
107
|
query PortalSiteHousesQuery(
|
|
55
108
|
$id: ID!
|
|
@@ -57,8 +57,8 @@ class Field extends Component {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
render() {
|
|
60
|
-
const field = this.props
|
|
61
|
-
|
|
60
|
+
const { PortalSite, field, filters, value } = this.props;
|
|
61
|
+
|
|
62
62
|
let options = [];
|
|
63
63
|
if (includes(['countries', 'cities', 'regions'], field.id)) {
|
|
64
64
|
options = PortalSite[field.id];
|
|
@@ -74,9 +74,10 @@ class Field extends Component {
|
|
|
74
74
|
options = this.createNumberArray(PortalSite[field.id]);
|
|
75
75
|
}
|
|
76
76
|
let input;
|
|
77
|
-
const
|
|
78
|
-
const
|
|
79
|
-
|
|
77
|
+
const countries = filters.countries ;
|
|
78
|
+
const regions = Array.isArray(filters.regions)
|
|
79
|
+
? filters.regions
|
|
80
|
+
: [filters.regions];
|
|
80
81
|
const properties = this.props.filters.properties || [];
|
|
81
82
|
|
|
82
83
|
if (field.id === 'properties') {
|
|
@@ -108,6 +109,7 @@ class Field extends Component {
|
|
|
108
109
|
}
|
|
109
110
|
});
|
|
110
111
|
} else if (field.type === 'select') {
|
|
112
|
+
console.log({ countries });
|
|
111
113
|
if (options && includes(['countries', 'cities', 'regions'], field.id)) {
|
|
112
114
|
input = (
|
|
113
115
|
<select
|
|
@@ -7,7 +7,7 @@ import Loading from '../icons/loading.svg';
|
|
|
7
7
|
import SingleResult from './SingleResult';
|
|
8
8
|
import Paginator from './Paginator';
|
|
9
9
|
|
|
10
|
-
import { HOUSES_QUERY } from '../../_lib/SearchQueries';
|
|
10
|
+
import { HOUSES_PRICE_QUERY, HOUSES_QUERY } from '../../_lib/SearchQueries';
|
|
11
11
|
import { ApiError } from '../Error';
|
|
12
12
|
|
|
13
13
|
function Results({
|
|
@@ -20,11 +20,13 @@ function Results({
|
|
|
20
20
|
activePage,
|
|
21
21
|
}) {
|
|
22
22
|
let min_nights = null;
|
|
23
|
+
let requestPrices = false
|
|
23
24
|
if (filters.departure_date && filters.arrival_date) {
|
|
24
25
|
min_nights = differenceInCalendarDays(
|
|
25
26
|
filters.departure_date,
|
|
26
27
|
filters.arrival_date
|
|
27
28
|
);
|
|
29
|
+
requestPrices = true
|
|
28
30
|
} else if (filters.arrival_date) {
|
|
29
31
|
min_nights = 1;
|
|
30
32
|
}
|
|
@@ -45,6 +47,8 @@ function Results({
|
|
|
45
47
|
bedrooms_min: Number(filters.bedrooms_min),
|
|
46
48
|
bathrooms_min: Number(filters.bathrooms_min),
|
|
47
49
|
arrival_date: filters.arrival_date,
|
|
50
|
+
starts_at: filters.arrival_date,
|
|
51
|
+
ends_at: filters.departure_date,
|
|
48
52
|
no_nights: Number(min_nights) || null,
|
|
49
53
|
extra_search: filters.extra_search,
|
|
50
54
|
properties,
|
|
@@ -55,7 +59,7 @@ function Results({
|
|
|
55
59
|
};
|
|
56
60
|
|
|
57
61
|
return (
|
|
58
|
-
<Query query={HOUSES_QUERY} variables={variables}>
|
|
62
|
+
<Query query={requestPrices ? HOUSES_PRICE_QUERY : HOUSES_QUERY} variables={variables}>
|
|
59
63
|
{({ loading, error, data }) => {
|
|
60
64
|
if (loading)
|
|
61
65
|
return (
|
|
@@ -3,8 +3,6 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
import Filters from './Filters';
|
|
4
4
|
import Results from './Results';
|
|
5
5
|
|
|
6
|
-
// import './SearchPage.css'
|
|
7
|
-
|
|
8
6
|
class SearchPage extends Component {
|
|
9
7
|
constructor(props) {
|
|
10
8
|
super(props);
|
|
@@ -21,11 +19,23 @@ class SearchPage extends Component {
|
|
|
21
19
|
this.pageChange = this.pageChange.bind(this);
|
|
22
20
|
}
|
|
23
21
|
|
|
22
|
+
componentDidMount() {
|
|
23
|
+
let filters = localStorage.getItem('bukazuFilters')
|
|
24
|
+
let activePage = localStorage.getItem('bukazuActivePage')
|
|
25
|
+
|
|
26
|
+
this.setState({
|
|
27
|
+
filters: JSON.parse(filters) || this.props.filters,
|
|
28
|
+
});
|
|
29
|
+
this.pageChange(activePage || 1)
|
|
30
|
+
}
|
|
31
|
+
|
|
24
32
|
onFilterChange(data) {
|
|
25
33
|
let filters = data;
|
|
26
34
|
this.setState({
|
|
27
35
|
filters,
|
|
28
36
|
});
|
|
37
|
+
|
|
38
|
+
localStorage.setItem('bukazuFilters', JSON.stringify(filters));
|
|
29
39
|
this.pageChange(1);
|
|
30
40
|
}
|
|
31
41
|
|
|
@@ -33,6 +43,7 @@ class SearchPage extends Component {
|
|
|
33
43
|
const { limit } = this.state;
|
|
34
44
|
let newSkip = pageNumber * limit - limit;
|
|
35
45
|
|
|
46
|
+
localStorage.setItem('bukazuActivePage', pageNumber)
|
|
36
47
|
this.setState({
|
|
37
48
|
activePage: pageNumber,
|
|
38
49
|
skip: newSkip,
|
|
@@ -42,15 +42,31 @@ function SingleResult({ result, options }) {
|
|
|
42
42
|
</div>
|
|
43
43
|
{thisOptions.showPrice && (
|
|
44
44
|
<div className="result-price">
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
45
|
+
{result.booking_price ? (
|
|
46
|
+
<>
|
|
47
|
+
<FormattedMessage id="price_from" />
|
|
48
|
+
<span className="price">
|
|
49
|
+
€{' '}
|
|
50
|
+
<FormattedNumber
|
|
51
|
+
value={result.booking_price.total_price}
|
|
52
|
+
minimumFractionDigits={0}
|
|
53
|
+
maximumFractionDigits={0}
|
|
54
|
+
/>
|
|
55
|
+
</span>
|
|
56
|
+
</>
|
|
57
|
+
) : (
|
|
58
|
+
<>
|
|
59
|
+
<FormattedMessage id="minimum_week_price" />
|
|
60
|
+
<span className="price">
|
|
61
|
+
€{' '}
|
|
62
|
+
<FormattedNumber
|
|
63
|
+
value={result.minimum_week_price}
|
|
64
|
+
minimumFractionDigits={0}
|
|
65
|
+
maximumFractionDigits={0}
|
|
66
|
+
/>
|
|
67
|
+
</span>
|
|
68
|
+
</>
|
|
69
|
+
)}
|
|
54
70
|
</div>
|
|
55
71
|
)}
|
|
56
72
|
<div className="result-button">
|
|
@@ -60,7 +76,7 @@ function SingleResult({ result, options }) {
|
|
|
60
76
|
</div>
|
|
61
77
|
</a>
|
|
62
78
|
);
|
|
63
|
-
}
|
|
79
|
+
}
|
|
64
80
|
|
|
65
81
|
SingleResult.propTypes = {
|
|
66
82
|
result: PropTypes.object.isRequired,
|
package/src/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import App from "./components/App";
|
|
3
|
-
import { IntlProvider
|
|
3
|
+
import { IntlProvider } from "react-intl";
|
|
4
4
|
// import registerServiceWorker from './registerServiceWorker';
|
|
5
5
|
|
|
6
6
|
import {
|
|
@@ -9,12 +9,6 @@ import {
|
|
|
9
9
|
ApolloProvider,
|
|
10
10
|
} from "@apollo/client";
|
|
11
11
|
|
|
12
|
-
import enData from "react-intl/locale-data/en";
|
|
13
|
-
import frData from "react-intl/locale-data/fr";
|
|
14
|
-
import esData from "react-intl/locale-data/es";
|
|
15
|
-
import nlData from "react-intl/locale-data/nl";
|
|
16
|
-
import deData from "react-intl/locale-data/de";
|
|
17
|
-
import itData from "react-intl/locale-data/it";
|
|
18
12
|
|
|
19
13
|
import en from "./locales/en.json";
|
|
20
14
|
import nl from "./locales/nl.json";
|
|
@@ -51,14 +45,7 @@ function Portal({ portalCode, objectCode, pageType, locale, filters, api_url } )
|
|
|
51
45
|
|
|
52
46
|
const messages = { en, nl, de, fr, es, it };
|
|
53
47
|
|
|
54
|
-
|
|
55
|
-
...enData,
|
|
56
|
-
...frData,
|
|
57
|
-
...esData,
|
|
58
|
-
...nlData,
|
|
59
|
-
...itData,
|
|
60
|
-
...deData,
|
|
61
|
-
]);
|
|
48
|
+
|
|
62
49
|
|
|
63
50
|
window.__localeId__ = locale;
|
|
64
51
|
|
package/src/locales/de.json
CHANGED
|
@@ -106,5 +106,6 @@
|
|
|
106
106
|
"no_discount_code_found": "Kein Rabatt mit eingegebenem Code gefunden",
|
|
107
107
|
"discount_code": "Rabatt-Code",
|
|
108
108
|
"minimum_nights": "Mindestens {minimum} Nächte",
|
|
109
|
-
"can_only_take_insurance_in_de_be_nl": "Sie können sich nur versichern, wenn Sie in den Niederlanden, Deutschland oder Belgien wohnen."
|
|
109
|
+
"can_only_take_insurance_in_de_be_nl": "Sie können sich nur versichern, wenn Sie in den Niederlanden, Deutschland oder Belgien wohnen.",
|
|
110
|
+
"price_from": "Preis von"
|
|
110
111
|
}
|
package/src/locales/en.json
CHANGED
|
@@ -107,5 +107,6 @@
|
|
|
107
107
|
"no_discount_code_found": "No discount found with entered code",
|
|
108
108
|
"discount_code": "Discount code",
|
|
109
109
|
"minimum_nights": "At least {minimum} nights",
|
|
110
|
-
"can_only_take_insurance_in_de_be_nl": "You can only take out insurance if you live in the Netherlands, Germany or Belgium."
|
|
110
|
+
"can_only_take_insurance_in_de_be_nl": "You can only take out insurance if you live in the Netherlands, Germany or Belgium.",
|
|
111
|
+
"price_from": "Price from"
|
|
111
112
|
}
|
package/src/locales/es.json
CHANGED
|
@@ -102,5 +102,6 @@
|
|
|
102
102
|
"camper.pick_your_arrivaldate_in_the_calendar": "Elija una fecha de recogida",
|
|
103
103
|
"no": "No",
|
|
104
104
|
"minimum_nights": "Al menos {minimum} noches",
|
|
105
|
-
"can_only_take_insurance_in_de_be_nl": "Solo puede contratar un seguro si vive en los Países Bajos, Alemania o Bélgica."
|
|
105
|
+
"can_only_take_insurance_in_de_be_nl": "Solo puede contratar un seguro si vive en los Países Bajos, Alemania o Bélgica.",
|
|
106
|
+
"price_from": "Precio de"
|
|
106
107
|
}
|
package/src/locales/fr.json
CHANGED
|
@@ -102,5 +102,6 @@
|
|
|
102
102
|
"camper.pick_your_arrivaldate_in_the_calendar": "Choisissez une date de pick-up",
|
|
103
103
|
"no": "Non",
|
|
104
104
|
"minimum_nights": "Au moins {minimum} nuits",
|
|
105
|
-
"can_only_take_insurance_in_de_be_nl": "Vous ne pouvez souscrire une assurance que si vous résidez aux Pays-Bas, en Allemagne ou en Belgique."
|
|
105
|
+
"can_only_take_insurance_in_de_be_nl": "Vous ne pouvez souscrire une assurance que si vous résidez aux Pays-Bas, en Allemagne ou en Belgique.",
|
|
106
|
+
"price_from": "Le prix de"
|
|
106
107
|
}
|
package/src/locales/it.json
CHANGED
|
@@ -102,5 +102,6 @@
|
|
|
102
102
|
"camper.pick_your_arrivaldate_in_the_calendar": "Scegli una data di ritiro",
|
|
103
103
|
"no": "No",
|
|
104
104
|
"minimum_nights": "Almeno {minimum} notti",
|
|
105
|
-
"can_only_take_insurance_in_de_be_nl": "Puoi stipulare un'assicurazione solo se vivi nei Paesi Bassi, in Germania o in Belgio."
|
|
105
|
+
"can_only_take_insurance_in_de_be_nl": "Puoi stipulare un'assicurazione solo se vivi nei Paesi Bassi, in Germania o in Belgio.",
|
|
106
|
+
"price_from": "Prezzo da"
|
|
106
107
|
}
|
package/src/locales/nl.json
CHANGED
|
@@ -107,5 +107,6 @@
|
|
|
107
107
|
"no_discount_code_found": "Geen korting gevonden met ingegeven code",
|
|
108
108
|
"discount_code": "Kortingscode",
|
|
109
109
|
"minimum_nights": "Minstens {minimum} nachten",
|
|
110
|
-
"can_only_take_insurance_in_de_be_nl": "U kunt alleen een verzekering afsluiten, wanneer u woont in Nederland, Duitsland of België."
|
|
110
|
+
"can_only_take_insurance_in_de_be_nl": "U kunt alleen een verzekering afsluiten, wanneer u woont in Nederland, Duitsland of België.",
|
|
111
|
+
"price_from": "Prijs vanaf"
|
|
111
112
|
}
|