@travelswitchhq/flight-search-react 1.2.1 → 1.2.2
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 +27 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.mjs +27 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -57,6 +57,11 @@ type FlightSearchWidgetProps = {
|
|
|
57
57
|
* If {@link countryCode} is set and this is omitted, the locale path segment still uses "EN".
|
|
58
58
|
*/
|
|
59
59
|
languageCode?: string;
|
|
60
|
+
/**
|
|
61
|
+
* ISO 4217 currency code for the `curr` query param (e.g. "INR", "AED").
|
|
62
|
+
* Defaults to `"INR"` when omitted.
|
|
63
|
+
*/
|
|
64
|
+
currency?: string;
|
|
60
65
|
};
|
|
61
66
|
ssoUser?: FlightSearchSsoUser;
|
|
62
67
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -57,6 +57,11 @@ type FlightSearchWidgetProps = {
|
|
|
57
57
|
* If {@link countryCode} is set and this is omitted, the locale path segment still uses "EN".
|
|
58
58
|
*/
|
|
59
59
|
languageCode?: string;
|
|
60
|
+
/**
|
|
61
|
+
* ISO 4217 currency code for the `curr` query param (e.g. "INR", "AED").
|
|
62
|
+
* Defaults to `"INR"` when omitted.
|
|
63
|
+
*/
|
|
64
|
+
currency?: string;
|
|
60
65
|
};
|
|
61
66
|
ssoUser?: FlightSearchSsoUser;
|
|
62
67
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -735,7 +735,7 @@ padding-inline-start: 25px;
|
|
|
735
735
|
gap: 10px;
|
|
736
736
|
width: fit-content;
|
|
737
737
|
margin-top: 15px;
|
|
738
|
-
color: var(--
|
|
738
|
+
color: var(--secondary-bg-text);
|
|
739
739
|
font-size: 14px;
|
|
740
740
|
}
|
|
741
741
|
.sw-advanced-search-options .p-toggleable-content {
|
|
@@ -847,9 +847,6 @@ padding-inline-start: 25px;
|
|
|
847
847
|
max-width: 100%;
|
|
848
848
|
height: auto;
|
|
849
849
|
}
|
|
850
|
-
.sw-container {
|
|
851
|
-
isolation: isolate;
|
|
852
|
-
}
|
|
853
850
|
.sw-srh-grid {
|
|
854
851
|
display: grid;
|
|
855
852
|
grid-template-columns: minmax(200px, 2fr) minmax(100px, 1fr) minmax(80px, 0.6fr) minmax(60px, 0.4fr);
|
|
@@ -1495,6 +1492,7 @@ function FlightSearchWidget({
|
|
|
1495
1492
|
const airlineSearchApiBaseUrl = urls.airline;
|
|
1496
1493
|
const countryCodeConfig = (config?.countryCode ?? "").trim();
|
|
1497
1494
|
const languageCodeConfig = (config?.languageCode ?? "").trim();
|
|
1495
|
+
const currencyCodeConfig = (config?.currency ?? "INR").trim().toUpperCase();
|
|
1498
1496
|
const langCode = languageCodeConfig || "en";
|
|
1499
1497
|
const [airlineQuery, setAirlineQuery] = useState("");
|
|
1500
1498
|
const [airlineSuggestions, setAirlineSuggestions] = useState([]);
|
|
@@ -1770,6 +1768,29 @@ function FlightSearchWidget({
|
|
|
1770
1768
|
},
|
|
1771
1769
|
[primaryColor, secondaryColor, primaryLightColor, secondaryBgText]
|
|
1772
1770
|
);
|
|
1771
|
+
const isAnyAirportDropdownOpen = useMemo(() => {
|
|
1772
|
+
if (isOriginDropdownOpen || isDestinationDropdownOpen || isRoomsGuestsMenuOpen) return true;
|
|
1773
|
+
return Object.values(segmentDropdowns).some(
|
|
1774
|
+
(entry) => Boolean(entry?.origin || entry?.destination)
|
|
1775
|
+
);
|
|
1776
|
+
}, [isOriginDropdownOpen, isDestinationDropdownOpen, isRoomsGuestsMenuOpen, segmentDropdowns]);
|
|
1777
|
+
useEffect(() => {
|
|
1778
|
+
if (typeof document === "undefined" || typeof window === "undefined") return;
|
|
1779
|
+
const mobileQuery = window.matchMedia("(max-width: 1024px)");
|
|
1780
|
+
const syncOverflow = () => {
|
|
1781
|
+
if (!mobileQuery.matches) {
|
|
1782
|
+
document.documentElement.style.overflow = "";
|
|
1783
|
+
return;
|
|
1784
|
+
}
|
|
1785
|
+
document.documentElement.style.overflow = isAnyAirportDropdownOpen ? "hidden" : "auto";
|
|
1786
|
+
};
|
|
1787
|
+
syncOverflow();
|
|
1788
|
+
mobileQuery.addEventListener("change", syncOverflow);
|
|
1789
|
+
return () => {
|
|
1790
|
+
mobileQuery.removeEventListener("change", syncOverflow);
|
|
1791
|
+
document.documentElement.style.overflow = "";
|
|
1792
|
+
};
|
|
1793
|
+
}, [isAnyAirportDropdownOpen]);
|
|
1773
1794
|
useEffect(() => {
|
|
1774
1795
|
ensureStylesInjected();
|
|
1775
1796
|
ensurePrimeIconsLoaded();
|
|
@@ -2102,7 +2123,7 @@ function FlightSearchWidget({
|
|
|
2102
2123
|
queryStringObj[`airlines`] = advancedOptions.preferredAirlineList.join(",") || "";
|
|
2103
2124
|
queryStringObj[`ref`] = advancedOptions.isRefundable;
|
|
2104
2125
|
queryStringObj[`lc`] = (langCode ?? "en").toUpperCase();
|
|
2105
|
-
queryStringObj[`curr`] =
|
|
2126
|
+
queryStringObj[`curr`] = currencyCodeConfig;
|
|
2106
2127
|
queryStringObj[`mgcc`] = "AE";
|
|
2107
2128
|
queryStringObj["ipc"] = isFlexiDateOption();
|
|
2108
2129
|
queryStringObj[`umrah`] = isUmrahFareOption();
|
|
@@ -2426,7 +2447,7 @@ function FlightSearchWidget({
|
|
|
2426
2447
|
/* @__PURE__ */ jsx("div", { className: "sw-srh-main-head", children: /* @__PURE__ */ jsx("div", { className: "sw-srh-head", children: /* @__PURE__ */ jsx("div", { className: "sw-srh-round-text", children: [
|
|
2427
2448
|
{ value: "round-trip", label: "Round-trip" },
|
|
2428
2449
|
{ value: "one-way", label: "One-way" },
|
|
2429
|
-
{ value: "custom-search", label: "Custom Search" },
|
|
2450
|
+
// { value: "custom-search", label: "Custom Search" },
|
|
2430
2451
|
{ value: "multi-city", label: "Multi-city" }
|
|
2431
2452
|
].map((option) => /* @__PURE__ */ jsxs("label", { className: "sw-tab-checkbox", children: [
|
|
2432
2453
|
/* @__PURE__ */ jsx(
|