@odynn/awayz-core 0.3.10 → 0.3.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,13 +1,8 @@
|
|
|
1
|
-
import { IAirport } from '@type-op/shared';
|
|
2
|
-
export interface IBed {
|
|
3
|
-
}
|
|
1
|
+
import { IAirport, ICoordinates } from '@type-op/shared';
|
|
4
2
|
export interface IGuest {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
photo: string[];
|
|
9
|
-
totalAmount: number;
|
|
10
|
-
name: string;
|
|
3
|
+
familyName: string;
|
|
4
|
+
givenName: string;
|
|
5
|
+
type: string;
|
|
11
6
|
}
|
|
12
7
|
export interface IAddress {
|
|
13
8
|
lineOne: string;
|
|
@@ -18,12 +13,7 @@ export interface IAddress {
|
|
|
18
13
|
}
|
|
19
14
|
export interface IHotelBookingDetails {
|
|
20
15
|
id: string;
|
|
21
|
-
userId: string;
|
|
22
16
|
status: string;
|
|
23
|
-
accommodationId: string;
|
|
24
|
-
numberOfGuests: number;
|
|
25
|
-
rateId: string;
|
|
26
|
-
quoteId: string;
|
|
27
17
|
baseAmount: number;
|
|
28
18
|
baseCurrency: string;
|
|
29
19
|
taxAmount: number;
|
|
@@ -32,12 +22,19 @@ export interface IHotelBookingDetails {
|
|
|
32
22
|
feeCurrency: string;
|
|
33
23
|
totalAmount: number;
|
|
34
24
|
totalCurrency: string;
|
|
35
|
-
checkInDate: string;
|
|
36
|
-
checkOutDate: string;
|
|
37
25
|
images: string[];
|
|
38
|
-
|
|
26
|
+
numberOfRooms: number;
|
|
39
27
|
address: IAddress;
|
|
40
28
|
guests: IGuest[];
|
|
29
|
+
reference: string;
|
|
30
|
+
name: string;
|
|
31
|
+
description: string;
|
|
32
|
+
cancelledAt?: string;
|
|
33
|
+
checkoutDate: string;
|
|
34
|
+
checkoutBeforeTime: string;
|
|
35
|
+
checkinDate: string;
|
|
36
|
+
checkinAfterTime: string;
|
|
37
|
+
coordinates: ICoordinates;
|
|
41
38
|
}
|
|
42
39
|
export interface IFlightConditionDetails {
|
|
43
40
|
allowed: boolean;
|
|
@@ -1,35 +1,66 @@
|
|
|
1
1
|
var m = Object.defineProperty;
|
|
2
|
-
var l = (n,
|
|
3
|
-
var o = (n,
|
|
2
|
+
var l = (n, e, a) => e in n ? m(n, e, { enumerable: !0, configurable: !0, writable: !0, value: a }) : n[e] = a;
|
|
3
|
+
var o = (n, e, a) => l(n, typeof e != "symbol" ? e + "" : e, a);
|
|
4
4
|
import "../../arrayExtensions-DlcBOj5a.js";
|
|
5
|
-
import { c as i, b as
|
|
5
|
+
import { c as i, b as s } from "../../AccountService-D_6U8vP6.js";
|
|
6
6
|
import "react";
|
|
7
|
-
import { EBookingEndpoints as
|
|
7
|
+
import { EBookingEndpoints as d } from "../../configs/endpoints.js";
|
|
8
8
|
const u = (n) => {
|
|
9
|
-
const
|
|
9
|
+
const e = /P((\d+)D)?T((\d+)H)?((\d+)M)?/, a = n.match(e);
|
|
10
10
|
if (a) {
|
|
11
|
-
const
|
|
12
|
-
return `${
|
|
11
|
+
const c = a[2] ? `${a[2]}d ` : "", t = a[4] ? `${a[4]}h ` : "", r = a[6] ? `${a[6]}m` : "";
|
|
12
|
+
return `${c}${t}${r}`.trim();
|
|
13
13
|
} else
|
|
14
14
|
return n;
|
|
15
15
|
};
|
|
16
16
|
class _ {
|
|
17
17
|
constructor() {
|
|
18
|
-
o(this, "getHotelBooking", async (
|
|
18
|
+
o(this, "getHotelBooking", async (e) => {
|
|
19
19
|
const { data: a } = await i.get(
|
|
20
|
-
`${
|
|
20
|
+
`${d.USER_HOTEL_BOOKINGS}/${e}`
|
|
21
21
|
);
|
|
22
|
-
return
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
return {
|
|
23
|
+
id: a.data._id,
|
|
24
|
+
totalAmount: parseFloat(a.data.total_amount),
|
|
25
|
+
feeAmount: parseFloat(a.data.fee_amount),
|
|
26
|
+
taxAmount: parseFloat(a.data.tax_amount),
|
|
27
|
+
baseAmount: parseFloat(a.data.base_amount),
|
|
28
|
+
cancelledAt: a.data.cancelled_at,
|
|
29
|
+
totalCurrency: a.data.total_currency,
|
|
30
|
+
baseCurrency: a.data.base_currency,
|
|
31
|
+
feeCurrency: a.data.fee_currency,
|
|
32
|
+
taxCurrency: a.data.tax_currency,
|
|
33
|
+
status: a.data.status,
|
|
34
|
+
description: a.data.data.accommodation.description,
|
|
35
|
+
name: a.data.data.accommodation.name,
|
|
36
|
+
reference: a.data.reference,
|
|
37
|
+
address: {
|
|
38
|
+
lineOne: a.data.address.line_one,
|
|
39
|
+
cityName: a.data.address.city_name,
|
|
40
|
+
postalCode: a.data.address.postal_code,
|
|
41
|
+
countryCode: a.data.address.country_code,
|
|
42
|
+
region: a.data.address.region || null
|
|
43
|
+
},
|
|
44
|
+
checkinDate: a.data.checkin_date,
|
|
45
|
+
checkinAfterTime: a.data.data.accommodation.check_in_information.check_in_after_time,
|
|
46
|
+
checkoutDate: a.data.checkout_date,
|
|
47
|
+
checkoutBeforeTime: a.data.data.accommodation.check_in_information.check_out_before_time,
|
|
48
|
+
coordinates: {
|
|
49
|
+
latitude: a.data.data.accommodation.location.geographic_coordinates.latitude,
|
|
50
|
+
longitude: a.data.data.accommodation.location.geographic_coordinates.longitude
|
|
51
|
+
},
|
|
52
|
+
images: a.data.images,
|
|
53
|
+
guests: a.data.data.guests.map((t, r) => ({
|
|
54
|
+
familyName: t.family_name,
|
|
55
|
+
givenName: t.given_name,
|
|
56
|
+
type: a.data.data.guest_types[r].type
|
|
57
|
+
})),
|
|
58
|
+
numberOfRooms: a.data.rooms.length
|
|
59
|
+
};
|
|
29
60
|
});
|
|
30
|
-
o(this, "getFlightBooking", async (
|
|
61
|
+
o(this, "getFlightBooking", async (e) => {
|
|
31
62
|
const { data: a } = await i.get(
|
|
32
|
-
`${
|
|
63
|
+
`${d.USER_FLIGHT_BOOKINGS}/${e}`
|
|
33
64
|
);
|
|
34
65
|
return {
|
|
35
66
|
id: a.data._id,
|
|
@@ -45,51 +76,51 @@ class _ {
|
|
|
45
76
|
flightOfferId: a.data.flight_offer_id,
|
|
46
77
|
cancelledAt: a.data.cancelled_at,
|
|
47
78
|
airlines: a.data.data.slices[0].segments.map(
|
|
48
|
-
(
|
|
79
|
+
(t) => t.operating_carrier.name
|
|
49
80
|
),
|
|
50
|
-
passengers: a.data.data.passengers.map((
|
|
51
|
-
id:
|
|
52
|
-
givenName:
|
|
53
|
-
familyName:
|
|
54
|
-
type:
|
|
55
|
-
title:
|
|
56
|
-
email:
|
|
57
|
-
gender:
|
|
58
|
-
phoneNumber:
|
|
81
|
+
passengers: a.data.data.passengers.map((t) => ({
|
|
82
|
+
id: t.id,
|
|
83
|
+
givenName: t.given_ame,
|
|
84
|
+
familyName: t.family_name,
|
|
85
|
+
type: t.type,
|
|
86
|
+
title: t.title,
|
|
87
|
+
email: t.email,
|
|
88
|
+
gender: t.gender,
|
|
89
|
+
phoneNumber: t.phone_number
|
|
59
90
|
})),
|
|
60
|
-
flights: a.data.data.slices.map((
|
|
61
|
-
departingAt:
|
|
62
|
-
arrivingAt:
|
|
63
|
-
numberOfStops:
|
|
91
|
+
flights: a.data.data.slices.map((t) => ({
|
|
92
|
+
departingAt: t.segments[0].departing_at,
|
|
93
|
+
arrivingAt: t.segments.getLast().arriving_at,
|
|
94
|
+
numberOfStops: t.segments.length - 1,
|
|
64
95
|
reference: a.data.booking_reference,
|
|
65
|
-
durationInMinutes: u(
|
|
66
|
-
origin:
|
|
67
|
-
destination:
|
|
96
|
+
durationInMinutes: u(t.duration),
|
|
97
|
+
origin: s(t.origin),
|
|
98
|
+
destination: s(t.destination)
|
|
68
99
|
})),
|
|
69
100
|
availableActions: a.data.available_actions
|
|
70
101
|
};
|
|
71
102
|
});
|
|
72
|
-
o(this, "initiateCancelFlightBooking", async (
|
|
103
|
+
o(this, "initiateCancelFlightBooking", async (e) => {
|
|
73
104
|
const { data: a } = await i.put(
|
|
74
|
-
`${
|
|
105
|
+
`${d.INITIATE_FLIGHT_CANCEL}/${e}`
|
|
75
106
|
);
|
|
76
107
|
return a.success;
|
|
77
108
|
});
|
|
78
|
-
o(this, "confirmCancelFlightBooking", async (
|
|
109
|
+
o(this, "confirmCancelFlightBooking", async (e) => {
|
|
79
110
|
const { data: a } = await i.put(
|
|
80
|
-
`${
|
|
111
|
+
`${d.CONFIRM_FLIGHT_CANCEL}/${e}`
|
|
81
112
|
);
|
|
82
113
|
return a.success;
|
|
83
114
|
});
|
|
84
|
-
o(this, "cancelHotelBooking", async (
|
|
115
|
+
o(this, "cancelHotelBooking", async (e) => {
|
|
85
116
|
const { data: a } = await i.post(
|
|
86
|
-
`${
|
|
117
|
+
`${d.CANCEL_HOTEL_BOOKING}/${e}`
|
|
87
118
|
);
|
|
88
119
|
return a.success;
|
|
89
120
|
});
|
|
90
121
|
}
|
|
91
122
|
}
|
|
92
|
-
const
|
|
123
|
+
const k = new _();
|
|
93
124
|
export {
|
|
94
|
-
|
|
125
|
+
k as BookingService
|
|
95
126
|
};
|