@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
package/errors.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","names":["$ZodCheck","$ZodStringFormats","$constructor","$ZodType","StandardSchemaV1","util","$ZodIssueBase","PropertyKey","$ZodIssueInvalidType","Input","$ZodIssueTooBig","$ZodIssueTooSmall","$ZodIssueInvalidStringFormat","$ZodIssueNotMultipleOf","$ZodIssueUnrecognizedKeys","Record","$ZodIssueInvalidUnion","$ZodIssue","$ZodIssueInvalidKey","$ZodIssueInvalidElement","$ZodIssueInvalidValue","Primitive","$ZodIssueCustom","$ZodIssueStringCommonFormats","Exclude","$ZodIssueStringInvalidRegex","$ZodIssueStringInvalidJWT","$ZodIssueStringStartsWith","$ZodIssueStringEndsWith","$ZodIssueStringIncludes","$ZodStringFormatIssues","$ZodIssueCode","$ZodInternalIssue","T","RawIssue","MakePartial","Flatten","$ZodRawIssue","$ZodErrorMap","$ZodError","Error","$ZodRealError","$ZodFlattenedError","U","_FlattenedError","flattenError","_ZodFormattedError","K","$ZodFormattedError","formatError","$ZodErrorTree","Array","treeifyError","toDotPath","PathSegment","prettifyError","FailureResult"],"sources":["../../../node_modules/zod/v4/core/errors.d.cts"],"sourcesContent":["import type { $ZodCheck, $ZodStringFormats } from \"./checks.cjs\";\nimport { $constructor } from \"./core.cjs\";\nimport type { $ZodType } from \"./schemas.cjs\";\nimport type { StandardSchemaV1 } from \"./standard-schema.cjs\";\nimport * as util from \"./util.cjs\";\nexport interface $ZodIssueBase {\n readonly code?: string;\n readonly input?: unknown;\n readonly path: PropertyKey[];\n readonly message: string;\n}\nexport interface $ZodIssueInvalidType<Input = unknown> extends $ZodIssueBase {\n readonly code: \"invalid_type\";\n readonly expected: $ZodType[\"_zod\"][\"def\"][\"type\"];\n readonly input?: Input;\n}\nexport interface $ZodIssueTooBig<Input = unknown> extends $ZodIssueBase {\n readonly code: \"too_big\";\n readonly origin: \"number\" | \"int\" | \"bigint\" | \"date\" | \"string\" | \"array\" | \"set\" | \"file\" | (string & {});\n readonly maximum: number | bigint;\n readonly inclusive?: boolean;\n readonly exact?: boolean;\n readonly input?: Input;\n}\nexport interface $ZodIssueTooSmall<Input = unknown> extends $ZodIssueBase {\n readonly code: \"too_small\";\n readonly origin: \"number\" | \"int\" | \"bigint\" | \"date\" | \"string\" | \"array\" | \"set\" | \"file\" | (string & {});\n readonly minimum: number | bigint;\n /** True if the allowable range includes the minimum */\n readonly inclusive?: boolean;\n /** True if the allowed value is fixed (e.g.` z.length(5)`), not a range (`z.minLength(5)`) */\n readonly exact?: boolean;\n readonly input?: Input;\n}\nexport interface $ZodIssueInvalidStringFormat extends $ZodIssueBase {\n readonly code: \"invalid_format\";\n readonly format: $ZodStringFormats | (string & {});\n readonly pattern?: string;\n readonly input?: string;\n}\nexport interface $ZodIssueNotMultipleOf<Input extends number | bigint = number | bigint> extends $ZodIssueBase {\n readonly code: \"not_multiple_of\";\n readonly divisor: number;\n readonly input?: Input;\n}\nexport interface $ZodIssueUnrecognizedKeys extends $ZodIssueBase {\n readonly code: \"unrecognized_keys\";\n readonly keys: string[];\n readonly input?: Record<string, unknown>;\n}\nexport interface $ZodIssueInvalidUnion extends $ZodIssueBase {\n readonly code: \"invalid_union\";\n readonly errors: $ZodIssue[][];\n readonly input?: unknown;\n readonly discriminator?: string | undefined;\n}\nexport interface $ZodIssueInvalidKey<Input = unknown> extends $ZodIssueBase {\n readonly code: \"invalid_key\";\n readonly origin: \"map\" | \"record\";\n readonly issues: $ZodIssue[];\n readonly input?: Input;\n}\nexport interface $ZodIssueInvalidElement<Input = unknown> extends $ZodIssueBase {\n readonly code: \"invalid_element\";\n readonly origin: \"map\" | \"set\";\n readonly key: unknown;\n readonly issues: $ZodIssue[];\n readonly input?: Input;\n}\nexport interface $ZodIssueInvalidValue<Input = unknown> extends $ZodIssueBase {\n readonly code: \"invalid_value\";\n readonly values: util.Primitive[];\n readonly input?: Input;\n}\nexport interface $ZodIssueCustom extends $ZodIssueBase {\n readonly code: \"custom\";\n readonly params?: Record<string, any> | undefined;\n readonly input?: unknown;\n}\nexport interface $ZodIssueStringCommonFormats extends $ZodIssueInvalidStringFormat {\n format: Exclude<$ZodStringFormats, \"regex\" | \"jwt\" | \"starts_with\" | \"ends_with\" | \"includes\">;\n}\nexport interface $ZodIssueStringInvalidRegex extends $ZodIssueInvalidStringFormat {\n format: \"regex\";\n pattern: string;\n}\nexport interface $ZodIssueStringInvalidJWT extends $ZodIssueInvalidStringFormat {\n format: \"jwt\";\n algorithm?: string;\n}\nexport interface $ZodIssueStringStartsWith extends $ZodIssueInvalidStringFormat {\n format: \"starts_with\";\n prefix: string;\n}\nexport interface $ZodIssueStringEndsWith extends $ZodIssueInvalidStringFormat {\n format: \"ends_with\";\n suffix: string;\n}\nexport interface $ZodIssueStringIncludes extends $ZodIssueInvalidStringFormat {\n format: \"includes\";\n includes: string;\n}\nexport type $ZodStringFormatIssues = $ZodIssueStringCommonFormats | $ZodIssueStringInvalidRegex | $ZodIssueStringInvalidJWT | $ZodIssueStringStartsWith | $ZodIssueStringEndsWith | $ZodIssueStringIncludes;\nexport type $ZodIssue = $ZodIssueInvalidType | $ZodIssueTooBig | $ZodIssueTooSmall | $ZodIssueInvalidStringFormat | $ZodIssueNotMultipleOf | $ZodIssueUnrecognizedKeys | $ZodIssueInvalidUnion | $ZodIssueInvalidKey | $ZodIssueInvalidElement | $ZodIssueInvalidValue | $ZodIssueCustom;\nexport type $ZodIssueCode = $ZodIssue[\"code\"];\nexport type $ZodInternalIssue<T extends $ZodIssueBase = $ZodIssue> = T extends any ? RawIssue<T> : never;\ntype RawIssue<T extends $ZodIssueBase> = T extends any ? util.Flatten<util.MakePartial<T, \"message\" | \"path\"> & {\n /** The input data */\n readonly input: unknown;\n /** The schema or check that originated this issue. */\n readonly inst?: $ZodType | $ZodCheck;\n /** If `true`, Zod will continue executing checks/refinements after this issue. */\n readonly continue?: boolean | undefined;\n} & Record<string, unknown>> : never;\nexport type $ZodRawIssue<T extends $ZodIssueBase = $ZodIssue> = $ZodInternalIssue<T>;\nexport interface $ZodErrorMap<T extends $ZodIssueBase = $ZodIssue> {\n (issue: $ZodRawIssue<T>): {\n message: string;\n } | string | undefined | null;\n}\nexport interface $ZodError<T = unknown> extends Error {\n type: T;\n issues: $ZodIssue[];\n _zod: {\n output: T;\n def: $ZodIssue[];\n };\n stack?: string;\n name: string;\n}\nexport declare const $ZodError: $constructor<$ZodError>;\ninterface $ZodRealError<T = any> extends $ZodError<T> {\n}\nexport declare const $ZodRealError: $constructor<$ZodRealError>;\nexport type $ZodFlattenedError<T, U = string> = _FlattenedError<T, U>;\ntype _FlattenedError<T, U = string> = {\n formErrors: U[];\n fieldErrors: {\n [P in keyof T]?: U[];\n };\n};\nexport declare function flattenError<T>(error: $ZodError<T>): _FlattenedError<T>;\nexport declare function flattenError<T, U>(error: $ZodError<T>, mapper?: (issue: $ZodIssue) => U): _FlattenedError<T, U>;\ntype _ZodFormattedError<T, U = string> = T extends [any, ...any[]] ? {\n [K in keyof T]?: $ZodFormattedError<T[K], U>;\n} : T extends any[] ? {\n [k: number]: $ZodFormattedError<T[number], U>;\n} : T extends object ? util.Flatten<{\n [K in keyof T]?: $ZodFormattedError<T[K], U>;\n}> : any;\nexport type $ZodFormattedError<T, U = string> = {\n _errors: U[];\n} & util.Flatten<_ZodFormattedError<T, U>>;\nexport declare function formatError<T>(error: $ZodError<T>): $ZodFormattedError<T>;\nexport declare function formatError<T, U>(error: $ZodError<T>, mapper?: (issue: $ZodIssue) => U): $ZodFormattedError<T, U>;\nexport type $ZodErrorTree<T, U = string> = T extends util.Primitive ? {\n errors: U[];\n} : T extends [any, ...any[]] ? {\n errors: U[];\n items?: {\n [K in keyof T]?: $ZodErrorTree<T[K], U>;\n };\n} : T extends any[] ? {\n errors: U[];\n items?: Array<$ZodErrorTree<T[number], U>>;\n} : T extends object ? {\n errors: U[];\n properties?: {\n [K in keyof T]?: $ZodErrorTree<T[K], U>;\n };\n} : {\n errors: U[];\n};\nexport declare function treeifyError<T>(error: $ZodError<T>): $ZodErrorTree<T>;\nexport declare function treeifyError<T, U>(error: $ZodError<T>, mapper?: (issue: $ZodIssue) => U): $ZodErrorTree<T, U>;\n/** Format a ZodError as a human-readable string in the following form.\n *\n * From\n *\n * ```ts\n * ZodError {\n * issues: [\n * {\n * expected: 'string',\n * code: 'invalid_type',\n * path: [ 'username' ],\n * message: 'Invalid input: expected string'\n * },\n * {\n * expected: 'number',\n * code: 'invalid_type',\n * path: [ 'favoriteNumbers', 1 ],\n * message: 'Invalid input: expected number'\n * }\n * ];\n * }\n * ```\n *\n * to\n *\n * ```\n * username\n * ✖ Expected number, received string at \"username\n * favoriteNumbers[0]\n * ✖ Invalid input: expected number\n * ```\n */\nexport declare function toDotPath(_path: readonly (string | number | symbol | StandardSchemaV1.PathSegment)[]): string;\nexport declare function prettifyError(error: StandardSchemaV1.FailureResult): string;\nexport {};\n"],"x_google_ignoreList":[0],"mappings":";;;;;;UAKiBM,aAAAA;EAAAA,SAAAA,IAAAA,CAAAA,EAAa,MAAA;EAMbE,SAAAA,KAAAA,CAAAA,EAAAA,OAAoB;EAEdL,SAAAA,IAAAA,EALJI,WAKIJ,EAAAA;EACFM,SAAAA,OAAAA,EAAAA,MAAAA;;AAHuD,UAA3DD,oBAA2D,CAAA,QAAA,OAAA,CAAA,SAAbF,aAAa,CAAA;EAK3DI,SAAAA,IAAAA,EAAAA,cAAeD;EAQfE,SAAAA,QAAAA,EAXMR,QAWW,CAAAM,MAAAA,CAAAA,CAAAA,KAQbA,CAAAA,CAAAA,MARuCH,CAAAA;EAU3CM,SAAAA,KAAAA,CAAAA,EApBIH,KAoBJG;AAMjB;AAKiBE,UA7BAJ,eA6ByB,CAAA,QAAA,OAGrBK,CAAAA,SAhCqCT,aA6BM,CAAA;EAK/CU,SAAAA,IAAAA,EAAAA,SAAqB;EAMrBE,SAAAA,MAAAA,EAAAA,QAAmB,GAAA,KAAAT,GAAAA,QAAA,GAAA,MAAA,G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,aAqCtBqC,GArCsC1B,SAqCtC0B,CAAAA,GArCmDX,iBAqCnDW,CArCqEV,CAqCrEU,CAAAA;AACuBV,UArCnBK,YAqCmBL,CAAAA,UArCI3B,aAqCJ2B,GArCoBhB,SAqCpBgB,CAAAA,CAAAA;EAAGU,CAAAA,KAAAA,EApC3BN,YAoC2BM,CApCdV,CAoCcU,CAAAA,CAAAA,EAAAA;IAAtBG,OAAAA,EAAAA,MAAAA;EAAbzC,CAAAA,GAAAA,MAAAA,GAAAA,SAAAA,GAAAA,IAAAA;;UAhCakC,+BAA+BC;QACtCP;UACEhB;;YAEIgB;SACHhB;;;;;cAKQsB,WAAWrC,aAAaqC;KAIjCG,oCAAoCE,gBAAgBX,GAAGU;KAC9DC;cACWD;6BAEIV,KAAKU;;KAKpBG,oCAAoCb,0CACzBA,KAAKe,mBAAmBf,EAAEc,IAAIJ,OAC1CV;eACae,mBAAmBf,WAAWU;IAC3CV,mBAAmB5B,sBACP4B,KAAKe,mBAAmBf,EAAEc,IAAIJ;KAElCK;WACCL;IACTtC,QAAayC,mBAAmBb,GAAGU"}
1
+ {"version":3,"file":"errors.d.ts","names":["$ZodCheck","$ZodStringFormats","$constructor","$ZodType","StandardSchemaV1","util","$ZodIssueBase","PropertyKey","$ZodIssueInvalidType","Input","$ZodIssueTooBig","$ZodIssueTooSmall","$ZodIssueInvalidStringFormat","$ZodIssueNotMultipleOf","$ZodIssueUnrecognizedKeys","Record","$ZodIssueInvalidUnionNoMatch","$ZodIssue","$ZodIssueInvalidUnionMultipleMatch","$ZodIssueInvalidUnion","$ZodIssueInvalidKey","$ZodIssueInvalidElement","$ZodIssueInvalidValue","Primitive","$ZodIssueCustom","$ZodIssueStringCommonFormats","Exclude","$ZodIssueStringInvalidRegex","$ZodIssueStringInvalidJWT","$ZodIssueStringStartsWith","$ZodIssueStringEndsWith","$ZodIssueStringIncludes","$ZodStringFormatIssues","$ZodIssueCode","$ZodInternalIssue","T","RawIssue","MakePartial","Flatten","$ZodRawIssue","$ZodErrorMap","$ZodError","Error","$ZodRealError","$ZodFlattenedError","U","_FlattenedError","flattenError","_ZodFormattedError","K","$ZodFormattedError","formatError","$ZodErrorTree","Array","treeifyError","toDotPath","PathSegment","prettifyError","FailureResult"],"sources":["../../../node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/errors.d.cts"],"sourcesContent":["import type { $ZodCheck, $ZodStringFormats } from \"./checks.cjs\";\nimport { $constructor } from \"./core.cjs\";\nimport type { $ZodType } from \"./schemas.cjs\";\nimport type { StandardSchemaV1 } from \"./standard-schema.cjs\";\nimport * as util from \"./util.cjs\";\nexport interface $ZodIssueBase {\n readonly code?: string;\n readonly input?: unknown;\n readonly path: PropertyKey[];\n readonly message: string;\n}\nexport interface $ZodIssueInvalidType<Input = unknown> extends $ZodIssueBase {\n readonly code: \"invalid_type\";\n readonly expected: $ZodType[\"_zod\"][\"def\"][\"type\"];\n readonly input?: Input;\n}\nexport interface $ZodIssueTooBig<Input = unknown> extends $ZodIssueBase {\n readonly code: \"too_big\";\n readonly origin: \"number\" | \"int\" | \"bigint\" | \"date\" | \"string\" | \"array\" | \"set\" | \"file\" | (string & {});\n readonly maximum: number | bigint;\n readonly inclusive?: boolean;\n readonly exact?: boolean;\n readonly input?: Input;\n}\nexport interface $ZodIssueTooSmall<Input = unknown> extends $ZodIssueBase {\n readonly code: \"too_small\";\n readonly origin: \"number\" | \"int\" | \"bigint\" | \"date\" | \"string\" | \"array\" | \"set\" | \"file\" | (string & {});\n readonly minimum: number | bigint;\n /** True if the allowable range includes the minimum */\n readonly inclusive?: boolean;\n /** True if the allowed value is fixed (e.g.` z.length(5)`), not a range (`z.minLength(5)`) */\n readonly exact?: boolean;\n readonly input?: Input;\n}\nexport interface $ZodIssueInvalidStringFormat extends $ZodIssueBase {\n readonly code: \"invalid_format\";\n readonly format: $ZodStringFormats | (string & {});\n readonly pattern?: string;\n readonly input?: string;\n}\nexport interface $ZodIssueNotMultipleOf<Input extends number | bigint = number | bigint> extends $ZodIssueBase {\n readonly code: \"not_multiple_of\";\n readonly divisor: number;\n readonly input?: Input;\n}\nexport interface $ZodIssueUnrecognizedKeys extends $ZodIssueBase {\n readonly code: \"unrecognized_keys\";\n readonly keys: string[];\n readonly input?: Record<string, unknown>;\n}\ninterface $ZodIssueInvalidUnionNoMatch extends $ZodIssueBase {\n readonly code: \"invalid_union\";\n readonly errors: $ZodIssue[][];\n readonly input?: unknown;\n readonly discriminator?: string | undefined;\n readonly inclusive?: true;\n}\ninterface $ZodIssueInvalidUnionMultipleMatch extends $ZodIssueBase {\n readonly code: \"invalid_union\";\n readonly errors: [];\n readonly input?: unknown;\n readonly discriminator?: string | undefined;\n readonly inclusive: false;\n}\nexport type $ZodIssueInvalidUnion = $ZodIssueInvalidUnionNoMatch | $ZodIssueInvalidUnionMultipleMatch;\nexport interface $ZodIssueInvalidKey<Input = unknown> extends $ZodIssueBase {\n readonly code: \"invalid_key\";\n readonly origin: \"map\" | \"record\";\n readonly issues: $ZodIssue[];\n readonly input?: Input;\n}\nexport interface $ZodIssueInvalidElement<Input = unknown> extends $ZodIssueBase {\n readonly code: \"invalid_element\";\n readonly origin: \"map\" | \"set\";\n readonly key: unknown;\n readonly issues: $ZodIssue[];\n readonly input?: Input;\n}\nexport interface $ZodIssueInvalidValue<Input = unknown> extends $ZodIssueBase {\n readonly code: \"invalid_value\";\n readonly values: util.Primitive[];\n readonly input?: Input;\n}\nexport interface $ZodIssueCustom extends $ZodIssueBase {\n readonly code: \"custom\";\n readonly params?: Record<string, any> | undefined;\n readonly input?: unknown;\n}\nexport interface $ZodIssueStringCommonFormats extends $ZodIssueInvalidStringFormat {\n format: Exclude<$ZodStringFormats, \"regex\" | \"jwt\" | \"starts_with\" | \"ends_with\" | \"includes\">;\n}\nexport interface $ZodIssueStringInvalidRegex extends $ZodIssueInvalidStringFormat {\n format: \"regex\";\n pattern: string;\n}\nexport interface $ZodIssueStringInvalidJWT extends $ZodIssueInvalidStringFormat {\n format: \"jwt\";\n algorithm?: string;\n}\nexport interface $ZodIssueStringStartsWith extends $ZodIssueInvalidStringFormat {\n format: \"starts_with\";\n prefix: string;\n}\nexport interface $ZodIssueStringEndsWith extends $ZodIssueInvalidStringFormat {\n format: \"ends_with\";\n suffix: string;\n}\nexport interface $ZodIssueStringIncludes extends $ZodIssueInvalidStringFormat {\n format: \"includes\";\n includes: string;\n}\nexport type $ZodStringFormatIssues = $ZodIssueStringCommonFormats | $ZodIssueStringInvalidRegex | $ZodIssueStringInvalidJWT | $ZodIssueStringStartsWith | $ZodIssueStringEndsWith | $ZodIssueStringIncludes;\nexport type $ZodIssue = $ZodIssueInvalidType | $ZodIssueTooBig | $ZodIssueTooSmall | $ZodIssueInvalidStringFormat | $ZodIssueNotMultipleOf | $ZodIssueUnrecognizedKeys | $ZodIssueInvalidUnion | $ZodIssueInvalidKey | $ZodIssueInvalidElement | $ZodIssueInvalidValue | $ZodIssueCustom;\nexport type $ZodIssueCode = $ZodIssue[\"code\"];\nexport type $ZodInternalIssue<T extends $ZodIssueBase = $ZodIssue> = T extends any ? RawIssue<T> : never;\ntype RawIssue<T extends $ZodIssueBase> = T extends any ? util.Flatten<util.MakePartial<T, \"message\" | \"path\"> & {\n /** The input data */\n readonly input: unknown;\n /** The schema or check that originated this issue. */\n readonly inst?: $ZodType | $ZodCheck;\n /** If `true`, Zod will continue executing checks/refinements after this issue. */\n readonly continue?: boolean | undefined;\n} & Record<string, unknown>> : never;\nexport type $ZodRawIssue<T extends $ZodIssueBase = $ZodIssue> = $ZodInternalIssue<T>;\nexport interface $ZodErrorMap<T extends $ZodIssueBase = $ZodIssue> {\n (issue: $ZodRawIssue<T>): {\n message: string;\n } | string | undefined | null;\n}\nexport interface $ZodError<T = unknown> extends Error {\n type: T;\n issues: $ZodIssue[];\n _zod: {\n output: T;\n def: $ZodIssue[];\n };\n stack?: string;\n name: string;\n}\nexport declare const $ZodError: $constructor<$ZodError>;\ninterface $ZodRealError<T = any> extends $ZodError<T> {\n}\nexport declare const $ZodRealError: $constructor<$ZodRealError>;\nexport type $ZodFlattenedError<T, U = string> = _FlattenedError<T, U>;\ntype _FlattenedError<T, U = string> = {\n formErrors: U[];\n fieldErrors: {\n [P in keyof T]?: U[];\n };\n};\nexport declare function flattenError<T>(error: $ZodError<T>): _FlattenedError<T>;\nexport declare function flattenError<T, U>(error: $ZodError<T>, mapper?: (issue: $ZodIssue) => U): _FlattenedError<T, U>;\ntype _ZodFormattedError<T, U = string> = T extends [any, ...any[]] ? {\n [K in keyof T]?: $ZodFormattedError<T[K], U>;\n} : T extends any[] ? {\n [k: number]: $ZodFormattedError<T[number], U>;\n} : T extends object ? util.Flatten<{\n [K in keyof T]?: $ZodFormattedError<T[K], U>;\n}> : any;\nexport type $ZodFormattedError<T, U = string> = {\n _errors: U[];\n} & util.Flatten<_ZodFormattedError<T, U>>;\nexport declare function formatError<T>(error: $ZodError<T>): $ZodFormattedError<T>;\nexport declare function formatError<T, U>(error: $ZodError<T>, mapper?: (issue: $ZodIssue) => U): $ZodFormattedError<T, U>;\nexport type $ZodErrorTree<T, U = string> = T extends util.Primitive ? {\n errors: U[];\n} : T extends [any, ...any[]] ? {\n errors: U[];\n items?: {\n [K in keyof T]?: $ZodErrorTree<T[K], U>;\n };\n} : T extends any[] ? {\n errors: U[];\n items?: Array<$ZodErrorTree<T[number], U>>;\n} : T extends object ? {\n errors: U[];\n properties?: {\n [K in keyof T]?: $ZodErrorTree<T[K], U>;\n };\n} : {\n errors: U[];\n};\nexport declare function treeifyError<T>(error: $ZodError<T>): $ZodErrorTree<T>;\nexport declare function treeifyError<T, U>(error: $ZodError<T>, mapper?: (issue: $ZodIssue) => U): $ZodErrorTree<T, U>;\n/** Format a ZodError as a human-readable string in the following form.\n *\n * From\n *\n * ```ts\n * ZodError {\n * issues: [\n * {\n * expected: 'string',\n * code: 'invalid_type',\n * path: [ 'username' ],\n * message: 'Invalid input: expected string'\n * },\n * {\n * expected: 'number',\n * code: 'invalid_type',\n * path: [ 'favoriteNumbers', 1 ],\n * message: 'Invalid input: expected number'\n * }\n * ];\n * }\n * ```\n *\n * to\n *\n * ```\n * username\n * ✖ Expected number, received string at \"username\n * favoriteNumbers[0]\n * ✖ Invalid input: expected number\n * ```\n */\nexport declare function toDotPath(_path: readonly (string | number | symbol | StandardSchemaV1.PathSegment)[]): string;\nexport declare function prettifyError(error: StandardSchemaV1.FailureResult): string;\nexport {};\n"],"x_google_ignoreList":[0],"mappings":";;;;;;UAKiBM,aAAAA;EAAAA,SAAAA,IAAAA,CAAAA,EAAa,MAAA;EAMbE,SAAAA,KAAAA,CAAAA,EAAAA,OAAoB;EAEdL,SAAAA,IAAAA,EALJI,WAKIJ,EAAAA;EACFM,SAAAA,OAAAA,EAAAA,MAAAA;;AAHuD,UAA3DD,oBAA2D,CAAA,QAAA,OAAA,CAAA,SAAbF,aAAa,CAAA;EAK3DI,SAAAA,IAAAA,EAAAA,cAAeD;EAQfE,SAAAA,QAAAA,EAXMR,QAWW,CAAAM,MAAAA,CAAAA,CAAAA,KAQbA,CAAAA,CAAAA,MARuCH,CAAAA;EAU3CM,SAAAA,KAAAA,CAAAA,EApBIH,KAoBJG;AAMjB;AAKiBE,UA7BAJ,eA6ByB,CAAA,QAAA,OAGrBK,CAAAA,SAhCqCT,aA6BM,CAAA;EAKtDU,SAAAA,IAAAA,EAAAA,SAAAA;EAOAE,SAAAA,MAAAA,EAAAA,QAAAA,GAAAA,KAAAA,GAAAA,QAAkC,GAAA,MAASZ,GAAAA,QAAAA,GAAa,OAAA,GAAA,KAAA,GAAA,MAAA,GAAA,CAAA,MAAA,GAAA,CAAA,CAAA,CAAA;EAOtDa,SAAAA,OAAAA,EAAAA,MAAqB,GAAA,MAAA;EAChBC,SAAAA,SAAAA,CAAAA,EAAAA,OAAmB;EAGfH,SAAAA,KAAAA,CAAAA,EAAAA,OAAAA;EACAR,SAAAA,KAAAA,CAAAA,EA/CAA,KA+CAA;;AAJsD,UAzC1DE,iBAyC0D,CAAA,QAAA,OAAA,CAAA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;;;cAKQwB,WAAWvC,aAAauC;KAIjCG,oCAAoCE,gBAAgBX,GAAGU;KAC9DC;cACWD;6BAEIV,KAAKU;;KAKpBG,oCAAoCb,0CACzBA,KAAKe,mBAAmBf,EAAEc,IAAIJ,OAC1CV;eACae,mBAAmBf,WAAWU;IAC3CV,mBAAmB9B,sBACP8B,KAAKe,mBAAmBf,EAAEc,IAAIJ;KAElCK;WACCL;IACTxC,QAAa2C,mBAAmBb,GAAGU"}
package/errors2.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { $ZodError, $ZodErrorMap, $ZodFlattenedError, $ZodFormattedError, $ZodIssue } from "./errors.js";
2
2
  import { $constructor } from "./core.js";
3
3
 
4
- //#region ../../node_modules/zod/v4/classic/errors.d.cts
4
+ //#region ../../node_modules/.bun/zod@4.2.1/node_modules/zod/v4/classic/errors.d.cts
5
5
 
6
6
  /** An Error-like class used to store Zod validation issues. */
7
7
  interface ZodError<T = unknown> extends $ZodError<T> {
package/errors2.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"errors2.d.ts","names":["core","$ZodError","ZodIssue","$ZodIssue","ZodError","U","T","$ZodFormattedError","$ZodFlattenedError","$constructor","ZodRealError","ZodFlattenedError","ZodFormattedError","$ZodErrorMap","ZodErrorMap","IssueData","$ZodRawIssue"],"sources":["../../../node_modules/zod/v4/classic/errors.d.cts"],"sourcesContent":["import * as core from \"../core/index.cjs\";\nimport { $ZodError } from \"../core/index.cjs\";\n/** @deprecated Use `z.core.$ZodIssue` from `@zod/core` instead, especially if you are building a library on top of Zod. */\nexport type ZodIssue = core.$ZodIssue;\n/** An Error-like class used to store Zod validation issues. */\nexport interface ZodError<T = unknown> extends $ZodError<T> {\n /** @deprecated Use the `z.treeifyError(err)` function instead. */\n format(): core.$ZodFormattedError<T>;\n format<U>(mapper: (issue: core.$ZodIssue) => U): core.$ZodFormattedError<T, U>;\n /** @deprecated Use the `z.treeifyError(err)` function instead. */\n flatten(): core.$ZodFlattenedError<T>;\n flatten<U>(mapper: (issue: core.$ZodIssue) => U): core.$ZodFlattenedError<T, U>;\n /** @deprecated Push directly to `.issues` instead. */\n addIssue(issue: core.$ZodIssue): void;\n /** @deprecated Push directly to `.issues` instead. */\n addIssues(issues: core.$ZodIssue[]): void;\n /** @deprecated Check `err.issues.length === 0` instead. */\n isEmpty: boolean;\n}\nexport declare const ZodError: core.$constructor<ZodError>;\nexport declare const ZodRealError: core.$constructor<ZodError>;\nexport type { \n/** @deprecated Use `z.core.$ZodFlattenedError` instead. */\n$ZodFlattenedError as ZodFlattenedError, \n/** @deprecated Use `z.core.$ZodFormattedError` instead. */\n$ZodFormattedError as ZodFormattedError, \n/** @deprecated Use `z.core.$ZodErrorMap` instead. */\n$ZodErrorMap as ZodErrorMap, } from \"../core/index.cjs\";\n/** @deprecated Use `z.core.$ZodRawIssue` instead. */\nexport type IssueData = core.$ZodRawIssue;\n"],"x_google_ignoreList":[0],"mappings":";;;;;AAKA;AAAyDM,UAAxCF,QAAwCE,CAAAA,IAAAA,OAAAA,CAAAA,SAAVL,SAAUK,CAAAA,CAAAA,CAAAA,CAAAA;EAEnBA;EAAxBN,MAAAA,EAAAA,EAAAA,kBAAAA,CAAwBM,CAAxBN,CAAAA;EACgBA,MAAAA,CAAAA,CAAAA,CAAAA,CAAAA,MAAAA,EAAAA,CAAAA,KAAAA,EAAAA,SAAAA,EAAAA,GAAmBK,CAAnBL,CAAAA,EAAuBA,kBAAvBA,CAA+CM,CAA/CN,EAAkDK,CAAlDL,CAAAA;EAAmBK;EAA4BC,OAAAA,EAAAA,EAE9DN,kBAF8DM,CAEtCA,CAFsCA,CAAAA;EAAGD,OAAAA,CAAAA,CAAAA,CAAAA,CAAAA,MAAAA,EAAAA,CAAAA,KAAAA,EAGjDL,SAHiDK,EAAAA,GAG9BA,CAH8BA,CAAAA,EAG1BL,kBAH0BK,CAGFC,CAHED,EAGCA,CAHDA,CAAAA;EAA3BL;EAEdM,QAAAA,CAAAA,KAAAA,EAGnBN,SAHmBM,CAAAA,EAAAA,IAAAA;EAAxBN;EACgBA,SAAAA,CAAAA,MAAAA,EAITA,SAJSA,EAAAA,CAAAA,EAAAA,IAAAA;EAAmBK;EAA4BC,OAAAA,EAAAA,OAAAA;;AAAxBN,cAQjCI,QARiCJ,EAQvBA,YARuBA,CAQLI,QARKJ,CAAAA"}
1
+ {"version":3,"file":"errors2.d.ts","names":["core","$ZodError","ZodIssue","$ZodIssue","ZodError","U","T","$ZodFormattedError","$ZodFlattenedError","$constructor","ZodRealError","ZodFlattenedError","ZodFormattedError","$ZodErrorMap","ZodErrorMap","IssueData","$ZodRawIssue"],"sources":["../../../node_modules/.bun/zod@4.2.1/node_modules/zod/v4/classic/errors.d.cts"],"sourcesContent":["import * as core from \"../core/index.cjs\";\nimport { $ZodError } from \"../core/index.cjs\";\n/** @deprecated Use `z.core.$ZodIssue` from `@zod/core` instead, especially if you are building a library on top of Zod. */\nexport type ZodIssue = core.$ZodIssue;\n/** An Error-like class used to store Zod validation issues. */\nexport interface ZodError<T = unknown> extends $ZodError<T> {\n /** @deprecated Use the `z.treeifyError(err)` function instead. */\n format(): core.$ZodFormattedError<T>;\n format<U>(mapper: (issue: core.$ZodIssue) => U): core.$ZodFormattedError<T, U>;\n /** @deprecated Use the `z.treeifyError(err)` function instead. */\n flatten(): core.$ZodFlattenedError<T>;\n flatten<U>(mapper: (issue: core.$ZodIssue) => U): core.$ZodFlattenedError<T, U>;\n /** @deprecated Push directly to `.issues` instead. */\n addIssue(issue: core.$ZodIssue): void;\n /** @deprecated Push directly to `.issues` instead. */\n addIssues(issues: core.$ZodIssue[]): void;\n /** @deprecated Check `err.issues.length === 0` instead. */\n isEmpty: boolean;\n}\nexport declare const ZodError: core.$constructor<ZodError>;\nexport declare const ZodRealError: core.$constructor<ZodError>;\nexport type { \n/** @deprecated Use `z.core.$ZodFlattenedError` instead. */\n$ZodFlattenedError as ZodFlattenedError, \n/** @deprecated Use `z.core.$ZodFormattedError` instead. */\n$ZodFormattedError as ZodFormattedError, \n/** @deprecated Use `z.core.$ZodErrorMap` instead. */\n$ZodErrorMap as ZodErrorMap, } from \"../core/index.cjs\";\n/** @deprecated Use `z.core.$ZodRawIssue` instead. */\nexport type IssueData = core.$ZodRawIssue;\n"],"x_google_ignoreList":[0],"mappings":";;;;;AAKA;AAAyDM,UAAxCF,QAAwCE,CAAAA,IAAAA,OAAAA,CAAAA,SAAVL,SAAUK,CAAAA,CAAAA,CAAAA,CAAAA;EAEnBA;EAAxBN,MAAAA,EAAAA,EAAAA,kBAAAA,CAAwBM,CAAxBN,CAAAA;EACgBA,MAAAA,CAAAA,CAAAA,CAAAA,CAAAA,MAAAA,EAAAA,CAAAA,KAAAA,EAAAA,SAAAA,EAAAA,GAAmBK,CAAnBL,CAAAA,EAAuBA,kBAAvBA,CAA+CM,CAA/CN,EAAkDK,CAAlDL,CAAAA;EAAmBK;EAA4BC,OAAAA,EAAAA,EAE9DN,kBAF8DM,CAEtCA,CAFsCA,CAAAA;EAAGD,OAAAA,CAAAA,CAAAA,CAAAA,CAAAA,MAAAA,EAAAA,CAAAA,KAAAA,EAGjDL,SAHiDK,EAAAA,GAG9BA,CAH8BA,CAAAA,EAG1BL,kBAH0BK,CAGFC,CAHED,EAGCA,CAHDA,CAAAA;EAA3BL;EAEdM,QAAAA,CAAAA,KAAAA,EAGnBN,SAHmBM,CAAAA,EAAAA,IAAAA;EAAxBN;EACgBA,SAAAA,CAAAA,MAAAA,EAITA,SAJSA,EAAAA,CAAAA,EAAAA,IAAAA;EAAmBK;EAA4BC,OAAAA,EAAAA,OAAAA;;AAAxBN,cAQjCI,QARiCJ,EAQvBA,YARuBA,CAQLI,QARKJ,CAAAA"}
package/hooks/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { useClientQuery } from "./private/use-client-query.js";
2
2
  import { useDefaultMessages } from "./private/use-default-messages.js";
3
- import { ConversationItem, GroupedMessage, TimelineEventItem, TimelineToolItem, UseGroupedMessagesOptions, UseGroupedMessagesProps, useGroupedMessages } from "./private/use-grouped-messages.js";
3
+ import { ConversationItem, DaySeparatorItem, GroupedMessage, TimelineEventItem, TimelineToolItem, UseGroupedMessagesOptions, UseGroupedMessagesProps, useGroupedMessages } from "./private/use-grouped-messages.js";
4
4
  import { UseMultimodalInputOptions, UseMultimodalInputReturn, useMultimodalInput } from "./private/use-multimodal-input.js";
5
5
  import { UseClientResult, useClient } from "./private/use-rest-client.js";
6
6
  import { UseComposerRefocusOptions, UseComposerRefocusReturn, useComposerRefocus } from "./use-composer-refocus.js";
@@ -27,4 +27,4 @@ import { UseSoundEffectOptions, UseSoundEffectReturn, useSoundEffect } from "./u
27
27
  import { useTypingSound } from "./use-typing-sound.js";
28
28
  import { UseVisitorReturn, useVisitor } from "./use-visitor.js";
29
29
  import { WindowVisibilityFocusState, useWindowVisibilityFocus } from "./use-window-visibility-focus.js";
30
- export { CONVERSATION_AUTO_SEEN_DELAY_MS, ConversationItem, ConversationLifecycleState, ConversationPreviewAssignedAgent, ConversationPreviewLastMessage, ConversationPreviewTypingParticipant, ConversationPreviewTypingState, ConversationTimelineTypingParticipant, ConversationTypingParticipant, CreateConversationVariables, FileUploadPart, GroupedMessage, SendMessageOptions, SendMessageResult, TimelineEventItem, TimelineToolItem, 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, UseVisitorReturn, WindowVisibilityFocusState, useClient, useClientQuery, useComposerRefocus, useConversation, useConversationAutoSeen, useConversationHistoryPage, useConversationLifecycle, useConversationPage, useConversationPreview, useConversationSeen, useConversationTimeline, useConversationTimelineItems, useConversationTyping, useConversations, useCreateConversation, useDebouncedConversationSeen, useDefaultMessages, useFileUpload, useGroupedMessages, useHomePage, useMessageComposer, useMultimodalInput, useNewMessageSound, useRealtimeSupport, useScrollMask, useSendMessage, useSoundEffect, useTypingSound, useVisitor, useWindowVisibilityFocus };
30
+ export { CONVERSATION_AUTO_SEEN_DELAY_MS, ConversationItem, ConversationLifecycleState, ConversationPreviewAssignedAgent, ConversationPreviewLastMessage, ConversationPreviewTypingParticipant, ConversationPreviewTypingState, ConversationTimelineTypingParticipant, ConversationTypingParticipant, CreateConversationVariables, DaySeparatorItem, FileUploadPart, GroupedMessage, SendMessageOptions, SendMessageResult, TimelineEventItem, TimelineToolItem, 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, UseVisitorReturn, WindowVisibilityFocusState, useClient, useClientQuery, useComposerRefocus, useConversation, useConversationAutoSeen, useConversationHistoryPage, useConversationLifecycle, useConversationPage, useConversationPreview, useConversationSeen, useConversationTimeline, useConversationTimelineItems, useConversationTyping, useConversations, useCreateConversation, useDebouncedConversationSeen, useDefaultMessages, useFileUpload, useGroupedMessages, useHomePage, useMessageComposer, useMultimodalInput, useNewMessageSound, useRealtimeSupport, useScrollMask, useSendMessage, useSoundEffect, useTypingSound, useVisitor, useWindowVisibilityFocus };
@@ -24,12 +24,16 @@ type TimelineToolItem = {
24
24
  tool: string | null;
25
25
  timestamp: Date;
26
26
  };
27
- type ConversationItem = GroupedMessage | TimelineEventItem | TimelineToolItem;
27
+ type DaySeparatorItem = {
28
+ type: "day_separator";
29
+ date: Date;
30
+ dateString: string;
31
+ };
32
+ type ConversationItem = GroupedMessage | TimelineEventItem | TimelineToolItem | DaySeparatorItem;
28
33
  type UseGroupedMessagesOptions = {
29
34
  items: TimelineItem[];
30
35
  seenData?: ConversationSeen[];
31
36
  currentViewerId?: string;
32
- viewerType?: SenderType;
33
37
  };
34
38
  type UseGroupedMessagesProps = UseGroupedMessagesOptions;
35
39
  /**
@@ -41,8 +45,7 @@ type UseGroupedMessagesProps = UseGroupedMessagesOptions;
41
45
  declare const useGroupedMessages: ({
42
46
  items,
43
47
  seenData,
44
- currentViewerId,
45
- viewerType
48
+ currentViewerId
46
49
  }: UseGroupedMessagesOptions) => {
47
50
  items: ConversationItem[];
48
51
  seenByMap: Map<string, Set<string>>;
@@ -56,5 +59,5 @@ declare const useGroupedMessages: ({
56
59
  hasUnreadAfter: (messageId: string, userId: string) => boolean;
57
60
  };
58
61
  //#endregion
59
- export { ConversationItem, GroupedMessage, TimelineEventItem, TimelineToolItem, UseGroupedMessagesOptions, UseGroupedMessagesProps, useGroupedMessages };
62
+ export { ConversationItem, DaySeparatorItem, GroupedMessage, TimelineEventItem, TimelineToolItem, UseGroupedMessagesOptions, UseGroupedMessagesProps, useGroupedMessages };
60
63
  //# sourceMappingURL=use-grouped-messages.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-grouped-messages.d.ts","names":[],"sources":["../../../src/hooks/private/use-grouped-messages.ts"],"sourcesContent":[],"mappings":";;;;;KAKY,cAAA;;EAAA,QAAA,EAAA,MAAA;EAGC,UAAA,EAAA,UAAA;EACL,KAAA,EAAA,YAAA,EAAA;EAGW,cAAA,EAAA,MAAA;EACD,aAAA,EAAA,MAAA;EAAI,gBAAA,EADH,IACG;EAGV,eAAA,EAHM,IAGW;AAM7B,CAAA;AAOY,KAbA,iBAAA,GAagB;EACzB,IAAA,EAAA,gBAAA;EACA,IAAA,EAbI,YAaJ;EACA,SAAA,EAbS,IAaT;CAAgB;AAEP,KAZA,gBAAA,GAYA;EACJ,IAAA,EAAA,eAAA;EACI,IAAA,EAZL,YAYK;EAEE,IAAA,EAAA,MAAA,GAAA,IAAA;EAAU,SAAA,EAZZ,IAYY;AAGxB,CAAA;AA+La,KA3MD,gBAAA,GACT,cA8QF,GA7QE,iBA6QF,GA5QE,gBA4QF;AApEkC,KAtMvB,yBAAA,GAsMuB;EAAA,KAAA,EArM3B,YAqM2B,EAAA;EAAA,QAAA,CAAA,EApMvB,gBAoMuB,EAAA;EAAA,eAAA,CAAA,EAAA,MAAA;EAKhC,UAAA,CAAA,EAvMW,UAuMX;;KApMS,uBAAA,GAA0B;;;;;;;cA+LzB;;;;;GAKV"}
1
+ {"version":3,"file":"use-grouped-messages.d.ts","names":[],"sources":["../../../src/hooks/private/use-grouped-messages.ts"],"sourcesContent":[],"mappings":";;;;;KAKY,cAAA;;EAAA,QAAA,EAAA,MAAA;EAGC,UAAA,EAAA,UAAA;EACL,KAAA,EAAA,YAAA,EAAA;EAGW,cAAA,EAAA,MAAA;EACD,aAAA,EAAA,MAAA;EAAI,gBAAA,EADH,IACG;EAGV,eAAA,EAHM,IAGW;AAM7B,CAAA;AAOY,KAbA,iBAAA,GAagB;EAMhB,IAAA,EAAA,gBAAgB;EACzB,IAAA,EAlBI,YAkBJ;EACA,SAAA,EAlBS,IAkBT;CACA;AACA,KAjBS,gBAAA,GAiBT;EAAgB,IAAA,EAAA,eAAA;EAEP,IAAA,EAjBL,YAiBK;EAMA,IAAA,EAAA,MAAA,GAAA,IAAA;EAsOC,SAAA,EA3PD,IA2PC;CAAsB;AAAA,KAxPvB,gBAAA,GAwPuB;EAAA,IAAA,EAAA,eAAA;EAIhC,IAAA,EA1PI,IA0PJ;;;KAtPS,gBAAA,GACT,iBACA,oBACA,mBACA;KAES,yBAAA;SACJ;aACI;;;KAIA,uBAAA,GAA0B;;;;;;;cAsOzB;;;;GAIV"}
@@ -12,6 +12,13 @@ const toDate = (date) => {
12
12
  if (typeof date === "string") return new Date(date);
13
13
  return date;
14
14
  };
15
+ const getDateString = (date) => {
16
+ return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, "0")}-${String(date.getDate()).padStart(2, "0")}`;
17
+ };
18
+ const createDayDate = (dateString) => {
19
+ const [year, month, day] = dateString.split("-").map(Number);
20
+ return new Date(year ?? 0, (month ?? 1) - 1, day ?? 1, 0, 0, 0, 0);
21
+ };
15
22
  const getSenderIdAndTypeFromTimelineItem = (item) => {
16
23
  if (item.visitorId) return {
17
24
  senderId: item.visitorId,
@@ -34,7 +41,25 @@ const EMPTY_STRING_ARRAY = Object.freeze([]);
34
41
  const groupTimelineItems = (items) => {
35
42
  const result = [];
36
43
  let currentGroup = null;
44
+ let currentDayString = null;
45
+ const maybeInsertDaySeparator = (itemDate) => {
46
+ const itemDayString = getDateString(itemDate);
47
+ if (currentDayString !== itemDayString) {
48
+ if (currentGroup) {
49
+ result.push(currentGroup);
50
+ currentGroup = null;
51
+ }
52
+ result.push({
53
+ type: "day_separator",
54
+ date: createDayDate(itemDayString),
55
+ dateString: itemDayString
56
+ });
57
+ currentDayString = itemDayString;
58
+ }
59
+ };
37
60
  for (const item of items) {
61
+ const itemDate = toDate(item.createdAt);
62
+ maybeInsertDaySeparator(itemDate);
38
63
  if (item.type === "event") {
39
64
  if (currentGroup) {
40
65
  result.push(currentGroup);
@@ -43,7 +68,7 @@ const groupTimelineItems = (items) => {
43
68
  result.push({
44
69
  type: "timeline_event",
45
70
  item,
46
- timestamp: toDate(item.createdAt)
71
+ timestamp: itemDate
47
72
  });
48
73
  continue;
49
74
  }
@@ -56,7 +81,7 @@ const groupTimelineItems = (items) => {
56
81
  type: "timeline_tool",
57
82
  item,
58
83
  tool: item.tool ?? null,
59
- timestamp: toDate(item.createdAt)
84
+ timestamp: itemDate
60
85
  });
61
86
  continue;
62
87
  }
@@ -64,7 +89,7 @@ const groupTimelineItems = (items) => {
64
89
  if (currentGroup && currentGroup.senderId === senderId) {
65
90
  currentGroup.items.push(item);
66
91
  currentGroup.lastMessageId = item.id || currentGroup.lastMessageId;
67
- currentGroup.lastMessageTime = toDate(item.createdAt);
92
+ currentGroup.lastMessageTime = itemDate;
68
93
  } else {
69
94
  if (currentGroup) result.push(currentGroup);
70
95
  currentGroup = {
@@ -74,27 +99,26 @@ const groupTimelineItems = (items) => {
74
99
  items: [item],
75
100
  firstMessageId: item.id || "",
76
101
  lastMessageId: item.id || "",
77
- firstMessageTime: toDate(item.createdAt),
78
- lastMessageTime: toDate(item.createdAt)
102
+ firstMessageTime: itemDate,
103
+ lastMessageTime: itemDate
79
104
  };
80
105
  }
81
106
  }
82
107
  if (currentGroup) result.push(currentGroup);
83
108
  return result;
84
109
  };
85
- const buildTimelineReadReceiptData = (seenData, items) => {
110
+ const buildTimelineReadReceiptData = (seenData, items, sortedMessageItems) => {
86
111
  const seenByMap = /* @__PURE__ */ new Map();
87
112
  const lastReadMessageMap = /* @__PURE__ */ new Map();
88
113
  const unreadCountMap = /* @__PURE__ */ new Map();
89
114
  for (const item of items) if (item.type === "message" && item.id) seenByMap.set(item.id, /* @__PURE__ */ new Set());
90
- const sortedItems = [...items].filter((item) => item.type === "message").sort((a, b) => getTimestamp(a.createdAt) - getTimestamp(b.createdAt));
91
115
  for (const seen of seenData) {
92
116
  const seenTime = getTimestamp(seen.lastSeenAt);
93
117
  const viewerId = seen.userId || seen.visitorId || seen.aiAgentId;
94
118
  if (!viewerId) continue;
95
119
  let lastReadItem = null;
96
120
  let unreadCount = 0;
97
- for (const item of sortedItems) if (getTimestamp(item.createdAt) <= seenTime) {
121
+ for (const item of sortedMessageItems) if (getTimestamp(item.createdAt) <= seenTime) {
98
122
  if (item.id) {
99
123
  const seenBy = seenByMap.get(item.id);
100
124
  if (seenBy) seenBy.add(viewerId);
@@ -116,10 +140,16 @@ const buildTimelineReadReceiptData = (seenData, items) => {
116
140
  * minimal effort. Seen data is normalised into quick lookup maps for unread
117
141
  * indicators.
118
142
  */
119
- const useGroupedMessages = ({ items, seenData = [], currentViewerId, viewerType }) => {
143
+ const useGroupedMessages = ({ items, seenData = [], currentViewerId }) => {
120
144
  return useMemo(() => {
121
145
  const groupedItems = groupTimelineItems(items);
122
- const { seenByMap, lastReadMessageMap, unreadCountMap } = buildTimelineReadReceiptData(seenData, items);
146
+ const sortedMessageItems = items.filter((item) => item.type === "message").sort((a, b) => getTimestamp(a.createdAt) - getTimestamp(b.createdAt));
147
+ const messageIndexMap = /* @__PURE__ */ new Map();
148
+ for (let i = 0; i < sortedMessageItems.length; i++) {
149
+ const item = sortedMessageItems[i];
150
+ if (item?.id) messageIndexMap.set(item.id, i);
151
+ }
152
+ const { seenByMap, lastReadMessageMap, unreadCountMap } = buildTimelineReadReceiptData(seenData, items, sortedMessageItems);
123
153
  const seenByArrayCache = /* @__PURE__ */ new Map();
124
154
  return {
125
155
  items: groupedItems,
@@ -148,7 +178,10 @@ const useGroupedMessages = ({ items, seenData = [], currentViewerId, viewerType
148
178
  hasUnreadAfter: (messageId, userId) => {
149
179
  const lastRead = lastReadMessageMap.get(userId);
150
180
  if (!lastRead) return true;
151
- return items.findIndex((item) => item.id === messageId) < items.findIndex((item) => item.id === lastRead);
181
+ const messageIndex = messageIndexMap.get(messageId);
182
+ const lastReadIndex = messageIndexMap.get(lastRead);
183
+ if (messageIndex === void 0 || lastReadIndex === void 0) return true;
184
+ return messageIndex < lastReadIndex;
152
185
  }
153
186
  };
154
187
  }, [
@@ -1 +1 @@
1
- {"version":3,"file":"use-grouped-messages.js","names":["EMPTY_STRING_ARRAY: readonly string[]","result: ConversationItem[]","currentGroup: GroupedMessage | null","lastReadItem: TimelineItem | null"],"sources":["../../../src/hooks/private/use-grouped-messages.ts"],"sourcesContent":["import { SenderType } from \"@cossistant/types\";\nimport type { TimelineItem } from \"@cossistant/types/api/timeline-item\";\nimport type { ConversationSeen } from \"@cossistant/types/schemas\";\nimport { useMemo } from \"react\";\n\nexport type GroupedMessage = {\n\ttype: \"message_group\";\n\tsenderId: string;\n\tsenderType: SenderType;\n\titems: TimelineItem[];\n\tfirstMessageId: string;\n\tlastMessageId: string;\n\tfirstMessageTime: Date;\n\tlastMessageTime: Date;\n};\n\nexport type TimelineEventItem = {\n\ttype: \"timeline_event\";\n\titem: TimelineItem;\n\ttimestamp: Date;\n};\n\nexport type TimelineToolItem = {\n\ttype: \"timeline_tool\";\n\titem: TimelineItem;\n\ttool: string | null;\n\ttimestamp: Date;\n};\n\nexport type ConversationItem =\n\t| GroupedMessage\n\t| TimelineEventItem\n\t| TimelineToolItem;\n\nexport type UseGroupedMessagesOptions = {\n\titems: TimelineItem[];\n\tseenData?: ConversationSeen[];\n\tcurrentViewerId?: string; // The ID of the current viewer (visitor, user, or AI agent)\n\tviewerType?: SenderType; // Type of the current viewer\n};\n\nexport type UseGroupedMessagesProps = UseGroupedMessagesOptions;\n\n// Helper function to safely get timestamp from Date or string\nconst getTimestamp = (date: Date | string | null | undefined): number => {\n\tif (!date) {\n\t\treturn 0;\n\t}\n\tif (typeof date === \"string\") {\n\t\treturn new Date(date).getTime();\n\t}\n\treturn date.getTime();\n};\n\n// Helper function to safely convert to Date\nconst toDate = (date: Date | string | null | undefined): Date => {\n\tif (!date) {\n\t\treturn typeof window !== \"undefined\" ? new Date() : new Date(0);\n\t}\n\tif (typeof date === \"string\") {\n\t\treturn new Date(date);\n\t}\n\treturn date;\n};\n\n// Helper to determine sender ID and type from a timeline item\nconst getSenderIdAndTypeFromTimelineItem = (\n\titem: TimelineItem\n): { senderId: string; senderType: SenderType } => {\n\tif (item.visitorId) {\n\t\treturn { senderId: item.visitorId, senderType: SenderType.VISITOR };\n\t}\n\tif (item.aiAgentId) {\n\t\treturn { senderId: item.aiAgentId, senderType: SenderType.AI };\n\t}\n\tif (item.userId) {\n\t\treturn { senderId: item.userId, senderType: SenderType.TEAM_MEMBER };\n\t}\n\n\t// Fallback\n\treturn {\n\t\tsenderId: item.id || \"default-sender\",\n\t\tsenderType: SenderType.TEAM_MEMBER,\n\t};\n};\n\nconst EMPTY_STRING_ARRAY: readonly string[] = Object.freeze([]);\n\n// Helper function to group timeline items (messages only, events stay separate)\nconst groupTimelineItems = (items: TimelineItem[]): ConversationItem[] => {\n\tconst result: ConversationItem[] = [];\n\tlet currentGroup: GroupedMessage | null = null;\n\n\tfor (const item of items) {\n\t\t// Events don't get grouped\n\t\tif (item.type === \"event\") {\n\t\t\t// Finalize any existing group\n\t\t\tif (currentGroup) {\n\t\t\t\tresult.push(currentGroup);\n\t\t\t\tcurrentGroup = null;\n\t\t\t}\n\n\t\t\t// Add event as standalone item\n\t\t\tresult.push({\n\t\t\t\ttype: \"timeline_event\",\n\t\t\t\titem,\n\t\t\t\ttimestamp: toDate(item.createdAt),\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (item.type === \"identification\") {\n\t\t\t// Finalize any existing group\n\t\t\tif (currentGroup) {\n\t\t\t\tresult.push(currentGroup);\n\t\t\t\tcurrentGroup = null;\n\t\t\t}\n\n\t\t\t// Add tool item as standalone entry\n\t\t\tresult.push({\n\t\t\t\ttype: \"timeline_tool\",\n\t\t\t\titem,\n\t\t\t\ttool: item.tool ?? null,\n\t\t\t\ttimestamp: toDate(item.createdAt),\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\n\t\t// Group messages by sender\n\t\tconst { senderId, senderType } = getSenderIdAndTypeFromTimelineItem(item);\n\n\t\tif (currentGroup && currentGroup.senderId === senderId) {\n\t\t\t// Add to existing group\n\t\t\tcurrentGroup.items.push(item);\n\t\t\tcurrentGroup.lastMessageId = item.id || currentGroup.lastMessageId;\n\t\t\tcurrentGroup.lastMessageTime = toDate(item.createdAt);\n\t\t} else {\n\t\t\t// Finalize previous group if exists\n\t\t\tif (currentGroup) {\n\t\t\t\tresult.push(currentGroup);\n\t\t\t}\n\n\t\t\t// Start new group\n\t\t\tcurrentGroup = {\n\t\t\t\ttype: \"message_group\",\n\t\t\t\tsenderId,\n\t\t\t\tsenderType,\n\t\t\t\titems: [item],\n\t\t\t\tfirstMessageId: item.id || \"\",\n\t\t\t\tlastMessageId: item.id || \"\",\n\t\t\t\tfirstMessageTime: toDate(item.createdAt),\n\t\t\t\tlastMessageTime: toDate(item.createdAt),\n\t\t\t};\n\t\t}\n\t}\n\n\tif (currentGroup) {\n\t\tresult.push(currentGroup);\n\t}\n\n\treturn result;\n};\n\n// Build read receipt data for timeline items\nconst buildTimelineReadReceiptData = (\n\tseenData: ConversationSeen[],\n\titems: TimelineItem[]\n) => {\n\tconst seenByMap = new Map<string, Set<string>>();\n\tconst lastReadMessageMap = new Map<string, string>();\n\tconst unreadCountMap = new Map<string, number>();\n\n\t// Initialize map for all message-type timeline items\n\tfor (const item of items) {\n\t\tif (item.type === \"message\" && item.id) {\n\t\t\tseenByMap.set(item.id, new Set());\n\t\t}\n\t}\n\n\t// Sort items by time to process in order\n\tconst sortedItems = [...items]\n\t\t.filter((item) => item.type === \"message\")\n\t\t.sort((a, b) => getTimestamp(a.createdAt) - getTimestamp(b.createdAt));\n\n\t// Process seen data for each viewer\n\tfor (const seen of seenData) {\n\t\tconst seenTime = getTimestamp(seen.lastSeenAt);\n\t\tconst viewerId = seen.userId || seen.visitorId || seen.aiAgentId;\n\t\tif (!viewerId) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tlet lastReadItem: TimelineItem | null = null;\n\t\tlet unreadCount = 0;\n\n\t\t// Process items in chronological order\n\t\tfor (const item of sortedItems) {\n\t\t\tconst itemTime = getTimestamp(item.createdAt);\n\n\t\t\tif (itemTime <= seenTime) {\n\t\t\t\t// This item has been seen\n\t\t\t\tif (item.id) {\n\t\t\t\t\tconst seenBy = seenByMap.get(item.id);\n\t\t\t\t\tif (seenBy) {\n\t\t\t\t\t\tseenBy.add(viewerId);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tlastReadItem = item;\n\t\t\t} else {\n\t\t\t\t// This item is unread\n\t\t\t\tunreadCount++;\n\t\t\t}\n\t\t}\n\n\t\t// Store the last read item for this viewer\n\t\tif (lastReadItem?.id) {\n\t\t\tlastReadMessageMap.set(viewerId, lastReadItem.id);\n\t\t}\n\n\t\t// Store unread count\n\t\tunreadCountMap.set(viewerId, unreadCount);\n\t}\n\n\treturn { seenByMap, lastReadMessageMap, unreadCountMap };\n};\n\n/**\n * Batches sequential timeline items from the same sender into groups and enriches\n * them with read-receipt helpers so UIs can render conversation timelines with\n * minimal effort. Seen data is normalised into quick lookup maps for unread\n * indicators.\n */\nexport const useGroupedMessages = ({\n\titems,\n\tseenData = [],\n\tcurrentViewerId,\n\tviewerType,\n}: UseGroupedMessagesOptions) => {\n\treturn useMemo(() => {\n\t\tconst groupedItems = groupTimelineItems(items);\n\n\t\t// Build read receipt data\n\t\tconst { seenByMap, lastReadMessageMap, unreadCountMap } =\n\t\t\tbuildTimelineReadReceiptData(seenData, items);\n\n\t\t// Cache for turning seen sets into stable arrays across renders\n\t\tconst seenByArrayCache = new Map<string, readonly string[]>();\n\n\t\treturn {\n\t\t\titems: groupedItems,\n\t\t\tseenByMap,\n\t\t\tlastReadMessageMap,\n\t\t\tunreadCountMap,\n\n\t\t\tisMessageSeenByViewer: (messageId: string): boolean => {\n\t\t\t\tif (!currentViewerId) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tconst seenBy = seenByMap.get(messageId);\n\t\t\t\treturn seenBy ? seenBy.has(currentViewerId) : false;\n\t\t\t},\n\n\t\t\tgetMessageSeenBy: (messageId: string): readonly string[] => {\n\t\t\t\tif (seenByArrayCache.has(messageId)) {\n\t\t\t\t\treturn seenByArrayCache.get(messageId) ?? EMPTY_STRING_ARRAY;\n\t\t\t\t}\n\n\t\t\t\tconst seenBy = seenByMap.get(messageId);\n\t\t\t\tif (!seenBy || seenBy.size === 0) {\n\t\t\t\t\tseenByArrayCache.set(messageId, EMPTY_STRING_ARRAY);\n\t\t\t\t\treturn EMPTY_STRING_ARRAY;\n\t\t\t\t}\n\n\t\t\t\tconst result = Object.freeze(Array.from(seenBy)) as readonly string[];\n\t\t\t\tseenByArrayCache.set(messageId, result);\n\t\t\t\treturn result;\n\t\t\t},\n\n\t\t\tgetLastReadMessageId: (userId: string): string | undefined =>\n\t\t\t\tlastReadMessageMap.get(userId),\n\n\t\t\tisLastReadMessage: (messageId: string, userId: string): boolean =>\n\t\t\t\tlastReadMessageMap.get(userId) === messageId,\n\n\t\t\tgetUnreadCount: (userId: string): number =>\n\t\t\t\tunreadCountMap.get(userId) || 0,\n\n\t\t\thasUnreadAfter: (messageId: string, userId: string): boolean => {\n\t\t\t\tconst lastRead = lastReadMessageMap.get(userId);\n\t\t\t\tif (!lastRead) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\tconst messageIndex = items.findIndex((item) => item.id === messageId);\n\t\t\t\tconst lastReadIndex = items.findIndex((item) => item.id === lastRead);\n\n\t\t\t\treturn messageIndex < lastReadIndex;\n\t\t\t},\n\t\t};\n\t}, [items, seenData, currentViewerId]);\n};\n"],"mappings":";;;;AA4CA,MAAM,gBAAgB,SAAmD;AACxE,KAAI,CAAC,KACJ,QAAO;AAER,KAAI,OAAO,SAAS,SACnB,QAAO,IAAI,KAAK,KAAK,CAA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BACA,iBACgC;AAChC,QAAO,cAAc;EACpB,MAAM,eAAe,mBAAmB,MAAM;EAG9C,MAAM,EAAE,WAAW,oBAAoB,mBACtC,6BAA6B,UAAU,MAAM;EAG9C,MAAM,mCAAmB,IAAI,KAAgC;AAE7D,SAAO;GACN,OAAO;GACP;GACA;GACA;GAEA,wBAAwB,cAA+B;AACtD,QAAI,CAAC,gBACJ,QAAO;IAER,MAAM,SAAS,UAAU,IAAI,UAAU;AACvC,WAAO,SAAS,OAAO,IAAI,gBAAgB,GAAG;;GAG/C,mBAAmB,cAAyC;AAC3D,QAAI,iBAAiB,IAAI,UAAU,CAClC,QAAO,iBAAiB,IAAI,UAAU,IAAI;IAG3C,MAAM,SAAS,UAAU,IAAI,UAAU;AACvC,QAAI,CAAC,UAAU,OAAO,SAAS,GAAG;AACjC,sBAAiB,IAAI,WAAW,mBAAmB;AACnD,YAAO;;IAGR,MAAM,SAAS,OAAO,OAAO,MAAM,KAAK,OAAO,CAAC;AAChD,qBAAiB,IAAI,WAAW,OAAO;AACvC,WAAO;;GAGR,uBAAuB,WACtB,mBAAmB,IAAI,OAAO;GAE/B,oBAAoB,WAAmB,WACtC,mBAAmB,IAAI,OAAO,KAAK;GAEpC,iBAAiB,WAChB,eAAe,IAAI,OAAO,IAAI;GAE/B,iBAAiB,WAAmB,WAA4B;IAC/D,MAAM,WAAW,mBAAmB,IAAI,OAAO;AAC/C,QAAI,CAAC,SACJ,QAAO;AAMR,WAHqB,MAAM,WAAW,SAAS,KAAK,OAAO,UAAU,GAC/C,MAAM,WAAW,SAAS,KAAK,OAAO,SAAS;;GAItE;IACC;EAAC;EAAO;EAAU;EAAgB,CAAC"}
1
+ {"version":3,"file":"use-grouped-messages.js","names":["EMPTY_STRING_ARRAY: readonly string[]","result: ConversationItem[]","currentGroup: GroupedMessage | null","currentDayString: string | null","lastReadItem: TimelineItem | null"],"sources":["../../../src/hooks/private/use-grouped-messages.ts"],"sourcesContent":["import { SenderType } from \"@cossistant/types\";\nimport type { TimelineItem } from \"@cossistant/types/api/timeline-item\";\nimport type { ConversationSeen } from \"@cossistant/types/schemas\";\nimport { useMemo } from \"react\";\n\nexport type GroupedMessage = {\n\ttype: \"message_group\";\n\tsenderId: string;\n\tsenderType: SenderType;\n\titems: TimelineItem[];\n\tfirstMessageId: string;\n\tlastMessageId: string;\n\tfirstMessageTime: Date;\n\tlastMessageTime: Date;\n};\n\nexport type TimelineEventItem = {\n\ttype: \"timeline_event\";\n\titem: TimelineItem;\n\ttimestamp: Date;\n};\n\nexport type TimelineToolItem = {\n\ttype: \"timeline_tool\";\n\titem: TimelineItem;\n\ttool: string | null;\n\ttimestamp: Date;\n};\n\nexport type DaySeparatorItem = {\n\ttype: \"day_separator\";\n\tdate: Date;\n\tdateString: string; // ISO date string (YYYY-MM-DD) for stable keys\n};\n\nexport type ConversationItem =\n\t| GroupedMessage\n\t| TimelineEventItem\n\t| TimelineToolItem\n\t| DaySeparatorItem;\n\nexport type UseGroupedMessagesOptions = {\n\titems: TimelineItem[];\n\tseenData?: ConversationSeen[];\n\tcurrentViewerId?: string; // The ID of the current viewer (visitor, user, or AI agent)\n};\n\nexport type UseGroupedMessagesProps = UseGroupedMessagesOptions;\n\n// Helper function to safely get timestamp from Date or string\nconst getTimestamp = (date: Date | string | null | undefined): number => {\n\tif (!date) {\n\t\treturn 0;\n\t}\n\tif (typeof date === \"string\") {\n\t\treturn new Date(date).getTime();\n\t}\n\treturn date.getTime();\n};\n\n// Helper function to safely convert to Date\nconst toDate = (date: Date | string | null | undefined): Date => {\n\tif (!date) {\n\t\treturn typeof window !== \"undefined\" ? new Date() : new Date(0);\n\t}\n\tif (typeof date === \"string\") {\n\t\treturn new Date(date);\n\t}\n\treturn date;\n};\n\n// Helper to extract the date string (YYYY-MM-DD) from a Date for day comparison\nconst getDateString = (date: Date): string => {\n\tconst year = date.getFullYear();\n\tconst month = String(date.getMonth() + 1).padStart(2, \"0\");\n\tconst day = String(date.getDate()).padStart(2, \"0\");\n\treturn `${year}-${month}-${day}`;\n};\n\n// Helper to create a Date at midnight for a given date string\nconst createDayDate = (dateString: string): Date => {\n\tconst [year, month, day] = dateString.split(\"-\").map(Number);\n\treturn new Date(year ?? 0, (month ?? 1) - 1, day ?? 1, 0, 0, 0, 0);\n};\n\n// Helper to determine sender ID and type from a timeline item\nconst getSenderIdAndTypeFromTimelineItem = (\n\titem: TimelineItem\n): { senderId: string; senderType: SenderType } => {\n\tif (item.visitorId) {\n\t\treturn { senderId: item.visitorId, senderType: SenderType.VISITOR };\n\t}\n\tif (item.aiAgentId) {\n\t\treturn { senderId: item.aiAgentId, senderType: SenderType.AI };\n\t}\n\tif (item.userId) {\n\t\treturn { senderId: item.userId, senderType: SenderType.TEAM_MEMBER };\n\t}\n\n\t// Fallback\n\treturn {\n\t\tsenderId: item.id || \"default-sender\",\n\t\tsenderType: SenderType.TEAM_MEMBER,\n\t};\n};\n\nconst EMPTY_STRING_ARRAY: readonly string[] = Object.freeze([]);\n\n// Helper function to group timeline items (messages only, events stay separate)\n// Also inserts day separators when the day changes between items\nconst groupTimelineItems = (items: TimelineItem[]): ConversationItem[] => {\n\tconst result: ConversationItem[] = [];\n\tlet currentGroup: GroupedMessage | null = null;\n\tlet currentDayString: string | null = null;\n\n\tconst maybeInsertDaySeparator = (itemDate: Date): void => {\n\t\tconst itemDayString = getDateString(itemDate);\n\n\t\tif (currentDayString !== itemDayString) {\n\t\t\t// Finalize any existing group before inserting day separator\n\t\t\tif (currentGroup) {\n\t\t\t\tresult.push(currentGroup);\n\t\t\t\tcurrentGroup = null;\n\t\t\t}\n\n\t\t\t// Insert day separator\n\t\t\tresult.push({\n\t\t\t\ttype: \"day_separator\",\n\t\t\t\tdate: createDayDate(itemDayString),\n\t\t\t\tdateString: itemDayString,\n\t\t\t});\n\n\t\t\tcurrentDayString = itemDayString;\n\t\t}\n\t};\n\n\tfor (const item of items) {\n\t\tconst itemDate = toDate(item.createdAt);\n\n\t\t// Check for day boundary before processing any item\n\t\tmaybeInsertDaySeparator(itemDate);\n\n\t\t// Events don't get grouped\n\t\tif (item.type === \"event\") {\n\t\t\t// Finalize any existing group\n\t\t\tif (currentGroup) {\n\t\t\t\tresult.push(currentGroup);\n\t\t\t\tcurrentGroup = null;\n\t\t\t}\n\n\t\t\t// Add event as standalone item\n\t\t\tresult.push({\n\t\t\t\ttype: \"timeline_event\",\n\t\t\t\titem,\n\t\t\t\ttimestamp: itemDate,\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (item.type === \"identification\") {\n\t\t\t// Finalize any existing group\n\t\t\tif (currentGroup) {\n\t\t\t\tresult.push(currentGroup);\n\t\t\t\tcurrentGroup = null;\n\t\t\t}\n\n\t\t\t// Add tool item as standalone entry\n\t\t\tresult.push({\n\t\t\t\ttype: \"timeline_tool\",\n\t\t\t\titem,\n\t\t\t\ttool: item.tool ?? null,\n\t\t\t\ttimestamp: itemDate,\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\n\t\t// Group messages by sender\n\t\tconst { senderId, senderType } = getSenderIdAndTypeFromTimelineItem(item);\n\n\t\tif (currentGroup && currentGroup.senderId === senderId) {\n\t\t\t// Add to existing group (day boundary already handled above)\n\t\t\tcurrentGroup.items.push(item);\n\t\t\tcurrentGroup.lastMessageId = item.id || currentGroup.lastMessageId;\n\t\t\tcurrentGroup.lastMessageTime = itemDate;\n\t\t} else {\n\t\t\t// Finalize previous group if exists\n\t\t\tif (currentGroup) {\n\t\t\t\tresult.push(currentGroup);\n\t\t\t}\n\n\t\t\t// Start new group\n\t\t\tcurrentGroup = {\n\t\t\t\ttype: \"message_group\",\n\t\t\t\tsenderId,\n\t\t\t\tsenderType,\n\t\t\t\titems: [item],\n\t\t\t\tfirstMessageId: item.id || \"\",\n\t\t\t\tlastMessageId: item.id || \"\",\n\t\t\t\tfirstMessageTime: itemDate,\n\t\t\t\tlastMessageTime: itemDate,\n\t\t\t};\n\t\t}\n\t}\n\n\tif (currentGroup) {\n\t\tresult.push(currentGroup);\n\t}\n\n\treturn result;\n};\n\n// Build read receipt data for timeline items\n// Accepts pre-sorted message items for performance\nconst buildTimelineReadReceiptData = (\n\tseenData: ConversationSeen[],\n\titems: TimelineItem[],\n\tsortedMessageItems: TimelineItem[]\n) => {\n\tconst seenByMap = new Map<string, Set<string>>();\n\tconst lastReadMessageMap = new Map<string, string>();\n\tconst unreadCountMap = new Map<string, number>();\n\n\t// Initialize map for all message-type timeline items\n\tfor (const item of items) {\n\t\tif (item.type === \"message\" && item.id) {\n\t\t\tseenByMap.set(item.id, new Set());\n\t\t}\n\t}\n\n\t// Process seen data for each viewer\n\tfor (const seen of seenData) {\n\t\tconst seenTime = getTimestamp(seen.lastSeenAt);\n\t\tconst viewerId = seen.userId || seen.visitorId || seen.aiAgentId;\n\t\tif (!viewerId) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tlet lastReadItem: TimelineItem | null = null;\n\t\tlet unreadCount = 0;\n\n\t\t// Process items in chronological order (using pre-sorted array)\n\t\tfor (const item of sortedMessageItems) {\n\t\t\tconst itemTime = getTimestamp(item.createdAt);\n\n\t\t\tif (itemTime <= seenTime) {\n\t\t\t\t// This item has been seen\n\t\t\t\tif (item.id) {\n\t\t\t\t\tconst seenBy = seenByMap.get(item.id);\n\t\t\t\t\tif (seenBy) {\n\t\t\t\t\t\tseenBy.add(viewerId);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tlastReadItem = item;\n\t\t\t} else {\n\t\t\t\t// This item is unread\n\t\t\t\tunreadCount++;\n\t\t\t}\n\t\t}\n\n\t\t// Store the last read item for this viewer\n\t\tif (lastReadItem?.id) {\n\t\t\tlastReadMessageMap.set(viewerId, lastReadItem.id);\n\t\t}\n\n\t\t// Store unread count\n\t\tunreadCountMap.set(viewerId, unreadCount);\n\t}\n\n\treturn { seenByMap, lastReadMessageMap, unreadCountMap };\n};\n\n/**\n * Batches sequential timeline items from the same sender into groups and enriches\n * them with read-receipt helpers so UIs can render conversation timelines with\n * minimal effort. Seen data is normalised into quick lookup maps for unread\n * indicators.\n */\nexport const useGroupedMessages = ({\n\titems,\n\tseenData = [],\n\tcurrentViewerId,\n}: UseGroupedMessagesOptions) => {\n\treturn useMemo(() => {\n\t\tconst groupedItems = groupTimelineItems(items);\n\n\t\t// Pre-sort message items once for reuse (performance optimization)\n\t\tconst sortedMessageItems = items\n\t\t\t.filter((item) => item.type === \"message\")\n\t\t\t.sort((a, b) => getTimestamp(a.createdAt) - getTimestamp(b.createdAt));\n\n\t\t// Build index map from sorted items for O(1) chronological lookups\n\t\t// Must use sortedMessageItems (not raw items) to ensure indices reflect time order\n\t\tconst messageIndexMap = new Map<string, number>();\n\t\tfor (let i = 0; i < sortedMessageItems.length; i++) {\n\t\t\tconst item = sortedMessageItems[i];\n\t\t\tif (item?.id) {\n\t\t\t\tmessageIndexMap.set(item.id, i);\n\t\t\t}\n\t\t}\n\n\t\t// Build read receipt data with pre-sorted items\n\t\tconst { seenByMap, lastReadMessageMap, unreadCountMap } =\n\t\t\tbuildTimelineReadReceiptData(seenData, items, sortedMessageItems);\n\n\t\t// Cache for turning seen sets into stable arrays across renders\n\t\tconst seenByArrayCache = new Map<string, readonly string[]>();\n\n\t\treturn {\n\t\t\titems: groupedItems,\n\t\t\tseenByMap,\n\t\t\tlastReadMessageMap,\n\t\t\tunreadCountMap,\n\n\t\t\tisMessageSeenByViewer: (messageId: string): boolean => {\n\t\t\t\tif (!currentViewerId) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tconst seenBy = seenByMap.get(messageId);\n\t\t\t\treturn seenBy ? seenBy.has(currentViewerId) : false;\n\t\t\t},\n\n\t\t\tgetMessageSeenBy: (messageId: string): readonly string[] => {\n\t\t\t\tif (seenByArrayCache.has(messageId)) {\n\t\t\t\t\treturn seenByArrayCache.get(messageId) ?? EMPTY_STRING_ARRAY;\n\t\t\t\t}\n\n\t\t\t\tconst seenBy = seenByMap.get(messageId);\n\t\t\t\tif (!seenBy || seenBy.size === 0) {\n\t\t\t\t\tseenByArrayCache.set(messageId, EMPTY_STRING_ARRAY);\n\t\t\t\t\treturn EMPTY_STRING_ARRAY;\n\t\t\t\t}\n\n\t\t\t\tconst result = Object.freeze(Array.from(seenBy)) as readonly string[];\n\t\t\t\tseenByArrayCache.set(messageId, result);\n\t\t\t\treturn result;\n\t\t\t},\n\n\t\t\tgetLastReadMessageId: (userId: string): string | undefined =>\n\t\t\t\tlastReadMessageMap.get(userId),\n\n\t\t\tisLastReadMessage: (messageId: string, userId: string): boolean =>\n\t\t\t\tlastReadMessageMap.get(userId) === messageId,\n\n\t\t\tgetUnreadCount: (userId: string): number =>\n\t\t\t\tunreadCountMap.get(userId) || 0,\n\n\t\t\thasUnreadAfter: (messageId: string, userId: string): boolean => {\n\t\t\t\tconst lastRead = lastReadMessageMap.get(userId);\n\t\t\t\tif (!lastRead) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\t// Use index map for O(1) lookups instead of findIndex O(n)\n\t\t\t\tconst messageIndex = messageIndexMap.get(messageId);\n\t\t\t\tconst lastReadIndex = messageIndexMap.get(lastRead);\n\n\t\t\t\tif (messageIndex === undefined || lastReadIndex === undefined) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\treturn messageIndex < lastReadIndex;\n\t\t\t},\n\t\t};\n\t}, [items, seenData, currentViewerId]);\n};\n"],"mappings":";;;;AAkDA,MAAM,gBAAgB,SAAmD;AACxE,KAAI,CAAC,KACJ,QAAO;AAER,KAAI,OAAO,SAAS,SACnB,QAAO,IAAI,KAAK,KAAK,CAAC,SAAS;AAEhC,QAAO,KAAK,SAAS;;AAItB,MAAM,UAAU,SAAiD;AAChE,KAAI,CAAC,KACJ,QAAO,OAAO,WAAW,8BAAc,IAAI,MAAM,mBAAG,IAAI,KAAK,EAAE;AAEhE,KAAI,OAAO,SAAS,SACnB,QAAO,IAAI,KAAK,KAAK;AAEtB,QAAO;;AAIR,MAAM,iBAAiB,SAAuB;AAI7C,QAAO,GAHM,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WACtC,mBAAmB,IAAI,OAAO,KAAK;GAEpC,iBAAiB,WAChB,eAAe,IAAI,OAAO,IAAI;GAE/B,iBAAiB,WAAmB,WAA4B;IAC/D,MAAM,WAAW,mBAAmB,IAAI,OAAO;AAC/C,QAAI,CAAC,SACJ,QAAO;IAIR,MAAM,eAAe,gBAAgB,IAAI,UAAU;IACnD,MAAM,gBAAgB,gBAAgB,IAAI,SAAS;AAEnD,QAAI,iBAAiB,UAAa,kBAAkB,OACnD,QAAO;AAGR,WAAO,eAAe;;GAEvB;IACC;EAAC;EAAO;EAAU;EAAgB,CAAC"}
@@ -47,7 +47,7 @@ function useConversationSeen(conversationId, options = {}) {
47
47
  */
48
48
  function useDebouncedConversationSeen(conversationId, options = {}, delay = 500) {
49
49
  const seenData = useConversationSeen(conversationId, options);
50
- const [debouncedSeenData, setDebouncedSeenData] = useState(seenData);
50
+ const [debouncedSeenData, setDebouncedSeenData] = useState(() => seenData);
51
51
  const timeoutRef = useRef(null);
52
52
  useEffect(() => {
53
53
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
@@ -1 +1 @@
1
- {"version":3,"file":"use-conversation-seen.js","names":[],"sources":["../../src/hooks/use-conversation-seen.ts"],"sourcesContent":["import type { ConversationSeen } from \"@cossistant/types/schemas\";\nimport { useEffect, useMemo, useRef, useState } from \"react\";\nimport { hydrateConversationSeen, useSeenStore } from \"../realtime/seen-store\";\n\ntype UseConversationSeenOptions = {\n\tinitialData?: ConversationSeen[];\n};\n\nfunction buildSeenId(\n\tconversationId: string,\n\tactorType: string,\n\tactorId: string\n) {\n\treturn `${conversationId}-${actorType}-${actorId}`;\n}\n\n/**\n * Reads the conversation seen store and optionally hydrates it with SSR\n * payloads.\n */\nexport function useConversationSeen(\n\tconversationId: string | null | undefined,\n\toptions: UseConversationSeenOptions = {}\n): ConversationSeen[] {\n\tconst { initialData } = options;\n\tconst hydratedKeyRef = useRef<string | null>(null);\n\n\tuseEffect(() => {\n\t\t// Clear hydration key when conversation changes or is unmounted\n\t\tif (!conversationId) {\n\t\t\thydratedKeyRef.current = null;\n\t\t\treturn;\n\t\t}\n\n\t\t// Skip if no initial data\n\t\tif (!initialData || initialData.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Only hydrate once per conversation\n\t\tconst hydrationKey = conversationId;\n\n\t\tif (hydratedKeyRef.current === hydrationKey) {\n\t\t\treturn; // Already hydrated for this conversation\n\t\t}\n\n\t\thydrateConversationSeen(conversationId, initialData);\n\t\thydratedKeyRef.current = hydrationKey;\n\t}, [conversationId]); // Only depend on conversationId, NOT initialData\n\n\tconst conversationSeen = useSeenStore((state) =>\n\t\tconversationId ? (state.conversations[conversationId] ?? null) : null\n\t);\n\n\treturn useMemo(() => {\n\t\tif (!(conversationId && conversationSeen)) {\n\t\t\treturn [];\n\t\t}\n\n\t\treturn Object.values(conversationSeen).map(\n\t\t\t(entry) =>\n\t\t\t\t({\n\t\t\t\t\tid: buildSeenId(conversationId, entry.actorType, entry.actorId),\n\t\t\t\t\tconversationId,\n\t\t\t\t\tuserId: entry.actorType === \"user\" ? entry.actorId : null,\n\t\t\t\t\tvisitorId: entry.actorType === \"visitor\" ? entry.actorId : null,\n\t\t\t\t\taiAgentId: entry.actorType === \"ai_agent\" ? entry.actorId : null,\n\t\t\t\t\tlastSeenAt: entry.lastSeenAt,\n\t\t\t\t\tcreatedAt: entry.lastSeenAt,\n\t\t\t\t\tupdatedAt: entry.lastSeenAt,\n\t\t\t\t\tdeletedAt: null,\n\t\t\t\t}) satisfies ConversationSeen\n\t\t);\n\t}, [conversationId, conversationSeen]);\n}\n\n/**\n * Debounced version of useConversationSeen that delays updates by 500ms\n * to prevent animation conflicts when messages are sent and immediately seen.\n *\n * Use this in UI components where smooth animations are critical.\n */\nexport function useDebouncedConversationSeen(\n\tconversationId: string | null | undefined,\n\toptions: UseConversationSeenOptions = {},\n\tdelay = 500\n): ConversationSeen[] {\n\tconst seenData = useConversationSeen(conversationId, options);\n\tconst [debouncedSeenData, setDebouncedSeenData] =\n\t\tuseState<ConversationSeen[]>(seenData);\n\tconst timeoutRef = useRef<NodeJS.Timeout | null>(null);\n\n\tuseEffect(() => {\n\t\t// Clear any pending timeout\n\t\tif (timeoutRef.current) {\n\t\t\tclearTimeout(timeoutRef.current);\n\t\t}\n\n\t\t// Set new timeout to update after delay\n\t\ttimeoutRef.current = setTimeout(() => {\n\t\t\tsetDebouncedSeenData(seenData);\n\t\t}, delay);\n\n\t\t// Cleanup on unmount or when seenData changes\n\t\treturn () => {\n\t\t\tif (timeoutRef.current) {\n\t\t\t\tclearTimeout(timeoutRef.current);\n\t\t\t}\n\t\t};\n\t}, [seenData, delay]);\n\n\treturn debouncedSeenData;\n}\n"],"mappings":";;;;AAQA,SAAS,YACR,gBACA,WACA,SACC;AACD,QAAO,GAAG,eAAe,GAAG,UAAU,GAAG;;;;;;AAO1C,SAAgB,oBACf,gBACA,UAAsC,EAAE,EACnB;CACrB,MAAM,EAAE,gBAAgB;CACxB,MAAM,iBAAiB,OAAsB,KAAK;AAElD,iBAAgB;AAEf,MAAI,CAAC,gBAAgB;AACpB,kBAAe,UAAU;AACzB;;AAID,MAAI,CAAC,eAAe,YAAY,WAAW,EAC1C;EAID,MAAM,eAAe;AAErB,MAAI,eAAe,YAAY,aAC9B;AAGD,0BAAwB,gBAAgB,YAAY;AACpD,iBAAe,UAAU;IACvB,CAAC,eAAe,CAAC;CAEpB,MAAM,mBAAmB,cAAc,UACtC,iBAAkB,MAAM,cAAc,mBAAmB,OAAQ,KACjE;AAED,QAAO,cAAc;AACpB,MAAI,EAAE,kBAAkB,kBACvB,QAAO,EAAE;AAGV,SAAO,OAAO,OAAO,iBAAiB,CAAC,KACrC,WACC;GACA,IAAI,YAAY,gBAAgB,MAAM,WAAW,MAAM,QAAQ;GAC/D;GACA,QAAQ,MAAM,cAAc,SAAS,MAAM,UAAU;GACrD,WAAW,MAAM,cAAc,YAAY,MAAM,UAAU;GAC3D,WAAW,MAAM,cAAc,aAAa,MAAM,UAAU;GAC5D,YAAY,MAAM;GAClB,WAAW,MAAM;GACjB,WAAW,MAAM;GACjB,WAAW;GACX,EACF;IACC,CAAC,gBAAgB,iBAAiB,CAAC;;;;;;;;AASvC,SAAgB,6BACf,gBACA,UAAsC,EAAE,EACxC,QAAQ,KACa;CACrB,MAAM,WAAW,oBAAoB,gBAAgB,QAAQ;CAC7D,MAAM,CAAC,mBAAmB,wBACzB,SAA6B,SAAS;CACvC,MAAM,aAAa,OAA8B,KAAK;AAEtD,iBAAgB;AAEf,MAAI,WAAW,QACd,cAAa,WAAW,QAAQ;AAIjC,aAAW,UAAU,iBAAiB;AACrC,wBAAqB,SAAS;KAC5B,MAAM;AAGT,eAAa;AACZ,OAAI,WAAW,QACd,cAAa,WAAW,QAAQ;;IAGhC,CAAC,UAAU,MAAM,CAAC;AAErB,QAAO"}
1
+ {"version":3,"file":"use-conversation-seen.js","names":[],"sources":["../../src/hooks/use-conversation-seen.ts"],"sourcesContent":["import type { ConversationSeen } from \"@cossistant/types/schemas\";\nimport { useEffect, useMemo, useRef, useState } from \"react\";\nimport { hydrateConversationSeen, useSeenStore } from \"../realtime/seen-store\";\n\ntype UseConversationSeenOptions = {\n\tinitialData?: ConversationSeen[];\n};\n\nfunction buildSeenId(\n\tconversationId: string,\n\tactorType: string,\n\tactorId: string\n) {\n\treturn `${conversationId}-${actorType}-${actorId}`;\n}\n\n/**\n * Reads the conversation seen store and optionally hydrates it with SSR\n * payloads.\n */\nexport function useConversationSeen(\n\tconversationId: string | null | undefined,\n\toptions: UseConversationSeenOptions = {}\n): ConversationSeen[] {\n\tconst { initialData } = options;\n\tconst hydratedKeyRef = useRef<string | null>(null);\n\n\tuseEffect(() => {\n\t\t// Clear hydration key when conversation changes or is unmounted\n\t\tif (!conversationId) {\n\t\t\thydratedKeyRef.current = null;\n\t\t\treturn;\n\t\t}\n\n\t\t// Skip if no initial data\n\t\tif (!initialData || initialData.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Only hydrate once per conversation\n\t\tconst hydrationKey = conversationId;\n\n\t\tif (hydratedKeyRef.current === hydrationKey) {\n\t\t\treturn; // Already hydrated for this conversation\n\t\t}\n\n\t\thydrateConversationSeen(conversationId, initialData);\n\t\thydratedKeyRef.current = hydrationKey;\n\t}, [conversationId]); // Only depend on conversationId, NOT initialData\n\n\tconst conversationSeen = useSeenStore((state) =>\n\t\tconversationId ? (state.conversations[conversationId] ?? null) : null\n\t);\n\n\treturn useMemo(() => {\n\t\tif (!(conversationId && conversationSeen)) {\n\t\t\treturn [];\n\t\t}\n\n\t\treturn Object.values(conversationSeen).map(\n\t\t\t(entry) =>\n\t\t\t\t({\n\t\t\t\t\tid: buildSeenId(conversationId, entry.actorType, entry.actorId),\n\t\t\t\t\tconversationId,\n\t\t\t\t\tuserId: entry.actorType === \"user\" ? entry.actorId : null,\n\t\t\t\t\tvisitorId: entry.actorType === \"visitor\" ? entry.actorId : null,\n\t\t\t\t\taiAgentId: entry.actorType === \"ai_agent\" ? entry.actorId : null,\n\t\t\t\t\tlastSeenAt: entry.lastSeenAt,\n\t\t\t\t\tcreatedAt: entry.lastSeenAt,\n\t\t\t\t\tupdatedAt: entry.lastSeenAt,\n\t\t\t\t\tdeletedAt: null,\n\t\t\t\t}) satisfies ConversationSeen\n\t\t);\n\t}, [conversationId, conversationSeen]);\n}\n\n/**\n * Debounced version of useConversationSeen that delays updates by 500ms\n * to prevent animation conflicts when messages are sent and immediately seen.\n *\n * Use this in UI components where smooth animations are critical.\n */\nexport function useDebouncedConversationSeen(\n\tconversationId: string | null | undefined,\n\toptions: UseConversationSeenOptions = {},\n\tdelay = 500\n): ConversationSeen[] {\n\tconst seenData = useConversationSeen(conversationId, options);\n\t// Use lazy initialization to avoid re-computing initial state on every render\n\tconst [debouncedSeenData, setDebouncedSeenData] = useState<\n\t\tConversationSeen[]\n\t>(() => seenData);\n\tconst timeoutRef = useRef<NodeJS.Timeout | null>(null);\n\n\tuseEffect(() => {\n\t\t// Clear any pending timeout\n\t\tif (timeoutRef.current) {\n\t\t\tclearTimeout(timeoutRef.current);\n\t\t}\n\n\t\t// Set new timeout to update after delay\n\t\ttimeoutRef.current = setTimeout(() => {\n\t\t\tsetDebouncedSeenData(seenData);\n\t\t}, delay);\n\n\t\t// Cleanup on unmount or when seenData changes\n\t\treturn () => {\n\t\t\tif (timeoutRef.current) {\n\t\t\t\tclearTimeout(timeoutRef.current);\n\t\t\t}\n\t\t};\n\t}, [seenData, delay]);\n\n\treturn debouncedSeenData;\n}\n"],"mappings":";;;;AAQA,SAAS,YACR,gBACA,WACA,SACC;AACD,QAAO,GAAG,eAAe,GAAG,UAAU,GAAG;;;;;;AAO1C,SAAgB,oBACf,gBACA,UAAsC,EAAE,EACnB;CACrB,MAAM,EAAE,gBAAgB;CACxB,MAAM,iBAAiB,OAAsB,KAAK;AAElD,iBAAgB;AAEf,MAAI,CAAC,gBAAgB;AACpB,kBAAe,UAAU;AACzB;;AAID,MAAI,CAAC,eAAe,YAAY,WAAW,EAC1C;EAID,MAAM,eAAe;AAErB,MAAI,eAAe,YAAY,aAC9B;AAGD,0BAAwB,gBAAgB,YAAY;AACpD,iBAAe,UAAU;IACvB,CAAC,eAAe,CAAC;CAEpB,MAAM,mBAAmB,cAAc,UACtC,iBAAkB,MAAM,cAAc,mBAAmB,OAAQ,KACjE;AAED,QAAO,cAAc;AACpB,MAAI,EAAE,kBAAkB,kBACvB,QAAO,EAAE;AAGV,SAAO,OAAO,OAAO,iBAAiB,CAAC,KACrC,WACC;GACA,IAAI,YAAY,gBAAgB,MAAM,WAAW,MAAM,QAAQ;GAC/D;GACA,QAAQ,MAAM,cAAc,SAAS,MAAM,UAAU;GACrD,WAAW,MAAM,cAAc,YAAY,MAAM,UAAU;GAC3D,WAAW,MAAM,cAAc,aAAa,MAAM,UAAU;GAC5D,YAAY,MAAM;GAClB,WAAW,MAAM;GACjB,WAAW,MAAM;GACjB,WAAW;GACX,EACF;IACC,CAAC,gBAAgB,iBAAiB,CAAC;;;;;;;;AASvC,SAAgB,6BACf,gBACA,UAAsC,EAAE,EACxC,QAAQ,KACa;CACrB,MAAM,WAAW,oBAAoB,gBAAgB,QAAQ;CAE7D,MAAM,CAAC,mBAAmB,wBAAwB,eAE1C,SAAS;CACjB,MAAM,aAAa,OAA8B,KAAK;AAEtD,iBAAgB;AAEf,MAAI,WAAW,QACd,cAAa,WAAW,QAAQ;AAIjC,aAAW,UAAU,iBAAiB;AACrC,wBAAqB,SAAS;KAC5B,MAAM;AAGT,eAAa;AACZ,OAAI,WAAW,QACd,cAAa,WAAW,QAAQ;;IAGhC,CAAC,UAAU,MAAM,CAAC;AAErB,QAAO"}
@@ -1 +1 @@
1
- {"version":3,"file":"use-conversation-timeline.d.ts","names":[],"sources":["../../src/hooks/use-conversation-timeline.ts"],"sourcesContent":[],"mappings":";;;;;;;KAYY,qCAAA,GAAwC;KAExC,8BAAA;EAFA,cAAA,EAAA,MAAA;EAEA,KAAA,EAEJ,YAFI,EAAA;EAMA,gBAAA,CAAA,EAAA,MAAA;CACwB;AAAlB,KADN,6BAAA,GACM;EACW,eAAA,EADX,UACW,CAAA,OADO,kBACP,CAAA;EAAlB,QAAA,EAAA,UAAA,CAAA,OAAkB,4BAAlB,CAAA;EACuB,aAAA,EAAlB,UAAkB,CAAA,OAAA,qBAAA,CAAA;EAAlB,kBAAA,EACK,qCADL,EAAA;EACK,4BAAA,EAAA,MAAA;CAAqC;AAQ1D;;;;AAIG,iBAJa,uBAAA,CAIb;EAAA,cAAA;EAAA,KAAA,EAFK,aAEL;EAAA;AAAA,CAAA,EAAA,8BAAA,CAAA,EAAiC,6BAAjC"}
1
+ {"version":3,"file":"use-conversation-timeline.d.ts","names":[],"sources":["../../src/hooks/use-conversation-timeline.ts"],"sourcesContent":[],"mappings":";;;;;;;KAWY,qCAAA,GAAwC;KAExC,8BAAA;EAFA,cAAA,EAAA,MAAA;EAEA,KAAA,EAEJ,YAFI,EAAA;EAMA,gBAAA,CAAA,EAAA,MAAA;CACwB;AAAlB,KADN,6BAAA,GACM;EACW,eAAA,EADX,UACW,CAAA,OADO,kBACP,CAAA;EAAlB,QAAA,EAAA,UAAA,CAAA,OAAkB,4BAAlB,CAAA;EACuB,aAAA,EAAlB,UAAkB,CAAA,OAAA,qBAAA,CAAA;EAAlB,kBAAA,EACK,qCADL,EAAA;EACK,4BAAA,EAAA,MAAA;CAAqC;AAQ1D;;;;AAIG,iBAJa,uBAAA,CAIb;EAAA,cAAA;EAAA,KAAA,EAFK,aAEL;EAAA;AAAA,CAAA,EAAA,8BAAA,CAAA,EAAiC,6BAAjC"}
@@ -3,7 +3,6 @@ import { useGroupedMessages } from "./private/use-grouped-messages.js";
3
3
  import { useDebouncedConversationSeen } from "./use-conversation-seen.js";
4
4
  import { useConversationTyping } from "./use-conversation-typing.js";
5
5
  import { useMemo } from "react";
6
- import { SenderType } from "@cossistant/types";
7
6
 
8
7
  //#region src/hooks/use-conversation-timeline.ts
9
8
  /**
@@ -16,8 +15,7 @@ function useConversationTimeline({ conversationId, items: timelineItems, current
16
15
  const groupedMessages = useGroupedMessages({
17
16
  items: timelineItems,
18
17
  seenData,
19
- currentViewerId: currentVisitorId,
20
- viewerType: SenderType.VISITOR
18
+ currentViewerId: currentVisitorId
21
19
  });
22
20
  const lastVisitorMessageGroupIndex = useMemo(() => {
23
21
  for (let index = groupedMessages.items.length - 1; index >= 0; index--) {
@@ -1 +1 @@
1
- {"version":3,"file":"use-conversation-timeline.js","names":[],"sources":["../../src/hooks/use-conversation-timeline.ts"],"sourcesContent":["import { SenderType } from \"@cossistant/types\";\nimport type { TimelineItem } from \"@cossistant/types/api/timeline-item\";\nimport { useMemo } from \"react\";\n\nimport {\n\tmapTypingEntriesToParticipants,\n\ttype TimelineTypingParticipant,\n} from \"./private/typing\";\nimport { useGroupedMessages } from \"./private/use-grouped-messages\";\nimport { useDebouncedConversationSeen } from \"./use-conversation-seen\";\nimport { useConversationTyping } from \"./use-conversation-typing\";\n\nexport type ConversationTimelineTypingParticipant = TimelineTypingParticipant;\n\nexport type UseConversationTimelineOptions = {\n\tconversationId: string;\n\titems: TimelineItem[];\n\tcurrentVisitorId?: string;\n};\n\nexport type UseConversationTimelineReturn = {\n\tgroupedMessages: ReturnType<typeof useGroupedMessages>;\n\tseenData: ReturnType<typeof useDebouncedConversationSeen>;\n\ttypingEntries: ReturnType<typeof useConversationTyping>;\n\ttypingParticipants: ConversationTimelineTypingParticipant[];\n\tlastVisitorMessageGroupIndex: number;\n};\n\n/**\n * Produces grouped timeline items, seen data and typing state suitable for the\n * conversation detail view.\n */\nexport function useConversationTimeline({\n\tconversationId,\n\titems: timelineItems,\n\tcurrentVisitorId,\n}: UseConversationTimelineOptions): UseConversationTimelineReturn {\n\tconst seenData = useDebouncedConversationSeen(conversationId);\n\tconst typingEntries = useConversationTyping(conversationId, {\n\t\texcludeVisitorId: currentVisitorId ?? null,\n\t});\n\n\tconst groupedMessages = useGroupedMessages({\n\t\titems: timelineItems,\n\t\tseenData,\n\t\tcurrentViewerId: currentVisitorId,\n\t\tviewerType: SenderType.VISITOR,\n\t});\n\n\tconst lastVisitorMessageGroupIndex = useMemo(() => {\n\t\tfor (let index = groupedMessages.items.length - 1; index >= 0; index--) {\n\t\t\tconst item = groupedMessages.items[index];\n\n\t\t\tif (!item || item.type !== \"message_group\") {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst firstMessage = item.items?.[0];\n\t\t\tif (firstMessage?.visitorId === currentVisitorId) {\n\t\t\t\treturn index;\n\t\t\t}\n\t\t}\n\n\t\treturn -1;\n\t}, [groupedMessages.items, currentVisitorId]);\n\n\tconst typingParticipants = useMemo(\n\t\t() => mapTypingEntriesToParticipants(typingEntries),\n\t\t[typingEntries]\n\t);\n\n\treturn {\n\t\tgroupedMessages,\n\t\tseenData,\n\t\ttypingEntries,\n\t\ttypingParticipants,\n\t\tlastVisitorMessageGroupIndex,\n\t};\n}\n"],"mappings":";;;;;;;;;;;;AAgCA,SAAgB,wBAAwB,EACvC,gBACA,OAAO,eACP,oBACiE;CACjE,MAAM,WAAW,6BAA6B,eAAe;CAC7D,MAAM,gBAAgB,sBAAsB,gBAAgB,EAC3D,kBAAkB,oBAAoB,MACtC,CAAC;CAEF,MAAM,kBAAkB,mBAAmB;EAC1C,OAAO;EACP;EACA,iBAAiB;EACjB,YAAY,WAAW;EACvB,CAAC;CAEF,MAAM,+BAA+B,cAAc;AAClD,OAAK,IAAI,QAAQ,gBAAgB,MAAM,SAAS,GAAG,SAAS,GAAG,SAAS;GACvE,MAAM,OAAO,gBAAgB,MAAM;AAEnC,OAAI,CAAC,QAAQ,KAAK,SAAS,gBAC1B;AAID,QADqB,KAAK,QAAQ,KAChB,cAAc,iBAC/B,QAAO;;AAIT,SAAO;IACL,CAAC,gBAAgB,OAAO,iBAAiB,CAAC;AAO7C,QAAO;EACN;EACA;EACA;EACA,oBAT0B,cACpB,+BAA+B,cAAc,EACnD,CAAC,cAAc,CACf;EAOA;EACA"}
1
+ {"version":3,"file":"use-conversation-timeline.js","names":[],"sources":["../../src/hooks/use-conversation-timeline.ts"],"sourcesContent":["import type { TimelineItem } from \"@cossistant/types/api/timeline-item\";\nimport { useMemo } from \"react\";\n\nimport {\n\tmapTypingEntriesToParticipants,\n\ttype TimelineTypingParticipant,\n} from \"./private/typing\";\nimport { useGroupedMessages } from \"./private/use-grouped-messages\";\nimport { useDebouncedConversationSeen } from \"./use-conversation-seen\";\nimport { useConversationTyping } from \"./use-conversation-typing\";\n\nexport type ConversationTimelineTypingParticipant = TimelineTypingParticipant;\n\nexport type UseConversationTimelineOptions = {\n\tconversationId: string;\n\titems: TimelineItem[];\n\tcurrentVisitorId?: string;\n};\n\nexport type UseConversationTimelineReturn = {\n\tgroupedMessages: ReturnType<typeof useGroupedMessages>;\n\tseenData: ReturnType<typeof useDebouncedConversationSeen>;\n\ttypingEntries: ReturnType<typeof useConversationTyping>;\n\ttypingParticipants: ConversationTimelineTypingParticipant[];\n\tlastVisitorMessageGroupIndex: number;\n};\n\n/**\n * Produces grouped timeline items, seen data and typing state suitable for the\n * conversation detail view.\n */\nexport function useConversationTimeline({\n\tconversationId,\n\titems: timelineItems,\n\tcurrentVisitorId,\n}: UseConversationTimelineOptions): UseConversationTimelineReturn {\n\tconst seenData = useDebouncedConversationSeen(conversationId);\n\tconst typingEntries = useConversationTyping(conversationId, {\n\t\texcludeVisitorId: currentVisitorId ?? null,\n\t});\n\n\tconst groupedMessages = useGroupedMessages({\n\t\titems: timelineItems,\n\t\tseenData,\n\t\tcurrentViewerId: currentVisitorId,\n\t});\n\n\tconst lastVisitorMessageGroupIndex = useMemo(() => {\n\t\tfor (let index = groupedMessages.items.length - 1; index >= 0; index--) {\n\t\t\tconst item = groupedMessages.items[index];\n\n\t\t\tif (!item || item.type !== \"message_group\") {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst firstMessage = item.items?.[0];\n\t\t\tif (firstMessage?.visitorId === currentVisitorId) {\n\t\t\t\treturn index;\n\t\t\t}\n\t\t}\n\n\t\treturn -1;\n\t}, [groupedMessages.items, currentVisitorId]);\n\n\tconst typingParticipants = useMemo(\n\t\t() => mapTypingEntriesToParticipants(typingEntries),\n\t\t[typingEntries]\n\t);\n\n\treturn {\n\t\tgroupedMessages,\n\t\tseenData,\n\t\ttypingEntries,\n\t\ttypingParticipants,\n\t\tlastVisitorMessageGroupIndex,\n\t};\n}\n"],"mappings":";;;;;;;;;;;AA+BA,SAAgB,wBAAwB,EACvC,gBACA,OAAO,eACP,oBACiE;CACjE,MAAM,WAAW,6BAA6B,eAAe;CAC7D,MAAM,gBAAgB,sBAAsB,gBAAgB,EAC3D,kBAAkB,oBAAoB,MACtC,CAAC;CAEF,MAAM,kBAAkB,mBAAmB;EAC1C,OAAO;EACP;EACA,iBAAiB;EACjB,CAAC;CAEF,MAAM,+BAA+B,cAAc;AAClD,OAAK,IAAI,QAAQ,gBAAgB,MAAM,SAAS,GAAG,SAAS,GAAG,SAAS;GACvE,MAAM,OAAO,gBAAgB,MAAM;AAEnC,OAAI,CAAC,QAAQ,KAAK,SAAS,gBAC1B;AAID,QADqB,KAAK,QAAQ,KAChB,cAAc,iBAC/B,QAAO;;AAIT,SAAO;IACL,CAAC,gBAAgB,OAAO,iBAAiB,CAAC;AAO7C,QAAO;EACN;EACA;EACA;EACA,oBAT0B,cACpB,+BAA+B,cAAc,EACnD,CAAC,cAAc,CACf;EAOA;EACA"}
package/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { useClientQuery } from "./hooks/private/use-client-query.js";
2
2
  import { useDefaultMessages } from "./hooks/private/use-default-messages.js";
3
- import { ConversationItem, GroupedMessage, TimelineEventItem, TimelineToolItem, UseGroupedMessagesOptions, UseGroupedMessagesProps, useGroupedMessages } from "./hooks/private/use-grouped-messages.js";
3
+ import { ConversationItem, DaySeparatorItem, GroupedMessage, TimelineEventItem, TimelineToolItem, UseGroupedMessagesOptions, UseGroupedMessagesProps, useGroupedMessages } from "./hooks/private/use-grouped-messages.js";
4
4
  import { UseMultimodalInputOptions, UseMultimodalInputReturn, useMultimodalInput } from "./hooks/private/use-multimodal-input.js";
5
5
  import { UseClientResult, useClient } from "./hooks/private/use-rest-client.js";
6
6
  import { UseComposerRefocusOptions, UseComposerRefocusReturn, useComposerRefocus } from "./hooks/use-composer-refocus.js";
@@ -49,4 +49,4 @@ import { Header } from "./support/components/header.js";
49
49
  import { WebSocketContextValue, WebSocketProvider, useWebSocket } from "./support/context/websocket.js";
50
50
  import { useSupportConfig, useSupportNavigation, useSupportStore } from "./support/store/support-store.js";
51
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 };
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, DaySeparatorItem, 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 };
@@ -0,0 +1,70 @@
1
+ //#region ../../node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/json-schema.d.cts
2
+ type _JSONSchema = boolean | JSONSchema;
3
+ type JSONSchema = {
4
+ [k: string]: unknown;
5
+ $schema?: "https://json-schema.org/draft/2020-12/schema" | "http://json-schema.org/draft-07/schema#" | "http://json-schema.org/draft-04/schema#";
6
+ $id?: string;
7
+ $anchor?: string;
8
+ $ref?: string;
9
+ $dynamicRef?: string;
10
+ $dynamicAnchor?: string;
11
+ $vocabulary?: Record<string, boolean>;
12
+ $comment?: string;
13
+ $defs?: Record<string, JSONSchema>;
14
+ type?: "object" | "array" | "string" | "number" | "boolean" | "null" | "integer";
15
+ additionalItems?: _JSONSchema;
16
+ unevaluatedItems?: _JSONSchema;
17
+ prefixItems?: _JSONSchema[];
18
+ items?: _JSONSchema | _JSONSchema[];
19
+ contains?: _JSONSchema;
20
+ additionalProperties?: _JSONSchema;
21
+ unevaluatedProperties?: _JSONSchema;
22
+ properties?: Record<string, _JSONSchema>;
23
+ patternProperties?: Record<string, _JSONSchema>;
24
+ dependentSchemas?: Record<string, _JSONSchema>;
25
+ propertyNames?: _JSONSchema;
26
+ if?: _JSONSchema;
27
+ then?: _JSONSchema;
28
+ else?: _JSONSchema;
29
+ allOf?: JSONSchema[];
30
+ anyOf?: JSONSchema[];
31
+ oneOf?: JSONSchema[];
32
+ not?: _JSONSchema;
33
+ multipleOf?: number;
34
+ maximum?: number;
35
+ exclusiveMaximum?: number | boolean;
36
+ minimum?: number;
37
+ exclusiveMinimum?: number | boolean;
38
+ maxLength?: number;
39
+ minLength?: number;
40
+ pattern?: string;
41
+ maxItems?: number;
42
+ minItems?: number;
43
+ uniqueItems?: boolean;
44
+ maxContains?: number;
45
+ minContains?: number;
46
+ maxProperties?: number;
47
+ minProperties?: number;
48
+ required?: string[];
49
+ dependentRequired?: Record<string, string[]>;
50
+ enum?: Array<string | number | boolean | null>;
51
+ const?: string | number | boolean | null;
52
+ id?: string;
53
+ title?: string;
54
+ description?: string;
55
+ default?: unknown;
56
+ deprecated?: boolean;
57
+ readOnly?: boolean;
58
+ writeOnly?: boolean;
59
+ nullable?: boolean;
60
+ examples?: unknown[];
61
+ format?: string;
62
+ contentMediaType?: string;
63
+ contentEncoding?: string;
64
+ contentSchema?: JSONSchema;
65
+ _prefault?: unknown;
66
+ };
67
+ type BaseSchema = JSONSchema;
68
+ //#endregion
69
+ export { BaseSchema };
70
+ //# sourceMappingURL=json-schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-schema.d.ts","names":["Schema","ObjectSchema","ArraySchema","StringSchema","NumberSchema","IntegerSchema","BooleanSchema","NullSchema","_JSONSchema","JSONSchema","Record","Array","BaseSchema"],"sources":["../../../node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/json-schema.d.cts"],"sourcesContent":["export type Schema = ObjectSchema | ArraySchema | StringSchema | NumberSchema | IntegerSchema | BooleanSchema | NullSchema;\nexport type _JSONSchema = boolean | JSONSchema;\nexport type JSONSchema = {\n [k: string]: unknown;\n $schema?: \"https://json-schema.org/draft/2020-12/schema\" | \"http://json-schema.org/draft-07/schema#\" | \"http://json-schema.org/draft-04/schema#\";\n $id?: string;\n $anchor?: string;\n $ref?: string;\n $dynamicRef?: string;\n $dynamicAnchor?: string;\n $vocabulary?: Record<string, boolean>;\n $comment?: string;\n $defs?: Record<string, JSONSchema>;\n type?: \"object\" | \"array\" | \"string\" | \"number\" | \"boolean\" | \"null\" | \"integer\";\n additionalItems?: _JSONSchema;\n unevaluatedItems?: _JSONSchema;\n prefixItems?: _JSONSchema[];\n items?: _JSONSchema | _JSONSchema[];\n contains?: _JSONSchema;\n additionalProperties?: _JSONSchema;\n unevaluatedProperties?: _JSONSchema;\n properties?: Record<string, _JSONSchema>;\n patternProperties?: Record<string, _JSONSchema>;\n dependentSchemas?: Record<string, _JSONSchema>;\n propertyNames?: _JSONSchema;\n if?: _JSONSchema;\n then?: _JSONSchema;\n else?: _JSONSchema;\n allOf?: JSONSchema[];\n anyOf?: JSONSchema[];\n oneOf?: JSONSchema[];\n not?: _JSONSchema;\n multipleOf?: number;\n maximum?: number;\n exclusiveMaximum?: number | boolean;\n minimum?: number;\n exclusiveMinimum?: number | boolean;\n maxLength?: number;\n minLength?: number;\n pattern?: string;\n maxItems?: number;\n minItems?: number;\n uniqueItems?: boolean;\n maxContains?: number;\n minContains?: number;\n maxProperties?: number;\n minProperties?: number;\n required?: string[];\n dependentRequired?: Record<string, string[]>;\n enum?: Array<string | number | boolean | null>;\n const?: string | number | boolean | null;\n id?: string;\n title?: string;\n description?: string;\n default?: unknown;\n deprecated?: boolean;\n readOnly?: boolean;\n writeOnly?: boolean;\n nullable?: boolean;\n examples?: unknown[];\n format?: string;\n contentMediaType?: string;\n contentEncoding?: string;\n contentSchema?: JSONSchema;\n _prefault?: unknown;\n};\nexport type BaseSchema = JSONSchema;\nexport interface ObjectSchema extends JSONSchema {\n type: \"object\";\n}\nexport interface ArraySchema extends JSONSchema {\n type: \"array\";\n}\nexport interface StringSchema extends JSONSchema {\n type: \"string\";\n}\nexport interface NumberSchema extends JSONSchema {\n type: \"number\";\n}\nexport interface IntegerSchema extends JSONSchema {\n type: \"integer\";\n}\nexport interface BooleanSchema extends JSONSchema {\n type: \"boolean\";\n}\nexport interface NullSchema extends JSONSchema {\n type: \"null\";\n}\n"],"x_google_ignoreList":[0],"mappings":";AACYQ,KAAAA,WAAAA,GAAW,OAAaC,GAAAA,UAAU;AAClCA,KAAAA,UAAAA,GAAU;EAQJC,CAAAA,CAAAA,EAAAA,MAAAA,CAAAA,EAAAA,OAAAA;EAESD,OAAAA,CAAAA,EAAAA,8CAAAA,GAAAA,yCAAAA,GAAAA,yCAAAA;EAAfC,GAAAA,CAAAA,EAAAA,MAAAA;EAEUF,OAAAA,CAAAA,EAAAA,MAAAA;EACCA,IAAAA,CAAAA,EAAAA,MAAAA;EACLA,WAAAA,CAAAA,EAAAA,MAAAA;EACNA,cAAAA,CAAAA,EAAAA,MAAAA;EAAcA,WAAAA,CAAAA,EAPRE,MAOQF,CAAA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1
1
  import { ISpecificationExtension } from "./specification-extension.js";
2
2
 
3
- //#region ../../node_modules/openapi3-ts/dist/model/openapi30.d.ts
3
+ //#region ../../node_modules/.bun/openapi3-ts@4.5.0/node_modules/openapi3-ts/dist/model/openapi30.d.ts
4
4
 
5
5
  interface ExternalDocumentationObject extends ISpecificationExtension {
6
6
  description?: string;