@@ -93,19 +93,18 @@ export function SurveyWebView(props: SurveyWebViewProps): JSX.Element | null {
9393 return null ;
9494 }
9595
96- const project = appConfig . get ( ) . environment . data . project ;
97- const styling = getStyling ( project , props . survey ) ;
98- const isBrandingEnabled = project . inAppSurveyBranding ;
96+ const settings = appConfig . get ( ) . workspace . data . settings ;
97+ const styling = getStyling ( settings , props . survey ) ;
98+ const isBrandingEnabled = settings . inAppSurveyBranding ;
9999
100100 const onCloseSurvey = ( ) : void => {
101- const { environment : environmentState , user : personState } =
102- appConfig . get ( ) ;
103- const filteredSurveys = filterSurveys ( environmentState , personState ) ;
101+ const { workspace, user : userState } = appConfig . get ( ) ;
102+ const filteredSurveys = filterSurveys ( workspace , userState ) ;
104103
105104 appConfig . update ( {
106105 ...appConfig . get ( ) ,
107- environment : environmentState ,
108- user : personState ,
106+ workspace ,
107+ user : userState ,
109108 filteredSurveys,
110109 } ) ;
111110
@@ -114,11 +113,11 @@ export function SurveyWebView(props: SurveyWebViewProps): JSX.Element | null {
114113 } ;
115114
116115 const surveyPlacement =
117- props . survey . projectOverwrites ?. placement ?? project . placement ;
116+ props . survey . projectOverwrites ?. placement ?? settings . placement ;
118117 const clickOutside =
119118 props . survey . projectOverwrites ?. clickOutsideClose ??
120- project . clickOutsideClose ;
121- const overlay = props . survey . projectOverwrites ?. overlay ?? project . overlay ;
119+ settings . clickOutsideClose ;
120+ const overlay = props . survey . projectOverwrites ?. overlay ?? settings . overlay ;
122121 const appUrl = appConfig . get ( ) . appUrl ;
123122
124123 return (
@@ -141,7 +140,7 @@ export function SurveyWebView(props: SurveyWebViewProps): JSX.Element | null {
141140 originWhitelist = { [ "https://*" , "http://*" ] }
142141 source = { {
143142 html : renderHtml ( {
144- environmentId : appConfig . get ( ) . environmentId ,
143+ workspaceId : appConfig . get ( ) . workspaceId ,
145144 contactId : appConfig . get ( ) . user . data . contactId ?? undefined ,
146145 survey : props . survey ,
147146 isBrandingEnabled,
@@ -214,7 +213,7 @@ export function SurveyWebView(props: SurveyWebViewProps): JSX.Element | null {
214213 const displays = [ ...existingDisplays , newDisplay ] ;
215214 const previousConfig = appConfig . get ( ) ;
216215
217- const updatedPersonState = {
216+ const updatedUserState = {
218217 ...previousConfig . user ,
219218 data : {
220219 ...previousConfig . user . data ,
@@ -224,14 +223,14 @@ export function SurveyWebView(props: SurveyWebViewProps): JSX.Element | null {
224223 } ;
225224
226225 const filteredSurveys = filterSurveys (
227- previousConfig . environment ,
228- updatedPersonState ,
226+ previousConfig . workspace ,
227+ updatedUserState ,
229228 ) ;
230229
231230 appConfig . update ( {
232231 ...previousConfig ,
233- environment : previousConfig . environment ,
234- user : updatedPersonState ,
232+ workspace : previousConfig . workspace ,
233+ user : updatedUserState ,
235234 filteredSurveys,
236235 } ) ;
237236 }
@@ -246,13 +245,13 @@ export function SurveyWebView(props: SurveyWebViewProps): JSX.Element | null {
246245 } ;
247246
248247 const filteredSurveys = filterSurveys (
249- appConfig . get ( ) . environment ,
248+ appConfig . get ( ) . workspace ,
250249 newPersonState ,
251250 ) ;
252251
253252 appConfig . update ( {
254253 ...appConfig . get ( ) ,
255- environment : appConfig . get ( ) . environment ,
254+ workspace : appConfig . get ( ) . workspace ,
256255 user : newPersonState ,
257256 filteredSurveys,
258257 } ) ;
@@ -380,7 +379,7 @@ const renderHtml = (
380379 onResponseCreated,
381380 onClose,
382381 };
383-
382+
384383 window.formbricksSurveys.renderSurvey(surveyProps);
385384 }
386385
0 commit comments