Feat/LOY-400 create spend points modal * feat(LOY-400): Added custom button to my pages overview and skeleton file to custom modal for my points. * feat(LOY-400): Added custom button to my pages overview and components for custom modal for my points. * feat(LOY-400): Changed some style and infogridcardover * feat(LOY-400):Removed custom card components and changed in infoCard: Added imagePosition top, added optional height prop. In Card: Changed Text-wrap styling, added min-width styling to buttons, added optional Icon prop, added optional height prop * feat(LOY-400):Added linkList, LinkListItem component and messageBanner component. Added granola illustration. * feat(LOY-400): Removed background in several illustrations. Added component for illustration. Fixed LinkedList and styling for UsePointsButton. * feat(LOY-400): Added modal to PointsToSpendCard and fixed UsePointsButton. * fix(LOY-400):added some styling * feat(LOY-400): Linked Modal to contentstack and fetch the data in cards with UsePointsModal for now * feat(LOY-400): changed link to aria-component, cleaned up a bit * feat(LOY-400): Changed height for larger modals in mobile, fixed zod schema for no illustration input, cleaned up * fix(LOY-400): fixed graphql after rebase * fix(LOY-400): mini fix * fix(LOY-400): fixed pr-comments * fix(LOY-400): fixed some PR-comments * fix(LOY-400): fixed a PR-comment * feat(LOY-400): added size prop to ilustration in LinkListItem to be able to use illustrations in IllustrationByIconName * fix(LOY-400): fixed pr-comments * Merged in feat/LOY-402-pre-ticked-book-reward-night-in-booking-flow (pull request #3210) Feat/LOY-402 pre ticked book reward night in booking flow * feat(LOY-402): Changed UsePointsModal structure to handle button actions in card. * feat(LOY-402): added functionality for book now button * feat(LOY-400): pr comment fix * feat(LOY-402): transformed the contentstack data * fix(LOY-402): fixed pr comments Approved-by: Chuma Mcphoy (We Ahead) Approved-by: Anton Gunnarsson Approved-by: Matilda Landström * Merged in feat/LOY-404-add-tracking-for-spend-points-modal (pull request #3229) Feat/LOY-404 add tracking for spend points modal * feat(LOY-402): Changed UsePointsModal structure to handle button actions in card. * feat(LOY-402): added functionality for book now button * feat(LOY-400): pr comment fix * feat(LOY-402): transformed the contentstack data * feat(LOY-404): added tracking * fix(LOY-404): fix for session storage removal of bookNowFromPointsModal * feat(LOY-404): added consts * fix(LOY-404): moved foxusWidget const * fix(LOY-404): moved BOOKING_WIDGET_STATE const * fix(LOY-404):fix Approved-by: Matilda Landström * fix(LOY-400): some fixes * feat(LOY-400): created linkList storybook Approved-by: Chuma Mcphoy (We Ahead) Approved-by: Matilda Landström
261 lines
7.3 KiB
TypeScript
261 lines
7.3 KiB
TypeScript
import { cache } from "@/utils/cache"
|
|
|
|
import { serverClient } from "../server"
|
|
|
|
import type { Country } from "@scandic-hotels/common/constants/country"
|
|
import type { Lang } from "@scandic-hotels/common/constants/language"
|
|
import type { GetHotelsByCSFilterInput } from "@scandic-hotels/trpc/routers/hotels/input"
|
|
import type { GetSavedPaymentCardsInput } from "@scandic-hotels/trpc/routers/user/input"
|
|
import type { HotelInput } from "@scandic-hotels/trpc/types/hotel"
|
|
import type {
|
|
AncillaryPackagesInput,
|
|
PackagesInput,
|
|
} from "@scandic-hotels/trpc/types/packages"
|
|
|
|
export const getProfile = cache(async function getMemoizedProfile() {
|
|
const caller = await serverClient()
|
|
return caller.user.get()
|
|
})
|
|
|
|
export const getBasicProfile = cache(async function getMemoizedBasicProfile() {
|
|
const caller = await serverClient()
|
|
return caller.user.getBasic()
|
|
})
|
|
|
|
export const getProfileSafely = cache(
|
|
async function getMemoizedProfileSafely() {
|
|
const caller = await serverClient()
|
|
return caller.user.getSafely()
|
|
}
|
|
)
|
|
|
|
export const getProfileWithExtendedPartnerData = cache(
|
|
async function getMemoizedProfileWithPartnerData() {
|
|
const caller = await serverClient()
|
|
return caller.user.getWithExtendedPartnerData()
|
|
}
|
|
)
|
|
|
|
export const getSavedPaymentCardsSafely = cache(
|
|
async function getMemoizedSavedPaymentCardsSafely(
|
|
input: GetSavedPaymentCardsInput
|
|
) {
|
|
const caller = await serverClient()
|
|
return caller.user.safePaymentCards(input)
|
|
}
|
|
)
|
|
|
|
export const getMembershipLevel = cache(
|
|
async function getMemoizedMembershipLevel() {
|
|
const caller = await serverClient()
|
|
return caller.user.membershipLevel()
|
|
}
|
|
)
|
|
|
|
export const getMembershipLevelSafely = cache(
|
|
async function getMemoizedMembershipLevelSafely() {
|
|
const caller = await serverClient()
|
|
return caller.user.safeMembershipLevel()
|
|
}
|
|
)
|
|
|
|
export const getMembershipCards = cache(
|
|
async function getMemoizedMembershipCards() {
|
|
const caller = await serverClient()
|
|
return caller.user.membershipCards()
|
|
}
|
|
)
|
|
|
|
export const getHotelsByCSFilter = cache(async function getMemoizedHotels(
|
|
input: GetHotelsByCSFilterInput
|
|
) {
|
|
const caller = await serverClient()
|
|
return caller.hotel.hotels.byCSFilter.get(input)
|
|
})
|
|
|
|
export const getHotel = cache(async function getMemoizedHotelData(
|
|
input: HotelInput
|
|
) {
|
|
if (!input.isCardOnlyPayment) {
|
|
input.isCardOnlyPayment = false
|
|
}
|
|
const caller = await serverClient()
|
|
return caller.hotel.get(input)
|
|
})
|
|
|
|
export const getHotelPage = cache(async function getMemoizedHotelPage() {
|
|
const caller = await serverClient()
|
|
return caller.contentstack.hotelPage.get()
|
|
})
|
|
|
|
export const getFooter = cache(async function getMemoizedFooter() {
|
|
const caller = await serverClient()
|
|
return caller.contentstack.base.footer()
|
|
})
|
|
|
|
export const getHeader = cache(async function getMemoizedHeader() {
|
|
const caller = await serverClient()
|
|
return caller.contentstack.base.header()
|
|
})
|
|
|
|
export const getAncillaryPackages = cache(
|
|
async function getMemoizedAncillaryPackages(input: AncillaryPackagesInput) {
|
|
const caller = await serverClient()
|
|
return caller.hotel.packages.ancillary(input)
|
|
}
|
|
)
|
|
|
|
export const getPackages = cache(async function getMemoizedPackages(
|
|
input: PackagesInput
|
|
) {
|
|
const caller = await serverClient()
|
|
return caller.hotel.packages.get(input)
|
|
})
|
|
|
|
export const getBookingConfirmation = cache(
|
|
async function getMemoizedBookingConfirmation(refId: string) {
|
|
const caller = await serverClient()
|
|
return caller.booking.get({ refId })
|
|
}
|
|
)
|
|
|
|
export const findBooking = cache(async function getMemoizedFindBooking(
|
|
confirmationNumber: string,
|
|
lastName: string,
|
|
firstName: string,
|
|
email: string
|
|
) {
|
|
const caller = await serverClient()
|
|
return caller.booking.findBooking({
|
|
confirmationNumber,
|
|
lastName,
|
|
firstName,
|
|
email,
|
|
})
|
|
})
|
|
|
|
export const getLinkedReservations = cache(
|
|
async function getMemoizedLinkedReservations(refId: string) {
|
|
const caller = await serverClient()
|
|
return caller.booking.linkedReservations({
|
|
refId,
|
|
})
|
|
}
|
|
)
|
|
|
|
export const getCurrentRewards = cache(
|
|
async function getMemoizedCurrentRewards() {
|
|
const caller = await serverClient()
|
|
return caller.contentstack.rewards.current()
|
|
}
|
|
)
|
|
|
|
export const getMeetingRooms = cache(
|
|
async function getMemoizedMeetingRooms(input: {
|
|
hotelId: string
|
|
language: Lang
|
|
}) {
|
|
const caller = await serverClient()
|
|
return caller.hotel.meetingRooms(input)
|
|
}
|
|
)
|
|
|
|
export const getDestinationOverviewPage = cache(
|
|
async function getMemoizedDestinationOverviewPage() {
|
|
const caller = await serverClient()
|
|
return caller.contentstack.destinationOverviewPage.get()
|
|
}
|
|
)
|
|
|
|
export const getDestinationsList = cache(
|
|
async function getMemoizedDestinationsList() {
|
|
const caller = await serverClient()
|
|
return caller.contentstack.destinationOverviewPage.destinations.get()
|
|
}
|
|
)
|
|
export const getDestinationCountryPage = cache(
|
|
async function getMemoizedDestinationCountryPage() {
|
|
const caller = await serverClient()
|
|
return caller.contentstack.destinationCountryPage.get()
|
|
}
|
|
)
|
|
export const getDestinationCityPagesByCountry = cache(
|
|
async function getMemoizedDestinationCityPagesByCountry(country: Country) {
|
|
const caller = await serverClient()
|
|
return caller.contentstack.destinationCountryPage.cityPages({
|
|
country,
|
|
})
|
|
}
|
|
)
|
|
export const getHotelsByCountry = cache(
|
|
async function getMemoizedHotelsByCountry(country: Country) {
|
|
const caller = await serverClient()
|
|
return caller.hotel.hotels.byCountry.get({
|
|
country,
|
|
})
|
|
}
|
|
)
|
|
export const getHotelsByCityIdentifier = cache(
|
|
async function getMemoizedHotelsByCityIdentifier(cityIdentifier: string) {
|
|
const caller = await serverClient()
|
|
return caller.hotel.hotels.byCityIdentifier.get({
|
|
cityIdentifier,
|
|
})
|
|
}
|
|
)
|
|
export const getDestinationsMapData = cache(
|
|
async function getMemoizedDestinationsMapData() {
|
|
const caller = await serverClient()
|
|
return caller.hotel.hotels.getDestinationsMapData()
|
|
}
|
|
)
|
|
export const getDestinationCityPage = cache(
|
|
async function getMemoizedDestinationCityPage() {
|
|
const caller = await serverClient()
|
|
return caller.contentstack.destinationCityPage.get()
|
|
}
|
|
)
|
|
|
|
export const getStartPage = cache(async function getMemoizedStartPage() {
|
|
const caller = await serverClient()
|
|
return caller.contentstack.startPage.get()
|
|
})
|
|
|
|
export const getJobylonFeed = cache(async function getMemoizedJobylonFeed() {
|
|
const caller = await serverClient()
|
|
return caller.partner.jobylon.feed.get()
|
|
})
|
|
|
|
export const getCampaignPage = cache(async function getMemoizedCampaignPage() {
|
|
const caller = await serverClient()
|
|
return caller.contentstack.campaignPage.get()
|
|
})
|
|
|
|
export const getCampaignOverviewPage = cache(
|
|
async function getMemoizedCampaignOverviewPage() {
|
|
const caller = await serverClient()
|
|
return caller.contentstack.campaignOverviewPage.get()
|
|
}
|
|
)
|
|
|
|
export const getPromoCampaignPage = cache(
|
|
async function getMemoizedPromoCampaignPage() {
|
|
const caller = await serverClient()
|
|
return caller.contentstack.promoCampaignPage.get()
|
|
}
|
|
)
|
|
|
|
export const getProfilingConsent = cache(
|
|
async function getMemoizedProfilingConsent() {
|
|
const caller = await serverClient()
|
|
return caller.contentstack.profilingConsent.get()
|
|
}
|
|
)
|
|
|
|
export const getUsePointsModal = cache(
|
|
async function getMemoizedUsePointsModal() {
|
|
const caller = await serverClient()
|
|
return caller.contentstack.usePointsModal.get()
|
|
}
|
|
)
|