fix(SW-890): better feature flag handling
This commit is contained in:
@@ -25,7 +25,6 @@ export default function ContentTypePage({
|
||||
setLang(params.lang)
|
||||
|
||||
const pathname = headers().get("x-pathname") || ""
|
||||
const isSignupRoute = isSignupPage(pathname)
|
||||
|
||||
switch (params.contentType) {
|
||||
case "collection-page":
|
||||
@@ -34,12 +33,22 @@ export default function ContentTypePage({
|
||||
}
|
||||
return <CollectionPage />
|
||||
case "content-page": {
|
||||
if (!isSignupRoute && env.HIDE_FOR_NEXT_RELEASE) {
|
||||
return notFound()
|
||||
const isSignupRoute = isSignupPage(pathname)
|
||||
|
||||
if (env.HIDE_FOR_NEXT_RELEASE) {
|
||||
// Hide content pages for next release for non-signup routes.
|
||||
if (!isSignupRoute) {
|
||||
return notFound()
|
||||
}
|
||||
}
|
||||
if (isSignupRoute && !env.SHOW_SIGNUP_FLOW) {
|
||||
return notFound()
|
||||
|
||||
if (!env.SHOW_SIGNUP_FLOW) {
|
||||
// Hide content pages for signup routes when signup flow is disabled.
|
||||
if (isSignupRoute) {
|
||||
return notFound()
|
||||
}
|
||||
}
|
||||
|
||||
return <ContentPage />
|
||||
}
|
||||
case "loyalty-page":
|
||||
|
||||
@@ -20,10 +20,5 @@ export const signupVerify: LangRoute = {
|
||||
|
||||
export function isSignupPage(path: string): boolean {
|
||||
const signupPaths = [...Object.values(signup), ...Object.values(signupVerify)]
|
||||
const result = signupPaths.some((signupPath) => {
|
||||
const includes = signupPath.includes(path)
|
||||
return includes
|
||||
})
|
||||
|
||||
return result
|
||||
return signupPaths.some((signupPath) => signupPath.includes(path))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user