@weldsuite/helpdesk-widget-sdk 1.0.2
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/LICENSE +21 -0
- package/README.md +824 -0
- package/dist/angular.d.ts +764 -0
- package/dist/angular.esm.js +2768 -0
- package/dist/angular.esm.js.map +1 -0
- package/dist/angular.js +2775 -0
- package/dist/angular.js.map +1 -0
- package/dist/index.d.ts +1428 -0
- package/dist/index.esm.js +2577 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +2620 -0
- package/dist/index.js.map +1 -0
- package/dist/index.umd.js +2626 -0
- package/dist/index.umd.js.map +1 -0
- package/dist/react.d.ts +666 -0
- package/dist/react.esm.js +2479 -0
- package/dist/react.esm.js.map +1 -0
- package/dist/react.js +2489 -0
- package/dist/react.js.map +1 -0
- package/dist/vue-composables.esm.js +2442 -0
- package/dist/vue-composables.esm.js.map +1 -0
- package/dist/vue-composables.js +2445 -0
- package/dist/vue-composables.js.map +1 -0
- package/frameworks/svelte/HelpdeskWidget.svelte +101 -0
- package/frameworks/svelte/index.ts +46 -0
- package/frameworks/svelte/shims-svelte.d.ts +4 -0
- package/frameworks/vue/HelpdeskWidget.vue +46 -0
- package/frameworks/vue/index.ts +47 -0
- package/frameworks/vue/shims-vue.d.ts +5 -0
- package/frameworks/vue/useHelpdeskWidget.ts +90 -0
- package/package.json +102 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vue 3 integration for Helpdesk Widget SDK
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```vue
|
|
6
|
+
* // Using the component
|
|
7
|
+
* <script setup>
|
|
8
|
+
* import { HelpdeskWidget } from '@weldsuite/helpdesk-widget-sdk/vue';
|
|
9
|
+
* </script>
|
|
10
|
+
*
|
|
11
|
+
* <template>
|
|
12
|
+
* <HelpdeskWidget widget-id="your-widget-id" />
|
|
13
|
+
* </template>
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```vue
|
|
18
|
+
* // Using the composable
|
|
19
|
+
* <script setup lang="ts">
|
|
20
|
+
* import { useHelpdeskWidget } from '@weldsuite/helpdesk-widget-sdk/vue';
|
|
21
|
+
*
|
|
22
|
+
* const widget = useHelpdeskWidget({ widgetId: 'your-widget-id' });
|
|
23
|
+
* </script>
|
|
24
|
+
*
|
|
25
|
+
* <template>
|
|
26
|
+
* <button @click="widget?.open()">Show Support</button>
|
|
27
|
+
* </template>
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
export { default as HelpdeskWidget } from './HelpdeskWidget.vue';
|
|
32
|
+
export { useHelpdeskWidget, useHelpdeskWidgetControls } from './useHelpdeskWidget';
|
|
33
|
+
|
|
34
|
+
// Re-export core types and configs for convenience
|
|
35
|
+
export type {
|
|
36
|
+
WeldConfig,
|
|
37
|
+
HelpdeskWidgetConfig,
|
|
38
|
+
WidgetEventType,
|
|
39
|
+
WidgetEvent,
|
|
40
|
+
WidgetEventHandler,
|
|
41
|
+
} from '../../src/index';
|
|
42
|
+
|
|
43
|
+
export {
|
|
44
|
+
DEFAULT_CONFIG,
|
|
45
|
+
WeldSDK,
|
|
46
|
+
HelpdeskWidget as HelpdeskWidgetClass,
|
|
47
|
+
} from '../../src/index';
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { onMounted, onUnmounted, ref } from 'vue';
|
|
2
|
+
import { WeldSDK, type WeldConfig } from '../../src/index';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Vue 3 composable for the Helpdesk Widget
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```vue
|
|
9
|
+
* <script setup lang="ts">
|
|
10
|
+
* import { useHelpdeskWidget } from '@weldsuite/helpdesk-widget-sdk/vue';
|
|
11
|
+
*
|
|
12
|
+
* const widget = useHelpdeskWidget({ widgetId: 'your-widget-id' });
|
|
13
|
+
* </script>
|
|
14
|
+
*
|
|
15
|
+
* <template>
|
|
16
|
+
* <button @click="widget?.open()">Show Support</button>
|
|
17
|
+
* </template>
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export function useHelpdeskWidget(config: WeldConfig) {
|
|
21
|
+
const widget = ref<WeldSDK | null>(null);
|
|
22
|
+
|
|
23
|
+
onMounted(() => {
|
|
24
|
+
try {
|
|
25
|
+
widget.value = new WeldSDK(config);
|
|
26
|
+
widget.value.init();
|
|
27
|
+
} catch (error) {
|
|
28
|
+
console.error('Failed to initialize Helpdesk Widget:', error);
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
onUnmounted(() => {
|
|
33
|
+
if (widget.value) {
|
|
34
|
+
widget.value.destroy();
|
|
35
|
+
widget.value = null;
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
return widget;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Composable that provides widget control methods
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```vue
|
|
47
|
+
* <script setup lang="ts">
|
|
48
|
+
* import { useHelpdeskWidgetControls } from '@weldsuite/helpdesk-widget-sdk/vue';
|
|
49
|
+
*
|
|
50
|
+
* const { open, close, toggle } = useHelpdeskWidgetControls({
|
|
51
|
+
* widgetId: 'your-widget-id'
|
|
52
|
+
* });
|
|
53
|
+
* </script>
|
|
54
|
+
*
|
|
55
|
+
* <template>
|
|
56
|
+
* <div>
|
|
57
|
+
* <button @click="open">Show Support</button>
|
|
58
|
+
* <button @click="close">Hide Support</button>
|
|
59
|
+
* <button @click="toggle">Toggle Support</button>
|
|
60
|
+
* </div>
|
|
61
|
+
* </template>
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
export function useHelpdeskWidgetControls(config: WeldConfig) {
|
|
65
|
+
const widget = useHelpdeskWidget(config);
|
|
66
|
+
|
|
67
|
+
const open = () => {
|
|
68
|
+
widget.value?.open();
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const close = () => {
|
|
72
|
+
widget.value?.close();
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const toggle = () => {
|
|
76
|
+
widget.value?.toggle();
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const sendMessage = (message: string) => {
|
|
80
|
+
widget.value?.sendMessage(message);
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
return {
|
|
84
|
+
widget,
|
|
85
|
+
open,
|
|
86
|
+
close,
|
|
87
|
+
toggle,
|
|
88
|
+
sendMessage,
|
|
89
|
+
};
|
|
90
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@weldsuite/helpdesk-widget-sdk",
|
|
3
|
+
"version": "1.0.2",
|
|
4
|
+
"description": "Easy-to-use helpdesk widget SDK that loads via iframe",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.esm.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.esm.js",
|
|
12
|
+
"require": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./react": {
|
|
15
|
+
"types": "./dist/react.d.ts",
|
|
16
|
+
"import": "./dist/react.esm.js",
|
|
17
|
+
"require": "./dist/react.js"
|
|
18
|
+
},
|
|
19
|
+
"./vue": {
|
|
20
|
+
"types": "./frameworks/vue/index.ts",
|
|
21
|
+
"import": "./frameworks/vue/index.ts",
|
|
22
|
+
"require": "./frameworks/vue/index.ts"
|
|
23
|
+
},
|
|
24
|
+
"./angular": {
|
|
25
|
+
"types": "./dist/angular.d.ts",
|
|
26
|
+
"import": "./dist/angular.esm.js",
|
|
27
|
+
"require": "./dist/angular.js"
|
|
28
|
+
},
|
|
29
|
+
"./svelte": {
|
|
30
|
+
"types": "./frameworks/svelte/index.ts",
|
|
31
|
+
"svelte": "./frameworks/svelte/HelpdeskWidget.svelte",
|
|
32
|
+
"import": "./frameworks/svelte/index.ts",
|
|
33
|
+
"require": "./frameworks/svelte/index.ts"
|
|
34
|
+
},
|
|
35
|
+
"./package.json": "./package.json"
|
|
36
|
+
},
|
|
37
|
+
"files": [
|
|
38
|
+
"dist",
|
|
39
|
+
"frameworks/vue",
|
|
40
|
+
"frameworks/svelte",
|
|
41
|
+
"README.md",
|
|
42
|
+
"LICENSE"
|
|
43
|
+
],
|
|
44
|
+
"scripts": {
|
|
45
|
+
"build": "rollup -c",
|
|
46
|
+
"dev": "rollup -c -w",
|
|
47
|
+
"typecheck": "tsc --noEmit",
|
|
48
|
+
"prepublishOnly": "pnpm run build"
|
|
49
|
+
},
|
|
50
|
+
"keywords": [
|
|
51
|
+
"helpdesk",
|
|
52
|
+
"widget",
|
|
53
|
+
"chat",
|
|
54
|
+
"customer-support",
|
|
55
|
+
"iframe",
|
|
56
|
+
"embed",
|
|
57
|
+
"sdk"
|
|
58
|
+
],
|
|
59
|
+
"author": "WeldSuite",
|
|
60
|
+
"license": "MIT",
|
|
61
|
+
"repository": {
|
|
62
|
+
"type": "git",
|
|
63
|
+
"url": "https://github.com/weldcorporation/weldsuite.git",
|
|
64
|
+
"directory": "packages/helpdesk-widget-sdk"
|
|
65
|
+
},
|
|
66
|
+
"devDependencies": {
|
|
67
|
+
"@rollup/plugin-json": "^6.1.0",
|
|
68
|
+
"@rollup/plugin-typescript": "^11.1.6",
|
|
69
|
+
"@types/node": "^20.11.5",
|
|
70
|
+
"rollup": "^4.9.6",
|
|
71
|
+
"rollup-plugin-dts": "^6.1.0",
|
|
72
|
+
"tslib": "^2.6.2",
|
|
73
|
+
"typescript": "^5.3.3"
|
|
74
|
+
},
|
|
75
|
+
"peerDependencies": {
|
|
76
|
+
"@angular/core": ">=14.0.0",
|
|
77
|
+
"react": ">=16.8.0",
|
|
78
|
+
"react-dom": ">=16.8.0",
|
|
79
|
+
"svelte": ">=3.0.0",
|
|
80
|
+
"vue": ">=3.0.0"
|
|
81
|
+
},
|
|
82
|
+
"peerDependenciesMeta": {
|
|
83
|
+
"react": {
|
|
84
|
+
"optional": true
|
|
85
|
+
},
|
|
86
|
+
"react-dom": {
|
|
87
|
+
"optional": true
|
|
88
|
+
},
|
|
89
|
+
"vue": {
|
|
90
|
+
"optional": true
|
|
91
|
+
},
|
|
92
|
+
"@angular/core": {
|
|
93
|
+
"optional": true
|
|
94
|
+
},
|
|
95
|
+
"svelte": {
|
|
96
|
+
"optional": true
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
"engines": {
|
|
100
|
+
"node": ">=18.0.0"
|
|
101
|
+
}
|
|
102
|
+
}
|