@cossistant/react 0.0.28 → 0.0.29

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 (89) hide show
  1. package/README.md +1 -1
  2. package/api.d.ts +1 -1
  3. package/api.d.ts.map +1 -1
  4. package/checks.d.ts +1 -1
  5. package/checks.d.ts.map +1 -1
  6. package/clsx.d.ts +1 -1
  7. package/clsx.d.ts.map +1 -1
  8. package/coerce.d.ts +1 -1
  9. package/coerce.d.ts.map +1 -1
  10. package/conversation.d.ts +3 -3
  11. package/core.d.ts +1 -1
  12. package/core.d.ts.map +1 -1
  13. package/errors.d.ts +12 -3
  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 -2
  18. package/hooks/private/use-grouped-messages.d.ts +8 -5
  19. package/hooks/private/use-grouped-messages.d.ts.map +1 -1
  20. package/hooks/private/use-grouped-messages.js +44 -11
  21. package/hooks/private/use-grouped-messages.js.map +1 -1
  22. package/hooks/use-conversation-seen.js +1 -1
  23. package/hooks/use-conversation-seen.js.map +1 -1
  24. package/hooks/use-conversation-timeline.d.ts.map +1 -1
  25. package/hooks/use-conversation-timeline.js +1 -3
  26. package/hooks/use-conversation-timeline.js.map +1 -1
  27. package/index.d.ts +2 -2
  28. package/json-schema.d.ts +70 -0
  29. package/json-schema.d.ts.map +1 -0
  30. package/openapi30.d.ts +1 -1
  31. package/openapi30.d.ts.map +1 -1
  32. package/openapi31.d.ts +1 -1
  33. package/openapi31.d.ts.map +1 -1
  34. package/package.json +3 -3
  35. package/parse.d.ts +1 -1
  36. package/parse.d.ts.map +1 -1
  37. package/primitives/avatar/fallback.d.ts.map +1 -1
  38. package/primitives/avatar/fallback.js +1 -1
  39. package/primitives/avatar/fallback.js.map +1 -1
  40. package/primitives/avatar/image.d.ts +1 -1
  41. package/primitives/day-separator.d.ts +76 -0
  42. package/primitives/day-separator.d.ts.map +1 -0
  43. package/primitives/day-separator.js +111 -0
  44. package/primitives/day-separator.js.map +1 -0
  45. package/primitives/index.d.ts +3 -2
  46. package/primitives/index.js +6 -1
  47. package/primitives/index.parts.d.ts +2 -1
  48. package/primitives/index.parts.js +2 -1
  49. package/primitives/multimodal-input.d.ts +2 -2
  50. package/primitives/multimodal-input.d.ts.map +1 -1
  51. package/primitives/timeline-item-group.d.ts.map +1 -1
  52. package/primitives/timeline-item-group.js +1 -1
  53. package/primitives/timeline-item-group.js.map +1 -1
  54. package/primitives/timeline-item.js +1 -1
  55. package/primitives/timeline-item.js.map +1 -1
  56. package/realtime/support-provider.js +4 -0
  57. package/realtime/support-provider.js.map +1 -1
  58. package/realtime-events.d.ts +127 -3
  59. package/realtime-events.d.ts.map +1 -1
  60. package/registries.d.ts +1 -1
  61. package/registries.d.ts.map +1 -1
  62. package/schemas.d.ts +305 -7
  63. package/schemas.d.ts.map +1 -1
  64. package/schemas2.d.ts +29 -4
  65. package/schemas2.d.ts.map +1 -1
  66. package/schemas3.d.ts +1 -1
  67. package/specification-extension.d.ts +1 -1
  68. package/specification-extension.d.ts.map +1 -1
  69. package/standard-schema.d.ts +83 -21
  70. package/standard-schema.d.ts.map +1 -1
  71. package/support/components/button.d.ts +1 -1
  72. package/support/components/conversation-timeline.d.ts +5 -0
  73. package/support/components/conversation-timeline.d.ts.map +1 -1
  74. package/support/components/conversation-timeline.js +22 -2
  75. package/support/components/conversation-timeline.js.map +1 -1
  76. package/support/text/index.d.ts +1 -1
  77. package/support/text/index.d.ts.map +1 -1
  78. package/support/text/index.js.map +1 -1
  79. package/to-json-schema.d.ts +96 -0
  80. package/to-json-schema.d.ts.map +1 -0
  81. package/util.d.ts +6 -2
  82. package/util.d.ts.map +1 -1
  83. package/utils/use-render-element.d.ts.map +1 -1
  84. package/utils/use-render-element.js +18 -3
  85. package/utils/use-render-element.js.map +1 -1
  86. package/versions.d.ts +2 -2
  87. package/versions.d.ts.map +1 -1
  88. package/zod-extensions.d.ts +1 -1
  89. package/zod-extensions.d.ts.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"timeline-item-group.js","names":["React","senderType: SenderType","renderProps: TimelineItemGroupRenderProps","_lastReaderIds: string[]","_readers: Array<{ userId: string; isLastRead: boolean }>"],"sources":["../../src/primitives/timeline-item-group.tsx"],"sourcesContent":["import type { SenderType } from \"@cossistant/types\";\nimport type { TimelineItem as TimelineItemType } from \"@cossistant/types/api/timeline-item\";\nimport * as React from \"react\";\nimport { useRenderElement } from \"../utils/use-render-element\";\n\n/**\n * Shape returned to render-prop children describing the grouped timeline items state\n * and viewer specific flags.\n */\nexport type TimelineItemGroupRenderProps = {\n\t// Sender information\n\tsenderType: SenderType;\n\tsenderId: string;\n\tviewerType?: SenderType;\n\n\t// POV flags - who is viewing\n\tisSentByViewer: boolean; // True if the current viewer sent these items\n\tisReceivedByViewer: boolean; // True if the current viewer received these items\n\n\t// Sender type flags for convenience\n\tisVisitor: boolean;\n\tisAI: boolean;\n\tisTeamMember: boolean;\n\n\t// Item info\n\titemCount: number;\n\tfirstItemId: string | undefined;\n\tlastItemId: string | undefined;\n\n\t// Seen status\n\thasBeenSeenByViewer?: boolean;\n\tseenByIds?: readonly string[]; // IDs of users who have seen the last item in group\n};\n\nexport type TimelineItemGroupProps = Omit<\n\tReact.HTMLAttributes<HTMLDivElement>,\n\t\"children\"\n> & {\n\tchildren?:\n\t\t| React.ReactNode\n\t\t| ((props: TimelineItemGroupRenderProps) => React.ReactNode);\n\tasChild?: boolean;\n\tclassName?: string;\n\titems: TimelineItemType[];\n\n\t// POV context - who is viewing these timeline items\n\tviewerId?: string; // ID of the current viewer\n\tviewerType?: SenderType; // Type of the current viewer\n\n\t// Seen data\n\tseenByIds?: readonly string[]; // IDs of users who have seen these timeline items\n\tlastReadItemIds?: Map<string, string>; // Map of userId -> lastItemId they read\n};\n\n/**\n * Groups sequential timeline items from the same sender and exposes render helpers\n * that describe who sent the batch and whether the active viewer has seen it.\n * Consumers can either render their own layout via a render prop or rely on\n * slotted children. Typically used for MESSAGE-type items; EVENT items are usually rendered separately.\n */\nexport const TimelineItemGroup = (() => {\n\tconst Component = React.forwardRef<HTMLDivElement, TimelineItemGroupProps>(\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\tviewerId,\n\t\t\t\tseenByIds = [] as readonly string[],\n\t\t\t\tlastReadItemIds,\n\t\t\t\t...restProps\n\t\t\t},\n\t\t\tref\n\t\t) => {\n\t\t\tconst { viewerType, ...elementProps } = restProps;\n\n\t\t\t// Determine sender type from first timeline item in group\n\t\t\tconst firstItem = items[0];\n\t\t\t// biome-ignore lint/style/useAtIndex: ok\n\t\t\tconst lastItem = items[items.length - 1];\n\n\t\t\t// Determine sender info\n\t\t\tlet senderId = \"\";\n\t\t\tlet senderType: SenderType;\n\n\t\t\tif (firstItem?.visitorId) {\n\t\t\t\tsenderId = firstItem.visitorId;\n\t\t\t\tsenderType = \"visitor\" as SenderType;\n\t\t\t} else if (firstItem?.aiAgentId) {\n\t\t\t\tsenderId = firstItem.aiAgentId;\n\t\t\t\tsenderType = \"ai\" as SenderType;\n\t\t\t} else if (firstItem?.userId) {\n\t\t\t\tsenderId = firstItem.userId;\n\t\t\t\tsenderType = \"team_member\" as SenderType;\n\t\t\t} else {\n\t\t\t\t// Fallback\n\t\t\t\tsenderId = firstItem?.id || \"unknown\";\n\t\t\t\tsenderType = \"team_member\" as SenderType;\n\t\t\t}\n\n\t\t\t// Determine POV\n\t\t\tconst isSentByViewer = viewerId\n\t\t\t\t? senderId === viewerId\n\t\t\t\t: viewerType\n\t\t\t\t\t? senderType === viewerType\n\t\t\t\t\t: false;\n\t\t\tconst isReceivedByViewer = viewerId\n\t\t\t\t? senderId !== viewerId\n\t\t\t\t: viewerType\n\t\t\t\t\t? senderType !== viewerType\n\t\t\t\t\t: true;\n\n\t\t\t// Convenience flags\n\t\t\tconst isVisitor = senderType === \"visitor\";\n\t\t\tconst isAI = senderType === \"ai\";\n\t\t\tconst isTeamMember = senderType === \"team_member\";\n\n\t\t\t// Check if viewer has seen these timeline items\n\t\t\tconst hasBeenSeenByViewer = viewerId\n\t\t\t\t? seenByIds.includes(viewerId)\n\t\t\t\t: undefined;\n\n\t\t\tconst renderProps: TimelineItemGroupRenderProps = {\n\t\t\t\tsenderType,\n\t\t\t\tsenderId,\n\t\t\t\tviewerType,\n\t\t\t\tisSentByViewer,\n\t\t\t\tisReceivedByViewer,\n\t\t\t\tisVisitor,\n\t\t\t\tisAI,\n\t\t\t\tisTeamMember,\n\t\t\t\titemCount: items.length,\n\t\t\t\tfirstItemId: firstItem?.id,\n\t\t\t\tlastItemId: lastItem?.id,\n\t\t\t\thasBeenSeenByViewer,\n\t\t\t\tseenByIds,\n\t\t\t};\n\n\t\t\tconst content =\n\t\t\t\ttypeof children === \"function\" ? children(renderProps) : children;\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,\n\t\t\t\t\tstate: renderProps,\n\t\t\t\t\tprops: {\n\t\t\t\t\t\trole: \"group\",\n\t\t\t\t\t\t\"aria-label\": `Timeline item group from ${senderType}`,\n\t\t\t\t\t\t...elementProps,\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 = \"TimelineItemGroup\";\n\treturn Component;\n})();\n\nexport type TimelineItemGroupAvatarProps = Omit<\n\tReact.HTMLAttributes<HTMLDivElement>,\n\t\"children\"\n> & {\n\tchildren?: React.ReactNode;\n\tasChild?: boolean;\n\tclassName?: string;\n};\n\n/**\n * Optional slot rendered next to a grouped batch to display an avatar, agent\n * badge or any other sender metadata supplied by the consumer UI.\n */\nexport const TimelineItemGroupAvatar = (() => {\n\tconst Component = React.forwardRef<\n\t\tHTMLDivElement,\n\t\tTimelineItemGroupAvatarProps\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 = \"TimelineItemGroupAvatar\";\n\treturn Component;\n})();\n\nexport type TimelineItemGroupHeaderProps = Omit<\n\tReact.HTMLAttributes<HTMLDivElement>,\n\t\"children\"\n> & {\n\tchildren?:\n\t\t| React.ReactNode\n\t\t| ((props: {\n\t\t\t\tname?: string;\n\t\t\t\tsenderId?: string;\n\t\t\t\tsenderType?: SenderType;\n\t\t }) => React.ReactNode);\n\tasChild?: boolean;\n\tclassName?: string;\n\tname?: string;\n\tsenderId?: string;\n\tsenderType?: SenderType;\n};\n\n/**\n * Decorative or semantic wrapper rendered above a timeline item batch. Useful for\n * injecting agent names, timestamps or custom status labels tied to the sender\n * metadata supplied by `TimelineItemGroup`.\n */\nexport const TimelineItemGroupHeader = (() => {\n\tconst Component = React.forwardRef<\n\t\tHTMLDivElement,\n\t\tTimelineItemGroupHeaderProps\n\t>(\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\tname,\n\t\t\t\tsenderId,\n\t\t\t\tsenderType,\n\t\t\t\t...props\n\t\t\t},\n\t\t\tref\n\t\t) => {\n\t\t\tconst content =\n\t\t\t\ttypeof children === \"function\"\n\t\t\t\t\t? children({ name, senderId, senderType })\n\t\t\t\t\t: children;\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,\n\t\t\t\t\tprops: {\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 = \"TimelineItemGroupHeader\";\n\treturn Component;\n})();\n\nexport type TimelineItemGroupContentProps = Omit<\n\tReact.HTMLAttributes<HTMLDivElement>,\n\t\"children\"\n> & {\n\tchildren?: React.ReactNode;\n\tasChild?: boolean;\n\tclassName?: string;\n};\n\n/**\n * Container for the actual timeline items within a batch. Consumers can\n * override the structure while inheriting layout props passed down from the\n * parent group.\n */\nexport const TimelineItemGroupContent = (() => {\n\tconst Component = React.forwardRef<\n\t\tHTMLDivElement,\n\t\tTimelineItemGroupContentProps\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 = \"TimelineItemGroupContent\";\n\treturn Component;\n})();\n\nexport type TimelineItemGroupSeenIndicatorProps = Omit<\n\tReact.HTMLAttributes<HTMLDivElement>,\n\t\"children\"\n> & {\n\tchildren?:\n\t\t| React.ReactNode\n\t\t| ((props: {\n\t\t\t\tseenByIds: readonly string[];\n\t\t\t\thasBeenSeen: boolean;\n\t\t }) => React.ReactNode);\n\tasChild?: boolean;\n\tclassName?: string;\n\tseenByIds?: readonly string[];\n};\n\n/**\n * Utility slot for showing who has viewed the most recent timeline item in the\n * group. Works with simple text children or a render prop for advanced\n * displays.\n */\nexport const TimelineItemGroupSeenIndicator = (() => {\n\tconst Component = React.forwardRef<\n\t\tHTMLDivElement,\n\t\tTimelineItemGroupSeenIndicatorProps\n\t>(\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\tseenByIds = [] as readonly string[],\n\t\t\t\t...props\n\t\t\t},\n\t\t\tref\n\t\t) => {\n\t\t\tconst hasBeenSeen = seenByIds.length > 0;\n\t\t\tconst content =\n\t\t\t\ttypeof children === \"function\"\n\t\t\t\t\t? children({ seenByIds, hasBeenSeen })\n\t\t\t\t\t: children;\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,\n\t\t\t\t\tprops: {\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 = \"TimelineItemGroupSeenIndicator\";\n\treturn Component;\n})();\n\nexport type TimelineItemGroupReadIndicatorProps = Omit<\n\tReact.HTMLAttributes<HTMLDivElement>,\n\t\"children\"\n> & {\n\tchildren?:\n\t\t| React.ReactNode\n\t\t| ((props: {\n\t\t\t\treaders: Array<{ userId: string; isLastRead: boolean }>;\n\t\t\t\tlastReaderIds: string[];\n\t\t }) => React.ReactNode);\n\tasChild?: boolean;\n\tclassName?: string;\n\titemId: string;\n\tlastReadItemIds?: Map<string, string>;\n};\n\n/**\n * Renders read receipts for the tail timeline item in a group. It surfaces the list\n * of readers and callers can decide whether to render avatars, tooltips or a\n * basic label.\n */\nexport const TimelineItemGroupReadIndicator = (() => {\n\tconst Component = React.forwardRef<\n\t\tHTMLDivElement,\n\t\tTimelineItemGroupReadIndicatorProps\n\t>(\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\titemId,\n\t\t\t\tlastReadItemIds,\n\t\t\t\t...props\n\t\t\t},\n\t\t\tref\n\t\t) => {\n\t\t\t// Find all users who stopped reading at this timeline item\n\t\t\tconst { lastReaderIds, readers } = React.useMemo(() => {\n\t\t\t\tconst _lastReaderIds: string[] = [];\n\t\t\t\tconst _readers: Array<{ userId: string; isLastRead: boolean }> = [];\n\n\t\t\t\tif (lastReadItemIds) {\n\t\t\t\t\tlastReadItemIds.forEach((lastItemId, userId) => {\n\t\t\t\t\t\tif (lastItemId === itemId) {\n\t\t\t\t\t\t\t_lastReaderIds.push(userId);\n\t\t\t\t\t\t\t_readers.push({ userId, isLastRead: true });\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\treturn { lastReaderIds: _lastReaderIds, readers: _readers };\n\t\t\t}, [itemId, lastReadItemIds]);\n\n\t\t\tconst content =\n\t\t\t\ttypeof children === \"function\"\n\t\t\t\t\t? children({ readers, lastReaderIds })\n\t\t\t\t\t: children;\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,\n\t\t\t\t\tprops: {\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 = \"TimelineItemGroupReadIndicator\";\n\treturn Component;\n})();\n"],"mappings":";;;;;;;;;;AA4DA,MAAa,2BAA2B;CACvC,MAAM,YAAYA,QAAM,YAEtB,EACC,UACA,WACA,UAAU,OACV,QAAQ,EAAE,EACV,UACA,YAAY,EAAE,EACd,gBACA,GAAG,aAEJ,QACI;EACJ,MAAM,EAAE,WAAY,GAAG,iBAAiB;EAGxC,MAAM,YAAY,MAAM;EAExB,MAAM,WAAW,MAAM,MAAM,SAAS;EAGtC,IAAI,WAAW;EACf,IAAIC;AAEJ,MAAI,WAAW,WAAW;AACzB,cAAW,UAAU;AACrB,gBAAa;aACH,WAAW,WAAW;AAChC,cAAW,UAAU;AACrB,gBAAa;aACH,WAAW,QAAQ;AAC7B,cAAW,UAAU;AACrB,gBAAa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.js","names":["React","senderType: SenderType","renderProps: TimelineItemGroupRenderProps","_lastReaderIds: string[]","_readers: Array<{ userId: string; isLastRead: boolean }>"],"sources":["../../src/primitives/timeline-item-group.tsx"],"sourcesContent":["import type { SenderType } from \"@cossistant/types\";\nimport type { TimelineItem as TimelineItemType } from \"@cossistant/types/api/timeline-item\";\nimport * as React from \"react\";\nimport { useRenderElement } from \"../utils/use-render-element\";\n\n/**\n * Shape returned to render-prop children describing the grouped timeline items state\n * and viewer specific flags.\n */\nexport type TimelineItemGroupRenderProps = {\n\t// Sender information\n\tsenderType: SenderType;\n\tsenderId: string;\n\tviewerType?: SenderType;\n\n\t// POV flags - who is viewing\n\tisSentByViewer: boolean; // True if the current viewer sent these items\n\tisReceivedByViewer: boolean; // True if the current viewer received these items\n\n\t// Sender type flags for convenience\n\tisVisitor: boolean;\n\tisAI: boolean;\n\tisTeamMember: boolean;\n\n\t// Item info\n\titemCount: number;\n\tfirstItemId: string | undefined;\n\tlastItemId: string | undefined;\n\n\t// Seen status\n\thasBeenSeenByViewer?: boolean;\n\tseenByIds?: readonly string[]; // IDs of users who have seen the last item in group\n};\n\nexport type TimelineItemGroupProps = Omit<\n\tReact.HTMLAttributes<HTMLDivElement>,\n\t\"children\"\n> & {\n\tchildren?:\n\t\t| React.ReactNode\n\t\t| ((props: TimelineItemGroupRenderProps) => React.ReactNode);\n\tasChild?: boolean;\n\tclassName?: string;\n\titems: TimelineItemType[];\n\n\t// POV context - who is viewing these timeline items\n\tviewerId?: string; // ID of the current viewer\n\tviewerType?: SenderType; // Type of the current viewer\n\n\t// Seen data\n\tseenByIds?: readonly string[]; // IDs of users who have seen these timeline items\n\tlastReadItemIds?: Map<string, string>; // Map of userId -> lastItemId they read\n};\n\n/**\n * Groups sequential timeline items from the same sender and exposes render helpers\n * that describe who sent the batch and whether the active viewer has seen it.\n * Consumers can either render their own layout via a render prop or rely on\n * slotted children. Typically used for MESSAGE-type items; EVENT items are usually rendered separately.\n */\nexport const TimelineItemGroup = (() => {\n\tconst Component = React.forwardRef<HTMLDivElement, TimelineItemGroupProps>(\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\tviewerId,\n\t\t\t\tseenByIds = [] as readonly string[],\n\t\t\t\tlastReadItemIds,\n\t\t\t\t...restProps\n\t\t\t},\n\t\t\tref\n\t\t) => {\n\t\t\tconst { viewerType, ...elementProps } = restProps;\n\n\t\t\t// Determine sender type from first timeline item in group\n\t\t\tconst firstItem = items[0];\n\t\t\tconst lastItem = items.at(-1);\n\n\t\t\t// Determine sender info\n\t\t\tlet senderId = \"\";\n\t\t\tlet senderType: SenderType;\n\n\t\t\tif (firstItem?.visitorId) {\n\t\t\t\tsenderId = firstItem.visitorId;\n\t\t\t\tsenderType = \"visitor\" as SenderType;\n\t\t\t} else if (firstItem?.aiAgentId) {\n\t\t\t\tsenderId = firstItem.aiAgentId;\n\t\t\t\tsenderType = \"ai\" as SenderType;\n\t\t\t} else if (firstItem?.userId) {\n\t\t\t\tsenderId = firstItem.userId;\n\t\t\t\tsenderType = \"team_member\" as SenderType;\n\t\t\t} else {\n\t\t\t\t// Fallback\n\t\t\t\tsenderId = firstItem?.id || \"unknown\";\n\t\t\t\tsenderType = \"team_member\" as SenderType;\n\t\t\t}\n\n\t\t\t// Determine POV\n\t\t\tconst isSentByViewer = viewerId\n\t\t\t\t? senderId === viewerId\n\t\t\t\t: viewerType\n\t\t\t\t\t? senderType === viewerType\n\t\t\t\t\t: false;\n\t\t\tconst isReceivedByViewer = viewerId\n\t\t\t\t? senderId !== viewerId\n\t\t\t\t: viewerType\n\t\t\t\t\t? senderType !== viewerType\n\t\t\t\t\t: true;\n\n\t\t\t// Convenience flags\n\t\t\tconst isVisitor = senderType === \"visitor\";\n\t\t\tconst isAI = senderType === \"ai\";\n\t\t\tconst isTeamMember = senderType === \"team_member\";\n\n\t\t\t// Check if viewer has seen these timeline items\n\t\t\tconst hasBeenSeenByViewer = viewerId\n\t\t\t\t? seenByIds.includes(viewerId)\n\t\t\t\t: undefined;\n\n\t\t\tconst renderProps: TimelineItemGroupRenderProps = {\n\t\t\t\tsenderType,\n\t\t\t\tsenderId,\n\t\t\t\tviewerType,\n\t\t\t\tisSentByViewer,\n\t\t\t\tisReceivedByViewer,\n\t\t\t\tisVisitor,\n\t\t\t\tisAI,\n\t\t\t\tisTeamMember,\n\t\t\t\titemCount: items.length,\n\t\t\t\tfirstItemId: firstItem?.id,\n\t\t\t\tlastItemId: lastItem?.id,\n\t\t\t\thasBeenSeenByViewer,\n\t\t\t\tseenByIds,\n\t\t\t};\n\n\t\t\tconst content =\n\t\t\t\ttypeof children === \"function\" ? children(renderProps) : children;\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,\n\t\t\t\t\tstate: renderProps,\n\t\t\t\t\tprops: {\n\t\t\t\t\t\trole: \"group\",\n\t\t\t\t\t\t\"aria-label\": `Timeline item group from ${senderType}`,\n\t\t\t\t\t\t...elementProps,\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 = \"TimelineItemGroup\";\n\treturn Component;\n})();\n\nexport type TimelineItemGroupAvatarProps = Omit<\n\tReact.HTMLAttributes<HTMLDivElement>,\n\t\"children\"\n> & {\n\tchildren?: React.ReactNode;\n\tasChild?: boolean;\n\tclassName?: string;\n};\n\n/**\n * Optional slot rendered next to a grouped batch to display an avatar, agent\n * badge or any other sender metadata supplied by the consumer UI.\n */\nexport const TimelineItemGroupAvatar = (() => {\n\tconst Component = React.forwardRef<\n\t\tHTMLDivElement,\n\t\tTimelineItemGroupAvatarProps\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 = \"TimelineItemGroupAvatar\";\n\treturn Component;\n})();\n\nexport type TimelineItemGroupHeaderProps = Omit<\n\tReact.HTMLAttributes<HTMLDivElement>,\n\t\"children\"\n> & {\n\tchildren?:\n\t\t| React.ReactNode\n\t\t| ((props: {\n\t\t\t\tname?: string;\n\t\t\t\tsenderId?: string;\n\t\t\t\tsenderType?: SenderType;\n\t\t }) => React.ReactNode);\n\tasChild?: boolean;\n\tclassName?: string;\n\tname?: string;\n\tsenderId?: string;\n\tsenderType?: SenderType;\n};\n\n/**\n * Decorative or semantic wrapper rendered above a timeline item batch. Useful for\n * injecting agent names, timestamps or custom status labels tied to the sender\n * metadata supplied by `TimelineItemGroup`.\n */\nexport const TimelineItemGroupHeader = (() => {\n\tconst Component = React.forwardRef<\n\t\tHTMLDivElement,\n\t\tTimelineItemGroupHeaderProps\n\t>(\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\tname,\n\t\t\t\tsenderId,\n\t\t\t\tsenderType,\n\t\t\t\t...props\n\t\t\t},\n\t\t\tref\n\t\t) => {\n\t\t\tconst content =\n\t\t\t\ttypeof children === \"function\"\n\t\t\t\t\t? children({ name, senderId, senderType })\n\t\t\t\t\t: children;\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,\n\t\t\t\t\tprops: {\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 = \"TimelineItemGroupHeader\";\n\treturn Component;\n})();\n\nexport type TimelineItemGroupContentProps = Omit<\n\tReact.HTMLAttributes<HTMLDivElement>,\n\t\"children\"\n> & {\n\tchildren?: React.ReactNode;\n\tasChild?: boolean;\n\tclassName?: string;\n};\n\n/**\n * Container for the actual timeline items within a batch. Consumers can\n * override the structure while inheriting layout props passed down from the\n * parent group.\n */\nexport const TimelineItemGroupContent = (() => {\n\tconst Component = React.forwardRef<\n\t\tHTMLDivElement,\n\t\tTimelineItemGroupContentProps\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 = \"TimelineItemGroupContent\";\n\treturn Component;\n})();\n\nexport type TimelineItemGroupSeenIndicatorProps = Omit<\n\tReact.HTMLAttributes<HTMLDivElement>,\n\t\"children\"\n> & {\n\tchildren?:\n\t\t| React.ReactNode\n\t\t| ((props: {\n\t\t\t\tseenByIds: readonly string[];\n\t\t\t\thasBeenSeen: boolean;\n\t\t }) => React.ReactNode);\n\tasChild?: boolean;\n\tclassName?: string;\n\tseenByIds?: readonly string[];\n};\n\n/**\n * Utility slot for showing who has viewed the most recent timeline item in the\n * group. Works with simple text children or a render prop for advanced\n * displays.\n */\nexport const TimelineItemGroupSeenIndicator = (() => {\n\tconst Component = React.forwardRef<\n\t\tHTMLDivElement,\n\t\tTimelineItemGroupSeenIndicatorProps\n\t>(\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\tseenByIds = [] as readonly string[],\n\t\t\t\t...props\n\t\t\t},\n\t\t\tref\n\t\t) => {\n\t\t\tconst hasBeenSeen = seenByIds.length > 0;\n\t\t\tconst content =\n\t\t\t\ttypeof children === \"function\"\n\t\t\t\t\t? children({ seenByIds, hasBeenSeen })\n\t\t\t\t\t: children;\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,\n\t\t\t\t\tprops: {\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 = \"TimelineItemGroupSeenIndicator\";\n\treturn Component;\n})();\n\nexport type TimelineItemGroupReadIndicatorProps = Omit<\n\tReact.HTMLAttributes<HTMLDivElement>,\n\t\"children\"\n> & {\n\tchildren?:\n\t\t| React.ReactNode\n\t\t| ((props: {\n\t\t\t\treaders: Array<{ userId: string; isLastRead: boolean }>;\n\t\t\t\tlastReaderIds: string[];\n\t\t }) => React.ReactNode);\n\tasChild?: boolean;\n\tclassName?: string;\n\titemId: string;\n\tlastReadItemIds?: Map<string, string>;\n};\n\n/**\n * Renders read receipts for the tail timeline item in a group. It surfaces the list\n * of readers and callers can decide whether to render avatars, tooltips or a\n * basic label.\n */\nexport const TimelineItemGroupReadIndicator = (() => {\n\tconst Component = React.forwardRef<\n\t\tHTMLDivElement,\n\t\tTimelineItemGroupReadIndicatorProps\n\t>(\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\titemId,\n\t\t\t\tlastReadItemIds,\n\t\t\t\t...props\n\t\t\t},\n\t\t\tref\n\t\t) => {\n\t\t\t// Find all users who stopped reading at this timeline item\n\t\t\tconst { lastReaderIds, readers } = React.useMemo(() => {\n\t\t\t\tconst _lastReaderIds: string[] = [];\n\t\t\t\tconst _readers: Array<{ userId: string; isLastRead: boolean }> = [];\n\n\t\t\t\tif (lastReadItemIds) {\n\t\t\t\t\tlastReadItemIds.forEach((lastItemId, userId) => {\n\t\t\t\t\t\tif (lastItemId === itemId) {\n\t\t\t\t\t\t\t_lastReaderIds.push(userId);\n\t\t\t\t\t\t\t_readers.push({ userId, isLastRead: true });\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\treturn { lastReaderIds: _lastReaderIds, readers: _readers };\n\t\t\t}, [itemId, lastReadItemIds]);\n\n\t\t\tconst content =\n\t\t\t\ttypeof children === \"function\"\n\t\t\t\t\t? children({ readers, lastReaderIds })\n\t\t\t\t\t: children;\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,\n\t\t\t\t\tprops: {\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 = \"TimelineItemGroupReadIndicator\";\n\treturn Component;\n})();\n"],"mappings":";;;;;;;;;;AA4DA,MAAa,2BAA2B;CACvC,MAAM,YAAYA,QAAM,YAEtB,EACC,UACA,WACA,UAAU,OACV,QAAQ,EAAE,EACV,UACA,YAAY,EAAE,EACd,gBACA,GAAG,aAEJ,QACI;EACJ,MAAM,EAAE,WAAY,GAAG,iBAAiB;EAGxC,MAAM,YAAY,MAAM;EACxB,MAAM,WAAW,MAAM,GAAG,GAAG;EAG7B,IAAI,WAAW;EACf,IAAIC;AAEJ,MAAI,WAAW,WAAW;AACzB,cAAW,UAAU;AACrB,gBAAa;aACH,WAAW,WAAW;AAChC,cAAW,UAAU;AACrB,gBAAa;aACH,WAAW,QAAQ;AAC7B,cAAW,UAAU;AACrB,gBAAa;SACP;AAEN,cAAW,WAAW,MAAM;AAC5B,gBAAa;;EAId,MAAM,iBAAiB,WACpB,aAAa,WACb,aACC,eAAe,aACf;EACJ,MAAM,qB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,OAAO;GACN,GAAG;GACH;GACA;EACD,CACD,CACD;AAED,WAAU,cAAc;AACxB,QAAO;IACJ;;;;;;AAsBJ,MAAa,wCAAwC;CACpD,MAAM,YAAYA,QAAM,YAKtB,EACC,UACA,WACA,UAAU,OACV,YAAY,EAAE,CACd,GAAG,SAEJ,QACI;EACJ,MAAM,cAAc,UAAU,SAAS;EACvC,MAAM,UACL,OAAO,aAAa,aACjB,SAAS;GAAE;GAAW;GAAa,CAAC,GACpC;AAEJ,SAAO,iBACN,OACA;GACC;GACA;GACA,EACD;GACC;GACA,OAAO;IACN,GAAG;IACH,UAAU;IACV;GACD,CACD;GAEF;AAED,WAAU,cAAc;AACxB,QAAO;IACJ;;;;;;AAuBJ,MAAa,wCAAwC;CACpD,MAAM,YAAYA,QAAM,YAKtB,EACC,UACA,WACA,UAAU,OACV,QACA,gBACA,GAAG,SAEJ,QACI;EAEJ,MAAM,EAAE,eAAe,YAAYA,QAAM,cAAc;GACtD,MAAMG,iBAA2B,EAAE;GACnC,MAAMC,WAA2D,EAAE;AAEnE,OAAI,gBACH,iBAAgB,SAAS,YAAY,WAAW;AAC/C,QAAI,eAAe,QAAQ;AAC1B,oBAAe,KAAK,OAAO;AAC3B,cAAS,KAAK;MAAE;MAAQ,YAAY;MAAM,CAAC;;KAE3C;AAGH,UAAO;IAAE,eAAe;IAAgB,SAAS;IAAU;KACzD,CAAC,QAAQ,gBAAgB,CAAC;EAE7B,MAAM,UACL,OAAO,aAAa,aACjB,SAAS;GAAE;GAAS;GAAe,CAAC,GACpC;AAEJ,SAAO,iBACN,OACA;GACC;GACA;GACA,EACD;GACC;GACA,OAAO;IACN,GAAG;IACH,UAAU;IACV;GACD,CACD;GAEF;AAED,WAAU,cAAc;AACxB,QAAO;IACJ"}
@@ -53,7 +53,7 @@ const MemoizedMarkdownBlock = React$1.memo(({ content }) => {
53
53
  return /* @__PURE__ */ jsx(ReactMarkdown, {
54
54
  components: {
55
55
  p: ({ children }) => /* @__PURE__ */ jsx("span", {
56
- className: "inline",
56
+ className: "block",
57
57
  children
58
58
  }),
59
59
  br: () => /* @__PURE__ */ jsx("br", {}),
@@ -1 +1 @@
1
- {"version":3,"file":"timeline-item.js","names":["React","renderProps: TimelineItemRenderProps"],"sources":["../../src/primitives/timeline-item.tsx"],"sourcesContent":["import type { TimelineItem as TimelineItemType } from \"@cossistant/types/api/timeline-item\";\nimport * as React from \"react\";\nimport ReactMarkdown from \"react-markdown\";\nimport { useRenderElement } from \"../utils/use-render-element\";\n\n/**\n * Metadata describing the origin of a timeline item and pre-parsed content that can\n * be consumed by render-prop children.\n */\nexport type TimelineItemRenderProps = {\n\tisVisitor: boolean;\n\tisAI: boolean;\n\tisHuman: boolean;\n\ttimestamp: Date;\n\ttext: string | null;\n\tsenderType: \"visitor\" | \"ai\" | \"human\";\n\titemType: \"message\" | \"event\" | \"identification\";\n};\n\nexport type TimelineItemProps = Omit<\n\tReact.HTMLAttributes<HTMLDivElement>,\n\t\"children\"\n> & {\n\tchildren?:\n\t\t| React.ReactNode\n\t\t| ((props: TimelineItemRenderProps) => React.ReactNode);\n\tasChild?: boolean;\n\tclassName?: string;\n\titem: TimelineItemType;\n};\n\n/**\n * Generic timeline item wrapper that adds accessibility attributes and resolves the\n * sender type into convenient render props for custom layouts. Works with\n * both MESSAGE and EVENT timeline item types.\n */\nexport const TimelineItem = (() => {\n\tconst Component = React.forwardRef<HTMLDivElement, TimelineItemProps>(\n\t\t({ children, className, asChild = false, item, ...props }, ref) => {\n\t\t\t// Determine sender type from timeline item properties\n\t\t\tconst isVisitor = item.visitorId !== null;\n\t\t\tconst isAI = item.aiAgentId !== null;\n\t\t\tconst isHuman = item.userId !== null && !isVisitor;\n\n\t\t\tconst senderType = isVisitor ? \"visitor\" : isAI ? \"ai\" : \"human\";\n\n\t\t\tconst renderProps: TimelineItemRenderProps = {\n\t\t\t\tisVisitor,\n\t\t\t\tisAI,\n\t\t\t\tisHuman,\n\t\t\t\ttimestamp: new Date(item.createdAt),\n\t\t\t\ttext: item.text,\n\t\t\t\tsenderType,\n\t\t\t\titemType: item.type,\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 itemTypeLabel = (() => {\n\t\t\t\tif (item.type === \"event\") {\n\t\t\t\t\treturn \"Event\";\n\t\t\t\t}\n\t\t\t\tif (item.type === \"identification\") {\n\t\t\t\t\treturn \"Identification\";\n\t\t\t\t}\n\t\t\t\tif (isVisitor) {\n\t\t\t\t\treturn \"visitor\";\n\t\t\t\t}\n\t\t\t\tif (isAI) {\n\t\t\t\t\treturn \"AI assistant\";\n\t\t\t\t}\n\t\t\t\treturn \"human agent\";\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,\n\t\t\t\t\tstate: renderProps,\n\t\t\t\t\tprops: {\n\t\t\t\t\t\trole: \"article\",\n\t\t\t\t\t\t\"aria-label\": `${item.type === \"message\" ? \"Message\" : \"Event\"} from ${itemTypeLabel}`,\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 = \"TimelineItem\";\n\treturn Component;\n})();\n\nconst MemoizedMarkdownBlock = React.memo(\n\t({ content }: { content: string }) => {\n\t\treturn (\n\t\t\t<ReactMarkdown\n\t\t\t\tcomponents={{\n\t\t\t\t\t// Customize paragraph rendering to prevent excessive spacing\n\t\t\t\t\tp: ({ children }) => <span className=\"inline\">{children}</span>,\n\t\t\t\t\t// Ensure proper line break handling\n\t\t\t\t\tbr: () => <br />,\n\t\t\t\t\t// Handle code blocks properly\n\t\t\t\t\tcode: ({ children, ...props }) => {\n\t\t\t\t\t\t// Check if it's inline code by looking at the parent element\n\t\t\t\t\t\tconst isInline = !(\n\t\t\t\t\t\t\t\"className\" in props &&\n\t\t\t\t\t\t\ttypeof props.className === \"string\" &&\n\t\t\t\t\t\t\tprops.className.includes(\"language-\")\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn isInline ? (\n\t\t\t\t\t\t\t<code className=\"rounded bg-co-background-300 px-1 py-0.5 text-xs\">\n\t\t\t\t\t\t\t\t{children}\n\t\t\t\t\t\t\t</code>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<pre className=\"overflow-x-auto rounded bg-co-background-300 p-2\">\n\t\t\t\t\t\t\t\t<code className=\"text-xs\">{children}</code>\n\t\t\t\t\t\t\t</pre>\n\t\t\t\t\t\t);\n\t\t\t\t\t},\n\t\t\t\t\t// Handle strong/bold text\n\t\t\t\t\tstrong: ({ children }) => (\n\t\t\t\t\t\t<strong className=\"font-semibold\">{children}</strong>\n\t\t\t\t\t),\n\t\t\t\t\t// Handle links\n\t\t\t\t\ta: ({ href, children }) => (\n\t\t\t\t\t\t<a\n\t\t\t\t\t\t\tclassName=\"underline hover:opacity-80\"\n\t\t\t\t\t\t\thref={href}\n\t\t\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{children}\n\t\t\t\t\t\t</a>\n\t\t\t\t\t),\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{content}\n\t\t\t</ReactMarkdown>\n\t\t);\n\t},\n\t(prevProps, nextProps) => {\n\t\tif (prevProps.content !== nextProps.content) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n);\n\nMemoizedMarkdownBlock.displayName = \"MemoizedMarkdownBlock\";\n\nexport type TimelineItemContentProps = Omit<\n\tReact.HTMLAttributes<HTMLDivElement>,\n\t\"children\"\n> & {\n\tchildren?: React.ReactNode | ((content: string) => React.ReactNode);\n\tasChild?: boolean;\n\tclassName?: string;\n\ttext?: string | null;\n\trenderMarkdown?: boolean;\n};\n\n/**\n * Renders the content of a timeline item, optionally piping Markdown content through a\n * memoised renderer or handing the raw text to a render prop for custom\n * formatting.\n */\nexport const TimelineItemContent = (() => {\n\tconst Component = React.forwardRef<HTMLDivElement, TimelineItemContentProps>(\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\ttext = \"\",\n\t\t\t\trenderMarkdown = true,\n\t\t\t\t...props\n\t\t\t},\n\t\t\tref\n\t\t) => {\n\t\t\tconst content = React.useMemo(() => {\n\t\t\t\tconst textContent = text ?? \"\";\n\t\t\t\tif (typeof children === \"function\") {\n\t\t\t\t\treturn children(textContent);\n\t\t\t\t}\n\t\t\t\tif (children) {\n\t\t\t\t\treturn children;\n\t\t\t\t}\n\t\t\t\tif (renderMarkdown && textContent) {\n\t\t\t\t\treturn <MemoizedMarkdownBlock content={textContent} />;\n\t\t\t\t}\n\t\t\t\treturn textContent;\n\t\t\t}, [children, text, renderMarkdown]);\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,\n\t\t\t\t\tprops: {\n\t\t\t\t\t\t...props,\n\t\t\t\t\t\tchildren: content,\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t...props.style,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t);\n\n\tComponent.displayName = \"TimelineItemContent\";\n\treturn Component;\n})();\n\nexport type TimelineItemTimestampProps = Omit<\n\tReact.HTMLAttributes<HTMLSpanElement>,\n\t\"children\"\n> & {\n\tchildren?: React.ReactNode | ((timestamp: Date) => React.ReactNode);\n\tasChild?: boolean;\n\tclassName?: string;\n\ttimestamp: Date;\n\tformat?: (date: Date) => string;\n};\n\n/**\n * Timestamp helper that renders a formatted date or allows callers to supply a\n * render prop for custom time displays while preserving semantic markup.\n */\nexport const TimelineItemTimestamp = (() => {\n\tconst Component = React.forwardRef<\n\t\tHTMLSpanElement,\n\t\tTimelineItemTimestampProps\n\t>(\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\ttimestamp,\n\t\t\t\tformat = (date) =>\n\t\t\t\t\tdate.toLocaleTimeString([], {\n\t\t\t\t\t\thour: \"2-digit\",\n\t\t\t\t\t\tminute: \"2-digit\",\n\t\t\t\t\t}),\n\t\t\t\t...props\n\t\t\t},\n\t\t\tref\n\t\t) => {\n\t\t\tconst content =\n\t\t\t\ttypeof children === \"function\"\n\t\t\t\t\t? children(timestamp)\n\t\t\t\t\t: children || format(timestamp);\n\n\t\t\treturn useRenderElement(\n\t\t\t\t\"span\",\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,\n\t\t\t\t\tprops: {\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 = \"TimelineItemTimestamp\";\n\treturn Component;\n})();\n"],"mappings":";;;;;;;;;;;AAoCA,MAAa,sBAAsB;CAClC,MAAM,YAAYA,QAAM,YACtB,EAAE,UAAU,WAAW,UAAU,OAAO,KAAM,GAAG,SAAS,QAAQ;EAElE,MAAM,YAAY,KAAK,cAAc;EACrC,MAAM,OAAO,KAAK,cAAc;EAChC,MAAM,UAAU,KAAK,WAAW,QAAQ,CAAC;EAEzC,MAAM,aAAa,YAAY,YAAY,OAAO,OAAO;EAEzD,MAAMC,cAAuC;GAC5C;GACA;GACA;GACA,WAAW,IAAI,KAAK,KAAK,UAAU;GACnC,MAAM,KAAK;GACX;GACA,UAAU,KAAK;GACf;EAED,MAAM,UACL,OAAO,aAAa,aAAa,SAAS,YAAY,GAAG;EAE1D,MAAM,uBAAuB;AAC5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SACH,QAAO;AAER,OAAI,kBAAkB,YACrB,QAAO,oBAAC,yBAAsB,SAAS,cAAe;AAEvD,UAAO;KACL;GAAC;GAAU;GAAM;GAAe,CAAC;AAEpC,SAAO,iBACN,OACA;GACC;GACA;GACA,EACD;GACC;GACA,OAAO;IACN,GAAG;IACH,UAAU;IACV,OAAO,EACN,GAAG,MAAM,OACT;IACD;GACD,CACD;GAEF;AAED,WAAU,cAAc;AACxB,QAAO;IACJ;;;;;AAiBJ,MAAa,+BAA+B;CAC3C,MAAM,YAAYA,QAAM,YAKtB,EACC,UACA,WACA,UAAU,OACV,WACA,UAAU,SACT,KAAK,mBAAmB,EAAE,EAAE;EAC3B,MAAM;EACN,QAAQ;EACR,CAAC,CACH,GAAG,SAEJ,QACI;EACJ,MAAM,UACL,OAAO,aAAa,aACjB,SAAS,UAAU,GACnB,YAAY,OAAO,UAAU;AAEjC,SAAO,iBACN,QACA;GACC;GACA;GACA,EACD;GACC;GACA,OAAO;IACN,GAAG;IACH,UAAU;IACV;GACD,CACD;GAEF;AAED,WAAU,cAAc;AACxB,QAAO;IACJ"}
1
+ {"version":3,"file":"timeline-item.js","names":["React","renderProps: TimelineItemRenderProps"],"sources":["../../src/primitives/timeline-item.tsx"],"sourcesContent":["import type { TimelineItem as TimelineItemType } from \"@cossistant/types/api/timeline-item\";\nimport * as React from \"react\";\nimport ReactMarkdown from \"react-markdown\";\nimport { useRenderElement } from \"../utils/use-render-element\";\n\n/**\n * Metadata describing the origin of a timeline item and pre-parsed content that can\n * be consumed by render-prop children.\n */\nexport type TimelineItemRenderProps = {\n\tisVisitor: boolean;\n\tisAI: boolean;\n\tisHuman: boolean;\n\ttimestamp: Date;\n\ttext: string | null;\n\tsenderType: \"visitor\" | \"ai\" | \"human\";\n\titemType: \"message\" | \"event\" | \"identification\";\n};\n\nexport type TimelineItemProps = Omit<\n\tReact.HTMLAttributes<HTMLDivElement>,\n\t\"children\"\n> & {\n\tchildren?:\n\t\t| React.ReactNode\n\t\t| ((props: TimelineItemRenderProps) => React.ReactNode);\n\tasChild?: boolean;\n\tclassName?: string;\n\titem: TimelineItemType;\n};\n\n/**\n * Generic timeline item wrapper that adds accessibility attributes and resolves the\n * sender type into convenient render props for custom layouts. Works with\n * both MESSAGE and EVENT timeline item types.\n */\nexport const TimelineItem = (() => {\n\tconst Component = React.forwardRef<HTMLDivElement, TimelineItemProps>(\n\t\t({ children, className, asChild = false, item, ...props }, ref) => {\n\t\t\t// Determine sender type from timeline item properties\n\t\t\tconst isVisitor = item.visitorId !== null;\n\t\t\tconst isAI = item.aiAgentId !== null;\n\t\t\tconst isHuman = item.userId !== null && !isVisitor;\n\n\t\t\tconst senderType = isVisitor ? \"visitor\" : isAI ? \"ai\" : \"human\";\n\n\t\t\tconst renderProps: TimelineItemRenderProps = {\n\t\t\t\tisVisitor,\n\t\t\t\tisAI,\n\t\t\t\tisHuman,\n\t\t\t\ttimestamp: new Date(item.createdAt),\n\t\t\t\ttext: item.text,\n\t\t\t\tsenderType,\n\t\t\t\titemType: item.type,\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 itemTypeLabel = (() => {\n\t\t\t\tif (item.type === \"event\") {\n\t\t\t\t\treturn \"Event\";\n\t\t\t\t}\n\t\t\t\tif (item.type === \"identification\") {\n\t\t\t\t\treturn \"Identification\";\n\t\t\t\t}\n\t\t\t\tif (isVisitor) {\n\t\t\t\t\treturn \"visitor\";\n\t\t\t\t}\n\t\t\t\tif (isAI) {\n\t\t\t\t\treturn \"AI assistant\";\n\t\t\t\t}\n\t\t\t\treturn \"human agent\";\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,\n\t\t\t\t\tstate: renderProps,\n\t\t\t\t\tprops: {\n\t\t\t\t\t\trole: \"article\",\n\t\t\t\t\t\t\"aria-label\": `${item.type === \"message\" ? \"Message\" : \"Event\"} from ${itemTypeLabel}`,\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 = \"TimelineItem\";\n\treturn Component;\n})();\n\nconst MemoizedMarkdownBlock = React.memo(\n\t({ content }: { content: string }) => {\n\t\treturn (\n\t\t\t<ReactMarkdown\n\t\t\t\tcomponents={{\n\t\t\t\t\t// Render paragraphs as block elements to preserve multiline spacing\n\t\t\t\t\tp: ({ children }) => <span className=\"block\">{children}</span>,\n\t\t\t\t\t// Ensure proper line break handling\n\t\t\t\t\tbr: () => <br />,\n\t\t\t\t\t// Handle code blocks properly\n\t\t\t\t\tcode: ({ children, ...props }) => {\n\t\t\t\t\t\t// Check if it's inline code by looking at the parent element\n\t\t\t\t\t\tconst isInline = !(\n\t\t\t\t\t\t\t\"className\" in props &&\n\t\t\t\t\t\t\ttypeof props.className === \"string\" &&\n\t\t\t\t\t\t\tprops.className.includes(\"language-\")\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn isInline ? (\n\t\t\t\t\t\t\t<code className=\"rounded bg-co-background-300 px-1 py-0.5 text-xs\">\n\t\t\t\t\t\t\t\t{children}\n\t\t\t\t\t\t\t</code>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<pre className=\"overflow-x-auto rounded bg-co-background-300 p-2\">\n\t\t\t\t\t\t\t\t<code className=\"text-xs\">{children}</code>\n\t\t\t\t\t\t\t</pre>\n\t\t\t\t\t\t);\n\t\t\t\t\t},\n\t\t\t\t\t// Handle strong/bold text\n\t\t\t\t\tstrong: ({ children }) => (\n\t\t\t\t\t\t<strong className=\"font-semibold\">{children}</strong>\n\t\t\t\t\t),\n\t\t\t\t\t// Handle links\n\t\t\t\t\ta: ({ href, children }) => (\n\t\t\t\t\t\t<a\n\t\t\t\t\t\t\tclassName=\"underline hover:opacity-80\"\n\t\t\t\t\t\t\thref={href}\n\t\t\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{children}\n\t\t\t\t\t\t</a>\n\t\t\t\t\t),\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{content}\n\t\t\t</ReactMarkdown>\n\t\t);\n\t},\n\t(prevProps, nextProps) => {\n\t\tif (prevProps.content !== nextProps.content) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n);\n\nMemoizedMarkdownBlock.displayName = \"MemoizedMarkdownBlock\";\n\nexport type TimelineItemContentProps = Omit<\n\tReact.HTMLAttributes<HTMLDivElement>,\n\t\"children\"\n> & {\n\tchildren?: React.ReactNode | ((content: string) => React.ReactNode);\n\tasChild?: boolean;\n\tclassName?: string;\n\ttext?: string | null;\n\trenderMarkdown?: boolean;\n};\n\n/**\n * Renders the content of a timeline item, optionally piping Markdown content through a\n * memoised renderer or handing the raw text to a render prop for custom\n * formatting.\n */\nexport const TimelineItemContent = (() => {\n\tconst Component = React.forwardRef<HTMLDivElement, TimelineItemContentProps>(\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\ttext = \"\",\n\t\t\t\trenderMarkdown = true,\n\t\t\t\t...props\n\t\t\t},\n\t\t\tref\n\t\t) => {\n\t\t\tconst content = React.useMemo(() => {\n\t\t\t\tconst textContent = text ?? \"\";\n\t\t\t\tif (typeof children === \"function\") {\n\t\t\t\t\treturn children(textContent);\n\t\t\t\t}\n\t\t\t\tif (children) {\n\t\t\t\t\treturn children;\n\t\t\t\t}\n\t\t\t\tif (renderMarkdown && textContent) {\n\t\t\t\t\treturn <MemoizedMarkdownBlock content={textContent} />;\n\t\t\t\t}\n\t\t\t\treturn textContent;\n\t\t\t}, [children, text, renderMarkdown]);\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,\n\t\t\t\t\tprops: {\n\t\t\t\t\t\t...props,\n\t\t\t\t\t\tchildren: content,\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t...props.style,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t);\n\n\tComponent.displayName = \"TimelineItemContent\";\n\treturn Component;\n})();\n\nexport type TimelineItemTimestampProps = Omit<\n\tReact.HTMLAttributes<HTMLSpanElement>,\n\t\"children\"\n> & {\n\tchildren?: React.ReactNode | ((timestamp: Date) => React.ReactNode);\n\tasChild?: boolean;\n\tclassName?: string;\n\ttimestamp: Date;\n\tformat?: (date: Date) => string;\n};\n\n/**\n * Timestamp helper that renders a formatted date or allows callers to supply a\n * render prop for custom time displays while preserving semantic markup.\n */\nexport const TimelineItemTimestamp = (() => {\n\tconst Component = React.forwardRef<\n\t\tHTMLSpanElement,\n\t\tTimelineItemTimestampProps\n\t>(\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\ttimestamp,\n\t\t\t\tformat = (date) =>\n\t\t\t\t\tdate.toLocaleTimeString([], {\n\t\t\t\t\t\thour: \"2-digit\",\n\t\t\t\t\t\tminute: \"2-digit\",\n\t\t\t\t\t}),\n\t\t\t\t...props\n\t\t\t},\n\t\t\tref\n\t\t) => {\n\t\t\tconst content =\n\t\t\t\ttypeof children === \"function\"\n\t\t\t\t\t? children(timestamp)\n\t\t\t\t\t: children || format(timestamp);\n\n\t\t\treturn useRenderElement(\n\t\t\t\t\"span\",\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,\n\t\t\t\t\tprops: {\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 = \"TimelineItemTimestamp\";\n\treturn Component;\n})();\n"],"mappings":";;;;;;;;;;;AAoCA,MAAa,sBAAsB;CAClC,MAAM,YAAYA,QAAM,YACtB,EAAE,UAAU,WAAW,UAAU,OAAO,KAAM,GAAG,SAAS,QAAQ;EAElE,MAAM,YAAY,KAAK,cAAc;EACrC,MAAM,OAAO,KAAK,cAAc;EAChC,MAAM,UAAU,KAAK,WAAW,QAAQ,CAAC;EAEzC,MAAM,aAAa,YAAY,YAAY,OAAO,OAAO;EAEzD,MAAMC,cAAuC;GAC5C;GACA;GACA;GACA,WAAW,IAAI,KAAK,KAAK,UAAU;GACnC,MAAM,KAAK;GACX;GACA,UAAU,KAAK;GACf;EAED,MAAM,UACL,OAAO,aAAa,aAAa,SAAS,YAAY,GAAG;EAE1D,MAAM,uBAAuB;AAC5B,OAAI,KAAK,SAAS,QACjB,QAAO;AAER,OAAI,KAAK,SAAS,iBACjB,QAAO;AAER,OAAI,UACH,QAAO;AAER,OAAI,KACH,QAAO;AAER,UAAO;MACJ;AAEJ,SAAO,iBACN,OACA;GACC;GACA;GACA,EACD;GACC;GACA,OAAO;GACP,OAAO;IACN,MAAM;IACN,cAAc,GAAG,KAAK,SAAS,YAAY,YAAY,QAAQ,QAAQ;IACvE,GAAG;IACH,UAAU;IACV;GACD,CACD;GAEF;AAED,WAAU,cAAc;AACxB,QAAO;IACJ;AAEJ,MAAM,wBAAwBD,QAAM,MAClC,EAAE,cAAmC;AACrC,QACC,oBAAC;EACA,YAAY;GAEX,IAAI,EAAE,eAAe,oBAAC;IAAK,WAAU;IAAS;KAAgB;GAE9D,UAAU,oBAAC,SAAK;GAEhB,OAAO,EAAE,SAAU,GAAG,YAAY;AAOjC,WALiB,EAChB,eAAe,SACf,OAAO,MAAM,cAAc,YAC3B,MAAM,UAAU,SAAS,YAAY,IAGrC,oBAAC;KAAK,WAAU;K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AED,WAAU,cAAc;AACxB,QAAO;IACJ"}
@@ -36,6 +36,10 @@ function SupportRealtimeProvider({ children }) {
36
36
  conversationTyping: (_data, { event, context }) => {
37
37
  if (context.websiteId && event.payload.websiteId !== context.websiteId) return;
38
38
  applyConversationTypingEvent(event, { ignoreVisitorId: context.visitorId });
39
+ },
40
+ conversationUpdated: (_data, { event, context }) => {
41
+ if (context.websiteId && event.payload.websiteId !== context.websiteId) return;
42
+ context.client.handleConversationUpdated(event);
39
43
  }
40
44
  }), []),
41
45
  websiteId: realtimeContext.websiteId,
@@ -1 +1 @@
1
- {"version":3,"file":"support-provider.js","names":[],"sources":["../../src/realtime/support-provider.tsx"],"sourcesContent":["import type { CossistantClient } from \"@cossistant/core\";\nimport type { RealtimeEvent } from \"@cossistant/types/realtime-events\";\nimport type React from \"react\";\nimport { useMemo } from \"react\";\nimport { useSupport } from \"../provider\";\nimport { applyConversationSeenEvent } from \"./seen-store\";\nimport {\n\tapplyConversationTypingEvent,\n\tclearTypingFromTimelineItem,\n} from \"./typing-store\";\nimport { useRealtime } from \"./use-realtime\";\n\ntype SupportRealtimeContext = {\n\twebsiteId: string | null;\n\tvisitorId: string | null;\n\tclient: CossistantClient;\n};\n\ntype SupportRealtimeProviderProps = {\n\tchildren: React.ReactNode;\n};\n\n/**\n * Bridges websocket events into the core client stores so support hooks stay\n * in sync without forcing refetches.\n */\nexport function SupportRealtimeProvider({\n\tchildren,\n}: SupportRealtimeProviderProps): React.ReactElement {\n\tconst { website, client, visitor } = useSupport();\n\n\tconst realtimeContext = useMemo<SupportRealtimeContext>(\n\t\t() => ({\n\t\t\twebsiteId: website?.id ?? null,\n\t\t\tvisitorId: visitor?.id ?? null,\n\t\t\tclient,\n\t\t}),\n\t\t[website?.id, visitor?.id, client]\n\t);\n\n\tconst events = useMemo(\n\t\t() => ({\n\t\t\ttimelineItemCreated: (\n\t\t\t\t_data: unknown,\n\t\t\t\t{\n\t\t\t\t\tevent,\n\t\t\t\t\tcontext,\n\t\t\t\t}: {\n\t\t\t\t\tevent: RealtimeEvent<\"timelineItemCreated\">;\n\t\t\t\t\tcontext: SupportRealtimeContext;\n\t\t\t\t}\n\t\t\t) => {\n\t\t\t\tif (\n\t\t\t\t\tcontext.websiteId &&\n\t\t\t\t\tevent.payload.websiteId !== context.websiteId\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Clear typing state when a timeline item is created\n\t\t\t\tclearTypingFromTimelineItem(event);\n\n\t\t\t\tcontext.client.handleRealtimeEvent(event);\n\t\t\t},\n\t\t\tconversationSeen: (\n\t\t\t\t_data: unknown,\n\t\t\t\t{\n\t\t\t\t\tevent,\n\t\t\t\t\tcontext,\n\t\t\t\t}: {\n\t\t\t\t\tevent: RealtimeEvent<\"conversationSeen\">;\n\t\t\t\t\tcontext: SupportRealtimeContext;\n\t\t\t\t}\n\t\t\t) => {\n\t\t\t\tif (\n\t\t\t\t\tcontext.websiteId &&\n\t\t\t\t\tevent.payload.websiteId !== context.websiteId\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Update the seen store so the UI reflects who has seen messages\n\t\t\t\t// Ignore events from the current visitor (their own seen updates are handled optimistically)\n\t\t\t\tapplyConversationSeenEvent(event, {\n\t\t\t\t\tignoreVisitorId: context.visitorId,\n\t\t\t\t});\n\t\t\t},\n\t\t\tconversationTyping: (\n\t\t\t\t_data: unknown,\n\t\t\t\t{\n\t\t\t\t\tevent,\n\t\t\t\t\tcontext,\n\t\t\t\t}: {\n\t\t\t\t\tevent: RealtimeEvent<\"conversationTyping\">;\n\t\t\t\t\tcontext: SupportRealtimeContext;\n\t\t\t\t}\n\t\t\t) => {\n\t\t\t\tif (\n\t\t\t\t\tcontext.websiteId &&\n\t\t\t\t\tevent.payload.websiteId !== context.websiteId\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Update typing store, but ignore events from the current visitor (their own typing)\n\t\t\t\t// Note: We use context.visitorId which is fresh from the context object\n\t\t\t\tapplyConversationTypingEvent(event, {\n\t\t\t\t\tignoreVisitorId: context.visitorId,\n\t\t\t\t});\n\t\t\t},\n\t\t}),\n\t\t// Empty dependencies is fine here since we use the context parameter\n\t\t// which always has fresh data from the memoized realtimeContext\n\t\t[]\n\t);\n\n\tuseRealtime<SupportRealtimeContext>({\n\t\tcontext: realtimeContext,\n\t\tevents,\n\t\twebsiteId: realtimeContext.websiteId,\n\t\tvisitorId: realtimeContext.visitorId,\n\t});\n\n\treturn <>{children}</>;\n}\n"],"mappings":";;;;;;;;;;;;AA0BA,SAAgB,wBAAwB,EACvC,YACoD;CACpD,MAAM,EAAE,SAAS,QAAQ,YAAY,YAAY;CAEjD,MAAM,kBAAkB,eAChB;EACN,WAAW,SAAS,MAAM;EAC1B,WAAW,SAAS,MAAM;EAC1B;EACA,GACD;EAAC,SAAS;EAAI,SAAS;EAAI;EAAO,CAClC;AA8ED,aAAoC;EACnC,SAAS;EACT,QA9Ec,eACP;GACN,sBACC,OACA,EACC,OACA,cAKG;AACJ,QACC,QAAQ,aACR,MAAM,QAAQ,cAAc,QAAQ,UAEpC;AAID,gCAA4B,MAAM;AAElC,YAAQ,OAAO,oBAAoB,MAAM;;GAE1C,mBACC,OACA,EACC,OACA,cAKG;AACJ,QACC,QAAQ,aACR,MAAM,QAAQ,cAAc,QAAQ,UAEpC;AAKD,+BAA2B,OAAO,EACjC,iBAAiB,QAAQ,WACzB,CAAC;;GAEH,qBACC,OACA,EACC,OACA,cAKG;AACJ,QACC,QAAQ,aACR,MAAM,QAAQ,cAAc,QAAQ,UAEpC;AAKD,iCAA6B,OAAO,EACnC,iBAAiB,QAAQ,WACzB,CAAC;;GAEH,GAGD,EAAE,CACF;EAKA,WAAW,gBAAgB;EAC3B,WAAW,gBAAgB;EAC3B,CAAC;AAEF,QAAO,gCAAG,WAAY"}
1
+ {"version":3,"file":"support-provider.js","names":[],"sources":["../../src/realtime/support-provider.tsx"],"sourcesContent":["import type { CossistantClient } from \"@cossistant/core\";\nimport type { RealtimeEvent } from \"@cossistant/types/realtime-events\";\nimport type React from \"react\";\nimport { useMemo } from \"react\";\nimport { useSupport } from \"../provider\";\nimport { applyConversationSeenEvent } from \"./seen-store\";\nimport {\n\tapplyConversationTypingEvent,\n\tclearTypingFromTimelineItem,\n} from \"./typing-store\";\nimport { useRealtime } from \"./use-realtime\";\n\ntype SupportRealtimeContext = {\n\twebsiteId: string | null;\n\tvisitorId: string | null;\n\tclient: CossistantClient;\n};\n\ntype SupportRealtimeProviderProps = {\n\tchildren: React.ReactNode;\n};\n\n/**\n * Bridges websocket events into the core client stores so support hooks stay\n * in sync without forcing refetches.\n */\nexport function SupportRealtimeProvider({\n\tchildren,\n}: SupportRealtimeProviderProps): React.ReactElement {\n\tconst { website, client, visitor } = useSupport();\n\n\tconst realtimeContext = useMemo<SupportRealtimeContext>(\n\t\t() => ({\n\t\t\twebsiteId: website?.id ?? null,\n\t\t\tvisitorId: visitor?.id ?? null,\n\t\t\tclient,\n\t\t}),\n\t\t[website?.id, visitor?.id, client]\n\t);\n\n\tconst events = useMemo(\n\t\t() => ({\n\t\t\ttimelineItemCreated: (\n\t\t\t\t_data: unknown,\n\t\t\t\t{\n\t\t\t\t\tevent,\n\t\t\t\t\tcontext,\n\t\t\t\t}: {\n\t\t\t\t\tevent: RealtimeEvent<\"timelineItemCreated\">;\n\t\t\t\t\tcontext: SupportRealtimeContext;\n\t\t\t\t}\n\t\t\t) => {\n\t\t\t\tif (\n\t\t\t\t\tcontext.websiteId &&\n\t\t\t\t\tevent.payload.websiteId !== context.websiteId\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Clear typing state when a timeline item is created\n\t\t\t\tclearTypingFromTimelineItem(event);\n\n\t\t\t\tcontext.client.handleRealtimeEvent(event);\n\t\t\t},\n\t\t\tconversationSeen: (\n\t\t\t\t_data: unknown,\n\t\t\t\t{\n\t\t\t\t\tevent,\n\t\t\t\t\tcontext,\n\t\t\t\t}: {\n\t\t\t\t\tevent: RealtimeEvent<\"conversationSeen\">;\n\t\t\t\t\tcontext: SupportRealtimeContext;\n\t\t\t\t}\n\t\t\t) => {\n\t\t\t\tif (\n\t\t\t\t\tcontext.websiteId &&\n\t\t\t\t\tevent.payload.websiteId !== context.websiteId\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Update the seen store so the UI reflects who has seen messages\n\t\t\t\t// Ignore events from the current visitor (their own seen updates are handled optimistically)\n\t\t\t\tapplyConversationSeenEvent(event, {\n\t\t\t\t\tignoreVisitorId: context.visitorId,\n\t\t\t\t});\n\t\t\t},\n\t\t\tconversationTyping: (\n\t\t\t\t_data: unknown,\n\t\t\t\t{\n\t\t\t\t\tevent,\n\t\t\t\t\tcontext,\n\t\t\t\t}: {\n\t\t\t\t\tevent: RealtimeEvent<\"conversationTyping\">;\n\t\t\t\t\tcontext: SupportRealtimeContext;\n\t\t\t\t}\n\t\t\t) => {\n\t\t\t\tif (\n\t\t\t\t\tcontext.websiteId &&\n\t\t\t\t\tevent.payload.websiteId !== context.websiteId\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Update typing store, but ignore events from the current visitor (their own typing)\n\t\t\t\t// Note: We use context.visitorId which is fresh from the context object\n\t\t\t\tapplyConversationTypingEvent(event, {\n\t\t\t\t\tignoreVisitorId: context.visitorId,\n\t\t\t\t});\n\t\t\t},\n\t\t\tconversationUpdated: (\n\t\t\t\t_data: unknown,\n\t\t\t\t{\n\t\t\t\t\tevent,\n\t\t\t\t\tcontext,\n\t\t\t\t}: {\n\t\t\t\t\tevent: RealtimeEvent<\"conversationUpdated\">;\n\t\t\t\t\tcontext: SupportRealtimeContext;\n\t\t\t\t}\n\t\t\t) => {\n\t\t\t\tif (\n\t\t\t\t\tcontext.websiteId &&\n\t\t\t\t\tevent.payload.websiteId !== context.websiteId\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Update conversation store with new title, sentiment, escalation status\n\t\t\t\tcontext.client.handleConversationUpdated(event);\n\t\t\t},\n\t\t}),\n\t\t// Empty dependencies is fine here since we use the context parameter\n\t\t// which always has fresh data from the memoized realtimeContext\n\t\t[]\n\t);\n\n\tuseRealtime<SupportRealtimeContext>({\n\t\tcontext: realtimeContext,\n\t\tevents,\n\t\twebsiteId: realtimeContext.websiteId,\n\t\tvisitorId: realtimeContext.visitorId,\n\t});\n\n\treturn <>{children}</>;\n}\n"],"mappings":";;;;;;;;;;;;AA0BA,SAAgB,wBAAwB,EACvC,YACoD;CACpD,MAAM,EAAE,SAAS,QAAQ,YAAY,YAAY;CAEjD,MAAM,kBAAkB,eAChB;EACN,WAAW,SAAS,MAAM;EAC1B,WAAW,SAAS,MAAM;EAC1B;EACA,GACD;EAAC,SAAS;EAAI,SAAS;EAAI;EAAO,CAClC;AAkGD,aAAoC;EACnC,SAAS;EACT,QAlGc,eACP;GACN,sBACC,OACA,EACC,OACA,cAKG;AACJ,QACC,QAAQ,aACR,MAAM,QAAQ,cAAc,QAAQ,UAEpC;AAID,gCAA4B,MAAM;AAElC,YAAQ,OAAO,oBAAoB,MAAM;;GAE1C,mBACC,OACA,EACC,OACA,cAKG;AACJ,QACC,QAAQ,aACR,MAAM,QAAQ,cAAc,QAAQ,UAEpC;AAKD,+BAA2B,OAAO,EACjC,iBAAiB,QAAQ,WACzB,CAAC;;GAEH,qBACC,OACA,EACC,OACA,cAKG;AACJ,QACC,QAAQ,aACR,MAAM,QAAQ,cAAc,QAAQ,UAEpC;AAKD,iCAA6B,OAAO,EACnC,iBAAiB,QAAQ,WACzB,CAAC;;GAEH,sBACC,OACA,EACC,OACA,cAKG;AACJ,QACC,QAAQ,aACR,MAAM,QAAQ,cAAc,QAAQ,UAEpC;AAID,YAAQ,OAAO,0BAA0B,MAAM;;GAEhD,GAGD,EAAE,CACF;EAKA,WAAW,gBAAgB;EAC3B,WAAW,gBAAgB;EAC3B,CAAC;AAEF,QAAO,gCAAG,WAAY"}
@@ -111,8 +111,8 @@ declare const realtimeSchema: {
111
111
  visitorId: ZodString;
112
112
  websiteId: ZodString;
113
113
  status: ZodDefault<ZodEnum<{
114
- resolved: "resolved";
115
114
  open: "open";
115
+ resolved: "resolved";
116
116
  spam: "spam";
117
117
  }>>;
118
118
  deletedAt: ZodDefault<ZodNullable<ZodString>>;
@@ -190,14 +190,14 @@ declare const realtimeSchema: {
190
190
  header: ZodObject<{
191
191
  id: ZodString;
192
192
  status: ZodEnum<{
193
- resolved: "resolved";
194
193
  open: "open";
194
+ resolved: "resolved";
195
195
  spam: "spam";
196
196
  }>;
197
197
  priority: ZodEnum<{
198
+ normal: "normal";
198
199
  high: "high";
199
200
  low: "low";
200
- normal: "normal";
201
201
  urgent: "urgent";
202
202
  }>;
203
203
  organizationId: ZodString;
@@ -225,6 +225,12 @@ declare const realtimeSchema: {
225
225
  resolvedAt: ZodNullable<ZodString>;
226
226
  resolvedByUserId: ZodNullable<ZodString>;
227
227
  resolvedByAiAgentId: ZodNullable<ZodString>;
228
+ escalatedAt: ZodNullable<ZodString>;
229
+ escalatedByAiAgentId: ZodNullable<ZodString>;
230
+ escalationReason: ZodNullable<ZodString>;
231
+ escalationHandledAt: ZodNullable<ZodString>;
232
+ escalationHandledByUserId: ZodNullable<ZodString>;
233
+ aiPausedUntil: ZodNullable<ZodString>;
228
234
  createdAt: ZodString;
229
235
  updatedAt: ZodString;
230
236
  deletedAt: ZodNullable<ZodString>;
@@ -468,6 +474,124 @@ declare const realtimeSchema: {
468
474
  deletedAt: ZodNullable<ZodString>;
469
475
  }, $strip>;
470
476
  }, $strip>;
477
+ readonly conversationUpdated: ZodObject<{
478
+ websiteId: ZodString;
479
+ organizationId: ZodString;
480
+ visitorId: ZodNullable<ZodString>;
481
+ userId: ZodNullable<ZodString>;
482
+ conversationId: ZodString;
483
+ updates: ZodObject<{
484
+ title: ZodOptional<ZodNullable<ZodString>>;
485
+ sentiment: ZodOptional<ZodNullable<ZodEnum<{
486
+ positive: "positive";
487
+ negative: "negative";
488
+ neutral: "neutral";
489
+ }>>>;
490
+ sentimentConfidence: ZodOptional<ZodNullable<ZodNumber>>;
491
+ escalatedAt: ZodOptional<ZodNullable<ZodString>>;
492
+ escalationReason: ZodOptional<ZodNullable<ZodString>>;
493
+ }, $strip>;
494
+ aiAgentId: ZodNullable<ZodString>;
495
+ }, $strip>;
496
+ readonly crawlStarted: ZodObject<{
497
+ websiteId: ZodString;
498
+ organizationId: ZodString;
499
+ visitorId: ZodNullable<ZodString>;
500
+ userId: ZodNullable<ZodString>;
501
+ linkSourceId: ZodString;
502
+ url: ZodString;
503
+ discoveredPages: ZodArray<ZodObject<{
504
+ url: ZodString;
505
+ title: ZodNullable<ZodString>;
506
+ depth: ZodNumber;
507
+ }, $strip>>;
508
+ totalPagesCount: ZodNumber;
509
+ }, $strip>;
510
+ readonly crawlProgress: ZodObject<{
511
+ websiteId: ZodString;
512
+ organizationId: ZodString;
513
+ visitorId: ZodNullable<ZodString>;
514
+ userId: ZodNullable<ZodString>;
515
+ linkSourceId: ZodString;
516
+ url: ZodString;
517
+ page: ZodObject<{
518
+ url: ZodString;
519
+ title: ZodNullable<ZodString>;
520
+ status: ZodEnum<{
521
+ pending: "pending";
522
+ crawling: "crawling";
523
+ completed: "completed";
524
+ failed: "failed";
525
+ }>;
526
+ sizeBytes: ZodOptional<ZodNumber>;
527
+ error: ZodOptional<ZodNullable<ZodString>>;
528
+ }, $strip>;
529
+ completedCount: ZodNumber;
530
+ totalCount: ZodNumber;
531
+ }, $strip>;
532
+ readonly crawlCompleted: ZodObject<{
533
+ websiteId: ZodString;
534
+ organizationId: ZodString;
535
+ visitorId: ZodNullable<ZodString>;
536
+ userId: ZodNullable<ZodString>;
537
+ linkSourceId: ZodString;
538
+ url: ZodString;
539
+ crawledPagesCount: ZodNumber;
540
+ totalSizeBytes: ZodNumber;
541
+ failedPagesCount: ZodNumber;
542
+ }, $strip>;
543
+ readonly crawlFailed: ZodObject<{
544
+ websiteId: ZodString;
545
+ organizationId: ZodString;
546
+ visitorId: ZodNullable<ZodString>;
547
+ userId: ZodNullable<ZodString>;
548
+ linkSourceId: ZodString;
549
+ url: ZodString;
550
+ error: ZodString;
551
+ }, $strip>;
552
+ readonly linkSourceUpdated: ZodObject<{
553
+ websiteId: ZodString;
554
+ organizationId: ZodString;
555
+ visitorId: ZodNullable<ZodString>;
556
+ userId: ZodNullable<ZodString>;
557
+ linkSourceId: ZodString;
558
+ status: ZodEnum<{
559
+ pending: "pending";
560
+ crawling: "crawling";
561
+ completed: "completed";
562
+ failed: "failed";
563
+ mapping: "mapping";
564
+ }>;
565
+ discoveredPagesCount: ZodOptional<ZodNumber>;
566
+ crawledPagesCount: ZodOptional<ZodNumber>;
567
+ totalSizeBytes: ZodOptional<ZodNumber>;
568
+ errorMessage: ZodOptional<ZodNullable<ZodString>>;
569
+ }, $strip>;
570
+ readonly crawlPagesDiscovered: ZodObject<{
571
+ websiteId: ZodString;
572
+ organizationId: ZodString;
573
+ visitorId: ZodNullable<ZodString>;
574
+ userId: ZodNullable<ZodString>;
575
+ linkSourceId: ZodString;
576
+ pages: ZodArray<ZodObject<{
577
+ url: ZodString;
578
+ path: ZodString;
579
+ depth: ZodNumber;
580
+ }, $strip>>;
581
+ }, $strip>;
582
+ readonly crawlPageCompleted: ZodObject<{
583
+ websiteId: ZodString;
584
+ organizationId: ZodString;
585
+ visitorId: ZodNullable<ZodString>;
586
+ userId: ZodNullable<ZodString>;
587
+ linkSourceId: ZodString;
588
+ page: ZodObject<{
589
+ url: ZodString;
590
+ title: ZodNullable<ZodString>;
591
+ sizeBytes: ZodNumber;
592
+ knowledgeId: ZodString;
593
+ }, $strip>;
594
+ }, $strip>;
471
595
  };
472
596
  type RealtimeEventType = keyof typeof realtimeSchema;
473
597
  type RealtimeEventPayload<T extends RealtimeEventType> = output<(typeof realtimeSchema)[T]>;
@@ -1 +1 @@
1
- {"version":3,"file":"realtime-events.d.ts","names":[],"sources":["../../types/src/realtime-events.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;cAqBa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAqGD,iBAAA,gBAAiC;KAEjC,+BAA+B,qBAAqB,eACvD,gBAAgB;KAGb,wBAAwB;QAC7B;WACG,qBAAqB;;KAGnB,gBAAA,WACL,oBAAoB,cAAc,KACvC;KAEU,4BAA4B,qBACvC,qBAAqB"}
1
+ {"version":3,"file":"realtime-events.d.ts","names":[],"sources":["../../types/src/realtime-events.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;cAqBa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAwLD,iBAAA,gBAAiC;KAEjC,+BAA+B,qBAAqB,eACvD,gBAAgB;KAGb,wBAAwB;QAC7B;WACG,qBAAqB;;KAGnB,gBAAA,WACL,oBAAoB,cAAc,KACvC;KAEU,4BAA4B,qBACvC,qBAAqB"}
package/registries.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { $ZodType } from "./schemas.js";
2
2
  import { input, output } from "./core.js";
3
3
 
4
- //#region ../../node_modules/zod/v4/core/registries.d.cts
4
+ //#region ../../node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/registries.d.cts
5
5
  declare const $output: unique symbol;
6
6
  type $output = typeof $output;
7
7
  declare const $input: unique symbol;
@@ -1 +1 @@
1
- {"version":3,"file":"registries.d.ts","names":["core","$ZodType","$output","$input","$replace","Meta","S","output","input","M","P","K","R","MetadataType","$ZodRegistry","Schema","WeakMap","Map","JSONSchemaMeta","GlobalMeta","registry","T","globalRegistry"],"sources":["../../../node_modules/zod/v4/core/registries.d.cts"],"sourcesContent":["import type * as core from \"./core.cjs\";\nimport type { $ZodType } from \"./schemas.cjs\";\nexport declare const $output: unique symbol;\nexport type $output = typeof $output;\nexport declare const $input: unique symbol;\nexport type $input = typeof $input;\nexport type $replace<Meta, S extends $ZodType> = Meta extends $output ? core.output<S> : Meta extends $input ? core.input<S> : Meta extends (infer M)[] ? $replace<M, S>[] : Meta extends (...args: infer P) => infer R ? (...args: {\n [K in keyof P]: $replace<P[K], S>;\n}) => $replace<R, S> : Meta extends object ? {\n [K in keyof Meta]: $replace<Meta[K], S>;\n} : Meta;\ntype MetadataType = object | undefined;\nexport declare class $ZodRegistry<Meta extends MetadataType = MetadataType, Schema extends $ZodType = $ZodType> {\n _meta: Meta;\n _schema: Schema;\n _map: WeakMap<Schema, $replace<Meta, Schema>>;\n _idmap: Map<string, Schema>;\n add<S extends Schema>(schema: S, ..._meta: undefined extends Meta ? [$replace<Meta, S>?] : [$replace<Meta, S>]): this;\n clear(): this;\n remove(schema: Schema): this;\n get<S extends Schema>(schema: S): $replace<Meta, S> | undefined;\n has(schema: Schema): boolean;\n}\nexport interface JSONSchemaMeta {\n id?: string | undefined;\n title?: string | undefined;\n description?: string | undefined;\n deprecated?: boolean | undefined;\n [k: string]: unknown;\n}\nexport interface GlobalMeta extends JSONSchemaMeta {\n}\nexport declare function registry<T extends MetadataType = MetadataType, S extends $ZodType = $ZodType>(): $ZodRegistry<T, S>;\nexport declare const globalRegistry: $ZodRegistry<GlobalMeta>;\nexport {};\n"],"x_google_ignoreList":[0],"mappings":";;;;cAEqBE;KACTA,OAAAA,UAAiBA;AADRA,cAEAC,MAFsB,EAAA,OAAA,MAAA;AAC/BD,KAEAC,MAAAA,GAFO,OAESA,MAFCD;AACRC,KAETC,QAF8B,CAAA,IAAA,EAAA,UAELH,QAFK,CAAA,GAEOI,IAFP,SAEoBH,OAFpB,GAE8BF,MAF9B,CAE0CM,CAF1C,CAAA,GAE+CD,IAF/C,SAE4DF,MAF5D,GAEqEH,KAFrE,CAEgFM,CAFhF,CAAA,GAEqFD,IAFrF,SAAA,CAAA,KAAA,EAAA,CAAA,EAAA,GAEgHD,QAFhH,CAEyHK,CAFzH,EAE4HH,CAF5H,CAAA,EAAA,GAEmID,IAFnI,UAAA,CAAA,GAAA,IAAA,EAAA,KAAA,EAAA,EAAA,GAAA,KAAA,EAAA,IAAA,CAAA,GAAA,I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F,QAdgIE,CAcvHD,IAduHC,EAcjHA,CAdiHA,CAAAA,GAAAA,SAAAA;EAAZF,GAAAA,CAAAA,MAAAA,EAe1IW,MAf0IX,CAAAA,EAAAA,OAAAA;;AAC1IM,UAgBCQ,cAAAA,CAhBDR;EAAaA,EAAAA,CAAAA,EAAAA,MAAAA,GAAAA,SAAAA;EAAEC,KAAAA,CAAAA,EAAAA,MAAAA,GAAAA,SAAAA;EAAIL,WAAAA,CAAAA,EAAAA,MAAAA,GAAAA,SAAAA;EAAfF,UAAAA,CAAAA,EAAAA,OAAAA,GAAAA,SAAAA;EACLQ,CAAAA,CAAAA,EAAAA,MAAAA,CAAAA,EAAAA,OAAAA;;AAATR,UAsBWe,UAAAA,SAAmBD,cAtB9Bd,CAAAA"}
1
+ {"version":3,"file":"registries.d.ts","names":["core","$ZodType","$output","$input","$replace","Meta","S","output","input","M","P","K","R","MetadataType","$ZodRegistry","Schema","WeakMap","Map","JSONSchemaMeta","GlobalMeta","registry","T","globalRegistry"],"sources":["../../../node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/registries.d.cts"],"sourcesContent":["import type * as core from \"./core.cjs\";\nimport type { $ZodType } from \"./schemas.cjs\";\nexport declare const $output: unique symbol;\nexport type $output = typeof $output;\nexport declare const $input: unique symbol;\nexport type $input = typeof $input;\nexport type $replace<Meta, S extends $ZodType> = Meta extends $output ? core.output<S> : Meta extends $input ? core.input<S> : Meta extends (infer M)[] ? $replace<M, S>[] : Meta extends (...args: infer P) => infer R ? (...args: {\n [K in keyof P]: $replace<P[K], S>;\n}) => $replace<R, S> : Meta extends object ? {\n [K in keyof Meta]: $replace<Meta[K], S>;\n} : Meta;\ntype MetadataType = object | undefined;\nexport declare class $ZodRegistry<Meta extends MetadataType = MetadataType, Schema extends $ZodType = $ZodType> {\n _meta: Meta;\n _schema: Schema;\n _map: WeakMap<Schema, $replace<Meta, Schema>>;\n _idmap: Map<string, Schema>;\n add<S extends Schema>(schema: S, ..._meta: undefined extends Meta ? [$replace<Meta, S>?] : [$replace<Meta, S>]): this;\n clear(): this;\n remove(schema: Schema): this;\n get<S extends Schema>(schema: S): $replace<Meta, S> | undefined;\n has(schema: Schema): boolean;\n}\nexport interface JSONSchemaMeta {\n id?: string | undefined;\n title?: string | undefined;\n description?: string | undefined;\n deprecated?: boolean | undefined;\n [k: string]: unknown;\n}\nexport interface GlobalMeta extends JSONSchemaMeta {\n}\nexport declare function registry<T extends MetadataType = MetadataType, S extends $ZodType = $ZodType>(): $ZodRegistry<T, S>;\nexport declare const globalRegistry: $ZodRegistry<GlobalMeta>;\nexport {};\n"],"x_google_ignoreList":[0],"mappings":";;;;cAEqBE;KACTA,OAAAA,UAAiBA;AADRA,cAEAC,MAFsB,EAAA,OAAA,MAAA;AAC/BD,KAEAC,MAAAA,GAFO,OAESA,MAFCD;AACRC,KAETC,QAF8B,CAAA,IAAA,EAAA,UAELH,QAFK,CAAA,GAEOI,IAFP,SAEoBH,OAFpB,GAE8BF,MAF9B,CAE0CM,CAF1C,CAAA,GAE+CD,IAF/C,SAE4DF,MAF5D,GAEqEH,KAFrE,CAEgFM,CAFhF,CAAA,GAEqFD,IAFrF,SAAA,CAAA,KAAA,EAAA,CAAA,EAAA,GAEgHD,QAFhH,CAEyHK,CAFzH,EAE4HH,CAF5H,CAAA,EAAA,GAEmID,IAFnI,UAAA,CAAA,GAAA,IAAA,EAAA,KAAA,EAAA,EAAA,GAAA,KAAA,EAAA,IAAA,CAAA,GAAA,IAAA,EAAA,QAC9BF,MAEIO,CAFE,GAEEN,QAFQD,CAECO,CAFDP,CAEGQ,CAFHR,CAAAA,EAEOG,CAFD,CAAA,EAClC,EAAA,GAEMF,QAFMA,CAEGQ,CAFK,EAEFN,CAFE,CAAA,GAEGD,IAFHA,SAAA,MAAA,GAAA,QAAiBJ,MAGrBI,IAHqBJ,GAGdG,QAHcH,CAGLI,IAHKJ,CAGAU,CAHAV,CAAAA,EAGIK,CAHJL,CAAAA,EAAYI,GAI7CA,IAJ6C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