keystone-design-bootstrap 1.0.91 → 1.0.92
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.js +11 -14
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/design_system/chat/useRealtimeReplyOrchestrator.ts +0 -1
- package/src/design_system/components/ChatWidget.tsx +22 -16
- package/src/design_system/portal/BookIframePanel.tsx +47 -22
- package/src/design_system/portal/PortalPage.tsx +11 -7
package/dist/index.js
CHANGED
|
@@ -20046,24 +20046,21 @@ function ChatWidget({
|
|
|
20046
20046
|
const [messages, setMessages] = useState33([]);
|
|
20047
20047
|
const [inputValue, setInputValue] = useState33("");
|
|
20048
20048
|
const [isLoading, setIsLoading] = useState33(false);
|
|
20049
|
-
const [sessionId
|
|
20049
|
+
const [sessionId] = useState33(() => {
|
|
20050
|
+
var _a;
|
|
20051
|
+
if (contactId) return "";
|
|
20052
|
+
if (providedSessionId) return providedSessionId;
|
|
20053
|
+
if (typeof window === "undefined") return "";
|
|
20054
|
+
return (_a = localStorage.getItem("keystone_chat_session_id")) != null ? _a : `session_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`;
|
|
20055
|
+
});
|
|
20050
20056
|
const [waitingForReply, setWaitingForReply] = useState33(false);
|
|
20051
20057
|
const messagesEndRef = useRef20(null);
|
|
20052
20058
|
useEffect14(() => {
|
|
20053
|
-
if (contactId) return;
|
|
20054
|
-
if (
|
|
20055
|
-
|
|
20056
|
-
} else {
|
|
20057
|
-
const stored = localStorage.getItem("keystone_chat_session_id");
|
|
20058
|
-
if (stored) {
|
|
20059
|
-
setSessionId(stored);
|
|
20060
|
-
} else {
|
|
20061
|
-
const newId = `session_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`;
|
|
20062
|
-
localStorage.setItem("keystone_chat_session_id", newId);
|
|
20063
|
-
setSessionId(newId);
|
|
20064
|
-
}
|
|
20059
|
+
if (contactId || providedSessionId || !sessionId) return;
|
|
20060
|
+
if (localStorage.getItem("keystone_chat_session_id") !== sessionId) {
|
|
20061
|
+
localStorage.setItem("keystone_chat_session_id", sessionId);
|
|
20065
20062
|
}
|
|
20066
|
-
}, [contactId, providedSessionId]);
|
|
20063
|
+
}, [contactId, providedSessionId, sessionId]);
|
|
20067
20064
|
const loadMessages = useCallback12(async () => {
|
|
20068
20065
|
if (!contactId && !sessionId) return [];
|
|
20069
20066
|
try {
|