@eshal-bot/chat-widget 0.1.98 → 0.1.99
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-CuL-0miz.esm.js → chat-widget-MarkdownRenderer-DPwT1hDQ.esm.js} +1 -1
- package/dist/{chat-widget-index-C4KMbduJ.esm.js → chat-widget-index-BHNeh4MK.esm.js} +1 -1
- package/dist/chat-widget.esm.js +1 -1
- package/dist/chat-widget.js +50 -7
- package/dist/chat-widget.min.js +5 -5
- package/dist/chat-widget.umd.js +1 -1
- 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-BHNeh4MK.esm.js";import"react";import"react-dom/client";import"react-dom";import"react/jsx-runtime";
|
package/dist/chat-widget.js
CHANGED
|
@@ -17169,7 +17169,11 @@
|
|
|
17169
17169
|
},
|
|
17170
17170
|
children: suggestions.map((p, index) => /*#__PURE__*/jsxRuntimeExports.jsx("button", {
|
|
17171
17171
|
type: "button",
|
|
17172
|
-
onClick: () =>
|
|
17172
|
+
onClick: () =>
|
|
17173
|
+
// EV-2842: pass the prompt object + position so the click
|
|
17174
|
+
// handler can record telemetry; extra args are ignored by
|
|
17175
|
+
// handlers that only read the submit value.
|
|
17176
|
+
onSuggestionClick(p.submitText || p.text || p, p, index),
|
|
17173
17177
|
dir: "auto",
|
|
17174
17178
|
className: "inline-flex items-center rounded-full px-4 py-1.5 whitespace-nowrap flex-shrink-0 border-0 transition-transform duration-150 active:scale-95",
|
|
17175
17179
|
style: {
|
|
@@ -18852,9 +18856,48 @@
|
|
|
18852
18856
|
var _panelRef$current;
|
|
18853
18857
|
(_panelRef$current = panelRef.current) === null || _panelRef$current === void 0 || _panelRef$current.focus();
|
|
18854
18858
|
}, []);
|
|
18855
|
-
|
|
18859
|
+
|
|
18860
|
+
// EV-2842 - chip click telemetry. Fire-and-forget POST to the
|
|
18861
|
+
// HMAC-verified support proxy (same auth pattern as the CSAT calls
|
|
18862
|
+
// below). A telemetry failure must never block or delay submitting
|
|
18863
|
+
// the chip's text, so this is never awaited and swallows everything.
|
|
18864
|
+
const reportChipClick = reactExports.useCallback(async (submitValue, prompt, index) => {
|
|
18865
|
+
try {
|
|
18866
|
+
if (!apiBaseUrl) return;
|
|
18867
|
+
const headers = {
|
|
18868
|
+
"Content-Type": "application/json"
|
|
18869
|
+
};
|
|
18870
|
+
if (typeof getAuthToken === "function") {
|
|
18871
|
+
const token = await getAuthToken();
|
|
18872
|
+
if (token) headers["Authorization"] = "Bearer ".concat(token);
|
|
18873
|
+
}
|
|
18874
|
+
await fetch("".concat(apiBaseUrl.replace(/\/$/, ""), "/api/v1/support/chip-click"), {
|
|
18875
|
+
method: "POST",
|
|
18876
|
+
headers,
|
|
18877
|
+
credentials: "include",
|
|
18878
|
+
keepalive: true,
|
|
18879
|
+
body: JSON.stringify({
|
|
18880
|
+
conversationId,
|
|
18881
|
+
chipText: prompt && prompt.text || String(submitValue !== null && submitValue !== void 0 ? submitValue : ""),
|
|
18882
|
+
submitText: String(submitValue !== null && submitValue !== void 0 ? submitValue : ""),
|
|
18883
|
+
position: Number.isInteger(index) ? index : undefined,
|
|
18884
|
+
source: "widget"
|
|
18885
|
+
})
|
|
18886
|
+
});
|
|
18887
|
+
} catch (_unused) {
|
|
18888
|
+
// Telemetry only - never surface to the user.
|
|
18889
|
+
}
|
|
18890
|
+
}, [apiBaseUrl, getAuthToken, conversationId]);
|
|
18891
|
+
const stableOnPromptSuggestionClick = reactExports.useCallback((text, prompt, index) => {
|
|
18892
|
+
// EV-2842: record the chip click (not awaited). Only fires when a
|
|
18893
|
+
// prompt OBJECT rode along - i.e. a real auto-prompt chip row -
|
|
18894
|
+
// so A2UI buttons / onboarding handlers that call this with just
|
|
18895
|
+
// a string are not miscounted as chip clicks.
|
|
18896
|
+
if (prompt && typeof prompt === "object") {
|
|
18897
|
+
reportChipClick(text, prompt, index);
|
|
18898
|
+
}
|
|
18856
18899
|
if (onPromptSuggestionClick) onPromptSuggestionClick(text);else onDirectSend === null || onDirectSend === void 0 || onDirectSend(text);
|
|
18857
|
-
}, [onPromptSuggestionClick, onDirectSend]);
|
|
18900
|
+
}, [onPromptSuggestionClick, onDirectSend, reportChipClick]);
|
|
18858
18901
|
|
|
18859
18902
|
// ─── Resizable widget ────────────────────────────────────────────
|
|
18860
18903
|
const anchorRight = launcherPosition.includes("right");
|
|
@@ -18866,7 +18909,7 @@
|
|
|
18866
18909
|
if (!raw) return null;
|
|
18867
18910
|
const parsed = JSON.parse(raw);
|
|
18868
18911
|
if (typeof (parsed === null || parsed === void 0 ? void 0 : parsed.width) === "number" && typeof (parsed === null || parsed === void 0 ? void 0 : parsed.height) === "number" && parsed.width >= _WIDGET_MIN_W && parsed.height >= _WIDGET_MIN_H) return parsed;
|
|
18869
|
-
} catch (
|
|
18912
|
+
} catch (_unused2) {/* fall through */}
|
|
18870
18913
|
return null;
|
|
18871
18914
|
});
|
|
18872
18915
|
const resizeAxisRef = reactExports.useRef(null);
|
|
@@ -18914,7 +18957,7 @@
|
|
|
18914
18957
|
if (!widgetSize) return;
|
|
18915
18958
|
try {
|
|
18916
18959
|
window.localStorage.setItem(_WIDGET_SIZE_KEY, JSON.stringify(widgetSize));
|
|
18917
|
-
} catch (
|
|
18960
|
+
} catch (_unused3) {/* ignore */}
|
|
18918
18961
|
}, [widgetSize]);
|
|
18919
18962
|
const handleResizeStart = (axis, e) => {
|
|
18920
18963
|
e.preventDefault();
|
|
@@ -18942,7 +18985,7 @@
|
|
|
18942
18985
|
try {
|
|
18943
18986
|
var _getSession$csatSubmi, _getSession;
|
|
18944
18987
|
return (_getSession$csatSubmi = (_getSession = getSession(organizationId)) === null || _getSession === void 0 ? void 0 : _getSession.csatSubmitted) !== null && _getSession$csatSubmi !== void 0 ? _getSession$csatSubmi : false;
|
|
18945
|
-
} catch (
|
|
18988
|
+
} catch (_unused4) {
|
|
18946
18989
|
return false;
|
|
18947
18990
|
}
|
|
18948
18991
|
});
|
|
@@ -18961,7 +19004,7 @@
|
|
|
18961
19004
|
const submitted = (_getSession$csatSubmi2 = (_getSession2 = getSession(organizationId)) === null || _getSession2 === void 0 ? void 0 : _getSession2.csatSubmitted) !== null && _getSession$csatSubmi2 !== void 0 ? _getSession$csatSubmi2 : false;
|
|
18962
19005
|
setCsatSubmitted(submitted);
|
|
18963
19006
|
if (submitted) setShowCsat(false);
|
|
18964
|
-
} catch (
|
|
19007
|
+
} catch (_unused5) {}
|
|
18965
19008
|
}, [conversationId]);
|
|
18966
19009
|
|
|
18967
19010
|
// Auto-scroll hook
|