import { cache } from "react" import { getBookingFlowConfig } from "../../bookingFlowConfig/bookingFlowConfig" import { serverClient } from "../../trpc" import type { GetSavedPaymentCardsInput } from "@scandic-hotels/trpc/routers/user/input" export const getSavedPaymentCardsSafely = cache( async function getMemoizedSavedPaymentCardsSafely( input: GetSavedPaymentCardsInput ) { const config = getBookingFlowConfig() if (!config.savedCreditCardsEnabled) { return null } const caller = await serverClient() return caller.user.safePaymentCards(input) } )