@tugitark/vue-widget 1.1.2 → 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.
- package/index.d.ts +59 -0
- package/index.js +88 -93
- package/package.json +12 -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,93 +1,88 @@
|
|
|
1
|
-
// Copyright (c) 2026, TugiTark. All rights reserved.
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
render() {
|
|
90
|
-
return null;
|
|
91
|
-
},
|
|
92
|
-
};
|
|
93
|
-
|
|
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,17 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tugitark/vue-widget",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Wraps the tugitark widget in a Vue component.",
|
|
5
|
+
"scripts": {
|
|
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"
|
|
9
|
+
},
|
|
5
10
|
"files": [
|
|
11
|
+
"index.d.ts",
|
|
6
12
|
"index.js",
|
|
7
13
|
"index.md"
|
|
8
14
|
],
|
|
9
15
|
"dependencies": {
|
|
10
|
-
"@tugitark/declarative-widget": "^1.0.
|
|
16
|
+
"@tugitark/declarative-widget": "^1.0.2"
|
|
11
17
|
},
|
|
12
18
|
"peerDependencies": {
|
|
13
19
|
"vue": ">=0.0.0"
|
|
14
20
|
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"vue": "^3.0.0",
|
|
23
|
+
"vue-tsc": "^3.2.2"
|
|
24
|
+
},
|
|
15
25
|
"keywords": [
|
|
16
26
|
"Typescript",
|
|
17
27
|
"Vue",
|