@odynn/awayz-core 0.3.14 → 0.3.16

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.
@@ -5,12 +5,12 @@ declare const _default: {
5
5
  "_id": "682f2c51a6cc24f39d99eecb",
6
6
  "name": "Jet's JumpOff",
7
7
  "user_id": "67fd23bc3a7cbcd0a8757cdc",
8
- "start_date": "2025-06-23",
9
- "end_date": "2025-06-26",
8
+ "start_date": "2077-06-23",
9
+ "end_date": "2077-06-26",
10
10
  "hotel_bookings": [],
11
11
  "flight_bookings": [],
12
- "created_at": "2025-05-22T13:53:21.392Z",
13
- "updated_at": "2025-05-22T13:53:21.392Z",
12
+ "created_at": "2077-05-22T13:53:21.392Z",
13
+ "updated_at": "2077-05-22T13:53:21.392Z",
14
14
  "__v": 0
15
15
  }
16
16
  ]
@@ -35,10 +35,15 @@ export interface IHotelBookingDetails {
35
35
  checkinDate: string;
36
36
  checkinAfterTime: string;
37
37
  coordinates: ICoordinates;
38
+ cancellationTimeline: {
39
+ date: string;
40
+ time: string;
41
+ description: string;
42
+ }[];
38
43
  }
39
44
  export interface IFlightConditionDetails {
40
45
  allowed: boolean;
41
- penaltyAmount: string | null;
46
+ penaltyAmount: number | null;
42
47
  penaltyCurrency: string | null;
43
48
  }
44
49
  export interface IFlightConditions {
@@ -1,86 +1,110 @@
1
- var m = Object.defineProperty;
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);
1
+ var l = Object.defineProperty;
2
+ var u = (r, e, a) => e in r ? l(r, e, { enumerable: !0, configurable: !0, writable: !0, value: a }) : r[e] = a;
3
+ var c = (r, e, a) => u(r, typeof e != "symbol" ? e + "" : e, a);
4
4
  import "../../arrayExtensions-DlcBOj5a.js";
5
5
  import { c as i, b as s } from "../../AccountService-D_6U8vP6.js";
6
6
  import "react";
7
7
  import { EBookingEndpoints as d } from "../../configs/endpoints.js";
8
- const u = (n) => {
9
- const e = /P((\d+)D)?T((\d+)H)?((\d+)M)?/, a = n.match(e);
8
+ const _ = (r) => {
9
+ const e = /P((\d+)D)?T((\d+)H)?((\d+)M)?/, a = r.match(e);
10
10
  if (a) {
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();
11
+ const o = a[2] ? `${a[2]}d ` : "", t = a[4] ? `${a[4]}h ` : "", n = a[6] ? `${a[6]}m` : "";
12
+ return `${o}${t}${n}`.trim();
13
13
  } else
14
- return n;
14
+ return r;
15
15
  };
16
- class _ {
16
+ class p {
17
17
  constructor() {
18
- o(this, "getHotelBooking", async (e) => {
18
+ c(this, "getHotelBooking", async (e) => {
19
19
  const { data: a } = await i.get(
20
20
  `${d.USER_HOTEL_BOOKINGS}/${e}`
21
- );
21
+ ), o = a.data.accommodation.rooms[0].rates[0];
22
22
  return {
23
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),
24
+ totalAmount: parseFloat(o.total_amount),
25
+ feeAmount: parseFloat(o.fee_amount),
26
+ taxAmount: parseFloat(o.tax_amount),
27
+ baseAmount: parseFloat(o.base_amount),
28
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,
29
+ totalCurrency: o.total_currency,
30
+ baseCurrency: o.base_currency,
31
+ feeCurrency: o.fee_currency,
32
+ taxCurrency: o.tax_currency,
33
33
  status: a.data.status,
34
- description: a.data.data.accommodation.description,
35
- name: a.data.data.accommodation.name,
34
+ description: a.data.accommodation.description,
35
+ name: a.data.accommodation.name,
36
36
  reference: a.data.reference,
37
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
38
+ lineOne: a.data.accommodation.location.address.line_one,
39
+ cityName: a.data.accommodation.location.address.city_name,
40
+ postalCode: a.data.accommodation.location.address.postal_code,
41
+ countryCode: a.data.accommodation.location.address.country_code,
42
+ region: a.data.accommodation.location.address.region || null
43
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,
44
+ checkinDate: a.data.check_in_date,
45
+ checkinAfterTime: a.data.accommodation.check_in_information.check_in_after_time,
46
+ checkoutDate: a.data.check_out_date,
47
+ checkoutBeforeTime: a.data.accommodation.check_in_information.check_out_before_time,
48
48
  coordinates: {
49
- latitude: a.data.data.accommodation.location.geographic_coordinates.latitude,
50
- longitude: a.data.data.accommodation.location.geographic_coordinates.longitude
49
+ latitude: a.data.accommodation.location.geographic_coordinates.latitude,
50
+ longitude: a.data.accommodation.location.geographic_coordinates.longitude
51
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
52
+ images: a.data.accommodation.photos.map((n) => n.url),
53
+ guests: a.data.guests.map((n, m) => ({
54
+ familyName: n.family_name,
55
+ givenName: n.given_name,
56
+ type: a.data.guest_types[m].type
57
57
  })),
58
- numberOfRooms: a.data.rooms.length
58
+ numberOfRooms: a.data.rooms,
59
+ cancellationTimeline: o.cancellation_timeline.map(
60
+ (n) => ({
61
+ refundAmount: parseFloat(n.refund_amount),
62
+ currency: n.currency,
63
+ before: n.before
64
+ })
65
+ )
59
66
  };
60
67
  });
61
- o(this, "getFlightBooking", async (e) => {
68
+ c(this, "getFlightBooking", async (e) => {
62
69
  const { data: a } = await i.get(
63
70
  `${d.USER_FLIGHT_BOOKINGS}/${e}`
64
71
  );
65
72
  return {
66
73
  id: a.data._id,
67
74
  taxAmount: parseFloat(a.data.tax_amount),
68
- extrasAmount: parseFloat(a.data.extras_amount),
75
+ extrasAmount: parseFloat(a.data.extras_amount ?? "0"),
69
76
  baseAmount: parseFloat(a.data.base_amount),
70
- feeAmount: parseFloat(a.data.fee_amount),
77
+ feeAmount: parseFloat(a.data.fee_amount ?? "0"),
71
78
  totalAmount: parseFloat(a.data.total_amount),
72
79
  currency: a.data.total_currency,
73
80
  status: a.data.status,
74
- conditions: a.data.conditions,
75
- class: a.data.data.slices[0].fare_brand_name,
76
- flightOfferId: a.data.flight_offer_id,
81
+ conditions: {
82
+ changeBeforeDeparture: {
83
+ allowed: a.data.conditions.change_before_departure.allowed,
84
+ penaltyAmount: a.data.conditions.change_before_departure.penalty_amount ? parseFloat(
85
+ a.data.conditions.change_before_departure.penalty_amount
86
+ ) : null,
87
+ penaltyCurrency: a.data.conditions.change_before_departure.penalty_currency
88
+ },
89
+ refundBeforeDeparture: {
90
+ allowed: a.data.conditions.refund_before_departure.allowed,
91
+ penaltyAmount: a.data.conditions.refund_before_departure.penalty_amount ? parseFloat(
92
+ a.data.conditions.refund_before_departure.penalty_amount
93
+ ) : null,
94
+ penaltyCurrency: a.data.conditions.refund_before_departure.penalty_currency
95
+ }
96
+ },
97
+ class: a.data.slices[0].fare_brand_name,
98
+ flightOfferId: a.data.offer_id,
77
99
  cancelledAt: a.data.cancelled_at,
78
- airlines: a.data.data.slices[0].segments.map(
79
- (t) => t.operating_carrier.name
80
- ),
81
- passengers: a.data.data.passengers.map((t) => ({
100
+ airlines: a.data.slices[0].segments.map((t) => ({
101
+ name: t.operating_carrier.name,
102
+ code: t.operating_carrier.iata_code,
103
+ logo: t.operating_carrier.logo_symbol_url
104
+ })),
105
+ passengers: a.data.passengers.map((t) => ({
82
106
  id: t.id,
83
- givenName: t.given_ame,
107
+ givenName: t.given_name,
84
108
  familyName: t.family_name,
85
109
  type: t.type,
86
110
  title: t.title,
@@ -88,31 +112,31 @@ class _ {
88
112
  gender: t.gender,
89
113
  phoneNumber: t.phone_number
90
114
  })),
91
- flights: a.data.data.slices.map((t) => ({
115
+ flights: a.data.slices.map((t) => ({
92
116
  departingAt: t.segments[0].departing_at,
93
117
  arrivingAt: t.segments.getLast().arriving_at,
94
118
  numberOfStops: t.segments.length - 1,
95
119
  reference: a.data.booking_reference,
96
- durationInMinutes: u(t.duration),
120
+ durationInMinutes: _(t.duration),
97
121
  origin: s(t.origin),
98
122
  destination: s(t.destination)
99
123
  })),
100
124
  availableActions: a.data.available_actions
101
125
  };
102
126
  });
103
- o(this, "initiateCancelFlightBooking", async (e) => {
127
+ c(this, "initiateCancelFlightBooking", async (e) => {
104
128
  const { data: a } = await i.put(
105
129
  `${d.INITIATE_FLIGHT_CANCEL}/${e}`
106
130
  );
107
131
  return a.success;
108
132
  });
109
- o(this, "confirmCancelFlightBooking", async (e) => {
133
+ c(this, "confirmCancelFlightBooking", async (e) => {
110
134
  const { data: a } = await i.put(
111
135
  `${d.CONFIRM_FLIGHT_CANCEL}/${e}`
112
136
  );
113
137
  return a.success;
114
138
  });
115
- o(this, "cancelHotelBooking", async (e) => {
139
+ c(this, "cancelHotelBooking", async (e) => {
116
140
  const { data: a } = await i.post(
117
141
  `${d.CANCEL_HOTEL_BOOKING}/${e}`
118
142
  );
@@ -120,7 +144,7 @@ class _ {
120
144
  });
121
145
  }
122
146
  }
123
- const k = new _();
147
+ const k = new p();
124
148
  export {
125
149
  k as BookingService
126
150
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@odynn/awayz-core",
3
- "version": "0.3.14",
3
+ "version": "0.3.16",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"