File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change
1
+ import { getLocale } from "next-intl/server"
1
2
import type { ReactNode } from "react"
2
3
3
4
import { IS_PREVIEW_DEPLOY , IS_PROD } from "@/lib/utils/env"
4
5
6
+ import { DEFAULT_LOCALE } from "@/lib/constants"
7
+
5
8
import { ClientABTestWrapper } from "./ClientABTestWrapper"
6
9
import { ABTestDebugPanel } from "./TestDebugPanel"
7
10
import { ABTestTracker } from "./TestTracker"
@@ -13,13 +16,19 @@ type ABTestWrapperProps = {
13
16
testKey : string
14
17
variants : ABTestVariants
15
18
fallback ?: ReactNode
19
+ enableAllLocales ?: boolean
16
20
}
17
21
18
22
const ABTestWrapper = async ( {
19
23
testKey,
20
24
variants,
21
25
fallback,
26
+ enableAllLocales,
22
27
} : ABTestWrapperProps ) => {
28
+ const locale = await getLocale ( )
29
+ if ( locale !== DEFAULT_LOCALE && ! enableAllLocales )
30
+ return < > { fallback || variants [ 0 ] } </ >
31
+
23
32
try {
24
33
// Get deterministic assignment
25
34
const assignment = await getABTestAssignment ( testKey )
You can’t perform that action at this time.
0 commit comments