@odynn/awayz-core 0.3.6 → 0.3.7
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,3 +1,4 @@
|
|
|
1
|
+
import { IAirport } from '@type-op/shared';
|
|
1
2
|
export interface IBed {
|
|
2
3
|
}
|
|
3
4
|
export interface IGuest {
|
|
@@ -38,21 +39,6 @@ export interface IHotelBookingDetails {
|
|
|
38
39
|
address: IAddress;
|
|
39
40
|
guests: IGuest[];
|
|
40
41
|
}
|
|
41
|
-
export interface IFlightPassenger {
|
|
42
|
-
id: string;
|
|
43
|
-
type: string | null;
|
|
44
|
-
}
|
|
45
|
-
export interface IFlightCarriers {
|
|
46
|
-
marketing: string[];
|
|
47
|
-
operating: string[];
|
|
48
|
-
}
|
|
49
|
-
export interface IFlightSlice {
|
|
50
|
-
id: string;
|
|
51
|
-
origin: string;
|
|
52
|
-
destination: string;
|
|
53
|
-
carriers: IFlightCarriers;
|
|
54
|
-
fareBrandName: string | null;
|
|
55
|
-
}
|
|
56
42
|
export interface IFlightConditionDetails {
|
|
57
43
|
allowed: boolean;
|
|
58
44
|
penaltyAmount: string | null;
|
|
@@ -62,49 +48,38 @@ export interface IFlightConditions {
|
|
|
62
48
|
refundBeforeDeparture: IFlightConditionDetails;
|
|
63
49
|
changeBeforeDeparture: IFlightConditionDetails;
|
|
64
50
|
}
|
|
65
|
-
export interface IFlightPaymentStatus {
|
|
66
|
-
paidAt: string;
|
|
67
|
-
priceGuaranteeExpiresAt: string | null;
|
|
68
|
-
paymentRequiredBy: string | null;
|
|
69
|
-
awaitingPayment: boolean;
|
|
70
|
-
}
|
|
71
|
-
export interface IFlightDocument {
|
|
72
|
-
passengerIds: string[];
|
|
73
|
-
uniqueIdentifier: string;
|
|
74
|
-
type: string;
|
|
75
|
-
}
|
|
76
|
-
export interface IFlightService {
|
|
77
|
-
id: string;
|
|
78
|
-
type: string;
|
|
79
|
-
quantity: number;
|
|
80
|
-
totalAmount: string;
|
|
81
|
-
totalCurrency: string;
|
|
82
|
-
}
|
|
83
51
|
export interface IFlightBookingDetails {
|
|
84
52
|
id: string;
|
|
85
53
|
flightOfferId: string;
|
|
86
|
-
|
|
54
|
+
baseAmount: number;
|
|
55
|
+
taxAmount: number;
|
|
56
|
+
feeAmount: number;
|
|
57
|
+
extrasAmount: number;
|
|
58
|
+
totalAmount: number;
|
|
59
|
+
currency: string;
|
|
87
60
|
status: string;
|
|
88
|
-
|
|
89
|
-
totalCurrency: string;
|
|
90
|
-
arrivalDate: string;
|
|
91
|
-
baseAmount: string;
|
|
92
|
-
extrasAmount: string;
|
|
93
|
-
extrasCurrency: string;
|
|
94
|
-
baseCurrency: string;
|
|
61
|
+
cancelledAt?: string;
|
|
95
62
|
conditions: IFlightConditions;
|
|
96
|
-
|
|
97
|
-
passengers:
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
63
|
+
class: string;
|
|
64
|
+
passengers: {
|
|
65
|
+
id: string;
|
|
66
|
+
givenName: string;
|
|
67
|
+
familyName: string;
|
|
68
|
+
type: string;
|
|
69
|
+
title: string;
|
|
70
|
+
email: string;
|
|
71
|
+
gender: string;
|
|
72
|
+
phoneNumber: string;
|
|
73
|
+
}[];
|
|
74
|
+
airlines: string[];
|
|
75
|
+
flights: IFlight[];
|
|
76
|
+
}
|
|
77
|
+
export interface IFlight {
|
|
78
|
+
origin: IAirport;
|
|
79
|
+
destination: IAirport;
|
|
80
|
+
departingAt: string;
|
|
81
|
+
arrivingAt: string;
|
|
82
|
+
numberOfStops: number;
|
|
83
|
+
durationInMinutes: number;
|
|
84
|
+
reference: string;
|
|
110
85
|
}
|
|
@@ -1,51 +1,94 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
1
|
+
var m = Object.defineProperty;
|
|
2
|
+
var l = (n, a, t) => a in n ? m(n, a, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[a] = t;
|
|
3
|
+
var o = (n, a, t) => l(n, typeof a != "symbol" ? a + "" : a, t);
|
|
4
4
|
import "../../arrayExtensions-DlcBOj5a.js";
|
|
5
|
-
import { c as
|
|
5
|
+
import { c as i, b as d } from "../../AccountService-D_6U8vP6.js";
|
|
6
6
|
import "react";
|
|
7
7
|
import { EBookingEndpoints as s } from "../../configs/endpoints.js";
|
|
8
|
-
|
|
8
|
+
const u = (n) => {
|
|
9
|
+
const a = /P((\d+)D)?T((\d+)H)?((\d+)M)?/, t = n.match(a);
|
|
10
|
+
if (t) {
|
|
11
|
+
const r = t[2] ? `${t[2]}d ` : "", e = t[4] ? `${t[4]}h ` : "", c = t[6] ? `${t[6]}m` : "";
|
|
12
|
+
return `${r}${e}${c}`.trim();
|
|
13
|
+
} else
|
|
14
|
+
return n;
|
|
15
|
+
};
|
|
16
|
+
class _ {
|
|
9
17
|
constructor() {
|
|
10
|
-
|
|
11
|
-
const { data:
|
|
12
|
-
`${s.USER_HOTEL_BOOKINGS}/${
|
|
18
|
+
o(this, "getHotelBooking", async (a) => {
|
|
19
|
+
const { data: t } = await i.get(
|
|
20
|
+
`${s.USER_HOTEL_BOOKINGS}/${a}`
|
|
13
21
|
);
|
|
14
|
-
return
|
|
15
|
-
...
|
|
16
|
-
total_amount: parseFloat(
|
|
17
|
-
fee_amount: parseFloat(
|
|
18
|
-
tax_amount: parseFloat(
|
|
19
|
-
base_amount: parseFloat(
|
|
22
|
+
return d({
|
|
23
|
+
...t.data,
|
|
24
|
+
total_amount: parseFloat(t.data.total_amount),
|
|
25
|
+
fee_amount: parseFloat(t.data.fee_amount),
|
|
26
|
+
tax_amount: parseFloat(t.data.tax_amount),
|
|
27
|
+
base_amount: parseFloat(t.data.base_amount)
|
|
20
28
|
});
|
|
21
29
|
});
|
|
22
|
-
|
|
23
|
-
const { data:
|
|
24
|
-
`${s.USER_FLIGHT_BOOKINGS}/${
|
|
30
|
+
o(this, "getFlightBooking", async (a) => {
|
|
31
|
+
const { data: t } = await i.get(
|
|
32
|
+
`${s.USER_FLIGHT_BOOKINGS}/${a}`
|
|
25
33
|
);
|
|
26
|
-
return
|
|
34
|
+
return {
|
|
35
|
+
id: t.data._id,
|
|
36
|
+
taxAmount: parseFloat(t.data.tax_amount),
|
|
37
|
+
extrasAmount: parseFloat(t.data.extras_amount),
|
|
38
|
+
baseAmount: parseFloat(t.data.base_amount),
|
|
39
|
+
feeAmount: parseFloat(t.data.fee_amount),
|
|
40
|
+
totalAmount: parseFloat(t.data.total_amount),
|
|
41
|
+
currency: t.data.total_currency,
|
|
42
|
+
status: t.data.status,
|
|
43
|
+
conditions: t.data.conditions,
|
|
44
|
+
class: t.data.data.slices[0].fare_brand_name,
|
|
45
|
+
flightOfferId: t.data.flight_offer_id,
|
|
46
|
+
cancelledAt: t.data.cancelled_at,
|
|
47
|
+
airlines: t.data.data.slices[0].segments.map(
|
|
48
|
+
(e) => e.operating_carrier.name
|
|
49
|
+
),
|
|
50
|
+
passengers: t.data.data.passengers.map((e) => ({
|
|
51
|
+
id: e.id,
|
|
52
|
+
givenName: e.given_ame,
|
|
53
|
+
familyName: e.family_name,
|
|
54
|
+
type: e.type,
|
|
55
|
+
title: e.title,
|
|
56
|
+
email: e.email,
|
|
57
|
+
gender: e.gender,
|
|
58
|
+
phoneNumber: e.phone_number
|
|
59
|
+
})),
|
|
60
|
+
flights: t.data.data.slices.map((e) => ({
|
|
61
|
+
departingAt: e.segments[0].departing_at,
|
|
62
|
+
arrivingAt: e.segments.getLast().arriving_at,
|
|
63
|
+
numberOfStops: e.segments.length - 1,
|
|
64
|
+
reference: t.data.booking_reference,
|
|
65
|
+
durationInMinutes: u(e.duration),
|
|
66
|
+
origin: d(e.origin),
|
|
67
|
+
destination: d(e.destination)
|
|
68
|
+
}))
|
|
69
|
+
};
|
|
27
70
|
});
|
|
28
|
-
|
|
29
|
-
const { data:
|
|
30
|
-
`${s.INITIATE_FLIGHT_CANCEL}/${
|
|
71
|
+
o(this, "initiateCancelFlightBooking", async (a) => {
|
|
72
|
+
const { data: t } = await i.put(
|
|
73
|
+
`${s.INITIATE_FLIGHT_CANCEL}/${a}`
|
|
31
74
|
);
|
|
32
|
-
return
|
|
75
|
+
return t.success;
|
|
33
76
|
});
|
|
34
|
-
|
|
35
|
-
const { data:
|
|
36
|
-
`${s.CONFIRM_FLIGHT_CANCEL}/${
|
|
77
|
+
o(this, "confirmCancelFlightBooking", async (a) => {
|
|
78
|
+
const { data: t } = await i.put(
|
|
79
|
+
`${s.CONFIRM_FLIGHT_CANCEL}/${a}`
|
|
37
80
|
);
|
|
38
|
-
return
|
|
81
|
+
return t.success;
|
|
39
82
|
});
|
|
40
|
-
|
|
41
|
-
const { data:
|
|
42
|
-
`${s.CANCEL_HOTEL_BOOKING}/${
|
|
83
|
+
o(this, "cancelHotelBooking", async (a) => {
|
|
84
|
+
const { data: t } = await i.post(
|
|
85
|
+
`${s.CANCEL_HOTEL_BOOKING}/${a}`
|
|
43
86
|
);
|
|
44
|
-
return
|
|
87
|
+
return t.success;
|
|
45
88
|
});
|
|
46
89
|
}
|
|
47
90
|
}
|
|
48
|
-
const
|
|
91
|
+
const b = new _();
|
|
49
92
|
export {
|
|
50
|
-
|
|
93
|
+
b as BookingService
|
|
51
94
|
};
|