@cossistant/react 0.0.4 → 0.0.6
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.
- package/README.md +27 -0
- package/_virtual/rolldown_runtime.js +19 -0
- package/conversation.d.ts +23 -0
- package/conversation.d.ts.map +1 -1
- package/hooks/index.d.ts +5 -3
- package/hooks/index.js +7 -5
- package/hooks/private/store/use-conversations-store.d.ts +8 -0
- package/hooks/private/store/use-conversations-store.d.ts.map +1 -1
- package/hooks/private/store/use-conversations-store.js +8 -0
- package/hooks/private/store/use-conversations-store.js.map +1 -1
- package/hooks/private/store/use-store-selector.d.ts +4 -0
- package/hooks/private/store/use-store-selector.d.ts.map +1 -1
- package/hooks/private/store/use-store-selector.js +5 -2
- package/hooks/private/store/use-store-selector.js.map +1 -1
- package/hooks/private/store/use-website-store.d.ts +4 -0
- package/hooks/private/store/use-website-store.d.ts.map +1 -1
- package/hooks/private/store/use-website-store.js +6 -3
- package/hooks/private/store/use-website-store.js.map +1 -1
- package/hooks/private/typing.d.ts +35 -0
- package/hooks/private/typing.d.ts.map +1 -0
- package/hooks/private/typing.js +49 -0
- package/hooks/private/typing.js.map +1 -0
- package/hooks/private/use-client-query.d.ts +5 -0
- package/hooks/private/use-client-query.d.ts.map +1 -1
- package/hooks/private/use-client-query.js +5 -0
- package/hooks/private/use-client-query.js.map +1 -1
- package/hooks/private/use-grouped-messages.d.ts +10 -4
- package/hooks/private/use-grouped-messages.d.ts.map +1 -1
- package/hooks/private/use-grouped-messages.js +24 -4
- package/hooks/private/use-grouped-messages.js.map +1 -1
- package/hooks/private/use-multimodal-input.d.ts.map +1 -1
- package/hooks/private/use-rest-client.d.ts.map +1 -1
- package/hooks/private/use-visitor-typing-reporter.d.ts +6 -0
- package/hooks/private/use-visitor-typing-reporter.d.ts.map +1 -1
- package/hooks/private/use-visitor-typing-reporter.js +6 -0
- package/hooks/private/use-visitor-typing-reporter.js.map +1 -1
- package/hooks/use-composer-refocus.d.ts.map +1 -1
- package/hooks/use-conversation-auto-seen.d.ts +9 -0
- package/hooks/use-conversation-auto-seen.d.ts.map +1 -1
- package/hooks/use-conversation-auto-seen.js +44 -3
- package/hooks/use-conversation-auto-seen.js.map +1 -1
- package/hooks/use-conversation-history-page.d.ts.map +1 -1
- package/hooks/use-conversation-history-page.js +16 -18
- package/hooks/use-conversation-history-page.js.map +1 -1
- package/hooks/use-conversation-lifecycle.d.ts.map +1 -1
- package/hooks/use-conversation-lifecycle.js +2 -4
- package/hooks/use-conversation-lifecycle.js.map +1 -1
- package/hooks/use-conversation-page.d.ts +6 -0
- package/hooks/use-conversation-page.d.ts.map +1 -1
- package/hooks/use-conversation-page.js +41 -3
- package/hooks/use-conversation-page.js.map +1 -1
- package/hooks/use-conversation-preview.d.ts +61 -0
- package/hooks/use-conversation-preview.d.ts.map +1 -0
- package/hooks/use-conversation-preview.js +173 -0
- package/hooks/use-conversation-preview.js.map +1 -0
- package/hooks/use-conversation-seen.d.ts +4 -0
- package/hooks/use-conversation-seen.d.ts.map +1 -1
- package/hooks/use-conversation-seen.js +4 -0
- package/hooks/use-conversation-seen.js.map +1 -1
- package/hooks/use-conversation-timeline-items.d.ts +4 -0
- package/hooks/use-conversation-timeline-items.d.ts.map +1 -1
- package/hooks/use-conversation-timeline-items.js +4 -0
- package/hooks/use-conversation-timeline-items.js.map +1 -1
- package/hooks/use-conversation-timeline.d.ts +32 -0
- package/hooks/use-conversation-timeline.d.ts.map +1 -0
- package/hooks/use-conversation-timeline.js +41 -0
- package/hooks/use-conversation-timeline.js.map +1 -0
- package/hooks/use-conversation-typing.d.ts +4 -0
- package/hooks/use-conversation-typing.d.ts.map +1 -1
- package/hooks/use-conversation-typing.js +4 -0
- package/hooks/use-conversation-typing.js.map +1 -1
- package/hooks/use-conversation.d.ts +11 -0
- package/hooks/use-conversation.d.ts.map +1 -1
- package/hooks/use-conversation.js +11 -0
- package/hooks/use-conversation.js.map +1 -1
- package/hooks/use-conversations.d.ts +12 -0
- package/hooks/use-conversations.d.ts.map +1 -1
- package/hooks/use-conversations.js +12 -0
- package/hooks/use-conversations.js.map +1 -1
- package/hooks/use-create-conversation.d.ts +5 -0
- package/hooks/use-create-conversation.d.ts.map +1 -1
- package/hooks/use-create-conversation.js +12 -9
- package/hooks/use-create-conversation.js.map +1 -1
- package/hooks/use-home-page.d.ts.map +1 -1
- package/hooks/use-home-page.js +6 -4
- package/hooks/use-home-page.js.map +1 -1
- package/hooks/use-message-composer.d.ts.map +1 -1
- package/hooks/use-realtime-support.d.ts.map +1 -1
- package/hooks/use-send-message.d.ts +9 -0
- package/hooks/use-send-message.d.ts.map +1 -1
- package/hooks/use-send-message.js +15 -13
- package/hooks/use-send-message.js.map +1 -1
- package/hooks/use-visitor.d.ts.map +1 -1
- package/hooks/use-visitor.js +28 -30
- package/hooks/use-visitor.js.map +1 -1
- package/hooks/use-window-visibility-focus.d.ts +4 -0
- package/hooks/use-window-visibility-focus.d.ts.map +1 -1
- package/hooks/use-window-visibility-focus.js +5 -2
- package/hooks/use-window-visibility-focus.js.map +1 -1
- package/identify-visitor.d.ts +12 -3
- package/identify-visitor.d.ts.map +1 -1
- package/identify-visitor.js +58 -9
- package/identify-visitor.js.map +1 -1
- package/index.d.ts +10 -7
- package/index.js +10 -9
- package/package.json +12 -16
- package/primitives/avatar/avatar.d.ts.map +1 -1
- package/primitives/avatar/fallback.d.ts.map +1 -1
- package/primitives/avatar/fallback.js +1 -3
- package/primitives/avatar/fallback.js.map +1 -1
- package/primitives/avatar/image.d.ts.map +1 -1
- package/primitives/avatar/index.d.ts +1 -0
- package/primitives/bubble.d.ts +2 -0
- package/primitives/bubble.d.ts.map +1 -1
- package/primitives/bubble.js +8 -2
- package/primitives/bubble.js.map +1 -1
- package/primitives/button.d.ts.map +1 -1
- package/primitives/conversation-timeline.d.ts.map +1 -1
- package/primitives/conversation-timeline.js +58 -5
- package/primitives/conversation-timeline.js.map +1 -1
- package/primitives/index.d.ts +1 -0
- package/primitives/index.parts.d.ts +1 -0
- package/primitives/multimodal-input.d.ts.map +1 -1
- package/primitives/timeline-item-group.d.ts +7 -7
- package/primitives/timeline-item-group.d.ts.map +1 -1
- package/primitives/timeline-item-group.js.map +1 -1
- package/primitives/timeline-item.d.ts +1 -1
- package/primitives/timeline-item.d.ts.map +1 -1
- package/primitives/timeline-item.js +7 -1
- package/primitives/timeline-item.js.map +1 -1
- package/primitives/window.d.ts +1 -1
- package/primitives/window.d.ts.map +1 -1
- package/primitives/window.js +4 -4
- package/primitives/window.js.map +1 -1
- package/provider.d.ts +23 -43
- package/provider.d.ts.map +1 -1
- package/provider.js +152 -49
- package/provider.js.map +1 -1
- package/realtime/event-filter.d.ts +4 -0
- package/realtime/event-filter.d.ts.map +1 -1
- package/realtime/event-filter.js +4 -0
- package/realtime/event-filter.js.map +1 -1
- package/realtime/index.js +1 -1
- package/realtime/provider.d.ts +7 -2
- package/realtime/provider.d.ts.map +1 -1
- package/realtime/provider.js +23 -1
- package/realtime/provider.js.map +1 -1
- package/realtime/seen-store.d.ts +13 -0
- package/realtime/seen-store.d.ts.map +1 -1
- package/realtime/seen-store.js +14 -2
- package/realtime/seen-store.js.map +1 -1
- package/realtime/support-provider.d.ts +1 -2
- package/realtime/support-provider.d.ts.map +1 -1
- package/realtime/support-provider.js +19 -20
- package/realtime/support-provider.js.map +1 -1
- package/realtime/typing-store.d.ts +18 -0
- package/realtime/typing-store.d.ts.map +1 -1
- package/realtime/typing-store.js +19 -2
- package/realtime/typing-store.js.map +1 -1
- package/realtime/use-realtime.d.ts +8 -4
- package/realtime/use-realtime.d.ts.map +1 -1
- package/realtime/use-realtime.js +4 -0
- package/realtime/use-realtime.js.map +1 -1
- package/realtime-events.d.ts +15 -1
- package/realtime-events.d.ts.map +1 -1
- package/schemas.d.ts +6 -0
- package/schemas.d.ts.map +1 -1
- package/support/components/avatar-stack.d.ts +8 -4
- package/support/components/avatar-stack.d.ts.map +1 -1
- package/support/components/avatar-stack.js +4 -0
- package/support/components/avatar-stack.js.map +1 -1
- package/support/components/avatar.d.ts +11 -6
- package/support/components/avatar.d.ts.map +1 -1
- package/support/components/avatar.js +4 -0
- package/support/components/avatar.js.map +1 -1
- package/support/components/bubble.d.ts.map +1 -1
- package/support/components/bubble.js +29 -6
- package/support/components/bubble.js.map +1 -1
- package/support/components/button.d.ts +8 -5
- package/support/components/button.d.ts.map +1 -1
- package/support/components/button.js +5 -1
- package/support/components/button.js.map +1 -1
- package/support/components/container.d.ts +0 -1
- package/support/components/container.d.ts.map +1 -1
- package/support/components/container.js +2 -8
- package/support/components/container.js.map +1 -1
- package/support/components/conversation-button-link.d.ts +8 -21
- package/support/components/conversation-button-link.d.ts.map +1 -1
- package/support/components/conversation-button-link.js +62 -178
- package/support/components/conversation-button-link.js.map +1 -1
- package/support/components/conversation-event.d.ts.map +1 -1
- package/support/components/conversation-event.js +4 -0
- package/support/components/conversation-event.js.map +1 -1
- package/support/components/conversation-timeline.d.ts +10 -1
- package/support/components/conversation-timeline.d.ts.map +1 -1
- package/support/components/conversation-timeline.js +63 -57
- package/support/components/conversation-timeline.js.map +1 -1
- package/support/components/cossistant-branding.d.ts +5 -2
- package/support/components/cossistant-branding.d.ts.map +1 -1
- package/support/components/cossistant-branding.js +3 -0
- package/support/components/cossistant-branding.js.map +1 -1
- package/support/components/header.d.ts.map +1 -1
- package/support/components/header.js +2 -2
- package/support/components/header.js.map +1 -1
- package/support/components/icons.d.ts.map +1 -1
- package/support/components/multimodal-input.d.ts.map +1 -1
- package/support/components/multimodal-input.js +5 -24
- package/support/components/multimodal-input.js.map +1 -1
- package/support/components/navigation-tab.d.ts +7 -2
- package/support/components/navigation-tab.d.ts.map +1 -1
- package/support/components/navigation-tab.js +4 -0
- package/support/components/navigation-tab.js.map +1 -1
- package/support/components/support-content.d.ts +1 -1
- package/support/components/support-content.d.ts.map +1 -1
- package/support/components/support-content.js +7 -10
- package/support/components/support-content.js.map +1 -1
- package/support/components/text-effect.d.ts +5 -2
- package/support/components/text-effect.d.ts.map +1 -1
- package/support/components/text-effect.js +4 -0
- package/support/components/text-effect.js.map +1 -1
- package/support/components/timeline-identification-tool.d.ts +7 -0
- package/support/components/timeline-identification-tool.d.ts.map +1 -0
- package/support/components/timeline-identification-tool.js +139 -0
- package/support/components/timeline-identification-tool.js.map +1 -0
- package/support/components/timeline-message-group.d.ts +2 -1
- package/support/components/timeline-message-group.d.ts.map +1 -1
- package/support/components/timeline-message-group.js +4 -19
- package/support/components/timeline-message-group.js.map +1 -1
- package/support/components/timeline-message-item.d.ts +6 -2
- package/support/components/timeline-message-item.d.ts.map +1 -1
- package/support/components/timeline-message-item.js +8 -4
- package/support/components/timeline-message-item.js.map +1 -1
- package/support/components/typing-indicator.d.ts +5 -2
- package/support/components/typing-indicator.d.ts.map +1 -1
- package/support/components/typing-indicator.js +4 -4
- package/support/components/typing-indicator.js.map +1 -1
- package/support/components/watermark.d.ts.map +1 -1
- package/support/context/websocket.d.ts +8 -0
- package/support/context/websocket.d.ts.map +1 -1
- package/support/context/websocket.js +12 -6
- package/support/context/websocket.js.map +1 -1
- package/support/index.d.ts +8 -8
- package/support/index.d.ts.map +1 -1
- package/support/index.js +18 -18
- package/support/index.js.map +1 -1
- package/support/pages/conversation-history.js +46 -54
- package/support/pages/conversation-history.js.map +1 -1
- package/support/pages/conversation.d.ts +3 -6
- package/support/pages/conversation.d.ts.map +1 -1
- package/support/pages/conversation.js +19 -9
- package/support/pages/conversation.js.map +1 -1
- package/support/pages/home.d.ts +2 -2
- package/support/pages/home.d.ts.map +1 -1
- package/support/pages/home.js +64 -77
- package/support/pages/home.js.map +1 -1
- package/support/store/support-store.d.ts +18 -2
- package/support/store/support-store.d.ts.map +1 -1
- package/support/store/support-store.js +20 -5
- package/support/store/support-store.js.map +1 -1
- package/support/{support-CMoDLQoC.css → support-Ck4jy29i.css} +1 -2
- package/support/support-Ck4jy29i.css.map +1 -0
- package/support/text/index.d.ts +15 -2
- package/support/text/index.d.ts.map +1 -1
- package/support/text/index.js +15 -2
- package/support/text/index.js.map +1 -1
- package/support/text/locales/en.js +22 -4
- package/support/text/locales/en.js.map +1 -1
- package/support/text/locales/es.js +18 -0
- package/support/text/locales/es.js.map +1 -1
- package/support/text/locales/fr.js +18 -0
- package/support/text/locales/fr.js.map +1 -1
- package/support/text/locales/keys.d.ts +69 -9
- package/support/text/locales/keys.d.ts.map +1 -1
- package/support/text/locales/keys.js +18 -0
- package/support/text/locales/keys.js.map +1 -1
- package/support/text/runtime.d.ts +21 -0
- package/support/text/runtime.d.ts.map +1 -1
- package/support/text/runtime.js +21 -0
- package/support/text/runtime.js.map +1 -1
- package/support/utils/index.d.ts +4 -0
- package/support/utils/index.d.ts.map +1 -1
- package/support/utils/index.js +4 -1
- package/support/utils/index.js.map +1 -1
- package/support/utils/time.d.ts +3 -0
- package/support/utils/time.d.ts.map +1 -1
- package/support/utils/time.js +3 -0
- package/support/utils/time.js.map +1 -1
- package/support-config.d.ts +2 -1
- package/support-config.d.ts.map +1 -1
- package/support-config.js.map +1 -1
- package/support.css +2 -2
- package/tailwind.css +404 -0
- package/timeline-item.d.ts +10 -0
- package/timeline-item.d.ts.map +1 -1
- package/utils/conversation.d.ts +7 -0
- package/utils/conversation.d.ts.map +1 -0
- package/utils/conversation.js +18 -0
- package/utils/conversation.js.map +1 -0
- package/utils/id.d.ts +3 -0
- package/utils/id.d.ts.map +1 -1
- package/utils/id.js +3 -0
- package/utils/id.js.map +1 -1
- package/utils/index.d.ts +2 -1
- package/utils/index.js +2 -1
- package/utils/metadata-hash.d.ts +12 -0
- package/utils/metadata-hash.d.ts.map +1 -0
- package/utils/metadata-hash.js +26 -0
- package/utils/metadata-hash.js.map +1 -0
- package/utils/text.d.ts +3 -0
- package/utils/text.d.ts.map +1 -1
- package/utils/text.js +3 -0
- package/utils/text.js.map +1 -1
- package/utils/use-render-element.d.ts +3 -0
- package/utils/use-render-element.d.ts.map +1 -1
- package/utils/use-render-element.js +3 -0
- package/utils/use-render-element.js.map +1 -1
- package/support/context/config.d.ts +0 -32
- package/support/context/config.d.ts.map +0 -1
- package/support/context/config.js +0 -27
- package/support/context/config.js.map +0 -1
- package/support/support-CMoDLQoC.css.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation-tab.js","names":["Icon"],"sources":["../../../src/support/components/navigation-tab.tsx"],"sourcesContent":["import { useSupportNavigation } from \"../store\";\nimport { Text } from \"../text\";\nimport { Button } from \"./button\";\nimport Icon from \"./icons\";\n\nexport function NavigationTab() {\n\tconst { current, navigate } = useSupportNavigation();\n\n\treturn (\n\t\t<div className=\"flex w-full items-center justify-center gap-2\">\n\t\t\t<Button\n\t\t\t\tonClick={() => navigate({ page: \"HOME\" })}\n\t\t\t\tvariant={current.page === \"HOME\" ? \"tab-selected\" : \"tab\"}\n\t\t\t>\n\t\t\t\t<Icon\n\t\t\t\t\tfilledOnHover\n\t\t\t\t\tname=\"home\"\n\t\t\t\t\tvariant={current.page === \"HOME\" ? \"filled\" : \"default\"}\n\t\t\t\t/>\n\t\t\t\t<Text as=\"span\" textKey=\"component.navigation.home\" />\n\t\t\t</Button>\n\t\t\t<Button\n\t\t\t\tonClick={() => navigate({ page: \"ARTICLES\" })}\n\t\t\t\tvariant={current.page === \"ARTICLES\" ? \"tab-selected\" : \"tab\"}\n\t\t\t>\n\t\t\t\t<Icon\n\t\t\t\t\tfilledOnHover\n\t\t\t\t\tname=\"articles\"\n\t\t\t\t\tvariant={current.page === \"ARTICLES\" ? \"filled\" : \"default\"}\n\t\t\t\t/>\n\t\t\t\t<Text as=\"span\" textKey=\"component.navigation.articles\" />\n\t\t\t</Button>\n\t\t</div>\n\t);\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"navigation-tab.js","names":["Icon"],"sources":["../../../src/support/components/navigation-tab.tsx"],"sourcesContent":["import type { ReactElement } from \"react\";\n\nimport { useSupportNavigation } from \"../store\";\nimport { Text } from \"../text\";\nimport { Button } from \"./button\";\nimport Icon from \"./icons\";\n\n/**\n * Tab bar used inside the widget header to switch between home and knowledge\n * base views.\n */\nexport function NavigationTab(): ReactElement {\n\tconst { current, navigate } = useSupportNavigation();\n\n\treturn (\n\t\t<div className=\"flex w-full items-center justify-center gap-2\">\n\t\t\t<Button\n\t\t\t\tonClick={() => navigate({ page: \"HOME\" })}\n\t\t\t\tvariant={current.page === \"HOME\" ? \"tab-selected\" : \"tab\"}\n\t\t\t>\n\t\t\t\t<Icon\n\t\t\t\t\tfilledOnHover\n\t\t\t\t\tname=\"home\"\n\t\t\t\t\tvariant={current.page === \"HOME\" ? \"filled\" : \"default\"}\n\t\t\t\t/>\n\t\t\t\t<Text as=\"span\" textKey=\"component.navigation.home\" />\n\t\t\t</Button>\n\t\t\t<Button\n\t\t\t\tonClick={() => navigate({ page: \"ARTICLES\" })}\n\t\t\t\tvariant={current.page === \"ARTICLES\" ? \"tab-selected\" : \"tab\"}\n\t\t\t>\n\t\t\t\t<Icon\n\t\t\t\t\tfilledOnHover\n\t\t\t\t\tname=\"articles\"\n\t\t\t\t\tvariant={current.page === \"ARTICLES\" ? \"filled\" : \"default\"}\n\t\t\t\t/>\n\t\t\t\t<Text as=\"span\" textKey=\"component.navigation.articles\" />\n\t\t\t</Button>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;;;;;AAWA,SAAgB,gBAA8B;CAC7C,MAAM,EAAE,SAAS,aAAa,sBAAsB;AAEpD,QACC,qBAAC;EAAI,WAAU;aACd,qBAAC;GACA,eAAe,SAAS,EAAE,MAAM,QAAQ,CAAC;GACzC,SAAS,QAAQ,SAAS,SAAS,iBAAiB;cAEpD,oBAACA;IACA;IACA,MAAK;IACL,SAAS,QAAQ,SAAS,SAAS,WAAW;KAC7C,EACF,oBAAC;IAAK,IAAG;IAAO,SAAQ;KAA8B;IAC9C,EACT,qBAAC;GACA,eAAe,SAAS,EAAE,MAAM,YAAY,CAAC;GAC7C,SAAS,QAAQ,SAAS,aAAa,iBAAiB;cAExD,oBAACA;IACA;IACA,MAAK;IACL,SAAS,QAAQ,SAAS,aAAa,WAAW;KACjD,EACF,oBAAC;IAAK,IAAG;IAAO,SAAQ;KAAkC;IAClD;GACJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"support-content.d.ts","names":[],"sources":["../../../src/support/components/support-content.tsx"],"sourcesContent":[],"mappings":";;;KAUK,mBAAA;;EAAA,QAAA,CAAA,EAAA,KAAA,GAAA,QAAmB;EAgBX,KAAA,CAAA,EAAA,OAAA,
|
|
1
|
+
{"version":3,"file":"support-content.d.ts","names":[],"sources":["../../../src/support/components/support-content.tsx"],"sourcesContent":[],"mappings":";;;KAUK,mBAAA;;EAAA,QAAA,CAAA,EAAA,KAAA,GAAA,QAAmB;EAgBX,KAAA,CAAA,EAAA,OAAA,GAmCZ,MAAA;;;;;;;;;;;;cAnCY,gBAAgB,KAAA,CAAM,GAAG"}
|
|
@@ -18,14 +18,12 @@ import { motion } from "motion/react";
|
|
|
18
18
|
* Each page (e.g., conversation, home) manages its own state internally,
|
|
19
19
|
* so this component is purely presentational.
|
|
20
20
|
*/
|
|
21
|
-
const SupportContent = ({ className, position = "bottom", align = "right",
|
|
22
|
-
const containerClasses = cn("cossistant", {
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"left-4": mode === "floating" && align === "left",
|
|
28
|
-
"relative h-full w-full": mode === "responsive"
|
|
21
|
+
const SupportContent = ({ className, position = "bottom", align = "right", positioning = "fixed" }) => {
|
|
22
|
+
const containerClasses = cn("cossistant z-[9999]", positioning === "fixed" ? "fixed" : "absolute", {
|
|
23
|
+
"bottom-4": position === "bottom",
|
|
24
|
+
"top-4": position === "top",
|
|
25
|
+
"right-4": align === "right",
|
|
26
|
+
"left-4": align === "left"
|
|
29
27
|
}, className);
|
|
30
28
|
return /* @__PURE__ */ jsxs(motion.div, {
|
|
31
29
|
animate: { opacity: 1 },
|
|
@@ -36,9 +34,8 @@ const SupportContent = ({ className, position = "bottom", align = "right", mode
|
|
|
36
34
|
default: { ease: "anticipate" },
|
|
37
35
|
layout: { duration: .3 }
|
|
38
36
|
},
|
|
39
|
-
children: [
|
|
37
|
+
children: [/* @__PURE__ */ jsx(Bubble, { className: "z-[1000] md:z-[9999]" }), /* @__PURE__ */ jsx(Container, {
|
|
40
38
|
align,
|
|
41
|
-
mode,
|
|
42
39
|
position,
|
|
43
40
|
children: /* @__PURE__ */ jsx(SupportRouter, {})
|
|
44
41
|
})]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"support-content.js","names":["SupportContent: React.FC<SupportContentProps>"],"sources":["../../../src/support/components/support-content.tsx"],"sourcesContent":["\"use client\";\n\nimport { motion } from \"motion/react\";\nimport type React from \"react\";\n\nimport { SupportRouter } from \"../router\";\nimport { cn } from \"../utils\";\nimport { Bubble } from \"./bubble\";\nimport { Container } from \"./container\";\n\ntype SupportContentProps = {\n\tclassName?: string;\n\tposition?: \"top\" | \"bottom\";\n\talign?: \"right\" | \"left\";\n\
|
|
1
|
+
{"version":3,"file":"support-content.js","names":["SupportContent: React.FC<SupportContentProps>"],"sources":["../../../src/support/components/support-content.tsx"],"sourcesContent":["\"use client\";\n\nimport { motion } from \"motion/react\";\nimport type React from \"react\";\n\nimport { SupportRouter } from \"../router\";\nimport { cn } from \"../utils\";\nimport { Bubble } from \"./bubble\";\nimport { Container } from \"./container\";\n\ntype SupportContentProps = {\n\tclassName?: string;\n\tposition?: \"top\" | \"bottom\";\n\talign?: \"right\" | \"left\";\n\tpositioning?: \"fixed\" | \"absolute\";\n};\n\n/**\n * Main support widget content container.\n *\n * Handles the layout and positioning of the support widget,\n * and renders the appropriate page via SupportRouter.\n *\n * Each page (e.g., conversation, home) manages its own state internally,\n * so this component is purely presentational.\n */\nexport const SupportContent: React.FC<SupportContentProps> = ({\n\tclassName,\n\tposition = \"bottom\",\n\talign = \"right\",\n\tpositioning = \"fixed\",\n}) => {\n\tconst containerClasses = cn(\n\t\t\"cossistant z-[9999]\",\n\t\tpositioning === \"fixed\" ? \"fixed\" : \"absolute\",\n\t\t{\n\t\t\t\"bottom-4\": position === \"bottom\",\n\t\t\t\"top-4\": position === \"top\",\n\t\t\t\"right-4\": align === \"right\",\n\t\t\t\"left-4\": align === \"left\",\n\t\t},\n\t\tclassName\n\t);\n\n\treturn (\n\t\t<motion.div\n\t\t\tanimate={{ opacity: 1 }}\n\t\t\tclassName={containerClasses}\n\t\t\tinitial={{ opacity: 0 }}\n\t\t\tlayout=\"position\"\n\t\t\ttransition={{\n\t\t\t\tdefault: { ease: \"anticipate\" },\n\t\t\t\tlayout: { duration: 0.3 },\n\t\t\t}}\n\t\t>\n\t\t\t<Bubble className=\"z-[1000] md:z-[9999]\" />\n\t\t\t<Container align={align} position={position}>\n\t\t\t\t<SupportRouter />\n\t\t\t</Container>\n\t\t</motion.div>\n\t);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA0BA,MAAaA,kBAAiD,EAC7D,WACA,WAAW,UACX,QAAQ,SACR,cAAc,cACT;CACL,MAAM,mBAAmB,GACxB,uBACA,gBAAgB,UAAU,UAAU,YACpC;EACC,YAAY,aAAa;EACzB,SAAS,aAAa;EACtB,WAAW,UAAU;EACrB,UAAU,UAAU;EACpB,EACD,UACA;AAED,QACC,qBAAC,OAAO;EACP,SAAS,EAAE,SAAS,GAAG;EACvB,WAAW;EACX,SAAS,EAAE,SAAS,GAAG;EACvB,QAAO;EACP,YAAY;GACX,SAAS,EAAE,MAAM,cAAc;GAC/B,QAAQ,EAAE,UAAU,IAAK;GACzB;aAED,oBAAC,UAAO,WAAU,yBAAyB,EAC3C,oBAAC;GAAiB;GAAiB;aAClC,oBAAC,kBAAgB;IACN;GACA"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import * as react_jsx_runtime7 from "react/jsx-runtime";
|
|
3
2
|
import { Transition, Variants } from "motion/react";
|
|
4
3
|
|
|
5
4
|
//#region src/support/components/text-effect.d.ts
|
|
@@ -26,6 +25,10 @@ type TextEffectProps = {
|
|
|
26
25
|
segmentTransition?: Transition;
|
|
27
26
|
style?: React.CSSProperties;
|
|
28
27
|
};
|
|
28
|
+
/**
|
|
29
|
+
* Animated typography helper that reveals text word-by-word or letter-by-letter
|
|
30
|
+
* with configurable motion presets.
|
|
31
|
+
*/
|
|
29
32
|
declare function TextEffect({
|
|
30
33
|
children,
|
|
31
34
|
per,
|
|
@@ -43,7 +46,7 @@ declare function TextEffect({
|
|
|
43
46
|
containerTransition,
|
|
44
47
|
segmentTransition,
|
|
45
48
|
style
|
|
46
|
-
}: TextEffectProps):
|
|
49
|
+
}: TextEffectProps): React.ReactElement;
|
|
47
50
|
//#endregion
|
|
48
51
|
export { PerType, PresetType, TextEffect, TextEffectProps };
|
|
49
52
|
//# sourceMappingURL=text-effect.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-effect.d.ts","names":[],"sources":["../../../src/support/components/text-effect.tsx"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"text-effect.d.ts","names":[],"sources":["../../../src/support/components/text-effect.tsx"],"sourcesContent":[],"mappings":";;;;KAWY,UAAA;KAEA,OAAA;AAFA,KAMA,eAAA,GANU;EAEV,QAAA,EAAO,MAAA,GAAA,MAAA,EAAA;EAIP,GAAA,CAAA,EAEL,OAFK;EAEL,EAAA,CAAA,EAAA,MACK,KAAA,CAAM,GAAA,CAAI,iBADf;EACK,QAAU,CAAA,EAAA;IAER,SAAA,CAAA,EAAA,QAAA;IACL,IAAA,CAAA,EAAA,QAAA;EAGC,CAAA;EAQa,SAAA,CAAA,EAAA,MAAA;EACF,MAAA,CAAA,EATX,UASW;EACZ,KAAM,CAAA,EAAA,MAAA;EAAa,WAAA,CAAA,EAAA,MAAA;EAmLZ,YAAA,CAAU,EAAA,MAAA;EACzB,OAAA,CAAA,EAAA,OAAA;EACA,mBAAA,CAAA,EAAA,GAAA,GAAA,IAAA;EACA,gBAAA,CAAA,EAAA,GAAA,GAAA,IAAA;EACA,uBAAA,CAAA,EAAA,MAAA;EACA,mBAAA,CAAA,EA1LsB,UA0LtB;EACA,iBAAA,CAAA,EA1LoB,UA0LpB;EACA,KAAA,CAAA,EA1LQ,KAAA,CAAM,aA0Ld;CACA;;;;;AAKA,iBAbe,UAAA,CAaf;EAAA,QAAA;EAAA,GAAA;EAAA,EAAA;EAAA,QAAA;EAAA,SAAA;EAAA,MAAA;EAAA,KAAA;EAAA,WAAA;EAAA,YAAA;EAAA,OAAA;EAAA,mBAAA;EAAA,gBAAA;EAAA,uBAAA;EAAA,mBAAA;EAAA,iBAAA;EAAA;AAAA,CAAA,EAIE,eAJF,CAAA,EAIoB,KAAA,CAAM,YAJ1B"}
|
|
@@ -166,6 +166,10 @@ const createVariantsWithTransition = (baseVariants, transition) => {
|
|
|
166
166
|
}
|
|
167
167
|
};
|
|
168
168
|
};
|
|
169
|
+
/**
|
|
170
|
+
* Animated typography helper that reveals text word-by-word or letter-by-letter
|
|
171
|
+
* with configurable motion presets.
|
|
172
|
+
*/
|
|
169
173
|
function TextEffect({ children, per = "word", as = "p", variants, className, preset = "fade", delay = 0, speedReveal = 1, speedSegment = 1, trigger = true, onAnimationComplete, onAnimationStart, segmentWrapperClassName, containerTransition, segmentTransition, style }) {
|
|
170
174
|
const segments = splitText(Array.isArray(children) ? children.join("") : children, per);
|
|
171
175
|
const MotionTag = motion[as];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-effect.js","names":["defaultStaggerTimes: Record<PerType, number>","defaultContainerVariants: Variants","defaultItemVariants: Variants","presetVariants: Record<\n\tPresetType,\n\t{ container: Variants; item: Variants }\n>","AnimationComponent: React.FC<{\n\tsegment: string;\n\tvariants: Variants;\n\tper: \"line\" | \"word\" | \"char\";\n\tsegmentWrapperClassName?: string;\n}>"],"sources":["../../../src/support/components/text-effect.tsx"],"sourcesContent":["\"use client\";\nimport type {\n\tTargetAndTransition,\n\tTransition,\n\tVariant,\n\tVariants,\n} from \"motion/react\";\nimport { AnimatePresence, motion } from \"motion/react\";\nimport React from \"react\";\nimport { cn } from \"../utils\";\n\nexport type PresetType = \"blur\" | \"fade-in-blur\" | \"scale\" | \"fade\" | \"slide\";\n\nexport type PerType = \"word\" | \"char\" | \"line\";\n\nconst SPACE_REGEX = /(\\s+)/;\n\nexport type TextEffectProps = {\n\tchildren: string | string[];\n\tper?: PerType;\n\tas?: keyof React.JSX.IntrinsicElements;\n\tvariants?: {\n\t\tcontainer?: Variants;\n\t\titem?: Variants;\n\t};\n\tclassName?: string;\n\tpreset?: PresetType;\n\tdelay?: number;\n\tspeedReveal?: number;\n\tspeedSegment?: number;\n\ttrigger?: boolean;\n\tonAnimationComplete?: () => void;\n\tonAnimationStart?: () => void;\n\tsegmentWrapperClassName?: string;\n\tcontainerTransition?: Transition;\n\tsegmentTransition?: Transition;\n\tstyle?: React.CSSProperties;\n};\n\nconst defaultStaggerTimes: Record<PerType, number> = {\n\tchar: 0.03,\n\tword: 0.05,\n\tline: 0.1,\n};\n\nconst defaultContainerVariants: Variants = {\n\thidden: { opacity: 0 },\n\tvisible: {\n\t\topacity: 1,\n\t\ttransition: {\n\t\t\tstaggerChildren: 0.05,\n\t\t},\n\t},\n\texit: {\n\t\ttransition: { staggerChildren: 0.05, staggerDirection: -1 },\n\t},\n};\n\nconst defaultItemVariants: Variants = {\n\thidden: { opacity: 0 },\n\tvisible: {\n\t\topacity: 1,\n\t},\n\texit: { opacity: 0 },\n};\n\nconst presetVariants: Record<\n\tPresetType,\n\t{ container: Variants; item: Variants }\n> = {\n\tblur: {\n\t\tcontainer: defaultContainerVariants,\n\t\titem: {\n\t\t\thidden: { opacity: 0, filter: \"blur(12px)\" },\n\t\t\tvisible: { opacity: 1, filter: \"blur(0px)\" },\n\t\t\texit: { opacity: 0, filter: \"blur(12px)\" },\n\t\t},\n\t},\n\t\"fade-in-blur\": {\n\t\tcontainer: defaultContainerVariants,\n\t\titem: {\n\t\t\thidden: { opacity: 0, y: 20, filter: \"blur(12px)\" },\n\t\t\tvisible: { opacity: 1, y: 0, filter: \"blur(0px)\" },\n\t\t\texit: { opacity: 0, y: 20, filter: \"blur(12px)\" },\n\t\t},\n\t},\n\tscale: {\n\t\tcontainer: defaultContainerVariants,\n\t\titem: {\n\t\t\thidden: { opacity: 0, scale: 0 },\n\t\t\tvisible: { opacity: 1, scale: 1 },\n\t\t\texit: { opacity: 0, scale: 0 },\n\t\t},\n\t},\n\tfade: {\n\t\tcontainer: defaultContainerVariants,\n\t\titem: {\n\t\t\thidden: { opacity: 0 },\n\t\t\tvisible: { opacity: 1 },\n\t\t\texit: { opacity: 0 },\n\t\t},\n\t},\n\tslide: {\n\t\tcontainer: defaultContainerVariants,\n\t\titem: {\n\t\t\thidden: { opacity: 0, y: 20 },\n\t\t\tvisible: { opacity: 1, y: 0 },\n\t\t\texit: { opacity: 0, y: 20 },\n\t\t},\n\t},\n};\n\nconst AnimationComponent: React.FC<{\n\tsegment: string;\n\tvariants: Variants;\n\tper: \"line\" | \"word\" | \"char\";\n\tsegmentWrapperClassName?: string;\n}> = React.memo(({ segment, variants, per, segmentWrapperClassName }) => {\n\tconst content =\n\t\tper === \"line\" ? (\n\t\t\t<motion.span className=\"block\" variants={variants}>\n\t\t\t\t{segment}\n\t\t\t</motion.span>\n\t\t) : per === \"word\" ? (\n\t\t\t<motion.span\n\t\t\t\taria-hidden=\"true\"\n\t\t\t\tclassName=\"inline-block whitespace-pre\"\n\t\t\t\tvariants={variants}\n\t\t\t>\n\t\t\t\t{segment}\n\t\t\t</motion.span>\n\t\t) : (\n\t\t\t<motion.span className=\"inline-block whitespace-pre\">\n\t\t\t\t{segment.split(\"\").map((char, charIndex) => (\n\t\t\t\t\t<motion.span\n\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\tclassName=\"inline-block whitespace-pre\"\n\t\t\t\t\t\tkey={`char-${charIndex}`}\n\t\t\t\t\t\tvariants={variants}\n\t\t\t\t\t>\n\t\t\t\t\t\t{char}\n\t\t\t\t\t</motion.span>\n\t\t\t\t))}\n\t\t\t</motion.span>\n\t\t);\n\n\tif (!segmentWrapperClassName) {\n\t\treturn content;\n\t}\n\n\tconst defaultWrapperClassName = per === \"line\" ? \"block\" : \"inline-block\";\n\n\treturn (\n\t\t<span className={cn(defaultWrapperClassName, segmentWrapperClassName)}>\n\t\t\t{content}\n\t\t</span>\n\t);\n});\n\nAnimationComponent.displayName = \"AnimationComponent\";\n\nconst splitText = (text: string, per: PerType) => {\n\tif (per === \"line\") {\n\t\treturn text.split(\"\\n\");\n\t}\n\treturn text.split(SPACE_REGEX);\n};\n\nconst hasTransition = (\n\tvariant?: Variant\n): variant is TargetAndTransition & { transition?: Transition } => {\n\tif (!variant) {\n\t\treturn false;\n\t}\n\treturn typeof variant === \"object\" && \"transition\" in variant;\n};\n\nconst createVariantsWithTransition = (\n\tbaseVariants: Variants,\n\ttransition?: Transition & { exit?: Transition }\n): Variants => {\n\tif (!transition) {\n\t\treturn baseVariants;\n\t}\n\n\tconst { exit: _, ...mainTransition } = transition;\n\n\treturn {\n\t\t...baseVariants,\n\t\tvisible: {\n\t\t\t...baseVariants.visible,\n\t\t\ttransition: {\n\t\t\t\t...(hasTransition(baseVariants.visible)\n\t\t\t\t\t? baseVariants.visible.transition\n\t\t\t\t\t: {}),\n\t\t\t\t...mainTransition,\n\t\t\t},\n\t\t},\n\t\texit: {\n\t\t\t...baseVariants.exit,\n\t\t\ttransition: {\n\t\t\t\t...(hasTransition(baseVariants.exit)\n\t\t\t\t\t? baseVariants.exit.transition\n\t\t\t\t\t: {}),\n\t\t\t\t...mainTransition,\n\t\t\t\tstaggerDirection: -1,\n\t\t\t},\n\t\t},\n\t};\n};\n\nexport function TextEffect({\n\tchildren,\n\tper = \"word\",\n\tas = \"p\",\n\tvariants,\n\tclassName,\n\tpreset = \"fade\",\n\tdelay = 0,\n\tspeedReveal = 1,\n\tspeedSegment = 1,\n\ttrigger = true,\n\tonAnimationComplete,\n\tonAnimationStart,\n\tsegmentWrapperClassName,\n\tcontainerTransition,\n\tsegmentTransition,\n\tstyle,\n}: TextEffectProps) {\n\tconst segments = splitText(\n\t\tArray.isArray(children) ? children.join(\"\") : children,\n\t\tper\n\t);\n\tconst MotionTag = motion[as as keyof typeof motion] as typeof motion.div;\n\n\tconst baseVariants = preset\n\t\t? presetVariants[preset]\n\t\t: { container: defaultContainerVariants, item: defaultItemVariants };\n\n\tconst stagger = defaultStaggerTimes[per] / speedReveal;\n\n\tconst baseDuration = 0.3 / speedSegment;\n\n\tconst customStagger = hasTransition(variants?.container?.visible ?? {})\n\t\t? (variants?.container?.visible as TargetAndTransition).transition\n\t\t\t\t?.staggerChildren\n\t\t: undefined;\n\n\tconst customDelay = hasTransition(variants?.container?.visible ?? {})\n\t\t? (variants?.container?.visible as TargetAndTransition).transition\n\t\t\t\t?.delayChildren\n\t\t: undefined;\n\n\tconst computedVariants = {\n\t\tcontainer: createVariantsWithTransition(\n\t\t\tvariants?.container || baseVariants.container,\n\t\t\t{\n\t\t\t\tstaggerChildren: customStagger ?? stagger,\n\t\t\t\tdelayChildren: customDelay ?? delay,\n\t\t\t\t...containerTransition,\n\t\t\t\texit: {\n\t\t\t\t\tstaggerChildren: customStagger ?? stagger,\n\t\t\t\t\tstaggerDirection: -1,\n\t\t\t\t},\n\t\t\t}\n\t\t),\n\t\titem: createVariantsWithTransition(variants?.item || baseVariants.item, {\n\t\t\tduration: baseDuration,\n\t\t\t...segmentTransition,\n\t\t}),\n\t};\n\n\treturn (\n\t\t<AnimatePresence mode=\"popLayout\">\n\t\t\t{trigger && (\n\t\t\t\t<MotionTag\n\t\t\t\t\tanimate=\"visible\"\n\t\t\t\t\tclassName={className}\n\t\t\t\t\texit=\"exit\"\n\t\t\t\t\tinitial=\"hidden\"\n\t\t\t\t\tonAnimationComplete={onAnimationComplete}\n\t\t\t\t\tonAnimationStart={onAnimationStart}\n\t\t\t\t\tstyle={style}\n\t\t\t\t\tvariants={computedVariants.container}\n\t\t\t\t>\n\t\t\t\t\t{per !== \"line\" ? <span className=\"sr-only\">{children}</span> : null}\n\t\t\t\t\t{segments.map((segment, index) => (\n\t\t\t\t\t\t<AnimationComponent\n\t\t\t\t\t\t\tkey={`${per}-${index}-${segment}`}\n\t\t\t\t\t\t\tper={per}\n\t\t\t\t\t\t\tsegment={segment}\n\t\t\t\t\t\t\tsegmentWrapperClassName={segmentWrapperClassName}\n\t\t\t\t\t\t\tvariants={computedVariants.item}\n\t\t\t\t\t\t/>\n\t\t\t\t\t))}\n\t\t\t\t</MotionTag>\n\t\t\t)}\n\t\t</AnimatePresence>\n\t);\n}\n"],"mappings":";;;;;;;;;AAeA,MAAM,cAAc;AAwBpB,MAAMA,sBAA+C;CACpD,MAAM;CACN,MAAM;CACN,MAAM;CACN;AAED,MAAMC,2BAAqC;CAC1C,QAAQ,EAAE,SAAS,GAAG;CACtB,SAAS;EACR,SAAS;EACT,YAAY,EACX,iBAAiB,KACjB;EACD;CACD,MAAM,EACL,YAAY;EAAE,iBAAiB;EAAM,kBAAkB;EAAI,EAC3D;CACD;AAED,MAAMC,sBAAgC;CACrC,QAAQ,EAAE,SAAS,GAAG;CACtB,SAAS,EACR,SAAS,GACT;CACD,MAAM,EAAE,SAAS,GAAG;CACpB;AAED,MAAMC,iBAGF;CACH,MAAM;EACL,WAAW;EACX,MAAM;GACL,QAAQ;IAAE,SAAS;IAAG,QAAQ;IAAc;GAC5C,SAAS;IAAE,SAAS;IAAG,QAAQ;IAAa;GAC5C,MAAM;IAAE,SAAS;IAAG,QAAQ;IAAc;GAC1C;EACD;CACD,gBAAgB;EACf,WAAW;EACX,MAAM;GACL,QAAQ;IAAE,SAAS;IAAG,GAAG;IAAI,QAAQ;IAAc;GACnD,SAAS;IAAE,SAAS;IAAG,GAAG;IAAG,QAAQ;IAAa;GAClD,MAAM;IAAE,SAAS;IAAG,GAAG;IAAI,QAAQ;IAAc;GACjD;EACD;CACD,OAAO;EACN,WAAW;EACX,MAAM;GACL,QA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a;GACH;GACX;GACP,UAAU,iBAAiB;cAE1B,QAAQ,SAAS,oBAAC;IAAK,WAAU;IAAW;KAAgB,GAAG,MAC/D,SAAS,KAAK,SAAS,UACvB,oBAAC;IAEK;IACI;IACgB;IACzB,UAAU,iBAAiB;MAJtB,GAAG,IAAI,GAAG,MAAM,GAAG,UAKvB,CACD;IACS;GAEI"}
|
|
1
|
+
{"version":3,"file":"text-effect.js","names":["defaultStaggerTimes: Record<PerType, number>","defaultContainerVariants: Variants","defaultItemVariants: Variants","presetVariants: Record<\n\tPresetType,\n\t{ container: Variants; item: Variants }\n>","AnimationComponent: React.FC<{\n\tsegment: string;\n\tvariants: Variants;\n\tper: \"line\" | \"word\" | \"char\";\n\tsegmentWrapperClassName?: string;\n}>"],"sources":["../../../src/support/components/text-effect.tsx"],"sourcesContent":["\"use client\";\nimport type {\n\tTargetAndTransition,\n\tTransition,\n\tVariant,\n\tVariants,\n} from \"motion/react\";\nimport { AnimatePresence, motion } from \"motion/react\";\nimport React from \"react\";\nimport { cn } from \"../utils\";\n\nexport type PresetType = \"blur\" | \"fade-in-blur\" | \"scale\" | \"fade\" | \"slide\";\n\nexport type PerType = \"word\" | \"char\" | \"line\";\n\nconst SPACE_REGEX = /(\\s+)/;\n\nexport type TextEffectProps = {\n\tchildren: string | string[];\n\tper?: PerType;\n\tas?: keyof React.JSX.IntrinsicElements;\n\tvariants?: {\n\t\tcontainer?: Variants;\n\t\titem?: Variants;\n\t};\n\tclassName?: string;\n\tpreset?: PresetType;\n\tdelay?: number;\n\tspeedReveal?: number;\n\tspeedSegment?: number;\n\ttrigger?: boolean;\n\tonAnimationComplete?: () => void;\n\tonAnimationStart?: () => void;\n\tsegmentWrapperClassName?: string;\n\tcontainerTransition?: Transition;\n\tsegmentTransition?: Transition;\n\tstyle?: React.CSSProperties;\n};\n\nconst defaultStaggerTimes: Record<PerType, number> = {\n\tchar: 0.03,\n\tword: 0.05,\n\tline: 0.1,\n};\n\nconst defaultContainerVariants: Variants = {\n\thidden: { opacity: 0 },\n\tvisible: {\n\t\topacity: 1,\n\t\ttransition: {\n\t\t\tstaggerChildren: 0.05,\n\t\t},\n\t},\n\texit: {\n\t\ttransition: { staggerChildren: 0.05, staggerDirection: -1 },\n\t},\n};\n\nconst defaultItemVariants: Variants = {\n\thidden: { opacity: 0 },\n\tvisible: {\n\t\topacity: 1,\n\t},\n\texit: { opacity: 0 },\n};\n\nconst presetVariants: Record<\n\tPresetType,\n\t{ container: Variants; item: Variants }\n> = {\n\tblur: {\n\t\tcontainer: defaultContainerVariants,\n\t\titem: {\n\t\t\thidden: { opacity: 0, filter: \"blur(12px)\" },\n\t\t\tvisible: { opacity: 1, filter: \"blur(0px)\" },\n\t\t\texit: { opacity: 0, filter: \"blur(12px)\" },\n\t\t},\n\t},\n\t\"fade-in-blur\": {\n\t\tcontainer: defaultContainerVariants,\n\t\titem: {\n\t\t\thidden: { opacity: 0, y: 20, filter: \"blur(12px)\" },\n\t\t\tvisible: { opacity: 1, y: 0, filter: \"blur(0px)\" },\n\t\t\texit: { opacity: 0, y: 20, filter: \"blur(12px)\" },\n\t\t},\n\t},\n\tscale: {\n\t\tcontainer: defaultContainerVariants,\n\t\titem: {\n\t\t\thidden: { opacity: 0, scale: 0 },\n\t\t\tvisible: { opacity: 1, scale: 1 },\n\t\t\texit: { opacity: 0, scale: 0 },\n\t\t},\n\t},\n\tfade: {\n\t\tcontainer: defaultContainerVariants,\n\t\titem: {\n\t\t\thidden: { opacity: 0 },\n\t\t\tvisible: { opacity: 1 },\n\t\t\texit: { opacity: 0 },\n\t\t},\n\t},\n\tslide: {\n\t\tcontainer: defaultContainerVariants,\n\t\titem: {\n\t\t\thidden: { opacity: 0, y: 20 },\n\t\t\tvisible: { opacity: 1, y: 0 },\n\t\t\texit: { opacity: 0, y: 20 },\n\t\t},\n\t},\n};\n\nconst AnimationComponent: React.FC<{\n\tsegment: string;\n\tvariants: Variants;\n\tper: \"line\" | \"word\" | \"char\";\n\tsegmentWrapperClassName?: string;\n}> = React.memo(({ segment, variants, per, segmentWrapperClassName }) => {\n\tconst content =\n\t\tper === \"line\" ? (\n\t\t\t<motion.span className=\"block\" variants={variants}>\n\t\t\t\t{segment}\n\t\t\t</motion.span>\n\t\t) : per === \"word\" ? (\n\t\t\t<motion.span\n\t\t\t\taria-hidden=\"true\"\n\t\t\t\tclassName=\"inline-block whitespace-pre\"\n\t\t\t\tvariants={variants}\n\t\t\t>\n\t\t\t\t{segment}\n\t\t\t</motion.span>\n\t\t) : (\n\t\t\t<motion.span className=\"inline-block whitespace-pre\">\n\t\t\t\t{segment.split(\"\").map((char, charIndex) => (\n\t\t\t\t\t<motion.span\n\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\tclassName=\"inline-block whitespace-pre\"\n\t\t\t\t\t\tkey={`char-${charIndex}`}\n\t\t\t\t\t\tvariants={variants}\n\t\t\t\t\t>\n\t\t\t\t\t\t{char}\n\t\t\t\t\t</motion.span>\n\t\t\t\t))}\n\t\t\t</motion.span>\n\t\t);\n\n\tif (!segmentWrapperClassName) {\n\t\treturn content;\n\t}\n\n\tconst defaultWrapperClassName = per === \"line\" ? \"block\" : \"inline-block\";\n\n\treturn (\n\t\t<span className={cn(defaultWrapperClassName, segmentWrapperClassName)}>\n\t\t\t{content}\n\t\t</span>\n\t);\n});\n\nAnimationComponent.displayName = \"AnimationComponent\";\n\nconst splitText = (text: string, per: PerType) => {\n\tif (per === \"line\") {\n\t\treturn text.split(\"\\n\");\n\t}\n\treturn text.split(SPACE_REGEX);\n};\n\nconst hasTransition = (\n\tvariant?: Variant\n): variant is TargetAndTransition & { transition?: Transition } => {\n\tif (!variant) {\n\t\treturn false;\n\t}\n\treturn typeof variant === \"object\" && \"transition\" in variant;\n};\n\nconst createVariantsWithTransition = (\n\tbaseVariants: Variants,\n\ttransition?: Transition & { exit?: Transition }\n): Variants => {\n\tif (!transition) {\n\t\treturn baseVariants;\n\t}\n\n\tconst { exit: _, ...mainTransition } = transition;\n\n\treturn {\n\t\t...baseVariants,\n\t\tvisible: {\n\t\t\t...baseVariants.visible,\n\t\t\ttransition: {\n\t\t\t\t...(hasTransition(baseVariants.visible)\n\t\t\t\t\t? baseVariants.visible.transition\n\t\t\t\t\t: {}),\n\t\t\t\t...mainTransition,\n\t\t\t},\n\t\t},\n\t\texit: {\n\t\t\t...baseVariants.exit,\n\t\t\ttransition: {\n\t\t\t\t...(hasTransition(baseVariants.exit)\n\t\t\t\t\t? baseVariants.exit.transition\n\t\t\t\t\t: {}),\n\t\t\t\t...mainTransition,\n\t\t\t\tstaggerDirection: -1,\n\t\t\t},\n\t\t},\n\t};\n};\n\n/**\n * Animated typography helper that reveals text word-by-word or letter-by-letter\n * with configurable motion presets.\n */\nexport function TextEffect({\n\tchildren,\n\tper = \"word\",\n\tas = \"p\",\n\tvariants,\n\tclassName,\n\tpreset = \"fade\",\n\tdelay = 0,\n\tspeedReveal = 1,\n\tspeedSegment = 1,\n\ttrigger = true,\n\tonAnimationComplete,\n\tonAnimationStart,\n\tsegmentWrapperClassName,\n\tcontainerTransition,\n\tsegmentTransition,\n\tstyle,\n}: TextEffectProps): React.ReactElement {\n\tconst segments = splitText(\n\t\tArray.isArray(children) ? children.join(\"\") : children,\n\t\tper\n\t);\n\tconst MotionTag = motion[as as keyof typeof motion] as typeof motion.div;\n\n\tconst baseVariants = preset\n\t\t? presetVariants[preset]\n\t\t: { container: defaultContainerVariants, item: defaultItemVariants };\n\n\tconst stagger = defaultStaggerTimes[per] / speedReveal;\n\n\tconst baseDuration = 0.3 / speedSegment;\n\n\tconst customStagger = hasTransition(variants?.container?.visible ?? {})\n\t\t? (variants?.container?.visible as TargetAndTransition).transition\n\t\t\t\t?.staggerChildren\n\t\t: undefined;\n\n\tconst customDelay = hasTransition(variants?.container?.visible ?? {})\n\t\t? (variants?.container?.visible as TargetAndTransition).transition\n\t\t\t\t?.delayChildren\n\t\t: undefined;\n\n\tconst computedVariants = {\n\t\tcontainer: createVariantsWithTransition(\n\t\t\tvariants?.container || baseVariants.container,\n\t\t\t{\n\t\t\t\tstaggerChildren: customStagger ?? stagger,\n\t\t\t\tdelayChildren: customDelay ?? delay,\n\t\t\t\t...containerTransition,\n\t\t\t\texit: {\n\t\t\t\t\tstaggerChildren: customStagger ?? stagger,\n\t\t\t\t\tstaggerDirection: -1,\n\t\t\t\t},\n\t\t\t}\n\t\t),\n\t\titem: createVariantsWithTransition(variants?.item || baseVariants.item, {\n\t\t\tduration: baseDuration,\n\t\t\t...segmentTransition,\n\t\t}),\n\t};\n\n\treturn (\n\t\t<AnimatePresence mode=\"popLayout\">\n\t\t\t{trigger && (\n\t\t\t\t<MotionTag\n\t\t\t\t\tanimate=\"visible\"\n\t\t\t\t\tclassName={className}\n\t\t\t\t\texit=\"exit\"\n\t\t\t\t\tinitial=\"hidden\"\n\t\t\t\t\tonAnimationComplete={onAnimationComplete}\n\t\t\t\t\tonAnimationStart={onAnimationStart}\n\t\t\t\t\tstyle={style}\n\t\t\t\t\tvariants={computedVariants.container}\n\t\t\t\t>\n\t\t\t\t\t{per !== \"line\" ? <span className=\"sr-only\">{children}</span> : null}\n\t\t\t\t\t{segments.map((segment, index) => (\n\t\t\t\t\t\t<AnimationComponent\n\t\t\t\t\t\t\tkey={`${per}-${index}-${segment}`}\n\t\t\t\t\t\t\tper={per}\n\t\t\t\t\t\t\tsegment={segment}\n\t\t\t\t\t\t\tsegmentWrapperClassName={segmentWrapperClassName}\n\t\t\t\t\t\t\tvariants={computedVariants.item}\n\t\t\t\t\t\t/>\n\t\t\t\t\t))}\n\t\t\t\t</MotionTag>\n\t\t\t)}\n\t\t</AnimatePresence>\n\t);\n}\n"],"mappings":";;;;;;;;;AAeA,MAAM,cAAc;AAwBpB,MAAMA,sBAA+C;CACpD,MAAM;CACN,MAAM;CACN,MAAM;CACN;AAED,MAAMC,2BAAqC;CAC1C,QAAQ,EAAE,SAAS,GAAG;CACtB,SAAS;EACR,SAAS;EACT,YAAY,EACX,iBAAiB,KACjB;EACD;CACD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ACf;EAAE,WAAW;EAA0B,MAAM;EAAqB;CAErE,MAAM,UAAU,oBAAoB,OAAO;CAE3C,MAAM,eAAe,KAAM;CAE3B,MAAM,gBAAgB,cAAc,UAAU,WAAW,WAAW,EAAE,CAAC,IACnE,UAAU,WAAW,SAAgC,YACpD,kBACF;CAEH,MAAM,cAAc,cAAc,UAAU,WAAW,WAAW,EAAE,CAAC,IACjE,UAAU,WAAW,SAAgC,YACpD,gBACF;CAEH,MAAM,mBAAmB;EACxB,WAAW,6BACV,UAAU,aAAa,aAAa,WACpC;GACC,iBAAiB,iBAAiB;GAClC,eAAe,eAAe;GAC9B,GAAG;GACH,MAAM;IACL,iBAAiB,iBAAiB;IAClC,kBAAkB;IAClB;GACD,CACD;EACD,MAAM,6BAA6B,UAAU,QAAQ,aAAa,MAAM;GACvE,UAAU;GACV,GAAG;GACH,CAAC;EACF;AAED,QACC,oBAAC;EAAgB,MAAK;YACpB,WACA,qBAAC;GACA,SAAQ;GACG;GACX,MAAK;GACL,SAAQ;GACa;GACH;GACX;GACP,UAAU,iBAAiB;cAE1B,QAAQ,SAAS,oBAAC;IAAK,WAAU;IAAW;KAAgB,GAAG,MAC/D,SAAS,KAAK,SAAS,UACvB,oBAAC;IAEK;IACI;IACgB;IACzB,UAAU,iBAAiB;MAJtB,GAAG,IAAI,GAAG,MAAM,GAAG,UAKvB,CACD;IACS;GAEI"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ConversationTimelineToolProps } from "./conversation-timeline.js";
|
|
2
|
+
|
|
3
|
+
//#region src/support/components/timeline-identification-tool.d.ts
|
|
4
|
+
declare const IdentificationTimelineTool: React.FC<ConversationTimelineToolProps>;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { IdentificationTimelineTool };
|
|
7
|
+
//# sourceMappingURL=timeline-identification-tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timeline-identification-tool.d.ts","names":[],"sources":["../../../src/support/components/timeline-identification-tool.tsx"],"sourcesContent":[],"mappings":";;;cAca,4BAA4B,KAAA,CAAM,GAC9C"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { Button } from "./button.js";
|
|
2
|
+
import { useSupportText } from "../text/index.js";
|
|
3
|
+
import { useVisitor } from "../../hooks/use-visitor.js";
|
|
4
|
+
import { useSupport } from "../../provider.js";
|
|
5
|
+
import { useCallback, useMemo, useState } from "react";
|
|
6
|
+
import { ConversationEventType, ConversationTimelineType, TimelineItemVisibility } from "@cossistant/types/enums";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
|
|
9
|
+
//#region src/support/components/timeline-identification-tool.tsx
|
|
10
|
+
const IdentificationTimelineTool = ({ conversationId }) => {
|
|
11
|
+
const text = useSupportText();
|
|
12
|
+
const { identify, visitor } = useVisitor();
|
|
13
|
+
const { client } = useSupport();
|
|
14
|
+
const [email, setEmail] = useState("");
|
|
15
|
+
const [status, setStatus] = useState("idle");
|
|
16
|
+
const [errorMessage, setErrorMessage] = useState(null);
|
|
17
|
+
const isAlreadyIdentified = Boolean(visitor?.contact);
|
|
18
|
+
const hasSucceeded = status === "success" || isAlreadyIdentified;
|
|
19
|
+
const ctaLabel = text("component.identificationTool.cta");
|
|
20
|
+
const successLabel = text("component.identificationTool.success");
|
|
21
|
+
const description = text("component.identificationTool.description");
|
|
22
|
+
const title = text("component.identificationTool.title");
|
|
23
|
+
const submitDisabled = hasSucceeded || status === "submitting";
|
|
24
|
+
const handleSubmit = useCallback(async (event) => {
|
|
25
|
+
event.preventDefault();
|
|
26
|
+
if (submitDisabled) return;
|
|
27
|
+
const trimmedEmail = email.trim();
|
|
28
|
+
if (!trimmedEmail) {
|
|
29
|
+
setErrorMessage(text("component.identificationTool.validation"));
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
setStatus("submitting");
|
|
33
|
+
setErrorMessage(null);
|
|
34
|
+
try {
|
|
35
|
+
const identifyResult = await identify({ email: trimmedEmail });
|
|
36
|
+
if (!identifyResult) {
|
|
37
|
+
setStatus("error");
|
|
38
|
+
setErrorMessage(text("component.identificationTool.error"));
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const payload = {
|
|
42
|
+
conversationId,
|
|
43
|
+
item: {
|
|
44
|
+
type: ConversationTimelineType.EVENT,
|
|
45
|
+
text: text("component.identificationTool.eventLog"),
|
|
46
|
+
tool: null,
|
|
47
|
+
parts: [{
|
|
48
|
+
type: "event",
|
|
49
|
+
eventType: ConversationEventType.VISITOR_IDENTIFIED,
|
|
50
|
+
actorUserId: null,
|
|
51
|
+
actorAiAgentId: null,
|
|
52
|
+
targetUserId: null,
|
|
53
|
+
targetAiAgentId: null,
|
|
54
|
+
message: text("component.identificationTool.eventLog")
|
|
55
|
+
}],
|
|
56
|
+
visitorId: identifyResult.visitorId,
|
|
57
|
+
visibility: TimelineItemVisibility.PUBLIC
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
await client.sendMessage(payload);
|
|
61
|
+
setStatus("success");
|
|
62
|
+
setEmail("");
|
|
63
|
+
client.fetchWebsite({ force: true }).catch(() => {});
|
|
64
|
+
} catch {
|
|
65
|
+
setStatus("error");
|
|
66
|
+
setErrorMessage(text("component.identificationTool.error"));
|
|
67
|
+
}
|
|
68
|
+
}, [
|
|
69
|
+
conversationId,
|
|
70
|
+
email,
|
|
71
|
+
identify,
|
|
72
|
+
client,
|
|
73
|
+
submitDisabled,
|
|
74
|
+
text
|
|
75
|
+
]);
|
|
76
|
+
const helperMessage = useMemo(() => {
|
|
77
|
+
if (errorMessage) return /* @__PURE__ */ jsx("p", {
|
|
78
|
+
className: "text-destructive text-xs",
|
|
79
|
+
role: "alert",
|
|
80
|
+
children: errorMessage
|
|
81
|
+
});
|
|
82
|
+
if (hasSucceeded) return /* @__PURE__ */ jsx("p", {
|
|
83
|
+
className: "text-primary text-xs",
|
|
84
|
+
children: successLabel
|
|
85
|
+
});
|
|
86
|
+
return null;
|
|
87
|
+
}, [
|
|
88
|
+
errorMessage,
|
|
89
|
+
hasSucceeded,
|
|
90
|
+
successLabel
|
|
91
|
+
]);
|
|
92
|
+
return /* @__PURE__ */ jsx("div", {
|
|
93
|
+
className: "rounded border border-co-border/60 bg-co-background-100 p-4 shadow-sm",
|
|
94
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
95
|
+
className: "flex flex-col gap-3",
|
|
96
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
97
|
+
className: "flex flex-col gap-1",
|
|
98
|
+
children: [/* @__PURE__ */ jsx("h3", {
|
|
99
|
+
className: "font-semibold text-sm",
|
|
100
|
+
children: title
|
|
101
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
102
|
+
className: "text-muted-foreground text-xs",
|
|
103
|
+
children: description
|
|
104
|
+
})]
|
|
105
|
+
}), hasSucceeded ? /* @__PURE__ */ jsx("div", {
|
|
106
|
+
className: "rounded-md bg-co-primary/10 px-3 py-2 text-primary text-sm",
|
|
107
|
+
children: successLabel
|
|
108
|
+
}) : /* @__PURE__ */ jsxs("form", {
|
|
109
|
+
className: "flex gap-2",
|
|
110
|
+
onSubmit: handleSubmit,
|
|
111
|
+
children: [
|
|
112
|
+
/* @__PURE__ */ jsx("input", {
|
|
113
|
+
"aria-label": text("component.identificationTool.inputLabel"),
|
|
114
|
+
autoComplete: "email",
|
|
115
|
+
className: "h-10 w-full rounded border border-co-border/60 bg-transparent px-3 py-2 text-sm outline-none focus:border-co-primary focus:ring-2 focus:ring-co-primary/20",
|
|
116
|
+
disabled: submitDisabled,
|
|
117
|
+
inputMode: "email",
|
|
118
|
+
onChange: (event) => setEmail(event.target.value),
|
|
119
|
+
placeholder: text("component.identificationTool.inputPlaceholder"),
|
|
120
|
+
type: "email",
|
|
121
|
+
value: email
|
|
122
|
+
}),
|
|
123
|
+
helperMessage,
|
|
124
|
+
/* @__PURE__ */ jsx(Button, {
|
|
125
|
+
className: "h-10",
|
|
126
|
+
disabled: submitDisabled,
|
|
127
|
+
type: "submit",
|
|
128
|
+
children: status === "submitting" ? text("component.identificationTool.loading") : ctaLabel
|
|
129
|
+
})
|
|
130
|
+
]
|
|
131
|
+
})]
|
|
132
|
+
})
|
|
133
|
+
});
|
|
134
|
+
};
|
|
135
|
+
IdentificationTimelineTool.displayName = "IdentificationTimelineTool";
|
|
136
|
+
|
|
137
|
+
//#endregion
|
|
138
|
+
export { IdentificationTimelineTool };
|
|
139
|
+
//# sourceMappingURL=timeline-identification-tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timeline-identification-tool.js","names":["IdentificationTimelineTool: React.FC<\n\tConversationTimelineToolProps\n>","payload: SendTimelineItemRequest"],"sources":["../../../src/support/components/timeline-identification-tool.tsx"],"sourcesContent":["import type { SendTimelineItemRequest } from \"@cossistant/types/api/timeline-item\";\nimport {\n\tConversationEventType,\n\tConversationTimelineType,\n\tTimelineItemVisibility,\n} from \"@cossistant/types/enums\";\nimport { type FormEventHandler, useCallback, useMemo, useState } from \"react\";\n\nimport { useVisitor } from \"../../hooks/use-visitor\";\nimport { useSupport } from \"../../provider\";\nimport { useSupportText } from \"../text\";\nimport { Button } from \"./button\";\nimport type { ConversationTimelineToolProps } from \"./conversation-timeline\";\n\nexport const IdentificationTimelineTool: React.FC<\n\tConversationTimelineToolProps\n> = ({ conversationId }) => {\n\tconst text = useSupportText();\n\tconst { identify, visitor } = useVisitor();\n\tconst { client } = useSupport();\n\tconst [email, setEmail] = useState(\"\");\n\tconst [status, setStatus] = useState<\n\t\t\"idle\" | \"submitting\" | \"success\" | \"error\"\n\t>(\"idle\");\n\tconst [errorMessage, setErrorMessage] = useState<string | null>(null);\n\n\tconst isAlreadyIdentified = Boolean(visitor?.contact);\n\tconst hasSucceeded = status === \"success\" || isAlreadyIdentified;\n\n\tconst ctaLabel = text(\"component.identificationTool.cta\");\n\tconst successLabel = text(\"component.identificationTool.success\");\n\tconst description = text(\"component.identificationTool.description\");\n\tconst title = text(\"component.identificationTool.title\");\n\n\tconst submitDisabled = hasSucceeded || status === \"submitting\";\n\n\tconst handleSubmit = useCallback<FormEventHandler<HTMLFormElement>>(\n\t\tasync (event) => {\n\t\t\tevent.preventDefault();\n\n\t\t\tif (submitDisabled) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst trimmedEmail = email.trim();\n\t\t\tif (!trimmedEmail) {\n\t\t\t\tsetErrorMessage(text(\"component.identificationTool.validation\"));\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tsetStatus(\"submitting\");\n\t\t\tsetErrorMessage(null);\n\n\t\t\ttry {\n\t\t\t\tconst identifyResult = await identify({ email: trimmedEmail });\n\n\t\t\t\tif (!identifyResult) {\n\t\t\t\t\tsetStatus(\"error\");\n\t\t\t\t\tsetErrorMessage(text(\"component.identificationTool.error\"));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst payload: SendTimelineItemRequest = {\n\t\t\t\t\tconversationId,\n\t\t\t\t\titem: {\n\t\t\t\t\t\ttype: ConversationTimelineType.EVENT,\n\t\t\t\t\t\ttext: text(\"component.identificationTool.eventLog\"),\n\t\t\t\t\t\ttool: null,\n\t\t\t\t\t\tparts: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: \"event\" as const,\n\t\t\t\t\t\t\t\teventType: ConversationEventType.VISITOR_IDENTIFIED,\n\t\t\t\t\t\t\t\tactorUserId: null,\n\t\t\t\t\t\t\t\tactorAiAgentId: null,\n\t\t\t\t\t\t\t\ttargetUserId: null,\n\t\t\t\t\t\t\t\ttargetAiAgentId: null,\n\t\t\t\t\t\t\t\tmessage: text(\"component.identificationTool.eventLog\"),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t\tvisitorId: identifyResult.visitorId,\n\t\t\t\t\t\tvisibility: TimelineItemVisibility.PUBLIC,\n\t\t\t\t\t},\n\t\t\t\t};\n\n\t\t\t\tawait client.sendMessage(payload);\n\n\t\t\t\tsetStatus(\"success\");\n\t\t\t\tsetEmail(\"\");\n\n\t\t\t\tvoid client.fetchWebsite({ force: true }).catch(() => {});\n\t\t\t} catch {\n\t\t\t\tsetStatus(\"error\");\n\t\t\t\tsetErrorMessage(text(\"component.identificationTool.error\"));\n\t\t\t}\n\t\t},\n\t\t[conversationId, email, identify, client, submitDisabled, text]\n\t);\n\n\tconst helperMessage = useMemo(() => {\n\t\tif (errorMessage) {\n\t\t\treturn (\n\t\t\t\t<p className=\"text-destructive text-xs\" role=\"alert\">\n\t\t\t\t\t{errorMessage}\n\t\t\t\t</p>\n\t\t\t);\n\t\t}\n\n\t\tif (hasSucceeded) {\n\t\t\treturn <p className=\"text-primary text-xs\">{successLabel}</p>;\n\t\t}\n\n\t\treturn null;\n\t}, [errorMessage, hasSucceeded, successLabel]);\n\n\treturn (\n\t\t<div className=\"rounded border border-co-border/60 bg-co-background-100 p-4 shadow-sm\">\n\t\t\t<div className=\"flex flex-col gap-3\">\n\t\t\t\t<div className=\"flex flex-col gap-1\">\n\t\t\t\t\t<h3 className=\"font-semibold text-sm\">{title}</h3>\n\t\t\t\t\t<p className=\"text-muted-foreground text-xs\">{description}</p>\n\t\t\t\t</div>\n\t\t\t\t{hasSucceeded ? (\n\t\t\t\t\t<div className=\"rounded-md bg-co-primary/10 px-3 py-2 text-primary text-sm\">\n\t\t\t\t\t\t{successLabel}\n\t\t\t\t\t</div>\n\t\t\t\t) : (\n\t\t\t\t\t<form className=\"flex gap-2\" onSubmit={handleSubmit}>\n\t\t\t\t\t\t<input\n\t\t\t\t\t\t\taria-label={text(\"component.identificationTool.inputLabel\")}\n\t\t\t\t\t\t\tautoComplete=\"email\"\n\t\t\t\t\t\t\tclassName=\"h-10 w-full rounded border border-co-border/60 bg-transparent px-3 py-2 text-sm outline-none focus:border-co-primary focus:ring-2 focus:ring-co-primary/20\"\n\t\t\t\t\t\t\tdisabled={submitDisabled}\n\t\t\t\t\t\t\tinputMode=\"email\"\n\t\t\t\t\t\t\tonChange={(event) => setEmail(event.target.value)}\n\t\t\t\t\t\t\tplaceholder={text(\n\t\t\t\t\t\t\t\t\"component.identificationTool.inputPlaceholder\"\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\ttype=\"email\"\n\t\t\t\t\t\t\tvalue={email}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{helperMessage}\n\t\t\t\t\t\t<Button className=\"h-10\" disabled={submitDisabled} type=\"submit\">\n\t\t\t\t\t\t\t{status === \"submitting\"\n\t\t\t\t\t\t\t\t? text(\"component.identificationTool.loading\")\n\t\t\t\t\t\t\t\t: ctaLabel}\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</form>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n\nIdentificationTimelineTool.displayName = \"IdentificationTimelineTool\";\n"],"mappings":";;;;;;;;;AAcA,MAAaA,8BAER,EAAE,qBAAqB;CAC3B,MAAM,OAAO,gBAAgB;CAC7B,MAAM,EAAE,UAAU,YAAY,YAAY;CAC1C,MAAM,EAAE,WAAW,YAAY;CAC/B,MAAM,CAAC,OAAO,YAAY,SAAS,GAAG;CACtC,MAAM,CAAC,QAAQ,aAAa,SAE1B,OAAO;CACT,MAAM,CAAC,cAAc,mBAAmB,SAAwB,KAAK;CAErE,MAAM,sBAAsB,QAAQ,SAAS,QAAQ;CACrD,MAAM,eAAe,WAAW,aAAa;CAE7C,MAAM,WAAW,KAAK,mCAAmC;CACzD,MAAM,eAAe,KAAK,uCAAuC;CACjE,MAAM,cAAc,KAAK,2CAA2C;CACpE,MAAM,QAAQ,KAAK,qCAAqC;CAExD,MAAM,iBAAiB,gBAAgB,WAAW;CAElD,MAAM,eAAe,YACpB,OAAO,UAAU;AAChB,QAAM,gBAAgB;AAEtB,MAAI,eACH;EAGD,MAAM,eAAe,MAAM,MAAM;AACjC,MAAI,CAAC,cAAc;AAClB,mBAAgB,KAAK,0CAA0C,CAAC;AAChE;;AAGD,YAAU,aAAa;AACvB,kBAAgB,KAAK;AAErB,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M,OAAO,MAAM;MACjD,aAAa,KACZ,gDACA;MACD,MAAK;MACL,OAAO;OACN;KACD;KACD,oBAAC;MAAO,WAAU;MAAO,UAAU;MAAgB,MAAK;gBACtD,WAAW,eACT,KAAK,uCAAuC,GAC5C;OACK;;KACH;IAEH;GACD;;AAIR,2BAA2B,cAAc"}
|
|
@@ -8,7 +8,8 @@ type TimelineMessageGroupProps = {
|
|
|
8
8
|
availableAIAgents: AvailableAIAgent[];
|
|
9
9
|
availableHumanAgents: AvailableHumanAgent[];
|
|
10
10
|
currentVisitorId?: string;
|
|
11
|
-
seenByIds?: string[];
|
|
11
|
+
seenByIds?: readonly string[];
|
|
12
|
+
seenByNames?: readonly string[];
|
|
12
13
|
};
|
|
13
14
|
declare const TimelineMessageGroup: React.FC<TimelineMessageGroupProps>;
|
|
14
15
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timeline-message-group.d.ts","names":[],"sources":["../../../src/support/components/timeline-message-group.tsx"],"sourcesContent":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"timeline-message-group.d.ts","names":[],"sources":["../../../src/support/components/timeline-message-group.tsx"],"sourcesContent":[],"mappings":";;;;;KAoCY,yBAAA;SACJ;EADI,iBAAA,EAEQ,gBAFiB,EAAA;EAC7B,oBAAA,EAEe,mBAFf,EAAA;EACY,gBAAA,CAAA,EAAA,MAAA;EACG,SAAA,CAAA,EAAA,SAAA,MAAA,EAAA;EAAmB,WAAA,CAAA,EAAA,SAAA,MAAA,EAAA;AAS1C,CAAA;cAAa,sBAAsB,KAAA,CAAM,GAAG"}
|
|
@@ -3,7 +3,6 @@ import { Avatar } from "./avatar.js";
|
|
|
3
3
|
import { CossistantLogo } from "./cossistant-branding.js";
|
|
4
4
|
import { TimelineItemGroup, TimelineItemGroupAvatar, TimelineItemGroupContent, TimelineItemGroupHeader, TimelineItemGroupSeenIndicator } from "../../primitives/timeline-item-group.js";
|
|
5
5
|
import { TimelineMessageItem } from "./timeline-message-item.js";
|
|
6
|
-
import { useMemo } from "react";
|
|
7
6
|
import { SenderType } from "@cossistant/types";
|
|
8
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
8
|
import { motion } from "motion/react";
|
|
@@ -37,27 +36,12 @@ const SEEN_ANIMATION = {
|
|
|
37
36
|
ease: "easeOut"
|
|
38
37
|
}
|
|
39
38
|
};
|
|
40
|
-
const
|
|
39
|
+
const EMPTY_SEEN_BY_IDS = Object.freeze([]);
|
|
40
|
+
const EMPTY_SEEN_BY_NAMES = Object.freeze([]);
|
|
41
|
+
const TimelineMessageGroup = ({ items, availableAIAgents, availableHumanAgents, currentVisitorId, seenByIds = EMPTY_SEEN_BY_IDS, seenByNames = EMPTY_SEEN_BY_NAMES }) => {
|
|
41
42
|
const firstItem = items[0];
|
|
42
43
|
const humanAgent = availableHumanAgents.find((agent) => agent.id === firstItem?.userId);
|
|
43
44
|
const aiAgent = availableAIAgents.find((agent) => agent.id === firstItem?.aiAgentId);
|
|
44
|
-
const seenByNames = useMemo(() => {
|
|
45
|
-
const deduped = /* @__PURE__ */ new Set();
|
|
46
|
-
for (const id of seenByIds) {
|
|
47
|
-
const human = availableHumanAgents.find((agent) => agent.id === id);
|
|
48
|
-
if (human?.name) {
|
|
49
|
-
deduped.add(human.name);
|
|
50
|
-
continue;
|
|
51
|
-
}
|
|
52
|
-
const ai = availableAIAgents.find((agent) => agent.id === id);
|
|
53
|
-
if (ai?.name) deduped.add(ai.name);
|
|
54
|
-
}
|
|
55
|
-
return Array.from(deduped);
|
|
56
|
-
}, [
|
|
57
|
-
seenByIds,
|
|
58
|
-
availableHumanAgents,
|
|
59
|
-
availableAIAgents
|
|
60
|
-
]);
|
|
61
45
|
if (items.length === 0) return null;
|
|
62
46
|
const hasSeenIndicator = seenByIds.length > 0 && seenByNames.length > 0;
|
|
63
47
|
return /* @__PURE__ */ jsx(TimelineItemGroup, {
|
|
@@ -111,6 +95,7 @@ const TimelineMessageGroup = ({ items, availableAIAgents, availableHumanAgents,
|
|
|
111
95
|
})
|
|
112
96
|
});
|
|
113
97
|
};
|
|
98
|
+
TimelineMessageGroup.displayName = "TimelineMessageGroup";
|
|
114
99
|
|
|
115
100
|
//#endregion
|
|
116
101
|
export { TimelineMessageGroup };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timeline-message-group.js","names":["TimelineMessageGroup: React.FC<TimelineMessageGroupProps>","PrimitiveTimelineItemGroup"],"sources":["../../../src/support/components/timeline-message-group.tsx"],"sourcesContent":["import type { AvailableAIAgent, AvailableHumanAgent } from \"@cossistant/types\";\nimport { SenderType } from \"@cossistant/types\";\nimport type { TimelineItem } from \"@cossistant/types/api/timeline-item\";\nimport { motion } from \"motion/react\";\nimport type React from \"react\";\nimport {
|
|
1
|
+
{"version":3,"file":"timeline-message-group.js","names":["EMPTY_SEEN_BY_IDS: readonly string[]","EMPTY_SEEN_BY_NAMES: readonly string[]","TimelineMessageGroup: React.FC<TimelineMessageGroupProps>","PrimitiveTimelineItemGroup"],"sources":["../../../src/support/components/timeline-message-group.tsx"],"sourcesContent":["import type { AvailableAIAgent, AvailableHumanAgent } from \"@cossistant/types\";\nimport { SenderType } from \"@cossistant/types\";\nimport type { TimelineItem } from \"@cossistant/types/api/timeline-item\";\nimport { motion } from \"motion/react\";\nimport type React from \"react\";\nimport {\n\tTimelineItemGroup as PrimitiveTimelineItemGroup,\n\tTimelineItemGroupAvatar,\n\tTimelineItemGroupContent,\n\tTimelineItemGroupHeader,\n\tTimelineItemGroupSeenIndicator,\n} from \"../../primitives/timeline-item-group\";\nimport { cn } from \"../utils\";\nimport { Avatar } from \"./avatar\";\nimport { CossistantLogo } from \"./cossistant-branding\";\nimport { TimelineMessageItem } from \"./timeline-message-item\";\n\nconst MESSAGE_ANIMATION = {\n\tinitial: { opacity: 0, y: 6 },\n\tanimate: { opacity: 1, y: 0 },\n\texit: { opacity: 0 },\n\ttransition: {\n\t\tduration: 0.1,\n\t\tease: [0.25, 0.46, 0.45, 0.94] as const, // easeOutCubic\n\t},\n} as const;\n\nconst SEEN_ANIMATION = {\n\tinitial: { opacity: 0 },\n\tanimate: { opacity: 1 },\n\ttransition: {\n\t\tduration: 0.1,\n\t\tease: \"easeOut\" as const,\n\t},\n} as const;\n\nexport type TimelineMessageGroupProps = {\n\titems: TimelineItem[];\n\tavailableAIAgents: AvailableAIAgent[];\n\tavailableHumanAgents: AvailableHumanAgent[];\n\tcurrentVisitorId?: string;\n\tseenByIds?: readonly string[];\n\tseenByNames?: readonly string[];\n};\n\nconst EMPTY_SEEN_BY_IDS: readonly string[] = Object.freeze([]);\nconst EMPTY_SEEN_BY_NAMES: readonly string[] = Object.freeze([]);\n\nexport const TimelineMessageGroup: React.FC<TimelineMessageGroupProps> = ({\n\titems,\n\tavailableAIAgents,\n\tavailableHumanAgents,\n\tcurrentVisitorId,\n\tseenByIds = EMPTY_SEEN_BY_IDS,\n\tseenByNames = EMPTY_SEEN_BY_NAMES,\n}) => {\n\t// Get agent info for the sender\n\tconst firstItem = items[0];\n\tconst humanAgent = availableHumanAgents.find(\n\t\t(agent) => agent.id === firstItem?.userId\n\t);\n\tconst aiAgent = availableAIAgents.find(\n\t\t(agent) => agent.id === firstItem?.aiAgentId\n\t);\n\n\tif (items.length === 0) {\n\t\treturn null;\n\t}\n\n\tconst hasSeenIndicator = seenByIds.length > 0 && seenByNames.length > 0;\n\n\treturn (\n\t\t<PrimitiveTimelineItemGroup\n\t\t\titems={items}\n\t\t\tseenByIds={seenByIds}\n\t\t\tviewerId={currentVisitorId}\n\t\t\tviewerType={SenderType.VISITOR}\n\t\t>\n\t\t\t{({\n\t\t\t\tisSentByViewer,\n\t\t\t\tisReceivedByViewer,\n\t\t\t\tisVisitor,\n\t\t\t\tisAI,\n\t\t\t\tisTeamMember,\n\t\t\t}) => (\n\t\t\t\t<div\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\"flex w-full gap-2\",\n\t\t\t\t\t\t// Support widget POV: visitor messages are sent (right side)\n\t\t\t\t\t\t// Agent messages are received (left side)\n\t\t\t\t\t\tisSentByViewer && \"flex-row-reverse\",\n\t\t\t\t\t\tisReceivedByViewer && \"flex-row\"\n\t\t\t\t\t)}\n\t\t\t\t>\n\t\t\t\t\t{/* Avatar - only show for received messages (agents) */}\n\t\t\t\t\t{isReceivedByViewer && (\n\t\t\t\t\t\t<TimelineItemGroupAvatar className=\"flex flex-shrink-0 flex-col justify-end\">\n\t\t\t\t\t\t\t{isAI ? (\n\t\t\t\t\t\t\t\t<div className=\"flex size-6 items-center justify-center rounded-full bg-primary/10\">\n\t\t\t\t\t\t\t\t\t<CossistantLogo className=\"h-4 w-4 text-primary\" />\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<Avatar\n\t\t\t\t\t\t\t\t\tclassName=\"size-6\"\n\t\t\t\t\t\t\t\t\timage={humanAgent?.image}\n\t\t\t\t\t\t\t\t\tname={humanAgent?.name || \"Support\"}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</TimelineItemGroupAvatar>\n\t\t\t\t\t)}\n\n\t\t\t\t\t<TimelineItemGroupContent\n\t\t\t\t\t\tclassName={cn(\"flex flex-col gap-1\", isSentByViewer && \"items-end\")}\n\t\t\t\t\t>\n\t\t\t\t\t\t{/* Header - show sender name for received messages (agents) */}\n\t\t\t\t\t\t{isReceivedByViewer && (\n\t\t\t\t\t\t\t<TimelineItemGroupHeader className=\"px-1 text-muted-foreground text-xs\">\n\t\t\t\t\t\t\t\t{isAI\n\t\t\t\t\t\t\t\t\t? aiAgent?.name || \"AI Assistant\"\n\t\t\t\t\t\t\t\t\t: humanAgent?.name || \"Support\"}\n\t\t\t\t\t\t\t</TimelineItemGroupHeader>\n\t\t\t\t\t\t)}\n\n\t\t\t\t\t\t{items.map((item, index) => (\n\t\t\t\t\t\t\t<motion.div key={item.id} {...MESSAGE_ANIMATION}>\n\t\t\t\t\t\t\t\t<TimelineMessageItem\n\t\t\t\t\t\t\t\t\tisLast={index === items.length - 1}\n\t\t\t\t\t\t\t\t\tisSentByViewer={isSentByViewer}\n\t\t\t\t\t\t\t\t\titem={item}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t))}\n\n\t\t\t\t\t\t{isSentByViewer && (\n\t\t\t\t\t\t\t<div className={cn(\"\", hasSeenIndicator && \"mt-2\")}>\n\t\t\t\t\t\t\t\t<div className=\"min-h-[1.25rem]\">\n\t\t\t\t\t\t\t\t\t{hasSeenIndicator && (\n\t\t\t\t\t\t\t\t\t\t<motion.div key=\"seen-indicator\" {...SEEN_ANIMATION}>\n\t\t\t\t\t\t\t\t\t\t\t<TimelineItemGroupSeenIndicator\n\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"px-1 text-muted-foreground text-xs\"\n\t\t\t\t\t\t\t\t\t\t\t\tseenByIds={seenByIds}\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t{() => `Seen by ${seenByNames.join(\", \")}`}\n\t\t\t\t\t\t\t\t\t\t\t</TimelineItemGroupSeenIndicator>\n\t\t\t\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</TimelineItemGroupContent>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</PrimitiveTimelineItemGroup>\n\t);\n};\n\nTimelineMessageGroup.displayName = \"TimelineMessageGroup\";\n"],"mappings":";;;;;;;;;;AAiBA,MAAM,oBAAoB;CACzB,SAAS;EAAE,SAAS;EAAG,GAAG;EAAG;CAC7B,SAAS;EAAE,SAAS;EAAG,GAAG;EAAG;CAC7B,MAAM,EAAE,SAAS,GAAG;CACpB,YAAY;EACX,UAAU;EACV,MAAM;GAAC;GAAM;GAAM;GAAM;GAAK;EAC9B;CACD;A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b,oBACA,oBAAC,OAAO;QAAyB,GAAI;kBACpC,oBAAC;SACA,WAAU;SACC;yBAEJ,WAAW,YAAY,KAAK,KAAK;UACR;UANlB,iBAOH;QAET;OACD;;KAEmB;IACtB;GAEqB;;AAI/B,qBAAqB,cAAc"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TimelineItem } from "../../timeline-item.js";
|
|
2
|
-
import
|
|
2
|
+
import React from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/support/components/timeline-message-item.d.ts
|
|
5
5
|
type TimelineMessageItemProps = {
|
|
@@ -7,11 +7,15 @@ type TimelineMessageItemProps = {
|
|
|
7
7
|
isLast?: boolean;
|
|
8
8
|
isSentByViewer?: boolean;
|
|
9
9
|
};
|
|
10
|
+
/**
|
|
11
|
+
* Message bubble renderer that adapts layout depending on whether the visitor
|
|
12
|
+
* or an agent sent the message.
|
|
13
|
+
*/
|
|
10
14
|
declare function TimelineMessageItem({
|
|
11
15
|
item,
|
|
12
16
|
isLast,
|
|
13
17
|
isSentByViewer
|
|
14
|
-
}: TimelineMessageItemProps):
|
|
18
|
+
}: TimelineMessageItemProps): React.ReactElement;
|
|
15
19
|
//#endregion
|
|
16
20
|
export { TimelineMessageItem, TimelineMessageItemProps };
|
|
17
21
|
//# sourceMappingURL=timeline-message-item.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timeline-message-item.d.ts","names":[],"sources":["../../../src/support/components/timeline-message-item.tsx"],"sourcesContent":[],"mappings":";;;;KAUY,wBAAA;QACL
|
|
1
|
+
{"version":3,"file":"timeline-message-item.d.ts","names":[],"sources":["../../../src/support/components/timeline-message-item.tsx"],"sourcesContent":[],"mappings":";;;;KAUY,wBAAA;QACL;EADK,MAAA,CAAA,EAAA,OAAA;EAUI,cAAA,CAAA,EAAA,OAAmB;CAClC;;;;;AAG+C,iBAJhC,mBAAA,CAIgC;EAAA,IAAA;EAAA,MAAA;EAAA;AAAA,CAAA,EAA7C,wBAA6C,CAAA,EAAlB,KAAA,CAAM,YAAY"}
|
|
@@ -4,19 +4,23 @@ import { useSupportText } from "../text/index.js";
|
|
|
4
4
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
|
|
6
6
|
//#region src/support/components/timeline-message-item.tsx
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Message bubble renderer that adapts layout depending on whether the visitor
|
|
9
|
+
* or an agent sent the message.
|
|
10
|
+
*/
|
|
11
|
+
function TimelineMessageItem({ item, isLast = false, isSentByViewer = false }) {
|
|
8
12
|
const text = useSupportText();
|
|
9
13
|
return /* @__PURE__ */ jsx(TimelineItem, {
|
|
10
14
|
item,
|
|
11
|
-
children: ({
|
|
12
|
-
const isSentByViewerFinal = isSentByViewer
|
|
15
|
+
children: ({ isAI, timestamp }) => {
|
|
16
|
+
const isSentByViewerFinal = isSentByViewer;
|
|
13
17
|
return /* @__PURE__ */ jsx("div", {
|
|
14
18
|
className: cn("flex w-full gap-2", isSentByViewerFinal && "flex-row-reverse", !isSentByViewerFinal && "flex-row"),
|
|
15
19
|
children: /* @__PURE__ */ jsxs("div", {
|
|
16
20
|
className: cn("flex w-full flex-1 flex-col gap-1", isSentByViewerFinal && "items-end"),
|
|
17
21
|
children: [/* @__PURE__ */ jsx(TimelineItemContent, {
|
|
18
22
|
className: cn("block w-max max-w-[300px] rounded-lg px-3.5 py-2.5 text-sm", {
|
|
19
|
-
"bg-
|
|
23
|
+
"bg-background-300 text-foreground dark:bg-background-600": !isSentByViewerFinal,
|
|
20
24
|
"bg-primary text-primary-foreground": isSentByViewerFinal,
|
|
21
25
|
"rounded-br-sm": isLast && isSentByViewerFinal,
|
|
22
26
|
"rounded-bl-sm": isLast && !isSentByViewerFinal
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timeline-message-item.js","names":["PrimitiveTimelineItem"],"sources":["../../../src/support/components/timeline-message-item.tsx"],"sourcesContent":["import type { TimelineItem } from \"@cossistant/types/api/timeline-item\";\nimport type React from \"react\";\nimport {\n\tTimelineItem as PrimitiveTimelineItem,\n\tTimelineItemContent,\n\tTimelineItemTimestamp,\n} from \"../../primitives/timeline-item\";\nimport { useSupportText } from \"../text\";\nimport { cn } from \"../utils\";\n\nexport type TimelineMessageItemProps = {\n\titem: TimelineItem;\n\tisLast?: boolean;\n\tisSentByViewer?: boolean;\n};\n\nexport function TimelineMessageItem({\n\titem,\n\tisLast = false,\n\tisSentByViewer,\n}: TimelineMessageItemProps) {\n\tconst text = useSupportText();\n\treturn (\n\t\t<PrimitiveTimelineItem item={item}>\n\t\t\t{({
|
|
1
|
+
{"version":3,"file":"timeline-message-item.js","names":["PrimitiveTimelineItem"],"sources":["../../../src/support/components/timeline-message-item.tsx"],"sourcesContent":["import type { TimelineItem } from \"@cossistant/types/api/timeline-item\";\nimport type React from \"react\";\nimport {\n\tTimelineItem as PrimitiveTimelineItem,\n\tTimelineItemContent,\n\tTimelineItemTimestamp,\n} from \"../../primitives/timeline-item\";\nimport { useSupportText } from \"../text\";\nimport { cn } from \"../utils\";\n\nexport type TimelineMessageItemProps = {\n\titem: TimelineItem;\n\tisLast?: boolean;\n\tisSentByViewer?: boolean;\n};\n\n/**\n * Message bubble renderer that adapts layout depending on whether the visitor\n * or an agent sent the message.\n */\nexport function TimelineMessageItem({\n\titem,\n\tisLast = false,\n\tisSentByViewer = false,\n}: TimelineMessageItemProps): React.ReactElement {\n\tconst text = useSupportText();\n\treturn (\n\t\t<PrimitiveTimelineItem item={item}>\n\t\t\t{({ isAI, timestamp }) => {\n\t\t\t\t// isSentByViewer defaults to false, meaning messages are treated as received\n\t\t\t\t// (left side with background) unless explicitly marked as sent by viewer\n\t\t\t\tconst isSentByViewerFinal = isSentByViewer;\n\n\t\t\t\treturn (\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\"flex w-full gap-2\",\n\t\t\t\t\t\t\tisSentByViewerFinal && \"flex-row-reverse\",\n\t\t\t\t\t\t\t!isSentByViewerFinal && \"flex-row\"\n\t\t\t\t\t\t)}\n\t\t\t\t\t>\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\"flex w-full flex-1 flex-col gap-1\",\n\t\t\t\t\t\t\t\tisSentByViewerFinal && \"items-end\"\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<TimelineItemContent\n\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\t\"block w-max max-w-[300px] rounded-lg px-3.5 py-2.5 text-sm\",\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\"bg-background-300 text-foreground dark:bg-background-600\":\n\t\t\t\t\t\t\t\t\t\t\t!isSentByViewerFinal,\n\t\t\t\t\t\t\t\t\t\t\"bg-primary text-primary-foreground\": isSentByViewerFinal,\n\t\t\t\t\t\t\t\t\t\t\"rounded-br-sm\": isLast && isSentByViewerFinal,\n\t\t\t\t\t\t\t\t\t\t\"rounded-bl-sm\": isLast && !isSentByViewerFinal,\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\trenderMarkdown\n\t\t\t\t\t\t\t\ttext={item.text}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{isLast && (\n\t\t\t\t\t\t\t\t<TimelineItemTimestamp\n\t\t\t\t\t\t\t\t\tclassName=\"px-1 text-muted-foreground text-xs\"\n\t\t\t\t\t\t\t\t\ttimestamp={timestamp}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{() => (\n\t\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t\t{timestamp.toLocaleTimeString([], {\n\t\t\t\t\t\t\t\t\t\t\t\thour: \"2-digit\",\n\t\t\t\t\t\t\t\t\t\t\t\tminute: \"2-digit\",\n\t\t\t\t\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t\t\t\t\t\t{isAI &&\n\t\t\t\t\t\t\t\t\t\t\t\t` ${text(\"component.message.timestamp.aiIndicator\")}`}\n\t\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t</TimelineItemTimestamp>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t);\n\t\t\t}}\n\t\t</PrimitiveTimelineItem>\n\t);\n}\n"],"mappings":";;;;;;;;;;AAoBA,SAAgB,oBAAoB,EACnC,MACA,SAAS,OACT,iBAAiB,SAC+B;CAChD,MAAM,OAAO,gBAAgB;AAC7B,QACC,oBAACA;EAA4B;aAC1B,EAAE,MAAM,gBAAgB;GAGzB,MAAM,sBAAsB;AAE5B,UACC,oBAAC;IACA,WAAW,GACV,qBACA,uBAAuB,oBACvB,CAAC,uBAAuB,WACxB;cAED,qBAAC;KACA,WAAW,GACV,qCACA,uBAAuB,YACvB;gBAED,oBAAC;MACA,WAAW,GACV,8DACA;OACC,4DACC,CAAC;OACF,sCAAsC;OACtC,iBAAiB,UAAU;OAC3B,iBAAiB,UAAU,CAAC;OAC5B,CACD;MACD;MACA,MAAM,KAAK;OACV,EACD,UACA,oBAAC;MACA,WAAU;MACC;sBAGV,4CACE,UAAU,mBAAmB,EAAE,EAAE;OACjC,MAAM;OACN,QAAQ;OACR,CAAC,EACD,QACA,IAAI,KAAK,0CAA0C,MAClD;OAEmB;MAEpB;KACD;;GAGe"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as React$1 from "react";
|
|
2
2
|
import { AvailableAIAgent, AvailableHumanAgent } from "@cossistant/types";
|
|
3
|
-
import * as react_jsx_runtime9 from "react/jsx-runtime";
|
|
4
3
|
|
|
5
4
|
//#region src/support/components/typing-indicator.d.ts
|
|
6
5
|
type TypingParticipantType = "visitor" | "team_member" | "ai";
|
|
@@ -14,7 +13,11 @@ type TypingIndicatorProps = React$1.HTMLAttributes<HTMLDivElement> & {
|
|
|
14
13
|
availableHumanAgents?: AvailableHumanAgent[];
|
|
15
14
|
withAvatars?: boolean;
|
|
16
15
|
};
|
|
17
|
-
declare const BouncingDots: (
|
|
16
|
+
declare const BouncingDots: ({
|
|
17
|
+
className
|
|
18
|
+
}: {
|
|
19
|
+
className?: string;
|
|
20
|
+
}) => React$1.ReactElement;
|
|
18
21
|
declare const TypingIndicator: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & {
|
|
19
22
|
participants: TypingParticipant[];
|
|
20
23
|
availableAIAgents?: AvailableAIAgent[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typing-indicator.d.ts","names":[],"sources":["../../../src/support/components/typing-indicator.tsx"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"typing-indicator.d.ts","names":[],"sources":["../../../src/support/components/typing-indicator.tsx"],"sourcesContent":[],"mappings":";;;;KAKY,qBAAA;KAEA,iBAAA;EAFA,EAAA,EAAA,MAAA;EAEA,IAAA,EAEL,qBAFsB;AAK7B,CAAA;AAAwD,KAA5C,oBAAA,GAAuB,OAAA,CAAM,cAAe,CAAA,cAAA,CAAA,GAAA;EAArB,YAAM,EAC1B,iBAD0B,EAAA;EAC1B,iBAAA,CAAA,EACM,gBADN,EAAA;EACM,oBAAA,CAAA,EACG,mBADH,EAAA;EACG,WAAA,CAAA,EAAA,OAAA;CAAmB;AAI9B,cAAA,YAAgB,EAAA,CAAA;EAAA;CAInB,EAAA;EAuBG,SAAA,CAAA,EAAA,MAuDZ;CAvD2B,EAAA,GAvBxB,OAAA,CAAM,YAuBkB;AAAA,cAAf,eAAe,EAAA,OAAA,CAAA,yBAAA,CAAA,OAAA,CAAA,cAAA,CAAA,cAAA,CAAA,GAAA;EAjCb,YAAA,EAAA,iBAAA,EAAA;EACM,iBAAA,CAAA,EAAA,gBAAA,EAAA;EACG,oBAAA,CAAA,EAAA,mBAAA,EAAA"}
|
|
@@ -4,12 +4,12 @@ import * as React$1 from "react";
|
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
|
|
6
6
|
//#region src/support/components/typing-indicator.tsx
|
|
7
|
-
const BouncingDots = () => /* @__PURE__ */ jsxs("div", {
|
|
7
|
+
const BouncingDots = ({ className }) => /* @__PURE__ */ jsxs("div", {
|
|
8
8
|
className: "flex gap-1",
|
|
9
9
|
children: [
|
|
10
|
-
/* @__PURE__ */ jsx("span", { className: "dot-bounce-1 size-1 rounded-full bg-co-primary" }),
|
|
11
|
-
/* @__PURE__ */ jsx("span", { className: "dot-bounce-2 size-1 rounded-full bg-co-primary" }),
|
|
12
|
-
/* @__PURE__ */ jsx("span", { className: "dot-bounce-3 size-1 rounded-full bg-co-primary" })
|
|
10
|
+
/* @__PURE__ */ jsx("span", { className: cn("dot-bounce-1 size-1 rounded-full bg-co-primary", className) }),
|
|
11
|
+
/* @__PURE__ */ jsx("span", { className: cn("dot-bounce-2 size-1 rounded-full bg-co-primary", className) }),
|
|
12
|
+
/* @__PURE__ */ jsx("span", { className: cn("dot-bounce-3 size-1 rounded-full bg-co-primary", className) })
|
|
13
13
|
]
|
|
14
14
|
});
|
|
15
15
|
const TypingIndicator = React$1.forwardRef(({ participants, availableAIAgents = [], availableHumanAgents = [], withAvatars = true, className,...props }, ref) => {
|