feat (SW-2864): Move booking router to trpc package * Add env to trpc package * Add eslint to trpc package * Apply lint rules * Use direct imports from trpc package * Add lint-staged config to trpc * Move lang enum to common * Restructure trpc package folder structure * WIP first step * update internal imports in trpc * Fix most errors in scandic-web Just 100 left... * Move Props type out of trpc * Fix CategorizedFilters types * Move more schemas in hotel router * Fix deps * fix getNonContentstackUrls * Fix import error * Fix entry error handling * Fix generateMetadata metrics * Fix alertType enum * Fix duplicated types * lint:fix * Merge branch 'master' into feat/sw-2863-move-contentstack-router-to-trpc-package * Fix broken imports * Move booking router to trpc package * Merge branch 'master' into feat/sw-2864-move-hotels-router-to-trpc-package Approved-by: Linus Flood
46 lines
1.3 KiB
TypeScript
46 lines
1.3 KiB
TypeScript
import { useIntl } from "react-intl"
|
|
|
|
import { PAYMENT_METHOD_TITLES } from "@/constants/booking"
|
|
|
|
import PaymentOptionsGroup from "../EnterDetails/Payment/PaymentOptionsGroup"
|
|
import PaymentOption from "../PaymentOption"
|
|
|
|
import styles from "./mySavedCards.module.css"
|
|
|
|
import type { PaymentMethodEnum } from "@scandic-hotels/common/constants/paymentMethod"
|
|
import type { CreditCard } from "@scandic-hotels/trpc/types/user"
|
|
|
|
interface MySavedCardsProps {
|
|
savedCreditCards: CreditCard[] | null
|
|
}
|
|
|
|
export default function MySavedCards({ savedCreditCards }: MySavedCardsProps) {
|
|
const intl = useIntl()
|
|
const mySavedCardsLabel = intl.formatMessage({
|
|
defaultMessage: "MY SAVED CARDS",
|
|
})
|
|
|
|
return (
|
|
<section className={styles.section}>
|
|
<PaymentOptionsGroup
|
|
name="paymentMethod"
|
|
label={mySavedCardsLabel}
|
|
className={styles.paymentOptionContainer}
|
|
>
|
|
{savedCreditCards?.map((savedCreditCard) => (
|
|
<PaymentOption
|
|
key={savedCreditCard.id}
|
|
value={savedCreditCard.id}
|
|
label={
|
|
PAYMENT_METHOD_TITLES[
|
|
savedCreditCard.cardType as PaymentMethodEnum
|
|
]
|
|
}
|
|
cardNumber={savedCreditCard.truncatedNumber}
|
|
/>
|
|
))}
|
|
</PaymentOptionsGroup>
|
|
</section>
|
|
)
|
|
}
|