@travelswitchhq/flight-search-react 1.0.7 → 1.0.9
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 +54 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +54 -22
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -37,6 +37,7 @@ var flightSearchWidgetStyles = `
|
|
|
37
37
|
.sw-container {
|
|
38
38
|
--sw-font-family: Montserrat, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
39
39
|
--sw-en-font-family: Arial, sans-serif;
|
|
40
|
+
--sw-secondary-bg-text: #ffffff;
|
|
40
41
|
--sw-label-color: #66797F;
|
|
41
42
|
--sw-body-text: #0B1215;
|
|
42
43
|
--sw-btn-radius: 8px;
|
|
@@ -66,7 +67,6 @@ var flightSearchWidgetStyles = `
|
|
|
66
67
|
--sw-size-lg: 20px;
|
|
67
68
|
}
|
|
68
69
|
.sw-container {
|
|
69
|
-
contain: layout;
|
|
70
70
|
position: relative;
|
|
71
71
|
display: block;
|
|
72
72
|
width: 100%;
|
|
@@ -171,7 +171,7 @@ var flightSearchWidgetStyles = `
|
|
|
171
171
|
position: relative;
|
|
172
172
|
display: block;
|
|
173
173
|
padding: 20px;
|
|
174
|
-
background-color: var(--
|
|
174
|
+
background-color: var(--secondary);
|
|
175
175
|
border-radius: var(--sw-radius);
|
|
176
176
|
}
|
|
177
177
|
.sw-card-box .br-right{
|
|
@@ -195,6 +195,18 @@ var flightSearchWidgetStyles = `
|
|
|
195
195
|
min-width: 0;
|
|
196
196
|
overflow: visible;
|
|
197
197
|
}
|
|
198
|
+
.sw-form-field.sw-is-invalid {
|
|
199
|
+
box-shadow: inset 0 0 0 1px var(--sw-error);
|
|
200
|
+
}
|
|
201
|
+
.sw-form-field.sw-is-invalid label {
|
|
202
|
+
color: var(--sw-error);
|
|
203
|
+
}
|
|
204
|
+
.sw-custom-dropdown.sw-has-error .sw-custom-dropdown-trigger {
|
|
205
|
+
color: var(--sw-error);
|
|
206
|
+
}
|
|
207
|
+
.sw-custom-dropdown.sw-has-error .sw-custom-dropdown-trigger::placeholder {
|
|
208
|
+
color: var(--sw-error) !important;
|
|
209
|
+
}
|
|
198
210
|
.sw-form-field label {
|
|
199
211
|
display: block;
|
|
200
212
|
width: 100%;
|
|
@@ -685,10 +697,10 @@ padding-inline-start: 25px;
|
|
|
685
697
|
.p-datepicker-other-month span{
|
|
686
698
|
opacity: 0;
|
|
687
699
|
}
|
|
688
|
-
.p-datepicker .p-highlight {
|
|
700
|
+
.sw-com-cal .p-datepicker .p-highlight {
|
|
689
701
|
position: relative;
|
|
690
|
-
background: var(--primary
|
|
691
|
-
color: var(--
|
|
702
|
+
background: var(--primary);
|
|
703
|
+
color: var(--primary-light);
|
|
692
704
|
}
|
|
693
705
|
.sw-product-tabs {
|
|
694
706
|
position: relative;
|
|
@@ -803,10 +815,10 @@ padding-inline-start: 25px;
|
|
|
803
815
|
background-color: var(--primary-light);
|
|
804
816
|
color: var(--primary);
|
|
805
817
|
}
|
|
806
|
-
.sw-tab-content {
|
|
818
|
+
.sw-card-box .sw-tab-content {
|
|
807
819
|
height: 40px;
|
|
808
820
|
padding: 6px 15px;
|
|
809
|
-
border: 1px solid var(--sw-
|
|
821
|
+
border: 1px solid var(--sw-secondary-bg-text);
|
|
810
822
|
border-radius: var(--sw-radius);
|
|
811
823
|
align-content: center;
|
|
812
824
|
}
|
|
@@ -875,6 +887,13 @@ padding-inline-start: 25px;
|
|
|
875
887
|
gap: 8px;
|
|
876
888
|
height: 40px;
|
|
877
889
|
}
|
|
890
|
+
.sw-srh-round-text .sw-tab-content{
|
|
891
|
+
color: var(--sw-secondary-bg-text);
|
|
892
|
+
}
|
|
893
|
+
.sw-advanced-search-options .p-accordion-header-text,
|
|
894
|
+
.sw-card-box .p-accordion-toggle-icon{
|
|
895
|
+
color: var(--sw-secondary-bg-text);
|
|
896
|
+
}
|
|
878
897
|
.sw-remove-segment{
|
|
879
898
|
fill: var(--primary);
|
|
880
899
|
cursor: pointer;
|
|
@@ -920,14 +939,14 @@ padding-inline-start: 25px;
|
|
|
920
939
|
gap: 7px;
|
|
921
940
|
margin-inline-start: 5px;
|
|
922
941
|
padding: 8px 10px;
|
|
923
|
-
|
|
942
|
+
background-color: var(--primary);
|
|
924
943
|
border-radius: 30px;
|
|
925
|
-
|
|
926
|
-
color: var(--primary);
|
|
944
|
+
color: var(--sw-white);
|
|
927
945
|
font-size: 14px;
|
|
946
|
+
cursor: pointer;
|
|
928
947
|
}
|
|
929
948
|
.sw-srh-mc .sw-srh-mc-foot button svg {
|
|
930
|
-
fill: var(--
|
|
949
|
+
fill: var(--sw-white);
|
|
931
950
|
}
|
|
932
951
|
.sw-srh-mc .sw-srh-add-btn {
|
|
933
952
|
display: flex;
|
|
@@ -935,9 +954,9 @@ padding-inline-start: 25px;
|
|
|
935
954
|
gap: 7px;
|
|
936
955
|
margin-inline-start: 5px;
|
|
937
956
|
padding: 0.8rem 1rem;
|
|
957
|
+
border: 0;
|
|
938
958
|
border-radius: 30px;
|
|
939
959
|
color: var(--primary);
|
|
940
|
-
font-size: 1.4rem;
|
|
941
960
|
}
|
|
942
961
|
.sw-srh-mc .sw-traveller {
|
|
943
962
|
grid-row-start: 1;
|
|
@@ -1012,7 +1031,7 @@ padding-inline-start: 25px;
|
|
|
1012
1031
|
font-weight: 400;
|
|
1013
1032
|
}
|
|
1014
1033
|
.sw-srh-button-wrapper button.sw-active-button {
|
|
1015
|
-
background-color: var(--
|
|
1034
|
+
background-color: var(--primary);
|
|
1016
1035
|
color: var(--sw-white);
|
|
1017
1036
|
}
|
|
1018
1037
|
.sw-traveller .sw-rooms-guests-menu {
|
|
@@ -1312,12 +1331,12 @@ padding-inline-start: 25px;
|
|
|
1312
1331
|
.sw-srh-mc .sw-srh-mc-foot{
|
|
1313
1332
|
margin: 10px 0;
|
|
1314
1333
|
}
|
|
1315
|
-
.sw-srh-mc .sw-srh-wrap:nth-child(3){
|
|
1316
|
-
flex-direction: row;
|
|
1317
|
-
}
|
|
1318
1334
|
.sw-container .sw-search-button{
|
|
1319
1335
|
border-radius: var(--sw-btn-radius);
|
|
1320
1336
|
}
|
|
1337
|
+
.sw-fsrh-chk-main{
|
|
1338
|
+
flex-wrap: wrap;
|
|
1339
|
+
}
|
|
1321
1340
|
}
|
|
1322
1341
|
`;
|
|
1323
1342
|
|
|
@@ -1617,8 +1636,12 @@ function FlightSearchWidget({
|
|
|
1617
1636
|
}
|
|
1618
1637
|
return updated;
|
|
1619
1638
|
});
|
|
1639
|
+
setValidationErrors((prev) => ({
|
|
1640
|
+
...prev,
|
|
1641
|
+
[segmentIndex]: { ...prev[segmentIndex] ?? {}, [dropdownType]: false }
|
|
1642
|
+
}));
|
|
1620
1643
|
closeAirportDropdown(dropdownType, segmentIndex);
|
|
1621
|
-
}, [closeAirportDropdown]);
|
|
1644
|
+
}, [closeAirportDropdown, tripType]);
|
|
1622
1645
|
const updateSelectedIndex = (0, import_react.useCallback)((segmentIndex, dropdownType, newIndex) => {
|
|
1623
1646
|
setPredictiveSearchList((prev) => {
|
|
1624
1647
|
const state = prev[segmentIndex] ?? { fromAirport: [], toAirport: [], selectedFromIndex: -1, selectedToIndex: -1 };
|
|
@@ -2039,6 +2062,14 @@ function FlightSearchWidget({
|
|
|
2039
2062
|
queryStringObj[`umrah`] = isUmrahFareOption();
|
|
2040
2063
|
return queryStringObj;
|
|
2041
2064
|
};
|
|
2065
|
+
const getNormalizedRedirectionBase = () => {
|
|
2066
|
+
const raw = (redirectionDomain ?? "").trim();
|
|
2067
|
+
if (!raw) return null;
|
|
2068
|
+
if (raw.startsWith("http://") || raw.startsWith("https://")) {
|
|
2069
|
+
return raw.replace(/\/+$/, "");
|
|
2070
|
+
}
|
|
2071
|
+
return `https://${raw.replace(/\/+$/, "")}`;
|
|
2072
|
+
};
|
|
2042
2073
|
const handleSearch = () => {
|
|
2043
2074
|
const queryStringObj = createQueryString();
|
|
2044
2075
|
console.log("Query String Object:", queryStringObj);
|
|
@@ -2058,8 +2089,9 @@ function FlightSearchWidget({
|
|
|
2058
2089
|
}
|
|
2059
2090
|
const queryString = queryParams.toString();
|
|
2060
2091
|
console.log("Query String:", queryString);
|
|
2061
|
-
|
|
2062
|
-
|
|
2092
|
+
const base = getNormalizedRedirectionBase();
|
|
2093
|
+
if (base) {
|
|
2094
|
+
const url = `${base}/flight/listing?${queryString}`;
|
|
2063
2095
|
window.location.href = url;
|
|
2064
2096
|
}
|
|
2065
2097
|
};
|
|
@@ -2118,8 +2150,8 @@ function FlightSearchWidget({
|
|
|
2118
2150
|
isOpen && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "sw-dropdown", children: [
|
|
2119
2151
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "mobileHead MobileShow", children: [
|
|
2120
2152
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { type: "button", onClick: () => closeAirportDropdown(dropdownType, segmentIndex), children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("svg", { width: "20px", height: "20px", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
2121
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M19 5L5 19", stroke: "black",
|
|
2122
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M5 5L19 19", stroke: "black",
|
|
2153
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M19 5L5 19", stroke: "black", strokeWidth: "2", "stroke-linecap": "round", strokeLinejoin: "round" }),
|
|
2154
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M5 5L19 19", stroke: "black", strokeWidth: "2", "stroke-linecap": "round", strokeLinejoin: "round" })
|
|
2123
2155
|
] }) }),
|
|
2124
2156
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h4", { children: isOrigin ? "Origin" : "Destination" })
|
|
2125
2157
|
] }),
|
|
@@ -2286,7 +2318,7 @@ function FlightSearchWidget({
|
|
|
2286
2318
|
className: "sw-form-swap",
|
|
2287
2319
|
"aria-label": "Swap origin and destination",
|
|
2288
2320
|
onClick: () => swapSegmentLocations(0),
|
|
2289
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { width: "30px", height: "30px", fill: "var(--body-text)", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", {
|
|
2321
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { width: "30px", height: "30px", fill: "var(--body-text)", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { fillRule: "evenodd", d: "M14.6403 5.2477a.7483.7483 0 0 1 1.0612.0084l4.0871 4.1684a.7555.7555 0 0 1 .1573.8195.7502.7502 0 0 1-.6921.4623H6.8305c-.4145 0-.7504-.3373-.7504-.7533 0-.4161.336-.7534.7504-.7534h10.6317L14.632 6.3131a.7556.7556 0 0 1 .0083-1.0654ZM9.368 18.8148a.7483.7483 0 0 1-1.0611-.0084l-4.087-4.1684a.7555.7555 0 0 1-.1574-.8195.7503.7503 0 0 1 .6921-.4623H17.178c.4144 0 .7503.3373.7503.7533 0 .4161-.3359.7534-.7503.7534H6.5463l2.8301 2.8865a.7555.7555 0 0 1-.0083 1.0654Z", clipRule: "evenodd" }) })
|
|
2290
2322
|
}
|
|
2291
2323
|
),
|
|
2292
2324
|
renderAirportDropdown(0, "destination", destinationDropdownRef, isDestinationDropdownOpen, () => setIsDestinationDropdownOpen(true))
|