@eshal-bot/chat-widget 0.2.24 → 0.2.26

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.
@@ -87938,11 +87938,12 @@
87938
87938
  },
87939
87939
  angle: xAngle,
87940
87940
  textAnchor: xAnchor,
87941
- interval: 0,
87942
- tickFormatter: v => {
87943
- const s = String(v ?? '');
87944
- return s.replace(/[_\-]+/g, ' ').replace(/\b\w/g, c => c.toUpperCase());
87945
- },
87941
+ interval: 0
87942
+ // Each label arrives formatted by A2uiBlock (formatAxisTick), so the
87943
+ // axis shows it as given, as the line and pie charts do. Capitalising
87944
+ // it again would split "CNBC-TV18" and turn "McDonald's" into
87945
+ // "McDonald'S".
87946
+ ,
87946
87947
  label: props.xAxisLabel ? {
87947
87948
  value: props.xAxisLabel,
87948
87949
  position: 'insideBottom',
@@ -90383,11 +90384,28 @@
90383
90384
  const MONTH_NAMES = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
90384
90385
  const CURRENCY_KEY_RE = /(^|[_\W])(price|salary|cost|amount|revenue|expense|total|value|budget|spend|income|sale|balance)/i;
90385
90386
  const MONTH_KEY_RE = /(^|[_\W])month/i;
90387
+
90388
+ // Only a column-style value is reworded: one with an underscore
90389
+ // (office_supplies), one without capitals (kebab-case, all-lower words)
90390
+ // or a camelCase key. A value written with capitals is a name and stays as
90391
+ // written ("DD Sports", "Republic TV", "GEC"), as does a word written with
90392
+ // capitals inside a key (GRP_pre -> "GRP Pre"). Lower-casing every word but
90393
+ // its first letter read those channels as "Dd Sports", "Republic Tv" and
90394
+ // "Gec" (Media Prowess, Oct 2026).
90386
90395
  function prettifyLabel(value) {
90387
90396
  if (value === null || value === undefined) return '';
90388
- const s = String(value);
90397
+ const s = String(value).replace(/\s+/g, ' ').trim();
90389
90398
  if (!s) return '';
90390
- return s.replace(/[_\-]+/g, ' ').replace(/([a-z])([A-Z])/g, '$1 $2').replace(/\s+/g, ' ').trim().split(' ').map(w => w.charAt(0).toUpperCase() + w.slice(1).toLowerCase()).join(' ');
90399
+ if (!isColumnStyle(s)) return s;
90400
+ return s.replace(/[_\-]+/g, ' ').replace(/([a-z])([A-Z])/g, '$1 $2').replace(/\s+/g, ' ').trim().split(' ').map(w => w === w.toLowerCase() ? w.charAt(0).toUpperCase() + w.slice(1) : w).join(' ');
90401
+ }
90402
+
90403
+ // A camelCase key ("camelCaseKey", "totalSpend"): two lower-case letters
90404
+ // before the first capital, so names such as "iPhone", "eBay" and "kWh"
90405
+ // stay as written.
90406
+ const CAMEL_CASE_KEY_RE = /^[a-z]{2}[a-z0-9]*[A-Z][A-Za-z0-9]*$/;
90407
+ function isColumnStyle(s) {
90408
+ return s.includes('_') || s === s.toLowerCase() || CAMEL_CASE_KEY_RE.test(s);
90391
90409
  }
90392
90410
  function isCurrencyKey(key) {
90393
90411
  return typeof key === 'string' && CURRENCY_KEY_RE.test(key);