Merged in feature/SW-3515-join-scandic-friends-placeholder (pull request #2883)
feat(SW-3515): display placeholder for join scandic friends * feat(SW-3515): display placeholder for join scandic friends * add missing variant config Approved-by: Linus Flood
This commit is contained in:
@@ -5,11 +5,12 @@ import { cache } from "react"
|
||||
import { BookingFlowConfigContextProvider } from "./bookingFlowConfigContext"
|
||||
|
||||
import type { LangRoute } from "@scandic-hotels/common/constants/routes/langRoute"
|
||||
import type { ScandicPartnersEnum } from "@scandic-hotels/common/constants/scandicPartners"
|
||||
|
||||
import type { BookingFlowVariant } from "./bookingFlowVariants"
|
||||
|
||||
export type BookingFlowConfig = {
|
||||
bookingCodeEnabled: boolean
|
||||
partner?: ScandicPartnersEnum
|
||||
variant: BookingFlowVariant
|
||||
routes: {
|
||||
myStay: LangRoute
|
||||
bookingTermsAndConditions: LangRoute
|
||||
|
||||
@@ -2,9 +2,8 @@
|
||||
|
||||
import { createContext, useContext } from "react"
|
||||
|
||||
import type { ScandicPartnersEnum } from "@scandic-hotels/common/constants/scandicPartners"
|
||||
|
||||
import type { BookingFlowConfig } from "./bookingFlowConfig"
|
||||
import type { BookingFlowVariant } from "./bookingFlowVariants"
|
||||
|
||||
type BookingFlowConfigContextData = BookingFlowConfig
|
||||
|
||||
@@ -12,7 +11,7 @@ const BookingFlowConfigContext = createContext<
|
||||
BookingFlowConfigContextData | undefined
|
||||
>(undefined)
|
||||
|
||||
export const useIsPartner = (partner: ScandicPartnersEnum) => {
|
||||
export const useIsPartner = (variant: BookingFlowVariant) => {
|
||||
const context = useContext(BookingFlowConfigContext)
|
||||
|
||||
if (!context) {
|
||||
@@ -21,7 +20,7 @@ export const useIsPartner = (partner: ScandicPartnersEnum) => {
|
||||
)
|
||||
}
|
||||
|
||||
return context.partner === partner
|
||||
return context.variant === variant
|
||||
}
|
||||
|
||||
export const useBookingFlowConfig = (): BookingFlowConfigContextData => {
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
export const bookingFlowVariants = ["scandic", "partner-sas"] as const
|
||||
export type BookingFlowVariant = (typeof bookingFlowVariants)[number]
|
||||
Reference in New Issue
Block a user