@odynn/awayz-flights 0.10.8 → 0.10.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.
@@ -0,0 +1,155 @@
1
+ var p = Object.defineProperty;
2
+ var g = (t, s, a) => s in t ? p(t, s, { enumerable: !0, configurable: !0, writable: !0, value: a }) : t[s] = a;
3
+ var u = (t, s, a) => g(t, typeof s != "symbol" ? s + "" : s, a);
4
+ import { clientInstance as o } from "@odynn/awayz-core";
5
+ import "react/jsx-runtime";
6
+ import "./moment-BGjjqtLQ.js";
7
+ import "./arrayExtensions-Ce8YopTP.js";
8
+ import "react";
9
+ import { EFlightEndpoint as d } from "./constants/endpoints.js";
10
+ const r = (t) => Array.isArray(t) ? t.map((s) => r(s)) : typeof t == "object" && t !== null ? Object.keys(t).reduce((s, a) => {
11
+ const c = y(a);
12
+ return s[c] = r(t[a]), s;
13
+ }, {}) : t, y = (t) => (t = t.replace(/^_+/, ""), t.replace(/_([a-z])/gi, (s, a) => a.toUpperCase()));
14
+ class h {
15
+ constructor() {
16
+ u(this, "getAirports", async (s) => {
17
+ try {
18
+ const { data: a } = await o.get(
19
+ `${d.GET_AIRPORTS}?search_term=${s}`
20
+ );
21
+ return a.data.map((e) => {
22
+ var i;
23
+ return {
24
+ city: {
25
+ name: e.city_name,
26
+ code: e.iata_city_code
27
+ },
28
+ coordinates: {
29
+ latitude: e.latitude,
30
+ longitude: e.longitude
31
+ },
32
+ country: {
33
+ code: e.iata_country_code,
34
+ name: (i = e.country) == null ? void 0 : i.name
35
+ },
36
+ name: e.name,
37
+ iataCode: e.iata_code,
38
+ id: e.id,
39
+ type: e.type,
40
+ label: `${e.iata_code} - ${e.name}`
41
+ };
42
+ });
43
+ } catch {
44
+ return [];
45
+ }
46
+ });
47
+ u(this, "cashOnlySearch", async (s) => {
48
+ var a, c, e, i, f, m;
49
+ try {
50
+ const { data: n } = await o.post(
51
+ d.CASH_FLIGHT_SEARCH,
52
+ s
53
+ );
54
+ if (!n.success)
55
+ return {
56
+ success: !1,
57
+ message: n.message
58
+ };
59
+ const l = ((c = (a = n.data) == null ? void 0 : a.flights) == null ? void 0 : c.flatMap(
60
+ (_) => _.offers
61
+ )) ?? [];
62
+ return {
63
+ success: !0,
64
+ data: r(l)
65
+ };
66
+ } catch (n) {
67
+ return console.error(JSON.stringify(n)), n.message === "canceled" ? {
68
+ success: !1,
69
+ message: ((i = (e = n == null ? void 0 : n.response) == null ? void 0 : e.data) == null ? void 0 : i.message) || (n == null ? void 0 : n.message)
70
+ } : {
71
+ success: !1,
72
+ message: ((m = (f = n == null ? void 0 : n.response) == null ? void 0 : f.data) == null ? void 0 : m.message) || (n == null ? void 0 : n.message)
73
+ };
74
+ }
75
+ });
76
+ u(this, "roundTripOutboundSearch", async (s) => {
77
+ var a, c;
78
+ try {
79
+ const { data: e } = await o.post(
80
+ d.CASH_OUTBOUND_SEARCH,
81
+ { ...s, to: s.return_date, from: s.departure_date }
82
+ );
83
+ if (!e.success) throw e;
84
+ return {
85
+ success: e.success,
86
+ data: r(e.data)
87
+ };
88
+ } catch (e) {
89
+ return {
90
+ success: !1,
91
+ message: ((c = (a = e == null ? void 0 : e.response) == null ? void 0 : a.data) == null ? void 0 : c.message) || (e == null ? void 0 : e.message)
92
+ };
93
+ }
94
+ });
95
+ u(this, "roundTripInboundSearch", async (s) => {
96
+ var a, c;
97
+ try {
98
+ const { data: e } = await o.get(
99
+ d.CASH_INBOUND_SEARCH,
100
+ {
101
+ params: {
102
+ outbound_offer_id: s.outboundOfferId,
103
+ outbound_offer_request_id: s.outboundOfferRequestId,
104
+ cabin_class: s.cabinClass
105
+ }
106
+ }
107
+ );
108
+ if (!e.success) throw e;
109
+ return r(e);
110
+ } catch (e) {
111
+ return {
112
+ success: !1,
113
+ message: ((c = (a = e == null ? void 0 : e.response) == null ? void 0 : a.data) == null ? void 0 : c.message) || (e == null ? void 0 : e.message)
114
+ };
115
+ }
116
+ });
117
+ u(this, "getRoundTripFares", async (s) => {
118
+ var a, c;
119
+ try {
120
+ const { data: e } = await o.get(
121
+ d.ROUND_TRIP_FARES,
122
+ {
123
+ params: {
124
+ outbound_offer_id: s.outboundOfferId,
125
+ outbound_offer_request_id: s.outboundOfferRequestId,
126
+ inbound_offer_id: s.inboundOfferId,
127
+ cabin_class: s.cabinClass
128
+ }
129
+ }
130
+ );
131
+ if (!e.success) throw e;
132
+ return e;
133
+ } catch (e) {
134
+ return console.error(JSON.stringify(e)), {
135
+ success: !1,
136
+ message: ((c = (a = e == null ? void 0 : e.response) == null ? void 0 : a.data) == null ? void 0 : c.message) || (e == null ? void 0 : e.message)
137
+ };
138
+ }
139
+ });
140
+ u(this, "getSupportedAirlinePrograms", async () => {
141
+ const { data: s } = await o.get(
142
+ d.SUPPORTED_AIRLINE_PROGRAMS
143
+ );
144
+ if (!s.success) throw s;
145
+ return s.data.reward_programs.map(
146
+ (a) => a.long_name
147
+ );
148
+ });
149
+ }
150
+ }
151
+ const T = new h();
152
+ export {
153
+ T as F,
154
+ r as c
155
+ };
@@ -10,7 +10,7 @@ import { d as X, e as O, f as V, g as oo } from "../../index-B9NLqDyM.js";
10
10
  import { EPaymentType as P } from "../../enums/EPaymentType.js";
11
11
  import { EBaggage as I } from "../../hooks/useFlightSearch/useFlightSearch.types.js";
12
12
  import { getAirlineProgram as ro, formatCabinClass as no } from "../../utils/flightUtils.js";
13
- import '../../assets/BookingOption.css';const U = (i, l, e = l + "s") => i === 1 ? l : e, eo = (i) => i ? i.toLowerCase().replace(/-/g, " ").split(" ").map((l) => l.charAt(0).toUpperCase() + l.slice(1)).join(" ") : "", to = "USD";
13
+ import '../../assets/BookingOption.css';const eo = "USD", U = (i, l, e = l + "s") => i === 1 ? l : e, to = (i) => i ? i.toLowerCase().replace(/-/g, " ").split(" ").map((l) => l.charAt(0).toUpperCase() + l.slice(1)).join(" ") : "";
14
14
  function w(i) {
15
15
  return J({ attr: { viewBox: "0 0 352 512" }, child: [{ tag: "path", attr: { d: "M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z" }, child: [] }] })(i);
16
16
  }
@@ -48,7 +48,7 @@ const No = ({
48
48
  children: [
49
49
  /* @__PURE__ */ n("div", { className: "rate-details", children: [
50
50
  i === P.POINTS && /* @__PURE__ */ o("img", { src: D == null ? void 0 : D.programLogo }),
51
- /* @__PURE__ */ o("p", { className: "fare-brand-name", children: eo(l) })
51
+ /* @__PURE__ */ o("p", { className: "fare-brand-name", children: to(l) })
52
52
  ] }),
53
53
  i === P.CASH && /* @__PURE__ */ n("div", { className: "fare-comparison-content", children: [
54
54
  h == null ? void 0 : h.map((r, C) => /* @__PURE__ */ n(K.Fragment, { children: [
@@ -179,7 +179,7 @@ const No = ({
179
179
  u,
180
180
  {
181
181
  amount: (p == null ? void 0 : p.amount) || 0,
182
- currency: (p == null ? void 0 : p.currency) || to,
182
+ currency: (p == null ? void 0 : p.currency) || eo,
183
183
  position: y.LEFT,
184
184
  customDisplay: "No fee",
185
185
  zeroDisplayOption: f.CUSTOM
@@ -1,10 +1,11 @@
1
1
  import { useQuery as s } from "@tanstack/react-query";
2
- import { FlightService as n } from "../../services/flights/FlightsService.js";
2
+ import { F as m } from "../../FlightsService-BgXzj6SR.js";
3
+ import "react/jsx-runtime";
3
4
  import "../../moment-BGjjqtLQ.js";
4
5
  import "../../arrayExtensions-Ce8YopTP.js";
5
- import { useState as m, useEffect as a } from "react";
6
- const c = 500, u = (t, r = c) => {
7
- const [e, o] = m(t);
6
+ import { useState as n, useEffect as a } from "react";
7
+ const c = 500, p = (t, r = c) => {
8
+ const [e, o] = n(t);
8
9
  return a(() => {
9
10
  const i = setTimeout(() => {
10
11
  o(t);
@@ -13,10 +14,10 @@ const c = 500, u = (t, r = c) => {
13
14
  clearTimeout(i);
14
15
  };
15
16
  }, [t, r]), e;
16
- }, l = (t) => {
17
- const r = u(t), { data: e, isLoading: o, error: i } = s({
17
+ }, y = (t) => {
18
+ const r = p(t), { data: e, isLoading: o, error: i } = s({
18
19
  queryKey: ["airports", r],
19
- queryFn: () => n.getAirports(t),
20
+ queryFn: () => m.getAirports(t),
20
21
  enabled: !!t && t.length > 2
21
22
  });
22
23
  return {
@@ -26,5 +27,5 @@ const c = 500, u = (t, r = c) => {
26
27
  };
27
28
  };
28
29
  export {
29
- l as useAirportSearch
30
+ y as useAirportSearch
30
31
  };
@@ -1,10 +1,10 @@
1
1
  import { useAwayzContext as Nt, awayzClient as Z, getBaseUrl as _t } from "@odynn/awayz-core";
2
2
  import { useQuery as Pt, useMutation as me } from "@tanstack/react-query";
3
+ import "react/jsx-runtime";
3
4
  import "../../moment-BGjjqtLQ.js";
4
5
  import "../../arrayExtensions-Ce8YopTP.js";
5
- import { c as Ue } from "../../objectUtils-3IeCVocm.js";
6
+ import { F as V, c as Ue } from "../../FlightsService-BgXzj6SR.js";
6
7
  import { useState as be, useRef as xt } from "react";
7
- import { FlightService as V } from "../../services/flights/FlightsService.js";
8
8
  import It from "../../stores/useFlightStore.js";
9
9
  import { EFlightType as Ze, EFlightPaymentType as Q } from "../../types/enums.js";
10
10
  import { ECabinClass as Ft } from "../../types/ECabinClass.js";
@@ -0,0 +1,21 @@
1
+ import { IAirlineProgram, IBankProgram, IHotelProgram, IRewardProgramResponse, IUserCard, IUserCardResponse } from './WalletService.types';
2
+ /**
3
+ * Map API response to IHotelProgram.
4
+ */
5
+ export declare const mapHotelProgram: (program: IRewardProgramResponse) => IHotelProgram;
6
+ /**
7
+ * Map API response to IBankProgram.
8
+ */
9
+ export declare const mapBankProgram: (program: IRewardProgramResponse & {
10
+ region?: string;
11
+ }) => IBankProgram;
12
+ /**
13
+ * Map API response to IAirlineProgram.
14
+ */
15
+ export declare const mapAirlineProgram: (program: IRewardProgramResponse & {
16
+ url?: string;
17
+ }) => IAirlineProgram;
18
+ /**
19
+ * Map API user card response to IUserCard.
20
+ */
21
+ export declare const mapUserCard: (card: IUserCardResponse) => IUserCard;
@@ -1,150 +1,10 @@
1
- var g = Object.defineProperty;
2
- var p = (o, s, a) => s in o ? g(o, s, { enumerable: !0, configurable: !0, writable: !0, value: a }) : o[s] = a;
3
- var c = (o, s, a) => p(o, typeof s != "symbol" ? s + "" : s, a);
4
- import { clientInstance as u } from "@odynn/awayz-core";
1
+ import "@odynn/awayz-core";
2
+ import "react/jsx-runtime";
5
3
  import "../../moment-BGjjqtLQ.js";
6
4
  import "../../arrayExtensions-Ce8YopTP.js";
7
- import { c as f } from "../../objectUtils-3IeCVocm.js";
5
+ import { F as a } from "../../FlightsService-BgXzj6SR.js";
8
6
  import "react";
9
- import { EFlightEndpoint as d } from "../../constants/endpoints.js";
10
- class y {
11
- constructor() {
12
- c(this, "getAirports", async (s) => {
13
- try {
14
- const { data: a } = await u.get(
15
- `${d.GET_AIRPORTS}?search_term=${s}`
16
- );
17
- return a.data.map((e) => {
18
- var i;
19
- return {
20
- city: {
21
- name: e.city_name,
22
- code: e.iata_city_code
23
- },
24
- coordinates: {
25
- latitude: e.latitude,
26
- longitude: e.longitude
27
- },
28
- country: {
29
- code: e.iata_country_code,
30
- name: (i = e.country) == null ? void 0 : i.name
31
- },
32
- name: e.name,
33
- iataCode: e.iata_code,
34
- id: e.id,
35
- type: e.type,
36
- label: `${e.iata_code} - ${e.name}`
37
- };
38
- });
39
- } catch {
40
- return [];
41
- }
42
- });
43
- c(this, "cashOnlySearch", async (s) => {
44
- var a, n, e, i, m, r;
45
- try {
46
- const { data: t } = await u.post(
47
- d.CASH_FLIGHT_SEARCH,
48
- s
49
- );
50
- if (!t.success)
51
- return {
52
- success: !1,
53
- message: t.message
54
- };
55
- const _ = ((n = (a = t.data) == null ? void 0 : a.flights) == null ? void 0 : n.flatMap(
56
- (l) => l.offers
57
- )) ?? [];
58
- return {
59
- success: !0,
60
- data: f(_)
61
- };
62
- } catch (t) {
63
- return console.error(JSON.stringify(t)), t.message === "canceled" ? {
64
- success: !1,
65
- message: ((i = (e = t == null ? void 0 : t.response) == null ? void 0 : e.data) == null ? void 0 : i.message) || (t == null ? void 0 : t.message)
66
- } : {
67
- success: !1,
68
- message: ((r = (m = t == null ? void 0 : t.response) == null ? void 0 : m.data) == null ? void 0 : r.message) || (t == null ? void 0 : t.message)
69
- };
70
- }
71
- });
72
- c(this, "roundTripOutboundSearch", async (s) => {
73
- var a, n;
74
- try {
75
- const { data: e } = await u.post(
76
- d.CASH_OUTBOUND_SEARCH,
77
- { ...s, to: s.return_date, from: s.departure_date }
78
- );
79
- if (!e.success) throw e;
80
- return {
81
- success: e.success,
82
- data: f(e.data)
83
- };
84
- } catch (e) {
85
- return {
86
- success: !1,
87
- message: ((n = (a = e == null ? void 0 : e.response) == null ? void 0 : a.data) == null ? void 0 : n.message) || (e == null ? void 0 : e.message)
88
- };
89
- }
90
- });
91
- c(this, "roundTripInboundSearch", async (s) => {
92
- var a, n;
93
- try {
94
- const { data: e } = await u.get(
95
- d.CASH_INBOUND_SEARCH,
96
- {
97
- params: {
98
- outbound_offer_id: s.outboundOfferId,
99
- outbound_offer_request_id: s.outboundOfferRequestId,
100
- cabin_class: s.cabinClass
101
- }
102
- }
103
- );
104
- if (!e.success) throw e;
105
- return f(e);
106
- } catch (e) {
107
- return {
108
- success: !1,
109
- message: ((n = (a = e == null ? void 0 : e.response) == null ? void 0 : a.data) == null ? void 0 : n.message) || (e == null ? void 0 : e.message)
110
- };
111
- }
112
- });
113
- c(this, "getRoundTripFares", async (s) => {
114
- var a, n;
115
- try {
116
- const { data: e } = await u.get(
117
- d.ROUND_TRIP_FARES,
118
- {
119
- params: {
120
- outbound_offer_id: s.outboundOfferId,
121
- outbound_offer_request_id: s.outboundOfferRequestId,
122
- inbound_offer_id: s.inboundOfferId,
123
- cabin_class: s.cabinClass
124
- }
125
- }
126
- );
127
- if (!e.success) throw e;
128
- return e;
129
- } catch (e) {
130
- return console.error(JSON.stringify(e)), {
131
- success: !1,
132
- message: ((n = (a = e == null ? void 0 : e.response) == null ? void 0 : a.data) == null ? void 0 : n.message) || (e == null ? void 0 : e.message)
133
- };
134
- }
135
- });
136
- c(this, "getSupportedAirlinePrograms", async () => {
137
- const { data: s } = await u.get(
138
- d.SUPPORTED_AIRLINE_PROGRAMS
139
- );
140
- if (!s.success) throw s;
141
- return s.data.reward_programs.map(
142
- (a) => a.long_name
143
- );
144
- });
145
- }
146
- }
147
- const C = new y();
7
+ import "../../constants/endpoints.js";
148
8
  export {
149
- C as FlightService
9
+ a as FlightService
150
10
  };
@@ -1,50 +1,47 @@
1
- var d = Object.defineProperty;
2
- var p = (e, r, t) => r in e ? d(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t;
3
- var s = (e, r, t) => p(e, typeof r != "symbol" ? r + "" : r, t);
1
+ var p = Object.defineProperty;
2
+ var c = (e, a, r) => a in e ? p(e, a, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[a] = r;
3
+ var t = (e, a, r) => c(e, typeof a != "symbol" ? a + "" : a, r);
4
+ import { clientInstance as s } from "@odynn/awayz-core";
5
+ import { EWalletEndpoints as n } from "../../constants/endpoints.js";
6
+ import { mapAirlineProgram as d, mapBankProgram as g, mapHotelProgram as R, mapUserCard as u } from "./WalletService.mappers.js";
4
7
  import { ERewardProgramCategories as o } from "./WalletService.types.js";
5
- import { clientInstance as n } from "@odynn/awayz-core";
6
- import "../../moment-BGjjqtLQ.js";
7
- import "../../arrayExtensions-Ce8YopTP.js";
8
- import { c as a } from "../../objectUtils-3IeCVocm.js";
9
- import "react";
10
- import { EWalletEndpoints as i } from "../../constants/endpoints.js";
11
- class u {
8
+ class w {
12
9
  constructor() {
13
- s(this, "getAwards", async () => {
14
- const r = [
10
+ t(this, "getAwards", async () => {
11
+ const a = [
15
12
  o.Hotel,
16
13
  o.Bank,
17
14
  o.Airline
18
15
  ], [
19
- { data: t },
20
- { data: l },
21
- { data: c }
16
+ { data: r },
17
+ { data: i },
18
+ { data: m }
22
19
  ] = await Promise.all(
23
- r.map(
24
- (m) => n.get(i.GET_AWARDS, {
25
- params: { category: m }
20
+ a.map(
21
+ (l) => s.get(n.GET_AWARDS, {
22
+ params: { category: l }
26
23
  })
27
24
  )
28
25
  );
29
26
  return {
30
- hotels: a(t.data),
31
- banks: a(l.data),
32
- airlines: a(c.data)
27
+ hotels: (r.data ?? []).map(R),
28
+ banks: (i.data ?? []).map(g),
29
+ airlines: (m.data ?? []).map(d)
33
30
  };
34
31
  });
35
- s(this, "getUserCards", async () => {
32
+ t(this, "getUserCards", async () => {
36
33
  try {
37
- const { data: r } = await n.get(
38
- i.GET_USER_CARDS
34
+ const { data: a } = await s.get(
35
+ n.GET_USER_CARDS
39
36
  );
40
- return a(r == null ? void 0 : r.data) ?? [];
41
- } catch (r) {
42
- return console.error(JSON.stringify(r)), [];
37
+ return ((a == null ? void 0 : a.data) ?? []).map(u);
38
+ } catch (a) {
39
+ return console.error(JSON.stringify(a)), [];
43
40
  }
44
41
  });
45
42
  }
46
43
  }
47
- const W = new u();
44
+ const P = new w();
48
45
  export {
49
- W as WalletService
46
+ P as WalletService
50
47
  };
@@ -0,0 +1,74 @@
1
+ import { ERewardProgramCategories as n } from "./WalletService.types.js";
2
+ const r = (e) => {
3
+ if (e == null) return 0;
4
+ if (typeof e == "number") return e;
5
+ if (typeof e == "string") {
6
+ const i = parseFloat(e);
7
+ return isNaN(i) ? 0 : i;
8
+ }
9
+ return 0;
10
+ }, o = (e) => ({
11
+ id: e._id,
12
+ mainProgram: e.main_program,
13
+ category: e.category,
14
+ awayzActive: e.awayz_active ?? [],
15
+ totalAccumulatedPoints: r(e.total_accumulated_points),
16
+ displayProgram: e.display_program,
17
+ programLogo: e.program_logo,
18
+ categoryLogo: e.category_logo,
19
+ colour: e.colour
20
+ }), s = (e) => ({
21
+ ...o(e),
22
+ category: n.Hotel
23
+ }), c = (e) => ({
24
+ ...o(e),
25
+ category: n.Bank,
26
+ region: e.region
27
+ }), u = (e) => ({
28
+ ...o(e),
29
+ category: n.Airline,
30
+ url: e.url ?? ""
31
+ }), a = (e) => {
32
+ if (e)
33
+ return {
34
+ id: e._id,
35
+ cardId: e.card_id,
36
+ cardImageUrl: e.card_image_url,
37
+ cardApplicationLink: e.card_application_link,
38
+ active: e.active,
39
+ currentOffer: e.current_offer,
40
+ cardDescription: e.card_description
41
+ };
42
+ }, l = (e) => ({
43
+ bank: e.bank,
44
+ network: e.network,
45
+ id: e._id,
46
+ name: e.name,
47
+ signupBonus: r(e.signupBonus),
48
+ cashBonus: r(e.cashBonus),
49
+ minimumSpend: r(e.minimumSpend),
50
+ daysToSpend: r(e.daysToSpend),
51
+ annualFee: r(e.annual_fee),
52
+ annualFeeWaived: e.annualFeeWaived,
53
+ cashPerks: r(e.cashPerks),
54
+ rewardsCurrency: e.rewards_currency,
55
+ bisCard: e.bisCard,
56
+ chargeCard: e.chargeCard,
57
+ cardFamily: r(e.cardFamily),
58
+ websiteUrl: e.websiteUrl,
59
+ colour: e.colour,
60
+ region: e.region,
61
+ alternateRegions: e.alternateRegions,
62
+ userId: e.user_id,
63
+ cardId: e.card_id,
64
+ activeCard: e.active_card,
65
+ metadata: a(e.metadata),
66
+ transferRatio: 0
67
+ // Not provided in response
68
+ });
69
+ export {
70
+ u as mapAirlineProgram,
71
+ c as mapBankProgram,
72
+ s as mapHotelProgram,
73
+ l as mapUserCard
74
+ };
@@ -1,4 +1,5 @@
1
1
  import { defaultAwayzConfig as Y, awayzClient as Q } from "@odynn/awayz-core";
2
+ import "react/jsx-runtime";
2
3
  import { d as H } from "../dateUtils-Cb9VQiIL.js";
3
4
  import "../arrayExtensions-Ce8YopTP.js";
4
5
  import "react";
@@ -7,7 +8,7 @@ import { EFlightEndpoint as W } from "../constants/endpoints.js";
7
8
  import { mapBaggageType as J } from "../hooks/useFlightSearch/useFlightSearch.types.js";
8
9
  import { WalletService as V } from "../services/wallet/WalletService.js";
9
10
  import { ERewardProgramCategories as X } from "../services/wallet/WalletService.types.js";
10
- const f = "https://assets.duffel.com/img/airlines/for-light-background/full-color-lockup/", ue = (t) => t == null ? void 0 : t.map((e) => {
11
+ const f = "https://assets.duffel.com/img/airlines/for-light-background/full-color-lockup/", ge = (t) => t == null ? void 0 : t.map((e) => {
11
12
  var d, o, c, s, a, u, l, n, r, m, p, g, b, F, A, w, L, D, I, P, T, h, k, O, R, _, v, E, M, $, z, G, Z, S, U, N;
12
13
  const i = se(e);
13
14
  return {
@@ -71,7 +72,7 @@ const f = "https://assets.duffel.com/img/airlines/for-light-background/full-colo
71
72
  }, se = (t) => {
72
73
  var e;
73
74
  return ee((e = t == null ? void 0 : t.slices) == null ? void 0 : e[0]);
74
- }, ge = (t) => !t.operatingCarrier || !t.marketingCarrier ? "" : t.operatingCarrier.iataCode !== t.marketingCarrier.iataCode ? t.operatingCarrier.name : "", ye = ({
75
+ }, ye = (t) => !t.operatingCarrier || !t.marketingCarrier ? "" : t.operatingCarrier.iataCode !== t.marketingCarrier.iataCode ? t.operatingCarrier.name : "", Ce = ({
75
76
  originCode: t,
76
77
  destinationCode: e,
77
78
  dates: i,
@@ -81,7 +82,7 @@ const f = "https://assets.duffel.com/img/airlines/for-light-background/full-colo
81
82
  }) => {
82
83
  let s = `${W.CASH_POINTS_FLIGHT_SEARCH}?`;
83
84
  return s += `origin=${t}`, s += `&destination=${e}`, s += `&departure_dates=[${i.map((a) => `"${a}"`).join(",")}]`, s += `&cabin_class=${d}`, s += `&adults=${o}`, s += `&cash_or_points=[${c}]`, s;
84
- }, te = (t) => t.flightDetails.slices[0].segments.map((i) => K(i)).join("_") + "_" + y(t.departureTime).format("YYYYMMDD"), Ce = (t) => t ? t.replace(/[_-]/g, " ").split(" ").map((e) => e.charAt(0).toUpperCase() + e.slice(1).toLowerCase()).join(" ") : "", be = (t) => {
85
+ }, te = (t) => t.flightDetails.slices[0].segments.map((i) => K(i)).join("_") + "_" + y(t.departureTime).format("YYYYMMDD"), be = (t) => t ? t.replace(/[_-]/g, " ").split(" ").map((e) => e.charAt(0).toUpperCase() + e.slice(1).toLowerCase()).join(" ") : "", Fe = (t) => {
85
86
  const e = {};
86
87
  t.forEach((s) => {
87
88
  var u, l;
@@ -184,7 +185,7 @@ const f = "https://assets.duffel.com/img/airlines/for-light-background/full-colo
184
185
  (u) => u.awayzGroupId === s.awayzGroupId
185
186
  ) || o.length === 0) && c.push(s);
186
187
  }), c;
187
- }, ae = (t) => t ? t.replace(/^0+/, "") : "", Fe = (t) => `https://assets.duffel.com/img/airlines/for-light-background/full-color-logo/${t}.svg`, C = (t) => `${f}${t}.svg`, B = Y.logoFallbackImageUrl, x = {
188
+ }, ae = (t) => t ? t.replace(/^0+/, "") : "", Ae = (t) => `https://assets.duffel.com/img/airlines/for-light-background/full-color-logo/${t}.svg`, C = (t) => `${f}${t}.svg`, B = Y.logoFallbackImageUrl, x = {
188
189
  categoryLogo: B,
189
190
  programLogo: B,
190
191
  awayzActive: [],
@@ -196,7 +197,7 @@ const f = "https://assets.duffel.com/img/airlines/for-light-background/full-colo
196
197
  colour: "#fff",
197
198
  // Using App Foreground Colour
198
199
  url: "https://www.odynn.com"
199
- }, Ae = async (t) => {
200
+ }, we = async (t) => {
200
201
  const { airlines: e } = await Q.ensureQueryData({
201
202
  queryKey: ["walletAwards"],
202
203
  queryFn: V.getAwards,
@@ -266,16 +267,16 @@ const f = "https://assets.duffel.com/img/airlines/for-light-background/full-colo
266
267
  };
267
268
  export {
268
269
  x as DEFAULT_AIRLINE_PROGRAM,
269
- ye as buildFlightSearchQuery,
270
- Ce as formatCabinClass,
271
- Ae as getAirlineProgram,
270
+ Ce as buildFlightSearchQuery,
271
+ be as formatCabinClass,
272
+ we as getAirlineProgram,
272
273
  K as getFlightNumber,
273
274
  C as getFullLogoPath,
274
- Fe as getLogoPath,
275
- ge as getOperatedBy,
275
+ Ae as getLogoPath,
276
+ ye as getOperatedBy,
276
277
  se as getPrimaryDisplayCarrierForFlightOffer,
277
278
  ee as getPrimaryDisplayCarrierForSlice,
278
- be as groupFlightResults,
279
- ue as mapDataToFlightDetails,
279
+ Fe as groupFlightResults,
280
+ ge as mapDataToFlightDetails,
280
281
  ae as removeLeadingZeros
281
282
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@odynn/awayz-flights",
3
- "version": "0.10.8",
3
+ "version": "0.10.9",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"
@@ -1,7 +0,0 @@
1
- const t = (e) => Array.isArray(e) ? e.map((r) => t(r)) : typeof e == "object" && e !== null ? Object.keys(e).reduce((r, a) => {
2
- const n = s(a);
3
- return r[n] = t(e[a]), r;
4
- }, {}) : e, s = (e) => (e = e.replace(/^_+/, ""), e.replace(/_([a-z])/gi, (r, a) => a.toUpperCase()));
5
- export {
6
- t as c
7
- };