@odynn/awayz-hotels 0.4.3 → 0.4.4
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/enums-B584l_96.js +4 -0
- package/dist/hooks/useHotelSearch/useHotelSearch.js +1 -1
- package/dist/hooks/useLocationSearch/useLocationSearch.js +1 -1
- package/dist/lib/hooks/useHotelDetails/useHotelDetails.types.d.ts +8 -0
- package/dist/lib/services/hotel/HotelService.d.ts +2 -2
- package/dist/services/hotel/HotelService.js +52 -51
- package/package.json +2 -2
- package/dist/enums-DQwp1Z7V.js +0 -4
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var S = /* @__PURE__ */ ((R) => (R.LOCATIONS = "LOCATIONS", R.CHECK_USER = "CHECK_USER", R.USER_REGIONS = "USER_REGIONS", R.CONVERT_CURRENCY = "CONVERT_CURRENCY", R.CLIENT_COMPONENT_KEY = "CLIENT_COMPONENT_KEY", R.SEARCH_LIMIT = "SEARCH_LIMIT", R.PROGRAMS = "PROGRAMS", R.USER_PROGRAMS = "USER_PROGRAMS", R.LINKED_USER_PROGRAMS = "LINKED_USER_PROGRAMS", R.BANKS = "BANKS", R.CARDS = "CARDS", R.USER_CARDS = "USER_CARDS", R.TRIPS = "TRIPS", R.UNCATEGORISED_BOOKINGS = "UNCATEGORISED_BOOKINGS", R.BOOKING = "BOOKING", R.VALUE_CENTS = "VALUE_CENTS", R))(S || {});
|
|
2
|
+
export {
|
|
3
|
+
S as E
|
|
4
|
+
};
|
|
@@ -5,7 +5,7 @@ import { HotelChains as s } from "../../definitions/HotelChains.js";
|
|
|
5
5
|
import { h as a } from "../../moment-BGjjqtLQ.js";
|
|
6
6
|
import P from "../../stores/useHotelsStore.js";
|
|
7
7
|
import { g as T } from "../../dateUtils-C1hKW8MF.js";
|
|
8
|
-
import { E as f } from "../../enums-
|
|
8
|
+
import { E as f } from "../../enums-B584l_96.js";
|
|
9
9
|
import "../../arrayExtensions-CFEBYUok.js";
|
|
10
10
|
import "react";
|
|
11
11
|
import { checkNthNightFree as B } from "../../utilities/hotelUtils/freeNightUtils.js";
|
|
@@ -2,7 +2,7 @@ import { useQuery as u } from "@tanstack/react-query";
|
|
|
2
2
|
import { HotelService as l } from "../../services/hotel/HotelService.js";
|
|
3
3
|
import "../../moment-BGjjqtLQ.js";
|
|
4
4
|
import "../../arrayExtensions-CFEBYUok.js";
|
|
5
|
-
import { E as d } from "../../enums-
|
|
5
|
+
import { E as d } from "../../enums-B584l_96.js";
|
|
6
6
|
import { useState as f, useEffect as L } from "react";
|
|
7
7
|
import { defaultSimilarityThreshold as p, defaultLocationSortOrder as y, duffelTestHotelLocation as T } from "../../configs/defaults.js";
|
|
8
8
|
import { sortLocationResults as E } from "../../utilities/hotelUtils/hotelUtils.js";
|
|
@@ -154,6 +154,14 @@ export interface IBestCheckout {
|
|
|
154
154
|
* `IBestCheckoutResponse.main_program_daily_points_value`
|
|
155
155
|
*/
|
|
156
156
|
nightlyCashCost: number;
|
|
157
|
+
/**
|
|
158
|
+
* ---
|
|
159
|
+
* ### The cents value of the main program.
|
|
160
|
+
*
|
|
161
|
+
* Maps to:
|
|
162
|
+
* `IBestCheckoutResponse.value_cents`
|
|
163
|
+
*/
|
|
164
|
+
valueCents?: number;
|
|
157
165
|
}
|
|
158
166
|
export interface ITransferPartner {
|
|
159
167
|
partnerProgram: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { IHotelPointsCheckArgs, ISearchByHotelIdRequest, ISearchHotelsParams, ISearchLocation } from './HotelService.types';
|
|
2
|
-
import { IHotelDetails, ILiveHotelCheck } from '../../components/HotelResult/HotelResult.types';
|
|
3
1
|
import { TServiceResponse } from '@type-op/shared';
|
|
2
|
+
import { IHotelDetails, ILiveHotelCheck } from '../../components/HotelResult/HotelResult.types';
|
|
4
3
|
import { IBestCheckout, ITransferPartner } from '../../hooks/useHotelDetails/useHotelDetails.types';
|
|
4
|
+
import { IHotelPointsCheckArgs, ISearchByHotelIdRequest, ISearchHotelsParams, ISearchLocation } from './HotelService.types';
|
|
5
5
|
declare class _HotelService {
|
|
6
6
|
getLocations: (searchInputQuery: string) => Promise<TServiceResponse<ISearchLocation[]>>;
|
|
7
7
|
searchByCoords: (request: ISearchHotelsParams) => Promise<TServiceResponse<IHotelDetails[]>>;
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
var f = Object.defineProperty;
|
|
2
2
|
var E = (i, s, e) => s in i ? f(i, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[s] = e;
|
|
3
3
|
var n = (i, s, e) => E(i, typeof s != "symbol" ? s + "" : s, e);
|
|
4
|
-
import {
|
|
5
|
-
import { s as
|
|
4
|
+
import { clientInstance as l } from "@odynn/awayz-core";
|
|
5
|
+
import { s as C } from "../../stringUtils-DFhHh7H1.js";
|
|
6
6
|
import "../../moment-BGjjqtLQ.js";
|
|
7
7
|
import "../../arrayExtensions-CFEBYUok.js";
|
|
8
8
|
import { c as h } from "../../objectUtils-CyIaVmog.js";
|
|
9
9
|
import { E as m } from "../../DateFormats-DZD30Nea.js";
|
|
10
10
|
import "react";
|
|
11
|
-
import { EHotelEndpoints as
|
|
12
|
-
import { clientInstance as _ } from "@odynn/awayz-core";
|
|
11
|
+
import { EHotelEndpoints as _ } from "../../configs/endpoints.js";
|
|
13
12
|
import { EBestCheckoutType as d } from "../../enums/EBestCheckoutType.js";
|
|
14
|
-
import { EBestValueType as
|
|
15
|
-
import { BestCheckoutHelper as
|
|
16
|
-
|
|
13
|
+
import { EBestValueType as T } from "../../enums/EBestValueType.js";
|
|
14
|
+
import { BestCheckoutHelper as H } from "./BestCheckoutHelper.js";
|
|
15
|
+
import { ESearchType as v } from "./HotelService.types.js";
|
|
16
|
+
class P {
|
|
17
17
|
constructor() {
|
|
18
18
|
n(this, "getLocations", async (s) => {
|
|
19
19
|
try {
|
|
20
|
-
const { data: e } = await
|
|
21
|
-
|
|
20
|
+
const { data: e } = await l.get(
|
|
21
|
+
_.GET_LOCATIONS,
|
|
22
22
|
{
|
|
23
23
|
params: {
|
|
24
|
-
search:
|
|
24
|
+
search: C(s)
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
);
|
|
@@ -30,15 +30,15 @@ class S {
|
|
|
30
30
|
success: !1,
|
|
31
31
|
message: (e == null ? void 0 : e.message) || "Error fetching location data"
|
|
32
32
|
};
|
|
33
|
-
const o = (a) => a.search_type ===
|
|
33
|
+
const o = (a) => a.search_type === v.HOTEL;
|
|
34
34
|
return {
|
|
35
35
|
success: !0,
|
|
36
36
|
data: e.data.cities.map(
|
|
37
37
|
(a) => {
|
|
38
|
-
const { search_id:
|
|
39
|
-
searchId:
|
|
38
|
+
const { search_id: r, search_type: p, description: c, coordinates: g, city: y } = a, u = {
|
|
39
|
+
searchId: r,
|
|
40
40
|
searchType: p,
|
|
41
|
-
description:
|
|
41
|
+
description: c,
|
|
42
42
|
coordinates: g,
|
|
43
43
|
city: y
|
|
44
44
|
};
|
|
@@ -61,7 +61,7 @@ class S {
|
|
|
61
61
|
n(this, "searchByCoords", async (s) => {
|
|
62
62
|
var e, o;
|
|
63
63
|
try {
|
|
64
|
-
const { data: t } = await
|
|
64
|
+
const { data: t } = await l.post(_.SEARCH_HOTELS, {
|
|
65
65
|
...s,
|
|
66
66
|
use_duffel: !0
|
|
67
67
|
});
|
|
@@ -84,7 +84,7 @@ class S {
|
|
|
84
84
|
n(this, "searchByHotelId", async (s) => {
|
|
85
85
|
var e, o;
|
|
86
86
|
try {
|
|
87
|
-
const { data: t } = await
|
|
87
|
+
const { data: t } = await l.post(_.GET_HOTEL_DATA, {
|
|
88
88
|
...s,
|
|
89
89
|
use_duffel: !0
|
|
90
90
|
});
|
|
@@ -106,8 +106,8 @@ class S {
|
|
|
106
106
|
});
|
|
107
107
|
n(this, "getTransferPartners", async (s) => {
|
|
108
108
|
try {
|
|
109
|
-
const { data: e } = await
|
|
110
|
-
|
|
109
|
+
const { data: e } = await l.get(
|
|
110
|
+
_.GET_TRANSFER_PARTNERS,
|
|
111
111
|
{
|
|
112
112
|
params: {
|
|
113
113
|
program: s
|
|
@@ -128,8 +128,8 @@ class S {
|
|
|
128
128
|
check_out_date: s.checkoutDate.format(m.ServerDate)
|
|
129
129
|
};
|
|
130
130
|
try {
|
|
131
|
-
const { data: t } = await
|
|
132
|
-
|
|
131
|
+
const { data: t } = await l.post(
|
|
132
|
+
_.HOTEL_POINTS_CHECK,
|
|
133
133
|
e
|
|
134
134
|
), a = ((o = t.data) == null ? void 0 : o.length) > 0 ? t.data[0] : null;
|
|
135
135
|
return {
|
|
@@ -148,45 +148,46 @@ class S {
|
|
|
148
148
|
n(this, "getRecommendations", async (s) => {
|
|
149
149
|
try {
|
|
150
150
|
const t = {
|
|
151
|
-
hotels: (await new
|
|
151
|
+
hotels: (await new H(s.hotels).getConvertedHotels(
|
|
152
152
|
s.userCurrency
|
|
153
|
-
)).map((
|
|
154
|
-
hotel_id:
|
|
155
|
-
hotel_group:
|
|
156
|
-
cash_value:
|
|
157
|
-
currency:
|
|
158
|
-
award_points:
|
|
159
|
-
points:
|
|
153
|
+
)).map((c) => ({
|
|
154
|
+
hotel_id: c.hotelId,
|
|
155
|
+
hotel_group: c.hotelGroup,
|
|
156
|
+
cash_value: c.cashValue,
|
|
157
|
+
currency: c.cashValue.currency,
|
|
158
|
+
award_points: c.awardPoints,
|
|
159
|
+
points: c.points
|
|
160
160
|
})),
|
|
161
161
|
days: s.days,
|
|
162
162
|
cash_or_points: ["cash", "points"]
|
|
163
|
-
}, { data: a } = await
|
|
164
|
-
|
|
163
|
+
}, { data: a } = await l.post(
|
|
164
|
+
_.GET_BEST_CHECKOUT,
|
|
165
165
|
t
|
|
166
|
-
),
|
|
166
|
+
), r = a.data[0];
|
|
167
167
|
return {
|
|
168
168
|
success: !0,
|
|
169
169
|
data: {
|
|
170
|
-
totalPointsCost:
|
|
171
|
-
nightlyPointsCost:
|
|
172
|
-
totalCashCost:
|
|
173
|
-
nightlyCashCost:
|
|
174
|
-
currency:
|
|
175
|
-
sufficientPoints:
|
|
176
|
-
awardPoints:
|
|
177
|
-
rewardsProgram:
|
|
178
|
-
|
|
170
|
+
totalPointsCost: r.total_hotel_points_cost,
|
|
171
|
+
nightlyPointsCost: r.points,
|
|
172
|
+
totalCashCost: r.total_cash_cost,
|
|
173
|
+
nightlyCashCost: r.cash_value.amount,
|
|
174
|
+
currency: r.cash_value.currency,
|
|
175
|
+
sufficientPoints: r.user_has_sufficient_points,
|
|
176
|
+
awardPoints: r.award_points,
|
|
177
|
+
rewardsProgram: r.hotel_rewards_program,
|
|
178
|
+
valueCents: r.value_cents,
|
|
179
|
+
bestCheckoutMethod: r.best_user_checkout_method === T.CASH ? d.CASH : d.POINTS,
|
|
179
180
|
optimalProgram: {
|
|
180
|
-
totalProgramPointsValuation:
|
|
181
|
-
remainingPointsBalance:
|
|
182
|
-
programs:
|
|
183
|
-
(
|
|
184
|
-
convertedPoints:
|
|
185
|
-
program:
|
|
186
|
-
pointsUsed:
|
|
187
|
-
transferRatio:
|
|
188
|
-
centsPerPoint:
|
|
189
|
-
programPointsValue:
|
|
181
|
+
totalProgramPointsValuation: r.optimal_user_program_checkout.total_program_points_valuation,
|
|
182
|
+
remainingPointsBalance: r.optimal_user_program_checkout.primary_offer_remaining_points_balance,
|
|
183
|
+
programs: r.optimal_user_program_checkout.programs.map(
|
|
184
|
+
(c) => ({
|
|
185
|
+
convertedPoints: c.converted_program_points,
|
|
186
|
+
program: c.program,
|
|
187
|
+
pointsUsed: c.program_points_used,
|
|
188
|
+
transferRatio: c.program_transfer_ratio,
|
|
189
|
+
centsPerPoint: c.program_value_cents,
|
|
190
|
+
programPointsValue: c.program_points_value
|
|
190
191
|
})
|
|
191
192
|
)
|
|
192
193
|
}
|
|
@@ -202,7 +203,7 @@ class S {
|
|
|
202
203
|
});
|
|
203
204
|
}
|
|
204
205
|
}
|
|
205
|
-
const V = new
|
|
206
|
+
const V = new P();
|
|
206
207
|
export {
|
|
207
208
|
V as HotelService
|
|
208
209
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@odynn/awayz-hotels",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.4.
|
|
4
|
+
"version": "0.4.4",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist"
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
]
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@odynn/awayz-core": "^0.4.
|
|
65
|
+
"@odynn/awayz-core": "^0.4.2",
|
|
66
66
|
"@tanstack/react-query": "^5.66.9",
|
|
67
67
|
"string-comparison": "^1.3.0"
|
|
68
68
|
}
|
package/dist/enums-DQwp1Z7V.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
var S = /* @__PURE__ */ ((R) => (R.LOCATIONS = "LOCATIONS", R.CHECK_USER = "CHECK_USER", R.USER_REGIONS = "USER_REGIONS", R.CONVERT_CURRENCY = "CONVERT_CURRENCY", R.CLIENT_COMPONENT_KEY = "CLIENT_COMPONENT_KEY", R.SEARCH_LIMIT = "SEARCH_LIMIT", R.PROGRAMS = "PROGRAMS", R.USER_PROGRAMS = "USER_PROGRAMS", R.BANKS = "BANKS", R.CARDS = "CARDS", R.USER_CARDS = "USER_CARDS", R.TRIPS = "TRIPS", R.UNCATEGORISED_BOOKINGS = "UNCATEGORISED_BOOKINGS", R.BOOKING = "BOOKING", R))(S || {});
|
|
2
|
-
export {
|
|
3
|
-
S as E
|
|
4
|
-
};
|