Merged in chore/cleanup-scandic-web (pull request #2831)

chore: Cleanup scandic-web

* Remove unused files

* Remove unused and add missing packages

* Remove unused exports


Approved-by: Linus Flood
This commit is contained in:
Anton Gunnarsson
2025-09-18 15:33:00 +00:00
parent cc99f26727
commit 08804e8675
113 changed files with 45 additions and 2891 deletions
-3
View File
@@ -1,3 +0,0 @@
export type Prettify<T> = {
[K in keyof T]: T[K]
} & {}
@@ -13,9 +13,3 @@ export interface AncillaryCardProps {
description?: string
}
}
export interface AncillaryChoiceCardProps extends AncillaryCardProps {
name: string
id?: string
value: string
}
@@ -9,7 +9,7 @@ import type { Block as DestinationCountryPageBlock } from "@scandic-hotels/trpc/
import type { Block as DestinationOverviewPageBlock } from "@scandic-hotels/trpc/types/destinationOverviewPage"
import type { Block as LoyaltyPageBlock } from "@scandic-hotels/trpc/types/loyaltyPage"
export type Blocks =
type Blocks =
| AccountPageBlock
| CampaignPageBlock
| CampaignOverviewPageBlock
@@ -9,14 +9,6 @@ type CardTheme = Exclude<
"image"
>
export const INFO_CARD_THEMES = [
"one",
"two",
"three",
"primaryInverted",
"primaryStrong",
] as const satisfies readonly CardTheme[]
export interface InfoCardProps {
scriptedTopTitle?: string
heading: string
@@ -1,12 +0,0 @@
import type { Embeds } from "@/types/requests/embeds"
import type { Node } from "@scandic-hotels/trpc/types/edges"
import type { RTENode } from "../rte/node"
import type { RenderOptions } from "../rte/option"
export type DeprecatedJsonToHtmlProps = {
embeds: Node<Embeds>[]
nodes: RTENode[]
renderOptions?: RenderOptions
}
export type EmbedByUid = Record<string, Node<Embeds>>
@@ -18,5 +18,3 @@ export enum DropdownTypeEnum {
HeaderLanguageSwitcherMobile = "headerLanguageSwitcherMobile",
FooterLanguageSwitcher = "footerLanguageSwitcher",
}
export type DropdownType = `${DropdownTypeEnum}`
@@ -1,6 +0,0 @@
import type { ImageProps } from "next/image"
export interface AvatarProps {
image?: ImageProps
initials?: string | null
}
@@ -68,11 +68,6 @@ export enum MeetingsHeading {
Default = "Great minds meet here",
}
export type HeadingEnum =
| RestaurantHeadings
| WellnessHeadings
| MeetingsHeading
export enum HealthFacilitiesEnum {
Jacuzzi = "Jacuzzi",
Gym = "Gym",
@@ -101,15 +96,6 @@ export enum IndoorPoolDetails {
DepthFrom = "DepthFrom",
}
export enum OutdoorPoolDetails {
Length = "Length",
Width = "Width",
DepthTo = "DepthTo",
DepthFrom = "DepthFrom",
OpenMonthFrom = "OpenMonthFrom",
OpenMonthTo = "OpenMonthTo",
}
export enum SaunaDetails {
SeparateMenAndWomen = "SeparateMenAndWomen",
}
@@ -1,6 +1,6 @@
import type { meetingRoomsSchema } from "@scandic-hotels/trpc/routers/hotels/schemas/meetingRoom"
import type { z } from "zod"
export type MeetingRoomData = z.output<typeof meetingRoomsSchema>
type MeetingRoomData = z.output<typeof meetingRoomsSchema>
export type MeetingRooms = MeetingRoomData["data"]
export type MeetingRoom = MeetingRooms[number]["attributes"]
@@ -1,3 +0,0 @@
export type BedTypeInfoProps = {
hasMultipleBedTypes: boolean
}
@@ -1,10 +1,6 @@
import type { Product } from "@scandic-hotels/trpc/types/roomAvailability"
import type { Price } from "../price"
export interface RoomPrice {
perNight: Price
perStay: Price
}
export type RoomRate = Product
@@ -1,7 +1,5 @@
import { z } from "zod"
import type { Hotel } from "@scandic-hotels/trpc/types/hotel"
export const cancelStaySchema = z.object({
rooms: z.array(
z.object({
@@ -11,34 +9,4 @@ export const cancelStaySchema = z.object({
),
})
export interface CancelStayProps {
handleCloseModal: () => void
hotel: Hotel
}
export type CancelStayFormValues = z.output<typeof cancelStaySchema>
export interface RoomDetails {
id: string
roomName: string
roomTypeCode: string
rateDefinition: {
breakfastIncluded: boolean
cancellationRule: string | null
cancellationText: string | null
generalTerms: string[]
isMemberRate: boolean
mustBeGuaranteed: boolean
rateCode: string
title: string | null
}
isMainBooking?: boolean
}
export interface StayDetails {
checkInDate: string
checkOutDate: string
nightsText: string
adultsText: string
childrenText: string
}
@@ -1,7 +1,5 @@
import { z } from "zod"
import { Lang } from "@scandic-hotels/common/constants/language"
export const changeDatesSchema = z.object({
checkInDate: z.string(),
checkOutDate: z.string(),
@@ -9,30 +7,6 @@ export const changeDatesSchema = z.object({
export type ChangeDatesSchema = z.output<typeof changeDatesSchema>
export interface QueryInput {
hotelId: string
roomStayStartDate: string
roomStayEndDate: string
adults: number
children: string
bookingCode: string
rateCode: string
roomTypeCode: string
lang: Lang
}
export const DEFAULT_QUERY_INPUT: QueryInput = {
hotelId: "",
roomStayStartDate: "",
roomStayEndDate: "",
adults: 1,
children: "",
bookingCode: "",
rateCode: "",
roomTypeCode: "",
lang: Lang.en,
}
export interface ChangeDatesStepsProps {
closeModal: () => void
}
@@ -1,6 +1,4 @@
import { z } from "zod"
import { CurrencyEnum } from "@scandic-hotels/common/constants/currency"
import type { CurrencyEnum } from "@scandic-hotels/common/constants/currency"
interface TPrice {
additionalPrice?: number
@@ -14,18 +12,3 @@ export interface Price {
requested?: TPrice
local: TPrice
}
export const PointsPriceSchema = z
.object({
localPrice: z.object({
currency: z.nativeEnum(CurrencyEnum),
price: z.number(),
additionalPrice: z.number().optional(),
additionalPriceCurrency: z.nativeEnum(CurrencyEnum).optional(),
}),
})
.transform((data) => ({
local: {
...data.localPrice,
},
}))
@@ -1,11 +0,0 @@
import type { ProductType } from "@scandic-hotels/trpc/types/availability"
import type { Hotel } from "@scandic-hotels/trpc/types/hotel"
export type HotelData = {
hotelData: Hotel
price: ProductType
}
export interface NullableHotelData extends Omit<HotelData, "hotelData"> {
hotelData: HotelData["hotelData"] | null
}
@@ -1,20 +0,0 @@
import type { Hotel } from "@scandic-hotels/trpc/types/hotel"
export type HotelFilter = Hotel["detailedFacilities"][number] & {
hotelId: string
hotelIds: string[]
}
export type CategorizedHotelFilters = {
facilityFilters: HotelFilter[]
surroundingsFilters: HotelFilter[]
}
export type HotelFiltersProps = {
filters: CategorizedHotelFilters
className?: string
}
export type HotelFilterModalProps = {
filters: CategorizedHotelFilters
}
@@ -1,36 +0,0 @@
import type { ProductTypeCheque } from "@scandic-hotels/trpc/types/availability"
import type { Amenities } from "@scandic-hotels/trpc/types/hotel"
import type { Coordinates } from "@/types/components/maps/coordinates"
export type HotelPin = {
bookingCode?: string | null
name: string
coordinates: Coordinates
chequePrice: ProductTypeCheque["localPrice"] | null
publicPrice: number | null
memberPrice: number | null
redemptionPrice: number | null
voucherPrice: number | null
rateType: string | null
currency: string
images: {
src: string
altText: string
altText_En: string
title: string
title_En: string
}[]
amenities: Amenities
ratings: number | null
operaId: string
facilityIds: number[]
hasEnoughPoints: boolean
}
export interface HotelCardDialogProps {
type?: "listing" | "standalone"
isOpen: boolean
data: HotelPin
handleClose: (event: { stopPropagation: () => void }) => void
}
@@ -1,19 +0,0 @@
import type {
ProductTypeCheque,
ProductTypePrices,
ProductTypeVoucher,
} from "@scandic-hotels/trpc/types/availability"
export type PriceCardProps = {
productTypePrices: ProductTypePrices
isMemberPrice?: boolean
className?: string
}
export type VoucherCardProps = {
productTypeVoucher: ProductTypeVoucher
}
export type BonusChequeCardProps = {
productTypeVoucher: ProductTypeCheque
}
@@ -1,15 +0,0 @@
import type { BookingSearchType } from "@scandic-hotels/booking-flow/searchType"
import type { Child } from "@scandic-hotels/trpc/types/child"
export type SelectHotelBooking = {
hotelId?: string
city?: string
fromDate: string
toDate: string
rooms: {
adults: number
childrenInRoom?: Child[]
}[]
bookingCode?: string
searchType?: BookingSearchType
}
@@ -1,7 +0,0 @@
import type { SelectRateBooking } from "@scandic-hotels/booking-flow/types/components/selectRate/selectRate"
import type { Hotel } from "@scandic-hotels/trpc/types/hotel"
export interface HotelInfoCardProps {
booking: SelectRateBooking
hotel: Hotel
}
@@ -1,7 +0,0 @@
import type { Price } from "../price"
export interface MobileSummaryProps {
isAllRoomsSelected: boolean
isUserLoggedIn: boolean
totalPriceToShow: Price
}
@@ -1,14 +0,0 @@
import type {
Product,
RoomConfiguration,
} from "@scandic-hotels/trpc/types/roomAvailability"
export interface RatesProps {
roomConfiguration: RoomConfiguration
}
export interface SharedRateCardProps
extends Pick<RoomConfiguration, "roomTypeCode"> {
handleSelectRate: (product: Product) => void
nights: number
}
@@ -1,13 +0,0 @@
import type { Package } from "@scandic-hotels/trpc/types/packages"
import type { RoomConfiguration } from "@scandic-hotels/trpc/types/roomAvailability"
export type RoomListItemProps = {
roomConfiguration: RoomConfiguration
}
export type RoomListItemImageProps = Pick<
RoomConfiguration,
"roomType" | "roomTypeCode" | "roomsLeft"
> & {
roomPackages: Package[]
}
@@ -1,34 +0,0 @@
import type { SelectRateBooking } from "@scandic-hotels/booking-flow/types/components/selectRate/selectRate"
import type { Child } from "@scandic-hotels/trpc/types/child"
import type { Packages } from "@scandic-hotels/trpc/types/packages"
import type { RoomPrice, RoomRate } from "./enterDetails/details"
import type { Price } from "./price"
export type RoomsData = {
rateDetails: string[] | undefined
roomType: string
cancellationText: string
roomPrice: RoomPrice
adults: number
children?: Child[]
packages: Packages | null
}
export interface SelectRateSummaryProps {
booking: SelectRateBooking
isMember: boolean
totalPrice: Price
vat: number
rooms: Array<{
adults: number
childrenInRoom: Child[] | undefined
roomType: string
roomPrice: RoomPrice
roomRate: RoomRate
rateDetails: string[] | undefined
cancellationText: string
packages?: Packages
} | null>
toggleSummaryOpen: () => void
}
@@ -7,7 +7,7 @@ export enum LanguageSwitcherTypesEnum {
Footer = "footer",
}
export type LanguageSwitcherTypes = `${LanguageSwitcherTypesEnum}`
type LanguageSwitcherTypes = `${LanguageSwitcherTypesEnum}`
export interface LanguageSwitcherProps {
type: LanguageSwitcherTypes
@@ -20,5 +20,6 @@ export interface LanguageSwitcherContentProps {
export interface LanguageSwitcherContainerProps {
type: LanguageSwitcherTypes
// eslint-disable-next-line @typescript-eslint/no-explicit-any
children: ReactElement<any, any>
}
@@ -1,27 +1,17 @@
import type { Lang } from "@scandic-hotels/common/constants/language"
import type { VariantProps } from "class-variance-authority"
import type { awardPointsVariants } from "@/components/Blocks/DynamicContent/Points/EarnAndBurn/AwardPoints/awardPointsVariants"
import type { UserQueryRouter } from "../user"
export type TransactionResponse = Awaited<
type TransactionResponse = Awaited<
ReturnType<UserQueryRouter["transaction"]["friendTransactions"]>
>
export type TransactionsNonNullResponseObject = NonNullable<TransactionResponse>
export type Transactions =
type TransactionsNonNullResponseObject = NonNullable<TransactionResponse>
type Transactions =
NonNullable<TransactionsNonNullResponseObject>["data"]["transactions"]
export type Transaction =
type Transaction =
NonNullable<TransactionsNonNullResponseObject>["data"]["transactions"][number]
export type ClientEarnAndBurnProps = {
initialData: TransactionsNonNullResponseObject
lang: Lang
}
export type EarnAndBurnProps = {
lang: Lang
}
export interface ClientTableProps {
transactions: Transactions
}
@@ -30,7 +20,4 @@ export interface RowProps {
transaction: Transaction
}
export interface AwardPointsProps extends Pick<Transaction, "awardPoints"> {}
export interface AwardPointsVariantProps
extends VariantProps<typeof awardPointsVariants> {}
export type AwardPointsVariantProps = VariantProps<typeof awardPointsVariants>
@@ -8,27 +8,3 @@ export const enum Status {
error = "error",
success = "success",
}
type Data = Record<
string,
string | undefined | Record<string, string | undefined>
>
type Issue = {
field: string
message: string
}
export type State = {
data: Data
message: string
} & (
| {
issues: never
status: Status.success
}
| {
issues: Issue[]
status: Status.error
}
)
@@ -24,15 +24,6 @@ export interface AddedAncillariesProps {
booking: Room
}
export interface AncillaryProps {
ancillary: Ancillary["ancillaryContent"][number]
}
export interface AncillaryGridModalProps {
ancillaries: Ancillaries
user: User | null
}
export interface AddAncillaryFlowModalProps {
booking: Room
packages: Packages | null
@@ -40,14 +31,6 @@ export interface AddAncillaryFlowModalProps {
savedCreditCards: CreditCard[] | null
}
export type DeliveryTimeOption = {
label: string
value: string
}
export interface DeliveryMethodStepProps {
deliveryTimeOptions: DeliveryTimeOption[]
}
export interface SelectQuantityStepProps {
user: User | null
}
@@ -1,14 +1,10 @@
import type { UserQueryRouter } from "../user"
export type PreviousStaysResponse = Awaited<
type PreviousStaysResponse = Awaited<
ReturnType<UserQueryRouter["stays"]["previous"]>
>
export type PreviousStaysNonNullResponseObject =
NonNullable<PreviousStaysResponse>
export type PreviousStays =
NonNullable<PreviousStaysNonNullResponseObject>["data"]
export type PreviousStay =
NonNullable<PreviousStaysNonNullResponseObject>["data"][number]
export interface PreviousStaysClientProps {
initialPreviousStays: PreviousStaysNonNullResponseObject
@@ -1,14 +1,10 @@
import type { UserQueryRouter } from "../user"
export type UpcomingStaysResponse = Awaited<
type UpcomingStaysResponse = Awaited<
ReturnType<UserQueryRouter["stays"]["upcoming"]>
>
export type UpcomingStaysNonNullResponseObject =
NonNullable<UpcomingStaysResponse>
export type UpcomingStays =
NonNullable<UpcomingStaysNonNullResponseObject>["data"]
export type UpcomingStay =
NonNullable<UpcomingStaysNonNullResponseObject>["data"][number]
export interface UpcomingStaysClientProps {
initialUpcomingStays: UpcomingStaysNonNullResponseObject
@@ -1,8 +0,0 @@
export interface SearchProps {
handlePressEnter: () => void
}
export type SearchHistoryItem = {
type: "cities" | "hotels"
id: string
}
@@ -1,12 +1,4 @@
import type { Room } from "@scandic-hotels/trpc/types/hotel"
import type { SafeUser } from "@/types/user"
export type BookedRoomSidePeekProps = {
close: () => void
confirmationNumber: string
room: Room
user: SafeUser
}
export type RoomDetailsProps = {
roomDescription: string
@@ -1,7 +1,7 @@
import type { SidebarBlock as ContentPageSidebarBlock } from "@scandic-hotels/trpc/types/contentPage"
import type { SidebarBlock as LoyaltyPageSidebarBlock } from "@scandic-hotels/trpc/types/loyaltyPage"
export type Blocks = ContentPageSidebarBlock | LoyaltyPageSidebarBlock
type Blocks = ContentPageSidebarBlock | LoyaltyPageSidebarBlock
export interface SidebarProps {
blocks: Blocks[]
@@ -1,9 +0,0 @@
export enum scriptedCardThemeEnum {
one = "one",
two = "two",
three = "three",
primaryDim = "primaryDim",
primaryDark = "primaryDark",
primaryInverted = "primaryInverted",
primaryStrong = "primaryStrong",
}
@@ -1,8 +0,0 @@
export enum SignatureHotelEnum {
DowntownCamper = "879",
GrandHotelOslo = "340",
Haymarket = "890",
HotelNorge = "785",
Marski = "605",
TheDock = "796",
}
-16
View File
@@ -1,16 +0,0 @@
// import type { MessageDescriptor } from "@formatjs/intl"
// Module augmentation
declare module "@formatjs/intl" {
// We are unable to override description field on MessageDescriptor from formatjs.
// Module augmentation does not allow for that. But we leave it here for reference.
// Instead we export our own LokaliseMessageDescriptor and use that where we control the code.
// For example in our custom formatter in i18n/formatter.ts
// interface MessageDescriptor {
// description?: {
// context?: string
// limit?: number
// tags?: string[]
// }
// }
}
-10
View File
@@ -1,10 +0,0 @@
import type { MessageDescriptor } from "@formatjs/intl"
export interface LokaliseMessageDescriptor
extends Omit<MessageDescriptor, "description"> {
description: {
context?: string
limit?: number
tags?: string
}
}
+1 -10
View File
@@ -7,7 +7,7 @@ export type SearchParams<S = object> = {
searchParams: Promise<S & { [key: string]: string }>
}
export type Params<P = object> = {
type Params<P = object> = {
params: Promise<P>
}
@@ -41,15 +41,6 @@ export type UIDParams = {
uid: string
}
export type UriParams = {
uri: string | string[]
}
export type PreviewParams = {
uri?: string
live_preview?: string
}
export type LayoutArgs<P = undefined> = P extends undefined
? unknown
: Params<P>
-12
View File
@@ -1,12 +0,0 @@
import type { SelectRateBooking } from "@scandic-hotels/booking-flow/types/components/selectRate/selectRate"
import type { AvailabilityError } from "@scandic-hotels/booking-flow/types/stores/rates"
import type { Room } from "@scandic-hotels/trpc/types/hotel"
import type { RoomsAvailability } from "@scandic-hotels/trpc/types/roomAvailability"
export interface RatesProviderProps extends React.PropsWithChildren {
booking: SelectRateBooking
hotelType: string | undefined
roomCategories: Room[]
roomsAvailability: (RoomsAvailability | AvailabilityError)[] | undefined
vat: number
}
@@ -1,6 +0,0 @@
import type { SelectedRoom } from "@scandic-hotels/booking-flow/types/stores/rates"
export interface RoomProviderProps extends React.PropsWithChildren {
idx: number
room: SelectedRoom
}
@@ -1,81 +0,0 @@
import type { Lang } from "@scandic-hotels/common/constants/language"
import type { EdgesWithTotalCount } from "@scandic-hotels/trpc/types/edges"
import type { Typename } from "../utils/typename"
export enum Section {
ContactBlockSectionsExtraInfo = "ContactBlockSectionsExtraInfo",
ContactBlockSectionsMailingAddress = "ContactBlockSectionsMailingAddress",
ContactBlockSectionsPhone = "ContactBlockSectionsPhone",
ContactBlockSectionsTitle = "ContactBlockSectionsTitle",
ContactBlockSectionsVisitingAddress = "ContactBlockSectionsVisitingAddress",
}
type ExtraInfo = Typename<
{
extra_info: {
text: string[]
}
},
Section.ContactBlockSectionsExtraInfo
>
type MailingAddress = Typename<
{
mailing_address: {
city: string
country: string
name: string
street: string
zip: string
}
},
Section.ContactBlockSectionsMailingAddress
>
type Phone = Typename<
{
phone: {
number: number
title: string
}
},
Section.ContactBlockSectionsPhone
>
type Title = Typename<
{
title: {
text: string
}
},
Section.ContactBlockSectionsTitle
>
type VisitingAddress = Typename<
{
visiting_address: {
city: string
country: string
street: string
zip: string
}
},
Section.ContactBlockSectionsVisitingAddress
>
type Sections = ExtraInfo | MailingAddress | Phone | Title | VisitingAddress
export type ContactNode = {
sections: Sections[]
system: {
locale: Lang
uid: string
}
}
export type Contact = {
contact: {
contactConnection: EdgesWithTotalCount<ContactNode>
}
}
@@ -1,5 +0,0 @@
import type { Puff } from "../puff"
export type PuffAside = {
puff: Puff
}
@@ -1,49 +0,0 @@
import type { Typename } from "../utils/typename"
enum ListItemStyleEnum {
checkmark = "checkmark",
default = "default",
}
type ListItemStyle = keyof typeof ListItemStyleEnum
export enum BlockListItemsEnum {
CurrentBlocksPageBlocksListBlockListItemsListItem = "CurrentBlocksPageBlocksListBlockListItemsListItem",
CurrentBlocksPageBlocksListBlockListItemsListItemExternalLink = "CurrentBlocksPageBlocksListBlockListItemsListItemExternalLink",
}
type ExternalLinkListItem = Typename<
{
list_item_external_link: {
link: {
href: string
title: string
}
list_item_style: ListItemStyle
subtitle?: string
}
},
BlockListItemsEnum.CurrentBlocksPageBlocksListBlockListItemsListItemExternalLink
>
type RegularListItem = Typename<
{
list_item: {
list_item_style: ListItemStyle
subtitle?: string
title: string
}
},
BlockListItemsEnum.CurrentBlocksPageBlocksListBlockListItemsListItem
>
export type ListItem = ExternalLinkListItem | RegularListItem
export type List = {
list: {
title?: string
list_items: ListItem[]
}
}
export type ListProps = List
@@ -1,9 +0,0 @@
import type { Puff } from "../puff"
export type PuffBlock = {
puffs: {
puffs: {
puff: Puff
}[]
}
}
@@ -1,13 +0,0 @@
import type { EdgesWithTotalCount } from "@scandic-hotels/trpc/types/edges"
import type { RTEDocument } from "@/types/rte/node"
import type { Embeds } from "../embeds"
export type Text = {
text: {
content: {
embedded_itemsConnection: EdgesWithTotalCount<Embeds>
json: RTEDocument
}
}
}
-22
View File
@@ -1,22 +0,0 @@
import type { ImageContainer } from "./imageContainer"
import type { SysAsset } from "./utils/asset"
import type { EmbedEnum } from "./utils/embeds"
import type { PageLink, PageLinkWithOriginalUrl } from "./utils/pageLink"
import type { TypenameInterface } from "./utils/typename"
interface AccountPage
extends TypenameInterface<EmbedEnum.AccountPage>,
PageLink {}
interface ContentPage
extends TypenameInterface<EmbedEnum.ContentPage>,
PageLinkWithOriginalUrl {}
interface LoyaltyPage
extends TypenameInterface<EmbedEnum.LoyaltyPage>,
PageLinkWithOriginalUrl {}
export type Embeds =
| AccountPage
| ContentPage
| ImageContainer
| LoyaltyPage
| SysAsset
-6
View File
@@ -1,6 +0,0 @@
import type { EdgesWithTotalCount } from "@scandic-hotels/trpc/types/edges"
import type { Image } from "@scandic-hotels/trpc/types/image"
export type Hero = {
imagesConnection: EdgesWithTotalCount<Image>
}
@@ -1,12 +0,0 @@
import type { ImageVaultAsset } from "@scandic-hotels/common/utils/imageVault"
import type { System } from "@scandic-hotels/trpc/routers/contentstack/schemas/system"
import type { EmbedEnum } from "./utils/embeds"
import type { TypenameInterface } from "./utils/typename"
export interface ImageContainer
extends TypenameInterface<EmbedEnum.ImageContainer>,
System {
image_left?: ImageVaultAsset
image_right?: ImageVaultAsset
}
@@ -1,11 +0,0 @@
import type { EdgesWithTotalCount } from "@scandic-hotels/trpc/types/edges"
import type { RTEDocument } from "../rte/node"
import type { Embeds } from "./embeds"
export type Preamble = {
text: {
embedded_itemsConnection: EdgesWithTotalCount<Embeds>
json: RTEDocument
}
}
-22
View File
@@ -1,22 +0,0 @@
import type { EdgesWithTotalCount } from "@scandic-hotels/trpc/types/edges"
import type { Image } from "@scandic-hotels/trpc/types/image"
import type { RTEDocument } from "../rte/node"
export enum PuffStyleEnum {
button = "button",
default = "default",
}
export type Puff = {
imageConnection: EdgesWithTotalCount<Image>
link: {
href: string
title?: string
}
puff_style: PuffStyleEnum
text: {
json: RTEDocument
}
title: string
}
@@ -1,3 +0,0 @@
export type TrackingData = {
current_blocks_page: { url: string; title: string }
}
@@ -1,8 +0,0 @@
export interface AllRequestResponse<T> {
items: T[]
}
export interface AllRequestResponseWithTotal<T> {
items: T[]
total: number
}
@@ -1,8 +0,0 @@
import type { Image } from "@scandic-hotels/trpc/types/image"
import type { EmbedEnum } from "./embeds"
import type { TypenameInterface } from "./typename"
export interface SysAsset
extends TypenameInterface<EmbedEnum.SysAsset>,
Image {}
@@ -1,11 +0,0 @@
export enum EmbedEnum {
CurrentBlocksPage = "CurrentBlocksPage",
SysAsset = "SysAsset",
ImageContainer = "ImageContainer",
LoyaltyPage = "LoyaltyPage",
AccountPage = "AccountPage",
ContentPage = "ContentPage",
HotelPage = "HotelPage",
}
export type Embed = keyof typeof EmbedEnum
@@ -1,17 +0,0 @@
import type { z } from "zod"
import type {
extendedPageLinkSchema,
pageLinkSchema,
} from "@scandic-hotels/trpc/routers/contentstack/schemas/pageLinks"
import type { EmbedEnum } from "./embeds"
import type { TypenameInterface } from "./typename"
export interface PageLink extends z.output<typeof pageLinkSchema> {}
export interface PageLinkWithOriginalUrl
extends z.output<typeof extendedPageLinkSchema> {}
export interface PageLinkType
extends TypenameInterface<EmbedEnum.CurrentBlocksPage>,
PageLink {}
@@ -1,22 +1,3 @@
export enum AsideTypenameEnum {
CurrentBlocksPageAsideContact = "CurrentBlocksPageAsideContact",
CurrentBlocksPageAsidePuff = "CurrentBlocksPageAsidePuff",
}
export type AsideTypename = keyof typeof AsideTypenameEnum
export enum BlocksTypenameEnum {
CurrentBlocksPageBlocksList = "CurrentBlocksPageBlocksList",
CurrentBlocksPageBlocksPuffs = "CurrentBlocksPageBlocksPuffs",
CurrentBlocksPageBlocksText = "CurrentBlocksPageBlocksText",
}
export type BlocksTypename = keyof typeof BlocksTypenameEnum
export type Typename<T, K> = T & {
__typename: K
}
export interface TypenameInterface<K> {
__typename: K
}
-51
View File
@@ -1,51 +0,0 @@
import type { Lang } from "@scandic-hotels/common/constants/language"
import type {
ImageVaultAsset,
ImageVaultAssetResponse,
} from "@scandic-hotels/common/utils/imageVault"
import type {
EmbedTypesEnum,
RTEItemType,
RTEItemTypeEnum,
} from "@scandic-hotels/trpc/types/RTEenums"
export interface Attributes {
[key: string]: any
"class-name"?: string
type: RTEItemType
}
export interface RTEAssetAttrs extends Attributes {
alt: string
"asset-alt": string
"asset-link": string
"asset-name": string
"asset-type": "image/png" | "image/jpg" | "image/jpeg"
"asset-uid": string
"display-type": EmbedTypesEnum.display
"content-type-uid": "sys_assets"
inline: false
type: RTEItemTypeEnum.asset
}
export interface RTEAnchorAttrs extends Attributes {
target: string
url: string
}
export interface RTELinkAttrs extends Attributes {
"display-type": EmbedTypesEnum.link
"class-name": string
"content-type-uid": string
"entry-uid": string
locale: Lang
href: string
target: HTMLAnchorElement["target"]
type: RTEItemTypeEnum.entry
}
export type RTEImageVaultAttrs = Attributes & {
height: string
style: string[]
width: string
} & (ImageVaultAssetResponse | ImageVaultAsset)
-98
View File
@@ -1,98 +0,0 @@
import type { RTETypeEnum } from "@scandic-hotels/trpc/types/RTEenums"
import type { JSX } from "react"
import type { EmbedByUid } from "../components/deprecatedjsontohtml"
import type {
Attributes,
RTEAnchorAttrs,
RTEAssetAttrs,
RTEImageVaultAttrs,
RTELinkAttrs,
} from "./attrs"
import type { RenderOptions } from "./option"
export interface RTEDefaultNode {
attrs: Attributes
children: RTENode[]
type: RTETypeEnum
uid: string
}
export interface RTELinkNode {
attrs: Attributes
children: RTENode[]
type: RTETypeEnum
uid: string
}
export interface RTEReferenceAssetNode extends RTEDefaultNode {
attrs: RTEAssetAttrs
}
export interface RTEAnchorNode extends RTEDefaultNode {
attrs: RTEAnchorAttrs
type: RTETypeEnum.a
}
export interface RTEReferenceLinkNode extends RTEDefaultNode {
attrs: RTELinkAttrs
}
export interface RTEImageVaultNode extends RTEDefaultNode {
attrs: RTEImageVaultAttrs
type: RTETypeEnum.ImageVault
}
export enum RTEMarkType {
bold = "bold",
break = "break",
classnameOrId = "classnameOrId",
inlineCode = "inlineCode",
italic = "italic",
strikethrough = "strikethrough",
subscript = "subscript",
superscript = "superscript",
underline = "underline",
}
type RTETextNodeOptionalKeys = {
[key in RTEMarkType]?: boolean
}
export type RTETextNode = RTETextNodeOptionalKeys & {
classname?: string
id?: string
text: string
}
export type RTERegularNode = RTEDefaultNode | RTEAnchorNode | RTEImageVaultNode
export type RTEImageNode = RTEDefaultNode | RTEImageVaultNode
export type RTEReferenceNode = RTEAnchorNode
export type RTENode = RTERegularNode | RTEReferenceNode | RTETextNode
export type RTERenderMark = (
children: React.ReactNode,
classname?: string,
id?: string
) => JSX.Element
export interface RTEDocument extends RTEDefaultNode {
type: RTETypeEnum.doc
_version: number
}
export type RTERenderOptionComponent = (
node: RTERegularNode,
embeds: EmbedByUid,
next: RTENext,
fullRenderOptions: RenderOptions
) => React.ReactNode
export type RTENext = (
nodes: RTENode[],
embeds: EmbedByUid,
fullRenderOptions: RenderOptions
) => string
-5
View File
@@ -1,5 +0,0 @@
import type { RTERenderMark, RTERenderOptionComponent } from "./node"
export type RenderOptions = {
[type: string]: RTERenderOptionComponent | RTERenderMark
}
-2
View File
@@ -1,5 +1,3 @@
export enum SidePeekEnum {
hotelDetails = "hotel-detail-side-peek",
roomDetails = "room-detail-side-peek",
bookedRoomDetails = "booked-room-detail-side-peek",
}
@@ -20,12 +20,6 @@ interface Actions {
setIsLoading: (isLoading: boolean) => void
}
export interface SubmitCallbackData {
sort: HotelSortOption
defaultSort: HotelSortOption
filters: string[]
basePath: string
}
export interface DestinationDataState {
actions: Actions
allCities: DestinationCityListItem[]
@@ -15,12 +15,6 @@ interface Actions {
setIsLoading: (isLoading: boolean) => void
}
export interface SubmitCallbackData {
sort: HotelSortOption
defaultSort: HotelSortOption
filters: string[]
basePath: string
}
export interface HotelListingDataState {
actions: Actions
allHotels: HotelListingHotelData[]
+1 -1
View File
@@ -36,7 +36,7 @@ export type Room = Omit<
terms: string | null
}
export type BookingRoom = BookingConfirmation["booking"]
type BookingRoom = BookingConfirmation["booking"]
interface Actions {
closeManageStay: () => void
@@ -1,14 +0,0 @@
import type { Node } from "@scandic-hotels/trpc/types/edges"
import type { Embeds } from "@scandic-hotels/trpc/types/embeds"
import type { RTENode } from "./rte/node"
import type { RenderOptions } from "./rte/option"
export type JsonToHtmlProps = {
embeds: Node<Embeds>[]
nodes: RTENode[]
renderOptions?: RenderOptions
className?: string
}
export type EmbedByUid = Record<string, Node<Embeds>>
@@ -1,45 +0,0 @@
import type { Lang } from "@scandic-hotels/common/constants/language"
import type { ImageVaultAsset } from "@scandic-hotels/common/utils/imageVault"
import type { EmbedTypesEnum, RTEItemType, RTEItemTypeEnum } from "./enums"
export interface Attributes {
[key: string]: any
"class-name"?: string
type: RTEItemType
}
export interface RTEAssetAttrs extends Attributes {
alt: string
"asset-alt": string
"asset-link": string
"asset-name": string
"asset-type": "image/png" | "image/jpg" | "image/jpeg"
"asset-uid": string
"display-type": EmbedTypesEnum.display
"content-type-uid": "sys_assets"
inline: false
type: RTEItemTypeEnum.asset
}
export interface RTEAnchorAttrs extends Attributes {
target: string
url: string
}
export interface RTELinkAttrs extends Attributes {
"display-type": EmbedTypesEnum.link
"class-name": string
"content-type-uid": string
"entry-uid": string
locale: Lang
href: string
target: HTMLAnchorElement["target"]
type: RTEItemTypeEnum.entry
}
export interface RTEImageVaultAttrs extends Attributes, ImageVaultAsset {
height: string
style: string[]
width: string
}
@@ -1,69 +0,0 @@
export enum EmbedTypesEnum {
block = "block",
display = "display",
download = "download",
inline = "inline",
link = "link",
}
export type EmbedTypes = keyof typeof EmbedTypesEnum
/** Copied from https://github.com/contentstack/contentstack-utils-javascript/blob/master/src/nodes/node-type.ts */
export enum RTETypeEnum {
a = "a",
blockquote = "blockquote",
code = "code",
doc = "doc",
embed = "embed",
h1 = "h1",
h2 = "h2",
h3 = "h3",
h4 = "h4",
h5 = "h5",
h6 = "h6",
hr = "hr",
img = "img",
li = "li",
ol = "ol",
p = "p",
reference = "reference",
span = "span",
/**
* Included for compatibility when copying RTE from other sources e.g. epi
*/
div = "div",
table = "table",
tbody = "tbody",
td = "td",
text = "text",
tfoot = "tfoot",
th = "th",
thead = "thead",
tr = "tr",
ul = "ul",
ImageVault = "ImageVault",
fragment = "fragment",
}
export type RTEType = keyof typeof RTETypeEnum
export enum RTEItemTypeEnum {
asset = "asset",
entry = "entry",
}
export type RTEItemType = keyof typeof RTEItemTypeEnum
export enum AvailableParagraphFormatEnum {
"script-1" = "script-1",
"script-2" = "script-2",
"footnote" = "footnote",
"caption" = "caption",
"subtitle-1" = "subtitle-1",
"subtitle-2" = "subtitle-2",
}
export enum AvailableULFormatEnum {
"heart" = "heart",
"check" = "check",
}
@@ -1,98 +0,0 @@
import type { JSX } from "react"
import type { EmbedByUid } from "../jsontohtml"
import type {
Attributes,
RTEAnchorAttrs,
RTEAssetAttrs,
RTEImageVaultAttrs,
RTELinkAttrs,
} from "./attrs"
import type { RTETypeEnum } from "./enums"
import type { RenderOptions } from "./option"
export interface RTEDefaultNode {
attrs: Attributes
children: RTENode[]
type: RTETypeEnum
uid: string
}
export interface RTELinkNode {
attrs: Attributes
children: RTENode[]
type: RTETypeEnum
uid: string
}
export interface RTEReferenceAssetNode extends RTEDefaultNode {
attrs: RTEAssetAttrs
}
export interface RTEAnchorNode extends RTEDefaultNode {
attrs: RTEAnchorAttrs
type: RTETypeEnum.a
}
export interface RTEReferenceLinkNode extends RTEDefaultNode {
attrs: RTELinkAttrs
}
export interface RTEImageVaultNode extends RTEDefaultNode {
attrs: RTEImageVaultAttrs
type: RTETypeEnum.ImageVault
}
export enum RTEMarkType {
bold = "bold",
break = "break",
classnameOrId = "classnameOrId",
inlineCode = "inlineCode",
italic = "italic",
strikethrough = "strikethrough",
subscript = "subscript",
superscript = "superscript",
underline = "underline",
}
type RTETextNodeOptionalKeys = {
[key in RTEMarkType]?: boolean
}
export type RTETextNode = RTETextNodeOptionalKeys & {
classname?: string
id?: string
text: string
}
export type RTERegularNode = RTEDefaultNode | RTEAnchorNode | RTEImageVaultNode
export type RTEImageNode = RTEDefaultNode | RTEImageVaultNode
export type RTEReferenceNode = RTEAnchorNode
export type RTENode = RTERegularNode | RTEReferenceNode | RTETextNode
export type RTERenderMark = (
children: React.ReactNode,
classname?: string,
id?: string
) => JSX.Element
export interface RTEDocument extends RTEDefaultNode {
type: RTETypeEnum.doc
_version: number
}
export type RTERenderOptionComponent = (
node: RTERegularNode,
embeds: EmbedByUid,
next: RTENext,
fullRenderOptions: RenderOptions
) => React.ReactNode
export type RTENext = (
nodes: RTENode[],
embeds: EmbedByUid,
fullRenderOptions: RenderOptions
) => string
@@ -1,5 +0,0 @@
import type { RTERenderMark, RTERenderOptionComponent } from "./node"
export type RenderOptions = {
[type: string]: RTERenderOptionComponent | RTERenderMark
}
@@ -1,12 +1,9 @@
import type { z } from "zod"
import type { joinLoyaltyContactSidebarSchema } from "@scandic-hotels/trpc/routers/contentstack/loyaltyPage/output"
import type { contactSchema } from "@scandic-hotels/trpc/routers/contentstack/schemas/sidebar/joinLoyaltyContact"
import type { z } from "zod"
export interface JoinLoyaltyContact
extends z.output<typeof joinLoyaltyContactSidebarSchema> {}
export type JoinLoyaltyContact = z.output<
typeof joinLoyaltyContactSidebarSchema
>
type ContactsSchema = z.output<typeof contactSchema>
export type Contacts = ContactsSchema["contact"]
export interface Contact {
contact: NonNullable<Contacts[number]>
}