bukazu-portal-react 2.1.21 → 3.0.3
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/.github/workflows/dependabot.yml +11 -0
- package/.github/workflows/node.js.yml +31 -0
- package/.prettierrc +3 -6
- package/CHANGELOG.MD +5 -0
- package/babel.config.json +1 -1
- package/build/index.css +1 -2312
- package/build/portal.es.js +35483 -0
- package/build/portal.umd.js +596 -0
- package/{build/calendar.html → calendar.html} +2 -4
- package/coverage/clover.xml +28 -0
- package/coverage/coverage-final.json +2 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/helper.ts.html +142 -0
- package/coverage/lcov-report/index.html +116 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +196 -0
- package/coverage/lcov.info +36 -0
- package/cypress/{integration → e2e}/.examples/actions.spec.js +0 -0
- package/cypress/{integration → e2e}/.examples/aliasing.spec.js +0 -0
- package/cypress/{integration → e2e}/.examples/assertions.spec.js +0 -0
- package/cypress/{integration → e2e}/.examples/connectors.spec.js +0 -0
- package/cypress/{integration → e2e}/.examples/cookies.spec.js +0 -0
- package/cypress/{integration → e2e}/.examples/cypress_api.spec.js +0 -0
- package/cypress/{integration → e2e}/.examples/files.spec.js +0 -0
- package/cypress/{integration → e2e}/.examples/local_storage.spec.js +0 -0
- package/cypress/{integration → e2e}/.examples/location.spec.js +0 -0
- package/cypress/{integration → e2e}/.examples/misc.spec.js +0 -0
- package/cypress/{integration → e2e}/.examples/navigation.spec.js +0 -0
- package/cypress/{integration → e2e}/.examples/network_requests.spec.js +0 -0
- package/cypress/{integration → e2e}/.examples/querying.spec.js +0 -0
- package/cypress/{integration → e2e}/.examples/spies_stubs_clocks.spec.js +0 -0
- package/cypress/{integration → e2e}/.examples/traversal.spec.js +0 -0
- package/cypress/{integration → e2e}/.examples/utilities.spec.js +0 -0
- package/cypress/{integration → e2e}/.examples/viewport.spec.js +0 -0
- package/cypress/{integration → e2e}/.examples/waiting.spec.js +0 -0
- package/cypress/{integration → e2e}/.examples/window.spec.js +0 -0
- package/cypress/{integration → e2e}/booking.spec.js +0 -0
- package/cypress/{integration → e2e}/calendar.spec.js +0 -0
- package/cypress/{integration → e2e}/search.spec.js +0 -0
- package/cypress/support/commands.ts +37 -0
- package/cypress/support/component-index.html +12 -0
- package/cypress/support/component.ts +39 -0
- package/cypress/support/{index.js → e2e.js} +0 -0
- package/cypress.config.ts +15 -0
- package/{dev.js → dev.tsx} +1 -1
- package/index.html +15 -0
- package/{build/invalid-calendar.html → invalid-calendar.html} +0 -0
- package/jest.config.js +195 -0
- package/package.json +35 -40
- package/reviews.html +16 -0
- package/src/_lib/{SearchQueries.js → SearchQueries.ts} +8 -2
- package/src/_lib/{countries.js → countries.ts} +0 -0
- package/src/_lib/date_helper.ts +27 -0
- package/src/_lib/{queries.js → queries.ts} +24 -5
- package/src/components/App.tsx +132 -0
- package/src/components/AppContext.ts +14 -0
- package/src/components/CalendarPage/BookingForm.tsx +42 -0
- package/src/components/CalendarPage/Calendar.tsx +50 -0
- package/src/components/CalendarPage/CalendarPage.tsx +43 -0
- package/src/components/CalendarPage/CalendarParts/CalendarContext.tsx +89 -0
- package/src/components/CalendarPage/CalendarParts/CalendarHeader.tsx +72 -0
- package/src/components/CalendarPage/CalendarParts/DayClasses.ts +111 -0
- package/src/components/CalendarPage/CalendarParts/GenerateCalendar.tsx +64 -0
- package/src/components/CalendarPage/CalendarParts/Legend.tsx +33 -0
- package/src/components/CalendarPage/CalendarParts/MonthHeader.tsx +15 -0
- package/src/components/CalendarPage/CalendarParts/Months.tsx +37 -0
- package/src/components/CalendarPage/CalendarParts/RenderCells.tsx +94 -0
- package/src/components/CalendarPage/CalendarParts/SingleMonth.tsx +72 -0
- package/src/components/CalendarPage/CalendarParts/StartBooking.tsx +17 -0
- package/src/components/CalendarPage/CalendarParts/WeekDays.tsx +27 -0
- package/src/components/CalendarPage/FormCreator.tsx +213 -0
- package/src/components/CalendarPage/FormItems/{Date.js → Date.tsx} +10 -2
- package/src/components/CalendarPage/FormItems/{NumberSelect.js → NumberSelect.tsx} +1 -1
- package/src/components/CalendarPage/FormItems/{Select.js → Select.tsx} +0 -0
- package/src/components/CalendarPage/FormItems/{index.js → index.ts} +0 -0
- package/src/components/CalendarPage/PriceField/Price.tsx +58 -0
- package/src/components/CalendarPage/PriceField/Queries.ts +23 -0
- package/src/components/CalendarPage/PriceField/index.tsx +127 -0
- package/src/components/CalendarPage/Summary/{CostRow.js → CostRow.tsx} +19 -3
- package/src/components/CalendarPage/Summary/{CostSection.js → CostSection.tsx} +5 -1
- package/src/components/CalendarPage/Summary/{CostSummary.js → CostSummary.tsx} +19 -10
- package/src/components/CalendarPage/Summary/Description.tsx +27 -0
- package/src/components/CalendarPage/Summary/{InsurancesAndRequired.js → InsurancesAndRequired.tsx} +21 -2
- package/src/components/CalendarPage/Summary/Object.tsx +59 -0
- package/src/components/CalendarPage/Summary/{OnSite.js → OnSite.tsx} +9 -9
- package/src/components/CalendarPage/Summary/{OptionalNotOnSite.js → OptionalNotOnSite.tsx} +19 -18
- package/src/components/CalendarPage/Summary/{OptionalOnSite.js → OptionalOnSite.tsx} +6 -1
- package/src/components/CalendarPage/Summary/{Queries.js → Queries.ts} +3 -3
- package/src/components/CalendarPage/Summary/RentAndDiscount.tsx +30 -0
- package/src/components/CalendarPage/Summary/{Totals.js → Totals.tsx} +8 -3
- package/src/components/CalendarPage/Summary/cost_types.d.ts +31 -0
- package/src/components/CalendarPage/Summary/index.tsx +24 -0
- package/src/components/CalendarPage/calender_types.d.ts +16 -0
- package/src/components/CalendarPage/formParts/AssistanceMessage.tsx +60 -0
- package/src/components/CalendarPage/formParts/{BookingHelpers.js → BookingHelpers.tsx} +3 -3
- package/src/components/CalendarPage/formParts/{BookingOrOption.js → BookingOrOption.tsx} +6 -1
- package/src/components/CalendarPage/formParts/CancelInsuranceText.tsx +105 -0
- package/src/components/CalendarPage/formParts/{DefaultBookingFields.js → DefaultBookingFields.ts} +3 -1
- package/src/components/CalendarPage/formParts/DiscountCode.tsx +62 -0
- package/src/components/CalendarPage/formParts/{Guests.js → Guests.tsx} +10 -4
- package/src/components/CalendarPage/formParts/{OptionalBookingFields.js → OptionalBookingFields.tsx} +0 -0
- package/src/components/CalendarPage/formParts/{OptionalCosts.js → OptionalCosts.tsx} +1 -2
- package/src/components/CalendarPage/formParts/{SuccessMessage.js → SuccessMessage.tsx} +0 -0
- package/src/components/CalendarPage/formParts/Validations.tsx +78 -0
- package/src/components/CalendarPage/formParts/{discount.js → discount.tsx} +11 -2
- package/src/components/CalendarPage/formParts/form_types.d.ts +38 -0
- package/src/components/CalendarPage/formParts/{insurances.js → insurances.tsx} +14 -10
- package/src/components/CalendarPage/formParts/{radioButtons.js → radioButtons.tsx} +0 -0
- package/src/components/Error/{ApiError.js → ApiError.tsx} +6 -4
- package/src/components/Error/{IntegrationError.js → IntegrationError.tsx} +17 -11
- package/src/components/Error/{index.js → index.ts} +0 -0
- package/src/components/{ErrorBoundary.js → ErrorBoundary.tsx} +13 -5
- package/src/components/Modal/index.tsx +46 -0
- package/src/components/ReviewsPage/Queries.ts +26 -0
- package/src/components/ReviewsPage/ReviewsPage.tsx +43 -0
- package/src/components/ReviewsPage/Score.tsx +25 -0
- package/src/components/ReviewsPage/SingleReview.tsx +38 -0
- package/src/components/SafeBooking.tsx +97 -0
- package/src/components/SearchPage/Field.tsx +75 -0
- package/src/components/SearchPage/Filters.tsx +91 -0
- package/src/components/SearchPage/Paginator.tsx +63 -0
- package/src/components/SearchPage/Results.tsx +129 -0
- package/src/components/SearchPage/{SearchPage.js → SearchPage.tsx} +42 -31
- package/src/components/SearchPage/{SingleResult.js → SingleResult.tsx} +15 -8
- package/src/components/SearchPage/filters/Categories.tsx +57 -0
- package/src/components/SearchPage/filters/DateFilter.tsx +34 -0
- package/src/components/SearchPage/filters/List.tsx +80 -0
- package/src/components/SearchPage/filters/NumberFilter.tsx +37 -0
- package/src/components/SearchPage/filters/Radio.tsx +46 -0
- package/src/components/SearchPage/filters/Select.tsx +85 -0
- package/src/components/SearchPage/filters/__tests__/helper.spec.js +15 -0
- package/src/components/SearchPage/filters/filter_types.d.ts +25 -0
- package/src/components/SearchPage/filters/helper.ts +19 -0
- package/src/components/icons/ArrowLeft.svg.tsx +20 -0
- package/src/components/icons/{ArrowRight.svg.js → ArrowRight.svg.tsx} +0 -0
- package/src/components/icons/{Reload.svg.js → Reload.svg.tsx} +0 -0
- package/src/components/icons/{info.svg.js → info.svg.tsx} +0 -0
- package/src/components/icons/{loading.svg.js → loading.svg.tsx} +1 -1
- package/src/custom.d.ts +10 -0
- package/src/index.tsx +93 -0
- package/src/locales/de.json +4 -3
- package/src/locales/en.json +4 -3
- package/src/locales/es.json +4 -3
- package/src/locales/fr.json +4 -3
- package/src/locales/it.json +4 -3
- package/src/locales/nl.json +4 -3
- package/src/styles/main.css +2 -1
- package/src/styles/modal.css +1 -1
- package/src/styles/pagination.css +25 -23
- package/src/styles/result.css +33 -2
- package/src/styles/reviews.css +76 -0
- package/src/types.d.ts +85 -0
- package/tsconfig.json +17 -0
- package/vite.config.ts +31 -0
- package/build/index.html +0 -16
- package/build/index.js +0 -48528
- package/cypress.json +0 -9
- package/rollup.config.js +0 -30
- package/src/_lib/format.js +0 -16
- package/src/components/App.js +0 -164
- package/src/components/CalendarPage/BookingForm.js +0 -57
- package/src/components/CalendarPage/Calendar.js +0 -373
- package/src/components/CalendarPage/CalendarHeader.js +0 -58
- package/src/components/CalendarPage/CalendarPage.js +0 -158
- package/src/components/CalendarPage/FormCreator.js +0 -278
- package/src/components/CalendarPage/FormItems/Wrapper.js +0 -0
- package/src/components/CalendarPage/PriceField.js +0 -203
- package/src/components/CalendarPage/Summary/Description.js +0 -22
- package/src/components/CalendarPage/Summary/Object.js +0 -46
- package/src/components/CalendarPage/Summary/RentAndDiscount.js +0 -21
- package/src/components/CalendarPage/Summary/index.js +0 -19
- package/src/components/CalendarPage/formParts/AssistanceMessage.js +0 -47
- package/src/components/CalendarPage/formParts/CancelInsuranceText.js +0 -91
- package/src/components/CalendarPage/formParts/DiscountCode.js +0 -62
- package/src/components/CalendarPage/formParts/summary.js +0 -43
- package/src/components/Modal/index.js +0 -58
- package/src/components/ReviewsPage/ReviewsPage.js +0 -15
- package/src/components/SafeBooking.js +0 -69
- package/src/components/SearchPage/Field.js +0 -241
- package/src/components/SearchPage/Filters.js +0 -108
- package/src/components/SearchPage/Paginator.js +0 -59
- package/src/components/SearchPage/Results.js +0 -130
- package/src/components/SearchPage/filters/List.js +0 -63
- package/src/components/icons/ArrowLeft.svg.js +0 -18
- package/src/index.js +0 -74
- package/webpack.config.dev.js +0 -53
- package/webpack.config.js +0 -67
package/jest.config.js
ADDED
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* For a detailed explanation regarding each configuration property, visit:
|
|
3
|
+
* https://jestjs.io/docs/configuration
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
module.exports = {
|
|
7
|
+
// All imported modules in your tests should be mocked automatically
|
|
8
|
+
// automock: false,
|
|
9
|
+
|
|
10
|
+
// Stop running tests after `n` failures
|
|
11
|
+
// bail: 0,
|
|
12
|
+
|
|
13
|
+
// The directory where Jest should store its cached dependency information
|
|
14
|
+
// cacheDirectory: "/tmp/jest_rs",
|
|
15
|
+
|
|
16
|
+
// Automatically clear mock calls, instances, contexts and results before every test
|
|
17
|
+
clearMocks: true,
|
|
18
|
+
|
|
19
|
+
// Indicates whether the coverage information should be collected while executing the test
|
|
20
|
+
collectCoverage: true,
|
|
21
|
+
|
|
22
|
+
// An array of glob patterns indicating a set of files for which coverage information should be collected
|
|
23
|
+
// collectCoverageFrom: undefined,
|
|
24
|
+
|
|
25
|
+
// The directory where Jest should output its coverage files
|
|
26
|
+
coverageDirectory: "coverage",
|
|
27
|
+
|
|
28
|
+
// An array of regexp pattern strings used to skip coverage collection
|
|
29
|
+
// coveragePathIgnorePatterns: [
|
|
30
|
+
// "/node_modules/"
|
|
31
|
+
// ],
|
|
32
|
+
|
|
33
|
+
// Indicates which provider should be used to instrument code for coverage
|
|
34
|
+
coverageProvider: "v8",
|
|
35
|
+
|
|
36
|
+
// A list of reporter names that Jest uses when writing coverage reports
|
|
37
|
+
// coverageReporters: [
|
|
38
|
+
// "json",
|
|
39
|
+
// "text",
|
|
40
|
+
// "lcov",
|
|
41
|
+
// "clover"
|
|
42
|
+
// ],
|
|
43
|
+
|
|
44
|
+
// An object that configures minimum threshold enforcement for coverage results
|
|
45
|
+
// coverageThreshold: undefined,
|
|
46
|
+
|
|
47
|
+
// A path to a custom dependency extractor
|
|
48
|
+
// dependencyExtractor: undefined,
|
|
49
|
+
|
|
50
|
+
// Make calling deprecated APIs throw helpful error messages
|
|
51
|
+
// errorOnDeprecated: false,
|
|
52
|
+
|
|
53
|
+
// The default configuration for fake timers
|
|
54
|
+
// fakeTimers: {
|
|
55
|
+
// "enableGlobally": false
|
|
56
|
+
// },
|
|
57
|
+
|
|
58
|
+
// Force coverage collection from ignored files using an array of glob patterns
|
|
59
|
+
// forceCoverageMatch: [],
|
|
60
|
+
|
|
61
|
+
// A path to a module which exports an async function that is triggered once before all test suites
|
|
62
|
+
// globalSetup: undefined,
|
|
63
|
+
|
|
64
|
+
// A path to a module which exports an async function that is triggered once after all test suites
|
|
65
|
+
// globalTeardown: undefined,
|
|
66
|
+
|
|
67
|
+
// A set of global variables that need to be available in all test environments
|
|
68
|
+
// globals: {},
|
|
69
|
+
|
|
70
|
+
// The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
|
|
71
|
+
// maxWorkers: "50%",
|
|
72
|
+
|
|
73
|
+
// An array of directory names to be searched recursively up from the requiring module's location
|
|
74
|
+
// moduleDirectories: [
|
|
75
|
+
// "node_modules"
|
|
76
|
+
// ],
|
|
77
|
+
|
|
78
|
+
// An array of file extensions your modules use
|
|
79
|
+
// moduleFileExtensions: [
|
|
80
|
+
// "js",
|
|
81
|
+
// "mjs",
|
|
82
|
+
// "cjs",
|
|
83
|
+
// "jsx",
|
|
84
|
+
// "ts",
|
|
85
|
+
// "tsx",
|
|
86
|
+
// "json",
|
|
87
|
+
// "node"
|
|
88
|
+
// ],
|
|
89
|
+
|
|
90
|
+
// A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
|
|
91
|
+
// moduleNameMapper: {},
|
|
92
|
+
|
|
93
|
+
// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
|
|
94
|
+
// modulePathIgnorePatterns: [],
|
|
95
|
+
|
|
96
|
+
// Activates notifications for test results
|
|
97
|
+
// notify: false,
|
|
98
|
+
|
|
99
|
+
// An enum that specifies notification mode. Requires { notify: true }
|
|
100
|
+
// notifyMode: "failure-change",
|
|
101
|
+
|
|
102
|
+
// A preset that is used as a base for Jest's configuration
|
|
103
|
+
// preset: undefined,
|
|
104
|
+
|
|
105
|
+
// Run tests from one or more projects
|
|
106
|
+
// projects: undefined,
|
|
107
|
+
|
|
108
|
+
// Use this configuration option to add custom reporters to Jest
|
|
109
|
+
// reporters: undefined,
|
|
110
|
+
|
|
111
|
+
// Automatically reset mock state before every test
|
|
112
|
+
// resetMocks: false,
|
|
113
|
+
|
|
114
|
+
// Reset the module registry before running each individual test
|
|
115
|
+
// resetModules: false,
|
|
116
|
+
|
|
117
|
+
// A path to a custom resolver
|
|
118
|
+
// resolver: undefined,
|
|
119
|
+
|
|
120
|
+
// Automatically restore mock state and implementation before every test
|
|
121
|
+
// restoreMocks: false,
|
|
122
|
+
|
|
123
|
+
// The root directory that Jest should scan for tests and modules within
|
|
124
|
+
// rootDir: undefined,
|
|
125
|
+
|
|
126
|
+
// A list of paths to directories that Jest should use to search for files in
|
|
127
|
+
roots: [
|
|
128
|
+
"src"
|
|
129
|
+
],
|
|
130
|
+
|
|
131
|
+
// Allows you to use a custom runner instead of Jest's default test runner
|
|
132
|
+
// runner: "jest-runner",
|
|
133
|
+
|
|
134
|
+
// The paths to modules that run some code to configure or set up the testing environment before each test
|
|
135
|
+
// setupFiles: [],
|
|
136
|
+
|
|
137
|
+
// A list of paths to modules that run some code to configure or set up the testing framework before each test
|
|
138
|
+
// setupFilesAfterEnv: [],
|
|
139
|
+
|
|
140
|
+
// The number of seconds after which a test is considered as slow and reported as such in the results.
|
|
141
|
+
// slowTestThreshold: 5,
|
|
142
|
+
|
|
143
|
+
// A list of paths to snapshot serializer modules Jest should use for snapshot testing
|
|
144
|
+
// snapshotSerializers: [],
|
|
145
|
+
|
|
146
|
+
// The test environment that will be used for testing
|
|
147
|
+
// testEnvironment: "jest-environment-node",
|
|
148
|
+
|
|
149
|
+
// Options that will be passed to the testEnvironment
|
|
150
|
+
// testEnvironmentOptions: {},
|
|
151
|
+
|
|
152
|
+
// Adds a location field to test results
|
|
153
|
+
// testLocationInResults: false,
|
|
154
|
+
|
|
155
|
+
// The glob patterns Jest uses to detect test files
|
|
156
|
+
// testMatch: [
|
|
157
|
+
// "**/__tests__/**/*.[jt]s?(x)",
|
|
158
|
+
// "**/?(*.)+(spec|test).[tj]s?(x)"
|
|
159
|
+
// ],
|
|
160
|
+
|
|
161
|
+
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
|
|
162
|
+
// testPathIgnorePatterns: [
|
|
163
|
+
// "/node_modules/"
|
|
164
|
+
// ],
|
|
165
|
+
|
|
166
|
+
// The regexp pattern or array of patterns that Jest uses to detect test files
|
|
167
|
+
// testRegex: [],
|
|
168
|
+
|
|
169
|
+
// This option allows the use of a custom results processor
|
|
170
|
+
// testResultsProcessor: undefined,
|
|
171
|
+
|
|
172
|
+
// This option allows use of a custom test runner
|
|
173
|
+
// testRunner: "jest-circus/runner",
|
|
174
|
+
|
|
175
|
+
// A map from regular expressions to paths to transformers
|
|
176
|
+
// transform: undefined,
|
|
177
|
+
|
|
178
|
+
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
|
|
179
|
+
// transformIgnorePatterns: [
|
|
180
|
+
// "/node_modules/",
|
|
181
|
+
// "\\.pnp\\.[^\\/]+$"
|
|
182
|
+
// ],
|
|
183
|
+
|
|
184
|
+
// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
|
|
185
|
+
// unmockedModulePathPatterns: undefined,
|
|
186
|
+
|
|
187
|
+
// Indicates whether each individual test should be reported during the run
|
|
188
|
+
// verbose: undefined,
|
|
189
|
+
|
|
190
|
+
// An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
|
|
191
|
+
// watchPathIgnorePatterns: [],
|
|
192
|
+
|
|
193
|
+
// Whether to use watchman for file crawling
|
|
194
|
+
// watchman: true,
|
|
195
|
+
};
|
package/package.json
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bukazu-portal-react",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.3",
|
|
4
4
|
"description": "A package for loading the calendar and search module from bukazu loading into a react app.",
|
|
5
|
-
"main": "build/index.js",
|
|
6
5
|
"repository": "https://github.com/BUKAZU/React-portal",
|
|
7
6
|
"scripts": {
|
|
8
|
-
"
|
|
9
|
-
"test": "cypress open",
|
|
10
|
-
"build": "
|
|
11
|
-
"
|
|
7
|
+
"test": "jest",
|
|
8
|
+
"test-cypress": "cypress open",
|
|
9
|
+
"build": "vite build",
|
|
10
|
+
"dev": "vite"
|
|
12
11
|
},
|
|
13
12
|
"author": "Bob van Oorschot",
|
|
14
13
|
"license": "MIT",
|
|
@@ -21,17 +20,15 @@
|
|
|
21
20
|
"@babel/plugin-proposal-class-properties": "^7.13.0",
|
|
22
21
|
"@babel/preset-env": "^7.15.0",
|
|
23
22
|
"@babel/preset-react": "^7.14.5",
|
|
24
|
-
"@
|
|
25
|
-
"@
|
|
26
|
-
"@
|
|
27
|
-
"@
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"babel-runtime": "^6.26.0",
|
|
23
|
+
"@babel/preset-typescript": "^7.18.6",
|
|
24
|
+
"@jest/globals": "^29.4.1",
|
|
25
|
+
"@types/node": "^18.11.18",
|
|
26
|
+
"@types/react": "^18.0.26",
|
|
27
|
+
"@types/react-dom": "^18.0.10",
|
|
28
|
+
"@vitejs/plugin-react": "^3.0.1",
|
|
29
|
+
"autoprefixer": "^10.4.13",
|
|
32
30
|
"chalk": "1.1.3",
|
|
33
|
-
"
|
|
34
|
-
"cypress": "^7.1.0",
|
|
31
|
+
"cypress": "^12.4.1",
|
|
35
32
|
"dotenv": "4.0.0",
|
|
36
33
|
"dotenv-expand": "4.2.0",
|
|
37
34
|
"eslint": "^7.28.0",
|
|
@@ -39,40 +36,38 @@
|
|
|
39
36
|
"eslint-plugin-prettier": "^3.4.0",
|
|
40
37
|
"eslint-plugin-react": "^7.24.0",
|
|
41
38
|
"fs-extra": "3.0.1",
|
|
42
|
-
"jest": "
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"postcss": "^
|
|
46
|
-
"postcss-
|
|
47
|
-
"postcss-
|
|
48
|
-
"postcss-modules": "^4.2.2",
|
|
49
|
-
"postcss-nested": "^5.0.5",
|
|
50
|
-
"postcss-preset-env": "^7.4.3",
|
|
39
|
+
"jest": "^29.4.1",
|
|
40
|
+
"path": "^0.12.7",
|
|
41
|
+
"path-browserify": "^1.0.0",
|
|
42
|
+
"postcss-import": "^15.1.0",
|
|
43
|
+
"postcss-nested": "^6.0.0",
|
|
44
|
+
"postcss-preset-env": "^8.0.1",
|
|
51
45
|
"prettier": "^2.3.1",
|
|
46
|
+
"process": "^0.11.10",
|
|
52
47
|
"react": "^16.4.1",
|
|
53
|
-
"react-dev-utils": "^5.0.1",
|
|
54
48
|
"react-dom": "^16.14.0",
|
|
55
49
|
"resolve": "1.6.0",
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"rollup-plugin-postcss": "^4.0.1",
|
|
60
|
-
"rollup-plugin-replace": "^2.2.0",
|
|
61
|
-
"webpack": "^5",
|
|
62
|
-
"webpack-cli": "^4.6.0",
|
|
63
|
-
"webpack-dev-server": "^3.0.0",
|
|
50
|
+
"ts-jest": "^29.0.5",
|
|
51
|
+
"typescript": "^4.9.4",
|
|
52
|
+
"vite": "^4.0.4",
|
|
64
53
|
"whatwg-fetch": "2.0.3"
|
|
65
54
|
},
|
|
66
55
|
"dependencies": {
|
|
67
|
-
"@apollo/client": "^3.
|
|
68
|
-
"
|
|
69
|
-
"array-sort": "^1.0.0",
|
|
70
|
-
"date-fns": "^1.29.0",
|
|
56
|
+
"@apollo/client": "^3.7.5",
|
|
57
|
+
"date-fns": "^2.29.3",
|
|
71
58
|
"formik": "^2.2.9",
|
|
72
59
|
"graphql": "^15.6.0",
|
|
73
60
|
"react-date-picker": "^8.1.1",
|
|
74
|
-
"react-intl": "5",
|
|
75
|
-
"react-
|
|
61
|
+
"react-intl": "^6.2.5",
|
|
62
|
+
"react-paginate": "^8.1.4"
|
|
63
|
+
},
|
|
64
|
+
"main": "./build/portal.umd.js",
|
|
65
|
+
"module": "./build/portal.es.js",
|
|
66
|
+
"exports": {
|
|
67
|
+
".": {
|
|
68
|
+
"import": "./build/portal.es.js",
|
|
69
|
+
"require": "./build/portal.umd.js"
|
|
70
|
+
}
|
|
76
71
|
},
|
|
77
72
|
"eslintConfig": {
|
|
78
73
|
"extends": [
|
package/reviews.html
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<title>Bukazu Portal</title>
|
|
6
|
+
</head>
|
|
7
|
+
<body>
|
|
8
|
+
<h1>Bukazu Test Reviews</h1>
|
|
9
|
+
|
|
10
|
+
<!-- <div class="bukazu-app" id="bukazu-app" portal-code="050497a0" object-code="DE0002" language='nl' filters='123'></div> -->
|
|
11
|
+
<!-- <div class="bukazu-app" id="bukazu-app" portal-code="72902823" object-code="NL1443" language='nl' filters='123'></div> -->
|
|
12
|
+
<div id='bukazu-app' class='bukazu-app' portal-code="674de20e" object-code="NL0099" language="nl" page="reviews"></div>
|
|
13
|
+
|
|
14
|
+
<script src="./dev.tsx" type="module"></script>
|
|
15
|
+
</body>
|
|
16
|
+
</html>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { gql}
|
|
1
|
+
import { gql } from '@apollo/client';
|
|
2
2
|
|
|
3
3
|
export const HOUSES_QUERY = gql`
|
|
4
4
|
query PortalSiteHousesQuery(
|
|
@@ -18,6 +18,7 @@ export const HOUSES_QUERY = gql`
|
|
|
18
18
|
$skip: Int
|
|
19
19
|
) {
|
|
20
20
|
PortalSite(id: $id) {
|
|
21
|
+
id
|
|
21
22
|
houses(
|
|
22
23
|
country_id: $country_id
|
|
23
24
|
region_id: $region_id
|
|
@@ -45,6 +46,8 @@ export const HOUSES_QUERY = gql`
|
|
|
45
46
|
city
|
|
46
47
|
country_name
|
|
47
48
|
minimum_week_price
|
|
49
|
+
rating
|
|
50
|
+
scoreAmount
|
|
48
51
|
}
|
|
49
52
|
}
|
|
50
53
|
}
|
|
@@ -97,6 +100,8 @@ export const HOUSES_PRICE_QUERY = gql`
|
|
|
97
100
|
city
|
|
98
101
|
country_name
|
|
99
102
|
minimum_week_price
|
|
103
|
+
rating
|
|
104
|
+
score_amount
|
|
100
105
|
booking_price(starts_at: $starts_at, ends_at: $ends_at)
|
|
101
106
|
}
|
|
102
107
|
}
|
|
@@ -104,7 +109,7 @@ export const HOUSES_PRICE_QUERY = gql`
|
|
|
104
109
|
`;
|
|
105
110
|
|
|
106
111
|
export const HOUSE_COUNT_QUERY = gql`
|
|
107
|
-
query
|
|
112
|
+
query PortalSiteHouseCountQuery(
|
|
108
113
|
$id: ID!
|
|
109
114
|
$country_id: ID
|
|
110
115
|
$region_id: String
|
|
@@ -119,6 +124,7 @@ export const HOUSE_COUNT_QUERY = gql`
|
|
|
119
124
|
$weekprice_max: Int
|
|
120
125
|
) {
|
|
121
126
|
PortalSite(id: $id) {
|
|
127
|
+
id
|
|
122
128
|
houses(
|
|
123
129
|
country_id: $country_id
|
|
124
130
|
region_id: $region_id
|
|
File without changes
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
|
|
2
|
+
import { format, parse } from 'date-fns';
|
|
3
|
+
import { es, nl, de, fr, it, enGB } from 'date-fns/locale';
|
|
4
|
+
|
|
5
|
+
const locales: any = {
|
|
6
|
+
en: enGB,
|
|
7
|
+
nl,
|
|
8
|
+
de,
|
|
9
|
+
fr,
|
|
10
|
+
it,
|
|
11
|
+
es,
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
function FormatIntl(date: number, formatStr: string) : String {
|
|
15
|
+
return format(date, formatStr, {
|
|
16
|
+
locale: locales[window.__localeId__], // or global.__localeId__
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
function Parse_EN_US(date_string: string) {
|
|
21
|
+
return parse(date_string, 'yyyy-MM-dd', new Date());
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const MONTH_FORMAT:string = 'MMMM yyyy';
|
|
25
|
+
const LONG_DATE_FORMAT:string = 'EEEE dd MMMM yyyy'
|
|
26
|
+
|
|
27
|
+
export { FormatIntl, Parse_EN_US, MONTH_FORMAT, LONG_DATE_FORMAT };
|
|
@@ -88,13 +88,13 @@ export const CALENDAR_QUERY = gql`
|
|
|
88
88
|
`;
|
|
89
89
|
|
|
90
90
|
export const BOOKING_PRICE_QUERY = gql`
|
|
91
|
-
query
|
|
92
|
-
$
|
|
93
|
-
$
|
|
91
|
+
query BookingFormQuery(
|
|
92
|
+
$portalCode: ID!
|
|
93
|
+
$objectCode: String!
|
|
94
94
|
$starts_at: Date!
|
|
95
95
|
$ends_at: Date!
|
|
96
96
|
) {
|
|
97
|
-
PortalSite(id: $
|
|
97
|
+
PortalSite(id: $portalCode) {
|
|
98
98
|
id
|
|
99
99
|
options
|
|
100
100
|
first_name_label
|
|
@@ -122,7 +122,7 @@ export const BOOKING_PRICE_QUERY = gql`
|
|
|
122
122
|
options
|
|
123
123
|
placeholder
|
|
124
124
|
}
|
|
125
|
-
houses(house_code: $
|
|
125
|
+
houses(house_code: $objectCode) {
|
|
126
126
|
id
|
|
127
127
|
name
|
|
128
128
|
code
|
|
@@ -219,3 +219,22 @@ export const CREATE_BOOKING_MUTATION = gql`
|
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
221
|
`;
|
|
222
|
+
|
|
223
|
+
export const SINGLE_HOUSE_QUERY = gql`
|
|
224
|
+
query PortalSiteSingleHouseQuery($portalCode: ID!, $objectCode: String!) {
|
|
225
|
+
PortalSite(id: $portalCode) {
|
|
226
|
+
id
|
|
227
|
+
houses(house_code: $objectCode) {
|
|
228
|
+
id
|
|
229
|
+
code
|
|
230
|
+
name
|
|
231
|
+
max_nights
|
|
232
|
+
last_minute_days
|
|
233
|
+
discounts
|
|
234
|
+
discounts_info
|
|
235
|
+
house_type
|
|
236
|
+
persons
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
`;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import React, { useContext, useEffect, useState } from 'react';
|
|
2
|
+
import Loading from './icons/loading.svg';
|
|
3
|
+
|
|
4
|
+
import 'react-date-picker/dist/DatePicker.css';
|
|
5
|
+
import 'react-calendar/dist/Calendar.css';
|
|
6
|
+
|
|
7
|
+
import { PORTAL_QUERY } from '../_lib/queries';
|
|
8
|
+
|
|
9
|
+
import SearchPage from './SearchPage/SearchPage';
|
|
10
|
+
import CalendarPage from './CalendarPage/CalendarPage';
|
|
11
|
+
import ReviewsPage from './ReviewsPage/ReviewsPage';
|
|
12
|
+
import SafeBooking from './SafeBooking';
|
|
13
|
+
import { ApiError } from './Error';
|
|
14
|
+
import ErrorBoundary from './ErrorBoundary';
|
|
15
|
+
import { useQuery } from '@apollo/client';
|
|
16
|
+
import { AppContext } from './AppContext';
|
|
17
|
+
import { FiltersType } from './SearchPage/filters/filter_types';
|
|
18
|
+
|
|
19
|
+
const getWidth = () =>
|
|
20
|
+
window.innerWidth ||
|
|
21
|
+
document.documentElement.clientWidth ||
|
|
22
|
+
document.body.clientWidth;
|
|
23
|
+
|
|
24
|
+
interface Props {
|
|
25
|
+
pageType?: string;
|
|
26
|
+
filters?: FiltersType;
|
|
27
|
+
locale: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function App({ pageType, locale, filters }: Props): JSX.Element {
|
|
31
|
+
const { portalCode, objectCode } = useContext(AppContext);
|
|
32
|
+
|
|
33
|
+
let [width, setWidth] = useState(getWidth());
|
|
34
|
+
|
|
35
|
+
// in this case useEffect will execute only once because
|
|
36
|
+
// it does not have any dependencies.
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
const resizeListener = () => {
|
|
39
|
+
// change width from the state object
|
|
40
|
+
setWidth(getWidth());
|
|
41
|
+
};
|
|
42
|
+
// set resize listener
|
|
43
|
+
window.addEventListener('resize', resizeListener);
|
|
44
|
+
|
|
45
|
+
// clean up function
|
|
46
|
+
return () => {
|
|
47
|
+
// remove resize listener
|
|
48
|
+
window.removeEventListener('resize', resizeListener);
|
|
49
|
+
};
|
|
50
|
+
}, []);
|
|
51
|
+
|
|
52
|
+
const { loading, error, data } = useQuery(PORTAL_QUERY, {
|
|
53
|
+
variables: { id: portalCode }
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
if (loading) {
|
|
57
|
+
return <Loading />;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (error) {
|
|
61
|
+
return <ApiError errors={{ ...error }} />;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const PortalSite = data.PortalSite;
|
|
65
|
+
let options = data.PortalSite.options;
|
|
66
|
+
|
|
67
|
+
let root = document.documentElement;
|
|
68
|
+
|
|
69
|
+
root.style.setProperty(
|
|
70
|
+
'--bukazu-discount',
|
|
71
|
+
`${options.colors ? options.colors.discount : 'orange'}`
|
|
72
|
+
);
|
|
73
|
+
root.style.setProperty(
|
|
74
|
+
'--bukazu-cell',
|
|
75
|
+
`${options.colors ? options.colors.cell : '#fff'}`
|
|
76
|
+
);
|
|
77
|
+
root.style.setProperty(
|
|
78
|
+
'--bukazu-arrival',
|
|
79
|
+
`${options.colors ? options.colors.arrival : '#6eeb83'}`
|
|
80
|
+
);
|
|
81
|
+
root.style.setProperty(
|
|
82
|
+
'--bukazu-booked',
|
|
83
|
+
`${options.colors ? options.colors.booked : '#ea2b1f'}`
|
|
84
|
+
);
|
|
85
|
+
root.style.setProperty(
|
|
86
|
+
'--bukazu-departure',
|
|
87
|
+
`${options.colors ? options.colors.departure : 'yellow'}`
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
root.style.setProperty(
|
|
91
|
+
'--bukazu-button',
|
|
92
|
+
`${options.colors ? options.colors.button : 'rgba(23, 190, 187, 0.75)'}`
|
|
93
|
+
);
|
|
94
|
+
root.style.setProperty(
|
|
95
|
+
'--bukazu-button_cta',
|
|
96
|
+
`${options.colors ? options.colors.buttonCta : '#e28413'}`
|
|
97
|
+
);
|
|
98
|
+
root.style.setProperty(
|
|
99
|
+
'--bukazu-background_month',
|
|
100
|
+
`${options.colors ? options.colors.month_background : '#e28413'}`
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
let page;
|
|
104
|
+
|
|
105
|
+
if (objectCode && objectCode !== null && pageType !== 'reviews') {
|
|
106
|
+
page = (
|
|
107
|
+
<ErrorBoundary>
|
|
108
|
+
<CalendarPage PortalSite={PortalSite} />
|
|
109
|
+
<SafeBooking />
|
|
110
|
+
</ErrorBoundary>
|
|
111
|
+
);
|
|
112
|
+
} else if (objectCode && objectCode !== null && pageType === 'reviews') {
|
|
113
|
+
page = <ReviewsPage />;
|
|
114
|
+
} else {
|
|
115
|
+
page = (
|
|
116
|
+
<SearchPage
|
|
117
|
+
PortalSite={PortalSite}
|
|
118
|
+
locale={locale}
|
|
119
|
+
options={options}
|
|
120
|
+
filters={filters}
|
|
121
|
+
/>
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
return <div className={width < 875 ? 'bu-smaller' : ''}>{page}</div>;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
App.defaultProps = {
|
|
129
|
+
filters: {}
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
export default App;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createContext } from 'react';
|
|
2
|
+
import { LocaleType } from '../types';
|
|
3
|
+
|
|
4
|
+
export const AppContext = createContext<AppContextType>({
|
|
5
|
+
locale: 'nl',
|
|
6
|
+
portalCode: '',
|
|
7
|
+
objectCode: ''
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
type AppContextType = {
|
|
11
|
+
locale: LocaleType;
|
|
12
|
+
portalCode: string;
|
|
13
|
+
objectCode: string;
|
|
14
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
|
+
import Loading from '../icons/loading.svg';
|
|
3
|
+
import FormCreator from './FormCreator';
|
|
4
|
+
import { BOOKING_PRICE_QUERY } from '../../_lib/queries';
|
|
5
|
+
import { useQuery } from '@apollo/client';
|
|
6
|
+
import { AppContext } from '../AppContext';
|
|
7
|
+
import { CalendarContext } from './CalendarParts/CalendarContext';
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
function BookingForm(): JSX.Element {
|
|
11
|
+
const { portalCode, objectCode } = useContext(AppContext);
|
|
12
|
+
const { arrivalDate, departureDate } = useContext(CalendarContext)
|
|
13
|
+
const { data, loading, error } = useQuery(BOOKING_PRICE_QUERY, {
|
|
14
|
+
variables: {
|
|
15
|
+
portalCode,
|
|
16
|
+
objectCode,
|
|
17
|
+
starts_at: arrivalDate.date,
|
|
18
|
+
ends_at: departureDate.date
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
if (loading)
|
|
23
|
+
return (
|
|
24
|
+
<div>
|
|
25
|
+
<Loading />
|
|
26
|
+
</div>
|
|
27
|
+
);
|
|
28
|
+
if (error) {
|
|
29
|
+
return <div>Error</div>;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const result = data.PortalSite.houses[0];
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<FormCreator
|
|
36
|
+
house={result}
|
|
37
|
+
PortalSite={data.PortalSite}
|
|
38
|
+
/>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export default BookingForm;
|