@odynn/awayz-core 0.6.40 → 0.6.41

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.
@@ -37,6 +37,15 @@ export interface IHotelBookingDetails {
37
37
  coordinates: ICoordinates;
38
38
  cancellationTimeline: ICancellationTimeline[];
39
39
  pointsAsCash?: IPointsAsCash;
40
+ rooms: {
41
+ beds: IBed[];
42
+ totalAmount: number;
43
+ name: string;
44
+ }[];
45
+ }
46
+ export interface IBed {
47
+ type: string;
48
+ count: number;
40
49
  }
41
50
  export interface IPointsAsCash {
42
51
  authCode: string;
@@ -1,24 +1,24 @@
1
- var m = Object.defineProperty;
2
- var p = (n, e, a) => e in n ? m(n, e, { enumerable: !0, configurable: !0, writable: !0, value: a }) : n[e] = a;
3
- var c = (n, e, a) => p(n, typeof e != "symbol" ? e + "" : e, a);
1
+ var p = Object.defineProperty;
2
+ var g = (i, e, a) => e in i ? p(i, e, { enumerable: !0, configurable: !0, writable: !0, value: a }) : i[e] = a;
3
+ var c = (i, e, a) => g(i, typeof e != "symbol" ? e + "" : e, a);
4
4
  import "../../arrayExtensions-DlcBOj5a.js";
5
- import { c as r, a as _ } from "../../AccountService-DHR8seWS.js";
5
+ import { c as r, a as u } from "../../AccountService-DHR8seWS.js";
6
6
  import "react";
7
- import { EBookingEndpoints as d } from "../../configs/endpoints.js";
8
- const g = (n) => {
9
- const e = /P((\d+)D)?T((\d+)H)?((\d+)M)?/, a = n.match(e);
7
+ import { EBookingEndpoints as s } from "../../configs/endpoints.js";
8
+ const f = (i) => {
9
+ const e = /P((\d+)D)?T((\d+)H)?((\d+)M)?/, a = i.match(e);
10
10
  if (a) {
11
- const o = a[2] ? `${a[2]}d ` : "", t = a[4] ? `${a[4]}h ` : "", s = a[6] ? `${a[6]}m` : "";
12
- return `${o}${t}${s}`.trim();
11
+ const o = a[2] ? `${a[2]}d ` : "", t = a[4] ? `${a[4]}h ` : "", _ = a[6] ? `${a[6]}m` : "";
12
+ return `${o}${t}${_}`.trim();
13
13
  } else
14
- return n;
14
+ return i;
15
15
  };
16
- class f {
16
+ class y {
17
17
  constructor() {
18
18
  c(this, "getHotelBooking", async (e) => {
19
- var s;
19
+ var _, m;
20
20
  const { data: a } = await r.get(
21
- `${d.USER_HOTEL_BOOKINGS}/${e}`
21
+ `${s.USER_HOTEL_BOOKINGS}/${e}`
22
22
  ), o = a.data.accommodation.rooms[0].rates[0];
23
23
  return {
24
24
  id: a.data._id,
@@ -50,33 +50,44 @@ class f {
50
50
  latitude: a.data.accommodation.location.geographic_coordinates.latitude,
51
51
  longitude: a.data.accommodation.location.geographic_coordinates.longitude
52
52
  },
53
- images: a.data.accommodation.photos.map((i) => i.url),
54
- guests: a.data.guests.map((i, u) => {
55
- var l;
53
+ images: a.data.accommodation.photos.map((n) => n.url),
54
+ guests: a.data.guests.map((n, l) => {
55
+ var d;
56
56
  return {
57
- familyName: i.family_name,
58
- givenName: i.given_name,
59
- type: (l = a.data.guest_types[u]) == null ? void 0 : l.type
57
+ familyName: n.family_name,
58
+ givenName: n.given_name,
59
+ type: (d = a.data.guest_types[l]) == null ? void 0 : d.type
60
60
  };
61
61
  }),
62
- numberOfRooms: (s = a.data.rooms) == null ? void 0 : s.length,
62
+ numberOfRooms: (_ = a.data.rooms) == null ? void 0 : _.length,
63
63
  cancellationTimeline: o.cancellation_timeline.map(
64
- (i) => ({
65
- refundAmount: parseFloat(i.refund_amount),
66
- currency: i.currency,
67
- before: i.before
64
+ (n) => ({
65
+ refundAmount: parseFloat(n.refund_amount),
66
+ currency: n.currency,
67
+ before: n.before
68
68
  })
69
69
  ),
70
70
  pointsAsCash: a.data.points_as_cash ? {
71
71
  authCode: a.data.points_as_cash.auth_code,
72
72
  points: a.data.points_as_cash.points,
73
73
  pointsValue: a.data.points_as_cash.points_value
74
- } : void 0
74
+ } : void 0,
75
+ rooms: (m = a.data.rooms) == null ? void 0 : m.map((n) => {
76
+ var l;
77
+ return {
78
+ beds: (l = n.beds) == null ? void 0 : l.map((d) => ({
79
+ type: d.type,
80
+ count: d.count
81
+ })),
82
+ totalAmount: parseFloat(n.rates[0].total_amount),
83
+ name: n.name
84
+ };
85
+ })
75
86
  };
76
87
  });
77
88
  c(this, "getFlightBooking", async (e) => {
78
89
  const { data: a } = await r.get(
79
- `${d.USER_FLIGHT_BOOKINGS}/${e}`
90
+ `${s.USER_FLIGHT_BOOKINGS}/${e}`
80
91
  );
81
92
  return {
82
93
  id: a.data._id,
@@ -125,12 +136,12 @@ class f {
125
136
  arrivingAt: t.segments.getLast().arriving_at,
126
137
  numberOfStops: t.segments.length - 1,
127
138
  reference: a.data.booking_reference,
128
- durationInMinutes: g(t.duration),
129
- origin: _(t.origin),
130
- destination: _(t.destination)
139
+ durationInMinutes: f(t.duration),
140
+ origin: u(t.origin),
141
+ destination: u(t.destination)
131
142
  })),
132
143
  availableActions: a.data.available_actions,
133
- airlineInitiatedChanges: _(a.data.airline_initiated_changes) || [],
144
+ airlineInitiatedChanges: u(a.data.airline_initiated_changes) || [],
134
145
  pointsAsCash: a.data.points_as_cash ? {
135
146
  authCode: a.data.points_as_cash.auth_code,
136
147
  points: a.data.points_as_cash.points,
@@ -140,19 +151,19 @@ class f {
140
151
  });
141
152
  c(this, "initiateCancelFlightBooking", async (e) => {
142
153
  const { data: a } = await r.put(
143
- `${d.INITIATE_FLIGHT_CANCEL}/${e}`
154
+ `${s.INITIATE_FLIGHT_CANCEL}/${e}`
144
155
  );
145
156
  return a.success;
146
157
  });
147
158
  c(this, "confirmCancelFlightBooking", async (e) => {
148
159
  const { data: a } = await r.put(
149
- `${d.CONFIRM_FLIGHT_CANCEL}/${e}`
160
+ `${s.CONFIRM_FLIGHT_CANCEL}/${e}`
150
161
  );
151
162
  return a.success;
152
163
  });
153
164
  c(this, "cancelHotelBooking", async (e) => {
154
165
  const { data: a } = await r.post(
155
- `${d.CANCEL_HOTEL_BOOKING}/${e}`
166
+ `${s.CANCEL_HOTEL_BOOKING}/${e}`
156
167
  );
157
168
  return a.success;
158
169
  });
@@ -162,7 +173,7 @@ class f {
162
173
  aicId: o
163
174
  }) => {
164
175
  const { data: t } = await r.post(
165
- d.ACTION_AIRLINE_CHANGES,
176
+ s.ACTION_AIRLINE_CHANGES,
166
177
  {
167
178
  booking_id: e,
168
179
  action_taken: a ? "accepted" : "cancelled",
@@ -173,7 +184,7 @@ class f {
173
184
  });
174
185
  }
175
186
  }
176
- const k = new f();
187
+ const F = new y();
177
188
  export {
178
- k as BookingService
189
+ F as BookingService
179
190
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@odynn/awayz-core",
3
- "version": "0.6.40",
3
+ "version": "0.6.41",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"