@tugitark/vue-widget 1.0.4 → 1.1.0

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.js CHANGED
@@ -1,7 +1,93 @@
1
1
  // Copyright (c) 2026, TugiTark. All rights reserved.
2
2
 
3
- /// <reference types="Widget" />
3
+ import render from '@tugitark/declarative-widget';
4
4
 
5
- import Widget from './Widget.vue';
6
- export default Widget;
5
+ // Weirdly, this way of declaring a `vue` component has absolutly no dependencies on `vue`...
6
+ export default {
7
+ data() {
8
+ return {
9
+ firstTime_: true,
10
+ props_: {},
11
+ props_: {},
12
+ };
13
+ },
14
+ props: {
15
+ // Full props.
16
+ user: [String, null],
17
+ jwtFn: Function,
18
+ tenantId: String,
19
+ brandId: String,
20
+ brandName: String,
21
+ language: String,
22
+ customize: Object,
23
+ httpUrl: String,
24
+ wsUrl: String,
25
+ // Free props.
26
+ chatDisabledReason: String,
27
+ title: String,
28
+ body: String,
29
+ sections: Array,
30
+ // Display props.
31
+ open: {
32
+ type: Boolean,
33
+ default: undefined,
34
+ },
35
+ visible: {
36
+ type: Boolean,
37
+ default: undefined,
38
+ },
39
+ onNotification: Function,
40
+ onReady: Function,
41
+ onOpened: Function,
42
+ onClosed: Function,
43
+ onError: Function,
44
+ // Two of these are required to open a message.
45
+ proactiveMessage: String,
46
+ proactiveContext: String,
47
+ ticketLanguageCode: String,
48
+ },
49
+ methods: {
50
+ onNotification_(hasNotification) {
51
+ if (this.jwtFn == null && this.user == null) {
52
+ if (this.firstTime_) {
53
+ // Replicate FAQ internal behaviour at a per-component level.
54
+ this.onNotification?.(hasNotification);
55
+ }
56
+ } else {
57
+ this.onNotification?.(hasNotification);
58
+ }
59
+ },
60
+ onReady_() {
61
+ if (this.firstTime_) {
62
+ this.firstTime_ = false;
63
+ this.onReady?.();
64
+ }
65
+ },
66
+ onOpened_() { return this.onOpened?.(); },
67
+ onClosed_() { return this.onClosed?.(); },
68
+ onError_(e) { return this.onError?.(e); },
69
+ },
70
+ watc() {
71
+ return render(this.props_);
72
+ },
73
+ watch: {
74
+ $props: {
75
+ handler(props) {
76
+ render({
77
+ ...props,
78
+ onNotification: this.onNotification_,
79
+ onReady: this.onReady_,
80
+ onOpened: this.onOpened_,
81
+ onClosed: this.onClosed_,
82
+ onError: this.onError_,
83
+ });
84
+ },
85
+ deep: true,
86
+ immediate: true,
87
+ },
88
+ },
89
+ render() {
90
+ return null;
91
+ },
92
+ };
7
93
 
package/index.md CHANGED
@@ -24,14 +24,14 @@ const props = defineProps({
24
24
  <template>
25
25
  <TugiWidget
26
26
  :user="props.userId"
27
- brand_id="a040050697fc4b2db16acfbbad1d0da4"
28
- brand_name="Super Casino"
29
- tenant_id="gb-casinos-ltd"
27
+ brand-id="a040050697fc4b2db16acfbbad1d0da4"
28
+ brand-name="Super Casino"
29
+ tenant-id="gb-casinos-ltd"
30
30
  />
31
31
  </template>
32
32
  ```
33
33
 
34
- 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. The `brand_id`, `brand_name`, and `tenant_id` 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.
34
+ 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. The `brand-id`, `brand-name`, and `tenant-id` 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.
35
35
 
36
36
  `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.
37
37
 
@@ -63,9 +63,9 @@ async function jwtFn() {
63
63
  <template>
64
64
  <TugiWidget
65
65
  :jwt-fn="jwtFn"
66
- brand_id="a040050697fc4b2db16acfbbad1d0da4"
67
- brand_name="Super Casino"
68
- tenant_id="gb-casinos-ltd"
66
+ brand-id="a040050697fc4b2db16acfbbad1d0da4"
67
+ brand-name="Super Casino"
68
+ tenant-id="gb-casinos-ltd"
69
69
  http-url="https://app.tugi.ai/tugi.widget"
70
70
  ws-url="wss://ws.tugi.ai"
71
71
  :customize="{
package/package.json CHANGED
@@ -1,18 +1,17 @@
1
1
  {
2
2
  "name": "@tugitark/vue-widget",
3
- "version": "1.0.4",
3
+ "version": "1.1.0",
4
4
  "description": "Wraps the tugitark widget in a Vue component.",
5
- "scripts": {
6
- "release": "npm publish --access public"
7
- },
8
5
  "files": [
9
6
  "Widget.vue",
10
7
  "index.js",
11
8
  "index.md"
12
9
  ],
13
10
  "dependencies": {
14
- "@tugitark/declarative-widget": "^1.0.0",
15
- "vue": "^3.3.0"
11
+ "@tugitark/declarative-widget": "^1.0.1"
12
+ },
13
+ "peerDependencies": {
14
+ "vue": ">=0.0.0"
16
15
  },
17
16
  "keywords": [
18
17
  "Typescript",
package/Widget.vue DELETED
@@ -1,43 +0,0 @@
1
- // Copyright (c) 2026, TugiTark. All rights reserved.
2
-
3
- <script setup lang="ts">
4
- /// <reference types="Widget" />
5
-
6
- import { watch, ref, onMounted, onUnmounted } from 'vue';
7
- import render, { Props } from '@tugitark/declarative-widget';
8
-
9
- // Weird vue behaviour with optional boolean props. Ensure they don't default to `false`.
10
- const props = withDefaults(defineProps<Props>(), {
11
- open: void 0,
12
- visible: void 0,
13
- });
14
-
15
- // Is this the first time this component has been rendered ever?
16
- const firstTime = ref(true);
17
-
18
- function onNotification(hasNotification: boolean) {
19
- if (props.jwtFn == null && props.user == null) {
20
- if (firstTime.value) {
21
- // Replicate FAQ internal behaviour at a per-component level.
22
- props.onNotification?.(hasNotification);
23
- }
24
- }
25
- }
26
-
27
- function onReady() {
28
- if (firstTime.value) {
29
- firstTime.value = false;
30
- props.onReady?.();
31
- }
32
- }
33
-
34
- watch(props, (p) => render({ ...p, onReady, onNotification }), { deep: true, immediate: true });
35
-
36
- // Listen for events that require us to re-initialise the widget.
37
- //onMounted(reloadScript);
38
- //onUnmounted(unloadScript);
39
- </script>
40
-
41
- <template>
42
- </template>
43
-