Vue.js component

A Vue.js component is provided to enable simple integration of the widget with web sites built using Vue.js.

Installation:

npm install @codemodity/tournament-ui-widget-vue

With the parameter "testMode": true, the widget generates test data for itself and does not require any backend connection. This is useful to efficiently integrate the UI without worrying about any backend connections. When using the widget with the backend, the testMode parameter must be false or omitted, while the token parameter must be provided.

Test mode:

import TournamentWidget from '@codemodity/tournament-ui-widget-vue';
 
...
 
<TournamentWidget :test-mode="true" account-id="codemodity-qa" language="pt" />

Real mode:

import TournamentWidget from '@codemodity/tournament-ui-widget-vue';
 
...
 
<TournamentWidget :token="token" />

Parameters

In Vue.js, parameters can be written with dashes. For example, testMode can be written as test-mode.

parametertyperequireddefaultdescription
isTestModebooleannofalseIf true, the widget will render test data without connecting to the backend API. Useful for testing the UI only.
tokenstring/JWTonly if testMode is falseA JWT token that contains parameters for player and game identification. The exact parameters within the token are described in the next section. The token should be generated on server side using the private signing key provided by Codemodity, to prevent players from tampering with it from the browser.
languagestringno’en’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. If the specified culture is not supported, the fallback ‘en’ will be used.
isDraggablebooleannotrueif true, the players will be able to drag the compact widget anywhere on the screen.
isCollapsibleOnDesktopbooleannotrueif true, on desktop, the widget will act like on mobile, as a small, at-a-glance widget that can be expanded into full view upon clicking on it. If false, the expanded full view will be the default, that cannot be closed.
openOnRightSidebooleannotrueif true, the expanded leaderboard will open on the right side of the screen.

Token parameters

Some parameters are passed as a JWT token so that those data cannot be tampered with. The signing algorithm is HS256. The signing key is provided by Codemodity separately, in a secure way. The token must be generated on the server side for security reasons. You may use one of the JWT libraries listed here: https://jwt.io/libraries

parametertyperequireddescription
brandIdstringyesThe unique Id of a brand the player belongs to (e.g. HAPPYLUKE). brandId and playerId together should be unique.
playerIdstringyesThe Id of the player in the brand/EC system. brandId and playerId together must be unique.
playerAliasstringnoThe nickname of the player that the leaderboard displays. e.g “casinoking82”.
gameIdstringyesUnique Id of the Game that the player launched.
currencystringyesCurrency of the player.
segmentationobjectnoOptional array for player segmentation, determined by the client system. See an example in the Segmentation section below.
expseconds since EpochyesStandard JWT expiration time. It is up to the discretion of the JWT token generator to pick a proper expiration date. This token will be used only once per widget launch, at the time the launch happens, thus it can be very short lived.

Segmentation

Example segmentation object:

"segmentation": {
    "codes": [
      "Tier-2",
      "VIP",
	  "Gold"
    ]
  }