@tugitark/react-widget 1.5.3 → 1.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.md +6 -11
- package/package.json +1 -1
package/index.md
CHANGED
|
@@ -15,24 +15,19 @@ import TugiWidget from '@tugitark/react-widget';
|
|
|
15
15
|
|
|
16
16
|
function Component(props) {
|
|
17
17
|
return (
|
|
18
|
-
<TugiWidget
|
|
19
|
-
user={props.userId}
|
|
20
|
-
brandId="a040050697fc4b2db16acfbbad1d0da4"
|
|
21
|
-
brandName="Super Casino"
|
|
22
|
-
tenantId="gb-casinos-ltd"
|
|
23
|
-
/>
|
|
18
|
+
<TugiWidget user={props.userId} />
|
|
24
19
|
);
|
|
25
20
|
}
|
|
26
21
|
```
|
|
27
22
|
|
|
28
|
-
If your server has the standard `/.tugi` endpoints (as provided by our back-end libraries and documented in our [developer documentation](https://gitlab.com/tugitark/integration/docs)) this is enough to get started with the Tugi Widget.
|
|
23
|
+
If your server has the standard `/.tugi` endpoints (as provided by our back-end libraries and documented in our [developer documentation](https://gitlab.com/tugitark/integration/docs)) this is enough to get started with the Tugi Widget. `user` is the ID within your system of the current player. How you determine the current player's unique ID depends entirely on your system and is left as a provided parameter here. This is the ID that the widget will internally pass to the `/.tugi/jwt/issue` endpoint to retrieve the player's profile, and so must in some way identify an end-user on your server. Technically even `user` is optional, and not passing this either will use the unauthenticated flow (in which the AI Agent has no information on which to base responses, and where a player will require e-mail verification first), or try to get the user's ID from the server.
|
|
29
24
|
|
|
30
|
-
`
|
|
25
|
+
Calls to `render` are idempotent, if the parameter objects are equivalent. The library will perform deep value comparisons between the parameters of two calls and only act on those that have changed.
|
|
31
26
|
|
|
32
27
|
Custom Example
|
|
33
28
|
----------------
|
|
34
29
|
|
|
35
|
-
This is a more extensive widget example, with colour-scheme customisation and an explicit JWT lookup function. The HTTP and websocket addresses are also specified, though match the defaults.
|
|
30
|
+
This is a more extensive widget example, with colour-scheme customisation and an explicit JWT lookup function. The HTTP and websocket addresses are also specified, though match the defaults. The `brandId`, `brandName`, and `tenantId` will be provided by us based on details provided by you when signing up with our system. They are not secret, so can safely appear in client-side code, but are case-sensitive so must remain exactly as specified by us. When not specified (as in the previous example) they are retrieved from the `/.tugi/config` endpoint - either a custom version or one served by the `Tugi Players` library.
|
|
36
31
|
|
|
37
32
|
```react
|
|
38
33
|
import TugiWidget from '@tugitark/react-widget';
|
|
@@ -78,7 +73,7 @@ function Component(props: Props) {
|
|
|
78
73
|
|
|
79
74
|
The full list of properties that can be passed to the `<TugiWidget>` component are:
|
|
80
75
|
|
|
81
|
-
* `user` Optional. When given will be used to look up a player's data from the server. You can disable this automatic lookup by passing a custom `jwtFn` or by not passing the `user` parameter.
|
|
76
|
+
* `user` Optional. When given will be used to look up a player's data from the server. You can disable this automatic lookup by passing a custom `jwtFn` or by not passing the `user` parameter. If you specify neither `user` nor `jwtFn` then the player will get the unauthenticated version of the widget, or the free version (FAQ only) with a few extra parameters (see below).
|
|
82
77
|
* `jwtFn` Optional. A function to override the default method for retrieving a player's data (via JWT). While this and `user` are both optional, one of them must be specified.
|
|
83
78
|
* `brandId` Required. The ID of your brand, as provided by Tugi Tark.
|
|
84
79
|
* `brandName` Required. The name of your brand, as provided by you initially.
|
|
@@ -106,7 +101,7 @@ A "proactive" message can be used to detect that a player has a problem and offe
|
|
|
106
101
|
Free Version
|
|
107
102
|
--------------
|
|
108
103
|
|
|
109
|
-
If both `tugiFn` and `user` are missing from the `<TugiWidget>` properties
|
|
104
|
+
If both `tugiFn` and `user` are missing from the `<TugiWidget>` properties AND one of the free-mode-only properties are given then the widget goes in to the special free mode. In this mode the user cannot send or receive any messages, they can only view a few pre-defined FAQ-style help topics:
|
|
110
105
|
|
|
111
106
|
```react
|
|
112
107
|
import TugiWidget from '@tugitark/react-widget';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tugitark/react-widget",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.4",
|
|
4
4
|
"description": "Wraps the tugitark widget in a React component.",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "npx esbuild index.ts --target=es6 --outfile=index.js && sed -i 's/\\bconst\\b/var/g' index.js && sed -i 's/\\blet\\b/var/g' index.js && npx esbuild index.js --allow-overwrite --minify --target=es5 --outfile=index.js && npx tsc --noErrorTruncation --declaration --emitDeclarationOnly --target es6 --module nodenext --moduleResolution nodenext --outDir . index.ts"
|