bukazu-portal-react 3.3.3 → 3.3.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.
Files changed (184) hide show
  1. package/build/index.css +1 -1
  2. package/build/portal.es.js +19931 -20259
  3. package/build/portal.umd.js +80 -82
  4. package/package.json +9 -7
  5. package/.env.development +0 -1
  6. package/.eslintrc +0 -25
  7. package/.github/dependabot.yml +0 -11
  8. package/.github/workflows/node.js.yml +0 -31
  9. package/.github/workflows/npm-publish.yml +0 -33
  10. package/.nvmrc +0 -1
  11. package/.prettierrc +0 -6
  12. package/.vscode/settings.json +0 -24
  13. package/CHANGELOG.MD +0 -93
  14. package/babel.config.json +0 -6
  15. package/calendar.html +0 -16
  16. package/coverage/clover.xml +0 -28
  17. package/coverage/coverage-final.json +0 -2
  18. package/coverage/lcov-report/base.css +0 -224
  19. package/coverage/lcov-report/block-navigation.js +0 -87
  20. package/coverage/lcov-report/favicon.png +0 -0
  21. package/coverage/lcov-report/helper.ts.html +0 -142
  22. package/coverage/lcov-report/index.html +0 -116
  23. package/coverage/lcov-report/prettify.css +0 -1
  24. package/coverage/lcov-report/prettify.js +0 -2
  25. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  26. package/coverage/lcov-report/sorter.js +0 -196
  27. package/coverage/lcov.info +0 -36
  28. package/cypress/e2e/.examples/actions.spec.js +0 -299
  29. package/cypress/e2e/.examples/aliasing.spec.js +0 -39
  30. package/cypress/e2e/.examples/assertions.spec.js +0 -177
  31. package/cypress/e2e/.examples/connectors.spec.js +0 -97
  32. package/cypress/e2e/.examples/cookies.spec.js +0 -77
  33. package/cypress/e2e/.examples/cypress_api.spec.js +0 -202
  34. package/cypress/e2e/.examples/files.spec.js +0 -89
  35. package/cypress/e2e/.examples/local_storage.spec.js +0 -52
  36. package/cypress/e2e/.examples/location.spec.js +0 -32
  37. package/cypress/e2e/.examples/misc.spec.js +0 -104
  38. package/cypress/e2e/.examples/navigation.spec.js +0 -56
  39. package/cypress/e2e/.examples/network_requests.spec.js +0 -163
  40. package/cypress/e2e/.examples/querying.spec.js +0 -114
  41. package/cypress/e2e/.examples/spies_stubs_clocks.spec.js +0 -205
  42. package/cypress/e2e/.examples/traversal.spec.js +0 -121
  43. package/cypress/e2e/.examples/utilities.spec.js +0 -110
  44. package/cypress/e2e/.examples/viewport.spec.js +0 -59
  45. package/cypress/e2e/.examples/waiting.spec.js +0 -31
  46. package/cypress/e2e/.examples/window.spec.js +0 -22
  47. package/cypress/e2e/booking.spec.js +0 -81
  48. package/cypress/e2e/calendar.spec.js +0 -21
  49. package/cypress/e2e/search.spec.js +0 -25
  50. package/cypress/fixtures/example.json +0 -5
  51. package/cypress/plugins/index.js +0 -16
  52. package/cypress/support/commands.js +0 -25
  53. package/cypress/support/commands.ts +0 -37
  54. package/cypress/support/component-index.html +0 -12
  55. package/cypress/support/component.ts +0 -39
  56. package/cypress/support/e2e.js +0 -20
  57. package/cypress.config.ts +0 -15
  58. package/dev.tsx +0 -44
  59. package/index.html +0 -15
  60. package/invalid-calendar.html +0 -16
  61. package/jest.config.js +0 -195
  62. package/postcss.config.js +0 -17
  63. package/reviews.html +0 -16
  64. package/src/_lib/SearchQueries.ts +0 -145
  65. package/src/_lib/Tracking.ts +0 -51
  66. package/src/_lib/countries/de.json +0 -998
  67. package/src/_lib/countries/en.json +0 -998
  68. package/src/_lib/countries/es.json +0 -998
  69. package/src/_lib/countries/fr.json +0 -998
  70. package/src/_lib/countries/it.json +0 -998
  71. package/src/_lib/countries/nl.json +0 -998
  72. package/src/_lib/countries.ts +0 -15
  73. package/src/_lib/date_helper.ts +0 -27
  74. package/src/_lib/queries.ts +0 -244
  75. package/src/components/App.tsx +0 -108
  76. package/src/components/AppContext.ts +0 -14
  77. package/src/components/CalendarPage/BookingForm.tsx +0 -49
  78. package/src/components/CalendarPage/Calendar.tsx +0 -49
  79. package/src/components/CalendarPage/CalendarPage.tsx +0 -43
  80. package/src/components/CalendarPage/CalendarParts/CalendarContext.tsx +0 -89
  81. package/src/components/CalendarPage/CalendarParts/CalendarHeader.tsx +0 -72
  82. package/src/components/CalendarPage/CalendarParts/DayClasses.ts +0 -113
  83. package/src/components/CalendarPage/CalendarParts/GenerateCalendar.tsx +0 -72
  84. package/src/components/CalendarPage/CalendarParts/Legend.tsx +0 -33
  85. package/src/components/CalendarPage/CalendarParts/MonthHeader.tsx +0 -15
  86. package/src/components/CalendarPage/CalendarParts/Months.tsx +0 -37
  87. package/src/components/CalendarPage/CalendarParts/RenderCells.tsx +0 -97
  88. package/src/components/CalendarPage/CalendarParts/SingleMonth.tsx +0 -72
  89. package/src/components/CalendarPage/CalendarParts/StartBooking.tsx +0 -17
  90. package/src/components/CalendarPage/CalendarParts/WeekDays.tsx +0 -27
  91. package/src/components/CalendarPage/FormCreator.tsx +0 -230
  92. package/src/components/CalendarPage/FormItems/Date.tsx +0 -61
  93. package/src/components/CalendarPage/FormItems/NumberSelect.tsx +0 -39
  94. package/src/components/CalendarPage/FormItems/Select.tsx +0 -38
  95. package/src/components/CalendarPage/FormItems/index.ts +0 -4
  96. package/src/components/CalendarPage/PriceField/Price.tsx +0 -58
  97. package/src/components/CalendarPage/PriceField/Queries.ts +0 -23
  98. package/src/components/CalendarPage/PriceField/index.tsx +0 -129
  99. package/src/components/CalendarPage/Summary/CostRow.tsx +0 -58
  100. package/src/components/CalendarPage/Summary/CostSection.tsx +0 -15
  101. package/src/components/CalendarPage/Summary/CostSummary.tsx +0 -61
  102. package/src/components/CalendarPage/Summary/Description.tsx +0 -27
  103. package/src/components/CalendarPage/Summary/InsurancesAndRequired.tsx +0 -68
  104. package/src/components/CalendarPage/Summary/Object.tsx +0 -59
  105. package/src/components/CalendarPage/Summary/OnSite.tsx +0 -36
  106. package/src/components/CalendarPage/Summary/OptionalNotOnSite.tsx +0 -43
  107. package/src/components/CalendarPage/Summary/OptionalOnSite.tsx +0 -39
  108. package/src/components/CalendarPage/Summary/Queries.ts +0 -31
  109. package/src/components/CalendarPage/Summary/RentAndDiscount.tsx +0 -30
  110. package/src/components/CalendarPage/Summary/Totals.tsx +0 -89
  111. package/src/components/CalendarPage/Summary/cost_types.d.ts +0 -31
  112. package/src/components/CalendarPage/Summary/index.tsx +0 -24
  113. package/src/components/CalendarPage/calender_types.d.ts +0 -16
  114. package/src/components/CalendarPage/formParts/AssistanceMessage.tsx +0 -60
  115. package/src/components/CalendarPage/formParts/BookingHelpers.tsx +0 -47
  116. package/src/components/CalendarPage/formParts/BookingOrOption.tsx +0 -35
  117. package/src/components/CalendarPage/formParts/CancelInsuranceText.tsx +0 -69
  118. package/src/components/CalendarPage/formParts/DefaultBookingFields.ts +0 -105
  119. package/src/components/CalendarPage/formParts/DiscountCode.tsx +0 -62
  120. package/src/components/CalendarPage/formParts/Guests.tsx +0 -77
  121. package/src/components/CalendarPage/formParts/OptionalBookingFields.tsx +0 -148
  122. package/src/components/CalendarPage/formParts/OptionalCosts.tsx +0 -103
  123. package/src/components/CalendarPage/formParts/SuccessMessage.tsx +0 -31
  124. package/src/components/CalendarPage/formParts/Validations.tsx +0 -64
  125. package/src/components/CalendarPage/formParts/discount.tsx +0 -69
  126. package/src/components/CalendarPage/formParts/form_types.d.ts +0 -38
  127. package/src/components/CalendarPage/formParts/insurances.tsx +0 -62
  128. package/src/components/CalendarPage/formParts/radioButtons.tsx +0 -66
  129. package/src/components/Error/ApiError.tsx +0 -33
  130. package/src/components/Error/IntegrationError.tsx +0 -62
  131. package/src/components/Error/index.ts +0 -4
  132. package/src/components/ErrorBoundary.tsx +0 -34
  133. package/src/components/Modal/index.tsx +0 -46
  134. package/src/components/ReviewsPage/Queries.ts +0 -26
  135. package/src/components/ReviewsPage/ReviewsPage.tsx +0 -45
  136. package/src/components/ReviewsPage/Score.tsx +0 -29
  137. package/src/components/ReviewsPage/SingleReview.tsx +0 -38
  138. package/src/components/ReviewsPage/note.tsx +0 -17
  139. package/src/components/SafeBooking.tsx +0 -96
  140. package/src/components/SearchPage/Field.tsx +0 -75
  141. package/src/components/SearchPage/Filters.tsx +0 -91
  142. package/src/components/SearchPage/Paginator.tsx +0 -63
  143. package/src/components/SearchPage/Results.tsx +0 -129
  144. package/src/components/SearchPage/SearchPage.tsx +0 -115
  145. package/src/components/SearchPage/SingleResult.tsx +0 -93
  146. package/src/components/SearchPage/filters/Categories.tsx +0 -57
  147. package/src/components/SearchPage/filters/DateFilter.tsx +0 -34
  148. package/src/components/SearchPage/filters/List.tsx +0 -80
  149. package/src/components/SearchPage/filters/NumberFilter.tsx +0 -37
  150. package/src/components/SearchPage/filters/Radio.tsx +0 -46
  151. package/src/components/SearchPage/filters/Select.tsx +0 -85
  152. package/src/components/SearchPage/filters/__tests__/helper.spec.js +0 -13
  153. package/src/components/SearchPage/filters/filter_types.d.ts +0 -25
  154. package/src/components/SearchPage/filters/helper.ts +0 -19
  155. package/src/components/icons/ArrowLeft.svg.tsx +0 -20
  156. package/src/components/icons/ArrowRight.svg.tsx +0 -16
  157. package/src/components/icons/Reload.svg.tsx +0 -23
  158. package/src/components/icons/info.svg.tsx +0 -24
  159. package/src/components/icons/loading.svg.tsx +0 -98
  160. package/src/custom.d.ts +0 -10
  161. package/src/index.tsx +0 -104
  162. package/src/locales/de.json +0 -137
  163. package/src/locales/en.json +0 -137
  164. package/src/locales/es.json +0 -132
  165. package/src/locales/fr.json +0 -132
  166. package/src/locales/it.json +0 -128
  167. package/src/locales/nl.json +0 -138
  168. package/src/styles/calendar.css +0 -317
  169. package/src/styles/datepicker.css +0 -6
  170. package/src/styles/field.css +0 -105
  171. package/src/styles/filters.css +0 -92
  172. package/src/styles/form.css +0 -219
  173. package/src/styles/main.css +0 -80
  174. package/src/styles/modal.css +0 -79
  175. package/src/styles/pagination.css +0 -92
  176. package/src/styles/price-overview.css +0 -111
  177. package/src/styles/result.css +0 -142
  178. package/src/styles/results.css +0 -50
  179. package/src/styles/reviews.css +0 -90
  180. package/src/styles/success.css +0 -9
  181. package/src/types.d.ts +0 -91
  182. package/tmp/cache/vite/last-build-production.json +0 -7
  183. package/tsconfig.json +0 -17
  184. package/vite.config.ts +0 -31
@@ -1,69 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { FormattedMessage } from 'react-intl';
4
- import { Field } from 'formik';
5
- import DiscountCode from './DiscountCode';
6
- import { HouseType, PortalOptions } from '../../../types';
7
- import { PossibleValues } from './form_types';
8
-
9
- interface Props {
10
- errors: object;
11
- house: HouseType;
12
- options: PortalOptions;
13
- values: PossibleValues;
14
- }
15
-
16
- const Discount = ({ errors, house, options, values }: Props) => {
17
- if (
18
- (house.discounts && house.discounts !== '0') ||
19
- options.bookingForm?.showDiscountCode
20
- ) {
21
- let discounts = house.discounts ? house.discounts.split(',') : [];
22
- return (
23
- <div className="form-section">
24
- {house.discounts && house.discounts !== '0' && (
25
- <>
26
- <div className="form-row inline">
27
- <label htmlFor="discount">
28
- <FormattedMessage id="discount" />
29
- </label>
30
- <Field component="select" name="discount">
31
- {discounts.map((discount) => (
32
- <option value={discount} key={discount}>
33
- {discount}%
34
- </option>
35
- ))}
36
- </Field>
37
- </div>
38
- <div className="form-row inline">
39
- <label htmlFor="discount_reason">
40
- <FormattedMessage id="discount_reason" />
41
- </label>
42
- <Field name="discount_reason" />
43
- {errors.discount_reason && (
44
- <div className="error-message bu-error-message">
45
- {errors.discount_reason}
46
- </div>
47
- )}
48
- </div>
49
- <div>
50
- <i style={{ fontSize: 14 }}>{house.discounts_info}</i>
51
- </div>
52
- </>
53
- )}
54
- {options.bookingForm?.showDiscountCode && (
55
- <DiscountCode errors={errors} house={house} values={values} />
56
- )}
57
- </div>
58
- );
59
- } else {
60
- return null;
61
- }
62
- };
63
-
64
- Discount.propTypes = {
65
- house: PropTypes.object.isRequired,
66
- errors: PropTypes.object.isRequired
67
- };
68
-
69
- export default Discount;
@@ -1,38 +0,0 @@
1
- import { BuDate } from '../../../types';
2
-
3
- export type PossibleValues = {
4
- arrivalDate: BuDate;
5
- departureDate: BuDate;
6
- is_option: 'false' | 'true';
7
- costs: any;
8
- adults: number;
9
- children: number;
10
- babies: number;
11
- persons: number;
12
- discount: number;
13
- country: number;
14
- cancel_insurance: '0' | '1' | '2';
15
- discount_code: string;
16
- };
17
-
18
- export type BookingFieldsType = SingleBookingFieldType[];
19
-
20
- export type SingleBookingFieldType = {
21
- id: string;
22
- label: string;
23
- type: InputTypes;
24
- options?: string[];
25
- required?: boolean;
26
- mandatory?: boolean;
27
- rows?: number;
28
- placeholder?: string;
29
- };
30
-
31
- type InputTypes =
32
- | 'textarea'
33
- | 'text'
34
- | 'email'
35
- | 'date'
36
- | 'country'
37
- | 'select'
38
- | 'booking_field';
@@ -1,62 +0,0 @@
1
- import React from 'react';
2
- import { FormattedMessage } from 'react-intl';
3
- import { Field } from 'formik';
4
- import Modal from '../../Modal';
5
- import Icon from '../../icons/info.svg';
6
- import CancelInsuranceText from './CancelInsuranceText';
7
- import { DateField } from '../FormItems';
8
- import { translatedOption } from './BookingHelpers';
9
- import { HouseType } from '../../../types';
10
- import { PossibleValues } from './form_types';
11
-
12
- type Props = {
13
- house: HouseType;
14
- values: PossibleValues;
15
- };
16
-
17
- function cancelInsurance(house: HouseType) {
18
- if (house.cancel_insurance) {
19
- return (
20
- <div className="form-row inline">
21
- <label htmlFor="cancel_insurance">
22
- <FormattedMessage id="cancel_insurance" />
23
- </label>
24
- <Field component="select" name="cancel_insurance" required={true}>
25
- {translatedOption('choose', '')}
26
- {/* {translatedOption('cancel_insurance_all_risk', '2')} */}
27
- {translatedOption('cancel_insurance_normal', '1')}
28
- {translatedOption('none', '0')}
29
- </Field>
30
- <Modal buttonText={<Icon />}>
31
- <CancelInsuranceText />
32
- </Modal>
33
- </div>
34
- );
35
- }
36
- }
37
-
38
- export const Insurances = ({ house, values }: Props) => {
39
- if (house.cancel_insurance) {
40
- return (
41
- <div className="form-section" id="insurances">
42
- <h2>
43
- <FormattedMessage id="insurances" />
44
- </h2>
45
- {cancelInsurance(house)}
46
- {values.cancel_insurance && values.cancel_insurance !== '0' && (
47
- <DateField
48
- label="extra_fields.date_of_birth"
49
- name="extra_fields.date_of_birth"
50
- required
51
- inline={false}
52
- description={
53
- <FormattedMessage id="insurance_company_needs_date_of_birth" />
54
- }
55
- />
56
- )}
57
- </div>
58
- );
59
- } else {
60
- return <div />;
61
- }
62
- };
@@ -1,66 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
-
4
- // Input feedback
5
- const InputFeedback = ({ error }) =>
6
- error ? <div className="input-feedback">{error}</div> : null;
7
-
8
- InputFeedback.propTypes = {
9
- error: PropTypes.object,
10
- };
11
-
12
- // Radio input
13
- export const RadioButton = ({
14
- field: { name, value, onChange, onBlur },
15
- id,
16
- label,
17
- ...props
18
- }) => {
19
- return (
20
- <div>
21
- <input
22
- name={name}
23
- id={id}
24
- type="radio"
25
- value={id} // could be something else for output?
26
- checked={id === value}
27
- onChange={onChange}
28
- onBlur={onBlur}
29
- className="radio-button"
30
- {...props}
31
- />
32
- <label htmlFor={id}>{label}</label>
33
- </div>
34
- );
35
- };
36
-
37
- RadioButton.propTypes = {
38
- field: PropTypes.object,
39
- id: PropTypes.string,
40
- label: PropTypes.object,
41
- };
42
-
43
- // Radio group
44
- export const RadioButtonGroup = ({
45
- error,
46
- touched,
47
- label,
48
- className,
49
- children,
50
- }) => {
51
- return (
52
- <div className={className}>
53
- <div className="legend">{label}</div>
54
- {children}
55
- {touched && <InputFeedback error={error} />}
56
- </div>
57
- );
58
- };
59
-
60
- RadioButtonGroup.propTypes = {
61
- error: PropTypes.object,
62
- touched: PropTypes.object,
63
- className: PropTypes.string,
64
- label: PropTypes.string,
65
- children: PropTypes.node.isRequired,
66
- };
@@ -1,33 +0,0 @@
1
- import React from 'react';
2
- import Modal from '../Modal';
3
- import { FormattedMessage } from 'react-intl';
4
- import { ApolloError } from '@apollo/client';
5
-
6
- function ApiError(
7
- errors: { errors: ApolloError },
8
- modal: boolean
9
- ): JSX.Element {
10
- const errorMessage = (
11
- <div className="bukazu-error-message">
12
- <h2>
13
- <FormattedMessage id="something_went_wrong_please_try_again" />
14
- </h2>
15
- <ul>
16
- {errors.errors.graphQLErrors.map((err) => (
17
- <li key={err.message}>{err.message}</li>
18
- ))}
19
- </ul>
20
- </div>
21
- );
22
- if (modal == true) {
23
- return <Modal show={true}>{errorMessage}</Modal>;
24
- }
25
-
26
- return errorMessage;
27
- }
28
-
29
- ApiError.defaultProps = {
30
- modal: false
31
- };
32
-
33
- export default ApiError;
@@ -1,62 +0,0 @@
1
- import React from 'react';
2
- import { FiltersType } from '../SearchPage/filters/filter_types';
3
-
4
- interface Props {
5
- portalCode: string;
6
- pageType?: string;
7
- locale?: string;
8
- filters?: FiltersType;
9
- }
10
-
11
- export default function IntegrationError({
12
- portalCode,
13
- pageType,
14
- locale,
15
- filters
16
- }: Props): JSX.Element | false {
17
- let errors: string[] = [];
18
-
19
- if (!portalCode) {
20
- let message = 'No portal code is specified, so portal is not working';
21
- console.error(message);
22
- errors.push(message);
23
- }
24
-
25
- if (pageType && pageType !== 'reviews') {
26
- let message = `'${pageType}' is not a valid page`;
27
- console.error(message);
28
- errors.push(message);
29
- }
30
-
31
- if (!locale) {
32
- console.warn('No locale is set default to English');
33
- } else {
34
- if (!['nl', 'de', 'en', 'fr', 'it', 'es'].includes(locale)) {
35
- errors.push('Invalid locale');
36
- }
37
- }
38
-
39
- if (filters && !isObject(filters)) {
40
- let message = 'Filters variable is not an object';
41
- console.error(message, filters);
42
- }
43
-
44
- if (errors.length == 0) {
45
- return false;
46
- }
47
-
48
- return (
49
- <div>
50
- <h2>Something went wrong please try again </h2>
51
- <ul>
52
- {errors.map((err) => (
53
- <li>{err}</li>
54
- ))}
55
- </ul>
56
- </div>
57
- );
58
- }
59
-
60
- const isObject = (obj: any) => {
61
- return Object.prototype.toString.call(obj) === '[object Object]';
62
- };
@@ -1,4 +0,0 @@
1
- import ApiError from './ApiError';
2
- import IntegrationError from './IntegrationError';
3
-
4
- export { ApiError, IntegrationError };
@@ -1,34 +0,0 @@
1
- import React, { ErrorInfo } from 'react';
2
-
3
- interface Props {
4
- children: JSX.Element[];
5
- }
6
-
7
- type State = {
8
- hasError: boolean;
9
- };
10
-
11
- class ErrorBoundary extends React.Component<Props, State> {
12
- constructor(props: Props) {
13
- super(props);
14
- this.state = { hasError: false };
15
- }
16
-
17
- static getDerivedStateFromError() {
18
- // Update state so the next render will show the fallback UI.
19
- return { hasError: true };
20
- }
21
- componentDidCatch(error: Error, errorInfo: ErrorInfo) {
22
- // You can also log the error to an error reporting service
23
- console.error(error, errorInfo);
24
- }
25
- render() {
26
- if (this.state.hasError) {
27
- // You can render any custom fallback UI
28
- return <h1>Something went wrong.</h1>;
29
- }
30
- return this.props.children;
31
- }
32
- }
33
-
34
- export default ErrorBoundary;
@@ -1,46 +0,0 @@
1
- import React, { useState } from 'react';
2
- import { FormattedMessage } from 'react-intl';
3
-
4
- interface Props {
5
- children: React.ReactNode;
6
- show?: boolean;
7
- buttonText?: string | React.ReactNode;
8
- }
9
-
10
- function Modal({ children, buttonText, show }: Props) {
11
- const [visible, setVisible] = useState(show);
12
-
13
- if (!visible) {
14
- return (
15
- <a className="info-button" onClick={() => setVisible(true)}>
16
- {buttonText}
17
- </a>
18
- );
19
- }
20
-
21
- return (
22
- <div className="bukazu-modal-container">
23
- <div className="bukazu-modal-container-inner">
24
- <div
25
- className="bukazu-modal-escape"
26
- onClick={() => setVisible(false)}
27
- ></div>
28
- <div className="bukazu-modal">
29
- <div className="bukazu-modal-content">{children}</div>
30
-
31
- <div className="bukazu-modal-footer">
32
- <a onClick={() => setVisible(false)}>
33
- <FormattedMessage id="close" />
34
- </a>
35
- </div>
36
- </div>
37
- </div>
38
- </div>
39
- );
40
- }
41
-
42
- Modal.defaultProps = {
43
- show: false
44
- };
45
-
46
- export default Modal;
@@ -1,26 +0,0 @@
1
- import { gql } from '@apollo/client';
2
-
3
- export const REVIEWS_QUERY = gql`
4
- query ReviewPortalSiteQuery($id: ID!, $house_id: String!) {
5
- PortalSite(id: $id) {
6
- houses(house_code: $house_id) {
7
- id
8
- name
9
- rating
10
- scoreAmount
11
- reviews {
12
- id
13
- name
14
- review
15
- score
16
- createdAt
17
- reviewCriteria {
18
- id
19
- name
20
- score
21
- }
22
- }
23
- }
24
- }
25
- }
26
- `;
@@ -1,45 +0,0 @@
1
- import { useQuery } from '@apollo/client';
2
- import React, { useContext } from 'react';
3
- import { FormattedMessage } from 'react-intl';
4
- import { AppContext } from '../AppContext';
5
- import { ApiError } from '../Error';
6
- import Loading from '../icons/loading.svg';
7
- import { REVIEWS_QUERY } from './Queries';
8
- import Score from './Score';
9
- import SingleReview from './SingleReview';
10
- import Note from './note';
11
-
12
- function ReviewsPage(): JSX.Element {
13
- const { objectCode, portalCode } = useContext(AppContext);
14
- const { data, error, loading } = useQuery(REVIEWS_QUERY, {
15
- variables: { id: portalCode, house_id: objectCode }
16
- });
17
-
18
- if (loading)
19
- return (
20
- <div>
21
- <Loading />
22
- </div>
23
- );
24
- if (error) return <ApiError errors={error} />;
25
-
26
- const house = data.PortalSite.houses[0];
27
- const reviews = house.reviews;
28
-
29
- return (
30
- <div className="bu_reviews">
31
- <div className="bu_reviews__overview bu_card">
32
- <Score rating={house.rating} />
33
- <div className="bu_reviews__overview__number">
34
- {house.scoreAmount} <FormattedMessage id="reviews" />
35
- </div>
36
- </div>
37
- {reviews.map((review) => {
38
- return <SingleReview review={review} key={review.id} />;
39
- })}
40
- <Note />
41
- </div>
42
- );
43
- }
44
-
45
- export default ReviewsPage;
@@ -1,29 +0,0 @@
1
- import React from 'react';
2
-
3
- interface Props {
4
- rating: number;
5
- name?: string;
6
- }
7
-
8
- function Score({ rating, name }: Props) {
9
- let color = 'low';
10
- if (rating > 7) {
11
- color = 'best';
12
- } else if (rating > 6) {
13
- color = 'good';
14
- } else if (rating > 4) {
15
- color = 'medium';
16
- }
17
- return (
18
- <div className="bu_score">
19
- {rating && (
20
- <div className={`bu_score__rating bu_card ${color}`}>
21
- {rating.toFixed(1)}
22
- </div>
23
- )}
24
- <div>{name}</div>
25
- </div>
26
- );
27
- }
28
-
29
- export default Score;
@@ -1,38 +0,0 @@
1
- import React, { memo } from 'react';
2
- import Score from './Score';
3
-
4
- interface Props {
5
- review: {
6
- score: number;
7
- name: string;
8
- createdAt: string;
9
- review: string;
10
- reviewCriteria: {
11
- score: number;
12
- name: string;
13
- id: number;
14
- }[];
15
- };
16
- }
17
-
18
- function SingleReview({ review }: Props): JSX.Element {
19
- return (
20
- <div className="bu_single_review bu_card">
21
- <div className="bu_review_summary">
22
- <Score rating={review.score} />
23
- <div className="bu_review_summary__date_name">
24
- <div>{review.createdAt},&nbsp;</div>
25
- <div className="bu_review_summary__name">{review.name}</div>
26
- </div>
27
- </div>
28
- <blockquote className="bu_review">{review.review}</blockquote>
29
- <div className="bu_criteria">
30
- {review.reviewCriteria.map((crit) => (
31
- <Score rating={crit.score} name={crit.name} key={crit.id} />
32
- ))}
33
- </div>
34
- </div>
35
- );
36
- }
37
-
38
- export default memo(SingleReview);
@@ -1,17 +0,0 @@
1
- import React from "react";
2
- import { FormattedMessage } from "react-intl";
3
-
4
- function Note() {
5
- return (
6
- <div className="bu_reviews__note">
7
- {/* <FormattedMessage id="reviews_note" />
8
- <br /> */}
9
- <a href="https://www.bukazu.com" target="_blank" rel="noopener noreferrer">
10
- <FormattedMessage id="reviews_note_link" />
11
- </a>
12
- </div>
13
- )
14
-
15
- }
16
-
17
- export default Note;
@@ -1,96 +0,0 @@
1
- import React, { CSSProperties, useContext } from 'react';
2
- import pjson from '../../package.json';
3
- import { AppContext } from './AppContext';
4
-
5
- const style: CSSProperties = {
6
- width: '100%',
7
- padding: '16px',
8
- display: 'flex',
9
- justifyContent: 'center',
10
- position: 'relative'
11
- };
12
- const styleLink = {
13
- color: '#808080',
14
- fontSize: 14,
15
- textDecoration: 'none'
16
- };
17
-
18
- const trans: Trans = {
19
- nl: {
20
- url: 'http://bukazu.com/veiligheid',
21
- label: 'Beveiligd en mogelijk gemaakt door BUKAZU'
22
- },
23
- en: {
24
- url: 'http://bukazu.com/en/security',
25
- label: 'Secured and made possible by BUKAZU'
26
- },
27
- de: {
28
- url: 'http://bukazu.com/de/sicherheit',
29
- label: 'Gesichert und ermöglicht durch BUKAZU'
30
- },
31
- fr: {
32
- url: 'http://bukazu.com/fr/securite',
33
- label: 'Sécurisé et rendu possible par BUKAZU'
34
- },
35
- es: {
36
- url: 'http://bukazu.com/es/seguridad',
37
- label: 'Asegurado y hecho posible por BUKAZU'
38
- },
39
- it: {
40
- url: 'http://bukazu.com/it/sicurezza',
41
- label: 'Protetto e reso possibile da BUKAZU'
42
- }
43
- };
44
-
45
- function SafeBooking(): JSX.Element {
46
- const { locale } = useContext(AppContext);
47
-
48
- return (
49
- <div style={style}>
50
- <a href={trans[locale].url} style={styleLink}>
51
- <svg
52
- xmlns="http://www.w3.org/2000/svg"
53
- xmlnsXlink="http://www.w3.org/1999/xlink"
54
- version="1.1"
55
- x="0px"
56
- y="0px"
57
- viewBox="0 0 100 100"
58
- enableBackground="new 0 0 100 100"
59
- xmlSpace="preserve"
60
- width="16px"
61
- height="16px"
62
- style={{ marginRight: '4px', fill: '#808080' }}
63
- >
64
- <path d="M75.98,41.62h-2.47L73.5,29.31C73.49,15.9,62.58,4.99,49.17,5C35.76,5.01,24.85,15.92,24.86,29.33l0.02,12.31H24 c-4.61,0.01-8.35,3.75-8.34,8.36v36.65c0,4.61,3.75,8.35,8.36,8.35L76,94.97c4.61,0,8.35-3.74,8.34-8.35V49.96 C84.34,45.35,80.59,41.62,75.98,41.62z M33.84,41.64l-0.02-12.31c0-8.47,6.88-15.36,15.35-15.37c8.47,0,15.36,6.89,15.36,15.35 l0.02,12.31L33.84,41.64z" />
65
- </svg>
66
- {trans[locale].label}{' '}
67
- <span
68
- style={{
69
- opacity: 0.5,
70
- fontSize: 9,
71
- position: 'absolute',
72
- right: 10,
73
- bottom: 0
74
- }}
75
- >
76
- </span>
77
- </a>
78
- </div>
79
- );
80
- }
81
-
82
- type Trans = {
83
- nl: LocaleType;
84
- en: LocaleType;
85
- de: LocaleType;
86
- es: LocaleType;
87
- fr: LocaleType;
88
- it: LocaleType;
89
- };
90
-
91
- type LocaleType = {
92
- label: string;
93
- url: string;
94
- };
95
-
96
- export default SafeBooking;