'use strict';

/**
 * Helper to extract string from ReactNode for announcements.
 * Complex ReactNodes (JSX elements) return empty string.
 */
const getStringValue = node => {
  if (typeof node === 'string' || typeof node === 'number') {
    return String(node);
  }
  return '';
};
/**
 * Builds the announcement string from visible content only.
 * Content visibility depends on expanded state and presence of title.
 */
const buildAnnouncementString = ({
  title,
  description,
  expanded,
  actionLabel,
  actionSecondaryLabel
}) => {
  return [title ? getStringValue(title) : undefined, description && (expanded || !title) ? getStringValue(description) : undefined, expanded && actionLabel ? getStringValue(actionLabel) : undefined, expanded && actionSecondaryLabel ? getStringValue(actionSecondaryLabel) : undefined].filter(Boolean).join('|');
};

exports.buildAnnouncementString = buildAnnouncementString;
exports.getStringValue = getStringValue;
//# sourceMappingURL=helpers.js.map
