@odynn/awayz-flights 0.10.7 → 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.
Files changed (31) hide show
  1. package/dist/{FlightItinerary-BvAVMr_3.js → FlightItinerary-Bn345w_C.js} +0 -1
  2. package/dist/FlightsService-BgXzj6SR.js +155 -0
  3. package/dist/assets/_styles.css +1 -1
  4. package/dist/components/BookingOption/BookingOption.js +193 -11
  5. package/dist/components/Dialog/Dialog.js +8 -9
  6. package/dist/components/FlightItinerary/FlightItinerary.js +1 -1
  7. package/dist/components/FlightItineraryDropdown/FlightItineraryDropdown.js +9 -13
  8. package/dist/components/HorizontalScroller/HorizontalScroller.js +2 -2
  9. package/dist/components/MiniFlightItinerary/MiniFlightItinerary.js +7 -7
  10. package/dist/components/index.js +7 -9
  11. package/dist/hooks/useAirportSearch/useAirportSearch.js +9 -8
  12. package/dist/hooks/useFlightSearch/useFlightSearch.js +560 -560
  13. package/dist/index-B9NLqDyM.js +39 -0
  14. package/dist/lib/components/index.d.ts +0 -1
  15. package/dist/lib/services/wallet/WalletService.mappers.d.ts +21 -0
  16. package/dist/main.js +29 -31
  17. package/dist/numberUtils-DxNMfbMM.js +8 -0
  18. package/dist/services/flights/FlightsService.js +5 -145
  19. package/dist/services/wallet/WalletService.js +26 -29
  20. package/dist/services/wallet/WalletService.mappers.js +74 -0
  21. package/dist/utils/flightUtils.js +13 -12
  22. package/package.json +1 -1
  23. package/dist/BookingOption-D566Ie2y.js +0 -205
  24. package/dist/assets/_styles2.css +0 -1
  25. package/dist/components/FlightResult/FlightResult.js +0 -416
  26. package/dist/enums-DPFgYLjY.js +0 -4
  27. package/dist/index-9LVJi5JO.js +0 -55
  28. package/dist/lib/components/FlightResult/FlightResult.d.ts +0 -40
  29. package/dist/objectUtils-3IeCVocm.js +0 -7
  30. /package/dist/assets/{_styles4.css → BookingOption.css} +0 -0
  31. /package/dist/assets/{_styles3.css → Dialog.css} +0 -0
@@ -0,0 +1,39 @@
1
+ import { G as c } from "./iconBase-DSKTHwal.js";
2
+ function l(t) {
3
+ return c({ attr: { viewBox: "0 0 448 512" }, child: [{ tag: "path", attr: { d: "M438.6 105.4c12.5 12.5 12.5 32.8 0 45.3l-256 256c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 338.7 393.4 105.4c12.5-12.5 32.8-12.5 45.3 0z" }, child: [] }] })(t);
4
+ }
5
+ function r(t) {
6
+ return c({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M233.4 406.6c12.5 12.5 32.8 12.5 45.3 0l192-192c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L256 338.7 86.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l192 192z" }, child: [] }] })(t);
7
+ }
8
+ function i(t) {
9
+ return c({ attr: { viewBox: "0 0 320 512" }, child: [{ tag: "path", attr: { d: "M9.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l192 192c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L77.3 256 246.6 86.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-192 192z" }, child: [] }] })(t);
10
+ }
11
+ function n(t) {
12
+ return c({ attr: { viewBox: "0 0 320 512" }, child: [{ tag: "path", attr: { d: "M310.6 233.4c12.5 12.5 12.5 32.8 0 45.3l-192 192c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L242.7 256 73.4 86.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l192 192z" }, child: [] }] })(t);
13
+ }
14
+ function h(t) {
15
+ return c({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M233.4 105.4c12.5-12.5 32.8-12.5 45.3 0l192 192c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L256 173.3 86.6 342.6c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3l192-192z" }, child: [] }] })(t);
16
+ }
17
+ function e(t) {
18
+ return c({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M256 0a256 256 0 1 1 0 512A256 256 0 1 1 256 0zM232 120l0 136c0 8 4 15.5 10.7 20l96 64c11 7.4 25.9 4.4 33.3-6.7s4.4-25.9-6.7-33.3L280 243.2 280 120c0-13.3-10.7-24-24-24s-24 10.7-24 24z" }, child: [] }] })(t);
19
+ }
20
+ function d(t) {
21
+ return c({ attr: { viewBox: "0 0 576 512" }, child: [{ tag: "path", attr: { d: "M482.3 192c34.2 0 93.7 29 93.7 64c0 36-59.5 64-93.7 64l-116.6 0L265.2 495.9c-5.7 10-16.3 16.1-27.8 16.1l-56.2 0c-10.6 0-18.3-10.2-15.4-20.4l49-171.6L112 320 68.8 377.6c-3 4-7.8 6.4-12.8 6.4l-42 0c-7.8 0-14-6.3-14-14c0-1.3 .2-2.6 .5-3.9L32 256 .5 145.9c-.4-1.3-.5-2.6-.5-3.9c0-7.8 6.3-14 14-14l42 0c5 0 9.8 2.4 12.8 6.4L112 192l102.9 0-49-171.6C162.9 10.2 170.6 0 181.2 0l56.2 0c11.5 0 22.1 6.2 27.8 16.1L365.7 192l116.6 0z" }, child: [] }] })(t);
22
+ }
23
+ function o(t) {
24
+ return c({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M176 56l0 40 160 0 0-40c0-4.4-3.6-8-8-8L184 48c-4.4 0-8 3.6-8 8zM128 96l0-40c0-30.9 25.1-56 56-56L328 0c30.9 0 56 25.1 56 56l0 40 0 32 0 352-256 0 0-352 0-32zM64 96l32 0 0 384-32 0c-35.3 0-64-28.7-64-64L0 160c0-35.3 28.7-64 64-64zM448 480l-32 0 0-384 32 0c35.3 0 64 28.7 64 64l0 256c0 35.3-28.7 64-64 64z" }, child: [] }] })(t);
25
+ }
26
+ function s(t) {
27
+ return c({ attr: { viewBox: "0 0 384 512" }, child: [{ tag: "path", attr: { d: "M376.6 84.5c11.3-13.6 9.5-33.8-4.1-45.1s-33.8-9.5-45.1 4.1L192 206 56.6 43.5C45.3 29.9 25.1 28.1 11.5 39.4S-3.9 70.9 7.4 84.5L150.3 256 7.4 427.5c-11.3 13.6-9.5 33.8 4.1 45.1s33.8 9.5 45.1-4.1L192 306 327.4 468.5c11.3 13.6 31.5 15.4 45.1 4.1s15.4-31.5 4.1-45.1L233.7 256 376.6 84.5z" }, child: [] }] })(t);
28
+ }
29
+ export {
30
+ i as F,
31
+ n as a,
32
+ e as b,
33
+ d as c,
34
+ o as d,
35
+ l as e,
36
+ h as f,
37
+ r as g,
38
+ s as h
39
+ };
@@ -1,5 +1,4 @@
1
1
  export * from './FlightItinerary/FlightItinerary';
2
2
  export * from './FlightItineraryDropdown/FlightItineraryDropdown';
3
- export * from './FlightResult/FlightResult';
4
3
  export * from './HorizontalScroller/HorizontalScroller';
5
4
  export * from './MiniFlightItinerary/MiniFlightItinerary';
@@ -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;
package/dist/main.js CHANGED
@@ -1,46 +1,44 @@
1
1
  import { useFlightSearch as Y } from "./hooks/useFlightSearch/useFlightSearch.js";
2
- import { useAirportSearch as M } from "./hooks/useAirportSearch/useAirportSearch.js";
2
+ import { useAirportSearch as p } from "./hooks/useAirportSearch/useAirportSearch.js";
3
3
  import { EBaggage as l } from "./hooks/useFlightSearch/useFlightSearch.types.js";
4
- import { F as h, g as f } from "./FlightItinerary-BvAVMr_3.js";
4
+ import { F as h, g as f } from "./FlightItinerary-Bn345w_C.js";
5
5
  import { FlightItineraryDropdown as S } from "./components/FlightItineraryDropdown/FlightItineraryDropdown.js";
6
- import { FlightResult as F } from "./components/FlightResult/FlightResult.js";
7
6
  import "react/jsx-runtime";
8
7
  import "react";
9
- import './assets/_styles2.css';/* empty css */
10
- import { MiniFlightItinerary as y } from "./components/MiniFlightItinerary/MiniFlightItinerary.js";
11
- import { EPaymentType as A } from "./enums/EPaymentType.js";
12
- import { DEFAULT_AIRLINE_PROGRAM as c, getAirlineProgram as b, getFlightNumber as I, getLogoPath as L } from "./utils/flightUtils.js";
13
- import { isSameDayFlight as d } from "./utils/flightDateUtils.js";
14
- import { EFlightPaymentType as N, EFlightType as R } from "./types/enums.js";
15
- import { ECabinClass as O, getCabinClassLabel as v, getCabinClassList as z } from "./types/ECabinClass.js";
16
- import { c as G, g as _, b as w, a as W } from "./dateUtils-Cb9VQiIL.js";
17
- import { c as j } from "./BookingOption-D566Ie2y.js";
8
+ import './assets/_styles.css';/* empty css */
9
+ import { MiniFlightItinerary as T } from "./components/MiniFlightItinerary/MiniFlightItinerary.js";
10
+ import { EPaymentType as F } from "./enums/EPaymentType.js";
11
+ import { DEFAULT_AIRLINE_PROGRAM as u, getAirlineProgram as C, getFlightNumber as c, getLogoPath as b } from "./utils/flightUtils.js";
12
+ import { isSameDayFlight as L } from "./utils/flightDateUtils.js";
13
+ import { EFlightPaymentType as d, EFlightType as H } from "./types/enums.js";
14
+ import { ECabinClass as U, getCabinClassLabel as O, getCabinClassList as R } from "./types/ECabinClass.js";
15
+ import { c as z, g as B, b as G, a as _ } from "./dateUtils-Cb9VQiIL.js";
16
+ import { c as W } from "./numberUtils-DxNMfbMM.js";
18
17
  import "./arrayExtensions-Ce8YopTP.js";
19
18
  var r = /* @__PURE__ */ ((e) => (e.USStringDateFormat = "MMM DD, YYYY", e.USStringDateTimeFormat = "MMM DD, YYYY, h:mm A (z)", e.FlightShortDate = "MMM DD - h:mm A", e.FlightTime = "h:mm A", e.DateFormat = "MM/DD", e.StringDateFormat = "MMM DD", e.FullDateFormat = "MM/DD/YYYY", e.ServerDate = "YYYY-MM-DD", e.GoogleDateFormat = "YYYYMMDDTHHmmssZ", e.AppleDateFormat = "YYYYMMDDTHHmmss", e.USStringDateWithTimeFormat = "MMM DD, YYYY, h:mm A", e))(r || {});
20
19
  export {
21
- c as DEFAULT_AIRLINE_PROGRAM,
20
+ u as DEFAULT_AIRLINE_PROGRAM,
22
21
  l as EBaggage,
23
- O as ECabinClass,
22
+ U as ECabinClass,
24
23
  r as EDateFormats,
25
- N as EFlightPaymentType,
26
- R as EFlightType,
27
- A as EPaymentType,
24
+ d as EFlightPaymentType,
25
+ H as EFlightType,
26
+ F as EPaymentType,
28
27
  h as FlightItinerary,
29
28
  S as FlightItineraryDropdown,
30
- F as FlightResult,
31
- y as MiniFlightItinerary,
32
- G as calculateTimeDifference,
33
- j as commaSeparatedNumber,
34
- b as getAirlineProgram,
35
- v as getCabinClassLabel,
36
- z as getCabinClassList,
29
+ T as MiniFlightItinerary,
30
+ z as calculateTimeDifference,
31
+ W as commaSeparatedNumber,
32
+ C as getAirlineProgram,
33
+ O as getCabinClassLabel,
34
+ R as getCabinClassList,
37
35
  f as getCountryNameByCode,
38
- _ as getDuration,
39
- I as getFlightNumber,
40
- L as getLogoPath,
41
- w as getTimeString,
42
- W as getTimezoneOffsetOrCode,
43
- d as isSameDayFlight,
44
- M as useAirportSearch,
36
+ B as getDuration,
37
+ c as getFlightNumber,
38
+ b as getLogoPath,
39
+ G as getTimeString,
40
+ _ as getTimezoneOffsetOrCode,
41
+ L as isSameDayFlight,
42
+ p as useAirportSearch,
45
43
  Y as useFlightSearch
46
44
  };
@@ -0,0 +1,8 @@
1
+ function c(t, i = !0) {
2
+ if ((!t || isNaN(t) || t < 0) && i) return "N/A";
3
+ let a = t == null ? void 0 : t.toString().split(".")[0];
4
+ return a == null ? void 0 : a.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
5
+ }
6
+ export {
7
+ c
8
+ };
@@ -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.7",
3
+ "version": "0.10.9",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"