@useknest/widget-core 0.0.1-alpha.5 → 0.0.1-alpha.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/dist/config.d.ts CHANGED
@@ -1,8 +1,14 @@
1
1
  import { WidgetConfig } from './types';
2
+ export type ConfigErrorType = 'auth' | 'network' | null;
3
+ export interface ConfigResult {
4
+ config: WidgetConfig | null;
5
+ error: ConfigErrorType;
6
+ }
2
7
  /**
3
8
  * Fetches widget configuration from the API.
4
9
  * @param publishableApiKey - The API key for authentication
5
10
  * @param baseUrl - Base URL for the API. Defaults to https://useknest.com. Pass empty string for relative paths.
11
+ * @returns ConfigResult with config data or error type
6
12
  */
7
- export declare function fetchWidgetConfig(publishableApiKey: string, baseUrl?: string): Promise<WidgetConfig | null>;
13
+ export declare function fetchWidgetConfig(publishableApiKey: string, baseUrl?: string): Promise<ConfigResult>;
8
14
  //# sourceMappingURL=config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C;;;;GAIG;AACH,wBAAsB,iBAAiB,CACtC,iBAAiB,EAAE,MAAM,EACzB,OAAO,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAoB9B"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;AAExD,MAAM,WAAW,YAAY;IAC5B,MAAM,EAAE,YAAY,GAAG,IAAI,CAAC;IAC5B,KAAK,EAAE,eAAe,CAAC;CACvB;AAED;;;;;GAKG;AACH,wBAAsB,iBAAiB,CACtC,iBAAiB,EAAE,MAAM,EACzB,OAAO,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,YAAY,CAAC,CA4BvB"}
@@ -6,7 +6,8 @@ export declare function getChatApiUrl(baseUrl?: string): string;
6
6
  export declare function getConfigApiUrl(baseUrl?: string): string;
7
7
  export declare const FALLBACK_ERROR_MESSAGE = "Sorry, I didn't get a response.";
8
8
  export declare const DEFAULT_ERROR_MESSAGE = "Unknown error occurred";
9
- export declare const DEFAULT_AVATAR_URL = "/default-avatar.svg";
9
+ export declare const AUTH_ERROR_MESSAGE = "This domain is not authorized. Please add it to your allowed origins in the Knest dashboard.";
10
+ export declare const DEFAULT_AVATAR_URL = "https://useknest.com/default-avatar.svg";
10
11
  export declare const DEFAULT_BRAND_COLOR = "#0d7a7f";
11
12
  export declare const DEFAULT_WELCOME_MESSAGE = "Hi! I'm your AI assistant. I'm trained to answer questions about your documentation. How can I help you today?";
12
13
  export declare const DEFAULT_EXAMPLE_QUESTIONS: string[];
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,yBAAyB,CAAC;AACvD,eAAO,MAAM,QAAQ,YAAY,CAAC;AAElC,wDAAwD;AACxD,wBAAgB,aAAa,CAAC,OAAO,GAAE,MAAyB,GAAG,MAAM,CAExE;AAED,wDAAwD;AACxD,wBAAgB,eAAe,CAAC,OAAO,GAAE,MAAyB,GAAG,MAAM,CAE1E;AAED,eAAO,MAAM,sBAAsB,oCAAoC,CAAC;AACxE,eAAO,MAAM,qBAAqB,2BAA2B,CAAC;AAC9D,eAAO,MAAM,kBAAkB,wBAAwB,CAAC;AACxD,eAAO,MAAM,mBAAmB,YAAY,CAAC;AAC7C,eAAO,MAAM,uBAAuB,mHAC6E,CAAC;AAClH,eAAO,MAAM,yBAAyB,UAIrC,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,yBAAyB,CAAC;AACvD,eAAO,MAAM,QAAQ,YAAY,CAAC;AAElC,wDAAwD;AACxD,wBAAgB,aAAa,CAAC,OAAO,GAAE,MAAyB,GAAG,MAAM,CAExE;AAED,wDAAwD;AACxD,wBAAgB,eAAe,CAAC,OAAO,GAAE,MAAyB,GAAG,MAAM,CAE1E;AAED,eAAO,MAAM,sBAAsB,oCAAoC,CAAC;AACxE,eAAO,MAAM,qBAAqB,2BAA2B,CAAC;AAC9D,eAAO,MAAM,kBAAkB,iGACgE,CAAC;AAChG,eAAO,MAAM,kBAAkB,4CAA4C,CAAC;AAC5E,eAAO,MAAM,mBAAmB,YAAY,CAAC;AAC7C,eAAO,MAAM,uBAAuB,mHAC6E,CAAC;AAClH,eAAO,MAAM,yBAAyB,UAIrC,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export type { MessageRole, Source, Message, ChatMessageRequest, ChatMessageResponse, ChatApiError, WidgetConfig, SSEEvent } from './types';
2
- export { DEFAULT_BASE_URL, API_PATH, getChatApiUrl, getConfigApiUrl, FALLBACK_ERROR_MESSAGE, DEFAULT_ERROR_MESSAGE, DEFAULT_AVATAR_URL, DEFAULT_BRAND_COLOR, DEFAULT_WELCOME_MESSAGE, DEFAULT_EXAMPLE_QUESTIONS } from './constants';
2
+ export { DEFAULT_BASE_URL, API_PATH, getChatApiUrl, getConfigApiUrl, FALLBACK_ERROR_MESSAGE, DEFAULT_ERROR_MESSAGE, AUTH_ERROR_MESSAGE, DEFAULT_AVATAR_URL, DEFAULT_BRAND_COLOR, DEFAULT_WELCOME_MESSAGE, DEFAULT_EXAMPLE_QUESTIONS } from './constants';
3
3
  export { fetchWidgetConfig } from './config';
4
+ export type { ConfigResult, ConfigErrorType } from './config';
4
5
  export { streamChatMessage } from './streaming';
5
6
  export type { StreamCallbacks, StreamMessageOptions } from './streaming';
6
7
  export { formatContent } from './utils';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,YAAY,EACX,WAAW,EACX,MAAM,EACN,OAAO,EACP,kBAAkB,EAClB,mBAAmB,EACnB,YAAY,EACZ,YAAY,EACZ,QAAQ,EACR,MAAM,SAAS,CAAC;AAGjB,OAAO,EACN,gBAAgB,EAChB,QAAQ,EACR,aAAa,EACb,eAAe,EACf,sBAAsB,EACtB,qBAAqB,EACrB,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,EACvB,yBAAyB,EACzB,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAG7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,YAAY,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAGzE,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAGxC,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,YAAY,EACX,WAAW,EACX,MAAM,EACN,OAAO,EACP,kBAAkB,EAClB,mBAAmB,EACnB,YAAY,EACZ,YAAY,EACZ,QAAQ,EACR,MAAM,SAAS,CAAC;AAGjB,OAAO,EACN,gBAAgB,EAChB,QAAQ,EACR,aAAa,EACb,eAAe,EACf,sBAAsB,EACtB,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,EACvB,yBAAyB,EACzB,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAG9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,YAAY,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAGzE,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAGxC,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC"}