 
   fbRequestCallback : (request, opts={}, callback, errback) =>
     (response) =>
-      @fbUiCallback(request,response,opts.path) if opts.uiAction
+      @fbUiCallback(request,response,opts.path) if opts.isUICall
       if !response or response?.error
         errorMsg = if (response) then "[Facebook Error] #{response.error.type}  : #{response.error.message}" else "[Facebook Error] Unknown error"
         return errback(errorMsg, { response, request })
-
       callback({ response, provider: 'facebook' })
 
   fbUiCallback : (req, res, path)=>
     @hideIframe()
-    endpoint = switch path
-      when 'ui.apprequests' then 'apprequests'
-      when 'ui.share' then 'share'
-      when 'ui.feed' then 'feed'
-    opts = { path: endpoint, method: 'post', params: res }
+    opts = { path: path, method: 'post', params: res }
     @wrappedRequest(opts)
 
   updateFBUserStatus: (res)=>


  subscribeToFBEvents : ()->
    return unless FB?.Event?
    FB.Event.subscribe 'auth.statusChange',       @updateFBUserStatus
    FB.Event.subscribe 'auth.authResponseChange', @updateFBUserStatus
    FB.Event.subscribe 'auth.login',              @updateFBUserStatus
    FB.Event.subscribe 'auth.logout',             @updateFBUserStatus

  loadFbSdk: (config)->
    dfd = promises.deferred()

  performRequest: (request,callback,errback)=>

    path = request.path
    isUICall = (path=='ui' and request.params?.method?)

    fbErrback = (msg, res)->
      res.time = new Date()
      errback(res)

    fbCallback = @fbRequestCallback(request, {isUICall, path}, callback, errback)

    if path == 'fql.query'
      FB.api({ method: 'fql.query', query: request.params.query },fbCallback)

    else if isUICall
      params = clone(request.params)

      @showIframe()
      trackParams = { ui_request_id: utils?.uuid?() || (new Date()).getTime() }
