@travelswitchhq/flight-search-react 1.0.4 → 1.0.6

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 CHANGED
@@ -244,7 +244,7 @@ var flightSearchWidgetStyles = `
244
244
  border-radius: 50%;
245
245
  background-color: #fff;
246
246
  cursor: pointer;
247
- transform: translate(-50%, -50%);
247
+ transform: translate(50%, -50%);
248
248
  }
249
249
  .sw-srh-wrap.sw-srh-box.sw-pos-rel .sw-form-field.sw-pos-rel:last-child {
250
250
  padding-inline-start: 25px;
@@ -794,7 +794,7 @@ padding-inline-start: 25px;
794
794
  -webkit-user-select: none;
795
795
  user-select: none;
796
796
  }
797
- .sw-tab-checkbox input {
797
+ .sw-container .sw-tab-checkbox input {
798
798
  display: none;
799
799
  }
800
800
  .sw-tab-checkbox input:checked + .sw-tab-content,
@@ -1295,7 +1295,7 @@ padding-inline-start: 25px;
1295
1295
  .sw-rooms-guests-title{
1296
1296
  display: none !important;
1297
1297
  }
1298
- .sw-rooms-guests-content{
1298
+ .sw-rooms-gst-content{
1299
1299
  padding: 15px;
1300
1300
  }
1301
1301
  .sw-rooms-guests-footer{
@@ -1323,6 +1323,16 @@ padding-inline-start: 25px;
1323
1323
 
1324
1324
  // src/Flight.tsx
1325
1325
  var import_jsx_runtime = require("react/jsx-runtime");
1326
+ var API_URLS = {
1327
+ dev: {
1328
+ airport: "https://adminapi-go.dev.futuretravelplatform.com/api",
1329
+ airline: "https://adminapi.dev.futuretravelplatform.com/api"
1330
+ },
1331
+ prod: {
1332
+ airport: "https://adminapi-go.futuretravelplatform.com/api",
1333
+ airline: "https://adminapi.futuretravelplatform.com/api"
1334
+ }
1335
+ };
1326
1336
  var normalizeDomainName = (domainName) => {
1327
1337
  const trimmed = domainName.trim();
1328
1338
  if (!trimmed) return "";
@@ -1446,8 +1456,10 @@ function FlightSearchWidget({
1446
1456
  const primaryLightColor = theme?.primaryLight ?? "#f3e2ff";
1447
1457
  const fontName = config?.fontName;
1448
1458
  const redirectionDomain = config?.redirectionDomain;
1449
- const airportSearchApiBaseUrl = "https://adminapi-go.dev.futuretravelplatform.com/api";
1450
- const airlineSearchApiBaseUrl = "https://adminapi.dev.futuretravelplatform.com/api";
1459
+ const env = config?.env ?? "dev";
1460
+ const urls = API_URLS[env];
1461
+ const airportSearchApiBaseUrl = urls.airport;
1462
+ const airlineSearchApiBaseUrl = urls.airline;
1451
1463
  const langCode = "en";
1452
1464
  const [airlineQuery, setAirlineQuery] = (0, import_react.useState)("");
1453
1465
  const [airlineSuggestions, setAirlineSuggestions] = (0, import_react.useState)([]);
@@ -2046,7 +2058,7 @@ function FlightSearchWidget({
2046
2058
  console.log("Query String:", queryString);
2047
2059
  if (redirectionDomain) {
2048
2060
  const url = `${redirectionDomain}/flight/listing?${queryString}`;
2049
- window.open(url, "_blank");
2061
+ window.location.href = url;
2050
2062
  }
2051
2063
  };
2052
2064
  const handleSubmit = (e) => {
@@ -2102,14 +2114,14 @@ function FlightSearchWidget({
2102
2114
  }
2103
2115
  ),
2104
2116
  isOpen && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "sw-dropdown", children: [
2105
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "mobileHead mobileShow", children: [
2117
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "mobileHead MobileShow", children: [
2106
2118
  /* @__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: [
2107
2119
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M19 5L5 19", stroke: "black", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }),
2108
2120
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M5 5L19 19", stroke: "black", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" })
2109
2121
  ] }) }),
2110
2122
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h4", { children: isOrigin ? "Origin" : "Destination" })
2111
2123
  ] }),
2112
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "mobileSrgInput mobileShow", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { type: "text", placeholder: `Search ${isOrigin ? "Origin" : "Destination"}`, value: value ?? "", onChange: (e) => {
2124
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "mobileSrgInput MobileShow", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { type: "text", placeholder: `Search ${isOrigin ? "Origin" : "Destination"}`, value: value ?? "", onChange: (e) => {
2113
2125
  const val = e.target.value;
2114
2126
  handleSegmentFieldChange(segmentIndex, dropdownType, val);
2115
2127
  triggerSearchAirport(segmentIndex, dropdownType, val);
@@ -2206,7 +2218,29 @@ function FlightSearchWidget({
2206
2218
  dateFormat: "dd M yy",
2207
2219
  placeholder: "29 Jan 2026",
2208
2220
  className: "p-inputtext-sm MobileShow",
2209
- minDate: getMinDateForSegment(index)
2221
+ minDate: getMinDateForSegment(index),
2222
+ headerTemplate: () => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "mobileHead MobileShow", children: [
2223
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { type: "button", onClick: (e) => {
2224
+ e.stopPropagation();
2225
+ mobileDateRangeCalendarRef.current?.hide?.();
2226
+ }, 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: [
2227
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M19 5L5 19", stroke: "black", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
2228
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M5 5L19 19", stroke: "black", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })
2229
+ ] }) }),
2230
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h4", { children: "Departure" })
2231
+ ] }),
2232
+ footerTemplate: () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "mobileFooter MobileShow", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
2233
+ "button",
2234
+ {
2235
+ type: "button",
2236
+ className: "sw-confirm-btn",
2237
+ onClick: (e) => {
2238
+ e.stopPropagation();
2239
+ mobileDateRangeCalendarRef.current?.hide?.();
2240
+ },
2241
+ children: "Confirm"
2242
+ }
2243
+ ) })
2210
2244
  }
2211
2245
  )
2212
2246
  ] }),
@@ -2477,7 +2511,7 @@ function FlightSearchWidget({
2477
2511
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h4", { children: "Number of Travellers" })
2478
2512
  ] }),
2479
2513
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { className: "sw-rooms-guests-title", children: "Number of Travellers" }),
2480
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "sw-rooms-guests-content", children: [
2514
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "sw-rooms-gst-content", children: [
2481
2515
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "sw-srh-pax", children: [
2482
2516
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "sw-srh-common-adult", children: [
2483
2517
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { children: "Adults" }),