@tugitark/vue-widget 1.0.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/Widget.vue +43 -0
- package/index.js +7 -0
- package/package.json +27 -0
package/Widget.vue
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
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
|
+
|
package/index.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tugitark/vue-widget",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Wraps the tugitark widget in a Vue component.",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"release": "npm publish --access public"
|
|
7
|
+
},
|
|
8
|
+
"files": [
|
|
9
|
+
"Widget.vue",
|
|
10
|
+
"index.js"
|
|
11
|
+
],
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@tugitark/declarative-widget": "^1.0.0",
|
|
14
|
+
"vue": "^3.5.26"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"Typescript",
|
|
18
|
+
"Vue",
|
|
19
|
+
"Tugitark",
|
|
20
|
+
"Casino",
|
|
21
|
+
"Integration",
|
|
22
|
+
"JWT",
|
|
23
|
+
"Library"
|
|
24
|
+
],
|
|
25
|
+
"author": "alex.cole@tugitark.com",
|
|
26
|
+
"license": "(c) 2026 Tugi Tark OÜ"
|
|
27
|
+
}
|