@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
- export interface IRoom {
7
- beds: IBed[];
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
- rooms: IRoom[];
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,6 +1,6 @@
1
1
  export declare enum EBookingType {
2
- HOTEL = "hotel",
3
- FLIGHT = "flight"
2
+ HOTEL = "Hotel",
3
+ FLIGHT = "Flight"
4
4
  }
5
5
  export interface ICreateTripRequest {
6
6
  name: string;
@@ -1,35 +1,66 @@
1
1
  var m = Object.defineProperty;
2
- var l = (n, t, a) => t in n ? m(n, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : n[t] = a;
3
- var o = (n, t, a) => l(n, typeof t != "symbol" ? t + "" : t, a);
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 d } from "../../AccountService-D_6U8vP6.js";
5
+ import { c as i, b as s } from "../../AccountService-D_6U8vP6.js";
6
6
  import "react";
7
- import { EBookingEndpoints as s } from "../../configs/endpoints.js";
7
+ import { EBookingEndpoints as d } from "../../configs/endpoints.js";
8
8
  const u = (n) => {
9
- const t = /P((\d+)D)?T((\d+)H)?((\d+)M)?/, a = n.match(t);
9
+ const e = /P((\d+)D)?T((\d+)H)?((\d+)M)?/, a = n.match(e);
10
10
  if (a) {
11
- const r = a[2] ? `${a[2]}d ` : "", e = a[4] ? `${a[4]}h ` : "", c = a[6] ? `${a[6]}m` : "";
12
- return `${r}${e}${c}`.trim();
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 (t) => {
18
+ o(this, "getHotelBooking", async (e) => {
19
19
  const { data: a } = await i.get(
20
- `${s.USER_HOTEL_BOOKINGS}/${t}`
20
+ `${d.USER_HOTEL_BOOKINGS}/${e}`
21
21
  );
22
- return d({
23
- ...a.data,
24
- total_amount: parseFloat(a.data.total_amount),
25
- fee_amount: parseFloat(a.data.fee_amount),
26
- tax_amount: parseFloat(a.data.tax_amount),
27
- base_amount: parseFloat(a.data.base_amount)
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 (t) => {
61
+ o(this, "getFlightBooking", async (e) => {
31
62
  const { data: a } = await i.get(
32
- `${s.USER_FLIGHT_BOOKINGS}/${t}`
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
- (e) => e.operating_carrier.name
79
+ (t) => t.operating_carrier.name
49
80
  ),
50
- passengers: a.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
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((e) => ({
61
- departingAt: e.segments[0].departing_at,
62
- arrivingAt: e.segments.getLast().arriving_at,
63
- numberOfStops: e.segments.length - 1,
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(e.duration),
66
- origin: d(e.origin),
67
- destination: d(e.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 (t) => {
103
+ o(this, "initiateCancelFlightBooking", async (e) => {
73
104
  const { data: a } = await i.put(
74
- `${s.INITIATE_FLIGHT_CANCEL}/${t}`
105
+ `${d.INITIATE_FLIGHT_CANCEL}/${e}`
75
106
  );
76
107
  return a.success;
77
108
  });
78
- o(this, "confirmCancelFlightBooking", async (t) => {
109
+ o(this, "confirmCancelFlightBooking", async (e) => {
79
110
  const { data: a } = await i.put(
80
- `${s.CONFIRM_FLIGHT_CANCEL}/${t}`
111
+ `${d.CONFIRM_FLIGHT_CANCEL}/${e}`
81
112
  );
82
113
  return a.success;
83
114
  });
84
- o(this, "cancelHotelBooking", async (t) => {
115
+ o(this, "cancelHotelBooking", async (e) => {
85
116
  const { data: a } = await i.post(
86
- `${s.CANCEL_HOTEL_BOOKING}/${t}`
117
+ `${d.CANCEL_HOTEL_BOOKING}/${e}`
87
118
  );
88
119
  return a.success;
89
120
  });
90
121
  }
91
122
  }
92
- const $ = new _();
123
+ const k = new _();
93
124
  export {
94
- $ as BookingService
125
+ k as BookingService
95
126
  };
@@ -1,4 +1,4 @@
1
- var t = /* @__PURE__ */ ((r) => (r.HOTEL = "hotel", r.FLIGHT = "flight", r))(t || {});
1
+ var t = /* @__PURE__ */ ((r) => (r.HOTEL = "Hotel", r.FLIGHT = "Flight", r))(t || {});
2
2
  export {
3
3
  t as EBookingType
4
4
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@odynn/awayz-core",
3
- "version": "0.3.10",
3
+ "version": "0.3.11",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"