@odynn/awayz-flights 0.7.4 → 0.7.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.
@@ -193,6 +193,7 @@ export interface IFlightOffer {
193
193
  amount: number;
194
194
  currency: string;
195
195
  };
196
+ googleUrl: string;
196
197
  }
197
198
  export interface IPaymentRequirements {
198
199
  requiresInstantPayment: boolean;
@@ -47,7 +47,10 @@ export type TPassengerSearchArgs = {
47
47
  } | {
48
48
  age: number;
49
49
  };
50
- export type TOneWayCashOnlyFlightSearchResponse = TApiResponse<IBaseFlightCashSearchData, ISearchLimitResponse>;
50
+ export type TOneWayCashOnlyFlightSearchResponse = TApiResponse<{
51
+ flights: IBaseFlightCashSearchData[];
52
+ search_limits: ISearchLimitResponse;
53
+ }, {}>;
51
54
  export interface IBaseFlightCashSearchData {
52
55
  client_key: string;
53
56
  offers: IFlightOfferResponse[];
@@ -1,13 +1,13 @@
1
- var m = Object.defineProperty;
2
- var _ = (c, s, a) => s in c ? m(c, s, { enumerable: !0, configurable: !0, writable: !0, value: a }) : c[s] = a;
3
- var o = (c, s, a) => _(c, typeof s != "symbol" ? s + "" : s, a);
1
+ var g = Object.defineProperty;
2
+ var p = (c, s, a) => s in c ? g(c, s, { enumerable: !0, configurable: !0, writable: !0, value: a }) : c[s] = a;
3
+ var o = (c, s, a) => p(c, typeof s != "symbol" ? s + "" : s, a);
4
4
  import { clientInstance as d } from "@odynn/awayz-core";
5
5
  import "../../moment-BGjjqtLQ.js";
6
6
  import "../../arrayExtensions-DFLvtO8l.js";
7
7
  import { c as f } from "../../objectUtils-CyIaVmog.js";
8
8
  import "react";
9
9
  import { EFlightEndpoint as i } from "../../constants/endpoints.js";
10
- class r {
10
+ class y {
11
11
  constructor() {
12
12
  o(this, "getAirports", async (s) => {
13
13
  try {
@@ -41,28 +41,31 @@ class r {
41
41
  }
42
42
  });
43
43
  o(this, "cashOnlySearch", async (s) => {
44
- var a, n, e, u;
44
+ var a, n, e, u, m, _;
45
45
  try {
46
46
  const { data: t } = await d.post(
47
47
  i.CASH_FLIGHT_SEARCH,
48
48
  s
49
49
  );
50
- return t.success ? {
50
+ if (!t.success)
51
+ return {
52
+ success: !1,
53
+ message: t.message
54
+ };
55
+ const r = ((n = (a = t.data) == null ? void 0 : a.flights) == null ? void 0 : n.flatMap(
56
+ (l) => l.offers
57
+ )) ?? [];
58
+ return {
51
59
  success: !0,
52
- data: f(
53
- t.data.offers
54
- )
55
- } : {
56
- success: !1,
57
- message: t.message
60
+ data: f(r)
58
61
  };
59
62
  } catch (t) {
60
63
  return console.error(JSON.stringify(t)), t.message === "canceled" ? {
61
64
  success: !1,
62
- message: ((n = (a = t == null ? void 0 : t.response) == null ? void 0 : a.data) == null ? void 0 : n.message) || (t == null ? void 0 : t.message)
65
+ message: ((u = (e = t == null ? void 0 : t.response) == null ? void 0 : e.data) == null ? void 0 : u.message) || (t == null ? void 0 : t.message)
63
66
  } : {
64
67
  success: !1,
65
- message: ((u = (e = t == null ? void 0 : t.response) == null ? void 0 : e.data) == null ? void 0 : u.message) || (t == null ? void 0 : t.message)
68
+ message: ((_ = (m = t == null ? void 0 : t.response) == null ? void 0 : m.data) == null ? void 0 : _.message) || (t == null ? void 0 : t.message)
66
69
  };
67
70
  }
68
71
  });
@@ -132,7 +135,7 @@ class r {
132
135
  });
133
136
  }
134
137
  }
135
- const R = new r();
138
+ const A = new y();
136
139
  export {
137
- R as FlightService
140
+ A as FlightService
138
141
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@odynn/awayz-flights",
3
- "version": "0.7.4",
3
+ "version": "0.7.6",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"