@roomstay/frontend 2.6.81 → 2.6.82

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.
Files changed (83) hide show
  1. package/dist/370.bundle.js +1 -1
  2. package/dist/375.bundle.js +1 -1
  3. package/dist/430.bundle.js +1 -1
  4. package/dist/537.bundle.js +1 -1
  5. package/dist/978.bundle.js +1 -1
  6. package/dist/main.bundle.js +1 -1
  7. package/dist/src/api/AvailabilityAPI.d.ts +5 -1
  8. package/dist/src/api/AvailabilityAPI.js +23 -12
  9. package/dist/src/api/AvailabilityAPI.js.map +1 -1
  10. package/dist/src/api/ReservationAPI.js +12 -9
  11. package/dist/src/api/ReservationAPI.js.map +1 -1
  12. package/dist/src/components/User/Forms/SignInForm.js.map +1 -1
  13. package/dist/src/components/generic/PaymentCard/InlinePaymentOption.js +2 -2
  14. package/dist/src/components/generic/PaymentCard/InlinePaymentOption.js.map +1 -1
  15. package/dist/src/components/reservation/ReservationItem.d.ts +1 -0
  16. package/dist/src/components/reservation/ReservationItem.js +2 -2
  17. package/dist/src/components/reservation/ReservationItem.js.map +1 -1
  18. package/dist/src/components/reservation/ReservationList.d.ts +1 -0
  19. package/dist/src/components/reservation/ReservationList.js +2 -2
  20. package/dist/src/components/reservation/ReservationList.js.map +1 -1
  21. package/dist/src/components/steps/addons/AddonCard.js +8 -0
  22. package/dist/src/components/steps/addons/AddonCard.js.map +1 -1
  23. package/dist/src/components/steps/confirmation/StepConfirmationPolicyBlock.js +5 -4
  24. package/dist/src/components/steps/confirmation/StepConfirmationPolicyBlock.js.map +1 -1
  25. package/dist/src/components/steps/confirmation/TrueRewardsPaymentOption/TrueRewardsPaymentMethod.js +6 -4
  26. package/dist/src/components/steps/confirmation/TrueRewardsPaymentOption/TrueRewardsPaymentMethod.js.map +1 -1
  27. package/dist/src/components/steps/room/AvailableUpgradesModal.js +0 -5
  28. package/dist/src/components/steps/room/AvailableUpgradesModal.js.map +1 -1
  29. package/dist/src/components/steps/room/roomDetails/roomRates/RoomRateDescriptionTab.js +2 -2
  30. package/dist/src/components/steps/room/roomDetails/roomRates/RoomRateDescriptionTab.js.map +1 -1
  31. package/dist/src/components/steps/room/roomDetails/unavailableRoom/UnavailableRoom.js +6 -2
  32. package/dist/src/components/steps/room/roomDetails/unavailableRoom/UnavailableRoom.js.map +1 -1
  33. package/dist/src/components/summary/BEMobileSummaryModal.js +11 -10
  34. package/dist/src/components/summary/BEMobileSummaryModal.js.map +1 -1
  35. package/dist/src/components/summary/BESummary.js +4 -4
  36. package/dist/src/components/summary/BESummary.js.map +1 -1
  37. package/dist/src/contexts/BasketContext/BasketContextType.d.ts +3 -3
  38. package/dist/src/contexts/BasketContext/BasketContextType.js.map +1 -1
  39. package/dist/src/contexts/BasketContext/BasketContextWrapper.js +145 -73
  40. package/dist/src/contexts/BasketContext/BasketContextWrapper.js.map +1 -1
  41. package/dist/src/contexts/CompanyContext/CompanyContextWrapper.js +1 -2
  42. package/dist/src/contexts/CompanyContext/CompanyContextWrapper.js.map +1 -1
  43. package/dist/src/contexts/ConfirmationStepContext/ConfirmationStepContextWrapper.js +3 -2
  44. package/dist/src/contexts/ConfirmationStepContext/ConfirmationStepContextWrapper.js.map +1 -1
  45. package/dist/src/contexts/Members/AuthenticationContext/AuthenticationContextProvider.js +23 -7
  46. package/dist/src/contexts/Members/AuthenticationContext/AuthenticationContextProvider.js.map +1 -1
  47. package/dist/src/engines/RecentSearchesEngine/RecentSearchesEngineElement.js +0 -1
  48. package/dist/src/engines/RecentSearchesEngine/RecentSearchesEngineElement.js.map +1 -1
  49. package/dist/src/models/Api/HotelDTO.d.ts +1 -1
  50. package/dist/src/models/Api/HotelDTO.js.map +1 -1
  51. package/dist/src/models/Client/Hotel/Hotel.d.ts +1 -1
  52. package/dist/src/models/Client/Hotel/Hotel.js.map +1 -1
  53. package/dist/src/models/Room/RoomRate.d.ts +8 -1
  54. package/dist/src/models/Room/RoomRate.js +24 -0
  55. package/dist/src/models/Room/RoomRate.js.map +1 -1
  56. package/dist/src/pages/account/AccountHome/AccountHomePage.js +1 -1
  57. package/dist/src/pages/account/AccountHome/AccountHomePage.js.map +1 -1
  58. package/dist/src/pages/account/AccountRoutes.d.ts +5 -0
  59. package/dist/src/pages/account/AccountRoutes.js +8 -2
  60. package/dist/src/pages/account/AccountRoutes.js.map +1 -1
  61. package/dist/src/pages/account/Reservations/AccountReservationSinglePage.js +21 -6
  62. package/dist/src/pages/account/Reservations/AccountReservationSinglePage.js.map +1 -1
  63. package/dist/src/pages/account/Reservations/AccountReservationsPage.js +7 -7
  64. package/dist/src/pages/account/Reservations/AccountReservationsPage.js.map +1 -1
  65. package/dist/src/translations/Translation.js +1 -1
  66. package/dist/src/translations/Translation.js.map +1 -1
  67. package/dist/src/util/Analytics/Analytics.d.ts +33 -9
  68. package/dist/src/util/Analytics/Analytics.js +26 -0
  69. package/dist/src/util/Analytics/Analytics.js.map +1 -1
  70. package/dist/src/util/Analytics/GoogleAnalytics4.d.ts +2 -1
  71. package/dist/src/util/Analytics/GoogleAnalytics4.js +9 -0
  72. package/dist/src/util/Analytics/GoogleAnalytics4.js.map +1 -1
  73. package/dist/src/util/Analytics/UniversalAnalytics.d.ts +4 -22
  74. package/dist/src/util/Analytics/UniversalAnalytics.js +23 -4
  75. package/dist/src/util/Analytics/UniversalAnalytics.js.map +1 -1
  76. package/dist/src/util/DataLayer.d.ts +7 -2
  77. package/dist/src/util/DataLayer.js +47 -18
  78. package/dist/src/util/DataLayer.js.map +1 -1
  79. package/dist/test.bundle.js +1 -1
  80. package/dist/tests/offline/entry/config/hotelSpecDefault.js +1 -1
  81. package/dist/tests/offline/entry/config/hotelSpecDefault.js.map +1 -1
  82. package/dist/vendors.bundle.js +1 -1
  83. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"Hotel.js","sourceRoot":"/","sources":["src/models/Client/Hotel/Hotel.ts"],"names":[],"mappings":";;;AAmBA,IAAY,gBAOX;AAPD,WAAY,gBAAgB;IACxB,+BAAW,CAAA;IACX,qCAAiB,CAAA;IACjB,8BAAU,CAAA;IACV,0CAAsB,CAAA;IACtB,qCAAiB,CAAA;IACjB,mCAAe,CAAA;AACnB,CAAC,EAPW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAO3B","sourcesContent":["import { EnvironmentName } from '@planpay/web/src/lib/shared-lib-duplicates';\nimport { EBookingFlow, EBookingPaymentMethod, EHotelCardProcessor, EHotelStateFieldConfiguration, EIntegration, IHotelColorScheme } from '@roomstay/core';\nimport { Property } from 'csstype';\nimport type { ReactChild } from 'react';\n\nimport type { InternalMemberSignInInputs } from '@/components/members/SignInModal/InternalMemberSignInModal.types';\nimport type { HotelRoomGroupsDTO, HotelRoomsDTO, HotelServiceDTO } from '@/models/Api/HotelDTO';\nimport type { TransportDistances } from '@/models/Api/HotelOverrideDTO';\nimport type { HasDatalayerTags } from '@/models/Client/Hotel/Company';\nimport type { DistanceUnitType } from '@/models/Client/Hotel/DistanceUnitType.types';\nimport type HotelAddress from '@/models/Client/Hotel/HotelAddress';\nimport type { HotelDataSource } from '@/models/Client/Hotel/HotelDataSource.types';\nimport type { HotelPerk } from '@/models/Client/Hotel/HotelPerk';\nimport type { HotelRoomOverwrite } from '@/models/Client/Hotel/HotelRoomOverwrite';\nimport type { WeekdayStartsOn } from '@/models/Client/Hotel/WeekdayStartsOn.types';\nimport { HotelFee } from '@/models/Fee';\nimport type { Language } from '@/providers/LanguageProvider';\nimport { RoomSort } from '@/providers/RoomSortProvider';\n\nexport enum EPaymentCardType {\n Visa = 'VI',\n Mastercard = 'MC',\n JCB = 'JC',\n AmericanExpress = 'AX',\n DinersClub = 'DN',\n UnionPay = 'UP',\n}\n\nexport interface IVGSVaultNames {\n standard: string;\n members: string;\n}\n\n/**\n * This config comes from admin -- TODO: Move to Roomstay Core\n */\nexport interface AdminHotelConfig {\n hotelID: string;\n name: string;\n address?: HotelAddress;\n latitude?: number;\n longitude?: number;\n phone?: string;\n email?: string;\n checkInTime?: string;\n checkOutTime?: string;\n paymentCardTypes?: EPaymentCardType[];\n description?: string;\n locationDescription?: string;\n policies?: string;\n hotelServices: HotelServiceDTO[];\n businessServices: HotelServiceDTO[];\n rooms: HotelRoomsDTO;\n hasLoadedDetails?: boolean;\n dataSource: HotelDataSource;\n defaultCurrency: string;\n paymentMethods: EBookingPaymentMethod[];\n planpay?: {\n username: string;\n minDaysShowPlanpay: number;\n env: EnvironmentName;\n };\n hotelUrl: string;\n heroImage: string;\n memberOnlyModalImage?: string;\n memberOnlyModalImageSize: Property.ObjectFit;\n images?: string[];\n logo: string | ReactChild;\n colors: IHotelColorScheme;\n distanceUnitType: DistanceUnitType;\n startsWeekOnDay?: WeekdayStartsOn;\n crossSellHotelIds?: string[];\n maxOccupancy?: number;\n minAdultAge?: number;\n maxAdultAge?: number;\n maxAdults?: number;\n maxChildren?: number;\n maxInfants?: number;\n countInfantsInOccupancy?: boolean;\n hideByLine?: boolean;\n transportDistances?: TransportDistances;\n roomGroups: HotelRoomGroupsDTO;\n cardProcessor: EHotelCardProcessor;\n\n requireDeposit?: boolean;\n bookingFlow: EBookingFlow;\n\n /** @deprecated Use the new Fees model instead */\n enableCreditCardSurcharge?: boolean;\n availableCountries?: { name: string; value: string }[];\n\n childConfiguration?: {\n supportChildren?: boolean;\n supportInfants: boolean;\n childRange: { min: number; max: number };\n infantRange: { min: number; max: number };\n };\n preventCancellation?: boolean;\n\n perks?: HotelPerk[];\n perkTitle?: string;\n\n stateFieldConfiguration?: EHotelStateFieldConfiguration;\n\n countryPrefix?: string;\n quoteImageDesktop?: string;\n quoteImageMobile?: string;\n memberOnlyImage?: string;\n captureChildAge?: boolean;\n itineraryNote: string;\n\n fees?: HotelFee[];\n addDepositFeeToBookingTotal?: boolean;\n\n company: {\n url?: string;\n logo?: string;\n };\n\n facebookUrl: string;\n instagramUrl: string;\n linkedinUrl: string;\n preferProviderBookingId: boolean;\n disableSavedPayments?: boolean;\n showUnavailableRooms?: boolean;\n isRACMemberNoRequired?: boolean;\n}\n\n/**\n * This config comes from hard static local file\n */\nexport interface ClientHotelConfig {\n providerHotelID: string;\n shortName?: string;\n defaultDatepickerType?: 'Month' | 'Week';\n // TODO: need to do magic to see if we need to append / prepend stuff, for now we assume that it's only used while on the site.\n checkoutUrl?: string;\n defaultLanguage: Language;\n privacyPolicyUrl: string;\n bookNowPayLaterUrl?: string;\n bestRateNoBSUrl?: string;\n\n memberOnlyRates?: string[];\n memberOnlyPromoCode?: string;\n memberOnlyRenderRateLast?: boolean;\n memberOnlySignupInputs?: InternalMemberSignInInputs;\n googleMapsImage?: string;\n /**\n * Whether to show the Breakfast / Lunch / Dinner included\n */\n showMealPill?: boolean;\n perks?: HotelPerk[];\n perkTitle?: string;\n /**\n * Hide perks on room row\n */\n perksHideOnRoomRow?: boolean;\n /**\n * Hide perks on room detail modal\n */\n perksHideOnRoomDetail?: boolean;\n perksShowDisclaimer?: boolean;\n /** @deprecated Use the vgs.vaultNames.standard property now */\n vgsVaultName?: string;\n vgs?: {\n vaultNames: IVGSVaultNames;\n };\n showAddonLoader: boolean;\n overwrites?: { [code: string]: Partial<HotelRoomOverwrite> };\n forwardFindReservationToSynxis?: boolean;\n additionalOptions?: { [name: string]: any };\n googleReCaptcha?: {\n loadForMembers?: boolean;\n siteKey?: string;\n };\n /**\n * Show description on RoomDetails\n */\n showDescriptionOnRoomDetails?: boolean;\n /**\n * Customize the Member modal colours. Specifically replacing the green (success) with the primary color of hotel (accent)\n */\n memberOnlyModalUsePrimaryColor?: boolean;\n /**\n * Callback to trigger specific events on load of a hotel.\n *\n * This is where you can specify custom fields, language overrides, feature toggles etc.\n */\n onLoad?: () => void;\n /**\n * Order available rooms\n */\n currentRoomSort?: RoomSort;\n /**\n * Order available rates\n */\n currentRoomRateSort?: RoomSort | undefined;\n maxAdults?: number; //fixed from frontend\n mobileDefaultRatesClosed?: boolean;\n}\n\nexport interface ConfigHotel extends ClientHotelConfig, AdminHotelConfig, HasDatalayerTags {}\n\nexport type Hotel = ConfigHotel & {\n lowestPrice?: {\n value: number;\n isLoading: boolean;\n };\n integrations?: EIntegration[];\n\n // TODO: Should be a better way to use this configuration.\n isRACMemberNoRequired?: boolean;\n};\n\n/**\n * Used for DetailsHotel event\n */\nexport type InitialHotelDetailsEventPayload = {\n name: string;\n hotelID: number | string;\n hotelUrl: string;\n currency: string;\n language: Language;\n address?: HotelAddress;\n};\n"]}
1
+ {"version":3,"file":"Hotel.js","sourceRoot":"/","sources":["src/models/Client/Hotel/Hotel.ts"],"names":[],"mappings":";;;AAmBA,IAAY,gBAOX;AAPD,WAAY,gBAAgB;IACxB,+BAAW,CAAA;IACX,qCAAiB,CAAA;IACjB,8BAAU,CAAA;IACV,0CAAsB,CAAA;IACtB,qCAAiB,CAAA;IACjB,mCAAe,CAAA;AACnB,CAAC,EAPW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAO3B","sourcesContent":["import { EnvironmentName } from '@planpay/web/src/lib/shared-lib-duplicates';\nimport { EBookingFlow, EBookingPaymentMethod, EHotelCardProcessor, EHotelStateFieldConfiguration, EIntegration, IHotelColorScheme } from '@roomstay/core';\nimport { Property } from 'csstype';\nimport type { ReactChild } from 'react';\n\nimport type { InternalMemberSignInInputs } from '@/components/members/SignInModal/InternalMemberSignInModal.types';\nimport type { HotelRoomGroupsDTO, HotelRoomsDTO, HotelServiceDTO } from '@/models/Api/HotelDTO';\nimport type { TransportDistances } from '@/models/Api/HotelOverrideDTO';\nimport type { HasDatalayerTags } from '@/models/Client/Hotel/Company';\nimport type { DistanceUnitType } from '@/models/Client/Hotel/DistanceUnitType.types';\nimport type HotelAddress from '@/models/Client/Hotel/HotelAddress';\nimport type { HotelDataSource } from '@/models/Client/Hotel/HotelDataSource.types';\nimport type { HotelPerk } from '@/models/Client/Hotel/HotelPerk';\nimport type { HotelRoomOverwrite } from '@/models/Client/Hotel/HotelRoomOverwrite';\nimport type { WeekdayStartsOn } from '@/models/Client/Hotel/WeekdayStartsOn.types';\nimport { HotelFee } from '@/models/Fee';\nimport type { Language } from '@/providers/LanguageProvider';\nimport { RoomSort } from '@/providers/RoomSortProvider';\n\nexport enum EPaymentCardType {\n Visa = 'VI',\n Mastercard = 'MC',\n JCB = 'JC',\n AmericanExpress = 'AX',\n DinersClub = 'DN',\n UnionPay = 'UP',\n}\n\nexport interface IVGSVaultNames {\n standard: string;\n members: string;\n}\n\n/**\n * This config comes from admin -- TODO: Move to Roomstay Core\n */\nexport interface AdminHotelConfig {\n hotelID: string;\n name: string;\n address?: HotelAddress;\n latitude?: number;\n longitude?: number;\n phone?: string;\n email?: string;\n checkInTime?: string;\n checkOutTime?: string;\n paymentCardTypes?: EPaymentCardType[];\n description?: string;\n locationDescription?: string;\n policies?: string;\n hotelServices: HotelServiceDTO[];\n businessServices: HotelServiceDTO[];\n rooms: HotelRoomsDTO;\n hasLoadedDetails?: boolean;\n dataSource: HotelDataSource;\n defaultCurrency: string;\n paymentMethods: EBookingPaymentMethod[];\n planpay?: {\n username: string;\n minDaysShowPlanpay: number;\n env: EnvironmentName;\n };\n hotelUrl: string;\n heroImage: string;\n memberOnlyModalImage?: string;\n memberOnlyModalImageSize: Property.ObjectFit;\n images?: string[];\n logo: string | ReactChild;\n colors: IHotelColorScheme;\n distanceUnitType: DistanceUnitType;\n startsWeekOnDay?: WeekdayStartsOn;\n crossSellHotelIds?: string[];\n maxOccupancy?: number;\n minAdultAge?: number;\n maxAdultAge?: number;\n maxAdults?: number;\n maxChildren?: number;\n maxInfants?: number;\n countInfantsInOccupancy?: boolean;\n hideByLine?: boolean;\n transportDistances?: TransportDistances;\n roomGroups: HotelRoomGroupsDTO;\n cardProcessor: EHotelCardProcessor;\n\n rmsUseDepositQuote?: boolean;\n bookingFlow: EBookingFlow;\n\n /** @deprecated Use the new Fees model instead */\n enableCreditCardSurcharge?: boolean;\n availableCountries?: { name: string; value: string }[];\n\n childConfiguration?: {\n supportChildren?: boolean;\n supportInfants: boolean;\n childRange: { min: number; max: number };\n infantRange: { min: number; max: number };\n };\n preventCancellation?: boolean;\n\n perks?: HotelPerk[];\n perkTitle?: string;\n\n stateFieldConfiguration?: EHotelStateFieldConfiguration;\n\n countryPrefix?: string;\n quoteImageDesktop?: string;\n quoteImageMobile?: string;\n memberOnlyImage?: string;\n captureChildAge?: boolean;\n itineraryNote: string;\n\n fees?: HotelFee[];\n addDepositFeeToBookingTotal?: boolean;\n\n company: {\n url?: string;\n logo?: string;\n };\n\n facebookUrl: string;\n instagramUrl: string;\n linkedinUrl: string;\n preferProviderBookingId: boolean;\n disableSavedPayments?: boolean;\n showUnavailableRooms?: boolean;\n isRACMemberNoRequired?: boolean;\n}\n\n/**\n * This config comes from hard static local file\n */\nexport interface ClientHotelConfig {\n providerHotelID: string;\n shortName?: string;\n defaultDatepickerType?: 'Month' | 'Week';\n // TODO: need to do magic to see if we need to append / prepend stuff, for now we assume that it's only used while on the site.\n checkoutUrl?: string;\n defaultLanguage: Language;\n privacyPolicyUrl: string;\n bookNowPayLaterUrl?: string;\n bestRateNoBSUrl?: string;\n\n memberOnlyRates?: string[];\n memberOnlyPromoCode?: string;\n memberOnlyRenderRateLast?: boolean;\n memberOnlySignupInputs?: InternalMemberSignInInputs;\n googleMapsImage?: string;\n /**\n * Whether to show the Breakfast / Lunch / Dinner included\n */\n showMealPill?: boolean;\n perks?: HotelPerk[];\n perkTitle?: string;\n /**\n * Hide perks on room row\n */\n perksHideOnRoomRow?: boolean;\n /**\n * Hide perks on room detail modal\n */\n perksHideOnRoomDetail?: boolean;\n perksShowDisclaimer?: boolean;\n /** @deprecated Use the vgs.vaultNames.standard property now */\n vgsVaultName?: string;\n vgs?: {\n vaultNames: IVGSVaultNames;\n };\n showAddonLoader: boolean;\n overwrites?: { [code: string]: Partial<HotelRoomOverwrite> };\n forwardFindReservationToSynxis?: boolean;\n additionalOptions?: { [name: string]: any };\n googleReCaptcha?: {\n loadForMembers?: boolean;\n siteKey?: string;\n };\n /**\n * Show description on RoomDetails\n */\n showDescriptionOnRoomDetails?: boolean;\n /**\n * Customize the Member modal colours. Specifically replacing the green (success) with the primary color of hotel (accent)\n */\n memberOnlyModalUsePrimaryColor?: boolean;\n /**\n * Callback to trigger specific events on load of a hotel.\n *\n * This is where you can specify custom fields, language overrides, feature toggles etc.\n */\n onLoad?: () => void;\n /**\n * Order available rooms\n */\n currentRoomSort?: RoomSort;\n /**\n * Order available rates\n */\n currentRoomRateSort?: RoomSort | undefined;\n maxAdults?: number; //fixed from frontend\n mobileDefaultRatesClosed?: boolean;\n}\n\nexport interface ConfigHotel extends ClientHotelConfig, AdminHotelConfig, HasDatalayerTags {}\n\nexport type Hotel = ConfigHotel & {\n lowestPrice?: {\n value: number;\n isLoading: boolean;\n };\n integrations?: EIntegration[];\n\n // TODO: Should be a better way to use this configuration.\n isRACMemberNoRequired?: boolean;\n};\n\n/**\n * Used for DetailsHotel event\n */\nexport type InitialHotelDetailsEventPayload = {\n name: string;\n hotelID: number | string;\n hotelUrl: string;\n currency: string;\n language: Language;\n address?: HotelAddress;\n};\n"]}
@@ -4,6 +4,7 @@ import type { Room } from './Room';
4
4
  import RoomRateNight, { IRoomRateNight } from './RoomRateNight';
5
5
  import type RoomRateSortable from './RoomRateSortable';
6
6
  import type { Serializable } from '../Serializable';
7
+ import { EGuaranteePolicyDepositMode } from '@roomstay/core';
7
8
  export declare enum RoomRatePriceInclusion {
8
9
  ExcludingFees = "Fees Excluded",
9
10
  ExcludingTaxes = "Taxes Excluded",
@@ -94,6 +95,10 @@ export declare class RoomRate implements RoomRateSortable, Serializable<RoomRate
94
95
  applyData(data: any): void;
95
96
  setRoom(room: Room): void;
96
97
  getRoom(): Room;
98
+ /**
99
+ * Do not use this method if RMS deposit quotes are enabled.
100
+ */
101
+ getDepositAccordingToGuaranteePolicy(bookingRateFees: number): number;
97
102
  getTotalPrice: (getCost?: boolean) => number;
98
103
  getTotalPriceBeforeDiscount: (getCost?: boolean) => number;
99
104
  getTotalDiscount: () => number;
@@ -104,7 +109,9 @@ export declare class RoomRate implements RoomRateSortable, Serializable<RoomRate
104
109
  getItemisedFees: (hotelFees: HotelFee[]) => ItemisedFee[];
105
110
  getTotalTaxes: () => number;
106
111
  getPriceType: () => RoomRatePriceInclusion;
107
- getGuaranteePolicy: () => string;
112
+ getGuaranteePolicy: () => Omit<import("@roomstay/core").IAvailabilityGuaranteePolicyDetails, "depositMode"> & {
113
+ depositMode: EGuaranteePolicyDepositMode | null;
114
+ };
108
115
  getCancellationPolicy: () => string;
109
116
  getPriceSortValue: () => number;
110
117
  /**
@@ -9,6 +9,7 @@ const AvailabilityAPI_1 = __importDefault(require("../../api/AvailabilityAPI"));
9
9
  const Fee_1 = require("../Fee");
10
10
  const RoomRateNight_1 = __importDefault(require("./RoomRateNight"));
11
11
  const StaticContextProvider_1 = __importDefault(require("../../providers/StaticContextProvider"));
12
+ const core_1 = require("@roomstay/core");
12
13
  var RoomRatePriceInclusion;
13
14
  (function (RoomRatePriceInclusion) {
14
15
  RoomRatePriceInclusion["ExcludingFees"] = "Fees Excluded";
@@ -454,6 +455,29 @@ class RoomRate {
454
455
  getRoom() {
455
456
  return this.room;
456
457
  }
458
+ /**
459
+ * Do not use this method if RMS deposit quotes are enabled.
460
+ */
461
+ getDepositAccordingToGuaranteePolicy(bookingRateFees) {
462
+ const depositPercentage = this.getGuaranteePolicy().depositPercentage;
463
+ const nightsAsArray = this.getNightRateArray();
464
+ const totalPriceIncludingAllFees = this.getTotalPrice() + bookingRateFees;
465
+ switch (this.getGuaranteePolicy().depositMode) {
466
+ case core_1.EGuaranteePolicyDepositMode.None:
467
+ return 0;
468
+ case core_1.EGuaranteePolicyDepositMode.Full:
469
+ return totalPriceIncludingAllFees;
470
+ case core_1.EGuaranteePolicyDepositMode.Percentage:
471
+ if (depositPercentage) {
472
+ return totalPriceIncludingAllFees * (depositPercentage / 100);
473
+ }
474
+ return totalPriceIncludingAllFees;
475
+ case core_1.EGuaranteePolicyDepositMode.FirstNight:
476
+ return Number(nightsAsArray[0].total) + bookingRateFees / nightsAsArray.length;
477
+ case null:
478
+ throw Error('Cannot calculate deposit without a deposit mode');
479
+ }
480
+ }
457
481
  /**
458
482
  * Not implemented
459
483
  */
@@ -1 +1 @@
1
- {"version":3,"file":"RoomRate.js","sourceRoot":"/","sources":["src/models/Room/RoomRate.ts"],"names":[],"mappings":";;;;;;AAAA,kDAAqC;AAErC,4EAAoD;AACpD,sCAAiH;AAEjH,gFAA4E;AAG5E,8FAAsE;AAEtE,IAAY,sBAKX;AALD,WAAY,sBAAsB;IAC9B,yDAA+B,CAAA;IAC/B,2DAAiC,CAAA;IACjC,4EAAkD,CAAA;IAClD,4EAAkD,CAAA;AACtD,CAAC,EALW,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QAKjC;AA+DD,MAAa,QAAQ;IA+BjB;QAdO,kBAAa,GAIhB;YACA,SAAS,EAAE,KAAK;YAChB,KAAK,EAAE,KAAK;YACZ,MAAM,EAAE,KAAK;SAChB,CAAC;QAqCK,kBAAa,GAAG,CAAC,OAAO,GAAG,KAAK,EAAE,EAAE;YACvC,IAAI,KAAK,GAAG,CAAC,CAAC;YACd,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YACrD,aAAa,CAAC,OAAO,CAAC,CAAC,KAAoB,EAAE,EAAE;gBAC3C,KAAK,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACxD,CAAC,CAAC,CAAC;YACH,OAAO,KAAK,CAAC;QACjB,CAAC,CAAC;QAEK,gCAA2B,GAAG,CAAC,OAAO,GAAG,KAAK,EAAE,EAAE;YACrD,IAAI,KAAK,GAAG,CAAC,CAAC;YACd,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YACrD,aAAa,CAAC,OAAO,CAAC,CAAC,KAAoB,EAAE,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AI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,eAAe,GAAG,eAAyB,CAAC;QACjD,IAAI,CAAC,YAAY,GAAG,YAAuB,CAAC;QAC5C,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QACzC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,UAAU,GAAG,sBAAsB,CAAC;QACzC,IAAI,CAAC,eAAe,GAAG,EAAE,CAAC;QAC1B,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC;QACxC,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QAEzC,OAAO,IAAI,CAAC;IAChB,CAAC;CAkWJ;AAzkBD,4BAykBC","sourcesContent":["import dayjs, { Dayjs } from 'dayjs';\n\nimport AvailabilityAPI from '@/api/AvailabilityAPI';\nimport { accumulateFees, feeMapToArray, HotelFee, ItemisedFee, mapSimpleFeesToItemisedFees } from '@/models/Fee';\nimport type { Room } from '@/models/Room/Room';\nimport RoomRateNight, { IRoomRateNight } from '@/models/Room/RoomRateNight';\nimport type RoomRateSortable from '@/models/Room/RoomRateSortable';\nimport type { Serializable } from '@/models/Serializable';\nimport StaticContextProvider from '@/providers/StaticContextProvider';\n\nexport enum RoomRatePriceInclusion {\n ExcludingFees = 'Fees Excluded',\n ExcludingTaxes = 'Taxes Excluded',\n ExcludingFeesAndTaxes = 'Excluding Fees and Taxes',\n IncludingFeesAndTaxes = 'Including Fees and Taxes',\n}\n\nexport interface IRoomRate {\n name: string;\n code: string;\n description: string;\n longDescription?: string;\n\n isMemberOnly?: boolean;\n guaranteeCode: string;\n cancelPolicyCode: string;\n nightRates: { [date: string]: IRoomRateNight };\n\n lowestPrice: number;\n promoCode: string;\n promoCodeName: string;\n\n mealsIncluded?: {\n breakfast: boolean;\n lunch: boolean;\n dinner: boolean;\n };\n rateOverrides?: RateOverride[];\n nightsToDiscount?: number;\n}\n\nexport type RateLabelsByDay = {\n Monday: boolean;\n Tuesday: boolean;\n Wednesday: boolean;\n Thursday: boolean;\n Friday: boolean;\n Saturday: boolean;\n Sunday: boolean;\n};\n\nexport type RateOverride = {\n name: string;\n shortDescription: string;\n longDescription: string;\n enabledPerDay: RateLabelsByDay;\n startDate: string;\n endDate: string;\n queryStartDate: string;\n queryEndDate: string;\n};\n\nexport type RateOverrideKeys = 'name' | 'shortDescription' | 'longDescription';\n\ninterface RequestedDate {\n startDate: Dayjs;\n endDate: Dayjs;\n}\n\ninterface DisplayRate {\n name: string;\n shortDescription: string;\n longDescription: string;\n startDate?: Dayjs;\n endDate?: Dayjs;\n override: RateOverride;\n}\n\nexport class RoomRate implements RoomRateSortable, Serializable<RoomRate, IRoomRate> {\n public name!: string;\n public code!: string;\n\n public description!: string;\n public longDescription!: string;\n\n public isMemberOnly!: boolean;\n\n public guaranteeCode!: string;\n\n public cancelPolicyCode!: string;\n\n public nightRates: { [date: string]: RoomRateNight };\n public lowestPrice!: number;\n public promoCode?: string;\n public promoCodeName?: string;\n public mealsIncluded?: {\n breakfast: boolean;\n lunch: boolean;\n dinner: boolean;\n } = {\n breakfast: false,\n lunch: false,\n dinner: false,\n };\n private nightRatesArray: RoomRateNight[];\n private room!: Room;\n public rateOverrides?: RateOverride[];\n public nightsToDiscount?: number;\n\n public constructor() {\n this.nightRates = {};\n this.nightRatesArray = [];\n }\n\n public static fromData(data: Partial<{ code: string }> | any) {\n const rate = new this();\n\n rate.applyData(data);\n\n if (StaticContextProvider.MemberOnlyRateCodes?.includes(data.code)) {\n rate.isMemberOnly = true;\n }\n\n return rate;\n }\n\n public applyData(data: any) {\n Object.keys(data).map((key: any) => {\n (this as any)[key] = (data as any)[key];\n }, this);\n }\n\n public setRoom(room: Room) {\n this.room = room;\n }\n\n public getRoom(): Room {\n return this.room;\n }\n\n public getTotalPrice = (getCost = false) => {\n let total = 0;\n const nightsAsArray = Object.values(this.nightRates);\n nightsAsArray.forEach((night: RoomRateNight) => {\n total += Number(getCost ? night.cost : night.total);\n });\n return total;\n };\n\n public getTotalPriceBeforeDiscount = (getCost = false) => {\n let total = 0;\n const nightsAsArray = Object.values(this.nightRates);\n nightsAsArray.forEach((night: RoomRateNight) => {\n total += Number(getCost ? night.cost : night.total) + Number(night.discount);\n });\n return total;\n };\n\n public getTotalDiscount = (): number => {\n return this.nightRateTotal((night: RoomRateNight) => {\n return Number(night.discount);\n });\n };\n\n public isStayXPayYRate = (): boolean => {\n return !!(this.nightsToDiscount && this.nightsToDiscount > 0);\n };\n\n public getAveragePrice = (getCost = false): number => {\n const total = this.getTotalPrice(getCost);\n\n return total / Object.keys(this.nightRates).length;\n };\n\n public getAveragePriceBeforeDiscount = (getCost = false) => {\n let total = 0;\n const nightsAsArray = Object.values(this.nightRates);\n nightsAsArray.forEach((night: RoomRateNight) => {\n total += Number(getCost ? night.cost : night.total) + Number(night.discount);\n });\n\n return total / nightsAsArray.length;\n };\n\n public getTotalFees = () => {\n return this.nightRateTotal((night: RoomRateNight) => {\n return Number(night.fee);\n });\n };\n\n public getItemisedFees = (hotelFees: HotelFee[]): ItemisedFee[] => {\n const feeMap = new Map<HotelFee, number>();\n\n this.getNightRateArray().forEach((night) => {\n if (night.fees) {\n const fees = mapSimpleFeesToItemisedFees(night.fees, hotelFees);\n accumulateFees(feeMap, fees);\n }\n });\n\n return feeMapToArray(feeMap);\n };\n\n public getTotalTaxes = () => {\n return this.nightRateTotal((night: RoomRateNight) => {\n return Number(night.tax);\n });\n };\n\n public getPriceType = () => {\n let hasFees = false;\n let hasTax = false;\n\n Object.values(this.nightRates).forEach((night) => {\n if (night.fee && night.fee !== '0') {\n hasFees = true;\n }\n\n if (night.tax && night.tax !== '0') {\n hasTax = true;\n }\n });\n\n if (hasFees && hasTax) {\n return RoomRatePriceInclusion.ExcludingFeesAndTaxes;\n } else if (hasFees) {\n return RoomRatePriceInclusion.ExcludingTaxes;\n } else if (hasTax) {\n return RoomRatePriceInclusion.ExcludingFees;\n } else {\n return RoomRatePriceInclusion.IncludingFeesAndTaxes;\n }\n };\n\n public getGuaranteePolicy = () => {\n return AvailabilityAPI.policyMappings.guarantee[this.guaranteeCode] ?? '';\n };\n\n public getCancellationPolicy = () => {\n return AvailabilityAPI.policyMappings.cancel[this.cancelPolicyCode] ?? '';\n };\n\n public getPriceSortValue = () => {\n return this.getAveragePrice();\n };\n\n /**\n * Not implemented\n */\n public getRecommendedSortValue() {\n return 0;\n }\n\n public serialize() {\n const serializedNightRates: any = {};\n Object.keys(this.nightRates).forEach((date) => {\n serializedNightRates[date] = this.nightRates[date].serialize();\n });\n\n const toSerialize: IRoomRate = {\n name: this.name,\n code: this.code,\n description: this.description,\n longDescription: this.longDescription,\n isMemberOnly: this.isMemberOnly,\n guaranteeCode: this.guaranteeCode,\n cancelPolicyCode: this.cancelPolicyCode,\n nightRates: serializedNightRates,\n lowestPrice: this.lowestPrice,\n promoCode: this.promoCode,\n promoCodeName: this.promoCodeName,\n mealsIncluded: this.mealsIncluded,\n rateOverrides: this.rateOverrides,\n nightsToDiscount: this.nightsToDiscount,\n } as IRoomRate;\n\n return toSerialize;\n }\n\n public unSerialize(data: IRoomRate) {\n const { name, code, description, longDescription, isMemberOnly, guaranteeCode, cancelPolicyCode, lowestPrice, promoCode, promoCodeName, mealsIncluded, nightsToDiscount } =\n data;\n\n const unSerializedNightRates: any = {};\n\n if (data.nightRates) {\n Object.keys(data.nightRates)?.forEach((date) => {\n const nightRate = new RoomRateNight();\n unSerializedNightRates[date] = nightRate.unSerialize(data.nightRates[date]);\n });\n }\n\n this.name = name;\n this.code = code;\n this.description = description;\n this.longDescription = longDescription as string;\n this.isMemberOnly = isMemberOnly as boolean;\n this.guaranteeCode = guaranteeCode;\n this.cancelPolicyCode = cancelPolicyCode;\n this.lowestPrice = lowestPrice;\n this.promoCode = promoCode;\n this.promoCodeName = promoCodeName;\n this.mealsIncluded = mealsIncluded;\n this.nightRates = unSerializedNightRates;\n this.nightRatesArray = [];\n this.rateOverrides = data.rateOverrides;\n this.nightsToDiscount = nightsToDiscount;\n\n return this;\n }\n\n private getNightRateArray = () => {\n if (!this.nightRatesArray.length) {\n this.nightRatesArray = Object.values(this.nightRates);\n }\n\n return this.nightRatesArray;\n };\n\n private reduceNightData = (reducer: (sum: number, rate: RoomRateNight) => number) => {\n return this.getNightRateArray().reduce<number>(reducer, 0) ?? 0;\n };\n\n private nightRateTotal = (value: (rate: RoomRateNight) => number) => {\n return this.reduceNightData((sum: number, redNight: RoomRateNight) => {\n const summingValue = value(redNight);\n\n return sum ? sum + summingValue : summingValue;\n });\n };\n\n public datesOverlap = (startDate1: Dayjs, endDate1: Dayjs, startDate2: Dayjs, endDate2: Dayjs): boolean => {\n const overlap1 = startDate1.isSameOrBefore(endDate2) && startDate2.isSameOrBefore(endDate1);\n const overlap2 = startDate1.isSameOrAfter(endDate2) && startDate2.isSameOrAfter(endDate1);\n return overlap1 || overlap2;\n };\n\n public getDefaultLabelsByDate = (requestedDate: RequestedDate) => {\n const days: { label: string; alternateLabel: string }[] = [];\n let currentDate = requestedDate.startDate.clone();\n while (currentDate.isSameOrBefore(requestedDate.endDate)) {\n days.push({\n label: currentDate.format('dddd, MMM DD, YYYY'),\n alternateLabel: '', // No rate label available\n });\n currentDate = currentDate.add(1, 'day');\n }\n return days;\n };\n\n public getPossiblyOverwrittenDetails = (requestedDate: RequestedDate) => {\n const rateOverrides: RateOverride[] = this.getAvailableRateOverrides();\n if (!rateOverrides.length) return { name: this.name, shortDescription: this.description, longDescription: this.longDescription };\n\n const originalRequestedStartDate = requestedDate.startDate;\n\n let shortDescription = this.description;\n let longDescription = this.longDescription;\n let name = this.name;\n\n // Loop through all overrides and check for any matching the booking dates\n rateOverrides.forEach((override) => {\n if (!originalRequestedStartDate) return;\n\n const queryStartDate = dayjs(override.queryStartDate);\n const queryEndDate = dayjs(override.queryEndDate);\n\n const overlap =\n (!override.queryStartDate || queryStartDate.isSameOrBefore(originalRequestedStartDate, 'date')) &&\n (!override.queryEndDate || queryEndDate.isSameOrAfter(originalRequestedStartDate, 'date'));\n\n const stayDay = originalRequestedStartDate.format('dddd');\n\n if (overlap && override.enabledPerDay[stayDay as keyof RateLabelsByDay] === true) {\n name = override.name;\n shortDescription = override.shortDescription;\n longDescription = override.longDescription;\n }\n });\n\n return { name, shortDescription, longDescription };\n };\n\n public getAvailableRateOverrides = (): RateOverride[] => {\n if (!this.rateOverrides?.length) return [];\n\n const now = dayjs();\n //startDate/endDate/queryStartDate/queryEndDate must not empty\n const rateOverrides: RateOverride[] = this.rateOverrides.filter((override) => {\n // Check if the override can apply to this query in current time.\n // We don't require any of the filter fields, so if they are set we should check that they apply.\n if (override.startDate) {\n if (!dayjs(override.startDate).isSameOrBefore(now)) {\n return false;\n }\n\n if (override.endDate && !dayjs(override.endDate).isSameOrAfter(now)) {\n return false;\n }\n }\n\n return true;\n });\n return rateOverrides;\n };\n\n public hasRateVariesByDay = (requestedDate: RequestedDate): boolean => {\n // Validate startDate/endDate\n if (!requestedDate?.startDate || !requestedDate.endDate) return false;\n\n const rateOverrides: RateOverride[] = this.getAvailableRateOverrides();\n if (!rateOverrides.length) false;\n\n const originalRequestedStartDate = dayjs(requestedDate.startDate);\n const originalRequestedEndDate = dayjs(requestedDate.endDate);\n\n // Loop through all overrides and check for any matching the booking dates\n return rateOverrides.some((override) => {\n const overrideStartDate = dayjs(override.startDate);\n const overrideEndDate = dayjs(override.endDate);\n const queryStartDate = dayjs(override.queryStartDate);\n const queryEndDate = dayjs(override.queryEndDate);\n\n if (override.startDate && overrideStartDate.isAfter(originalRequestedEndDate)) {\n return false;\n }\n\n if (override.endDate && overrideEndDate.isBefore(originalRequestedStartDate)) {\n return false;\n }\n\n if (override.queryStartDate && queryStartDate.isAfter(originalRequestedEndDate)) {\n return false;\n }\n if (override.queryEndDate && queryEndDate.isBefore(originalRequestedStartDate)) {\n return false;\n }\n\n return true;\n });\n };\n\n public getDisplayRates = (requestedDate: RequestedDate): DisplayRate[] => {\n const rateOverrides: RateOverride[] = this.getAvailableRateOverrides();\n if (!rateOverrides.length) return [];\n\n const originalRequestedStartDate = dayjs(requestedDate.startDate);\n const originalRequestedEndDate = dayjs(requestedDate.endDate);\n\n const displayRates: DisplayRate[] = [\n {\n name: this.name,\n shortDescription: this.description,\n longDescription: this.longDescription,\n override: {\n name: this.name,\n shortDescription: this.description,\n longDescription: this.longDescription,\n enabledPerDay: {\n Monday: true,\n Tuesday: true,\n Wednesday: true,\n Thursday: true,\n Friday: true,\n Saturday: true,\n Sunday: true,\n },\n startDate: '',\n endDate: '',\n queryStartDate: '',\n queryEndDate: '',\n },\n },\n ];\n // Loop through all overrides and check for any matching the booking dates\n rateOverrides.forEach((override) => {\n const overrideStartDate = dayjs(override.startDate);\n const overrideEndDate = dayjs(override.endDate);\n const queryStartDate = dayjs(override.queryStartDate);\n const queryEndDate = dayjs(override.queryEndDate);\n //requestedStartDate & requestedEndDate must be in date range of override's startDate/endDate\n const requestedStartDate = originalRequestedStartDate.isBefore(overrideStartDate) ? overrideStartDate : originalRequestedStartDate;\n const requestedEndDate = originalRequestedEndDate.isAfter(overrideEndDate) ? overrideEndDate : originalRequestedEndDate;\n const overlap = this.datesOverlap(requestedStartDate, requestedEndDate, queryStartDate, queryEndDate);\n if (overlap) {\n if (requestedStartDate.isBefore(queryStartDate, 'date')) {\n if (queryEndDate.isBefore(requestedEndDate, 'date')) {\n displayRates.push({\n override: override,\n name: override.name,\n shortDescription: override.shortDescription,\n longDescription: override.longDescription,\n startDate: queryStartDate,\n endDate: queryEndDate,\n });\n } else {\n displayRates.push({\n override: override,\n name: override.name,\n shortDescription: override.shortDescription,\n longDescription: override.longDescription,\n startDate: queryStartDate,\n endDate: requestedEndDate,\n });\n }\n } else {\n if (queryEndDate.isBefore(requestedEndDate, 'date')) {\n displayRates.push({\n override: override,\n name: override.name,\n shortDescription: override.shortDescription,\n longDescription: override.longDescription,\n startDate: requestedStartDate,\n endDate: queryEndDate,\n });\n } else {\n displayRates.push({\n override: override,\n name: override.name,\n shortDescription: override.shortDescription,\n longDescription: override.longDescription,\n startDate: requestedStartDate,\n endDate: requestedEndDate,\n });\n }\n }\n }\n });\n\n return displayRates;\n };\n\n public displayRateToDayLabel = (displayRate: DisplayRate): string => {\n if (!displayRate.startDate || !displayRate.endDate) return '';\n\n const dayDayLabels: Record<string, string> = {};\n const startDayLabel = displayRate.startDate.format('MMM DD, YYYY');\n const endDayLabel = displayRate.endDate.format('MMM DD, YYYY');\n dayDayLabels[startDayLabel] = startDayLabel;\n dayDayLabels[endDayLabel] = endDayLabel;\n return `${Object.values(dayDayLabels).join(' - ')}`;\n };\n\n public displayRateToDayName = (displayRate: DisplayRate): string => {\n if (!displayRate.startDate || !displayRate.endDate) return '';\n\n const dayNames: Record<string, string> = {};\n const startDayName = displayRate.startDate.format('dddd');\n const endDayName = displayRate.endDate.format('dddd');\n dayNames[startDayName] = startDayName;\n dayNames[endDayName] = endDayName;\n return `${Object.values(dayNames).join(' - ')}`;\n };\n\n public getLabelsByDate = (requestedDate: RequestedDate): { label: string; alternateLabel: string; shortDescription?: string; longDescription?: string }[] => {\n const overrides: RateOverride[] = this.getAvailableRateOverrides();\n if (!overrides.length) {\n // If overrides are null or empty, return an empty rateLabelByDay for the whole date range\n return this.getDefaultLabelsByDate(requestedDate);\n }\n\n const labelsByDate: Record<string, { label: string; alternateLabel: string; shortDescription?: string; longDescription?: string; date: string }> = {};\n let dayOneOverride: RateOverride | null = null;\n\n overrides.forEach((override) => {\n const overrideStartDate = dayjs(override.startDate);\n const overrideEndDate = dayjs(override.endDate);\n const overrideQueryStartDate = dayjs(override.queryStartDate);\n const overrideQueryEndDate = dayjs(override.queryEndDate);\n\n const isApplicableForStayDate = () => {\n if (overrideStartDate && overrideStartDate.isAfter(stayDate)) {\n return false;\n }\n\n if (overrideEndDate && overrideEndDate.isBefore(stayDate)) {\n return false;\n }\n\n if (overrideQueryStartDate && overrideQueryStartDate.isAfter(stayDate)) {\n return false;\n }\n\n if (overrideQueryEndDate && overrideQueryEndDate.isBefore(stayDate)) {\n return false;\n }\n\n return true;\n };\n\n let stayDate = requestedDate.startDate.clone();\n while (stayDate.isSameOrBefore(requestedDate.endDate, 'date')) {\n const dayIndex = stayDate.format('YYYY-MM-DD');\n const dayLabel = stayDate.format('dddd, MMM DD, YYYY');\n const stayDay = stayDate.format('dddd');\n //stayDate must be in date range of override's startDate/endDate and queryStartDate/queryEndDate\n if (isApplicableForStayDate()) {\n if (override.enabledPerDay[stayDay as keyof RateLabelsByDay] === true) {\n // Keep setting the dayOneOverride until the first day of the stay is reached, this will tell us\n // what is the initial rate label for the stay\n if (stayDate.isSame(requestedDate.startDate, 'date')) {\n dayOneOverride = override;\n }\n\n labelsByDate[dayIndex] = {\n label: dayLabel,\n date: dayIndex,\n alternateLabel: override.name,\n shortDescription: override.shortDescription,\n longDescription: override.longDescription,\n };\n }\n } else if (!labelsByDate[dayIndex]?.label) {\n // No rate label override\n labelsByDate[dayIndex] = {\n label: dayLabel,\n date: dayIndex,\n alternateLabel: '',\n };\n }\n\n if (dayOneOverride === override) {\n // If the first day of the stay is an override, the user thinks all dates are the same, so we\n // need to remove the override from this day, and specify the default for the remaining empty days.\n\n if (labelsByDate[dayIndex]?.label === dayLabel && labelsByDate[dayIndex]?.alternateLabel === override.name) {\n labelsByDate[dayIndex] = {\n label: dayLabel,\n date: dayIndex,\n alternateLabel: '',\n shortDescription: '',\n longDescription: '',\n };\n } else if (labelsByDate[dayIndex]?.alternateLabel === '') {\n labelsByDate[dayIndex] = {\n label: dayLabel,\n date: dayIndex,\n alternateLabel: this.name,\n shortDescription: this.description,\n longDescription: this.longDescription,\n };\n }\n }\n\n // If label dates aren't populated, they're the originl rate labels.\n if (!labelsByDate[dayIndex]?.label) {\n labelsByDate[dayIndex] = {\n label: dayLabel,\n date: dayIndex,\n alternateLabel: dayOneOverride === override ? this.name : '',\n shortDescription: this.description,\n longDescription: this.longDescription,\n };\n }\n\n stayDate = stayDate.add(1, 'day');\n }\n });\n\n return Object.values(labelsByDate).sort((a, b) => {\n return a.date > b.date ? 1 : -1;\n });\n };\n}\n"]}
1
+ {"version":3,"file":"RoomRate.js","sourceRoot":"/","sources":["src/models/Room/RoomRate.ts"],"names":[],"mappings":";;;;;;AAAA,kDAAqC;AAErC,4EAAoD;AACpD,sCAAiH;AAEjH,gFAA4E;AAG5E,8FAAsE;AACtE,yCAA6D;AAE7D,IAAY,sBAKX;AALD,WAAY,sBAAsB;IAC9B,yDAA+B,CAAA;IAC/B,2DAAiC,CAAA;IACjC,4EAAkD,CAAA;IAClD,4EAAkD,CAAA;AACtD,CAAC,EALW,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QAKjC;AA+DD,MAAa,QAAQ;IA+BjB;QAdO,kBAAa,GAIhB;YACA,SAAS,EAAE,KAAK;YAChB,KAAK,EAAE,KAAK;YACZ,MAAM,EAAE,KAAK;SAChB,CAAC;QA8DK,kBAAa,GAAG,CAAC,OAAO,GAAG,KAAK,EAAE,EAAE;YACvC,IAAI,KAAK,GAAG,CAAC,CAAC;YACd,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YACrD,aAAa,CAAC,OAAO,CAAC,CAAC,KAAoB,EAAE,EAAE;gBAC3C,KAAK,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACxD,CAAC,CAAC,CAAC;YACH,OAAO,KAAK,CAAC;QACjB,CAAC,CAAC;QAEK,gCAA2B,GAAG,CAAC,OAAO,GAAG,KAAK,EA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,GAAG,gBAAgB,CAAC;QACzC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,UAAU,GAAG,sBAAsB,CAAC;QACzC,IAAI,CAAC,eAAe,GAAG,EAAE,CAAC;QAC1B,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC;QACxC,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QAEzC,OAAO,IAAI,CAAC;IAChB,CAAC;CAkWJ;AAlmBD,4BAkmBC","sourcesContent":["import dayjs, { Dayjs } from 'dayjs';\n\nimport AvailabilityAPI from '@/api/AvailabilityAPI';\nimport { accumulateFees, feeMapToArray, HotelFee, ItemisedFee, mapSimpleFeesToItemisedFees } from '@/models/Fee';\nimport type { Room } from '@/models/Room/Room';\nimport RoomRateNight, { IRoomRateNight } from '@/models/Room/RoomRateNight';\nimport type RoomRateSortable from '@/models/Room/RoomRateSortable';\nimport type { Serializable } from '@/models/Serializable';\nimport StaticContextProvider from '@/providers/StaticContextProvider';\nimport { EGuaranteePolicyDepositMode } from '@roomstay/core';\n\nexport enum RoomRatePriceInclusion {\n ExcludingFees = 'Fees Excluded',\n ExcludingTaxes = 'Taxes Excluded',\n ExcludingFeesAndTaxes = 'Excluding Fees and Taxes',\n IncludingFeesAndTaxes = 'Including Fees and Taxes',\n}\n\nexport interface IRoomRate {\n name: string;\n code: string;\n description: string;\n longDescription?: string;\n\n isMemberOnly?: boolean;\n guaranteeCode: string;\n cancelPolicyCode: string;\n nightRates: { [date: string]: IRoomRateNight };\n\n lowestPrice: number;\n promoCode: string;\n promoCodeName: string;\n\n mealsIncluded?: {\n breakfast: boolean;\n lunch: boolean;\n dinner: boolean;\n };\n rateOverrides?: RateOverride[];\n nightsToDiscount?: number;\n}\n\nexport type RateLabelsByDay = {\n Monday: boolean;\n Tuesday: boolean;\n Wednesday: boolean;\n Thursday: boolean;\n Friday: boolean;\n Saturday: boolean;\n Sunday: boolean;\n};\n\nexport type RateOverride = {\n name: string;\n shortDescription: string;\n longDescription: string;\n enabledPerDay: RateLabelsByDay;\n startDate: string;\n endDate: string;\n queryStartDate: string;\n queryEndDate: string;\n};\n\nexport type RateOverrideKeys = 'name' | 'shortDescription' | 'longDescription';\n\ninterface RequestedDate {\n startDate: Dayjs;\n endDate: Dayjs;\n}\n\ninterface DisplayRate {\n name: string;\n shortDescription: string;\n longDescription: string;\n startDate?: Dayjs;\n endDate?: Dayjs;\n override: RateOverride;\n}\n\nexport class RoomRate implements RoomRateSortable, Serializable<RoomRate, IRoomRate> {\n public name!: string;\n public code!: string;\n\n public description!: string;\n public longDescription!: string;\n\n public isMemberOnly!: boolean;\n\n public guaranteeCode!: string;\n\n public cancelPolicyCode!: string;\n\n public nightRates: { [date: string]: RoomRateNight };\n public lowestPrice!: number;\n public promoCode?: string;\n public promoCodeName?: string;\n public mealsIncluded?: {\n breakfast: boolean;\n lunch: boolean;\n dinner: boolean;\n } = {\n breakfast: false,\n lunch: false,\n dinner: false,\n };\n private nightRatesArray: RoomRateNight[];\n private room!: Room;\n public rateOverrides?: RateOverride[];\n public nightsToDiscount?: number;\n\n public constructor() {\n this.nightRates = {};\n this.nightRatesArray = [];\n }\n\n public static fromData(data: Partial<{ code: string }> | any) {\n const rate = new this();\n\n rate.applyData(data);\n\n if (StaticContextProvider.MemberOnlyRateCodes?.includes(data.code)) {\n rate.isMemberOnly = true;\n }\n\n return rate;\n }\n\n public applyData(data: any) {\n Object.keys(data).map((key: any) => {\n (this as any)[key] = (data as any)[key];\n }, this);\n }\n\n public setRoom(room: Room) {\n this.room = room;\n }\n\n public getRoom(): Room {\n return this.room;\n }\n\n /**\n * Do not use this method if RMS deposit quotes are enabled.\n */\n public getDepositAccordingToGuaranteePolicy(bookingRateFees: number) {\n const depositPercentage = this.getGuaranteePolicy().depositPercentage;\n const nightsAsArray = this.getNightRateArray();\n const totalPriceIncludingAllFees = this.getTotalPrice() + bookingRateFees;\n\n switch (this.getGuaranteePolicy().depositMode) {\n case EGuaranteePolicyDepositMode.None:\n return 0;\n case EGuaranteePolicyDepositMode.Full:\n return totalPriceIncludingAllFees;\n case EGuaranteePolicyDepositMode.Percentage:\n if (depositPercentage) {\n return totalPriceIncludingAllFees * (depositPercentage / 100);\n }\n return totalPriceIncludingAllFees;\n case EGuaranteePolicyDepositMode.FirstNight:\n return Number(nightsAsArray[0].total) + bookingRateFees / nightsAsArray.length;\n case null:\n throw Error('Cannot calculate deposit without a deposit mode');\n }\n }\n\n public getTotalPrice = (getCost = false) => {\n let total = 0;\n const nightsAsArray = Object.values(this.nightRates);\n nightsAsArray.forEach((night: RoomRateNight) => {\n total += Number(getCost ? night.cost : night.total);\n });\n return total;\n };\n\n public getTotalPriceBeforeDiscount = (getCost = false) => {\n let total = 0;\n const nightsAsArray = Object.values(this.nightRates);\n nightsAsArray.forEach((night: RoomRateNight) => {\n total += Number(getCost ? night.cost : night.total) + Number(night.discount);\n });\n return total;\n };\n\n public getTotalDiscount = (): number => {\n return this.nightRateTotal((night: RoomRateNight) => {\n return Number(night.discount);\n });\n };\n\n public isStayXPayYRate = (): boolean => {\n return !!(this.nightsToDiscount && this.nightsToDiscount > 0);\n };\n\n public getAveragePrice = (getCost = false): number => {\n const total = this.getTotalPrice(getCost);\n\n return total / Object.keys(this.nightRates).length;\n };\n\n public getAveragePriceBeforeDiscount = (getCost = false) => {\n let total = 0;\n const nightsAsArray = Object.values(this.nightRates);\n nightsAsArray.forEach((night: RoomRateNight) => {\n total += Number(getCost ? night.cost : night.total) + Number(night.discount);\n });\n\n return total / nightsAsArray.length;\n };\n\n public getTotalFees = () => {\n return this.nightRateTotal((night: RoomRateNight) => {\n return Number(night.fee);\n });\n };\n\n public getItemisedFees = (hotelFees: HotelFee[]): ItemisedFee[] => {\n const feeMap = new Map<HotelFee, number>();\n\n this.getNightRateArray().forEach((night) => {\n if (night.fees) {\n const fees = mapSimpleFeesToItemisedFees(night.fees, hotelFees);\n accumulateFees(feeMap, fees);\n }\n });\n\n return feeMapToArray(feeMap);\n };\n\n public getTotalTaxes = () => {\n return this.nightRateTotal((night: RoomRateNight) => {\n return Number(night.tax);\n });\n };\n\n public getPriceType = () => {\n let hasFees = false;\n let hasTax = false;\n\n Object.values(this.nightRates).forEach((night) => {\n if (night.fee && night.fee !== '0') {\n hasFees = true;\n }\n\n if (night.tax && night.tax !== '0') {\n hasTax = true;\n }\n });\n\n if (hasFees && hasTax) {\n return RoomRatePriceInclusion.ExcludingFeesAndTaxes;\n } else if (hasFees) {\n return RoomRatePriceInclusion.ExcludingTaxes;\n } else if (hasTax) {\n return RoomRatePriceInclusion.ExcludingFees;\n } else {\n return RoomRatePriceInclusion.IncludingFeesAndTaxes;\n }\n };\n\n public getGuaranteePolicy = () => {\n return AvailabilityAPI.policyMappings.guarantee[this.guaranteeCode] ?? '';\n };\n\n public getCancellationPolicy = () => {\n return AvailabilityAPI.policyMappings.cancel[this.cancelPolicyCode] ?? '';\n };\n\n public getPriceSortValue = () => {\n return this.getAveragePrice();\n };\n\n /**\n * Not implemented\n */\n public getRecommendedSortValue() {\n return 0;\n }\n\n public serialize() {\n const serializedNightRates: any = {};\n Object.keys(this.nightRates).forEach((date) => {\n serializedNightRates[date] = this.nightRates[date].serialize();\n });\n\n const toSerialize: IRoomRate = {\n name: this.name,\n code: this.code,\n description: this.description,\n longDescription: this.longDescription,\n isMemberOnly: this.isMemberOnly,\n guaranteeCode: this.guaranteeCode,\n cancelPolicyCode: this.cancelPolicyCode,\n nightRates: serializedNightRates,\n lowestPrice: this.lowestPrice,\n promoCode: this.promoCode,\n promoCodeName: this.promoCodeName,\n mealsIncluded: this.mealsIncluded,\n rateOverrides: this.rateOverrides,\n nightsToDiscount: this.nightsToDiscount,\n } as IRoomRate;\n\n return toSerialize;\n }\n\n public unSerialize(data: IRoomRate) {\n const { name, code, description, longDescription, isMemberOnly, guaranteeCode, cancelPolicyCode, lowestPrice, promoCode, promoCodeName, mealsIncluded, nightsToDiscount } =\n data;\n\n const unSerializedNightRates: any = {};\n\n if (data.nightRates) {\n Object.keys(data.nightRates)?.forEach((date) => {\n const nightRate = new RoomRateNight();\n unSerializedNightRates[date] = nightRate.unSerialize(data.nightRates[date]);\n });\n }\n\n this.name = name;\n this.code = code;\n this.description = description;\n this.longDescription = longDescription as string;\n this.isMemberOnly = isMemberOnly as boolean;\n this.guaranteeCode = guaranteeCode;\n this.cancelPolicyCode = cancelPolicyCode;\n this.lowestPrice = lowestPrice;\n this.promoCode = promoCode;\n this.promoCodeName = promoCodeName;\n this.mealsIncluded = mealsIncluded;\n this.nightRates = unSerializedNightRates;\n this.nightRatesArray = [];\n this.rateOverrides = data.rateOverrides;\n this.nightsToDiscount = nightsToDiscount;\n\n return this;\n }\n\n private getNightRateArray = () => {\n if (!this.nightRatesArray.length) {\n this.nightRatesArray = Object.values(this.nightRates);\n }\n\n return this.nightRatesArray;\n };\n\n private reduceNightData = (reducer: (sum: number, rate: RoomRateNight) => number) => {\n return this.getNightRateArray().reduce<number>(reducer, 0) ?? 0;\n };\n\n private nightRateTotal = (value: (rate: RoomRateNight) => number) => {\n return this.reduceNightData((sum: number, redNight: RoomRateNight) => {\n const summingValue = value(redNight);\n\n return sum ? sum + summingValue : summingValue;\n });\n };\n\n public datesOverlap = (startDate1: Dayjs, endDate1: Dayjs, startDate2: Dayjs, endDate2: Dayjs): boolean => {\n const overlap1 = startDate1.isSameOrBefore(endDate2) && startDate2.isSameOrBefore(endDate1);\n const overlap2 = startDate1.isSameOrAfter(endDate2) && startDate2.isSameOrAfter(endDate1);\n return overlap1 || overlap2;\n };\n\n public getDefaultLabelsByDate = (requestedDate: RequestedDate) => {\n const days: { label: string; alternateLabel: string }[] = [];\n let currentDate = requestedDate.startDate.clone();\n while (currentDate.isSameOrBefore(requestedDate.endDate)) {\n days.push({\n label: currentDate.format('dddd, MMM DD, YYYY'),\n alternateLabel: '', // No rate label available\n });\n currentDate = currentDate.add(1, 'day');\n }\n return days;\n };\n\n public getPossiblyOverwrittenDetails = (requestedDate: RequestedDate) => {\n const rateOverrides: RateOverride[] = this.getAvailableRateOverrides();\n if (!rateOverrides.length) return { name: this.name, shortDescription: this.description, longDescription: this.longDescription };\n\n const originalRequestedStartDate = requestedDate.startDate;\n\n let shortDescription = this.description;\n let longDescription = this.longDescription;\n let name = this.name;\n\n // Loop through all overrides and check for any matching the booking dates\n rateOverrides.forEach((override) => {\n if (!originalRequestedStartDate) return;\n\n const queryStartDate = dayjs(override.queryStartDate);\n const queryEndDate = dayjs(override.queryEndDate);\n\n const overlap =\n (!override.queryStartDate || queryStartDate.isSameOrBefore(originalRequestedStartDate, 'date')) &&\n (!override.queryEndDate || queryEndDate.isSameOrAfter(originalRequestedStartDate, 'date'));\n\n const stayDay = originalRequestedStartDate.format('dddd');\n\n if (overlap && override.enabledPerDay[stayDay as keyof RateLabelsByDay] === true) {\n name = override.name;\n shortDescription = override.shortDescription;\n longDescription = override.longDescription;\n }\n });\n\n return { name, shortDescription, longDescription };\n };\n\n public getAvailableRateOverrides = (): RateOverride[] => {\n if (!this.rateOverrides?.length) return [];\n\n const now = dayjs();\n //startDate/endDate/queryStartDate/queryEndDate must not empty\n const rateOverrides: RateOverride[] = this.rateOverrides.filter((override) => {\n // Check if the override can apply to this query in current time.\n // We don't require any of the filter fields, so if they are set we should check that they apply.\n if (override.startDate) {\n if (!dayjs(override.startDate).isSameOrBefore(now)) {\n return false;\n }\n\n if (override.endDate && !dayjs(override.endDate).isSameOrAfter(now)) {\n return false;\n }\n }\n\n return true;\n });\n return rateOverrides;\n };\n\n public hasRateVariesByDay = (requestedDate: RequestedDate): boolean => {\n // Validate startDate/endDate\n if (!requestedDate?.startDate || !requestedDate.endDate) return false;\n\n const rateOverrides: RateOverride[] = this.getAvailableRateOverrides();\n if (!rateOverrides.length) false;\n\n const originalRequestedStartDate = dayjs(requestedDate.startDate);\n const originalRequestedEndDate = dayjs(requestedDate.endDate);\n\n // Loop through all overrides and check for any matching the booking dates\n return rateOverrides.some((override) => {\n const overrideStartDate = dayjs(override.startDate);\n const overrideEndDate = dayjs(override.endDate);\n const queryStartDate = dayjs(override.queryStartDate);\n const queryEndDate = dayjs(override.queryEndDate);\n\n if (override.startDate && overrideStartDate.isAfter(originalRequestedEndDate)) {\n return false;\n }\n\n if (override.endDate && overrideEndDate.isBefore(originalRequestedStartDate)) {\n return false;\n }\n\n if (override.queryStartDate && queryStartDate.isAfter(originalRequestedEndDate)) {\n return false;\n }\n if (override.queryEndDate && queryEndDate.isBefore(originalRequestedStartDate)) {\n return false;\n }\n\n return true;\n });\n };\n\n public getDisplayRates = (requestedDate: RequestedDate): DisplayRate[] => {\n const rateOverrides: RateOverride[] = this.getAvailableRateOverrides();\n if (!rateOverrides.length) return [];\n\n const originalRequestedStartDate = dayjs(requestedDate.startDate);\n const originalRequestedEndDate = dayjs(requestedDate.endDate);\n\n const displayRates: DisplayRate[] = [\n {\n name: this.name,\n shortDescription: this.description,\n longDescription: this.longDescription,\n override: {\n name: this.name,\n shortDescription: this.description,\n longDescription: this.longDescription,\n enabledPerDay: {\n Monday: true,\n Tuesday: true,\n Wednesday: true,\n Thursday: true,\n Friday: true,\n Saturday: true,\n Sunday: true,\n },\n startDate: '',\n endDate: '',\n queryStartDate: '',\n queryEndDate: '',\n },\n },\n ];\n // Loop through all overrides and check for any matching the booking dates\n rateOverrides.forEach((override) => {\n const overrideStartDate = dayjs(override.startDate);\n const overrideEndDate = dayjs(override.endDate);\n const queryStartDate = dayjs(override.queryStartDate);\n const queryEndDate = dayjs(override.queryEndDate);\n //requestedStartDate & requestedEndDate must be in date range of override's startDate/endDate\n const requestedStartDate = originalRequestedStartDate.isBefore(overrideStartDate) ? overrideStartDate : originalRequestedStartDate;\n const requestedEndDate = originalRequestedEndDate.isAfter(overrideEndDate) ? overrideEndDate : originalRequestedEndDate;\n const overlap = this.datesOverlap(requestedStartDate, requestedEndDate, queryStartDate, queryEndDate);\n if (overlap) {\n if (requestedStartDate.isBefore(queryStartDate, 'date')) {\n if (queryEndDate.isBefore(requestedEndDate, 'date')) {\n displayRates.push({\n override: override,\n name: override.name,\n shortDescription: override.shortDescription,\n longDescription: override.longDescription,\n startDate: queryStartDate,\n endDate: queryEndDate,\n });\n } else {\n displayRates.push({\n override: override,\n name: override.name,\n shortDescription: override.shortDescription,\n longDescription: override.longDescription,\n startDate: queryStartDate,\n endDate: requestedEndDate,\n });\n }\n } else {\n if (queryEndDate.isBefore(requestedEndDate, 'date')) {\n displayRates.push({\n override: override,\n name: override.name,\n shortDescription: override.shortDescription,\n longDescription: override.longDescription,\n startDate: requestedStartDate,\n endDate: queryEndDate,\n });\n } else {\n displayRates.push({\n override: override,\n name: override.name,\n shortDescription: override.shortDescription,\n longDescription: override.longDescription,\n startDate: requestedStartDate,\n endDate: requestedEndDate,\n });\n }\n }\n }\n });\n\n return displayRates;\n };\n\n public displayRateToDayLabel = (displayRate: DisplayRate): string => {\n if (!displayRate.startDate || !displayRate.endDate) return '';\n\n const dayDayLabels: Record<string, string> = {};\n const startDayLabel = displayRate.startDate.format('MMM DD, YYYY');\n const endDayLabel = displayRate.endDate.format('MMM DD, YYYY');\n dayDayLabels[startDayLabel] = startDayLabel;\n dayDayLabels[endDayLabel] = endDayLabel;\n return `${Object.values(dayDayLabels).join(' - ')}`;\n };\n\n public displayRateToDayName = (displayRate: DisplayRate): string => {\n if (!displayRate.startDate || !displayRate.endDate) return '';\n\n const dayNames: Record<string, string> = {};\n const startDayName = displayRate.startDate.format('dddd');\n const endDayName = displayRate.endDate.format('dddd');\n dayNames[startDayName] = startDayName;\n dayNames[endDayName] = endDayName;\n return `${Object.values(dayNames).join(' - ')}`;\n };\n\n public getLabelsByDate = (requestedDate: RequestedDate): { label: string; alternateLabel: string; shortDescription?: string; longDescription?: string }[] => {\n const overrides: RateOverride[] = this.getAvailableRateOverrides();\n if (!overrides.length) {\n // If overrides are null or empty, return an empty rateLabelByDay for the whole date range\n return this.getDefaultLabelsByDate(requestedDate);\n }\n\n const labelsByDate: Record<string, { label: string; alternateLabel: string; shortDescription?: string; longDescription?: string; date: string }> = {};\n let dayOneOverride: RateOverride | null = null;\n\n overrides.forEach((override) => {\n const overrideStartDate = dayjs(override.startDate);\n const overrideEndDate = dayjs(override.endDate);\n const overrideQueryStartDate = dayjs(override.queryStartDate);\n const overrideQueryEndDate = dayjs(override.queryEndDate);\n\n const isApplicableForStayDate = () => {\n if (overrideStartDate && overrideStartDate.isAfter(stayDate)) {\n return false;\n }\n\n if (overrideEndDate && overrideEndDate.isBefore(stayDate)) {\n return false;\n }\n\n if (overrideQueryStartDate && overrideQueryStartDate.isAfter(stayDate)) {\n return false;\n }\n\n if (overrideQueryEndDate && overrideQueryEndDate.isBefore(stayDate)) {\n return false;\n }\n\n return true;\n };\n\n let stayDate = requestedDate.startDate.clone();\n while (stayDate.isSameOrBefore(requestedDate.endDate, 'date')) {\n const dayIndex = stayDate.format('YYYY-MM-DD');\n const dayLabel = stayDate.format('dddd, MMM DD, YYYY');\n const stayDay = stayDate.format('dddd');\n //stayDate must be in date range of override's startDate/endDate and queryStartDate/queryEndDate\n if (isApplicableForStayDate()) {\n if (override.enabledPerDay[stayDay as keyof RateLabelsByDay] === true) {\n // Keep setting the dayOneOverride until the first day of the stay is reached, this will tell us\n // what is the initial rate label for the stay\n if (stayDate.isSame(requestedDate.startDate, 'date')) {\n dayOneOverride = override;\n }\n\n labelsByDate[dayIndex] = {\n label: dayLabel,\n date: dayIndex,\n alternateLabel: override.name,\n shortDescription: override.shortDescription,\n longDescription: override.longDescription,\n };\n }\n } else if (!labelsByDate[dayIndex]?.label) {\n // No rate label override\n labelsByDate[dayIndex] = {\n label: dayLabel,\n date: dayIndex,\n alternateLabel: '',\n };\n }\n\n if (dayOneOverride === override) {\n // If the first day of the stay is an override, the user thinks all dates are the same, so we\n // need to remove the override from this day, and specify the default for the remaining empty days.\n\n if (labelsByDate[dayIndex]?.label === dayLabel && labelsByDate[dayIndex]?.alternateLabel === override.name) {\n labelsByDate[dayIndex] = {\n label: dayLabel,\n date: dayIndex,\n alternateLabel: '',\n shortDescription: '',\n longDescription: '',\n };\n } else if (labelsByDate[dayIndex]?.alternateLabel === '') {\n labelsByDate[dayIndex] = {\n label: dayLabel,\n date: dayIndex,\n alternateLabel: this.name,\n shortDescription: this.description,\n longDescription: this.longDescription,\n };\n }\n }\n\n // If label dates aren't populated, they're the originl rate labels.\n if (!labelsByDate[dayIndex]?.label) {\n labelsByDate[dayIndex] = {\n label: dayLabel,\n date: dayIndex,\n alternateLabel: dayOneOverride === override ? this.name : '',\n shortDescription: this.description,\n longDescription: this.longDescription,\n };\n }\n\n stayDate = stayDate.add(1, 'day');\n }\n });\n\n return Object.values(labelsByDate).sort((a, b) => {\n return a.date > b.date ? 1 : -1;\n });\n };\n}\n"]}
@@ -60,7 +60,7 @@ const AccountHomePage = () => {
60
60
  react_1.default.createElement("div", { className: "u-marg-bottom--heavy u-pad-top@m" },
61
61
  react_1.default.createElement(Headline_1.default, { size: "extra-large", className: "u-marg-bottom" }, t((user === null || user === void 0 ? void 0 : user.forename) ? Translation_1.Translation.UserPortal.HomeScreen.Title : Translation_1.Translation.UserPortal.HomeScreen.TitleEmpty, { name: user === null || user === void 0 ? void 0 : user.forename })),
62
62
  hasBookings ? (react_1.default.createElement(Text_1.default, { type: Text_1.TextType.Body }, t(Translation_1.Translation.UserPortal.HomeScreen.Subtitle))) : (react_1.default.createElement(Text_1.default, { className: "u-marg-top" }, t(Translation_1.Translation.Reservation.EmptyPage.SubTitle)))),
63
- react_1.default.createElement("div", { className: "u-marg-bottom--heavy" }, hasBookings ? (react_1.default.createElement(ReservationItem_1.default, { itineraryItem: upcomingBookings === null || upcomingBookings === void 0 ? void 0 : upcomingBookings[0], defaultEventsExpanded: true })) : (react_1.default.createElement("div", { className: "u-marg-top--heavy u-flex u-flex-align-center u-flex-direction-column@l- u-flex-gap" },
63
+ react_1.default.createElement("div", { className: "u-marg-bottom--heavy" }, hasBookings ? (react_1.default.createElement(ReservationItem_1.default, { itineraryItem: upcomingBookings === null || upcomingBookings === void 0 ? void 0 : upcomingBookings[0], defaultEventsExpanded: true, navPath: AccountRoutes_1.EReservationStatusNavPath.UpcomingStays })) : (react_1.default.createElement("div", { className: "u-marg-top--heavy u-flex u-flex-align-center u-flex-direction-column@l- u-flex-gap" },
64
64
  react_1.default.createElement("div", null,
65
65
  react_1.default.createElement(EmptyGraphic_1.default, { className: "mw-100" })),
66
66
  react_1.default.createElement("div", { className: "u-marg-top--heavy@m-" },
@@ -1 +1 @@
1
- {"version":3,"file":"AccountHomePage.js","sourceRoot":"/","sources":["src/pages/account/AccountHome/AccountHomePage.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA4G;AAC5G,2CAA6D;AAC7D,+CAA0C;AAC1C,iDAAsD;AACtD,uDAAwC;AACxC,0DAAuD;AAEvD,6EAAqD;AACrD,mFAAgF;AAChF,6EAAqD;AACrD,yDAA0D;AAC1D,kEAA2D;AAC3D,sFAAsE;AACtE,+FAAuE;AACvE,iEAA8D;AAC9D,wCAAqC;AACrC,mEAA2C;AAC3C,qEAA6C;AAEtC,MAAM,eAAe,GAAG,GAAG,EAAE;IAChC,MAAM,EAAE,IAAI,EAAE,gBAAgB,EAAE,GAAG,IAAA,iBAAS,GAAE,CAAC;IAC/C,MAAM,EAAE,mCAAmC,EAAE,GAAG,IAAA,uBAAe,GAAE,CAAC;IAClE,MAAM,EAAE,CAAC,EAAE,GAAG,IAAA,8BAAc,GAAE,CAAC;IAE/B,MAAM,OAAO,GAAG,IAAA,kBAAU,EAAC,+BAAoB,CAAC,CAAC;IACjD,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,IAAI,oBAAU,CAAC,KAAK,CAAC;IAExD,MAAM,YAAY,GAAG,qBAAW,CAAC,YAAY,EAAE,CAAC,UAAU,EAAE,C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EAAE,OAAO;wBACb,KAAK,EAAE,aAAK,CAAC,MAAM;qBACtB,GACH,CACA,CACT;YAED,uCAAK,SAAS,EAAE,UAAU,gBAAgB,EAAE;gBACxC,8BAAC,yBAAW,IACR,IAAI,EAAE,eAAQ,CAAC,YAAY,EAC3B,KAAK,EAAE,CAAC,CAAC,yBAAW,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,EAC9C,WAAW,EAAE,8BAAC,qBAAK,IAAC,OAAO,EAAE,yBAAW,CAAC,UAAU,CAAC,UAAU,CAAC,mBAAmB,EAAE,UAAU,EAAE,EAAE,CAAC,EAAE,0CAAO,EAAE,GAAI,EAClH,IAAI,EAAE;wBACF,IAAI,EAAE,aAAa;wBACnB,MAAM,EAAE,6BAAa,CAAC,IAAI,CAAC,IAAI;wBAC/B,IAAI,EAAE,OAAO;wBACb,KAAK,EAAE,aAAK,CAAC,MAAM;qBACtB,GACH,CACA,CACJ,CACJ,CACT,CAAC;AACN,CAAC,CAAC;AA5HW,QAAA,eAAe,mBA4H1B","sourcesContent":["import { BookingEngineContext, IRoomstayMemberBookingItemWithRefAndHotelDetails } from '@frontend/contexts';\nimport { useCurrentHotel, useMember } from '@frontend/hooks';\nimport React, { useContext } from 'react';\nimport { Trans, useTranslation } from 'react-i18next';\nimport { Link } from 'react-router-dom';\nimport { Translation } from 'translations/Translation';\n\nimport BEButton from '@/components/generic/BEButton';\nimport { IconNavCard } from '@/components/generic/Card/IconNavCard/IconNavCard';\nimport Headline from '@/components/generic/Headline';\nimport { IconType } from '@/components/generic/Icon/Icon';\nimport Text, { TextType } from '@/components/generic/Text';\nimport HomeEmptyReservation from '@/components/graphics/EmptyGraphic';\nimport ReservationItem from '@/components/reservation/ReservationItem';\nimport { AccountRoutes } from '@/pages/account/AccountRoutes';\nimport { Color } from '@/util/Color';\nimport ScreenSize from '@/util/ScreenSize';\nimport StepManager from '@/util/StepManager';\n\nexport const AccountHomePage = () => {\n const { user, upcomingBookings } = useMember();\n const { isMemberPaymentInformationAvailable } = useCurrentHotel();\n const { t } = useTranslation();\n\n const context = useContext(BookingEngineContext);\n const isMobile = context.screenSize <= ScreenSize.Large;\n\n const firstStepUrl = StepManager.getFirstStep().getStepUrl();\n\n const hasBookings = (upcomingBookings?.length as number) > 0;\n\n const quickLinkColSize = isMemberPaymentInformationAvailable ? 3 : 4;\n\n return (\n <div>\n <div className=\"u-marg-top--heavy@m u-marg-top@m- u-marg-bottom\">\n <Link to={StepManager.getFirstStep().getStepUrl()}>\n <BEButton isText icon={IconType.ArrowLeft} size=\"small\">\n {t(Translation.UserPortal.HomeScreen.BackToBooking)}\n </BEButton>\n </Link>\n </div>\n <div className=\"u-marg-bottom--heavy u-pad-top@m\">\n <Headline size=\"extra-large\" className=\"u-marg-bottom\">\n {t(user?.forename ? Translation.UserPortal.HomeScreen.Title : Translation.UserPortal.HomeScreen.TitleEmpty, { name: user?.forename })}\n </Headline>\n {hasBookings ? (\n <Text type={TextType.Body}>{t(Translation.UserPortal.HomeScreen.Subtitle)}</Text>\n ) : (\n <Text className=\"u-marg-top\">{t(Translation.Reservation.EmptyPage.SubTitle)}</Text>\n )}\n </div>\n\n <div className=\"u-marg-bottom--heavy\">\n {hasBookings ? (\n <ReservationItem itineraryItem={upcomingBookings?.[0] as IRoomstayMemberBookingItemWithRefAndHotelDetails} defaultEventsExpanded />\n ) : (\n <div className=\"u-marg-top--heavy u-flex u-flex-align-center u-flex-direction-column@l- u-flex-gap\">\n <div>\n <HomeEmptyReservation className=\"mw-100\" />\n </div>\n <div className=\"u-marg-top--heavy@m-\">\n <Headline size=\"large\">{t(Translation.Reservation.EmptyPage.Message)}</Headline>\n <Text color={Color.DarkGrey} type={TextType.Small} className=\"u-marg-top--light\">\n {t(Translation.Reservation.EmptyPage.SubMessage)}\n </Text>\n <div className=\"u-marg-top--heavy u-flex u-flex-flex-start u-flex-gap--light u-flex-direction-column@l-\">\n <Link to={firstStepUrl}>\n <BEButton wide={isMobile} rounded filled icon={IconType.ArrowRight} iconPosition=\"right\" primary>\n {t(Translation.Reservation.EmptyPage.SearchRooms)}\n </BEButton>\n </Link>\n {/* <Link to={AccountRoutes.Reservations.path}>\n <BEButton wide={isMobile} rounded icon={IconType.ArrowRight} iconPosition=\"right\">\n {t(Translation.Reservation.EmptyPage.SeeAll)}\n </BEButton>\n </Link> */}\n </div>\n </div>\n </div>\n )}\n </div>\n\n <div className=\"row\">\n <div className={`col-md-${quickLinkColSize}`}>\n <IconNavCard\n icon={IconType.Subtitle}\n title={t(Translation.UserPortal.HomeScreen.Bookings)}\n description={<Trans i18nKey={Translation.UserPortal.HomeScreen.BookingsDescription} components={{ 1: <div /> }} />}\n link={{\n text: 'See list',\n pathTo: AccountRoutes.Reservations.path,\n icon: 'arrow',\n color: Color.Accent,\n }}\n />\n </div>\n <div className={`col-md-${quickLinkColSize}`}>\n <IconNavCard\n icon={IconType.Person}\n title={t(Translation.Navigation.Menu.ProfileInformation)}\n description={<Trans i18nKey={Translation.UserPortal.HomeScreen.ProfileInformationDescription} components={{ 1: <div /> }} />}\n link={{\n text: 'Edit Info',\n pathTo: AccountRoutes.ProfileDetails.path,\n icon: 'arrow',\n color: Color.Accent,\n }}\n />\n </div>\n\n {isMemberPaymentInformationAvailable && (\n <div className=\"col-md-3\">\n <IconNavCard\n icon={IconType.CreditCard}\n title={t(Translation.Navigation.Menu.PaymentInformation)}\n description={<Trans i18nKey={Translation.UserPortal.HomeScreen.PaymentInformationDescription} components={{ 1: <div /> }} />}\n link={{\n text: 'Manage cards',\n pathTo: AccountRoutes.CardDetails.path,\n icon: 'arrow',\n color: Color.Accent,\n }}\n />\n </div>\n )}\n\n <div className={`col-md-${quickLinkColSize}`}>\n <IconNavCard\n icon={IconType.ProgressHelp}\n title={t(Translation.Navigation.Menu.NeedHelp)}\n description={<Trans i18nKey={Translation.UserPortal.HomeScreen.NeedHelpDescription} components={{ 1: <div /> }} />}\n link={{\n text: 'Contact now',\n pathTo: AccountRoutes.Help.path,\n icon: 'arrow',\n color: Color.Accent,\n }}\n />\n </div>\n </div>\n </div>\n );\n};\n"]}
1
+ {"version":3,"file":"AccountHomePage.js","sourceRoot":"/","sources":["src/pages/account/AccountHome/AccountHomePage.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA4G;AAC5G,2CAA6D;AAC7D,+CAA0C;AAC1C,iDAAsD;AACtD,uDAAwC;AACxC,0DAAuD;AAEvD,6EAAqD;AACrD,mFAAgF;AAChF,6EAAqD;AACrD,yDAA0D;AAC1D,kEAA2D;AAC3D,sFAAsE;AACtE,+FAAuE;AACvE,iEAAyF;AACzF,wCAAqC;AACrC,mEAA2C;AAC3C,qEAA6C;AAEtC,MAAM,eAAe,GAAG,GAAG,EAAE;IAChC,MAAM,EAAE,IAAI,EAAE,gBAAgB,EAAE,GAAG,IAAA,iBAAS,GAAE,CAAC;IAC/C,MAAM,EAAE,mCAAmC,EAAE,GAAG,IAAA,uBAAe,GAAE,CAAC;IAClE,MAAM,EAAE,CAAC,EAAE,GAAG,IAAA,8BAAc,GAAE,CAAC;IAE/B,MAAM,OAAO,GAAG,IAAA,kBAAU,EAAC,+BAAoB,CAAC,CAAC;IACjD,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,IAAI,oBAAU,CAAC,KAAK,CAAC;IAExD,MAAM,YAAY,GAAG,qBAAW,CAAC,YAAY,EAAE,CAAC,UAAU,EAAE,CAAC;IAE7D,MAAM,WAAW,GAAG,CAAC,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,MAAiB,IAAG,CAAC,CAAC;IAE7D,MAAM,gBAAgB,GAAG,mCAAmC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAErE,OAAO,CACH;QACI,uCAAK,SAAS,EAAC,iDAAiD;YAC5D,8BAAC,uBAAI,IAAC,EAAE,EAAE,qBAAW,CAAC,YAAY,EAAE,CAAC,UAAU,EAAE;gBAC7C,8BAAC,kBAA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AAC,UAAU,CAAC,UAAU,CAAC,mBAAmB,EAAE,UAAU,EAAE,EAAE,CAAC,EAAE,0CAAO,EAAE,GAAI,EAClH,IAAI,EAAE;wBACF,IAAI,EAAE,aAAa;wBACnB,MAAM,EAAE,6BAAa,CAAC,IAAI,CAAC,IAAI;wBAC/B,IAAI,EAAE,OAAO;wBACb,KAAK,EAAE,aAAK,CAAC,MAAM;qBACtB,GACH,CACA,CACJ,CACJ,CACT,CAAC;AACN,CAAC,CAAC;AAhIW,QAAA,eAAe,mBAgI1B","sourcesContent":["import { BookingEngineContext, IRoomstayMemberBookingItemWithRefAndHotelDetails } from '@frontend/contexts';\nimport { useCurrentHotel, useMember } from '@frontend/hooks';\nimport React, { useContext } from 'react';\nimport { Trans, useTranslation } from 'react-i18next';\nimport { Link } from 'react-router-dom';\nimport { Translation } from 'translations/Translation';\n\nimport BEButton from '@/components/generic/BEButton';\nimport { IconNavCard } from '@/components/generic/Card/IconNavCard/IconNavCard';\nimport Headline from '@/components/generic/Headline';\nimport { IconType } from '@/components/generic/Icon/Icon';\nimport Text, { TextType } from '@/components/generic/Text';\nimport HomeEmptyReservation from '@/components/graphics/EmptyGraphic';\nimport ReservationItem from '@/components/reservation/ReservationItem';\nimport { AccountRoutes, EReservationStatusNavPath } from '@/pages/account/AccountRoutes';\nimport { Color } from '@/util/Color';\nimport ScreenSize from '@/util/ScreenSize';\nimport StepManager from '@/util/StepManager';\n\nexport const AccountHomePage = () => {\n const { user, upcomingBookings } = useMember();\n const { isMemberPaymentInformationAvailable } = useCurrentHotel();\n const { t } = useTranslation();\n\n const context = useContext(BookingEngineContext);\n const isMobile = context.screenSize <= ScreenSize.Large;\n\n const firstStepUrl = StepManager.getFirstStep().getStepUrl();\n\n const hasBookings = (upcomingBookings?.length as number) > 0;\n\n const quickLinkColSize = isMemberPaymentInformationAvailable ? 3 : 4;\n\n return (\n <div>\n <div className=\"u-marg-top--heavy@m u-marg-top@m- u-marg-bottom\">\n <Link to={StepManager.getFirstStep().getStepUrl()}>\n <BEButton isText icon={IconType.ArrowLeft} size=\"small\">\n {t(Translation.UserPortal.HomeScreen.BackToBooking)}\n </BEButton>\n </Link>\n </div>\n <div className=\"u-marg-bottom--heavy u-pad-top@m\">\n <Headline size=\"extra-large\" className=\"u-marg-bottom\">\n {t(user?.forename ? Translation.UserPortal.HomeScreen.Title : Translation.UserPortal.HomeScreen.TitleEmpty, { name: user?.forename })}\n </Headline>\n {hasBookings ? (\n <Text type={TextType.Body}>{t(Translation.UserPortal.HomeScreen.Subtitle)}</Text>\n ) : (\n <Text className=\"u-marg-top\">{t(Translation.Reservation.EmptyPage.SubTitle)}</Text>\n )}\n </div>\n\n <div className=\"u-marg-bottom--heavy\">\n {hasBookings ? (\n <ReservationItem\n itineraryItem={upcomingBookings?.[0] as IRoomstayMemberBookingItemWithRefAndHotelDetails}\n defaultEventsExpanded\n navPath={EReservationStatusNavPath.UpcomingStays}\n />\n ) : (\n <div className=\"u-marg-top--heavy u-flex u-flex-align-center u-flex-direction-column@l- u-flex-gap\">\n <div>\n <HomeEmptyReservation className=\"mw-100\" />\n </div>\n <div className=\"u-marg-top--heavy@m-\">\n <Headline size=\"large\">{t(Translation.Reservation.EmptyPage.Message)}</Headline>\n <Text color={Color.DarkGrey} type={TextType.Small} className=\"u-marg-top--light\">\n {t(Translation.Reservation.EmptyPage.SubMessage)}\n </Text>\n <div className=\"u-marg-top--heavy u-flex u-flex-flex-start u-flex-gap--light u-flex-direction-column@l-\">\n <Link to={firstStepUrl}>\n <BEButton wide={isMobile} rounded filled icon={IconType.ArrowRight} iconPosition=\"right\" primary>\n {t(Translation.Reservation.EmptyPage.SearchRooms)}\n </BEButton>\n </Link>\n {/* <Link to={AccountRoutes.Reservations.path}>\n <BEButton wide={isMobile} rounded icon={IconType.ArrowRight} iconPosition=\"right\">\n {t(Translation.Reservation.EmptyPage.SeeAll)}\n </BEButton>\n </Link> */}\n </div>\n </div>\n </div>\n )}\n </div>\n\n <div className=\"row\">\n <div className={`col-md-${quickLinkColSize}`}>\n <IconNavCard\n icon={IconType.Subtitle}\n title={t(Translation.UserPortal.HomeScreen.Bookings)}\n description={<Trans i18nKey={Translation.UserPortal.HomeScreen.BookingsDescription} components={{ 1: <div /> }} />}\n link={{\n text: 'See list',\n pathTo: AccountRoutes.Reservations.path,\n icon: 'arrow',\n color: Color.Accent,\n }}\n />\n </div>\n <div className={`col-md-${quickLinkColSize}`}>\n <IconNavCard\n icon={IconType.Person}\n title={t(Translation.Navigation.Menu.ProfileInformation)}\n description={<Trans i18nKey={Translation.UserPortal.HomeScreen.ProfileInformationDescription} components={{ 1: <div /> }} />}\n link={{\n text: 'Edit Info',\n pathTo: AccountRoutes.ProfileDetails.path,\n icon: 'arrow',\n color: Color.Accent,\n }}\n />\n </div>\n\n {isMemberPaymentInformationAvailable && (\n <div className=\"col-md-3\">\n <IconNavCard\n icon={IconType.CreditCard}\n title={t(Translation.Navigation.Menu.PaymentInformation)}\n description={<Trans i18nKey={Translation.UserPortal.HomeScreen.PaymentInformationDescription} components={{ 1: <div /> }} />}\n link={{\n text: 'Manage cards',\n pathTo: AccountRoutes.CardDetails.path,\n icon: 'arrow',\n color: Color.Accent,\n }}\n />\n </div>\n )}\n\n <div className={`col-md-${quickLinkColSize}`}>\n <IconNavCard\n icon={IconType.ProgressHelp}\n title={t(Translation.Navigation.Menu.NeedHelp)}\n description={<Trans i18nKey={Translation.UserPortal.HomeScreen.NeedHelpDescription} components={{ 1: <div /> }} />}\n link={{\n text: 'Contact now',\n pathTo: AccountRoutes.Help.path,\n icon: 'arrow',\n color: Color.Accent,\n }}\n />\n </div>\n </div>\n </div>\n );\n};\n"]}
@@ -23,3 +23,8 @@ export declare const AccountRoutes: {
23
23
  path: string;
24
24
  };
25
25
  };
26
+ export declare enum EReservationStatusNavPath {
27
+ UpcomingStays = "upcoming-stays",
28
+ PastStays = "past-stays",
29
+ CancelledStays = "cancelled-stays"
30
+ }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AccountRoutes = void 0;
3
+ exports.EReservationStatusNavPath = exports.AccountRoutes = void 0;
4
4
  exports.AccountRoutes = {
5
5
  Home: {
6
6
  path: '/account/home',
@@ -10,7 +10,7 @@ exports.AccountRoutes = {
10
10
  path: '/account/reservations',
11
11
  },
12
12
  SingleReservation: {
13
- matchPath: '/account/reservations/:resId/item',
13
+ matchPath: '/account/reservations/:navPath/:resId/item',
14
14
  path: '/account/reservations/',
15
15
  },
16
16
  ProfileDetails: {
@@ -26,4 +26,10 @@ exports.AccountRoutes = {
26
26
  path: '/account/details/change-password',
27
27
  },
28
28
  };
29
+ var EReservationStatusNavPath;
30
+ (function (EReservationStatusNavPath) {
31
+ EReservationStatusNavPath["UpcomingStays"] = "upcoming-stays";
32
+ EReservationStatusNavPath["PastStays"] = "past-stays";
33
+ EReservationStatusNavPath["CancelledStays"] = "cancelled-stays";
34
+ })(EReservationStatusNavPath = exports.EReservationStatusNavPath || (exports.EReservationStatusNavPath = {}));
29
35
  //# sourceMappingURL=AccountRoutes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AccountRoutes.js","sourceRoot":"/","sources":["src/pages/account/AccountRoutes.ts"],"names":[],"mappings":";;;AAAa,QAAA,aAAa,GAAG;IACzB,IAAI,EAAE;QACF,IAAI,EAAE,eAAe;KACxB;IACD,YAAY,EAAE;QACV,SAAS,EAAE,yBAAyB;QACpC,IAAI,EAAE,uBAAuB;KAChC;IACD,iBAAiB,EAAE;QACf,SAAS,EAAE,mCAAmC;QAC9C,IAAI,EAAE,wBAAwB;KACjC;IACD,cAAc,EAAE;QACZ,IAAI,EAAE,0BAA0B;KACnC;IACD,WAAW,EAAE;QACT,IAAI,EAAE,wBAAwB;KACjC;IACD,IAAI,EAAE;QACF,IAAI,EAAE,eAAe;KACxB;IACD,cAAc,EAAE;QACZ,IAAI,EAAE,kCAAkC;KAC3C;CACJ,CAAC","sourcesContent":["export const AccountRoutes = {\n Home: {\n path: '/account/home',\n },\n Reservations: {\n matchPath: '/account/reservations/*',\n path: '/account/reservations',\n },\n SingleReservation: {\n matchPath: '/account/reservations/:resId/item',\n path: '/account/reservations/',\n },\n ProfileDetails: {\n path: '/account/details/profile',\n },\n CardDetails: {\n path: '/account/details/cards',\n },\n Help: {\n path: '/account/help',\n },\n ChangePassword: {\n path: '/account/details/change-password',\n },\n};\n"]}
1
+ {"version":3,"file":"AccountRoutes.js","sourceRoot":"/","sources":["src/pages/account/AccountRoutes.ts"],"names":[],"mappings":";;;AAAa,QAAA,aAAa,GAAG;IACzB,IAAI,EAAE;QACF,IAAI,EAAE,eAAe;KACxB;IACD,YAAY,EAAE;QACV,SAAS,EAAE,yBAAyB;QACpC,IAAI,EAAE,uBAAuB;KAChC;IACD,iBAAiB,EAAE;QACf,SAAS,EAAE,4CAA4C;QACvD,IAAI,EAAE,wBAAwB;KACjC;IACD,cAAc,EAAE;QACZ,IAAI,EAAE,0BAA0B;KACnC;IACD,WAAW,EAAE;QACT,IAAI,EAAE,wBAAwB;KACjC;IACD,IAAI,EAAE;QACF,IAAI,EAAE,eAAe;KACxB;IACD,cAAc,EAAE;QACZ,IAAI,EAAE,kCAAkC;KAC3C;CACJ,CAAC;AAEF,IAAY,yBAIX;AAJD,WAAY,yBAAyB;IACjC,6DAAgC,CAAA;IAChC,qDAAwB,CAAA;IACxB,+DAAkC,CAAA;AACtC,CAAC,EAJW,yBAAyB,GAAzB,iCAAyB,KAAzB,iCAAyB,QAIpC","sourcesContent":["export const AccountRoutes = {\n Home: {\n path: '/account/home',\n },\n Reservations: {\n matchPath: '/account/reservations/*',\n path: '/account/reservations',\n },\n SingleReservation: {\n matchPath: '/account/reservations/:navPath/:resId/item',\n path: '/account/reservations/',\n },\n ProfileDetails: {\n path: '/account/details/profile',\n },\n CardDetails: {\n path: '/account/details/cards',\n },\n Help: {\n path: '/account/help',\n },\n ChangePassword: {\n path: '/account/details/change-password',\n },\n};\n\nexport enum EReservationStatusNavPath {\n UpcomingStays = 'upcoming-stays',\n PastStays = 'past-stays',\n CancelledStays = 'cancelled-stays',\n}\n"]}
@@ -53,6 +53,7 @@ const hooks_1 = require("../../../hooks");
53
53
  const LoggedInUserHook_1 = require("../../../hooks/LoggedInUserHook");
54
54
  const ModifyBookingFeature_1 = __importDefault(require("../../../providers/feature/ModifyBookingFeature"));
55
55
  const Color_1 = require("../../../util/Color");
56
+ const DataLayer_1 = __importDefault(require("../../../util/DataLayer"));
56
57
  const ScreenSize_1 = __importDefault(require("../../../util/ScreenSize"));
57
58
  const StringHelper_1 = __importDefault(require("../../../util/StringHelper"));
58
59
  const AccountRoutes_1 = require("../AccountRoutes");
@@ -76,16 +77,27 @@ const CancelReservationModal = (props) => {
76
77
  const { t } = (0, react_i18next_1.useTranslation)();
77
78
  const [isLoading, setIsLoading] = (0, react_1.useState)(false);
78
79
  const onCancelClick = () => {
79
- const cancellations = [];
80
80
  setIsLoading(true);
81
- for (const item of items) {
82
- cancellations.push(BookingAPI_1.default.Reservation.cancelReservation(item.id, item.profile.email, booking.hotelId));
83
- }
84
- Promise.all(cancellations).then(() => {
81
+ const cancellations = items.map((item) => BookingAPI_1.default.Reservation.cancelReservation(item.id, item.profile.email, booking.hotelId)
82
+ .then(() => {
83
+ DataLayer_1.default.instance.sendCancellationByReservationNumber(item.id);
84
+ })
85
+ .catch((error) => {
86
+ contexts_1.ErrorHandler.add({
87
+ title: t(Translation_1.Translation.Step.Thanks.Errors.CancelFailed),
88
+ message: error.Message,
89
+ });
90
+ }));
91
+ Promise.all(cancellations)
92
+ .then(() => {
85
93
  fetchRoomstayMember === null || fetchRoomstayMember === void 0 ? void 0 : fetchRoomstayMember().then(() => {
86
94
  setIsLoading(false);
87
95
  onClose();
88
96
  });
97
+ })
98
+ .catch(() => {
99
+ // This catch only fires if Promise.all itself rejects
100
+ setIsLoading(false);
89
101
  });
90
102
  };
91
103
  const footers = (react_1.default.createElement("div", { className: "d-flex u-pad align-items-center justify-content-center" },
@@ -149,6 +161,9 @@ const AccountReservationSinglePage = () => {
149
161
  const [bookingHotel, setBookingHotel] = (0, react_1.useState)();
150
162
  const isMobile = beContext.screenSize <= ScreenSize_1.default.Medium;
151
163
  const params = (0, react_router_dom_1.useParams)();
164
+ if (!params.navPath) {
165
+ throw new Error('Missing reservation navPath parameter.');
166
+ }
152
167
  const [booking, itineraries] = (0, react_1.useMemo)(() => {
153
168
  if (!params.resId) {
154
169
  throw new Error('Missing reservation ID parameter.');
@@ -214,7 +229,7 @@ const AccountReservationSinglePage = () => {
214
229
  react_1.default.createElement("div", { className: "c-header d-inline-block" },
215
230
  react_1.default.createElement("div", { className: "c-header__logo u-flex u-flex-align-center" }, hotelImageElement))),
216
231
  react_1.default.createElement("div", { className: "u-marg-bottom--massive u-marg-bottom--none@m- u-print-marg-none u-marg-top--heavy" },
217
- react_1.default.createElement(ReservationList_1.default, { actions: [ReservationItem_1.ReservationAction.Cancel, ReservationItem_1.ReservationAction.Modify, ReservationItem_1.ReservationAction.BookAgain], reservationItems: itineraries, onActionClick: onActionClick, showCancelledNotifications: true })),
232
+ react_1.default.createElement(ReservationList_1.default, { actions: [ReservationItem_1.ReservationAction.Cancel, ReservationItem_1.ReservationAction.Modify, ReservationItem_1.ReservationAction.BookAgain], reservationItems: itineraries, onActionClick: onActionClick, showCancelledNotifications: true, navPath: params.navPath })),
218
233
  react_1.default.createElement(LineBreak_1.default, { noMargins: isMobile }),
219
234
  react_1.default.createElement("div", { className: "u-flex u-marg-top--heavy@m-" },
220
235
  react_1.default.createElement(Headline_1.default, { size: "large", bold: true }, t(Translation_1.Translation.Reservation.Total)),