@tugitark/vue-widget 1.2.0 → 1.3.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.
Files changed (3) hide show
  1. package/index.d.ts +59 -0
  2. package/index.js +88 -92
  3. package/package.json +9 -2
package/index.d.ts ADDED
@@ -0,0 +1,59 @@
1
+ import { type Props } from '@tugitark/declarative-widget';
2
+ import type { PropType } from 'vue';
3
+ type Sections = NonNullable<Props['sections']>;
4
+ type Customise = NonNullable<Props['customize']>;
5
+ declare const _default: {
6
+ data(): {
7
+ firstTime_: boolean;
8
+ props_: {};
9
+ };
10
+ props: {
11
+ user: StringConstructor;
12
+ jwtFn: FunctionConstructor;
13
+ tenantId: StringConstructor;
14
+ brandId: StringConstructor;
15
+ brandName: StringConstructor;
16
+ language: StringConstructor;
17
+ customize: PropType<Customise>;
18
+ httpUrl: StringConstructor;
19
+ wsUrl: StringConstructor;
20
+ chatDisabledReason: StringConstructor;
21
+ title: StringConstructor;
22
+ body: StringConstructor;
23
+ sections: PropType<Sections>;
24
+ open: {
25
+ type: BooleanConstructor;
26
+ default: any;
27
+ };
28
+ visible: {
29
+ type: BooleanConstructor;
30
+ default: any;
31
+ };
32
+ onNotification: PropType<(hasNotification: boolean) => void>;
33
+ onReady: PropType<() => void>;
34
+ onOpened: PropType<() => void>;
35
+ onClosed: PropType<() => void>;
36
+ onError: PropType<(e: any) => void>;
37
+ proactiveMessage: StringConstructor;
38
+ proactiveContext: StringConstructor;
39
+ ticketLanguageCode: StringConstructor;
40
+ };
41
+ methods: {
42
+ onNotification_(hasNotification: any): void;
43
+ onReady_(): void;
44
+ onOpened_(): void;
45
+ onClosed_(): void;
46
+ onError_(e: any): void;
47
+ };
48
+ watc(): void;
49
+ watch: {
50
+ $props: {
51
+ handler(props: any): void;
52
+ deep: boolean;
53
+ immediate: boolean;
54
+ };
55
+ };
56
+ render(): any;
57
+ };
58
+ export default _default;
59
+ //# sourceMappingURL=index.d.ts.map
package/index.js CHANGED
@@ -1,92 +1,88 @@
1
- // Copyright (c) 2026, TugiTark. All rights reserved.
2
-
3
- import render from '@tugitark/declarative-widget';
4
-
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
- return;
55
- }
56
- }
57
- this.onNotification && this.onNotification(hasNotification);
58
- },
59
- onReady_() {
60
- if (this.firstTime_) {
61
- this.firstTime_ = false;
62
- this.onReady && this.onReady();
63
- }
64
- },
65
- onOpened_() { this.onOpened && this.onOpened(); },
66
- onClosed_() { this.onClosed && this.onClosed(); },
67
- onError_(e) { this.onError && this.onError(e); },
68
- },
69
- watc() {
70
- return render(this.props_);
71
- },
72
- watch: {
73
- $props: {
74
- handler(props) {
75
- render({
76
- ...props,
77
- onNotification: this.onNotification_,
78
- onReady: this.onReady_,
79
- onOpened: this.onOpened_,
80
- onClosed: this.onClosed_,
81
- onError: this.onError_,
82
- });
83
- },
84
- deep: true,
85
- immediate: true,
86
- },
87
- },
88
- render() {
89
- return null;
90
- },
91
- };
92
-
1
+ // Copyright (c) 2026, TugiTark. All rights reserved.
2
+ import render from '@tugitark/declarative-widget';
3
+ // Weirdly, this way of declaring a `vue` component has absolutly no dependencies on `vue`...
4
+ export default {
5
+ data() {
6
+ return {
7
+ firstTime_: true,
8
+ props_: {},
9
+ };
10
+ },
11
+ props: {
12
+ // Full props.
13
+ user: String,
14
+ jwtFn: Function,
15
+ tenantId: String,
16
+ brandId: String,
17
+ brandName: String,
18
+ language: String,
19
+ customize: Object,
20
+ httpUrl: String,
21
+ wsUrl: String,
22
+ // Free props.
23
+ chatDisabledReason: String,
24
+ title: String,
25
+ body: String,
26
+ sections: Array,
27
+ // Display props.
28
+ open: {
29
+ type: Boolean,
30
+ default: undefined,
31
+ },
32
+ visible: {
33
+ type: Boolean,
34
+ default: undefined,
35
+ },
36
+ onNotification: Function,
37
+ onReady: Function,
38
+ onOpened: Function,
39
+ onClosed: Function,
40
+ onError: Function,
41
+ // Two of these are required to open a message.
42
+ proactiveMessage: String,
43
+ proactiveContext: String,
44
+ ticketLanguageCode: String,
45
+ },
46
+ methods: {
47
+ onNotification_(hasNotification) {
48
+ if (this.jwtFn == null && this.user == null) {
49
+ if (!this.firstTime_) {
50
+ // Replicate FAQ internal behaviour at a per-component level.
51
+ return;
52
+ }
53
+ }
54
+ this.onNotification && this.onNotification(hasNotification);
55
+ },
56
+ onReady_() {
57
+ if (this.firstTime_) {
58
+ this.firstTime_ = false;
59
+ this.onReady && this.onReady();
60
+ }
61
+ },
62
+ onOpened_() { this.onOpened && this.onOpened(); },
63
+ onClosed_() { this.onClosed && this.onClosed(); },
64
+ onError_(e) { this.onError && this.onError(e); },
65
+ },
66
+ watc() {
67
+ return render(this.props_);
68
+ },
69
+ watch: {
70
+ $props: {
71
+ handler(props) {
72
+ render({
73
+ ...props,
74
+ onNotification: this.onNotification_,
75
+ onReady: this.onReady_,
76
+ onOpened: this.onOpened_,
77
+ onClosed: this.onClosed_,
78
+ onError: this.onError_,
79
+ });
80
+ },
81
+ deep: true,
82
+ immediate: true,
83
+ },
84
+ },
85
+ render() {
86
+ return null;
87
+ },
88
+ };
package/package.json CHANGED
@@ -1,11 +1,14 @@
1
1
  {
2
2
  "name": "@tugitark/vue-widget",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "Wraps the tugitark widget in a Vue component.",
5
5
  "scripts": {
6
- "release": "npm publish --access public"
6
+ "build": "npx tsc --noErrorTruncation --esModuleInterop --resolveJsonModule --module esnext --moduleResolution bundler --rewriteRelativeImportExtensions --forceConsistentCasingInFileNames false --declaration --declarationMap --target es2022 --outDir . index.ts",
7
+ "release": "npm publish --access public",
8
+ "prerelease": "npm run build"
7
9
  },
8
10
  "files": [
11
+ "index.d.ts",
9
12
  "index.js",
10
13
  "index.md"
11
14
  ],
@@ -15,6 +18,10 @@
15
18
  "peerDependencies": {
16
19
  "vue": ">=0.0.0"
17
20
  },
21
+ "devDependencies": {
22
+ "vue": "^3.0.0",
23
+ "vue-tsc": "^3.2.2"
24
+ },
18
25
  "keywords": [
19
26
  "Typescript",
20
27
  "Vue",