@odynn/awayz-core 0.6.36 → 0.6.40
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/components/CashValue/CashValue.js +1 -1
- package/dist/hooks/useBookingManagement/useBookingManagement.test.js +2 -2
- package/dist/hooks/useWallet/useWallet.js +34 -38
- package/dist/lib/hooks/useWallet/useWallet.types.d.ts +2 -2
- package/dist/lib/services/index.d.ts +5 -5
- package/dist/main.js +25 -24
- package/dist/services/index.js +12 -11
- package/package.json +1 -1
|
@@ -17,8 +17,8 @@ import "react-i18next";
|
|
|
17
17
|
import "../../configs/awayzClient.js";
|
|
18
18
|
import { useAwayzContext as bt } from "../../hooks/useAwayzContext.js";
|
|
19
19
|
import "../../context/AwayzContext.js";
|
|
20
|
-
import "../../services/noRetryInstance.js";
|
|
21
20
|
import { CurrencyService as xt } from "../../services/currency/CurrencyService.js";
|
|
21
|
+
import "../../services/noRetryInstance.js";
|
|
22
22
|
/* empty css */
|
|
23
23
|
// @__NO_SIDE_EFFECTS__
|
|
24
24
|
function Tt(e) {
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { EBookingEndpoints as i } from "../../configs/endpoints.js";
|
|
2
|
-
import { c } from "../../AccountService-DHR8seWS.js";
|
|
3
|
-
import "../../services/noRetryInstance.js";
|
|
4
2
|
import "../../arrayExtensions-DlcBOj5a.js";
|
|
5
3
|
import "react";
|
|
6
4
|
import "react/jsx-runtime";
|
|
@@ -14,7 +12,9 @@ import "react-i18next";
|
|
|
14
12
|
import "../../configs/awayzClient.js";
|
|
15
13
|
import "../../context/AwayzContext.js";
|
|
16
14
|
import { useBookingManagement as t } from "./useBookingManagement.js";
|
|
15
|
+
import { c } from "../../AccountService-DHR8seWS.js";
|
|
17
16
|
import { EBookingType as r } from "../../services/trips/TripService.types.js";
|
|
17
|
+
import "../../services/noRetryInstance.js";
|
|
18
18
|
import { renderHook as a, waitFor as n } from "../../tests/TestWrapper.js";
|
|
19
19
|
import { d as s, v as u, t as l, g as e } from "../../vi.ClIskdbk-k6t29WRA.js";
|
|
20
20
|
const d = { _id: "6811290ef16af25943018944", order_id: "ord_0000AvQk8IXqiCE2o20e00", user_id: "67d82b1c52c4a4dbe4e640c0", void_window_ends_at: null, documents: [{ passenger_ids: ["pas_0000AvQjcLZRvVQivKWRxi"], unique_identifier: "1", type: "electronic_ticket" }], synced_at: "2025-06-23T18:32:48Z", available_actions: ["cancel", "change", "update"], airline_initiated_changes: [], cancellation: null, tax_currency: "USD", base_currency: "USD", base_amount: "77.49", tax_amount: "13.94", total_currency: "USD", offer_id: "off_0000AvQjcLqSuF2bm6U2U7", booking_reference: "GHNRHO", created_at: "2025-06-23T18:31:58.211428Z", payment_status: { paid_at: "2025-06-23T18:31:58Z", price_guarantee_expires_at: null, payment_required_by: null, awaiting_payment: !1 }, live_mode: !1, total_amount: "91.43", slices: [{ destination_type: "airport", origin_type: "airport", fare_brand_name: "Basic", segments: [{ origin_terminal: "2", destination_terminal: "1", aircraft: { iata_code: "773", name: "Boeing 777-300", id: "arc_00009VMF8AhXSSRnQDI6HE" }, departing_at: "2025-07-30T22:27:00", arriving_at: "2025-07-31T00:24:00", operating_carrier: { logo_symbol_url: "https://assets.duffel.com/img/airlines/for-light-background/full-color-logo/ZZ.svg", logo_lockup_url: null, conditions_of_carriage_url: "https://duffelairways.com/dummy-url/conditions-of-carriage", iata_code: "ZZ", name: "Duffel Airways", id: "arl_00009VME7D6ivUu8dn35WK" }, marketing_carrier: { logo_symbol_url: "https://assets.duffel.com/img/airlines/for-light-background/full-color-logo/ZZ.svg", logo_lockup_url: null, conditions_of_carriage_url: "https://duffelairways.com/dummy-url/conditions-of-carriage", iata_code: "ZZ", name: "Duffel Airways", id: "arl_00009VME7D6ivUu8dn35WK" }, stops: [], operating_carrier_flight_number: "9596", marketing_carrier_flight_number: "9596", distance: "1034.9960998474376", passengers: [{ baggages: [{ quantity: 1, type: "checked" }, { quantity: 1, type: "carry_on" }], cabin_class_marketing_name: "Economy", passenger_id: "pas_0000AvQjcLZRvVQivKWRxi", seat: null, cabin_class: "economy" }], duration: "PT1H57M", destination: { icao_code: "LFPG", iata_country_code: "FR", iata_city_code: "PAR", city_name: "Paris", iata_code: "CDG", latitude: 49.011244, longitude: 2.548962, city: { icao_code: null, iata_country_code: "FR", iata_city_code: "PAR", city_name: null, iata_code: "PAR", latitude: null, longitude: null, time_zone: null, type: "city", name: "Paris", id: "cit_par_fr" }, time_zone: "Europe/Paris", type: "airport", name: "Paris Charles de Gaulle Airport", id: "arp_cdg_fr" }, origin: { icao_code: "LOWW", iata_country_code: "AT", iata_city_code: "VIE", city_name: "Vienna", iata_code: "VIE", latitude: 48.113065, longitude: 16.568137, city: null, time_zone: "Europe/Vienna", type: "airport", name: "Vienna International Airport", id: "arp_vie_at" }, id: "seg_0000AvQjcLqSuF2bm6U2U5" }], conditions: { change_before_departure: { penalty_currency: "GBP", penalty_amount: "10.00", allowed: !0 } }, duration: "PT1H57M", destination: { icao_code: "LFPG", iata_country_code: "FR", iata_city_code: "PAR", city_name: "Paris", iata_code: "CDG", latitude: 49.011244, longitude: 2.548962, city: { icao_code: null, iata_country_code: "FR", iata_city_code: "PAR", city_name: null, iata_code: "PAR", latitude: null, longitude: null, time_zone: null, type: "city", name: "Paris", id: "cit_par_fr" }, time_zone: "Europe/Paris", type: "airport", name: "Paris Charles de Gaulle Airport", id: "arp_cdg_fr" }, origin: { icao_code: "LOWW", iata_country_code: "AT", iata_city_code: "VIE", city_name: "Vienna", iata_code: "VIE", latitude: 48.113065, longitude: 16.568137, city: null, time_zone: "Europe/Vienna", type: "airport", name: "Vienna International Airport", id: "arp_vie_at" }, id: "sli_0000AvQjcLqSuF2bm6U2U6" }], passengers: [{ born_on: "2007-04-29", loyalty_programme_accounts: [], family_name: "Botha", given_name: "Adriaan", gender: "m", infant_passenger_id: null, phone_number: "+12345642342", user_id: null, email: "adriaan.botha@typedev.co.za", title: "mr", type: "adult", id: "pas_0000AvQjcLZRvVQivKWRxi" }], conditions: { refund_before_departure: { penalty_currency: null, penalty_amount: null, allowed: !1 }, change_before_departure: { penalty_currency: "GBP", penalty_amount: "10.00", allowed: !0 } }, cancelled_at: null, changes: [], content: "managed", services: [], users: ["icu_0000Asbm8q0FlWOhf0fDUm"], metadata: null, type: "instant", owner: { logo_symbol_url: "https://assets.duffel.com/img/airlines/for-light-background/full-color-logo/ZZ.svg", logo_lockup_url: null, conditions_of_carriage_url: "https://duffelairways.com/dummy-url/conditions-of-carriage", iata_code: "ZZ", name: "Duffel Airways", id: "arl_00009VME7D6ivUu8dn35WK" }, id: "ord_0000AvQk8IXqiCE2o20e00", status: "flight confirmed" }, m = "Flight booking found", g = !0, _ = { internalRequestId: "f6b54196-4d33-434d-9800-d9dc72a074ab" }, h = {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { useQuery as n, useMutation as
|
|
1
|
+
import { useQuery as n, useMutation as s } from "@tanstack/react-query";
|
|
2
2
|
import "../../arrayExtensions-DlcBOj5a.js";
|
|
3
|
-
import { E as a, b as
|
|
3
|
+
import { E as a, b as m } from "../../AccountService-DHR8seWS.js";
|
|
4
4
|
import "react";
|
|
5
5
|
import "react/jsx-runtime";
|
|
6
|
-
import { awayzClient as
|
|
6
|
+
import { awayzClient as i } from "../../configs/awayzClient.js";
|
|
7
7
|
import '../../assets/_styles4.css';import '../../assets/_styles3.css';import '../../assets/_styles2.css';import '../../assets/_styles.css';import '../../assets/_styles5.css';/* empty css */
|
|
8
8
|
/* empty css */
|
|
9
9
|
import "react-i18next";
|
|
@@ -15,20 +15,20 @@ import "../../context/AwayzContext.js";
|
|
|
15
15
|
import "../../services/noRetryInstance.js";
|
|
16
16
|
import { WalletService as o } from "../../services/wallet/WalletService.js";
|
|
17
17
|
const B = () => {
|
|
18
|
-
const { user:
|
|
18
|
+
const { user: r } = l(), { data: t } = n({
|
|
19
19
|
queryKey: [a.PROGRAMS],
|
|
20
20
|
queryFn: o.getAwards,
|
|
21
21
|
placeholderData: []
|
|
22
22
|
}), { data: c } = n({
|
|
23
|
-
queryKey: [a.USER_PROGRAMS,
|
|
24
|
-
queryFn: () =>
|
|
23
|
+
queryKey: [a.USER_PROGRAMS, r == null ? void 0 : r.id],
|
|
24
|
+
queryFn: () => r != null && r.id ? o.getUserAwards(r.id) : [],
|
|
25
25
|
placeholderData: [],
|
|
26
|
-
enabled: !!(
|
|
26
|
+
enabled: !!(r != null && r.id)
|
|
27
27
|
}), { data: y } = n({
|
|
28
|
-
queryKey: [a.LINKED_USER_PROGRAMS,
|
|
29
|
-
queryFn: () =>
|
|
28
|
+
queryKey: [a.LINKED_USER_PROGRAMS, r == null ? void 0 : r.id],
|
|
29
|
+
queryFn: () => r != null && r.id ? o.getLinkedUserAwards(r.id) : [],
|
|
30
30
|
placeholderData: [],
|
|
31
|
-
enabled: !!(
|
|
31
|
+
enabled: !!(r != null && r.id)
|
|
32
32
|
}), { data: A } = n({
|
|
33
33
|
queryKey: [a.BANKS],
|
|
34
34
|
queryFn: o.getBanks,
|
|
@@ -46,56 +46,52 @@ const B = () => {
|
|
|
46
46
|
queryFn: o.getPointsAsCash,
|
|
47
47
|
placeholderData: { availablePoints: 0, valuePerPoint: 0, currency: "" },
|
|
48
48
|
enabled: S && R.usePointsAsCashFeature
|
|
49
|
-
}), { mutate: C } =
|
|
50
|
-
mutationFn: async (
|
|
51
|
-
const { mainProgram:
|
|
52
|
-
await o.addAwardProgram(
|
|
49
|
+
}), { mutate: C } = s({
|
|
50
|
+
mutationFn: async (e) => {
|
|
51
|
+
const { mainProgram: u, awardsAmount: d } = typeof e == "string" ? { mainProgram: e, awardsAmount: 0 } : e;
|
|
52
|
+
await o.addAwardProgram(u, d);
|
|
53
53
|
},
|
|
54
54
|
onSuccess: () => {
|
|
55
|
-
|
|
55
|
+
i.invalidateQueries({
|
|
56
56
|
queryKey: [a.LINKED_USER_PROGRAMS]
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
|
-
}), { mutate: E } =
|
|
60
|
-
mutationFn: async (
|
|
61
|
-
await o.removeAwardProgram(
|
|
59
|
+
}), { mutate: E } = s({
|
|
60
|
+
mutationFn: async (e) => {
|
|
61
|
+
await o.removeAwardProgram(e);
|
|
62
62
|
},
|
|
63
63
|
onSuccess: () => {
|
|
64
|
-
|
|
64
|
+
i.invalidateQueries({
|
|
65
65
|
queryKey: [a.LINKED_USER_PROGRAMS]
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
|
-
}), { mutateAsync: K } =
|
|
69
|
-
mutationFn: async ({ mainProgram:
|
|
70
|
-
const d = t == null ? void 0 : t.find((F) => F.mainProgram ===
|
|
68
|
+
}), { mutateAsync: K } = s({
|
|
69
|
+
mutationFn: async ({ mainProgram: e, awardsAmount: u }) => {
|
|
70
|
+
const d = t == null ? void 0 : t.find((F) => F.mainProgram === e);
|
|
71
71
|
if (!d)
|
|
72
72
|
throw new Error("Program not found");
|
|
73
|
-
return o.setAwardPoints(d.mainProgram,
|
|
73
|
+
return o.setAwardPoints(d.mainProgram, u);
|
|
74
74
|
},
|
|
75
75
|
onSuccess: () => {
|
|
76
76
|
[
|
|
77
77
|
a.LINKED_USER_PROGRAMS,
|
|
78
78
|
a.USER_PROGRAMS,
|
|
79
79
|
a.PROGRAMS
|
|
80
|
-
].forEach((
|
|
81
|
-
|
|
80
|
+
].forEach((e) => {
|
|
81
|
+
i.invalidateQueries({ queryKey: [e] });
|
|
82
82
|
});
|
|
83
83
|
}
|
|
84
|
-
}), {
|
|
85
|
-
mutationFn: async (
|
|
86
|
-
await o.addCardsToWallet(r);
|
|
87
|
-
},
|
|
84
|
+
}), { mutateAsync: f } = s({
|
|
85
|
+
mutationFn: async (e) => o.addCardsToWallet(e),
|
|
88
86
|
onSuccess: () => {
|
|
89
|
-
|
|
87
|
+
i.invalidateQueries({
|
|
90
88
|
queryKey: [a.USER_CARDS]
|
|
91
89
|
});
|
|
92
90
|
}
|
|
93
|
-
}), {
|
|
94
|
-
mutationFn: async (
|
|
95
|
-
await o.removeCardsFromWallet(r);
|
|
96
|
-
},
|
|
91
|
+
}), { mutateAsync: q } = s({
|
|
92
|
+
mutationFn: async (e) => o.removeCardsFromWallet(e),
|
|
97
93
|
onSuccess: () => {
|
|
98
|
-
|
|
94
|
+
i.invalidateQueries({
|
|
99
95
|
queryKey: [a.USER_CARDS]
|
|
100
96
|
});
|
|
101
97
|
}
|
|
@@ -106,13 +102,13 @@ const B = () => {
|
|
|
106
102
|
userPrograms: c || [],
|
|
107
103
|
linkedUserPrograms: y || [],
|
|
108
104
|
hotelPrograms: (t == null ? void 0 : t.filter(
|
|
109
|
-
(
|
|
105
|
+
(e) => e.category.includes(m.HOTEL)
|
|
110
106
|
)) || [],
|
|
111
107
|
airlinePrograms: (t == null ? void 0 : t.filter(
|
|
112
|
-
(
|
|
108
|
+
(e) => e.category.includes(m.AIRLINE)
|
|
113
109
|
)) || [],
|
|
114
110
|
bankPrograms: (t == null ? void 0 : t.filter(
|
|
115
|
-
(
|
|
111
|
+
(e) => e.category.includes(m.BANK)
|
|
116
112
|
)) || [],
|
|
117
113
|
updatePoints: K,
|
|
118
114
|
addAwardProgram: C,
|
|
@@ -60,12 +60,12 @@ export interface IWalletHook {
|
|
|
60
60
|
* Adds cards to the user's wallet.
|
|
61
61
|
* @param cardIds - The IDs of the cards to be added.
|
|
62
62
|
*/
|
|
63
|
-
addCards: (cardIds: string[]) => void
|
|
63
|
+
addCards: (cardIds: string[]) => Promise<void>;
|
|
64
64
|
/**
|
|
65
65
|
* Removes cards from the user's wallet.
|
|
66
66
|
* @param cardIds - The IDs of the cards to be removed.
|
|
67
67
|
*/
|
|
68
|
-
removeCards: (cardIds: string[]) => void
|
|
68
|
+
removeCards: (cardIds: string[]) => Promise<void>;
|
|
69
69
|
/**
|
|
70
70
|
* Points as cash value object containing available points and dollar per point value.
|
|
71
71
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { instance, clientInstance } from './instance';
|
|
2
|
-
export { clientNoRetryInstance } from './noRetryInstance';
|
|
3
|
-
export * from './currency/CurrencyService';
|
|
4
|
-
export * from './wallet/WalletService.types';
|
|
5
|
-
export * from './trips/TripService.types';
|
|
6
1
|
export * from './bookings/BookingService.types';
|
|
2
|
+
export * from './currency/CurrencyService';
|
|
3
|
+
export { clientInstance, gatewayInstance, instance } from './instance';
|
|
4
|
+
export { clientNoRetryInstance } from './noRetryInstance';
|
|
7
5
|
export * from './rewards/RewardsService';
|
|
6
|
+
export * from './trips/TripService.types';
|
|
7
|
+
export * from './wallet/WalletService.types';
|
package/dist/main.js
CHANGED
|
@@ -1,41 +1,42 @@
|
|
|
1
1
|
import { CashValue as r } from "./components/CashValue/CashValue.js";
|
|
2
|
-
import { EInvalidAmountDisplayOption as
|
|
3
|
-
import { Card as
|
|
2
|
+
import { EInvalidAmountDisplayOption as a, EToolTipPosition as n } from "./components/CashValue/CashValueTypes.js";
|
|
3
|
+
import { Card as m } from "./components/Wallet/Card/Card.js";
|
|
4
4
|
import { FlightBooking as f } from "./components/Bookings/FlightBooking/FlightBooking.js";
|
|
5
5
|
import { HotelBooking as s } from "./components/Bookings/HotelBooking/HotelBooking.js";
|
|
6
6
|
import { awayzClient as c } from "./configs/awayzClient.js";
|
|
7
|
-
import { defaultAwayzConfig as
|
|
7
|
+
import { defaultAwayzConfig as u } from "./configs/defaultAwayzConfig.js";
|
|
8
8
|
import { useAwayzContext as w } from "./hooks/useAwayzContext.js";
|
|
9
9
|
import { useBookingManagement as d } from "./hooks/useBookingManagement/useBookingManagement.js";
|
|
10
10
|
import { useSearchLimit as B } from "./hooks/useSearchLimit.js";
|
|
11
11
|
import { useTripManagement as k } from "./hooks/useTripManagement/useTripManagement.js";
|
|
12
12
|
import { useWallet as z } from "./hooks/useWallet/useWallet.js";
|
|
13
|
-
import { AwayzProvider as
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import { EAuthFlow as
|
|
20
|
-
import { getBaseUrl as
|
|
13
|
+
import { AwayzProvider as I } from "./providers/AwayzProvider.js";
|
|
14
|
+
import { CurrencyService as S } from "./services/currency/CurrencyService.js";
|
|
15
|
+
import { c as M, g as P, i as R } from "./AccountService-DHR8seWS.js";
|
|
16
|
+
import { clientNoRetryInstance as H } from "./services/noRetryInstance.js";
|
|
17
|
+
import { RewardsService as N } from "./services/rewards/RewardsService.js";
|
|
18
|
+
import { EBookingType as U } from "./services/trips/TripService.types.js";
|
|
19
|
+
import { EAuthFlow as W } from "./types/EAuthFlow.js";
|
|
20
|
+
import { getBaseUrl as j } from "./configs/baseUrl.js";
|
|
21
21
|
export {
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
I as AwayzProvider,
|
|
23
|
+
m as Card,
|
|
24
24
|
r as CashValue,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
S as CurrencyService,
|
|
26
|
+
W as EAuthFlow,
|
|
27
|
+
U as EBookingType,
|
|
28
|
+
a as EInvalidAmountDisplayOption,
|
|
29
|
+
n as EToolTipPosition,
|
|
30
30
|
f as FlightBooking,
|
|
31
31
|
s as HotelBooking,
|
|
32
|
-
|
|
32
|
+
N as RewardsService,
|
|
33
33
|
c as awayzClient,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
M as clientInstance,
|
|
35
|
+
H as clientNoRetryInstance,
|
|
36
|
+
u as defaultAwayzConfig,
|
|
37
|
+
P as gatewayInstance,
|
|
38
|
+
j as getBaseUrl,
|
|
39
|
+
R as instance,
|
|
39
40
|
w as useAwayzContext,
|
|
40
41
|
d as useBookingManagement,
|
|
41
42
|
B as useSearchLimit,
|
package/dist/services/index.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { CurrencyService as o } from "./currency/CurrencyService.js";
|
|
2
|
+
import { c as n, g as a, i as c } from "../AccountService-DHR8seWS.js";
|
|
3
|
+
import { clientNoRetryInstance as i } from "./noRetryInstance.js";
|
|
4
|
+
import { RewardsService as f } from "./rewards/RewardsService.js";
|
|
5
|
+
import { EBookingType as x } from "./trips/TripService.types.js";
|
|
6
6
|
export {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
o as CurrencyService,
|
|
8
|
+
x as EBookingType,
|
|
9
|
+
f as RewardsService,
|
|
10
|
+
n as clientInstance,
|
|
11
|
+
i as clientNoRetryInstance,
|
|
12
|
+
a as gatewayInstance,
|
|
13
|
+
c as instance
|
|
13
14
|
};
|