@access-ci/ui 0.17.0 → 0.18.1

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/README.md CHANGED
@@ -129,14 +129,20 @@ The library includes functions for rendering common ACCESS user interface compon
129
129
 
130
130
  footer({ target: document.getElementById("footer") });
131
131
 
132
+ // Detect login state via ACCESS SSO cookie
133
+ const isLoggedIn = document.cookie.split("; ").includes("SESSaccesscisso=1")
134
+
135
+ // User info is typically provided by your CMS, something like this:
136
+ const { email, name, accessId } = window.cmsSettings?.currentUser || {};
137
+
132
138
  qaBot({
133
139
  target: document.getElementById("qa-bot"),
134
140
  apiKey: "my-api-key",
135
- userEmail: "user@example.com",
136
- userName: "John Doe",
137
- accessId: "jdoe123",
138
- isLoggedIn: true,
139
- welcome: "Welcome to the ACCESS Q&A Bot!",
141
+ isLoggedIn: isLoggedIn,
142
+ userEmail: email,
143
+ userName: name,
144
+ accessId: accessId,
145
+ loginUrl: "/login",
140
146
  onAnalyticsEvent: (event) => {
141
147
  window.dataLayer = window.dataLayer || [];
142
148
  window.dataLayer.push(event);