@qite/tide-booking-component 1.4.93 → 1.4.95
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/.prettierrc +9 -9
- package/.vs/ProjectSettings.json +3 -3
- package/.vs/VSWorkspaceState.json +5 -5
- package/build/build-cjs/index.js +81 -27
- package/build/build-cjs/src/booking-wizard/features/booking/booking-slice.d.ts +2 -1
- package/build/build-cjs/src/booking-wizard/features/booking/selectors.d.ts +4 -3
- package/build/build-cjs/src/booking-wizard/features/price-details/price-details-slice.d.ts +1 -0
- package/build/build-cjs/src/booking-wizard/features/price-details/selectors.d.ts +1 -0
- package/build/build-cjs/src/booking-wizard/features/sidebar/sidebar.d.ts +1 -0
- package/build/build-cjs/src/booking-wizard/types.d.ts +1 -0
- package/build/build-cjs/src/shared/utils/localization-util.d.ts +1 -0
- package/build/build-esm/index.js +81 -27
- package/build/build-esm/src/booking-wizard/features/booking/booking-slice.d.ts +2 -1
- package/build/build-esm/src/booking-wizard/features/booking/selectors.d.ts +4 -3
- package/build/build-esm/src/booking-wizard/features/price-details/price-details-slice.d.ts +1 -0
- package/build/build-esm/src/booking-wizard/features/price-details/selectors.d.ts +1 -0
- package/build/build-esm/src/booking-wizard/features/sidebar/sidebar.d.ts +1 -0
- package/build/build-esm/src/booking-wizard/types.d.ts +1 -0
- package/build/build-esm/src/shared/utils/localization-util.d.ts +1 -0
- package/package.json +83 -83
- package/src/booking-product/components/age-select.tsx +35 -35
- package/src/booking-product/components/amount-input.tsx +51 -51
- package/src/booking-product/components/date-range-picker/calendar.tsx +155 -155
- package/src/booking-product/components/footer.tsx +54 -54
- package/src/booking-product/components/header.tsx +57 -57
- package/src/booking-product/components/icon.tsx +200 -200
- package/src/booking-product/components/list-view.tsx +54 -54
- package/src/booking-product/components/rating.tsx +21 -21
- package/src/booking-product/components/rooms.tsx +171 -171
- package/src/booking-product/constants.ts +1 -1
- package/src/booking-product/index.tsx +21 -21
- package/src/booking-product/settings-context.ts +16 -16
- package/src/booking-product/types.ts +30 -30
- package/src/booking-product/utils/api.ts +26 -26
- package/src/booking-product/utils/price.ts +28 -28
- package/src/booking-wizard/api-settings-slice.ts +24 -24
- package/src/booking-wizard/components/icon.tsx +398 -398
- package/src/booking-wizard/components/labeled-input.tsx +56 -56
- package/src/booking-wizard/components/labeled-select.tsx +54 -54
- package/src/booking-wizard/components/message.tsx +21 -21
- package/src/booking-wizard/components/multi-range-filter.tsx +99 -99
- package/src/booking-wizard/components/phone-input.tsx +146 -146
- package/src/booking-wizard/components/print-offer-button.tsx +53 -53
- package/src/booking-wizard/components/product-card.tsx +23 -23
- package/src/booking-wizard/declarations.d.ts +4 -4
- package/src/booking-wizard/features/booking/booking-self-contained.tsx +16 -1
- package/src/booking-wizard/features/booking/booking-slice.ts +9 -1
- package/src/booking-wizard/features/booking/booking.tsx +16 -1
- package/src/booking-wizard/features/booking/selectors.ts +5 -0
- package/src/booking-wizard/features/flight-options/flight-filter.tsx +371 -371
- package/src/booking-wizard/features/flight-options/flight-option-flight.tsx +354 -354
- package/src/booking-wizard/features/flight-options/flight-option-modal.tsx +211 -211
- package/src/booking-wizard/features/flight-options/flight-option.tsx +57 -57
- package/src/booking-wizard/features/flight-options/flight-utils.ts +423 -423
- package/src/booking-wizard/features/price-details/price-details-api.ts +20 -20
- package/src/booking-wizard/features/price-details/price-details-slice.ts +2 -0
- package/src/booking-wizard/features/price-details/selectors.ts +1 -0
- package/src/booking-wizard/features/price-details/util.ts +115 -115
- package/src/booking-wizard/features/product-options/no-options.tsx +18 -18
- package/src/booking-wizard/features/product-options/none-option.tsx +73 -73
- package/src/booking-wizard/features/product-options/option-booking-airline-group.tsx +53 -53
- package/src/booking-wizard/features/product-options/option-booking-group.tsx +152 -152
- package/src/booking-wizard/features/product-options/option-item.tsx +236 -236
- package/src/booking-wizard/features/product-options/option-pax-card.tsx +159 -159
- package/src/booking-wizard/features/product-options/option-pax-group.tsx +122 -122
- package/src/booking-wizard/features/product-options/option-room.tsx +226 -226
- package/src/booking-wizard/features/product-options/option-unit-group.tsx +138 -138
- package/src/booking-wizard/features/room-options/room-utils.ts +154 -154
- package/src/booking-wizard/features/room-options/room.tsx +123 -123
- package/src/booking-wizard/features/room-options/traveler-rooms.tsx +64 -64
- package/src/booking-wizard/features/sidebar/index.tsx +2 -0
- package/src/booking-wizard/features/sidebar/sidebar-flight.tsx +66 -66
- package/src/booking-wizard/features/sidebar/sidebar.tsx +17 -1
- package/src/booking-wizard/features/summary/summary-booking-option-pax.tsx +23 -23
- package/src/booking-wizard/features/summary/summary-booking-option-unit.tsx +23 -23
- package/src/booking-wizard/features/summary/summary-flight.tsx +36 -36
- package/src/booking-wizard/features/summary/summary-per-booking-option-group.tsx +60 -60
- package/src/booking-wizard/features/summary/summary-per-pax-option-group.tsx +56 -56
- package/src/booking-wizard/features/summary/summary-per-unit-option-group.tsx +58 -58
- package/src/booking-wizard/features/summary/summary-slice.ts +27 -27
- package/src/booking-wizard/features/travelers-form/travelers-form-slice.ts +157 -157
- package/src/booking-wizard/features/travelers-form/travelers-form-util.ts +10 -10
- package/src/booking-wizard/features/travelers-form/type-ahead-input.tsx +85 -85
- package/src/booking-wizard/features/travelers-form/validate-form.ts +178 -178
- package/src/booking-wizard/index.tsx +27 -27
- package/src/booking-wizard/store.ts +26 -26
- package/src/booking-wizard/types.ts +1 -0
- package/src/booking-wizard/use-offer-printer.ts +108 -108
- package/src/content/components/LanguageSwitcher.tsx +158 -158
- package/src/content/components/accordion.tsx +30 -30
- package/src/content/components/contact.tsx +211 -211
- package/src/content/components/personal-contact-form.tsx +809 -809
- package/src/content/header/index.tsx +43 -43
- package/src/content/header/types.ts +26 -26
- package/src/qsm/components/date-picker/index.tsx +152 -152
- package/src/qsm/components/date-range-picker/calendar-day.tsx +49 -49
- package/src/qsm/components/date-range-picker/calendar.tsx +211 -211
- package/src/qsm/components/date-range-picker/index.tsx +404 -404
- package/src/qsm/index.tsx +26 -26
- package/src/qsm/store/qsm-store.ts +13 -13
- package/src/search-results/components/flight/flight-card.tsx +38 -38
- package/src/search-results/components/flight/flight-leg.tsx +61 -61
- package/src/search-results/components/flight/flight-path.tsx +23 -23
- package/src/search-results/components/multi-range-filter.tsx +104 -104
- package/src/search-results/components/search-results-container/search-results-container.tsx +2 -2
- package/src/search-results/index.tsx +24 -24
- package/src/search-results/search-results-configuration-context.ts +6 -6
- package/src/search-results/store/search-results-store.ts +13 -13
- package/src/shared/components/loader.tsx +16 -16
- package/src/shared/translations/ar-SA.json +2 -1
- package/src/shared/translations/da-DK.json +2 -1
- package/src/shared/translations/de-DE.json +2 -1
- package/src/shared/translations/en-GB.json +2 -1
- package/src/shared/translations/es-ES.json +2 -1
- package/src/shared/translations/fr-BE.json +2 -1
- package/src/shared/translations/fr-FR.json +2 -1
- package/src/shared/translations/is-IS.json +2 -1
- package/src/shared/translations/it-IT.json +2 -1
- package/src/shared/translations/ja-JP.json +2 -1
- package/src/shared/translations/nl-BE.json +2 -1
- package/src/shared/translations/nl-NL.json +2 -1
- package/src/shared/translations/no-NO.json +2 -1
- package/src/shared/translations/pl-PL.json +2 -1
- package/src/shared/translations/pt-PT.json +2 -1
- package/src/shared/translations/sv-SE.json +2 -1
- package/src/shared/utils/class-util.ts +7 -7
- package/src/shared/utils/query-string-util.ts +91 -91
- package/src/shared/utils/tide-api-utils.ts +34 -34
- package/src/shared/utils/use-media-query-util.ts +19 -19
- package/styles/abstracts/_mixins.scss +74 -74
- package/styles/abstracts/_variables.scss +57 -57
- package/styles/base/_fonts.scss +2 -2
- package/styles/base/_normalize.scss +227 -227
- package/styles/base/_typography.scss +35 -35
- package/styles/booking-joker-variables.scss +596 -596
- package/styles/booking-product-variables.scss +330 -330
- package/styles/booking-product.scss +438 -438
- package/styles/booking-qsm-variables.scss +501 -501
- package/styles/booking-qsm.scss +52 -52
- package/styles/booking-wizard-variables.scss +603 -603
- package/styles/booking-wizard.scss +61 -61
- package/styles/components/_accordion.scss +67 -67
- package/styles/components/_animations.scss +39 -39
- package/styles/components/_base.scss +107 -107
- package/styles/components/_breadcrumb.scss +92 -92
- package/styles/components/_button.scss +238 -238
- package/styles/components/_checkbox.scss +230 -230
- package/styles/components/_contact.scss +239 -239
- package/styles/components/_cta.scss +238 -238
- package/styles/components/_date-list.scss +41 -41
- package/styles/components/_date-range-picker.scss +223 -223
- package/styles/components/_decrement-increment.scss +35 -35
- package/styles/components/_dropdown.scss +72 -72
- package/styles/components/_faq.scss +27 -27
- package/styles/components/_flight-option.scss +1419 -1419
- package/styles/components/_gallery.scss +314 -314
- package/styles/components/_header.scss +113 -113
- package/styles/components/_img-slider.scss +175 -175
- package/styles/components/_info-message.scss +75 -75
- package/styles/components/_input.scss +35 -35
- package/styles/components/_list.scss +185 -185
- package/styles/components/_loader.scss +70 -70
- package/styles/components/_mixins.scss +579 -579
- package/styles/components/_passenger-picker.scss +306 -306
- package/styles/components/_phone-input.scss +8 -8
- package/styles/components/_placeholders.scss +165 -165
- package/styles/components/_qsm.scss +17 -17
- package/styles/components/_radiobutton.scss +170 -170
- package/styles/components/_select-wrapper.scss +76 -76
- package/styles/components/_slider.scss +128 -128
- package/styles/components/_spinner.scss +29 -29
- package/styles/components/_step-indicators.scss +161 -161
- package/styles/components/_table.scss +81 -81
- package/styles/components/_typeahead.scss +275 -275
- package/styles/components/_variables.scss +89 -89
- package/styles/content-blocks-variables.scss +507 -507
- package/styles/font.scss +2 -2
- package/styles/qsm/_calendar.scss +274 -274
- package/styles/qsm/_qsm.scss +1094 -1094
- package/styles/search.scss +1200 -1200
- package/tsconfig.json +24 -24
|
@@ -1,138 +1,138 @@
|
|
|
1
|
-
import { BookingOptionGroup, BookingOptionPax, PerPackageOption, PerUnitPackageOption } from '@qite/tide-client/build/types';
|
|
2
|
-
import { isEmpty } from 'lodash';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import { buildClassName } from '../../../shared/utils/class-util';
|
|
5
|
-
import NoneOption from './none-option';
|
|
6
|
-
import OptionItem from './option-item';
|
|
7
|
-
import OptionPaxCard from './option-pax-card';
|
|
8
|
-
|
|
9
|
-
interface OptionUnitGroupProps {
|
|
10
|
-
unitIndex: number;
|
|
11
|
-
optionId?: string;
|
|
12
|
-
group: BookingOptionGroup<PerUnitPackageOption>;
|
|
13
|
-
firstClassName: string;
|
|
14
|
-
secondClassName: string;
|
|
15
|
-
parentId: string;
|
|
16
|
-
onGroupChange?: (group: BookingOptionGroup<PerUnitPackageOption>, unitIndex: number, optionId?: string) => void;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const OptionUnitGroup: React.FC<OptionUnitGroupProps> = ({ unitIndex, optionId, group, firstClassName, secondClassName, parentId, onGroupChange }) => {
|
|
20
|
-
const handleOptionChange = (option: PerPackageOption, index: number) => {
|
|
21
|
-
const updatedGroup = {
|
|
22
|
-
...group,
|
|
23
|
-
options: group.options.map((o, i) => {
|
|
24
|
-
return i === index
|
|
25
|
-
? option
|
|
26
|
-
: {
|
|
27
|
-
...o,
|
|
28
|
-
isSelected: option.requirementType === 2 || option.requirementType === 3 ? false : o.isSelected
|
|
29
|
-
};
|
|
30
|
-
})
|
|
31
|
-
} as BookingOptionGroup<PerUnitPackageOption>;
|
|
32
|
-
|
|
33
|
-
if (onGroupChange) onGroupChange(updatedGroup, unitIndex, optionId);
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
const handleChildGroupChange = (childGroup: BookingOptionGroup<PerUnitPackageOption>, unitIndex: number, optionId?: string) => {
|
|
37
|
-
const updatedGroup = {
|
|
38
|
-
...group,
|
|
39
|
-
options: group.options.map((groupOption) => {
|
|
40
|
-
return groupOption.line.entryLineGuid === optionId
|
|
41
|
-
? {
|
|
42
|
-
...groupOption,
|
|
43
|
-
groups: groupOption.groups.map((optionGroup) => {
|
|
44
|
-
return optionGroup.name === childGroup.name ? childGroup : optionGroup;
|
|
45
|
-
})
|
|
46
|
-
}
|
|
47
|
-
: groupOption;
|
|
48
|
-
})
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
if (onGroupChange) onGroupChange(updatedGroup, unitIndex, optionId);
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
const handleOnPaxChange = (pax: BookingOptionPax[], index?: number) => {
|
|
55
|
-
const updatedGroup = {
|
|
56
|
-
...group,
|
|
57
|
-
options: group.options.map((groupOption, i) => {
|
|
58
|
-
return {
|
|
59
|
-
...groupOption,
|
|
60
|
-
pax: i === index ? pax : groupOption.pax
|
|
61
|
-
};
|
|
62
|
-
})
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
if (onGroupChange) onGroupChange(updatedGroup, unitIndex, optionId);
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
const handleNoneSelectionChanged = () => {
|
|
69
|
-
const updatedGroup = {
|
|
70
|
-
...group,
|
|
71
|
-
options: group.options.map((groupOption) => ({
|
|
72
|
-
...groupOption,
|
|
73
|
-
isSelected: false
|
|
74
|
-
}))
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
if (onGroupChange) onGroupChange(updatedGroup, unitIndex, optionId);
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
const selectedPrice = group.name === '' ? 0 : group.options.find((x) => x.isSelected)?.line.price ?? 0;
|
|
81
|
-
|
|
82
|
-
return (
|
|
83
|
-
<div className={firstClassName}>
|
|
84
|
-
{group.title && <h4 className={secondClassName}>{group.title}</h4>}
|
|
85
|
-
<table className={buildClassName(['table', 'table--striped'])}>
|
|
86
|
-
<tbody>
|
|
87
|
-
{group.options.map((option, index) => (
|
|
88
|
-
<tr key={option.line.entryLineGuid}>
|
|
89
|
-
<td>
|
|
90
|
-
<div className={buildClassName(['tree', option.isSelected && 'tree--selected'])}>
|
|
91
|
-
<div className="tree__level">
|
|
92
|
-
<div className="tree__header">
|
|
93
|
-
<div className="tree__description-collapse">
|
|
94
|
-
<div
|
|
95
|
-
className={buildClassName([
|
|
96
|
-
(option.requirementType === 0 || option.requirementType === 1) && 'checkbox',
|
|
97
|
-
(option.requirementType === 2 || option.requirementType === 3) && 'radiobutton'
|
|
98
|
-
])}>
|
|
99
|
-
<label
|
|
100
|
-
htmlFor={`${parentId}_${index}`}
|
|
101
|
-
className={buildClassName([
|
|
102
|
-
(option.requirementType === 0 || option.requirementType === 1) && 'checkbox__label',
|
|
103
|
-
(option.requirementType === 2 || option.requirementType === 3) && 'radiobutton__label'
|
|
104
|
-
])}>
|
|
105
|
-
<OptionItem option={option} parentId={parentId} index={index} selectedPrice={selectedPrice} onOptionChange={handleOptionChange} />
|
|
106
|
-
{!isEmpty(option.groups) && (
|
|
107
|
-
<div className="tree__body">
|
|
108
|
-
{option.groups.map((optionGroup) => (
|
|
109
|
-
<OptionUnitGroup
|
|
110
|
-
unitIndex={unitIndex}
|
|
111
|
-
optionId={option.line.entryLineGuid}
|
|
112
|
-
group={optionGroup}
|
|
113
|
-
firstClassName={'tree__level'}
|
|
114
|
-
secondClassName={'tree__level-heading'}
|
|
115
|
-
parentId={`${parentId}_${optionGroup.name}`}
|
|
116
|
-
onGroupChange={handleChildGroupChange}
|
|
117
|
-
/>
|
|
118
|
-
))}
|
|
119
|
-
</div>
|
|
120
|
-
)}
|
|
121
|
-
{!isEmpty(option.pax) && <OptionPaxCard pax={option.pax} parentIndex={index} onPaxChange={handleOnPaxChange} />}
|
|
122
|
-
</label>
|
|
123
|
-
</div>
|
|
124
|
-
</div>
|
|
125
|
-
</div>
|
|
126
|
-
</div>
|
|
127
|
-
</div>
|
|
128
|
-
</td>
|
|
129
|
-
</tr>
|
|
130
|
-
))}
|
|
131
|
-
<NoneOption group={group} parentId={parentId} handleNoneSelectionChanged={handleNoneSelectionChanged} />
|
|
132
|
-
</tbody>
|
|
133
|
-
</table>
|
|
134
|
-
</div>
|
|
135
|
-
);
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
export default OptionUnitGroup;
|
|
1
|
+
import { BookingOptionGroup, BookingOptionPax, PerPackageOption, PerUnitPackageOption } from '@qite/tide-client/build/types';
|
|
2
|
+
import { isEmpty } from 'lodash';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { buildClassName } from '../../../shared/utils/class-util';
|
|
5
|
+
import NoneOption from './none-option';
|
|
6
|
+
import OptionItem from './option-item';
|
|
7
|
+
import OptionPaxCard from './option-pax-card';
|
|
8
|
+
|
|
9
|
+
interface OptionUnitGroupProps {
|
|
10
|
+
unitIndex: number;
|
|
11
|
+
optionId?: string;
|
|
12
|
+
group: BookingOptionGroup<PerUnitPackageOption>;
|
|
13
|
+
firstClassName: string;
|
|
14
|
+
secondClassName: string;
|
|
15
|
+
parentId: string;
|
|
16
|
+
onGroupChange?: (group: BookingOptionGroup<PerUnitPackageOption>, unitIndex: number, optionId?: string) => void;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const OptionUnitGroup: React.FC<OptionUnitGroupProps> = ({ unitIndex, optionId, group, firstClassName, secondClassName, parentId, onGroupChange }) => {
|
|
20
|
+
const handleOptionChange = (option: PerPackageOption, index: number) => {
|
|
21
|
+
const updatedGroup = {
|
|
22
|
+
...group,
|
|
23
|
+
options: group.options.map((o, i) => {
|
|
24
|
+
return i === index
|
|
25
|
+
? option
|
|
26
|
+
: {
|
|
27
|
+
...o,
|
|
28
|
+
isSelected: option.requirementType === 2 || option.requirementType === 3 ? false : o.isSelected
|
|
29
|
+
};
|
|
30
|
+
})
|
|
31
|
+
} as BookingOptionGroup<PerUnitPackageOption>;
|
|
32
|
+
|
|
33
|
+
if (onGroupChange) onGroupChange(updatedGroup, unitIndex, optionId);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const handleChildGroupChange = (childGroup: BookingOptionGroup<PerUnitPackageOption>, unitIndex: number, optionId?: string) => {
|
|
37
|
+
const updatedGroup = {
|
|
38
|
+
...group,
|
|
39
|
+
options: group.options.map((groupOption) => {
|
|
40
|
+
return groupOption.line.entryLineGuid === optionId
|
|
41
|
+
? {
|
|
42
|
+
...groupOption,
|
|
43
|
+
groups: groupOption.groups.map((optionGroup) => {
|
|
44
|
+
return optionGroup.name === childGroup.name ? childGroup : optionGroup;
|
|
45
|
+
})
|
|
46
|
+
}
|
|
47
|
+
: groupOption;
|
|
48
|
+
})
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
if (onGroupChange) onGroupChange(updatedGroup, unitIndex, optionId);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const handleOnPaxChange = (pax: BookingOptionPax[], index?: number) => {
|
|
55
|
+
const updatedGroup = {
|
|
56
|
+
...group,
|
|
57
|
+
options: group.options.map((groupOption, i) => {
|
|
58
|
+
return {
|
|
59
|
+
...groupOption,
|
|
60
|
+
pax: i === index ? pax : groupOption.pax
|
|
61
|
+
};
|
|
62
|
+
})
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
if (onGroupChange) onGroupChange(updatedGroup, unitIndex, optionId);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const handleNoneSelectionChanged = () => {
|
|
69
|
+
const updatedGroup = {
|
|
70
|
+
...group,
|
|
71
|
+
options: group.options.map((groupOption) => ({
|
|
72
|
+
...groupOption,
|
|
73
|
+
isSelected: false
|
|
74
|
+
}))
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
if (onGroupChange) onGroupChange(updatedGroup, unitIndex, optionId);
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const selectedPrice = group.name === '' ? 0 : group.options.find((x) => x.isSelected)?.line.price ?? 0;
|
|
81
|
+
|
|
82
|
+
return (
|
|
83
|
+
<div className={firstClassName}>
|
|
84
|
+
{group.title && <h4 className={secondClassName}>{group.title}</h4>}
|
|
85
|
+
<table className={buildClassName(['table', 'table--striped'])}>
|
|
86
|
+
<tbody>
|
|
87
|
+
{group.options.map((option, index) => (
|
|
88
|
+
<tr key={option.line.entryLineGuid}>
|
|
89
|
+
<td>
|
|
90
|
+
<div className={buildClassName(['tree', option.isSelected && 'tree--selected'])}>
|
|
91
|
+
<div className="tree__level">
|
|
92
|
+
<div className="tree__header">
|
|
93
|
+
<div className="tree__description-collapse">
|
|
94
|
+
<div
|
|
95
|
+
className={buildClassName([
|
|
96
|
+
(option.requirementType === 0 || option.requirementType === 1) && 'checkbox',
|
|
97
|
+
(option.requirementType === 2 || option.requirementType === 3) && 'radiobutton'
|
|
98
|
+
])}>
|
|
99
|
+
<label
|
|
100
|
+
htmlFor={`${parentId}_${index}`}
|
|
101
|
+
className={buildClassName([
|
|
102
|
+
(option.requirementType === 0 || option.requirementType === 1) && 'checkbox__label',
|
|
103
|
+
(option.requirementType === 2 || option.requirementType === 3) && 'radiobutton__label'
|
|
104
|
+
])}>
|
|
105
|
+
<OptionItem option={option} parentId={parentId} index={index} selectedPrice={selectedPrice} onOptionChange={handleOptionChange} />
|
|
106
|
+
{!isEmpty(option.groups) && (
|
|
107
|
+
<div className="tree__body">
|
|
108
|
+
{option.groups.map((optionGroup) => (
|
|
109
|
+
<OptionUnitGroup
|
|
110
|
+
unitIndex={unitIndex}
|
|
111
|
+
optionId={option.line.entryLineGuid}
|
|
112
|
+
group={optionGroup}
|
|
113
|
+
firstClassName={'tree__level'}
|
|
114
|
+
secondClassName={'tree__level-heading'}
|
|
115
|
+
parentId={`${parentId}_${optionGroup.name}`}
|
|
116
|
+
onGroupChange={handleChildGroupChange}
|
|
117
|
+
/>
|
|
118
|
+
))}
|
|
119
|
+
</div>
|
|
120
|
+
)}
|
|
121
|
+
{!isEmpty(option.pax) && <OptionPaxCard pax={option.pax} parentIndex={index} onPaxChange={handleOnPaxChange} />}
|
|
122
|
+
</label>
|
|
123
|
+
</div>
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
</div>
|
|
127
|
+
</div>
|
|
128
|
+
</td>
|
|
129
|
+
</tr>
|
|
130
|
+
))}
|
|
131
|
+
<NoneOption group={group} parentId={parentId} handleNoneSelectionChanged={handleNoneSelectionChanged} />
|
|
132
|
+
</tbody>
|
|
133
|
+
</table>
|
|
134
|
+
</div>
|
|
135
|
+
);
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
export default OptionUnitGroup;
|
|
@@ -1,154 +1,154 @@
|
|
|
1
|
-
import { BookingPackageAvailability, BookingPackageRoom } from '@qite/tide-client/build/types';
|
|
2
|
-
import { AccommodationContent, RegimeContent, SelectableRoom, SelectableRoomAccommodation } from '../../types';
|
|
3
|
-
|
|
4
|
-
export const buildSelectableRooms = (
|
|
5
|
-
packageRooms: BookingPackageRoom[],
|
|
6
|
-
accommodations: AccommodationContent[] | undefined,
|
|
7
|
-
regimes: RegimeContent[] | undefined,
|
|
8
|
-
accommodationViews: { [key: string]: string } | undefined
|
|
9
|
-
) => {
|
|
10
|
-
return packageRooms.map((x) => {
|
|
11
|
-
const selectedOption = x.options.find((x) => x.isSelected)!;
|
|
12
|
-
const alternativeOptions = x.options
|
|
13
|
-
.filter((x) => x.accommodationCode !== selectedOption.accommodationCode && !x.isLocked)
|
|
14
|
-
.sort((a, b) => a.price - b.price);
|
|
15
|
-
|
|
16
|
-
const alternativeAccommodations: SelectableRoomAccommodation[] = [];
|
|
17
|
-
alternativeOptions.forEach((x) => {
|
|
18
|
-
const alternativeAccommodation = alternativeAccommodations.find((y) => y.code === x.accommodationCode);
|
|
19
|
-
|
|
20
|
-
if (alternativeAccommodation) {
|
|
21
|
-
const regime = regimes?.find((y) => y.code === x.regimeCode);
|
|
22
|
-
|
|
23
|
-
alternativeAccommodation.regimes.push({
|
|
24
|
-
code: x.regimeCode,
|
|
25
|
-
title: regime?.title ?? x.regimeName,
|
|
26
|
-
price: x.price
|
|
27
|
-
});
|
|
28
|
-
} else {
|
|
29
|
-
const accommodation = accommodations?.find((y) => y.code === x.accommodationCode);
|
|
30
|
-
const regime = regimes?.find((y) => y.code === x.regimeCode);
|
|
31
|
-
|
|
32
|
-
alternativeAccommodations.push({
|
|
33
|
-
code: x.accommodationCode,
|
|
34
|
-
regimeCode: x.regimeCode,
|
|
35
|
-
from: x.from,
|
|
36
|
-
to: x.to,
|
|
37
|
-
price: x.price,
|
|
38
|
-
regimes: [
|
|
39
|
-
{
|
|
40
|
-
code: x.regimeCode,
|
|
41
|
-
title: regime?.title ?? x.regimeName,
|
|
42
|
-
price: x.price
|
|
43
|
-
}
|
|
44
|
-
],
|
|
45
|
-
title: accommodation?.title ?? x.accommodationName,
|
|
46
|
-
image: accommodation?.imageUrl,
|
|
47
|
-
usps: accommodation?.usps ?? [],
|
|
48
|
-
description: accommodation?.description,
|
|
49
|
-
viewHtml: accommodationViews?.[x.accommodationCode]
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
const accommodation = accommodations?.find((y) => y.code === selectedOption.accommodationCode);
|
|
55
|
-
|
|
56
|
-
return {
|
|
57
|
-
index: x.index,
|
|
58
|
-
selected: {
|
|
59
|
-
code: selectedOption.accommodationCode,
|
|
60
|
-
regimeCode: selectedOption.regimeCode,
|
|
61
|
-
price: selectedOption.price,
|
|
62
|
-
from: selectedOption.from,
|
|
63
|
-
to: selectedOption.to,
|
|
64
|
-
regimes: x.options
|
|
65
|
-
.filter((x) => x.accommodationCode === selectedOption.accommodationCode)
|
|
66
|
-
.sort((a, b) => a.price - b.price)
|
|
67
|
-
.map((o) => {
|
|
68
|
-
const regime = regimes?.find((y) => y.code === o.regimeCode);
|
|
69
|
-
|
|
70
|
-
return {
|
|
71
|
-
code: o.regimeCode,
|
|
72
|
-
title: regime?.title ?? o.regimeName,
|
|
73
|
-
price: o.price
|
|
74
|
-
};
|
|
75
|
-
}),
|
|
76
|
-
title: accommodation?.title ?? selectedOption.accommodationName,
|
|
77
|
-
image: accommodation?.imageUrl,
|
|
78
|
-
usps: accommodation?.usps ?? [],
|
|
79
|
-
description: accommodation?.description,
|
|
80
|
-
viewHtml: accommodationViews?.[selectedOption.accommodationCode]
|
|
81
|
-
},
|
|
82
|
-
showAlternatives: false,
|
|
83
|
-
alternatives: alternativeAccommodations
|
|
84
|
-
} as SelectableRoom;
|
|
85
|
-
});
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
export const updatePackageRooms = (
|
|
89
|
-
rooms: BookingPackageRoom[],
|
|
90
|
-
index: number,
|
|
91
|
-
accommodationCode: string,
|
|
92
|
-
regimeCode: string | null,
|
|
93
|
-
availabilities: BookingPackageAvailability[]
|
|
94
|
-
) => {
|
|
95
|
-
const updatedRooms = rooms.map((room) => {
|
|
96
|
-
if (room.index !== index) return room;
|
|
97
|
-
|
|
98
|
-
return {
|
|
99
|
-
...room,
|
|
100
|
-
options: room.options.map((option) => {
|
|
101
|
-
return {
|
|
102
|
-
...option,
|
|
103
|
-
isSelected: option.accommodationCode === accommodationCode && (option.regimeCode === regimeCode || (option.regimeCode === null && regimeCode === ''))
|
|
104
|
-
};
|
|
105
|
-
})
|
|
106
|
-
};
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
const selectedAccommodations = new Map<string, number>();
|
|
110
|
-
updatedRooms
|
|
111
|
-
.map((x) => x.options.find((x) => x.isSelected)!)
|
|
112
|
-
.forEach((x) => {
|
|
113
|
-
if (selectedAccommodations.has(x.accommodationCode)) {
|
|
114
|
-
selectedAccommodations.set(x.accommodationCode, selectedAccommodations.get(x.accommodationCode)! + 1);
|
|
115
|
-
} else {
|
|
116
|
-
selectedAccommodations.set(x.accommodationCode, 1);
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
const accoCounter = availabilities.map((x) => ({
|
|
121
|
-
code: x.code,
|
|
122
|
-
count: x.count
|
|
123
|
-
}));
|
|
124
|
-
return updatedRooms.map((room) => {
|
|
125
|
-
const selectedOption = room.options.find((x) => x.isSelected)!;
|
|
126
|
-
|
|
127
|
-
return {
|
|
128
|
-
...room,
|
|
129
|
-
options: room.options.map((option) => {
|
|
130
|
-
const isCurrentOption = selectedOption.accommodationCode === option.accommodationCode;
|
|
131
|
-
const usedCount = selectedAccommodations.get(option.accommodationCode) ?? 0;
|
|
132
|
-
const availability = availabilities.find((x) => x.code === option.accommodationCode);
|
|
133
|
-
|
|
134
|
-
if (availability) {
|
|
135
|
-
const accoCount = accoCounter.find((x) => x.code === option.accommodationCode)!;
|
|
136
|
-
|
|
137
|
-
const roomsLeft = availability.count - usedCount;
|
|
138
|
-
let isOnRequest =
|
|
139
|
-
(option.isOnRequest && availability.count == 99) || // Tide sets count to 99 if an option falls back to on request.
|
|
140
|
-
(isCurrentOption ? accoCount.count < 0 && (availability?.onRequestPossible ?? false) : roomsLeft < 0 && (availability?.onRequestPossible ?? false));
|
|
141
|
-
if (isCurrentOption) accoCount.count--;
|
|
142
|
-
|
|
143
|
-
return {
|
|
144
|
-
...option,
|
|
145
|
-
isLocked: !option.isSelected && !isOnRequest && roomsLeft < 0 && !availability.isExternal,
|
|
146
|
-
isOnRequest: isOnRequest
|
|
147
|
-
};
|
|
148
|
-
} else {
|
|
149
|
-
return option;
|
|
150
|
-
}
|
|
151
|
-
})
|
|
152
|
-
};
|
|
153
|
-
});
|
|
154
|
-
};
|
|
1
|
+
import { BookingPackageAvailability, BookingPackageRoom } from '@qite/tide-client/build/types';
|
|
2
|
+
import { AccommodationContent, RegimeContent, SelectableRoom, SelectableRoomAccommodation } from '../../types';
|
|
3
|
+
|
|
4
|
+
export const buildSelectableRooms = (
|
|
5
|
+
packageRooms: BookingPackageRoom[],
|
|
6
|
+
accommodations: AccommodationContent[] | undefined,
|
|
7
|
+
regimes: RegimeContent[] | undefined,
|
|
8
|
+
accommodationViews: { [key: string]: string } | undefined
|
|
9
|
+
) => {
|
|
10
|
+
return packageRooms.map((x) => {
|
|
11
|
+
const selectedOption = x.options.find((x) => x.isSelected)!;
|
|
12
|
+
const alternativeOptions = x.options
|
|
13
|
+
.filter((x) => x.accommodationCode !== selectedOption.accommodationCode && !x.isLocked)
|
|
14
|
+
.sort((a, b) => a.price - b.price);
|
|
15
|
+
|
|
16
|
+
const alternativeAccommodations: SelectableRoomAccommodation[] = [];
|
|
17
|
+
alternativeOptions.forEach((x) => {
|
|
18
|
+
const alternativeAccommodation = alternativeAccommodations.find((y) => y.code === x.accommodationCode);
|
|
19
|
+
|
|
20
|
+
if (alternativeAccommodation) {
|
|
21
|
+
const regime = regimes?.find((y) => y.code === x.regimeCode);
|
|
22
|
+
|
|
23
|
+
alternativeAccommodation.regimes.push({
|
|
24
|
+
code: x.regimeCode,
|
|
25
|
+
title: regime?.title ?? x.regimeName,
|
|
26
|
+
price: x.price
|
|
27
|
+
});
|
|
28
|
+
} else {
|
|
29
|
+
const accommodation = accommodations?.find((y) => y.code === x.accommodationCode);
|
|
30
|
+
const regime = regimes?.find((y) => y.code === x.regimeCode);
|
|
31
|
+
|
|
32
|
+
alternativeAccommodations.push({
|
|
33
|
+
code: x.accommodationCode,
|
|
34
|
+
regimeCode: x.regimeCode,
|
|
35
|
+
from: x.from,
|
|
36
|
+
to: x.to,
|
|
37
|
+
price: x.price,
|
|
38
|
+
regimes: [
|
|
39
|
+
{
|
|
40
|
+
code: x.regimeCode,
|
|
41
|
+
title: regime?.title ?? x.regimeName,
|
|
42
|
+
price: x.price
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
title: accommodation?.title ?? x.accommodationName,
|
|
46
|
+
image: accommodation?.imageUrl,
|
|
47
|
+
usps: accommodation?.usps ?? [],
|
|
48
|
+
description: accommodation?.description,
|
|
49
|
+
viewHtml: accommodationViews?.[x.accommodationCode]
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const accommodation = accommodations?.find((y) => y.code === selectedOption.accommodationCode);
|
|
55
|
+
|
|
56
|
+
return {
|
|
57
|
+
index: x.index,
|
|
58
|
+
selected: {
|
|
59
|
+
code: selectedOption.accommodationCode,
|
|
60
|
+
regimeCode: selectedOption.regimeCode,
|
|
61
|
+
price: selectedOption.price,
|
|
62
|
+
from: selectedOption.from,
|
|
63
|
+
to: selectedOption.to,
|
|
64
|
+
regimes: x.options
|
|
65
|
+
.filter((x) => x.accommodationCode === selectedOption.accommodationCode)
|
|
66
|
+
.sort((a, b) => a.price - b.price)
|
|
67
|
+
.map((o) => {
|
|
68
|
+
const regime = regimes?.find((y) => y.code === o.regimeCode);
|
|
69
|
+
|
|
70
|
+
return {
|
|
71
|
+
code: o.regimeCode,
|
|
72
|
+
title: regime?.title ?? o.regimeName,
|
|
73
|
+
price: o.price
|
|
74
|
+
};
|
|
75
|
+
}),
|
|
76
|
+
title: accommodation?.title ?? selectedOption.accommodationName,
|
|
77
|
+
image: accommodation?.imageUrl,
|
|
78
|
+
usps: accommodation?.usps ?? [],
|
|
79
|
+
description: accommodation?.description,
|
|
80
|
+
viewHtml: accommodationViews?.[selectedOption.accommodationCode]
|
|
81
|
+
},
|
|
82
|
+
showAlternatives: false,
|
|
83
|
+
alternatives: alternativeAccommodations
|
|
84
|
+
} as SelectableRoom;
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export const updatePackageRooms = (
|
|
89
|
+
rooms: BookingPackageRoom[],
|
|
90
|
+
index: number,
|
|
91
|
+
accommodationCode: string,
|
|
92
|
+
regimeCode: string | null,
|
|
93
|
+
availabilities: BookingPackageAvailability[]
|
|
94
|
+
) => {
|
|
95
|
+
const updatedRooms = rooms.map((room) => {
|
|
96
|
+
if (room.index !== index) return room;
|
|
97
|
+
|
|
98
|
+
return {
|
|
99
|
+
...room,
|
|
100
|
+
options: room.options.map((option) => {
|
|
101
|
+
return {
|
|
102
|
+
...option,
|
|
103
|
+
isSelected: option.accommodationCode === accommodationCode && (option.regimeCode === regimeCode || (option.regimeCode === null && regimeCode === ''))
|
|
104
|
+
};
|
|
105
|
+
})
|
|
106
|
+
};
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
const selectedAccommodations = new Map<string, number>();
|
|
110
|
+
updatedRooms
|
|
111
|
+
.map((x) => x.options.find((x) => x.isSelected)!)
|
|
112
|
+
.forEach((x) => {
|
|
113
|
+
if (selectedAccommodations.has(x.accommodationCode)) {
|
|
114
|
+
selectedAccommodations.set(x.accommodationCode, selectedAccommodations.get(x.accommodationCode)! + 1);
|
|
115
|
+
} else {
|
|
116
|
+
selectedAccommodations.set(x.accommodationCode, 1);
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
const accoCounter = availabilities.map((x) => ({
|
|
121
|
+
code: x.code,
|
|
122
|
+
count: x.count
|
|
123
|
+
}));
|
|
124
|
+
return updatedRooms.map((room) => {
|
|
125
|
+
const selectedOption = room.options.find((x) => x.isSelected)!;
|
|
126
|
+
|
|
127
|
+
return {
|
|
128
|
+
...room,
|
|
129
|
+
options: room.options.map((option) => {
|
|
130
|
+
const isCurrentOption = selectedOption.accommodationCode === option.accommodationCode;
|
|
131
|
+
const usedCount = selectedAccommodations.get(option.accommodationCode) ?? 0;
|
|
132
|
+
const availability = availabilities.find((x) => x.code === option.accommodationCode);
|
|
133
|
+
|
|
134
|
+
if (availability) {
|
|
135
|
+
const accoCount = accoCounter.find((x) => x.code === option.accommodationCode)!;
|
|
136
|
+
|
|
137
|
+
const roomsLeft = availability.count - usedCount;
|
|
138
|
+
let isOnRequest =
|
|
139
|
+
(option.isOnRequest && availability.count == 99) || // Tide sets count to 99 if an option falls back to on request.
|
|
140
|
+
(isCurrentOption ? accoCount.count < 0 && (availability?.onRequestPossible ?? false) : roomsLeft < 0 && (availability?.onRequestPossible ?? false));
|
|
141
|
+
if (isCurrentOption) accoCount.count--;
|
|
142
|
+
|
|
143
|
+
return {
|
|
144
|
+
...option,
|
|
145
|
+
isLocked: !option.isSelected && !isOnRequest && roomsLeft < 0 && !availability.isExternal,
|
|
146
|
+
isOnRequest: isOnRequest
|
|
147
|
+
};
|
|
148
|
+
} else {
|
|
149
|
+
return option;
|
|
150
|
+
}
|
|
151
|
+
})
|
|
152
|
+
};
|
|
153
|
+
});
|
|
154
|
+
};
|