@tambo-ai/react 0.72.0 → 0.73.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.
Files changed (151) hide show
  1. package/dist/mcp/mcp-hooks.d.ts +4 -0
  2. package/dist/mcp/mcp-hooks.d.ts.map +1 -1
  3. package/dist/mcp/mcp-hooks.js +4 -0
  4. package/dist/mcp/mcp-hooks.js.map +1 -1
  5. package/dist/providers/tambo-provider.d.ts +3 -0
  6. package/dist/providers/tambo-provider.d.ts.map +1 -1
  7. package/dist/providers/tambo-provider.js +3 -0
  8. package/dist/providers/tambo-provider.js.map +1 -1
  9. package/dist/util/resource-content-resolver.d.ts.map +1 -1
  10. package/dist/util/resource-content-resolver.js +2 -0
  11. package/dist/util/resource-content-resolver.js.map +1 -1
  12. package/dist/v1/hooks/use-tambo-v1-messages.test.js +22 -9
  13. package/dist/v1/hooks/use-tambo-v1-messages.test.js.map +1 -1
  14. package/dist/v1/hooks/use-tambo-v1-send-message.d.ts +1 -0
  15. package/dist/v1/hooks/use-tambo-v1-send-message.d.ts.map +1 -1
  16. package/dist/v1/hooks/use-tambo-v1-send-message.js +9 -2
  17. package/dist/v1/hooks/use-tambo-v1-send-message.js.map +1 -1
  18. package/dist/v1/hooks/use-tambo-v1-send-message.test.js +22 -9
  19. package/dist/v1/hooks/use-tambo-v1-send-message.test.js.map +1 -1
  20. package/dist/v1/hooks/use-tambo-v1-suggestions.d.ts +91 -0
  21. package/dist/v1/hooks/use-tambo-v1-suggestions.d.ts.map +1 -0
  22. package/dist/v1/hooks/use-tambo-v1-suggestions.js +152 -0
  23. package/dist/v1/hooks/use-tambo-v1-suggestions.js.map +1 -0
  24. package/dist/v1/hooks/use-tambo-v1-suggestions.test.d.ts +2 -0
  25. package/dist/v1/hooks/use-tambo-v1-suggestions.test.d.ts.map +1 -0
  26. package/dist/v1/hooks/use-tambo-v1-suggestions.test.js +511 -0
  27. package/dist/v1/hooks/use-tambo-v1-suggestions.test.js.map +1 -0
  28. package/dist/v1/hooks/use-tambo-v1-thread-input.d.ts +6 -57
  29. package/dist/v1/hooks/use-tambo-v1-thread-input.d.ts.map +1 -1
  30. package/dist/v1/hooks/use-tambo-v1-thread-input.js +7 -67
  31. package/dist/v1/hooks/use-tambo-v1-thread-input.js.map +1 -1
  32. package/dist/v1/hooks/use-tambo-v1-thread-input.test.js +201 -72
  33. package/dist/v1/hooks/use-tambo-v1-thread-input.test.js.map +1 -1
  34. package/dist/v1/hooks/use-tambo-v1-thread-list.d.ts +6 -4
  35. package/dist/v1/hooks/use-tambo-v1-thread-list.d.ts.map +1 -1
  36. package/dist/v1/hooks/use-tambo-v1-thread-list.js +2 -2
  37. package/dist/v1/hooks/use-tambo-v1-thread-list.js.map +1 -1
  38. package/dist/v1/hooks/use-tambo-v1-thread-list.test.js +2 -2
  39. package/dist/v1/hooks/use-tambo-v1-thread-list.test.js.map +1 -1
  40. package/dist/v1/hooks/use-tambo-v1.test.js +16 -7
  41. package/dist/v1/hooks/use-tambo-v1.test.js.map +1 -1
  42. package/dist/v1/index.d.ts +22 -13
  43. package/dist/v1/index.d.ts.map +1 -1
  44. package/dist/v1/index.js +31 -39
  45. package/dist/v1/index.js.map +1 -1
  46. package/dist/v1/providers/tambo-v1-provider.d.ts +27 -9
  47. package/dist/v1/providers/tambo-v1-provider.d.ts.map +1 -1
  48. package/dist/v1/providers/tambo-v1-provider.js +22 -11
  49. package/dist/v1/providers/tambo-v1-provider.js.map +1 -1
  50. package/dist/v1/providers/tambo-v1-provider.test.js +27 -10
  51. package/dist/v1/providers/tambo-v1-provider.test.js.map +1 -1
  52. package/dist/v1/providers/tambo-v1-stream-context.d.ts +19 -10
  53. package/dist/v1/providers/tambo-v1-stream-context.d.ts.map +1 -1
  54. package/dist/v1/providers/tambo-v1-stream-context.js +43 -53
  55. package/dist/v1/providers/tambo-v1-stream-context.js.map +1 -1
  56. package/dist/v1/providers/tambo-v1-stream-context.test.js +94 -19
  57. package/dist/v1/providers/tambo-v1-stream-context.test.js.map +1 -1
  58. package/dist/v1/providers/tambo-v1-stub-provider.d.ts +74 -0
  59. package/dist/v1/providers/tambo-v1-stub-provider.d.ts.map +1 -0
  60. package/dist/v1/providers/tambo-v1-stub-provider.js +212 -0
  61. package/dist/v1/providers/tambo-v1-stub-provider.js.map +1 -0
  62. package/dist/v1/providers/tambo-v1-stub-provider.test.d.ts +2 -0
  63. package/dist/v1/providers/tambo-v1-stub-provider.test.d.ts.map +1 -0
  64. package/dist/v1/providers/tambo-v1-stub-provider.test.js +162 -0
  65. package/dist/v1/providers/tambo-v1-stub-provider.test.js.map +1 -0
  66. package/dist/v1/providers/tambo-v1-thread-input-provider.d.ts +105 -0
  67. package/dist/v1/providers/tambo-v1-thread-input-provider.d.ts.map +1 -0
  68. package/dist/v1/providers/tambo-v1-thread-input-provider.js +191 -0
  69. package/dist/v1/providers/tambo-v1-thread-input-provider.js.map +1 -0
  70. package/dist/v1/utils/component-renderer.d.ts +15 -67
  71. package/dist/v1/utils/component-renderer.d.ts.map +1 -1
  72. package/dist/v1/utils/component-renderer.js +3 -149
  73. package/dist/v1/utils/component-renderer.js.map +1 -1
  74. package/dist/v1/utils/component-renderer.test.js +15 -350
  75. package/dist/v1/utils/component-renderer.test.js.map +1 -1
  76. package/esm/mcp/mcp-hooks.d.ts +4 -0
  77. package/esm/mcp/mcp-hooks.d.ts.map +1 -1
  78. package/esm/mcp/mcp-hooks.js +4 -0
  79. package/esm/mcp/mcp-hooks.js.map +1 -1
  80. package/esm/providers/tambo-provider.d.ts +3 -0
  81. package/esm/providers/tambo-provider.d.ts.map +1 -1
  82. package/esm/providers/tambo-provider.js +3 -0
  83. package/esm/providers/tambo-provider.js.map +1 -1
  84. package/esm/util/resource-content-resolver.d.ts.map +1 -1
  85. package/esm/util/resource-content-resolver.js +2 -0
  86. package/esm/util/resource-content-resolver.js.map +1 -1
  87. package/esm/v1/hooks/use-tambo-v1-messages.test.js +22 -9
  88. package/esm/v1/hooks/use-tambo-v1-messages.test.js.map +1 -1
  89. package/esm/v1/hooks/use-tambo-v1-send-message.d.ts +1 -0
  90. package/esm/v1/hooks/use-tambo-v1-send-message.d.ts.map +1 -1
  91. package/esm/v1/hooks/use-tambo-v1-send-message.js +9 -2
  92. package/esm/v1/hooks/use-tambo-v1-send-message.js.map +1 -1
  93. package/esm/v1/hooks/use-tambo-v1-send-message.test.js +22 -9
  94. package/esm/v1/hooks/use-tambo-v1-send-message.test.js.map +1 -1
  95. package/esm/v1/hooks/use-tambo-v1-suggestions.d.ts +91 -0
  96. package/esm/v1/hooks/use-tambo-v1-suggestions.d.ts.map +1 -0
  97. package/esm/v1/hooks/use-tambo-v1-suggestions.js +149 -0
  98. package/esm/v1/hooks/use-tambo-v1-suggestions.js.map +1 -0
  99. package/esm/v1/hooks/use-tambo-v1-suggestions.test.d.ts +2 -0
  100. package/esm/v1/hooks/use-tambo-v1-suggestions.test.d.ts.map +1 -0
  101. package/esm/v1/hooks/use-tambo-v1-suggestions.test.js +506 -0
  102. package/esm/v1/hooks/use-tambo-v1-suggestions.test.js.map +1 -0
  103. package/esm/v1/hooks/use-tambo-v1-thread-input.d.ts +6 -57
  104. package/esm/v1/hooks/use-tambo-v1-thread-input.d.ts.map +1 -1
  105. package/esm/v1/hooks/use-tambo-v1-thread-input.js +5 -66
  106. package/esm/v1/hooks/use-tambo-v1-thread-input.js.map +1 -1
  107. package/esm/v1/hooks/use-tambo-v1-thread-input.test.js +199 -73
  108. package/esm/v1/hooks/use-tambo-v1-thread-input.test.js.map +1 -1
  109. package/esm/v1/hooks/use-tambo-v1-thread-list.d.ts +6 -4
  110. package/esm/v1/hooks/use-tambo-v1-thread-list.d.ts.map +1 -1
  111. package/esm/v1/hooks/use-tambo-v1-thread-list.js +2 -2
  112. package/esm/v1/hooks/use-tambo-v1-thread-list.js.map +1 -1
  113. package/esm/v1/hooks/use-tambo-v1-thread-list.test.js +2 -2
  114. package/esm/v1/hooks/use-tambo-v1-thread-list.test.js.map +1 -1
  115. package/esm/v1/hooks/use-tambo-v1.test.js +16 -7
  116. package/esm/v1/hooks/use-tambo-v1.test.js.map +1 -1
  117. package/esm/v1/index.d.ts +22 -13
  118. package/esm/v1/index.d.ts.map +1 -1
  119. package/esm/v1/index.js +23 -18
  120. package/esm/v1/index.js.map +1 -1
  121. package/esm/v1/providers/tambo-v1-provider.d.ts +27 -9
  122. package/esm/v1/providers/tambo-v1-provider.d.ts.map +1 -1
  123. package/esm/v1/providers/tambo-v1-provider.js +20 -10
  124. package/esm/v1/providers/tambo-v1-provider.js.map +1 -1
  125. package/esm/v1/providers/tambo-v1-provider.test.js +28 -11
  126. package/esm/v1/providers/tambo-v1-provider.test.js.map +1 -1
  127. package/esm/v1/providers/tambo-v1-stream-context.d.ts +19 -10
  128. package/esm/v1/providers/tambo-v1-stream-context.d.ts.map +1 -1
  129. package/esm/v1/providers/tambo-v1-stream-context.js +44 -54
  130. package/esm/v1/providers/tambo-v1-stream-context.js.map +1 -1
  131. package/esm/v1/providers/tambo-v1-stream-context.test.js +95 -20
  132. package/esm/v1/providers/tambo-v1-stream-context.test.js.map +1 -1
  133. package/esm/v1/providers/tambo-v1-stub-provider.d.ts +74 -0
  134. package/esm/v1/providers/tambo-v1-stub-provider.d.ts.map +1 -0
  135. package/esm/v1/providers/tambo-v1-stub-provider.js +176 -0
  136. package/esm/v1/providers/tambo-v1-stub-provider.js.map +1 -0
  137. package/esm/v1/providers/tambo-v1-stub-provider.test.d.ts +2 -0
  138. package/esm/v1/providers/tambo-v1-stub-provider.test.d.ts.map +1 -0
  139. package/esm/v1/providers/tambo-v1-stub-provider.test.js +157 -0
  140. package/esm/v1/providers/tambo-v1-stub-provider.test.js.map +1 -0
  141. package/esm/v1/providers/tambo-v1-thread-input-provider.d.ts +105 -0
  142. package/esm/v1/providers/tambo-v1-thread-input-provider.d.ts.map +1 -0
  143. package/esm/v1/providers/tambo-v1-thread-input-provider.js +153 -0
  144. package/esm/v1/providers/tambo-v1-thread-input-provider.js.map +1 -0
  145. package/esm/v1/utils/component-renderer.d.ts +15 -67
  146. package/esm/v1/utils/component-renderer.d.ts.map +1 -1
  147. package/esm/v1/utils/component-renderer.js +4 -146
  148. package/esm/v1/utils/component-renderer.js.map +1 -1
  149. package/esm/v1/utils/component-renderer.test.js +16 -351
  150. package/esm/v1/utils/component-renderer.test.js.map +1 -1
  151. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"component-renderer.test.js","sourceRoot":"","sources":["../../../src/v1/utils/component-renderer.test.tsx"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,6DAA6D;AAC7D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAGxD,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,oBAAoB,EACpB,uBAAuB,EACvB,qBAAqB,EACrB,6BAA6B,GAC9B,MAAM,sBAAsB,CAAC;AAE9B,yCAAyC;AACzC,SAAS,aAAa,CAAC,EAAE,KAAK,EAAE,KAAK,EAAoC;IACvE,OAAO,CACL,4CAAiB,gBAAgB;QAC/B,6CAAkB,OAAO,IAAE,KAAK,CAAQ;QACxC,6CAAkB,OAAO,IAAE,KAAK,CAAQ,CACpC,CACP,CAAC;AACJ,CAAC;AAED,yBAAyB;AACzB,SAAS,oBAAoB;IAC3B,OAAO,4CAAiB,SAAS,iBAAiB,CAAC;AACrD,CAAC;AAED,+CAA+C;AAC/C,SAAS,qBAAqB;IAC5B,MAAM,OAAO,GAAG,qBAAqB,EAAE,CAAC;IACxC,OAAO,CACL,4CAAiB,eAAe;QAC9B,6CAAkB,aAAa,IAAE,OAAO,CAAC,WAAW,CAAQ;QAC5D,6CAAkB,UAAU,IAAE,OAAO,CAAC,QAAQ,CAAQ;QACtD,6CAAkB,WAAW,IAAE,OAAO,CAAC,SAAS,CAAQ,CACpD,CACP,CAAC;AACJ,CAAC;AAED,MAAM,YAAY,GAAsB;IACtC,aAAa,EA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,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;IACvD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,sCAAsC,EAAE,GAAG,EAAE;IACpD,EAAE,CAAC,6CAA6C,EAAE,GAAG,EAAE;QACrD,SAAS,YAAY;YACnB,qBAAqB,EAAE,CAAC;YACxB,OAAO,qDAA4B,CAAC;QACtC,CAAC;QAED,qCAAqC;QACrC,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,kBAAkB,EAAE,CAAC;QAErE,MAAM,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,oBAAC,YAAY,OAAG,CAAC,CAAC,CAAC,OAAO,CAC5C,gEAAgE,CACjE,CAAC;QAEF,UAAU,CAAC,WAAW,EAAE,CAAC;IAC3B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["// React import needed for JSX transform (jsxImportSource is not set to react-jsx)\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport React from \"react\";\nimport { render, screen } from \"@testing-library/react\";\nimport type { ComponentRegistry } from \"../../model/component-metadata\";\nimport type { V1ComponentContent } from \"../types/message\";\nimport {\n isComponentContent,\n renderComponentContent,\n renderMessageContent,\n renderMessageComponents,\n useV1ComponentContent,\n useV1ComponentContentOptional,\n} from \"./component-renderer\";\n\n// Test component that displays its props\nfunction TestComponent({ title, count }: { title: string; count: number }) {\n return (\n <div data-testid=\"test-component\">\n <span data-testid=\"title\">{title}</span>\n <span data-testid=\"count\">{count}</span>\n </div>\n );\n}\n\n// Test loading component\nfunction TestLoadingComponent() {\n return <div data-testid=\"loading\">Loading...</div>;\n}\n\n// Test component that uses the content context\nfunction ContextAwareComponent() {\n const context = useV1ComponentContent();\n return (\n <div data-testid=\"context-aware\">\n <span data-testid=\"componentId\">{context.componentId}</span>\n <span data-testid=\"threadId\">{context.threadId}</span>\n <span data-testid=\"messageId\">{context.messageId}</span>\n </div>\n );\n}\n\nconst mockRegistry: ComponentRegistry = {\n TestComponent: {\n component: TestComponent,\n name: \"TestComponent\",\n description: \"A test component\",\n props: {},\n contextTools: [],\n },\n TestWithLoading: {\n component: TestComponent,\n loadingComponent: TestLoadingComponent,\n name: \"TestWithLoading\",\n description: \"A test component with loading state\",\n props: {},\n contextTools: [],\n },\n ContextAware: {\n component: ContextAwareComponent,\n name: \"ContextAware\",\n description: \"A context-aware component\",\n props: {},\n contextTools: [],\n },\n};\n\ndescribe(\"isComponentContent\", () => {\n it(\"returns true for component content\", () => {\n const content: V1ComponentContent = {\n type: \"component\",\n id: \"comp_1\",\n name: \"Test\",\n props: {},\n streamingState: \"done\",\n };\n expect(isComponentContent(content)).toBe(true);\n });\n\n it(\"returns false for text content\", () => {\n const content = { type: \"text\", text: \"hello\" };\n expect(isComponentContent(content as any)).toBe(false);\n });\n});\n\ndescribe(\"renderComponentContent\", () => {\n it(\"renders a component from registry\", () => {\n const content: V1ComponentContent = {\n type: \"component\",\n id: \"comp_1\",\n name: \"TestComponent\",\n props: { title: \"Hello\", count: 42 },\n streamingState: \"done\",\n };\n\n const result = renderComponentContent(content, {\n threadId: \"thread_1\",\n messageId: \"msg_1\",\n componentList: mockRegistry,\n });\n\n expect(result.renderedComponent).not.toBeNull();\n\n // Render and check output\n render(<>{result.renderedComponent}</>);\n expect(screen.getByTestId(\"title\")).toHaveTextContent(\"Hello\");\n expect(screen.getByTestId(\"count\")).toHaveTextContent(\"42\");\n });\n\n it(\"returns null renderedComponent for unknown component\", () => {\n const content: V1ComponentContent = {\n type: \"component\",\n id: \"comp_1\",\n name: \"UnknownComponent\",\n props: {},\n streamingState: \"done\",\n };\n\n const consoleWarn = jest.spyOn(console, \"warn\").mockImplementation();\n\n const result = renderComponentContent(content, {\n threadId: \"thread_1\",\n messageId: \"msg_1\",\n componentList: mockRegistry,\n });\n\n expect(result.renderedComponent).toBeNull();\n expect(consoleWarn).toHaveBeenCalledWith(\n 'Component \"UnknownComponent\" not found in registry',\n );\n\n consoleWarn.mockRestore();\n });\n\n it(\"shows loading component when streaming\", () => {\n const content: V1ComponentContent = {\n type: \"component\",\n id: \"comp_1\",\n name: \"TestWithLoading\",\n props: { title: \"Loading Test\", count: 0 },\n streamingState: \"streaming\",\n };\n\n const result = renderComponentContent(content, {\n threadId: \"thread_1\",\n messageId: \"msg_1\",\n componentList: mockRegistry,\n });\n\n render(<>{result.renderedComponent}</>);\n expect(screen.getByTestId(\"loading\")).toHaveTextContent(\"Loading...\");\n });\n\n it(\"shows main component when done streaming\", () => {\n const content: V1ComponentContent = {\n type: \"component\",\n id: \"comp_1\",\n name: \"TestWithLoading\",\n props: { title: \"Done Test\", count: 99 },\n streamingState: \"done\",\n };\n\n const result = renderComponentContent(content, {\n threadId: \"thread_1\",\n messageId: \"msg_1\",\n componentList: mockRegistry,\n });\n\n render(<>{result.renderedComponent}</>);\n expect(screen.getByTestId(\"title\")).toHaveTextContent(\"Done Test\");\n expect(screen.getByTestId(\"count\")).toHaveTextContent(\"99\");\n });\n\n it(\"provides component context to rendered components\", () => {\n const content: V1ComponentContent = {\n type: \"component\",\n id: \"comp_123\",\n name: \"ContextAware\",\n props: {},\n streamingState: \"done\",\n };\n\n const result = renderComponentContent(content, {\n threadId: \"thread_456\",\n messageId: \"msg_789\",\n componentList: mockRegistry,\n });\n\n render(<>{result.renderedComponent}</>);\n expect(screen.getByTestId(\"componentId\")).toHaveTextContent(\"comp_123\");\n expect(screen.getByTestId(\"threadId\")).toHaveTextContent(\"thread_456\");\n expect(screen.getByTestId(\"messageId\")).toHaveTextContent(\"msg_789\");\n });\n});\n\ndescribe(\"renderMessageContent\", () => {\n it(\"renders component content blocks and passes through others\", () => {\n const content = [\n { type: \"text\", text: \"Hello\" },\n {\n type: \"component\",\n id: \"comp_1\",\n name: \"TestComponent\",\n props: { title: \"Test\", count: 1 },\n streamingState: \"done\",\n } as V1ComponentContent,\n { type: \"text\", text: \"World\" },\n ];\n\n const result = renderMessageContent(content as any, {\n threadId: \"thread_1\",\n messageId: \"msg_1\",\n componentList: mockRegistry,\n });\n\n expect(result).toHaveLength(3);\n expect(result[0]).toEqual({ type: \"text\", text: \"Hello\" });\n expect((result[1] as any).renderedComponent).not.toBeNull();\n expect(result[2]).toEqual({ type: \"text\", text: \"World\" });\n });\n\n it(\"handles multiple component blocks in a message\", () => {\n const content = [\n {\n type: \"component\",\n id: \"comp_1\",\n name: \"TestComponent\",\n props: { title: \"First\", count: 1 },\n streamingState: \"done\",\n } as V1ComponentContent,\n {\n type: \"component\",\n id: \"comp_2\",\n name: \"TestComponent\",\n props: { title: \"Second\", count: 2 },\n streamingState: \"done\",\n } as V1ComponentContent,\n ];\n\n const result = renderMessageContent(content as any, {\n threadId: \"thread_1\",\n messageId: \"msg_1\",\n componentList: mockRegistry,\n });\n\n expect(result).toHaveLength(2);\n expect((result[0] as V1ComponentContent).renderedComponent).not.toBeNull();\n expect((result[1] as V1ComponentContent).renderedComponent).not.toBeNull();\n });\n\n it(\"handles tool_use content blocks unchanged\", () => {\n const content = [\n {\n type: \"tool_use\",\n id: \"tool_1\",\n name: \"search\",\n input: { query: \"test\" },\n },\n ];\n\n const result = renderMessageContent(content as any, {\n threadId: \"thread_1\",\n messageId: \"msg_1\",\n componentList: mockRegistry,\n });\n\n expect(result).toHaveLength(1);\n expect(result[0]).toEqual(content[0]);\n });\n});\n\ndescribe(\"renderComponentContent edge cases\", () => {\n it(\"shows main component when streamingState is 'started' (no loading component)\", () => {\n const content: V1ComponentContent = {\n type: \"component\",\n id: \"comp_1\",\n name: \"TestComponent\",\n props: { title: \"Started\", count: 0 },\n streamingState: \"started\",\n };\n\n const result = renderComponentContent(content, {\n threadId: \"thread_1\",\n messageId: \"msg_1\",\n componentList: mockRegistry,\n });\n\n // TestComponent has no loading component, so it shows main even when streaming\n render(<>{result.renderedComponent}</>);\n expect(screen.getByTestId(\"title\")).toHaveTextContent(\"Started\");\n });\n\n it(\"shows loading component when streamingState is 'started' and loading exists\", () => {\n const content: V1ComponentContent = {\n type: \"component\",\n id: \"comp_1\",\n name: \"TestWithLoading\",\n props: { title: \"Started\", count: 0 },\n streamingState: \"started\",\n };\n\n const result = renderComponentContent(content, {\n threadId: \"thread_1\",\n messageId: \"msg_1\",\n componentList: mockRegistry,\n });\n\n render(<>{result.renderedComponent}</>);\n expect(screen.getByTestId(\"loading\")).toHaveTextContent(\"Loading...\");\n });\n\n it(\"passes state as initialState prop\", () => {\n // Component that reads initialState\n function StatefulComponent({\n initialState,\n }: {\n initialState?: { count: number };\n }) {\n return (\n <div data-testid=\"initial-count\">{initialState?.count ?? \"none\"}</div>\n );\n }\n\n const registryWithStateful: ComponentRegistry = {\n StatefulComponent: {\n component: StatefulComponent,\n name: \"StatefulComponent\",\n description: \"A stateful component\",\n props: {},\n contextTools: [],\n },\n };\n\n const content: V1ComponentContent = {\n type: \"component\",\n id: \"comp_1\",\n name: \"StatefulComponent\",\n props: {},\n state: { count: 42 },\n streamingState: \"done\",\n };\n\n const result = renderComponentContent(content, {\n threadId: \"thread_1\",\n messageId: \"msg_1\",\n componentList: registryWithStateful,\n });\n\n render(<>{result.renderedComponent}</>);\n expect(screen.getByTestId(\"initial-count\")).toHaveTextContent(\"42\");\n });\n\n it(\"preserves original content properties in returned object\", () => {\n const content: V1ComponentContent = {\n type: \"component\",\n id: \"comp_custom\",\n name: \"TestComponent\",\n props: { title: \"Test\", count: 5 },\n state: { value: \"preserved\" },\n streamingState: \"done\",\n };\n\n const result = renderComponentContent(content, {\n threadId: \"thread_1\",\n messageId: \"msg_1\",\n componentList: mockRegistry,\n });\n\n expect(result.id).toBe(\"comp_custom\");\n expect(result.name).toBe(\"TestComponent\");\n expect(result.props).toEqual({ title: \"Test\", count: 5 });\n expect(result.state).toEqual({ value: \"preserved\" });\n expect(result.streamingState).toBe(\"done\");\n });\n});\n\ndescribe(\"useV1ComponentContentOptional\", () => {\n it(\"returns null when used outside rendered component\", () => {\n function TestConsumer() {\n const context = useV1ComponentContentOptional();\n return (\n <div data-testid=\"context\">\n {context ? \"has context\" : \"no context\"}\n </div>\n );\n }\n\n render(<TestConsumer />);\n expect(screen.getByTestId(\"context\")).toHaveTextContent(\"no context\");\n });\n});\n\ndescribe(\"renderMessageComponents\", () => {\n it(\"renders all components in a message\", () => {\n const message = {\n id: \"msg_1\",\n role: \"assistant\" as const,\n content: [\n { type: \"text\" as const, text: \"Here is the weather:\" },\n {\n type: \"component\",\n id: \"comp_1\",\n name: \"TestComponent\",\n props: { title: \"Weather\", count: 72 },\n streamingState: \"done\",\n } as V1ComponentContent,\n ],\n createdAt: \"2024-01-01T00:00:00.000Z\",\n };\n\n const result = renderMessageComponents(message, {\n threadId: \"thread_1\",\n componentList: mockRegistry,\n });\n\n expect(result.id).toBe(\"msg_1\");\n expect(result.content).toHaveLength(2);\n expect(result.content[0]).toEqual({\n type: \"text\",\n text: \"Here is the weather:\",\n });\n expect(\n (result.content[1] as V1ComponentContent).renderedComponent,\n ).not.toBeNull();\n });\n\n it(\"preserves message metadata\", () => {\n const message = {\n id: \"msg_123\",\n role: \"assistant\" as const,\n content: [],\n createdAt: \"2024-01-01T00:00:00.000Z\",\n metadata: { custom: \"value\" },\n };\n\n const result = renderMessageComponents(message, {\n threadId: \"thread_1\",\n componentList: mockRegistry,\n });\n\n expect(result.id).toBe(\"msg_123\");\n expect(result.role).toBe(\"assistant\");\n expect(result.createdAt).toBe(\"2024-01-01T00:00:00.000Z\");\n expect(result.metadata).toEqual({ custom: \"value\" });\n });\n});\n\ndescribe(\"useV1ComponentContent error handling\", () => {\n it(\"throws when used outside rendered component\", () => {\n function TestConsumer() {\n useV1ComponentContent();\n return <div>Should not render</div>;\n }\n\n // Suppress React error boundary logs\n const consoleSpy = jest.spyOn(console, \"error\").mockImplementation();\n\n expect(() => render(<TestConsumer />)).toThrow(\n \"useV1ComponentContent must be used within a rendered component\",\n );\n\n consoleSpy.mockRestore();\n });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M,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC,CAAC,iBAAiB,CAC3D,eAAe,CAChB,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,uBAAuB,EAAE,GAAG,EAAE;IACrC,EAAE,CAAC,mCAAmC,EAAE,GAAG,EAAE;QAC3C,SAAS,YAAY;YACnB,qBAAqB,EAAE,CAAC;YACxB,OAAO,qDAA4B,CAAC;QACtC,CAAC;QAED,qCAAqC;QACrC,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,kBAAkB,EAAE,CAAC;QAErE,MAAM,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,oBAAC,YAAY,OAAG,CAAC,CAAC,CAAC,OAAO,CAC5C,gEAAgE,CACjE,CAAC;QAEF,UAAU,CAAC,WAAW,EAAE,CAAC;IAC3B,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,2CAA2C,EAAE,GAAG,EAAE;QACnD,MAAM,CACJ,oBAAC,0BAA0B,IACzB,WAAW,EAAC,WAAW,EACvB,QAAQ,EAAC,aAAa,EACtB,SAAS,EAAC,UAAU,EACpB,aAAa,EAAC,UAAU;YAExB,oBAAC,qBAAqB,OAAG,CACE,CAC9B,CAAC;QAEF,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC;IAC3E,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import React from \"react\";\nimport { render, screen } from \"@testing-library/react\";\nimport {\n useV1ComponentContent,\n V1ComponentContentProvider,\n} from \"./component-renderer\";\n\n// Test component that uses the content context\nconst ContextAwareComponent: React.FC = () => {\n const context = useV1ComponentContent();\n return (\n <div data-testid=\"context-aware\">\n <span data-testid=\"componentId\">{context.componentId}</span>\n <span data-testid=\"threadId\">{context.threadId}</span>\n <span data-testid=\"messageId\">{context.messageId}</span>\n <span data-testid=\"componentName\">{context.componentName}</span>\n </div>\n );\n};\n\ndescribe(\"V1ComponentContentProvider\", () => {\n it(\"provides context to child components\", () => {\n render(\n <V1ComponentContentProvider\n componentId=\"comp_123\"\n threadId=\"thread_456\"\n messageId=\"msg_789\"\n componentName=\"TestComponent\"\n >\n <ContextAwareComponent />\n </V1ComponentContentProvider>,\n );\n\n expect(screen.getByTestId(\"componentId\")).toHaveTextContent(\"comp_123\");\n expect(screen.getByTestId(\"threadId\")).toHaveTextContent(\"thread_456\");\n expect(screen.getByTestId(\"messageId\")).toHaveTextContent(\"msg_789\");\n expect(screen.getByTestId(\"componentName\")).toHaveTextContent(\n \"TestComponent\",\n );\n });\n});\n\ndescribe(\"useV1ComponentContent\", () => {\n it(\"throws when used outside provider\", () => {\n function TestConsumer() {\n useV1ComponentContent();\n return <div>Should not render</div>;\n }\n\n // Suppress React error boundary logs\n const consoleSpy = jest.spyOn(console, \"error\").mockImplementation();\n\n expect(() => render(<TestConsumer />)).toThrow(\n \"useV1ComponentContent must be used within a rendered component\",\n );\n\n consoleSpy.mockRestore();\n });\n\n it(\"returns context when used within provider\", () => {\n render(\n <V1ComponentContentProvider\n componentId=\"comp_test\"\n threadId=\"thread_test\"\n messageId=\"msg_test\"\n componentName=\"TestComp\"\n >\n <ContextAwareComponent />\n </V1ComponentContentProvider>,\n );\n\n expect(screen.getByTestId(\"componentId\")).toHaveTextContent(\"comp_test\");\n });\n});\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tambo-ai/react",
3
- "version": "0.72.0",
3
+ "version": "0.73.1",
4
4
  "description": "React client package for Tambo AI",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -85,7 +85,7 @@
85
85
  "@modelcontextprotocol/sdk": "^1.25.1",
86
86
  "@standard-community/standard-json": "^0.3.5",
87
87
  "@standard-schema/spec": "^1.1.0",
88
- "@tambo-ai/typescript-sdk": "^0.86.0",
88
+ "@tambo-ai/typescript-sdk": "^0.87.0",
89
89
  "@tanstack/react-query": "^5.90.16",
90
90
  "fast-equals": "^5.3.3",
91
91
  "fast-json-patch": "^3.1.1",