@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.mjs
CHANGED
|
@@ -11,6 +11,7 @@ var flightSearchWidgetStyles = `
|
|
|
11
11
|
.sw-container {
|
|
12
12
|
--sw-font-family: Montserrat, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
13
13
|
--sw-en-font-family: Arial, sans-serif;
|
|
14
|
+
--sw-secondary-bg-text: #ffffff;
|
|
14
15
|
--sw-label-color: #66797F;
|
|
15
16
|
--sw-body-text: #0B1215;
|
|
16
17
|
--sw-btn-radius: 8px;
|
|
@@ -40,7 +41,6 @@ var flightSearchWidgetStyles = `
|
|
|
40
41
|
--sw-size-lg: 20px;
|
|
41
42
|
}
|
|
42
43
|
.sw-container {
|
|
43
|
-
contain: layout;
|
|
44
44
|
position: relative;
|
|
45
45
|
display: block;
|
|
46
46
|
width: 100%;
|
|
@@ -145,7 +145,7 @@ var flightSearchWidgetStyles = `
|
|
|
145
145
|
position: relative;
|
|
146
146
|
display: block;
|
|
147
147
|
padding: 20px;
|
|
148
|
-
background-color: var(--
|
|
148
|
+
background-color: var(--secondary);
|
|
149
149
|
border-radius: var(--sw-radius);
|
|
150
150
|
}
|
|
151
151
|
.sw-card-box .br-right{
|
|
@@ -169,6 +169,18 @@ var flightSearchWidgetStyles = `
|
|
|
169
169
|
min-width: 0;
|
|
170
170
|
overflow: visible;
|
|
171
171
|
}
|
|
172
|
+
.sw-form-field.sw-is-invalid {
|
|
173
|
+
box-shadow: inset 0 0 0 1px var(--sw-error);
|
|
174
|
+
}
|
|
175
|
+
.sw-form-field.sw-is-invalid label {
|
|
176
|
+
color: var(--sw-error);
|
|
177
|
+
}
|
|
178
|
+
.sw-custom-dropdown.sw-has-error .sw-custom-dropdown-trigger {
|
|
179
|
+
color: var(--sw-error);
|
|
180
|
+
}
|
|
181
|
+
.sw-custom-dropdown.sw-has-error .sw-custom-dropdown-trigger::placeholder {
|
|
182
|
+
color: var(--sw-error) !important;
|
|
183
|
+
}
|
|
172
184
|
.sw-form-field label {
|
|
173
185
|
display: block;
|
|
174
186
|
width: 100%;
|
|
@@ -659,10 +671,10 @@ padding-inline-start: 25px;
|
|
|
659
671
|
.p-datepicker-other-month span{
|
|
660
672
|
opacity: 0;
|
|
661
673
|
}
|
|
662
|
-
.p-datepicker .p-highlight {
|
|
674
|
+
.sw-com-cal .p-datepicker .p-highlight {
|
|
663
675
|
position: relative;
|
|
664
|
-
background: var(--primary
|
|
665
|
-
color: var(--
|
|
676
|
+
background: var(--primary);
|
|
677
|
+
color: var(--primary-light);
|
|
666
678
|
}
|
|
667
679
|
.sw-product-tabs {
|
|
668
680
|
position: relative;
|
|
@@ -777,10 +789,10 @@ padding-inline-start: 25px;
|
|
|
777
789
|
background-color: var(--primary-light);
|
|
778
790
|
color: var(--primary);
|
|
779
791
|
}
|
|
780
|
-
.sw-tab-content {
|
|
792
|
+
.sw-card-box .sw-tab-content {
|
|
781
793
|
height: 40px;
|
|
782
794
|
padding: 6px 15px;
|
|
783
|
-
border: 1px solid var(--sw-
|
|
795
|
+
border: 1px solid var(--sw-secondary-bg-text);
|
|
784
796
|
border-radius: var(--sw-radius);
|
|
785
797
|
align-content: center;
|
|
786
798
|
}
|
|
@@ -849,6 +861,13 @@ padding-inline-start: 25px;
|
|
|
849
861
|
gap: 8px;
|
|
850
862
|
height: 40px;
|
|
851
863
|
}
|
|
864
|
+
.sw-srh-round-text .sw-tab-content{
|
|
865
|
+
color: var(--sw-secondary-bg-text);
|
|
866
|
+
}
|
|
867
|
+
.sw-advanced-search-options .p-accordion-header-text,
|
|
868
|
+
.sw-card-box .p-accordion-toggle-icon{
|
|
869
|
+
color: var(--sw-secondary-bg-text);
|
|
870
|
+
}
|
|
852
871
|
.sw-remove-segment{
|
|
853
872
|
fill: var(--primary);
|
|
854
873
|
cursor: pointer;
|
|
@@ -894,14 +913,14 @@ padding-inline-start: 25px;
|
|
|
894
913
|
gap: 7px;
|
|
895
914
|
margin-inline-start: 5px;
|
|
896
915
|
padding: 8px 10px;
|
|
897
|
-
|
|
916
|
+
background-color: var(--primary);
|
|
898
917
|
border-radius: 30px;
|
|
899
|
-
|
|
900
|
-
color: var(--primary);
|
|
918
|
+
color: var(--sw-white);
|
|
901
919
|
font-size: 14px;
|
|
920
|
+
cursor: pointer;
|
|
902
921
|
}
|
|
903
922
|
.sw-srh-mc .sw-srh-mc-foot button svg {
|
|
904
|
-
fill: var(--
|
|
923
|
+
fill: var(--sw-white);
|
|
905
924
|
}
|
|
906
925
|
.sw-srh-mc .sw-srh-add-btn {
|
|
907
926
|
display: flex;
|
|
@@ -909,9 +928,9 @@ padding-inline-start: 25px;
|
|
|
909
928
|
gap: 7px;
|
|
910
929
|
margin-inline-start: 5px;
|
|
911
930
|
padding: 0.8rem 1rem;
|
|
931
|
+
border: 0;
|
|
912
932
|
border-radius: 30px;
|
|
913
933
|
color: var(--primary);
|
|
914
|
-
font-size: 1.4rem;
|
|
915
934
|
}
|
|
916
935
|
.sw-srh-mc .sw-traveller {
|
|
917
936
|
grid-row-start: 1;
|
|
@@ -986,7 +1005,7 @@ padding-inline-start: 25px;
|
|
|
986
1005
|
font-weight: 400;
|
|
987
1006
|
}
|
|
988
1007
|
.sw-srh-button-wrapper button.sw-active-button {
|
|
989
|
-
background-color: var(--
|
|
1008
|
+
background-color: var(--primary);
|
|
990
1009
|
color: var(--sw-white);
|
|
991
1010
|
}
|
|
992
1011
|
.sw-traveller .sw-rooms-guests-menu {
|
|
@@ -1286,12 +1305,12 @@ padding-inline-start: 25px;
|
|
|
1286
1305
|
.sw-srh-mc .sw-srh-mc-foot{
|
|
1287
1306
|
margin: 10px 0;
|
|
1288
1307
|
}
|
|
1289
|
-
.sw-srh-mc .sw-srh-wrap:nth-child(3){
|
|
1290
|
-
flex-direction: row;
|
|
1291
|
-
}
|
|
1292
1308
|
.sw-container .sw-search-button{
|
|
1293
1309
|
border-radius: var(--sw-btn-radius);
|
|
1294
1310
|
}
|
|
1311
|
+
.sw-fsrh-chk-main{
|
|
1312
|
+
flex-wrap: wrap;
|
|
1313
|
+
}
|
|
1295
1314
|
}
|
|
1296
1315
|
`;
|
|
1297
1316
|
|
|
@@ -1591,8 +1610,12 @@ function FlightSearchWidget({
|
|
|
1591
1610
|
}
|
|
1592
1611
|
return updated;
|
|
1593
1612
|
});
|
|
1613
|
+
setValidationErrors((prev) => ({
|
|
1614
|
+
...prev,
|
|
1615
|
+
[segmentIndex]: { ...prev[segmentIndex] ?? {}, [dropdownType]: false }
|
|
1616
|
+
}));
|
|
1594
1617
|
closeAirportDropdown(dropdownType, segmentIndex);
|
|
1595
|
-
}, [closeAirportDropdown]);
|
|
1618
|
+
}, [closeAirportDropdown, tripType]);
|
|
1596
1619
|
const updateSelectedIndex = useCallback((segmentIndex, dropdownType, newIndex) => {
|
|
1597
1620
|
setPredictiveSearchList((prev) => {
|
|
1598
1621
|
const state = prev[segmentIndex] ?? { fromAirport: [], toAirport: [], selectedFromIndex: -1, selectedToIndex: -1 };
|
|
@@ -2013,6 +2036,14 @@ function FlightSearchWidget({
|
|
|
2013
2036
|
queryStringObj[`umrah`] = isUmrahFareOption();
|
|
2014
2037
|
return queryStringObj;
|
|
2015
2038
|
};
|
|
2039
|
+
const getNormalizedRedirectionBase = () => {
|
|
2040
|
+
const raw = (redirectionDomain ?? "").trim();
|
|
2041
|
+
if (!raw) return null;
|
|
2042
|
+
if (raw.startsWith("http://") || raw.startsWith("https://")) {
|
|
2043
|
+
return raw.replace(/\/+$/, "");
|
|
2044
|
+
}
|
|
2045
|
+
return `https://${raw.replace(/\/+$/, "")}`;
|
|
2046
|
+
};
|
|
2016
2047
|
const handleSearch = () => {
|
|
2017
2048
|
const queryStringObj = createQueryString();
|
|
2018
2049
|
console.log("Query String Object:", queryStringObj);
|
|
@@ -2032,8 +2063,9 @@ function FlightSearchWidget({
|
|
|
2032
2063
|
}
|
|
2033
2064
|
const queryString = queryParams.toString();
|
|
2034
2065
|
console.log("Query String:", queryString);
|
|
2035
|
-
|
|
2036
|
-
|
|
2066
|
+
const base = getNormalizedRedirectionBase();
|
|
2067
|
+
if (base) {
|
|
2068
|
+
const url = `${base}/flight/listing?${queryString}`;
|
|
2037
2069
|
window.location.href = url;
|
|
2038
2070
|
}
|
|
2039
2071
|
};
|
|
@@ -2092,8 +2124,8 @@ function FlightSearchWidget({
|
|
|
2092
2124
|
isOpen && /* @__PURE__ */ jsxs("div", { className: "sw-dropdown", children: [
|
|
2093
2125
|
/* @__PURE__ */ jsxs("div", { className: "mobileHead MobileShow", children: [
|
|
2094
2126
|
/* @__PURE__ */ jsx("a", { type: "button", onClick: () => closeAirportDropdown(dropdownType, segmentIndex), children: /* @__PURE__ */ jsxs("svg", { width: "20px", height: "20px", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
2095
|
-
/* @__PURE__ */ jsx("path", { d: "M19 5L5 19", stroke: "black",
|
|
2096
|
-
/* @__PURE__ */ jsx("path", { d: "M5 5L19 19", stroke: "black",
|
|
2127
|
+
/* @__PURE__ */ jsx("path", { d: "M19 5L5 19", stroke: "black", strokeWidth: "2", "stroke-linecap": "round", strokeLinejoin: "round" }),
|
|
2128
|
+
/* @__PURE__ */ jsx("path", { d: "M5 5L19 19", stroke: "black", strokeWidth: "2", "stroke-linecap": "round", strokeLinejoin: "round" })
|
|
2097
2129
|
] }) }),
|
|
2098
2130
|
/* @__PURE__ */ jsx("h4", { children: isOrigin ? "Origin" : "Destination" })
|
|
2099
2131
|
] }),
|
|
@@ -2260,7 +2292,7 @@ function FlightSearchWidget({
|
|
|
2260
2292
|
className: "sw-form-swap",
|
|
2261
2293
|
"aria-label": "Swap origin and destination",
|
|
2262
2294
|
onClick: () => swapSegmentLocations(0),
|
|
2263
|
-
children: /* @__PURE__ */ jsx("svg", { width: "30px", height: "30px", fill: "var(--body-text)", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", {
|
|
2295
|
+
children: /* @__PURE__ */ jsx("svg", { width: "30px", height: "30px", fill: "var(--body-text)", viewBox: "0 0 24 24", children: /* @__PURE__ */ 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" }) })
|
|
2264
2296
|
}
|
|
2265
2297
|
),
|
|
2266
2298
|
renderAirportDropdown(0, "destination", destinationDropdownRef, isDestinationDropdownOpen, () => setIsDestinationDropdownOpen(true))
|