@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
|
|
2
|
-
var
|
|
3
|
-
var c = (
|
|
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
|
|
5
|
+
import { c as r, a as u } from "../../AccountService-DHR8seWS.js";
|
|
6
6
|
import "react";
|
|
7
|
-
import { EBookingEndpoints as
|
|
8
|
-
const
|
|
9
|
-
const e = /P((\d+)D)?T((\d+)H)?((\d+)M)?/, a =
|
|
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 ` : "",
|
|
12
|
-
return `${o}${t}${
|
|
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
|
|
14
|
+
return i;
|
|
15
15
|
};
|
|
16
|
-
class
|
|
16
|
+
class y {
|
|
17
17
|
constructor() {
|
|
18
18
|
c(this, "getHotelBooking", async (e) => {
|
|
19
|
-
var
|
|
19
|
+
var _, m;
|
|
20
20
|
const { data: a } = await r.get(
|
|
21
|
-
`${
|
|
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((
|
|
54
|
-
guests: a.data.guests.map((
|
|
55
|
-
var
|
|
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:
|
|
58
|
-
givenName:
|
|
59
|
-
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: (
|
|
62
|
+
numberOfRooms: (_ = a.data.rooms) == null ? void 0 : _.length,
|
|
63
63
|
cancellationTimeline: o.cancellation_timeline.map(
|
|
64
|
-
(
|
|
65
|
-
refundAmount: parseFloat(
|
|
66
|
-
currency:
|
|
67
|
-
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
|
-
`${
|
|
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:
|
|
129
|
-
origin:
|
|
130
|
-
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:
|
|
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
|
-
`${
|
|
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
|
-
`${
|
|
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
|
-
`${
|
|
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
|
-
|
|
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
|
|
187
|
+
const F = new y();
|
|
177
188
|
export {
|
|
178
|
-
|
|
189
|
+
F as BookingService
|
|
179
190
|
};
|