React component

A React component is provided to enable simple integration of the Lobby with web sites built using React.

Installation

npm install @codemodity/gamity-ui-react

Usage

import { Lobby } from '@codemodity/gamity-ui-react'
 
...
 
export const TournamentPage = () => {
    return (
		<Lobby
			integrationRef="codemodity"
			environment="qa"
			brandRef="codemodity-casino"
			currency="USD"
			language='en'
			isTestMode={false}
			onGameLaunch={(gameProvider, gameCode) => {
				// your game launch logic here...
			}}
		/>
    )
}

When the isTestMode parameter is set to true, the Lobby generates its own test data and does not require a connection to the backend. This feature allows for a more efficient integration of the UI without the need for backend connections.

Parameters

parametertyperequireddefaultdescription
integrationRefstringyesThe unique Id of the account, provided by Codemodity.
environmentstringno’prod’Variable which by the lobby determines if it should connect to the local, QA or production backend. It values can be ‘local’, ‘qa’, ‘prod’ or undefined, in that case it will connect to the prod by default. Only used by the wrappers (e.g. React), not relevant for the plain js integration.
brandRefstringyesThe unique Id of a brand the player belongs to (e.g. BEEBET). brandRef and playerId together should be unique.
currencystringyesThe player’s currently selected currency on the site.
languagestringno’en’Culture code of the player or the site. This can be either a culture-neutral language code, such as en or fr, or a specific culture variant, such as en-GB, en-US, fr-FR, or fr-CA.
onGameLaunchvoidnoYou game launch logic. Invoked when the player clicks/taps on the game icon of an associated game in the lobby.
isTestModebooleannofalseIf true, the Lobby will render test data without connecting to the backend API. Useful for testing the UI only.
playerJwtTokenjwt token stringnoPlease see the Overview page for details on how to use this parameter. A HS256 signed JWT token that contains information about the player.
gamitySessionRefstringnoNOT USED YET, IGNORE THIS PARAMETER. A valid game session id that allows Gamity to make debit/credit calls against the casino’s wallet. If it is provided, the playerJwtToken parameter is not required.

playerJwtToken parameter

An HS256-signed JWT token contains information about the player. This token is necessary for player-dependent functionalities, such as determining the number of raffle tickets the current player has. Below is an example of a JWT token that includes the required fields:

{
    "integrationRef": "codemodity",
    "brandRef": "codemodity-casino",
    "playerId": "player-12345",
    "playerAlias": "Player's display name [OPTIONAL]",
    "currency": "USD",
    "exp": 1722110400
}

The exp field represents the expiration time of the token in Unix time. The token will be considered invalid after this time. This expiration can be relatively short-lived, such as 5 minutes, since this token is used more for authentication than for session duration.

The Lobby component can be rendered without the JWT token parameter. This allows the player-independent parts, such as tournaments, to start rendering in parallel to the creation of the JWT token, resulting in faster load times and improved user experience. Once the JWT token is ready, the component’s parameters can be updated with it.

⚠️

This token must be created on the server side with the signing key provided by Codemodity. This ensures that players cannot tamper with the token from the browser.