@odynn/awayz-core 0.9.19 → 0.9.21
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.
- package/dist/TripsService-GImsS17_.js +148 -0
- package/dist/assets/_styles6.css +1 -1
- package/dist/components/Bookings/FlightBooking/FlightBooking.js +123 -85
- package/dist/components/CashValue/CashValue.js +1 -1
- package/dist/components/CashValue/CashValue.stories.js +1 -1
- package/dist/components/ClientPointsValue/ClientPointsValue.js +1 -1
- package/dist/components/Wallet/Card/Card.stories.js +1 -1
- package/dist/hooks/useAwayzAuth/useAwayzAuth.js +1 -1
- package/dist/hooks/useBookingManagement/useBookingManagement.js +1 -1
- package/dist/hooks/useBookingManagement/useBookingManagement.test.js +2 -2
- package/dist/hooks/useFeatureFlags.js +13 -11
- package/dist/hooks/useSearchLimit.js +1 -1
- package/dist/hooks/useTripManagement/mocks/index.js +12 -12
- package/dist/hooks/useTripManagement/useTripManagement.js +2 -2
- package/dist/hooks/useTripManagement/useTripManagement.test.js +122 -92
- package/dist/hooks/useWallet/useWallet.js +1 -1
- package/dist/hooks/useWallet/useWallet.test.js +2 -2
- package/dist/lib/components/Bookings/FlightBooking/FlightBooking.d.ts +15 -3
- package/dist/lib/hooks/useFeatureFlags.d.ts +1 -1
- package/dist/lib/hooks/useTripManagement/mocks/UncategorisedBookings200.json.d.ts +88 -0
- package/dist/lib/services/trips/TripService.types.d.ts +11 -0
- package/dist/magic-string.es-uPKorP4O.js +663 -0
- package/dist/main.js +1 -1
- package/dist/{noRetryInstance-De2sH_IH.js → noRetryInstance-DKhe8ju0.js} +35 -35
- package/dist/providers/AwayzProvider.js +1 -1
- package/dist/services/account/AccountService.js +1 -1
- package/dist/services/bookings/BookingService.js +1 -1
- package/dist/services/currency/CurrencyService.js +1 -1
- package/dist/services/features/featureService.js +1 -1
- package/dist/services/index.js +1 -1
- package/dist/services/instance.js +1 -1
- package/dist/services/instanceConfig.js +1 -1
- package/dist/services/noRetryInstance.js +1 -1
- package/dist/services/preferences/PreferencesService.js +1 -1
- package/dist/services/rewards/RewardsService.js +1 -1
- package/dist/services/trips/TripsService.js +3 -3
- package/dist/services/wallet/WalletService.js +1 -1
- package/dist/tests/TestWrapper.js +1130 -1153
- package/dist/utils/clientPoints.js +1 -1
- package/dist/vi.2VT5v0um-lKoi8TEt.js +10573 -0
- package/package.json +4 -2
- package/dist/TripsService-BJPYRlRO.js +0 -141
- package/dist/magic-string.es-D4UQQyt0.js +0 -859
- package/dist/vi.ClIskdbk-k6t29WRA.js +0 -12860
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@odynn/awayz-core",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.21",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -43,6 +43,8 @@
|
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@radix-ui/react-menubar": "^1.1.15",
|
|
45
45
|
"@radix-ui/react-tooltip": "^1.1.8",
|
|
46
|
-
"
|
|
46
|
+
"@testing-library/react": "^16.3.2",
|
|
47
|
+
"vite-plugin-lib-inject-css": "^2.2.1",
|
|
48
|
+
"vitest": "^4.0.18"
|
|
47
49
|
}
|
|
48
50
|
}
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
var m = Object.defineProperty;
|
|
2
|
-
var g = (r, e, s) => e in r ? m(r, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : r[e] = s;
|
|
3
|
-
var t = (r, e, s) => g(r, typeof e != "symbol" ? e + "" : e, s);
|
|
4
|
-
import "./arrayExtensions-DlcBOj5a.js";
|
|
5
|
-
import { c as n, f as p, b as c, r as T } from "./noRetryInstance-De2sH_IH.js";
|
|
6
|
-
import "react";
|
|
7
|
-
import { EMyTripsEndpoints as i } from "./configs/endpoints.js";
|
|
8
|
-
import { EBookingType as l } from "./services/trips/TripService.types.js";
|
|
9
|
-
import { DEFAULT_LOGO as y } from "./configs/defaultAwayzConfig.js";
|
|
10
|
-
const b = "https://assets.duffel.com/img/airlines/for-light-background/full-color-lockup/";
|
|
11
|
-
class f {
|
|
12
|
-
constructor() {
|
|
13
|
-
t(this, "createTrip", async (e) => {
|
|
14
|
-
const { data: s } = await n.post(
|
|
15
|
-
i.TRIPS,
|
|
16
|
-
p({
|
|
17
|
-
...e,
|
|
18
|
-
hotel_bookings: [],
|
|
19
|
-
flight_bookings: []
|
|
20
|
-
})
|
|
21
|
-
);
|
|
22
|
-
return s;
|
|
23
|
-
});
|
|
24
|
-
t(this, "getTripsByStatus", async (e) => {
|
|
25
|
-
const { data: s } = await n.get(
|
|
26
|
-
i.TRIPS,
|
|
27
|
-
{
|
|
28
|
-
params: { status: e }
|
|
29
|
-
}
|
|
30
|
-
);
|
|
31
|
-
if (!(s != null && s.success))
|
|
32
|
-
return [];
|
|
33
|
-
const a = s.data.map((d) => ({
|
|
34
|
-
...d,
|
|
35
|
-
flightBookings: u(d.flight_bookings ?? []),
|
|
36
|
-
hotelBookings: _(d.hotel_bookings ?? [])
|
|
37
|
-
}));
|
|
38
|
-
return c(a);
|
|
39
|
-
});
|
|
40
|
-
t(this, "updateTrip", async (e, s) => {
|
|
41
|
-
const { data: a } = await n.put(
|
|
42
|
-
`${i.TRIPS}/${e}`,
|
|
43
|
-
T(p(s))
|
|
44
|
-
);
|
|
45
|
-
return a != null && a.success ? {
|
|
46
|
-
success: !0,
|
|
47
|
-
data: c(a.data),
|
|
48
|
-
message: "Trip updated successfully."
|
|
49
|
-
} : {
|
|
50
|
-
success: !1,
|
|
51
|
-
message: "An error occurred while trying to update the trip."
|
|
52
|
-
};
|
|
53
|
-
});
|
|
54
|
-
t(this, "deleteTrip", async (e) => {
|
|
55
|
-
const { data: s } = await n.delete(
|
|
56
|
-
`${i.TRIPS}/${e}`
|
|
57
|
-
);
|
|
58
|
-
return s;
|
|
59
|
-
});
|
|
60
|
-
t(this, "getUncategorisedBookings", async () => {
|
|
61
|
-
const { data: e } = await n.get(
|
|
62
|
-
i.UNCATEGORISED_BOOKINGS
|
|
63
|
-
);
|
|
64
|
-
return e != null && e.success ? {
|
|
65
|
-
flightBookings: u(e.data.flight_bookings ?? []),
|
|
66
|
-
hotelBookings: _(e.data.hotel_bookings ?? [])
|
|
67
|
-
} : {
|
|
68
|
-
flightBookings: [],
|
|
69
|
-
hotelBookings: []
|
|
70
|
-
};
|
|
71
|
-
});
|
|
72
|
-
t(this, "addBookingToTrip", async (e, s, a) => {
|
|
73
|
-
const { data: o } = await n.put(i.ADD_BOOKING, {
|
|
74
|
-
trip_id: e,
|
|
75
|
-
booking_id: s,
|
|
76
|
-
booking_type: a
|
|
77
|
-
});
|
|
78
|
-
return o.success;
|
|
79
|
-
});
|
|
80
|
-
t(this, "removeBookingFromTrip", async (e, s, a) => {
|
|
81
|
-
const { data: o } = await n.put(
|
|
82
|
-
i.REMOVE_BOOKING,
|
|
83
|
-
p({
|
|
84
|
-
trip_id: e,
|
|
85
|
-
booking_id: s,
|
|
86
|
-
booking_type: a
|
|
87
|
-
})
|
|
88
|
-
);
|
|
89
|
-
return o.success;
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
const u = (r) => r.map(
|
|
94
|
-
(e) => c({
|
|
95
|
-
id: e._id,
|
|
96
|
-
reference: e.booking_reference,
|
|
97
|
-
startDate: e.departure_date,
|
|
98
|
-
endDate: e.arrival_date,
|
|
99
|
-
bookingType: l.FLIGHT,
|
|
100
|
-
airlines: e.slices.map((s) => {
|
|
101
|
-
var a;
|
|
102
|
-
return {
|
|
103
|
-
logo: (a = s.carriers.operating_iata_codes) != null && a.length ? `${b}${s.carriers.operating_iata_codes[0]}.svg` : y,
|
|
104
|
-
name: s.carriers.operating[0]
|
|
105
|
-
};
|
|
106
|
-
}),
|
|
107
|
-
arrival: {
|
|
108
|
-
airportCode: e.slices.getLast().destination,
|
|
109
|
-
location: ""
|
|
110
|
-
},
|
|
111
|
-
departure: {
|
|
112
|
-
airportCode: e.slices[0].origin,
|
|
113
|
-
location: ""
|
|
114
|
-
},
|
|
115
|
-
class: e.slices[0].fare_brand_name,
|
|
116
|
-
passengers: e.passengers.length,
|
|
117
|
-
hasAirlineChanges: !1,
|
|
118
|
-
orderId: e.order_id,
|
|
119
|
-
type: e.type,
|
|
120
|
-
cancelledAt: e.cancelled_at
|
|
121
|
-
})
|
|
122
|
-
), _ = (r) => r.map(
|
|
123
|
-
(e) => c({
|
|
124
|
-
id: e._id,
|
|
125
|
-
reference: e.reference,
|
|
126
|
-
startDate: e.check_in_date,
|
|
127
|
-
endDate: e.check_out_date,
|
|
128
|
-
bookingType: l.HOTEL,
|
|
129
|
-
name: e.rooms[0].name,
|
|
130
|
-
image: e.images[0],
|
|
131
|
-
guests: e.guests.length,
|
|
132
|
-
address: Object.values(e.address).filter((s) => s).map((s) => s.trim()).join(", "),
|
|
133
|
-
rooms: e.rooms.length,
|
|
134
|
-
bookingId: e.booking_id,
|
|
135
|
-
cancelledAt: e.cancelled_at
|
|
136
|
-
})
|
|
137
|
-
), w = new f();
|
|
138
|
-
export {
|
|
139
|
-
b as D,
|
|
140
|
-
w as T
|
|
141
|
-
};
|