CondoWebAppGetLaunchParams

This method takes no parameters and returns the current users context. The user context is required by the mini-application for session and interface management.

Platforms

  • B2B-Web

Return value

If successful, you will receive a JSON object of the following type:
typescript
type GetLaunchParamsData = { condoUserId: string | null // Current user ID condoUserType: 'staff' | 'resident' // User type condoLocale: string // Current interface locale ("en" / "ru") condoContextEntity: 'Organization' | 'Resident' // Context entity type condoContextEntityId: string | null // Context entity ID }

About user type and context entity

The user type is simple. In B2B applications it is always an staff, in B2C applications it is a resident.

condoContextEntity in B2B applications

A B2B application is always opened by an employee of some organization. In this case you will get its ID in the field condoContextEntityId and condoContextEntity will always be set to Organization. The user can be an employee of more than one organization, but the IFrame of the current mini-application is reloaded when it is changed in the main application interface. So you can safely put a CondoWebAppGetLaunchParams handler on the page loader (window.addEventListener("load", () => {...})) in case of pure JS or useEffect() => {...}, []) in case of React).

condoContextEntity in B2C applications

A B2C application always opened by a resident. A resident can reside in several addresses (units), each of which corresponds to a different Resident entity, the id of which you can get when opening the B2C application.

Usage example

typescript
import '@/styles/globals.css' import { cookies } from 'next/headers' import React, { useEffect } from 'react' import bridge from '@open-condo/bridge' import type { AppProps } from 'next/app' export default function App ({ Component, pageProps }: AppProps): React.ReactNode { useEffect(() => { bridge.send('CondoWebAppGetLaunchParams').then(data => { console.log(data.condoLocale) // Set intl locale if you have some if (cookies().get('currentUserId')?.value !== data.condoUserId) { // Start auth process } }).catch((error) => { // Retry or begin auth process }) }, []) return ( <Component {...pageProps} /> ) }