@odynn/awayz-core 0.9.20 → 0.9.23
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 +1 -1
- package/dist/hooks/useFeatureFlags.js +1 -1
- 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 +41 -41
- package/dist/hooks/useWallet/useWallet.test.js +1 -1
- package/dist/lib/components/Bookings/FlightBooking/FlightBooking.d.ts +15 -3
- 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/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/utils/clientPoints.js +1 -1
- package/package.json +1 -1
- package/dist/TripsService-BJPYRlRO.js +0 -141
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { h as p } from "../../arrayExtensions-DlcBOj5a.js";
|
|
2
|
-
import { D as f } from "../../TripsService-
|
|
2
|
+
import { D as f } from "../../TripsService-GImsS17_.js";
|
|
3
3
|
import "react";
|
|
4
4
|
import { renderHook as o, waitFor as i } from "../../tests/TestWrapper.js";
|
|
5
5
|
import { EMyTripsEndpoints as c } from "../../configs/endpoints.js";
|
|
@@ -10,80 +10,80 @@ import "../../_styles.flight-booking-CaUgKcMC.js";
|
|
|
10
10
|
/* empty css */
|
|
11
11
|
import "@tanstack/react-query";
|
|
12
12
|
import "../../configs/awayzClient.js";
|
|
13
|
-
import { c as d } from "../../noRetryInstance-
|
|
13
|
+
import { c as d } from "../../noRetryInstance-DKhe8ju0.js";
|
|
14
14
|
/* empty css */
|
|
15
15
|
/* empty css */
|
|
16
16
|
import "../../index-Cv-wvFlM.js";
|
|
17
17
|
import "../../context/AwayzContext.js";
|
|
18
|
-
import { EBookingType as
|
|
18
|
+
import { EBookingType as g } from "../../services/trips/TripService.types.js";
|
|
19
19
|
import { useTripManagement as n } from "./useTripManagement.js";
|
|
20
20
|
/* empty css */
|
|
21
|
-
import { UncategorisedBookings200 as
|
|
22
|
-
import { d as u, v as
|
|
23
|
-
let
|
|
24
|
-
past: [...
|
|
25
|
-
upcoming: [...
|
|
21
|
+
import { UncategorisedBookings200 as T, PastTrip200 as y, UpcomingTrip200 as B, UpdatedTrip200 as b } from "./mocks/index.js";
|
|
22
|
+
import { d as u, v as k, b as D, t as s, g as e } from "../../vi.2VT5v0um-lKoi8TEt.js";
|
|
23
|
+
let l = {
|
|
24
|
+
past: [...y.data],
|
|
25
|
+
upcoming: [...B.data].concat(b.data)
|
|
26
26
|
};
|
|
27
27
|
u("useTripManagement", () => {
|
|
28
|
-
|
|
29
|
-
var a,
|
|
30
|
-
return
|
|
31
|
-
data:
|
|
32
|
-
}) : ((a =
|
|
33
|
-
data: { ...
|
|
34
|
-
}) : ((
|
|
35
|
-
data: { ...
|
|
28
|
+
k.mocked(d.get).mockImplementation((r, t) => {
|
|
29
|
+
var a, m;
|
|
30
|
+
return r === c.UNCATEGORISED_BOOKINGS ? Promise.resolve({
|
|
31
|
+
data: T
|
|
32
|
+
}) : ((a = t == null ? void 0 : t.params) == null ? void 0 : a.status) === "past" ? Promise.resolve({
|
|
33
|
+
data: { ...y, data: l.past }
|
|
34
|
+
}) : ((m = t == null ? void 0 : t.params) == null ? void 0 : m.status) === "upcoming" ? Promise.resolve({
|
|
35
|
+
data: { ...B, data: l.upcoming }
|
|
36
36
|
}) : Promise.resolve({ data: {} });
|
|
37
|
-
}),
|
|
38
|
-
if (
|
|
39
|
-
const
|
|
40
|
-
...
|
|
37
|
+
}), k.mocked(d.put).mockImplementation((r) => {
|
|
38
|
+
if (r === `${c.TRIPS}/67fd23bc3a7cbcd0a8757cdc`) {
|
|
39
|
+
const t = {
|
|
40
|
+
...b.data,
|
|
41
41
|
name: "Updated Trip"
|
|
42
42
|
};
|
|
43
|
-
return
|
|
44
|
-
(a) => a._id === "67fd23bc3a7cbcd0a8757cdc" ?
|
|
45
|
-
),
|
|
46
|
-
(a) => a._id === "67fd23bc3a7cbcd0a8757cdc" ?
|
|
43
|
+
return l.past = l.past.map(
|
|
44
|
+
(a) => a._id === "67fd23bc3a7cbcd0a8757cdc" ? t : a
|
|
45
|
+
), l.upcoming = l.upcoming.map(
|
|
46
|
+
(a) => a._id === "67fd23bc3a7cbcd0a8757cdc" ? t : a
|
|
47
47
|
), Promise.resolve({
|
|
48
|
-
data:
|
|
48
|
+
data: b
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
|
-
return
|
|
51
|
+
return r === c.ADD_BOOKING ? Promise.resolve({
|
|
52
52
|
data: { success: !0, message: "Booking added to trip successfully" }
|
|
53
53
|
}) : Promise.resolve({ data: {} });
|
|
54
54
|
}), D(() => {
|
|
55
|
-
|
|
55
|
+
k.clearAllMocks();
|
|
56
56
|
}), u("Get User Trips", () => {
|
|
57
57
|
s("Has past trips", async () => {
|
|
58
|
-
const { result:
|
|
58
|
+
const { result: r } = o(() => n());
|
|
59
59
|
await i(() => {
|
|
60
|
-
e(
|
|
61
|
-
p(
|
|
60
|
+
e(r.current.pastTrips.length).greaterThan(0), e(
|
|
61
|
+
p(r.current.pastTrips[0].endDate).isBefore(p())
|
|
62
62
|
).toBe(!0);
|
|
63
63
|
});
|
|
64
64
|
}), s("Has upcoming trips", async () => {
|
|
65
|
-
const { result:
|
|
65
|
+
const { result: r } = o(() => n());
|
|
66
66
|
await i(() => {
|
|
67
|
-
e(
|
|
68
|
-
p(
|
|
67
|
+
e(r.current.upcomingTrips.length).greaterThan(0), e(
|
|
68
|
+
p(r.current.upcomingTrips[0].startDate).isAfter(p())
|
|
69
69
|
).toBe(!0);
|
|
70
70
|
});
|
|
71
71
|
}), s("Has correct flight booking structure", async () => {
|
|
72
|
-
const { result:
|
|
72
|
+
const { result: r } = o(() => n());
|
|
73
73
|
await i(() => {
|
|
74
|
-
const
|
|
75
|
-
e(
|
|
74
|
+
const t = r.current.uncategorisedFlightBookings[0], a = T.data.flight_bookings[0];
|
|
75
|
+
e(t).toMatchObject({
|
|
76
76
|
id: a._id,
|
|
77
77
|
reference: a.booking_reference,
|
|
78
78
|
startDate: e.any(String),
|
|
79
79
|
endDate: e.any(String),
|
|
80
|
-
bookingType:
|
|
81
|
-
airlines: a.slices.map((
|
|
80
|
+
bookingType: g.FLIGHT,
|
|
81
|
+
airlines: a.slices.map((m) => ({
|
|
82
82
|
logo: f + ".svg",
|
|
83
|
-
name:
|
|
83
|
+
name: m.carriers.operating[0]
|
|
84
84
|
})),
|
|
85
85
|
arrival: {
|
|
86
|
-
airportCode: a.slices.
|
|
86
|
+
airportCode: a.slices[0].destination,
|
|
87
87
|
location: ""
|
|
88
88
|
},
|
|
89
89
|
departure: {
|
|
@@ -95,19 +95,49 @@ u("useTripManagement", () => {
|
|
|
95
95
|
hasAirlineChanges: !1,
|
|
96
96
|
orderId: a.order_id,
|
|
97
97
|
type: a.type,
|
|
98
|
-
cancelledAt: a.cancelled_at
|
|
98
|
+
cancelledAt: a.cancelled_at,
|
|
99
|
+
isRoundTrip: !1
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
}), s("Has correct round-trip flight booking structure", async () => {
|
|
103
|
+
const { result: r } = o(() => n());
|
|
104
|
+
await i(() => {
|
|
105
|
+
const t = r.current.uncategorisedFlightBookings[1], a = T.data.flight_bookings[1];
|
|
106
|
+
e(t).toMatchObject({
|
|
107
|
+
id: a._id,
|
|
108
|
+
reference: a.booking_reference,
|
|
109
|
+
bookingType: g.FLIGHT,
|
|
110
|
+
isRoundTrip: !0,
|
|
111
|
+
departure: {
|
|
112
|
+
airportCode: "LAX",
|
|
113
|
+
location: ""
|
|
114
|
+
},
|
|
115
|
+
arrival: {
|
|
116
|
+
airportCode: "HRL",
|
|
117
|
+
location: ""
|
|
118
|
+
},
|
|
119
|
+
inboundDeparture: {
|
|
120
|
+
airportCode: "HRL",
|
|
121
|
+
location: ""
|
|
122
|
+
},
|
|
123
|
+
inboundArrival: {
|
|
124
|
+
airportCode: "LAX",
|
|
125
|
+
location: ""
|
|
126
|
+
},
|
|
127
|
+
outboundArrivalDate: "2025-07-06T22:29:00.000Z",
|
|
128
|
+
inboundDepartureDate: "2025-07-10T20:07:00.000Z"
|
|
99
129
|
});
|
|
100
130
|
});
|
|
101
131
|
}), s("Has correct hotel booking structure", async () => {
|
|
102
|
-
const { result:
|
|
132
|
+
const { result: r } = o(() => n());
|
|
103
133
|
await i(() => {
|
|
104
|
-
const
|
|
105
|
-
e(
|
|
134
|
+
const t = r.current.uncategorisedHotelBookings[0];
|
|
135
|
+
e(t).toMatchObject({
|
|
106
136
|
id: e.any(String),
|
|
107
137
|
reference: e.any(String),
|
|
108
138
|
startDate: e.any(String),
|
|
109
139
|
endDate: e.any(String),
|
|
110
|
-
bookingType:
|
|
140
|
+
bookingType: g.HOTEL,
|
|
111
141
|
name: e.any(String),
|
|
112
142
|
image: e.any(String),
|
|
113
143
|
guests: e.any(Number),
|
|
@@ -119,83 +149,83 @@ u("useTripManagement", () => {
|
|
|
119
149
|
});
|
|
120
150
|
}), u("Create Trip", () => {
|
|
121
151
|
s("Invalid Requests", async () => {
|
|
122
|
-
const { result:
|
|
123
|
-
|
|
124
|
-
var
|
|
125
|
-
e(
|
|
152
|
+
const { result: r } = o(() => n());
|
|
153
|
+
r.current.createTrip(), await i(() => {
|
|
154
|
+
var t;
|
|
155
|
+
e(r.current.isCreateTripError).toBe(!0), e((t = r.current.createTripError) == null ? void 0 : t.message).toContain(
|
|
126
156
|
"Trip details are required to create a trip"
|
|
127
157
|
);
|
|
128
|
-
}),
|
|
158
|
+
}), r.current.createTrip({
|
|
129
159
|
name: "",
|
|
130
160
|
startDate: "",
|
|
131
161
|
endDate: ""
|
|
132
162
|
}), await i(() => {
|
|
133
|
-
var
|
|
134
|
-
e(
|
|
163
|
+
var t;
|
|
164
|
+
e(r.current.isCreateTripError).toBe(!0), e((t = r.current.createTripError) == null ? void 0 : t.message).toContain(
|
|
135
165
|
"Trip name, start date, and end date are required"
|
|
136
166
|
);
|
|
137
167
|
});
|
|
138
168
|
}), s("Can successfully create a trip", async () => {
|
|
139
|
-
const
|
|
169
|
+
const r = {
|
|
140
170
|
name: "New Trip",
|
|
141
171
|
startDate: p().add(1, "days").format("YYYY-MM-DD"),
|
|
142
172
|
endDate: p().add(2, "days").format("YYYY-MM-DD")
|
|
143
|
-
}, { result:
|
|
144
|
-
|
|
173
|
+
}, { result: t } = o(() => n());
|
|
174
|
+
t.current.createTrip(r), await i(() => {
|
|
145
175
|
e(d.post).toHaveBeenCalledWith(
|
|
146
176
|
c.TRIPS,
|
|
147
177
|
e.objectContaining({
|
|
148
|
-
name:
|
|
149
|
-
start_date:
|
|
150
|
-
end_date:
|
|
178
|
+
name: r.name,
|
|
179
|
+
start_date: r.startDate,
|
|
180
|
+
end_date: r.endDate
|
|
151
181
|
})
|
|
152
182
|
);
|
|
153
183
|
});
|
|
154
184
|
});
|
|
155
185
|
}), u("Delete Trip", () => {
|
|
156
186
|
s("Can successfully delete a trip", async () => {
|
|
157
|
-
const
|
|
158
|
-
|
|
187
|
+
const r = "12345", { result: t } = o(() => n());
|
|
188
|
+
t.current.deleteTrip(r), await i(() => {
|
|
159
189
|
e(d.delete).toHaveBeenCalledWith(
|
|
160
|
-
`${c.TRIPS}/${
|
|
190
|
+
`${c.TRIPS}/${r}`
|
|
161
191
|
);
|
|
162
192
|
});
|
|
163
193
|
});
|
|
164
194
|
}), u("Update Trip", () => {
|
|
165
195
|
s("Invalid tripId arg", async () => {
|
|
166
|
-
const { result:
|
|
167
|
-
|
|
196
|
+
const { result: r } = o(() => n());
|
|
197
|
+
r.current.updateTrip({
|
|
168
198
|
tripId: "",
|
|
169
199
|
tripDetails: {
|
|
170
200
|
name: "Updated Trip"
|
|
171
201
|
}
|
|
172
202
|
}), await i(() => {
|
|
173
|
-
var
|
|
174
|
-
e(
|
|
203
|
+
var t;
|
|
204
|
+
e(r.current.isUpdateTripError).toBe(!0), e((t = r.current.updateTripError) == null ? void 0 : t.message).toContain(
|
|
175
205
|
"Trip ID is required"
|
|
176
206
|
);
|
|
177
207
|
});
|
|
178
208
|
}), s("Invalid tripDetails arg", async () => {
|
|
179
|
-
const { result:
|
|
180
|
-
|
|
209
|
+
const { result: r } = o(() => n());
|
|
210
|
+
r.current.updateTrip({
|
|
181
211
|
tripId: "123",
|
|
182
212
|
tripDetails: {}
|
|
183
213
|
}), await i(() => {
|
|
184
|
-
var
|
|
185
|
-
e(
|
|
214
|
+
var t;
|
|
215
|
+
e(r.current.isUpdateTripError).toBe(!0), e((t = r.current.updateTripError) == null ? void 0 : t.message).toContain(
|
|
186
216
|
"Trip details must be provided for update"
|
|
187
217
|
);
|
|
188
218
|
});
|
|
189
219
|
}), s("Successful update", async () => {
|
|
190
|
-
const { result:
|
|
191
|
-
|
|
192
|
-
tripId:
|
|
220
|
+
const { result: r } = o(() => n()), t = "682ffebaa6cc24f39d99fdc7";
|
|
221
|
+
r.current.updateTrip({
|
|
222
|
+
tripId: t,
|
|
193
223
|
tripDetails: {
|
|
194
224
|
name: "Updated Trip"
|
|
195
225
|
}
|
|
196
226
|
}), await i(() => {
|
|
197
227
|
e(d.put).toHaveBeenCalledWith(
|
|
198
|
-
`${c.TRIPS}/${
|
|
228
|
+
`${c.TRIPS}/${t}`,
|
|
199
229
|
e.objectContaining({
|
|
200
230
|
name: "Updated Trip"
|
|
201
231
|
})
|
|
@@ -204,52 +234,52 @@ u("useTripManagement", () => {
|
|
|
204
234
|
});
|
|
205
235
|
}), u("Add Booking to Trip", () => {
|
|
206
236
|
s("Invalid tripId arg", async () => {
|
|
207
|
-
const { result:
|
|
208
|
-
|
|
209
|
-
booking:
|
|
237
|
+
const { result: r } = o(() => n());
|
|
238
|
+
r.current.addBookingToTrip({
|
|
239
|
+
booking: r.current.uncategorisedHotelBookings[0]
|
|
210
240
|
}), await i(() => {
|
|
211
|
-
var
|
|
212
|
-
e(
|
|
241
|
+
var t;
|
|
242
|
+
e(r.current.isAddBookingToTripError).toBe(!0), e((t = r.current.addBookingToTripError) == null ? void 0 : t.message).toContain(
|
|
213
243
|
"Trip ID is required"
|
|
214
244
|
);
|
|
215
245
|
});
|
|
216
246
|
}), s("Invalid bookingId arg", async () => {
|
|
217
|
-
const { result:
|
|
218
|
-
|
|
247
|
+
const { result: r } = o(() => n());
|
|
248
|
+
r.current.addBookingToTrip({
|
|
219
249
|
tripId: "12345"
|
|
220
250
|
}), await i(() => {
|
|
221
|
-
var
|
|
222
|
-
e(
|
|
251
|
+
var t;
|
|
252
|
+
e(r.current.isAddBookingToTripError).toBe(!0), e((t = r.current.addBookingToTripError) == null ? void 0 : t.message).toContain(
|
|
223
253
|
"Booking is required"
|
|
224
254
|
);
|
|
225
255
|
});
|
|
226
256
|
}), s("Successfully add hotel booking to trip", async () => {
|
|
227
|
-
const { result:
|
|
228
|
-
|
|
257
|
+
const { result: r } = o(() => n()), t = r.current.uncategorisedHotelBookings[0], a = r.current.upcomingTrips[0];
|
|
258
|
+
r.current.addBookingToTrip({
|
|
229
259
|
tripId: a.id,
|
|
230
|
-
booking:
|
|
260
|
+
booking: t
|
|
231
261
|
}), await i(() => {
|
|
232
262
|
e(d.put).toHaveBeenCalledWith(
|
|
233
263
|
c.ADD_BOOKING,
|
|
234
264
|
e.objectContaining({
|
|
235
265
|
trip_id: a.id,
|
|
236
|
-
booking_id:
|
|
237
|
-
booking_type:
|
|
266
|
+
booking_id: t.id,
|
|
267
|
+
booking_type: g.HOTEL
|
|
238
268
|
})
|
|
239
269
|
);
|
|
240
270
|
});
|
|
241
271
|
}), s("Successfully add flight booking to trip", async () => {
|
|
242
|
-
const { result:
|
|
243
|
-
|
|
272
|
+
const { result: r } = o(() => n()), t = r.current.uncategorisedFlightBookings[0], a = r.current.upcomingTrips[0];
|
|
273
|
+
r.current.addBookingToTrip({
|
|
244
274
|
tripId: a.id,
|
|
245
|
-
booking:
|
|
275
|
+
booking: t
|
|
246
276
|
}), await i(() => {
|
|
247
277
|
e(d.put).toHaveBeenCalledWith(
|
|
248
278
|
c.ADD_BOOKING,
|
|
249
279
|
e.objectContaining({
|
|
250
280
|
trip_id: a.id,
|
|
251
|
-
booking_id:
|
|
252
|
-
booking_type:
|
|
281
|
+
booking_id: t.id,
|
|
282
|
+
booking_type: g.FLIGHT
|
|
253
283
|
})
|
|
254
284
|
);
|
|
255
285
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useQuery as n, useMutation as s } from "@tanstack/react-query";
|
|
2
2
|
import "../../arrayExtensions-DlcBOj5a.js";
|
|
3
|
-
import { E as a, d as
|
|
3
|
+
import { E as a, d as m } from "../../noRetryInstance-DKhe8ju0.js";
|
|
4
4
|
import "react";
|
|
5
5
|
import "react/jsx-runtime";
|
|
6
6
|
import "react-i18next";
|
|
@@ -11,25 +11,25 @@ import { awayzClient as i } from "../../configs/awayzClient.js";
|
|
|
11
11
|
/* empty css */
|
|
12
12
|
/* empty css */
|
|
13
13
|
import "../../index-Cv-wvFlM.js";
|
|
14
|
-
import { useAwayzContext as
|
|
14
|
+
import { useAwayzContext as c } from "../useAwayzContext.js";
|
|
15
15
|
/* empty css */
|
|
16
16
|
import "../../context/AwayzContext.js";
|
|
17
17
|
import { WalletService as o } from "../../services/wallet/WalletService.js";
|
|
18
|
-
const
|
|
19
|
-
const { user:
|
|
18
|
+
const x = () => {
|
|
19
|
+
const { user: e } = c(), { data: t } = n({
|
|
20
20
|
queryKey: [a.PROGRAMS],
|
|
21
21
|
queryFn: o.getAwards,
|
|
22
22
|
placeholderData: []
|
|
23
|
-
}), { data:
|
|
24
|
-
queryKey: [a.USER_PROGRAMS,
|
|
25
|
-
queryFn: () =>
|
|
23
|
+
}), { data: l } = n({
|
|
24
|
+
queryKey: [a.USER_PROGRAMS, e == null ? void 0 : e.id],
|
|
25
|
+
queryFn: () => e != null && e.id ? o.getUserAwards(e.id) : [],
|
|
26
26
|
placeholderData: [],
|
|
27
|
-
enabled: !!(
|
|
27
|
+
enabled: !!(e != null && e.id)
|
|
28
28
|
}), { data: y } = n({
|
|
29
|
-
queryKey: [a.LINKED_USER_PROGRAMS,
|
|
30
|
-
queryFn: () =>
|
|
29
|
+
queryKey: [a.LINKED_USER_PROGRAMS, e == null ? void 0 : e.id],
|
|
30
|
+
queryFn: () => e != null && e.id ? o.getLinkedUserAwards(e.id) : [],
|
|
31
31
|
placeholderData: [],
|
|
32
|
-
enabled: !!(
|
|
32
|
+
enabled: !!(e != null && e.id)
|
|
33
33
|
}), { data: A } = n({
|
|
34
34
|
queryKey: [a.BANKS],
|
|
35
35
|
queryFn: o.getBanks,
|
|
@@ -42,55 +42,55 @@ const T = () => {
|
|
|
42
42
|
queryKey: [a.USER_CARDS],
|
|
43
43
|
queryFn: o.getUserCards,
|
|
44
44
|
placeholderData: []
|
|
45
|
-
}), { featureFlags: R, featureFlagsLoaded: S } =
|
|
45
|
+
}), { featureFlags: R, featureFlagsLoaded: S, isAuthenticated: p } = c(), { data: C } = n({
|
|
46
46
|
queryKey: [a.POINTS_AS_CASH],
|
|
47
47
|
queryFn: o.getPointsAsCash,
|
|
48
48
|
placeholderData: { availablePoints: 0, valuePerPoint: 0, currency: "" },
|
|
49
|
-
enabled: S && R.usePointsAsCashFeature
|
|
50
|
-
}), { mutate:
|
|
51
|
-
mutationFn: async (
|
|
52
|
-
const { mainProgram:
|
|
53
|
-
await o.addAwardProgram(
|
|
49
|
+
enabled: S && R.usePointsAsCashFeature && p
|
|
50
|
+
}), { mutate: E } = s({
|
|
51
|
+
mutationFn: async (r) => {
|
|
52
|
+
const { mainProgram: u, awardsAmount: d } = typeof r == "string" ? { mainProgram: r, awardsAmount: 0 } : r;
|
|
53
|
+
await o.addAwardProgram(u, d);
|
|
54
54
|
},
|
|
55
55
|
onSuccess: () => {
|
|
56
56
|
i.invalidateQueries({
|
|
57
57
|
queryKey: [a.LINKED_USER_PROGRAMS]
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
|
-
}), { mutate:
|
|
61
|
-
mutationFn: async (
|
|
62
|
-
await o.removeAwardProgram(
|
|
60
|
+
}), { mutate: K } = s({
|
|
61
|
+
mutationFn: async (r) => {
|
|
62
|
+
await o.removeAwardProgram(r);
|
|
63
63
|
},
|
|
64
64
|
onSuccess: () => {
|
|
65
65
|
i.invalidateQueries({
|
|
66
66
|
queryKey: [a.LINKED_USER_PROGRAMS]
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
|
-
}), { mutateAsync:
|
|
70
|
-
mutationFn: async ({ mainProgram:
|
|
71
|
-
const d = t == null ? void 0 : t.find((
|
|
69
|
+
}), { mutateAsync: f } = s({
|
|
70
|
+
mutationFn: async ({ mainProgram: r, awardsAmount: u }) => {
|
|
71
|
+
const d = t == null ? void 0 : t.find((h) => h.mainProgram === r);
|
|
72
72
|
if (!d)
|
|
73
73
|
throw new Error("Program not found");
|
|
74
|
-
return o.setAwardPoints(d.mainProgram,
|
|
74
|
+
return o.setAwardPoints(d.mainProgram, u);
|
|
75
75
|
},
|
|
76
76
|
onSuccess: () => {
|
|
77
77
|
[
|
|
78
78
|
a.LINKED_USER_PROGRAMS,
|
|
79
79
|
a.USER_PROGRAMS,
|
|
80
80
|
a.PROGRAMS
|
|
81
|
-
].forEach((
|
|
82
|
-
i.invalidateQueries({ queryKey: [
|
|
81
|
+
].forEach((r) => {
|
|
82
|
+
i.invalidateQueries({ queryKey: [r] });
|
|
83
83
|
});
|
|
84
84
|
}
|
|
85
|
-
}), { mutateAsync:
|
|
86
|
-
mutationFn: async (
|
|
85
|
+
}), { mutateAsync: q } = s({
|
|
86
|
+
mutationFn: async (r) => o.addCardsToWallet(r),
|
|
87
87
|
onSuccess: () => {
|
|
88
88
|
i.invalidateQueries({
|
|
89
89
|
queryKey: [a.USER_CARDS]
|
|
90
90
|
});
|
|
91
91
|
}
|
|
92
|
-
}), { mutateAsync:
|
|
93
|
-
mutationFn: async (
|
|
92
|
+
}), { mutateAsync: F } = s({
|
|
93
|
+
mutationFn: async (r) => o.removeCardsFromWallet(r),
|
|
94
94
|
onSuccess: () => {
|
|
95
95
|
i.invalidateQueries({
|
|
96
96
|
queryKey: [a.USER_CARDS]
|
|
@@ -100,27 +100,27 @@ const T = () => {
|
|
|
100
100
|
return {
|
|
101
101
|
// Program Management
|
|
102
102
|
allPrograms: t || [],
|
|
103
|
-
userPrograms:
|
|
103
|
+
userPrograms: l || [],
|
|
104
104
|
linkedUserPrograms: y || [],
|
|
105
105
|
hotelPrograms: (t == null ? void 0 : t.filter(
|
|
106
|
-
(
|
|
106
|
+
(r) => r.category.includes(m.HOTEL)
|
|
107
107
|
)) || [],
|
|
108
108
|
airlinePrograms: (t == null ? void 0 : t.filter(
|
|
109
|
-
(
|
|
109
|
+
(r) => r.category.includes(m.AIRLINE)
|
|
110
110
|
)) || [],
|
|
111
111
|
bankPrograms: (t == null ? void 0 : t.filter(
|
|
112
|
-
(
|
|
112
|
+
(r) => r.category.includes(m.BANK)
|
|
113
113
|
)) || [],
|
|
114
|
-
updatePoints:
|
|
115
|
-
addAwardProgram:
|
|
116
|
-
removeAwardProgram:
|
|
114
|
+
updatePoints: f,
|
|
115
|
+
addAwardProgram: E,
|
|
116
|
+
removeAwardProgram: K,
|
|
117
117
|
// Card Management
|
|
118
118
|
banks: A || [],
|
|
119
119
|
allCards: P || [],
|
|
120
120
|
userCards: g || [],
|
|
121
|
-
addCards:
|
|
122
|
-
removeCards:
|
|
123
|
-
pointsAsCash:
|
|
121
|
+
addCards: q,
|
|
122
|
+
removeCards: F,
|
|
123
|
+
pointsAsCash: C || {
|
|
124
124
|
availablePoints: 0,
|
|
125
125
|
valuePerPoint: 0,
|
|
126
126
|
currency: ""
|
|
@@ -128,5 +128,5 @@ const T = () => {
|
|
|
128
128
|
};
|
|
129
129
|
};
|
|
130
130
|
export {
|
|
131
|
-
|
|
131
|
+
x as useWallet
|
|
132
132
|
};
|
|
@@ -8,7 +8,7 @@ import "../../_styles.flight-booking-CaUgKcMC.js";
|
|
|
8
8
|
/* empty css */
|
|
9
9
|
import "@tanstack/react-query";
|
|
10
10
|
import "../../configs/awayzClient.js";
|
|
11
|
-
import { c as l } from "../../noRetryInstance-
|
|
11
|
+
import { c as l } from "../../noRetryInstance-DKhe8ju0.js";
|
|
12
12
|
/* empty css */
|
|
13
13
|
/* empty css */
|
|
14
14
|
import "../../index-Cv-wvFlM.js";
|
|
@@ -14,11 +14,11 @@ export interface IFlightBookingProps {
|
|
|
14
14
|
name: string;
|
|
15
15
|
}[];
|
|
16
16
|
/**
|
|
17
|
-
* The location and time of the flight's departure
|
|
17
|
+
* The location and time of the outbound flight's departure
|
|
18
18
|
*/
|
|
19
19
|
departure: IFlightBookingLocation;
|
|
20
20
|
/**
|
|
21
|
-
* The location and time of the flight's arrival
|
|
21
|
+
* The location and time of the outbound flight's arrival
|
|
22
22
|
*/
|
|
23
23
|
arrival: IFlightBookingLocation;
|
|
24
24
|
/**
|
|
@@ -42,6 +42,18 @@ export interface IFlightBookingProps {
|
|
|
42
42
|
*/
|
|
43
43
|
hasAirlineChanges: boolean;
|
|
44
44
|
onClick?: () => void;
|
|
45
|
+
/**
|
|
46
|
+
* The location and time of the inbound (return) flight's departure.
|
|
47
|
+
* When provided, a second leg row is rendered on the card.
|
|
48
|
+
*/
|
|
49
|
+
inboundDeparture?: IFlightBookingLocation;
|
|
50
|
+
/**
|
|
51
|
+
* The location and time of the inbound (return) flight's arrival
|
|
52
|
+
* This is a change from before, where it was flightBooking.slices.getLast().destination
|
|
53
|
+
* We now explicitly arrival/departure for one-way and outbound.
|
|
54
|
+
* For round-trip, we have inboundDeparture/Arrival as optional props
|
|
55
|
+
*/
|
|
56
|
+
inboundArrival?: IFlightBookingLocation;
|
|
45
57
|
/**
|
|
46
58
|
* Context options to show in the menu
|
|
47
59
|
* Generally used for actions like "Cancel Booking", "Add to trip", etc.
|
|
@@ -55,5 +67,5 @@ export interface IFlightBookingProps {
|
|
|
55
67
|
* flight class, number of passengers, and cancellation status.
|
|
56
68
|
* It also provides a menu for additional actions if context options are provided.
|
|
57
69
|
*/
|
|
58
|
-
export declare const FlightBooking: ({ airlines, departure, arrival, bookingRef, flightClass, numberOfPassengers, cancelledAt, hasAirlineChanges, onClick, contextOptions }: IFlightBookingProps) => import("react/jsx-runtime").JSX.Element;
|
|
70
|
+
export declare const FlightBooking: ({ airlines, departure, arrival, bookingRef, flightClass, numberOfPassengers, cancelledAt, hasAirlineChanges, onClick, inboundDeparture, inboundArrival, contextOptions }: IFlightBookingProps) => import("react/jsx-runtime").JSX.Element;
|
|
59
71
|
export {};
|