@cossistant/react 0.0.14 → 0.0.16

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 (126) hide show
  1. package/hooks/index.d.ts +2 -1
  2. package/hooks/index.js +2 -1
  3. package/hooks/use-home-page.js +1 -1
  4. package/hooks/use-home-page.js.map +1 -1
  5. package/hooks/use-scroll-mask.d.ts +24 -0
  6. package/hooks/use-scroll-mask.d.ts.map +1 -0
  7. package/hooks/use-scroll-mask.js +90 -0
  8. package/hooks/use-scroll-mask.js.map +1 -0
  9. package/hooks/use-send-message.js +1 -1
  10. package/hooks/use-send-message.js.map +1 -1
  11. package/index.d.ts +7 -2
  12. package/index.js +9 -5
  13. package/package.json +3 -3
  14. package/parse.d.ts.map +1 -1
  15. package/primitives/avatar/image.d.ts +1 -1
  16. package/primitives/bubble.d.ts +10 -2
  17. package/primitives/bubble.d.ts.map +1 -1
  18. package/primitives/bubble.js +11 -3
  19. package/primitives/bubble.js.map +1 -1
  20. package/primitives/conversation-timeline.d.ts.map +1 -1
  21. package/primitives/conversation-timeline.js +10 -20
  22. package/primitives/conversation-timeline.js.map +1 -1
  23. package/primitives/index.d.ts +5 -2
  24. package/primitives/index.js +11 -3
  25. package/primitives/index.parts.d.ts +4 -1
  26. package/primitives/index.parts.js +5 -2
  27. package/primitives/page-registry.d.ts +30 -0
  28. package/primitives/page-registry.d.ts.map +1 -0
  29. package/primitives/page-registry.js +45 -0
  30. package/primitives/page-registry.js.map +1 -0
  31. package/primitives/page.d.ts +21 -0
  32. package/primitives/page.d.ts.map +1 -0
  33. package/primitives/page.js +18 -0
  34. package/primitives/page.js.map +1 -0
  35. package/primitives/router.d.ts +35 -0
  36. package/primitives/router.d.ts.map +1 -0
  37. package/primitives/router.js +22 -0
  38. package/primitives/router.js.map +1 -0
  39. package/primitives/window.d.ts +8 -3
  40. package/primitives/window.d.ts.map +1 -1
  41. package/primitives/window.js +8 -3
  42. package/primitives/window.js.map +1 -1
  43. package/realtime/index.js +1 -1
  44. package/realtime/provider.js +1 -1
  45. package/realtime/support-provider.js +0 -4
  46. package/realtime/support-provider.js.map +1 -1
  47. package/realtime-events.d.ts +1 -1
  48. package/schemas2.d.ts.map +1 -1
  49. package/support/components/avatar-stack.js +1 -1
  50. package/support/components/avatar-stack.js.map +1 -1
  51. package/support/components/bubble.js +1 -1
  52. package/support/components/bubble.js.map +1 -1
  53. package/support/components/button.d.ts +1 -1
  54. package/support/components/button.js +3 -3
  55. package/support/components/button.js.map +1 -1
  56. package/support/components/container.js +1 -1
  57. package/support/components/container.js.map +1 -1
  58. package/support/components/conversation-timeline.js +1 -1
  59. package/support/components/conversation-timeline.js.map +1 -1
  60. package/support/components/multimodal-input.js +2 -2
  61. package/support/components/multimodal-input.js.map +1 -1
  62. package/support/components/support-content.d.ts +5 -7
  63. package/support/components/support-content.d.ts.map +1 -1
  64. package/support/components/support-content.js +9 -11
  65. package/support/components/support-content.js.map +1 -1
  66. package/support/components/theme-wrapper.d.ts +15 -0
  67. package/support/components/theme-wrapper.d.ts.map +1 -0
  68. package/support/components/theme-wrapper.js +18 -0
  69. package/support/components/theme-wrapper.js.map +1 -0
  70. package/support/components/timeline-identification-tool.js +2 -2
  71. package/support/components/timeline-identification-tool.js.map +1 -1
  72. package/support/components/watermark.js +2 -2
  73. package/support/components/watermark.js.map +1 -1
  74. package/support/index.d.ts +36 -6
  75. package/support/index.d.ts.map +1 -1
  76. package/support/index.js +43 -20
  77. package/support/index.js.map +1 -1
  78. package/support/pages/articles.d.ts +4 -1
  79. package/support/pages/articles.d.ts.map +1 -1
  80. package/support/pages/articles.js +1 -1
  81. package/support/pages/articles.js.map +1 -1
  82. package/support/pages/conversation-history.d.ts +5 -10
  83. package/support/pages/conversation-history.d.ts.map +1 -1
  84. package/support/pages/conversation-history.js +2 -9
  85. package/support/pages/conversation-history.js.map +1 -1
  86. package/support/pages/conversation.d.ts +17 -12
  87. package/support/pages/conversation.d.ts.map +1 -1
  88. package/support/pages/conversation.js +5 -2
  89. package/support/pages/conversation.js.map +1 -1
  90. package/support/pages/home.d.ts +5 -12
  91. package/support/pages/home.d.ts.map +1 -1
  92. package/support/pages/home.js +3 -12
  93. package/support/pages/home.js.map +1 -1
  94. package/support/router.d.ts +9 -4
  95. package/support/router.d.ts.map +1 -1
  96. package/support/router.js +34 -15
  97. package/support/router.js.map +1 -1
  98. package/support/store/support-store.d.ts +17 -14
  99. package/support/store/support-store.d.ts.map +1 -1
  100. package/support/store/support-store.js +13 -10
  101. package/support/store/support-store.js.map +1 -1
  102. package/support/{support-D0JydWRx.css → support-BQhCt9Za.css} +10 -9
  103. package/support/support-BQhCt9Za.css.map +1 -0
  104. package/support/types.d.ts +28 -0
  105. package/support/types.d.ts.map +1 -0
  106. package/support/types.js +1 -0
  107. package/support.css +1 -1
  108. package/tailwind.css +9 -8
  109. package/utils/conversation.d.ts.map +1 -1
  110. package/utils/conversation.js +3 -1
  111. package/utils/conversation.js.map +1 -1
  112. package/utils/use-render-element.d.ts.map +1 -1
  113. package/zod-extensions.d.ts.map +1 -1
  114. package/index4.d.ts +0 -18
  115. package/index4.d.ts.map +0 -1
  116. package/index5.d.ts +0 -999
  117. package/index5.d.ts.map +0 -1
  118. package/index6.d.ts +0 -6
  119. package/react.d.ts +0 -4
  120. package/support/components/text-effect.d.ts +0 -53
  121. package/support/components/text-effect.d.ts.map +0 -1
  122. package/support/components/text-effect.js +0 -225
  123. package/support/components/text-effect.js.map +0 -1
  124. package/support/support-D0JydWRx.css.map +0 -1
  125. package/types.d-BJcRxCew.d.ts +0 -39
  126. package/types.d-BJcRxCew.d.ts.map +0 -1
@@ -13,16 +13,9 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
13
13
 
14
14
  //#region src/support/pages/conversation-history.tsx
15
15
  /**
16
- * Conversation history page component.
17
- *
18
- * Displays:
19
- * - List of all conversations
20
- * - Pagination controls
21
- * - Button to start new conversation
22
- *
23
- * All logic is handled by the useConversationHistoryPage hook.
16
+ * Conversation history page with list of past conversations and pagination.
24
17
  */
25
- const ConversationHistoryPage = () => {
18
+ const ConversationHistoryPage = (_props = {}) => {
26
19
  const { goBack, canGoBack, navigate } = useSupportNavigation();
27
20
  const { availableAIAgents, availableHumanAgents } = useSupport();
28
21
  const text = useSupportText();
@@ -1 +1 @@
1
- {"version":3,"file":"conversation-history.js","names":["ConversationHistoryPage: React.FC","Icon"],"sources":["../../../src/support/pages/conversation-history.tsx"],"sourcesContent":["import { useSupport } from \"@cossistant/react\";\nimport { PENDING_CONVERSATION_ID } from \"@cossistant/react/utils/id\";\nimport type React from \"react\";\nimport { useConversationHistoryPage } from \"../../hooks/use-conversation-history-page\";\nimport { AvatarStack } from \"../components/avatar-stack\";\nimport { CoButton } from \"../components/button\";\nimport { ConversationButtonLink } from \"../components/conversation-button-link\";\nimport { Header } from \"../components/header\";\nimport Icon from \"../components/icons\";\nimport { TextEffect } from \"../components/text-effect\";\nimport { Watermark } from \"../components/watermark\";\nimport { useSupportNavigation } from \"../store/support-store\";\nimport { Text, useSupportText } from \"../text\";\n\n/**\n * Conversation history page component.\n *\n * Displays:\n * - List of all conversations\n * - Pagination controls\n * - Button to start new conversation\n *\n * All logic is handled by the useConversationHistoryPage hook.\n */\nexport const ConversationHistoryPage: React.FC = () => {\n\tconst { goBack, canGoBack, navigate } = useSupportNavigation();\n\tconst { availableAIAgents, availableHumanAgents } = useSupport();\n\tconst text = useSupportText();\n\n\tconst history = useConversationHistoryPage({\n\t\tinitialVisibleCount: 4,\n\t\tonOpenConversation: (conversationId) => {\n\t\t\tnavigate({\n\t\t\t\tpage: \"CONVERSATION\",\n\t\t\t\tparams: {\n\t\t\t\t\tconversationId,\n\t\t\t\t},\n\t\t\t});\n\t\t},\n\t\tonStartConversation: (initialMessage) => {\n\t\t\tnavigate({\n\t\t\t\tpage: \"CONVERSATION\",\n\t\t\t\tparams: {\n\t\t\t\t\tconversationId: PENDING_CONVERSATION_ID,\n\t\t\t\t\tinitialMessage,\n\t\t\t\t},\n\t\t\t});\n\t\t},\n\t});\n\n\tconst handleGoBack = () => {\n\t\tif (canGoBack) {\n\t\t\tgoBack();\n\t\t} else {\n\t\t\tnavigate({\n\t\t\t\tpage: \"HOME\",\n\t\t\t});\n\t\t}\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<Header onGoBack={handleGoBack}>\n\t\t\t\t<div className=\"flex w-full items-center justify-between gap-2 py-3\">\n\t\t\t\t\t<div className=\"flex flex-col\">\n\t\t\t\t\t\t<h2 className=\"max-w-xs text-balance font-co-sans text-md leading-normal\">\n\t\t\t\t\t\t\t{text(\"page.conversationHistory.title\")}\n\t\t\t\t\t\t</h2>\n\t\t\t\t\t</div>\n\t\t\t\t\t<AvatarStack\n\t\t\t\t\t\taiAgents={availableAIAgents}\n\t\t\t\t\t\tgapWidth={2}\n\t\t\t\t\t\thumanAgents={availableHumanAgents}\n\t\t\t\t\t\tsize={32}\n\t\t\t\t\t\tspacing={28}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</Header>\n\n\t\t\t<div className=\"flex flex-1 flex-col items-center justify-between gap-2 px-6 pb-4\">\n\t\t\t\t{history.conversations.length > 0 && (\n\t\t\t\t\t<div className=\"flex flex-col items-center justify-between gap-2 pt-10\">\n\t\t\t\t\t\t<div className=\"flex w-full flex-col overflow-clip rounded-md border border-co-border/80\">\n\t\t\t\t\t\t\t{history.visibleConversations.map((conversation) => (\n\t\t\t\t\t\t\t\t<ConversationButtonLink\n\t\t\t\t\t\t\t\t\tclassName=\"rounded-none\"\n\t\t\t\t\t\t\t\t\tconversation={conversation}\n\t\t\t\t\t\t\t\t\tkey={conversation.id}\n\t\t\t\t\t\t\t\t\tonClick={() => history.openConversation(conversation.id)}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t{history.hasMore && (\n\t\t\t\t\t\t\t<CoButton\n\t\t\t\t\t\t\t\tclassName=\"relative mt-6 w-full text-co-primary/40 text-xs hover:text-co-primary\"\n\t\t\t\t\t\t\t\tonClick={history.showAll}\n\t\t\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\t\t\tas=\"span\"\n\t\t\t\t\t\t\t\t\ttextKey=\"page.conversationHistory.showMore\"\n\t\t\t\t\t\t\t\t\tvariables={{ count: history.remainingCount }}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</CoButton>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\n\t\t\t\t<div className=\"sticky bottom-4 z-10 flex w-full flex-col items-center gap-2\">\n\t\t\t\t\t<CoButton\n\t\t\t\t\t\tclassName=\"relative w-full justify-between\"\n\t\t\t\t\t\tonClick={() => history.startConversation()}\n\t\t\t\t\t\tsize=\"large\"\n\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\tclassName=\"-translate-y-1/2 absolute top-1/2 right-4 size-3 text-co-primary/60 transition-transform duration-200 group-hover/btn:translate-x-0.5 group-hover/btn:text-co-primary\"\n\t\t\t\t\t\t\tname=\"arrow-right\"\n\t\t\t\t\t\t\tvariant=\"default\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<Text as=\"span\" textKey=\"common.actions.askQuestion\" />\n\t\t\t\t\t</CoButton>\n\t\t\t\t\t<Watermark className=\"mt-4 mb-2\" />\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</>\n\t);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAwBA,MAAaA,gCAA0C;CACtD,MAAM,EAAE,QAAQ,WAAW,aAAa,sBAAsB;CAC9D,MAAM,EAAE,mBAAmB,yBAAyB,YAAY;CAChE,MAAM,OAAO,gBAAgB;CAE7B,MAAM,UAAU,2BAA2B;EAC1C,qBAAqB;EACrB,qBAAqB,mBAAmB;AACvC,YAAS;IACR,MAAM;IACN,QAAQ,EACP,gBACA;IACD,CAAC;;EAEH,sBAAsB,mBAAmB;AACxC,YAAS;IACR,MAAM;IACN,QAAQ;KACP,gBAAgB;KAChB;KACA;IACD,CAAC;;EAEH,CAAC;CAEF,MAAM,qBAAqB;AAC1B,MAAI,UACH,SAAQ;MAER,UAAS,EACR,MAAM,QACN,CAAC;;AAIJ,QACC,4CACC,oBAAC;EAAO,UAAU;YACjB,qBAAC;GAAI,WAAU;cACd,oBAAC;IAAI,WAAU;cACd,oBAAC;KAAG,WAAU;eACZ,KAAK,iCAAiC;MACnC;KACA,EACN,oBAAC;IACA,UAAU;IACV,UAAU;IACV,aAAa;IACb,MAAM;IACN,SAAS;KACR;IACG;GACE,EAET,qBAAC;EAAI,WAAU;aACb,QAAQ,cAAc,SAAS,KAC/B,qBAAC;GAAI,WAAU;cACd,oBAAC;IAAI,WAAU;cACb,QAAQ,qBAAqB,KAAK,iBAClC,oBAAC;KACA,WAAU;KACI;KAEd,eAAe,QAAQ,iBAAiB,aAAa,GAAG;OADnD,aAAa,GAEjB,CACD;KACG,EACL,QAAQ,WACR,oBAAC;IACA,WAAU;IACV,SAAS,QAAQ;IACjB,SAAQ;cAER,oBAAC;KACA,IAAG;KACH,SAAQ;KACR,WAAW,EAAE,OAAO,QAAQ,gBAAgB;MAC3C;KACQ;IAEP,EAGP,qBAAC;GAAI,WAAU;cACd,qBAAC;IACA,WAAU;IACV,eAAe,QAAQ,mBAAmB;IAC1C,MAAK;IACL,SAAQ;eAER,oBAACC;KACA,WAAU;KACV,MAAK;KACL,SAAQ;MACP,EACF,oBAAC;KAAK,IAAG;KAAO,SAAQ;MAA+B;KAC7C,EACX,oBAAC,aAAU,WAAU,cAAc;IAC9B;GACD,IACJ"}
1
+ {"version":3,"file":"conversation-history.js","names":["ConversationHistoryPage: React.FC<ConversationHistoryPageProps>","Icon"],"sources":["../../../src/support/pages/conversation-history.tsx"],"sourcesContent":["import { useSupport } from \"@cossistant/react\";\nimport { PENDING_CONVERSATION_ID } from \"@cossistant/react/utils/id\";\nimport type React from \"react\";\nimport { useConversationHistoryPage } from \"../../hooks/use-conversation-history-page\";\nimport { AvatarStack } from \"../components/avatar-stack\";\nimport { CoButton } from \"../components/button\";\nimport { ConversationButtonLink } from \"../components/conversation-button-link\";\nimport { Header } from \"../components/header\";\nimport Icon from \"../components/icons\";\nimport { Watermark } from \"../components/watermark\";\nimport { useSupportNavigation } from \"../store/support-store\";\nimport { Text, useSupportText } from \"../text\";\n\ntype ConversationHistoryPageProps = {\n\tparams?: undefined;\n};\n\n/**\n * Conversation history page with list of past conversations and pagination.\n */\nexport const ConversationHistoryPage: React.FC<ConversationHistoryPageProps> = (\n\t_props = {}\n) => {\n\tconst { goBack, canGoBack, navigate } = useSupportNavigation();\n\tconst { availableAIAgents, availableHumanAgents } = useSupport();\n\tconst text = useSupportText();\n\n\tconst history = useConversationHistoryPage({\n\t\tinitialVisibleCount: 4,\n\t\tonOpenConversation: (conversationId) => {\n\t\t\tnavigate({\n\t\t\t\tpage: \"CONVERSATION\",\n\t\t\t\tparams: {\n\t\t\t\t\tconversationId,\n\t\t\t\t},\n\t\t\t});\n\t\t},\n\t\tonStartConversation: (initialMessage) => {\n\t\t\tnavigate({\n\t\t\t\tpage: \"CONVERSATION\",\n\t\t\t\tparams: {\n\t\t\t\t\tconversationId: PENDING_CONVERSATION_ID,\n\t\t\t\t\tinitialMessage,\n\t\t\t\t},\n\t\t\t});\n\t\t},\n\t});\n\n\tconst handleGoBack = () => {\n\t\tif (canGoBack) {\n\t\t\tgoBack();\n\t\t} else {\n\t\t\tnavigate({\n\t\t\t\tpage: \"HOME\",\n\t\t\t});\n\t\t}\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<Header onGoBack={handleGoBack}>\n\t\t\t\t<div className=\"flex w-full items-center justify-between gap-2 py-3\">\n\t\t\t\t\t<div className=\"flex flex-col\">\n\t\t\t\t\t\t<h2 className=\"max-w-xs text-balance font-co-sans text-md leading-normal\">\n\t\t\t\t\t\t\t{text(\"page.conversationHistory.title\")}\n\t\t\t\t\t\t</h2>\n\t\t\t\t\t</div>\n\t\t\t\t\t<AvatarStack\n\t\t\t\t\t\taiAgents={availableAIAgents}\n\t\t\t\t\t\tgapWidth={2}\n\t\t\t\t\t\thumanAgents={availableHumanAgents}\n\t\t\t\t\t\tsize={32}\n\t\t\t\t\t\tspacing={28}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</Header>\n\n\t\t\t<div className=\"flex flex-1 flex-col items-center justify-between gap-2 px-6 pb-4\">\n\t\t\t\t{history.conversations.length > 0 && (\n\t\t\t\t\t<div className=\"flex flex-col items-center justify-between gap-2 pt-10\">\n\t\t\t\t\t\t<div className=\"flex w-full flex-col overflow-clip rounded-md border border-co-border/80\">\n\t\t\t\t\t\t\t{history.visibleConversations.map((conversation) => (\n\t\t\t\t\t\t\t\t<ConversationButtonLink\n\t\t\t\t\t\t\t\t\tclassName=\"rounded-none\"\n\t\t\t\t\t\t\t\t\tconversation={conversation}\n\t\t\t\t\t\t\t\t\tkey={conversation.id}\n\t\t\t\t\t\t\t\t\tonClick={() => history.openConversation(conversation.id)}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t{history.hasMore && (\n\t\t\t\t\t\t\t<CoButton\n\t\t\t\t\t\t\t\tclassName=\"relative mt-6 w-full text-co-primary/40 text-xs hover:text-co-primary\"\n\t\t\t\t\t\t\t\tonClick={history.showAll}\n\t\t\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\t\t\tas=\"span\"\n\t\t\t\t\t\t\t\t\ttextKey=\"page.conversationHistory.showMore\"\n\t\t\t\t\t\t\t\t\tvariables={{ count: history.remainingCount }}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</CoButton>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\n\t\t\t\t<div className=\"sticky bottom-4 z-10 flex w-full flex-col items-center gap-2\">\n\t\t\t\t\t<CoButton\n\t\t\t\t\t\tclassName=\"relative w-full justify-between\"\n\t\t\t\t\t\tonClick={() => history.startConversation()}\n\t\t\t\t\t\tsize=\"large\"\n\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\tclassName=\"-translate-y-1/2 absolute top-1/2 right-4 size-3 text-co-primary/60 transition-transform duration-200 group-hover/btn:translate-x-0.5 group-hover/btn:text-co-primary\"\n\t\t\t\t\t\t\tname=\"arrow-right\"\n\t\t\t\t\t\t\tvariant=\"default\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<Text as=\"span\" textKey=\"common.actions.askQuestion\" />\n\t\t\t\t\t</CoButton>\n\t\t\t\t\t<Watermark className=\"mt-4 mb-2\" />\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</>\n\t);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAoBA,MAAaA,2BACZ,SAAS,EAAE,KACP;CACJ,MAAM,EAAE,QAAQ,WAAW,aAAa,sBAAsB;CAC9D,MAAM,EAAE,mBAAmB,yBAAyB,YAAY;CAChE,MAAM,OAAO,gBAAgB;CAE7B,MAAM,UAAU,2BAA2B;EAC1C,qBAAqB;EACrB,qBAAqB,mBAAmB;AACvC,YAAS;IACR,MAAM;IACN,QAAQ,EACP,gBACA;IACD,CAAC;;EAEH,sBAAsB,mBAAmB;AACxC,YAAS;IACR,MAAM;IACN,QAAQ;KACP,gBAAgB;KAChB;KACA;IACD,CAAC;;EAEH,CAAC;CAEF,MAAM,qBAAqB;AAC1B,MAAI,UACH,SAAQ;MAER,UAAS,EACR,MAAM,QACN,CAAC;;AAIJ,QACC,4CACC,oBAAC;EAAO,UAAU;YACjB,qBAAC;GAAI,WAAU;cACd,oBAAC;IAAI,WAAU;cACd,oBAAC;KAAG,WAAU;eACZ,KAAK,iCAAiC;MACnC;KACA,EACN,oBAAC;IACA,UAAU;IACV,UAAU;IACV,aAAa;IACb,MAAM;IACN,SAAS;KACR;IACG;GACE,EAET,qBAAC;EAAI,WAAU;aACb,QAAQ,cAAc,SAAS,KAC/B,qBAAC;GAAI,WAAU;cACd,oBAAC;IAAI,WAAU;cACb,QAAQ,qBAAqB,KAAK,iBAClC,oBAAC;KACA,WAAU;KACI;KAEd,eAAe,QAAQ,iBAAiB,aAAa,GAAG;OADnD,aAAa,GAEjB,CACD;KACG,EACL,QAAQ,WACR,oBAAC;IACA,WAAU;IACV,SAAS,QAAQ;IACjB,SAAQ;cAER,oBAAC;KACA,IAAG;KACH,SAAQ;KACR,WAAW,EAAE,OAAO,QAAQ,gBAAgB;MAC3C;KACQ;IAEP,EAGP,qBAAC;GAAI,WAAU;cACd,qBAAC;IACA,WAAU;IACV,eAAe,QAAQ,mBAAmB;IAC1C,MAAK;IACL,SAAQ;eAER,oBAACC;KACA,WAAU;KACV,MAAK;KACL,SAAQ;MACP,EACF,oBAAC;KAAK,IAAG;KAAO,SAAQ;MAA+B;KAC7C,EACX,oBAAC,aAAU,WAAU,cAAc;IAC9B;GACD,IACJ"}
@@ -4,23 +4,28 @@ import { ReactElement } from "react";
4
4
  //#region src/support/pages/conversation.d.ts
5
5
  type ConversationPageProps = {
6
6
  /**
7
- * The conversation ID to display (can be PENDING_CONVERSATION_ID or a real ID).
8
- */
9
- conversationId: string;
10
- /**
11
- * Optional initial message to send when opening the conversation.
7
+ * Page params object (for compatibility with Page component)
12
8
  */
9
+ params?: {
10
+ /**
11
+ * The conversation ID to display (can be PENDING_CONVERSATION_ID or a real ID).
12
+ */
13
+ conversationId: string;
14
+ /**
15
+ * Optional initial message to send when opening the conversation.
16
+ */
17
+ initialMessage?: string;
18
+ /**
19
+ * Optional timeline items to display (for optimistic updates or initial state).
20
+ */
21
+ items?: TimelineItem[];
22
+ };
23
+ conversationId?: string;
13
24
  initialMessage?: string;
14
- /**
15
- * Optional timeline items to display (for optimistic updates or initial state).
16
- */
17
25
  items?: TimelineItem[];
18
26
  };
19
27
  /**
20
- * Main conversation page component.
21
- *
22
- * All conversation logic is handled by the useConversationPage hook,
23
- * making this component focused purely on rendering and user interaction.
28
+ * Conversation page with message timeline and input composer.
24
29
  */
25
30
  type ConversationPageComponent = (props: ConversationPageProps) => ReactElement;
26
31
  declare const ConversationPage: ConversationPageComponent;
@@ -1 +1 @@
1
- {"version":3,"file":"conversation.d.ts","names":[],"sources":["../../../src/support/pages/conversation.tsx"],"sourcesContent":[],"mappings":";;;;KAcK,qBAAA;;AAZ8C;AA0B9B;EAWR,cAAA,EAAA,MA2GZ;;;;;;;;UAtHQ;;;;;;;;KASJ,yBAAA,WAAoC,0BAA0B;cAEtD,kBAAkB"}
1
+ {"version":3,"file":"conversation.d.ts","names":[],"sources":["../../../src/support/pages/conversation.tsx"],"sourcesContent":[],"mappings":";;;;KAcK,qBAAA;;AAZ8C;AAoC9B;EAQR,MAAA,CAAA,EAAA;;;;;;;;;;;;YAdH;;;;UAMD;;;;;KAMJ,yBAAA,WAAoC,0BAA0B;cAEtD,kBAAkB"}
@@ -13,7 +13,10 @@ import { ConversationStatus } from "@cossistant/types";
13
13
  import { jsx, jsxs } from "react/jsx-runtime";
14
14
 
15
15
  //#region src/support/pages/conversation.tsx
16
- const ConversationPage = ({ conversationId: initialConversationId, initialMessage, items: passedItems = [] }) => {
16
+ const ConversationPage = ({ params, conversationId: legacyConversationId, initialMessage: legacyInitialMessage, items: legacyItems }) => {
17
+ const initialConversationId = params?.conversationId ?? legacyConversationId ?? "";
18
+ const initialMessage = params?.initialMessage ?? legacyInitialMessage;
19
+ const passedItems = params?.items ?? legacyItems ?? [];
17
20
  const { website, availableAIAgents, availableHumanAgents, visitor } = useSupport();
18
21
  const { navigate, replace, goBack, canGoBack } = useSupportNavigation();
19
22
  const { isOpen } = useSupportConfig();
@@ -47,7 +50,7 @@ const ConversationPage = ({ conversationId: initialConversationId, initialMessag
47
50
  children: [/* @__PURE__ */ jsxs("div", {
48
51
  className: "flex flex-col",
49
52
  children: [/* @__PURE__ */ jsx("p", {
50
- className: "font-medium text-sm",
53
+ className: "font-medium text-co-primary text-sm",
51
54
  children: website?.name
52
55
  }), /* @__PURE__ */ jsx(Text, {
53
56
  as: "p",
@@ -1 +1 @@
1
- {"version":3,"file":"conversation.js","names":["ConversationPage: ConversationPageComponent"],"sources":["../../../src/support/pages/conversation.tsx"],"sourcesContent":["import { ConversationStatus } from \"@cossistant/types\";\nimport type { TimelineItem } from \"@cossistant/types/api/timeline-item\";\nimport { type ReactElement, useMemo } from \"react\";\nimport { useConversation } from \"../../hooks/use-conversation\";\nimport { useConversationPage } from \"../../hooks/use-conversation-page\";\nimport { useSupport } from \"../../provider\";\nimport { AvatarStack } from \"../components/avatar-stack\";\nimport { ConversationTimelineList } from \"../components/conversation-timeline\";\nimport { Header } from \"../components/header\";\nimport { MultimodalInput } from \"../components/multimodal-input\";\nimport { IdentificationTimelineTool } from \"../components/timeline-identification-tool\";\nimport { useSupportConfig, useSupportNavigation } from \"../store\";\nimport { Text, useSupportText } from \"../text\";\n\ntype ConversationPageProps = {\n\t/**\n\t * The conversation ID to display (can be PENDING_CONVERSATION_ID or a real ID).\n\t */\n\tconversationId: string;\n\n\t/**\n\t * Optional initial message to send when opening the conversation.\n\t */\n\tinitialMessage?: string;\n\n\t/**\n\t * Optional timeline items to display (for optimistic updates or initial state).\n\t */\n\titems?: TimelineItem[];\n};\n\n/**\n * Main conversation page component.\n *\n * All conversation logic is handled by the useConversationPage hook,\n * making this component focused purely on rendering and user interaction.\n */\ntype ConversationPageComponent = (props: ConversationPageProps) => ReactElement;\n\nexport const ConversationPage: ConversationPageComponent = ({\n\tconversationId: initialConversationId,\n\tinitialMessage,\n\titems: passedItems = [],\n}: ConversationPageProps) => {\n\tconst { website, availableAIAgents, availableHumanAgents, visitor } =\n\t\tuseSupport();\n\tconst { navigate, replace, goBack, canGoBack } = useSupportNavigation();\n\tconst { isOpen } = useSupportConfig();\n\tconst text = useSupportText();\n\n\tconst timelineTools = useMemo(\n\t\t() => ({\n\t\t\tidentification: { component: IdentificationTimelineTool },\n\t\t}),\n\t\t[]\n\t);\n\n\t// Main conversation hook - handles all logic\n\tconst conversation = useConversationPage({\n\t\tconversationId: initialConversationId,\n\t\titems: passedItems,\n\t\tinitialMessage,\n\t\tautoSeenEnabled: isOpen,\n\t\tonConversationIdChange: (newConversationId) => {\n\t\t\t// Update navigation when conversation is created\n\t\t\treplace({\n\t\t\t\tpage: \"CONVERSATION\",\n\t\t\t\tparams: { conversationId: newConversationId },\n\t\t\t});\n\t\t},\n\t});\n\n\tconst { conversation: activeConversation } = useConversation(\n\t\tconversation.isPending ? null : conversation.conversationId,\n\t\t{ enabled: !conversation.isPending }\n\t);\n\n\tconst isConversationClosed = Boolean(\n\t\tactiveConversation &&\n\t\t\t(activeConversation.status === ConversationStatus.RESOLVED ||\n\t\t\t\tactiveConversation.status === ConversationStatus.SPAM ||\n\t\t\t\tactiveConversation.deletedAt)\n\t);\n\n\tconst handleGoBack = () => {\n\t\tif (canGoBack) {\n\t\t\tgoBack();\n\t\t} else {\n\t\t\tnavigate({ page: \"HOME\" });\n\t\t}\n\t};\n\n\treturn (\n\t\t<div className=\"flex h-full flex-col gap-0 overflow-hidden\">\n\t\t\t<Header onGoBack={handleGoBack}>\n\t\t\t\t<div className=\"flex w-full items-center justify-between gap-2 py-3\">\n\t\t\t\t\t<div className=\"flex flex-col\">\n\t\t\t\t\t\t<p className=\"font-medium text-sm\">{website?.name}</p>\n\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\tas=\"p\"\n\t\t\t\t\t\t\tclassName=\"text-co-muted-foreground text-sm\"\n\t\t\t\t\t\t\ttextKey=\"common.labels.supportOnline\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t\t<AvatarStack\n\t\t\t\t\t\taiAgents={availableAIAgents}\n\t\t\t\t\t\tgapWidth={2}\n\t\t\t\t\t\thumanAgents={availableHumanAgents}\n\t\t\t\t\t\tsize={32}\n\t\t\t\t\t\tspacing={28}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</Header>\n\n\t\t\t<ConversationTimelineList\n\t\t\t\tavailableAIAgents={availableAIAgents}\n\t\t\t\tavailableHumanAgents={availableHumanAgents}\n\t\t\t\tclassName=\"min-h-0 flex-1 px-4\"\n\t\t\t\tconversationId={conversation.conversationId}\n\t\t\t\tcurrentVisitorId={visitor?.id}\n\t\t\t\titems={conversation.items}\n\t\t\t\ttools={timelineTools}\n\t\t\t/>\n\n\t\t\t{isConversationClosed ? (\n\t\t\t\t<div className=\"m-4 flex items-center justify-center text-balance px-4 pb-6 text-center font-medium text-co-muted-foreground text-sm\">\n\t\t\t\t\t<Text as=\"p\" textKey=\"component.conversationPage.closedMessage\" />\n\t\t\t\t</div>\n\t\t\t) : (\n\t\t\t\t<div className=\"flex-shrink-0 p-1\">\n\t\t\t\t\t<MultimodalInput\n\t\t\t\t\t\tdisabled={conversation.composer.isSubmitting}\n\t\t\t\t\t\terror={conversation.error}\n\t\t\t\t\t\tfiles={conversation.composer.files}\n\t\t\t\t\t\tisSubmitting={conversation.composer.isSubmitting}\n\t\t\t\t\t\tonChange={conversation.composer.setMessage}\n\t\t\t\t\t\tonFileSelect={conversation.composer.addFiles}\n\t\t\t\t\t\tonRemoveFile={conversation.composer.removeFile}\n\t\t\t\t\t\tonSubmit={conversation.composer.submit}\n\t\t\t\t\t\tplaceholder={text(\"component.multimodalInput.placeholder\")}\n\t\t\t\t\t\tvalue={conversation.composer.message}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</div>\n\t);\n};\n"],"mappings":";;;;;;;;;;;;;;;AAuCA,MAAaA,oBAA+C,EAC3D,gBAAgB,uBAChB,gBACA,OAAO,cAAc,EAAE,OACK;CAC5B,MAAM,EAAE,SAAS,mBAAmB,sBAAsB,YACzD,YAAY;CACb,MAAM,EAAE,UAAU,SAAS,QAAQ,cAAc,sBAAsB;CACvE,MAAM,EAAE,WAAW,kBAAkB;CACrC,MAAM,OAAO,gBAAgB;CAE7B,MAAM,gBAAgB,eACd,EACN,gBAAgB,EAAE,WAAW,4BAA4B,EACzD,GACD,EAAE,CACF;CAGD,MAAM,eAAe,oBAAoB;EACxC,gBAAgB;EAChB,OAAO;EACP;EACA,iBAAiB;EACjB,yBAAyB,sBAAsB;AAE9C,WAAQ;IACP,MAAM;IACN,QAAQ,EAAE,gBAAgB,mBAAmB;IAC7C,CAAC;;EAEH,CAAC;CAEF,MAAM,EAAE,cAAc,uBAAuB,gBAC5C,aAAa,YAAY,OAAO,aAAa,gBAC7C,EAAE,SAAS,CAAC,aAAa,WAAW,CACpC;CAED,MAAM,uBAAuB,QAC5B,uBACE,mBAAmB,WAAW,mBAAmB,YACjD,mBAAmB,WAAW,mBAAmB,QACjD,mBAAmB,WACrB;CAED,MAAM,qBAAqB;AAC1B,MAAI,UACH,SAAQ;MAER,UAAS,EAAE,MAAM,QAAQ,CAAC;;AAI5B,QACC,qBAAC;EAAI,WAAU;;GACd,oBAAC;IAAO,UAAU;cACjB,qBAAC;KAAI,WAAU;gBACd,qBAAC;MAAI,WAAU;iBACd,oBAAC;OAAE,WAAU;iBAAuB,SAAS;QAAS,EACtD,oBAAC;OACA,IAAG;OACH,WAAU;OACV,SAAQ;QACP;OACG,EACN,oBAAC;MACA,UAAU;MACV,UAAU;MACV,aAAa;MACb,MAAM;MACN,SAAS;OACR;MACG;KACE;GAET,oBAAC;IACmB;IACG;IACtB,WAAU;IACV,gBAAgB,aAAa;IAC7B,kBAAkB,SAAS;IAC3B,OAAO,aAAa;IACpB,OAAO;KACN;GAED,uBACA,oBAAC;IAAI,WAAU;cACd,oBAAC;KAAK,IAAG;KAAI,SAAQ;MAA6C;KAC7D,GAEN,oBAAC;IAAI,WAAU;cACd,oBAAC;KACA,UAAU,aAAa,SAAS;KAChC,OAAO,aAAa;KACpB,OAAO,aAAa,SAAS;KAC7B,cAAc,aAAa,SAAS;KACpC,UAAU,aAAa,SAAS;KAChC,cAAc,aAAa,SAAS;KACpC,cAAc,aAAa,SAAS;KACpC,UAAU,aAAa,SAAS;KAChC,aAAa,KAAK,wCAAwC;KAC1D,OAAO,aAAa,SAAS;MAC5B;KACG;;GAEF"}
1
+ {"version":3,"file":"conversation.js","names":["ConversationPage: ConversationPageComponent"],"sources":["../../../src/support/pages/conversation.tsx"],"sourcesContent":["import { ConversationStatus } from \"@cossistant/types\";\nimport type { TimelineItem } from \"@cossistant/types/api/timeline-item\";\nimport { type ReactElement, useMemo } from \"react\";\nimport { useConversation } from \"../../hooks/use-conversation\";\nimport { useConversationPage } from \"../../hooks/use-conversation-page\";\nimport { useSupport } from \"../../provider\";\nimport { AvatarStack } from \"../components/avatar-stack\";\nimport { ConversationTimelineList } from \"../components/conversation-timeline\";\nimport { Header } from \"../components/header\";\nimport { MultimodalInput } from \"../components/multimodal-input\";\nimport { IdentificationTimelineTool } from \"../components/timeline-identification-tool\";\nimport { useSupportConfig, useSupportNavigation } from \"../store\";\nimport { Text, useSupportText } from \"../text\";\n\ntype ConversationPageProps = {\n\t/**\n\t * Page params object (for compatibility with Page component)\n\t */\n\tparams?: {\n\t\t/**\n\t\t * The conversation ID to display (can be PENDING_CONVERSATION_ID or a real ID).\n\t\t */\n\t\tconversationId: string;\n\n\t\t/**\n\t\t * Optional initial message to send when opening the conversation.\n\t\t */\n\t\tinitialMessage?: string;\n\n\t\t/**\n\t\t * Optional timeline items to display (for optimistic updates or initial state).\n\t\t */\n\t\titems?: TimelineItem[];\n\t};\n\n\t// Legacy direct props support (deprecated but maintained for backward compatibility)\n\tconversationId?: string;\n\tinitialMessage?: string;\n\titems?: TimelineItem[];\n};\n\n/**\n * Conversation page with message timeline and input composer.\n */\ntype ConversationPageComponent = (props: ConversationPageProps) => ReactElement;\n\nexport const ConversationPage: ConversationPageComponent = ({\n\tparams,\n\tconversationId: legacyConversationId,\n\tinitialMessage: legacyInitialMessage,\n\titems: legacyItems,\n}: ConversationPageProps) => {\n\t// Support both params object (new) and direct props (legacy)\n\tconst initialConversationId =\n\t\tparams?.conversationId ?? legacyConversationId ?? \"\";\n\tconst initialMessage = params?.initialMessage ?? legacyInitialMessage;\n\tconst passedItems = params?.items ?? legacyItems ?? [];\n\tconst { website, availableAIAgents, availableHumanAgents, visitor } =\n\t\tuseSupport();\n\tconst { navigate, replace, goBack, canGoBack } = useSupportNavigation();\n\tconst { isOpen } = useSupportConfig();\n\tconst text = useSupportText();\n\n\tconst timelineTools = useMemo(\n\t\t() => ({\n\t\t\tidentification: { component: IdentificationTimelineTool },\n\t\t}),\n\t\t[]\n\t);\n\n\t// Main conversation hook - handles all logic\n\tconst conversation = useConversationPage({\n\t\tconversationId: initialConversationId,\n\t\titems: passedItems,\n\t\tinitialMessage,\n\t\tautoSeenEnabled: isOpen,\n\t\tonConversationIdChange: (newConversationId) => {\n\t\t\t// Update navigation when conversation is created\n\t\t\treplace({\n\t\t\t\tpage: \"CONVERSATION\",\n\t\t\t\tparams: { conversationId: newConversationId },\n\t\t\t});\n\t\t},\n\t});\n\n\tconst { conversation: activeConversation } = useConversation(\n\t\tconversation.isPending ? null : conversation.conversationId,\n\t\t{ enabled: !conversation.isPending }\n\t);\n\n\tconst isConversationClosed = Boolean(\n\t\tactiveConversation &&\n\t\t\t(activeConversation.status === ConversationStatus.RESOLVED ||\n\t\t\t\tactiveConversation.status === ConversationStatus.SPAM ||\n\t\t\t\tactiveConversation.deletedAt)\n\t);\n\n\tconst handleGoBack = () => {\n\t\tif (canGoBack) {\n\t\t\tgoBack();\n\t\t} else {\n\t\t\tnavigate({ page: \"HOME\" });\n\t\t}\n\t};\n\n\treturn (\n\t\t<div className=\"flex h-full flex-col gap-0 overflow-hidden\">\n\t\t\t<Header onGoBack={handleGoBack}>\n\t\t\t\t<div className=\"flex w-full items-center justify-between gap-2 py-3\">\n\t\t\t\t\t<div className=\"flex flex-col\">\n\t\t\t\t\t\t<p className=\"font-medium text-co-primary text-sm\">\n\t\t\t\t\t\t\t{website?.name}\n\t\t\t\t\t\t</p>\n\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\tas=\"p\"\n\t\t\t\t\t\t\tclassName=\"text-co-muted-foreground text-sm\"\n\t\t\t\t\t\t\ttextKey=\"common.labels.supportOnline\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t\t<AvatarStack\n\t\t\t\t\t\taiAgents={availableAIAgents}\n\t\t\t\t\t\tgapWidth={2}\n\t\t\t\t\t\thumanAgents={availableHumanAgents}\n\t\t\t\t\t\tsize={32}\n\t\t\t\t\t\tspacing={28}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</Header>\n\n\t\t\t<ConversationTimelineList\n\t\t\t\tavailableAIAgents={availableAIAgents}\n\t\t\t\tavailableHumanAgents={availableHumanAgents}\n\t\t\t\tclassName=\"min-h-0 flex-1 px-4\"\n\t\t\t\tconversationId={conversation.conversationId}\n\t\t\t\tcurrentVisitorId={visitor?.id}\n\t\t\t\titems={conversation.items}\n\t\t\t\ttools={timelineTools}\n\t\t\t/>\n\n\t\t\t{isConversationClosed ? (\n\t\t\t\t<div className=\"m-4 flex items-center justify-center text-balance px-4 pb-6 text-center font-medium text-co-muted-foreground text-sm\">\n\t\t\t\t\t<Text as=\"p\" textKey=\"component.conversationPage.closedMessage\" />\n\t\t\t\t</div>\n\t\t\t) : (\n\t\t\t\t<div className=\"flex-shrink-0 p-1\">\n\t\t\t\t\t<MultimodalInput\n\t\t\t\t\t\tdisabled={conversation.composer.isSubmitting}\n\t\t\t\t\t\terror={conversation.error}\n\t\t\t\t\t\tfiles={conversation.composer.files}\n\t\t\t\t\t\tisSubmitting={conversation.composer.isSubmitting}\n\t\t\t\t\t\tonChange={conversation.composer.setMessage}\n\t\t\t\t\t\tonFileSelect={conversation.composer.addFiles}\n\t\t\t\t\t\tonRemoveFile={conversation.composer.removeFile}\n\t\t\t\t\t\tonSubmit={conversation.composer.submit}\n\t\t\t\t\t\tplaceholder={text(\"component.multimodalInput.placeholder\")}\n\t\t\t\t\t\tvalue={conversation.composer.message}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</div>\n\t);\n};\n"],"mappings":";;;;;;;;;;;;;;;AA8CA,MAAaA,oBAA+C,EAC3D,QACA,gBAAgB,sBAChB,gBAAgB,sBAChB,OAAO,kBACqB;CAE5B,MAAM,wBACL,QAAQ,kBAAkB,wBAAwB;CACnD,MAAM,iBAAiB,QAAQ,kBAAkB;CACjD,MAAM,cAAc,QAAQ,SAAS,eAAe,EAAE;CACtD,MAAM,EAAE,SAAS,mBAAmB,sBAAsB,YACzD,YAAY;CACb,MAAM,EAAE,UAAU,SAAS,QAAQ,cAAc,sBAAsB;CACvE,MAAM,EAAE,WAAW,kBAAkB;CACrC,MAAM,OAAO,gBAAgB;CAE7B,MAAM,gBAAgB,eACd,EACN,gBAAgB,EAAE,WAAW,4BAA4B,EACzD,GACD,EAAE,CACF;CAGD,MAAM,eAAe,oBAAoB;EACxC,gBAAgB;EAChB,OAAO;EACP;EACA,iBAAiB;EACjB,yBAAyB,sBAAsB;AAE9C,WAAQ;IACP,MAAM;IACN,QAAQ,EAAE,gBAAgB,mBAAmB;IAC7C,CAAC;;EAEH,CAAC;CAEF,MAAM,EAAE,cAAc,uBAAuB,gBAC5C,aAAa,YAAY,OAAO,aAAa,gBAC7C,EAAE,SAAS,CAAC,aAAa,WAAW,CACpC;CAED,MAAM,uBAAuB,QAC5B,uBACE,mBAAmB,WAAW,mBAAmB,YACjD,mBAAmB,WAAW,mBAAmB,QACjD,mBAAmB,WACrB;CAED,MAAM,qBAAqB;AAC1B,MAAI,UACH,SAAQ;MAER,UAAS,EAAE,MAAM,QAAQ,CAAC;;AAI5B,QACC,qBAAC;EAAI,WAAU;;GACd,oBAAC;IAAO,UAAU;cACjB,qBAAC;KAAI,WAAU;gBACd,qBAAC;MAAI,WAAU;iBACd,oBAAC;OAAE,WAAU;iBACX,SAAS;QACP,EACJ,oBAAC;OACA,IAAG;OACH,WAAU;OACV,SAAQ;QACP;OACG,EACN,oBAAC;MACA,UAAU;MACV,UAAU;MACV,aAAa;MACb,MAAM;MACN,SAAS;OACR;MACG;KACE;GAET,oBAAC;IACmB;IACG;IACtB,WAAU;IACV,gBAAgB,aAAa;IAC7B,kBAAkB,SAAS;IAC3B,OAAO,aAAa;IACpB,OAAO;KACN;GAED,uBACA,oBAAC;IAAI,WAAU;cACd,oBAAC;KAAK,IAAG;KAAI,SAAQ;MAA6C;KAC7D,GAEN,oBAAC;IAAI,WAAU;cACd,oBAAC;KACA,UAAU,aAAa,SAAS;KAChC,OAAO,aAAa;KACpB,OAAO,aAAa,SAAS;KAC7B,cAAc,aAAa,SAAS;KACpC,UAAU,aAAa,SAAS;KAChC,cAAc,aAAa,SAAS;KACpC,cAAc,aAAa,SAAS;KACpC,UAAU,aAAa,SAAS;KAChC,aAAa,KAAK,wCAAwC;KAC1D,OAAO,aAAa,SAAS;MAC5B;KACG;;GAEF"}
@@ -1,20 +1,13 @@
1
1
  import { ReactElement } from "react";
2
2
 
3
3
  //#region src/support/pages/home.d.ts
4
-
4
+ type HomePageProps = {
5
+ params?: undefined;
6
+ };
5
7
  /**
6
- * Home page component for the support widget.
7
- *
8
- * Displays:
9
- * - Welcome message with available agents
10
- * - Quick action buttons
11
- * - Last open conversation (if any)
12
- * - Button to start new conversation
13
- * - Link to conversation history
14
- *
15
- * All logic is handled by the useHomePage hook.
8
+ * Home page with welcome message, quick options, and conversation starter.
16
9
  */
17
- declare const HomePage: () => ReactElement;
10
+ declare const HomePage: (_props?: HomePageProps) => ReactElement;
18
11
  //#endregion
19
12
  export { HomePage };
20
13
  //# sourceMappingURL=home.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"home.d.ts","names":[],"sources":["../../../src/support/pages/home.tsx"],"sourcesContent":[],"mappings":";;;;;;AA2BA;;;;;;;;;;cAAa,gBAAe"}
1
+ {"version":3,"file":"home.d.ts","names":[],"sources":["../../../src/support/pages/home.tsx"],"sourcesContent":[],"mappings":";;;KAcK,aAAA;;AAbqC,CAAA;AAoB1C;;;cAAa,oBAAoB,kBAAqB"}
@@ -14,18 +14,9 @@ import { motion } from "motion/react";
14
14
 
15
15
  //#region src/support/pages/home.tsx
16
16
  /**
17
- * Home page component for the support widget.
18
- *
19
- * Displays:
20
- * - Welcome message with available agents
21
- * - Quick action buttons
22
- * - Last open conversation (if any)
23
- * - Button to start new conversation
24
- * - Link to conversation history
25
- *
26
- * All logic is handled by the useHomePage hook.
17
+ * Home page with welcome message, quick options, and conversation starter.
27
18
  */
28
- const HomePage = () => {
19
+ const HomePage = (_props = {}) => {
29
20
  const { website, availableHumanAgents, visitor, quickOptions } = useSupport();
30
21
  const { navigate } = useSupportNavigation();
31
22
  const text = useSupportText();
@@ -84,7 +75,7 @@ const HomePage = () => {
84
75
  size: 44,
85
76
  spacing: 32
86
77
  }), /* @__PURE__ */ jsx("h2", {
87
- className: "max-w-xs text-balance font-co-sans font-medium text-2xl leading-normal",
78
+ className: "max-w-xs text-balance font-co-sans font-medium text-2xl text-co-primary leading-normal",
88
79
  children: text("page.home.greeting", { visitorName: visitor?.contact?.name?.split(" ")[0] ?? void 0 })
89
80
  })]
90
81
  }), quickOptions.length > 0 && /* @__PURE__ */ jsx(motion.div, {
@@ -1 +1 @@
1
- {"version":3,"file":"home.js","names":["Icon"],"sources":["../../../src/support/pages/home.tsx"],"sourcesContent":["import { motion } from \"motion/react\";\nimport type { ReactElement } from \"react\";\nimport { useHomePage } from \"../../hooks/use-home-page\";\nimport { useSupport } from \"../../provider\";\nimport { PENDING_CONVERSATION_ID } from \"../../utils/id\";\nimport { AvatarStack } from \"../components/avatar-stack\";\nimport { CoButton } from \"../components/button\";\nimport { ConversationButtonLink } from \"../components/conversation-button-link\";\nimport { Header } from \"../components/header\";\nimport Icon from \"../components/icons\";\nimport { TextEffect } from \"../components/text-effect\";\nimport { Watermark } from \"../components/watermark\";\nimport { useSupportNavigation } from \"../store/support-store\";\nimport { Text, useSupportText } from \"../text\";\n\n/**\n * Home page component for the support widget.\n *\n * Displays:\n * - Welcome message with available agents\n * - Quick action buttons\n * - Last open conversation (if any)\n * - Button to start new conversation\n * - Link to conversation history\n *\n * All logic is handled by the useHomePage hook.\n */\nexport const HomePage = (): ReactElement => {\n\tconst { website, availableHumanAgents, visitor, quickOptions } = useSupport();\n\tconst { navigate } = useSupportNavigation();\n\tconst text = useSupportText();\n\n\t// Main home page hook - handles all logic\n\tconst home = useHomePage({\n\t\tonStartConversation: (initialMessage) => {\n\t\t\tnavigate({\n\t\t\t\tpage: \"CONVERSATION\",\n\t\t\t\tparams: {\n\t\t\t\t\tconversationId: PENDING_CONVERSATION_ID,\n\t\t\t\t\tinitialMessage,\n\t\t\t\t},\n\t\t\t});\n\t\t},\n\t\tonOpenConversation: (conversationId) => {\n\t\t\tnavigate({\n\t\t\t\tpage: \"CONVERSATION\",\n\t\t\t\tparams: {\n\t\t\t\t\tconversationId,\n\t\t\t\t},\n\t\t\t});\n\t\t},\n\t\tonOpenConversationHistory: () => {\n\t\t\tnavigate({\n\t\t\t\tpage: \"CONVERSATION_HISTORY\",\n\t\t\t});\n\t\t},\n\t});\n\n\treturn (\n\t\t<>\n\t\t\t<Header>{/* <NavigationTab /> */}</Header>\n\t\t\t<div className=\"sticky top-0 flex flex-1 px-6\">\n\t\t\t\t<div className=\"flex flex-col gap-2\">\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tanimate=\"visible\"\n\t\t\t\t\t\tclassName=\"flex flex-col gap-2\"\n\t\t\t\t\t\texit=\"exit\"\n\t\t\t\t\t\tinitial=\"hidden\"\n\t\t\t\t\t\ttransition={{\n\t\t\t\t\t\t\tdelay: 0.1,\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tvariants={{\n\t\t\t\t\t\t\thidden: { opacity: 0, y: 20, filter: \"blur(12px)\" },\n\t\t\t\t\t\t\tvisible: { opacity: 1, y: 0, filter: \"blur(0px)\" },\n\t\t\t\t\t\t\texit: { opacity: 0, y: 20, filter: \"blur(12px)\" },\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t<AvatarStack\n\t\t\t\t\t\t\taiAgents={website?.availableAIAgents || []}\n\t\t\t\t\t\t\thumanAgents={availableHumanAgents}\n\t\t\t\t\t\t\tsize={44}\n\t\t\t\t\t\t\tspacing={32}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<h2 className=\"max-w-xs text-balance font-co-sans font-medium text-2xl leading-normal\">\n\t\t\t\t\t\t\t{text(\"page.home.greeting\", {\n\t\t\t\t\t\t\t\tvisitorName: visitor?.contact?.name?.split(\" \")[0] ?? undefined,\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t</h2>\n\t\t\t\t\t</motion.div>\n\n\t\t\t\t\t{quickOptions.length > 0 && (\n\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\tanimate=\"visible\"\n\t\t\t\t\t\t\tclassName=\"mt-6 space-x-2 space-y-2\"\n\t\t\t\t\t\t\texit=\"exit\"\n\t\t\t\t\t\t\tinitial=\"hidden\"\n\t\t\t\t\t\t\ttransition={{\n\t\t\t\t\t\t\t\tdelay: 0.1,\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\tvariants={{\n\t\t\t\t\t\t\t\thidden: { opacity: 0, y: 20, filter: \"blur(12px)\" },\n\t\t\t\t\t\t\t\tvisible: { opacity: 1, y: 0, filter: \"blur(0px)\" },\n\t\t\t\t\t\t\t\texit: { opacity: 0, y: 20, filter: \"blur(12px)\" },\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{quickOptions?.map((option) => (\n\t\t\t\t\t\t\t\t<CoButton\n\t\t\t\t\t\t\t\t\tclassName=\"inline-flex w-fit rounded-lg border-dashed px-2\"\n\t\t\t\t\t\t\t\t\tkey={option}\n\t\t\t\t\t\t\t\t\tonClick={() => home.startConversation(option)}\n\t\t\t\t\t\t\t\t\tsize=\"default\"\n\t\t\t\t\t\t\t\t\tvariant=\"outline\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{option}\n\t\t\t\t\t\t\t\t</CoButton>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div className=\"flex flex-shrink-0 flex-col items-center justify-center gap-2 px-6 pb-4\">\n\t\t\t\t{home.availableConversationsCount > 0 && (\n\t\t\t\t\t<CoButton\n\t\t\t\t\t\tclassName=\"relative w-full text-co-primary/40 text-xs hover:text-co-primary\"\n\t\t\t\t\t\tonClick={home.openConversationHistory}\n\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\tas=\"span\"\n\t\t\t\t\t\t\ttextKey=\"page.home.history.more\"\n\t\t\t\t\t\t\tvariables={{ count: home.availableConversationsCount }}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</CoButton>\n\t\t\t\t)}\n\n\t\t\t\t{home.lastOpenConversation && (\n\t\t\t\t\t<div className=\"flex w-full flex-col overflow-clip rounded-md border border-co-border/80\">\n\t\t\t\t\t\t<ConversationButtonLink\n\t\t\t\t\t\t\tclassName=\"rounded-none\"\n\t\t\t\t\t\t\tconversation={home.lastOpenConversation}\n\t\t\t\t\t\t\tkey={home.lastOpenConversation.id}\n\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\tif (home.lastOpenConversation) {\n\t\t\t\t\t\t\t\t\thome.openConversation(home.lastOpenConversation.id);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\n\t\t\t\t<div className=\"sticky bottom-4 z-10 flex w-full flex-col items-center gap-2\">\n\t\t\t\t\t<CoButton\n\t\t\t\t\t\tclassName=\"relative w-full justify-between\"\n\t\t\t\t\t\tonClick={() => home.startConversation()}\n\t\t\t\t\t\tsize=\"large\"\n\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\tclassName=\"-translate-y-1/2 absolute top-1/2 right-4 size-3 text-co-primary/60 transition-transform duration-200 group-hover/btn:translate-x-0.5 group-hover/btn:text-co-primary\"\n\t\t\t\t\t\t\tname=\"arrow-right\"\n\t\t\t\t\t\t\tvariant=\"default\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<Text as=\"span\" textKey=\"common.actions.askQuestion\" />\n\t\t\t\t\t</CoButton>\n\t\t\t\t\t<Watermark className=\"mt-4 mb-0\" />\n\t\t\t\t</div>\n\t\t\t\t<div />\n\t\t\t</div>\n\t\t</>\n\t);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,MAAa,iBAA+B;CAC3C,MAAM,EAAE,SAAS,sBAAsB,SAAS,iBAAiB,YAAY;CAC7E,MAAM,EAAE,aAAa,sBAAsB;CAC3C,MAAM,OAAO,gBAAgB;CAG7B,MAAM,OAAO,YAAY;EACxB,sBAAsB,mBAAmB;AACxC,YAAS;IACR,MAAM;IACN,QAAQ;KACP,gBAAgB;KAChB;KACA;IACD,CAAC;;EAEH,qBAAqB,mBAAmB;AACvC,YAAS;IACR,MAAM;IACN,QAAQ,EACP,gBACA;IACD,CAAC;;EAEH,iCAAiC;AAChC,YAAS,EACR,MAAM,wBACN,CAAC;;EAEH,CAAC;AAEF,QACC;EACC,oBAAC,WAAyC;EAC1C,oBAAC;GAAI,WAAU;aACd,qBAAC;IAAI,WAAU;eACd,qBAAC,OAAO;KACP,SAAQ;KACR,WAAU;KACV,MAAK;KACL,SAAQ;KACR,YAAY,EACX,OAAO,IACP;KACD,UAAU;MACT,QAAQ;OAAE,SAAS;OAAG,GAAG;OAAI,QAAQ;OAAc;MACnD,SAAS;OAAE,SAAS;OAAG,GAAG;OAAG,QAAQ;OAAa;MAClD,MAAM;OAAE,SAAS;OAAG,GAAG;OAAI,QAAQ;OAAc;MACjD;gBAED,oBAAC;MACA,UAAU,SAAS,qBAAqB,EAAE;MAC1C,aAAa;MACb,MAAM;MACN,SAAS;OACR,EACF,oBAAC;MAAG,WAAU;gBACZ,KAAK,sBAAsB,EAC3B,aAAa,SAAS,SAAS,MAAM,MAAM,IAAI,CAAC,MAAM,QACtD,CAAC;OACE;MACO,EAEZ,aAAa,SAAS,KACtB,oBAAC,OAAO;KACP,SAAQ;KACR,WAAU;KACV,MAAK;KACL,SAAQ;KACR,YAAY,EACX,OAAO,IACP;KACD,UAAU;MACT,QAAQ;OAAE,SAAS;OAAG,GAAG;OAAI,QAAQ;OAAc;MACnD,SAAS;OAAE,SAAS;OAAG,GAAG;OAAG,QAAQ;OAAa;MAClD,MAAM;OAAE,SAAS;OAAG,GAAG;OAAI,QAAQ;OAAc;MACjD;eAEA,cAAc,KAAK,WACnB,oBAAC;MACA,WAAU;MAEV,eAAe,KAAK,kBAAkB,OAAO;MAC7C,MAAK;MACL,SAAQ;gBAEP;QALI,OAMK,CACV;MACU;KAET;IACD;EACN,qBAAC;GAAI,WAAU;;IACb,KAAK,8BAA8B,KACnC,oBAAC;KACA,WAAU;KACV,SAAS,KAAK;KACd,SAAQ;eAER,oBAAC;MACA,IAAG;MACH,SAAQ;MACR,WAAW,EAAE,OAAO,KAAK,6BAA6B;OACrD;MACQ;IAGX,KAAK,wBACL,oBAAC;KAAI,WAAU;eACd,oBAAC;MACA,WAAU;MACV,cAAc,KAAK;MAEnB,eAAe;AACd,WAAI,KAAK,qBACR,MAAK,iBAAiB,KAAK,qBAAqB,GAAG;;QAHhD,KAAK,qBAAqB,GAM9B;MACG;IAGP,qBAAC;KAAI,WAAU;gBACd,qBAAC;MACA,WAAU;MACV,eAAe,KAAK,mBAAmB;MACvC,MAAK;MACL,SAAQ;iBAER,oBAACA;OACA,WAAU;OACV,MAAK;OACL,SAAQ;QACP,EACF,oBAAC;OAAK,IAAG;OAAO,SAAQ;QAA+B;OAC7C,EACX,oBAAC,aAAU,WAAU,cAAc;MAC9B;IACN,oBAAC,UAAM;;IACF;KACJ"}
1
+ {"version":3,"file":"home.js","names":["Icon"],"sources":["../../../src/support/pages/home.tsx"],"sourcesContent":["import { motion } from \"motion/react\";\nimport type { ReactElement } from \"react\";\nimport { useHomePage } from \"../../hooks/use-home-page\";\nimport { useSupport } from \"../../provider\";\nimport { PENDING_CONVERSATION_ID } from \"../../utils/id\";\nimport { AvatarStack } from \"../components/avatar-stack\";\nimport { CoButton } from \"../components/button\";\nimport { ConversationButtonLink } from \"../components/conversation-button-link\";\nimport { Header } from \"../components/header\";\nimport Icon from \"../components/icons\";\nimport { Watermark } from \"../components/watermark\";\nimport { useSupportNavigation } from \"../store/support-store\";\nimport { Text, useSupportText } from \"../text\";\n\ntype HomePageProps = {\n\tparams?: undefined;\n};\n\n/**\n * Home page with welcome message, quick options, and conversation starter.\n */\nexport const HomePage = (_props: HomePageProps = {}): ReactElement => {\n\tconst { website, availableHumanAgents, visitor, quickOptions } = useSupport();\n\tconst { navigate } = useSupportNavigation();\n\tconst text = useSupportText();\n\n\t// Main home page hook - handles all logic\n\tconst home = useHomePage({\n\t\tonStartConversation: (initialMessage) => {\n\t\t\tnavigate({\n\t\t\t\tpage: \"CONVERSATION\",\n\t\t\t\tparams: {\n\t\t\t\t\tconversationId: PENDING_CONVERSATION_ID,\n\t\t\t\t\tinitialMessage,\n\t\t\t\t},\n\t\t\t});\n\t\t},\n\t\tonOpenConversation: (conversationId) => {\n\t\t\tnavigate({\n\t\t\t\tpage: \"CONVERSATION\",\n\t\t\t\tparams: {\n\t\t\t\t\tconversationId,\n\t\t\t\t},\n\t\t\t});\n\t\t},\n\t\tonOpenConversationHistory: () => {\n\t\t\tnavigate({\n\t\t\t\tpage: \"CONVERSATION_HISTORY\",\n\t\t\t});\n\t\t},\n\t});\n\n\treturn (\n\t\t<>\n\t\t\t<Header>{/* <NavigationTab /> */}</Header>\n\t\t\t<div className=\"sticky top-0 flex flex-1 px-6\">\n\t\t\t\t<div className=\"flex flex-col gap-2\">\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tanimate=\"visible\"\n\t\t\t\t\t\tclassName=\"flex flex-col gap-2\"\n\t\t\t\t\t\texit=\"exit\"\n\t\t\t\t\t\tinitial=\"hidden\"\n\t\t\t\t\t\ttransition={{\n\t\t\t\t\t\t\tdelay: 0.1,\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tvariants={{\n\t\t\t\t\t\t\thidden: { opacity: 0, y: 20, filter: \"blur(12px)\" },\n\t\t\t\t\t\t\tvisible: { opacity: 1, y: 0, filter: \"blur(0px)\" },\n\t\t\t\t\t\t\texit: { opacity: 0, y: 20, filter: \"blur(12px)\" },\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t<AvatarStack\n\t\t\t\t\t\t\taiAgents={website?.availableAIAgents || []}\n\t\t\t\t\t\t\thumanAgents={availableHumanAgents}\n\t\t\t\t\t\t\tsize={44}\n\t\t\t\t\t\t\tspacing={32}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<h2 className=\"max-w-xs text-balance font-co-sans font-medium text-2xl text-co-primary leading-normal\">\n\t\t\t\t\t\t\t{text(\"page.home.greeting\", {\n\t\t\t\t\t\t\t\tvisitorName: visitor?.contact?.name?.split(\" \")[0] ?? undefined,\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t</h2>\n\t\t\t\t\t</motion.div>\n\n\t\t\t\t\t{quickOptions.length > 0 && (\n\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\tanimate=\"visible\"\n\t\t\t\t\t\t\tclassName=\"mt-6 space-x-2 space-y-2\"\n\t\t\t\t\t\t\texit=\"exit\"\n\t\t\t\t\t\t\tinitial=\"hidden\"\n\t\t\t\t\t\t\ttransition={{\n\t\t\t\t\t\t\t\tdelay: 0.1,\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\tvariants={{\n\t\t\t\t\t\t\t\thidden: { opacity: 0, y: 20, filter: \"blur(12px)\" },\n\t\t\t\t\t\t\t\tvisible: { opacity: 1, y: 0, filter: \"blur(0px)\" },\n\t\t\t\t\t\t\t\texit: { opacity: 0, y: 20, filter: \"blur(12px)\" },\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{quickOptions?.map((option) => (\n\t\t\t\t\t\t\t\t<CoButton\n\t\t\t\t\t\t\t\t\tclassName=\"inline-flex w-fit rounded-lg border-dashed px-2\"\n\t\t\t\t\t\t\t\t\tkey={option}\n\t\t\t\t\t\t\t\t\tonClick={() => home.startConversation(option)}\n\t\t\t\t\t\t\t\t\tsize=\"default\"\n\t\t\t\t\t\t\t\t\tvariant=\"outline\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{option}\n\t\t\t\t\t\t\t\t</CoButton>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div className=\"flex flex-shrink-0 flex-col items-center justify-center gap-2 px-6 pb-4\">\n\t\t\t\t{home.availableConversationsCount > 0 && (\n\t\t\t\t\t<CoButton\n\t\t\t\t\t\tclassName=\"relative w-full text-co-primary/40 text-xs hover:text-co-primary\"\n\t\t\t\t\t\tonClick={home.openConversationHistory}\n\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\tas=\"span\"\n\t\t\t\t\t\t\ttextKey=\"page.home.history.more\"\n\t\t\t\t\t\t\tvariables={{ count: home.availableConversationsCount }}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</CoButton>\n\t\t\t\t)}\n\n\t\t\t\t{home.lastOpenConversation && (\n\t\t\t\t\t<div className=\"flex w-full flex-col overflow-clip rounded-md border border-co-border/80\">\n\t\t\t\t\t\t<ConversationButtonLink\n\t\t\t\t\t\t\tclassName=\"rounded-none\"\n\t\t\t\t\t\t\tconversation={home.lastOpenConversation}\n\t\t\t\t\t\t\tkey={home.lastOpenConversation.id}\n\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\tif (home.lastOpenConversation) {\n\t\t\t\t\t\t\t\t\thome.openConversation(home.lastOpenConversation.id);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\n\t\t\t\t<div className=\"sticky bottom-4 z-10 flex w-full flex-col items-center gap-2\">\n\t\t\t\t\t<CoButton\n\t\t\t\t\t\tclassName=\"relative w-full justify-between\"\n\t\t\t\t\t\tonClick={() => home.startConversation()}\n\t\t\t\t\t\tsize=\"large\"\n\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\tclassName=\"-translate-y-1/2 absolute top-1/2 right-4 size-3 text-co-primary/60 transition-transform duration-200 group-hover/btn:translate-x-0.5 group-hover/btn:text-co-primary\"\n\t\t\t\t\t\t\tname=\"arrow-right\"\n\t\t\t\t\t\t\tvariant=\"default\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<Text as=\"span\" textKey=\"common.actions.askQuestion\" />\n\t\t\t\t\t</CoButton>\n\t\t\t\t\t<Watermark className=\"mt-4 mb-0\" />\n\t\t\t\t</div>\n\t\t\t\t<div />\n\t\t\t</div>\n\t\t</>\n\t);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAqBA,MAAa,YAAY,SAAwB,EAAE,KAAmB;CACrE,MAAM,EAAE,SAAS,sBAAsB,SAAS,iBAAiB,YAAY;CAC7E,MAAM,EAAE,aAAa,sBAAsB;CAC3C,MAAM,OAAO,gBAAgB;CAG7B,MAAM,OAAO,YAAY;EACxB,sBAAsB,mBAAmB;AACxC,YAAS;IACR,MAAM;IACN,QAAQ;KACP,gBAAgB;KAChB;KACA;IACD,CAAC;;EAEH,qBAAqB,mBAAmB;AACvC,YAAS;IACR,MAAM;IACN,QAAQ,EACP,gBACA;IACD,CAAC;;EAEH,iCAAiC;AAChC,YAAS,EACR,MAAM,wBACN,CAAC;;EAEH,CAAC;AAEF,QACC;EACC,oBAAC,WAAyC;EAC1C,oBAAC;GAAI,WAAU;aACd,qBAAC;IAAI,WAAU;eACd,qBAAC,OAAO;KACP,SAAQ;KACR,WAAU;KACV,MAAK;KACL,SAAQ;KACR,YAAY,EACX,OAAO,IACP;KACD,UAAU;MACT,QAAQ;OAAE,SAAS;OAAG,GAAG;OAAI,QAAQ;OAAc;MACnD,SAAS;OAAE,SAAS;OAAG,GAAG;OAAG,QAAQ;OAAa;MAClD,MAAM;OAAE,SAAS;OAAG,GAAG;OAAI,QAAQ;OAAc;MACjD;gBAED,oBAAC;MACA,UAAU,SAAS,qBAAqB,EAAE;MAC1C,aAAa;MACb,MAAM;MACN,SAAS;OACR,EACF,oBAAC;MAAG,WAAU;gBACZ,KAAK,sBAAsB,EAC3B,aAAa,SAAS,SAAS,MAAM,MAAM,IAAI,CAAC,MAAM,QACtD,CAAC;OACE;MACO,EAEZ,aAAa,SAAS,KACtB,oBAAC,OAAO;KACP,SAAQ;KACR,WAAU;KACV,MAAK;KACL,SAAQ;KACR,YAAY,EACX,OAAO,IACP;KACD,UAAU;MACT,QAAQ;OAAE,SAAS;OAAG,GAAG;OAAI,QAAQ;OAAc;MACnD,SAAS;OAAE,SAAS;OAAG,GAAG;OAAG,QAAQ;OAAa;MAClD,MAAM;OAAE,SAAS;OAAG,GAAG;OAAI,QAAQ;OAAc;MACjD;eAEA,cAAc,KAAK,WACnB,oBAAC;MACA,WAAU;MAEV,eAAe,KAAK,kBAAkB,OAAO;MAC7C,MAAK;MACL,SAAQ;gBAEP;QALI,OAMK,CACV;MACU;KAET;IACD;EACN,qBAAC;GAAI,WAAU;;IACb,KAAK,8BAA8B,KACnC,oBAAC;KACA,WAAU;KACV,SAAS,KAAK;KACd,SAAQ;eAER,oBAAC;MACA,IAAG;MACH,SAAQ;MACR,WAAW,EAAE,OAAO,KAAK,6BAA6B;OACrD;MACQ;IAGX,KAAK,wBACL,oBAAC;KAAI,WAAU;eACd,oBAAC;MACA,WAAU;MACV,cAAc,KAAK;MAEnB,eAAe;AACd,WAAI,KAAK,qBACR,MAAK,iBAAiB,KAAK,qBAAqB,GAAG;;QAHhD,KAAK,qBAAqB,GAM9B;MACG;IAGP,qBAAC;KAAI,WAAU;gBACd,qBAAC;MACA,WAAU;MACV,eAAe,KAAK,mBAAmB;MACvC,MAAK;MACL,SAAQ;iBAER,oBAACA;OACA,WAAU;OACV,MAAK;OACL,SAAQ;QACP,EACF,oBAAC;OAAK,IAAG;OAAO,SAAQ;QAA+B;OAC7C,EACX,oBAAC,aAAU,WAAU,cAAc;MAC9B;IACN,oBAAC,UAAM;;IACF;KACJ"}
@@ -3,12 +3,17 @@ import React from "react";
3
3
  //#region src/support/router.d.ts
4
4
 
5
5
  /**
6
- * Routes between different support widget pages based on navigation state.
6
+ * Router with default support pages (HOME, ARTICLES, CONVERSATION, CONVERSATION_HISTORY).
7
+ * Add custom pages as children.
7
8
  *
8
- * Each page manages its own state internally via dedicated hooks,
9
- * so the router simply maps navigation state to the appropriate page component.
9
+ * @example
10
+ * <SupportRouter>
11
+ * <Page name="SETTINGS" component={SettingsPage} />
12
+ * </SupportRouter>
10
13
  */
11
- declare const SupportRouter: React.FC;
14
+ declare const SupportRouter: React.FC<{
15
+ children?: React.ReactNode;
16
+ }>;
12
17
  //#endregion
13
18
  export { SupportRouter };
14
19
  //# sourceMappingURL=router.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"router.d.ts","names":[],"sources":["../../src/support/router.tsx"],"sourcesContent":[],"mappings":";;;;;;AAaA;;;;cAAa,eAAe,KAAA,CAAM"}
1
+ {"version":3,"file":"router.d.ts","names":[],"sources":["../../src/support/router.tsx"],"sourcesContent":[],"mappings":";;;;;;AAiBA;;;;;;;cAAa,eAAe,KAAA,CAAM;aAAgB,KAAA,CAAM"}
package/support/router.js CHANGED
@@ -1,29 +1,48 @@
1
+ import { Page } from "../primitives/page.js";
2
+ import { Router } from "../primitives/router.js";
1
3
  import { useSupportNavigation } from "./store/support-store.js";
2
4
  import { ArticlesPage } from "./pages/articles.js";
3
5
  import { ConversationPage } from "./pages/conversation.js";
4
6
  import { ConversationHistoryPage } from "./pages/conversation-history.js";
5
7
  import { HomePage } from "./pages/home.js";
6
- import { jsx } from "react/jsx-runtime";
8
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
7
9
 
8
10
  //#region src/support/router.tsx
9
11
  /**
10
- * Routes between different support widget pages based on navigation state.
12
+ * Router with default support pages (HOME, ARTICLES, CONVERSATION, CONVERSATION_HISTORY).
13
+ * Add custom pages as children.
11
14
  *
12
- * Each page manages its own state internally via dedicated hooks,
13
- * so the router simply maps navigation state to the appropriate page component.
15
+ * @example
16
+ * <SupportRouter>
17
+ * <Page name="SETTINGS" component={SettingsPage} />
18
+ * </SupportRouter>
14
19
  */
15
- const SupportRouter = () => {
20
+ const SupportRouter = ({ children }) => {
16
21
  const { current } = useSupportNavigation();
17
- switch (current.page) {
18
- case "HOME": return /* @__PURE__ */ jsx(HomePage, {});
19
- case "ARTICLES": return /* @__PURE__ */ jsx(ArticlesPage, {});
20
- case "CONVERSATION": return /* @__PURE__ */ jsx(ConversationPage, {
21
- conversationId: current.params.conversationId,
22
- initialMessage: current.params.initialMessage
23
- });
24
- case "CONVERSATION_HISTORY": return /* @__PURE__ */ jsx(ConversationHistoryPage, {});
25
- default: return /* @__PURE__ */ jsx(HomePage, {});
26
- }
22
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
23
+ /* @__PURE__ */ jsx(Page, {
24
+ component: HomePage,
25
+ name: "HOME"
26
+ }),
27
+ /* @__PURE__ */ jsx(Page, {
28
+ component: ArticlesPage,
29
+ name: "ARTICLES"
30
+ }),
31
+ /* @__PURE__ */ jsx(Page, {
32
+ component: ConversationPage,
33
+ name: "CONVERSATION"
34
+ }),
35
+ /* @__PURE__ */ jsx(Page, {
36
+ component: ConversationHistoryPage,
37
+ name: "CONVERSATION_HISTORY"
38
+ }),
39
+ children,
40
+ /* @__PURE__ */ jsx(Router, {
41
+ fallback: HomePage,
42
+ page: current.page,
43
+ params: current.params
44
+ })
45
+ ] });
27
46
  };
28
47
 
29
48
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"router.js","names":["SupportRouter: React.FC"],"sources":["../../src/support/router.tsx"],"sourcesContent":["import type React from \"react\";\nimport { ArticlesPage } from \"./pages/articles\";\nimport { ConversationPage } from \"./pages/conversation\";\nimport { ConversationHistoryPage } from \"./pages/conversation-history\";\nimport { HomePage } from \"./pages/home\";\nimport { useSupportNavigation } from \"./store/support-store\";\n\n/**\n * Routes between different support widget pages based on navigation state.\n *\n * Each page manages its own state internally via dedicated hooks,\n * so the router simply maps navigation state to the appropriate page component.\n */\nexport const SupportRouter: React.FC = () => {\n\tconst { current } = useSupportNavigation();\n\n\tswitch (current.page) {\n\t\tcase \"HOME\":\n\t\t\treturn <HomePage />;\n\n\t\tcase \"ARTICLES\":\n\t\t\treturn <ArticlesPage />;\n\n\t\tcase \"CONVERSATION\":\n\t\t\treturn (\n\t\t\t\t<ConversationPage\n\t\t\t\t\tconversationId={current.params.conversationId}\n\t\t\t\t\tinitialMessage={current.params.initialMessage}\n\t\t\t\t/>\n\t\t\t);\n\n\t\tcase \"CONVERSATION_HISTORY\":\n\t\t\treturn <ConversationHistoryPage />;\n\n\t\tdefault: {\n\t\t\treturn <HomePage />;\n\t\t}\n\t}\n};\n"],"mappings":";;;;;;;;;;;;;;AAaA,MAAaA,sBAAgC;CAC5C,MAAM,EAAE,YAAY,sBAAsB;AAE1C,SAAQ,QAAQ,MAAhB;EACC,KAAK,OACJ,QAAO,oBAAC,aAAW;EAEpB,KAAK,WACJ,QAAO,oBAAC,iBAAe;EAExB,KAAK,eACJ,QACC,oBAAC;GACA,gBAAgB,QAAQ,OAAO;GAC/B,gBAAgB,QAAQ,OAAO;IAC9B;EAGJ,KAAK,uBACJ,QAAO,oBAAC,4BAA0B;EAEnC,QACC,QAAO,oBAAC,aAAW"}
1
+ {"version":3,"file":"router.js","names":["SupportRouter: React.FC<{ children?: React.ReactNode }>","Primitive.Page","Primitive.Router"],"sources":["../../src/support/router.tsx"],"sourcesContent":["import type React from \"react\";\nimport * as Primitive from \"../primitives\";\nimport { ArticlesPage } from \"./pages/articles\";\nimport { ConversationPage } from \"./pages/conversation\";\nimport { ConversationHistoryPage } from \"./pages/conversation-history\";\nimport { HomePage } from \"./pages/home\";\nimport { useSupportNavigation } from \"./store/support-store\";\n\n/**\n * Router with default support pages (HOME, ARTICLES, CONVERSATION, CONVERSATION_HISTORY).\n * Add custom pages as children.\n *\n * @example\n * <SupportRouter>\n * <Page name=\"SETTINGS\" component={SettingsPage} />\n * </SupportRouter>\n */\nexport const SupportRouter: React.FC<{ children?: React.ReactNode }> = ({\n\tchildren,\n}) => {\n\tconst { current } = useSupportNavigation();\n\n\treturn (\n\t\t<>\n\t\t\t{/* Register default pages */}\n\t\t\t<Primitive.Page\n\t\t\t\tcomponent={HomePage as React.ComponentType<{ params?: unknown }>}\n\t\t\t\tname=\"HOME\"\n\t\t\t/>\n\t\t\t<Primitive.Page\n\t\t\t\tcomponent={ArticlesPage as React.ComponentType<{ params?: unknown }>}\n\t\t\t\tname=\"ARTICLES\"\n\t\t\t/>\n\t\t\t<Primitive.Page\n\t\t\t\tcomponent={\n\t\t\t\t\tConversationPage as React.ComponentType<{ params?: unknown }>\n\t\t\t\t}\n\t\t\t\tname=\"CONVERSATION\"\n\t\t\t/>\n\t\t\t<Primitive.Page\n\t\t\t\tcomponent={\n\t\t\t\t\tConversationHistoryPage as React.ComponentType<{ params?: unknown }>\n\t\t\t\t}\n\t\t\t\tname=\"CONVERSATION_HISTORY\"\n\t\t\t/>\n\n\t\t\t{/* Allow custom pages via children */}\n\t\t\t{children}\n\n\t\t\t{/* Render using primitive router */}\n\t\t\t<Primitive.Router\n\t\t\t\tfallback={HomePage as React.ComponentType<{ params?: unknown }>}\n\t\t\t\tpage={current.page as string}\n\t\t\t\tparams={current.params}\n\t\t\t/>\n\t\t</>\n\t);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAiBA,MAAaA,iBAA2D,EACvE,eACK;CACL,MAAM,EAAE,YAAY,sBAAsB;AAE1C,QACC;EAEC,oBAACC;GACA,WAAW;GACX,MAAK;IACJ;EACF,oBAACA;GACA,WAAW;GACX,MAAK;IACJ;EACF,oBAACA;GACA,WACC;GAED,MAAK;IACJ;EACF,oBAACA;GACA,WACC;GAED,MAAK;IACJ;EAGD;EAGD,oBAACC;GACA,UAAU;GACV,MAAM,QAAQ;GACd,QAAQ,QAAQ;IACf;KACA"}
@@ -4,14 +4,17 @@ import { SupportConfig, SupportStore, SupportStoreState } from "@cossistant/core
4
4
  //#region src/support/store/support-store.d.ts
5
5
  type UseSupportStoreResult = SupportStoreState & Pick<SupportStore, "navigate" | "replace" | "goBack" | "open" | "close" | "toggle" | "updateConfig" | "reset">;
6
6
  /**
7
- * React hook wrapper around the shared support widget store. Exposes both the
8
- * raw state and imperative actions so UI components can drive navigation or
9
- * change configuration without importing the store singleton directly.
7
+ * Access the support widget store state and actions.
8
+ *
9
+ * @example
10
+ * const { isOpen, navigate, toggle } = useSupportStore();
10
11
  */
11
12
  declare function useSupportStore(): UseSupportStoreResult;
12
13
  /**
13
- * Shortcut hook that returns the persisted widget configuration along with
14
- * open/close/toggle helpers for common UI bindings.
14
+ * Access widget configuration (isOpen, size) and toggle helpers.
15
+ *
16
+ * @example
17
+ * const { isOpen, open, close, toggle } = useSupportConfig();
15
18
  */
16
19
  declare const useSupportConfig: () => {
17
20
  open: () => void;
@@ -28,26 +31,26 @@ declare const useSupportConfig: () => {
28
31
  };
29
32
  };
30
33
  /**
31
- * Provides the current navigation entry, the stack history and helpers to
32
- * transition between screens inside the support widget.
34
+ * Access navigation state and routing methods.
35
+ *
36
+ * @example
37
+ * const { navigate, goBack, page, params } = useSupportNavigation();
33
38
  */
34
39
  declare const useSupportNavigation: () => {
35
- current: _cossistant_core0.NavigationState;
40
+ current: _cossistant_core0.NavigationState<_cossistant_core0.RouteRegistry>;
36
41
  page: "HOME" | "ARTICLES" | "CONVERSATION" | "CONVERSATION_HISTORY";
37
42
  params: {
38
43
  conversationId: string;
39
44
  initialMessage?: string;
40
45
  } | undefined;
41
- previousPages: _cossistant_core0.NavigationState[];
42
- navigate: (state: _cossistant_core0.NavigationState) => void;
43
- replace: (state: _cossistant_core0.NavigationState) => void;
46
+ previousPages: _cossistant_core0.NavigationState<_cossistant_core0.RouteRegistry>[];
47
+ navigate: (state: _cossistant_core0.NavigationState<_cossistant_core0.RouteRegistry>) => void;
48
+ replace: (state: _cossistant_core0.NavigationState<_cossistant_core0.RouteRegistry>) => void;
44
49
  goBack: () => void;
45
50
  canGoBack: boolean;
46
51
  };
47
52
  /**
48
- * Applies initial configuration derived from provider props or server state to
49
- * the singleton support store. Call this once during bootstrapping so that the
50
- * UI renders with the expected open state.
53
+ * Initialize store with default configuration (used internally by Support component).
51
54
  */
52
55
  declare const initializeSupportStore: (props: {
53
56
  size?: SupportConfig["size"];
@@ -1 +1 @@
1
- {"version":3,"file":"support-store.d.ts","names":[],"sources":["../../../src/support/store/support-store.ts"],"sourcesContent":[],"mappings":";;;;KA8CY,qBAAA,GAAwB,oBACnC,KACC;;;AAFF;;;AACC,iBAiBe,eAAA,CAAA,CAjBf,EAiBkC,qBAjBlC;;AAiBD;AAuBA;AAkBA;AAiBC,cAnCY,gBAmCZ,EAAA,GAAA,GAAA;;;;;EAOY,MAAA,EAAA,OAAA;;;;;;;;;;;;;cAxBA;WAiBZ,iBAAA,CAAA;;;;;;;;;;;;;;;;;cAOY;SACL"}
1
+ {"version":3,"file":"support-store.d.ts","names":[],"sources":["../../../src/support/store/support-store.ts"],"sourcesContent":[],"mappings":";;;;KA8CY,qBAAA,GAAwB,oBACnC,KACC;;;AAFF;;;;AACK,iBAkBW,eAAA,CAAA,CAlBX,EAkB8B,qBAlB9B;AAkBL;AAyBA;AAoBA;;;;cApBa;;;;;;EA0CA,OAAA,EAAA;;;;;;;;;;;;;;cAtBA;6CAiBZ,iBAAA,CAAA,aAAA;;;;;;;;;;;;;;;cAKY;SACL"}
@@ -16,9 +16,10 @@ function useSelector(selector, isEqual = Object.is) {
16
16
  return selectionRef.current;
17
17
  }
18
18
  /**
19
- * React hook wrapper around the shared support widget store. Exposes both the
20
- * raw state and imperative actions so UI components can drive navigation or
21
- * change configuration without importing the store singleton directly.
19
+ * Access the support widget store state and actions.
20
+ *
21
+ * @example
22
+ * const { isOpen, navigate, toggle } = useSupportStore();
22
23
  */
23
24
  function useSupportStore() {
24
25
  const state = useSelector((current) => current);
@@ -35,8 +36,10 @@ function useSupportStore() {
35
36
  }), [state]);
36
37
  }
37
38
  /**
38
- * Shortcut hook that returns the persisted widget configuration along with
39
- * open/close/toggle helpers for common UI bindings.
39
+ * Access widget configuration (isOpen, size) and toggle helpers.
40
+ *
41
+ * @example
42
+ * const { isOpen, open, close, toggle } = useSupportConfig();
40
43
  */
41
44
  const useSupportConfig = () => {
42
45
  const config = useSelector((state) => state.config);
@@ -48,8 +51,10 @@ const useSupportConfig = () => {
48
51
  }), [config]);
49
52
  };
50
53
  /**
51
- * Provides the current navigation entry, the stack history and helpers to
52
- * transition between screens inside the support widget.
54
+ * Access navigation state and routing methods.
55
+ *
56
+ * @example
57
+ * const { navigate, goBack, page, params } = useSupportNavigation();
53
58
  */
54
59
  const useSupportNavigation = () => {
55
60
  const { current, previousPages } = useSelector((state) => state.navigation);
@@ -65,9 +70,7 @@ const useSupportNavigation = () => {
65
70
  }), [current, previousPages]);
66
71
  };
67
72
  /**
68
- * Applies initial configuration derived from provider props or server state to
69
- * the singleton support store. Call this once during bootstrapping so that the
70
- * UI renders with the expected open state.
73
+ * Initialize store with default configuration (used internally by Support component).
71
74
  */
72
75
  const initializeSupportStore = (props) => {
73
76
  const patch = {};
@@ -1 +1 @@
1
- {"version":3,"file":"support-store.js","names":["patch: Partial<SupportConfig>"],"sources":["../../../src/support/store/support-store.ts"],"sourcesContent":["\"use client\";\n\nimport {\n\tcreateSupportStore,\n\ttype SupportConfig,\n\ttype SupportStore,\n\ttype SupportStoreState,\n} from \"@cossistant/core\";\nimport { useMemo, useRef, useSyncExternalStore } from \"react\";\n\nconst storage = typeof window !== \"undefined\" ? window.localStorage : undefined;\nconst store = createSupportStore({ storage });\n\ntype Selector<T> = (state: SupportStoreState) => T;\n\ntype EqualityChecker<T> = (previous: T, next: T) => boolean;\n\nfunction useSelector<TSelected>(\n\tselector: Selector<TSelected>,\n\tisEqual: EqualityChecker<TSelected> = Object.is\n): TSelected {\n\tconst selectionRef = useRef<TSelected>(undefined);\n\n\tconst subscribe = (onStoreChange: () => void) =>\n\t\tstore.subscribe(() => {\n\t\t\tonStoreChange();\n\t\t});\n\n\tconst snapshot = useSyncExternalStore(\n\t\tsubscribe,\n\t\tstore.getState,\n\t\tstore.getState\n\t);\n\n\tconst selected = selector(snapshot);\n\n\tif (\n\t\tselectionRef.current === undefined ||\n\t\t!isEqual(selectionRef.current, selected)\n\t) {\n\t\tselectionRef.current = selected;\n\t}\n\n\treturn selectionRef.current as TSelected;\n}\n\nexport type UseSupportStoreResult = SupportStoreState &\n\tPick<\n\t\tSupportStore,\n\t\t| \"navigate\"\n\t\t| \"replace\"\n\t\t| \"goBack\"\n\t\t| \"open\"\n\t\t| \"close\"\n\t\t| \"toggle\"\n\t\t| \"updateConfig\"\n\t\t| \"reset\"\n\t>;\n\n/**\n * React hook wrapper around the shared support widget store. Exposes both the\n * raw state and imperative actions so UI components can drive navigation or\n * change configuration without importing the store singleton directly.\n */\nexport function useSupportStore(): UseSupportStoreResult {\n\tconst state = useSelector((current) => current);\n\n\treturn useMemo(\n\t\t() => ({\n\t\t\t...state,\n\t\t\tnavigate: store.navigate,\n\t\t\treplace: store.replace,\n\t\t\tgoBack: store.goBack,\n\t\t\topen: store.open,\n\t\t\tclose: store.close,\n\t\t\ttoggle: store.toggle,\n\t\t\tupdateConfig: store.updateConfig,\n\t\t\treset: store.reset,\n\t\t}),\n\t\t[state]\n\t);\n}\n\n/**\n * Shortcut hook that returns the persisted widget configuration along with\n * open/close/toggle helpers for common UI bindings.\n */\nexport const useSupportConfig = () => {\n\tconst config = useSelector((state) => state.config);\n\n\treturn useMemo(\n\t\t() => ({\n\t\t\t...config,\n\t\t\topen: store.open,\n\t\t\tclose: store.close,\n\t\t\ttoggle: store.toggle,\n\t\t}),\n\t\t[config]\n\t);\n};\n\n/**\n * Provides the current navigation entry, the stack history and helpers to\n * transition between screens inside the support widget.\n */\nexport const useSupportNavigation = () => {\n\tconst navigation = useSelector((state) => state.navigation);\n\tconst { current, previousPages } = navigation;\n\n\treturn useMemo(\n\t\t() => ({\n\t\t\tcurrent,\n\t\t\tpage: current.page,\n\t\t\tparams: current.params,\n\t\t\tpreviousPages,\n\t\t\tnavigate: store.navigate,\n\t\t\treplace: store.replace,\n\t\t\tgoBack: store.goBack,\n\t\t\tcanGoBack: previousPages.length > 0,\n\t\t}),\n\t\t[current, previousPages]\n\t);\n};\n\n/**\n * Applies initial configuration derived from provider props or server state to\n * the singleton support store. Call this once during bootstrapping so that the\n * UI renders with the expected open state.\n */\nexport const initializeSupportStore = (props: {\n\tsize?: SupportConfig[\"size\"];\n\tdefaultOpen?: boolean;\n}) => {\n\tconst patch: Partial<SupportConfig> = {};\n\n\tif (props.size !== undefined) {\n\t\tpatch.size = props.size;\n\t}\n\n\tif (props.defaultOpen !== undefined) {\n\t\tpatch.isOpen = props.defaultOpen;\n\t}\n\n\tif (Object.keys(patch).length > 0) {\n\t\tstore.updateConfig(patch);\n\t}\n};\n"],"mappings":";;;;;;;AAWA,MAAM,QAAQ,mBAAmB,EAAE,SADnB,OAAO,WAAW,cAAc,OAAO,eAAe,QAC1B,CAAC;AAM7C,SAAS,YACR,UACA,UAAsC,OAAO,IACjC;CACZ,MAAM,eAAe,OAAkB,OAAU;CAEjD,MAAM,aAAa,kBAClB,MAAM,gBAAgB;AACrB,iBAAe;GACd;CAQH,MAAM,WAAW,SANA,qBAChB,WACA,MAAM,UACN,MAAM,SACN,CAEkC;AAEnC,KACC,aAAa,YAAY,UACzB,CAAC,QAAQ,aAAa,SAAS,SAAS,CAExC,cAAa,UAAU;AAGxB,QAAO,aAAa;;;;;;;AAqBrB,SAAgB,kBAAyC;CACxD,MAAM,QAAQ,aAAa,YAAY,QAAQ;AAE/C,QAAO,eACC;EACN,GAAG;EACH,UAAU,MAAM;EAChB,SAAS,MAAM;EACf,QAAQ,MAAM;EACd,MAAM,MAAM;EACZ,OAAO,MAAM;EACb,QAAQ,MAAM;EACd,cAAc,MAAM;EACpB,OAAO,MAAM;EACb,GACD,CAAC,MAAM,CACP;;;;;;AAOF,MAAa,yBAAyB;CACrC,MAAM,SAAS,aAAa,UAAU,MAAM,OAAO;AAEnD,QAAO,eACC;EACN,GAAG;EACH,MAAM,MAAM;EACZ,OAAO,MAAM;EACb,QAAQ,MAAM;EACd,GACD,CAAC,OAAO,CACR;;;;;;AAOF,MAAa,6BAA6B;CAEzC,MAAM,EAAE,SAAS,kBADE,aAAa,UAAU,MAAM,WAAW;AAG3D,QAAO,eACC;EACN;EACA,MAAM,QAAQ;EACd,QAAQ,QAAQ;EAChB;EACA,UAAU,MAAM;EAChB,SAAS,MAAM;EACf,QAAQ,MAAM;EACd,WAAW,cAAc,SAAS;EAClC,GACD,CAAC,SAAS,cAAc,CACxB;;;;;;;AAQF,MAAa,0BAA0B,UAGjC;CACL,MAAMA,QAAgC,EAAE;AAExC,KAAI,MAAM,SAAS,OAClB,OAAM,OAAO,MAAM;AAGpB,KAAI,MAAM,gBAAgB,OACzB,OAAM,SAAS,MAAM;AAGtB,KAAI,OAAO,KAAK,MAAM,CAAC,SAAS,EAC/B,OAAM,aAAa,MAAM"}
1
+ {"version":3,"file":"support-store.js","names":["patch: Partial<SupportConfig>"],"sources":["../../../src/support/store/support-store.ts"],"sourcesContent":["\"use client\";\n\nimport {\n\tcreateSupportStore,\n\ttype SupportConfig,\n\ttype SupportStore,\n\ttype SupportStoreState,\n} from \"@cossistant/core\";\nimport { useMemo, useRef, useSyncExternalStore } from \"react\";\n\nconst storage = typeof window !== \"undefined\" ? window.localStorage : undefined;\nconst store = createSupportStore({ storage });\n\ntype Selector<T> = (state: SupportStoreState) => T;\n\ntype EqualityChecker<T> = (previous: T, next: T) => boolean;\n\nfunction useSelector<TSelected>(\n\tselector: Selector<TSelected>,\n\tisEqual: EqualityChecker<TSelected> = Object.is\n): TSelected {\n\tconst selectionRef = useRef<TSelected>(undefined);\n\n\tconst subscribe = (onStoreChange: () => void) =>\n\t\tstore.subscribe(() => {\n\t\t\tonStoreChange();\n\t\t});\n\n\tconst snapshot = useSyncExternalStore(\n\t\tsubscribe,\n\t\tstore.getState,\n\t\tstore.getState\n\t);\n\n\tconst selected = selector(snapshot);\n\n\tif (\n\t\tselectionRef.current === undefined ||\n\t\t!isEqual(selectionRef.current, selected)\n\t) {\n\t\tselectionRef.current = selected;\n\t}\n\n\treturn selectionRef.current as TSelected;\n}\n\nexport type UseSupportStoreResult = SupportStoreState &\n\tPick<\n\t\tSupportStore,\n\t\t| \"navigate\"\n\t\t| \"replace\"\n\t\t| \"goBack\"\n\t\t| \"open\"\n\t\t| \"close\"\n\t\t| \"toggle\"\n\t\t| \"updateConfig\"\n\t\t| \"reset\"\n\t>;\n\n/**\n * Access the support widget store state and actions.\n *\n * @example\n * const { isOpen, navigate, toggle } = useSupportStore();\n */\nexport function useSupportStore(): UseSupportStoreResult {\n\tconst state = useSelector((current) => current);\n\n\treturn useMemo(\n\t\t() => ({\n\t\t\t...state,\n\t\t\tnavigate: store.navigate,\n\t\t\treplace: store.replace,\n\t\t\tgoBack: store.goBack,\n\t\t\topen: store.open,\n\t\t\tclose: store.close,\n\t\t\ttoggle: store.toggle,\n\t\t\tupdateConfig: store.updateConfig,\n\t\t\treset: store.reset,\n\t\t}),\n\t\t[state]\n\t);\n}\n\n/**\n * Access widget configuration (isOpen, size) and toggle helpers.\n *\n * @example\n * const { isOpen, open, close, toggle } = useSupportConfig();\n */\nexport const useSupportConfig = () => {\n\tconst config = useSelector((state) => state.config);\n\n\treturn useMemo(\n\t\t() => ({\n\t\t\t...config,\n\t\t\topen: store.open,\n\t\t\tclose: store.close,\n\t\t\ttoggle: store.toggle,\n\t\t}),\n\t\t[config]\n\t);\n};\n\n/**\n * Access navigation state and routing methods.\n *\n * @example\n * const { navigate, goBack, page, params } = useSupportNavigation();\n */\nexport const useSupportNavigation = () => {\n\tconst navigation = useSelector((state) => state.navigation);\n\tconst { current, previousPages } = navigation;\n\n\treturn useMemo(\n\t\t() => ({\n\t\t\tcurrent,\n\t\t\tpage: current.page,\n\t\t\tparams: current.params,\n\t\t\tpreviousPages,\n\t\t\tnavigate: store.navigate,\n\t\t\treplace: store.replace,\n\t\t\tgoBack: store.goBack,\n\t\t\tcanGoBack: previousPages.length > 0,\n\t\t}),\n\t\t[current, previousPages]\n\t);\n};\n\n/**\n * Initialize store with default configuration (used internally by Support component).\n */\nexport const initializeSupportStore = (props: {\n\tsize?: SupportConfig[\"size\"];\n\tdefaultOpen?: boolean;\n}) => {\n\tconst patch: Partial<SupportConfig> = {};\n\n\tif (props.size !== undefined) {\n\t\tpatch.size = props.size;\n\t}\n\n\tif (props.defaultOpen !== undefined) {\n\t\tpatch.isOpen = props.defaultOpen;\n\t}\n\n\tif (Object.keys(patch).length > 0) {\n\t\tstore.updateConfig(patch);\n\t}\n};\n"],"mappings":";;;;;;;AAWA,MAAM,QAAQ,mBAAmB,EAAE,SADnB,OAAO,WAAW,cAAc,OAAO,eAAe,QAC1B,CAAC;AAM7C,SAAS,YACR,UACA,UAAsC,OAAO,IACjC;CACZ,MAAM,eAAe,OAAkB,OAAU;CAEjD,MAAM,aAAa,kBAClB,MAAM,gBAAgB;AACrB,iBAAe;GACd;CAQH,MAAM,WAAW,SANA,qBAChB,WACA,MAAM,UACN,MAAM,SACN,CAEkC;AAEnC,KACC,aAAa,YAAY,UACzB,CAAC,QAAQ,aAAa,SAAS,SAAS,CAExC,cAAa,UAAU;AAGxB,QAAO,aAAa;;;;;;;;AAsBrB,SAAgB,kBAAyC;CACxD,MAAM,QAAQ,aAAa,YAAY,QAAQ;AAE/C,QAAO,eACC;EACN,GAAG;EACH,UAAU,MAAM;EAChB,SAAS,MAAM;EACf,QAAQ,MAAM;EACd,MAAM,MAAM;EACZ,OAAO,MAAM;EACb,QAAQ,MAAM;EACd,cAAc,MAAM;EACpB,OAAO,MAAM;EACb,GACD,CAAC,MAAM,CACP;;;;;;;;AASF,MAAa,yBAAyB;CACrC,MAAM,SAAS,aAAa,UAAU,MAAM,OAAO;AAEnD,QAAO,eACC;EACN,GAAG;EACH,MAAM,MAAM;EACZ,OAAO,MAAM;EACb,QAAQ,MAAM;EACd,GACD,CAAC,OAAO,CACR;;;;;;;;AASF,MAAa,6BAA6B;CAEzC,MAAM,EAAE,SAAS,kBADE,aAAa,UAAU,MAAM,WAAW;AAG3D,QAAO,eACC;EACN;EACA,MAAM,QAAQ;EACd,QAAQ,QAAQ;EAChB;EACA,UAAU,MAAM;EAChB,SAAS,MAAM;EACf,QAAQ,MAAM;EACd,WAAW,cAAc,SAAS;EAClC,GACD,CAAC,SAAS,cAAc,CACxB;;;;;AAMF,MAAa,0BAA0B,UAGjC;CACL,MAAMA,QAAgC,EAAE;AAExC,KAAI,MAAM,SAAS,OAClB,OAAM,OAAO,MAAM;AAGpB,KAAI,MAAM,gBAAgB,OACzB,OAAM,SAAS,MAAM;AAGtB,KAAI,OAAO,KAAK,MAAM,CAAC,SAAS,EAC/B,OAAM,aAAa,MAAM"}
@@ -5,11 +5,12 @@
5
5
  @source "./components";
6
6
  @source "./pages";
7
7
 
8
- @custom-variant dark (&:is(.dark *));
8
+ @plugin 'tailwind-scrollbar';
9
9
 
10
10
  @layer base {
11
11
  .cossistant {
12
12
  @apply scroll-smooth;
13
+ @apply text-co-primary;
13
14
 
14
15
  color-scheme: inherit;
15
16
 
@@ -25,13 +26,13 @@
25
26
  /* Core surfaces */
26
27
  --co-radius: var(--co-theme-radius, 0.625rem);
27
28
  --co-background-base: var(--co-theme-background, oklch(99% 0 0));
28
- --co-foreground-base: var(--co-theme-foreground, oklch(14.5% 0 0));
29
+ --co-foreground-base: var(--co-theme-foreground, oklch(20.5% 0 0));
29
30
  --co-popover-base: var(--co-theme-popover, var(--co-background-base));
30
31
  --co-popover-foreground-base: var(
31
32
  --co-theme-popover-foreground,
32
33
  var(--co-foreground-base)
33
34
  );
34
- --co-primary-base: var(--co-theme-primary, oklch(20.5% 0 0));
35
+ --co-primary-base: var(--co-theme-primary, oklch(14.5% 0 0));
35
36
  --co-primary-foreground-base: var(
36
37
  --co-theme-primary-foreground,
37
38
  oklch(98.5% 0 0)
@@ -39,7 +40,7 @@
39
40
  --co-secondary-base: var(--co-theme-secondary, oklch(97% 0 0));
40
41
  --co-secondary-foreground-base: var(
41
42
  --co-theme-secondary-foreground,
42
- oklch(20.5% 0 0)
43
+ oklch(14.5% 0 0)
43
44
  );
44
45
  --co-border-base: var(--co-theme-border, oklch(92.2% 0 0));
45
46
  --co-input-base: var(--co-theme-input, oklch(92.2% 0 0));
@@ -224,21 +225,21 @@
224
225
  .cossistant[data-color-scheme="dark"] {
225
226
  /* Dark mode defaults */
226
227
  --co-background-base: var(--co-theme-background, oklch(15.5% 0 0));
227
- --co-foreground-base: var(--co-theme-foreground, oklch(98.5% 0 0));
228
+ --co-foreground-base: var(--co-theme-foreground, oklch(95% 0 0));
228
229
  --co-popover-base: var(--co-theme-popover, oklch(14.5% 0 0));
229
230
  --co-popover-foreground-base: var(
230
231
  --co-theme-popover-foreground,
231
- oklch(98.5% 0 0)
232
+ oklch(95% 0 0)
232
233
  );
233
234
  --co-primary-base: var(--co-theme-primary, oklch(98.5% 0 0));
234
235
  --co-primary-foreground-base: var(
235
236
  --co-theme-primary-foreground,
236
- oklch(20.5% 0 0)
237
+ oklch(14.5% 0 0)
237
238
  );
238
239
  --co-secondary-base: var(--co-theme-secondary, oklch(26.9% 0 0));
239
240
  --co-secondary-foreground-base: var(
240
241
  --co-theme-secondary-foreground,
241
- oklch(98.5% 0 0)
242
+ oklch(95% 0 0)
242
243
  );
243
244
  --co-border-base: var(--co-theme-border, oklch(26.9% 0 0));
244
245
  --co-input-base: var(--co-theme-input, oklch(26.9% 0 0));
@@ -362,4 +363,4 @@
362
363
  }
363
364
 
364
365
 
365
- /*# sourceMappingURL=support-D0JydWRx.css.map*/
366
+ /*# sourceMappingURL=support-BQhCt9Za.css.map*/