@odynn/awayz-core 0.3.10 → 0.3.12
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/assets/_styles.css +1 -1
- package/dist/assets/_styles2.css +1 -1
- package/dist/assets/_styles3.css +1 -1
- package/dist/assets/_styles4.css +1 -1
- package/dist/assets/_styles5.css +1 -0
- package/dist/components/Bookings/FlightBooking/FlightBooking.js +2 -2
- package/dist/components/Bookings/HotelBooking/HotelBooking.js +2 -2
- package/dist/components/CashValue/CashValue.js +7 -5
- package/dist/components/CashValue/CashValue.stories.js +14 -13
- package/dist/components/Menu/Menu.js +11 -10
- package/dist/components/Wallet/Card/Card.js +35 -0
- package/dist/components/Wallet/Card/Card.stories.js +62 -0
- package/dist/components/index.js +6 -4
- package/dist/configs/endpoints.js +2 -2
- package/dist/hooks/useBookingManagement/useBookingManagement.js +57 -48
- package/dist/hooks/useBookingManagement/useBookingManagement.test.js +40 -39
- package/dist/hooks/useTripManagement/useTripManagement.js +4 -3
- package/dist/hooks/useTripManagement/useTripManagement.test.js +2 -1
- package/dist/hooks/useWallet/useWallet.js +52 -33
- package/dist/hooks/useWallet/useWallet.test.js +85 -15
- package/dist/hooks/useWallet/useWallet.types.js +1 -0
- package/dist/index-BC-KTkxU.js +1571 -0
- package/dist/index-CDh8vAM_.js +132 -0
- package/dist/lib/components/Wallet/Card/Card.d.ts +6 -0
- package/dist/lib/components/Wallet/Card/Card.stories.d.ts +14 -0
- package/dist/lib/components/index.d.ts +1 -0
- package/dist/lib/configs/endpoints.d.ts +2 -0
- package/dist/lib/hooks/useBookingManagement/mocks/HotelBooking200.json.d.ts +608 -67
- package/dist/lib/hooks/useBookingManagement/useBookingManagement.types.d.ts +8 -0
- package/dist/lib/hooks/useWallet/mocks/AllCardsResponse200.json.d.ts +177 -0
- package/dist/lib/hooks/useWallet/mocks/GetAllProgramsReponse200.json.d.ts +705 -0
- package/dist/lib/hooks/useWallet/mocks/UserCardsResponse200.json.d.ts +139 -0
- package/dist/lib/hooks/useWallet/useWallet.d.ts +2 -16
- package/dist/lib/hooks/useWallet/useWallet.types.d.ts +50 -0
- package/dist/lib/services/bookings/BookingService.types.d.ts +14 -17
- package/dist/lib/services/trips/TripService.types.d.ts +2 -2
- package/dist/lib/services/wallet/WalletService.d.ts +2 -0
- package/dist/lib/services/wallet/WalletService.types.d.ts +2 -5
- package/dist/main.js +20 -18
- package/dist/providers/AwayzProvider.js +4 -3
- package/dist/services/bookings/BookingService.js +74 -43
- package/dist/services/currency/CurrencyService.js +4 -3
- package/dist/services/trips/TripService.types.js +1 -1
- package/dist/services/wallet/WalletService.js +43 -63
- package/package.json +1 -1
- package/dist/index-COgXcb6p.js +0 -1696
- package/dist/lib/hooks/useWallet/mocks/CardsResponse.json.d.ts +0 -34
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
"data": [
|
|
3
|
+
{
|
|
4
|
+
"_id": "6830b5f8f8fd6ae84f4cc118",
|
|
5
|
+
"name": "Prestige",
|
|
6
|
+
"signupBonus": 50000,
|
|
7
|
+
"cashBonus": 0,
|
|
8
|
+
"minimumSpend": 4000,
|
|
9
|
+
"daysToSpend": 90,
|
|
10
|
+
"annual_fee": 495,
|
|
11
|
+
"annualFeeWaived": false,
|
|
12
|
+
"cashPerks": 300,
|
|
13
|
+
"bank": {
|
|
14
|
+
"name": "Citi"
|
|
15
|
+
},
|
|
16
|
+
"rewards_currency": "Citi ThankYou Points",
|
|
17
|
+
"bisCard": false,
|
|
18
|
+
"chargeCard": false,
|
|
19
|
+
"cardFamily": 11,
|
|
20
|
+
"websiteUrl": "",
|
|
21
|
+
"network": {
|
|
22
|
+
"name": "Mastercard"
|
|
23
|
+
},
|
|
24
|
+
"_modified": "2022-09-02T01:38:04.150Z",
|
|
25
|
+
"colour": "#1A3251",
|
|
26
|
+
"region": "US",
|
|
27
|
+
"faredrop_card_id": "",
|
|
28
|
+
"points_as_cash_conversion_ratio": 0.01,
|
|
29
|
+
"updatedAt": "2024-10-18T14:47:25.187Z",
|
|
30
|
+
"alternateRegions": [],
|
|
31
|
+
"logoUrl": "https://s3.us-east-1.amazonaws.com/awayz/card_logos/citi-white.svg",
|
|
32
|
+
"card_id": "CitiPrestige",
|
|
33
|
+
"user_id": "67d82b1c52c4a4dbe4e640c0",
|
|
34
|
+
"active_card": true
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"_id": "6830b5f8f8fd6ae84f4cc119",
|
|
38
|
+
"name": "Sapphire Reserve",
|
|
39
|
+
"signupBonus": 60000,
|
|
40
|
+
"cashBonus": 0,
|
|
41
|
+
"minimumSpend": 4000,
|
|
42
|
+
"daysToSpend": 90,
|
|
43
|
+
"annual_fee": 550,
|
|
44
|
+
"annualFeeWaived": false,
|
|
45
|
+
"cashPerks": 0,
|
|
46
|
+
"bank": {
|
|
47
|
+
"name": "Chase"
|
|
48
|
+
},
|
|
49
|
+
"rewards_currency": "Chase Ultimate Rewards Points",
|
|
50
|
+
"bisCard": false,
|
|
51
|
+
"chargeCard": false,
|
|
52
|
+
"cardFamily": 21,
|
|
53
|
+
"websiteUrl": "https://yourbestcreditcards.com/card/chase-sapphire-reserve?ccid=ccref",
|
|
54
|
+
"network": {
|
|
55
|
+
"name": "Visa"
|
|
56
|
+
},
|
|
57
|
+
"_modified": "2023-10-10T07:20:51.860Z",
|
|
58
|
+
"colour": "#1A3251",
|
|
59
|
+
"region": "US",
|
|
60
|
+
"alternateRegions": ["CA"],
|
|
61
|
+
"faredrop_card_id": "chase-sapphire-reserve",
|
|
62
|
+
"points_as_cash_conversion_ratio": 0.015,
|
|
63
|
+
"updatedAt": "2024-10-18T14:47:25.187Z",
|
|
64
|
+
"logoUrl": "https://s3.us-east-1.amazonaws.com/awayz/card_logos/chase-white.svg",
|
|
65
|
+
"card_id": "SapphReserve",
|
|
66
|
+
"user_id": "67d82b1c52c4a4dbe4e640c0",
|
|
67
|
+
"active_card": true
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"_id": "6835a6bef8fd6a342a14bfcd",
|
|
71
|
+
"name": "IHG Rewards Club Traveler",
|
|
72
|
+
"signupBonus": 0,
|
|
73
|
+
"cashBonus": 0,
|
|
74
|
+
"minimumSpend": 0,
|
|
75
|
+
"daysToSpend": 30,
|
|
76
|
+
"annual_fee": 0,
|
|
77
|
+
"annualFeeWaived": true,
|
|
78
|
+
"cashPerks": 0,
|
|
79
|
+
"bank": {
|
|
80
|
+
"name": "Chase"
|
|
81
|
+
},
|
|
82
|
+
"rewards_currency": "IHG Rewards Club",
|
|
83
|
+
"bisCard": false,
|
|
84
|
+
"chargeCard": false,
|
|
85
|
+
"cardFamily": 22,
|
|
86
|
+
"websiteUrl": "https://yourbestcreditcards.com/card/ihg-rewards-club-traveler-credit-card?ccid=ccref",
|
|
87
|
+
"network": {
|
|
88
|
+
"name": "Visa"
|
|
89
|
+
},
|
|
90
|
+
"_modified": "2022-09-02T00:53:47.499Z",
|
|
91
|
+
"colour": "#C8C8C8",
|
|
92
|
+
"region": "US",
|
|
93
|
+
"faredrop_card_id": "ihg-rewards-traveler-credit-card",
|
|
94
|
+
"alternateRegions": [],
|
|
95
|
+
"logoUrl": "https://s3.us-east-1.amazonaws.com/awayz/card_logos/chase-black.svg",
|
|
96
|
+
"card_id": "IHGcardTraveler",
|
|
97
|
+
"user_id": "67d82b1c52c4a4dbe4e640c0",
|
|
98
|
+
"active_card": true
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"_id": "6835ac4df8fd6a87525def02",
|
|
102
|
+
"name": "IHG Rewards Club Premier",
|
|
103
|
+
"signupBonus": 140000,
|
|
104
|
+
"cashBonus": 0,
|
|
105
|
+
"minimumSpend": 3000,
|
|
106
|
+
"daysToSpend": 90,
|
|
107
|
+
"annual_fee": 89,
|
|
108
|
+
"annualFeeWaived": true,
|
|
109
|
+
"cashPerks": 0,
|
|
110
|
+
"bank": {
|
|
111
|
+
"name": "Chase"
|
|
112
|
+
},
|
|
113
|
+
"rewards_currency": "IHG Rewards Club",
|
|
114
|
+
"bisCard": false,
|
|
115
|
+
"chargeCard": false,
|
|
116
|
+
"cardFamily": 22,
|
|
117
|
+
"websiteUrl": "https://yourbestcreditcards.com/card/ihg-rewards-club-premier-credit-card?ccid=ccref",
|
|
118
|
+
"network": {
|
|
119
|
+
"name": "Visa"
|
|
120
|
+
},
|
|
121
|
+
"_modified": "2022-09-02T00:29:39.722Z",
|
|
122
|
+
"colour": "#C8C8C8",
|
|
123
|
+
"region": "US",
|
|
124
|
+
"faredrop_card_id": "ihg-rewards-premier-credit-card",
|
|
125
|
+
"alternateRegions": [],
|
|
126
|
+
"logoUrl": "https://s3.us-east-1.amazonaws.com/awayz/card_logos/chase-black.svg",
|
|
127
|
+
"card_id": "IHGcard",
|
|
128
|
+
"user_id": "67d82b1c52c4a4dbe4e640c0",
|
|
129
|
+
"active_card": true
|
|
130
|
+
}
|
|
131
|
+
],
|
|
132
|
+
"success": true,
|
|
133
|
+
"metadata": {
|
|
134
|
+
"internalRequestId": "a0133305-71e4-40dd-97ec-3c1b57073a7e"
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
;
|
|
138
|
+
|
|
139
|
+
export default _default;
|
|
@@ -1,16 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
awardsAmount: number;
|
|
4
|
-
}
|
|
5
|
-
export declare const useWallet: () => {
|
|
6
|
-
allPrograms: import('../../services').ILoyaltyProgram[];
|
|
7
|
-
hotelPrograms: import('../../services').ILoyaltyProgram[];
|
|
8
|
-
airlinePrograms: import('../../services').ILoyaltyProgram[];
|
|
9
|
-
bankPrograms: import('../../services').ILoyaltyProgram[];
|
|
10
|
-
updatePoints: import('@tanstack/react-query').UseMutateFunction<void, Error, ISetAwardPointsRequest, unknown>;
|
|
11
|
-
getProgramById: (programId: string) => import('../../services').ILoyaltyProgram | null;
|
|
12
|
-
banks: import('../../services').IBank[];
|
|
13
|
-
allCards: import('../../services').ICard[];
|
|
14
|
-
userCards: import('../../services').ICard[];
|
|
15
|
-
};
|
|
16
|
-
export {};
|
|
1
|
+
import { IWalletHook } from './useWallet.types';
|
|
2
|
+
export declare const useWallet: () => IWalletHook;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { IBank, ICard, ILoyaltyProgram } from '../../services';
|
|
2
|
+
export interface ISetAwardPointsRequest {
|
|
3
|
+
mainProgram: string;
|
|
4
|
+
awardsAmount: number;
|
|
5
|
+
}
|
|
6
|
+
export interface IWalletHook {
|
|
7
|
+
/**
|
|
8
|
+
* All loyalty programs currently supported by Awayz.
|
|
9
|
+
*/
|
|
10
|
+
allPrograms: ILoyaltyProgram[];
|
|
11
|
+
/**
|
|
12
|
+
* Supported loyalty programs related to hotels.
|
|
13
|
+
*/
|
|
14
|
+
hotelPrograms: ILoyaltyProgram[];
|
|
15
|
+
/**
|
|
16
|
+
* Supported loyalty programs related to airlines.
|
|
17
|
+
*/
|
|
18
|
+
airlinePrograms: ILoyaltyProgram[];
|
|
19
|
+
/**
|
|
20
|
+
* Supported loyalty programs related to banks.
|
|
21
|
+
*/
|
|
22
|
+
bankPrograms: ILoyaltyProgram[];
|
|
23
|
+
/**
|
|
24
|
+
* Updates the points for a specific loyalty program.
|
|
25
|
+
* @param request - The request object containing the main program and the amount of points/miles.
|
|
26
|
+
*/
|
|
27
|
+
updatePoints: (request: ISetAwardPointsRequest) => void;
|
|
28
|
+
/**
|
|
29
|
+
* List of banks currently supported by Awayz.
|
|
30
|
+
*/
|
|
31
|
+
banks: IBank[];
|
|
32
|
+
/**
|
|
33
|
+
* All cards available in the system.
|
|
34
|
+
*/
|
|
35
|
+
allCards: ICard[];
|
|
36
|
+
/**
|
|
37
|
+
* User's cards that are currently in the wallet.
|
|
38
|
+
*/
|
|
39
|
+
userCards: ICard[];
|
|
40
|
+
/**
|
|
41
|
+
* Adds cards to the user's wallet.
|
|
42
|
+
* @param cardIds - The IDs of the cards to be added.
|
|
43
|
+
*/
|
|
44
|
+
addCards: (cardIds: string[]) => void;
|
|
45
|
+
/**
|
|
46
|
+
* Removes cards from the user's wallet.
|
|
47
|
+
* @param cardIds - The IDs of the cards to be removed.
|
|
48
|
+
*/
|
|
49
|
+
removeCards: (cardIds: string[]) => void;
|
|
50
|
+
}
|
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
import { IAirport } from '@type-op/shared';
|
|
2
|
-
export interface IBed {
|
|
3
|
-
}
|
|
1
|
+
import { IAirport, ICoordinates } from '@type-op/shared';
|
|
4
2
|
export interface IGuest {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
photo: string[];
|
|
9
|
-
totalAmount: number;
|
|
10
|
-
name: string;
|
|
3
|
+
familyName: string;
|
|
4
|
+
givenName: string;
|
|
5
|
+
type: string;
|
|
11
6
|
}
|
|
12
7
|
export interface IAddress {
|
|
13
8
|
lineOne: string;
|
|
@@ -18,12 +13,7 @@ export interface IAddress {
|
|
|
18
13
|
}
|
|
19
14
|
export interface IHotelBookingDetails {
|
|
20
15
|
id: string;
|
|
21
|
-
userId: string;
|
|
22
16
|
status: string;
|
|
23
|
-
accommodationId: string;
|
|
24
|
-
numberOfGuests: number;
|
|
25
|
-
rateId: string;
|
|
26
|
-
quoteId: string;
|
|
27
17
|
baseAmount: number;
|
|
28
18
|
baseCurrency: string;
|
|
29
19
|
taxAmount: number;
|
|
@@ -32,12 +22,19 @@ export interface IHotelBookingDetails {
|
|
|
32
22
|
feeCurrency: string;
|
|
33
23
|
totalAmount: number;
|
|
34
24
|
totalCurrency: string;
|
|
35
|
-
checkInDate: string;
|
|
36
|
-
checkOutDate: string;
|
|
37
25
|
images: string[];
|
|
38
|
-
|
|
26
|
+
numberOfRooms: number;
|
|
39
27
|
address: IAddress;
|
|
40
28
|
guests: IGuest[];
|
|
29
|
+
reference: string;
|
|
30
|
+
name: string;
|
|
31
|
+
description: string;
|
|
32
|
+
cancelledAt?: string;
|
|
33
|
+
checkoutDate: string;
|
|
34
|
+
checkoutBeforeTime: string;
|
|
35
|
+
checkinDate: string;
|
|
36
|
+
checkinAfterTime: string;
|
|
37
|
+
coordinates: ICoordinates;
|
|
41
38
|
}
|
|
42
39
|
export interface IFlightConditionDetails {
|
|
43
40
|
allowed: boolean;
|
|
@@ -5,6 +5,8 @@ declare class _WalletService {
|
|
|
5
5
|
getBanks: () => Promise<IBank[]>;
|
|
6
6
|
getCards: () => Promise<ICard[]>;
|
|
7
7
|
getUserCards: () => Promise<ICard[]>;
|
|
8
|
+
addCardsToWallet: (cardIds: string[]) => Promise<any>;
|
|
9
|
+
removeCardsFromWallet: (cardIds: string[]) => Promise<any>;
|
|
8
10
|
}
|
|
9
11
|
export declare const WalletService: _WalletService;
|
|
10
12
|
export {};
|
|
@@ -9,7 +9,7 @@ export interface IStatusLevels {
|
|
|
9
9
|
export interface ILoyaltyProgram {
|
|
10
10
|
id: string;
|
|
11
11
|
mainProgram: string;
|
|
12
|
-
category: ERewardProgramCategory;
|
|
12
|
+
category: ERewardProgramCategory[];
|
|
13
13
|
statusLevels: IStatusLevels;
|
|
14
14
|
displayProgram: string;
|
|
15
15
|
awayzActive: string[];
|
|
@@ -55,11 +55,8 @@ export interface ICard {
|
|
|
55
55
|
network: {
|
|
56
56
|
name: string;
|
|
57
57
|
};
|
|
58
|
-
modified: string;
|
|
59
58
|
colour: string;
|
|
60
59
|
region: string;
|
|
61
60
|
alternateRegions: string[];
|
|
62
|
-
|
|
63
|
-
userId: string;
|
|
64
|
-
activeCard: boolean;
|
|
61
|
+
logoUrl: string;
|
|
65
62
|
}
|
package/dist/main.js
CHANGED
|
@@ -1,41 +1,43 @@
|
|
|
1
|
-
import { AwayzProvider as
|
|
2
|
-
import { useAwayzContext as
|
|
3
|
-
import { useSearchLimit as
|
|
1
|
+
import { AwayzProvider as e } from "./providers/AwayzProvider.js";
|
|
2
|
+
import { useAwayzContext as p } from "./hooks/useAwayzContext.js";
|
|
3
|
+
import { useSearchLimit as a } from "./hooks/useSearchLimit.js";
|
|
4
4
|
import { useWallet as m } from "./hooks/useWallet/useWallet.js";
|
|
5
5
|
import { useTripManagement as f, validateUpdateTripArgs as l } from "./hooks/useTripManagement/useTripManagement.js";
|
|
6
6
|
import { useBookingManagement as c } from "./hooks/useBookingManagement/useBookingManagement.js";
|
|
7
7
|
import { EAuthFlow as y } from "./types/EAuthFlow.js";
|
|
8
|
-
import { EHotelCurrencyOption as
|
|
9
|
-
import { c as
|
|
8
|
+
import { EHotelCurrencyOption as C, currencySymbols as d } from "./types/ECurrency.js";
|
|
9
|
+
import { c as B, i as E } from "./AccountService-D_6U8vP6.js";
|
|
10
10
|
import { clientNoRetryInstance as h } from "./services/noRetryInstance.js";
|
|
11
11
|
import { CurrencyService as v } from "./services/currency/CurrencyService.js";
|
|
12
12
|
import { EBookingType as z } from "./services/trips/TripService.types.js";
|
|
13
13
|
import { awayzClient as S } from "./configs/awayzClient.js";
|
|
14
14
|
import { CashValue as H } from "./components/CashValue/CashValue.js";
|
|
15
15
|
import { EInvalidAmountDisplayOption as O, EToolTipPosition as P } from "./components/CashValue/CashValueTypes.js";
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
16
|
+
import { Card as b } from "./components/Wallet/Card/Card.js";
|
|
17
|
+
import { FlightBooking as L } from "./components/Bookings/FlightBooking/FlightBooking.js";
|
|
18
|
+
import { HotelBooking as R } from "./components/Bookings/HotelBooking/HotelBooking.js";
|
|
19
|
+
import { getBaseUrl as W } from "./configs/baseUrl.js";
|
|
19
20
|
export {
|
|
20
|
-
|
|
21
|
+
e as AwayzProvider,
|
|
22
|
+
b as Card,
|
|
21
23
|
H as CashValue,
|
|
22
24
|
v as CurrencyService,
|
|
23
25
|
y as EAuthFlow,
|
|
24
26
|
z as EBookingType,
|
|
25
|
-
|
|
27
|
+
C as EHotelCurrencyOption,
|
|
26
28
|
O as EInvalidAmountDisplayOption,
|
|
27
29
|
P as EToolTipPosition,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
+
L as FlightBooking,
|
|
31
|
+
R as HotelBooking,
|
|
30
32
|
S as awayzClient,
|
|
31
|
-
|
|
33
|
+
B as clientInstance,
|
|
32
34
|
h as clientNoRetryInstance,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
d as currencySymbols,
|
|
36
|
+
W as getBaseUrl,
|
|
37
|
+
E as instance,
|
|
38
|
+
p as useAwayzContext,
|
|
37
39
|
c as useBookingManagement,
|
|
38
|
-
|
|
40
|
+
a as useSearchLimit,
|
|
39
41
|
f as useTripManagement,
|
|
40
42
|
m as useWallet,
|
|
41
43
|
l as validateUpdateTripArgs
|
|
@@ -8,12 +8,13 @@ import { setCustomBaseUrl as i, setBaseUrl as u } from "../configs/baseUrl.js";
|
|
|
8
8
|
import { QueryClientProvider as d } from "@tanstack/react-query";
|
|
9
9
|
import { awayzClient as p } from "../configs/awayzClient.js";
|
|
10
10
|
import "../services/noRetryInstance.js";
|
|
11
|
-
import '../assets/_styles4.css';import '../assets/_styles3.css';import '../assets/_styles2.css';import '../assets/_styles.css';/* empty css */
|
|
11
|
+
import '../assets/_styles5.css';import '../assets/_styles4.css';import '../assets/_styles3.css';import '../assets/_styles2.css';import '../assets/_styles.css';/* empty css */
|
|
12
|
+
/* empty css */
|
|
12
13
|
/* empty css */
|
|
13
14
|
/* empty css */
|
|
14
15
|
/* empty css */
|
|
15
16
|
import { defaultAwayzConfig as h } from "../configs/defaultAwayzConfig.js";
|
|
16
|
-
const
|
|
17
|
+
const B = ({ children: o, config: e }) => {
|
|
17
18
|
const s = l({
|
|
18
19
|
authFlow: e.authFlow,
|
|
19
20
|
onSuccess: e.onAuthSuccess,
|
|
@@ -41,5 +42,5 @@ const U = ({ children: o, config: e }) => {
|
|
|
41
42
|
) });
|
|
42
43
|
};
|
|
43
44
|
export {
|
|
44
|
-
|
|
45
|
+
B as AwayzProvider
|
|
45
46
|
};
|
|
@@ -1,35 +1,66 @@
|
|
|
1
1
|
var m = Object.defineProperty;
|
|
2
|
-
var l = (n,
|
|
3
|
-
var o = (n,
|
|
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);
|
|
4
4
|
import "../../arrayExtensions-DlcBOj5a.js";
|
|
5
|
-
import { c as i, b as
|
|
5
|
+
import { c as i, b as s } from "../../AccountService-D_6U8vP6.js";
|
|
6
6
|
import "react";
|
|
7
|
-
import { EBookingEndpoints as
|
|
7
|
+
import { EBookingEndpoints as d } from "../../configs/endpoints.js";
|
|
8
8
|
const u = (n) => {
|
|
9
|
-
const
|
|
9
|
+
const e = /P((\d+)D)?T((\d+)H)?((\d+)M)?/, a = n.match(e);
|
|
10
10
|
if (a) {
|
|
11
|
-
const
|
|
12
|
-
return `${
|
|
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();
|
|
13
13
|
} else
|
|
14
14
|
return n;
|
|
15
15
|
};
|
|
16
16
|
class _ {
|
|
17
17
|
constructor() {
|
|
18
|
-
o(this, "getHotelBooking", async (
|
|
18
|
+
o(this, "getHotelBooking", async (e) => {
|
|
19
19
|
const { data: a } = await i.get(
|
|
20
|
-
`${
|
|
20
|
+
`${d.USER_HOTEL_BOOKINGS}/${e}`
|
|
21
21
|
);
|
|
22
|
-
return
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
return {
|
|
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),
|
|
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,
|
|
33
|
+
status: a.data.status,
|
|
34
|
+
description: a.data.data.accommodation.description,
|
|
35
|
+
name: a.data.data.accommodation.name,
|
|
36
|
+
reference: a.data.reference,
|
|
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
|
|
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,
|
|
48
|
+
coordinates: {
|
|
49
|
+
latitude: a.data.data.accommodation.location.geographic_coordinates.latitude,
|
|
50
|
+
longitude: a.data.data.accommodation.location.geographic_coordinates.longitude
|
|
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
|
|
57
|
+
})),
|
|
58
|
+
numberOfRooms: a.data.rooms.length
|
|
59
|
+
};
|
|
29
60
|
});
|
|
30
|
-
o(this, "getFlightBooking", async (
|
|
61
|
+
o(this, "getFlightBooking", async (e) => {
|
|
31
62
|
const { data: a } = await i.get(
|
|
32
|
-
`${
|
|
63
|
+
`${d.USER_FLIGHT_BOOKINGS}/${e}`
|
|
33
64
|
);
|
|
34
65
|
return {
|
|
35
66
|
id: a.data._id,
|
|
@@ -45,51 +76,51 @@ class _ {
|
|
|
45
76
|
flightOfferId: a.data.flight_offer_id,
|
|
46
77
|
cancelledAt: a.data.cancelled_at,
|
|
47
78
|
airlines: a.data.data.slices[0].segments.map(
|
|
48
|
-
(
|
|
79
|
+
(t) => t.operating_carrier.name
|
|
49
80
|
),
|
|
50
|
-
passengers: a.data.data.passengers.map((
|
|
51
|
-
id:
|
|
52
|
-
givenName:
|
|
53
|
-
familyName:
|
|
54
|
-
type:
|
|
55
|
-
title:
|
|
56
|
-
email:
|
|
57
|
-
gender:
|
|
58
|
-
phoneNumber:
|
|
81
|
+
passengers: a.data.data.passengers.map((t) => ({
|
|
82
|
+
id: t.id,
|
|
83
|
+
givenName: t.given_ame,
|
|
84
|
+
familyName: t.family_name,
|
|
85
|
+
type: t.type,
|
|
86
|
+
title: t.title,
|
|
87
|
+
email: t.email,
|
|
88
|
+
gender: t.gender,
|
|
89
|
+
phoneNumber: t.phone_number
|
|
59
90
|
})),
|
|
60
|
-
flights: a.data.data.slices.map((
|
|
61
|
-
departingAt:
|
|
62
|
-
arrivingAt:
|
|
63
|
-
numberOfStops:
|
|
91
|
+
flights: a.data.data.slices.map((t) => ({
|
|
92
|
+
departingAt: t.segments[0].departing_at,
|
|
93
|
+
arrivingAt: t.segments.getLast().arriving_at,
|
|
94
|
+
numberOfStops: t.segments.length - 1,
|
|
64
95
|
reference: a.data.booking_reference,
|
|
65
|
-
durationInMinutes: u(
|
|
66
|
-
origin:
|
|
67
|
-
destination:
|
|
96
|
+
durationInMinutes: u(t.duration),
|
|
97
|
+
origin: s(t.origin),
|
|
98
|
+
destination: s(t.destination)
|
|
68
99
|
})),
|
|
69
100
|
availableActions: a.data.available_actions
|
|
70
101
|
};
|
|
71
102
|
});
|
|
72
|
-
o(this, "initiateCancelFlightBooking", async (
|
|
103
|
+
o(this, "initiateCancelFlightBooking", async (e) => {
|
|
73
104
|
const { data: a } = await i.put(
|
|
74
|
-
`${
|
|
105
|
+
`${d.INITIATE_FLIGHT_CANCEL}/${e}`
|
|
75
106
|
);
|
|
76
107
|
return a.success;
|
|
77
108
|
});
|
|
78
|
-
o(this, "confirmCancelFlightBooking", async (
|
|
109
|
+
o(this, "confirmCancelFlightBooking", async (e) => {
|
|
79
110
|
const { data: a } = await i.put(
|
|
80
|
-
`${
|
|
111
|
+
`${d.CONFIRM_FLIGHT_CANCEL}/${e}`
|
|
81
112
|
);
|
|
82
113
|
return a.success;
|
|
83
114
|
});
|
|
84
|
-
o(this, "cancelHotelBooking", async (
|
|
115
|
+
o(this, "cancelHotelBooking", async (e) => {
|
|
85
116
|
const { data: a } = await i.post(
|
|
86
|
-
`${
|
|
117
|
+
`${d.CANCEL_HOTEL_BOOKING}/${e}`
|
|
87
118
|
);
|
|
88
119
|
return a.success;
|
|
89
120
|
});
|
|
90
121
|
}
|
|
91
122
|
}
|
|
92
|
-
const
|
|
123
|
+
const k = new _();
|
|
93
124
|
export {
|
|
94
|
-
|
|
125
|
+
k as BookingService
|
|
95
126
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import '../../assets/_styles4.css';import '../../assets/_styles3.css';import '../../assets/_styles2.css';import '../../assets/_styles.css';var u = Object.defineProperty;
|
|
1
|
+
import '../../assets/_styles5.css';import '../../assets/_styles4.css';import '../../assets/_styles3.css';import '../../assets/_styles2.css';import '../../assets/_styles.css';var u = Object.defineProperty;
|
|
2
2
|
var y = (t, r, e) => r in t ? u(t, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[r] = e;
|
|
3
3
|
var n = (t, r, e) => y(t, typeof r != "symbol" ? r + "" : r, e);
|
|
4
4
|
import "../../arrayExtensions-DlcBOj5a.js";
|
|
@@ -11,6 +11,7 @@ import { awayzClient as C } from "../../configs/awayzClient.js";
|
|
|
11
11
|
import "@tanstack/react-query";
|
|
12
12
|
import "../noRetryInstance.js";
|
|
13
13
|
/* empty css */
|
|
14
|
+
/* empty css */
|
|
14
15
|
/* empty css */
|
|
15
16
|
/* empty css */
|
|
16
17
|
/* empty css */
|
|
@@ -65,7 +66,7 @@ class E {
|
|
|
65
66
|
});
|
|
66
67
|
}
|
|
67
68
|
}
|
|
68
|
-
const
|
|
69
|
+
const b = new E();
|
|
69
70
|
export {
|
|
70
|
-
|
|
71
|
+
b as CurrencyService
|
|
71
72
|
};
|