@odynn/awayz-core 0.6.10 → 0.6.11

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.
@@ -1,15 +1,16 @@
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 r = (a, e, s) => g(a, typeof e != "symbol" ? e + "" : e, s);
1
+ var l = Object.defineProperty;
2
+ var g = (r, e, s) => e in r ? l(r, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : r[e] = s;
3
+ var t = (r, e, s) => g(r, typeof e != "symbol" ? e + "" : e, s);
4
4
  import "./arrayExtensions-DlcBOj5a.js";
5
- import { c as n, f as p, a as o, r as T } from "./AccountService-DGz0jGwx.js";
5
+ import { c as n, f as p, a as c, r as T } from "./AccountService-DGz0jGwx.js";
6
6
  import "react";
7
7
  import { EMyTripsEndpoints as i } from "./configs/endpoints.js";
8
8
  import { EBookingType as m } from "./services/trips/TripService.types.js";
9
- const y = "https://assets.duffel.com/img/airlines/for-light-background/full-color-lockup/";
10
- class b {
9
+ import { DEFAULT_LOGO as y } from "./configs/defaultAwayzConfig.js";
10
+ const b = "https://assets.duffel.com/img/airlines/for-light-background/full-color-lockup/";
11
+ class f {
11
12
  constructor() {
12
- r(this, "createTrip", async (e) => {
13
+ t(this, "createTrip", async (e) => {
13
14
  const { data: s } = await n.post(
14
15
  i.TRIPS,
15
16
  p({
@@ -20,7 +21,7 @@ class b {
20
21
  );
21
22
  return s;
22
23
  });
23
- r(this, "getTripsByStatus", async (e) => {
24
+ t(this, "getTripsByStatus", async (e) => {
24
25
  const { data: s } = await n.get(
25
26
  i.TRIPS,
26
27
  {
@@ -29,77 +30,80 @@ class b {
29
30
  );
30
31
  if (!(s != null && s.success))
31
32
  return [];
32
- const t = s.data.map((d) => ({
33
+ const a = s.data.map((d) => ({
33
34
  ...d,
34
35
  flightBookings: u(d.flight_bookings ?? []),
35
- hotelBookings: l(d.hotel_bookings ?? [])
36
+ hotelBookings: _(d.hotel_bookings ?? [])
36
37
  }));
37
- return o(t);
38
+ return c(a);
38
39
  });
39
- r(this, "updateTrip", async (e, s) => {
40
- const { data: t } = await n.put(
40
+ t(this, "updateTrip", async (e, s) => {
41
+ const { data: a } = await n.put(
41
42
  `${i.TRIPS}/${e}`,
42
43
  T(p(s))
43
44
  );
44
- return t != null && t.success ? {
45
+ return a != null && a.success ? {
45
46
  success: !0,
46
- data: o(t.data),
47
+ data: c(a.data),
47
48
  message: "Trip updated successfully."
48
49
  } : {
49
50
  success: !1,
50
51
  message: "An error occurred while trying to update the trip."
51
52
  };
52
53
  });
53
- r(this, "deleteTrip", async (e) => {
54
+ t(this, "deleteTrip", async (e) => {
54
55
  const { data: s } = await n.delete(
55
56
  `${i.TRIPS}/${e}`
56
57
  );
57
58
  return s;
58
59
  });
59
- r(this, "getUncategorisedBookings", async () => {
60
+ t(this, "getUncategorisedBookings", async () => {
60
61
  const { data: e } = await n.get(
61
62
  i.UNCATEGORISED_BOOKINGS
62
63
  );
63
64
  return e != null && e.success ? {
64
65
  flightBookings: u(e.data.flight_bookings ?? []),
65
- hotelBookings: l(e.data.hotel_bookings ?? [])
66
+ hotelBookings: _(e.data.hotel_bookings ?? [])
66
67
  } : {
67
68
  flightBookings: [],
68
69
  hotelBookings: []
69
70
  };
70
71
  });
71
- r(this, "addBookingToTrip", async (e, s, t) => {
72
- const { data: c } = await n.put(i.ADD_BOOKING, {
72
+ t(this, "addBookingToTrip", async (e, s, a) => {
73
+ const { data: o } = await n.put(i.ADD_BOOKING, {
73
74
  trip_id: e,
74
75
  booking_id: s,
75
- booking_type: t
76
+ booking_type: a
76
77
  });
77
- return c.success;
78
+ return o.success;
78
79
  });
79
- r(this, "removeBookingFromTrip", async (e, s, t) => {
80
- const { data: c } = await n.put(
80
+ t(this, "removeBookingFromTrip", async (e, s, a) => {
81
+ const { data: o } = await n.put(
81
82
  i.REMOVE_BOOKING,
82
83
  p({
83
84
  trip_id: e,
84
85
  booking_id: s,
85
- booking_type: t
86
+ booking_type: a
86
87
  })
87
88
  );
88
- return c.success;
89
+ return o.success;
89
90
  });
90
91
  }
91
92
  }
92
- const u = (a) => a.map(
93
- (e) => o({
93
+ const u = (r) => r.map(
94
+ (e) => c({
94
95
  id: e._id,
95
96
  reference: e.booking_reference,
96
97
  startDate: e.departure_date,
97
98
  endDate: e.arrival_date,
98
99
  bookingType: m.FLIGHT,
99
- airlines: e.slices.map((s) => ({
100
- logo: y + ".svg",
101
- name: s.carriers.operating[0]
102
- })),
100
+ airlines: e.slices.map((s) => {
101
+ var a;
102
+ return {
103
+ logo: (a = s.carriers.operating_iata_codes) != null && a.length ? `${b}${s.carriers.operating_iata_codes[0]}.svg` : y,
104
+ name: s.carriers.operating[0]
105
+ };
106
+ }),
103
107
  arrival: {
104
108
  airportCode: e.slices.getLast().destination,
105
109
  location: ""
@@ -115,8 +119,8 @@ const u = (a) => a.map(
115
119
  type: e.type,
116
120
  cancelledAt: e.cancelled_at
117
121
  })
118
- ), l = (a) => a.map(
119
- (e) => o({
122
+ ), _ = (r) => r.map(
123
+ (e) => c({
120
124
  id: e._id,
121
125
  reference: e.reference,
122
126
  startDate: e.check_in_date,
@@ -130,8 +134,8 @@ const u = (a) => a.map(
130
134
  bookingId: e.booking_id,
131
135
  cancelledAt: e.cancelled_at
132
136
  })
133
- ), O = new b();
137
+ ), w = new f();
134
138
  export {
135
- y as D,
136
- O as T
139
+ b as D,
140
+ w as T
137
141
  };
@@ -1,12 +1,13 @@
1
- const o = {
1
+ const o = "https://awayz.com/favicon.ico", t = {
2
2
  testMode: !1,
3
3
  externalInventory: !1,
4
4
  flightsConfig: {
5
5
  streamTimeoutPingCount: 3,
6
6
  streamTimeoutTotalSeconds: 180
7
7
  },
8
- logoFallbackImageUrl: "https://awayz.com/favicon.ico"
8
+ logoFallbackImageUrl: o
9
9
  };
10
10
  export {
11
- o as defaultAwayzConfig
11
+ o as DEFAULT_LOGO,
12
+ t as defaultAwayzConfig
12
13
  };
@@ -2,7 +2,7 @@ import { useQuery as p, useMutation as s } from "@tanstack/react-query";
2
2
  import { h as m } from "../../arrayExtensions-DlcBOj5a.js";
3
3
  import { E as e } from "../../AccountService-DGz0jGwx.js";
4
4
  import "react";
5
- import { T as t } from "../../TripsService-BHByIiRu.js";
5
+ import { T as t } from "../../TripsService-DrPrX2_z.js";
6
6
  import "react/jsx-runtime";
7
7
  import { awayzClient as o } from "../../configs/awayzClient.js";
8
8
  import '../../assets/_styles4.css';import '../../assets/_styles3.css';import '../../assets/_styles2.css';import '../../assets/_styles.css';import '../../assets/_styles5.css';/* empty css */
@@ -1,5 +1,5 @@
1
1
  import { h as p } from "../../arrayExtensions-DlcBOj5a.js";
2
- import { D as f } from "../../TripsService-BHByIiRu.js";
2
+ import { D as f } from "../../TripsService-DrPrX2_z.js";
3
3
  import "react";
4
4
  import { renderHook as o, waitFor as i } from "../../tests/TestWrapper.js";
5
5
  import { EMyTripsEndpoints as c } from "../../configs/endpoints.js";
@@ -1,2 +1,3 @@
1
1
  import { IAwayzConfig } from './awayzConfig';
2
+ export declare const DEFAULT_LOGO = "https://awayz.com/favicon.ico";
2
3
  export declare const defaultAwayzConfig: Partial<IAwayzConfig>;
@@ -1,9 +1,10 @@
1
1
  import "../../arrayExtensions-DlcBOj5a.js";
2
2
  import "../../AccountService-DGz0jGwx.js";
3
- import { T as s } from "../../TripsService-BHByIiRu.js";
3
+ import { T } from "../../TripsService-DrPrX2_z.js";
4
4
  import "react";
5
5
  import "../../configs/endpoints.js";
6
6
  import "./TripService.types.js";
7
+ import "../../configs/defaultAwayzConfig.js";
7
8
  export {
8
- s as TripsService
9
+ T as TripsService
9
10
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@odynn/awayz-core",
3
- "version": "0.6.10",
3
+ "version": "0.6.11",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"