@eshal-bot/chat-widget 0.2.13 → 0.2.14
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/{chat-widget-MarkdownRenderer-D9NjXFWy.esm.js → chat-widget-MarkdownRenderer-Dj2CxQVq.esm.js} +1 -1
- package/dist/{chat-widget-index-C-9MnNDf.esm.js → chat-widget-index-DnppNZQ8.esm.js} +3 -3
- package/dist/chat-widget.esm.js +1 -1
- package/dist/chat-widget.js +99 -35
- package/dist/chat-widget.min.js +2 -2
- package/dist/chat-widget.umd.js +6 -6
- package/package.json +1 -1
package/dist/chat-widget.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{S as default}from"./chat-widget-index-
|
|
1
|
+
export{S as default}from"./chat-widget-index-DnppNZQ8.esm.js";import"react";import"react-dom/client";import"react/jsx-runtime";import"react-dom";
|
package/dist/chat-widget.js
CHANGED
|
@@ -18334,6 +18334,65 @@
|
|
|
18334
18334
|
});
|
|
18335
18335
|
}
|
|
18336
18336
|
|
|
18337
|
+
/**
|
|
18338
|
+
* ChipStrip - the one component that renders the prompt-chip strip on the
|
|
18339
|
+
* widget, the Testing Lab preview and the SDK (EV-3014).
|
|
18340
|
+
*
|
|
18341
|
+
* widget packages/widget/src/components/ChatInput.jsx PromptSuggestionsRow
|
|
18342
|
+
* preview packages/frontend/src/components/chatbot-preview.tsx PromptSuggestionsBar
|
|
18343
|
+
* SDK packages/agent-sdk/src/EshalChat.tsx FollowUpPromptsBar
|
|
18344
|
+
*
|
|
18345
|
+
* It owns what the three must agree on: the wrapper > stack > one <button>
|
|
18346
|
+
* per prompt structure, the display text of each chip (EV-2977 question vs
|
|
18347
|
+
* label), each chip's own text direction with the ambient direction as the
|
|
18348
|
+
* neutral-text fallback (EV-2993), and the click order: telemetry strictly
|
|
18349
|
+
* before the submit, never instead of it (EV-2979). Those are the behaviours
|
|
18350
|
+
* that drifted between copies before.
|
|
18351
|
+
*
|
|
18352
|
+
* Each surface keeps what is genuinely its own, passed in rather than shared:
|
|
18353
|
+
* classes, inline styles and attributes (Tailwind and org colours on the
|
|
18354
|
+
* widget and preview, CSS classes on the SDK), its text-direction detector
|
|
18355
|
+
* (pinned per package by rtlCharRangeParity), and its submit call. Class
|
|
18356
|
+
* strings stay in each surface's source so its Tailwind build still sees them.
|
|
18357
|
+
*
|
|
18358
|
+
* Plain JavaScript with React.createElement and no JSX, on purpose: the
|
|
18359
|
+
* widget's Rollup/Babel build compiles neither TypeScript nor JSX from
|
|
18360
|
+
* another package. Types live in ChipStrip.d.ts. Each surface's DOM is pinned
|
|
18361
|
+
* by its own markup golden (EV-3014).
|
|
18362
|
+
*/
|
|
18363
|
+
function ChipStrip({
|
|
18364
|
+
prompts,
|
|
18365
|
+
getDisplayText,
|
|
18366
|
+
detectDirection,
|
|
18367
|
+
ambientIsRtl,
|
|
18368
|
+
wrapperProps,
|
|
18369
|
+
stackProps,
|
|
18370
|
+
getKey,
|
|
18371
|
+
getChipProps,
|
|
18372
|
+
onChipClick,
|
|
18373
|
+
onSelect
|
|
18374
|
+
}) {
|
|
18375
|
+
return reactExports.createElement('div', wrapperProps, reactExports.createElement('div', stackProps, prompts.map((prompt, index) => {
|
|
18376
|
+
const displayText = getDisplayText(prompt);
|
|
18377
|
+
const chipIsRtl = detectDirection(displayText, ambientIsRtl);
|
|
18378
|
+
return reactExports.createElement('button', {
|
|
18379
|
+
key: getKey(prompt, index),
|
|
18380
|
+
type: 'button',
|
|
18381
|
+
...getChipProps({
|
|
18382
|
+
prompt,
|
|
18383
|
+
index,
|
|
18384
|
+
displayText,
|
|
18385
|
+
chipIsRtl
|
|
18386
|
+
}),
|
|
18387
|
+
onClick: () => {
|
|
18388
|
+
// EV-2979: fire-and-forget telemetry, strictly before the submit.
|
|
18389
|
+
if (onChipClick) onChipClick(prompt, index);
|
|
18390
|
+
onSelect(prompt, index);
|
|
18391
|
+
}
|
|
18392
|
+
}, displayText);
|
|
18393
|
+
})));
|
|
18394
|
+
}
|
|
18395
|
+
|
|
18337
18396
|
var img$1 = "data:image/svg+xml,%3csvg width='219' height='54' xmlns='http://www.w3.org/2000/svg' version='1.0'%3e%3cg class='layer'%3e%3ctitle%3eEshal Logo%3c/title%3e%3cg clip-path='url(%23a)' transform='translate(-.708 -1.076)'%3e%3cg clip-path='url(%23b)'%3e%3cpath d='M21.79 54.75h4.5l3.93-.56 4.49-1.4 3.38-1.97 2.81-2.25 2.24-2.81 2.25-3.93 1.13-3.09v-.85l-3.65-1.12h-.57l-1.96 4.5-1.97 3.09-2.81 2.53-3.93 1.96-3.38.85-2.81.28h-2.81l-4.21-.57-3.94-1.4-2.81-1.97-2.25-2.24-1.96-3.38-1.41-4.21-.56-3.37-.28-3.1v-3.65l.56-5.06 1.12-4.21 1.97-3.94 2.53-2.81 2.25-1.68 2.81-1.41 3.37-.84 2.25-.28H26l4.78.84 4.5 2.25 2.53 2.53 1.4 2.53.56 2.53-.28 3.65-1.12 2.25-1.41 1.69-1.4.55-1.13-4.21-1.68-2.81-1.97-1.97-3.09-1.4-1.12-.28h-5.34l-3.09 1.12-2.25 1.69-1.41 1.97-.84 3.09.28 3.08 1.4 2.82 1.97 1.96 2.81 1.41 2.25.56 4.78.28 3.09-.28.84-.28-1.12 3.09-1.69 1.97-2.25.84h-3.65l-2.81-1.12-1.68-1.41-3.38 2.25.56 1.13 1.13 1.4 2.81 1.69 2.81.84h4.78l2.81-.84 2.53-1.69 1.96-2.25L35 34.8l.84-4.5 3.65-2.24 2.53-2.53 1.69-3.09.56-2.25.28-2.81-.56-3.93-1.12-2.82-2.25-3.09-3.09-2.81-4.22-2.25-4.5-1.12-2.52-.28h-4.5l-3.93.56-4.5 1.41-3.38 1.96-3.37 3.1-2.52 3.65-1.97 4.49-1.13 4.78-.28 2.25v9.27l.84 5.06 1.69 4.78 1.69 3.09 2.25 2.81 2.8 2.53 2.82 1.69 5.06 1.68zm1.12-27.54-2.53-.84-1.4-1.12-.84-1.69.28-2.53 1.12-1.4 2.25-1.13H26l2.81 1.41 1.41 1.97.84 2.8v2.25l-1.12.28zm0 0' fill='black'/%3e%3c/g%3e%3c/g%3e%3cpath d='M82.381 38.435v6.48h-27.06V9.965h26.41v6.5h-18.36v7.57h16.22v6.3h-16.22v8.1zm16.432 7.07c-2.77 0-5.44-.37-8.02-1.11-2.57-.75-4.65-1.72-6.22-2.92l2.75-6.09c1.5 1.09 3.28 1.98 5.34 2.64 2.07.67 4.13 1 6.19 1q3.45 0 5.1-1.02t1.65-2.73c0-.83-.33-1.52-.98-2.06-.65-.55-1.48-1-2.5-1.33-1.01-.33-2.39-.7-4.11-1.1-2.67-.63-4.85-1.26-6.55-1.89s-3.15-1.64-4.37-3.04c-1.21-1.41-1.82-3.27-1.82-5.6 0-2.03.55-3.86 1.64-5.51 1.11-1.66 2.76-2.96 4.97-3.92 2.22-.97 4.93-1.46 8.13-1.46 2.22 0 4.4.27 6.53.8s4 1.3 5.59 2.3l-2.5 6.14c-3.23-1.82-6.45-2.74-9.67-2.74-2.27 0-3.95.37-5.03 1.1-1.07.73-1.61 1.69-1.61 2.89q0 1.8 1.86 2.67c1.25.59 3.16 1.16 5.72 1.72 2.66.63 4.85 1.27 6.55 1.9 1.69.63 3.14 1.63 4.36 2.99 1.21 1.37 1.82 3.21 1.82 5.55 0 2-.56 3.82-1.67 5.46q-1.68 2.475-5.01 3.93c-2.23.95-4.95 1.43-8.14 1.43m50.913-35.54v34.95h-8.08v-14.33h-15.88v14.33h-8.09V9.965h8.09v13.78h15.88V9.965zm29.811 27.47h-16.22l-3.1 7.48h-8.29l15.58-34.95h7.98l15.62 34.95h-8.48zm-2.55-6.15-5.55-13.37-5.53 13.37zm16.274-21.32h8.09v28.36h17.52v6.59h-25.61zm0 0' fill='black'/%3e%3c/g%3e%3c/svg%3e";
|
|
18338
18397
|
|
|
18339
18398
|
var img = "data:image/svg+xml,%3csvg width='219' height='54' xmlns='http://www.w3.org/2000/svg' version='1.0'%3e%3cg class='layer'%3e%3ctitle%3eEshal Logo%3c/title%3e%3cg clip-path='url(%23a)' transform='translate(-.708 -1.076)'%3e%3cg clip-path='url(%23b)'%3e%3cpath d='M21.79 54.75h4.5l3.93-.56 4.49-1.4 3.38-1.97 2.81-2.25 2.24-2.81 2.25-3.93 1.13-3.09v-.85l-3.65-1.12h-.57l-1.96 4.5-1.97 3.09-2.81 2.53-3.93 1.96-3.38.85-2.81.28h-2.81l-4.21-.57-3.94-1.4-2.81-1.97-2.25-2.24-1.96-3.38-1.41-4.21-.56-3.37-.28-3.1v-3.65l.56-5.06 1.12-4.21 1.97-3.94 2.53-2.81 2.25-1.68 2.81-1.41 3.37-.84 2.25-.28H26l4.78.84 4.5 2.25 2.53 2.53 1.4 2.53.56 2.53-.28 3.65-1.12 2.25-1.41 1.69-1.4.55-1.13-4.21-1.68-2.81-1.97-1.97-3.09-1.4-1.12-.28h-5.34l-3.09 1.12-2.25 1.69-1.41 1.97-.84 3.09.28 3.08 1.4 2.82 1.97 1.96 2.81 1.41 2.25.56 4.78.28 3.09-.28.84-.28-1.12 3.09-1.69 1.97-2.25.84h-3.65l-2.81-1.12-1.68-1.41-3.38 2.25.56 1.13 1.13 1.4 2.81 1.69 2.81.84h4.78l2.81-.84 2.53-1.69 1.96-2.25L35 34.8l.84-4.5 3.65-2.24 2.53-2.53 1.69-3.09.56-2.25.28-2.81-.56-3.93-1.12-2.82-2.25-3.09-3.09-2.81-4.22-2.25-4.5-1.12-2.52-.28h-4.5l-3.93.56-4.5 1.41-3.38 1.96-3.37 3.1-2.52 3.65-1.97 4.49-1.13 4.78-.28 2.25v9.27l.84 5.06 1.69 4.78 1.69 3.09 2.25 2.81 2.8 2.53 2.82 1.69 5.06 1.68zm1.12-27.54-2.53-.84-1.4-1.12-.84-1.69.28-2.53 1.12-1.4 2.25-1.13H26l2.81 1.41 1.41 1.97.84 2.8v2.25l-1.12.28zm0 0' fill='white'/%3e%3c/g%3e%3c/g%3e%3cpath d='M82.381 38.435v6.48h-27.06V9.965h26.41v6.5h-18.36v7.57h16.22v6.3h-16.22v8.1zm16.432 7.07c-2.77 0-5.44-.37-8.02-1.11-2.57-.75-4.65-1.72-6.22-2.92l2.75-6.09c1.5 1.09 3.28 1.98 5.34 2.64 2.07.67 4.13 1 6.19 1q3.45 0 5.1-1.02t1.65-2.73c0-.83-.33-1.52-.98-2.06-.65-.55-1.48-1-2.5-1.33-1.01-.33-2.39-.7-4.11-1.1-2.67-.63-4.85-1.26-6.55-1.89s-3.15-1.64-4.37-3.04c-1.21-1.41-1.82-3.27-1.82-5.6 0-2.03.55-3.86 1.64-5.51 1.11-1.66 2.76-2.96 4.97-3.92 2.22-.97 4.93-1.46 8.13-1.46 2.22 0 4.4.27 6.53.8s4 1.3 5.59 2.3l-2.5 6.14c-3.23-1.82-6.45-2.74-9.67-2.74-2.27 0-3.95.37-5.03 1.1-1.07.73-1.61 1.69-1.61 2.89q0 1.8 1.86 2.67c1.25.59 3.16 1.16 5.72 1.72 2.66.63 4.85 1.27 6.55 1.9 1.69.63 3.14 1.63 4.36 2.99 1.21 1.37 1.82 3.21 1.82 5.55 0 2-.56 3.82-1.67 5.46q-1.68 2.475-5.01 3.93c-2.23.95-4.95 1.43-8.14 1.43m50.913-35.54v34.95h-8.08v-14.33h-15.88v14.33h-8.09V9.965h8.09v13.78h15.88V9.965zm29.811 27.47h-16.22l-3.1 7.48h-8.29l15.58-34.95h7.98l15.62 34.95h-8.48zm-2.55-6.15-5.55-13.37-5.53 13.37zm16.274-21.32h8.09v28.36h17.52v6.59h-25.61zm0 0' fill='white'/%3e%3c/g%3e%3c/svg%3e";
|
|
@@ -18352,43 +18411,48 @@
|
|
|
18352
18411
|
// getPromptDisplayText. Kill-switch: behavior.autoPromptQuestionDisplay.
|
|
18353
18412
|
questionDisplay = true
|
|
18354
18413
|
}) => {
|
|
18355
|
-
|
|
18356
|
-
|
|
18357
|
-
|
|
18414
|
+
// EV-3014: the strip is the shared ChipStrip, also rendered by the Testing
|
|
18415
|
+
// Lab preview and the SDK. Each chip follows the direction of the string it
|
|
18416
|
+
// actually DISPLAYS (EV-2993) - under EV-2977 the natural question
|
|
18417
|
+
// (submitText), not the title-case label - falling back to the configured
|
|
18418
|
+
// widget direction only when the text itself is direction-neutral ("123", a
|
|
18419
|
+
// lone "?"). `dir="auto"` alone was not enough: it hard-defaults neutral
|
|
18420
|
+
// text to LTR and leaves `text-align` on the container's direction. The
|
|
18421
|
+
// widget keeps its own classes (here, so its Tailwind build sees them),
|
|
18422
|
+
// accepts plain-string prompts, and records click telemetry in its parent.
|
|
18423
|
+
return /*#__PURE__*/jsxRuntimeExports.jsx(ChipStrip, {
|
|
18424
|
+
prompts: suggestions,
|
|
18425
|
+
getDisplayText: p => getPromptDisplayText(p, questionDisplay),
|
|
18426
|
+
detectDirection: detectTextDirection,
|
|
18427
|
+
ambientIsRtl: isRtl,
|
|
18428
|
+
wrapperProps: {
|
|
18429
|
+
className: "mb-2 px-5"
|
|
18430
|
+
},
|
|
18431
|
+
stackProps: {
|
|
18358
18432
|
className: "flex flex-col gap-2",
|
|
18359
18433
|
role: "group",
|
|
18360
|
-
"aria-label": t("suggestedQuestions")
|
|
18361
|
-
|
|
18362
|
-
|
|
18363
|
-
|
|
18364
|
-
|
|
18365
|
-
|
|
18366
|
-
|
|
18367
|
-
|
|
18368
|
-
|
|
18369
|
-
|
|
18370
|
-
|
|
18371
|
-
|
|
18372
|
-
|
|
18373
|
-
|
|
18374
|
-
|
|
18375
|
-
|
|
18376
|
-
// handlers that only read the submit value.
|
|
18377
|
-
onSuggestionClick(p.submitText || p.text || p, p, index),
|
|
18378
|
-
dir: chipIsRtl ? "rtl" : "ltr",
|
|
18379
|
-
className: `block w-full rounded-2xl px-4 py-2 border-0 transition-transform duration-150 active:scale-[0.99] ${chipIsRtl ? "text-right" : "text-left"}`,
|
|
18380
|
-
style: {
|
|
18381
|
-
direction: chipIsRtl ? "rtl" : "ltr",
|
|
18382
|
-
textAlign: chipIsRtl ? "right" : "left",
|
|
18383
|
-
background: `linear-gradient(135deg, ${promptPrimary} 0%, ${promptPrimary}dd 100%)`,
|
|
18384
|
-
color: promptTextColor,
|
|
18385
|
-
fontFamily: promptFontFamily,
|
|
18386
|
-
fontSize: promptFontSize
|
|
18387
|
-
},
|
|
18388
|
-
children: displayText
|
|
18389
|
-
}, `${p.text || p}-${index}`);
|
|
18390
|
-
})
|
|
18434
|
+
"aria-label": t("suggestedQuestions")
|
|
18435
|
+
},
|
|
18436
|
+
getKey: (p, index) => `${p.text || p}-${index}`,
|
|
18437
|
+
getChipProps: ({
|
|
18438
|
+
chipIsRtl
|
|
18439
|
+
}) => ({
|
|
18440
|
+
dir: chipIsRtl ? "rtl" : "ltr",
|
|
18441
|
+
className: `block w-full rounded-2xl px-4 py-2 border-0 transition-transform duration-150 active:scale-[0.99] ${chipIsRtl ? "text-right" : "text-left"}`,
|
|
18442
|
+
style: {
|
|
18443
|
+
direction: chipIsRtl ? "rtl" : "ltr",
|
|
18444
|
+
textAlign: chipIsRtl ? "right" : "left",
|
|
18445
|
+
background: `linear-gradient(135deg, ${promptPrimary} 0%, ${promptPrimary}dd 100%)`,
|
|
18446
|
+
color: promptTextColor,
|
|
18447
|
+
fontFamily: promptFontFamily,
|
|
18448
|
+
fontSize: promptFontSize
|
|
18449
|
+
}
|
|
18391
18450
|
})
|
|
18451
|
+
// EV-2842: pass the prompt object + position so the click handler can
|
|
18452
|
+
// record telemetry; extra args are ignored by handlers that only read
|
|
18453
|
+
// the submit value.
|
|
18454
|
+
,
|
|
18455
|
+
onSelect: (p, index) => onSuggestionClick(p.submitText || p.text || p, p, index)
|
|
18392
18456
|
});
|
|
18393
18457
|
};
|
|
18394
18458
|
const ChatInput = ({
|
|
@@ -21440,7 +21504,7 @@
|
|
|
21440
21504
|
* value by its own test (that constant sat at 0.1.113 while this package was
|
|
21441
21505
|
* at 0.2.2 precisely because nothing enforced it - EV-2431).
|
|
21442
21506
|
*/
|
|
21443
|
-
const WIDGET_VERSION = '0.2.
|
|
21507
|
+
const WIDGET_VERSION = '0.2.14';
|
|
21444
21508
|
|
|
21445
21509
|
/**
|
|
21446
21510
|
* API utility functions
|