@travelswitchhq/flight-search-react 1.0.0
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/dist/index.cjs +2282 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +65 -0
- package/dist/index.d.ts +65 -0
- package/dist/index.mjs +2255 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +47 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,2282 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
FlightSearchWidget: () => FlightSearchWidget
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(index_exports);
|
|
26
|
+
|
|
27
|
+
// src/Flight.tsx
|
|
28
|
+
var import_react = require("react");
|
|
29
|
+
var import_calendar = require("primereact/calendar");
|
|
30
|
+
var import_accordion = require("primereact/accordion");
|
|
31
|
+
var import_autocomplete = require("primereact/autocomplete");
|
|
32
|
+
var import_api = require("primereact/api");
|
|
33
|
+
var import_jsencrypt = require("jsencrypt");
|
|
34
|
+
|
|
35
|
+
// src/flight-search-widget.styles.ts
|
|
36
|
+
var flightSearchWidgetStyles = `
|
|
37
|
+
:root {
|
|
38
|
+
--font-family: Montserrat, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
39
|
+
--ar-font-family: Arial, sans-serif;
|
|
40
|
+
--label-color: #66797F;
|
|
41
|
+
--body-text: #0B1215;
|
|
42
|
+
--btn-radius: 8px;
|
|
43
|
+
--radius: 12px;
|
|
44
|
+
--primary-btn: #2C0A82;
|
|
45
|
+
--primary-button-text: #ffffff;
|
|
46
|
+
--button-primary-border: #2C0A82;
|
|
47
|
+
--form-border: #d8dcde;
|
|
48
|
+
--white: #ffffff;
|
|
49
|
+
--gray: #999;
|
|
50
|
+
--widget-bg: #f5f5f8;
|
|
51
|
+
--widget-font-size: 1.4rem;
|
|
52
|
+
--widget-z-index-base: 1000;
|
|
53
|
+
--widget-transition: all 0.2s ease;
|
|
54
|
+
--widget-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|
55
|
+
--widget-shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.15);
|
|
56
|
+
--grid-gap-sm: 2px;
|
|
57
|
+
--grid-gap-md: 10px;
|
|
58
|
+
--grid-gap-lg: 20px;
|
|
59
|
+
--flex-gap-sm: 5px;
|
|
60
|
+
--flex-gap-md: 15px;
|
|
61
|
+
--flex-gap-lg: 20px;
|
|
62
|
+
}
|
|
63
|
+
.sw-container {
|
|
64
|
+
contain: layout;
|
|
65
|
+
position: relative;
|
|
66
|
+
display: block;
|
|
67
|
+
width: 100%;
|
|
68
|
+
min-width: 1240px;
|
|
69
|
+
margin: 0;
|
|
70
|
+
padding: 0;
|
|
71
|
+
box-sizing: border-box;
|
|
72
|
+
color: var(--body-text);
|
|
73
|
+
font-family: var(--font-family);
|
|
74
|
+
font-size: var(--widget-font-size);
|
|
75
|
+
font-weight: 400;
|
|
76
|
+
line-height: 1.5;
|
|
77
|
+
-webkit-font-smoothing: antialiased;
|
|
78
|
+
-moz-osx-font-smoothing: grayscale;
|
|
79
|
+
-webkit-tap-highlight-color: transparent;
|
|
80
|
+
background: var(--widget-bg);
|
|
81
|
+
*,
|
|
82
|
+
*::before,
|
|
83
|
+
*::after {
|
|
84
|
+
box-sizing: border-box;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
.sw-container button,
|
|
88
|
+
.sw-container input {
|
|
89
|
+
font-family: var(--font-family);
|
|
90
|
+
}
|
|
91
|
+
.sw-container h1,
|
|
92
|
+
.sw-container h2,
|
|
93
|
+
.sw-container h3,
|
|
94
|
+
.sw-container h4,
|
|
95
|
+
.sw-container h5,
|
|
96
|
+
.sw-container h6,
|
|
97
|
+
.sw-container p {
|
|
98
|
+
display: block;
|
|
99
|
+
margin: 0;
|
|
100
|
+
color: inherit;
|
|
101
|
+
font-family: var(--font-family);
|
|
102
|
+
font-weight: normal;
|
|
103
|
+
line-height: 1.4;
|
|
104
|
+
}
|
|
105
|
+
.sw-container h1 {
|
|
106
|
+
font-size: 22px;
|
|
107
|
+
}
|
|
108
|
+
.sw-container h2 {
|
|
109
|
+
font-size: 20px;
|
|
110
|
+
}
|
|
111
|
+
.sw-container h3 {
|
|
112
|
+
font-size: 18px;
|
|
113
|
+
}
|
|
114
|
+
.sw-container h4 {
|
|
115
|
+
font-size: 16px;
|
|
116
|
+
}
|
|
117
|
+
.sw-container h5 {
|
|
118
|
+
font-size: 14px;
|
|
119
|
+
}
|
|
120
|
+
.sw-container h6,
|
|
121
|
+
.sw-container small {
|
|
122
|
+
font-size: 12px;
|
|
123
|
+
}
|
|
124
|
+
.sw-container .sw-fw500 {
|
|
125
|
+
font-weight: 500 !important;
|
|
126
|
+
}
|
|
127
|
+
.sw-container .sw-flex {
|
|
128
|
+
display: flex;
|
|
129
|
+
}
|
|
130
|
+
.sw-container .sw-align-center {
|
|
131
|
+
display: flex;
|
|
132
|
+
align-items: center;
|
|
133
|
+
}
|
|
134
|
+
.sw-container .sw-gap-5 {
|
|
135
|
+
gap: 5px;
|
|
136
|
+
}
|
|
137
|
+
.sw-container .sw-gap-15 {
|
|
138
|
+
gap: 15px;
|
|
139
|
+
}
|
|
140
|
+
.sw-container .sw-justify-between {
|
|
141
|
+
justify-content: space-between;
|
|
142
|
+
}
|
|
143
|
+
.sw-container .enFont{
|
|
144
|
+
font-family: var(--ar-font-family);
|
|
145
|
+
}
|
|
146
|
+
.sw-container .sw-text-ellipsis {
|
|
147
|
+
display: -webkit-box;
|
|
148
|
+
overflow: hidden;
|
|
149
|
+
-webkit-box-orient: vertical;
|
|
150
|
+
text-overflow: ellipsis;
|
|
151
|
+
}
|
|
152
|
+
.sw-container .sw-text-label {
|
|
153
|
+
color: var(--label-color);
|
|
154
|
+
}
|
|
155
|
+
.sw-booking-form {
|
|
156
|
+
position: relative;
|
|
157
|
+
display: grid;
|
|
158
|
+
grid-template-columns: 1fr repeat(4, minmax(0, 1fr)) minmax(80px, 0.8fr);
|
|
159
|
+
gap: var(--grid-gap-sm);
|
|
160
|
+
min-height: 55px;
|
|
161
|
+
min-width: 0;
|
|
162
|
+
border-radius: var(--radius);
|
|
163
|
+
overflow: visible;
|
|
164
|
+
}
|
|
165
|
+
.sw-card-box {
|
|
166
|
+
position: relative;
|
|
167
|
+
display: block;
|
|
168
|
+
padding: 20px;
|
|
169
|
+
background-color: var(--white);
|
|
170
|
+
border-radius: var(--radius);
|
|
171
|
+
}
|
|
172
|
+
body[dir="ltr"] .sw-card-box .br-right,
|
|
173
|
+
body[dir="rtl"] .sw-card-box .br-left{
|
|
174
|
+
border-top-right-radius: var(--radius);
|
|
175
|
+
border-bottom-right-radius: var(--radius);
|
|
176
|
+
}
|
|
177
|
+
body[dir="rtl"] .sw-card-box .br-right,
|
|
178
|
+
body[dir="ltr"] .sw-card-box .br-left{
|
|
179
|
+
border-top-left-radius: var(--radius);
|
|
180
|
+
border-bottom-left-radius: var(--radius);
|
|
181
|
+
}
|
|
182
|
+
.sw-form-field {
|
|
183
|
+
display: flex;
|
|
184
|
+
flex-direction: column;
|
|
185
|
+
flex: 1 1 auto;
|
|
186
|
+
gap: 3px;
|
|
187
|
+
padding: 10px 15px;
|
|
188
|
+
background-color: #f8f8f8;
|
|
189
|
+
min-width: 0;
|
|
190
|
+
overflow: visible;
|
|
191
|
+
}
|
|
192
|
+
.sw-form-field .p-calendar {
|
|
193
|
+
position: unset;
|
|
194
|
+
}
|
|
195
|
+
.sw-form-field label {
|
|
196
|
+
display: block;
|
|
197
|
+
width: 100%;
|
|
198
|
+
margin: 0;
|
|
199
|
+
padding: 0;
|
|
200
|
+
overflow: hidden;
|
|
201
|
+
white-space: nowrap;
|
|
202
|
+
color: var(--label-color);
|
|
203
|
+
font-size: 12px;
|
|
204
|
+
font-weight: 500;
|
|
205
|
+
-webkit-box-orient: vertical;
|
|
206
|
+
text-overflow: ellipsis;
|
|
207
|
+
}
|
|
208
|
+
.p-button-label {
|
|
209
|
+
flex: unset;
|
|
210
|
+
}
|
|
211
|
+
.sw-form-field input,
|
|
212
|
+
.sw-form-field .p-inputtext {
|
|
213
|
+
display: block;
|
|
214
|
+
width: 100%;
|
|
215
|
+
margin: 0;
|
|
216
|
+
padding: 0;
|
|
217
|
+
border: 0;
|
|
218
|
+
border-radius: 0;
|
|
219
|
+
outline: none;
|
|
220
|
+
background: transparent;
|
|
221
|
+
box-shadow: none;
|
|
222
|
+
color: var(--body-text);
|
|
223
|
+
font-size: 14px;
|
|
224
|
+
font-weight: 500;
|
|
225
|
+
}
|
|
226
|
+
.sw-form-field input::placeholder,
|
|
227
|
+
.sw-form-field .p-inputtext::placeholder {
|
|
228
|
+
color: var(--label-color) !important;
|
|
229
|
+
}
|
|
230
|
+
.sw-form-swap {
|
|
231
|
+
position: absolute;
|
|
232
|
+
top: 50%;
|
|
233
|
+
left: 50%;
|
|
234
|
+
z-index: 2;
|
|
235
|
+
display: flex;
|
|
236
|
+
align-items: center;
|
|
237
|
+
justify-content: center;
|
|
238
|
+
padding: 3px;
|
|
239
|
+
border: 1px solid var(--form-border);
|
|
240
|
+
border-radius: 50%;
|
|
241
|
+
background-color: #fff;
|
|
242
|
+
cursor: pointer;
|
|
243
|
+
transform: translate(-50%, -50%);
|
|
244
|
+
}
|
|
245
|
+
.sw-srh-wrap.sw-srh-box.sw-pos-rel .sw-form-field.sw-pos-rel:last-child {
|
|
246
|
+
padding-inline-start: 25px;
|
|
247
|
+
}
|
|
248
|
+
.sw-custom-dropdown {
|
|
249
|
+
display: block;
|
|
250
|
+
width: 100%;
|
|
251
|
+
}
|
|
252
|
+
.sw-custom-dropdown-trigger {
|
|
253
|
+
display: flex;
|
|
254
|
+
align-items: center;
|
|
255
|
+
justify-content: space-between;
|
|
256
|
+
flex: 1 1 auto;
|
|
257
|
+
width: 100%;
|
|
258
|
+
min-width: 0;
|
|
259
|
+
margin: 0;
|
|
260
|
+
padding: 0;
|
|
261
|
+
border: 0;
|
|
262
|
+
outline: none;
|
|
263
|
+
background: transparent;
|
|
264
|
+
cursor: pointer;
|
|
265
|
+
color: var(--body-text);
|
|
266
|
+
font-size: 14px;
|
|
267
|
+
font-weight: 500;
|
|
268
|
+
}
|
|
269
|
+
.sw-custom-dropdown-trigger .sw-placeholder {
|
|
270
|
+
color: var(--label-color);
|
|
271
|
+
}
|
|
272
|
+
.sw-dropdown-arrow {
|
|
273
|
+
margin-left: 8px;
|
|
274
|
+
color: var(--label-color);
|
|
275
|
+
font-size: 10px;
|
|
276
|
+
transition: transform 0.2s ease;
|
|
277
|
+
}
|
|
278
|
+
.sw-dropdown{
|
|
279
|
+
position: absolute;
|
|
280
|
+
top: calc(100% + 5px);
|
|
281
|
+
left: 0;
|
|
282
|
+
right: 0;
|
|
283
|
+
z-index: calc(var(--widget-z-index-base) + 5);
|
|
284
|
+
display: block;
|
|
285
|
+
visibility: visible;
|
|
286
|
+
opacity: 1;
|
|
287
|
+
}
|
|
288
|
+
.sw-dropdown,
|
|
289
|
+
.p-autocomplete-panel {
|
|
290
|
+
width: 380px;
|
|
291
|
+
max-height: 310px;
|
|
292
|
+
margin: 0;
|
|
293
|
+
padding: 0;
|
|
294
|
+
overflow: auto;
|
|
295
|
+
overflow-x: hidden;
|
|
296
|
+
background: var(--white);
|
|
297
|
+
border: 1px solid var(--form-border);
|
|
298
|
+
border-radius: var(--radius);
|
|
299
|
+
box-shadow: var(--widget-shadow);
|
|
300
|
+
}
|
|
301
|
+
.sw-dropdown::-webkit-scrollbar {
|
|
302
|
+
display: none;
|
|
303
|
+
}
|
|
304
|
+
.sw-dropdown-list-card,
|
|
305
|
+
.sw-dropdown-list-box,
|
|
306
|
+
.p-autocomplete-item {
|
|
307
|
+
display: flex;
|
|
308
|
+
align-items: center;
|
|
309
|
+
gap: 15px;
|
|
310
|
+
margin: 0 20px;
|
|
311
|
+
padding: 10px 0;
|
|
312
|
+
cursor: pointer;
|
|
313
|
+
font-family: var(--font-family);
|
|
314
|
+
}
|
|
315
|
+
.p-autocomplete-item{
|
|
316
|
+
font-size: 14px;
|
|
317
|
+
font-weight: 400;
|
|
318
|
+
}
|
|
319
|
+
.p-autocomplete-item:hover{
|
|
320
|
+
background-color: var(--primary-light);
|
|
321
|
+
}
|
|
322
|
+
.sw-dropdown-list-box {
|
|
323
|
+
display: flex;
|
|
324
|
+
justify-content: space-between;
|
|
325
|
+
}
|
|
326
|
+
.sw-dropdown-list-card {
|
|
327
|
+
display: grid;
|
|
328
|
+
grid-template-columns: 45px auto;
|
|
329
|
+
}
|
|
330
|
+
.sw-dropdown-item-badge {
|
|
331
|
+
display: grid;
|
|
332
|
+
place-items: center;
|
|
333
|
+
width: fit-content;
|
|
334
|
+
height: unset;
|
|
335
|
+
margin: 0;
|
|
336
|
+
padding: 4px 8px;
|
|
337
|
+
background-color: #f4f5f5;
|
|
338
|
+
border-radius: 4px;
|
|
339
|
+
font-weight: 500;
|
|
340
|
+
}
|
|
341
|
+
.sw-dropdown-list {
|
|
342
|
+
display: block;
|
|
343
|
+
margin: 0;
|
|
344
|
+
padding: 0;
|
|
345
|
+
list-style: none;
|
|
346
|
+
}
|
|
347
|
+
.sw-dropdown-list-item {
|
|
348
|
+
display: block;
|
|
349
|
+
margin: 0;
|
|
350
|
+
padding: 0;
|
|
351
|
+
cursor: pointer;
|
|
352
|
+
color: var(--body-text);
|
|
353
|
+
font-size: 14px;
|
|
354
|
+
transition: background-color 0.2s ease;
|
|
355
|
+
}
|
|
356
|
+
.sw-current {
|
|
357
|
+
font-weight: 500;
|
|
358
|
+
}
|
|
359
|
+
.sw-en-font {
|
|
360
|
+
font-family: Arial, sans-serif;
|
|
361
|
+
}
|
|
362
|
+
.sw-bg-color-loc {
|
|
363
|
+
color: var(--primary);
|
|
364
|
+
}
|
|
365
|
+
.sw-scale-rotate {
|
|
366
|
+
transition: transform 0.2s ease;
|
|
367
|
+
}
|
|
368
|
+
.sw-custom-dropdown-item:hover {
|
|
369
|
+
background-color: var(--secondary-light);
|
|
370
|
+
}
|
|
371
|
+
.sw-custom-dropdown-item:first-child {
|
|
372
|
+
border-top-left-radius: var(--btn-radius);
|
|
373
|
+
border-top-right-radius: var(--btn-radius);
|
|
374
|
+
}
|
|
375
|
+
.sw-custom-dropdown-item:last-child {
|
|
376
|
+
border-bottom-left-radius: var(--btn-radius);
|
|
377
|
+
border-bottom-right-radius: var(--btn-radius);
|
|
378
|
+
}
|
|
379
|
+
.sw-rooms-guests-menu {
|
|
380
|
+
position: absolute;
|
|
381
|
+
top: 100%;
|
|
382
|
+
right: 0;
|
|
383
|
+
z-index: var(--widget-z-index-base);
|
|
384
|
+
display: block;
|
|
385
|
+
width: 75%;
|
|
386
|
+
margin-top: 4px;
|
|
387
|
+
padding: 20px;
|
|
388
|
+
background: var(--white);
|
|
389
|
+
border: 1px solid var(--form-border);
|
|
390
|
+
border-radius: var(--radius);
|
|
391
|
+
box-shadow: var(--widget-shadow);
|
|
392
|
+
}
|
|
393
|
+
.sw-pos-rel {
|
|
394
|
+
position: relative;
|
|
395
|
+
}
|
|
396
|
+
.sw-rooms-guests-title {
|
|
397
|
+
margin: 0 0 15px 0 !important;
|
|
398
|
+
font-size: 16px !important;
|
|
399
|
+
font-weight: 500 !important;
|
|
400
|
+
}
|
|
401
|
+
.sw-room-section {
|
|
402
|
+
display: grid;
|
|
403
|
+
grid-template-columns: 1.2fr 3fr 4fr 50px;
|
|
404
|
+
align-items: center;
|
|
405
|
+
padding: 10px 0;
|
|
406
|
+
}
|
|
407
|
+
.sw-pb0 {
|
|
408
|
+
padding-bottom: 0;
|
|
409
|
+
}
|
|
410
|
+
.sw-room-section:last-of-type {
|
|
411
|
+
margin-bottom: 15px;
|
|
412
|
+
}
|
|
413
|
+
.sw-room-header {
|
|
414
|
+
display: flex;
|
|
415
|
+
align-items: center;
|
|
416
|
+
gap: 5px;
|
|
417
|
+
color: var(--primary);
|
|
418
|
+
font-size: 14px;
|
|
419
|
+
font-weight: 500;
|
|
420
|
+
}
|
|
421
|
+
.sw-room-controls-child {
|
|
422
|
+
display: grid;
|
|
423
|
+
grid-template-columns: repeat(4, minmax(0, 1fr));
|
|
424
|
+
gap: var(--grid-gap-lg);
|
|
425
|
+
min-width: 0;
|
|
426
|
+
}
|
|
427
|
+
.sw-room-controls-child .p-dropdown {
|
|
428
|
+
padding: 10px;
|
|
429
|
+
border: 1px solid var(--form-border);
|
|
430
|
+
border-radius: var(--radius);
|
|
431
|
+
}
|
|
432
|
+
.sw-room-controls-child .p-dropdown-item {
|
|
433
|
+
padding: 10px;
|
|
434
|
+
font-size: 14px;
|
|
435
|
+
}
|
|
436
|
+
.sw-room-controls-child .p-dropdown-panel {
|
|
437
|
+
background: var(--white);
|
|
438
|
+
border: 1px solid var(--form-border);
|
|
439
|
+
border-radius: var(--btn-radius);
|
|
440
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
|
441
|
+
}
|
|
442
|
+
.sw-room-controls-group {
|
|
443
|
+
display: grid;
|
|
444
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
445
|
+
justify-content: center;
|
|
446
|
+
gap: var(--grid-gap-md);
|
|
447
|
+
min-width: 0;
|
|
448
|
+
}
|
|
449
|
+
.sw-room-control-item {
|
|
450
|
+
display: flex;
|
|
451
|
+
flex-direction: column;
|
|
452
|
+
flex: 1 1 auto;
|
|
453
|
+
justify-content: space-between;
|
|
454
|
+
gap: var(--flex-gap-sm);
|
|
455
|
+
min-width: 0;
|
|
456
|
+
}
|
|
457
|
+
.sw-room-control-label {
|
|
458
|
+
color: var(--body-text);
|
|
459
|
+
font-size: 14px;
|
|
460
|
+
font-weight: 400;
|
|
461
|
+
}
|
|
462
|
+
.sw-room-control-buttons {
|
|
463
|
+
display: grid;
|
|
464
|
+
grid-template-columns: 36px 40px 36px;
|
|
465
|
+
align-items: center;
|
|
466
|
+
overflow: hidden;
|
|
467
|
+
}
|
|
468
|
+
.sw-count-button {
|
|
469
|
+
display: flex;
|
|
470
|
+
align-items: center;
|
|
471
|
+
justify-content: center;
|
|
472
|
+
width: 36px;
|
|
473
|
+
height: 36px;
|
|
474
|
+
margin: 0;
|
|
475
|
+
padding: 0;
|
|
476
|
+
border: none;
|
|
477
|
+
border-radius: 50%;
|
|
478
|
+
background: var(--primary);
|
|
479
|
+
cursor: pointer;
|
|
480
|
+
color: var(--white);
|
|
481
|
+
font-size: 20px;
|
|
482
|
+
font-weight: 500;
|
|
483
|
+
transition: var(--widget-transition);
|
|
484
|
+
}
|
|
485
|
+
.sw-count-button:focus-visible {
|
|
486
|
+
outline: 2px solid var(--primary);
|
|
487
|
+
outline-offset: 2px;
|
|
488
|
+
}
|
|
489
|
+
.sw-count-button:hover:not(:disabled) {
|
|
490
|
+
background: var(--primary-btn);
|
|
491
|
+
opacity: 0.9;
|
|
492
|
+
transform: scale(1.05);
|
|
493
|
+
}
|
|
494
|
+
.sw-count-button.sw-disabled {
|
|
495
|
+
opacity: 0.6;
|
|
496
|
+
cursor: not-allowed;
|
|
497
|
+
}
|
|
498
|
+
.sw-count-button:disabled {
|
|
499
|
+
cursor: not-allowed;
|
|
500
|
+
}
|
|
501
|
+
.sw-count-value {
|
|
502
|
+
min-width: 30px;
|
|
503
|
+
text-align: center;
|
|
504
|
+
color: var(--body-text);
|
|
505
|
+
font-size: 16px;
|
|
506
|
+
font-weight: 500;
|
|
507
|
+
}
|
|
508
|
+
.sw-add-room-button {
|
|
509
|
+
display: flex;
|
|
510
|
+
align-items: center;
|
|
511
|
+
gap: 8px;
|
|
512
|
+
width: auto;
|
|
513
|
+
height: 40px;
|
|
514
|
+
margin: 0 !important;
|
|
515
|
+
padding: 1rem;
|
|
516
|
+
border: 1px solid var(--primary);
|
|
517
|
+
border-radius: var(--radius);
|
|
518
|
+
background-color: transparent;
|
|
519
|
+
cursor: pointer;
|
|
520
|
+
color: var(--primary);
|
|
521
|
+
font-size: 14px;
|
|
522
|
+
font-weight: 500;
|
|
523
|
+
}
|
|
524
|
+
.sw-rooms-guests-cta {
|
|
525
|
+
display: flex;
|
|
526
|
+
gap: 10px;
|
|
527
|
+
}
|
|
528
|
+
.sw-rooms-guests-footer {
|
|
529
|
+
display: flex;
|
|
530
|
+
justify-content: space-between;
|
|
531
|
+
gap: 10px;
|
|
532
|
+
margin-top: 15px;
|
|
533
|
+
padding-top: 15px;
|
|
534
|
+
border-top: 1px solid var(--form-border);
|
|
535
|
+
}
|
|
536
|
+
.sw-reset-button {
|
|
537
|
+
padding: 10px 20px;
|
|
538
|
+
border: 1px solid var(--primary);
|
|
539
|
+
border-radius: var(--btn-radius);
|
|
540
|
+
background: transparent;
|
|
541
|
+
cursor: pointer;
|
|
542
|
+
color: var(--primary);
|
|
543
|
+
font-size: 14px;
|
|
544
|
+
font-weight: 500;
|
|
545
|
+
transition: all 0.2s ease;
|
|
546
|
+
}
|
|
547
|
+
.sw-reset-button:hover {
|
|
548
|
+
background: var(--primary-light);
|
|
549
|
+
}
|
|
550
|
+
.sw-apply-button {
|
|
551
|
+
padding: 10px 20px;
|
|
552
|
+
border: 1px solid var(--button-primary-border);
|
|
553
|
+
border-radius: var(--btn-radius);
|
|
554
|
+
background: var(--primary-btn);
|
|
555
|
+
cursor: pointer;
|
|
556
|
+
color: var(--primary-button-text);
|
|
557
|
+
font-size: 14px;
|
|
558
|
+
font-weight: 500;
|
|
559
|
+
transition: all 0.2s ease;
|
|
560
|
+
}
|
|
561
|
+
.sw-apply-button:hover {
|
|
562
|
+
opacity: 0.9;
|
|
563
|
+
background: var(--primary);
|
|
564
|
+
}
|
|
565
|
+
.sw-search-button,
|
|
566
|
+
.sw-search-button.p-button {
|
|
567
|
+
display: flex;
|
|
568
|
+
align-items: center;
|
|
569
|
+
justify-content: center;
|
|
570
|
+
gap: 10px;
|
|
571
|
+
width: auto;
|
|
572
|
+
height: 100%;
|
|
573
|
+
min-height: 56px;
|
|
574
|
+
margin: 0;
|
|
575
|
+
padding: 0 15px;
|
|
576
|
+
border: 1px solid var(--button-primary-border);
|
|
577
|
+
background-color: var(--primary-btn);
|
|
578
|
+
cursor: pointer;
|
|
579
|
+
color: var(--primary-button-text);
|
|
580
|
+
font-size: 16px;
|
|
581
|
+
font-weight: 400;
|
|
582
|
+
transition: var(--widget-transition);
|
|
583
|
+
}
|
|
584
|
+
.sw-search-button:focus-visible,
|
|
585
|
+
.sw-search-button.p-button:focus-visible {
|
|
586
|
+
outline: 2px solid var(--primary);
|
|
587
|
+
outline-offset: 2px;
|
|
588
|
+
}
|
|
589
|
+
.sw-search-button:hover:not(:disabled),
|
|
590
|
+
.sw-search-button.p-button:hover:not(:disabled) {
|
|
591
|
+
background-color: var(--primary);
|
|
592
|
+
opacity: 0.9;
|
|
593
|
+
box-shadow: var(--widget-shadow-hover);
|
|
594
|
+
}
|
|
595
|
+
.sw-search-button .p-button-icon-left {
|
|
596
|
+
margin: 0;
|
|
597
|
+
}
|
|
598
|
+
.sw-search-button svg,
|
|
599
|
+
.sw-search-button .p-button-icon {
|
|
600
|
+
flex-shrink: 0;
|
|
601
|
+
}
|
|
602
|
+
.p-calendar .p-datepicker {
|
|
603
|
+
top: 100% !important;
|
|
604
|
+
display: block;
|
|
605
|
+
min-width: 100%;
|
|
606
|
+
margin-top: 5px !important;
|
|
607
|
+
padding: 15px;
|
|
608
|
+
background-color: var(--white);
|
|
609
|
+
border: 1px solid var(--form-border);
|
|
610
|
+
border-radius: var(--radius);
|
|
611
|
+
box-shadow: var(--widget-shadow);
|
|
612
|
+
}
|
|
613
|
+
.sw-srh-wrap {
|
|
614
|
+
display: flex;
|
|
615
|
+
gap: 2px;
|
|
616
|
+
}
|
|
617
|
+
.sw-com-cal p{
|
|
618
|
+
color: var(--body-text);
|
|
619
|
+
font-size: 14px;
|
|
620
|
+
font-weight: 500;
|
|
621
|
+
}
|
|
622
|
+
.sw-com-cal .p-inputtext{
|
|
623
|
+
visibility: hidden;
|
|
624
|
+
height: 0;
|
|
625
|
+
width: 0;
|
|
626
|
+
;
|
|
627
|
+
}
|
|
628
|
+
.p-datepicker-header {
|
|
629
|
+
padding-bottom: 15px;
|
|
630
|
+
}
|
|
631
|
+
.p-datepicker-prev[style="visibility: hidden;"]::after,
|
|
632
|
+
.p-datepicker-next[style="visibility: hidden;"]::after {
|
|
633
|
+
visibility: hidden !important;
|
|
634
|
+
}
|
|
635
|
+
.p-datepicker-prev,
|
|
636
|
+
.p-datepicker-next {
|
|
637
|
+
cursor: pointer;
|
|
638
|
+
|
|
639
|
+
}
|
|
640
|
+
.p-datepicker-prev::after,
|
|
641
|
+
.p-datepicker-next::after {
|
|
642
|
+
content: "";
|
|
643
|
+
display: block;
|
|
644
|
+
width: 14px;
|
|
645
|
+
height: 14px;
|
|
646
|
+
visibility: visible;
|
|
647
|
+
background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1024 1024'><path fill='%231b1a1f' d='m222.927 580.115 301.354 328.512c24.354 28.708 20.825 71.724-7.883 96.078s-71.724 20.825-96.078-7.883L19.576 559.963a67.9 67.9 0 0 1-13.784-20.022 68 68 0 0 1-5.977-29.488l.001-.063a68.34 68.34 0 0 1 7.265-29.134 68 68 0 0 1 1.384-2.6 67.6 67.6 0 0 1 10.102-13.687L429.966 21.113c25.592-27.611 68.721-29.247 96.331-3.656s29.247 68.721 3.656 96.331L224.088 443.784h730.46c37.647 0 68.166 30.519 68.166 68.166s-30.519 68.166-68.166 68.166z'/></svg>");
|
|
648
|
+
}
|
|
649
|
+
.p-datepicker-header button {
|
|
650
|
+
margin: 0;
|
|
651
|
+
padding: 0 5px;
|
|
652
|
+
border: 0;
|
|
653
|
+
border-color: var(--white);
|
|
654
|
+
outline: none;
|
|
655
|
+
background: transparent;
|
|
656
|
+
color: var(--body-text);
|
|
657
|
+
font-size: 16px;
|
|
658
|
+
font-weight: 500;
|
|
659
|
+
line-height: 20px;
|
|
660
|
+
}
|
|
661
|
+
.p-datepicker-header button .p-icon {
|
|
662
|
+
display: none;
|
|
663
|
+
}
|
|
664
|
+
.p-datepicker .p-datepicker-next {
|
|
665
|
+
transform: rotate(180deg);
|
|
666
|
+
}
|
|
667
|
+
.p-datepicker .p-datepicker-header button {
|
|
668
|
+
border: 0;
|
|
669
|
+
border-color: var(--white);
|
|
670
|
+
outline: none;
|
|
671
|
+
box-shadow: none !important;
|
|
672
|
+
background: transparent;
|
|
673
|
+
color: var(--body-text);
|
|
674
|
+
font-size: 16px;
|
|
675
|
+
font-weight: 500;
|
|
676
|
+
line-height: 20px;
|
|
677
|
+
}
|
|
678
|
+
.p-datepicker .p-datepicker-calendar-container th {
|
|
679
|
+
padding: 10px 0;
|
|
680
|
+
color: var(--body-text);
|
|
681
|
+
font-size: 14px;
|
|
682
|
+
font-weight: 400;
|
|
683
|
+
line-height: 1.4;
|
|
684
|
+
}
|
|
685
|
+
.p-datepicker .p-datepicker-calendar-container td {
|
|
686
|
+
padding: 0;
|
|
687
|
+
}
|
|
688
|
+
.p-datepicker .p-datepicker-calendar-container td span {
|
|
689
|
+
padding: 10px 0;
|
|
690
|
+
border-radius: 0;
|
|
691
|
+
font-size: 14px;
|
|
692
|
+
width: 45px;
|
|
693
|
+
height: 45px;
|
|
694
|
+
}
|
|
695
|
+
.p-datepicker-group-container .p-datepicker-group:not(:last-child) {
|
|
696
|
+
border-inline-end: 1px solid var(--form-border);
|
|
697
|
+
padding-inline-end: 10px;
|
|
698
|
+
margin-inline-end: 10px;
|
|
699
|
+
}
|
|
700
|
+
.p-datepicker-other-month span{
|
|
701
|
+
opacity: 0;
|
|
702
|
+
}
|
|
703
|
+
.p-datepicker .p-highlight {
|
|
704
|
+
position: relative;
|
|
705
|
+
background: var(--primary) !important;
|
|
706
|
+
color: var(--white) !important;
|
|
707
|
+
}
|
|
708
|
+
.sw-product-tabs {
|
|
709
|
+
position: relative;
|
|
710
|
+
z-index: 1;
|
|
711
|
+
}
|
|
712
|
+
.sw-product-tabs .p-tabview-nav {
|
|
713
|
+
display: flex;
|
|
714
|
+
flex-wrap: wrap;
|
|
715
|
+
gap: 10px;
|
|
716
|
+
margin: 0;
|
|
717
|
+
padding: 0;
|
|
718
|
+
list-style: none;
|
|
719
|
+
}
|
|
720
|
+
.sw-product-tabs .sw-product-list {
|
|
721
|
+
position: relative;
|
|
722
|
+
gap: 10px;
|
|
723
|
+
padding: 0 10px 10px;
|
|
724
|
+
border: 0 !important;
|
|
725
|
+
border-radius: 0;
|
|
726
|
+
cursor: pointer;
|
|
727
|
+
}
|
|
728
|
+
.p-tabview-selected .sw-product-list:before {
|
|
729
|
+
content: "";
|
|
730
|
+
position: absolute;
|
|
731
|
+
bottom: 0;
|
|
732
|
+
left: 0;
|
|
733
|
+
inset-inline-start: 0;
|
|
734
|
+
width: 100%;
|
|
735
|
+
border: 2px solid var(--primary) !important;
|
|
736
|
+
border-radius: 40px;
|
|
737
|
+
}
|
|
738
|
+
.p-tabview-ink-bar {
|
|
739
|
+
display: none;
|
|
740
|
+
}
|
|
741
|
+
.sw-advanced-search-options .p-accordion-header-link {
|
|
742
|
+
display: flex;
|
|
743
|
+
flex-direction: row-reverse;
|
|
744
|
+
gap: 10px;
|
|
745
|
+
width: fit-content;
|
|
746
|
+
margin-top: 15px;
|
|
747
|
+
color: var(--body-text);
|
|
748
|
+
font-size: 14px;
|
|
749
|
+
}
|
|
750
|
+
.sw-advanced-search-options .p-toggleable-content {
|
|
751
|
+
margin-top: 20px;
|
|
752
|
+
}
|
|
753
|
+
.sw-advanced-search-options .p-accordion-content .sw-hsrh-advan-cont:not(:last-child) {
|
|
754
|
+
margin-bottom: 16px;
|
|
755
|
+
}
|
|
756
|
+
.sw-advanced-search-options .p-accordion-header-link svg {
|
|
757
|
+
transform: rotate(90deg);
|
|
758
|
+
}
|
|
759
|
+
.sw-advanced-search-options .p-accordion-header-link[aria-expanded="true"] svg {
|
|
760
|
+
transform: scale(-1);
|
|
761
|
+
}
|
|
762
|
+
.sw-material-checkbox {
|
|
763
|
+
position: relative;
|
|
764
|
+
display: inline-flex;
|
|
765
|
+
gap: 10px;
|
|
766
|
+
cursor: pointer;
|
|
767
|
+
user-select: none;
|
|
768
|
+
color: var(--body-text);
|
|
769
|
+
font-size: 14px;
|
|
770
|
+
}
|
|
771
|
+
.sw-material-checkbox input {
|
|
772
|
+
display: none;
|
|
773
|
+
}
|
|
774
|
+
.sw-material-checkbox input:checked + .sw-checkmark {
|
|
775
|
+
background-color: var(--primary);
|
|
776
|
+
border-color: var(--primary);
|
|
777
|
+
}
|
|
778
|
+
.sw-material-checkbox input:checked + .sw-checkmark::after {
|
|
779
|
+
content: "";
|
|
780
|
+
position: absolute;
|
|
781
|
+
top: 2px;
|
|
782
|
+
left: 6px;
|
|
783
|
+
display: block;
|
|
784
|
+
width: 6px;
|
|
785
|
+
height: 11px;
|
|
786
|
+
border: solid #fff;
|
|
787
|
+
border-width: 0 2px 2px 0;
|
|
788
|
+
transform: rotate(45deg);
|
|
789
|
+
}
|
|
790
|
+
.sw-material-checkbox .sw-checkmark {
|
|
791
|
+
position: relative;
|
|
792
|
+
display: inline-block;
|
|
793
|
+
width: 20px;
|
|
794
|
+
min-width: 20px;
|
|
795
|
+
height: 20px;
|
|
796
|
+
background-color: #fff;
|
|
797
|
+
border: 1px solid var(--form-border);
|
|
798
|
+
border-radius: 4px;
|
|
799
|
+
transition: background-color 0.3s, border-color 0.3s;
|
|
800
|
+
}
|
|
801
|
+
.sw-material-checkbox .sw-checkmark::after {
|
|
802
|
+
content: "";
|
|
803
|
+
position: absolute;
|
|
804
|
+
display: none;
|
|
805
|
+
}
|
|
806
|
+
.sw-tab-checkbox {
|
|
807
|
+
display: flex;
|
|
808
|
+
cursor: pointer;
|
|
809
|
+
-webkit-user-select: none;
|
|
810
|
+
user-select: none;
|
|
811
|
+
}
|
|
812
|
+
.sw-tab-checkbox input {
|
|
813
|
+
display: none;
|
|
814
|
+
}
|
|
815
|
+
.sw-tab-checkbox input:checked + .sw-tab-content,
|
|
816
|
+
.sw-tab-checkbox input[type=radio]:checked + .sw-tab-content {
|
|
817
|
+
border: 1px solid var(--primary);
|
|
818
|
+
background-color: var(--primary-light);
|
|
819
|
+
color: var(--primary);
|
|
820
|
+
}
|
|
821
|
+
.sw-tab-content {
|
|
822
|
+
height: 40px;
|
|
823
|
+
padding: 6px 15px;
|
|
824
|
+
border: 1px solid var(--form-border);
|
|
825
|
+
border-radius: var(--radius);
|
|
826
|
+
align-content: center;
|
|
827
|
+
}
|
|
828
|
+
@media print {
|
|
829
|
+
.sw-container {
|
|
830
|
+
display: none;
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
.sw-dropdown,
|
|
834
|
+
.sw-rooms-guests-menu,
|
|
835
|
+
.p-calendar .p-datepicker {
|
|
836
|
+
will-change: transform, opacity;
|
|
837
|
+
transform: translateZ(0);
|
|
838
|
+
}
|
|
839
|
+
.sw-dropdown {
|
|
840
|
+
-webkit-overflow-scrolling: touch;
|
|
841
|
+
scroll-behavior: smooth;
|
|
842
|
+
}
|
|
843
|
+
.sw-container img {
|
|
844
|
+
max-width: 100%;
|
|
845
|
+
height: auto;
|
|
846
|
+
}
|
|
847
|
+
.sw-container svg {
|
|
848
|
+
max-width: 100%;
|
|
849
|
+
height: auto;
|
|
850
|
+
}
|
|
851
|
+
.sw-container {
|
|
852
|
+
isolation: isolate;
|
|
853
|
+
}
|
|
854
|
+
.sw-srh-grid {
|
|
855
|
+
display: grid;
|
|
856
|
+
grid-template-columns: minmax(200px, 2fr) minmax(100px, 1fr) minmax(80px, 0.6fr) minmax(60px, 0.4fr);
|
|
857
|
+
gap: var(--grid-gap-sm, 2px);
|
|
858
|
+
margin-top: 15px;
|
|
859
|
+
border-radius: var(--radius);
|
|
860
|
+
min-width: 0;
|
|
861
|
+
overflow: visible;
|
|
862
|
+
}
|
|
863
|
+
.sw-srh-wrap .sw-form-field {
|
|
864
|
+
flex: 1 1 50%;
|
|
865
|
+
min-width: 0;
|
|
866
|
+
justify-content: center;
|
|
867
|
+
}
|
|
868
|
+
.sw-add-return-label label {
|
|
869
|
+
color: var(--primary) !important;
|
|
870
|
+
}
|
|
871
|
+
.sw-srh-main-head {
|
|
872
|
+
display: flex;
|
|
873
|
+
align-items: center;
|
|
874
|
+
justify-content: space-between;
|
|
875
|
+
margin-bottom: 15px;
|
|
876
|
+
}
|
|
877
|
+
.sw-srh-head {
|
|
878
|
+
display: flex;
|
|
879
|
+
align-items: center;
|
|
880
|
+
gap: 10px;
|
|
881
|
+
}
|
|
882
|
+
.sw-srh-round-text {
|
|
883
|
+
display: flex;
|
|
884
|
+
align-items: center;
|
|
885
|
+
gap: 8px;
|
|
886
|
+
height: 40px;
|
|
887
|
+
}
|
|
888
|
+
.sw-remove-segment{
|
|
889
|
+
fill: var(--primary);
|
|
890
|
+
cursor: pointer;
|
|
891
|
+
display: grid;
|
|
892
|
+
place-content: center;
|
|
893
|
+
position: absolute;
|
|
894
|
+
z-index: 2;
|
|
895
|
+
border-radius: 50%;
|
|
896
|
+
inset-inline-end: 12px;
|
|
897
|
+
border: 1px solid var(--primary);
|
|
898
|
+
width: 22px;
|
|
899
|
+
height: 22px;
|
|
900
|
+
top: 19px;
|
|
901
|
+
svg{
|
|
902
|
+
width: 22px;
|
|
903
|
+
height: 22px;
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
.sw-srh-mc .sw-srh-wrap.sw-srh-box{
|
|
907
|
+
position: relative;
|
|
908
|
+
}
|
|
909
|
+
.sw-srh-mc {
|
|
910
|
+
grid-template-columns: 6.3fr 2.5fr 1.15fr !important;
|
|
911
|
+
min-width: 0;
|
|
912
|
+
}
|
|
913
|
+
.sw-srh-mc .sw-com-cal .p-inputtext{
|
|
914
|
+
visibility: visible !important;
|
|
915
|
+
height: auto !important;
|
|
916
|
+
width: auto !important;
|
|
917
|
+
}
|
|
918
|
+
.sw-srh-mc .sw-srh-wrap.sw-pos-rel:nth-child(3){
|
|
919
|
+
flex-basis: 30%;
|
|
920
|
+
}
|
|
921
|
+
.sw-srh-mc .sw-srh-mc-foot {
|
|
922
|
+
display: flex;
|
|
923
|
+
align-items: flex-end;
|
|
924
|
+
width: fit-content;
|
|
925
|
+
grid-column-start: 2;
|
|
926
|
+
}
|
|
927
|
+
.sw-srh-mc .sw-srh-mc-foot button {
|
|
928
|
+
display: flex;
|
|
929
|
+
align-items: center;
|
|
930
|
+
gap: 7px;
|
|
931
|
+
margin-inline-start: 5px;
|
|
932
|
+
padding: 8px 10px;
|
|
933
|
+
border: 1px solid var(--primary);
|
|
934
|
+
border-radius: 30px;
|
|
935
|
+
background-color: transparent;
|
|
936
|
+
color: var(--primary);
|
|
937
|
+
font-size: 14px;
|
|
938
|
+
}
|
|
939
|
+
.sw-srh-mc .sw-srh-mc-foot button svg {
|
|
940
|
+
fill: var(--primary);
|
|
941
|
+
}
|
|
942
|
+
.sw-srh-mc .sw-srh-add-btn {
|
|
943
|
+
display: flex;
|
|
944
|
+
align-items: center;
|
|
945
|
+
gap: 7px;
|
|
946
|
+
margin-inline-start: 5px;
|
|
947
|
+
padding: 0.8rem 1rem;
|
|
948
|
+
border-radius: 30px;
|
|
949
|
+
color: var(--primary);
|
|
950
|
+
font-size: 1.4rem;
|
|
951
|
+
}
|
|
952
|
+
.sw-srh-mc .sw-traveller {
|
|
953
|
+
grid-row-start: 1;
|
|
954
|
+
grid-column-start: 2;
|
|
955
|
+
}
|
|
956
|
+
.sw-srh-mc button {
|
|
957
|
+
grid-row-start: 1;
|
|
958
|
+
grid-column-start: 3;
|
|
959
|
+
}
|
|
960
|
+
.sw-srh-box {
|
|
961
|
+
grid-column-start: 1;
|
|
962
|
+
}
|
|
963
|
+
.p-autocomplete-multiple-container {
|
|
964
|
+
width: 100%;
|
|
965
|
+
min-width: 270px;
|
|
966
|
+
padding: 10px;
|
|
967
|
+
padding-inline-end: 2rem;
|
|
968
|
+
border: 1px solid var(--form-border);
|
|
969
|
+
border-radius: var(--radius);
|
|
970
|
+
gap: 0.5rem;
|
|
971
|
+
font-size: 14px;
|
|
972
|
+
}
|
|
973
|
+
.p-autocomplete-multiple-container .p-autocomplete-token {
|
|
974
|
+
padding: 5px 8px;
|
|
975
|
+
border-radius: 5px;
|
|
976
|
+
background: var(--primary-light);
|
|
977
|
+
gap: 5px;
|
|
978
|
+
color: var(--primary);
|
|
979
|
+
}
|
|
980
|
+
.p-autocomplete-token .p-autocomplete-token-label{
|
|
981
|
+
font-size: 12px;
|
|
982
|
+
font-weight: 400;
|
|
983
|
+
}
|
|
984
|
+
.sw-fsrh-adv-cont {
|
|
985
|
+
display: flex;
|
|
986
|
+
align-items: center;
|
|
987
|
+
gap: 20px;
|
|
988
|
+
}
|
|
989
|
+
.sw-fsrh-chk-main {
|
|
990
|
+
display: flex;
|
|
991
|
+
gap: 20px;
|
|
992
|
+
font-size: 1.4rem;
|
|
993
|
+
font-weight: 400;
|
|
994
|
+
}
|
|
995
|
+
.sw-srh-pax {
|
|
996
|
+
display: flex;
|
|
997
|
+
align-items: center;
|
|
998
|
+
gap: 10px;
|
|
999
|
+
}
|
|
1000
|
+
.sw-srh-pax:not(:last-child) {
|
|
1001
|
+
margin-bottom: 15px;
|
|
1002
|
+
}
|
|
1003
|
+
.sw-srh-common-adult {
|
|
1004
|
+
width: 92px;
|
|
1005
|
+
}
|
|
1006
|
+
.sw-srh-pax h3 {
|
|
1007
|
+
font-size: 14px;
|
|
1008
|
+
}
|
|
1009
|
+
.sw-srh-pax p {
|
|
1010
|
+
color: var(--label-color);
|
|
1011
|
+
font-size: 12px;
|
|
1012
|
+
}
|
|
1013
|
+
.sw-srh-button-wrapper button {
|
|
1014
|
+
width: 32px;
|
|
1015
|
+
height: 30px;
|
|
1016
|
+
margin: 0;
|
|
1017
|
+
padding: 0;
|
|
1018
|
+
border: 0;
|
|
1019
|
+
border-radius: 8px;
|
|
1020
|
+
background-color: transparent;
|
|
1021
|
+
font-size: 14px;
|
|
1022
|
+
font-weight: 400;
|
|
1023
|
+
}
|
|
1024
|
+
.sw-srh-button-wrapper button.sw-active-button {
|
|
1025
|
+
background-color: var(--secondary);
|
|
1026
|
+
color: var(--white);
|
|
1027
|
+
}
|
|
1028
|
+
.sw-traveller .sw-rooms-guests-menu {
|
|
1029
|
+
width: 460px;
|
|
1030
|
+
}
|
|
1031
|
+
.sw-srh-class {
|
|
1032
|
+
display: flex;
|
|
1033
|
+
flex-wrap: wrap;
|
|
1034
|
+
gap: var(--flex-gap-md, 10px);
|
|
1035
|
+
align-items: stretch;
|
|
1036
|
+
}
|
|
1037
|
+
.sw-srh-class .sw-tab-content {
|
|
1038
|
+
min-width: fit-content;
|
|
1039
|
+
display: block;
|
|
1040
|
+
}
|
|
1041
|
+
.sw-srh-class label {
|
|
1042
|
+
width: fit-content !important;
|
|
1043
|
+
}
|
|
1044
|
+
.sw-srh-class .sw-tab-checkbox input:checked + .sw-tab-content,
|
|
1045
|
+
.sw-srh-class .sw-tab-checkbox input[type=radio]:checked + .sw-tab-content {
|
|
1046
|
+
background-color: var(--primary);
|
|
1047
|
+
color: var(--white);
|
|
1048
|
+
}
|
|
1049
|
+
.sw-srh-h-grid {
|
|
1050
|
+
position: relative;
|
|
1051
|
+
display: grid;
|
|
1052
|
+
grid-template-columns: 2.2fr 1.8fr 3fr 1.8fr 1.15fr;
|
|
1053
|
+
gap: var(--grid-gap-sm, 2px);
|
|
1054
|
+
min-height: 55px;
|
|
1055
|
+
min-width: 0;
|
|
1056
|
+
overflow: visible;
|
|
1057
|
+
border-radius: var(--radius);
|
|
1058
|
+
}
|
|
1059
|
+
.sw-srh-loc {
|
|
1060
|
+
display: block !important;
|
|
1061
|
+
padding: 15px 0 12px;
|
|
1062
|
+
border-bottom: 1px solid var(--form-border);
|
|
1063
|
+
}
|
|
1064
|
+
.sw-srh-count-wrapper,
|
|
1065
|
+
.sw-srh-loc {
|
|
1066
|
+
display: flex;
|
|
1067
|
+
align-items: center;
|
|
1068
|
+
gap: 15px;
|
|
1069
|
+
margin: 0 20px;
|
|
1070
|
+
cursor: pointer;
|
|
1071
|
+
}
|
|
1072
|
+
.sw-hotel-search-form-icon {
|
|
1073
|
+
display: grid;
|
|
1074
|
+
place-content: center;
|
|
1075
|
+
width: 40px;
|
|
1076
|
+
height: 40px;
|
|
1077
|
+
background: #f4f5f5;
|
|
1078
|
+
border-radius: var(--radius);
|
|
1079
|
+
}
|
|
1080
|
+
.sw-hotel-search-form-icon.sw-fill {
|
|
1081
|
+
background: var(--primary-light);
|
|
1082
|
+
}
|
|
1083
|
+
.sw-hsrh-advan-cont {
|
|
1084
|
+
display: flex;
|
|
1085
|
+
align-items: center;
|
|
1086
|
+
gap: 10px;
|
|
1087
|
+
}
|
|
1088
|
+
.sw-checkbox-wrap {
|
|
1089
|
+
cursor: pointer;
|
|
1090
|
+
}
|
|
1091
|
+
.sw-checkbox-wrap input {
|
|
1092
|
+
display: none;
|
|
1093
|
+
}
|
|
1094
|
+
.sw-checkbox-wrap input:checked + .sw-star-checkbox {
|
|
1095
|
+
padding: 8px 12px;
|
|
1096
|
+
border: 1px solid var(--primary-light);
|
|
1097
|
+
border-radius: 20px;
|
|
1098
|
+
background: var(--primary-light);
|
|
1099
|
+
gap: 5px;
|
|
1100
|
+
color: var(--primary);
|
|
1101
|
+
font-size: 14px;
|
|
1102
|
+
line-height: 1;
|
|
1103
|
+
}
|
|
1104
|
+
.sw-checkbox-wrap .sw-star-checkbox {
|
|
1105
|
+
display: flex;
|
|
1106
|
+
align-items: center;
|
|
1107
|
+
gap: 5px;
|
|
1108
|
+
padding: 8px 12px;
|
|
1109
|
+
border: 1px solid var(--form-border);
|
|
1110
|
+
border-radius: 20px;
|
|
1111
|
+
font-size: 14px;
|
|
1112
|
+
line-height: 1;
|
|
1113
|
+
}
|
|
1114
|
+
.sw-star-checkbox-wrap input:checked + .sw-star-checkbox {
|
|
1115
|
+
padding: 7px 12px;
|
|
1116
|
+
border: 1px solid #fcf2e8;
|
|
1117
|
+
border-radius: 20px;
|
|
1118
|
+
background: #fcf2e8;
|
|
1119
|
+
color: #ffae43;
|
|
1120
|
+
}
|
|
1121
|
+
.sw-star-checkbox-wrap input:checked + .sw-star-checkbox svg path {
|
|
1122
|
+
fill: #ffae43;
|
|
1123
|
+
}
|
|
1124
|
+
.sw-hsrh-chk-main {
|
|
1125
|
+
display: flex;
|
|
1126
|
+
gap: var(--flex-gap-md, 10px);
|
|
1127
|
+
font-size: 1.4rem;
|
|
1128
|
+
font-weight: 400;
|
|
1129
|
+
flex-wrap: wrap;
|
|
1130
|
+
}
|
|
1131
|
+
.sw-srh-class {
|
|
1132
|
+
display: flex;
|
|
1133
|
+
flex-wrap: wrap;
|
|
1134
|
+
gap: var(--flex-gap-md, 10px);
|
|
1135
|
+
align-items: stretch;
|
|
1136
|
+
}
|
|
1137
|
+
.sw-srh-class .sw-tab-content {
|
|
1138
|
+
flex: 0 1 auto;
|
|
1139
|
+
min-width: fit-content;
|
|
1140
|
+
}
|
|
1141
|
+
`;
|
|
1142
|
+
|
|
1143
|
+
// src/Flight.tsx
|
|
1144
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
1145
|
+
var normalizeDomainName = (domainName) => {
|
|
1146
|
+
const trimmed = domainName.trim();
|
|
1147
|
+
if (!trimmed) return "";
|
|
1148
|
+
if (trimmed.startsWith("http://") || trimmed.startsWith("https://")) {
|
|
1149
|
+
try {
|
|
1150
|
+
return new URL(trimmed).hostname;
|
|
1151
|
+
} catch {
|
|
1152
|
+
return trimmed.replace(/^https?:\/\//, "").split("/")[0] ?? "";
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
return trimmed.split("/")[0] ?? "";
|
|
1156
|
+
};
|
|
1157
|
+
var buildEncryptedToken = (domainName) => {
|
|
1158
|
+
const normalizedDomain = normalizeDomainName(domainName);
|
|
1159
|
+
if (!normalizedDomain) return null;
|
|
1160
|
+
const encryptor = new import_jsencrypt.JSEncrypt();
|
|
1161
|
+
encryptor.setPublicKey(RSA_PUBLIC_KEY);
|
|
1162
|
+
const payload = `${normalizedDomain}~${(/* @__PURE__ */ new Date()).getTime()}`;
|
|
1163
|
+
const encrypted = encryptor.encrypt(payload);
|
|
1164
|
+
return typeof encrypted === "string" ? encrypted : null;
|
|
1165
|
+
};
|
|
1166
|
+
var STYLE_ELEMENT_ID = "tfsw-flight-styles";
|
|
1167
|
+
var PRIMEICONS_LINK_ID = "tfsw-primeicons";
|
|
1168
|
+
var RSA_PUBLIC_KEY = `-----BEGIN PUBLIC KEY-----
|
|
1169
|
+
MIICITANBgkqhkiG9w0BAQEFAAOCAg4AMIICCQKCAgB0rRSHGZK/FtK15IRfQxtl
|
|
1170
|
+
dN5ToPtfXGzTNBe1vGhow5xqp6BLubMKKPwCj3zOJiAm1Ip1VNqqYxWnaL8ZErBF
|
|
1171
|
+
rErtE0r7kn50QgGgJCpdrWJ4unhaoe1su207d9oY6D6OBH90v1aXA6ZjN7zTJmiq
|
|
1172
|
+
FJZOOTQE6t/XwNAOphq/B6Lcr1iQSQmSqaMozy4OQ4NvIzNTQn5tcs9qJBMsKFeU
|
|
1173
|
+
cSp8VK76JBNEqSuEHNmbV2d/IQ5XAqVUiAs34kH2xWRSbBmy0WK3c3QKGzC1MRWM
|
|
1174
|
+
9JauLN56TKUFOmUSjfWY3caJru6HxsiMTGKnvflXHfgA2aLAPxu72pIHoCTy5Hxj
|
|
1175
|
+
AUoKM7qXUn/kQj4Ci0M/0LRF4boqd37wpbyVNeXNvqm+dLjxklf/+NHMfNL2Wvb4
|
|
1176
|
+
ekHUVI8nMVPgswIcQ7q/Njf9DC+LA+/duf8m9JDjI3J6r9y1gQugdkLETGzF2Gj1
|
|
1177
|
+
ToU0Pocrg6CFHImqq2z+cOeWnURrV0f0I1UWWGCb79OZxZ5oDjM9uCLRsoe8+Npg
|
|
1178
|
+
ACZNf4AbnM7OUNj5TEYs6t/tUYouvTB7gH452I3EH6KWBl+ZTgCg0RFkOMazNOjn
|
|
1179
|
+
4J0yfbaPvpVgKzF2WRyn63mTO2tdLRl5s9uqMFhXmCs6IzEqBpxMKL1aS6ONZLDG
|
|
1180
|
+
5qPtpCPJnUFQEBTVlSO15QIDAQAB
|
|
1181
|
+
-----END PUBLIC KEY-----`;
|
|
1182
|
+
var SSO_RSA_PUBLIC_KEY = `-----BEGIN PUBLIC KEY-----
|
|
1183
|
+
MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAv+PThexweK9V8axQRaB3
|
|
1184
|
+
JrhYm/y2JAhED2o7V4Kpi4PpwdkcsVuACwxPt8M51idar/lBNnm12yJAvMnSRAYP
|
|
1185
|
+
Gv+iYCE5VV+XPzUZuu/ho3sARxO3bCSRx9Xk0JZkd0Q7Muvy3Z74N9lML+g4DAHH
|
|
1186
|
+
1SA+tQnvk2hLwna7vd6pHfmVDROEkTTqv0EF+0cVCUhwrXcEZ7NLrs3BPWLbxzus
|
|
1187
|
+
jlYsutTU0oaCeeag+xX6vbb+LFjDBvxngdlPzApUU0z9T4r/Mqbdb73e2FMrPSHO
|
|
1188
|
+
rJo+bRQ1+GE0EoFxYTyYVyOrd9bpfUhcc/ziK8Bu2M8lQk9pFs+1DGb1wC1TWklf
|
|
1189
|
+
ZCHX79BPP+tyLFugqmCLm+WprtNl+Cv93VQuwue6m9UATeiWHYrA9uZ0mWHvRPuD
|
|
1190
|
+
EaXCAvT3JUDqTnuV/mTu8cAr+HWMfB7wQ+XWyi6TVAfQovMawV89Gtk5q7Ep2L89
|
|
1191
|
+
MShfennamuIRODd7IuDLN24h8laBEKz0lPATsvyS3ITHG+DdwUjU+ptGYGzGI+ps
|
|
1192
|
+
YadkX8g5DSjQs8JZvCN22ktjGRLCudvS8e0IfgzRe6QQ90NmQ3dmtC4AsatHBeM5
|
|
1193
|
+
S7wetGyB9NHx52liu+AwZqiiLk8Yf/Y2/4394Z+kE/CYVFnCMEOxRhx/Fs3QRCm2
|
|
1194
|
+
piJcd0xNaTlQZ4IcB08NBMECAwEAAQ==
|
|
1195
|
+
-----END PUBLIC KEY-----`;
|
|
1196
|
+
var buildEncryptedSsoUserToken = (user) => {
|
|
1197
|
+
if (!user) return null;
|
|
1198
|
+
const email = (user.email ?? "").trim();
|
|
1199
|
+
if (!email) return null;
|
|
1200
|
+
const encryptor = new import_jsencrypt.JSEncrypt();
|
|
1201
|
+
encryptor.setPublicKey(SSO_RSA_PUBLIC_KEY);
|
|
1202
|
+
const payloadUser = {
|
|
1203
|
+
...user,
|
|
1204
|
+
email,
|
|
1205
|
+
ts: user.ts ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
1206
|
+
};
|
|
1207
|
+
const payload = JSON.stringify(payloadUser);
|
|
1208
|
+
const encrypted = encryptor.encrypt(payload);
|
|
1209
|
+
return typeof encrypted === "string" ? encrypted : null;
|
|
1210
|
+
};
|
|
1211
|
+
var ensureStylesInjected = () => {
|
|
1212
|
+
if (typeof document === "undefined") {
|
|
1213
|
+
return;
|
|
1214
|
+
}
|
|
1215
|
+
if (document.getElementById(STYLE_ELEMENT_ID)) {
|
|
1216
|
+
return;
|
|
1217
|
+
}
|
|
1218
|
+
const style = document.createElement("style");
|
|
1219
|
+
style.id = STYLE_ELEMENT_ID;
|
|
1220
|
+
style.textContent = flightSearchWidgetStyles;
|
|
1221
|
+
document.head.appendChild(style);
|
|
1222
|
+
};
|
|
1223
|
+
var ensurePrimeIconsLoaded = () => {
|
|
1224
|
+
if (typeof document === "undefined") {
|
|
1225
|
+
return;
|
|
1226
|
+
}
|
|
1227
|
+
if (document.getElementById(PRIMEICONS_LINK_ID)) {
|
|
1228
|
+
return;
|
|
1229
|
+
}
|
|
1230
|
+
const link = document.createElement("link");
|
|
1231
|
+
link.id = PRIMEICONS_LINK_ID;
|
|
1232
|
+
link.rel = "stylesheet";
|
|
1233
|
+
link.href = "https://unpkg.com/primeicons@7.0.0/primeicons.css";
|
|
1234
|
+
document.head.appendChild(link);
|
|
1235
|
+
};
|
|
1236
|
+
var DEFAULT_AIRPORTS = [
|
|
1237
|
+
{ ac: "AUH", an: "Abu Dhabi International Airport", cc: "AE", cn: "United Arab Emirates", ct: "Abu Dhabi" },
|
|
1238
|
+
{ ac: "CAI", an: "Cairo International Airport", cc: "EG", cn: "Egypt", ct: "Cairo" },
|
|
1239
|
+
{ ac: "DXB", an: "Dubai International Airport", cc: "AE", cn: "United Arab Emirates", ct: "Dubai" },
|
|
1240
|
+
{ ac: "RUH", an: "King Khalid International Airport", cc: "SA", cn: "Saudi Arabia", ct: "Riyadh" },
|
|
1241
|
+
{ ac: "LOS", an: "Murtala Muhammed International Airport", cc: "NG", cn: "Nigeria", ct: "Lagos" },
|
|
1242
|
+
{ ac: "LON", an: "London All Airports", cc: "GB", cn: "United Kingdom", ct: "London" },
|
|
1243
|
+
{ ac: "PAR", an: "All Airports", cc: "FR", cn: "France", ct: "Paris" },
|
|
1244
|
+
{ ac: "NYC", an: "All airports", cc: "US", cn: "United States Of America", ct: "New York" }
|
|
1245
|
+
];
|
|
1246
|
+
function formatAirportDisplay(airport) {
|
|
1247
|
+
const code = airport.ac ?? "";
|
|
1248
|
+
const name = airport.an ?? airport.ct ?? "";
|
|
1249
|
+
return name ? `${name} (${code})` : code;
|
|
1250
|
+
}
|
|
1251
|
+
function getAirportCode(airport) {
|
|
1252
|
+
return airport.ac ?? "";
|
|
1253
|
+
}
|
|
1254
|
+
function formatDisplayDate(date) {
|
|
1255
|
+
if (!date || !(date instanceof Date) || isNaN(date.getTime())) return "Select date";
|
|
1256
|
+
return date.toLocaleDateString("en-GB", { day: "2-digit", month: "short", year: "numeric" });
|
|
1257
|
+
}
|
|
1258
|
+
function FlightSearchWidget({
|
|
1259
|
+
config,
|
|
1260
|
+
ssoUser
|
|
1261
|
+
}) {
|
|
1262
|
+
const theme = config?.theme;
|
|
1263
|
+
const primaryColor = theme?.primary ?? "#2c0a82";
|
|
1264
|
+
const secondaryColor = theme?.secondary ?? "#2c0a82";
|
|
1265
|
+
const primaryLightColor = theme?.primaryLight ?? "#f3e2ff";
|
|
1266
|
+
const fontName = config?.fontName;
|
|
1267
|
+
const redirectionDomain = config?.redirectionDomain;
|
|
1268
|
+
const airportSearchApiBaseUrl = "https://adminapi-go.dev.futuretravelplatform.com/api";
|
|
1269
|
+
const airlineSearchApiBaseUrl = "https://adminapi.dev.futuretravelplatform.com/api";
|
|
1270
|
+
const langCode = "en";
|
|
1271
|
+
const [airlineQuery, setAirlineQuery] = (0, import_react.useState)("");
|
|
1272
|
+
const [airlineSuggestions, setAirlineSuggestions] = (0, import_react.useState)([]);
|
|
1273
|
+
const [selectedAirlines, setSelectedAirlines] = (0, import_react.useState)([]);
|
|
1274
|
+
const [validationErrors, setValidationErrors] = (0, import_react.useState)({});
|
|
1275
|
+
const createDefaultSegment = () => ({
|
|
1276
|
+
origin: "Origin",
|
|
1277
|
+
destination: "Destination",
|
|
1278
|
+
departureDate: /* @__PURE__ */ new Date(),
|
|
1279
|
+
returnDate: new Date((/* @__PURE__ */ new Date()).setDate((/* @__PURE__ */ new Date()).getDate() + 1)),
|
|
1280
|
+
dateRange: [/* @__PURE__ */ new Date(), new Date((/* @__PURE__ */ new Date()).setDate((/* @__PURE__ */ new Date()).getDate() + 1))],
|
|
1281
|
+
travelerClass: "Economy",
|
|
1282
|
+
adultCount: 1,
|
|
1283
|
+
childCount: 0,
|
|
1284
|
+
infantCount: 0
|
|
1285
|
+
});
|
|
1286
|
+
const [formState, setFormState] = (0, import_react.useState)(() => ({
|
|
1287
|
+
tripType: "round-trip",
|
|
1288
|
+
segments: [{
|
|
1289
|
+
origin: "Origin",
|
|
1290
|
+
destination: "Destination",
|
|
1291
|
+
departureDate: /* @__PURE__ */ new Date(),
|
|
1292
|
+
returnDate: new Date((/* @__PURE__ */ new Date()).setDate((/* @__PURE__ */ new Date()).getDate() + 1)),
|
|
1293
|
+
dateRange: [/* @__PURE__ */ new Date(), new Date((/* @__PURE__ */ new Date()).setDate((/* @__PURE__ */ new Date()).getDate() + 1))],
|
|
1294
|
+
travelerClass: "Economy",
|
|
1295
|
+
adultCount: 1,
|
|
1296
|
+
childCount: 0,
|
|
1297
|
+
infantCount: 0
|
|
1298
|
+
}]
|
|
1299
|
+
}));
|
|
1300
|
+
const { tripType, segments } = formState;
|
|
1301
|
+
const setTripType = (value) => setFormState((prev) => ({ ...prev, tripType: value }));
|
|
1302
|
+
const setSegments = (updater) => setFormState((prev) => ({ ...prev, segments: updater(prev.segments) }));
|
|
1303
|
+
const [advancedOptions, setAdvancedOptions] = (0, import_react.useState)({
|
|
1304
|
+
isDirectFlights: false,
|
|
1305
|
+
isRefundable: false,
|
|
1306
|
+
isBaggage: false,
|
|
1307
|
+
preferredAirlineList: [],
|
|
1308
|
+
isFlexiDate: false,
|
|
1309
|
+
isUmrah: false
|
|
1310
|
+
});
|
|
1311
|
+
const [isOriginDropdownOpen, setIsOriginDropdownOpen] = (0, import_react.useState)(false);
|
|
1312
|
+
const [isDestinationDropdownOpen, setIsDestinationDropdownOpen] = (0, import_react.useState)(false);
|
|
1313
|
+
const [isRoomsGuestsMenuOpen, setIsRoomsGuestsMenuOpen] = (0, import_react.useState)(false);
|
|
1314
|
+
const originDropdownRef = (0, import_react.useRef)(null);
|
|
1315
|
+
const destinationDropdownRef = (0, import_react.useRef)(null);
|
|
1316
|
+
const roomsGuestsMenuRef = (0, import_react.useRef)(null);
|
|
1317
|
+
const dateRangeCalendarRef = (0, import_react.useRef)(null);
|
|
1318
|
+
const segmentCalendarRefs = (0, import_react.useRef)({});
|
|
1319
|
+
const getMaxSegments = () => {
|
|
1320
|
+
if (tripType === "custom-search") return 3;
|
|
1321
|
+
if (tripType === "multi-city") return 6;
|
|
1322
|
+
return 1;
|
|
1323
|
+
};
|
|
1324
|
+
const [segmentDropdowns, setSegmentDropdowns] = (0, import_react.useState)({});
|
|
1325
|
+
const segmentRefs = (0, import_react.useRef)({});
|
|
1326
|
+
const [predictiveSearchList, setPredictiveSearchList] = (0, import_react.useState)({});
|
|
1327
|
+
const searchDebounceRef = (0, import_react.useRef)(null);
|
|
1328
|
+
const airlineSearchDebounceRef = (0, import_react.useRef)(null);
|
|
1329
|
+
const getPredictiveState = (segmentIndex) => {
|
|
1330
|
+
return predictiveSearchList[segmentIndex] ?? {
|
|
1331
|
+
fromAirport: [],
|
|
1332
|
+
toAirport: [],
|
|
1333
|
+
selectedFromIndex: -1,
|
|
1334
|
+
selectedToIndex: -1
|
|
1335
|
+
};
|
|
1336
|
+
};
|
|
1337
|
+
const getAirportListBySearch = (0, import_react.useCallback)(async (searchKeyword) => {
|
|
1338
|
+
if (!searchKeyword.trim()) return [];
|
|
1339
|
+
const url = `${airportSearchApiBaseUrl.replace(/\/$/, "")}/Airport/GetList/${encodeURIComponent(langCode)}/${encodeURIComponent(searchKeyword.trim())}`;
|
|
1340
|
+
try {
|
|
1341
|
+
const res = await fetch(url);
|
|
1342
|
+
if (!res.ok) return [];
|
|
1343
|
+
const data = await res.json();
|
|
1344
|
+
if (Array.isArray(data)) return data;
|
|
1345
|
+
if (data && Array.isArray(data.data)) return data.data;
|
|
1346
|
+
if (data && Array.isArray(data.result)) return data.result;
|
|
1347
|
+
return [];
|
|
1348
|
+
} catch {
|
|
1349
|
+
return [];
|
|
1350
|
+
}
|
|
1351
|
+
}, [airportSearchApiBaseUrl, langCode]);
|
|
1352
|
+
const getAirlineListBySearch = (0, import_react.useCallback)(async (searchKeyword) => {
|
|
1353
|
+
if (!searchKeyword.trim()) return [];
|
|
1354
|
+
const lang = (langCode ?? "en").toUpperCase();
|
|
1355
|
+
const url = `${airlineSearchApiBaseUrl.replace(/\/$/, "")}/MasterSearch/GetAllAirline/${encodeURIComponent(lang)}/${encodeURIComponent(searchKeyword.trim())}`;
|
|
1356
|
+
try {
|
|
1357
|
+
const token = buildEncryptedToken(redirectionDomain ?? "");
|
|
1358
|
+
const res = await fetch(url, {
|
|
1359
|
+
headers: token ? { token } : void 0
|
|
1360
|
+
});
|
|
1361
|
+
if (!res.ok) return [];
|
|
1362
|
+
const data = await res.json();
|
|
1363
|
+
if (Array.isArray(data)) return data;
|
|
1364
|
+
if (data && Array.isArray(data.data)) return data.data;
|
|
1365
|
+
if (data && Array.isArray(data.result)) return data.result;
|
|
1366
|
+
return [];
|
|
1367
|
+
} catch {
|
|
1368
|
+
return [];
|
|
1369
|
+
}
|
|
1370
|
+
}, [airlineSearchApiBaseUrl, langCode, redirectionDomain]);
|
|
1371
|
+
const searchAirport = (0, import_react.useCallback)((segmentIndex, dropdownType, value) => {
|
|
1372
|
+
if (value.length < 3) {
|
|
1373
|
+
setPredictiveSearchList((prev) => ({
|
|
1374
|
+
...prev,
|
|
1375
|
+
[segmentIndex]: {
|
|
1376
|
+
...prev[segmentIndex] ?? { fromAirport: [], toAirport: [], selectedFromIndex: -1, selectedToIndex: -1 },
|
|
1377
|
+
[dropdownType === "origin" ? "fromAirport" : "toAirport"]: [],
|
|
1378
|
+
[dropdownType === "origin" ? "selectedFromIndex" : "selectedToIndex"]: -1
|
|
1379
|
+
}
|
|
1380
|
+
}));
|
|
1381
|
+
return;
|
|
1382
|
+
}
|
|
1383
|
+
getAirportListBySearch(value).then((res) => {
|
|
1384
|
+
setPredictiveSearchList((prev) => ({
|
|
1385
|
+
...prev,
|
|
1386
|
+
[segmentIndex]: {
|
|
1387
|
+
...prev[segmentIndex] ?? { fromAirport: [], toAirport: [], selectedFromIndex: -1, selectedToIndex: -1 },
|
|
1388
|
+
[dropdownType === "origin" ? "fromAirport" : "toAirport"]: res,
|
|
1389
|
+
[dropdownType === "origin" ? "selectedFromIndex" : "selectedToIndex"]: res?.length === 0 ? -1 : 0
|
|
1390
|
+
}
|
|
1391
|
+
}));
|
|
1392
|
+
});
|
|
1393
|
+
}, [getAirportListBySearch]);
|
|
1394
|
+
const closeAirportDropdown = (0, import_react.useCallback)((dropdownType, segmentIndex) => {
|
|
1395
|
+
if (dropdownType === "origin") {
|
|
1396
|
+
setIsOriginDropdownOpen(false);
|
|
1397
|
+
} else {
|
|
1398
|
+
setIsDestinationDropdownOpen(false);
|
|
1399
|
+
}
|
|
1400
|
+
setSegmentDropdowns((prev) => ({
|
|
1401
|
+
...prev,
|
|
1402
|
+
[segmentIndex]: { ...prev[segmentIndex] || { origin: false, destination: false }, [dropdownType]: false }
|
|
1403
|
+
}));
|
|
1404
|
+
}, []);
|
|
1405
|
+
const selectAirport = (0, import_react.useCallback)((airport, dropdownType, segmentIndex) => {
|
|
1406
|
+
const display = formatAirportDisplay(airport);
|
|
1407
|
+
setSegments((prev) => {
|
|
1408
|
+
const updated = [...prev];
|
|
1409
|
+
if (!updated[segmentIndex]) return prev;
|
|
1410
|
+
if (dropdownType === "origin") updated[segmentIndex] = { ...updated[segmentIndex], origin: display };
|
|
1411
|
+
else updated[segmentIndex] = { ...updated[segmentIndex], destination: display };
|
|
1412
|
+
return updated;
|
|
1413
|
+
});
|
|
1414
|
+
closeAirportDropdown(dropdownType, segmentIndex);
|
|
1415
|
+
}, [closeAirportDropdown]);
|
|
1416
|
+
const updateSelectedIndex = (0, import_react.useCallback)((segmentIndex, dropdownType, newIndex) => {
|
|
1417
|
+
setPredictiveSearchList((prev) => {
|
|
1418
|
+
const state = prev[segmentIndex] ?? { fromAirport: [], toAirport: [], selectedFromIndex: -1, selectedToIndex: -1 };
|
|
1419
|
+
const list = dropdownType === "origin" ? state.fromAirport : state.toAirport;
|
|
1420
|
+
const len = list.length;
|
|
1421
|
+
if (len === 0) return prev;
|
|
1422
|
+
const clamped = (newIndex % len + len) % len;
|
|
1423
|
+
return {
|
|
1424
|
+
...prev,
|
|
1425
|
+
[segmentIndex]: {
|
|
1426
|
+
...state,
|
|
1427
|
+
[dropdownType === "origin" ? "selectedFromIndex" : "selectedToIndex"]: clamped
|
|
1428
|
+
}
|
|
1429
|
+
};
|
|
1430
|
+
});
|
|
1431
|
+
}, []);
|
|
1432
|
+
const handleKeyDown = (0, import_react.useCallback)((event, dropdownType, segmentIndex) => {
|
|
1433
|
+
const state = getPredictiveState(segmentIndex);
|
|
1434
|
+
const options = dropdownType === "origin" ? state.fromAirport : state.toAirport;
|
|
1435
|
+
const selectedIndex = dropdownType === "origin" ? state.selectedFromIndex : state.selectedToIndex;
|
|
1436
|
+
const isOpen = segmentIndex === 0 ? dropdownType === "origin" ? isOriginDropdownOpen : isDestinationDropdownOpen : segmentDropdowns[segmentIndex]?.[dropdownType];
|
|
1437
|
+
switch (event.key) {
|
|
1438
|
+
case "ArrowDown":
|
|
1439
|
+
if (isOpen && options.length) {
|
|
1440
|
+
event.preventDefault();
|
|
1441
|
+
updateSelectedIndex(segmentIndex, dropdownType, selectedIndex + 1);
|
|
1442
|
+
}
|
|
1443
|
+
break;
|
|
1444
|
+
case "ArrowUp":
|
|
1445
|
+
if (isOpen && options.length) {
|
|
1446
|
+
event.preventDefault();
|
|
1447
|
+
updateSelectedIndex(segmentIndex, dropdownType, selectedIndex - 1);
|
|
1448
|
+
}
|
|
1449
|
+
break;
|
|
1450
|
+
case "Enter":
|
|
1451
|
+
if (isOpen && options.length && selectedIndex >= 0 && options[selectedIndex]) {
|
|
1452
|
+
event.preventDefault();
|
|
1453
|
+
selectAirport(options[selectedIndex], dropdownType, segmentIndex);
|
|
1454
|
+
}
|
|
1455
|
+
break;
|
|
1456
|
+
case "Escape":
|
|
1457
|
+
if (isOpen) {
|
|
1458
|
+
event.preventDefault();
|
|
1459
|
+
closeAirportDropdown(dropdownType, segmentIndex);
|
|
1460
|
+
}
|
|
1461
|
+
break;
|
|
1462
|
+
default:
|
|
1463
|
+
break;
|
|
1464
|
+
}
|
|
1465
|
+
}, [isOriginDropdownOpen, isDestinationDropdownOpen, segmentDropdowns, getPredictiveState, updateSelectedIndex, selectAirport, closeAirportDropdown]);
|
|
1466
|
+
const DEBOUNCE_MS = 300;
|
|
1467
|
+
const triggerSearchAirport = (0, import_react.useCallback)((segmentIndex, dropdownType, value) => {
|
|
1468
|
+
if (searchDebounceRef.current) clearTimeout(searchDebounceRef.current);
|
|
1469
|
+
if (value.length < 3) {
|
|
1470
|
+
searchAirport(segmentIndex, dropdownType, value);
|
|
1471
|
+
return;
|
|
1472
|
+
}
|
|
1473
|
+
searchDebounceRef.current = setTimeout(() => {
|
|
1474
|
+
searchDebounceRef.current = null;
|
|
1475
|
+
searchAirport(segmentIndex, dropdownType, value);
|
|
1476
|
+
}, DEBOUNCE_MS);
|
|
1477
|
+
}, [searchAirport]);
|
|
1478
|
+
const triggerSearchAirline = (0, import_react.useCallback)((value) => {
|
|
1479
|
+
if (airlineSearchDebounceRef.current) clearTimeout(airlineSearchDebounceRef.current);
|
|
1480
|
+
if (value.length < 2) {
|
|
1481
|
+
setAirlineSuggestions([]);
|
|
1482
|
+
return;
|
|
1483
|
+
}
|
|
1484
|
+
airlineSearchDebounceRef.current = setTimeout(() => {
|
|
1485
|
+
airlineSearchDebounceRef.current = null;
|
|
1486
|
+
getAirlineListBySearch(value).then(setAirlineSuggestions);
|
|
1487
|
+
}, DEBOUNCE_MS);
|
|
1488
|
+
}, [getAirlineListBySearch]);
|
|
1489
|
+
(0, import_react.useEffect)(() => () => {
|
|
1490
|
+
if (searchDebounceRef.current) clearTimeout(searchDebounceRef.current);
|
|
1491
|
+
if (airlineSearchDebounceRef.current) clearTimeout(airlineSearchDebounceRef.current);
|
|
1492
|
+
}, []);
|
|
1493
|
+
const themeStyle = (0, import_react.useMemo)(
|
|
1494
|
+
() => {
|
|
1495
|
+
const style = {
|
|
1496
|
+
["--primary"]: primaryColor,
|
|
1497
|
+
["--secondary"]: secondaryColor,
|
|
1498
|
+
["--primary-light"]: primaryLightColor
|
|
1499
|
+
};
|
|
1500
|
+
if (fontName) {
|
|
1501
|
+
style["--font-family"] = fontName;
|
|
1502
|
+
}
|
|
1503
|
+
return style;
|
|
1504
|
+
},
|
|
1505
|
+
[primaryColor, secondaryColor, primaryLightColor]
|
|
1506
|
+
);
|
|
1507
|
+
(0, import_react.useEffect)(() => {
|
|
1508
|
+
ensureStylesInjected();
|
|
1509
|
+
ensurePrimeIconsLoaded();
|
|
1510
|
+
}, []);
|
|
1511
|
+
(0, import_react.useEffect)(() => {
|
|
1512
|
+
const handleClickOutside = (event) => {
|
|
1513
|
+
const target = event.target;
|
|
1514
|
+
const isInsidePrimeDropdown = target.closest(".p-dropdown-panel") !== null || target.closest(".p-dropdown-items-wrapper") !== null || target.closest(".p-dropdown-item") !== null || target.closest(".p-component")?.classList.contains("p-dropdown") !== false || target.closest('[data-pc-section="panel"]') !== null || target.closest('[data-pc-name="dropdown"]') !== null;
|
|
1515
|
+
if (originDropdownRef.current && !originDropdownRef.current.contains(target)) {
|
|
1516
|
+
setIsOriginDropdownOpen(false);
|
|
1517
|
+
}
|
|
1518
|
+
if (destinationDropdownRef.current && !destinationDropdownRef.current.contains(target)) {
|
|
1519
|
+
setIsDestinationDropdownOpen(false);
|
|
1520
|
+
}
|
|
1521
|
+
if (!isInsidePrimeDropdown && roomsGuestsMenuRef.current && !roomsGuestsMenuRef.current.contains(target)) {
|
|
1522
|
+
setIsRoomsGuestsMenuOpen(false);
|
|
1523
|
+
}
|
|
1524
|
+
const isInsideCustomDropdown = target.closest(".sw-custom-dropdown") !== null;
|
|
1525
|
+
const isInsideCalendar = target.closest(".p-datepicker") !== null || target.closest(".p-calendar") !== null;
|
|
1526
|
+
if (!isInsideCustomDropdown && !isInsideCalendar) {
|
|
1527
|
+
setSegmentDropdowns({});
|
|
1528
|
+
return;
|
|
1529
|
+
}
|
|
1530
|
+
Object.keys(segmentRefs.current).forEach((key) => {
|
|
1531
|
+
const index = Number.parseInt(key, 10);
|
|
1532
|
+
const refs = segmentRefs.current[index];
|
|
1533
|
+
if (refs) {
|
|
1534
|
+
if (refs.origin && !refs.origin.contains(target)) {
|
|
1535
|
+
setSegmentDropdowns((prev) => ({
|
|
1536
|
+
...prev,
|
|
1537
|
+
[index]: { ...prev[index] || { origin: false, destination: false }, origin: false }
|
|
1538
|
+
}));
|
|
1539
|
+
}
|
|
1540
|
+
if (refs.destination && !refs.destination.contains(target)) {
|
|
1541
|
+
setSegmentDropdowns((prev) => ({
|
|
1542
|
+
...prev,
|
|
1543
|
+
[index]: {
|
|
1544
|
+
...prev[index] || { origin: false, destination: false },
|
|
1545
|
+
destination: false
|
|
1546
|
+
}
|
|
1547
|
+
}));
|
|
1548
|
+
}
|
|
1549
|
+
}
|
|
1550
|
+
});
|
|
1551
|
+
};
|
|
1552
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
1553
|
+
return () => {
|
|
1554
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
1555
|
+
};
|
|
1556
|
+
}, []);
|
|
1557
|
+
(0, import_react.useEffect)(() => {
|
|
1558
|
+
if (tripType === "multi-city" || tripType === "custom-search") {
|
|
1559
|
+
setSegments((prev) => {
|
|
1560
|
+
const maxSegments = getMaxSegments();
|
|
1561
|
+
if (prev.length === 0) {
|
|
1562
|
+
const first = createDefaultSegment();
|
|
1563
|
+
const second = {
|
|
1564
|
+
origin: "Origin",
|
|
1565
|
+
destination: "Destination",
|
|
1566
|
+
departureDate: /* @__PURE__ */ new Date(),
|
|
1567
|
+
returnDate: null,
|
|
1568
|
+
dateRange: null,
|
|
1569
|
+
travelerClass: first.travelerClass,
|
|
1570
|
+
adultCount: first.adultCount,
|
|
1571
|
+
childCount: first.childCount,
|
|
1572
|
+
infantCount: first.infantCount
|
|
1573
|
+
};
|
|
1574
|
+
return [first, second];
|
|
1575
|
+
}
|
|
1576
|
+
if (prev.length === 1) {
|
|
1577
|
+
const first = prev[0];
|
|
1578
|
+
const second = {
|
|
1579
|
+
origin: "Origin",
|
|
1580
|
+
destination: "Destination",
|
|
1581
|
+
departureDate: /* @__PURE__ */ new Date(),
|
|
1582
|
+
returnDate: null,
|
|
1583
|
+
dateRange: null,
|
|
1584
|
+
travelerClass: first.travelerClass,
|
|
1585
|
+
adultCount: first.adultCount,
|
|
1586
|
+
childCount: first.childCount,
|
|
1587
|
+
infantCount: first.infantCount
|
|
1588
|
+
};
|
|
1589
|
+
return [first, second];
|
|
1590
|
+
}
|
|
1591
|
+
if (prev.length > maxSegments) return prev.slice(0, maxSegments);
|
|
1592
|
+
return prev;
|
|
1593
|
+
});
|
|
1594
|
+
} else {
|
|
1595
|
+
setSegments((prev) => {
|
|
1596
|
+
if (prev.length === 0) return [createDefaultSegment()];
|
|
1597
|
+
if (prev.length > 1) return [prev[0]];
|
|
1598
|
+
return prev;
|
|
1599
|
+
});
|
|
1600
|
+
}
|
|
1601
|
+
}, [tripType]);
|
|
1602
|
+
const isValidLocationValue = (value, placeholder) => {
|
|
1603
|
+
if (typeof value !== "string") return false;
|
|
1604
|
+
const trimmed = value.trim();
|
|
1605
|
+
return trimmed.length > 0 && trimmed !== placeholder;
|
|
1606
|
+
};
|
|
1607
|
+
const handleSegmentFieldChange = (index, field, value) => {
|
|
1608
|
+
setSegments((prev) => {
|
|
1609
|
+
const updated = [...prev];
|
|
1610
|
+
if (!updated[index]) return prev;
|
|
1611
|
+
updated[index] = { ...updated[index], [field]: value };
|
|
1612
|
+
if (field === "departureDate" && (tripType === "multi-city" || tripType === "custom-search") && value instanceof Date && !isNaN(value.getTime())) {
|
|
1613
|
+
for (let i = index + 1; i < updated.length; i += 1) {
|
|
1614
|
+
updated[i] = { ...updated[i], departureDate: value };
|
|
1615
|
+
}
|
|
1616
|
+
}
|
|
1617
|
+
return updated;
|
|
1618
|
+
});
|
|
1619
|
+
if (field === "origin" || field === "destination") {
|
|
1620
|
+
setSegmentDropdowns((prev) => ({
|
|
1621
|
+
...prev,
|
|
1622
|
+
[index]: { ...prev[index], [field]: false }
|
|
1623
|
+
}));
|
|
1624
|
+
const placeholder = field === "origin" ? "Origin" : "Destination";
|
|
1625
|
+
if (isValidLocationValue(value, placeholder)) {
|
|
1626
|
+
setValidationErrors((prev) => ({
|
|
1627
|
+
...prev,
|
|
1628
|
+
[index]: { ...prev[index] ?? {}, [field]: false }
|
|
1629
|
+
}));
|
|
1630
|
+
}
|
|
1631
|
+
}
|
|
1632
|
+
};
|
|
1633
|
+
const handleTravellerChange = (field, value) => {
|
|
1634
|
+
setSegments((prev) => {
|
|
1635
|
+
const updated = prev.map(
|
|
1636
|
+
(seg, i) => i === 0 ? { ...seg, [field]: value } : seg
|
|
1637
|
+
);
|
|
1638
|
+
return updated;
|
|
1639
|
+
});
|
|
1640
|
+
};
|
|
1641
|
+
const toggleSegmentDropdown = (index, field) => {
|
|
1642
|
+
setSegmentDropdowns((prev) => ({
|
|
1643
|
+
...prev,
|
|
1644
|
+
[index]: {
|
|
1645
|
+
...prev[index] || { origin: false, destination: false },
|
|
1646
|
+
[field]: !prev[index]?.[field]
|
|
1647
|
+
}
|
|
1648
|
+
}));
|
|
1649
|
+
};
|
|
1650
|
+
const addFlightSegment = () => {
|
|
1651
|
+
const maxSegments = getMaxSegments();
|
|
1652
|
+
if (segments.length < maxSegments) {
|
|
1653
|
+
const template = segments[0] ?? createDefaultSegment();
|
|
1654
|
+
setSegments((prev) => [
|
|
1655
|
+
...prev,
|
|
1656
|
+
{
|
|
1657
|
+
origin: "Origin",
|
|
1658
|
+
destination: "Destination",
|
|
1659
|
+
departureDate: /* @__PURE__ */ new Date(),
|
|
1660
|
+
returnDate: null,
|
|
1661
|
+
dateRange: null,
|
|
1662
|
+
travelerClass: template.travelerClass,
|
|
1663
|
+
adultCount: template.adultCount,
|
|
1664
|
+
childCount: template.childCount,
|
|
1665
|
+
infantCount: template.infantCount
|
|
1666
|
+
}
|
|
1667
|
+
]);
|
|
1668
|
+
}
|
|
1669
|
+
};
|
|
1670
|
+
const removeFlightSegment = (index) => {
|
|
1671
|
+
if (segments.length > 1) {
|
|
1672
|
+
setSegments((prev) => prev.filter((_, i) => i !== index));
|
|
1673
|
+
}
|
|
1674
|
+
};
|
|
1675
|
+
const extractAirportCode = (location) => {
|
|
1676
|
+
const match = location.match(/\(([A-Z]{3})\)/);
|
|
1677
|
+
return match ? match[1] : location;
|
|
1678
|
+
};
|
|
1679
|
+
const MONTH_NAMES = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
1680
|
+
const formatDate = (date) => {
|
|
1681
|
+
if (!date) return "";
|
|
1682
|
+
const day = String(date.getDate()).padStart(2, "0");
|
|
1683
|
+
const month = MONTH_NAMES[date.getMonth()];
|
|
1684
|
+
const year = date.getFullYear();
|
|
1685
|
+
return `${day}-${month}-${year}`;
|
|
1686
|
+
};
|
|
1687
|
+
const getTripTypeNumber = () => {
|
|
1688
|
+
switch (tripType) {
|
|
1689
|
+
case "one-way":
|
|
1690
|
+
return 1;
|
|
1691
|
+
case "round-trip":
|
|
1692
|
+
return 2;
|
|
1693
|
+
case "multi-city":
|
|
1694
|
+
return 3;
|
|
1695
|
+
case "custom-search":
|
|
1696
|
+
return 4;
|
|
1697
|
+
default:
|
|
1698
|
+
return 2;
|
|
1699
|
+
}
|
|
1700
|
+
};
|
|
1701
|
+
const getClassCode = (className) => {
|
|
1702
|
+
const classMap = {
|
|
1703
|
+
"Economy": "Y",
|
|
1704
|
+
"Business": "C",
|
|
1705
|
+
"First Class": "F",
|
|
1706
|
+
"Premium Economy": "W"
|
|
1707
|
+
};
|
|
1708
|
+
return classMap[className] || "Y";
|
|
1709
|
+
};
|
|
1710
|
+
const buildItineraryRequests = () => {
|
|
1711
|
+
const itineraryReqs = [];
|
|
1712
|
+
const firstSegment = segments[0];
|
|
1713
|
+
if (!firstSegment) return itineraryReqs;
|
|
1714
|
+
if (tripType === "one-way") {
|
|
1715
|
+
itineraryReqs.push({
|
|
1716
|
+
departureCode: extractAirportCode(firstSegment.origin),
|
|
1717
|
+
returnCode: extractAirportCode(firstSegment.destination),
|
|
1718
|
+
departureDate: formatDate(firstSegment.departureDate),
|
|
1719
|
+
class: getClassCode(firstSegment.travelerClass)
|
|
1720
|
+
});
|
|
1721
|
+
} else if (tripType === "round-trip") {
|
|
1722
|
+
itineraryReqs.push({
|
|
1723
|
+
departureCode: extractAirportCode(firstSegment.origin),
|
|
1724
|
+
returnCode: extractAirportCode(firstSegment.destination),
|
|
1725
|
+
departureDate: formatDate(firstSegment.departureDate),
|
|
1726
|
+
class: getClassCode(firstSegment.travelerClass)
|
|
1727
|
+
});
|
|
1728
|
+
const returnDate = firstSegment.dateRange?.[1] ?? firstSegment.returnDate ?? firstSegment.departureDate;
|
|
1729
|
+
itineraryReqs.push({
|
|
1730
|
+
departureCode: extractAirportCode(firstSegment.destination),
|
|
1731
|
+
returnCode: extractAirportCode(firstSegment.origin),
|
|
1732
|
+
departureDate: formatDate(returnDate),
|
|
1733
|
+
class: getClassCode(firstSegment.travelerClass)
|
|
1734
|
+
});
|
|
1735
|
+
} else if (tripType === "multi-city" || tripType === "custom-search") {
|
|
1736
|
+
segments.forEach((segment) => {
|
|
1737
|
+
itineraryReqs.push({
|
|
1738
|
+
departureCode: extractAirportCode(segment.origin),
|
|
1739
|
+
returnCode: extractAirportCode(segment.destination),
|
|
1740
|
+
departureDate: formatDate(segment.departureDate),
|
|
1741
|
+
class: getClassCode(segment.travelerClass)
|
|
1742
|
+
});
|
|
1743
|
+
});
|
|
1744
|
+
}
|
|
1745
|
+
return itineraryReqs;
|
|
1746
|
+
};
|
|
1747
|
+
const isBaggageOption = () => {
|
|
1748
|
+
return advancedOptions.isBaggage;
|
|
1749
|
+
};
|
|
1750
|
+
const getTripKey = () => {
|
|
1751
|
+
switch (tripType) {
|
|
1752
|
+
case "one-way":
|
|
1753
|
+
return "OW";
|
|
1754
|
+
case "round-trip":
|
|
1755
|
+
return "IRT";
|
|
1756
|
+
case "multi-city":
|
|
1757
|
+
return "NMC";
|
|
1758
|
+
case "custom-search":
|
|
1759
|
+
return "MC";
|
|
1760
|
+
default:
|
|
1761
|
+
return "OW";
|
|
1762
|
+
}
|
|
1763
|
+
};
|
|
1764
|
+
const isFlexiDateOption = () => {
|
|
1765
|
+
return advancedOptions.isFlexiDate;
|
|
1766
|
+
};
|
|
1767
|
+
const isUmrahFareOption = () => {
|
|
1768
|
+
return advancedOptions.isUmrah;
|
|
1769
|
+
};
|
|
1770
|
+
const createQueryString = () => {
|
|
1771
|
+
const queryStringObj = {};
|
|
1772
|
+
const itineraryReqs = buildItineraryRequests();
|
|
1773
|
+
let trip_index = 1;
|
|
1774
|
+
itineraryReqs.forEach((itineraryReqObj) => {
|
|
1775
|
+
queryStringObj[`dep${trip_index}`] = itineraryReqObj.departureCode;
|
|
1776
|
+
queryStringObj[`ret${trip_index}`] = itineraryReqObj.returnCode;
|
|
1777
|
+
queryStringObj[`dtt${trip_index}`] = itineraryReqObj.departureDate;
|
|
1778
|
+
queryStringObj[`cl${trip_index}`] = itineraryReqObj.class;
|
|
1779
|
+
trip_index++;
|
|
1780
|
+
});
|
|
1781
|
+
queryStringObj[`triptype`] = getTripTypeNumber();
|
|
1782
|
+
const firstSeg = segments[0];
|
|
1783
|
+
queryStringObj[`adult`] = firstSeg?.adultCount ?? 1;
|
|
1784
|
+
queryStringObj[`child`] = firstSeg?.childCount ?? 0;
|
|
1785
|
+
queryStringObj[`infant`] = firstSeg?.infantCount ?? 0;
|
|
1786
|
+
queryStringObj[`direct`] = advancedOptions.isDirectFlights;
|
|
1787
|
+
queryStringObj[`baggage`] = isBaggageOption();
|
|
1788
|
+
queryStringObj[`key`] = getTripKey();
|
|
1789
|
+
queryStringObj[`airlines`] = advancedOptions.preferredAirlineList.join(",") || "";
|
|
1790
|
+
queryStringObj[`ref`] = advancedOptions.isRefundable;
|
|
1791
|
+
queryStringObj[`lc`] = (langCode ?? "en").toUpperCase();
|
|
1792
|
+
queryStringObj[`curr`] = "AED";
|
|
1793
|
+
queryStringObj[`mgcc`] = "AE";
|
|
1794
|
+
queryStringObj["ipc"] = isFlexiDateOption();
|
|
1795
|
+
queryStringObj[`umrah`] = isUmrahFareOption();
|
|
1796
|
+
return queryStringObj;
|
|
1797
|
+
};
|
|
1798
|
+
const handleSearch = () => {
|
|
1799
|
+
const queryStringObj = createQueryString();
|
|
1800
|
+
console.log("Query String Object:", queryStringObj);
|
|
1801
|
+
console.log("Searching with:", formState, "domain:", redirectionDomain);
|
|
1802
|
+
const queryParams = new URLSearchParams();
|
|
1803
|
+
Object.keys(queryStringObj).forEach((key) => {
|
|
1804
|
+
const value = queryStringObj[key];
|
|
1805
|
+
if (key === "airlines" || key === "mgcc") {
|
|
1806
|
+
queryParams.append(key, value !== null && value !== void 0 ? String(value) : "");
|
|
1807
|
+
} else if (value !== null && value !== void 0 && value !== "") {
|
|
1808
|
+
queryParams.append(key, String(value));
|
|
1809
|
+
}
|
|
1810
|
+
});
|
|
1811
|
+
const ssoToken = buildEncryptedSsoUserToken(ssoUser);
|
|
1812
|
+
if (ssoToken) {
|
|
1813
|
+
queryParams.append("to", ssoToken);
|
|
1814
|
+
}
|
|
1815
|
+
const queryString = queryParams.toString();
|
|
1816
|
+
console.log("Query String:", queryString);
|
|
1817
|
+
if (redirectionDomain) {
|
|
1818
|
+
const url = `${redirectionDomain}/flight/listing?${queryString}`;
|
|
1819
|
+
window.open(url, "_blank");
|
|
1820
|
+
}
|
|
1821
|
+
};
|
|
1822
|
+
const handleSubmit = (e) => {
|
|
1823
|
+
e.preventDefault();
|
|
1824
|
+
const isMultiCityOrCustom = tripType === "multi-city" || tripType === "custom-search";
|
|
1825
|
+
const segmentsToValidate = isMultiCityOrCustom ? segments : segments.slice(0, 1);
|
|
1826
|
+
const nextErrors = {};
|
|
1827
|
+
segmentsToValidate.forEach((segment, index) => {
|
|
1828
|
+
const originInvalid = !isValidLocationValue(segment.origin, "Origin");
|
|
1829
|
+
const destinationInvalid = !isValidLocationValue(segment.destination, "Destination");
|
|
1830
|
+
if (originInvalid || destinationInvalid) {
|
|
1831
|
+
nextErrors[index] = {
|
|
1832
|
+
origin: originInvalid,
|
|
1833
|
+
destination: destinationInvalid
|
|
1834
|
+
};
|
|
1835
|
+
}
|
|
1836
|
+
});
|
|
1837
|
+
if (Object.keys(nextErrors).length > 0) {
|
|
1838
|
+
setValidationErrors(nextErrors);
|
|
1839
|
+
return;
|
|
1840
|
+
}
|
|
1841
|
+
handleSearch();
|
|
1842
|
+
};
|
|
1843
|
+
const renderAirportDropdown = (segmentIndex, dropdownType, dropdownRef, isOpen, onOpen) => {
|
|
1844
|
+
const isOrigin = dropdownType === "origin";
|
|
1845
|
+
const value = segments[segmentIndex]?.[dropdownType];
|
|
1846
|
+
const placeholder = isOrigin ? "Origin" : "Destination";
|
|
1847
|
+
const label = isOrigin ? "From" : "To";
|
|
1848
|
+
const list = isOrigin ? getPredictiveState(segmentIndex).fromAirport : getPredictiveState(segmentIndex).toAirport;
|
|
1849
|
+
const selectedIndex = isOrigin ? getPredictiveState(segmentIndex).selectedFromIndex : getPredictiveState(segmentIndex).selectedToIndex;
|
|
1850
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: `sw-form-field sw-pos-rel ${validationErrors[segmentIndex]?.[dropdownType] ? "sw-is-invalid" : ""}`, children: [
|
|
1851
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { htmlFor: `${dropdownType}-${segmentIndex}`, children: label }),
|
|
1852
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: `sw-custom-dropdown ${validationErrors[segmentIndex]?.[dropdownType] ? "sw-has-error" : ""}`, ref: dropdownRef, children: [
|
|
1853
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1854
|
+
"input",
|
|
1855
|
+
{
|
|
1856
|
+
type: "text",
|
|
1857
|
+
id: `${dropdownType}-${segmentIndex}`,
|
|
1858
|
+
className: `sw-custom-dropdown-trigger ${value === placeholder || !value ? "sw-placeholder" : ""}`,
|
|
1859
|
+
value: value === placeholder ? "" : value ?? "",
|
|
1860
|
+
placeholder,
|
|
1861
|
+
onFocus: onOpen,
|
|
1862
|
+
onChange: (e) => {
|
|
1863
|
+
const val = e.target.value;
|
|
1864
|
+
handleSegmentFieldChange(segmentIndex, dropdownType, val);
|
|
1865
|
+
triggerSearchAirport(segmentIndex, dropdownType, val);
|
|
1866
|
+
},
|
|
1867
|
+
onKeyDown: (e) => handleKeyDown(e, dropdownType, segmentIndex)
|
|
1868
|
+
}
|
|
1869
|
+
),
|
|
1870
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "sw-dropdown", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { className: "sw-dropdown-list", children: list.length > 0 ? list.map((airport, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { className: `sw-dropdown-list-item ${selectedIndex === i ? "highlight" : ""}`, onClick: () => selectAirport(airport, dropdownType, segmentIndex), children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "sw-dropdown-list-card", children: [
|
|
1871
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h6", { className: "sw-dropdown-item-badge sw-en-font", children: getAirportCode(airport) }),
|
|
1872
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
|
|
1873
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h5", { className: "sw-fw500 sw-text-ellipsis", children: formatAirportDisplay(airport) }),
|
|
1874
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("h6", { className: "sw-text-label sw-text-ellipsis", children: [
|
|
1875
|
+
airport.ct,
|
|
1876
|
+
airport.cn ? `, ${airport.cn}` : ""
|
|
1877
|
+
] })
|
|
1878
|
+
] })
|
|
1879
|
+
] }) }, airport.id ?? airport.ac ?? i)) : DEFAULT_AIRPORTS.map((airport, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { className: "sw-dropdown-list-item ", onClick: () => selectAirport(airport, dropdownType, segmentIndex), children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "sw-dropdown-list-card", children: [
|
|
1880
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h6", { className: "sw-dropdown-item-badge sw-en-font", children: getAirportCode(airport) }),
|
|
1881
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
|
|
1882
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h5", { className: "sw-fw500 sw-text-ellipsis", children: formatAirportDisplay(airport) }),
|
|
1883
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("h6", { className: "sw-text-label sw-text-ellipsis", children: [
|
|
1884
|
+
airport.ct,
|
|
1885
|
+
airport.cn ? `, ${airport.cn}` : ""
|
|
1886
|
+
] })
|
|
1887
|
+
] })
|
|
1888
|
+
] }) }, airport.ac ?? i)) }) })
|
|
1889
|
+
] })
|
|
1890
|
+
] });
|
|
1891
|
+
};
|
|
1892
|
+
const getMinDateForSegment = (index) => {
|
|
1893
|
+
const today = /* @__PURE__ */ new Date();
|
|
1894
|
+
if (index <= 0) return today;
|
|
1895
|
+
const prev = segments[index - 1]?.departureDate;
|
|
1896
|
+
if (prev instanceof Date && !isNaN(prev.getTime())) return prev;
|
|
1897
|
+
return today;
|
|
1898
|
+
};
|
|
1899
|
+
const renderFlightSegment = (index, segment, isMultiCityOrCustom) => {
|
|
1900
|
+
const canRemove = segments.length > 2 && index > 0 && isMultiCityOrCustom;
|
|
1901
|
+
const originRef = (el) => {
|
|
1902
|
+
if (!segmentRefs.current[index]) segmentRefs.current[index] = { origin: null, destination: null };
|
|
1903
|
+
segmentRefs.current[index].origin = el;
|
|
1904
|
+
};
|
|
1905
|
+
const destinationRef = (el) => {
|
|
1906
|
+
if (!segmentRefs.current[index]) segmentRefs.current[index] = { origin: null, destination: null };
|
|
1907
|
+
segmentRefs.current[index].destination = el;
|
|
1908
|
+
};
|
|
1909
|
+
const isOriginOpen = segmentDropdowns[index]?.origin ?? false;
|
|
1910
|
+
const isDestOpen = segmentDropdowns[index]?.destination ?? false;
|
|
1911
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "sw-srh-wrap sw-srh-box", children: [
|
|
1912
|
+
renderAirportDropdown(index, "origin", originDropdownRef || originRef, isOriginOpen, () => toggleSegmentDropdown(index, "origin")),
|
|
1913
|
+
renderAirportDropdown(index, "destination", destinationDropdownRef || destinationRef, isDestOpen, () => toggleSegmentDropdown(index, "destination")),
|
|
1914
|
+
isMultiCityOrCustom && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "sw-srh-wrap sw-pos-rel", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "sw-form-field sw-com-cal", children: [
|
|
1915
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { htmlFor: `departure-${index}`, children: "Departure" }),
|
|
1916
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1917
|
+
import_calendar.Calendar,
|
|
1918
|
+
{
|
|
1919
|
+
numberOfMonths: 2,
|
|
1920
|
+
id: `departure-${index}`,
|
|
1921
|
+
appendTo: "self",
|
|
1922
|
+
value: segment.departureDate ?? null,
|
|
1923
|
+
onChange: (e) => {
|
|
1924
|
+
const raw = e.value;
|
|
1925
|
+
const nextDate = raw instanceof Date ? raw : typeof raw === "string" ? new Date(raw) : null;
|
|
1926
|
+
handleSegmentFieldChange(
|
|
1927
|
+
index,
|
|
1928
|
+
"departureDate",
|
|
1929
|
+
nextDate && !isNaN(nextDate.getTime()) ? nextDate : null
|
|
1930
|
+
);
|
|
1931
|
+
},
|
|
1932
|
+
dateFormat: "dd M yy",
|
|
1933
|
+
placeholder: "29 Jan 2026",
|
|
1934
|
+
className: "p-inputtext-sm",
|
|
1935
|
+
minDate: getMinDateForSegment(index)
|
|
1936
|
+
}
|
|
1937
|
+
)
|
|
1938
|
+
] }) }),
|
|
1939
|
+
canRemove && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "sw-srh-wrap", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1940
|
+
"a",
|
|
1941
|
+
{
|
|
1942
|
+
type: "button",
|
|
1943
|
+
className: "sw-remove-segment",
|
|
1944
|
+
onClick: () => removeFlightSegment(index),
|
|
1945
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { viewBox: "0 0 200 200", width: "35", height: "35", xmlns: "http://www.w3.org/2000/svg", role: "presentation", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M124.697 135.303L100 110.606l-24.697 24.697l-10.606-10.606L89.393 100L64.697 75.303l10.606-10.606L100 89.394l24.697-24.697l10.606 10.606L110.607 100l24.696 24.697z" }) })
|
|
1946
|
+
}
|
|
1947
|
+
) })
|
|
1948
|
+
] }, index);
|
|
1949
|
+
};
|
|
1950
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_api.PrimeReactProvider, { value: { hideOverlaysOnDocumentScrolling: false }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "tfsw-root sw-container", style: themeStyle, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "sw-card-box", children: [
|
|
1951
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "sw-srh-main-head", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "sw-srh-head", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "sw-srh-round-text", children: [
|
|
1952
|
+
{ value: "round-trip", label: "Round-trip" },
|
|
1953
|
+
{ value: "one-way", label: "One-way" },
|
|
1954
|
+
{ value: "custom-search", label: "Custom Search" },
|
|
1955
|
+
{ value: "multi-city", label: "Multi-city" }
|
|
1956
|
+
].map((option) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "sw-tab-checkbox", children: [
|
|
1957
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1958
|
+
"input",
|
|
1959
|
+
{
|
|
1960
|
+
type: "radio",
|
|
1961
|
+
name: "trip",
|
|
1962
|
+
value: option.value,
|
|
1963
|
+
checked: tripType === option.value,
|
|
1964
|
+
onChange: (e) => setTripType(e.target.value)
|
|
1965
|
+
}
|
|
1966
|
+
),
|
|
1967
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h5", { className: "sw-tab-content", children: option.label })
|
|
1968
|
+
] }, option.value)) }) }) }),
|
|
1969
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("form", { className: `sw-srh-grid ${tripType === "multi-city" || tripType === "custom-search" ? "sw-srh-mc" : ""}`, onSubmit: handleSubmit, children: [
|
|
1970
|
+
tripType === "multi-city" || tripType === "custom-search" ? segments.map((segment, index) => renderFlightSegment(index, segment, true)) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "sw-srh-wrap sw-srh-box", children: [
|
|
1971
|
+
renderAirportDropdown(0, "origin", originDropdownRef, isOriginDropdownOpen, () => setIsOriginDropdownOpen(true)),
|
|
1972
|
+
renderAirportDropdown(0, "destination", destinationDropdownRef, isDestinationDropdownOpen, () => setIsDestinationDropdownOpen(true))
|
|
1973
|
+
] }),
|
|
1974
|
+
(tripType === "round-trip" || tripType === "one-way") && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "sw-srh-wrap sw-pos-rel ", children: tripType === "round-trip" ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
1975
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { cursor: "pointer" }, onClick: () => dateRangeCalendarRef.current?.show?.(), className: "sw-form-field sw-com-cal", children: [
|
|
1976
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
|
|
1977
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { children: "Departure" }),
|
|
1978
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: segments[0]?.dateRange?.[0]?.toLocaleDateString("en-GB", { day: "2-digit", month: "short", year: "numeric" }) })
|
|
1979
|
+
] }),
|
|
1980
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1981
|
+
import_calendar.Calendar,
|
|
1982
|
+
{
|
|
1983
|
+
numberOfMonths: 2,
|
|
1984
|
+
ref: dateRangeCalendarRef,
|
|
1985
|
+
id: "dateRange",
|
|
1986
|
+
appendTo: "self",
|
|
1987
|
+
selectionMode: "range",
|
|
1988
|
+
value: segments[0]?.dateRange ?? null,
|
|
1989
|
+
minDate: /* @__PURE__ */ new Date(),
|
|
1990
|
+
onChange: (e) => {
|
|
1991
|
+
const range = e.value;
|
|
1992
|
+
setSegments((prev) => {
|
|
1993
|
+
const u = [...prev];
|
|
1994
|
+
if (!u[0]) return prev;
|
|
1995
|
+
u[0] = {
|
|
1996
|
+
...u[0],
|
|
1997
|
+
dateRange: range,
|
|
1998
|
+
departureDate: range?.[0] ?? /* @__PURE__ */ new Date(),
|
|
1999
|
+
returnDate: range?.[1] ?? /* @__PURE__ */ new Date()
|
|
2000
|
+
};
|
|
2001
|
+
return u;
|
|
2002
|
+
});
|
|
2003
|
+
if (range?.[0] && range?.[1]) setTimeout(() => {
|
|
2004
|
+
dateRangeCalendarRef.current?.hide?.();
|
|
2005
|
+
}, 150);
|
|
2006
|
+
},
|
|
2007
|
+
dateFormat: "dd M yy",
|
|
2008
|
+
placeholder: "Select date range",
|
|
2009
|
+
className: "p-inputtext-sm tfsw-calendar-input"
|
|
2010
|
+
}
|
|
2011
|
+
)
|
|
2012
|
+
] }),
|
|
2013
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { cursor: "pointer" }, className: "sw-form-field sw-com-cal", onClick: () => dateRangeCalendarRef.current?.show?.(), children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
|
|
2014
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { children: "Return" }),
|
|
2015
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: (segments[0]?.dateRange?.[1] ?? segments[0]?.dateRange?.[0])?.toLocaleDateString("en-GB", { day: "2-digit", month: "short", year: "numeric" }) })
|
|
2016
|
+
] }) })
|
|
2017
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
2018
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
2019
|
+
"div",
|
|
2020
|
+
{
|
|
2021
|
+
className: "sw-form-field sw-pos-rel sw-com-cal",
|
|
2022
|
+
style: { cursor: "pointer" },
|
|
2023
|
+
onClick: () => segmentCalendarRefs.current[0]?.show?.(),
|
|
2024
|
+
children: [
|
|
2025
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { children: "Departure" }),
|
|
2026
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: formatDisplayDate(segments[0]?.departureDate) }),
|
|
2027
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2028
|
+
import_calendar.Calendar,
|
|
2029
|
+
{
|
|
2030
|
+
numberOfMonths: 2,
|
|
2031
|
+
ref: (el) => {
|
|
2032
|
+
segmentCalendarRefs.current[0] = el;
|
|
2033
|
+
},
|
|
2034
|
+
value: segments[0]?.departureDate ?? null,
|
|
2035
|
+
onChange: (e) => {
|
|
2036
|
+
const raw = e.value;
|
|
2037
|
+
const nextDate = raw instanceof Date ? raw : typeof raw === "string" ? new Date(raw) : null;
|
|
2038
|
+
handleSegmentFieldChange(
|
|
2039
|
+
0,
|
|
2040
|
+
"departureDate",
|
|
2041
|
+
nextDate && !isNaN(nextDate.getTime()) ? nextDate : null
|
|
2042
|
+
);
|
|
2043
|
+
},
|
|
2044
|
+
appendTo: "self",
|
|
2045
|
+
minDate: /* @__PURE__ */ new Date(),
|
|
2046
|
+
dateFormat: "dd M yy",
|
|
2047
|
+
className: "p-inputtext-sm tfsw-calendar-input"
|
|
2048
|
+
}
|
|
2049
|
+
)
|
|
2050
|
+
]
|
|
2051
|
+
}
|
|
2052
|
+
),
|
|
2053
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "sw-form-field sw-pos-rel sw-com-cal sw-add-return-label", style: { cursor: "pointer" }, onClick: () => {
|
|
2054
|
+
setTripType("round-trip");
|
|
2055
|
+
setTimeout(() => document.getElementById("dateRange")?.querySelector("input")?.focus?.(), 100);
|
|
2056
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { children: "Add return" }) })
|
|
2057
|
+
] }) }),
|
|
2058
|
+
(tripType === "multi-city" || tripType === "custom-search") && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "sw-srh-mc-foot", children: segments.length < getMaxSegments() && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", { type: "button", className: "sw-srh-add-btn", onClick: addFlightSegment, children: [
|
|
2059
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("svg", { width: "14", height: "14", viewBox: "0 0 16 16", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
2060
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { fill: "none", d: "M0 0h16v16H0z" }),
|
|
2061
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M15 7H9V1H7v6H1v2h6v6h2V9h6z" })
|
|
2062
|
+
] }),
|
|
2063
|
+
"Add Another Flight"
|
|
2064
|
+
] }) }),
|
|
2065
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "sw-form-field sw-traveller sw-pos-rel", children: [
|
|
2066
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { htmlFor: "rooms", children: "Travellers and Class" }),
|
|
2067
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "sw-custom-dropdown", ref: roomsGuestsMenuRef, children: [
|
|
2068
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2069
|
+
"div",
|
|
2070
|
+
{
|
|
2071
|
+
className: "sw-custom-dropdown-trigger",
|
|
2072
|
+
onClick: () => setIsRoomsGuestsMenuOpen(!isRoomsGuestsMenuOpen),
|
|
2073
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
|
|
2074
|
+
(segments[0]?.adultCount ?? 0) + (segments[0]?.childCount ?? 0) + (segments[0]?.infantCount ?? 0),
|
|
2075
|
+
" Traveller",
|
|
2076
|
+
(segments[0]?.adultCount ?? 0) + (segments[0]?.childCount ?? 0) + (segments[0]?.infantCount ?? 0) !== 1 ? "s" : "",
|
|
2077
|
+
", ",
|
|
2078
|
+
segments[0]?.travelerClass ?? "Economy"
|
|
2079
|
+
] })
|
|
2080
|
+
}
|
|
2081
|
+
),
|
|
2082
|
+
isRoomsGuestsMenuOpen && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "sw-rooms-guests-menu", children: [
|
|
2083
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { className: "sw-rooms-guests-title", children: "Number of Travellers" }),
|
|
2084
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "sw-srh-pax", children: [
|
|
2085
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "sw-srh-common-adult", children: [
|
|
2086
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { children: "Adults" }),
|
|
2087
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "Age (12+)" })
|
|
2088
|
+
] }),
|
|
2089
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "sw-srh-button-wrapper", children: [1, 2, 3, 4, 5, 6, 7, 8, 9].map((count) => {
|
|
2090
|
+
const childCount = segments[0]?.childCount ?? 0;
|
|
2091
|
+
const infantCount = segments[0]?.infantCount ?? 0;
|
|
2092
|
+
const isDisabled = count + childCount > 9;
|
|
2093
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2094
|
+
"button",
|
|
2095
|
+
{
|
|
2096
|
+
type: "button",
|
|
2097
|
+
className: `sw-en-font ${(segments[0]?.adultCount ?? 0) === count ? "sw-active-button" : ""} ${isDisabled ? "disabled" : ""}`,
|
|
2098
|
+
disabled: isDisabled,
|
|
2099
|
+
onClick: () => {
|
|
2100
|
+
const newChildCount = Math.min(childCount, 9 - count);
|
|
2101
|
+
setSegments((prev) => {
|
|
2102
|
+
const updated = [...prev];
|
|
2103
|
+
if (!updated[0]) return prev;
|
|
2104
|
+
updated[0] = {
|
|
2105
|
+
...updated[0],
|
|
2106
|
+
adultCount: count,
|
|
2107
|
+
childCount: newChildCount,
|
|
2108
|
+
infantCount: Math.min(infantCount, count)
|
|
2109
|
+
};
|
|
2110
|
+
return updated;
|
|
2111
|
+
});
|
|
2112
|
+
},
|
|
2113
|
+
children: count
|
|
2114
|
+
},
|
|
2115
|
+
count
|
|
2116
|
+
);
|
|
2117
|
+
}) })
|
|
2118
|
+
] }),
|
|
2119
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "sw-srh-pax", children: [
|
|
2120
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "sw-srh-common-adult", children: [
|
|
2121
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { children: "Child" }),
|
|
2122
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "Age (2-11)" })
|
|
2123
|
+
] }),
|
|
2124
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "sw-srh-button-wrapper", children: [0, 1, 2, 3, 4, 5, 6, 7, 8].map((count) => {
|
|
2125
|
+
const adultCount = segments[0]?.adultCount ?? 0;
|
|
2126
|
+
const isDisabled = adultCount + count > 9;
|
|
2127
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2128
|
+
"button",
|
|
2129
|
+
{
|
|
2130
|
+
type: "button",
|
|
2131
|
+
className: `sw-en-font ${(segments[0]?.childCount ?? 0) === count ? "sw-active-button" : ""} ${isDisabled ? "disabled" : ""}`,
|
|
2132
|
+
disabled: isDisabled,
|
|
2133
|
+
onClick: () => handleTravellerChange("childCount", count),
|
|
2134
|
+
children: count
|
|
2135
|
+
},
|
|
2136
|
+
count
|
|
2137
|
+
);
|
|
2138
|
+
}) })
|
|
2139
|
+
] }),
|
|
2140
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "sw-srh-pax", children: [
|
|
2141
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "sw-srh-common-adult", children: [
|
|
2142
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { children: "Infant" }),
|
|
2143
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "Under 2 years" })
|
|
2144
|
+
] }),
|
|
2145
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "sw-srh-button-wrapper", children: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9].map((count) => {
|
|
2146
|
+
const adultCount = segments[0]?.adultCount ?? 0;
|
|
2147
|
+
const isDisabled = count > adultCount;
|
|
2148
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2149
|
+
"button",
|
|
2150
|
+
{
|
|
2151
|
+
type: "button",
|
|
2152
|
+
className: `sw-en-font ${(segments[0]?.infantCount ?? 0) === count ? "sw-active-button" : ""} ${isDisabled ? "disabled" : ""}`,
|
|
2153
|
+
disabled: isDisabled,
|
|
2154
|
+
onClick: () => handleTravellerChange("infantCount", count),
|
|
2155
|
+
children: count
|
|
2156
|
+
},
|
|
2157
|
+
count
|
|
2158
|
+
);
|
|
2159
|
+
}) })
|
|
2160
|
+
] }),
|
|
2161
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { className: "sw-rooms-guests-title", children: "Travel Class" }),
|
|
2162
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "sw-srh-class", children: ["Economy", "Business", "First Class", "Premium Economy"].map((classOption) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "sw-tab-checkbox", children: [
|
|
2163
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2164
|
+
"input",
|
|
2165
|
+
{
|
|
2166
|
+
type: "radio",
|
|
2167
|
+
name: "travel-class",
|
|
2168
|
+
checked: (segments[0]?.travelerClass ?? "Economy") === classOption,
|
|
2169
|
+
onChange: () => handleTravellerChange("travelerClass", classOption)
|
|
2170
|
+
}
|
|
2171
|
+
),
|
|
2172
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "sw-tab-content", children: classOption })
|
|
2173
|
+
] }, classOption)) }),
|
|
2174
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "sw-rooms-guests-footer", children: [
|
|
2175
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {}),
|
|
2176
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "sw-rooms-guests-cta", children: [
|
|
2177
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2178
|
+
"button",
|
|
2179
|
+
{
|
|
2180
|
+
type: "button",
|
|
2181
|
+
className: "sw-reset-button",
|
|
2182
|
+
onClick: () => {
|
|
2183
|
+
setSegments((prev) => {
|
|
2184
|
+
const updated = [...prev];
|
|
2185
|
+
if (!updated[0]) return prev;
|
|
2186
|
+
updated[0] = { ...updated[0], adultCount: 1, childCount: 0, infantCount: 0, travelerClass: "Economy" };
|
|
2187
|
+
return updated;
|
|
2188
|
+
});
|
|
2189
|
+
},
|
|
2190
|
+
children: "Reset"
|
|
2191
|
+
}
|
|
2192
|
+
),
|
|
2193
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2194
|
+
"button",
|
|
2195
|
+
{
|
|
2196
|
+
type: "button",
|
|
2197
|
+
className: "sw-apply-button",
|
|
2198
|
+
onClick: () => setIsRoomsGuestsMenuOpen(false),
|
|
2199
|
+
children: "Apply"
|
|
2200
|
+
}
|
|
2201
|
+
)
|
|
2202
|
+
] })
|
|
2203
|
+
] })
|
|
2204
|
+
] })
|
|
2205
|
+
] })
|
|
2206
|
+
] }),
|
|
2207
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", { type: "submit", className: "sw-search-button", children: [
|
|
2208
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "pi pi-search", "aria-hidden": "true" }),
|
|
2209
|
+
"Search"
|
|
2210
|
+
] })
|
|
2211
|
+
] }),
|
|
2212
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "sw-advanced-search-options", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_accordion.Accordion, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_accordion.AccordionTab, { header: "Advanced Search options", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "sw-fsrh-adv-cont", children: [
|
|
2213
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2214
|
+
import_autocomplete.AutoComplete,
|
|
2215
|
+
{
|
|
2216
|
+
value: selectedAirlines,
|
|
2217
|
+
suggestions: airlineSuggestions,
|
|
2218
|
+
completeMethod: (e) => {
|
|
2219
|
+
const query = e.query ?? "";
|
|
2220
|
+
setAirlineQuery(query);
|
|
2221
|
+
triggerSearchAirline(query);
|
|
2222
|
+
},
|
|
2223
|
+
onChange: (e) => {
|
|
2224
|
+
const next = e.value ?? [];
|
|
2225
|
+
setSelectedAirlines(next);
|
|
2226
|
+
setAdvancedOptions((prev) => ({
|
|
2227
|
+
...prev,
|
|
2228
|
+
preferredAirlineList: next.map((item) => item.airline_code)
|
|
2229
|
+
}));
|
|
2230
|
+
},
|
|
2231
|
+
field: "airline_name",
|
|
2232
|
+
multiple: true,
|
|
2233
|
+
forceSelection: true,
|
|
2234
|
+
placeholder: "Preferred airline"
|
|
2235
|
+
}
|
|
2236
|
+
),
|
|
2237
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "sw-fsrh-chk-main", children: [
|
|
2238
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "sw-material-checkbox", children: [
|
|
2239
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2240
|
+
"input",
|
|
2241
|
+
{
|
|
2242
|
+
type: "checkbox",
|
|
2243
|
+
checked: advancedOptions.isRefundable,
|
|
2244
|
+
onChange: (e) => setAdvancedOptions((prev) => ({ ...prev, isRefundable: e.target.checked }))
|
|
2245
|
+
}
|
|
2246
|
+
),
|
|
2247
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "sw-checkmark" }),
|
|
2248
|
+
"Refundable"
|
|
2249
|
+
] }),
|
|
2250
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "sw-material-checkbox", children: [
|
|
2251
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2252
|
+
"input",
|
|
2253
|
+
{
|
|
2254
|
+
type: "checkbox",
|
|
2255
|
+
checked: advancedOptions.isBaggage,
|
|
2256
|
+
onChange: (e) => setAdvancedOptions((prev) => ({ ...prev, isBaggage: e.target.checked }))
|
|
2257
|
+
}
|
|
2258
|
+
),
|
|
2259
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "sw-checkmark" }),
|
|
2260
|
+
"Baggage only"
|
|
2261
|
+
] }),
|
|
2262
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "sw-material-checkbox", children: [
|
|
2263
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2264
|
+
"input",
|
|
2265
|
+
{
|
|
2266
|
+
type: "checkbox",
|
|
2267
|
+
checked: advancedOptions.isDirectFlights,
|
|
2268
|
+
onChange: (e) => setAdvancedOptions((prev) => ({ ...prev, isDirectFlights: e.target.checked }))
|
|
2269
|
+
}
|
|
2270
|
+
),
|
|
2271
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "sw-checkmark" }),
|
|
2272
|
+
"Direct Flights"
|
|
2273
|
+
] })
|
|
2274
|
+
] })
|
|
2275
|
+
] }) }) }) })
|
|
2276
|
+
] }) }) });
|
|
2277
|
+
}
|
|
2278
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
2279
|
+
0 && (module.exports = {
|
|
2280
|
+
FlightSearchWidget
|
|
2281
|
+
});
|
|
2282
|
+
//# sourceMappingURL=index.cjs.map
|