andy-widget-react 2.1.0 → 2.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "andy-widget-react",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "Official React Widget for embeddable Andy agents",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -67,6 +67,6 @@
67
67
  "react-dom": "^18.0.0 || ^19.0.0"
68
68
  },
69
69
  "dependencies": {
70
- "andy-widget-core": "2.1.0"
70
+ "andy-widget-core": "2.1.1"
71
71
  }
72
72
  }
package/src/AndyChat.tsx CHANGED
@@ -121,6 +121,8 @@ const AndyChat: React.FC<AndyChatProps> = ({
121
121
  setSessionId(projection.identity.sessionId)
122
122
  pendingHandoffIdsRef.current = projection.pendingProjectionIds || []
123
123
  const projectedMessages = projection.messages.map(message => ({ id: message.id, content: message.content, sender: message.role === 'user' ? 'user' as const : 'bot' as const, timestamp: new Date(message.createdAt).toISOString(), isHuman: message.sentByHuman }))
124
+ // An empty agent projection does not mean the client-only greeting is gone.
125
+ if (projection.control === 'agent' && projectedMessages.length === 0) return
124
126
  setMessages(projection.control === 'requested' || projection.control === 'human'
125
127
  ? [...projectedMessages, { id: 'handoff-waiting', content: strings.handoffWaiting, sender: 'bot', timestamp: new Date().toISOString(), isWaiting: true }]
126
128
  : projectedMessages)
@@ -696,7 +698,7 @@ const AndyChat: React.FC<AndyChatProps> = ({
696
698
  bubble = document.createElement('button')
697
699
  bubble.type = 'button'
698
700
  bubble.className = 'andy-chat-bubble'
699
- bubble.setAttribute('aria-label', 'Open chat')
701
+ bubble.setAttribute('aria-label', strings.openChat)
700
702
 
701
703
  const tooltipHTML = tooltip
702
704
  ? `<span class="andy-chat-bubble__tooltip" role="tooltip">${tooltip}</span>`
@@ -713,6 +715,7 @@ const AndyChat: React.FC<AndyChatProps> = ({
713
715
  const bubbleLogoUrl = config?.logoUrl || CHAT_BUBBLE_DEFAULT_ICON_URL
714
716
 
715
717
  if (bubble) {
718
+ bubble.setAttribute('aria-label', isOpen ? strings.closeChat : strings.openChat)
716
719
  bubble.className = 'andy-chat-bubble'
717
720
  if (isPillStyle) {
718
721
  bubble.classList.add('andy-chat-bubble--pill')
@@ -775,7 +778,7 @@ const AndyChat: React.FC<AndyChatProps> = ({
775
778
  type='button'
776
779
  className='andy-header__back'
777
780
  id='andy-back-button'
778
- aria-label='Go back'
781
+ aria-label={strings.goBack}
779
782
  onClick={() => setIsOpen(false)}
780
783
  >
781
784
  <svg
@@ -821,7 +824,7 @@ const AndyChat: React.FC<AndyChatProps> = ({
821
824
  type='button'
822
825
  className='andy-header__close'
823
826
  id='andy-close-button'
824
- aria-label='Close chat'
827
+ aria-label={strings.closeChat}
825
828
  onClick={() => setIsOpen(false)}
826
829
  >
827
830
  <svg
@@ -1021,7 +1024,7 @@ const AndyChat: React.FC<AndyChatProps> = ({
1021
1024
  className='andy-input__field'
1022
1025
  id='andy-message-input'
1023
1026
  placeholder={config ? strings.inputPlaceholder : '...'}
1024
- aria-label='Message input'
1027
+ aria-label={strings.messageInput}
1025
1028
  onKeyDown={e => {
1026
1029
  if (e.key === 'Enter' && (e.target as HTMLInputElement).value.trim()) {
1027
1030
  handleSendMessage((e.target as HTMLInputElement).value)
@@ -1034,7 +1037,7 @@ const AndyChat: React.FC<AndyChatProps> = ({
1034
1037
  type='button'
1035
1038
  className='andy-input__button'
1036
1039
  id='andy-send-button'
1037
- aria-label='Send message'
1040
+ aria-label={strings.sendMessage}
1038
1041
  onClick={() => {
1039
1042
  const input = shadowRef.current?.getElementById(
1040
1043
  'andy-message-input'
@@ -1084,7 +1087,7 @@ const AndyChat: React.FC<AndyChatProps> = ({
1084
1087
  className={`andy-welcome-popup ${config?.orientation === 'left' ? 'andychat-popup-left' : ''}`}
1085
1088
  style={{ display: 'block' }}
1086
1089
  role='dialog'
1087
- aria-label='Welcome message'
1090
+ aria-label={strings.welcomeMessage}
1088
1091
  >
1089
1092
  <div className='andy-welcome-popup__content'>
1090
1093
  <div className='andy-welcome-popup__message'>
@@ -1095,7 +1098,7 @@ const AndyChat: React.FC<AndyChatProps> = ({
1095
1098
  <button
1096
1099
  type='button'
1097
1100
  className='andy-welcome-popup__close'
1098
- aria-label='Close welcome message'
1101
+ aria-label={strings.closeWelcomeMessage}
1099
1102
  onClick={() => setShowWelcomePopup(false)}
1100
1103
  >
1101
1104
  <svg