@odynn/awayz-core 0.3.2 → 0.3.3

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.
@@ -74,7 +74,7 @@ function Ke(e, t) {
74
74
  return s;
75
75
  return null;
76
76
  }
77
- const B = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, $e = (e) => !v(e) && e !== B;
77
+ const q = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, $e = (e) => !v(e) && e !== q;
78
78
  function fe() {
79
79
  const { caseless: e } = $e(this) && this || {}, t = {}, n = (r, s) => {
80
80
  const o = e && Ke(t, s) || s;
@@ -181,14 +181,14 @@ const Xt = (e) => {
181
181
  return r;
182
182
  };
183
183
  return n(e, 0);
184
- }, Yt = x("AsyncFunction"), Zt = (e) => e && (se(e) || _(e)) && _(e.then) && _(e.catch), Je = ((e, t) => e ? setImmediate : t ? ((n, r) => (B.addEventListener("message", ({ source: s, data: o }) => {
185
- s === B && o === n && r.length && r.shift()();
184
+ }, Yt = x("AsyncFunction"), Zt = (e) => e && (se(e) || _(e)) && _(e.then) && _(e.catch), Je = ((e, t) => e ? setImmediate : t ? ((n, r) => (q.addEventListener("message", ({ source: s, data: o }) => {
185
+ s === q && o === n && r.length && r.shift()();
186
186
  }, !1), (s) => {
187
- r.push(s), B.postMessage(n, "*");
187
+ r.push(s), q.postMessage(n, "*");
188
188
  }))(`axios@${Math.random()}`, []) : (n) => setTimeout(n))(
189
189
  typeof setImmediate == "function",
190
- _(B.postMessage)
191
- ), Qt = typeof queueMicrotask < "u" ? queueMicrotask.bind(B) : typeof process < "u" && process.nextTick || Je, en = (e) => e != null && _(e[te]), a = {
190
+ _(q.postMessage)
191
+ ), Qt = typeof queueMicrotask < "u" ? queueMicrotask.bind(q) : typeof process < "u" && process.nextTick || Je, en = (e) => e != null && _(e[te]), a = {
192
192
  isArray: j,
193
193
  isArrayBuffer: je,
194
194
  isBuffer: yt,
@@ -237,7 +237,7 @@ const Xt = (e) => {
237
237
  noop: Gt,
238
238
  toFiniteNumber: Vt,
239
239
  findKey: Ke,
240
- global: B,
240
+ global: q,
241
241
  isContextDefined: $e,
242
242
  isSpecCompliantForm: Wt,
243
243
  toJSONObject: Xt,
@@ -940,7 +940,7 @@ function nt(e, t, n) {
940
940
  return e && (r || n == !1) ? kn(e, t) : t;
941
941
  }
942
942
  const xe = (e) => e instanceof N ? { ...e } : e;
943
- function H(e, t) {
943
+ function M(e, t) {
944
944
  t = t || {};
945
945
  const n = {};
946
946
  function r(u, l, d, y) {
@@ -1005,7 +1005,7 @@ function H(e, t) {
1005
1005
  }), n;
1006
1006
  }
1007
1007
  const rt = (e) => {
1008
- const t = H({}, e);
1008
+ const t = M({}, e);
1009
1009
  let { data: n, withXSRFToken: r, xsrfHeaderName: s, xsrfCookieName: o, headers: i, auth: c } = t;
1010
1010
  t.headers = i = N.from(i), t.url = Ye(nt(t.baseURL, t.url, t.allowAbsoluteUrls), e.params, e.paramsSerializer), c && i.set(
1011
1011
  "Authorization",
@@ -1406,7 +1406,7 @@ const Z = {
1406
1406
  assertOptions: Kn,
1407
1407
  validators: ae
1408
1408
  }, U = Z.validators;
1409
- let q = class {
1409
+ let H = class {
1410
1410
  constructor(t) {
1411
1411
  this.defaults = t || {}, this.interceptors = {
1412
1412
  request: new Ae(),
@@ -1439,7 +1439,7 @@ let q = class {
1439
1439
  }
1440
1440
  }
1441
1441
  _request(t, n) {
1442
- typeof t == "string" ? (n = n || {}, n.url = t) : n = t || {}, n = H(this.defaults, n);
1442
+ typeof t == "string" ? (n = n || {}, n.url = t) : n = t || {}, n = M(this.defaults, n);
1443
1443
  const { transitional: r, paramsSerializer: s, headers: o } = n;
1444
1444
  r !== void 0 && Z.assertOptions(r, {
1445
1445
  silentJSONParsing: U.transitional(U.boolean),
@@ -1501,14 +1501,14 @@ let q = class {
1501
1501
  return l;
1502
1502
  }
1503
1503
  getUri(t) {
1504
- t = H(this.defaults, t);
1504
+ t = M(this.defaults, t);
1505
1505
  const n = nt(t.baseURL, t.url, t.allowAbsoluteUrls);
1506
1506
  return Ye(n, t.params, t.paramsSerializer);
1507
1507
  }
1508
1508
  };
1509
1509
  a.forEach(["delete", "get", "head", "options"], function(t) {
1510
- q.prototype[t] = function(n, r) {
1511
- return this.request(H(r || {}, {
1510
+ H.prototype[t] = function(n, r) {
1511
+ return this.request(M(r || {}, {
1512
1512
  method: t,
1513
1513
  url: n,
1514
1514
  data: (r || {}).data
@@ -1518,7 +1518,7 @@ a.forEach(["delete", "get", "head", "options"], function(t) {
1518
1518
  a.forEach(["post", "put", "patch"], function(t) {
1519
1519
  function n(r) {
1520
1520
  return function(o, i, c) {
1521
- return this.request(H(c || {}, {
1521
+ return this.request(M(c || {}, {
1522
1522
  method: t,
1523
1523
  headers: r ? {
1524
1524
  "Content-Type": "multipart/form-data"
@@ -1528,7 +1528,7 @@ a.forEach(["post", "put", "patch"], function(t) {
1528
1528
  }));
1529
1529
  };
1530
1530
  }
1531
- q.prototype[t] = n(), q.prototype[t + "Form"] = n(!0);
1531
+ H.prototype[t] = n(), H.prototype[t + "Form"] = n(!0);
1532
1532
  });
1533
1533
  let $n = class ct {
1534
1534
  constructor(t) {
@@ -1680,13 +1680,13 @@ Object.entries(Ee).forEach(([e, t]) => {
1680
1680
  Ee[t] = e;
1681
1681
  });
1682
1682
  function ut(e) {
1683
- const t = new q(e), n = He(q.prototype.request, t);
1684
- return a.extend(n, q.prototype, t, { allOwnKeys: !0 }), a.extend(n, t, null, { allOwnKeys: !0 }), n.create = function(s) {
1685
- return ut(H(e, s));
1683
+ const t = new H(e), n = He(H.prototype.request, t);
1684
+ return a.extend(n, H.prototype, t, { allOwnKeys: !0 }), a.extend(n, t, null, { allOwnKeys: !0 }), n.create = function(s) {
1685
+ return ut(M(e, s));
1686
1686
  }, n;
1687
1687
  }
1688
1688
  const S = ut(G);
1689
- S.Axios = q;
1689
+ S.Axios = H;
1690
1690
  S.CanceledError = z;
1691
1691
  S.CancelToken = $n;
1692
1692
  S.isCancel = et;
@@ -1699,7 +1699,7 @@ S.all = function(t) {
1699
1699
  };
1700
1700
  S.spread = vn;
1701
1701
  S.isAxiosError = Jn;
1702
- S.mergeConfig = H;
1702
+ S.mergeConfig = M;
1703
1703
  S.AxiosHeaders = N;
1704
1704
  S.formToJSON = (e) => Qe(a.isHTMLForm(e) ? new FormData(e) : e);
1705
1705
  S.getAdapter = it.getAdapter;
@@ -1718,7 +1718,7 @@ const {
1718
1718
  spread: gr,
1719
1719
  toFormData: br,
1720
1720
  AxiosHeaders: Tr,
1721
- HttpStatusCode: M,
1721
+ HttpStatusCode: B,
1722
1722
  formToJSON: Or,
1723
1723
  getAdapter: Ar,
1724
1724
  mergeConfig: _r
@@ -1741,10 +1741,10 @@ const {
1741
1741
  );
1742
1742
  }, Yn = async (e, t, n, r, s) => {
1743
1743
  var f, u, l;
1744
- const o = t.config, i = localStorage.getItem(F.REFRESH_TOKEN), c = ((f = t.response) == null ? void 0 : f.status) || M.InternalServerError;
1744
+ const o = t.config, i = localStorage.getItem(F.REFRESH_TOKEN), c = ((f = t.response) == null ? void 0 : f.status) || B.InternalServerError;
1745
1745
  if (!o || o.__retries === n)
1746
1746
  throw t;
1747
- if (c === M.Unauthorized && o.url !== O.REFRESH_EMBED_TOKEN && o.url !== O.REFRESH_TOKEN && o.url !== O.SIGN_IN && o.url !== O.SIGN_UP) {
1747
+ if (c === B.Unauthorized && o.url !== O.REFRESH_EMBED_TOKEN && o.url !== O.REFRESH_TOKEN && o.url !== O.SIGN_IN && o.url !== O.SIGN_UP) {
1748
1748
  if (!i)
1749
1749
  throw De(
1750
1750
  "refresh_token",
@@ -1763,10 +1763,11 @@ const {
1763
1763
  return (l = o.url) != null && l.includes(O.EXCHANGE_TOKEN) && "id_token" in w && (o.data = JSON.stringify({ idToken: w.id_token })), r = !1, o.headers && (o.headers.Authorization = `Bearer ${w.token}`), Le(e, null, w.token), s(o);
1764
1764
  }
1765
1765
  if ([
1766
- M.Unauthorized,
1767
- M.Forbidden,
1768
- M.InternalServerError,
1769
- M.Conflict
1766
+ B.Unauthorized,
1767
+ B.Forbidden,
1768
+ B.InternalServerError,
1769
+ B.Conflict,
1770
+ B.NotFound
1770
1771
  ].includes(c) || (o.__retries || (o.__retries = 0), o.__retries += 1, o.__retries > n))
1771
1772
  throw t;
1772
1773
  return Xn(
@@ -2022,13 +2023,13 @@ export {
2022
2023
  mt as a,
2023
2024
  L as b,
2024
2025
  C as c,
2025
- ge as d,
2026
- F as e,
2027
- S as f,
2026
+ F as d,
2027
+ S as e,
2028
+ Gn as f,
2028
2029
  Vn as g,
2029
2030
  Yn as h,
2030
2031
  Zn as i,
2031
- Gn as j,
2032
+ ge as j,
2032
2033
  Wn as k,
2033
2034
  Xn as l,
2034
2035
  De as m,
@@ -0,0 +1,120 @@
1
+ var _ = Object.defineProperty;
2
+ var g = (a, e, s) => e in a ? _(a, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : a[e] = s;
3
+ var t = (a, e, s) => g(a, typeof e != "symbol" ? e + "" : e, s);
4
+ import { c as n, j as u, b as o, r as y } from "./AccountService-D_6U8vP6.js";
5
+ import { EBookingType as T } from "./services/trips/TripService.types.js";
6
+ import { EMyTripsEndpoints as i } from "./configs/endpoints.js";
7
+ import { h as c } from "./arrayExtensions-DlcBOj5a.js";
8
+ import "react";
9
+ const b = "https://assets.duffel.com/img/airlines/for-light-background/full-color-lockup/";
10
+ class f {
11
+ constructor() {
12
+ t(this, "createTrip", async (e) => {
13
+ const { data: s } = await n.post(
14
+ i.TRIPS,
15
+ u(e)
16
+ );
17
+ return s;
18
+ });
19
+ t(this, "getTripsByStatus", async (e) => {
20
+ const { data: s } = await n.get(
21
+ i.TRIPS,
22
+ {
23
+ params: { status: e }
24
+ }
25
+ );
26
+ if (!(s != null && s.success))
27
+ return [];
28
+ const r = s.data.map((p) => ({
29
+ ...p,
30
+ flightBookings: m(p.flight_bookings ?? []),
31
+ hotelBookings: l(p.hotel_bookings ?? [])
32
+ }));
33
+ return o(r);
34
+ });
35
+ t(this, "updateTrip", async (e, s) => {
36
+ const { data: r } = await n.put(
37
+ `${i.TRIPS}/${e}`,
38
+ y(u(s))
39
+ );
40
+ return r != null && r.success ? {
41
+ success: !0,
42
+ data: o(r.data),
43
+ message: "Trip updated successfully."
44
+ } : {
45
+ success: !1,
46
+ message: "An error occurred while trying to update the trip."
47
+ };
48
+ });
49
+ t(this, "deleteTrip", async (e) => {
50
+ const { data: s } = await n.delete(
51
+ `${i.TRIPS}/${e}`
52
+ );
53
+ return s;
54
+ });
55
+ t(this, "getUncategorisedBookings", async () => {
56
+ const { data: e } = await n.get(
57
+ i.UNCATEGORISED_BOOKINGS
58
+ );
59
+ return e != null && e.success ? {
60
+ flightBookings: m(e.data.flight_bookings ?? []),
61
+ hotelBookings: l(e.data.hotel_bookings ?? [])
62
+ } : {
63
+ flightBookings: [],
64
+ hotelBookings: []
65
+ };
66
+ });
67
+ t(this, "addBookingToTrip", async (e, s, r) => {
68
+ const { data: d } = await n.put(i.ADD_BOOKING, {
69
+ trip_id: e,
70
+ booking_id: s,
71
+ booking_type: r
72
+ });
73
+ return d.success;
74
+ });
75
+ }
76
+ }
77
+ const m = (a) => a.map(
78
+ (e) => o({
79
+ id: e._id,
80
+ reference: e.booking_reference,
81
+ startDate: c(e.departure_date),
82
+ endDate: c(e.arrival_date),
83
+ bookingType: T.FLIGHT,
84
+ airlines: e.slices.map((s) => ({
85
+ logo: b + ".svg",
86
+ name: s.carriers.operating[0]
87
+ })),
88
+ arrival: {
89
+ airportCode: e.slices[0].origin,
90
+ location: ""
91
+ },
92
+ departure: {
93
+ airportCode: e.slices.getLast().destination,
94
+ location: ""
95
+ },
96
+ class: e.slices[0].fare_brand_name,
97
+ passengers: e.passengers.length,
98
+ hasAirlineChanges: !1,
99
+ orderId: e.order_id,
100
+ type: e.type
101
+ })
102
+ ), l = (a) => a.map(
103
+ (e) => o({
104
+ id: e._id,
105
+ reference: e.reference,
106
+ startDate: c(e.start_date),
107
+ endDate: c(e.end_date),
108
+ bookingType: T.HOTEL,
109
+ name: e.rooms[0].name,
110
+ image: e.images[0],
111
+ guests: e.number_of_guests,
112
+ address: Object.values(e.address).filter((s) => s).map((s) => s.trim()).join(", "),
113
+ rooms: e.rooms.length,
114
+ bookingId: e.booking_id
115
+ })
116
+ ), k = new f();
117
+ export {
118
+ b as D,
119
+ k as T
120
+ };
@@ -4,7 +4,7 @@ import { useMemo as rt } from "react";
4
4
  import { u as N, a as nt, c as A, b as Z, d as he, e as ot, f as st, g as G, o as it, s as at, h as lt, i as ct, j as dt, k as ut, l as pt, m as ft, n as ht, p as vt, P as ve, q as ue } from "../../index-COgXcb6p.js";
5
5
  import { r as mt, R as yt } from "../../index-Cv-wvFlM.js";
6
6
  import "../../arrayExtensions-DlcBOj5a.js";
7
- import { E as gt } from "../../AccountService-Ct4hShV-.js";
7
+ import { E as gt } from "../../AccountService-D_6U8vP6.js";
8
8
  import { useQuery as wt } from "@tanstack/react-query";
9
9
  import { CurrencyService as Ct } from "../../services/currency/CurrencyService.js";
10
10
  import '../../assets/_styles4.css';import '../../assets/_styles3.css';import '../../assets/_styles2.css';import '../../assets/_styles.css';/* empty css */
@@ -4,7 +4,7 @@ import { AwayzProvider as a } from "../../providers/AwayzProvider.js";
4
4
  import "react";
5
5
  import "../../context/AwayzContext.js";
6
6
  import "../../arrayExtensions-DlcBOj5a.js";
7
- import "../../AccountService-Ct4hShV-.js";
7
+ import "../../AccountService-D_6U8vP6.js";
8
8
  import "../../configs/awayzClient.js";
9
9
  import "@tanstack/react-query";
10
10
  import { EAuthFlow as i } from "../../types/EAuthFlow.js";
@@ -1,25 +1,25 @@
1
1
  import "../../arrayExtensions-DlcBOj5a.js";
2
- import { j as U, e as r, A as o, E as v } from "../../AccountService-Ct4hShV-.js";
2
+ import { f as U, d as r, A as o, E as v } from "../../AccountService-D_6U8vP6.js";
3
3
  import { useState as E, useCallback as R, useEffect as y } from "react";
4
4
  import { EAuthFlow as S } from "../../types/EAuthFlow.js";
5
5
  import { awayzClient as A } from "../../configs/awayzClient.js";
6
6
  const H = (s, t) => {
7
- var f, d;
8
- let c = "", m = t;
9
- typeof t == "string" ? c = t : t instanceof U ? (c = t.message, m = {
7
+ var f, m;
8
+ let c = "", d = t;
9
+ typeof t == "string" ? c = t : t instanceof U ? (c = t.message, d = {
10
10
  message: t.message,
11
11
  cause: t.cause,
12
12
  status: t.status,
13
13
  data: (f = t == null ? void 0 : t.response) == null ? void 0 : f.data
14
- }) : c = t.message, (d = window.parent) == null || d.postMessage(
14
+ }) : c = t.message, (m = window.parent) == null || m.postMessage(
15
15
  {
16
16
  type: "auth_error",
17
- details: { message: c, action: s, info: m }
17
+ details: { message: c, action: s, info: d }
18
18
  },
19
19
  "*"
20
20
  );
21
21
  }, G = (s) => {
22
- const [t, c] = E(!0), [m, f] = E(!1), [d, T] = E(), [O, k] = E(), [I, K] = E([]), w = R(
22
+ const [t, c] = E(!0), [d, f] = E(!1), [m, T] = E(), [O, k] = E(), [I, K] = E([]), w = R(
23
23
  async (a) => {
24
24
  s != null && s.onSuccess && (s == null || s.onSuccess(a)), s != null && s.onSuccessAsync && await (s == null ? void 0 : s.onSuccessAsync(a)), c(!1), f(!0), T(a.token), k(a.user), A.invalidateQueries();
25
25
  },
@@ -136,8 +136,8 @@ const H = (s, t) => {
136
136
  };
137
137
  }, []), {
138
138
  isAuthenticating: t,
139
- isAuthenticated: m,
140
- token: d,
139
+ isAuthenticated: d,
140
+ token: m,
141
141
  user: O,
142
142
  supportedRegions: I,
143
143
  signIn: async (a) => {
@@ -1,7 +1,7 @@
1
1
  import { useQuery as n, useMutation as a } from "@tanstack/react-query";
2
2
  import { EBookingType as i } from "../../services/trips/TripService.types.js";
3
3
  import "../../arrayExtensions-DlcBOj5a.js";
4
- import { E as o } from "../../AccountService-Ct4hShV-.js";
4
+ import { E as o } from "../../AccountService-D_6U8vP6.js";
5
5
  import "react";
6
6
  import { BookingService as e } from "../../services/bookings/BookingService.js";
7
7
  import "react/jsx-runtime";
@@ -1,6 +1,6 @@
1
1
  import { renderHook as r, waitFor as c } from "../../tests/TestWrapper.js";
2
2
  import { useBookingManagement as i } from "./useBookingManagement.js";
3
- import { c as o } from "../../AccountService-Ct4hShV-.js";
3
+ import { c as o } from "../../AccountService-D_6U8vP6.js";
4
4
  import "../../services/noRetryInstance.js";
5
5
  import "../../arrayExtensions-DlcBOj5a.js";
6
6
  import "react";
@@ -1,4 +1,4 @@
1
- import { E as s, A as i, b as n } from "../AccountService-Ct4hShV-.js";
1
+ import { E as s, A as i, b as n } from "../AccountService-D_6U8vP6.js";
2
2
  import { useQuery as u } from "@tanstack/react-query";
3
3
  import "../arrayExtensions-DlcBOj5a.js";
4
4
  import "react";
@@ -1,8 +1,8 @@
1
1
  import { useQuery as d, useMutation as p } from "@tanstack/react-query";
2
2
  import { h as c } from "../../arrayExtensions-DlcBOj5a.js";
3
- import { E as e } from "../../AccountService-Ct4hShV-.js";
3
+ import { E as e } from "../../AccountService-D_6U8vP6.js";
4
4
  import "react";
5
- import { TripsService as o } from "../../services/trips/TripsService.js";
5
+ import { T as o } from "../../TripsService-BGx--gfb.js";
6
6
  import "react/jsx-runtime";
7
7
  import "../../context/AwayzContext.js";
8
8
  import { awayzClient as t } from "../../configs/awayzClient.js";
@@ -13,11 +13,11 @@ import '../../assets/_styles4.css';import '../../assets/_styles3.css';import '..
13
13
  /* empty css */
14
14
  const U = ({
15
15
  tripId: s,
16
- tripDetails: a
16
+ tripDetails: n
17
17
  }) => {
18
18
  if (!s)
19
19
  throw new Error("Trip ID is required");
20
- if (!a || Object.keys(a).length === 0)
20
+ if (!n || Object.keys(n).length === 0)
21
21
  throw new Error("Trip details must be provided for update");
22
22
  }, J = () => {
23
23
  const { data: s = [] } = d({
@@ -30,7 +30,7 @@ const U = ({
30
30
  "past"
31
31
  /* PAST */
32
32
  )
33
- }), { data: a = [] } = d({
33
+ }), { data: n = [] } = d({
34
34
  queryKey: [
35
35
  e.TRIPS,
36
36
  "upcoming"
@@ -40,7 +40,7 @@ const U = ({
40
40
  "upcoming"
41
41
  /* UPCOMING */
42
42
  )
43
- }), { data: n } = d({
43
+ }), { data: a } = d({
44
44
  queryKey: [e.UNCATEGORISED_BOOKINGS],
45
45
  queryFn: () => o.getUncategorisedBookings()
46
46
  }), {
@@ -154,7 +154,7 @@ const U = ({
154
154
  ]
155
155
  });
156
156
  }
157
- }), R = [...s, ...a], u = (n == null ? void 0 : n.flightBookings) || [], T = (n == null ? void 0 : n.hotelBookings) || [], Q = [
157
+ }), R = [...s, ...n], u = (a == null ? void 0 : a.flightBookings) || [], T = (a == null ? void 0 : a.hotelBookings) || [], Q = [
158
158
  ...u,
159
159
  ...T
160
160
  ].sort((r, i) => c(r.startDate).diff(c(i.startDate)));
@@ -162,7 +162,7 @@ const U = ({
162
162
  // Trips
163
163
  allTrips: R,
164
164
  pastTrips: s,
165
- upcomingTrips: a,
165
+ upcomingTrips: n,
166
166
  // Bookings
167
167
  allUncategorisedBookings: Q,
168
168
  uncategorisedFlightBookings: u,
@@ -1,149 +1,197 @@
1
- import { h as c } from "../../arrayExtensions-DlcBOj5a.js";
1
+ import { h as p } from "../../arrayExtensions-DlcBOj5a.js";
2
2
  import { renderHook as o, waitFor as i } from "../../tests/TestWrapper.js";
3
3
  import { useTripManagement as n } from "./useTripManagement.js";
4
4
  import "react/jsx-runtime";
5
5
  import "react";
6
6
  import "../../context/AwayzContext.js";
7
- import { c as d } from "../../AccountService-Ct4hShV-.js";
8
- import { EMyTripsEndpoints as p } from "../../configs/endpoints.js";
7
+ import { D as f } from "../../TripsService-BGx--gfb.js";
8
+ import { c as d } from "../../AccountService-D_6U8vP6.js";
9
+ import { EMyTripsEndpoints as c } from "../../configs/endpoints.js";
9
10
  import "../../configs/awayzClient.js";
10
11
  import "@tanstack/react-query";
11
12
  import "../../services/noRetryInstance.js";
12
- import { EBookingType as k } from "../../services/trips/TripService.types.js";
13
+ import { EBookingType as m } from "../../services/trips/TripService.types.js";
13
14
  import '../../assets/_styles4.css';import '../../assets/_styles3.css';import '../../assets/_styles2.css';import '../../assets/_styles.css';/* empty css */
14
15
  /* empty css */
15
16
  /* empty css */
16
17
  /* empty css */
17
- import { UncategorisedBookings200 as D, PastTrip200 as B, UpcomingTrip200 as I, UpdatedTrip200 as T } from "./mocks/index.js";
18
- import { d as u, v as l, b, t as s, g as e } from "../../vi.ClIskdbk-k6t29WRA.js";
19
- let m = {
20
- past: [...B.data],
21
- upcoming: [...I.data].concat(T.data)
18
+ import { UncategorisedBookings200 as b, PastTrip200 as y, UpcomingTrip200 as B, UpdatedTrip200 as k } from "./mocks/index.js";
19
+ import { d as u, v as T, b as D, t as s, g as e } from "../../vi.ClIskdbk-k6t29WRA.js";
20
+ let l = {
21
+ past: [...y.data],
22
+ upcoming: [...B.data].concat(k.data)
22
23
  };
23
24
  u("useTripManagement", () => {
24
- l.mocked(d.get).mockImplementation((r, t) => {
25
+ T.mocked(d.get).mockImplementation((t, r) => {
25
26
  var a, g;
26
- return r === p.UNCATEGORISED_BOOKINGS ? Promise.resolve({
27
- data: D
28
- }) : ((a = t == null ? void 0 : t.params) == null ? void 0 : a.status) === "past" ? Promise.resolve({
29
- data: { ...B, data: m.past }
30
- }) : ((g = t == null ? void 0 : t.params) == null ? void 0 : g.status) === "upcoming" ? Promise.resolve({
31
- data: { ...I, data: m.upcoming }
27
+ return t === c.UNCATEGORISED_BOOKINGS ? Promise.resolve({
28
+ data: b
29
+ }) : ((a = r == null ? void 0 : r.params) == null ? void 0 : a.status) === "past" ? Promise.resolve({
30
+ data: { ...y, data: l.past }
31
+ }) : ((g = r == null ? void 0 : r.params) == null ? void 0 : g.status) === "upcoming" ? Promise.resolve({
32
+ data: { ...B, data: l.upcoming }
32
33
  }) : Promise.resolve({ data: {} });
33
- }), l.mocked(d.put).mockImplementation((r) => {
34
- if (r === `${p.TRIPS}/67fd23bc3a7cbcd0a8757cdc`) {
35
- const t = {
36
- ...T.data,
34
+ }), T.mocked(d.put).mockImplementation((t) => {
35
+ if (t === `${c.TRIPS}/67fd23bc3a7cbcd0a8757cdc`) {
36
+ const r = {
37
+ ...k.data,
37
38
  name: "Updated Trip"
38
39
  };
39
- return m.past = m.past.map(
40
- (a) => a._id === "67fd23bc3a7cbcd0a8757cdc" ? t : a
41
- ), m.upcoming = m.upcoming.map(
42
- (a) => a._id === "67fd23bc3a7cbcd0a8757cdc" ? t : a
40
+ return l.past = l.past.map(
41
+ (a) => a._id === "67fd23bc3a7cbcd0a8757cdc" ? r : a
42
+ ), l.upcoming = l.upcoming.map(
43
+ (a) => a._id === "67fd23bc3a7cbcd0a8757cdc" ? r : a
43
44
  ), Promise.resolve({
44
- data: T
45
+ data: k
45
46
  });
46
47
  }
47
- return r === p.ADD_BOOKING ? Promise.resolve({
48
+ return t === c.ADD_BOOKING ? Promise.resolve({
48
49
  data: { success: !0, message: "Booking added to trip successfully" }
49
50
  }) : Promise.resolve({ data: {} });
50
- }), b(() => {
51
- l.clearAllMocks();
51
+ }), D(() => {
52
+ T.clearAllMocks();
52
53
  }), u("Get User Trips", () => {
53
54
  s("Has past trips", async () => {
54
- const { result: r } = o(() => n());
55
+ const { result: t } = o(() => n());
55
56
  await i(() => {
56
- e(r.current.pastTrips.length).greaterThan(0), e(
57
- c(r.current.pastTrips[0].endDate).isBefore(c())
57
+ e(t.current.pastTrips.length).greaterThan(0), e(
58
+ p(t.current.pastTrips[0].endDate).isBefore(p())
58
59
  ).toBe(!0);
59
60
  });
60
61
  }), s("Has upcoming trips", async () => {
61
- const { result: r } = o(() => n());
62
+ const { result: t } = o(() => n());
62
63
  await i(() => {
63
- e(r.current.upcomingTrips.length).greaterThan(0), e(
64
- c(r.current.upcomingTrips[0].startDate).isAfter(c())
64
+ e(t.current.upcomingTrips.length).greaterThan(0), e(
65
+ p(t.current.upcomingTrips[0].startDate).isAfter(p())
65
66
  ).toBe(!0);
66
67
  });
68
+ }), s("Has correct flight booking structure", async () => {
69
+ const { result: t } = o(() => n());
70
+ await i(() => {
71
+ const r = t.current.uncategorisedFlightBookings[0], a = b.data.flight_bookings[0];
72
+ e(r).toMatchObject({
73
+ id: a._id,
74
+ reference: a.booking_reference,
75
+ startDate: e.any(Object),
76
+ endDate: e.any(Object),
77
+ bookingType: m.FLIGHT,
78
+ airlines: a.slices.map((g) => ({
79
+ logo: f + ".svg",
80
+ name: g.carriers.operating[0]
81
+ })),
82
+ arrival: {
83
+ airportCode: a.slices[0].origin,
84
+ location: ""
85
+ },
86
+ departure: {
87
+ airportCode: a.slices.getLast().destination,
88
+ location: ""
89
+ },
90
+ class: a.slices[0].fare_brand_name,
91
+ passengers: a.passengers.length,
92
+ hasAirlineChanges: !1,
93
+ orderId: a.order_id,
94
+ type: a.type
95
+ });
96
+ });
97
+ }), s("Has correct hotel booking structure", async () => {
98
+ const { result: t } = o(() => n());
99
+ await i(() => {
100
+ const r = t.current.uncategorisedHotelBookings[0];
101
+ console.log("Hotel Booking:", r), e(r).toMatchObject({
102
+ id: e.any(String),
103
+ reference: e.any(String),
104
+ startDate: e.any(Object),
105
+ endDate: e.any(Object),
106
+ bookingType: m.HOTEL,
107
+ name: e.any(String),
108
+ image: e.any(String),
109
+ guests: e.any(Number),
110
+ address: e.any(String),
111
+ rooms: e.any(Number),
112
+ bookingId: e.any(String)
113
+ });
114
+ });
67
115
  });
68
116
  }), u("Create Trip", () => {
69
117
  s("Invalid Requests", async () => {
70
- const { result: r } = o(() => n());
71
- r.current.createTrip(), await i(() => {
72
- var t;
73
- e(r.current.isCreateTripError).toBe(!0), e((t = r.current.createTripError) == null ? void 0 : t.message).toContain(
118
+ const { result: t } = o(() => n());
119
+ t.current.createTrip(), await i(() => {
120
+ var r;
121
+ e(t.current.isCreateTripError).toBe(!0), e((r = t.current.createTripError) == null ? void 0 : r.message).toContain(
74
122
  "Trip details are required to create a trip"
75
123
  );
76
- }), r.current.createTrip({
124
+ }), t.current.createTrip({
77
125
  name: "",
78
126
  startDate: "",
79
127
  endDate: ""
80
128
  }), await i(() => {
81
- var t;
82
- e(r.current.isCreateTripError).toBe(!0), e((t = r.current.createTripError) == null ? void 0 : t.message).toContain(
129
+ var r;
130
+ e(t.current.isCreateTripError).toBe(!0), e((r = t.current.createTripError) == null ? void 0 : r.message).toContain(
83
131
  "Trip name, start date, and end date are required"
84
132
  );
85
133
  });
86
134
  }), s("Can successfully create a trip", async () => {
87
- const r = {
135
+ const t = {
88
136
  name: "New Trip",
89
- startDate: c().add(1, "days").format("YYYY-MM-DD"),
90
- endDate: c().add(2, "days").format("YYYY-MM-DD")
91
- }, { result: t } = o(() => n());
92
- t.current.createTrip(r), await i(() => {
137
+ startDate: p().add(1, "days").format("YYYY-MM-DD"),
138
+ endDate: p().add(2, "days").format("YYYY-MM-DD")
139
+ }, { result: r } = o(() => n());
140
+ r.current.createTrip(t), await i(() => {
93
141
  e(d.post).toHaveBeenCalledWith(
94
- p.TRIPS,
142
+ c.TRIPS,
95
143
  e.objectContaining({
96
- name: r.name,
97
- start_date: r.startDate,
98
- end_date: r.endDate
144
+ name: t.name,
145
+ start_date: t.startDate,
146
+ end_date: t.endDate
99
147
  })
100
148
  );
101
149
  });
102
150
  });
103
151
  }), u("Delete Trip", () => {
104
152
  s("Can successfully delete a trip", async () => {
105
- const r = "12345", { result: t } = o(() => n());
106
- t.current.deleteTrip(r), await i(() => {
153
+ const t = "12345", { result: r } = o(() => n());
154
+ r.current.deleteTrip(t), await i(() => {
107
155
  e(d.delete).toHaveBeenCalledWith(
108
- `${p.TRIPS}/${r}`
156
+ `${c.TRIPS}/${t}`
109
157
  );
110
158
  });
111
159
  });
112
160
  }), u("Update Trip", () => {
113
161
  s("Invalid tripId arg", async () => {
114
- const { result: r } = o(() => n());
115
- r.current.updateTrip({
162
+ const { result: t } = o(() => n());
163
+ t.current.updateTrip({
116
164
  tripId: "",
117
165
  tripDetails: {
118
166
  name: "Updated Trip"
119
167
  }
120
168
  }), await i(() => {
121
- var t;
122
- e(r.current.isUpdateTripError).toBe(!0), e((t = r.current.updateTripError) == null ? void 0 : t.message).toContain(
169
+ var r;
170
+ e(t.current.isUpdateTripError).toBe(!0), e((r = t.current.updateTripError) == null ? void 0 : r.message).toContain(
123
171
  "Trip ID is required"
124
172
  );
125
173
  });
126
174
  }), s("Invalid tripDetails arg", async () => {
127
- const { result: r } = o(() => n());
128
- r.current.updateTrip({
175
+ const { result: t } = o(() => n());
176
+ t.current.updateTrip({
129
177
  tripId: "123",
130
178
  tripDetails: {}
131
179
  }), await i(() => {
132
- var t;
133
- e(r.current.isUpdateTripError).toBe(!0), e((t = r.current.updateTripError) == null ? void 0 : t.message).toContain(
180
+ var r;
181
+ e(t.current.isUpdateTripError).toBe(!0), e((r = t.current.updateTripError) == null ? void 0 : r.message).toContain(
134
182
  "Trip details must be provided for update"
135
183
  );
136
184
  });
137
185
  }), s("Successful update", async () => {
138
- const { result: r } = o(() => n()), t = "682ffebaa6cc24f39d99fdc7";
139
- r.current.updateTrip({
140
- tripId: t,
186
+ const { result: t } = o(() => n()), r = "682ffebaa6cc24f39d99fdc7";
187
+ t.current.updateTrip({
188
+ tripId: r,
141
189
  tripDetails: {
142
190
  name: "Updated Trip"
143
191
  }
144
192
  }), await i(() => {
145
193
  e(d.put).toHaveBeenCalledWith(
146
- `${p.TRIPS}/${t}`,
194
+ `${c.TRIPS}/${r}`,
147
195
  e.objectContaining({
148
196
  name: "Updated Trip"
149
197
  })
@@ -152,54 +200,52 @@ u("useTripManagement", () => {
152
200
  });
153
201
  }), u("Add Booking to Trip", () => {
154
202
  s("Invalid tripId arg", async () => {
155
- const { result: r } = o(() => n());
156
- r.current.addBookingToTrip({
157
- booking: r.current.uncategorisedHotelBookings[0]
203
+ const { result: t } = o(() => n());
204
+ t.current.addBookingToTrip({
205
+ booking: t.current.uncategorisedHotelBookings[0]
158
206
  }), await i(() => {
159
- var t;
160
- e(r.current.isAddBookingToTripError).toBe(!0), e((t = r.current.addBookingToTripError) == null ? void 0 : t.message).toContain(
207
+ var r;
208
+ e(t.current.isAddBookingToTripError).toBe(!0), e((r = t.current.addBookingToTripError) == null ? void 0 : r.message).toContain(
161
209
  "Trip ID is required"
162
210
  );
163
211
  });
164
212
  }), s("Invalid bookingId arg", async () => {
165
- const { result: r } = o(() => n());
166
- r.current.addBookingToTrip({
213
+ const { result: t } = o(() => n());
214
+ t.current.addBookingToTrip({
167
215
  tripId: "12345"
168
216
  }), await i(() => {
169
- var t;
170
- e(r.current.isAddBookingToTripError).toBe(!0), e((t = r.current.addBookingToTripError) == null ? void 0 : t.message).toContain(
217
+ var r;
218
+ e(t.current.isAddBookingToTripError).toBe(!0), e((r = t.current.addBookingToTripError) == null ? void 0 : r.message).toContain(
171
219
  "Booking is required"
172
220
  );
173
221
  });
174
222
  }), s("Successfully add hotel booking to trip", async () => {
175
- const { result: r } = o(() => n()), t = r.current.uncategorisedHotelBookings[0], a = r.current.upcomingTrips[0];
176
- r.current.addBookingToTrip({
223
+ const { result: t } = o(() => n()), r = t.current.uncategorisedHotelBookings[0], a = t.current.upcomingTrips[0];
224
+ t.current.addBookingToTrip({
177
225
  tripId: a.id,
178
- booking: t
226
+ booking: r
179
227
  }), await i(() => {
180
228
  e(d.put).toHaveBeenCalledWith(
181
- p.ADD_BOOKING,
229
+ c.ADD_BOOKING,
182
230
  e.objectContaining({
183
231
  trip_id: a.id,
184
- booking_id: t.id,
185
- booking_type: k.HOTEL
232
+ booking_id: r.id,
233
+ booking_type: m.HOTEL
186
234
  })
187
235
  );
188
236
  });
189
237
  }), s("Successfully add flight booking to trip", async () => {
190
- const { result: r } = o(() => n());
191
- console.log(r.current);
192
- const t = r.current.uncategorisedFlightBookings[0], a = r.current.upcomingTrips[0];
193
- console.log({ booking: t }), r.current.addBookingToTrip({
238
+ const { result: t } = o(() => n()), r = t.current.uncategorisedFlightBookings[0], a = t.current.upcomingTrips[0];
239
+ t.current.addBookingToTrip({
194
240
  tripId: a.id,
195
- booking: t
241
+ booking: r
196
242
  }), await i(() => {
197
243
  e(d.put).toHaveBeenCalledWith(
198
- p.ADD_BOOKING,
244
+ c.ADD_BOOKING,
199
245
  e.objectContaining({
200
246
  trip_id: a.id,
201
- booking_id: t.id,
202
- booking_type: k.FLIGHT
247
+ booking_id: r.id,
248
+ booking_type: m.FLIGHT
203
249
  })
204
250
  );
205
251
  });
@@ -1,6 +1,6 @@
1
1
  import { useQuery as a, useMutation as d } from "@tanstack/react-query";
2
2
  import "../../arrayExtensions-DlcBOj5a.js";
3
- import { E as o, a as m } from "../../AccountService-Ct4hShV-.js";
3
+ import { E as o, a as m } from "../../AccountService-D_6U8vP6.js";
4
4
  import "react";
5
5
  import { WalletService as t } from "../../services/wallet/WalletService.js";
6
6
  import "react/jsx-runtime";
@@ -4,7 +4,7 @@ import "react/jsx-runtime";
4
4
  import "react";
5
5
  import "../../context/AwayzContext.js";
6
6
  import "../../arrayExtensions-DlcBOj5a.js";
7
- import { c as i } from "../../AccountService-Ct4hShV-.js";
7
+ import { c as i } from "../../AccountService-D_6U8vP6.js";
8
8
  import { EWalletEndpoints as d } from "../../configs/endpoints.js";
9
9
  import "../../configs/awayzClient.js";
10
10
  import "@tanstack/react-query";
@@ -1,4 +1,3 @@
1
- import { IPassenger } from '@type-op/shared';
2
1
  import { Moment } from 'moment';
3
2
  export declare enum EBookingType {
4
3
  HOTEL = "hotel",
@@ -16,8 +15,8 @@ export interface ITrip {
16
15
  name: string;
17
16
  startDate?: string;
18
17
  endDate?: string;
19
- hotelBookings?: IBooking[];
20
- flightBookings?: IBooking[];
18
+ hotelBookings?: IHotelBooking[];
19
+ flightBookings?: IFlightBooking[];
21
20
  }
22
21
  export interface IBooking {
23
22
  id: string;
@@ -30,7 +29,7 @@ export interface IBooking {
30
29
  export interface IHotelBooking extends IBooking {
31
30
  name: string;
32
31
  image: string;
33
- people: number;
32
+ guests: number;
34
33
  tripId?: string;
35
34
  address?: string;
36
35
  rooms?: number;
@@ -50,7 +49,7 @@ export interface IFlightBooking extends IBooking {
50
49
  location: string;
51
50
  };
52
51
  class: string;
53
- passengers: IPassenger[];
52
+ passengers: number;
54
53
  hasAirlineChanges: boolean;
55
54
  orderId: string;
56
55
  type: string;
package/dist/main.js CHANGED
@@ -4,7 +4,7 @@ import { useSearchLimit as a } from "./hooks/useSearchLimit.js";
4
4
  import { useWallet as m } from "./hooks/useWallet/useWallet.js";
5
5
  import { useTripManagement as f, validateUpdateTripArgs as l } from "./hooks/useTripManagement/useTripManagement.js";
6
6
  import { EAuthFlow as c } from "./types/EAuthFlow.js";
7
- import { c as g, i as y } from "./AccountService-Ct4hShV-.js";
7
+ import { c as g, i as y } from "./AccountService-D_6U8vP6.js";
8
8
  import { clientNoRetryInstance as T } from "./services/noRetryInstance.js";
9
9
  import { CurrencyService as h } from "./services/currency/CurrencyService.js";
10
10
  import { EBookingType as w } from "./services/trips/TripService.types.js";
@@ -2,7 +2,7 @@ import { jsx as t } from "react/jsx-runtime";
2
2
  import { useEffect as a } from "react";
3
3
  import { AwayzContext as m } from "../context/AwayzContext.js";
4
4
  import "../arrayExtensions-DlcBOj5a.js";
5
- import { e as r } from "../AccountService-Ct4hShV-.js";
5
+ import { d as r } from "../AccountService-D_6U8vP6.js";
6
6
  import { useAwayzAuth as l } from "../hooks/useAwayzAuth/useAwayzAuth.js";
7
7
  import { setCustomBaseUrl as i, setBaseUrl as u } from "../configs/baseUrl.js";
8
8
  import { QueryClientProvider as d } from "@tanstack/react-query";
@@ -1,5 +1,5 @@
1
1
  import "../../arrayExtensions-DlcBOj5a.js";
2
- import { A as c } from "../../AccountService-Ct4hShV-.js";
2
+ import { A as c } from "../../AccountService-D_6U8vP6.js";
3
3
  import "react";
4
4
  import "../../configs/endpoints.js";
5
5
  import "../../configs/awayzClient.js";
@@ -2,7 +2,7 @@ var c = Object.defineProperty;
2
2
  var r = (o, t, a) => t in o ? c(o, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : o[t] = a;
3
3
  var n = (o, t, a) => r(o, typeof t != "symbol" ? t + "" : t, a);
4
4
  import "../../arrayExtensions-DlcBOj5a.js";
5
- import { c as e, b as i } from "../../AccountService-Ct4hShV-.js";
5
+ import { c as e, b as i } from "../../AccountService-D_6U8vP6.js";
6
6
  import "react";
7
7
  import { EBookingEndpoints as s } from "../../configs/endpoints.js";
8
8
  class l {
@@ -2,7 +2,7 @@ import '../../assets/_styles4.css';import '../../assets/_styles3.css';import '..
2
2
  var y = (t, r, e) => r in t ? u(t, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[r] = e;
3
3
  var n = (t, r, e) => y(t, typeof r != "symbol" ? r + "" : r, e);
4
4
  import "../../arrayExtensions-DlcBOj5a.js";
5
- import { A as p, E as m, c as a } from "../../AccountService-Ct4hShV-.js";
5
+ import { A as p, E as m, c as a } from "../../AccountService-D_6U8vP6.js";
6
6
  import "react";
7
7
  import { ECurrencyEndpoints as s } from "../../configs/endpoints.js";
8
8
  import "react/jsx-runtime";
@@ -1,4 +1,4 @@
1
- import { c as o, i as n } from "../AccountService-Ct4hShV-.js";
1
+ import { c as o, i as n } from "../AccountService-D_6U8vP6.js";
2
2
  import { clientNoRetryInstance as c } from "./noRetryInstance.js";
3
3
  import { CurrencyService as a } from "./currency/CurrencyService.js";
4
4
  import { EBookingType as s } from "./trips/TripService.types.js";
@@ -1,5 +1,5 @@
1
1
  import "../arrayExtensions-DlcBOj5a.js";
2
- import { c as a, i as c } from "../AccountService-Ct4hShV-.js";
2
+ import { c as a, i as c } from "../AccountService-D_6U8vP6.js";
3
3
  import "react";
4
4
  import "../configs/baseUrl.js";
5
5
  export {
@@ -1,4 +1,4 @@
1
- import { m as p, k as l, l as m, g, h, p as u } from "../AccountService-Ct4hShV-.js";
1
+ import { m as p, k as l, l as m, g, h, p as u } from "../AccountService-D_6U8vP6.js";
2
2
  import "../configs/baseUrl.js";
3
3
  import "../arrayExtensions-DlcBOj5a.js";
4
4
  import "react";
@@ -1,4 +1,4 @@
1
- import { f as t, g as r, h as n } from "../AccountService-Ct4hShV-.js";
1
+ import { e as t, g as r, h as n } from "../AccountService-D_6U8vP6.js";
2
2
  const s = t.create();
3
3
  s.interceptors.request.use((e) => (e = r(e), e));
4
4
  const o = 1;
@@ -1,81 +1,9 @@
1
- var g = Object.defineProperty;
2
- var d = (a, t, s) => t in a ? g(a, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : a[t] = s;
3
- var o = (a, t, s) => d(a, typeof t != "symbol" ? t + "" : t, s);
4
- import { c as r, d as p, b as n, r as T } from "../../AccountService-Ct4hShV-.js";
5
- import { EBookingType as u } from "./TripService.types.js";
6
- import { EMyTripsEndpoints as i } from "../../configs/endpoints.js";
1
+ import "../../AccountService-D_6U8vP6.js";
2
+ import "./TripService.types.js";
3
+ import "../../configs/endpoints.js";
7
4
  import "../../arrayExtensions-DlcBOj5a.js";
5
+ import { T as s } from "../../TripsService-BGx--gfb.js";
8
6
  import "react";
9
- class l {
10
- constructor() {
11
- o(this, "createTrip", async (t) => {
12
- const { data: s } = await r.post(
13
- i.TRIPS,
14
- p(t)
15
- );
16
- return s;
17
- });
18
- o(this, "getTripsByStatus", async (t) => {
19
- const { data: s } = await r.get(
20
- i.TRIPS,
21
- {
22
- params: { status: t }
23
- }
24
- );
25
- return s != null && s.success ? n(s.data) : [];
26
- });
27
- o(this, "updateTrip", async (t, s) => {
28
- const { data: e } = await r.put(
29
- `${i.TRIPS}/${t}`,
30
- T(p(s))
31
- );
32
- return e != null && e.success ? {
33
- success: !0,
34
- data: n(e.data),
35
- message: "Trip updated successfully."
36
- } : {
37
- success: !1,
38
- message: "An error occurred while trying to update the trip."
39
- };
40
- });
41
- o(this, "deleteTrip", async (t) => {
42
- const { data: s } = await r.delete(
43
- `${i.TRIPS}/${t}`
44
- );
45
- return s;
46
- });
47
- o(this, "getUncategorisedBookings", async () => {
48
- const { data: t } = await r.get(
49
- i.UNCATEGORISED_BOOKINGS
50
- );
51
- if (!(t != null && t.success))
52
- return {
53
- flightBookings: [],
54
- hotelBookings: []
55
- };
56
- const s = n(t.data);
57
- return {
58
- flightBookings: s.flightBookings.map((e) => ({
59
- ...e,
60
- bookingType: u.FLIGHT
61
- })) ?? [],
62
- hotelBookings: s.hotelBookings.map((e) => ({
63
- ...e,
64
- bookingType: u.HOTEL
65
- })) ?? []
66
- };
67
- });
68
- o(this, "addBookingToTrip", async (t, s, e) => {
69
- const { data: c } = await r.put(i.ADD_BOOKING, {
70
- trip_id: t,
71
- booking_id: s,
72
- booking_type: e
73
- });
74
- return c.success;
75
- });
76
- }
77
- }
78
- const I = new l();
79
7
  export {
80
- I as TripsService
8
+ s as TripsService
81
9
  };
@@ -2,7 +2,7 @@ var y = Object.defineProperty;
2
2
  var w = (e, a, t) => a in e ? y(e, a, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[a] = t;
3
3
  var s = (e, a, t) => w(e, typeof a != "symbol" ? a + "" : a, t);
4
4
  import "../../arrayExtensions-DlcBOj5a.js";
5
- import { a as o, c, b as n } from "../../AccountService-Ct4hShV-.js";
5
+ import { a as o, c, b as n } from "../../AccountService-D_6U8vP6.js";
6
6
  import "react";
7
7
  import { EWalletEndpoints as i } from "../../configs/endpoints.js";
8
8
  class E {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@odynn/awayz-core",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"