@smarter.sh/ui-chat 0.2.6 → 0.2.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smarter.sh/ui-chat",
3
- "version": "0.2.6",
3
+ "version": "0.2.7",
4
4
  "description": "chatbot React.js component for the https://smarter.sh no-code, plugin based AI platform",
5
5
  "homepage": "https://smarter.sh",
6
6
  "main": "dist/smarter-chat-library.umd.js",
@@ -49,14 +49,14 @@ function SmarterChat({
49
49
  apiUrl, // the URL of the Smarter chatbot API. example: https://smarter.3141-5926-5359.beta.api.smarter.sh/
50
50
  apiKey, // NOT USED. TO DELETE.
51
51
  toggleMetadata, // show/hide toggle button to show/hide the chat thread metadata
52
- csrfCookieName, // the Django CSRF cookie.
52
+ csrfCookieName = "csrftoken", // the Django CSRF cookie.
53
53
  debugCookieName, // the Smarter chat debug cookie. Set here.
54
54
  debugCookieExpiration, // the Smarter chat debug cookie. Set here.
55
- sessionCookieName, // the Smarter chat session cookie. Set here, where the user creates a new chat session.
55
+ sessionCookieName = "session_key", // the Smarter chat session cookie. Set here, where the user creates a new chat session.
56
56
  sessionCookieExpiration, // the Smarter chat session cookie. Set here, where the user creates a new chat session.
57
- authSessionCookieName, // the Django session cookie. Set when the user logs in to the Smarter web console app.
57
+ authSessionCookieName = "sessionid", // the Django session cookie. Set when the user logs in to the Smarter web console app.
58
58
  showConsole = true, // show the server console log component
59
- cookieDomain, // the domain of the cookie. This is added to the cookie meta data, but it is not used.
59
+ cookieDomain, // the domain of the cookie. This is added to the cookie meta data to restrict the domain that this component will read cookie data.
60
60
  }) {
61
61
  const [configApiUrl, setConfigApiUrl] = useState(apiUrl);
62
62
 
@@ -29,6 +29,7 @@ const userAgent = "SmarterChat/1.0";
29
29
  const applicationJson = "application/json";
30
30
 
31
31
  function getCookie(cookie, defaultValue = null) {
32
+ console.log("getCookie(): cookie", cookie);
32
33
  let cookieValue = null;
33
34
  const expectedDomain = cookie.domain;
34
35
 
@@ -39,6 +40,7 @@ function getCookie(cookie, defaultValue = null) {
39
40
  const thisCookie = cookies[i].trim();
40
41
  if (thisCookie.substring(0, cookie.name.length + 1) === cookie.name + "=") {
41
42
  cookieValue = decodeURIComponent(thisCookie.substring(cookie.name.length + 1));
43
+ console.log("getCookie(): ", cookie.domain, cookie.name, cookieValue);
42
44
  break;
43
45
  }
44
46
  }