@tugitark/react-widget 1.4.2 → 1.4.5

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/from-scratch.md CHANGED
@@ -35,7 +35,7 @@ The code below demonstrates the basics of what is going on behind the scenes wit
35
35
 
36
36
  The details here are partially supplied by Tugi Tark (e.g. the `brandId`), and otherwise customisable by you:
37
37
 
38
- ```javacript
38
+ ```javascript
39
39
  function initialise() {
40
40
  window.tugiWidget.initialize({
41
41
  jwtFn: getUserToken,
@@ -61,7 +61,7 @@ The code below demonstrates the basics of what is going on behind the scenes wit
61
61
 
62
62
  This requires a user that is logged in:
63
63
 
64
- ```javacript
64
+ ```javascript
65
65
  async function getUserToken() {
66
66
  const response = await fetch('/users/current/tugi-token');
67
67
  if (response.ok) {
@@ -78,7 +78,7 @@ The code below demonstrates the basics of what is going on behind the scenes wit
78
78
 
79
79
  If a user logs in after loading the widget tell it so it can update the JWT:
80
80
 
81
- ```javacript
81
+ ```javascript
82
82
  if (window.tugiWidget?.isInitialized()) {
83
83
  window.tugiWidget.refresh();
84
84
  }
package/index.md CHANGED
@@ -10,7 +10,7 @@ Also see [the original integration guide](https://www.tugitark.com/chat-setup) f
10
10
 
11
11
  This is the smallest number of properties that you can pass to `<TugiWidget>` and have it still operate correctly. These properties are given to you on signing up with Tugi Tark and must be entered accurately.
12
12
 
13
- ```javascript
13
+ ```react
14
14
  import TugiWidget from '@tugitark/react-widget';
15
15
 
16
16
  function Component(props) {
@@ -34,7 +34,7 @@ If your server has the standard `/.tugi` endpoints (as provided by our back-end
34
34
 
35
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.
36
36
 
37
- ```javascript
37
+ ```react
38
38
  import TugiWidget from '@tugitark/react-widget';
39
39
 
40
40
  interface Props {
@@ -108,7 +108,7 @@ A "proactive" message can be used to detect that a player has a problem and offe
108
108
 
109
109
  If both `tugiFn` and `user` are missing from the `<TugiWidget>` properties then the widget goes in to the special free mode (more accurately, both must be `null` or `undefined` - if you want a user who isn't logged in pass a `user` of `''`). In this mode the user cannot send or receive any messages, they can only view a few pre-defined FAQ-style help topics:
110
110
 
111
- ```javascript
111
+ ```react
112
112
  import TugiWidget from '@tugitark/react-widget';
113
113
 
114
114
  function Component(props) {
@@ -152,7 +152,7 @@ The following optional properties are shared with the full version:
152
152
 
153
153
  While there can be only one widget on the page there can be multiple `<TugiWidget>` components at once. Which one will be used is non-deterministic - even if you have one `<TugiWidget>` with `visible={true}` and another one with `visible={false}` this will not guarantee that the visible one is the one that gets shown, the invisible one may be "shown", resulting in neither being seen. The one selected is based on internal render and update orders. Further, having two at once may result in the widget being constantly unloaded and reloaded even when nothing has changed as the underlying code flips repeatedly between them. If you have two versions of the widget shown in different circumstances then make sure that the whole component is conditional:
154
154
 
155
- ```javascript
155
+ ```react
156
156
  return (
157
157
  disabled
158
158
  ? <TugiWidget
@@ -188,5 +188,5 @@ return (
188
188
 
189
189
  [Click here](using-library.md) to see how this component wraps the underlying [@tugitark/declarative-widget](https://gitlab.com/tugitark/integration/libraries/javascript/declarative-widget) library in a react component.
190
190
 
191
- [Click here][from-scratch.md) to get a better understanding of everything that that library is doing behind the scenes to inject the main widget script in to a page and initialise it.
191
+ [Click here](from-scratch.md) to get a better understanding of everything that that library is doing behind the scenes to inject the main widget script in to a page and initialise it.
192
192
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tugitark/react-widget",
3
- "version": "1.4.2",
3
+ "version": "1.4.5",
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",