@informedai/react 0.4.16 → 0.4.18

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.d.mts CHANGED
@@ -82,6 +82,8 @@ interface InformedAssistantConfig {
82
82
  documentTypeId: string;
83
83
  /** API base URL (defaults to https://api.informedassistant.ai/api/v1) */
84
84
  apiUrl?: string;
85
+ /** Pool access key (pak_*) for authentication */
86
+ accessKey?: string;
85
87
  /**
86
88
  * External ID for idempotency - your object's ID in your system.
87
89
  * If provided, the widget will find or create a document linked to this ID.
@@ -347,7 +349,8 @@ interface ApplyResponse {
347
349
  }
348
350
  declare class InformedAIClient {
349
351
  private apiUrl;
350
- constructor(apiUrl?: string);
352
+ private accessKey?;
353
+ constructor(apiUrl?: string, accessKey?: string);
351
354
  private getHeaders;
352
355
  private request;
353
356
  /**
package/dist/index.d.ts CHANGED
@@ -82,6 +82,8 @@ interface InformedAssistantConfig {
82
82
  documentTypeId: string;
83
83
  /** API base URL (defaults to https://api.informedassistant.ai/api/v1) */
84
84
  apiUrl?: string;
85
+ /** Pool access key (pak_*) for authentication */
86
+ accessKey?: string;
85
87
  /**
86
88
  * External ID for idempotency - your object's ID in your system.
87
89
  * If provided, the widget will find or create a document linked to this ID.
@@ -347,7 +349,8 @@ interface ApplyResponse {
347
349
  }
348
350
  declare class InformedAIClient {
349
351
  private apiUrl;
350
- constructor(apiUrl?: string);
352
+ private accessKey?;
353
+ constructor(apiUrl?: string, accessKey?: string);
351
354
  private getHeaders;
352
355
  private request;
353
356
  /**
package/dist/index.js CHANGED
@@ -40,13 +40,18 @@ var import_react_dom = require("react-dom");
40
40
  // src/utils/api-client.ts
41
41
  var DEFAULT_API_URL = "https://api.informedassistant.ai/api/v1";
42
42
  var InformedAIClient = class {
43
- constructor(apiUrl) {
43
+ constructor(apiUrl, accessKey) {
44
44
  this.apiUrl = apiUrl || DEFAULT_API_URL;
45
+ this.accessKey = accessKey;
45
46
  }
46
47
  getHeaders() {
47
- return {
48
+ const headers = {
48
49
  "Content-Type": "application/json"
49
50
  };
51
+ if (this.accessKey) {
52
+ headers["Authorization"] = `Bearer ${this.accessKey}`;
53
+ }
54
+ return headers;
50
55
  }
51
56
  async request(endpoint, options = {}) {
52
57
  const response = await fetch(`${this.apiUrl}${endpoint}`, {
@@ -304,8 +309,8 @@ function InformedAIProvider({ config, children }) {
304
309
  const shouldPersist = config.persistSession ?? true;
305
310
  const storageKey = getStorageKey(config.documentTypeId, config.externalId);
306
311
  (0, import_react.useEffect)(() => {
307
- clientRef.current = new InformedAIClient(config.apiUrl);
308
- }, [config.apiUrl]);
312
+ clientRef.current = new InformedAIClient(config.apiUrl, config.accessKey);
313
+ }, [config.apiUrl, config.accessKey]);
309
314
  const createNewSession = (0, import_react.useCallback)(async () => {
310
315
  if (!clientRef.current) return null;
311
316
  const result = await clientRef.current.createSession(
@@ -2258,7 +2263,9 @@ function WebsiteChatbot({ className, ...config }) {
2258
2263
  border: "1px solid #d1d5db",
2259
2264
  fontSize: "14px",
2260
2265
  fontFamily: "var(--wc-font)",
2261
- outline: "none"
2266
+ outline: "none",
2267
+ color: "#1f2937",
2268
+ backgroundColor: "#ffffff"
2262
2269
  }
2263
2270
  }
2264
2271
  ),
package/dist/index.mjs CHANGED
@@ -8,13 +8,18 @@ import { flushSync } from "react-dom";
8
8
  // src/utils/api-client.ts
9
9
  var DEFAULT_API_URL = "https://api.informedassistant.ai/api/v1";
10
10
  var InformedAIClient = class {
11
- constructor(apiUrl) {
11
+ constructor(apiUrl, accessKey) {
12
12
  this.apiUrl = apiUrl || DEFAULT_API_URL;
13
+ this.accessKey = accessKey;
13
14
  }
14
15
  getHeaders() {
15
- return {
16
+ const headers = {
16
17
  "Content-Type": "application/json"
17
18
  };
19
+ if (this.accessKey) {
20
+ headers["Authorization"] = `Bearer ${this.accessKey}`;
21
+ }
22
+ return headers;
18
23
  }
19
24
  async request(endpoint, options = {}) {
20
25
  const response = await fetch(`${this.apiUrl}${endpoint}`, {
@@ -272,8 +277,8 @@ function InformedAIProvider({ config, children }) {
272
277
  const shouldPersist = config.persistSession ?? true;
273
278
  const storageKey = getStorageKey(config.documentTypeId, config.externalId);
274
279
  useEffect(() => {
275
- clientRef.current = new InformedAIClient(config.apiUrl);
276
- }, [config.apiUrl]);
280
+ clientRef.current = new InformedAIClient(config.apiUrl, config.accessKey);
281
+ }, [config.apiUrl, config.accessKey]);
277
282
  const createNewSession = useCallback(async () => {
278
283
  if (!clientRef.current) return null;
279
284
  const result = await clientRef.current.createSession(
@@ -2226,7 +2231,9 @@ function WebsiteChatbot({ className, ...config }) {
2226
2231
  border: "1px solid #d1d5db",
2227
2232
  fontSize: "14px",
2228
2233
  fontFamily: "var(--wc-font)",
2229
- outline: "none"
2234
+ outline: "none",
2235
+ color: "#1f2937",
2236
+ backgroundColor: "#ffffff"
2230
2237
  }
2231
2238
  }
2232
2239
  ),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@informedai/react",
3
- "version": "0.4.16",
3
+ "version": "0.4.18",
4
4
  "description": "React SDK for InformedAI Assistant - AI-powered content creation widget",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",