@odynn/awayz-hotels 0.1.19 → 0.1.20

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.
@@ -24,7 +24,7 @@ const w = async (o) => await m.getTransferPartners(
24
24
  checkoutDate: a
25
25
  });
26
26
  if (r.success) {
27
- const e = r.data[0], u = !(e.points.pointsValue > 0) && o.bestValue === l.POINTS;
27
+ const e = r.data, u = !(e.points.pointsValue > 0) && o.bestValue === l.POINTS;
28
28
  n = {
29
29
  ...o,
30
30
  awardPoints: e.points.awardPointsValue ?? e.points.pointsValue,
@@ -141,3 +141,18 @@ export interface IStepBonus {
141
141
  bonus: number;
142
142
  stepThreshold: number;
143
143
  }
144
+ export interface ILiveHotelCheck {
145
+ hotelName: string;
146
+ hotelNameKey: string;
147
+ country: string;
148
+ city: string;
149
+ state: string;
150
+ hotelId: string;
151
+ points: {
152
+ pointsType: string;
153
+ pointsValue: number;
154
+ awardPointsValue: number;
155
+ availability: boolean;
156
+ };
157
+ rooms: IRoom[];
158
+ }
@@ -1,5 +1,5 @@
1
1
  import { IHotelPointsCheckArgs, ISearchByHotelIdRequest, ISearchHotelsParams, ISearchLocation } from './HotelService.types';
2
- import { IHotelDetails } from '../../components/HotelResult/HotelResult.types';
2
+ import { IHotelDetails, ILiveHotelCheck } from '../../components/HotelResult/HotelResult.types';
3
3
  import { TServiceResponse } from '@type-op/shared';
4
4
  import { IBestCheckout } from '../../hooks/useHotelDetails/useHotelDetails.types';
5
5
  declare class _HotelService {
@@ -7,7 +7,10 @@ declare class _HotelService {
7
7
  searchByCoords: (request: ISearchHotelsParams) => Promise<TServiceResponse<IHotelDetails[]>>;
8
8
  searchByHotelId: (request: ISearchByHotelIdRequest) => Promise<TServiceResponse<IHotelDetails[]>>;
9
9
  getTransferPartners: (program: string) => Promise<any>;
10
- hotelPointsCheck: (args: IHotelPointsCheckArgs) => Promise<any>;
10
+ hotelPointsCheck: (args: IHotelPointsCheckArgs) => Promise<{
11
+ success: any;
12
+ data: ILiveHotelCheck;
13
+ }>;
11
14
  getRecommendations: (args: any) => Promise<{
12
15
  success: boolean;
13
16
  data: IBestCheckout;
@@ -6,10 +6,10 @@ import { s as T } from "../../stringUtils-CvWpky85.js";
6
6
  import "../../moment-BGjjqtLQ.js";
7
7
  import "../../arrayExtensions-cyilNkdJ.js";
8
8
  import { c as h } from "../../objectUtils-CyIaVmog.js";
9
- import { E as l } from "../../DateFormats-DZD30Nea.js";
9
+ import { E as m } from "../../DateFormats-DZD30Nea.js";
10
10
  import { EHotelEndpoints as i } from "../../configs/endpoints.js";
11
11
  import { clientInstance as u } from "@odynn/awayz-auth";
12
- import { EBestCheckoutType as m } from "../../enums/EBestCheckoutType.js";
12
+ import { EBestCheckoutType as p } from "../../enums/EBestCheckoutType.js";
13
13
  import { EBestValueType as S } from "../../enums/EBestValueType.js";
14
14
  class H {
15
15
  constructor() {
@@ -33,9 +33,9 @@ class H {
33
33
  success: !0,
34
34
  data: e.data.cities.map(
35
35
  (o) => {
36
- const { search_id: p, search_type: _, description: d, coordinates: y, city: g } = o, n = {
37
- searchId: p,
38
- searchType: _,
36
+ const { search_id: _, search_type: l, description: d, coordinates: y, city: g } = o, n = {
37
+ searchId: _,
38
+ searchType: l,
39
39
  description: d,
40
40
  coordinates: y,
41
41
  city: g
@@ -121,13 +121,16 @@ class H {
121
121
  const e = {
122
122
  hotel_group: a.hotelGroup,
123
123
  hotel_id: a.hotelId,
124
- check_in_date: a.checkinDate.format(l.ServerDate),
125
- check_out_date: a.checkoutDate.format(l.ServerDate)
124
+ check_in_date: a.checkinDate.format(m.ServerDate),
125
+ check_out_date: a.checkoutDate.format(m.ServerDate)
126
126
  }, { data: t } = await u.post(
127
127
  i.HOTEL_POINTS_CHECK,
128
128
  e
129
129
  );
130
- return t;
130
+ return {
131
+ success: t.success,
132
+ data: h(t.data[0])
133
+ };
131
134
  });
132
135
  r(this, "getRecommendations", async (a) => {
133
136
  try {
@@ -146,7 +149,7 @@ class H {
146
149
  cash_or_points: ["cash", "points"]
147
150
  }
148
151
  ), t = e.data[0];
149
- return console.log({ data: t }), {
152
+ return {
150
153
  success: !0,
151
154
  data: {
152
155
  totalPointsCost: t.total_hotel_points_cost,
@@ -157,7 +160,7 @@ class H {
157
160
  sufficientPoints: t.user_has_sufficient_points,
158
161
  awardPoints: t.award_points,
159
162
  rewardsProgram: t.hotel_rewards_program,
160
- bestCheckoutMethod: t.best_user_checkout_method === S.CASH ? m.CASH : m.POINTS,
163
+ bestCheckoutMethod: t.best_user_checkout_method === S.CASH ? p.CASH : p.POINTS,
161
164
  optimalProgram: {
162
165
  remainingPointsBalance: t.optimal_user_program_checkout.primary_offer_remaining_points_balance,
163
166
  programs: t.optimal_user_program_checkout.programs.map(
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@odynn/awayz-hotels",
3
3
  "private": false,
4
- "version": "0.1.19",
4
+ "version": "0.1.20",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist"