nerdagent-chat-widget-vue 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/README.md ADDED
@@ -0,0 +1,211 @@
1
+ # @nerdagent/chat-widget-vue
2
+
3
+ Vue wrapper for the NerdAgent Chat Widget built with Stencil.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @nerdagent/chat-widget-vue
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ### Option 1: Component Registration (Recommended)
14
+
15
+ ```typescript
16
+ // main.ts
17
+ import { createApp } from 'vue';
18
+ import App from './App.vue';
19
+ import { NerdChatWidget } from '@nerdagent/chat-widget-vue';
20
+
21
+ const app = createApp(App);
22
+
23
+ // Register component globally
24
+ app.component('NerdChatWidget', NerdChatWidget);
25
+
26
+ app.mount('#app');
27
+ ```
28
+
29
+ ```vue
30
+ <!-- App.vue -->
31
+ <template>
32
+ <div id="app">
33
+ <NerdChatWidget
34
+ agent-name="Support Agent"
35
+ agent-role="Customer Support"
36
+ primary-color="#2d3e50"
37
+ accent-color="#4e8cff"
38
+ welcome-message="Hi! How can I help?"
39
+ position="bottom-right"
40
+ width="350"
41
+ height="500"
42
+ :show-minimize-button="true"
43
+ :show-timestamps="true"
44
+ :enable-file-upload="false"
45
+ :enable-speech="false"
46
+ :show-powered-by="true"
47
+ @messageSent="handleMessageSent"
48
+ @widgetOpened="handleWidgetOpened"
49
+ @widgetClosed="handleWidgetClosed"
50
+ />
51
+ </div>
52
+ </template>
53
+
54
+ <script setup lang="ts">
55
+ const handleMessageSent = (event: { message: string; timestamp: Date }) => {
56
+ console.log('Message sent:', event);
57
+ };
58
+
59
+ const handleWidgetOpened = () => {
60
+ console.log('Widget opened');
61
+ };
62
+
63
+ const handleWidgetClosed = () => {
64
+ console.log('Widget closed');
65
+ };
66
+ </script>
67
+ ```
68
+
69
+ ### Option 2: Plugin Registration
70
+
71
+ ```typescript
72
+ // main.ts
73
+ import { createApp } from 'vue';
74
+ import App from './App.vue';
75
+ import { NerdChatWidgetPlugin } from '@nerdagent/chat-widget-vue';
76
+
77
+ const app = createApp(App);
78
+
79
+ // Use as plugin
80
+ app.use(NerdChatWidgetPlugin);
81
+
82
+ app.mount('#app');
83
+ ```
84
+
85
+ ### Option 3: Local Component Registration
86
+
87
+ ```vue
88
+ <template>
89
+ <div>
90
+ <NerdChatWidget
91
+ agent-name="Support Agent"
92
+ @messageSent="handleMessageSent"
93
+ />
94
+ </div>
95
+ </template>
96
+
97
+ <script setup lang="ts">
98
+ import { NerdChatWidget } from '@nerdagent/chat-widget-vue';
99
+
100
+ const handleMessageSent = (event: { message: string; timestamp: Date }) => {
101
+ console.log('Message sent:', event);
102
+ };
103
+ </script>
104
+ ```
105
+
106
+ ### With Composition API
107
+
108
+ ```vue
109
+ <template>
110
+ <div>
111
+ <NerdChatWidget
112
+ :agent-name="config.agentName"
113
+ :primary-color="config.primaryColor"
114
+ :position="config.position"
115
+ @messageSent="onMessageSent"
116
+ @widgetOpened="onWidgetOpened"
117
+ @widgetClosed="onWidgetClosed"
118
+ />
119
+ </div>
120
+ </template>
121
+
122
+ <script setup lang="ts">
123
+ import { ref } from 'vue';
124
+ import { NerdChatWidget, WidgetPosition } from '@nerdagent/chat-widget-vue';
125
+
126
+ interface Config {
127
+ agentName: string;
128
+ primaryColor: string;
129
+ position: WidgetPosition;
130
+ }
131
+
132
+ const config = ref<Config>({
133
+ agentName: 'Support Agent',
134
+ primaryColor: '#2d3e50',
135
+ position: 'bottom-right'
136
+ });
137
+
138
+ const onMessageSent = (event: { message: string; timestamp: Date }) => {
139
+ console.log('Message sent:', event);
140
+ };
141
+
142
+ const onWidgetOpened = () => {
143
+ console.log('Widget opened');
144
+ };
145
+
146
+ const onWidgetClosed = () => {
147
+ console.log('Widget closed');
148
+ };
149
+ </script>
150
+ ```
151
+
152
+ ### Vite Configuration
153
+
154
+ If you're using Vite, you may need to configure it to recognize the custom elements:
155
+
156
+ ```javascript
157
+ // vite.config.js
158
+ import { defineConfig } from 'vite'
159
+ import vue from '@vitejs/plugin-vue'
160
+
161
+ export default defineConfig({
162
+ plugins: [
163
+ vue({
164
+ template: {
165
+ compilerOptions: {
166
+ isCustomElement: (tag) => tag.startsWith('nerd-')
167
+ }
168
+ }
169
+ })
170
+ ]
171
+ })
172
+ ```
173
+
174
+ ## API
175
+
176
+ ### Props
177
+
178
+ | Prop | Type | Default | Description |
179
+ |------|------|---------|-------------|
180
+ | `agentName` | `string` | `'Support Agent'` | Name of the chat agent |
181
+ | `agentRole` | `string` | `'Customer Support'` | Role/title of the agent |
182
+ | `primaryColor` | `string` | `'#2d3e50'` | Primary theme color |
183
+ | `accentColor` | `string` | `'#4e8cff'` | Accent color for buttons |
184
+ | `welcomeMessage` | `string` | `'Hi! How can I help?'` | Initial message from agent |
185
+ | `placeholderText` | `string` | `'Type your message...'` | Input placeholder text |
186
+ | `position` | `WidgetPosition` | `'bottom-right'` | Widget position |
187
+ | `width` | `string` | `'350'` | Widget width in pixels |
188
+ | `height` | `string` | `'500'` | Widget height in pixels |
189
+ | `showMinimizeButton` | `boolean` | `true` | Show/hide minimize button |
190
+ | `showTimestamps` | `boolean` | `true` | Show/hide message timestamps |
191
+ | `enableFileUpload` | `boolean` | `false` | Enable file upload feature |
192
+ | `enableSpeech` | `boolean` | `false` | Enable speech input |
193
+ | `showPoweredBy` | `boolean` | `true` | Show/hide "Powered by" footer |
194
+
195
+ ### Events
196
+
197
+ | Event | Payload | Description |
198
+ |-------|---------|-------------|
199
+ | `messageSent` | `{ message: string; timestamp: Date }` | Emitted when a message is sent |
200
+ | `widgetOpened` | `void` | Emitted when the widget is opened |
201
+ | `widgetClosed` | `void` | Emitted when the widget is closed |
202
+
203
+ ### Types
204
+
205
+ ```typescript
206
+ type WidgetPosition = 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
207
+ ```
208
+
209
+ ## License
210
+
211
+ MIT
@@ -0,0 +1,142 @@
1
+ import { PropType } from 'vue';
2
+ export type WidgetPosition = 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
3
+ export declare const NerdChatWidget: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
4
+ agentName: {
5
+ type: StringConstructor;
6
+ default: string;
7
+ };
8
+ agentRole: {
9
+ type: StringConstructor;
10
+ default: string;
11
+ };
12
+ primaryColor: {
13
+ type: StringConstructor;
14
+ default: string;
15
+ };
16
+ accentColor: {
17
+ type: StringConstructor;
18
+ default: string;
19
+ };
20
+ welcomeMessage: {
21
+ type: StringConstructor;
22
+ default: string;
23
+ };
24
+ placeholderText: {
25
+ type: StringConstructor;
26
+ default: string;
27
+ };
28
+ position: {
29
+ type: PropType<WidgetPosition>;
30
+ default: string;
31
+ };
32
+ width: {
33
+ type: StringConstructor;
34
+ default: string;
35
+ };
36
+ height: {
37
+ type: StringConstructor;
38
+ default: string;
39
+ };
40
+ showMinimizeButton: {
41
+ type: BooleanConstructor;
42
+ default: boolean;
43
+ };
44
+ showTimestamps: {
45
+ type: BooleanConstructor;
46
+ default: boolean;
47
+ };
48
+ enableFileUpload: {
49
+ type: BooleanConstructor;
50
+ default: boolean;
51
+ };
52
+ enableSpeech: {
53
+ type: BooleanConstructor;
54
+ default: boolean;
55
+ };
56
+ showPoweredBy: {
57
+ type: BooleanConstructor;
58
+ default: boolean;
59
+ };
60
+ }>, {
61
+ widgetRef: import("vue").Ref<HTMLElement | undefined, HTMLElement | undefined>;
62
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("messageSent" | "widgetOpened" | "widgetClosed")[], "messageSent" | "widgetOpened" | "widgetClosed", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
63
+ agentName: {
64
+ type: StringConstructor;
65
+ default: string;
66
+ };
67
+ agentRole: {
68
+ type: StringConstructor;
69
+ default: string;
70
+ };
71
+ primaryColor: {
72
+ type: StringConstructor;
73
+ default: string;
74
+ };
75
+ accentColor: {
76
+ type: StringConstructor;
77
+ default: string;
78
+ };
79
+ welcomeMessage: {
80
+ type: StringConstructor;
81
+ default: string;
82
+ };
83
+ placeholderText: {
84
+ type: StringConstructor;
85
+ default: string;
86
+ };
87
+ position: {
88
+ type: PropType<WidgetPosition>;
89
+ default: string;
90
+ };
91
+ width: {
92
+ type: StringConstructor;
93
+ default: string;
94
+ };
95
+ height: {
96
+ type: StringConstructor;
97
+ default: string;
98
+ };
99
+ showMinimizeButton: {
100
+ type: BooleanConstructor;
101
+ default: boolean;
102
+ };
103
+ showTimestamps: {
104
+ type: BooleanConstructor;
105
+ default: boolean;
106
+ };
107
+ enableFileUpload: {
108
+ type: BooleanConstructor;
109
+ default: boolean;
110
+ };
111
+ enableSpeech: {
112
+ type: BooleanConstructor;
113
+ default: boolean;
114
+ };
115
+ showPoweredBy: {
116
+ type: BooleanConstructor;
117
+ default: boolean;
118
+ };
119
+ }>> & Readonly<{
120
+ onMessageSent?: ((...args: any[]) => any) | undefined;
121
+ onWidgetOpened?: ((...args: any[]) => any) | undefined;
122
+ onWidgetClosed?: ((...args: any[]) => any) | undefined;
123
+ }>, {
124
+ agentName: string;
125
+ agentRole: string;
126
+ primaryColor: string;
127
+ accentColor: string;
128
+ welcomeMessage: string;
129
+ placeholderText: string;
130
+ position: WidgetPosition;
131
+ width: string;
132
+ height: string;
133
+ showMinimizeButton: boolean;
134
+ showTimestamps: boolean;
135
+ enableFileUpload: boolean;
136
+ enableSpeech: boolean;
137
+ showPoweredBy: boolean;
138
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
139
+ export default NerdChatWidget;
140
+ export declare const NerdChatWidgetPlugin: {
141
+ install(app: any): void;
142
+ };
@@ -0,0 +1,125 @@
1
+ import { defineComponent, ref, onMounted } from 'vue';
2
+ import { defineCustomElements } from 'nerdagent-chat-widget/loader';
3
+
4
+ const NerdChatWidget = defineComponent({
5
+ name: 'NerdChatWidget',
6
+ props: {
7
+ agentName: {
8
+ type: String,
9
+ default: 'Support Agent'
10
+ },
11
+ agentRole: {
12
+ type: String,
13
+ default: 'Customer Support'
14
+ },
15
+ primaryColor: {
16
+ type: String,
17
+ default: '#2d3e50'
18
+ },
19
+ accentColor: {
20
+ type: String,
21
+ default: '#4e8cff'
22
+ },
23
+ welcomeMessage: {
24
+ type: String,
25
+ default: 'Hi! How can I help?'
26
+ },
27
+ placeholderText: {
28
+ type: String,
29
+ default: 'Type your message...'
30
+ },
31
+ position: {
32
+ type: String,
33
+ default: 'bottom-right'
34
+ },
35
+ width: {
36
+ type: String,
37
+ default: '350'
38
+ },
39
+ height: {
40
+ type: String,
41
+ default: '500'
42
+ },
43
+ showMinimizeButton: {
44
+ type: Boolean,
45
+ default: true
46
+ },
47
+ showTimestamps: {
48
+ type: Boolean,
49
+ default: true
50
+ },
51
+ enableFileUpload: {
52
+ type: Boolean,
53
+ default: false
54
+ },
55
+ enableSpeech: {
56
+ type: Boolean,
57
+ default: false
58
+ },
59
+ showPoweredBy: {
60
+ type: Boolean,
61
+ default: true
62
+ }
63
+ },
64
+ emits: ['messageSent', 'widgetOpened', 'widgetClosed'],
65
+ setup(props, { emit }) {
66
+ const widgetRef = ref();
67
+ onMounted(() => {
68
+ // Define custom elements
69
+ defineCustomElements();
70
+ // Setup event listeners
71
+ if (widgetRef.value) {
72
+ const widget = widgetRef.value;
73
+ const handleMessageSent = (event) => {
74
+ emit('messageSent', event.detail);
75
+ };
76
+ const handleWidgetOpened = (event) => {
77
+ emit('widgetOpened');
78
+ };
79
+ const handleWidgetClosed = (event) => {
80
+ emit('widgetClosed');
81
+ };
82
+ widget.addEventListener('messageSent', handleMessageSent);
83
+ widget.addEventListener('widgetOpened', handleWidgetOpened);
84
+ widget.addEventListener('widgetClosed', handleWidgetClosed);
85
+ // Cleanup on unmount
86
+ return () => {
87
+ widget.removeEventListener('messageSent', handleMessageSent);
88
+ widget.removeEventListener('widgetOpened', handleWidgetOpened);
89
+ widget.removeEventListener('widgetClosed', handleWidgetClosed);
90
+ };
91
+ }
92
+ });
93
+ return {
94
+ widgetRef
95
+ };
96
+ },
97
+ template: `
98
+ <nerd-chat-widget
99
+ ref="widgetRef"
100
+ :agent-name="agentName"
101
+ :agent-role="agentRole"
102
+ :primary-color="primaryColor"
103
+ :accent-color="accentColor"
104
+ :welcome-message="welcomeMessage"
105
+ :placeholder-text="placeholderText"
106
+ :position="position"
107
+ :width="width"
108
+ :height="height"
109
+ :show-minimize-button="showMinimizeButton.toString()"
110
+ :show-timestamps="showTimestamps.toString()"
111
+ :enable-file-upload="enableFileUpload.toString()"
112
+ :enable-speech="enableSpeech.toString()"
113
+ :show-powered-by="showPoweredBy.toString()">
114
+ </nerd-chat-widget>
115
+ `
116
+ });
117
+ // Plugin for global registration
118
+ const NerdChatWidgetPlugin = {
119
+ install(app) {
120
+ app.component('NerdChatWidget', NerdChatWidget);
121
+ }
122
+ };
123
+
124
+ export { NerdChatWidget, NerdChatWidgetPlugin, NerdChatWidget as default };
125
+ //# sourceMappingURL=index.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.esm.js","sources":["../src/index.ts"],"sourcesContent":["import { defineComponent, onMounted, ref, PropType } from 'vue';\nimport { defineCustomElements } from 'nerdagent-chat-widget/loader';\n\nexport type WidgetPosition = 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';\n\nexport const NerdChatWidget = defineComponent({\n name: 'NerdChatWidget',\n props: {\n agentName: {\n type: String,\n default: 'Support Agent'\n },\n agentRole: {\n type: String,\n default: 'Customer Support'\n },\n primaryColor: {\n type: String,\n default: '#2d3e50'\n },\n accentColor: {\n type: String,\n default: '#4e8cff'\n },\n welcomeMessage: {\n type: String,\n default: 'Hi! How can I help?'\n },\n placeholderText: {\n type: String,\n default: 'Type your message...'\n },\n position: {\n type: String as PropType<WidgetPosition>,\n default: 'bottom-right'\n },\n width: {\n type: String,\n default: '350'\n },\n height: {\n type: String,\n default: '500'\n },\n showMinimizeButton: {\n type: Boolean,\n default: true\n },\n showTimestamps: {\n type: Boolean,\n default: true\n },\n enableFileUpload: {\n type: Boolean,\n default: false\n },\n enableSpeech: {\n type: Boolean,\n default: false\n },\n showPoweredBy: {\n type: Boolean,\n default: true\n }\n },\n emits: ['messageSent', 'widgetOpened', 'widgetClosed'],\n setup(props, { emit }) {\n const widgetRef = ref<HTMLElement>();\n\n onMounted(() => {\n // Define custom elements\n defineCustomElements();\n \n // Setup event listeners\n if (widgetRef.value) {\n const widget = widgetRef.value;\n \n const handleMessageSent = (event: CustomEvent) => {\n emit('messageSent', event.detail);\n };\n \n const handleWidgetOpened = (event: CustomEvent) => {\n emit('widgetOpened');\n };\n \n const handleWidgetClosed = (event: CustomEvent) => {\n emit('widgetClosed');\n };\n \n widget.addEventListener('messageSent', handleMessageSent as EventListener);\n widget.addEventListener('widgetOpened', handleWidgetOpened as EventListener);\n widget.addEventListener('widgetClosed', handleWidgetClosed as EventListener);\n \n // Cleanup on unmount\n return () => {\n widget.removeEventListener('messageSent', handleMessageSent as EventListener);\n widget.removeEventListener('widgetOpened', handleWidgetOpened as EventListener);\n widget.removeEventListener('widgetClosed', handleWidgetClosed as EventListener);\n };\n }\n });\n\n return {\n widgetRef\n };\n },\n template: `\n <nerd-chat-widget\n ref=\"widgetRef\"\n :agent-name=\"agentName\"\n :agent-role=\"agentRole\"\n :primary-color=\"primaryColor\"\n :accent-color=\"accentColor\"\n :welcome-message=\"welcomeMessage\"\n :placeholder-text=\"placeholderText\"\n :position=\"position\"\n :width=\"width\"\n :height=\"height\"\n :show-minimize-button=\"showMinimizeButton.toString()\"\n :show-timestamps=\"showTimestamps.toString()\"\n :enable-file-upload=\"enableFileUpload.toString()\"\n :enable-speech=\"enableSpeech.toString()\"\n :show-powered-by=\"showPoweredBy.toString()\">\n </nerd-chat-widget>\n `\n});\n\nexport default NerdChatWidget;\n\n// Plugin for global registration\nexport const NerdChatWidgetPlugin = {\n install(app: any) {\n app.component('NerdChatWidget', NerdChatWidget);\n }\n};\n"],"names":[],"mappings":";;;AAKO,MAAM,cAAc,GAAG,eAAe,C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,CAAC,CAAC;AAChF,oBAAA,MAAM,CAAC,mBAAmB,CAAC,cAAc,EAAE,kBAAmC,CAAC,CAAC;AAClF,iBAAC,CAAC;aACH;AACH,SAAC,CAAC,CAAC;QAEH,OAAO;YACL,SAAS;SACV,CAAC;KACH;AACD,IAAA,QAAQ,EAAE,CAAA;;;;;;;;;;;;;;;;;;AAkBT,EAAA,CAAA;AACF,CAAA,EAAE;AAIH;AACa,MAAA,oBAAoB,GAAG;AAClC,IAAA,OAAO,CAAC,GAAQ,EAAA;AACd,QAAA,GAAG,CAAC,SAAS,CAAC,gBAAgB,EAAE,cAAc,CAAC,CAAC;KACjD;;;;;"}
package/dist/index.js ADDED
@@ -0,0 +1,131 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var vue = require('vue');
6
+ var loader = require('nerdagent-chat-widget/loader');
7
+
8
+ const NerdChatWidget = vue.defineComponent({
9
+ name: 'NerdChatWidget',
10
+ props: {
11
+ agentName: {
12
+ type: String,
13
+ default: 'Support Agent'
14
+ },
15
+ agentRole: {
16
+ type: String,
17
+ default: 'Customer Support'
18
+ },
19
+ primaryColor: {
20
+ type: String,
21
+ default: '#2d3e50'
22
+ },
23
+ accentColor: {
24
+ type: String,
25
+ default: '#4e8cff'
26
+ },
27
+ welcomeMessage: {
28
+ type: String,
29
+ default: 'Hi! How can I help?'
30
+ },
31
+ placeholderText: {
32
+ type: String,
33
+ default: 'Type your message...'
34
+ },
35
+ position: {
36
+ type: String,
37
+ default: 'bottom-right'
38
+ },
39
+ width: {
40
+ type: String,
41
+ default: '350'
42
+ },
43
+ height: {
44
+ type: String,
45
+ default: '500'
46
+ },
47
+ showMinimizeButton: {
48
+ type: Boolean,
49
+ default: true
50
+ },
51
+ showTimestamps: {
52
+ type: Boolean,
53
+ default: true
54
+ },
55
+ enableFileUpload: {
56
+ type: Boolean,
57
+ default: false
58
+ },
59
+ enableSpeech: {
60
+ type: Boolean,
61
+ default: false
62
+ },
63
+ showPoweredBy: {
64
+ type: Boolean,
65
+ default: true
66
+ }
67
+ },
68
+ emits: ['messageSent', 'widgetOpened', 'widgetClosed'],
69
+ setup(props, { emit }) {
70
+ const widgetRef = vue.ref();
71
+ vue.onMounted(() => {
72
+ // Define custom elements
73
+ loader.defineCustomElements();
74
+ // Setup event listeners
75
+ if (widgetRef.value) {
76
+ const widget = widgetRef.value;
77
+ const handleMessageSent = (event) => {
78
+ emit('messageSent', event.detail);
79
+ };
80
+ const handleWidgetOpened = (event) => {
81
+ emit('widgetOpened');
82
+ };
83
+ const handleWidgetClosed = (event) => {
84
+ emit('widgetClosed');
85
+ };
86
+ widget.addEventListener('messageSent', handleMessageSent);
87
+ widget.addEventListener('widgetOpened', handleWidgetOpened);
88
+ widget.addEventListener('widgetClosed', handleWidgetClosed);
89
+ // Cleanup on unmount
90
+ return () => {
91
+ widget.removeEventListener('messageSent', handleMessageSent);
92
+ widget.removeEventListener('widgetOpened', handleWidgetOpened);
93
+ widget.removeEventListener('widgetClosed', handleWidgetClosed);
94
+ };
95
+ }
96
+ });
97
+ return {
98
+ widgetRef
99
+ };
100
+ },
101
+ template: `
102
+ <nerd-chat-widget
103
+ ref="widgetRef"
104
+ :agent-name="agentName"
105
+ :agent-role="agentRole"
106
+ :primary-color="primaryColor"
107
+ :accent-color="accentColor"
108
+ :welcome-message="welcomeMessage"
109
+ :placeholder-text="placeholderText"
110
+ :position="position"
111
+ :width="width"
112
+ :height="height"
113
+ :show-minimize-button="showMinimizeButton.toString()"
114
+ :show-timestamps="showTimestamps.toString()"
115
+ :enable-file-upload="enableFileUpload.toString()"
116
+ :enable-speech="enableSpeech.toString()"
117
+ :show-powered-by="showPoweredBy.toString()">
118
+ </nerd-chat-widget>
119
+ `
120
+ });
121
+ // Plugin for global registration
122
+ const NerdChatWidgetPlugin = {
123
+ install(app) {
124
+ app.component('NerdChatWidget', NerdChatWidget);
125
+ }
126
+ };
127
+
128
+ exports.NerdChatWidget = NerdChatWidget;
129
+ exports.NerdChatWidgetPlugin = NerdChatWidgetPlugin;
130
+ exports.default = NerdChatWidget;
131
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import { defineComponent, onMounted, ref, PropType } from 'vue';\nimport { defineCustomElements } from 'nerdagent-chat-widget/loader';\n\nexport type WidgetPosition = 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';\n\nexport const NerdChatWidget = defineComponent({\n name: 'NerdChatWidget',\n props: {\n agentName: {\n type: String,\n default: 'Support Agent'\n },\n agentRole: {\n type: String,\n default: 'Customer Support'\n },\n primaryColor: {\n type: String,\n default: '#2d3e50'\n },\n accentColor: {\n type: String,\n default: '#4e8cff'\n },\n welcomeMessage: {\n type: String,\n default: 'Hi! How can I help?'\n },\n placeholderText: {\n type: String,\n default: 'Type your message...'\n },\n position: {\n type: String as PropType<WidgetPosition>,\n default: 'bottom-right'\n },\n width: {\n type: String,\n default: '350'\n },\n height: {\n type: String,\n default: '500'\n },\n showMinimizeButton: {\n type: Boolean,\n default: true\n },\n showTimestamps: {\n type: Boolean,\n default: true\n },\n enableFileUpload: {\n type: Boolean,\n default: false\n },\n enableSpeech: {\n type: Boolean,\n default: false\n },\n showPoweredBy: {\n type: Boolean,\n default: true\n }\n },\n emits: ['messageSent', 'widgetOpened', 'widgetClosed'],\n setup(props, { emit }) {\n const widgetRef = ref<HTMLElement>();\n\n onMounted(() => {\n // Define custom elements\n defineCustomElements();\n \n // Setup event listeners\n if (widgetRef.value) {\n const widget = widgetRef.value;\n \n const handleMessageSent = (event: CustomEvent) => {\n emit('messageSent', event.detail);\n };\n \n const handleWidgetOpened = (event: CustomEvent) => {\n emit('widgetOpened');\n };\n \n const handleWidgetClosed = (event: CustomEvent) => {\n emit('widgetClosed');\n };\n \n widget.addEventListener('messageSent', handleMessageSent as EventListener);\n widget.addEventListener('widgetOpened', handleWidgetOpened as EventListener);\n widget.addEventListener('widgetClosed', handleWidgetClosed as EventListener);\n \n // Cleanup on unmount\n return () => {\n widget.removeEventListener('messageSent', handleMessageSent as EventListener);\n widget.removeEventListener('widgetOpened', handleWidgetOpened as EventListener);\n widget.removeEventListener('widgetClosed', handleWidgetClosed as EventListener);\n };\n }\n });\n\n return {\n widgetRef\n };\n },\n template: `\n <nerd-chat-widget\n ref=\"widgetRef\"\n :agent-name=\"agentName\"\n :agent-role=\"agentRole\"\n :primary-color=\"primaryColor\"\n :accent-color=\"accentColor\"\n :welcome-message=\"welcomeMessage\"\n :placeholder-text=\"placeholderText\"\n :position=\"position\"\n :width=\"width\"\n :height=\"height\"\n :show-minimize-button=\"showMinimizeButton.toString()\"\n :show-timestamps=\"showTimestamps.toString()\"\n :enable-file-upload=\"enableFileUpload.toString()\"\n :enable-speech=\"enableSpeech.toString()\"\n :show-powered-by=\"showPoweredBy.toString()\">\n </nerd-chat-widget>\n `\n});\n\nexport default NerdChatWidget;\n\n// Plugin for global registration\nexport const NerdChatWidgetPlugin = {\n install(app: any) {\n app.component('NerdChatWidget', NerdChatWidget);\n }\n};\n"],"names":["defineComponent","ref","onMounted","defineCustomElements"],"mappings":";;;;;;;AAKO,MAAM,cAAc,GAAGA,mBAAe,CAAC;AAC5C,IAAA,IAAI,EAAE,gBAAgB;AACtB,IAAA,KAAK,EAAE;AACL,QAAA,SAAS,EAAE;AACT,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,OAAO,EAAE,eAAe;AACzB,SAAA;AACD,QAAA,SAAS,EAAE;AACT,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,OAAO,EAAE,kBAAkB;AAC5B,SAAA;AACD,QAAA,YAAY,EAAE;AACZ,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,OAAO,EAAE,SAAS;AACnB,SAAA;AACD,QAAA,WAAW,EAAE;AACX,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,OAAO,EAAE,SAAS;AACnB,SAAA;AACD,QAAA,cAAc,EAAE;AACd,YAAA,IAA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
3
+ "version": "1.0.2",
4
+ "type": "module",
5
+ "description": "NerdAgent Chat Widget for Vue",
6
+ "main": "dist/index.js",
7
+ "module": "dist/index.esm.js",
8
+ "types": "dist/index.d.ts",
9
+ "files": [
10
+ "dist/"
11
+ ],
12
+ "scripts": {
13
+ "build": "rollup -c",
14
+ "prepublishOnly": "npm run build"
15
+ },
16
+ "keywords": [
17
+ "vue",
18
+ "chat",
19
+ "widget",
20
+ "stencil",
21
+ "web-components"
22
+ ],
23
+ "author": "NerdAgent",
24
+ "license": "MIT",
25
+ "peerDependencies": {
26
+ "vue": "^3.0.0"
27
+ },
28
+ "dependencies": {
29
+ "nerdagent-chat-widget": "^1.0.0"
30
+ },
31
+ "devDependencies": {
32
+ "@rollup/plugin-commonjs": "^25.0.0",
33
+ "@rollup/plugin-node-resolve": "^15.0.0",
34
+ "@rollup/plugin-typescript": "^11.0.0",
35
+ "rollup": "^3.0.0",
36
+ "tslib": "^2.0.0",
37
+ "typescript": "^5.0.0",
38
+ "vue": "^3.0.0"
39
+ },
40
+ "repository": {
41
+ "type": "git",
42
+ "url": "https://github.com/nerdagent/chat-widget.git",
43
+ "directory": "packages/vue"
44
+ },
45
+ "gitHead": "baebff96671fd060b15aa0ca587f2c9a1556c06b"
46
+ }