@yartsun/hypershadow-widget 0.1.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 (35) hide show
  1. package/README.md +89 -0
  2. package/dist/lib/index.cjs.js +26 -0
  3. package/dist/lib/index.es.js +7769 -0
  4. package/dist/lib/init.js +28 -0
  5. package/dist/lib/style.css +1 -0
  6. package/dist/lib/vite.svg +1 -0
  7. package/dist/standalone/hs-widget.css +1 -0
  8. package/dist/standalone/hs-widget.es.js +11503 -0
  9. package/dist/standalone/hs-widget.iife.js +46 -0
  10. package/dist/standalone/init.js +28 -0
  11. package/dist/standalone/vite.svg +1 -0
  12. package/dist/static/widget/v1/chat/assets/ChatWrapper.vue_vue_type_style_index_0_lang-a7iZ5AvP.js +26 -0
  13. package/dist/static/widget/v1/chat/assets/federation-expose-Chat-ZaLC8sp9.js +1 -0
  14. package/dist/static/widget/v1/chat/assets/federation-expose-Utils-BmSDJTj0.js +1 -0
  15. package/dist/static/widget/v1/chat/assets/federation-import-CxlH6xnb.js +1 -0
  16. package/dist/static/widget/v1/chat/assets/federation-shared-vue-MGgX2WkV.js +22 -0
  17. package/dist/static/widget/v1/chat/assets/federation-utils-DDIHa9Ih.js +1 -0
  18. package/dist/static/widget/v1/chat/assets/index-DVNLuQ51.js +6 -0
  19. package/dist/static/widget/v1/chat/assets/remoteChat.js +1 -0
  20. package/dist/static/widget/v1/chat/assets/style-DKzkMddi.css +1 -0
  21. package/dist/static/widget/v1/chat/index.html +23 -0
  22. package/dist/static/widget/v1/chat/init.js +28 -0
  23. package/dist/static/widget/v1/chat/vite.svg +1 -0
  24. package/dist/widget/chat/assets/ChatWrapper.vue_vue_type_style_index_0_lang-CSxaiIok.js +3 -0
  25. package/dist/widget/chat/assets/__federation_expose_Chat-B-cuBP_G.js +1 -0
  26. package/dist/widget/chat/assets/__federation_fn_import-CxlH6xnb.js +1 -0
  27. package/dist/widget/chat/assets/__federation_shared_vue-MGgX2WkV.js +22 -0
  28. package/dist/widget/chat/assets/federation-utils-DDIHa9Ih.js +1 -0
  29. package/dist/widget/chat/assets/index-DN9zikYF.js +5 -0
  30. package/dist/widget/chat/assets/remoteChat.js +1 -0
  31. package/dist/widget/chat/assets/style-GHzhDfDI.css +1 -0
  32. package/dist/widget/chat/index.html +22 -0
  33. package/dist/widget/chat/init.js +28 -0
  34. package/dist/widget/chat/vite.svg +1 -0
  35. package/package.json +66 -0
package/README.md ADDED
@@ -0,0 +1,89 @@
1
+ # Hypershadow Widget
2
+
3
+ Chat widget for Hypershadow platform with WebSocket communication.
4
+
5
+ ## Requirements
6
+
7
+ - Node.js 18 or higher
8
+
9
+ ## Building the project
10
+
11
+ ```bash
12
+ # Install dependencies
13
+ npm i
14
+
15
+ # Build the project
16
+ npm run build
17
+ ```
18
+
19
+ Build output will be located in the `/dist` directory
20
+
21
+ ## Module Federation Usage
22
+
23
+ ### Using the chat component in another application
24
+
25
+ 1. **Import the federated component:**
26
+
27
+ ```javascript
28
+ // In your host application
29
+ const ChatWrapper = React.lazy(() => import('chat/chat'));
30
+
31
+ // Or for Vue 3
32
+ import { defineAsyncComponent } from 'vue';
33
+ const ChatWrapper = defineAsyncComponent(() => import('chat/chat'));
34
+ ```
35
+
36
+ 2. **Pass WebSocket link via props (recommended for federation):**
37
+
38
+ ```vue
39
+ <template>
40
+ <ChatWrapper
41
+ :config="chatConfig"
42
+ :link="websocketUrl"
43
+ :is-embedded="true"
44
+ :is-preview="false"
45
+ />
46
+ </template>
47
+
48
+ <script setup>
49
+ const websocketUrl = "wss://your-websocket-server.com/chat";
50
+ const chatConfig = {
51
+ // ... your configuration
52
+ };
53
+ </script>
54
+ ```
55
+
56
+ 3. **Alternative: Pass link via URL parameters:**
57
+
58
+ ```
59
+ http://your-app.com/chat?link=wss://your-websocket-server.com/chat
60
+ ```
61
+
62
+ ### Troubleshooting Federation Issues
63
+
64
+ If you're experiencing WebSocket connection issues when using through federation:
65
+
66
+ 1. **Check WebSocket URL format:**
67
+ - Must start with `ws://` or `wss://`
68
+ - URL should be properly encoded if passed via query parameters
69
+
70
+ 2. **Use props instead of URL parameters:**
71
+ ```vue
72
+ <!-- Recommended approach -->
73
+ <ChatWrapper :link="websocketUrl" :config="config" />
74
+ ```
75
+
76
+ 3. **Enable debugging:**
77
+ - Open browser console to see detailed connection logs
78
+ - Component will show which link source is being used
79
+
80
+ 4. **CORS considerations:**
81
+ - Ensure your WebSocket server allows connections from the federation host domain
82
+ - Check browser network tab for any blocked requests
83
+
84
+ ### Props Reference
85
+
86
+ - `link?: string` - WebSocket server URL (highest priority)
87
+ - `config: WidgetConfig` - Widget configuration object (required)
88
+ - `isEmbedded?: boolean` - Whether widget is embedded in another app
89
+ - `isPreview?: boolean` - Preview mode (shows placeholder content)