@cloro-dev/response-parser 0.1.2 → 0.1.4

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.
Files changed (60) hide show
  1. package/README.md +107 -50
  2. package/dist/core/types.d.ts +5 -6
  3. package/dist/core/types.d.ts.map +1 -1
  4. package/dist/index.d.ts +78 -13
  5. package/dist/index.esm.js +1 -1
  6. package/dist/index.esm.js.map +1 -1
  7. package/dist/index.js +1 -1
  8. package/dist/index.js.map +1 -1
  9. package/dist/providers/ai-mode.d.ts +14 -3
  10. package/dist/providers/ai-mode.d.ts.map +1 -1
  11. package/dist/providers/ai-overview.d.ts +14 -3
  12. package/dist/providers/ai-overview.d.ts.map +1 -1
  13. package/dist/providers/base-provider.d.ts +4 -1
  14. package/dist/providers/base-provider.d.ts.map +1 -1
  15. package/dist/providers/chatgpt.d.ts +15 -3
  16. package/dist/providers/chatgpt.d.ts.map +1 -1
  17. package/dist/providers/copilot.d.ts +12 -1
  18. package/dist/providers/copilot.d.ts.map +1 -1
  19. package/dist/providers/gemini.d.ts +12 -1
  20. package/dist/providers/gemini.d.ts.map +1 -1
  21. package/dist/providers/perplexity.d.ts +10 -3
  22. package/dist/providers/perplexity.d.ts.map +1 -1
  23. package/dist/react/components/AiResponseRenderer.d.ts +2 -2
  24. package/dist/react/components/AiResponseRenderer.d.ts.map +1 -1
  25. package/dist/react/components/ResponseRenderer.d.ts +24 -0
  26. package/dist/react/components/ResponseRenderer.d.ts.map +1 -0
  27. package/dist/react/core/types.d.ts +5 -6
  28. package/dist/react/core/types.d.ts.map +1 -1
  29. package/dist/react/hooks/useAiResponse.d.ts.map +1 -1
  30. package/dist/react/hooks/useResponse.d.ts +19 -0
  31. package/dist/react/hooks/useResponse.d.ts.map +1 -0
  32. package/dist/react/index.d.ts +13 -14
  33. package/dist/react/index.esm.js +1 -1
  34. package/dist/react/index.esm.js.map +1 -1
  35. package/dist/react/index.js +1 -1
  36. package/dist/react/index.js.map +1 -1
  37. package/dist/react/providers/ai-mode.d.ts +14 -3
  38. package/dist/react/providers/ai-mode.d.ts.map +1 -1
  39. package/dist/react/providers/ai-overview.d.ts +14 -3
  40. package/dist/react/providers/ai-overview.d.ts.map +1 -1
  41. package/dist/react/providers/base-provider.d.ts +4 -1
  42. package/dist/react/providers/base-provider.d.ts.map +1 -1
  43. package/dist/react/providers/chatgpt.d.ts +15 -3
  44. package/dist/react/providers/chatgpt.d.ts.map +1 -1
  45. package/dist/react/providers/copilot.d.ts +12 -1
  46. package/dist/react/providers/copilot.d.ts.map +1 -1
  47. package/dist/react/providers/gemini.d.ts +12 -1
  48. package/dist/react/providers/gemini.d.ts.map +1 -1
  49. package/dist/react/providers/perplexity.d.ts +10 -3
  50. package/dist/react/providers/perplexity.d.ts.map +1 -1
  51. package/dist/react/react/components/AiResponseRenderer.d.ts +2 -2
  52. package/dist/react/react/components/AiResponseRenderer.d.ts.map +1 -1
  53. package/dist/react/react/components/ResponseRenderer.d.ts +24 -0
  54. package/dist/react/react/components/ResponseRenderer.d.ts.map +1 -0
  55. package/dist/react/react/hooks/useAiResponse.d.ts.map +1 -1
  56. package/dist/react/react/hooks/useResponse.d.ts +19 -0
  57. package/dist/react/react/hooks/useResponse.d.ts.map +1 -0
  58. package/dist/react/react/index.d.ts +6 -6
  59. package/dist/react/react/index.d.ts.map +1 -1
  60. package/package.json +1 -1
@@ -1,10 +1,22 @@
1
- import { BaseProvider } from './base-provider';
2
- import { AIProvider, ParsedResponse, ParseOptions, ContentExtraction } from '../core/types';
1
+ import { BaseProvider } from "./base-provider";
2
+ import { AIProvider, ParsedResponse, ParseOptions, ContentExtraction } from "../core/types";
3
3
  export declare class ChatGPTProvider extends BaseProvider {
4
4
  readonly name: AIProvider;
5
5
  readonly baseUrl = "https://chatgpt.com";
6
- readonly defaultStyles = "\n /* Force Dark Background on main containers and wrappers */\n html, body, main, article, footer, form,\n [class*=\"bg-\"], [class*=\"footer\"], [class*=\"bottom\"],\n div[class*=\"border-t\"],\n #thread-bottom-container, #thread-bottom,\n #thread, .composer-parent, [class*=\"group\\/thread\"] {\n background-color: #131314 !important;\n color: #e3e3e3 !important;\n border-color: #2a2b36 !important;\n }\n\n /* Force background on specific white artifacts in the footer */\n #thread-bottom-container .bg-clip-padding,\n #thread-bottom-container .content-fade,\n #thread-bottom-container .absolute {\n background-color: transparent !important;\n }\n\n /* Specific targeting for the composer/input box (was white) */\n form .bg-token-bg-primary, form .shadow-short {\n background-color: #2a2b36 !important;\n border-color: #3e3f4b !important;\n box-shadow: none !important;\n }\n\n /* Disclaimer Footer - Force Dark Background */\n div[class*=\"text-token-text-secondary\"] {\n color: #9ca3af !important;\n background-color: #131314 !important;\n }\n\n /* Force Text Color to Light */\n p, h1, h2, h3, h4, h5, h6, li, span, div, td, th, textarea, button {\n color: #e3e3e3 !important;\n }\n\n /* Links - Light Blue */\n a, a span {\n color: #8ab4f8 !important;\n }\n\n /* Code Blocks */\n pre, code, pre div, code span {\n background-color: #2a2b36 !important;\n color: #e3e3e3 !important;\n text-shadow: none !important;\n }\n\n /* Inputs/Textareas */\n input, textarea {\n background-color: transparent !important;\n color: #e3e3e3 !important;\n border-color: #3e3f4b !important;\n }\n\n /* Placeholder text */\n textarea::placeholder {\n color: #9ca3af !important;\n }\n\n /* Hide Sidebar */\n nav, [class*=\"sidebar\"] {\n display: none !important;\n }\n\n /* Media visibility */\n img, video {\n opacity: 1 !important;\n }\n ";
7
6
  extractContent(response: any): ContentExtraction;
7
+ /**
8
+ * Remove links from HTML, preserving badge styling
9
+ * Converts <a> tags to <span> while keeping class attributes
10
+ */
11
+ removeLinks(html: string): string;
12
+ /**
13
+ * Remove ChatGPT sidebar from HTML
14
+ */
15
+ removeSidebar(html: string): string;
16
+ /**
17
+ * Remove ChatGPT footer/composer from HTML
18
+ */
19
+ removeFooter(html: string): string;
8
20
  parse(response: any, options?: ParseOptions): ParsedResponse;
9
21
  }
10
22
  //# sourceMappingURL=chatgpt.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"chatgpt.d.ts","sourceRoot":"","sources":["../../src/providers/chatgpt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAE5F,qBAAa,eAAgB,SAAQ,YAAY;IAC/C,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAa;IACtC,QAAQ,CAAC,OAAO,yBAAyB;IAEzC,QAAQ,CAAC,aAAa,ygEAsEpB;IAEF,cAAc,CAAC,QAAQ,EAAE,GAAG,GAAG,iBAAiB;IAkChD,KAAK,CAAC,QAAQ,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,cAAc;CAgC7D"}
1
+ {"version":3,"file":"chatgpt.d.ts","sourceRoot":"","sources":["../../src/providers/chatgpt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EACL,UAAU,EACV,cAAc,EACd,YAAY,EACZ,iBAAiB,EAClB,MAAM,eAAe,CAAC;AAEvB,qBAAa,eAAgB,SAAQ,YAAY;IAC/C,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAa;IACtC,QAAQ,CAAC,OAAO,yBAAyB;IAGzC,cAAc,CAAC,QAAQ,EAAE,GAAG,GAAG,iBAAiB;IAkChD;;;OAGG;IACH,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAgBjC;;OAEG;IACH,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAanC;;OAEG;IACH,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IA0ClC,KAAK,CAAC,QAAQ,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,cAAc;CA8E7D"}
@@ -3,8 +3,19 @@ import { AIProvider, ParsedResponse, ParseOptions, ContentExtraction } from '../
3
3
  export declare class CopilotProvider extends BaseProvider {
4
4
  readonly name: AIProvider;
5
5
  readonly baseUrl = "https://copilot.microsoft.com";
6
- readonly defaultStyles = "\n /* Copilot Sidebar & Header */\n div:has(> [data-testid=\"sidebar-container\"]),\n [data-testid=\"sidebar-container\"],\n [data-testid=\"sticky-header\"],\n .side-nav-menu-button {\n display: none !important;\n }\n\n /* General Layout Fixes */\n main {\n width: 100% !important;\n max-width: 100% !important;\n margin: 0 !important;\n }\n ";
7
6
  extractContent(response: any): ContentExtraction;
7
+ /**
8
+ * Remove Copilot header/navbar from HTML
9
+ */
10
+ removeHeader(html: string): string;
11
+ /**
12
+ * Remove Copilot footer/followup input box from HTML
13
+ */
14
+ removeFooter(html: string): string;
15
+ /**
16
+ * Remove Copilot sidebar from HTML
17
+ */
18
+ removeSidebar(html: string): string;
8
19
  parse(response: any, options?: ParseOptions): ParsedResponse;
9
20
  }
10
21
  //# sourceMappingURL=copilot.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"copilot.d.ts","sourceRoot":"","sources":["../../src/providers/copilot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAE5F,qBAAa,eAAgB,SAAQ,YAAY;IAC/C,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAa;IACtC,QAAQ,CAAC,OAAO,mCAAmC;IAEnD,QAAQ,CAAC,aAAa,4YAepB;IAEF,cAAc,CAAC,QAAQ,EAAE,GAAG,GAAG,iBAAiB;IAkChD,KAAK,CAAC,QAAQ,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,cAAc;CAgC7D"}
1
+ {"version":3,"file":"copilot.d.ts","sourceRoot":"","sources":["../../src/providers/copilot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAE5F,qBAAa,eAAgB,SAAQ,YAAY;IAC/C,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAa;IACtC,QAAQ,CAAC,OAAO,mCAAmC;IAGnD,cAAc,CAAC,QAAQ,EAAE,GAAG,GAAG,iBAAiB;IAkChD;;OAEG;IACH,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IASlC;;OAEG;IACH,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAiBlC;;OAEG;IACH,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAWnC,KAAK,CAAC,QAAQ,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,cAAc;CAsD7D"}
@@ -3,8 +3,19 @@ import { AIProvider, ParsedResponse, ParseOptions, ContentExtraction } from '../
3
3
  export declare class GeminiProvider extends BaseProvider {
4
4
  readonly name: AIProvider;
5
5
  readonly baseUrl = "https://gemini.google.com";
6
- readonly defaultStyles = "\n /* Gemini Dark Mode Variable Overrides */\n :root {\n --gem-sys-color--surface: #131314 !important;\n --gem-sys-color--surface-container: #1e1f20 !important;\n --gem-sys-color--on-surface: #e3e3e3 !important;\n --bard-color-synthetic--chat-window-surface: #131314 !important;\n --bard-color-surface-dim-tmp: #131314 !important;\n }\n\n /* UI hiding - Gemini */\n bard-sidenav, mat-sidenav, .mat-drawer-backdrop, .side-nav-menu-button,\n\n /* Gemini \"About Gemini\" footer/navigation block */\n .gb_5a, .gb_5c, .gb_5d, .gb_5e,\n .gb_Uc, .gb_Vc, .gb_Wc,\n a[href*=\"about\"],\n a[href*=\"subscriptions\"],\n a[href*=\"business\"],\n div[class*=\"gb_5\"],\n .gb_Pd, .gb_Qd, .gb_Rd,\n .gb_Sd, .gb_Td, .gb_Ud, .gb_Vd,\n [aria-label*=\"About\"],\n [aria-label*=\"Gemini App\"],\n [aria-label*=\"Subscriptions\"],\n [aria-label*=\"For Business\"],\n *:contains(\"About Gemini\"),\n *:contains(\"Gemini App\"),\n *:contains(\"Subscriptions\"),\n *:contains(\"For Business\") {\n display: none !important;\n }\n\n /* General Layout */\n main { width: 100% !important; max-width: 100% !important; margin: 0 !important; }\n\n /* Force Dark Mode on Body and Gemini Containers */\n body, .content-container, chat-app, .main-content, .chat-container {\n background-color: #131314 !important;\n color: #e3e3e3 !important;\n }\n ";
7
6
  extractContent(response: any): ContentExtraction;
7
+ /**
8
+ * Remove Gemini header/navbar from HTML
9
+ */
10
+ removeHeader(html: string): string;
11
+ /**
12
+ * Remove Gemini footer/follow-up input box from HTML
13
+ */
14
+ removeFooter(html: string): string;
15
+ /**
16
+ * Remove Gemini sidebar from HTML
17
+ */
18
+ removeSidebar(html: string): string;
8
19
  parse(response: any, options?: ParseOptions): ParsedResponse;
9
20
  }
10
21
  //# sourceMappingURL=gemini.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"gemini.d.ts","sourceRoot":"","sources":["../../src/providers/gemini.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAE5F,qBAAa,cAAe,SAAQ,YAAY;IAC9C,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAY;IACrC,QAAQ,CAAC,OAAO,+BAA+B;IAE/C,QAAQ,CAAC,aAAa,w6CAyCpB;IAEF,cAAc,CAAC,QAAQ,EAAE,GAAG,GAAG,iBAAiB;IAyChD,KAAK,CAAC,QAAQ,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,cAAc;CAkC7D"}
1
+ {"version":3,"file":"gemini.d.ts","sourceRoot":"","sources":["../../src/providers/gemini.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAE5F,qBAAa,cAAe,SAAQ,YAAY;IAC9C,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAY;IACrC,QAAQ,CAAC,OAAO,+BAA+B;IAG/C,cAAc,CAAC,QAAQ,EAAE,GAAG,GAAG,iBAAiB;IAyChD;;OAEG;IACH,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAkBlC;;OAEG;IACH,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAKlC;;OAEG;IACH,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAKnC,KAAK,CAAC,QAAQ,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,cAAc;CAwD7D"}
@@ -1,10 +1,17 @@
1
- import { BaseProvider } from './base-provider';
2
- import { AIProvider, ParsedResponse, ParseOptions, ContentExtraction } from '../core/types';
1
+ import { BaseProvider } from "./base-provider";
2
+ import { AIProvider, ParsedResponse, ParseOptions, ContentExtraction } from "../core/types";
3
3
  export declare class PerplexityProvider extends BaseProvider {
4
4
  readonly name: AIProvider;
5
5
  readonly baseUrl = "https://www.perplexity.ai";
6
- readonly defaultStyles = "\n html {\n filter: invert(1) hue-rotate(180deg);\n background-color: white !important;\n }\n img, video, iframe, svg {\n filter: invert(1) hue-rotate(180deg);\n }\n ";
7
6
  extractContent(response: any): ContentExtraction;
7
+ /**
8
+ * Remove Perplexity header/navbar from HTML
9
+ */
10
+ removeHeader(html: string): string;
11
+ /**
12
+ * Remove Perplexity footer/followup input from HTML
13
+ */
14
+ removeFooter(html: string): string;
8
15
  parse(response: any, options?: ParseOptions): ParsedResponse;
9
16
  }
10
17
  //# sourceMappingURL=perplexity.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"perplexity.d.ts","sourceRoot":"","sources":["../../src/providers/perplexity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAE5F,qBAAa,kBAAmB,SAAQ,YAAY;IAClD,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAgB;IACzC,QAAQ,CAAC,OAAO,+BAA+B;IAE/C,QAAQ,CAAC,aAAa,wMAQpB;IAEF,cAAc,CAAC,QAAQ,EAAE,GAAG,GAAG,iBAAiB;IAkChD,KAAK,CAAC,QAAQ,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,cAAc;CA+B7D"}
1
+ {"version":3,"file":"perplexity.d.ts","sourceRoot":"","sources":["../../src/providers/perplexity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EACL,UAAU,EACV,cAAc,EACd,YAAY,EACZ,iBAAiB,EAClB,MAAM,eAAe,CAAC;AAEvB,qBAAa,kBAAmB,SAAQ,YAAY;IAClD,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAgB;IACzC,QAAQ,CAAC,OAAO,+BAA+B;IAE/C,cAAc,CAAC,QAAQ,EAAE,GAAG,GAAG,iBAAiB;IAkChD;;OAEG;IACH,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAMlC;;OAEG;IACH,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAMlC,KAAK,CAAC,QAAQ,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,cAAc;CAwD7D"}
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { UseAiResponseOptions } from '../hooks/useAiResponse';
3
3
  import { IframeRendererProps } from './IframeRenderer';
4
- export interface AiResponseRendererProps extends Omit<UseAiResponseOptions, 'onError'> {
4
+ export interface ResponseRendererProps extends Omit<UseAiResponseOptions, 'onError'> {
5
5
  response: any;
6
6
  className?: string;
7
7
  style?: React.CSSProperties;
@@ -18,7 +18,7 @@ export interface AiResponseRendererProps extends Omit<UseAiResponseOptions, 'onE
18
18
  }>;
19
19
  onRenderComplete?: (html: string) => void;
20
20
  }
21
- export declare const AiResponseRenderer: React.FC<AiResponseRendererProps>;
21
+ export declare const ResponseRenderer: React.FC<ResponseRendererProps>;
22
22
  export { IframeRenderer } from './IframeRenderer';
23
23
  export { useAiResponse } from '../hooks/useAiResponse';
24
24
  //# sourceMappingURL=AiResponseRenderer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AiResponseRenderer.d.ts","sourceRoot":"","sources":["../../../src/react/components/AiResponseRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAiB,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EAAkB,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEvE,MAAM,WAAW,uBAAwB,SAAQ,IAAI,CAAC,oBAAoB,EAAE,SAAS,CAAC;IACpF,QAAQ,EAAE,GAAG,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,WAAW,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAC3C,gBAAgB,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;QAAE,SAAS,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IAC/D,cAAc,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;QAAE,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;QAAC,KAAK,EAAE,MAAM,IAAI,CAAA;KAAE,CAAC,CAAC;IACjF,iBAAiB,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;QAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC,CAAC;IACrE,gBAAgB,CAAC,EAAE,CAA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AO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC"}
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ import { UseResponseOptions } from '../hooks/useResponse';
3
+ import { IframeRendererProps } from './IframeRenderer';
4
+ export interface ResponseRendererProps extends Omit<UseResponseOptions, 'onError'> {
5
+ response: any;
6
+ className?: string;
7
+ style?: React.CSSProperties;
8
+ iframeProps?: Partial<IframeRendererProps>;
9
+ loadingComponent?: React.ComponentType<{
10
+ isLoading: boolean;
11
+ }>;
12
+ errorComponent?: React.ComponentType<{
13
+ error: Error | null;
14
+ retry: () => void;
15
+ }>;
16
+ fallbackComponent?: React.ComponentType<{
17
+ provider: string | null;
18
+ }>;
19
+ onRenderComplete?: (html: string) => void;
20
+ }
21
+ export declare const ResponseRenderer: React.FC<ResponseRendererProps>;
22
+ export { IframeRenderer } from './IframeRenderer';
23
+ export { useResponse } from '../hooks/useResponse';
24
+ //# sourceMappingURL=ResponseRenderer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ResponseRenderer.d.ts","sourceRoot":"","sources":["../../../src/react/components/ResponseRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAe,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAkB,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEvE,MAAM,WAAW,qBAAsB,SAAQ,IAAI,CAAC,kBAAkB,EAAE,SAAS,CAAC;IAChF,QAAQ,EAAE,GAAG,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,WAAW,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAC3C,gBAAgB,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;QAAE,SAAS,EAAE,OAAO,CAAA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IAAI,CAAC;IACpB,OAAO,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IACtB,OAAO,EAAE,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,KAAK,IAAI,CAAC;CAC5D;AAED,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,GAAG,EACb,OAAO,GAAE,oBAAyB,GACjC,mBAAmB,CA8ErB"}
1
+ {"version":3,"file":"useAiResponse.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/useAiResponse.ts"],"names":[],"mappings":"AACA,OAAO,EAAmC,cAAc,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAExG,MAAM,WAAW,oBAAqB,SAAQ,YAAY;IACxD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,UAAU,CAAC;IACtB,kBAAkB,CAAC,EAAE,CAAC,QAAQ,EAAE,UAAU,GAAG,IAAI,KAAK,IAAI,CAAC;IAC3D,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAClC;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,cAAc,GAAG,IAAI,CAAC;IAC9B,QAAQ,EAAE,UAAU,GAAG,IAAI,CAAC;IAC5B,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,OAAO,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IACtB,OAAO,EAAE,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,KAAK,IAAI,CAAC;CAC5D;AAED,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,GAAG,EACb,OAAO,GAAE,oBAAyB,GACjC,mBAAmB,CAkFrB"}
@@ -0,0 +1,19 @@
1
+ import { ParsedResponse, ParseOptions, AIProvider } from '../../index';
2
+ export interface UseResponseOptions extends ParseOptions {
3
+ autoDetect?: boolean;
4
+ provider?: AIProvider;
5
+ onProviderDetected?: (provider: AIProvider | null) => void;
6
+ onError?: (error: Error) => void;
7
+ }
8
+ export interface UseResponseReturn {
9
+ parsed: ParsedResponse | null;
10
+ provider: AIProvider | null;
11
+ isLoading: boolean;
12
+ error: Error | null;
13
+ html: string | null;
14
+ text: string | null;
15
+ sources: any[] | null;
16
+ reparse: (options?: Partial<UseResponseOptions>) => void;
17
+ }
18
+ export declare function useResponse(response: any, options?: UseResponseOptions): UseResponseReturn;
19
+ //# sourceMappingURL=useResponse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useResponse.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/useResponse.ts"],"names":[],"mappings":"AACA,OAAO,EAAmC,cAAc,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAExG,MAAM,WAAW,kBAAmB,SAAQ,YAAY;IACtD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,UAAU,CAAC;IACtB,kBAAkB,CAAC,EAAE,CAAC,QAAQ,EAAE,UAAU,GAAG,IAAI,KAAK,IAAI,CAAC;IAC3D,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAClC;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,cAAc,GAAG,IAAI,CAAC;IAC9B,QAAQ,EAAE,UAAU,GAAG,IAAI,CAAC;IAC5B,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,OAAO,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IACtB,OAAO,EAAE,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,KAAK,IAAI,CAAC;CAC1D;AAED,wBAAgB,WAAW,CACzB,QAAQ,EAAE,GAAG,EACb,OAAO,GAAE,kBAAuB,GAC/B,iBAAiB,CAgFnB"}
@@ -1,7 +1,7 @@
1
- export { AiResponseRenderer, IframeRenderer } from './components/AiResponseRenderer';
2
- export type { AiResponseRendererProps } from './components/AiResponseRenderer';
3
- export type { IframeRendererProps } from './components/IframeRenderer';
4
- export { useAiResponse } from './hooks/useAiResponse';
5
- export type { UseAiResponseOptions, UseAiResponseReturn } from './hooks/useAiResponse';
6
- export type { AIProvider, ParsedResponse, ParseOptions, ProviderConfig, DetectedProvider, StyleOptions, ContentExtraction, } from '../core/types';
1
+ export { ResponseRenderer, IframeRenderer, } from "./components/ResponseRenderer";
2
+ export type { ResponseRendererProps } from "./components/ResponseRenderer";
3
+ export type { IframeRendererProps } from "./components/IframeRenderer";
4
+ export { useResponse } from "./hooks/useResponse";
5
+ export type { UseResponseOptions, UseResponseReturn, } from "./hooks/useResponse";
6
+ export type { AIProvider, ParsedResponse, ParseOptions, ProviderConfig, DetectedProvider, StyleOptions, ContentExtraction, } from "../core/types";
7
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACrF,YAAY,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC/E,YAAY,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAGvE,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,YAAY,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAGvF,YAAY,EACV,UAAU,EACV,cAAc,EACd,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,YAAY,EACZ,iBAAiB,GAClB,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,gBAAgB,EAChB,cAAc,GACf,MAAM,+BAA+B,CAAC;AACvC,YAAY,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAC3E,YAAY,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAGvE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,YAAY,EACV,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,qBAAqB,CAAC;AAG7B,YAAY,EACV,UAAU,EACV,cAAc,EACd,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,YAAY,EACZ,iBAAiB,GAClB,MAAM,eAAe,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloro-dev/response-parser",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "type": "module",
5
5
  "description": "Parse and render AI model responses from ChatGPT, Gemini, Perplexity, and more",
6
6
  "main": "dist/index.js",