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,35 +0,0 @@
1
- import React from 'react';
2
- import { RadioButtonGroup, RadioButton } from './radioButtons';
3
- import { Field } from 'formik';
4
- import { FormattedMessage } from 'react-intl';
5
- import { HouseType } from '../../../types';
6
-
7
- interface Props {
8
- house: HouseType;
9
- }
10
-
11
- export default function BookingOrOption({ house }: Props): JSX.Element {
12
- return (
13
- <>
14
- {house.allow_option && (
15
- <div>
16
- <RadioButtonGroup id="is_option" className="booking_option">
17
- <Field
18
- component={RadioButton}
19
- name="is_option"
20
- id="true"
21
- disabled={!house.allow_option}
22
- label={<FormattedMessage id="option" />}
23
- />
24
- <Field
25
- component={RadioButton}
26
- name="is_option"
27
- id="false"
28
- label={<FormattedMessage id="booking" />}
29
- />
30
- </RadioButtonGroup>
31
- </div>
32
- )}
33
- </>
34
- );
35
- }
@@ -1,69 +0,0 @@
1
- import React, { useContext } from 'react';
2
- import { FormattedMessage as FM } from 'react-intl';
3
- import { AppContext } from '../../AppContext';
4
-
5
- const CancelInsuranceText = () => {
6
- const { locale } = useContext(AppContext);
7
-
8
- const links = {
9
- nl: 'https://recreatieverzekeringen.nl/veelgestelde-vragen',
10
- de: 'https://recreatieverzekeringen.nl/de/haufig-gestellte-fragen',
11
- en: 'https://recreatieverzekeringen.nl/en/frequently-asked-questions',
12
- fr: 'https://recreatieverzekeringen.nl/en/frequently-asked-questions',
13
- es: 'https://recreatieverzekeringen.nl/en/frequently-asked-questions',
14
- it: 'https://recreatieverzekeringen.nl/en/frequently-asked-questions'
15
- };
16
-
17
- return (
18
- <>
19
- <h2>
20
- <FM id="cancel_insurance_normal_long" />
21
- </h2>
22
- <p>
23
- <FM id="cancel_insurance_normal_desc" />
24
- </p>
25
- <h3>
26
- <FM id="cancel_insurance_more_insured" />
27
- </h3>
28
- <p>
29
- <FM id="cancel_insurance_more_insured_desc" />
30
- </p>
31
-
32
- <h3>
33
- <FM id="cancel_insurance_important" />
34
- </h3>
35
- <p>
36
- <FM id="cancel_insurance_important_message" />
37
- </p>
38
-
39
- <h3>
40
- <FM id="cancel_insurance_for_whom" />
41
- </h3>
42
- <p>
43
- <FM id="cancel_insurance_for_whom_explain" />
44
- </p>
45
- <h3>
46
- <FM id="cancel_insurance_questions" />
47
- </h3>
48
- <p>
49
- <FM id="cancel_insurance_questions_explain_1" />
50
- <a href={links[locale]} target="_blank">
51
- <FM id="cancel_insurance_questions_explain_link" />
52
- </a>
53
- <FM id="cancel_insurance_questions_explain_2" />
54
- </p>
55
- <h3>
56
- <FM id="terms" />
57
- </h3>
58
- <a
59
- href={`https://api.bukazu.com/files/${locale}/insurance.pdf`}
60
- target="_blank"
61
- rel="noopener noreferrer"
62
- >
63
- <FM id="show_terms" />
64
- </a>
65
- </>
66
- );
67
- };
68
-
69
- export default CancelInsuranceText;
@@ -1,105 +0,0 @@
1
- import { BookingFieldsType } from "./form_types";
2
-
3
- const DefaultBookingFields: BookingFieldsType = [
4
- {
5
- id: 'first_name',
6
- label: 'Voornaam',
7
- type: 'text',
8
- options: ['text'],
9
- required: true,
10
- placeholder: '',
11
- },
12
- {
13
- id: 'preposition',
14
- label: 'Tussenvoegsel',
15
- type: 'text',
16
- options: ['text'],
17
- required: false,
18
- placeholder: '',
19
- },
20
- {
21
- id: 'last_name',
22
- label: 'Achternaam',
23
- type: 'text',
24
- options: ['text'],
25
- required: true,
26
- mandatory: true,
27
- placeholder: '',
28
- },
29
- {
30
- id: 'address',
31
- label: 'Adres',
32
- type: 'text',
33
- options: ['text'],
34
- required: true,
35
- placeholder: '',
36
- },
37
- {
38
- id: 'house_number',
39
- label: 'Huisnummer',
40
- type: 'text',
41
- options: ['text'],
42
- required: true,
43
- placeholder: '',
44
- },
45
- {
46
- id: 'zipcode',
47
- label: 'Postcode',
48
- type: 'text',
49
- options: ['text'],
50
- required: true,
51
- placeholder: '',
52
- },
53
- {
54
- id: 'city',
55
- label: 'Plaats',
56
- type: 'text',
57
- options: ['text'],
58
- required: true,
59
- placeholder: '',
60
- },
61
- {
62
- id: 'country',
63
- label: 'Land',
64
- type: 'select',
65
- options: ['select'],
66
- required: true,
67
- mandatory: true,
68
- placeholder: '',
69
- },
70
- {
71
- id: 'email',
72
- label: 'E-mail',
73
- type: 'email',
74
- options: ['email'],
75
- required: true,
76
- mandatory: true,
77
- placeholder: '',
78
- },
79
- {
80
- id: 'phone_mobile',
81
- label: 'Mobiel telefoonnummer',
82
- type: 'text',
83
- options: ['text'],
84
- required: false,
85
- placeholder: '',
86
- },
87
- {
88
- id: 'phone',
89
- label: 'Telefoonnummer',
90
- type: 'text',
91
- options: ['text'],
92
- required: true,
93
- placeholder: '',
94
- },
95
- {
96
- id: 'comment',
97
- label: 'Opmerking',
98
- type: 'textarea',
99
- options: ['textarea'],
100
- required: false,
101
- rows: 10,
102
- },
103
- ];
104
-
105
- export default DefaultBookingFields;
@@ -1,62 +0,0 @@
1
- import React, { ReactNode } from 'react';
2
- import { Field } from 'formik';
3
- import { FormattedMessage } from 'react-intl';
4
- import { gql, useMutation } from '@apollo/client';
5
- import { HouseType } from '../../../types';
6
-
7
- function DiscountCode({ house }: { house: HouseType }): ReactNode {
8
- const [checkCode, { loading, error, data }] =
9
- useMutation(CHECK_DISCOUNT_CODE);
10
-
11
- return (
12
- <div className="form-row inline">
13
- <label htmlFor="discount_code">
14
- <FormattedMessage id="discount_code" />
15
- </label>
16
- <Field name="discount_code">
17
- {({ field, form }) => {
18
- return (
19
- <input
20
- {...field}
21
- onChange={(e) => {
22
- checkCode({
23
- variables: { code: e.target.value, house_code: house.code }
24
- });
25
- form.setFieldValue(field.name, e.target.value);
26
- }}
27
- ></input>
28
- );
29
- }}
30
- </Field>
31
- {loading && <div className="bu_discount_code">Loading...</div>}
32
- {error && (
33
- <div className="bu_discount_code">
34
- <FormattedMessage id="no_discount_code_found" />
35
- </div>
36
- )}
37
- {data && (
38
- <div className="bu_discount_code">
39
- <div>{data.checkDiscountCode.name}</div>
40
- {data.checkDiscountCode.use_price ? (
41
- <div>€ {data.checkDiscountCode.price}</div>
42
- ) : (
43
- <div>{data.checkDiscountCode.percentage}%</div>
44
- )}
45
- </div>
46
- )}
47
- </div>
48
- );
49
- }
50
-
51
- const CHECK_DISCOUNT_CODE = gql`
52
- mutation CheckDiscountCode($code: String!, $house_code: String!) {
53
- checkDiscountCode(code: $code, house_code: $house_code) {
54
- name
55
- use_price
56
- percentage
57
- price
58
- }
59
- }
60
- `;
61
-
62
- export default DiscountCode;
@@ -1,77 +0,0 @@
1
- import React from 'react';
2
- import { NumberSelect } from '../FormItems';
3
- import { FormattedMessage } from 'react-intl';
4
- import { HouseType, PortalOptions } from '../../../types';
5
-
6
- interface Props {
7
- options: PortalOptions;
8
- house: HouseType;
9
- }
10
-
11
- export default function Guests({ options, house }: Props): React.ReactNode {
12
- return (
13
- <>
14
- <NumberSelect
15
- name="adults"
16
- label="adults"
17
- count={house.persons}
18
- description={
19
- <div className="age-description">
20
- <FormattedMessage
21
- id="adults_from"
22
- defaultMessage="> {age}"
23
- values={{
24
- age: options.bookingForm
25
- ? options.bookingForm.adults_from || '18'
26
- : '18'
27
- }}
28
- />
29
- </div>
30
- }
31
- />
32
- {options.bookingForm && !options.bookingForm.children ? null : (
33
- <NumberSelect
34
- name="children"
35
- label="children"
36
- count={house.persons - 1}
37
- description={
38
- <div className="age-description">
39
- <FormattedMessage
40
- id="children_from"
41
- defaultMessage="{from} - {til}"
42
- values={{
43
- from: options.bookingForm
44
- ? options.bookingForm.children_from || '3'
45
- : '3',
46
- til: options.bookingForm
47
- ? options.bookingForm.children_til || '17'
48
- : '17'
49
- }}
50
- />
51
- </div>
52
- }
53
- />
54
- )}
55
- {options.bookingForm && !options.bookingForm.babies ? null : (
56
- <NumberSelect
57
- name="babies"
58
- label="babies"
59
- count={house.persons - 1}
60
- description={
61
- <div className="age-description">
62
- <FormattedMessage
63
- id="babies_from"
64
- defaultMessage="til {babies_til}"
65
- values={{
66
- babies: options.bookingForm
67
- ? options.bookingForm.babies_til || '2'
68
- : '2'
69
- }}
70
- />
71
- </div>
72
- }
73
- />
74
- )}
75
- </>
76
- );
77
- }
@@ -1,148 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { Field } from 'formik';
4
- import { FormattedMessage } from 'react-intl';
5
- import { Countries } from '../../../_lib/countries';
6
- import { DateField } from '../FormItems';
7
- import DefaultBookingFields from './DefaultBookingFields';
8
-
9
- export function isInt(value) {
10
- return (
11
- !isNaN(value) &&
12
- (function (x) {
13
- return (x | 0) === x;
14
- })(parseFloat(value))
15
- );
16
- }
17
-
18
- export default function OptionalBookingFields({
19
- bookingFields,
20
- errors,
21
- touched,
22
- PortalSite,
23
- values
24
- }) {
25
- let fields = [].concat(bookingFields);
26
-
27
- const requiredFields = ['address', 'house_number', 'zipcode', 'city'];
28
- if (values.cancel_insurance === '1' || values.cancel_insurance === '2') {
29
- requiredFields.forEach((key) => {
30
- let index = bookingFields.findIndex((x) => x.id === key);
31
- if (index !== -1) {
32
- fields[index] = DefaultBookingFields.find((x) => x.id === key);
33
- } else {
34
- fields.push(DefaultBookingFields.find((x) => x.id === key));
35
- }
36
- });
37
- }
38
- return (
39
- <div className="form-section">
40
- <h2>
41
- <FormattedMessage id="personal_details" />
42
- </h2>
43
- {fields.map((input) => {
44
- if (input.id === 'telephone') {
45
- input.id = 'phonenumber';
46
- }
47
-
48
- if (input.type === 'booking_field' || isInt(input.id)) {
49
- const bookingField = PortalSite.booking_fields.find(
50
- (x) => x.id === input.id
51
- );
52
-
53
- return (
54
- <div className="form-row" key={bookingField.id}>
55
- <label htmlFor={`extra_fields.booking_field_${bookingField.id}`}>
56
- {bookingField.label} {input.required && <span>*</span>}
57
- </label>
58
- <Field
59
- onKeyPress={(e) => {
60
- e.which === 13 && e.preventDefault();
61
- }}
62
- id={`extra_fields.booking_field_${bookingField.id}`}
63
- type={
64
- bookingField.field_type === 'text'
65
- ? 'input'
66
- : bookingField.field_type
67
- }
68
- component={
69
- bookingField.field_type === 'text'
70
- ? 'input'
71
- : bookingField.field_type
72
- }
73
- name={`extra_fields.booking_field_${bookingField.id}`}
74
- />
75
- {errors[input.id] &&
76
- ((touched.extra_fields &&
77
- touched.extra_fields[`booking_field_${bookingField.id}`]) ||
78
- touched[input.id]) && (
79
- <div className="error-message bu-error-message">
80
- {errors[input.id]}
81
- </div>
82
- )}
83
- </div>
84
- );
85
- } else if (input.id === 'country') {
86
- return (
87
- <div className="form-row" key={input.id}>
88
- <label htmlFor={input.id}>
89
- {PortalSite[`${input.id}_label`]}{' '}
90
- {input.required && <span>*</span>}
91
- </label>
92
- <Field component="select" name={input.id}>
93
- {Countries[window.__localeId__].map((country) => {
94
- return (
95
- <option value={country.alpha2} key={country.alpha2}>
96
- {country.name}
97
- </option>
98
- );
99
- })}
100
- </Field>
101
- {errors[input.id] && (
102
- <div className="error-message bu-error-message">
103
- {errors[input.id]}
104
- </div>
105
- )}
106
- </div>
107
- );
108
- } else if (input.type === 'date') {
109
- return (
110
- <div className="form-row" key={input.id}>
111
- <DateField name={input.id} label={input.id} inline={false} />
112
- </div>
113
- );
114
- } else {
115
- return (
116
- <div className="form-row" key={input.id}>
117
- <label
118
- htmlFor={input.id}
119
- name={`${input.id.replace(/\./g, '_')}_label`}
120
- >
121
- {PortalSite[`${input.id.replace(/\./g, '_')}_label`]}{' '}
122
- {input.required && <span>*</span>}
123
- </label>
124
- <Field
125
- type={input.type}
126
- name={input.id}
127
- onKeyPress={(e) => {
128
- e.which === 13 && e.preventDefault();
129
- }}
130
- />
131
- {errors[input.id] && touched[input.id] && (
132
- <div className="error-message bu-error-message">
133
- {errors[input.id]}
134
- </div>
135
- )}
136
- </div>
137
- );
138
- }
139
- })}
140
- </div>
141
- );
142
- }
143
-
144
- OptionalBookingFields.propTypes = {
145
- bookingFields: PropTypes.array.isRequired,
146
- errors: PropTypes.object.isRequired,
147
- PortalSite: PropTypes.object.isRequired
148
- };
@@ -1,103 +0,0 @@
1
- import React from 'react';
2
- import { Field } from 'formik';
3
- import {FormattedMessage, FormattedNumber } from 'react-intl'
4
- import Modal from '../../Modal'
5
- import Icon from "../../icons/info.svg";
6
- import { createPeronsArray } from './BookingHelpers'
7
-
8
- function OptionalCosts({ costs }) {
9
- if (costs.length === 0) {
10
- return null;
11
- }
12
- return (
13
- <div className="form-section optional_house_costs">
14
- <h2>
15
- <FormattedMessage id="extra_costs_bookable" />
16
- </h2>
17
- <div>
18
- {costs.map((cost) => {
19
- if (
20
- !['none', 'total'].includes(cost.method) &&
21
- cost.max_available > 0
22
- ) {
23
- if (cost.max_available === 1) {
24
- return (
25
- <div className="form-row inline" key={cost.id}>
26
- <label htmlFor={cost.id}>{cost.name}</label>
27
- <Field component="select" name={`costs[${cost.id}]`}>
28
- <FormattedMessage id="no">
29
- {(formattedMessage) => (
30
- <option value={0}>{formattedMessage}</option>
31
- )}
32
- </FormattedMessage>
33
- <FormattedMessage id="yes">
34
- {(formattedMessage) => (
35
- <option value={1}>{formattedMessage}</option>
36
- )}
37
- </FormattedMessage>
38
- </Field>
39
-
40
- <div className="price_per">
41
- €{' '}
42
- <FormattedNumber
43
- value={cost.amount}
44
- minimumFractionDigits={2}
45
- maximumFractionDigits={2}
46
- />{' '}
47
- {cost.method_name}
48
- </div>
49
- <div>
50
- {cost.description ? (
51
- <div>
52
- <Modal buttonText={<Icon />}>
53
- <p>{cost.description}</p>
54
- </Modal>
55
- </div>
56
- ) : null}
57
- </div>
58
- </div>
59
- );
60
- }
61
- return (
62
- <div className="form-row inline" key={cost.id}>
63
- <label htmlFor={cost.id}>{cost.name}</label>
64
- <Field component="select" name={`costs[${cost.id}]`}>
65
- {createPeronsArray(cost.max_available).map((opt) => {
66
- return (
67
- <option key={opt} value={opt}>
68
- {opt}
69
- </option>
70
- );
71
- })}
72
- </Field>
73
-
74
- <div className="price_per">
75
- €{' '}
76
- <FormattedNumber
77
- value={cost.amount}
78
- minimumFractionDigits={2}
79
- maximumFractionDigits={2}
80
- />{' '}
81
- {cost.method_name}
82
- </div>
83
- <div>
84
- {cost.description ? (
85
- <div>
86
- <Modal buttonText={<Icon />}>
87
- <p>{cost.description}</p>
88
- </Modal>
89
- </div>
90
- ) : null}
91
- </div>
92
- </div>
93
- );
94
- } else {
95
- return '';
96
- }
97
- })}
98
- </div>
99
- </div>
100
- );
101
- }
102
-
103
- export default OptionalCosts;
@@ -1,31 +0,0 @@
1
- import React from 'react';
2
- import { FormattedMessage } from 'react-intl';
3
-
4
- const SuccessMessage = () => (
5
- <div className="success-message">
6
- <svg
7
- xmlns="http://www.w3.org/2000/svg"
8
- xmlnsXlink="http://www.w3.org/1999/xlink"
9
- version="1.1"
10
- x="0px"
11
- y="0px"
12
- viewBox="0 0 100 125"
13
- style={{
14
- enableBackground: 'new 0 0 100 100;',
15
- fill: 'green',
16
- height: '150px',
17
- }}
18
- xmlSpace="preserve"
19
- >
20
- <path d="M50,5C25.2,5,5,25.1,5,50c0,24.8,20.2,45,45,45s45-20.2,45-45C95,25.1,74.8,5,50,5z M72.7,38.2L44.2,66.7 c-0.4,0.4-0.9,0.6-1.4,0.6s-1-0.2-1.4-0.6l-14-14c-0.8-0.8-0.8-2,0-2.8c0.8-0.8,2-0.8,2.8,0l12.6,12.6l27.1-27.1 c0.8-0.8,2-0.8,2.8,0C73.5,36.1,73.5,37.4,72.7,38.2z" />
21
- </svg>
22
- <h3>
23
- <FormattedMessage id="thank_you_for_your_request" />
24
- </h3>
25
- <p>
26
- <FormattedMessage id="we_sent_confirmation_check_email" />
27
- </p>
28
- </div>
29
- );
30
-
31
- export default SuccessMessage;
@@ -1,64 +0,0 @@
1
- import React from 'react';
2
- import { FormattedMessage } from 'react-intl';
3
- import { HouseType } from '../../../types';
4
- import { byString, validateAge } from './BookingHelpers';
5
- import { isInt } from './OptionalBookingFields';
6
-
7
- export function validateForm(
8
- values: object,
9
- house: HouseType,
10
- bookingFields: []
11
- ): [] {
12
- const { babies_extra, persons } = house;
13
-
14
- let errors = {};
15
-
16
- let babies = Number(values.babies) - Number(babies_extra);
17
- if (babies < 0) {
18
- babies = 0;
19
- }
20
- values.persons = Number(values.children) + Number(values.adults) + babies;
21
-
22
- for (let field of bookingFields) {
23
- if (field.required) {
24
- if (isInt(field.id)) {
25
- const validateValue = byString(
26
- values,
27
- `extra_fields.booking_field_${field.id}`
28
- );
29
-
30
- if (!validateValue || validateValue === '') {
31
- errors[field.id] = <FormattedMessage id="required" />;
32
- }
33
- } else {
34
- const validateValue = byString(values, field.id);
35
-
36
- if (!validateValue || validateValue === '') {
37
- errors[field.id] = <FormattedMessage id="required" />;
38
- }
39
- }
40
- }
41
- }
42
-
43
- if (values.adults < 1 && persons > 0) {
44
- errors.adults = <FormattedMessage id="at_least_1_adult" />;
45
- }
46
- if (Number(values.discount) > 0 && !values.discount_reason) {
47
- errors.discount_reason = <FormattedMessage id="you_need_to_give_reason" />;
48
- }
49
- if (values.persons > persons) {
50
- errors.max_persons = <FormattedMessage id="max_persons_reached" />;
51
- }
52
-
53
- if (
54
- values.cancel_insurance !== 0 &&
55
- validateAge(values.extra_fields?.date_of_birth)
56
- ) {
57
- errors['extra_fields.date_of_birth'] = (
58
- <FormattedMessage id="at_least_18y_old" />
59
- );
60
- errors['insurances'] = <FormattedMessage id="at_least_18y_old" />;
61
- }
62
-
63
- return errors;
64
- }