@cossistant/react 0.0.26 → 0.0.28

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 (227) hide show
  1. package/api.d.ts +1 -1
  2. package/api.d.ts.map +1 -1
  3. package/checks.d.ts +1 -1
  4. package/checks.d.ts.map +1 -1
  5. package/clsx.d.ts +1 -1
  6. package/clsx.d.ts.map +1 -1
  7. package/coerce.d.ts +1 -1
  8. package/coerce.d.ts.map +1 -1
  9. package/conversation.d.ts +3 -0
  10. package/conversation.d.ts.map +1 -1
  11. package/core.d.ts +1 -1
  12. package/core.d.ts.map +1 -1
  13. package/errors.d.ts +1 -1
  14. package/errors.d.ts.map +1 -1
  15. package/errors2.d.ts +1 -1
  16. package/errors2.d.ts.map +1 -1
  17. package/hooks/index.d.ts +2 -1
  18. package/hooks/index.js +6 -5
  19. package/hooks/private/store/use-website-store.js +2 -1
  20. package/hooks/private/store/use-website-store.js.map +1 -1
  21. package/hooks/private/use-client-query.d.ts +6 -0
  22. package/hooks/private/use-client-query.d.ts.map +1 -1
  23. package/hooks/private/use-client-query.js +26 -3
  24. package/hooks/private/use-client-query.js.map +1 -1
  25. package/hooks/private/use-multimodal-input.d.ts.map +1 -1
  26. package/hooks/private/use-multimodal-input.js +7 -5
  27. package/hooks/private/use-multimodal-input.js.map +1 -1
  28. package/hooks/private/use-visitor-typing-reporter.d.ts +18 -1
  29. package/hooks/private/use-visitor-typing-reporter.d.ts.map +1 -1
  30. package/hooks/private/use-visitor-typing-reporter.js +34 -4
  31. package/hooks/private/use-visitor-typing-reporter.js.map +1 -1
  32. package/hooks/use-conversation-page.d.ts +1 -0
  33. package/hooks/use-conversation-page.d.ts.map +1 -1
  34. package/hooks/use-conversation-page.js +6 -1
  35. package/hooks/use-conversation-page.js.map +1 -1
  36. package/hooks/use-conversation-preview.d.ts +2 -1
  37. package/hooks/use-conversation-preview.d.ts.map +1 -1
  38. package/hooks/use-conversation-preview.js +1 -1
  39. package/hooks/use-conversation-preview.js.map +1 -1
  40. package/hooks/use-conversation-timeline-items.js +2 -1
  41. package/hooks/use-conversation-timeline-items.js.map +1 -1
  42. package/hooks/use-conversation.js +2 -1
  43. package/hooks/use-conversation.js.map +1 -1
  44. package/hooks/use-conversations.js +1 -0
  45. package/hooks/use-conversations.js.map +1 -1
  46. package/hooks/use-create-conversation.d.ts.map +1 -1
  47. package/hooks/use-file-upload.d.ts +55 -0
  48. package/hooks/use-file-upload.d.ts.map +1 -0
  49. package/hooks/use-file-upload.js +100 -0
  50. package/hooks/use-file-upload.js.map +1 -0
  51. package/hooks/use-message-composer.d.ts +11 -0
  52. package/hooks/use-message-composer.d.ts.map +1 -1
  53. package/hooks/use-message-composer.js +7 -3
  54. package/hooks/use-message-composer.js.map +1 -1
  55. package/hooks/use-send-message.d.ts +1 -0
  56. package/hooks/use-send-message.d.ts.map +1 -1
  57. package/hooks/use-send-message.js +63 -11
  58. package/hooks/use-send-message.js.map +1 -1
  59. package/index.d.ts +6 -3
  60. package/index.js +13 -10
  61. package/openapi30.d.ts +1 -1
  62. package/openapi30.d.ts.map +1 -1
  63. package/openapi31.d.ts +1 -1
  64. package/openapi31.d.ts.map +1 -1
  65. package/package.json +4 -3
  66. package/parse.d.ts +1 -1
  67. package/parse.d.ts.map +1 -1
  68. package/primitives/avatar/image.d.ts +1 -1
  69. package/primitives/conversation-timeline.d.ts.map +1 -1
  70. package/primitives/conversation-timeline.js +10 -5
  71. package/primitives/conversation-timeline.js.map +1 -1
  72. package/primitives/index.d.ts +4 -3
  73. package/primitives/index.js +12 -5
  74. package/primitives/index.parts.d.ts +3 -2
  75. package/primitives/index.parts.js +4 -3
  76. package/primitives/multimodal-input.d.ts +2 -2
  77. package/primitives/multimodal-input.d.ts.map +1 -1
  78. package/primitives/timeline-item-attachments.d.ts +100 -0
  79. package/primitives/timeline-item-attachments.d.ts.map +1 -0
  80. package/primitives/timeline-item-attachments.js +151 -0
  81. package/primitives/timeline-item-attachments.js.map +1 -0
  82. package/primitives/trigger.d.ts +91 -0
  83. package/primitives/trigger.d.ts.map +1 -0
  84. package/primitives/trigger.js +74 -0
  85. package/primitives/trigger.js.map +1 -0
  86. package/primitives/window.d.ts +22 -1
  87. package/primitives/window.d.ts.map +1 -1
  88. package/primitives/window.js +91 -5
  89. package/primitives/window.js.map +1 -1
  90. package/provider.d.ts.map +1 -1
  91. package/provider.js +8 -3
  92. package/provider.js.map +1 -1
  93. package/realtime/index.js +1 -1
  94. package/realtime/provider.js +1 -1
  95. package/realtime/support-provider.js +1 -1
  96. package/realtime/support-provider.js.map +1 -1
  97. package/realtime-events.d.ts +40 -1
  98. package/realtime-events.d.ts.map +1 -1
  99. package/registries.d.ts +1 -1
  100. package/registries.d.ts.map +1 -1
  101. package/schemas.d.ts +1 -1
  102. package/schemas.d.ts.map +1 -1
  103. package/schemas2.d.ts +1 -1
  104. package/schemas2.d.ts.map +1 -1
  105. package/schemas3.d.ts +1 -0
  106. package/schemas3.d.ts.map +1 -1
  107. package/specification-extension.d.ts +1 -1
  108. package/specification-extension.d.ts.map +1 -1
  109. package/standard-schema.d.ts +1 -1
  110. package/standard-schema.d.ts.map +1 -1
  111. package/support/components/content.d.ts +30 -0
  112. package/support/components/content.d.ts.map +1 -0
  113. package/support/components/content.js +282 -0
  114. package/support/components/content.js.map +1 -0
  115. package/support/components/conversation-button-link.js +1 -1
  116. package/support/components/conversation-timeline.js +3 -3
  117. package/support/components/conversation-timeline.js.map +1 -1
  118. package/support/components/header.js +1 -1
  119. package/support/components/image-lightbox.d.ts +49 -0
  120. package/support/components/image-lightbox.d.ts.map +1 -0
  121. package/support/components/image-lightbox.js +142 -0
  122. package/support/components/image-lightbox.js.map +1 -0
  123. package/support/components/index.d.ts +5 -4
  124. package/support/components/index.js +4 -4
  125. package/support/components/multimodal-input.d.ts +4 -1
  126. package/support/components/multimodal-input.d.ts.map +1 -1
  127. package/support/components/multimodal-input.js +71 -45
  128. package/support/components/multimodal-input.js.map +1 -1
  129. package/support/components/navigation-tab.js +1 -1
  130. package/support/components/root.d.ts +23 -0
  131. package/support/components/root.d.ts.map +1 -0
  132. package/support/components/root.js +36 -0
  133. package/support/components/root.js.map +1 -0
  134. package/support/components/timeline-message-item.d.ts.map +1 -1
  135. package/support/components/timeline-message-item.js +82 -18
  136. package/support/components/timeline-message-item.js.map +1 -1
  137. package/support/components/trigger.d.ts +14 -0
  138. package/support/components/trigger.d.ts.map +1 -0
  139. package/support/components/{bubble.js → trigger.js} +16 -12
  140. package/support/components/trigger.js.map +1 -0
  141. package/support/components/typing-indicator.d.ts.map +1 -1
  142. package/support/components/typing-indicator.js +1 -0
  143. package/support/components/typing-indicator.js.map +1 -1
  144. package/support/context/controlled-state.d.ts +46 -0
  145. package/support/context/controlled-state.d.ts.map +1 -0
  146. package/support/context/controlled-state.js +34 -0
  147. package/support/context/controlled-state.js.map +1 -0
  148. package/support/context/events.d.ts +103 -0
  149. package/support/context/events.d.ts.map +1 -0
  150. package/support/context/events.js +139 -0
  151. package/support/context/events.js.map +1 -0
  152. package/support/context/handle.d.ts +90 -0
  153. package/support/context/handle.d.ts.map +1 -0
  154. package/support/context/handle.js +79 -0
  155. package/support/context/handle.js.map +1 -0
  156. package/support/context/positioning.d.ts +17 -0
  157. package/support/context/positioning.d.ts.map +1 -0
  158. package/support/context/positioning.js +26 -0
  159. package/support/context/positioning.js.map +1 -0
  160. package/support/context/slots.d.ts +85 -0
  161. package/support/context/slots.d.ts.map +1 -0
  162. package/support/context/slots.js +115 -0
  163. package/support/context/slots.js.map +1 -0
  164. package/support/context/websocket.d.ts +8 -1
  165. package/support/context/websocket.d.ts.map +1 -1
  166. package/support/context/websocket.js +8 -1
  167. package/support/context/websocket.js.map +1 -1
  168. package/support/index.d.ts +239 -54
  169. package/support/index.d.ts.map +1 -1
  170. package/support/index.js +254 -33
  171. package/support/index.js.map +1 -1
  172. package/support/pages/articles.d.ts.map +1 -1
  173. package/support/pages/articles.js +3 -4
  174. package/support/pages/articles.js.map +1 -1
  175. package/support/pages/conversation-history.js +2 -2
  176. package/support/pages/conversation.js +6 -5
  177. package/support/pages/conversation.js.map +1 -1
  178. package/support/pages/home.js +2 -2
  179. package/support/router.d.ts +52 -12
  180. package/support/router.d.ts.map +1 -1
  181. package/support/router.js +78 -30
  182. package/support/router.js.map +1 -1
  183. package/support/store/index.d.ts +2 -2
  184. package/support/store/support-store.d.ts +26 -20
  185. package/support/store/support-store.d.ts.map +1 -1
  186. package/support/store/support-store.js +47 -6
  187. package/support/store/support-store.js.map +1 -1
  188. package/support/{support-D2EgfIts.css → support-C7Xaw-N6.css} +1 -2
  189. package/support/support-C7Xaw-N6.css.map +1 -0
  190. package/support/text/index.js.map +1 -1
  191. package/support/types.d.ts +75 -12
  192. package/support/types.d.ts.map +1 -1
  193. package/support.css +2 -2
  194. package/tailwind.css +0 -1
  195. package/timeline-item.d.ts +68 -2
  196. package/timeline-item.d.ts.map +1 -1
  197. package/util.d.ts +1 -1
  198. package/util.d.ts.map +1 -1
  199. package/utils/index.d.ts +2 -1
  200. package/utils/index.js +2 -1
  201. package/utils/merge-refs.d.ts +30 -0
  202. package/utils/merge-refs.d.ts.map +1 -0
  203. package/utils/merge-refs.js +46 -0
  204. package/utils/merge-refs.js.map +1 -0
  205. package/utils/use-render-element.d.ts.map +1 -1
  206. package/utils/use-render-element.js +20 -7
  207. package/utils/use-render-element.js.map +1 -1
  208. package/versions.d.ts +1 -1
  209. package/versions.d.ts.map +1 -1
  210. package/zod-extensions.d.ts +1 -1
  211. package/zod-extensions.d.ts.map +1 -1
  212. package/primitives/bubble.d.ts +0 -38
  213. package/primitives/bubble.d.ts.map +0 -1
  214. package/primitives/bubble.js +0 -57
  215. package/primitives/bubble.js.map +0 -1
  216. package/support/components/bubble.d.ts +0 -10
  217. package/support/components/bubble.d.ts.map +0 -1
  218. package/support/components/bubble.js.map +0 -1
  219. package/support/components/container.d.ts +0 -13
  220. package/support/components/container.d.ts.map +0 -1
  221. package/support/components/container.js +0 -109
  222. package/support/components/container.js.map +0 -1
  223. package/support/components/support-content.d.ts +0 -22
  224. package/support/components/support-content.d.ts.map +0 -1
  225. package/support/components/support-content.js +0 -48
  226. package/support/components/support-content.js.map +0 -1
  227. package/support/support-D2EgfIts.css.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"use-send-message.js","names":["initialConversation:\n\t\t\t\t\t| CreateConversationResponseBody[\"conversation\"]\n\t\t\t\t\t| undefined","result: SendMessageResult"],"sources":["../../src/hooks/use-send-message.ts"],"sourcesContent":["import type { CossistantClient } from \"@cossistant/core\";\nimport { generateMessageId } from \"@cossistant/core\";\nimport type { CreateConversationResponseBody } from \"@cossistant/types/api/conversation\";\nimport type { TimelineItem } from \"@cossistant/types/api/timeline-item\";\nimport { useCallback, useState } from \"react\";\n\nimport { useSupport } from \"../provider\";\n\nexport type SendMessageOptions = {\n\tconversationId?: string | null;\n\tmessage: string;\n\tfiles?: File[];\n\tdefaultTimelineItems?: TimelineItem[];\n\tvisitorId?: string;\n\t/**\n\t * Optional message ID to use for the optimistic update and API request.\n\t * When not provided, a ULID will be generated on the client.\n\t */\n\tmessageId?: string;\n\tonSuccess?: (conversationId: string, messageId: string) => void;\n\tonError?: (error: Error) => void;\n};\n\nexport type SendMessageResult = {\n\tconversationId: string;\n\tmessageId: string;\n\tconversation?: CreateConversationResponseBody[\"conversation\"];\n\tinitialTimelineItems?: CreateConversationResponseBody[\"initialTimelineItems\"];\n};\n\nexport type UseSendMessageResult = {\n\tmutate: (options: SendMessageOptions) => void;\n\tmutateAsync: (\n\t\toptions: SendMessageOptions\n\t) => Promise<SendMessageResult | null>;\n\tisPending: boolean;\n\terror: Error | null;\n\treset: () => void;\n};\n\nexport type UseSendMessageOptions = {\n\tclient?: CossistantClient;\n};\n\nfunction toError(error: unknown): Error {\n\tif (error instanceof Error) {\n\t\treturn error;\n\t}\n\n\tif (typeof error === \"string\") {\n\t\treturn new Error(error);\n\t}\n\n\treturn new Error(\"Unknown error\");\n}\n\nfunction buildTimelineItemPayload(\n\tbody: string,\n\tconversationId: string,\n\tvisitorId: string | null,\n\tmessageId?: string\n): TimelineItem {\n\tconst nowIso = typeof window !== \"undefined\" ? new Date().toISOString() : \"\";\n\tconst id = messageId ?? generateMessageId();\n\n\treturn {\n\t\tid,\n\t\tconversationId,\n\t\torganizationId: \"\", // Will be set by backend\n\t\ttype: \"message\" as const,\n\t\ttext: body,\n\t\tparts: [{ type: \"text\" as const, text: body }],\n\t\tvisibility: \"public\" as const,\n\t\tuserId: null,\n\t\taiAgentId: null,\n\t\tvisitorId: visitorId ?? null,\n\t\tcreatedAt: nowIso,\n\t\tdeletedAt: null,\n\t} satisfies TimelineItem;\n}\n\n/**\n * Sends visitor messages while handling optimistic pending conversations and\n * exposing react-query-like mutation state.\n */\nexport function useSendMessage(\n\toptions: UseSendMessageOptions = {}\n): UseSendMessageResult {\n\tconst { client: contextClient } = useSupport();\n\tconst client = options.client ?? contextClient;\n\n\tconst [isPending, setIsPending] = useState(false);\n\tconst [error, setError] = useState<Error | null>(null);\n\n\tconst mutateAsync = useCallback(\n\t\tasync (payload: SendMessageOptions): Promise<SendMessageResult | null> => {\n\t\t\tconst {\n\t\t\t\tconversationId: providedConversationId,\n\t\t\t\tmessage,\n\t\t\t\tdefaultTimelineItems = [],\n\t\t\t\tvisitorId,\n\t\t\t\tmessageId: providedMessageId,\n\t\t\t\tonSuccess,\n\t\t\t\tonError,\n\t\t\t} = payload;\n\n\t\t\tif (!message.trim()) {\n\t\t\t\tconst emptyMessageError = new Error(\"Message cannot be empty\");\n\t\t\t\tsetError(emptyMessageError);\n\t\t\t\tonError?.(emptyMessageError);\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tsetIsPending(true);\n\t\t\tsetError(null);\n\n\t\t\ttry {\n\t\t\t\tlet conversationId = providedConversationId ?? undefined;\n\t\t\t\tlet preparedDefaultTimelineItems = defaultTimelineItems;\n\t\t\t\tlet initialConversation:\n\t\t\t\t\t| CreateConversationResponseBody[\"conversation\"]\n\t\t\t\t\t| undefined;\n\n\t\t\t\tif (!conversationId) {\n\t\t\t\t\tconst initiated = client.initiateConversation({\n\t\t\t\t\t\tdefaultTimelineItems,\n\t\t\t\t\t\tvisitorId: visitorId ?? undefined,\n\t\t\t\t\t});\n\t\t\t\t\tconversationId = initiated.conversationId;\n\t\t\t\t\tpreparedDefaultTimelineItems = initiated.defaultTimelineItems;\n\t\t\t\t\tinitialConversation = initiated.conversation;\n\t\t\t\t}\n\n\t\t\t\tconst timelineItemPayload = buildTimelineItemPayload(\n\t\t\t\t\tmessage,\n\t\t\t\t\tconversationId,\n\t\t\t\t\tvisitorId ?? null,\n\t\t\t\t\tprovidedMessageId\n\t\t\t\t);\n\n\t\t\t\tconst response = await client.sendMessage({\n\t\t\t\t\tconversationId,\n\t\t\t\t\titem: {\n\t\t\t\t\t\tid: timelineItemPayload.id,\n\t\t\t\t\t\ttext: timelineItemPayload.text ?? \"\",\n\t\t\t\t\t\ttype:\n\t\t\t\t\t\t\ttimelineItemPayload.type === \"identification\"\n\t\t\t\t\t\t\t\t? \"message\"\n\t\t\t\t\t\t\t\t: timelineItemPayload.type,\n\t\t\t\t\t\tvisibility: timelineItemPayload.visibility,\n\t\t\t\t\t\tuserId: timelineItemPayload.userId,\n\t\t\t\t\t\taiAgentId: timelineItemPayload.aiAgentId,\n\t\t\t\t\t\tvisitorId: timelineItemPayload.visitorId,\n\t\t\t\t\t\tcreatedAt: timelineItemPayload.createdAt,\n\t\t\t\t\t\tparts: timelineItemPayload.parts,\n\t\t\t\t\t},\n\t\t\t\t\tcreateIfPending: true,\n\t\t\t\t});\n\n\t\t\t\tconst messageId = response.item.id;\n\n\t\t\t\tif (!messageId) {\n\t\t\t\t\tthrow new Error(\"SendMessage response missing item.id\");\n\t\t\t\t}\n\n\t\t\t\tconst result: SendMessageResult = {\n\t\t\t\t\tconversationId,\n\t\t\t\t\tmessageId,\n\t\t\t\t};\n\n\t\t\t\tif (\"conversation\" in response && response.conversation) {\n\t\t\t\t\tresult.conversation = response.conversation;\n\t\t\t\t\tresult.initialTimelineItems = response.initialTimelineItems;\n\t\t\t\t} else if (initialConversation) {\n\t\t\t\t\tresult.conversation = initialConversation;\n\t\t\t\t\tresult.initialTimelineItems = preparedDefaultTimelineItems;\n\t\t\t\t}\n\n\t\t\t\tsetIsPending(false);\n\t\t\t\tsetError(null);\n\t\t\t\tonSuccess?.(result.conversationId, result.messageId);\n\t\t\t\treturn result;\n\t\t\t} catch (raw) {\n\t\t\t\tconst normalised = toError(raw);\n\t\t\t\tsetIsPending(false);\n\t\t\t\tsetError(normalised);\n\t\t\t\tonError?.(normalised);\n\t\t\t\tthrow normalised;\n\t\t\t}\n\t\t},\n\t\t[client]\n\t);\n\n\tconst mutate = useCallback(\n\t\t(opts: SendMessageOptions) => {\n\t\t\tvoid mutateAsync(opts).catch(() => {\n\t\t\t\t// Swallow errors to mimic react-query behaviour for mutate\n\t\t\t});\n\t\t},\n\t\t[mutateAsync]\n\t);\n\n\tconst reset = useCallback(() => {\n\t\tsetError(null);\n\t\tsetIsPending(false);\n\t}, []);\n\n\treturn {\n\t\tmutate,\n\t\tmutateAsync,\n\t\tisPending,\n\t\terror,\n\t\treset,\n\t};\n}\n"],"mappings":";;;;;AA4CA,SAAS,QAAQ,OAAuB;AACvC,KAAI,iBAAiB,MACpB,QAAO;AAGR,KAAI,OAAO,UAAU,SACpB,QAAO,IAAI,MAAM,MAAM;AAGxB,wBAAO,IAAI,MAAM,gBAAgB;;AAGlC,SAAS,yBACR,MACA,gBACA,WACA,WACe;CACf,MAAM,SAAS,OAAO,WAAW,+BAAc,IAAI,MAAM,EAAC,aAAa,GAAG;AAG1E,QAAO;EACN,IAHU,aAAa,mBAAmB;EAI1C;EACA,gBAAgB;EAChB,MAAM;EACN,MAAM;EACN,OAAO,CAAC;GAAE,MAAM;GAAiB,MAAM;GAAM,CAAC;EAC9C,YAAY;EACZ,QAAQ;EACR,WAAW;EACX,WAAW,aAAa;EACxB,WAAW;EACX,WAAW;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,kBAAkB,YAAY,SAAS,cAAc;AACxD,WAAO,eAAe,SAAS;AAC/B,WAAO,uBAAuB,SAAS;cAC7B,qBAAqB;AAC/B,WAAO,eAAe;AACtB,WAAO,uBAAuB;;AAG/B,gBAAa,MAAM;AACnB,YAAS,KAAK;AACd,eAAY,OAAO,gBAAgB,OAAO,UAAU;AACpD,UAAO;WACC,KAAK;GACb,MAAM,aAAa,QAAQ,IAAI;AAC/B,gBAAa,MAAM;AACnB,YAAS,WAAW;AACpB,aAAU,WAAW;AACrB,SAAM;;IAGR,CAAC,OAAO,CACR;AAgBD,QAAO;EACN,QAfc,aACb,SAA6B;AAC7B,GAAK,YAAY,KAAK,CAAC,YAAY,GAEjC;KAEH,CAAC,YAAY,CACb;EASA;EACA;EACA;EACA,OAVa,kBAAkB;AAC/B,YAAS,KAAK;AACd,gBAAa,MAAM;KACjB,EAAE,CAAC;EAQL"}
1
+ {"version":3,"file":"use-send-message.js","names":["parts: TimelineItemParts","initialConversation:\n\t\t\t\t\t| CreateConversationResponseBody[\"conversation\"]\n\t\t\t\t\t| undefined","fileParts: Array<TimelinePartImage | TimelinePartFile>","result: SendMessageResult"],"sources":["../../src/hooks/use-send-message.ts"],"sourcesContent":["import type { CossistantClient } from \"@cossistant/core\";\nimport {\n\tgenerateMessageId,\n\tisImageMimeType,\n\tvalidateFiles,\n} from \"@cossistant/core\";\nimport type { CreateConversationResponseBody } from \"@cossistant/types/api/conversation\";\nimport type {\n\tTimelineItem,\n\tTimelineItemParts,\n\tTimelinePartFile,\n\tTimelinePartImage,\n} from \"@cossistant/types/api/timeline-item\";\nimport { useCallback, useState } from \"react\";\n\nimport { useSupport } from \"../provider\";\n\nexport type SendMessageOptions = {\n\tconversationId?: string | null;\n\tmessage: string;\n\tfiles?: File[];\n\tdefaultTimelineItems?: TimelineItem[];\n\tvisitorId?: string;\n\t/**\n\t * Optional message ID to use for the optimistic update and API request.\n\t * When not provided, a ULID will be generated on the client.\n\t */\n\tmessageId?: string;\n\tonSuccess?: (conversationId: string, messageId: string) => void;\n\tonError?: (error: Error) => void;\n};\n\nexport type SendMessageResult = {\n\tconversationId: string;\n\tmessageId: string;\n\tconversation?: CreateConversationResponseBody[\"conversation\"];\n\tinitialTimelineItems?: CreateConversationResponseBody[\"initialTimelineItems\"];\n};\n\nexport type UseSendMessageResult = {\n\tmutate: (options: SendMessageOptions) => void;\n\tmutateAsync: (\n\t\toptions: SendMessageOptions\n\t) => Promise<SendMessageResult | null>;\n\tisPending: boolean;\n\tisUploading: boolean;\n\terror: Error | null;\n\treset: () => void;\n};\n\nexport type UseSendMessageOptions = {\n\tclient?: CossistantClient;\n};\n\nfunction toError(error: unknown): Error {\n\tif (error instanceof Error) {\n\t\treturn error;\n\t}\n\n\tif (typeof error === \"string\") {\n\t\treturn new Error(error);\n\t}\n\n\treturn new Error(\"Unknown error\");\n}\n\ntype BuildTimelineItemPayloadOptions = {\n\tbody: string;\n\tconversationId: string;\n\tvisitorId: string | null;\n\tmessageId?: string;\n\tfileParts?: Array<TimelinePartImage | TimelinePartFile>;\n};\n\nfunction buildTimelineItemPayload({\n\tbody,\n\tconversationId,\n\tvisitorId,\n\tmessageId,\n\tfileParts,\n}: BuildTimelineItemPayloadOptions): TimelineItem {\n\tconst nowIso = typeof window !== \"undefined\" ? new Date().toISOString() : \"\";\n\tconst id = messageId ?? generateMessageId();\n\n\t// Build parts array: text first, then any file/image parts\n\tconst parts: TimelineItemParts = [{ type: \"text\" as const, text: body }];\n\n\tif (fileParts && fileParts.length > 0) {\n\t\tparts.push(...fileParts);\n\t}\n\n\treturn {\n\t\tid,\n\t\tconversationId,\n\t\torganizationId: \"\", // Will be set by backend\n\t\ttype: \"message\" as const,\n\t\ttext: body,\n\t\tparts,\n\t\tvisibility: \"public\" as const,\n\t\tuserId: null,\n\t\taiAgentId: null,\n\t\tvisitorId: visitorId ?? null,\n\t\tcreatedAt: nowIso,\n\t\tdeletedAt: null,\n\t} satisfies TimelineItem;\n}\n\n/**\n * Upload files and return timeline parts for inclusion in a message.\n */\nasync function uploadFilesForMessage(\n\tclient: CossistantClient,\n\tfiles: File[],\n\tconversationId: string\n): Promise<Array<TimelinePartImage | TimelinePartFile>> {\n\tif (files.length === 0) {\n\t\treturn [];\n\t}\n\n\t// Validate files first\n\tconst validationError = validateFiles(files);\n\tif (validationError) {\n\t\tthrow new Error(validationError);\n\t}\n\n\t// Upload files in parallel\n\tconst uploadPromises = files.map(async (file) => {\n\t\t// Generate presigned URL\n\t\tconst uploadInfo = await client.generateUploadUrl({\n\t\t\tconversationId,\n\t\t\tcontentType: file.type,\n\t\t\tfileName: file.name,\n\t\t});\n\n\t\t// Upload file to S3\n\t\tawait client.uploadFile(file, uploadInfo.uploadUrl, file.type);\n\n\t\t// Return timeline part based on file type\n\t\tconst isImage = isImageMimeType(file.type);\n\n\t\tif (isImage) {\n\t\t\treturn {\n\t\t\t\ttype: \"image\" as const,\n\t\t\t\turl: uploadInfo.publicUrl,\n\t\t\t\tmediaType: file.type,\n\t\t\t\tfileName: file.name,\n\t\t\t\tsize: file.size,\n\t\t\t} satisfies TimelinePartImage;\n\t\t}\n\n\t\treturn {\n\t\t\ttype: \"file\" as const,\n\t\t\turl: uploadInfo.publicUrl,\n\t\t\tmediaType: file.type,\n\t\t\tfileName: file.name,\n\t\t\tsize: file.size,\n\t\t} satisfies TimelinePartFile;\n\t});\n\n\treturn Promise.all(uploadPromises);\n}\n\n/**\n * Sends visitor messages while handling optimistic pending conversations and\n * exposing react-query-like mutation state.\n */\nexport function useSendMessage(\n\toptions: UseSendMessageOptions = {}\n): UseSendMessageResult {\n\tconst { client: contextClient } = useSupport();\n\tconst client = options.client ?? contextClient;\n\n\tconst [isPending, setIsPending] = useState(false);\n\tconst [isUploading, setIsUploading] = useState(false);\n\tconst [error, setError] = useState<Error | null>(null);\n\n\tconst mutateAsync = useCallback(\n\t\tasync (payload: SendMessageOptions): Promise<SendMessageResult | null> => {\n\t\t\tconst {\n\t\t\t\tconversationId: providedConversationId,\n\t\t\t\tmessage,\n\t\t\t\tfiles = [],\n\t\t\t\tdefaultTimelineItems = [],\n\t\t\t\tvisitorId,\n\t\t\t\tmessageId: providedMessageId,\n\t\t\t\tonSuccess,\n\t\t\t\tonError,\n\t\t\t} = payload;\n\n\t\t\t// Allow empty message if there are files\n\t\t\tif (!message.trim() && files.length === 0) {\n\t\t\t\tconst emptyMessageError = new Error(\n\t\t\t\t\t\"Message cannot be empty (or attach files)\"\n\t\t\t\t);\n\t\t\t\tsetError(emptyMessageError);\n\t\t\t\tonError?.(emptyMessageError);\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tsetIsPending(true);\n\t\t\tsetError(null);\n\n\t\t\ttry {\n\t\t\t\tlet conversationId = providedConversationId ?? undefined;\n\t\t\t\tlet preparedDefaultTimelineItems = defaultTimelineItems;\n\t\t\t\tlet initialConversation:\n\t\t\t\t\t| CreateConversationResponseBody[\"conversation\"]\n\t\t\t\t\t| undefined;\n\n\t\t\t\tif (!conversationId) {\n\t\t\t\t\tconst initiated = client.initiateConversation({\n\t\t\t\t\t\tdefaultTimelineItems,\n\t\t\t\t\t\tvisitorId: visitorId ?? undefined,\n\t\t\t\t\t});\n\t\t\t\t\tconversationId = initiated.conversationId;\n\t\t\t\t\tpreparedDefaultTimelineItems = initiated.defaultTimelineItems;\n\t\t\t\t\tinitialConversation = initiated.conversation;\n\t\t\t\t}\n\n\t\t\t\t// Upload files BEFORE sending the message\n\t\t\t\tlet fileParts: Array<TimelinePartImage | TimelinePartFile> = [];\n\t\t\t\tif (files.length > 0) {\n\t\t\t\t\tsetIsUploading(true);\n\t\t\t\t\ttry {\n\t\t\t\t\t\tfileParts = await uploadFilesForMessage(\n\t\t\t\t\t\t\tclient,\n\t\t\t\t\t\t\tfiles,\n\t\t\t\t\t\t\tconversationId\n\t\t\t\t\t\t);\n\t\t\t\t\t} finally {\n\t\t\t\t\t\tsetIsUploading(false);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst timelineItemPayload = buildTimelineItemPayload({\n\t\t\t\t\tbody: message,\n\t\t\t\t\tconversationId,\n\t\t\t\t\tvisitorId: visitorId ?? null,\n\t\t\t\t\tmessageId: providedMessageId,\n\t\t\t\t\tfileParts,\n\t\t\t\t});\n\n\t\t\t\tconst response = await client.sendMessage({\n\t\t\t\t\tconversationId,\n\t\t\t\t\titem: {\n\t\t\t\t\t\tid: timelineItemPayload.id,\n\t\t\t\t\t\ttext: timelineItemPayload.text ?? \"\",\n\t\t\t\t\t\ttype:\n\t\t\t\t\t\t\ttimelineItemPayload.type === \"identification\"\n\t\t\t\t\t\t\t\t? \"message\"\n\t\t\t\t\t\t\t\t: timelineItemPayload.type,\n\t\t\t\t\t\tvisibility: timelineItemPayload.visibility,\n\t\t\t\t\t\tuserId: timelineItemPayload.userId,\n\t\t\t\t\t\taiAgentId: timelineItemPayload.aiAgentId,\n\t\t\t\t\t\tvisitorId: timelineItemPayload.visitorId,\n\t\t\t\t\t\tcreatedAt: timelineItemPayload.createdAt,\n\t\t\t\t\t\tparts: timelineItemPayload.parts,\n\t\t\t\t\t},\n\t\t\t\t\tcreateIfPending: true,\n\t\t\t\t});\n\n\t\t\t\tconst messageId = response.item.id;\n\n\t\t\t\tif (!messageId) {\n\t\t\t\t\tthrow new Error(\"SendMessage response missing item.id\");\n\t\t\t\t}\n\n\t\t\t\tconst result: SendMessageResult = {\n\t\t\t\t\tconversationId,\n\t\t\t\t\tmessageId,\n\t\t\t\t};\n\n\t\t\t\tif (\"conversation\" in response && response.conversation) {\n\t\t\t\t\tresult.conversation = response.conversation;\n\t\t\t\t\tresult.initialTimelineItems = response.initialTimelineItems;\n\t\t\t\t} else if (initialConversation) {\n\t\t\t\t\tresult.conversation = initialConversation;\n\t\t\t\t\tresult.initialTimelineItems = preparedDefaultTimelineItems;\n\t\t\t\t}\n\n\t\t\t\tsetIsPending(false);\n\t\t\t\tsetError(null);\n\t\t\t\tonSuccess?.(result.conversationId, result.messageId);\n\t\t\t\treturn result;\n\t\t\t} catch (raw) {\n\t\t\t\tconst normalised = toError(raw);\n\t\t\t\tsetIsPending(false);\n\t\t\t\tsetError(normalised);\n\t\t\t\tonError?.(normalised);\n\t\t\t\tthrow normalised;\n\t\t\t}\n\t\t},\n\t\t[client]\n\t);\n\n\tconst mutate = useCallback(\n\t\t(opts: SendMessageOptions) => {\n\t\t\tvoid mutateAsync(opts).catch(() => {\n\t\t\t\t// Swallow errors to mimic react-query behaviour for mutate\n\t\t\t});\n\t\t},\n\t\t[mutateAsync]\n\t);\n\n\tconst reset = useCallback(() => {\n\t\tsetError(null);\n\t\tsetIsPending(false);\n\t\tsetIsUploading(false);\n\t}, []);\n\n\treturn {\n\t\tmutate,\n\t\tmutateAsync,\n\t\tisPending,\n\t\tisUploading,\n\t\terror,\n\t\treset,\n\t};\n}\n"],"mappings":";;;;;AAsDA,SAAS,QAAQ,OAAuB;AACvC,KAAI,iBAAiB,MACpB,QAAO;AAGR,KAAI,OAAO,UAAU,SACpB,QAAO,IAAI,MAAM,MAAM;AAGxB,wBAAO,IAAI,MAAM,gBAAgB;;AAWlC,SAAS,yBAAyB,EACjC,MACA,gBACA,WACA,WACA,aACiD;CACjD,MAAM,SAAS,OAAO,WAAW,+BAAc,IAAI,MAAM,EAAC,aAAa,GAAG;CAC1E,MAAM,KAAK,aAAa,mBAAmB;CAG3C,MAAMA,QAA2B,CAAC;EAAE,MAAM;EAAiB,MAAM;EAAM,CAAC;AAExE,KAAI,aAAa,UAAU,SAAS,EACnC,OAAM,KAAK,GAAG,UAAU;AAGzB,QAAO;EACN;EACA;EACA,gBAAgB;EAChB,MAAM;EACN,MAAM;EACN;EACA,YAAY;EACZ,QAAQ;EACR,WAAW;EACX,WAAW,aAAa;EACxB,WAAW;EACX,WAAW;EACX;;;;;AAMF,eAAe,sBACd,QACA,OACA,gBACuD;AACvD,KAAI,MAAM,WAAW,EACpB,QAAO,EAAE;CAIV,MAAM,kBAAkB,cAAc,MAAM;AAC5C,KAAI,gBACH,OAAM,IA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Za,kBAAkB;AAC/B,YAAS,KAAK;AACd,gBAAa,MAAM;AACnB,kBAAe,MAAM;KACnB,EAAE,CAAC;EASL"}
package/index.d.ts CHANGED
@@ -17,6 +17,7 @@ import { ConversationTypingParticipant, useConversationTyping } from "./hooks/us
17
17
  import { ConversationTimelineTypingParticipant, UseConversationTimelineOptions, UseConversationTimelineReturn, useConversationTimeline } from "./hooks/use-conversation-timeline.js";
18
18
  import { UseConversationsOptions, UseConversationsResult, useConversations } from "./hooks/use-conversations.js";
19
19
  import { CreateConversationVariables, UseCreateConversationOptions, UseCreateConversationResult, useCreateConversation } from "./hooks/use-create-conversation.js";
20
+ import { FileUploadPart, UseFileUploadOptions, UseFileUploadReturn, useFileUpload } from "./hooks/use-file-upload.js";
20
21
  import { UseHomePageOptions, UseHomePageReturn, useHomePage } from "./hooks/use-home-page.js";
21
22
  import { UseMessageComposerOptions, UseMessageComposerReturn, useMessageComposer } from "./hooks/use-message-composer.js";
22
23
  import { useNewMessageSound } from "./hooks/use-new-message-sound.js";
@@ -39,11 +40,13 @@ import { applyConversationTypingEvent, clearTypingFromTimelineItem, clearTypingS
39
40
  import { RealtimeEventHandler, RealtimeEventHandlerEntry, RealtimeEventHandlersMap, RealtimeEventMeta, useRealtime } from "./realtime/use-realtime.js";
40
41
  import "./realtime/index.js";
41
42
  import { CustomPage } from "./support/router.js";
43
+ import { ConversationEndEvent, ConversationStartEvent, ErrorEvent, MessageReceivedEvent, MessageSentEvent, SupportEvent, SupportEventCallbacks, SupportEventType, useSupportEventEmitter, useSupportEvents } from "./support/context/events.js";
44
+ import { SupportHandle, useSupportHandle } from "./support/context/handle.js";
42
45
  import { Text, useSupportText } from "./support/text/index.js";
43
- import { BubbleSlotProps, ContainerSlotProps, RouterSlotProps } from "./support/types.js";
46
+ import { Align, CollisionPadding, ContentProps, RootProps, Side, TriggerRenderProps } from "./support/types.js";
44
47
  import { CoButton } from "./support/components/button.js";
45
48
  import { Header } from "./support/components/header.js";
46
49
  import { WebSocketContextValue, WebSocketProvider, useWebSocket } from "./support/context/websocket.js";
47
50
  import { useSupportConfig, useSupportNavigation, useSupportStore } from "./support/store/support-store.js";
48
- import { DefaultRoutes, NavigationState, RouteRegistry, Support, SupportPage, SupportProps } from "./support/index.js";
49
- export { BubbleSlotProps, CoButton as Button, CONVERSATION_AUTO_SEEN_DELAY_MS, ContainerSlotProps, ConversationItem, ConversationLifecycleState, ConversationPreviewAssignedAgent, ConversationPreviewLastMessage, ConversationPreviewTypingParticipant, ConversationPreviewTypingState, ConversationTimelineTypingParticipant, ConversationTypingParticipant, CossistantContextValue, CossistantProviderProps, CreateConversationVariables, CustomPage, DefaultRoutes, GroupedMessage, Header, IdentifySupportVisitor, IdentifySupportVisitorProps, NavigationState, index_d_exports as Primitives, RealtimeAuthConfig, RealtimeContextValue, RealtimeEventHandler, RealtimeEventHandlerEntry, RealtimeEventHandlersMap, RealtimeEventMeta, RealtimeProvider, RealtimeProviderProps, RouteRegistry, RouterSlotProps, SendMessageOptions, SendMessageResult, Support, SupportConfig, SupportConfigProps, SupportContext, SupportLocale, SupportPage, SupportProps, SupportProvider, SupportProviderProps, SupportRealtimeProvider, SupportTextContentOverrides, Text, TimelineEventItem, TimelineToolItem, UseClientResult, UseComposerRefocusOptions, UseComposerRefocusReturn, UseConversationAutoSeenOptions, UseConversationHistoryPageOptions, UseConversationHistoryPageReturn, UseConversationLifecycleOptions, UseConversationLifecycleReturn, UseConversationOptions, UseConversationPageOptions, UseConversationPageReturn, UseConversationPreviewOptions, UseConversationPreviewReturn, UseConversationResult, UseConversationTimelineItemsOptions, UseConversationTimelineItemsResult, UseConversationTimelineOptions, UseConversationTimelineReturn, UseConversationsOptions, UseConversationsResult, UseCreateConversationOptions, UseCreateConversationResult, UseGroupedMessagesOptions, UseGroupedMessagesProps, UseHomePageOptions, UseHomePageReturn, UseMessageComposerOptions, UseMessageComposerReturn, UseMultimodalInputOptions, UseMultimodalInputReturn, UseRealtimeSupportOptions, UseRealtimeSupportResult, UseScrollMaskOptions, UseScrollMaskReturn, UseSendMessageOptions, UseSendMessageResult, UseSoundEffectOptions, UseSoundEffectReturn, UseSupportValue, UseVisitorReturn, WebSocketContextValue, WebSocketProvider, WindowVisibilityFocusState, applyConversationSeenEvent, applyConversationTypingEvent, clearTypingFromTimelineItem, clearTypingState, hydrateConversationSeen, setTypingState, upsertConversationSeen, useClient, useClientQuery, useComposerRefocus, useConversation, useConversationAutoSeen, useConversationHistoryPage, useConversationLifecycle, useConversationPage, useConversationPreview, useConversationSeen, useConversationTimeline, useConversationTimelineItems, useConversationTyping, useConversations, useCreateConversation, useDebouncedConversationSeen, useDefaultMessages, useGroupedMessages, useHomePage, useMessageComposer, useMultimodalInput, useNewMessageSound, useRealtime, useRealtimeConnection, useRealtimeSupport, useScrollMask, useSendMessage, useSoundEffect, useSupport, useSupportConfig, useSupportNavigation, useSupportStore, useSupportText, useTypingSound, useVisitor, useWebSocket, useWindowVisibilityFocus };
51
+ import { DefaultRoutes, NavigationState, RouteRegistry, Support, SupportContentProps, SupportPageProps, SupportPageType, SupportProps, SupportRootProps, SupportRouterProps, SupportTriggerProps } from "./support/index.js";
52
+ export { Align, CoButton as Button, CONVERSATION_AUTO_SEEN_DELAY_MS, CollisionPadding, ContentProps, ConversationEndEvent, ConversationItem, ConversationLifecycleState, ConversationPreviewAssignedAgent, ConversationPreviewLastMessage, ConversationPreviewTypingParticipant, ConversationPreviewTypingState, ConversationStartEvent, ConversationTimelineTypingParticipant, ConversationTypingParticipant, CossistantContextValue, CossistantProviderProps, CreateConversationVariables, CustomPage, DefaultRoutes, ErrorEvent, FileUploadPart, GroupedMessage, Header, IdentifySupportVisitor, IdentifySupportVisitorProps, MessageReceivedEvent, MessageSentEvent, NavigationState, index_d_exports as Primitives, RealtimeAuthConfig, RealtimeContextValue, RealtimeEventHandler, RealtimeEventHandlerEntry, RealtimeEventHandlersMap, RealtimeEventMeta, RealtimeProvider, RealtimeProviderProps, RootProps, RouteRegistry, SendMessageOptions, SendMessageResult, Side, Support, SupportConfig, SupportConfigProps, SupportContentProps, SupportContext, SupportEvent, SupportEventCallbacks, SupportEventType, SupportHandle, SupportLocale, SupportPageProps, SupportPageType, SupportProps, SupportProvider, SupportProviderProps, SupportRealtimeProvider, SupportRootProps, SupportRouterProps, SupportTextContentOverrides, SupportTriggerProps, Text, TimelineEventItem, TimelineToolItem, TriggerRenderProps, UseClientResult, UseComposerRefocusOptions, UseComposerRefocusReturn, UseConversationAutoSeenOptions, UseConversationHistoryPageOptions, UseConversationHistoryPageReturn, UseConversationLifecycleOptions, UseConversationLifecycleReturn, UseConversationOptions, UseConversationPageOptions, UseConversationPageReturn, UseConversationPreviewOptions, UseConversationPreviewReturn, UseConversationResult, UseConversationTimelineItemsOptions, UseConversationTimelineItemsResult, UseConversationTimelineOptions, UseConversationTimelineReturn, UseConversationsOptions, UseConversationsResult, UseCreateConversationOptions, UseCreateConversationResult, UseFileUploadOptions, UseFileUploadReturn, UseGroupedMessagesOptions, UseGroupedMessagesProps, UseHomePageOptions, UseHomePageReturn, UseMessageComposerOptions, UseMessageComposerReturn, UseMultimodalInputOptions, UseMultimodalInputReturn, UseRealtimeSupportOptions, UseRealtimeSupportResult, UseScrollMaskOptions, UseScrollMaskReturn, UseSendMessageOptions, UseSendMessageResult, UseSoundEffectOptions, UseSoundEffectReturn, UseSupportValue, UseVisitorReturn, WebSocketContextValue, WebSocketProvider, WindowVisibilityFocusState, applyConversationSeenEvent, applyConversationTypingEvent, clearTypingFromTimelineItem, clearTypingState, hydrateConversationSeen, setTypingState, upsertConversationSeen, useClient, useClientQuery, useComposerRefocus, useConversation, useConversationAutoSeen, useConversationHistoryPage, useConversationLifecycle, useConversationPage, useConversationPreview, useConversationSeen, useConversationTimeline, useConversationTimelineItems, useConversationTyping, useConversations, useCreateConversation, useDebouncedConversationSeen, useDefaultMessages, useFileUpload, useGroupedMessages, useHomePage, useMessageComposer, useMultimodalInput, useNewMessageSound, useRealtime, useRealtimeConnection, useRealtimeSupport, useScrollMask, useSendMessage, useSoundEffect, useSupport, useSupportConfig, useSupportEventEmitter, useSupportEvents, useSupportHandle, useSupportNavigation, useSupportStore, useSupportText, useTypingSound, useVisitor, useWebSocket, useWindowVisibilityFocus };
package/index.js CHANGED
@@ -1,18 +1,23 @@
1
1
  import { useClientQuery } from "./hooks/private/use-client-query.js";
2
2
  import { useClient } from "./hooks/private/use-rest-client.js";
3
3
  import { applyConversationSeenEvent, hydrateConversationSeen, upsertConversationSeen } from "./realtime/seen-store.js";
4
- import { RealtimeProvider, useRealtimeConnection } from "./realtime/provider.js";
5
- import { applyConversationTypingEvent, clearTypingFromTimelineItem, clearTypingState, setTypingState } from "./realtime/typing-store.js";
6
- import { useRealtime } from "./realtime/use-realtime.js";
7
- import { SupportRealtimeProvider } from "./realtime/support-provider.js";
8
4
  import { SupportConfig } from "./support-config.js";
9
5
  import { useScrollMask } from "./hooks/use-scroll-mask.js";
6
+ import { applyConversationTypingEvent, clearTypingFromTimelineItem, clearTypingState, setTypingState } from "./realtime/typing-store.js";
10
7
  import { useSupportConfig, useSupportNavigation, useSupportStore } from "./support/store/support-store.js";
11
8
  import { primitives_exports } from "./primitives/index.js";
9
+ import { RealtimeProvider, useRealtimeConnection } from "./realtime/provider.js";
10
+ import { useRealtime } from "./realtime/use-realtime.js";
11
+ import { SupportRealtimeProvider } from "./realtime/support-provider.js";
12
+ import { useSoundEffect } from "./hooks/use-sound-effect.js";
13
+ import { useNewMessageSound } from "./hooks/use-new-message-sound.js";
14
+ import { useTypingSound } from "./hooks/use-typing-sound.js";
15
+ import { useSupportEventEmitter, useSupportEvents } from "./support/context/events.js";
16
+ import { useSupportHandle } from "./support/context/handle.js";
12
17
  import { CoButton } from "./support/components/button.js";
13
18
  import { Header } from "./support/components/header.js";
14
19
  import { Text, useSupportText } from "./support/text/index.js";
15
- import { useConversation } from "./hooks/use-conversation.js";
20
+ import { WebSocketProvider, useWebSocket } from "./support/context/websocket.js";
16
21
  import { useWindowVisibilityFocus } from "./hooks/use-window-visibility-focus.js";
17
22
  import { CONVERSATION_AUTO_SEEN_DELAY_MS, useConversationAutoSeen } from "./hooks/use-conversation-auto-seen.js";
18
23
  import { useConversationLifecycle } from "./hooks/use-conversation-lifecycle.js";
@@ -21,25 +26,23 @@ import { useMultimodalInput } from "./hooks/private/use-multimodal-input.js";
21
26
  import { useSendMessage } from "./hooks/use-send-message.js";
22
27
  import { useMessageComposer } from "./hooks/use-message-composer.js";
23
28
  import { useConversationPage } from "./hooks/use-conversation-page.js";
24
- import { useSoundEffect } from "./hooks/use-sound-effect.js";
25
- import { useNewMessageSound } from "./hooks/use-new-message-sound.js";
26
29
  import { useGroupedMessages } from "./hooks/private/use-grouped-messages.js";
27
30
  import { useConversationSeen, useDebouncedConversationSeen } from "./hooks/use-conversation-seen.js";
28
31
  import { useConversationTyping } from "./hooks/use-conversation-typing.js";
29
32
  import { useConversationTimeline } from "./hooks/use-conversation-timeline.js";
30
- import { useTypingSound } from "./hooks/use-typing-sound.js";
31
33
  import { useComposerRefocus } from "./hooks/use-composer-refocus.js";
32
34
  import { useVisitor } from "./hooks/use-visitor.js";
33
35
  import { useConversations } from "./hooks/use-conversations.js";
34
36
  import { useConversationHistoryPage } from "./hooks/use-conversation-history-page.js";
35
37
  import { useConversationPreview } from "./hooks/use-conversation-preview.js";
36
38
  import { useHomePage } from "./hooks/use-home-page.js";
37
- import { WebSocketProvider, useWebSocket } from "./support/context/websocket.js";
38
39
  import { Support } from "./support/index.js";
39
40
  import { SupportContext, SupportProvider, useSupport } from "./provider.js";
40
41
  import { useDefaultMessages } from "./hooks/private/use-default-messages.js";
42
+ import { useConversation } from "./hooks/use-conversation.js";
41
43
  import { useCreateConversation } from "./hooks/use-create-conversation.js";
44
+ import { useFileUpload } from "./hooks/use-file-upload.js";
42
45
  import { useRealtimeSupport } from "./hooks/use-realtime-support.js";
43
46
  import { IdentifySupportVisitor } from "./identify-visitor.js";
44
47
 
45
- export { CoButton as Button, CONVERSATION_AUTO_SEEN_DELAY_MS, Header, IdentifySupportVisitor, primitives_exports as Primitives, RealtimeProvider, Support, SupportConfig, SupportContext, SupportProvider, SupportRealtimeProvider, Text, WebSocketProvider, applyConversationSeenEvent, applyConversationTypingEvent, clearTypingFromTimelineItem, clearTypingState, hydrateConversationSeen, setTypingState, upsertConversationSeen, useClient, useClientQuery, useComposerRefocus, useConversation, useConversationAutoSeen, useConversationHistoryPage, useConversationLifecycle, useConversationPage, useConversationPreview, useConversationSeen, useConversationTimeline, useConversationTimelineItems, useConversationTyping, useConversations, useCreateConversation, useDebouncedConversationSeen, useDefaultMessages, useGroupedMessages, useHomePage, useMessageComposer, useMultimodalInput, useNewMessageSound, useRealtime, useRealtimeConnection, useRealtimeSupport, useScrollMask, useSendMessage, useSoundEffect, useSupport, useSupportConfig, useSupportNavigation, useSupportStore, useSupportText, useTypingSound, useVisitor, useWebSocket, useWindowVisibilityFocus };
48
+ export { CoButton as Button, CONVERSATION_AUTO_SEEN_DELAY_MS, Header, IdentifySupportVisitor, primitives_exports as Primitives, RealtimeProvider, Support, SupportConfig, SupportContext, SupportProvider, SupportRealtimeProvider, Text, WebSocketProvider, applyConversationSeenEvent, applyConversationTypingEvent, clearTypingFromTimelineItem, clearTypingState, hydrateConversationSeen, setTypingState, upsertConversationSeen, useClient, useClientQuery, useComposerRefocus, useConversation, useConversationAutoSeen, useConversationHistoryPage, useConversationLifecycle, useConversationPage, useConversationPreview, useConversationSeen, useConversationTimeline, useConversationTimelineItems, useConversationTyping, useConversations, useCreateConversation, useDebouncedConversationSeen, useDefaultMessages, useFileUpload, useGroupedMessages, useHomePage, useMessageComposer, useMultimodalInput, useNewMessageSound, useRealtime, useRealtimeConnection, useRealtimeSupport, useScrollMask, useSendMessage, useSoundEffect, useSupport, useSupportConfig, useSupportEventEmitter, useSupportEvents, useSupportHandle, useSupportNavigation, useSupportStore, useSupportText, useTypingSound, useVisitor, useWebSocket, useWindowVisibilityFocus };
package/openapi30.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { ISpecificationExtension } from "./specification-extension.js";
2
2
 
3
- //#region ../../node_modules/.bun/openapi3-ts@4.5.0/node_modules/openapi3-ts/dist/model/openapi30.d.ts
3
+ //#region ../../node_modules/openapi3-ts/dist/model/openapi30.d.ts
4
4
 
5
5
  interface ExternalDocumentationObject extends ISpecificationExtension {
6
6
  description?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"openapi30.d.ts","names":["ServerObject","ISpecificationExtension","SpecificationExtension","OpenAPIObject","InfoObject","PathsObject","ComponentsObject","SecurityRequirementObject","TagObject","ExternalDocumentationObject","ContactObject","LicenseObject","SchemaObject","ReferenceObject","ResponseObject","ParameterObject","ExampleObject","RequestBodyObject","HeaderObject","SecuritySchemeObject","LinkObject","CallbackObject","PathItemObject","PathObject","getPath","OperationObject","ResponsesObject","CallbacksObject","ParameterLocation","ParameterStyle","BaseParameterObject","ContentObject","MediaTypeObject","ExamplesObject","EncodingObject","EncodingPropertyObject","HeadersObject","LinksObject","LinkParametersObject","isReferenceObject","SchemaObjectType","SchemaObjectFormat","DiscriminatorObject","XmlObject","isSchemaObject","SchemasObject","SecuritySchemeType","OAuthFlowsObject","OAuthFlowObject","ScopesObject"],"sources":["../../../node_modules/.bun/openapi3-ts@4.5.0/node_modules/openapi3-ts/dist/model/openapi30.d.ts"],"sourcesContent":["import { ServerObject } from './oas-common';\nimport { ISpecificationExtension } from './specification-extension';\nexport * from './oas-common';\nexport type { ISpecificationExtension, SpecificationExtension } from './specification-extension';\nexport interface OpenAPIObject extends ISpecificationExtension {\n openapi: string;\n info: InfoObject;\n servers?: ServerObject[];\n paths: PathsObject;\n components?: ComponentsObject;\n security?: SecurityRequirementObject[];\n tags?: TagObject[];\n externalDocs?: ExternalDocumentationObject;\n}\nexport interface InfoObject extends ISpecificationExtension {\n title: string;\n description?: string;\n termsOfService?: string;\n contact?: ContactObject;\n license?: LicenseObject;\n version: string;\n}\nexport interface ContactObject extends ISpecificationExtension {\n name?: string;\n url?: string;\n email?: string;\n}\nexport interface LicenseObject extends ISpecificationExtension {\n name: string;\n url?: string;\n}\nexport interface ComponentsObject extends ISpecificationExtension {\n schemas?: {\n [schema: string]: SchemaObject | ReferenceObject;\n };\n responses?: {\n [response: string]: ResponseObject | ReferenceObject;\n };\n parameters?: {\n [parameter: string]: ParameterObject | ReferenceObject;\n };\n examples?: {\n [example: string]: ExampleObject | ReferenceObject;\n };\n requestBodies?: {\n [request: string]: RequestBodyObject | ReferenceObject;\n };\n headers?: {\n [header: string]: HeaderObject | ReferenceObject;\n };\n securitySchemes?: {\n [securityScheme: string]: SecuritySchemeObject | ReferenceObject;\n };\n links?: {\n [link: string]: LinkObject | ReferenceObject;\n };\n callbacks?: {\n [callback: string]: CallbackObject | ReferenceObject;\n };\n}\nexport interface PathsObject extends ISpecificationExtension {\n [path: string]: PathItemObject;\n}\nexport type PathObject = PathsObject;\nexport declare function getPath(pathsObject: PathsObject, path: string): PathItemObject | undefined;\nexport interface PathItemObject extends ISpecificationExtension {\n $ref?: string;\n summary?: string;\n description?: string;\n get?: OperationObject;\n put?: OperationObject;\n post?: OperationObject;\n delete?: OperationObject;\n options?: OperationObject;\n head?: OperationObject;\n patch?: OperationObject;\n trace?: OperationObject;\n servers?: ServerObject[];\n parameters?: (ParameterObject | ReferenceObject)[];\n}\nexport interface OperationObject extends ISpecificationExtension {\n tags?: string[];\n summary?: string;\n description?: string;\n externalDocs?: ExternalDocumentationObject;\n operationId?: string;\n parameters?: (ParameterObject | ReferenceObject)[];\n requestBody?: RequestBodyObject | ReferenceObject;\n responses: ResponsesObject;\n callbacks?: CallbacksObject;\n deprecated?: boolean;\n security?: SecurityRequirementObject[];\n servers?: ServerObject[];\n}\nexport interface ExternalDocumentationObject extends ISpecificationExtension {\n description?: string;\n url: string;\n}\nexport type ParameterLocation = 'query' | 'header' | 'path' | 'cookie';\nexport type ParameterStyle = 'matrix' | 'label' | 'form' | 'simple' | 'spaceDelimited' | 'pipeDelimited' | 'deepObject';\nexport interface BaseParameterObject extends ISpecificationExtension {\n description?: string;\n required?: boolean;\n deprecated?: boolean;\n allowEmptyValue?: boolean;\n style?: ParameterStyle;\n explode?: boolean;\n allowReserved?: boolean;\n schema?: SchemaObject | ReferenceObject;\n examples?: {\n [param: string]: ExampleObject | ReferenceObject;\n };\n example?: any;\n content?: ContentObject;\n}\nexport interface ParameterObject extends BaseParameterObject {\n name: string;\n in: ParameterLocation;\n}\nexport interface RequestBodyObject extends ISpecificationExtension {\n description?: string;\n content: ContentObject;\n required?: boolean;\n}\nexport interface ContentObject {\n [mediatype: string]: MediaTypeObject;\n}\nexport interface MediaTypeObject extends ISpecificationExtension {\n schema?: SchemaObject | ReferenceObject;\n examples?: ExamplesObject;\n example?: any;\n encoding?: EncodingObject;\n}\nexport interface EncodingObject extends ISpecificationExtension {\n [property: string]: EncodingPropertyObject | any;\n}\nexport interface EncodingPropertyObject {\n contentType?: string;\n headers?: {\n [key: string]: HeaderObject | ReferenceObject;\n };\n style?: string;\n explode?: boolean;\n allowReserved?: boolean;\n [key: string]: any;\n}\nexport interface ResponsesObject extends ISpecificationExtension {\n default?: ResponseObject | ReferenceObject;\n [statuscode: string]: ResponseObject | ReferenceObject | any;\n}\nexport interface ResponseObject extends ISpecificationExtension {\n description: string;\n headers?: HeadersObject;\n content?: ContentObject;\n links?: LinksObject;\n}\nexport interface CallbacksObject extends ISpecificationExtension {\n [name: string]: CallbackObject | ReferenceObject | any;\n}\nexport interface CallbackObject extends ISpecificationExtension {\n [name: string]: PathItemObject | any;\n}\nexport interface HeadersObject {\n [name: string]: HeaderObject | ReferenceObject;\n}\nexport interface ExampleObject {\n summary?: string;\n description?: string;\n value?: any;\n externalValue?: string;\n [property: string]: any;\n}\nexport interface LinksObject {\n [name: string]: LinkObject | ReferenceObject;\n}\nexport interface LinkObject extends ISpecificationExtension {\n operationRef?: string;\n operationId?: string;\n parameters?: LinkParametersObject;\n requestBody?: any | string;\n description?: string;\n server?: ServerObject;\n [property: string]: any;\n}\nexport interface LinkParametersObject {\n [name: string]: any | string;\n}\nexport interface HeaderObject extends BaseParameterObject {\n $ref?: string;\n}\nexport interface TagObject extends ISpecificationExtension {\n name: string;\n description?: string;\n externalDocs?: ExternalDocumentationObject;\n [extension: string]: any;\n}\nexport interface ExamplesObject {\n [name: string]: ExampleObject | ReferenceObject;\n}\nexport interface ReferenceObject {\n $ref: string;\n}\nexport declare function isReferenceObject(obj: any): obj is ReferenceObject;\nexport type SchemaObjectType = 'integer' | 'number' | 'string' | 'boolean' | 'object' | 'null' | 'array';\nexport type SchemaObjectFormat = 'int32' | 'int64' | 'float' | 'double' | 'byte' | 'binary' | 'date' | 'date-time' | 'password' | string;\nexport interface SchemaObject extends ISpecificationExtension {\n nullable?: boolean;\n discriminator?: DiscriminatorObject;\n readOnly?: boolean;\n writeOnly?: boolean;\n xml?: XmlObject;\n externalDocs?: ExternalDocumentationObject;\n example?: any;\n examples?: any[];\n deprecated?: boolean;\n type?: SchemaObjectType | SchemaObjectType[];\n format?: SchemaObjectFormat;\n allOf?: (SchemaObject | ReferenceObject)[];\n oneOf?: (SchemaObject | ReferenceObject)[];\n anyOf?: (SchemaObject | ReferenceObject)[];\n not?: SchemaObject | ReferenceObject;\n items?: SchemaObject | ReferenceObject;\n properties?: {\n [propertyName: string]: SchemaObject | ReferenceObject;\n };\n additionalProperties?: SchemaObject | ReferenceObject | boolean;\n description?: string;\n default?: any;\n title?: string;\n multipleOf?: number;\n maximum?: number;\n exclusiveMaximum?: boolean;\n minimum?: number;\n exclusiveMinimum?: boolean;\n maxLength?: number;\n minLength?: number;\n pattern?: string;\n maxItems?: number;\n minItems?: number;\n uniqueItems?: boolean;\n maxProperties?: number;\n minProperties?: number;\n required?: string[];\n enum?: any[];\n}\nexport declare function isSchemaObject(schema: SchemaObject | ReferenceObject): schema is SchemaObject;\nexport interface SchemasObject {\n [schema: string]: SchemaObject;\n}\nexport interface DiscriminatorObject {\n propertyName: string;\n mapping?: {\n [key: string]: string;\n };\n}\nexport interface XmlObject extends ISpecificationExtension {\n name?: string;\n namespace?: string;\n prefix?: string;\n attribute?: boolean;\n wrapped?: boolean;\n}\nexport type SecuritySchemeType = 'apiKey' | 'http' | 'oauth2' | 'openIdConnect';\nexport interface SecuritySchemeObject extends ISpecificationExtension {\n type: SecuritySchemeType;\n description?: string;\n name?: string;\n in?: string;\n scheme?: string;\n bearerFormat?: string;\n flows?: OAuthFlowsObject;\n openIdConnectUrl?: string;\n}\nexport interface OAuthFlowsObject extends ISpecificationExtension {\n implicit?: OAuthFlowObject;\n password?: OAuthFlowObject;\n clientCredentials?: OAuthFlowObject;\n authorizationCode?: OAuthFlowObject;\n}\nexport interface OAuthFlowObject extends ISpecificationExtension {\n authorizationUrl?: string;\n tokenUrl?: string;\n refreshUrl?: string;\n scopes: ScopesObject;\n}\nexport interface ScopesObject extends ISpecificationExtension {\n [scope: string]: any;\n}\nexport interface SecurityRequirementObject {\n [name: string]: string[];\n}\n"],"x_google_ignoreList":[0],"mappings":";;;;UA8FiBS,2BAAAA,SAAoCR;;;;KAIzC2B,iBAAAA;KACAC,cAAAA;UACKC,mBAAAA,SAA4B7B;;;;;UAKjC4B;;;WAGCjB,eAAeC;;qBAEHG,gBAAgBH;;;YAG3BkB;;UAEGhB,eAAAA,SAAwBe;;MAEjCF;;UAOSG,aAAAA;uBACQC;;UAERA,eAAAA,SAAwB/B;WAC5BW,eAAeC;aACboB;;aAEAC;;UAEEA,cAAAA,SAAuBjC;sBAChBkC;;UAEPA,sBAAAA;;;mBAGMjB,eAAeL;;;;;;;UA0BrBG,aAAAA;;;;;;;UAsBAE,YAAAA,SAAqBY;;;UASrBG,cAAAA;kBACGjB,gBAAgBH;;UAEnBA,eAAAA;;;KAIL2B,gBAAAA;KACAC,kBAAAA;UACK7B,YAAAA,SAAqBX;;kBAElByC;;;QAGVC;iBACSlC;;;;SAIR+B,mBAAmBA;WACjBC;WACA7B,eAAeC;WACfD,eAAeC;WACfD,eAAeC;QAClBD,eAAeC;UACbD,eAAeC;;4BAEKD,eAAeC;;yBAEpBD,eAAeC;;;;;;;;;;;;;;;;;;;;UAwBzB6B,mBAAAA;;;;;;UAMAC,SAAAA,SAAkB1C"}
1
+ {"version":3,"file":"openapi30.d.ts","names":["ServerObject","ISpecificationExtension","SpecificationExtension","OpenAPIObject","InfoObject","PathsObject","ComponentsObject","SecurityRequirementObject","TagObject","ExternalDocumentationObject","ContactObject","LicenseObject","SchemaObject","ReferenceObject","ResponseObject","ParameterObject","ExampleObject","RequestBodyObject","HeaderObject","SecuritySchemeObject","LinkObject","CallbackObject","PathItemObject","PathObject","getPath","OperationObject","ResponsesObject","CallbacksObject","ParameterLocation","ParameterStyle","BaseParameterObject","ContentObject","MediaTypeObject","ExamplesObject","EncodingObject","EncodingPropertyObject","HeadersObject","LinksObject","LinkParametersObject","isReferenceObject","SchemaObjectType","SchemaObjectFormat","DiscriminatorObject","XmlObject","isSchemaObject","SchemasObject","SecuritySchemeType","OAuthFlowsObject","OAuthFlowObject","ScopesObject"],"sources":["../../../node_modules/openapi3-ts/dist/model/openapi30.d.ts"],"sourcesContent":["import { ServerObject } from './oas-common';\nimport { ISpecificationExtension } from './specification-extension';\nexport * from './oas-common';\nexport type { ISpecificationExtension, SpecificationExtension } from './specification-extension';\nexport interface OpenAPIObject extends ISpecificationExtension {\n openapi: string;\n info: InfoObject;\n servers?: ServerObject[];\n paths: PathsObject;\n components?: ComponentsObject;\n security?: SecurityRequirementObject[];\n tags?: TagObject[];\n externalDocs?: ExternalDocumentationObject;\n}\nexport interface InfoObject extends ISpecificationExtension {\n title: string;\n description?: string;\n termsOfService?: string;\n contact?: ContactObject;\n license?: LicenseObject;\n version: string;\n}\nexport interface ContactObject extends ISpecificationExtension {\n name?: string;\n url?: string;\n email?: string;\n}\nexport interface LicenseObject extends ISpecificationExtension {\n name: string;\n url?: string;\n}\nexport interface ComponentsObject extends ISpecificationExtension {\n schemas?: {\n [schema: string]: SchemaObject | ReferenceObject;\n };\n responses?: {\n [response: string]: ResponseObject | ReferenceObject;\n };\n parameters?: {\n [parameter: string]: ParameterObject | ReferenceObject;\n };\n examples?: {\n [example: string]: ExampleObject | ReferenceObject;\n };\n requestBodies?: {\n [request: string]: RequestBodyObject | ReferenceObject;\n };\n headers?: {\n [header: string]: HeaderObject | ReferenceObject;\n };\n securitySchemes?: {\n [securityScheme: string]: SecuritySchemeObject | ReferenceObject;\n };\n links?: {\n [link: string]: LinkObject | ReferenceObject;\n };\n callbacks?: {\n [callback: string]: CallbackObject | ReferenceObject;\n };\n}\nexport interface PathsObject extends ISpecificationExtension {\n [path: string]: PathItemObject;\n}\nexport type PathObject = PathsObject;\nexport declare function getPath(pathsObject: PathsObject, path: string): PathItemObject | undefined;\nexport interface PathItemObject extends ISpecificationExtension {\n $ref?: string;\n summary?: string;\n description?: string;\n get?: OperationObject;\n put?: OperationObject;\n post?: OperationObject;\n delete?: OperationObject;\n options?: OperationObject;\n head?: OperationObject;\n patch?: OperationObject;\n trace?: OperationObject;\n servers?: ServerObject[];\n parameters?: (ParameterObject | ReferenceObject)[];\n}\nexport interface OperationObject extends ISpecificationExtension {\n tags?: string[];\n summary?: string;\n description?: string;\n externalDocs?: ExternalDocumentationObject;\n operationId?: string;\n parameters?: (ParameterObject | ReferenceObject)[];\n requestBody?: RequestBodyObject | ReferenceObject;\n responses: ResponsesObject;\n callbacks?: CallbacksObject;\n deprecated?: boolean;\n security?: SecurityRequirementObject[];\n servers?: ServerObject[];\n}\nexport interface ExternalDocumentationObject extends ISpecificationExtension {\n description?: string;\n url: string;\n}\nexport type ParameterLocation = 'query' | 'header' | 'path' | 'cookie';\nexport type ParameterStyle = 'matrix' | 'label' | 'form' | 'simple' | 'spaceDelimited' | 'pipeDelimited' | 'deepObject';\nexport interface BaseParameterObject extends ISpecificationExtension {\n description?: string;\n required?: boolean;\n deprecated?: boolean;\n allowEmptyValue?: boolean;\n style?: ParameterStyle;\n explode?: boolean;\n allowReserved?: boolean;\n schema?: SchemaObject | ReferenceObject;\n examples?: {\n [param: string]: ExampleObject | ReferenceObject;\n };\n example?: any;\n content?: ContentObject;\n}\nexport interface ParameterObject extends BaseParameterObject {\n name: string;\n in: ParameterLocation;\n}\nexport interface RequestBodyObject extends ISpecificationExtension {\n description?: string;\n content: ContentObject;\n required?: boolean;\n}\nexport interface ContentObject {\n [mediatype: string]: MediaTypeObject;\n}\nexport interface MediaTypeObject extends ISpecificationExtension {\n schema?: SchemaObject | ReferenceObject;\n examples?: ExamplesObject;\n example?: any;\n encoding?: EncodingObject;\n}\nexport interface EncodingObject extends ISpecificationExtension {\n [property: string]: EncodingPropertyObject | any;\n}\nexport interface EncodingPropertyObject {\n contentType?: string;\n headers?: {\n [key: string]: HeaderObject | ReferenceObject;\n };\n style?: string;\n explode?: boolean;\n allowReserved?: boolean;\n [key: string]: any;\n}\nexport interface ResponsesObject extends ISpecificationExtension {\n default?: ResponseObject | ReferenceObject;\n [statuscode: string]: ResponseObject | ReferenceObject | any;\n}\nexport interface ResponseObject extends ISpecificationExtension {\n description: string;\n headers?: HeadersObject;\n content?: ContentObject;\n links?: LinksObject;\n}\nexport interface CallbacksObject extends ISpecificationExtension {\n [name: string]: CallbackObject | ReferenceObject | any;\n}\nexport interface CallbackObject extends ISpecificationExtension {\n [name: string]: PathItemObject | any;\n}\nexport interface HeadersObject {\n [name: string]: HeaderObject | ReferenceObject;\n}\nexport interface ExampleObject {\n summary?: string;\n description?: string;\n value?: any;\n externalValue?: string;\n [property: string]: any;\n}\nexport interface LinksObject {\n [name: string]: LinkObject | ReferenceObject;\n}\nexport interface LinkObject extends ISpecificationExtension {\n operationRef?: string;\n operationId?: string;\n parameters?: LinkParametersObject;\n requestBody?: any | string;\n description?: string;\n server?: ServerObject;\n [property: string]: any;\n}\nexport interface LinkParametersObject {\n [name: string]: any | string;\n}\nexport interface HeaderObject extends BaseParameterObject {\n $ref?: string;\n}\nexport interface TagObject extends ISpecificationExtension {\n name: string;\n description?: string;\n externalDocs?: ExternalDocumentationObject;\n [extension: string]: any;\n}\nexport interface ExamplesObject {\n [name: string]: ExampleObject | ReferenceObject;\n}\nexport interface ReferenceObject {\n $ref: string;\n}\nexport declare function isReferenceObject(obj: any): obj is ReferenceObject;\nexport type SchemaObjectType = 'integer' | 'number' | 'string' | 'boolean' | 'object' | 'null' | 'array';\nexport type SchemaObjectFormat = 'int32' | 'int64' | 'float' | 'double' | 'byte' | 'binary' | 'date' | 'date-time' | 'password' | string;\nexport interface SchemaObject extends ISpecificationExtension {\n nullable?: boolean;\n discriminator?: DiscriminatorObject;\n readOnly?: boolean;\n writeOnly?: boolean;\n xml?: XmlObject;\n externalDocs?: ExternalDocumentationObject;\n example?: any;\n examples?: any[];\n deprecated?: boolean;\n type?: SchemaObjectType | SchemaObjectType[];\n format?: SchemaObjectFormat;\n allOf?: (SchemaObject | ReferenceObject)[];\n oneOf?: (SchemaObject | ReferenceObject)[];\n anyOf?: (SchemaObject | ReferenceObject)[];\n not?: SchemaObject | ReferenceObject;\n items?: SchemaObject | ReferenceObject;\n properties?: {\n [propertyName: string]: SchemaObject | ReferenceObject;\n };\n additionalProperties?: SchemaObject | ReferenceObject | boolean;\n description?: string;\n default?: any;\n title?: string;\n multipleOf?: number;\n maximum?: number;\n exclusiveMaximum?: boolean;\n minimum?: number;\n exclusiveMinimum?: boolean;\n maxLength?: number;\n minLength?: number;\n pattern?: string;\n maxItems?: number;\n minItems?: number;\n uniqueItems?: boolean;\n maxProperties?: number;\n minProperties?: number;\n required?: string[];\n enum?: any[];\n}\nexport declare function isSchemaObject(schema: SchemaObject | ReferenceObject): schema is SchemaObject;\nexport interface SchemasObject {\n [schema: string]: SchemaObject;\n}\nexport interface DiscriminatorObject {\n propertyName: string;\n mapping?: {\n [key: string]: string;\n };\n}\nexport interface XmlObject extends ISpecificationExtension {\n name?: string;\n namespace?: string;\n prefix?: string;\n attribute?: boolean;\n wrapped?: boolean;\n}\nexport type SecuritySchemeType = 'apiKey' | 'http' | 'oauth2' | 'openIdConnect';\nexport interface SecuritySchemeObject extends ISpecificationExtension {\n type: SecuritySchemeType;\n description?: string;\n name?: string;\n in?: string;\n scheme?: string;\n bearerFormat?: string;\n flows?: OAuthFlowsObject;\n openIdConnectUrl?: string;\n}\nexport interface OAuthFlowsObject extends ISpecificationExtension {\n implicit?: OAuthFlowObject;\n password?: OAuthFlowObject;\n clientCredentials?: OAuthFlowObject;\n authorizationCode?: OAuthFlowObject;\n}\nexport interface OAuthFlowObject extends ISpecificationExtension {\n authorizationUrl?: string;\n tokenUrl?: string;\n refreshUrl?: string;\n scopes: ScopesObject;\n}\nexport interface ScopesObject extends ISpecificationExtension {\n [scope: string]: any;\n}\nexport interface SecurityRequirementObject {\n [name: string]: string[];\n}\n"],"x_google_ignoreList":[0],"mappings":";;;;UA8FiBS,2BAAAA,SAAoCR;;;;KAIzC2B,iBAAAA;KACAC,cAAAA;UACKC,mBAAAA,SAA4B7B;;;;;UAKjC4B;;;WAGCjB,eAAeC;;qBAEHG,gBAAgBH;;;YAG3BkB;;UAEGhB,eAAAA,SAAwBe;;MAEjCF;;UAOSG,aAAAA;uBACQC;;UAERA,eAAAA,SAAwB/B;WAC5BW,eAAeC;aACboB;;aAEAC;;UAEEA,cAAAA,SAAuBjC;sBAChBkC;;UAEPA,sBAAAA;;;mBAGMjB,eAAeL;;;;;;;UA0BrBG,aAAAA;;;;;;;UAsBAE,YAAAA,SAAqBY;;;UASrBG,cAAAA;kBACGjB,gBAAgBH;;UAEnBA,eAAAA;;;KAIL2B,gBAAAA;KACAC,kBAAAA;UACK7B,YAAAA,SAAqBX;;kBAElByC;;;QAGVC;iBACSlC;;;;SAIR+B,mBAAmBA;WACjBC;WACA7B,eAAeC;WACfD,eAAeC;WACfD,eAAeC;QAClBD,eAAeC;UACbD,eAAeC;;4BAEKD,eAAeC;;yBAEpBD,eAAeC;;;;;;;;;;;;;;;;;;;;UAwBzB6B,mBAAAA;;;;;;UAMAC,SAAAA,SAAkB1C"}
package/openapi31.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { ISpecificationExtension } from "./specification-extension.js";
2
2
 
3
- //#region ../../node_modules/.bun/openapi3-ts@4.5.0/node_modules/openapi3-ts/dist/model/openapi31.d.ts
3
+ //#region ../../node_modules/openapi3-ts/dist/model/openapi31.d.ts
4
4
 
5
5
  interface ExternalDocumentationObject extends ISpecificationExtension {
6
6
  description?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"openapi31.d.ts","names":["ServerObject","ISpecificationExtension","SpecificationExtension","OpenAPIObject","InfoObject","PathsObject","ComponentsObject","SecurityRequirementObject","TagObject","ExternalDocumentationObject","ContactObject","LicenseObject","SchemaObject","ReferenceObject","ResponseObject","ParameterObject","ExampleObject","RequestBodyObject","HeaderObject","SecuritySchemeObject","LinkObject","CallbackObject","PathItemObject","PathObject","getPath","OperationObject","ResponsesObject","CallbacksObject","ParameterLocation","ParameterStyle","BaseParameterObject","ContentObject","MediaTypeObject","ExamplesObject","EncodingObject","EncodingPropertyObject","HeadersObject","LinksObject","LinkParametersObject","isReferenceObject","SchemaObjectType","DiscriminatorObject","XmlObject","isSchemaObject","SchemasObject","SecuritySchemeType","OAuthFlowsObject","OAuthFlowObject","ScopesObject"],"sources":["../../../node_modules/.bun/openapi3-ts@4.5.0/node_modules/openapi3-ts/dist/model/openapi31.d.ts"],"sourcesContent":["import { ServerObject } from './oas-common';\nimport { ISpecificationExtension } from './specification-extension';\nexport * from './oas-common';\nexport type { ISpecificationExtension, SpecificationExtension } from './specification-extension';\nexport interface OpenAPIObject extends ISpecificationExtension {\n openapi: string;\n info: InfoObject;\n servers?: ServerObject[];\n paths?: PathsObject;\n components?: ComponentsObject;\n security?: SecurityRequirementObject[];\n tags?: TagObject[];\n externalDocs?: ExternalDocumentationObject;\n webhooks?: PathsObject;\n}\nexport interface InfoObject extends ISpecificationExtension {\n title: string;\n description?: string;\n termsOfService?: string;\n contact?: ContactObject;\n license?: LicenseObject;\n version: string;\n}\nexport interface ContactObject extends ISpecificationExtension {\n name?: string;\n url?: string;\n email?: string;\n}\nexport interface LicenseObject extends ISpecificationExtension {\n name: string;\n identifier?: string;\n url?: string;\n}\nexport interface ComponentsObject extends ISpecificationExtension {\n schemas?: {\n [schema: string]: SchemaObject | ReferenceObject;\n };\n responses?: {\n [response: string]: ResponseObject | ReferenceObject;\n };\n parameters?: {\n [parameter: string]: ParameterObject | ReferenceObject;\n };\n examples?: {\n [example: string]: ExampleObject | ReferenceObject;\n };\n requestBodies?: {\n [request: string]: RequestBodyObject | ReferenceObject;\n };\n headers?: {\n [header: string]: HeaderObject | ReferenceObject;\n };\n securitySchemes?: {\n [securityScheme: string]: SecuritySchemeObject | ReferenceObject;\n };\n links?: {\n [link: string]: LinkObject | ReferenceObject;\n };\n callbacks?: {\n [callback: string]: CallbackObject | ReferenceObject;\n };\n pathItems?: {\n [pathItem: string]: PathItemObject | ReferenceObject;\n };\n}\nexport interface PathsObject extends ISpecificationExtension {\n [path: string]: PathItemObject;\n}\nexport type PathObject = PathsObject;\nexport declare function getPath(pathsObject: PathsObject | undefined, path: string): PathItemObject | undefined;\nexport interface PathItemObject extends ISpecificationExtension {\n $ref?: string;\n summary?: string;\n description?: string;\n get?: OperationObject;\n put?: OperationObject;\n post?: OperationObject;\n delete?: OperationObject;\n options?: OperationObject;\n head?: OperationObject;\n patch?: OperationObject;\n trace?: OperationObject;\n servers?: ServerObject[];\n parameters?: (ParameterObject | ReferenceObject)[];\n}\nexport interface OperationObject extends ISpecificationExtension {\n tags?: string[];\n summary?: string;\n description?: string;\n externalDocs?: ExternalDocumentationObject;\n operationId?: string;\n parameters?: (ParameterObject | ReferenceObject)[];\n requestBody?: RequestBodyObject | ReferenceObject;\n responses?: ResponsesObject;\n callbacks?: CallbacksObject;\n deprecated?: boolean;\n security?: SecurityRequirementObject[];\n servers?: ServerObject[];\n}\nexport interface ExternalDocumentationObject extends ISpecificationExtension {\n description?: string;\n url: string;\n}\nexport type ParameterLocation = 'query' | 'header' | 'path' | 'cookie';\nexport type ParameterStyle = 'matrix' | 'label' | 'form' | 'simple' | 'spaceDelimited' | 'pipeDelimited' | 'deepObject';\nexport interface BaseParameterObject extends ISpecificationExtension {\n description?: string;\n required?: boolean;\n deprecated?: boolean;\n allowEmptyValue?: boolean;\n style?: ParameterStyle;\n explode?: boolean;\n allowReserved?: boolean;\n schema?: SchemaObject | ReferenceObject;\n examples?: {\n [param: string]: ExampleObject | ReferenceObject;\n };\n example?: any;\n content?: ContentObject;\n}\nexport interface ParameterObject extends BaseParameterObject {\n name: string;\n in: ParameterLocation;\n}\nexport interface RequestBodyObject extends ISpecificationExtension {\n description?: string;\n content: ContentObject;\n required?: boolean;\n}\nexport interface ContentObject {\n [mediatype: string]: MediaTypeObject;\n}\nexport interface MediaTypeObject extends ISpecificationExtension {\n schema?: SchemaObject | ReferenceObject;\n examples?: ExamplesObject;\n example?: any;\n encoding?: EncodingObject;\n}\nexport interface EncodingObject extends ISpecificationExtension {\n [property: string]: EncodingPropertyObject | any;\n}\nexport interface EncodingPropertyObject {\n contentType?: string;\n headers?: {\n [key: string]: HeaderObject | ReferenceObject;\n };\n style?: string;\n explode?: boolean;\n allowReserved?: boolean;\n [key: string]: any;\n}\nexport interface ResponsesObject extends ISpecificationExtension {\n default?: ResponseObject | ReferenceObject;\n [statuscode: string]: ResponseObject | ReferenceObject | any;\n}\nexport interface ResponseObject extends ISpecificationExtension {\n description: string;\n headers?: HeadersObject;\n content?: ContentObject;\n links?: LinksObject;\n}\nexport interface CallbacksObject extends ISpecificationExtension {\n [name: string]: CallbackObject | ReferenceObject | any;\n}\nexport interface CallbackObject extends ISpecificationExtension {\n [name: string]: PathItemObject | any;\n}\nexport interface HeadersObject {\n [name: string]: HeaderObject | ReferenceObject;\n}\nexport interface ExampleObject {\n summary?: string;\n description?: string;\n value?: any;\n externalValue?: string;\n [property: string]: any;\n}\nexport interface LinksObject {\n [name: string]: LinkObject | ReferenceObject;\n}\nexport interface LinkObject extends ISpecificationExtension {\n operationRef?: string;\n operationId?: string;\n parameters?: LinkParametersObject;\n requestBody?: any | string;\n description?: string;\n server?: ServerObject;\n [property: string]: any;\n}\nexport interface LinkParametersObject {\n [name: string]: any | string;\n}\nexport interface HeaderObject extends BaseParameterObject {\n $ref?: string;\n}\nexport interface TagObject extends ISpecificationExtension {\n name: string;\n description?: string;\n externalDocs?: ExternalDocumentationObject;\n [extension: string]: any;\n}\nexport interface ExamplesObject {\n [name: string]: ExampleObject | ReferenceObject;\n}\nexport interface ReferenceObject {\n $ref: string;\n summary?: string;\n description?: string;\n}\nexport declare function isReferenceObject(obj: any): obj is ReferenceObject;\nexport type SchemaObjectType = 'integer' | 'number' | 'string' | 'boolean' | 'object' | 'null' | 'array';\nexport interface SchemaObject extends ISpecificationExtension {\n $ref?: string;\n discriminator?: DiscriminatorObject;\n readOnly?: boolean;\n writeOnly?: boolean;\n xml?: XmlObject;\n externalDocs?: ExternalDocumentationObject;\n example?: any;\n examples?: any[];\n deprecated?: boolean;\n type?: SchemaObjectType | SchemaObjectType[];\n format?: 'int32' | 'int64' | 'float' | 'double' | 'byte' | 'binary' | 'date' | 'date-time' | 'password' | string;\n allOf?: (SchemaObject | ReferenceObject)[];\n oneOf?: (SchemaObject | ReferenceObject)[];\n anyOf?: (SchemaObject | ReferenceObject)[];\n not?: SchemaObject | ReferenceObject;\n items?: SchemaObject | ReferenceObject;\n properties?: {\n [propertyName: string]: SchemaObject | ReferenceObject;\n };\n additionalProperties?: SchemaObject | ReferenceObject | boolean;\n propertyNames?: SchemaObject | ReferenceObject;\n description?: string;\n default?: any;\n title?: string;\n multipleOf?: number;\n maximum?: number;\n const?: any;\n exclusiveMaximum?: number;\n minimum?: number;\n exclusiveMinimum?: number;\n maxLength?: number;\n minLength?: number;\n pattern?: string;\n maxItems?: number;\n minItems?: number;\n uniqueItems?: boolean;\n maxProperties?: number;\n minProperties?: number;\n required?: string[];\n enum?: any[];\n prefixItems?: (SchemaObject | ReferenceObject)[];\n contentMediaType?: string;\n contentEncoding?: string;\n}\nexport declare function isSchemaObject(schema: SchemaObject | ReferenceObject): schema is SchemaObject;\nexport interface SchemasObject {\n [schema: string]: SchemaObject;\n}\nexport interface DiscriminatorObject {\n propertyName: string;\n mapping?: {\n [key: string]: string;\n };\n}\nexport interface XmlObject extends ISpecificationExtension {\n name?: string;\n namespace?: string;\n prefix?: string;\n attribute?: boolean;\n wrapped?: boolean;\n}\nexport type SecuritySchemeType = 'apiKey' | 'http' | 'oauth2' | 'openIdConnect';\nexport interface SecuritySchemeObject extends ISpecificationExtension {\n type: SecuritySchemeType;\n description?: string;\n name?: string;\n in?: string;\n scheme?: string;\n bearerFormat?: string;\n flows?: OAuthFlowsObject;\n openIdConnectUrl?: string;\n}\nexport interface OAuthFlowsObject extends ISpecificationExtension {\n implicit?: OAuthFlowObject;\n password?: OAuthFlowObject;\n clientCredentials?: OAuthFlowObject;\n authorizationCode?: OAuthFlowObject;\n}\nexport interface OAuthFlowObject extends ISpecificationExtension {\n authorizationUrl?: string;\n tokenUrl?: string;\n refreshUrl?: string;\n scopes: ScopesObject;\n}\nexport interface ScopesObject extends ISpecificationExtension {\n [scope: string]: any;\n}\nexport interface SecurityRequirementObject {\n [name: string]: string[];\n}\n"],"x_google_ignoreList":[0],"mappings":";;;;UAmGiBS,2BAAAA,SAAoCR;;;;KAIzC2B,iBAAAA;KACAC,cAAAA;UACKC,mBAAAA,SAA4B7B;;;;;UAKjC4B;;;WAGCjB,eAAeC;;qBAEHG,gBAAgBH;;;YAG3BkB;;UAEGhB,eAAAA,SAAwBe;;MAEjCF;;UAOSG,aAAAA;uBACQC;;UAERA,eAAAA,SAAwB/B;WAC5BW,eAAeC;aACboB;;aAEAC;;UAEEA,cAAAA,SAAuBjC;sBAChBkC;;UAEPA,sBAAAA;;;mBAGMjB,eAAeL;;;;;;;UA0BrBG,aAAAA;;;;;;;UAsBAE,YAAAA,SAAqBY;;;UASrBG,cAAAA;kBACGjB,gBAAgBH;;UAEnBA,eAAAA;;;;;KAML2B,gBAAAA;UACK5B,YAAAA,SAAqBX;;kBAElBwC;;;QAGVC;iBACSjC;;;;SAIR+B,mBAAmBA;;WAEjB5B,eAAeC;WACfD,eAAeC;WACfD,eAAeC;QAClBD,eAAeC;UACbD,eAAeC;;4BAEKD,eAAeC;;yBAEpBD,eAAeC;kBACtBD,eAAeC;;;;;;;;;;;;;;;;;;;;iBAoBhBD,eAAeC;;;;UAQjB4B,mBAAAA;;;;;;UAMAC,SAAAA,SAAkBzC"}
1
+ {"version":3,"file":"openapi31.d.ts","names":["ServerObject","ISpecificationExtension","SpecificationExtension","OpenAPIObject","InfoObject","PathsObject","ComponentsObject","SecurityRequirementObject","TagObject","ExternalDocumentationObject","ContactObject","LicenseObject","SchemaObject","ReferenceObject","ResponseObject","ParameterObject","ExampleObject","RequestBodyObject","HeaderObject","SecuritySchemeObject","LinkObject","CallbackObject","PathItemObject","PathObject","getPath","OperationObject","ResponsesObject","CallbacksObject","ParameterLocation","ParameterStyle","BaseParameterObject","ContentObject","MediaTypeObject","ExamplesObject","EncodingObject","EncodingPropertyObject","HeadersObject","LinksObject","LinkParametersObject","isReferenceObject","SchemaObjectType","DiscriminatorObject","XmlObject","isSchemaObject","SchemasObject","SecuritySchemeType","OAuthFlowsObject","OAuthFlowObject","ScopesObject"],"sources":["../../../node_modules/openapi3-ts/dist/model/openapi31.d.ts"],"sourcesContent":["import { ServerObject } from './oas-common';\nimport { ISpecificationExtension } from './specification-extension';\nexport * from './oas-common';\nexport type { ISpecificationExtension, SpecificationExtension } from './specification-extension';\nexport interface OpenAPIObject extends ISpecificationExtension {\n openapi: string;\n info: InfoObject;\n servers?: ServerObject[];\n paths?: PathsObject;\n components?: ComponentsObject;\n security?: SecurityRequirementObject[];\n tags?: TagObject[];\n externalDocs?: ExternalDocumentationObject;\n webhooks?: PathsObject;\n}\nexport interface InfoObject extends ISpecificationExtension {\n title: string;\n description?: string;\n termsOfService?: string;\n contact?: ContactObject;\n license?: LicenseObject;\n version: string;\n}\nexport interface ContactObject extends ISpecificationExtension {\n name?: string;\n url?: string;\n email?: string;\n}\nexport interface LicenseObject extends ISpecificationExtension {\n name: string;\n identifier?: string;\n url?: string;\n}\nexport interface ComponentsObject extends ISpecificationExtension {\n schemas?: {\n [schema: string]: SchemaObject | ReferenceObject;\n };\n responses?: {\n [response: string]: ResponseObject | ReferenceObject;\n };\n parameters?: {\n [parameter: string]: ParameterObject | ReferenceObject;\n };\n examples?: {\n [example: string]: ExampleObject | ReferenceObject;\n };\n requestBodies?: {\n [request: string]: RequestBodyObject | ReferenceObject;\n };\n headers?: {\n [header: string]: HeaderObject | ReferenceObject;\n };\n securitySchemes?: {\n [securityScheme: string]: SecuritySchemeObject | ReferenceObject;\n };\n links?: {\n [link: string]: LinkObject | ReferenceObject;\n };\n callbacks?: {\n [callback: string]: CallbackObject | ReferenceObject;\n };\n pathItems?: {\n [pathItem: string]: PathItemObject | ReferenceObject;\n };\n}\nexport interface PathsObject extends ISpecificationExtension {\n [path: string]: PathItemObject;\n}\nexport type PathObject = PathsObject;\nexport declare function getPath(pathsObject: PathsObject | undefined, path: string): PathItemObject | undefined;\nexport interface PathItemObject extends ISpecificationExtension {\n $ref?: string;\n summary?: string;\n description?: string;\n get?: OperationObject;\n put?: OperationObject;\n post?: OperationObject;\n delete?: OperationObject;\n options?: OperationObject;\n head?: OperationObject;\n patch?: OperationObject;\n trace?: OperationObject;\n servers?: ServerObject[];\n parameters?: (ParameterObject | ReferenceObject)[];\n}\nexport interface OperationObject extends ISpecificationExtension {\n tags?: string[];\n summary?: string;\n description?: string;\n externalDocs?: ExternalDocumentationObject;\n operationId?: string;\n parameters?: (ParameterObject | ReferenceObject)[];\n requestBody?: RequestBodyObject | ReferenceObject;\n responses?: ResponsesObject;\n callbacks?: CallbacksObject;\n deprecated?: boolean;\n security?: SecurityRequirementObject[];\n servers?: ServerObject[];\n}\nexport interface ExternalDocumentationObject extends ISpecificationExtension {\n description?: string;\n url: string;\n}\nexport type ParameterLocation = 'query' | 'header' | 'path' | 'cookie';\nexport type ParameterStyle = 'matrix' | 'label' | 'form' | 'simple' | 'spaceDelimited' | 'pipeDelimited' | 'deepObject';\nexport interface BaseParameterObject extends ISpecificationExtension {\n description?: string;\n required?: boolean;\n deprecated?: boolean;\n allowEmptyValue?: boolean;\n style?: ParameterStyle;\n explode?: boolean;\n allowReserved?: boolean;\n schema?: SchemaObject | ReferenceObject;\n examples?: {\n [param: string]: ExampleObject | ReferenceObject;\n };\n example?: any;\n content?: ContentObject;\n}\nexport interface ParameterObject extends BaseParameterObject {\n name: string;\n in: ParameterLocation;\n}\nexport interface RequestBodyObject extends ISpecificationExtension {\n description?: string;\n content: ContentObject;\n required?: boolean;\n}\nexport interface ContentObject {\n [mediatype: string]: MediaTypeObject;\n}\nexport interface MediaTypeObject extends ISpecificationExtension {\n schema?: SchemaObject | ReferenceObject;\n examples?: ExamplesObject;\n example?: any;\n encoding?: EncodingObject;\n}\nexport interface EncodingObject extends ISpecificationExtension {\n [property: string]: EncodingPropertyObject | any;\n}\nexport interface EncodingPropertyObject {\n contentType?: string;\n headers?: {\n [key: string]: HeaderObject | ReferenceObject;\n };\n style?: string;\n explode?: boolean;\n allowReserved?: boolean;\n [key: string]: any;\n}\nexport interface ResponsesObject extends ISpecificationExtension {\n default?: ResponseObject | ReferenceObject;\n [statuscode: string]: ResponseObject | ReferenceObject | any;\n}\nexport interface ResponseObject extends ISpecificationExtension {\n description: string;\n headers?: HeadersObject;\n content?: ContentObject;\n links?: LinksObject;\n}\nexport interface CallbacksObject extends ISpecificationExtension {\n [name: string]: CallbackObject | ReferenceObject | any;\n}\nexport interface CallbackObject extends ISpecificationExtension {\n [name: string]: PathItemObject | any;\n}\nexport interface HeadersObject {\n [name: string]: HeaderObject | ReferenceObject;\n}\nexport interface ExampleObject {\n summary?: string;\n description?: string;\n value?: any;\n externalValue?: string;\n [property: string]: any;\n}\nexport interface LinksObject {\n [name: string]: LinkObject | ReferenceObject;\n}\nexport interface LinkObject extends ISpecificationExtension {\n operationRef?: string;\n operationId?: string;\n parameters?: LinkParametersObject;\n requestBody?: any | string;\n description?: string;\n server?: ServerObject;\n [property: string]: any;\n}\nexport interface LinkParametersObject {\n [name: string]: any | string;\n}\nexport interface HeaderObject extends BaseParameterObject {\n $ref?: string;\n}\nexport interface TagObject extends ISpecificationExtension {\n name: string;\n description?: string;\n externalDocs?: ExternalDocumentationObject;\n [extension: string]: any;\n}\nexport interface ExamplesObject {\n [name: string]: ExampleObject | ReferenceObject;\n}\nexport interface ReferenceObject {\n $ref: string;\n summary?: string;\n description?: string;\n}\nexport declare function isReferenceObject(obj: any): obj is ReferenceObject;\nexport type SchemaObjectType = 'integer' | 'number' | 'string' | 'boolean' | 'object' | 'null' | 'array';\nexport interface SchemaObject extends ISpecificationExtension {\n $ref?: string;\n discriminator?: DiscriminatorObject;\n readOnly?: boolean;\n writeOnly?: boolean;\n xml?: XmlObject;\n externalDocs?: ExternalDocumentationObject;\n example?: any;\n examples?: any[];\n deprecated?: boolean;\n type?: SchemaObjectType | SchemaObjectType[];\n format?: 'int32' | 'int64' | 'float' | 'double' | 'byte' | 'binary' | 'date' | 'date-time' | 'password' | string;\n allOf?: (SchemaObject | ReferenceObject)[];\n oneOf?: (SchemaObject | ReferenceObject)[];\n anyOf?: (SchemaObject | ReferenceObject)[];\n not?: SchemaObject | ReferenceObject;\n items?: SchemaObject | ReferenceObject;\n properties?: {\n [propertyName: string]: SchemaObject | ReferenceObject;\n };\n additionalProperties?: SchemaObject | ReferenceObject | boolean;\n propertyNames?: SchemaObject | ReferenceObject;\n description?: string;\n default?: any;\n title?: string;\n multipleOf?: number;\n maximum?: number;\n const?: any;\n exclusiveMaximum?: number;\n minimum?: number;\n exclusiveMinimum?: number;\n maxLength?: number;\n minLength?: number;\n pattern?: string;\n maxItems?: number;\n minItems?: number;\n uniqueItems?: boolean;\n maxProperties?: number;\n minProperties?: number;\n required?: string[];\n enum?: any[];\n prefixItems?: (SchemaObject | ReferenceObject)[];\n contentMediaType?: string;\n contentEncoding?: string;\n}\nexport declare function isSchemaObject(schema: SchemaObject | ReferenceObject): schema is SchemaObject;\nexport interface SchemasObject {\n [schema: string]: SchemaObject;\n}\nexport interface DiscriminatorObject {\n propertyName: string;\n mapping?: {\n [key: string]: string;\n };\n}\nexport interface XmlObject extends ISpecificationExtension {\n name?: string;\n namespace?: string;\n prefix?: string;\n attribute?: boolean;\n wrapped?: boolean;\n}\nexport type SecuritySchemeType = 'apiKey' | 'http' | 'oauth2' | 'openIdConnect';\nexport interface SecuritySchemeObject extends ISpecificationExtension {\n type: SecuritySchemeType;\n description?: string;\n name?: string;\n in?: string;\n scheme?: string;\n bearerFormat?: string;\n flows?: OAuthFlowsObject;\n openIdConnectUrl?: string;\n}\nexport interface OAuthFlowsObject extends ISpecificationExtension {\n implicit?: OAuthFlowObject;\n password?: OAuthFlowObject;\n clientCredentials?: OAuthFlowObject;\n authorizationCode?: OAuthFlowObject;\n}\nexport interface OAuthFlowObject extends ISpecificationExtension {\n authorizationUrl?: string;\n tokenUrl?: string;\n refreshUrl?: string;\n scopes: ScopesObject;\n}\nexport interface ScopesObject extends ISpecificationExtension {\n [scope: string]: any;\n}\nexport interface SecurityRequirementObject {\n [name: string]: string[];\n}\n"],"x_google_ignoreList":[0],"mappings":";;;;UAmGiBS,2BAAAA,SAAoCR;;;;KAIzC2B,iBAAAA;KACAC,cAAAA;UACKC,mBAAAA,SAA4B7B;;;;;UAKjC4B;;;WAGCjB,eAAeC;;qBAEHG,gBAAgBH;;;YAG3BkB;;UAEGhB,eAAAA,SAAwBe;;MAEjCF;;UAOSG,aAAAA;uBACQC;;UAERA,eAAAA,SAAwB/B;WAC5BW,eAAeC;aACboB;;aAEAC;;UAEEA,cAAAA,SAAuBjC;sBAChBkC;;UAEPA,sBAAAA;;;mBAGMjB,eAAeL;;;;;;;UA0BrBG,aAAAA;;;;;;;UAsBAE,YAAAA,SAAqBY;;;UASrBG,cAAAA;kBACGjB,gBAAgBH;;UAEnBA,eAAAA;;;;;KAML2B,gBAAAA;UACK5B,YAAAA,SAAqBX;;kBAElBwC;;;QAGVC;iBACSjC;;;;SAIR+B,mBAAmBA;;WAEjB5B,eAAeC;WACfD,eAAeC;WACfD,eAAeC;QAClBD,eAAeC;UACbD,eAAeC;;4BAEKD,eAAeC;;yBAEpBD,eAAeC;kBACtBD,eAAeC;;;;;;;;;;;;;;;;;;;;iBAoBhBD,eAAeC;;;;UAQjB4B,mBAAAA;;;;;;UAMAC,SAAAA,SAAkBzC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cossistant/react",
3
3
  "type": "module",
4
- "version": "0.0.26",
4
+ "version": "0.0.28",
5
5
  "private": false,
6
6
  "author": "Cossistant team",
7
7
  "description": "Headless React SDK for building AI-powered support/chat widgets. Hooks + primitives, WS-driven, TypeScript-first. Next.js-ready, Tailwind optional.",
@@ -88,8 +88,9 @@
88
88
  "*.css"
89
89
  ],
90
90
  "dependencies": {
91
- "@cossistant/core": "0.0.26",
92
- "@cossistant/types": "0.0.26",
91
+ "@cossistant/core": "0.0.28",
92
+ "@cossistant/types": "0.0.28",
93
+ "@floating-ui/react": "^0.27.16",
93
94
  "class-variance-authority": "^0.7.1",
94
95
  "clsx": "^2.1.1",
95
96
  "nanoid": "^5.1.5",
package/parse.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { ZodError } from "./errors2.js";
2
2
 
3
- //#region ../../node_modules/.bun/zod@4.1.12/node_modules/zod/v4/classic/parse.d.cts
3
+ //#region ../../node_modules/zod/v4/classic/parse.d.cts
4
4
  type ZodSafeParseResult<T> = ZodSafeParseSuccess<T> | ZodSafeParseError<T>;
5
5
  type ZodSafeParseSuccess<T> = {
6
6
  success: true;
package/parse.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"parse.d.ts","names":["core","ZodError","ZodSafeParseResult","T","ZodSafeParseSuccess","ZodSafeParseError","parse","$ZodType","$ZodIssue","ParseContext","util","AnyFunc","$ZodErrorClass","output","parseAsync","Promise","safeParse","safeParseAsync","encode","input","decode","encodeAsync","decodeAsync","safeEncode","safeDecode","safeEncodeAsync","safeDecodeAsync"],"sources":["../../../node_modules/.bun/zod@4.1.12/node_modules/zod/v4/classic/parse.d.cts"],"sourcesContent":["import * as core from \"../core/index.cjs\";\nimport { type ZodError } from \"./errors.cjs\";\nexport type ZodSafeParseResult<T> = ZodSafeParseSuccess<T> | ZodSafeParseError<T>;\nexport type ZodSafeParseSuccess<T> = {\n success: true;\n data: T;\n error?: never;\n};\nexport type ZodSafeParseError<T> = {\n success: false;\n data?: never;\n error: ZodError<T>;\n};\nexport declare const parse: <T extends core.$ZodType>(schema: T, value: unknown, _ctx?: core.ParseContext<core.$ZodIssue>, _params?: {\n callee?: core.util.AnyFunc;\n Err?: core.$ZodErrorClass;\n}) => core.output<T>;\nexport declare const parseAsync: <T extends core.$ZodType>(schema: T, value: unknown, _ctx?: core.ParseContext<core.$ZodIssue>, _params?: {\n callee?: core.util.AnyFunc;\n Err?: core.$ZodErrorClass;\n}) => Promise<core.output<T>>;\nexport declare const safeParse: <T extends core.$ZodType>(schema: T, value: unknown, _ctx?: core.ParseContext<core.$ZodIssue>) => ZodSafeParseResult<core.output<T>>;\nexport declare const safeParseAsync: <T extends core.$ZodType>(schema: T, value: unknown, _ctx?: core.ParseContext<core.$ZodIssue>) => Promise<ZodSafeParseResult<core.output<T>>>;\nexport declare const encode: <T extends core.$ZodType>(schema: T, value: core.output<T>, _ctx?: core.ParseContext<core.$ZodIssue>) => core.input<T>;\nexport declare const decode: <T extends core.$ZodType>(schema: T, value: core.input<T>, _ctx?: core.ParseContext<core.$ZodIssue>) => core.output<T>;\nexport declare const encodeAsync: <T extends core.$ZodType>(schema: T, value: core.output<T>, _ctx?: core.ParseContext<core.$ZodIssue>) => Promise<core.input<T>>;\nexport declare const decodeAsync: <T extends core.$ZodType>(schema: T, value: core.input<T>, _ctx?: core.ParseContext<core.$ZodIssue>) => Promise<core.output<T>>;\nexport declare const safeEncode: <T extends core.$ZodType>(schema: T, value: core.output<T>, _ctx?: core.ParseContext<core.$ZodIssue>) => ZodSafeParseResult<core.input<T>>;\nexport declare const safeDecode: <T extends core.$ZodType>(schema: T, value: core.input<T>, _ctx?: core.ParseContext<core.$ZodIssue>) => ZodSafeParseResult<core.output<T>>;\nexport declare const safeEncodeAsync: <T extends core.$ZodType>(schema: T, value: core.output<T>, _ctx?: core.ParseContext<core.$ZodIssue>) => Promise<ZodSafeParseResult<core.input<T>>>;\nexport declare const safeDecodeAsync: <T extends core.$ZodType>(schema: T, value: core.input<T>, _ctx?: core.ParseContext<core.$ZodIssue>) => Promise<ZodSafeParseResult<core.output<T>>>;\n"],"x_google_ignoreList":[0],"mappings":";;;KAEYE,wBAAwBE,oBAAoBD,KAAKE,kBAAkBF;AAAnED,KACAE,mBADkB,CAAAD,CAAAA,CAAAA,GAAAA;EAA0BA,OAAAA,EAAAA,IAAAA;EAApBC,IAAAA,EAG1BD,CAH0BC;EAA2CD,KAAAA,CAAAA,EAAAA,KAAAA;CAAlBE;AAAiB,KAMlEA,iBANkE,CAAA,CAAA,CAAA,GAAA;EAClED,OAAAA,EAAAA,KAAAA;EAKAC,IAAAA,CAAAA,EAAAA,KAAAA;SAGDJ,SAASE"}
1
+ {"version":3,"file":"parse.d.ts","names":["core","ZodError","ZodSafeParseResult","T","ZodSafeParseSuccess","ZodSafeParseError","parse","$ZodType","$ZodIssue","ParseContext","util","AnyFunc","$ZodErrorClass","output","parseAsync","Promise","safeParse","safeParseAsync","encode","input","decode","encodeAsync","decodeAsync","safeEncode","safeDecode","safeEncodeAsync","safeDecodeAsync"],"sources":["../../../node_modules/zod/v4/classic/parse.d.cts"],"sourcesContent":["import * as core from \"../core/index.cjs\";\nimport { type ZodError } from \"./errors.cjs\";\nexport type ZodSafeParseResult<T> = ZodSafeParseSuccess<T> | ZodSafeParseError<T>;\nexport type ZodSafeParseSuccess<T> = {\n success: true;\n data: T;\n error?: never;\n};\nexport type ZodSafeParseError<T> = {\n success: false;\n data?: never;\n error: ZodError<T>;\n};\nexport declare const parse: <T extends core.$ZodType>(schema: T, value: unknown, _ctx?: core.ParseContext<core.$ZodIssue>, _params?: {\n callee?: core.util.AnyFunc;\n Err?: core.$ZodErrorClass;\n}) => core.output<T>;\nexport declare const parseAsync: <T extends core.$ZodType>(schema: T, value: unknown, _ctx?: core.ParseContext<core.$ZodIssue>, _params?: {\n callee?: core.util.AnyFunc;\n Err?: core.$ZodErrorClass;\n}) => Promise<core.output<T>>;\nexport declare const safeParse: <T extends core.$ZodType>(schema: T, value: unknown, _ctx?: core.ParseContext<core.$ZodIssue>) => ZodSafeParseResult<core.output<T>>;\nexport declare const safeParseAsync: <T extends core.$ZodType>(schema: T, value: unknown, _ctx?: core.ParseContext<core.$ZodIssue>) => Promise<ZodSafeParseResult<core.output<T>>>;\nexport declare const encode: <T extends core.$ZodType>(schema: T, value: core.output<T>, _ctx?: core.ParseContext<core.$ZodIssue>) => core.input<T>;\nexport declare const decode: <T extends core.$ZodType>(schema: T, value: core.input<T>, _ctx?: core.ParseContext<core.$ZodIssue>) => core.output<T>;\nexport declare const encodeAsync: <T extends core.$ZodType>(schema: T, value: core.output<T>, _ctx?: core.ParseContext<core.$ZodIssue>) => Promise<core.input<T>>;\nexport declare const decodeAsync: <T extends core.$ZodType>(schema: T, value: core.input<T>, _ctx?: core.ParseContext<core.$ZodIssue>) => Promise<core.output<T>>;\nexport declare const safeEncode: <T extends core.$ZodType>(schema: T, value: core.output<T>, _ctx?: core.ParseContext<core.$ZodIssue>) => ZodSafeParseResult<core.input<T>>;\nexport declare const safeDecode: <T extends core.$ZodType>(schema: T, value: core.input<T>, _ctx?: core.ParseContext<core.$ZodIssue>) => ZodSafeParseResult<core.output<T>>;\nexport declare const safeEncodeAsync: <T extends core.$ZodType>(schema: T, value: core.output<T>, _ctx?: core.ParseContext<core.$ZodIssue>) => Promise<ZodSafeParseResult<core.input<T>>>;\nexport declare const safeDecodeAsync: <T extends core.$ZodType>(schema: T, value: core.input<T>, _ctx?: core.ParseContext<core.$ZodIssue>) => Promise<ZodSafeParseResult<core.output<T>>>;\n"],"x_google_ignoreList":[0],"mappings":";;;KAEYE,wBAAwBE,oBAAoBD,KAAKE,kBAAkBF;AAAnED,KACAE,mBADkB,CAAAD,CAAAA,CAAAA,GAAAA;EAA0BA,OAAAA,EAAAA,IAAAA;EAApBC,IAAAA,EAG1BD,CAH0BC;EAA2CD,KAAAA,CAAAA,EAAAA,KAAAA;CAAlBE;AAAiB,KAMlEA,iBANkE,CAAA,CAAA,CAAA,GAAA;EAClED,OAAAA,EAAAA,KAAAA;EAKAC,IAAAA,CAAAA,EAAAA,KAAAA;SAGDJ,SAASE"}
@@ -15,7 +15,7 @@ type AvatarImageProps = Omit<React$1.ImgHTMLAttributes<HTMLImageElement>, "src"
15
15
  * Controlled `<img>` that syncs its loading status back to the avatar context
16
16
  * so fallbacks know when to display.
17
17
  */
18
- declare const AvatarImage: React$1.ForwardRefExoticComponent<Omit<React$1.ImgHTMLAttributes<HTMLImageElement>, "alt" | "src"> & {
18
+ declare const AvatarImage: React$1.ForwardRefExoticComponent<Omit<React$1.ImgHTMLAttributes<HTMLImageElement>, "src" | "alt"> & {
19
19
  src: string;
20
20
  alt?: string;
21
21
  asChild?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"conversation-timeline.d.ts","names":[],"sources":["../../src/primitives/conversation-timeline.tsx"],"sourcesContent":[],"mappings":";;;;;;;AASA;AAOA;AACsB,KARV,+BAAA,GAQU;EAArB,SAAM,EAAA,MAAA;EADiC,SAAA,CAAA,EAAA,OAAA;EAKpC,OAAM,CAAA,EAAA,OAAA;EACG,OAAA,EAAA,OAAA;CAAoC;AAGxC,KATG,yBAAA,GAA4B,IAS/B,CARR,OAAA,CAAM,cAQE,CARa,cAQb,CAAA,EAAA,UAAA,CAAA,GAAA;EAAgB,QAAA,CAAA,EAJrB,OAAA,CAAM,SAIe,GAAA,CAAA,CAAA,KAAA,EAHZ,+BAGY,EAAA,GAHwB,OAAA,CAAM,SAG9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,CAAA,CAAA;KAJN,gCAAA,GAAmC,KAC9C,OAAA,CAAM,eAAe;aAGV,OAAA,CAAM;EASsB,OAAA,CAAA,EAAA,OAAA;EAAA,SAAA,CAAA,EAAA,MAAA;AA2BxC,CAAA;;;;;AAI2B,cA/Bd,2BA+Bc,EA/Ba,OAAA,CAAA,yBA+Bb,CA/Ba,IA+Bb,CA/Ba,OAAA,CAAA,cA+Bb,CA/Ba,cA+Bb,CAAA,EAAA,UAAA,CAAA,GAAA;EASd,QAAA,CAAA,EAjDD,OAAA,CAAM,SAiDL;EAAyB,OAAA,CAAA,EAAA,OAAA;EAAA,SAAA,CAAA,EAAA,MAAA;CAAA,wBAAA,eAAA,CAAA,CAAA;AAT1B,KAJA,8BAAA,GAAiC,IAI3B,CAHjB,OAAA,CAAM,cAGW,CAHI,cAGJ,CAAA,EAAA,UAAA,CAAA,GAAA;aAAN,OAAA,CAAM;;EASoB,SAAA,CAAA,EAAA,MAAA;CAAA;;;;;cAAzB,2BAAyB,OAAA,CAAA,0BAAA,KAAA,OAAA,CAAA,eAAA;aAT1B,OAAA,CAAM"}
@@ -5,6 +5,8 @@ import * as React$1 from "react";
5
5
  //#region src/primitives/conversation-timeline.tsx
6
6
  const BOTTOM_THRESHOLD_PX = 12;
7
7
  const TOP_THRESHOLD_PX = 2;
8
+ /** Grace period after mount where all scrolls are instant (avoids animation on first render) */
9
+ const INITIAL_SCROLL_GRACE_MS = 300;
8
10
  function getLastItemKey(items) {
9
11
  if (items.length === 0) return null;
10
12
  const lastItem = items.at(-1);
@@ -30,7 +32,7 @@ const ConversationTimeline = (() => {
30
32
  if (typeof ref === "function") ref(node);
31
33
  else if (ref) ref.current = node;
32
34
  }, [ref, scrollMaskRef]);
33
- const isInitialRender = React$1.useRef(true);
35
+ const mountTimeRef = React$1.useRef(Date.now());
34
36
  const previousItemCount = React$1.useRef(items.length);
35
37
  const previousLastItemKey = React$1.useRef(getLastItemKey(items));
36
38
  const isPinnedToBottom = React$1.useRef(true);
@@ -48,21 +50,24 @@ const ConversationTimeline = (() => {
48
50
  if (!(element && autoScroll)) {
49
51
  previousItemCount.current = items.length;
50
52
  previousLastItemKey.current = lastItemKey;
51
- isInitialRender.current = false;
52
53
  return;
53
54
  }
54
55
  const hasNewItems = items.length > previousItemCount.current;
55
56
  const itemsRemoved = items.length < previousItemCount.current;
56
57
  const appendedNewItem = hasNewItems && lastItemKey !== null && lastItemKey !== previousLastItemKey.current;
57
58
  const replacedLastItem = !hasNewItems && lastItemKey !== null && lastItemKey !== previousLastItemKey.current;
58
- if (isInitialRender.current || itemsRemoved && isPinnedToBottom.current || appendedNewItem && isPinnedToBottom.current || replacedLastItem && isPinnedToBottom.current) {
59
- element.scrollTop = element.scrollHeight;
59
+ const isWithinGracePeriod = Date.now() - mountTimeRef.current < INITIAL_SCROLL_GRACE_MS;
60
+ if (isWithinGracePeriod || itemsRemoved && isPinnedToBottom.current || appendedNewItem && isPinnedToBottom.current || replacedLastItem && isPinnedToBottom.current) {
61
+ if (isWithinGracePeriod) element.scrollTop = element.scrollHeight;
62
+ else element.scrollTo({
63
+ top: element.scrollHeight,
64
+ behavior: "smooth"
65
+ });
60
66
  isPinnedToBottom.current = true;
61
67
  isAtTop.current = false;
62
68
  }
63
69
  previousItemCount.current = items.length;
64
70
  previousLastItemKey.current = lastItemKey;
65
- isInitialRender.current = false;
66
71
  }, [
67
72
  autoScroll,
68
73
  items.length,
@@ -1 +1 @@
1
- {"version":3,"file":"conversation-timeline.js","names":["React","renderProps: ConversationTimelineRenderProps"],"sources":["../../src/primitives/conversation-timeline.tsx"],"sourcesContent":["import type { TimelineItem as TimelineItemType } from \"@cossistant/types/api/timeline-item\";\nimport * as React from \"react\";\nimport { useScrollMask } from \"../hooks/use-scroll-mask\";\nimport { useRenderElement } from \"../utils/use-render-element\";\n\n/**\n * High-level state of the timeline handed to render-prop children so they can show\n * skeletons, empty states or pagination affordances.\n */\nexport type ConversationTimelineRenderProps = {\n\titemCount: number;\n\tisLoading?: boolean;\n\thasMore?: boolean;\n\tisEmpty: boolean;\n};\n\nexport type ConversationTimelineProps = Omit<\n\tReact.HTMLAttributes<HTMLDivElement>,\n\t\"children\"\n> & {\n\tchildren?:\n\t\t| React.ReactNode\n\t\t| ((props: ConversationTimelineRenderProps) => React.ReactNode);\n\tasChild?: boolean;\n\tclassName?: string;\n\titems?: TimelineItemType[];\n\tisLoading?: boolean;\n\thasMore?: boolean;\n\tautoScroll?: boolean;\n\tonScrollEnd?: () => void;\n\tonScrollStart?: () => void;\n};\n\nconst BOTTOM_THRESHOLD_PX = 12;\nconst TOP_THRESHOLD_PX = 2;\n\nfunction getLastItemKey(items: TimelineItemType[]): string | number | null {\n\tif (items.length === 0) {\n\t\treturn null;\n\t}\n\n\tconst lastItem = items.at(-1);\n\n\tif (lastItem?.id) {\n\t\treturn lastItem.id;\n\t}\n\n\treturn lastItem?.createdAt ?? null;\n}\n\n/**\n * Scrollable conversation timeline that wires auto-scroll behaviour, live-region semantics and\n * pagination callbacks for displaying timeline items (messages, events, etc.).\n */\nexport const ConversationTimeline = (() => {\n\tconst Component = React.forwardRef<HTMLDivElement, ConversationTimelineProps>(\n\t\t(\n\t\t\t{\n\t\t\t\tchildren,\n\t\t\t\tclassName,\n\t\t\t\tasChild = false,\n\t\t\t\titems = [],\n\t\t\t\tisLoading = false,\n\t\t\t\thasMore = false,\n\t\t\t\tautoScroll = true,\n\t\t\t\tonScrollEnd,\n\t\t\t\tonScrollStart,\n\t\t\t\t...props\n\t\t\t},\n\t\t\tref\n\t\t) => {\n\t\t\tconst internalRef = React.useRef<HTMLDivElement>(null);\n\t\t\tconst { ref: scrollMaskRef, style: scrollMaskStyle } = useScrollMask({\n\t\t\t\tmaskHeight: \"54px\",\n\t\t\t\tscrollbarWidth: \"8px\",\n\t\t\t\ttopThreshold: TOP_THRESHOLD_PX,\n\t\t\t\tbottomThreshold: BOTTOM_THRESHOLD_PX,\n\t\t\t});\n\n\t\t\tconst setRefs = React.useCallback(\n\t\t\t\t(node: HTMLDivElement | null) => {\n\t\t\t\t\tinternalRef.current = node;\n\t\t\t\t\t(\n\t\t\t\t\t\tscrollMaskRef as React.MutableRefObject<HTMLDivElement | null>\n\t\t\t\t\t).current = node;\n\t\t\t\t\tif (typeof ref === \"function\") {\n\t\t\t\t\t\tref(node);\n\t\t\t\t\t} else if (ref) {\n\t\t\t\t\t\t(ref as React.MutableRefObject<HTMLDivElement | null>).current =\n\t\t\t\t\t\t\tnode;\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t[ref, scrollMaskRef]\n\t\t\t);\n\n\t\t\tconst isInitialRender = React.useRef(true);\n\t\t\tconst previousItemCount = React.useRef(items.length);\n\t\t\tconst previousLastItemKey = React.useRef<string | number | null>(\n\t\t\t\tgetLastItemKey(items)\n\t\t\t);\n\t\t\tconst isPinnedToBottom = React.useRef(true);\n\t\t\tconst isAtTop = React.useRef(true);\n\n\t\t\tconst renderProps: ConversationTimelineRenderProps = {\n\t\t\t\titemCount: items.length,\n\t\t\t\tisLoading,\n\t\t\t\thasMore,\n\t\t\t\tisEmpty: items.length === 0,\n\t\t\t};\n\n\t\t\tconst content =\n\t\t\t\ttypeof children === \"function\" ? children(renderProps) : children;\n\n\t\t\tconst lastItemKey = getLastItemKey(items);\n\n\t\t\t// Auto-scroll to bottom when new timeline items are added\n\t\t\tReact.useEffect(() => {\n\t\t\t\tconst element = internalRef.current;\n\n\t\t\t\tif (!(element && autoScroll)) {\n\t\t\t\t\tpreviousItemCount.current = items.length;\n\t\t\t\t\tpreviousLastItemKey.current = lastItemKey;\n\t\t\t\t\tisInitialRender.current = false;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst hasNewItems = items.length > previousItemCount.current;\n\t\t\t\tconst itemsRemoved = items.length < previousItemCount.current;\n\t\t\t\tconst appendedNewItem =\n\t\t\t\t\thasNewItems &&\n\t\t\t\t\tlastItemKey !== null &&\n\t\t\t\t\tlastItemKey !== previousLastItemKey.current;\n\t\t\t\tconst replacedLastItem =\n\t\t\t\t\t!hasNewItems &&\n\t\t\t\t\tlastItemKey !== null &&\n\t\t\t\t\tlastItemKey !== previousLastItemKey.current;\n\n\t\t\t\tconst shouldSnapToBottom =\n\t\t\t\t\tisInitialRender.current ||\n\t\t\t\t\t(itemsRemoved && isPinnedToBottom.current) ||\n\t\t\t\t\t(appendedNewItem && isPinnedToBottom.current) ||\n\t\t\t\t\t(replacedLastItem && isPinnedToBottom.current);\n\n\t\t\t\tif (shouldSnapToBottom) {\n\t\t\t\t\telement.scrollTop = element.scrollHeight;\n\t\t\t\t\tisPinnedToBottom.current = true;\n\t\t\t\t\tisAtTop.current = false;\n\t\t\t\t}\n\n\t\t\t\tpreviousItemCount.current = items.length;\n\t\t\t\tpreviousLastItemKey.current = lastItemKey;\n\t\t\t\tisInitialRender.current = false;\n\t\t\t}, [autoScroll, items.length, lastItemKey]);\n\n\t\t\t// Handle scroll events for infinite scrolling\n\t\t\tconst handleScroll = React.useCallback(\n\t\t\t\t(e: React.UIEvent<HTMLDivElement>) => {\n\t\t\t\t\tconst element = e.currentTarget;\n\t\t\t\t\tconst { scrollTop, scrollHeight, clientHeight } = element;\n\n\t\t\t\t\tconst distanceFromBottom = scrollHeight - scrollTop - clientHeight;\n\t\t\t\t\tconst pinnedNow = distanceFromBottom <= BOTTOM_THRESHOLD_PX;\n\t\t\t\t\tif (pinnedNow && !isPinnedToBottom.current) {\n\t\t\t\t\t\tonScrollEnd?.();\n\t\t\t\t\t}\n\t\t\t\t\tisPinnedToBottom.current = pinnedNow;\n\n\t\t\t\t\tconst atTop = scrollTop <= TOP_THRESHOLD_PX;\n\t\t\t\t\tif (atTop && !isAtTop.current) {\n\t\t\t\t\t\tonScrollStart?.();\n\t\t\t\t\t}\n\t\t\t\t\tisAtTop.current = atTop;\n\t\t\t\t},\n\t\t\t\t[onScrollStart, onScrollEnd]\n\t\t\t);\n\n\t\t\treturn useRenderElement(\n\t\t\t\t\"div\",\n\t\t\t\t{\n\t\t\t\t\tclassName,\n\t\t\t\t\tasChild,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tref: setRefs,\n\t\t\t\t\tstate: renderProps,\n\t\t\t\t\tprops: {\n\t\t\t\t\t\trole: \"log\",\n\t\t\t\t\t\t\"aria-label\": \"Conversation timeline\",\n\t\t\t\t\t\t\"aria-live\": \"polite\",\n\t\t\t\t\t\t\"aria-relevant\": \"additions\",\n\t\t\t\t\t\tonScroll: handleScroll,\n\t\t\t\t\t\tstyle: scrollMaskStyle,\n\t\t\t\t\t\t...props,\n\t\t\t\t\t\tchildren: content,\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t);\n\n\tComponent.displayName = \"ConversationTimeline\";\n\treturn Component;\n})();\n\nexport type ConversationTimelineContainerProps = Omit<\n\tReact.HTMLAttributes<HTMLDivElement>,\n\t\"children\"\n> & {\n\tchildren?: React.ReactNode;\n\tasChild?: boolean;\n\tclassName?: string;\n};\n\n/**\n * Wrapper around the scrollable timeline giving consumers an easy hook to add\n * padding, backgrounds or transitions without touching the core timeline logic.\n */\nexport const ConversationTimelineContainer = (() => {\n\tconst Component = React.forwardRef<\n\t\tHTMLDivElement,\n\t\tConversationTimelineContainerProps\n\t>(({ children, className, asChild = false, ...props }, ref) =>\n\t\tuseRenderElement(\n\t\t\t\"div\",\n\t\t\t{\n\t\t\t\tclassName,\n\t\t\t\tasChild,\n\t\t\t},\n\t\t\t{\n\t\t\t\tref,\n\t\t\t\tprops: {\n\t\t\t\t\t...props,\n\t\t\t\t\tchildren,\n\t\t\t\t},\n\t\t\t}\n\t\t)\n\t);\n\n\tComponent.displayName = \"ConversationTimelineContainer\";\n\treturn Component;\n})();\n\nexport type ConversationTimelineLoadingProps = Omit<\n\tReact.HTMLAttributes<HTMLDivElement>,\n\t\"children\"\n> & {\n\tchildren?: React.ReactNode;\n\tasChild?: boolean;\n\tclassName?: string;\n};\n\n/**\n * Accessible status region for loading more timeline items. Lets host apps render\n * skeletons or shimmer states without reimplementing ARIA wiring.\n */\nexport const ConversationTimelineLoading = (() => {\n\tconst Component = React.forwardRef<\n\t\tHTMLDivElement,\n\t\tConversationTimelineLoadingProps\n\t>(({ children, className, asChild = false, ...props }, ref) =>\n\t\tuseRenderElement(\n\t\t\t\"div\",\n\t\t\t{\n\t\t\t\tclassName,\n\t\t\t\tasChild,\n\t\t\t},\n\t\t\t{\n\t\t\t\tref,\n\t\t\t\tprops: {\n\t\t\t\t\trole: \"status\",\n\t\t\t\t\t\"aria-label\": \"Loading timeline items\",\n\t\t\t\t\t...props,\n\t\t\t\t\tchildren,\n\t\t\t\t},\n\t\t\t}\n\t\t)\n\t);\n\n\tComponent.displayName = \"ConversationTimelineLoading\";\n\treturn Component;\n})();\n\nexport type ConversationTimelineEmptyProps = Omit<\n\tReact.HTMLAttributes<HTMLDivElement>,\n\t\"children\"\n> & {\n\tchildren?: React.ReactNode;\n\tasChild?: boolean;\n\tclassName?: string;\n};\n\n/**\n * Placeholder state rendered when no timeline items are present. Uses a polite status\n * region so screen readers announce the empty state.\n */\nexport const ConversationTimelineEmpty = (() => {\n\tconst Component = React.forwardRef<\n\t\tHTMLDivElement,\n\t\tConversationTimelineEmptyProps\n\t>(({ children, className, asChild = false, ...props }, ref) =>\n\t\tuseRenderElement(\n\t\t\t\"div\",\n\t\t\t{\n\t\t\t\tclassName,\n\t\t\t\tasChild,\n\t\t\t},\n\t\t\t{\n\t\t\t\tref,\n\t\t\t\tprops: {\n\t\t\t\t\trole: \"status\",\n\t\t\t\t\t\"aria-label\": \"No timeline items\",\n\t\t\t\t\t...props,\n\t\t\t\t\tchildren,\n\t\t\t\t},\n\t\t\t}\n\t\t)\n\t);\n\n\tComponent.displayName = \"ConversationTimelineEmpty\";\n\treturn Component;\n})();\n"],"mappings":";;;;;AAiCA,MAAM,sBAAsB;AAC5B,MAAM,mBAAmB;AAEzB,SAAS,eAAe,OAAmD;AAC1E,KAAI,MAAM,WAAW,EACpB,QAAO;CAGR,MAAM,WAAW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A,EACD;EACC;EACA,OAAO;GACN,MAAM;GACN,cAAc;GACd,GAAG;GACH;GACA;EACD,CACD,CACD;AAED,WAAU,cAAc;AACxB,QAAO;IACJ;;;;;AAeJ,MAAa,mCAAmC;CAC/C,MAAM,YAAYA,QAAM,YAGrB,EAAE,UAAU,WAAW,UAAU,MAAO,GAAG,SAAS,QACtD,iBACC,OACA;EACC;EACA;EACA,EACD;EACC;EACA,OAAO;GACN,MAAM;GACN,cAAc;GACd,GAAG;GACH;GACA;EACD,CACD,CACD;AAED,WAAU,cAAc;AACxB,QAAO;IACJ"}
1
+ {"version":3,"file":"conversation-timeline.js","names":["React","renderProps: ConversationTimelineRenderProps"],"sources":["../../src/primitives/conversation-timeline.tsx"],"sourcesContent":["import type { TimelineItem as TimelineItemType } from \"@cossistant/types/api/timeline-item\";\nimport * as React from \"react\";\nimport { useScrollMask } from \"../hooks/use-scroll-mask\";\nimport { useRenderElement } from \"../utils/use-render-element\";\n\n/**\n * High-level state of the timeline handed to render-prop children so they can show\n * skeletons, empty states or pagination affordances.\n */\nexport type ConversationTimelineRenderProps = {\n\titemCount: number;\n\tisLoading?: boolean;\n\thasMore?: boolean;\n\tisEmpty: boolean;\n};\n\nexport type ConversationTimelineProps = Omit<\n\tReact.HTMLAttributes<HTMLDivElement>,\n\t\"children\"\n> & {\n\tchildren?:\n\t\t| React.ReactNode\n\t\t| ((props: ConversationTimelineRenderProps) => React.ReactNode);\n\tasChild?: boolean;\n\tclassName?: string;\n\titems?: TimelineItemType[];\n\tisLoading?: boolean;\n\thasMore?: boolean;\n\tautoScroll?: boolean;\n\tonScrollEnd?: () => void;\n\tonScrollStart?: () => void;\n};\n\nconst BOTTOM_THRESHOLD_PX = 12;\nconst TOP_THRESHOLD_PX = 2;\n/** Grace period after mount where all scrolls are instant (avoids animation on first render) */\nconst INITIAL_SCROLL_GRACE_MS = 300;\n\nfunction getLastItemKey(items: TimelineItemType[]): string | number | null {\n\tif (items.length === 0) {\n\t\treturn null;\n\t}\n\n\tconst lastItem = items.at(-1);\n\n\tif (lastItem?.id) {\n\t\treturn lastItem.id;\n\t}\n\n\treturn lastItem?.createdAt ?? null;\n}\n\n/**\n * Scrollable conversation timeline that wires auto-scroll behaviour, live-region semantics and\n * pagination callbacks for displaying timeline items (messages, events, etc.).\n */\nexport const ConversationTimeline = (() => {\n\tconst Component = React.forwardRef<HTMLDivElement, ConversationTimelineProps>(\n\t\t(\n\t\t\t{\n\t\t\t\tchildren,\n\t\t\t\tclassName,\n\t\t\t\tasChild = false,\n\t\t\t\titems = [],\n\t\t\t\tisLoading = false,\n\t\t\t\thasMore = false,\n\t\t\t\tautoScroll = true,\n\t\t\t\tonScrollEnd,\n\t\t\t\tonScrollStart,\n\t\t\t\t...props\n\t\t\t},\n\t\t\tref\n\t\t) => {\n\t\t\tconst internalRef = React.useRef<HTMLDivElement>(null);\n\t\t\tconst { ref: scrollMaskRef, style: scrollMaskStyle } = useScrollMask({\n\t\t\t\tmaskHeight: \"54px\",\n\t\t\t\tscrollbarWidth: \"8px\",\n\t\t\t\ttopThreshold: TOP_THRESHOLD_PX,\n\t\t\t\tbottomThreshold: BOTTOM_THRESHOLD_PX,\n\t\t\t});\n\n\t\t\tconst setRefs = React.useCallback(\n\t\t\t\t(node: HTMLDivElement | null) => {\n\t\t\t\t\tinternalRef.current = node;\n\t\t\t\t\t(\n\t\t\t\t\t\tscrollMaskRef as React.MutableRefObject<HTMLDivElement | null>\n\t\t\t\t\t).current = node;\n\t\t\t\t\tif (typeof ref === \"function\") {\n\t\t\t\t\t\tref(node);\n\t\t\t\t\t} else if (ref) {\n\t\t\t\t\t\t(ref as React.MutableRefObject<HTMLDivElement | null>).current =\n\t\t\t\t\t\t\tnode;\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t[ref, scrollMaskRef]\n\t\t\t);\n\n\t\t\t// Track mount time for grace period (instant scroll during initial load)\n\t\t\tconst mountTimeRef = React.useRef(Date.now());\n\t\t\tconst previousItemCount = React.useRef(items.length);\n\t\t\tconst previousLastItemKey = React.useRef<string | number | null>(\n\t\t\t\tgetLastItemKey(items)\n\t\t\t);\n\t\t\tconst isPinnedToBottom = React.useRef(true);\n\t\t\tconst isAtTop = React.useRef(true);\n\n\t\t\tconst renderProps: ConversationTimelineRenderProps = {\n\t\t\t\titemCount: items.length,\n\t\t\t\tisLoading,\n\t\t\t\thasMore,\n\t\t\t\tisEmpty: items.length === 0,\n\t\t\t};\n\n\t\t\tconst content =\n\t\t\t\ttypeof children === \"function\" ? children(renderProps) : children;\n\n\t\t\tconst lastItemKey = getLastItemKey(items);\n\n\t\t\t// Auto-scroll to bottom when new timeline items are added\n\t\t\tReact.useEffect(() => {\n\t\t\t\tconst element = internalRef.current;\n\n\t\t\t\tif (!(element && autoScroll)) {\n\t\t\t\t\tpreviousItemCount.current = items.length;\n\t\t\t\t\tpreviousLastItemKey.current = lastItemKey;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst hasNewItems = items.length > previousItemCount.current;\n\t\t\t\tconst itemsRemoved = items.length < previousItemCount.current;\n\t\t\t\tconst appendedNewItem =\n\t\t\t\t\thasNewItems &&\n\t\t\t\t\tlastItemKey !== null &&\n\t\t\t\t\tlastItemKey !== previousLastItemKey.current;\n\t\t\t\tconst replacedLastItem =\n\t\t\t\t\t!hasNewItems &&\n\t\t\t\t\tlastItemKey !== null &&\n\t\t\t\t\tlastItemKey !== previousLastItemKey.current;\n\n\t\t\t\tconst isWithinGracePeriod =\n\t\t\t\t\tDate.now() - mountTimeRef.current < INITIAL_SCROLL_GRACE_MS;\n\n\t\t\t\tconst shouldSnapToBottom =\n\t\t\t\t\tisWithinGracePeriod ||\n\t\t\t\t\t(itemsRemoved && isPinnedToBottom.current) ||\n\t\t\t\t\t(appendedNewItem && isPinnedToBottom.current) ||\n\t\t\t\t\t(replacedLastItem && isPinnedToBottom.current);\n\n\t\t\t\tif (shouldSnapToBottom) {\n\t\t\t\t\t// Instant scroll during grace period, smooth scroll after\n\t\t\t\t\tif (isWithinGracePeriod) {\n\t\t\t\t\t\telement.scrollTop = element.scrollHeight;\n\t\t\t\t\t} else {\n\t\t\t\t\t\telement.scrollTo({ top: element.scrollHeight, behavior: \"smooth\" });\n\t\t\t\t\t}\n\t\t\t\t\tisPinnedToBottom.current = true;\n\t\t\t\t\tisAtTop.current = false;\n\t\t\t\t}\n\n\t\t\t\tpreviousItemCount.current = items.length;\n\t\t\t\tpreviousLastItemKey.current = lastItemKey;\n\t\t\t}, [autoScroll, items.length, lastItemKey]);\n\n\t\t\t// Handle scroll events for infinite scrolling\n\t\t\tconst handleScroll = React.useCallback(\n\t\t\t\t(e: React.UIEvent<HTMLDivElement>) => {\n\t\t\t\t\tconst element = e.currentTarget;\n\t\t\t\t\tconst { scrollTop, scrollHeight, clientHeight } = element;\n\n\t\t\t\t\tconst distanceFromBottom = scrollHeight - scrollTop - clientHeight;\n\t\t\t\t\tconst pinnedNow = distanceFromBottom <= BOTTOM_THRESHOLD_PX;\n\t\t\t\t\tif (pinnedNow && !isPinnedToBottom.current) {\n\t\t\t\t\t\tonScrollEnd?.();\n\t\t\t\t\t}\n\t\t\t\t\tisPinnedToBottom.current = pinnedNow;\n\n\t\t\t\t\tconst atTop = scrollTop <= TOP_THRESHOLD_PX;\n\t\t\t\t\tif (atTop && !isAtTop.current) {\n\t\t\t\t\t\tonScrollStart?.();\n\t\t\t\t\t}\n\t\t\t\t\tisAtTop.current = atTop;\n\t\t\t\t},\n\t\t\t\t[onScrollStart, onScrollEnd]\n\t\t\t);\n\n\t\t\treturn useRenderElement(\n\t\t\t\t\"div\",\n\t\t\t\t{\n\t\t\t\t\tclassName,\n\t\t\t\t\tasChild,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tref: setRefs,\n\t\t\t\t\tstate: renderProps,\n\t\t\t\t\tprops: {\n\t\t\t\t\t\trole: \"log\",\n\t\t\t\t\t\t\"aria-label\": \"Conversation timeline\",\n\t\t\t\t\t\t\"aria-live\": \"polite\",\n\t\t\t\t\t\t\"aria-relevant\": \"additions\",\n\t\t\t\t\t\tonScroll: handleScroll,\n\t\t\t\t\t\tstyle: scrollMaskStyle,\n\t\t\t\t\t\t...props,\n\t\t\t\t\t\tchildren: content,\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t);\n\n\tComponent.displayName = \"ConversationTimeline\";\n\treturn Component;\n})();\n\nexport type ConversationTimelineContainerProps = Omit<\n\tReact.HTMLAttributes<HTMLDivElement>,\n\t\"children\"\n> & {\n\tchildren?: React.ReactNode;\n\tasChild?: boolean;\n\tclassName?: string;\n};\n\n/**\n * Wrapper around the scrollable timeline giving consumers an easy hook to add\n * padding, backgrounds or transitions without touching the core timeline logic.\n */\nexport const ConversationTimelineContainer = (() => {\n\tconst Component = React.forwardRef<\n\t\tHTMLDivElement,\n\t\tConversationTimelineContainerProps\n\t>(({ children, className, asChild = false, ...props }, ref) =>\n\t\tuseRenderElement(\n\t\t\t\"div\",\n\t\t\t{\n\t\t\t\tclassName,\n\t\t\t\tasChild,\n\t\t\t},\n\t\t\t{\n\t\t\t\tref,\n\t\t\t\tprops: {\n\t\t\t\t\t...props,\n\t\t\t\t\tchildren,\n\t\t\t\t},\n\t\t\t}\n\t\t)\n\t);\n\n\tComponent.displayName = \"ConversationTimelineContainer\";\n\treturn Component;\n})();\n\nexport type ConversationTimelineLoadingProps = Omit<\n\tReact.HTMLAttributes<HTMLDivElement>,\n\t\"children\"\n> & {\n\tchildren?: React.ReactNode;\n\tasChild?: boolean;\n\tclassName?: string;\n};\n\n/**\n * Accessible status region for loading more timeline items. Lets host apps render\n * skeletons or shimmer states without reimplementing ARIA wiring.\n */\nexport const ConversationTimelineLoading = (() => {\n\tconst Component = React.forwardRef<\n\t\tHTMLDivElement,\n\t\tConversationTimelineLoadingProps\n\t>(({ children, className, asChild = false, ...props }, ref) =>\n\t\tuseRenderElement(\n\t\t\t\"div\",\n\t\t\t{\n\t\t\t\tclassName,\n\t\t\t\tasChild,\n\t\t\t},\n\t\t\t{\n\t\t\t\tref,\n\t\t\t\tprops: {\n\t\t\t\t\trole: \"status\",\n\t\t\t\t\t\"aria-label\": \"Loading timeline items\",\n\t\t\t\t\t...props,\n\t\t\t\t\tchildren,\n\t\t\t\t},\n\t\t\t}\n\t\t)\n\t);\n\n\tComponent.displayName = \"ConversationTimelineLoading\";\n\treturn Component;\n})();\n\nexport type ConversationTimelineEmptyProps = Omit<\n\tReact.HTMLAttributes<HTMLDivElement>,\n\t\"children\"\n> & {\n\tchildren?: React.ReactNode;\n\tasChild?: boolean;\n\tclassName?: string;\n};\n\n/**\n * Placeholder state rendered when no timeline items are present. Uses a polite status\n * region so screen readers announce the empty state.\n */\nexport const ConversationTimelineEmpty = (() => {\n\tconst Component = React.forwardRef<\n\t\tHTMLDivElement,\n\t\tConversationTimelineEmptyProps\n\t>(({ children, className, asChild = false, ...props }, ref) =>\n\t\tuseRenderElement(\n\t\t\t\"div\",\n\t\t\t{\n\t\t\t\tclassName,\n\t\t\t\tasChild,\n\t\t\t},\n\t\t\t{\n\t\t\t\tref,\n\t\t\t\tprops: {\n\t\t\t\t\trole: \"status\",\n\t\t\t\t\t\"aria-label\": \"No timeline items\",\n\t\t\t\t\t...props,\n\t\t\t\t\tchildren,\n\t\t\t\t},\n\t\t\t}\n\t\t)\n\t);\n\n\tComponent.displayName = \"ConversationTimelineEmpty\";\n\treturn Component;\n})();\n"],"mappings":";;;;;AAiCA,MAAM,sBAAsB;AAC5B,MAAM,mBAAmB;;AAEzB,MAAM,0BAA0B;AAEhC,SAAS,eAAe,OAAmD;AAC1E,KAAI,MAAM,WAAW,EACpB,QAAO;CAGR,MAAM,WAAW,MAAM,GAAG,GAAG;AAE7B,KAAI,UAAU,GACb,QAAO,SAAS;AAGjB,QAAO,UAAU,aAAa;;;;;;AAO/B,MAAa,8BAA8B;CAC1C,MAAM,YAAYA,QAAM,YAEtB,EACC,UACA,WACA,UAAU,OACV,QAAQ,EAAE,EACV,YAAY,OACZ,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J;;;;;AAeJ,MAAa,mCAAmC;CAC/C,MAAM,YAAYA,QAAM,YAGrB,EAAE,UAAU,WAAW,UAAU,MAAO,GAAG,SAAS,QACtD,iBACC,OACA;EACC;EACA;EACA,EACD;EACC;EACA,OAAO;GACN,MAAM;GACN,cAAc;GACd,GAAG;GACH;GACA;EACD,CACD,CACD;AAED,WAAU,cAAc;AACxB,QAAO;IACJ"}
@@ -3,20 +3,21 @@ import { SupportConfig } from "../support-config.js";
3
3
  import { Avatar } from "./avatar/avatar.js";
4
4
  import { AvatarFallback } from "./avatar/fallback.js";
5
5
  import { AvatarImage } from "./avatar/image.js";
6
- import { SupportBubble } from "./bubble.js";
7
6
  import { Button } from "./button.js";
8
7
  import { ConversationTimeline, ConversationTimelineContainer, ConversationTimelineEmpty, ConversationTimelineLoading } from "./conversation-timeline.js";
9
8
  import { FileInput, MultimodalInput, SupportInput } from "./multimodal-input.js";
10
9
  import { PageDefinition, Router, RouterProps } from "./router.js";
11
10
  import { TimelineItem, TimelineItemContent, TimelineItemTimestamp } from "./timeline-item.js";
11
+ import { TimelineItemAttachments, TimelineItemFiles, TimelineItemImages, extractFileParts, extractImageParts, hasAttachments } from "./timeline-item-attachments.js";
12
12
  import { TimelineItemGroup, TimelineItemGroupAvatar, TimelineItemGroupContent, TimelineItemGroupHeader, TimelineItemGroupReadIndicator, TimelineItemGroupSeenIndicator } from "./timeline-item-group.js";
13
+ import { SupportTrigger, TriggerProps, TriggerRenderProps } from "./trigger.js";
13
14
  import { SupportWindow } from "./window.js";
14
15
  import "./index.parts.js";
15
16
 
16
17
  //#region src/primitives/index.d.ts
17
18
  declare namespace index_d_exports {
18
- export { Avatar, AvatarFallback, AvatarImage, SupportBubble as Bubble, Button, SupportConfig as Config, ConversationTimeline, ConversationTimelineContainer, ConversationTimelineEmpty, ConversationTimelineLoading, FileInput, SupportInput as Input, MultimodalInput, PageDefinition, Router, RouterProps, TimelineItem, TimelineItemContent, TimelineItemGroup, TimelineItemGroupAvatar, TimelineItemGroupContent, TimelineItemGroupHeader, TimelineItemGroupReadIndicator, TimelineItemGroupSeenIndicator, TimelineItemTimestamp, TypingIndicator, TypingIndicatorProps, TypingParticipant, TypingParticipantType, SupportWindow as Window };
19
+ export { Avatar, AvatarFallback, AvatarImage, Button, SupportConfig as Config, ConversationTimeline, ConversationTimelineContainer, ConversationTimelineEmpty, ConversationTimelineLoading, FileInput, SupportInput as Input, MultimodalInput, PageDefinition, Router, RouterProps, TimelineItem, TimelineItemAttachments, TimelineItemContent, TimelineItemFiles, TimelineItemGroup, TimelineItemGroupAvatar, TimelineItemGroupContent, TimelineItemGroupHeader, TimelineItemGroupReadIndicator, TimelineItemGroupSeenIndicator, TimelineItemImages, TimelineItemTimestamp, SupportTrigger as Trigger, TriggerProps, TriggerRenderProps, TypingIndicator, TypingIndicatorProps, TypingParticipant, TypingParticipantType, SupportWindow as Window, extractFileParts, extractImageParts, hasAttachments };
19
20
  }
20
21
  //#endregion
21
- export { Avatar, AvatarFallback, AvatarImage, SupportBubble as Bubble, Button, SupportConfig as Config, ConversationTimeline, ConversationTimelineContainer, ConversationTimelineEmpty, ConversationTimelineLoading, FileInput, SupportInput as Input, MultimodalInput, PageDefinition, Router, RouterProps, TimelineItem, TimelineItemContent, TimelineItemGroup, TimelineItemGroupAvatar, TimelineItemGroupContent, TimelineItemGroupHeader, TimelineItemGroupReadIndicator, TimelineItemGroupSeenIndicator, TimelineItemTimestamp, TypingIndicator, TypingIndicatorProps, TypingParticipant, TypingParticipantType, SupportWindow as Window, index_d_exports };
22
+ export { Avatar, AvatarFallback, AvatarImage, Button, SupportConfig as Config, ConversationTimeline, ConversationTimelineContainer, ConversationTimelineEmpty, ConversationTimelineLoading, FileInput, SupportInput as Input, MultimodalInput, PageDefinition, Router, RouterProps, TimelineItem, TimelineItemAttachments, TimelineItemContent, TimelineItemFiles, TimelineItemGroup, TimelineItemGroupAvatar, TimelineItemGroupContent, TimelineItemGroupHeader, TimelineItemGroupReadIndicator, TimelineItemGroupSeenIndicator, TimelineItemImages, TimelineItemTimestamp, SupportTrigger as Trigger, TriggerProps, TriggerRenderProps, TypingIndicator, TypingIndicatorProps, TypingParticipant, TypingParticipantType, SupportWindow as Window, extractFileParts, extractImageParts, hasAttachments, index_d_exports };
22
23
  //# sourceMappingURL=index.d.ts.map
@@ -1,16 +1,17 @@
1
1
  import { __export } from "../_virtual/rolldown_runtime.js";
2
- import { SupportConfig } from "../support-config.js";
3
2
  import { Avatar } from "./avatar/avatar.js";
4
3
  import { AvatarFallback } from "./avatar/fallback.js";
5
4
  import { AvatarImage } from "./avatar/image.js";
6
5
  import { TypingIndicator } from "../support/components/typing-indicator.js";
7
- import { SupportBubble } from "./bubble.js";
6
+ import { SupportConfig } from "../support-config.js";
8
7
  import { Button } from "./button.js";
9
8
  import { ConversationTimeline, ConversationTimelineContainer, ConversationTimelineEmpty, ConversationTimelineLoading } from "./conversation-timeline.js";
10
9
  import { FileInput, MultimodalInput, SupportInput } from "./multimodal-input.js";
11
10
  import { Router } from "./router.js";
12
11
  import { TimelineItem, TimelineItemContent, TimelineItemTimestamp } from "./timeline-item.js";
12
+ import { TimelineItemAttachments, TimelineItemFiles, TimelineItemImages, extractFileParts, extractImageParts, hasAttachments } from "./timeline-item-attachments.js";
13
13
  import { TimelineItemGroup, TimelineItemGroupAvatar, TimelineItemGroupContent, TimelineItemGroupHeader, TimelineItemGroupReadIndicator, TimelineItemGroupSeenIndicator } from "./timeline-item-group.js";
14
+ import { SupportTrigger } from "./trigger.js";
14
15
  import { SupportWindow } from "./window.js";
15
16
 
16
17
  //#region src/primitives/index.ts
@@ -18,7 +19,6 @@ var primitives_exports = /* @__PURE__ */ __export({
18
19
  Avatar: () => Avatar,
19
20
  AvatarFallback: () => AvatarFallback,
20
21
  AvatarImage: () => AvatarImage,
21
- Bubble: () => SupportBubble,
22
22
  Button: () => Button,
23
23
  Config: () => SupportConfig,
24
24
  ConversationTimeline: () => ConversationTimeline,
@@ -30,18 +30,25 @@ var primitives_exports = /* @__PURE__ */ __export({
30
30
  MultimodalInput: () => MultimodalInput,
31
31
  Router: () => Router,
32
32
  TimelineItem: () => TimelineItem,
33
+ TimelineItemAttachments: () => TimelineItemAttachments,
33
34
  TimelineItemContent: () => TimelineItemContent,
35
+ TimelineItemFiles: () => TimelineItemFiles,
34
36
  TimelineItemGroup: () => TimelineItemGroup,
35
37
  TimelineItemGroupAvatar: () => TimelineItemGroupAvatar,
36
38
  TimelineItemGroupContent: () => TimelineItemGroupContent,
37
39
  TimelineItemGroupHeader: () => TimelineItemGroupHeader,
38
40
  TimelineItemGroupReadIndicator: () => TimelineItemGroupReadIndicator,
39
41
  TimelineItemGroupSeenIndicator: () => TimelineItemGroupSeenIndicator,
42
+ TimelineItemImages: () => TimelineItemImages,
40
43
  TimelineItemTimestamp: () => TimelineItemTimestamp,
44
+ Trigger: () => SupportTrigger,
41
45
  TypingIndicator: () => TypingIndicator,
42
- Window: () => SupportWindow
46
+ Window: () => SupportWindow,
47
+ extractFileParts: () => extractFileParts,
48
+ extractImageParts: () => extractImageParts,
49
+ hasAttachments: () => hasAttachments
43
50
  });
44
51
 
45
52
  //#endregion
46
- export { Avatar, AvatarFallback, AvatarImage, SupportBubble as Bubble, Button, SupportConfig as Config, ConversationTimeline, ConversationTimelineContainer, ConversationTimelineEmpty, ConversationTimelineLoading, FileInput, SupportInput as Input, MultimodalInput, Router, TimelineItem, TimelineItemContent, TimelineItemGroup, TimelineItemGroupAvatar, TimelineItemGroupContent, TimelineItemGroupHeader, TimelineItemGroupReadIndicator, TimelineItemGroupSeenIndicator, TimelineItemTimestamp, TypingIndicator, SupportWindow as Window, primitives_exports };
53
+ export { Avatar, AvatarFallback, AvatarImage, Button, SupportConfig as Config, ConversationTimeline, ConversationTimelineContainer, ConversationTimelineEmpty, ConversationTimelineLoading, FileInput, SupportInput as Input, MultimodalInput, Router, TimelineItem, TimelineItemAttachments, TimelineItemContent, TimelineItemFiles, TimelineItemGroup, TimelineItemGroupAvatar, TimelineItemGroupContent, TimelineItemGroupHeader, TimelineItemGroupReadIndicator, TimelineItemGroupSeenIndicator, TimelineItemImages, TimelineItemTimestamp, SupportTrigger as Trigger, TypingIndicator, SupportWindow as Window, extractFileParts, extractImageParts, hasAttachments, primitives_exports };
47
54
  //# sourceMappingURL=index.js.map
@@ -4,12 +4,13 @@ import { Avatar } from "./avatar/avatar.js";
4
4
  import { AvatarFallback } from "./avatar/fallback.js";
5
5
  import { AvatarImage } from "./avatar/image.js";
6
6
  import "./avatar/index.js";
7
- import { SupportBubble } from "./bubble.js";
8
7
  import { Button } from "./button.js";
9
8
  import { ConversationTimeline, ConversationTimelineContainer, ConversationTimelineEmpty, ConversationTimelineLoading } from "./conversation-timeline.js";
10
9
  import { FileInput, MultimodalInput, SupportInput } from "./multimodal-input.js";
11
10
  import { PageDefinition, Router, RouterProps } from "./router.js";
12
11
  import { TimelineItem, TimelineItemContent, TimelineItemTimestamp } from "./timeline-item.js";
12
+ import { TimelineItemAttachments, TimelineItemFiles, TimelineItemImages, extractFileParts, extractImageParts, hasAttachments } from "./timeline-item-attachments.js";
13
13
  import { TimelineItemGroup, TimelineItemGroupAvatar, TimelineItemGroupContent, TimelineItemGroupHeader, TimelineItemGroupReadIndicator, TimelineItemGroupSeenIndicator } from "./timeline-item-group.js";
14
+ import { SupportTrigger, TriggerProps, TriggerRenderProps } from "./trigger.js";
14
15
  import { SupportWindow } from "./window.js";
15
- export { Avatar, AvatarFallback, AvatarImage, SupportBubble as Bubble, Button, SupportConfig as Config, ConversationTimeline, ConversationTimelineContainer, ConversationTimelineEmpty, ConversationTimelineLoading, FileInput, SupportInput as Input, MultimodalInput, type PageDefinition, Router, type RouterProps, TimelineItem, TimelineItemContent, TimelineItemGroup, TimelineItemGroupAvatar, TimelineItemGroupContent, TimelineItemGroupHeader, TimelineItemGroupReadIndicator, TimelineItemGroupSeenIndicator, TimelineItemTimestamp, TypingIndicator, type TypingIndicatorProps, type TypingParticipant, type TypingParticipantType, SupportWindow as Window };
16
+ export { Avatar, AvatarFallback, AvatarImage, Button, SupportConfig as Config, ConversationTimeline, ConversationTimelineContainer, ConversationTimelineEmpty, ConversationTimelineLoading, FileInput, SupportInput as Input, MultimodalInput, type PageDefinition, Router, type RouterProps, TimelineItem, TimelineItemAttachments, TimelineItemContent, TimelineItemFiles, TimelineItemGroup, TimelineItemGroupAvatar, TimelineItemGroupContent, TimelineItemGroupHeader, TimelineItemGroupReadIndicator, TimelineItemGroupSeenIndicator, TimelineItemImages, TimelineItemTimestamp, SupportTrigger as Trigger, type TriggerProps, type TriggerRenderProps, TypingIndicator, type TypingIndicatorProps, type TypingParticipant, type TypingParticipantType, SupportWindow as Window, extractFileParts, extractImageParts, hasAttachments };