andy-widget-react 2.0.6 → 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/dist/index.esm.js CHANGED
@@ -3433,6 +3433,48 @@ const SVG_ICONS = {
3433
3433
  <path d="M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z" />
3434
3434
  </svg>`};
3435
3435
 
3436
+ // Localized UI Strings
3437
+ // Chrome the widget renders itself, as opposed to copy the Agent supplies.
3438
+ // Keyed by language so React and Vanilla render identical text for a visitor.
3439
+ const UI_STRINGS = {
3440
+ en: {
3441
+ openChat: 'Open chat',
3442
+ closeChat: 'Close chat',
3443
+ goBack: 'Go back',
3444
+ messageInput: 'Message input',
3445
+ sendMessage: 'Send message',
3446
+ welcomeMessage: 'Welcome message',
3447
+ closeWelcomeMessage: 'Close welcome message',
3448
+ inputPlaceholder: 'Type your message...',
3449
+ predefinedQuestionsTitle: 'What would you like to know?',
3450
+ sendFailure: 'Sorry, I could not answer. Please try again.',
3451
+ handoffWaiting: 'A team member will reply soon.',
3452
+ teamName: 'Team'
3453
+ },
3454
+ es: {
3455
+ openChat: 'Abrir chat',
3456
+ closeChat: 'Cerrar chat',
3457
+ goBack: 'Volver',
3458
+ messageInput: 'Entrada de mensaje',
3459
+ sendMessage: 'Enviar mensaje',
3460
+ welcomeMessage: 'Mensaje de bienvenida',
3461
+ closeWelcomeMessage: 'Cerrar mensaje de bienvenida',
3462
+ inputPlaceholder: 'Escribe tu mensaje...',
3463
+ predefinedQuestionsTitle: '¿Qué te gustaría saber?',
3464
+ sendFailure: 'Lo siento, no pude responder. Inténtalo de nuevo.',
3465
+ handoffWaiting: 'Un miembro del equipo te responderá pronto.',
3466
+ teamName: 'Equipo'
3467
+ }
3468
+ };
3469
+
3470
+ /**
3471
+ * Get the widget's own UI strings for a language.
3472
+ * Unknown languages fall back to English rather than rendering blanks.
3473
+ * @param {string} [lang] - Language code ('en' or 'es')
3474
+ * @returns {typeof UI_STRINGS.en} The localized string set
3475
+ */
3476
+ const getUiStrings = lang => UI_STRINGS[lang] || UI_STRINGS.en;
3477
+
3436
3478
  /**
3437
3479
  * Keyboard detection utility for handling mobile virtual keyboards
3438
3480
  * Provides cross-browser support for detecting keyboard open/close events
@@ -3851,8 +3893,13 @@ const createBrowserHandoff = (chatbotId, bootstrap, onProjection) => {
3851
3893
  }
3852
3894
  };
3853
3895
 
3854
- const AndyChat = ({ embedId, tooltip, name, headline, description, welcomeMessage, bubbleLabel, theme, orientation, brandColor, bubbleStyle, useBrandColor, logoUrl, previewMode = false, initialOpen = false }) => {
3896
+ const AndyChat = ({ embedId, tooltip, name, headline, description, welcomeMessage, bubbleLabel, lang, predefinedQuestions, theme, orientation, brandColor, bubbleStyle, useBrandColor, logoUrl, previewMode = false, initialOpen = false }) => {
3855
3897
  const [config, setConfig] = useState(null);
3898
+ // The visitor's language wins over the Agent's own default: a Spanish Agent
3899
+ // embedded on an English page must still render English chrome.
3900
+ const uiLang = lang || config?.defaultLang || 'en';
3901
+ const strings = getUiStrings(uiLang);
3902
+ const activeQuestions = predefinedQuestions?.length ? predefinedQuestions : config?.predefinedQuestions;
3856
3903
  const [isOpen, setIsOpen] = useState(initialOpen);
3857
3904
  const [messages, setMessages] = useState([]);
3858
3905
  const [isLoading, setIsLoading] = useState(false);
@@ -3882,8 +3929,11 @@ const AndyChat = ({ embedId, tooltip, name, headline, description, welcomeMessag
3882
3929
  setSessionId(projection.identity.sessionId);
3883
3930
  pendingHandoffIdsRef.current = projection.pendingProjectionIds || [];
3884
3931
  const projectedMessages = projection.messages.map(message => ({ id: message.id, content: message.content, sender: message.role === 'user' ? 'user' : 'bot', timestamp: new Date(message.createdAt).toISOString(), isHuman: message.sentByHuman }));
3932
+ // An empty agent projection does not mean the client-only greeting is gone.
3933
+ if (projection.control === 'agent' && projectedMessages.length === 0)
3934
+ return;
3885
3935
  setMessages(projection.control === 'requested' || projection.control === 'human'
3886
- ? [...projectedMessages, { id: 'handoff-waiting', content: config.defaultLang === 'es' ? 'Un miembro del equipo te responderá pronto.' : 'A team member will reply soon.', sender: 'bot', timestamp: new Date().toISOString(), isWaiting: true }]
3936
+ ? [...projectedMessages, { id: 'handoff-waiting', content: strings.handoffWaiting, sender: 'bot', timestamp: new Date().toISOString(), isWaiting: true }]
3887
3937
  : projectedMessages);
3888
3938
  });
3889
3939
  handoffRef.current = handoff;
@@ -4072,12 +4122,12 @@ const AndyChat = ({ embedId, tooltip, name, headline, description, welcomeMessag
4072
4122
  bubbleStyle: bubbleStyle || 'icon',
4073
4123
  bubbleLabel: bubbleLabel || null,
4074
4124
  useBrandColor: useBrandColor !== undefined ? useBrandColor : true,
4075
- defaultLang: 'en',
4125
+ defaultLang: uiLang,
4076
4126
  showBranding: true,
4077
4127
  showWelcomePopup: { enabled: false, seconds: 3, message: '' },
4078
4128
  collectUserInfo: { enabled: false, message: '' },
4079
4129
  welcomeMessage: welcomeMessage || 'Hi there! How can I help you today?',
4080
- predefinedQuestions: [],
4130
+ predefinedQuestions: predefinedQuestions || [],
4081
4131
  faqs: []
4082
4132
  };
4083
4133
  setConfig(previewConfig);
@@ -4230,7 +4280,7 @@ const AndyChat = ({ embedId, tooltip, name, headline, description, welcomeMessag
4230
4280
  setIsLoading(true);
4231
4281
  const response = await sendMessageForWidget(embedId, sessionId, messageText);
4232
4282
  if (response.status === 'waiting') {
4233
- setMessages(prev => prev.some(message => message.isWaiting) ? prev : [...prev, { id: 'handoff-waiting', content: config?.defaultLang === 'es' ? 'Un miembro del equipo te responderá pronto.' : 'A team member will reply soon.', sender: 'bot', timestamp: new Date().toISOString(), isWaiting: true }]);
4283
+ setMessages(prev => prev.some(message => message.isWaiting) ? prev : [...prev, { id: 'handoff-waiting', content: strings.handoffWaiting, sender: 'bot', timestamp: new Date().toISOString(), isWaiting: true }]);
4234
4284
  return;
4235
4285
  }
4236
4286
  const botMessage = {
@@ -4257,9 +4307,7 @@ const AndyChat = ({ embedId, tooltip, name, headline, description, welcomeMessag
4257
4307
  console.error('AndyChat: Message request failed.');
4258
4308
  const errorMessage = {
4259
4309
  id: timestamp + 3,
4260
- content: config?.defaultLang === 'es'
4261
- ? 'Lo siento, no pude responder. Inténtalo de nuevo.'
4262
- : 'Sorry, I could not answer. Please try again.',
4310
+ content: strings.sendFailure,
4263
4311
  sender: 'bot',
4264
4312
  timestamp: new Date().toISOString(),
4265
4313
  isError: true
@@ -4366,7 +4414,7 @@ const AndyChat = ({ embedId, tooltip, name, headline, description, welcomeMessag
4366
4414
  bubble = document.createElement('button');
4367
4415
  bubble.type = 'button';
4368
4416
  bubble.className = 'andy-chat-bubble';
4369
- bubble.setAttribute('aria-label', 'Open chat');
4417
+ bubble.setAttribute('aria-label', strings.openChat);
4370
4418
  const tooltipHTML = tooltip
4371
4419
  ? `<span class="andy-chat-bubble__tooltip" role="tooltip">${tooltip}</span>`
4372
4420
  : '';
@@ -4375,9 +4423,10 @@ const AndyChat = ({ embedId, tooltip, name, headline, description, welcomeMessag
4375
4423
  bubble.addEventListener('click', () => setIsOpen(prev => !prev));
4376
4424
  }
4377
4425
  const isPillStyle = config?.bubbleStyle === 'pill';
4378
- const displayLabel = bubbleLabel || config?.bubbleLabel || (isPillStyle ? getDefaultBubbleLabel(config?.defaultLang || 'en') : null);
4426
+ const displayLabel = bubbleLabel || config?.bubbleLabel || (isPillStyle ? getDefaultBubbleLabel(uiLang) : null);
4379
4427
  const bubbleLogoUrl = config?.logoUrl || CHAT_BUBBLE_DEFAULT_ICON_URL;
4380
4428
  if (bubble) {
4429
+ bubble.setAttribute('aria-label', isOpen ? strings.closeChat : strings.openChat);
4381
4430
  bubble.className = 'andy-chat-bubble';
4382
4431
  if (isPillStyle) {
4383
4432
  bubble.classList.add('andy-chat-bubble--pill');
@@ -4420,7 +4469,7 @@ const AndyChat = ({ embedId, tooltip, name, headline, description, welcomeMessag
4420
4469
  }
4421
4470
  }
4422
4471
  }, [shadowReady, config, isOpen, tooltip, bubbleLabel]);
4423
- return (jsx("div", { ref: containerRef, id: 'andy-chatbot-container', children: portalRef.current && shadowReady && config && (jsxs(Fragment, { children: [ReactDOM.createPortal(jsxs("div", { className: `andy-chat-window ${isOpen ? 'andy-chat-window--open' : ''}`, children: [jsxs("header", { className: 'andy-header', children: [jsx("button", { type: 'button', className: 'andy-header__back', id: 'andy-back-button', "aria-label": 'Go back', onClick: () => setIsOpen(false), children: jsx("svg", { className: 'andy-header__back-icon', width: '20', height: '20', viewBox: '0 0 24 24', fill: 'none', children: jsx("path", { d: 'M15 18l-6-6 6-6', stroke: 'currentColor', strokeWidth: '2', strokeLinecap: 'round', strokeLinejoin: 'round' }) }) }), jsxs("div", { className: 'andy-header__bot-info', children: [jsx("div", { className: 'andy-header__avatar', children: config?.logoUrl ? (jsx("img", { src: config.logoUrl, alt: 'Bot Avatar', className: 'andy-header__avatar-image' })) : (jsx("img", { src: CHAT_BUBBLE_DEFAULT_ICON_URL, alt: 'Bot Avatar', className: 'andy-header__avatar-icon andy-header__avatar-icon--default' })) }), jsxs("div", { className: 'andy-header__text', children: [jsx("h1", { className: 'andy-header__name', children: config?.name || 'Andy bot' }), config?.headline && (jsx("p", { className: 'andy-header__subtitle', title: config.headline, children: config.headline }))] })] }), jsx("button", { type: 'button', className: 'andy-header__close', id: 'andy-close-button', "aria-label": 'Close chat', onClick: () => setIsOpen(false), children: jsx("svg", { className: 'andy-header__close-icon', width: '20', height: '20', viewBox: '0 0 24 24', fill: 'none', children: jsx("path", { d: 'M18 6L6 18M6 6l12 12', stroke: 'currentColor', strokeWidth: '2', strokeLinecap: 'round', strokeLinejoin: 'round' }) }) })] }), jsxs("div", { className: 'andy-chat-window__messages', id: 'andy-messages', ref: messagesContainerRef, children: [config?.description && (jsx("div", { className: 'andy-chat-subtitle', children: jsx("p", { className: 'andy-chat-subtitle__text', children: config.description }) })), messages.map(message => {
4472
+ return (jsx("div", { ref: containerRef, id: 'andy-chatbot-container', children: portalRef.current && shadowReady && config && (jsxs(Fragment, { children: [ReactDOM.createPortal(jsxs("div", { className: `andy-chat-window ${isOpen ? 'andy-chat-window--open' : ''}`, children: [jsxs("header", { className: 'andy-header', children: [jsx("button", { type: 'button', className: 'andy-header__back', id: 'andy-back-button', "aria-label": strings.goBack, onClick: () => setIsOpen(false), children: jsx("svg", { className: 'andy-header__back-icon', width: '20', height: '20', viewBox: '0 0 24 24', fill: 'none', children: jsx("path", { d: 'M15 18l-6-6 6-6', stroke: 'currentColor', strokeWidth: '2', strokeLinecap: 'round', strokeLinejoin: 'round' }) }) }), jsxs("div", { className: 'andy-header__bot-info', children: [jsx("div", { className: 'andy-header__avatar', children: config?.logoUrl ? (jsx("img", { src: config.logoUrl, alt: 'Bot Avatar', className: 'andy-header__avatar-image' })) : (jsx("img", { src: CHAT_BUBBLE_DEFAULT_ICON_URL, alt: 'Bot Avatar', className: 'andy-header__avatar-icon andy-header__avatar-icon--default' })) }), jsxs("div", { className: 'andy-header__text', children: [jsx("h1", { className: 'andy-header__name', children: config?.name || 'Andy bot' }), config?.headline && (jsx("p", { className: 'andy-header__subtitle', title: config.headline, children: config.headline }))] })] }), jsx("button", { type: 'button', className: 'andy-header__close', id: 'andy-close-button', "aria-label": strings.closeChat, onClick: () => setIsOpen(false), children: jsx("svg", { className: 'andy-header__close-icon', width: '20', height: '20', viewBox: '0 0 24 24', fill: 'none', children: jsx("path", { d: 'M18 6L6 18M6 6l12 12', stroke: 'currentColor', strokeWidth: '2', strokeLinecap: 'round', strokeLinejoin: 'round' }) }) })] }), jsxs("div", { className: 'andy-chat-window__messages', id: 'andy-messages', ref: messagesContainerRef, children: [config?.description && (jsx("div", { className: 'andy-chat-subtitle', children: jsx("p", { className: 'andy-chat-subtitle__text', children: config.description }) })), messages.map(message => {
4424
4473
  if (message.isForm) {
4425
4474
  return (jsxs("div", { className: 'andy-message-container andy-message-container--form', children: [jsx("div", { className: 'andy-avatar', children: jsx("svg", { className: 'andy-avatar__icon', width: '24', height: '24', viewBox: '0 0 24 24', fill: 'none', xmlns: 'http://www.w3.org/2000/svg', children: jsx("path", { d: 'M20 2H4C2.9 2 2 2.9 2 4V22L6 18H20C21.1 18 22 17.1 22 16V4C22 2.9 21.1 2 20 2Z', fill: 'currentColor' }) }) }), jsx("div", { className: 'andy-message andy-message--bot andy-message--form', children: jsx("div", { className: 'andy-user-info-form', children: jsxs("div", { className: 'andy-user-info-form__content', children: [jsx("h3", { className: 'andy-user-info-form__title', children: config?.collectUserInfo?.message ||
4426
4475
  'Please provide your information to continue:' }), jsxs("form", { className: 'andy-user-info-form__form', id: 'andy-user-info-form', children: [jsxs("div", { className: 'andy-form-group', children: [jsx("label", { htmlFor: 'andy-user-name', className: 'andy-form-group__label', children: "Name" }), jsx("input", { type: 'text', id: 'andy-user-name', className: 'andy-form-group__input', placeholder: 'Your Name', required: true })] }), jsxs("div", { className: 'andy-form-group', children: [jsx("label", { htmlFor: 'andy-user-email', className: 'andy-form-group__label', children: "Email" }), jsx("input", { type: 'email', id: 'andy-user-email', className: 'andy-form-group__input', placeholder: 'Your Email', required: true })] }), jsx("button", { type: 'submit', className: 'andy-button andy-button--primary andy-user-info-form__submit', children: "Submit" })] })] }) }) })] }, message.id));
@@ -4428,15 +4477,15 @@ const AndyChat = ({ embedId, tooltip, name, headline, description, welcomeMessag
4428
4477
  if (message.isLoading) {
4429
4478
  return (jsx("div", { className: 'andy-message-container andy-message-container--bot andy-message-container--loading', children: jsx("div", { className: 'andy-message andy-message--bot', children: jsxs("div", { className: 'andy-typing-indicator', children: [jsx("div", { className: 'andy-typing-indicator__dot' }), jsx("div", { className: 'andy-typing-indicator__dot' }), jsx("div", { className: 'andy-typing-indicator__dot' })] }) }) }, message.id));
4430
4479
  }
4431
- return (jsxs("div", { className: `andy-message-container andy-message-container--${message.sender} ${message.isWaiting ? 'andy-message-container--waiting' : ''}`, children: [message.sender === 'bot' && (jsxs("div", { className: `andy-message andy-message--bot ${message.isHuman ? 'andy-message--operator' : ''} ${message.isWaiting ? 'andy-message--waiting' : ''} ${message.isError ? 'andy-message--error' : ''}`, children: [jsxs("div", { className: 'andy-bot-header', children: [jsx("div", { className: 'andy-bot-header__icon', children: config?.logoUrl ? (jsx("img", { src: config.logoUrl, alt: 'Bot Avatar', className: 'andy-bot-header__icon-image' })) : (jsx("img", { src: CHAT_BUBBLE_DEFAULT_ICON_URL, alt: 'Bot Avatar', className: 'andy-bot-header__icon-image andy-bot-header__icon-image--default' })) }), jsx("span", { className: 'andy-bot-header__name', children: message.isHuman ? (config?.defaultLang === 'es' ? 'Equipo' : 'Team') : config?.name || 'Andy bot' })] }), jsx("div", { className: 'andy-message__content', children: jsx("div", { dangerouslySetInnerHTML: { __html: parseMarkdown(message.content) } }) })] })), message.sender === 'user' && (jsx("div", { className: 'andy-message andy-message--user', children: jsx("div", { className: 'andy-message__content', children: jsx("p", { children: message.content }) }) }))] }, message.id));
4432
- }), isLoading && (jsx("div", { className: 'andy-message-container andy-message-container--bot andy-message-container--typing', children: jsx("div", { className: 'andy-message andy-message--bot andy-message--typing', children: jsxs("div", { className: 'andy-typing-indicator', children: [jsx("div", { className: 'andy-typing-indicator__dot' }), jsx("div", { className: 'andy-typing-indicator__dot' }), jsx("div", { className: 'andy-typing-indicator__dot' })] }) }) }))] }), jsxs("div", { className: 'andy-chat-window__bottom', children: [config?.predefinedQuestions &&
4433
- config.predefinedQuestions.length > 0 &&
4434
- showPredefinedQuestions && (jsxs("div", { className: 'andy-predefined-questions', id: 'andy-predefined-questions', children: [jsx("div", { className: 'andy-predefined-questions__header', children: jsx("p", { className: 'andy-predefined-questions__title', children: "What would you like to know?" }) }), jsx("div", { className: 'andy-predefined-questions__list', children: config.predefinedQuestions.map((q, index) => (jsxs("button", { type: 'button', className: 'andy-predefined-question', "data-question": q.question, disabled: isCollectingUserInfo || isLoading || !config, children: [jsx("span", { className: 'andy-predefined-question__icon', children: "\uD83D\uDCAC" }), jsx("span", { className: 'andy-predefined-question__text', children: q.question })] }, index))) })] })), jsx("div", { className: 'andy-chat-window__input', children: jsx("div", { className: 'andy-input-container', children: jsxs("div", { className: 'andy-input', children: [jsx("input", { type: 'text', className: 'andy-input__field', id: 'andy-message-input', placeholder: config ? 'Type your message...' : '...', "aria-label": 'Message input', onKeyDown: e => {
4480
+ return (jsxs("div", { className: `andy-message-container andy-message-container--${message.sender} ${message.isWaiting ? 'andy-message-container--waiting' : ''}`, children: [message.sender === 'bot' && (jsxs("div", { className: `andy-message andy-message--bot ${message.isHuman ? 'andy-message--operator' : ''} ${message.isWaiting ? 'andy-message--waiting' : ''} ${message.isError ? 'andy-message--error' : ''}`, children: [jsxs("div", { className: 'andy-bot-header', children: [jsx("div", { className: 'andy-bot-header__icon', children: config?.logoUrl ? (jsx("img", { src: config.logoUrl, alt: 'Bot Avatar', className: 'andy-bot-header__icon-image' })) : (jsx("img", { src: CHAT_BUBBLE_DEFAULT_ICON_URL, alt: 'Bot Avatar', className: 'andy-bot-header__icon-image andy-bot-header__icon-image--default' })) }), jsx("span", { className: 'andy-bot-header__name', children: message.isHuman ? strings.teamName : config?.name || 'Andy bot' })] }), jsx("div", { className: 'andy-message__content', children: jsx("div", { dangerouslySetInnerHTML: { __html: parseMarkdown(message.content) } }) })] })), message.sender === 'user' && (jsx("div", { className: 'andy-message andy-message--user', children: jsx("div", { className: 'andy-message__content', children: jsx("p", { children: message.content }) }) }))] }, message.id));
4481
+ }), isLoading && (jsx("div", { className: 'andy-message-container andy-message-container--bot andy-message-container--typing', children: jsx("div", { className: 'andy-message andy-message--bot andy-message--typing', children: jsxs("div", { className: 'andy-typing-indicator', children: [jsx("div", { className: 'andy-typing-indicator__dot' }), jsx("div", { className: 'andy-typing-indicator__dot' }), jsx("div", { className: 'andy-typing-indicator__dot' })] }) }) }))] }), jsxs("div", { className: 'andy-chat-window__bottom', children: [activeQuestions &&
4482
+ activeQuestions.length > 0 &&
4483
+ showPredefinedQuestions && (jsxs("div", { className: 'andy-predefined-questions', id: 'andy-predefined-questions', children: [jsx("div", { className: 'andy-predefined-questions__header', children: jsx("p", { className: 'andy-predefined-questions__title', children: strings.predefinedQuestionsTitle }) }), jsx("div", { className: 'andy-predefined-questions__list', children: activeQuestions.map((q, index) => (jsxs("button", { type: 'button', className: 'andy-predefined-question', "data-question": q.question, disabled: isCollectingUserInfo || isLoading || !config, children: [jsx("span", { className: 'andy-predefined-question__icon', children: "\uD83D\uDCAC" }), jsx("span", { className: 'andy-predefined-question__text', children: q.question })] }, index))) })] })), jsx("div", { className: 'andy-chat-window__input', children: jsx("div", { className: 'andy-input-container', children: jsxs("div", { className: 'andy-input', children: [jsx("input", { type: 'text', className: 'andy-input__field', id: 'andy-message-input', placeholder: config ? strings.inputPlaceholder : '...', "aria-label": strings.messageInput, onKeyDown: e => {
4435
4484
  if (e.key === 'Enter' && e.target.value.trim()) {
4436
4485
  handleSendMessage(e.target.value);
4437
4486
  e.target.value = '';
4438
4487
  }
4439
- }, disabled: isCollectingUserInfo || !config }), jsx("button", { type: 'button', className: 'andy-input__button', id: 'andy-send-button', "aria-label": 'Send message', onClick: () => {
4488
+ }, disabled: isCollectingUserInfo || !config }), jsx("button", { type: 'button', className: 'andy-input__button', id: 'andy-send-button', "aria-label": strings.sendMessage, onClick: () => {
4440
4489
  const input = shadowRef.current?.getElementById('andy-message-input');
4441
4490
  if (input && input.value.trim()) {
4442
4491
  handleSendMessage(input.value);
@@ -4444,9 +4493,9 @@ const AndyChat = ({ embedId, tooltip, name, headline, description, welcomeMessag
4444
4493
  }
4445
4494
  }, disabled: isCollectingUserInfo || !config, children: jsx("svg", { className: 'andy-input__button-icon', width: '18', height: '18', viewBox: '0 0 24 24', fill: 'currentColor', xmlns: 'http://www.w3.org/2000/svg', children: jsx("path", { d: 'M2.01 21L23 12 2.01 3 2 10l15 2-15 2z' }) }) })] }) }) }), config?.showBranding !== false && (jsx("footer", { className: 'andy-chat-window__footer', children: jsx("a", { href: getFooterUrl(), target: '_blank', rel: 'noopener noreferrer', className: 'andy-chat-window__footer-link', children: jsx("span", { className: 'andy-chat-window__footer-text', children: FOOTER_TEXT }) }) }))] })] }), portalRef.current), showWelcomePopup &&
4446
4495
  !isOpen &&
4447
- ReactDOM.createPortal(jsxs("div", { className: `andy-welcome-popup ${config?.orientation === 'left' ? 'andychat-popup-left' : ''}`, style: { display: 'block' }, role: 'dialog', "aria-label": 'Welcome message', children: [jsxs("div", { className: 'andy-welcome-popup__content', children: [jsx("div", { className: 'andy-welcome-popup__message', children: config?.showWelcomePopup?.message ||
4496
+ ReactDOM.createPortal(jsxs("div", { className: `andy-welcome-popup ${config?.orientation === 'left' ? 'andychat-popup-left' : ''}`, style: { display: 'block' }, role: 'dialog', "aria-label": strings.welcomeMessage, children: [jsxs("div", { className: 'andy-welcome-popup__content', children: [jsx("div", { className: 'andy-welcome-popup__message', children: config?.showWelcomePopup?.message ||
4448
4497
  config?.welcomeMessage ||
4449
- 'Welcome! How can I help you today?' }), jsx("button", { type: 'button', className: 'andy-welcome-popup__close', "aria-label": 'Close welcome message', onClick: () => setShowWelcomePopup(false), children: jsx("svg", { className: 'andy-welcome-popup__close-icon', width: '20', height: '20', viewBox: '0 0 24 24', fill: 'none', xmlns: 'http://www.w3.org/2000/svg', children: jsx("path", { d: 'M18 6L6 18M6 6l12 12', stroke: 'currentColor', strokeWidth: '2', strokeLinecap: 'round', strokeLinejoin: 'round' }) }) })] }), jsx("div", { className: 'andy-welcome-popup__arrow' })] }), portalRef.current)] })) }));
4498
+ 'Welcome! How can I help you today?' }), jsx("button", { type: 'button', className: 'andy-welcome-popup__close', "aria-label": strings.closeWelcomeMessage, onClick: () => setShowWelcomePopup(false), children: jsx("svg", { className: 'andy-welcome-popup__close-icon', width: '20', height: '20', viewBox: '0 0 24 24', fill: 'none', xmlns: 'http://www.w3.org/2000/svg', children: jsx("path", { d: 'M18 6L6 18M6 6l12 12', stroke: 'currentColor', strokeWidth: '2', strokeLinecap: 'round', strokeLinejoin: 'round' }) }) })] }), jsx("div", { className: 'andy-welcome-popup__arrow' })] }), portalRef.current)] })) }));
4450
4499
  };
4451
4500
 
4452
4501
  const { SESSION_STORAGE_KEY, FORM_DISPLAY_DELAY_MS, PERSIST_SESSION } = CONFIG;