about summary refs log tree commit diff
path: root/src/lib/statsig/statsig.tsx
diff options
context:
space:
mode:
authorEric Bailey <git@esb.lol>2024-06-17 13:21:09 -0500
committerGitHub <noreply@github.com>2024-06-17 13:21:09 -0500
commit332524b7dec18b5e19edacdb976467d6725a5df0 (patch)
tree7e3a0256ea3b8d7e2861d4a558b7f9f7f979de96 /src/lib/statsig/statsig.tsx
parentf5f3bd8130c1ba1fee4030f758a158a983ff28c5 (diff)
downloadvoidsky-332524b7dec18b5e19edacdb976467d6725a5df0.tar.zst
Add `native_pwi_disabled` feature gate experiment (#4507)
* Add native_pwi_disabled feature gate experiment

* Use const
Diffstat (limited to 'src/lib/statsig/statsig.tsx')
-rw-r--r--src/lib/statsig/statsig.tsx10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/lib/statsig/statsig.tsx b/src/lib/statsig/statsig.tsx
index f6aed999f..b5a239c3a 100644
--- a/src/lib/statsig/statsig.tsx
+++ b/src/lib/statsig/statsig.tsx
@@ -14,6 +14,8 @@ import {useNonReactiveCallback} from '../hooks/useNonReactiveCallback'
 import {LogEvents} from './events'
 import {Gate} from './gates'
 
+const SDK_KEY = 'client-SXJakO39w9vIhl3D44u8UupyzFl4oZ2qPIkjwcvuPsV'
+
 type StatsigUser = {
   userID: string | undefined
   // TODO: Remove when enough users have custom.platform:
@@ -251,7 +253,7 @@ AppState.addEventListener('change', (state: AppStateStatus) => {
 })
 
 export async function tryFetchGates(
-  did: string,
+  did: string | undefined,
   strategy: 'prefer-low-latency' | 'prefer-fresh-gates',
 ) {
   try {
@@ -275,6 +277,10 @@ export async function tryFetchGates(
   }
 }
 
+export function initialize() {
+  return Statsig.initialize(SDK_KEY, null, createStatsigOptions([]))
+}
+
 export function Provider({children}: {children: React.ReactNode}) {
   const {currentAccount, accounts} = useSession()
   const did = currentAccount?.did
@@ -320,7 +326,7 @@ export function Provider({children}: {children: React.ReactNode}) {
     <GateCache.Provider value={gateCache}>
       <StatsigProvider
         key={did}
-        sdkKey="client-SXJakO39w9vIhl3D44u8UupyzFl4oZ2qPIkjwcvuPsV"
+        sdkKey={SDK_KEY}
         mountKey={currentStatsigUser.userID}
         user={currentStatsigUser}
         // This isn't really blocking due to short initTimeoutMs above.