@bytexbyte/nxtlinq-ai-agent-ui-react-development 0.1.1

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 (142) hide show
  1. package/dist/NxtlinqAgentChat.d.ts +26 -0
  2. package/dist/NxtlinqAgentChat.d.ts.map +1 -0
  3. package/dist/NxtlinqAgentChat.js +28 -0
  4. package/dist/components/AgentAssistantShell.d.ts +5 -0
  5. package/dist/components/AgentAssistantShell.d.ts.map +1 -0
  6. package/dist/components/AgentAssistantShell.js +52 -0
  7. package/dist/components/AgentComposer.d.ts +3 -0
  8. package/dist/components/AgentComposer.d.ts.map +1 -0
  9. package/dist/components/AgentComposer.js +60 -0
  10. package/dist/components/AgentMessageList.d.ts +3 -0
  11. package/dist/components/AgentMessageList.d.ts.map +1 -0
  12. package/dist/components/AgentMessageList.js +37 -0
  13. package/dist/components/AgentRemoteAudio.d.ts +4 -0
  14. package/dist/components/AgentRemoteAudio.d.ts.map +1 -0
  15. package/dist/components/AgentRemoteAudio.js +34 -0
  16. package/dist/components/AgentVoiceBar.d.ts +3 -0
  17. package/dist/components/AgentVoiceBar.d.ts.map +1 -0
  18. package/dist/components/AgentVoiceBar.js +91 -0
  19. package/dist/components/PresetMessageChips.d.ts +3 -0
  20. package/dist/components/PresetMessageChips.d.ts.map +1 -0
  21. package/dist/components/PresetMessageChips.js +23 -0
  22. package/dist/context/AgentAssistantContext.d.ts +32 -0
  23. package/dist/context/AgentAssistantContext.d.ts.map +1 -0
  24. package/dist/context/AgentAssistantContext.js +159 -0
  25. package/dist/index.d.ts +16 -0
  26. package/dist/index.d.ts.map +1 -0
  27. package/dist/index.js +12 -0
  28. package/dist/legacy/assets/images/adiSideItalicDataUri.d.ts +2 -0
  29. package/dist/legacy/assets/images/adiSideItalicDataUri.d.ts.map +1 -0
  30. package/dist/legacy/assets/images/adiSideItalicDataUri.js +1 -0
  31. package/dist/legacy/chatbot/ChatBot.d.ts +5 -0
  32. package/dist/legacy/chatbot/ChatBot.d.ts.map +1 -0
  33. package/dist/legacy/chatbot/ChatBot.js +35 -0
  34. package/dist/legacy/chatbot/context/ChatBotContext.d.ts +5 -0
  35. package/dist/legacy/chatbot/context/ChatBotContext.d.ts.map +1 -0
  36. package/dist/legacy/chatbot/context/ChatBotContext.js +2908 -0
  37. package/dist/legacy/chatbot/types/ChatBotTypes.d.ts +166 -0
  38. package/dist/legacy/chatbot/types/ChatBotTypes.d.ts.map +1 -0
  39. package/dist/legacy/chatbot/types/ChatBotTypes.js +1 -0
  40. package/dist/legacy/chatbot/ui/BerifyMeModal.d.ts +17 -0
  41. package/dist/legacy/chatbot/ui/BerifyMeModal.d.ts.map +1 -0
  42. package/dist/legacy/chatbot/ui/BerifyMeModal.js +110 -0
  43. package/dist/legacy/chatbot/ui/ChatBotUI.d.ts +3 -0
  44. package/dist/legacy/chatbot/ui/ChatBotUI.d.ts.map +1 -0
  45. package/dist/legacy/chatbot/ui/ChatBotUI.js +625 -0
  46. package/dist/legacy/chatbot/ui/MessageInput.d.ts +3 -0
  47. package/dist/legacy/chatbot/ui/MessageInput.d.ts.map +1 -0
  48. package/dist/legacy/chatbot/ui/MessageInput.js +321 -0
  49. package/dist/legacy/chatbot/ui/MessageList.d.ts +4 -0
  50. package/dist/legacy/chatbot/ui/MessageList.d.ts.map +1 -0
  51. package/dist/legacy/chatbot/ui/MessageList.js +455 -0
  52. package/dist/legacy/chatbot/ui/ModelSelector.d.ts +4 -0
  53. package/dist/legacy/chatbot/ui/ModelSelector.d.ts.map +1 -0
  54. package/dist/legacy/chatbot/ui/ModelSelector.js +122 -0
  55. package/dist/legacy/chatbot/ui/NotificationModal.d.ts +15 -0
  56. package/dist/legacy/chatbot/ui/NotificationModal.d.ts.map +1 -0
  57. package/dist/legacy/chatbot/ui/NotificationModal.js +53 -0
  58. package/dist/legacy/chatbot/ui/PermissionForm.d.ts +8 -0
  59. package/dist/legacy/chatbot/ui/PermissionForm.d.ts.map +1 -0
  60. package/dist/legacy/chatbot/ui/PermissionForm.js +465 -0
  61. package/dist/legacy/chatbot/ui/PresetMessages.d.ts +4 -0
  62. package/dist/legacy/chatbot/ui/PresetMessages.d.ts.map +1 -0
  63. package/dist/legacy/chatbot/ui/PresetMessages.js +33 -0
  64. package/dist/legacy/chatbot/ui/VoiceModePanel.d.ts +3 -0
  65. package/dist/legacy/chatbot/ui/VoiceModePanel.d.ts.map +1 -0
  66. package/dist/legacy/chatbot/ui/VoiceModePanel.js +95 -0
  67. package/dist/legacy/chatbot/ui/styles/isolatedStyles.d.ts +73 -0
  68. package/dist/legacy/chatbot/ui/styles/isolatedStyles.d.ts.map +1 -0
  69. package/dist/legacy/chatbot/ui/styles/isolatedStyles.js +985 -0
  70. package/dist/legacy/index.d.ts +14 -0
  71. package/dist/legacy/index.d.ts.map +1 -0
  72. package/dist/legacy/index.js +12 -0
  73. package/dist/theme/defaultTheme.d.ts +3 -0
  74. package/dist/theme/defaultTheme.d.ts.map +1 -0
  75. package/dist/theme/defaultTheme.js +20 -0
  76. package/dist/types.d.ts +62 -0
  77. package/dist/types.d.ts.map +1 -0
  78. package/dist/types.js +1 -0
  79. package/dist/voice/useVoiceConnectOrchestration.d.ts +21 -0
  80. package/dist/voice/useVoiceConnectOrchestration.d.ts.map +1 -0
  81. package/dist/voice/useVoiceConnectOrchestration.js +86 -0
  82. package/dist/voice/useVoiceMicState.d.ts +15 -0
  83. package/dist/voice/useVoiceMicState.d.ts.map +1 -0
  84. package/dist/voice/useVoiceMicState.js +94 -0
  85. package/dist/voice/useVoiceSilenceCommit.d.ts +10 -0
  86. package/dist/voice/useVoiceSilenceCommit.d.ts.map +1 -0
  87. package/dist/voice/useVoiceSilenceCommit.js +67 -0
  88. package/dist/voice/useVoiceTranscriptMessages.d.ts +16 -0
  89. package/dist/voice/useVoiceTranscriptMessages.d.ts.map +1 -0
  90. package/dist/voice/useVoiceTranscriptMessages.js +129 -0
  91. package/dist/voice/useWsRealtimeAudio.d.ts +18 -0
  92. package/dist/voice/useWsRealtimeAudio.d.ts.map +1 -0
  93. package/dist/voice/useWsRealtimeAudio.js +102 -0
  94. package/dist/voice/voiceMicConstants.d.ts +4 -0
  95. package/dist/voice/voiceMicConstants.d.ts.map +1 -0
  96. package/dist/voice/voiceMicConstants.js +10 -0
  97. package/dist/voice/ws/BrowserWsPcmPlayer.d.ts +23 -0
  98. package/dist/voice/ws/BrowserWsPcmPlayer.d.ts.map +1 -0
  99. package/dist/voice/ws/BrowserWsPcmPlayer.js +137 -0
  100. package/dist/voice/ws/BrowserWsPcmRecorder.d.ts +17 -0
  101. package/dist/voice/ws/BrowserWsPcmRecorder.d.ts.map +1 -0
  102. package/dist/voice/ws/BrowserWsPcmRecorder.js +71 -0
  103. package/dist/voice/ws/float32ToPcm16.d.ts +2 -0
  104. package/dist/voice/ws/float32ToPcm16.d.ts.map +1 -0
  105. package/dist/voice/ws/float32ToPcm16.js +8 -0
  106. package/dist/voice/ws/voiceSilenceConstants.d.ts +5 -0
  107. package/dist/voice/ws/voiceSilenceConstants.d.ts.map +1 -0
  108. package/dist/voice/ws/voiceSilenceConstants.js +4 -0
  109. package/dist/voice/ws/wsRealtimeConstants.d.ts +2 -0
  110. package/dist/voice/ws/wsRealtimeConstants.d.ts.map +1 -0
  111. package/dist/voice/ws/wsRealtimeConstants.js +1 -0
  112. package/package.json +60 -0
  113. package/src/NxtlinqAgentChat.tsx +79 -0
  114. package/src/components/AgentAssistantShell.tsx +104 -0
  115. package/src/components/AgentComposer.tsx +134 -0
  116. package/src/components/AgentMessageList.tsx +78 -0
  117. package/src/components/AgentRemoteAudio.tsx +34 -0
  118. package/src/components/AgentVoiceBar.tsx +173 -0
  119. package/src/components/PresetMessageChips.tsx +41 -0
  120. package/src/context/AgentAssistantContext.tsx +276 -0
  121. package/src/index.ts +78 -0
  122. package/src/legacy/assets/images/adiSideItalicDataUri.ts +1 -0
  123. package/src/legacy/chatbot/ChatBot.tsx +61 -0
  124. package/src/legacy/chatbot/context/ChatBotContext.tsx +3227 -0
  125. package/src/legacy/chatbot/types/ChatBotTypes.ts +195 -0
  126. package/src/legacy/chatbot/ui/BerifyMeModal.tsx +145 -0
  127. package/src/legacy/chatbot/ui/ChatBotUI.tsx +949 -0
  128. package/src/legacy/chatbot/ui/MessageInput.tsx +517 -0
  129. package/src/legacy/chatbot/ui/MessageList.tsx +764 -0
  130. package/src/legacy/chatbot/ui/ModelSelector.tsx +190 -0
  131. package/src/legacy/chatbot/ui/NotificationModal.tsx +110 -0
  132. package/src/legacy/chatbot/ui/PermissionForm.tsx +632 -0
  133. package/src/legacy/chatbot/ui/PresetMessages.tsx +50 -0
  134. package/src/legacy/chatbot/ui/VoiceModePanel.tsx +168 -0
  135. package/src/legacy/chatbot/ui/styles/isolatedStyles.ts +1058 -0
  136. package/src/legacy/index.ts +26 -0
  137. package/src/theme/defaultTheme.ts +22 -0
  138. package/src/types.ts +65 -0
  139. package/src/voice/useVoiceConnectOrchestration.ts +117 -0
  140. package/src/voice/useVoiceMicState.ts +117 -0
  141. package/src/voice/useVoiceTranscriptMessages.ts +173 -0
  142. package/src/voice/voiceMicConstants.ts +13 -0
@@ -0,0 +1,190 @@
1
+ /** @jsxImportSource @emotion/react */
2
+ import * as React from 'react';
3
+ import { css } from '@emotion/react';
4
+ import { useChatBot } from '../context/ChatBotContext';
5
+ import { walletTextUtils } from '@bytexbyte/nxtlinq-ai-agent-web-development';
6
+ import { adiSideItalicDataUri } from '../../assets/images/adiSideItalicDataUri';
7
+
8
+ export const ModelSelector: React.FC = () => {
9
+ const {
10
+ availableModels,
11
+ selectedModelIndex,
12
+ handleModelChange,
13
+ serviceId
14
+ } = useChatBot();
15
+
16
+ // Safety check: ensure selectedModelIndex is within bounds
17
+ const safeSelectedModelIndex = selectedModelIndex >= availableModels.length ? 0 : selectedModelIndex;
18
+
19
+ // Check if current service is Adilas
20
+ const isAdilasService = walletTextUtils.isAdilasService(serviceId);
21
+
22
+ // Get fallback model label (first available model or 'Unknown')
23
+ // For Adilas, we don't show the label, only the image
24
+ const fallbackModelLabel = availableModels.length > 0
25
+ ? availableModels[0].label
26
+ : 'Unknown';
27
+
28
+ const [anchorEl, setAnchorEl] = React.useState<null | HTMLElement>(null);
29
+ const open = Boolean(anchorEl);
30
+
31
+ const handleClick = (event: React.MouseEvent<HTMLElement>) => {
32
+ setAnchorEl(event.currentTarget);
33
+ };
34
+
35
+ const handleMenuItemClick = (event: React.MouseEvent<HTMLElement>, index: number) => {
36
+ handleModelChange(index);
37
+ setAnchorEl(null);
38
+ };
39
+
40
+ const handleClose = () => {
41
+ setAnchorEl(null);
42
+ };
43
+
44
+ // Don't show anything if no models available
45
+ if (availableModels.length === 0) {
46
+ return null;
47
+ }
48
+
49
+ // For Adilas: only show image, no text (Adilas always has only 1 model)
50
+ if (isAdilasService) {
51
+ return (
52
+ <div css={css`
53
+ display: flex !important;
54
+ align-items: center !important;
55
+ gap: 6px !important;
56
+ `}>
57
+ <div css={css`
58
+ background-color: white !important;
59
+ border-radius: 4px !important;
60
+ padding: 2px !important;
61
+ display: flex !important;
62
+ align-items: center !important;
63
+ justify-content: center !important;
64
+ `}>
65
+ <img
66
+ src={adiSideItalicDataUri}
67
+ alt="Adi"
68
+ css={css`
69
+ width: 28px !important;
70
+ height: 28px !important;
71
+ display: block !important;
72
+ `}
73
+ />
74
+ </div>
75
+ </div>
76
+ );
77
+ }
78
+
79
+ // For other services: handle single or multiple models
80
+ // If only 1 model, show model name
81
+ if (availableModels.length === 1) {
82
+ return (
83
+ <div css={css`
84
+ display: flex !important;
85
+ align-items: center !important;
86
+ gap: 6px !important;
87
+ `}>
88
+ <div css={css`
89
+ display: flex !important;
90
+ align-items: center !important;
91
+ padding: 4px 8px !important;
92
+ border-radius: 4px !important;
93
+ background-color: rgba(255, 255, 255, 0.1) !important;
94
+ font-size: 12px !important;
95
+ font-weight: 500 !important;
96
+ `}>
97
+ <span>{availableModels[0].label}</span>
98
+ </div>
99
+ </div>
100
+ );
101
+ }
102
+
103
+ // If 2+ models, show full selector with dropdown
104
+ return (
105
+ <div css={css`
106
+ display: flex !important;
107
+ align-items: center !important;
108
+ position: relative !important;
109
+ gap: 6px !important;
110
+ `}>
111
+ <div
112
+ css={css`
113
+ display: flex !important;
114
+ align-items: center !important;
115
+ cursor: pointer !important;
116
+ padding: 4px 8px !important;
117
+ border-radius: 4px !important;
118
+ background-color: rgba(255, 255, 255, 0.1) !important;
119
+ transition: background-color 0.2s !important;
120
+ font-size: 12px !important;
121
+ font-weight: 500 !important;
122
+ gap: 6px !important;
123
+
124
+ &:hover {
125
+ background-color: rgba(255, 255, 255, 0.2) !important;
126
+ }
127
+ `}
128
+ onClick={handleClick}
129
+ title="Change AI Model"
130
+ >
131
+ <span>
132
+ {availableModels[safeSelectedModelIndex]?.label || fallbackModelLabel}
133
+ </span>
134
+ <span css={css`font-size: 10px !important;`}>▼</span>
135
+ </div>
136
+
137
+ {open && (
138
+ <div
139
+ css={css`
140
+ position: absolute !important;
141
+ top: 100% !important;
142
+ left: 0 !important;
143
+ background-color: white !important;
144
+ border: 1px solid #ddd !important;
145
+ border-radius: 4px !important;
146
+ box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
147
+ z-index: 1000 !important;
148
+ min-width: 120px !important;
149
+ margin-top: 4px !important;
150
+ `}
151
+ >
152
+ {availableModels.map((model, index) => (
153
+ <div
154
+ key={model.value}
155
+ css={css`
156
+ padding: 8px 12px !important;
157
+ cursor: pointer !important;
158
+ background-color: ${index === safeSelectedModelIndex ? '#f0f0f0' : 'transparent'} !important;
159
+ color: ${index === safeSelectedModelIndex ? '#007bff' : '#333'} !important;
160
+ font-size: 12px !important;
161
+ border-bottom: ${index < availableModels.length - 1 ? '1px solid #eee' : 'none'} !important;
162
+
163
+ &:hover {
164
+ background-color: ${index === safeSelectedModelIndex ? '#f0f0f0' : '#f8f9fa'} !important;
165
+ }
166
+ `}
167
+ onClick={(event) => handleMenuItemClick(event, index)}
168
+ >
169
+ {model.label}
170
+ </div>
171
+ ))}
172
+ </div>
173
+ )}
174
+
175
+ {open && (
176
+ <div
177
+ css={css`
178
+ position: fixed !important;
179
+ top: 0 !important;
180
+ left: 0 !important;
181
+ right: 0 !important;
182
+ bottom: 0 !important;
183
+ z-index: 999 !important;
184
+ `}
185
+ onClick={handleClose}
186
+ />
187
+ )}
188
+ </div>
189
+ );
190
+ };
@@ -0,0 +1,110 @@
1
+ /** @jsxImportSource @emotion/react */
2
+ import * as React from 'react';
3
+ import { css } from '@emotion/react';
4
+ import { createNotification, getNotificationIcon } from '@bytexbyte/nxtlinq-ai-agent-web-development';
5
+ import { actionButton, modalOverlay } from './styles/isolatedStyles';
6
+
7
+ interface NotificationModalProps {
8
+ type: 'success' | 'error' | 'info' | 'warning';
9
+ title: string;
10
+ message: string;
11
+ onClose: () => void;
12
+ onConfirm?: () => void;
13
+ showConfirm?: boolean;
14
+ confirmText?: string;
15
+ cancelText?: string;
16
+ }
17
+
18
+ export const NotificationModal: React.FC<NotificationModalProps> = ({
19
+ type,
20
+ title,
21
+ message,
22
+ onClose,
23
+ onConfirm,
24
+ showConfirm = false,
25
+ confirmText = 'Confirm',
26
+ cancelText = 'Cancel'
27
+ }) => {
28
+ const icon = getNotificationIcon(type);
29
+ const notification = createNotification(type, message);
30
+
31
+ return (
32
+ <div css={modalOverlay}>
33
+ <div css={css`
34
+ background-color: white !important;
35
+ padding: 24px !important;
36
+ border-radius: 12px !important;
37
+ width: 400px !important;
38
+ max-width: 90% !important;
39
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
40
+ text-align: center !important;
41
+ `}>
42
+ <div css={css`
43
+ font-size: 48px !important;
44
+ margin-bottom: 16px !important;
45
+ `}>
46
+ {icon}
47
+ </div>
48
+
49
+ <h3 css={css`
50
+ margin: 0 0 12px 0 !important;
51
+ font-size: 20px !important;
52
+ font-weight: 600 !important;
53
+ color: #1a1a1a !important;
54
+ `}>
55
+ {title}
56
+ </h3>
57
+
58
+ <p css={css`
59
+ margin: 0 0 24px 0 !important;
60
+ font-size: 16px !important;
61
+ color: #666 !important;
62
+ line-height: 1.5 !important;
63
+ `}>
64
+ {message}
65
+ </p>
66
+
67
+ <div css={css`
68
+ display: flex !important;
69
+ justify-content: center !important;
70
+ gap: 12px !important;
71
+ `}>
72
+ {showConfirm && onConfirm && (
73
+ <button
74
+ onClick={onConfirm}
75
+ css={css`
76
+ ${actionButton}
77
+ background-color: ${type === 'error' ? '#dc3545' : '#007bff'} !important;
78
+ border-radius: 8px !important;
79
+
80
+ &:hover {
81
+ background-color: ${type === 'error' ? '#c82333' : '#0056b3'} !important;
82
+ }
83
+ `}
84
+ >
85
+ {confirmText}
86
+ </button>
87
+ )}
88
+
89
+ <button
90
+ onClick={onClose}
91
+ css={css`
92
+ ${actionButton}
93
+ background-color: ${showConfirm ? '#f8f9fa' : '#007bff'} !important;
94
+ color: ${showConfirm ? '#666' : 'white'} !important;
95
+ border: ${showConfirm ? '1px solid #dee2e6' : 'none'} !important;
96
+ border-radius: 8px !important;
97
+
98
+ &:hover {
99
+ background-color: ${showConfirm ? '#e9ecef' : '#0056b3'} !important;
100
+ border-color: ${showConfirm ? '#ced4da' : 'none'} !important;
101
+ }
102
+ `}
103
+ >
104
+ {cancelText}
105
+ </button>
106
+ </div>
107
+ </div>
108
+ </div>
109
+ );
110
+ };