Files
web/apps/scandic-web/constants/booking.ts
Anton Gunnarsson e572d9e7e9 Merged in feat/sw-2862-move-booking-router-to-trpc-package (pull request #2421)
feat(SW-2861): Move booking router to trpc package

* 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

* Move partners router to trpc package

* Move autocomplete router to trpc package

* Move booking router to trpc package

* Merge branch 'master' into feat/sw-2862-move-booking-router-to-trpc-package


Approved-by: Linus Flood
2025-06-26 13:21:16 +00:00

115 lines
3.8 KiB
TypeScript

import BedBunkExtraIcon from "@scandic-hotels/design-system/Icons/BedBunkExtraIcon"
import BedGenericIcon from "@scandic-hotels/design-system/Icons/BedGenericIcon"
import BedKingIcon from "@scandic-hotels/design-system/Icons/BedKingIcon"
import BedPullOutExtraIcon from "@scandic-hotels/design-system/Icons/BedPullOutExtraIcon"
import BedQueenIcon from "@scandic-hotels/design-system/Icons/BedQueenIcon"
import BedSingleIcon from "@scandic-hotels/design-system/Icons/BedSingleIcon"
import BedSofaExtraIcon from "@scandic-hotels/design-system/Icons/BedSofaExtraIcon"
import BedTwinIcon from "@scandic-hotels/design-system/Icons/BedTwinIcon"
import BedWallExtraIcon from "@scandic-hotels/design-system/Icons/BedWallExtraIcon"
import { REDEMPTION } from "@scandic-hotels/trpc/constants/booking"
import type { PaymentMethodEnum } from "@scandic-hotels/common/constants/paymentMethod"
import type { IconProps } from "@scandic-hotels/design-system/Icons"
import type {
BedTypeEnum,
ExtraBedTypeEnum,
} from "@scandic-hotels/trpc/enums/bedType"
import type { JSX } from "react"
export const FamilyAndFriendsCodes = ["D000029555", "D000029271", "D000029195"]
export const bookingSearchTypes = [REDEMPTION] as const
export const SEARCHTYPE = "searchtype"
export const MEMBERSHIP_FAILED_ERROR = "MembershipFailedError"
export const PAYMENT_METHOD_TITLES: Record<
keyof typeof PaymentMethodEnum,
string
> = {
card: "Credit card",
swish: "Swish",
vipps: "Vipps",
mobilePay: "MobilePay",
applePay: "Apple Pay",
googlePay: "Google Pay",
alipayPlus: "Alipay+",
weChatPay: "WeChat Pay",
payPal: "PayPal",
klarna: "Klarna",
americanExpress: "American Express",
dankort: "Dankort",
dinersClub: "Diners Club",
jcb: "JCB",
masterCard: "Mastercard",
visa: "Visa",
maestro: "Maestro",
chinaUnionPay: "China UnionPay",
discover: "Discover",
}
export const PAYMENT_METHOD_ICONS: Record<
keyof typeof PaymentMethodEnum,
string
> = {
card: "/_static/icons/payment/card-generic.svg",
swish: "/_static/icons/payment/swish.svg",
vipps: "/_static/icons/payment/vipps.svg",
mobilePay: "/_static/icons/payment/mobilepay.svg",
applePay: "/_static/icons/payment/apple-pay.svg",
googlePay: "/_static/icons/payment/google-pay.svg",
alipayPlus: "/_static/icons/payment/alipay-plus.svg",
weChatPay: "/_static/icons/payment/wechat-pay.svg",
payPal: "/_static/icons/payment/paypal.svg",
klarna: "/_static/icons/payment/klarna.svg",
americanExpress: "/_static/icons/payment/american-express.svg",
dankort: "/_static/icons/payment/dankort.svg",
dinersClub: "/_static/icons/payment/diners-club.svg",
jcb: "/_static/icons/payment/jcb.svg",
masterCard: "/_static/icons/payment/mastercard.svg",
visa: "/_static/icons/payment/visa.svg",
maestro: "/_static/icons/payment/maestro.svg",
chinaUnionPay: "/_static/icons/payment/china-union-pay.svg",
discover: "/_static/icons/payment/discover.svg",
}
export type BedTypes = keyof typeof BedTypeEnum | keyof typeof ExtraBedTypeEnum
export const BED_TYPE_ICONS: Record<
BedTypes,
(props: IconProps) => JSX.Element
> = {
King: BedKingIcon,
Queen: BedQueenIcon,
Single: BedSingleIcon,
Twin: BedTwinIcon,
SofaBed: BedSofaExtraIcon,
WallBed: BedWallExtraIcon,
BunkBed: BedBunkExtraIcon,
PullOutBed: BedPullOutExtraIcon,
Other: BedGenericIcon,
}
export enum CancellationRuleEnum {
CancellableBefore6PM = "CancellableBefore6PM",
NonCancellable = "NonCancellable",
Changeable = "Changeable",
}
export enum PaymentCallbackStatusEnum {
Success = "success",
Error = "error",
Cancel = "cancel",
}
export function combineRegExps(regexps: RegExp[], flags = "") {
return new RegExp(regexps.map((r) => r.source).join("|"), flags)
}
export const rateTypeRegex = {
ARB: /(^B[a-z]{3}\d{6}$)/,
VOUCHER: /(^VO[0-9a-z]*$)/,
}