@odynn/awayz-core 0.10.34 → 0.10.36

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.
Files changed (32) hide show
  1. package/dist/{TripsService-DtjkgWX5.js → TripsService-C_TStOtx.js} +1 -1
  2. package/dist/components/CashValue/CashValue.js +1 -1
  3. package/dist/components/CashValue/CashValue.stories.js +1 -1
  4. package/dist/components/ClientPointsValue/ClientPointsValue.js +1 -1
  5. package/dist/components/Wallet/Card/Card.stories.js +1 -1
  6. package/dist/hooks/useAwayzAuth/useAwayzAuth.js +95 -82
  7. package/dist/hooks/useBookingManagement/useBookingManagement.js +1 -1
  8. package/dist/hooks/useBookingManagement/useBookingManagement.test.js +1 -1
  9. package/dist/hooks/useFeatureFlags.js +1 -1
  10. package/dist/hooks/useSearchLimit.js +1 -1
  11. package/dist/hooks/useTripManagement/useTripManagement.js +2 -2
  12. package/dist/hooks/useTripManagement/useTripManagement.test.js +2 -2
  13. package/dist/hooks/useWallet/useWallet.js +1 -1
  14. package/dist/hooks/useWallet/useWallet.test.js +1 -1
  15. package/dist/lib/services/bookings/BookingService.types.d.ts +16 -0
  16. package/dist/main.js +1 -1
  17. package/dist/{noRetryInstance-BbgLI6--.js → noRetryInstance-wA6BVsyM.js} +411 -409
  18. package/dist/providers/AwayzProvider.js +1 -1
  19. package/dist/services/account/AccountService.js +1 -1
  20. package/dist/services/bookings/BookingService.js +68 -60
  21. package/dist/services/currency/CurrencyService.js +1 -1
  22. package/dist/services/features/featureService.js +1 -1
  23. package/dist/services/index.js +1 -1
  24. package/dist/services/instance.js +1 -1
  25. package/dist/services/instanceConfig.js +1 -1
  26. package/dist/services/noRetryInstance.js +1 -1
  27. package/dist/services/preferences/PreferencesService.js +1 -1
  28. package/dist/services/rewards/RewardsService.js +1 -1
  29. package/dist/services/trips/TripsService.js +2 -2
  30. package/dist/services/wallet/WalletService.js +1 -1
  31. package/dist/utils/clientPoints.js +1 -1
  32. package/package.json +1 -1
@@ -12,7 +12,7 @@ import '../assets/_styles4.css';import '../assets/_styles6.css';import '../asset
12
12
  /* empty css */
13
13
  /* empty css */
14
14
  import { awayzClient as w } from "../configs/awayzClient.js";
15
- import "../noRetryInstance-BbgLI6--.js";
15
+ import "../noRetryInstance-wA6BVsyM.js";
16
16
  /* empty css */
17
17
  /* empty css */
18
18
  import "../index-Cv-wvFlM.js";
@@ -1,6 +1,6 @@
1
1
  import "react/jsx-runtime";
2
2
  import "../../arrayExtensions-DlcBOj5a.js";
3
- import { A as a } from "../../noRetryInstance-BbgLI6--.js";
3
+ import { A as a } from "../../noRetryInstance-wA6BVsyM.js";
4
4
  import "../../keys-C7jV6nZg.js";
5
5
  import "react";
6
6
  import "../../configs/awayzClient.js";
@@ -1,41 +1,41 @@
1
1
  var g = Object.defineProperty;
2
- var f = (r, t, a) => t in r ? g(r, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : r[t] = a;
3
- var c = (r, t, a) => f(r, typeof t != "symbol" ? t + "" : t, a);
2
+ var y = (r, t, a) => t in r ? g(r, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : r[t] = a;
3
+ var i = (r, t, a) => y(r, typeof t != "symbol" ? t + "" : t, a);
4
4
  import "react/jsx-runtime";
5
5
  import "../../arrayExtensions-DlcBOj5a.js";
6
- import { t as y } from "../../numberUtils-B4wd-SGR.js";
7
- import { c as l, b as u, g as p } from "../../noRetryInstance-BbgLI6--.js";
6
+ import { t as f } from "../../numberUtils-B4wd-SGR.js";
7
+ import { c as l, b as m, g as p } from "../../noRetryInstance-wA6BVsyM.js";
8
8
  import "react";
9
- import { EBookingEndpoints as i } from "../../configs/endpoints.js";
9
+ import { EBookingEndpoints as c } from "../../configs/endpoints.js";
10
10
  const h = (r) => {
11
11
  const t = /P((\d+)D)?T((\d+)H)?((\d+)M)?/, a = r.match(t);
12
12
  if (a) {
13
- const n = a[2] ? `${a[2]}d ` : "", d = a[4] ? `${a[4]}h ` : "", s = a[6] ? `${a[6]}m` : "";
14
- return `${n}${d}${s}`.trim();
13
+ const o = a[2] ? `${a[2]}d ` : "", d = a[4] ? `${a[4]}h ` : "", s = a[6] ? `${a[6]}m` : "";
14
+ return `${o}${d}${s}`.trim();
15
15
  } else
16
16
  return r;
17
17
  };
18
18
  class b {
19
19
  constructor() {
20
- c(this, "getHotelBooking", async (t) => {
20
+ i(this, "getHotelBooking", async (t) => {
21
21
  var s, e;
22
22
  const { data: a } = await l.get(
23
- `${i.USER_HOTEL_BOOKINGS}/${t}`
24
- ), n = a.data.accommodation.rooms[0].rates[0];
23
+ `${c.USER_HOTEL_BOOKINGS}/${t}`
24
+ ), o = a.data.accommodation.rooms[0].rates[0];
25
25
  return {
26
26
  id: a.data._id,
27
27
  rateId: a.data.rate_id,
28
28
  quoteId: a.data.quote_id,
29
29
  bookingId: a.data.id,
30
- totalAmount: parseFloat(n.total_amount),
31
- feeAmount: parseFloat(n.fee_amount),
32
- taxAmount: parseFloat(n.tax_amount),
33
- baseAmount: parseFloat(n.base_amount),
30
+ totalAmount: parseFloat(o.total_amount),
31
+ feeAmount: parseFloat(o.fee_amount),
32
+ taxAmount: parseFloat(o.tax_amount),
33
+ baseAmount: parseFloat(o.base_amount),
34
34
  cancelledAt: a.data.cancelled_at,
35
- totalCurrency: n.total_currency,
36
- baseCurrency: n.base_currency,
37
- feeCurrency: n.fee_currency,
38
- taxCurrency: n.tax_currency,
35
+ totalCurrency: o.total_currency,
36
+ baseCurrency: o.base_currency,
37
+ feeCurrency: o.fee_currency,
38
+ taxCurrency: o.tax_currency,
39
39
  status: a.data.status,
40
40
  description: a.data.accommodation.description,
41
41
  name: a.data.accommodation.name,
@@ -55,41 +55,49 @@ class b {
55
55
  latitude: a.data.accommodation.location.geographic_coordinates.latitude,
56
56
  longitude: a.data.accommodation.location.geographic_coordinates.longitude
57
57
  },
58
- images: a.data.accommodation.photos.map((o) => o.url),
59
- guests: a.data.guests.map((o, _) => {
60
- var m;
58
+ images: a.data.accommodation.photos.map((n) => n.url),
59
+ guests: a.data.guests.map((n, _) => {
60
+ var u;
61
61
  return {
62
- familyName: o.family_name,
63
- givenName: o.given_name,
64
- type: (m = a.data.guest_types[_]) == null ? void 0 : m.type
62
+ familyName: n.family_name,
63
+ givenName: n.given_name,
64
+ type: (u = a.data.guest_types[_]) == null ? void 0 : u.type
65
65
  };
66
66
  }),
67
67
  numberOfRooms: (s = a.data.rooms) == null ? void 0 : s.length,
68
- cancellationTimeline: n.cancellation_timeline.map(
69
- (o) => ({
70
- refundAmount: parseFloat(o.refund_amount),
71
- currency: o.currency,
72
- before: o.before
68
+ cancellationTimeline: o.cancellation_timeline.map(
69
+ (n) => ({
70
+ refundAmount: parseFloat(n.refund_amount),
71
+ currency: n.currency,
72
+ before: n.before
73
73
  })
74
74
  ),
75
- rooms: (e = a.data.rooms) == null ? void 0 : e.map((o) => {
75
+ rooms: (e = a.data.rooms) == null ? void 0 : e.map((n) => {
76
76
  var _;
77
77
  return {
78
- beds: (_ = o.beds) == null ? void 0 : _.map((m) => ({
79
- type: m.type,
80
- count: m.count
78
+ beds: (_ = n.beds) == null ? void 0 : _.map((u) => ({
79
+ type: u.type,
80
+ count: u.count
81
81
  })),
82
- totalAmount: parseFloat(o.total_amount),
83
- name: o.name
82
+ totalAmount: parseFloat(n.total_amount),
83
+ name: n.name
84
84
  };
85
85
  }),
86
- createdAt: a.data.created_at
86
+ createdAt: a.data.created_at,
87
+ conditions: a.data.rooms[0].conditions,
88
+ loyaltyProgram: {
89
+ loyaltyProgrammeAccountNumber: a.data.loyalty_programme_account_number,
90
+ supportedLoyaltyProgramme: a.data.supported_loyalty_programme
91
+ },
92
+ amenities: a.data.accommodation.amenities,
93
+ phoneNumber: a.data.phone_number,
94
+ email: a.data.email
87
95
  };
88
96
  });
89
- c(this, "getFlightBooking", async (t) => {
97
+ i(this, "getFlightBooking", async (t) => {
90
98
  var d, s;
91
99
  const { data: a } = await l.get(
92
- `${i.USER_FLIGHT_BOOKINGS}/${t}`
100
+ `${c.USER_FLIGHT_BOOKINGS}/${t}`
93
101
  );
94
102
  return {
95
103
  id: a.data._id,
@@ -140,12 +148,12 @@ class b {
140
148
  numberOfStops: e.segments.length - 1,
141
149
  reference: a.data.booking_reference,
142
150
  durationInMinutes: h(e.duration),
143
- origin: u(e.origin),
144
- destination: u(e.destination),
145
- segments: u(e.segments)
151
+ origin: m(e.origin),
152
+ destination: m(e.destination),
153
+ segments: m(e.segments)
146
154
  })),
147
155
  availableActions: a.data.available_actions,
148
- airlineInitiatedChanges: u(a.data.airline_initiated_changes) || [],
156
+ airlineInitiatedChanges: m(a.data.airline_initiated_changes) || [],
149
157
  cancellationDetails: a.data.cancellation_details ? {
150
158
  refundAmount: parseFloat(
151
159
  a.data.cancellation_details.refund_amount
@@ -154,61 +162,61 @@ class b {
154
162
  refundTo: a.data.cancellation_details.refund_to,
155
163
  confirmedAt: a.data.cancellation_details.confirmed_at
156
164
  } : void 0,
157
- services: u(a.data.services),
165
+ services: m(a.data.services),
158
166
  createdAt: a.data.created_at
159
167
  };
160
168
  });
161
- c(this, "initiateCancelFlightBooking", async (t) => {
169
+ i(this, "initiateCancelFlightBooking", async (t) => {
162
170
  const { data: a } = await l.put(
163
- `${i.INITIATE_FLIGHT_CANCEL}/${t}`
171
+ `${c.INITIATE_FLIGHT_CANCEL}/${t}`
164
172
  );
165
173
  if (!a.success)
166
174
  throw new Error("Failed to initiate cancellation");
167
- const n = u(a.data);
175
+ const o = m(a.data);
168
176
  return {
169
- ...n,
170
- refundAmount: y(n.refundAmount)
177
+ ...o,
178
+ refundAmount: f(o.refundAmount)
171
179
  };
172
180
  });
173
- c(this, "confirmCancelFlightBooking", async (t) => {
181
+ i(this, "confirmCancelFlightBooking", async (t) => {
174
182
  const { data: a } = await l.put(
175
- `${i.CONFIRM_FLIGHT_CANCEL}/${t}`
183
+ `${c.CONFIRM_FLIGHT_CANCEL}/${t}`
176
184
  );
177
185
  return a.success;
178
186
  });
179
- c(this, "cancelHotelBooking", async (t) => {
187
+ i(this, "cancelHotelBooking", async (t) => {
180
188
  const { data: a } = await l.post(
181
- `${i.CANCEL_HOTEL_BOOKING}/${t}`
189
+ `${c.CANCEL_HOTEL_BOOKING}/${t}`
182
190
  );
183
191
  return a.success;
184
192
  });
185
- c(this, "actionAirlineChanges", async ({
193
+ i(this, "actionAirlineChanges", async ({
186
194
  bookingId: t,
187
195
  acceptChanges: a,
188
- aicId: n
196
+ aicId: o
189
197
  }) => {
190
198
  const { data: d } = await l.post(
191
- i.ACTION_AIRLINE_CHANGES,
199
+ c.ACTION_AIRLINE_CHANGES,
192
200
  {
193
201
  booking_id: t,
194
202
  action_taken: a ? "accepted" : "cancelled",
195
- aic_id: n
203
+ aic_id: o
196
204
  }
197
205
  );
198
206
  return d.success;
199
207
  });
200
- c(this, "cancelPointsBooking", async (t) => {
208
+ i(this, "cancelPointsBooking", async (t) => {
201
209
  const { data: a } = await p.post(
202
- `${i.REFUND_POINTS_BOOKING}`,
210
+ `${c.REFUND_POINTS_BOOKING}`,
203
211
  {
204
212
  bookingId: t
205
213
  }
206
214
  );
207
215
  return a.success;
208
216
  });
209
- c(this, "getPointsAsCash", async (t) => {
217
+ i(this, "getPointsAsCash", async (t) => {
210
218
  const { data: a } = await p.get(
211
- `${i.BOOKING_POINTS_AS_CASH}/${t}`
219
+ `${c.BOOKING_POINTS_AS_CASH}/${t}`
212
220
  );
213
221
  return !a.success || !a.data ? null : {
214
222
  ...a.data,
@@ -3,7 +3,7 @@ var l = (c, r, t) => r in c ? f(c, r, { enumerable: !0, configurable: !0, writab
3
3
  var o = (c, r, t) => l(c, typeof r != "symbol" ? r + "" : r, t);
4
4
  import "react/jsx-runtime";
5
5
  import "../../arrayExtensions-DlcBOj5a.js";
6
- import { A as i, E as u, c as y } from "../../noRetryInstance-BbgLI6--.js";
6
+ import { A as i, E as u, c as y } from "../../noRetryInstance-wA6BVsyM.js";
7
7
  import "react";
8
8
  import { ECurrencyEndpoints as p } from "../../configs/endpoints.js";
9
9
  import "react-i18next";
@@ -1,5 +1,5 @@
1
1
  import { EAuthEndpoints as a } from "../../configs/endpoints.js";
2
- import { c as o } from "../../noRetryInstance-BbgLI6--.js";
2
+ import { c as o } from "../../noRetryInstance-wA6BVsyM.js";
3
3
  class i {
4
4
  static async getFeatures() {
5
5
  try {
@@ -1,4 +1,4 @@
1
- import { A as o, c, a as t, g as a, i as n } from "../noRetryInstance-BbgLI6--.js";
1
+ import { A as o, c, a as t, g as a, i as n } from "../noRetryInstance-wA6BVsyM.js";
2
2
  import { ESource as i } from "./account/AccountServices.types.js";
3
3
  import { CurrencyService as f } from "./currency/CurrencyService.js";
4
4
  import { RewardsService as x } from "./rewards/RewardsService.js";
@@ -2,7 +2,7 @@ import "react/jsx-runtime";
2
2
  import "../arrayExtensions-DlcBOj5a.js";
3
3
  import "../keys-C7jV6nZg.js";
4
4
  import "react";
5
- import { c as m, g as p, i as s } from "../noRetryInstance-BbgLI6--.js";
5
+ import { c as m, g as p, i as s } from "../noRetryInstance-wA6BVsyM.js";
6
6
  import "../configs/awayzUrl.js";
7
7
  export {
8
8
  m as clientInstance,
@@ -2,7 +2,7 @@ import "react/jsx-runtime";
2
2
  import "../arrayExtensions-DlcBOj5a.js";
3
3
  import "../keys-C7jV6nZg.js";
4
4
  import "react";
5
- import { m as c, k as F, l as j, h as k, j as q, n as w, p as A } from "../noRetryInstance-BbgLI6--.js";
5
+ import { m as c, k as F, l as j, h as k, j as q, n as w, p as A } from "../noRetryInstance-wA6BVsyM.js";
6
6
  import "../configs/awayzUrl.js";
7
7
  import "../configs/endpoints.js";
8
8
  import "react-i18next";
@@ -1,4 +1,4 @@
1
- import { a } from "../noRetryInstance-BbgLI6--.js";
1
+ import { a } from "../noRetryInstance-wA6BVsyM.js";
2
2
  export {
3
3
  a as clientNoRetryInstance
4
4
  };
@@ -2,7 +2,7 @@ var a = Object.defineProperty;
2
2
  var o = (s, e, r) => e in s ? a(s, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : s[e] = r;
3
3
  var n = (s, e, r) => o(s, typeof e != "symbol" ? e + "" : e, r);
4
4
  import { EPreferencesEndpoints as u } from "../../configs/endpoints.js";
5
- import { c as i } from "../../noRetryInstance-BbgLI6--.js";
5
+ import { c as i } from "../../noRetryInstance-wA6BVsyM.js";
6
6
  class E {
7
7
  constructor() {
8
8
  n(this, "setCurrency", async (e) => {
@@ -3,7 +3,7 @@ var o = (t, e, a) => e in t ? s(t, e, { enumerable: !0, configurable: !0, writab
3
3
  var r = (t, e, a) => o(t, typeof e != "symbol" ? e + "" : e, a);
4
4
  import "react/jsx-runtime";
5
5
  import "../../arrayExtensions-DlcBOj5a.js";
6
- import { c as n, b as i } from "../../noRetryInstance-BbgLI6--.js";
6
+ import { c as n, b as i } from "../../noRetryInstance-wA6BVsyM.js";
7
7
  import "react";
8
8
  import { ERewardsEndpoints as c } from "../../configs/endpoints.js";
9
9
  class m {
@@ -1,7 +1,7 @@
1
1
  import "react/jsx-runtime";
2
2
  import "../../arrayExtensions-DlcBOj5a.js";
3
- import "../../noRetryInstance-BbgLI6--.js";
4
- import { T as a } from "../../TripsService-DtjkgWX5.js";
3
+ import "../../noRetryInstance-wA6BVsyM.js";
4
+ import { T as a } from "../../TripsService-C_TStOtx.js";
5
5
  import "react";
6
6
  import "../../configs/defaultAwayzConfig.js";
7
7
  import "../../configs/endpoints.js";
@@ -3,7 +3,7 @@ var i = (o, a, t) => a in o ? d(o, a, { enumerable: !0, configurable: !0, writab
3
3
  var r = (o, a, t) => i(o, typeof a != "symbol" ? a + "" : a, t);
4
4
  import "react/jsx-runtime";
5
5
  import "../../arrayExtensions-DlcBOj5a.js";
6
- import { c as e, b as c, g as A } from "../../noRetryInstance-BbgLI6--.js";
6
+ import { c as e, b as c, g as A } from "../../noRetryInstance-wA6BVsyM.js";
7
7
  import "react";
8
8
  import { EWalletEndpoints as s } from "../../configs/endpoints.js";
9
9
  class u {
@@ -1,6 +1,6 @@
1
1
  import "react/jsx-runtime";
2
2
  import "../arrayExtensions-DlcBOj5a.js";
3
- import { E as m } from "../noRetryInstance-BbgLI6--.js";
3
+ import { E as m } from "../noRetryInstance-wA6BVsyM.js";
4
4
  import "react";
5
5
  import "react-i18next";
6
6
  import '../assets/_styles4.css';import '../assets/_styles6.css';import '../assets/_styles5.css';import '../assets/_styles2.css';import '../assets/_styles.css';import '../assets/_styles3.css';/* empty css */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@odynn/awayz-core",
3
- "version": "0.10.34",
3
+ "version": "0.10.36",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"