@kelet-ai/feedback-ui 0.7.0 → 0.7.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.
@@ -8,6 +8,7 @@ interface KeletContextValue {
8
8
  interface KeletProviderProps {
9
9
  apiKey?: string;
10
10
  project: string;
11
+ baseUrl?: string;
11
12
  }
12
13
  export declare const KeletContext: React.Context<KeletContextValue | null>;
13
14
  export declare const useKelet: () => KeletContextValue;
@@ -353,7 +353,7 @@ function requireJsxRuntime() {
353
353
  }
354
354
  var jsxRuntimeExports = requireJsxRuntime();
355
355
  const KeletContext = createContext(null);
356
- const KeletBaseUrl = "https://api.kelet.ai/api";
356
+ const DefaultKeletBaseUrl = "https://api.kelet.ai/api";
357
357
  const useKelet = () => {
358
358
  const context = useContext(KeletContext);
359
359
  if (!context) {
@@ -373,7 +373,7 @@ const useDefaultFeedbackHandler = () => {
373
373
  return context.feedback;
374
374
  }
375
375
  };
376
- const KeletProvider = ({ apiKey, project, children }) => {
376
+ const KeletProvider = ({ apiKey, project, baseUrl, children }) => {
377
377
  const parentContext = useContext(KeletContext);
378
378
  const resolvedApiKey = apiKey || parentContext?.api_key;
379
379
  if (!resolvedApiKey) {
@@ -382,7 +382,8 @@ const KeletProvider = ({ apiKey, project, children }) => {
382
382
  );
383
383
  }
384
384
  const feedback = async (data) => {
385
- const url = `${KeletBaseUrl}/projects/${project}/feedback`;
385
+ const resolvedBaseUrl = baseUrl || DefaultKeletBaseUrl;
386
+ const url = `${resolvedBaseUrl}/projects/${project}/feedback`;
386
387
  const req = {
387
388
  tx_id: data.tx_id,
388
389
  source: data.source || "EXPLICIT",