Web/Javascript SDK (Games)
Installation
npm install Lucra-Sports/lucra-web-sdkThe package is hosted as a public repository on Github. To specify a specific version of the SDK to install, add #vX.Y.Z after lucra-web-sdk in your package.json file. The available releases can be found at https://github.com/Lucra-Sports/lucra-web-sdk/releases. We recommend using the most recent version of the SDK.
Typescript
The SDK was developed with Typescript in mind. If you are using Typescript, everything should be typed including the class constructor and the available methods and arguments on the LucraClient class.
Create an instance of LucraClient
API Key Update (Required)
Starting with Web SDK > 0.20.2, Lucra SDK initialization now requires both tenantId and apiKey.
What changed
Lucra SDK initialization requires an explicit
apiKey.Using
tenantIdalone is no longer supported in these versions.Existing integrations on older Web SDK versions will continue to work.
Required action
Update your Lucra SDK initialization to include both
tenantIdandapiKey.
Notes
Backend API keys are unchanged.
Use the appropriate key for Sandbox vs Production environments.
Registering `onMessage` functions
If you need to register a handler function for any of the onMessagecallbacks, you can do so after instantiation like so:
The deepLinkhandler is an example of where you might want to do this since the handler of the function probably needs the instance of LucraClientto respond. For example, consider this handler function,
Note that when you register this function at instantiation, lucraClientwill be undefined. You can later in your code, when lucraClientis no longer undefined, do:
Opening up Lucra
Recommended Screen Size
We recommend that the element you pass to the LucraClient be bound by a width between 320px - 640px for the optimal experience.
Messages you can send to LucraClient
userUpdated - update the LucraClient user with known information about the current user. This information will be persisted to LucraSports and will be used to pre-fill forms the user will have to fill out for things like Identity Verification
You may optionally include a metadata property as valid JSON related to the Lucra user. Key/value pairs should be of type String only. Note: On the metadata object, the external_id property will be used to index, if provided. Passing in metadata in this way will be used to link client users with the Lucra user for autosettlement identification purposes.
Sending a message to LucraClient
Logging out
Sign the user out of Lucra
Last updated