@cossistant/react 0.0.1
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/_virtual/rolldown_runtime.js +13 -0
- package/conversation.d.ts +312 -0
- package/conversation.d.ts.map +1 -0
- package/hooks/index.d.ts +23 -0
- package/hooks/index.js +24 -0
- package/hooks/private/store/use-conversations-store.d.ts +13 -0
- package/hooks/private/store/use-conversations-store.d.ts.map +1 -0
- package/hooks/private/store/use-conversations-store.js +34 -0
- package/hooks/private/store/use-conversations-store.js.map +1 -0
- package/hooks/private/store/use-store-selector.d.ts +10 -0
- package/hooks/private/store/use-store-selector.d.ts.map +1 -0
- package/hooks/private/store/use-store-selector.js +17 -0
- package/hooks/private/store/use-store-selector.js.map +1 -0
- package/hooks/private/store/use-website-store.d.ts +18 -0
- package/hooks/private/store/use-website-store.d.ts.map +1 -0
- package/hooks/private/store/use-website-store.js +39 -0
- package/hooks/private/store/use-website-store.js.map +1 -0
- package/hooks/private/use-client-query.d.ts +25 -0
- package/hooks/private/use-client-query.d.ts.map +1 -0
- package/hooks/private/use-client-query.js +122 -0
- package/hooks/private/use-client-query.js.map +1 -0
- package/hooks/private/use-default-messages.d.ts +18 -0
- package/hooks/private/use-default-messages.d.ts.map +1 -0
- package/hooks/private/use-default-messages.js +45 -0
- package/hooks/private/use-default-messages.js.map +1 -0
- package/hooks/private/use-grouped-messages.d.ts +54 -0
- package/hooks/private/use-grouped-messages.d.ts.map +1 -0
- package/hooks/private/use-grouped-messages.js +157 -0
- package/hooks/private/use-grouped-messages.js.map +1 -0
- package/hooks/private/use-multimodal-input.d.ts +40 -0
- package/hooks/private/use-multimodal-input.d.ts.map +1 -0
- package/hooks/private/use-multimodal-input.js +129 -0
- package/hooks/private/use-multimodal-input.js.map +1 -0
- package/hooks/private/use-rest-client.d.ts +17 -0
- package/hooks/private/use-rest-client.d.ts.map +1 -0
- package/hooks/private/use-rest-client.js +41 -0
- package/hooks/private/use-rest-client.js.map +1 -0
- package/hooks/private/use-visitor-typing-reporter.d.ts +19 -0
- package/hooks/private/use-visitor-typing-reporter.d.ts.map +1 -0
- package/hooks/private/use-visitor-typing-reporter.js +140 -0
- package/hooks/private/use-visitor-typing-reporter.js.map +1 -0
- package/hooks/use-composer-refocus.d.ts +20 -0
- package/hooks/use-composer-refocus.d.ts.map +1 -0
- package/hooks/use-composer-refocus.js +32 -0
- package/hooks/use-composer-refocus.js.map +1 -0
- package/hooks/use-conversation-auto-seen.d.ts +54 -0
- package/hooks/use-conversation-auto-seen.d.ts.map +1 -0
- package/hooks/use-conversation-auto-seen.js +106 -0
- package/hooks/use-conversation-auto-seen.js.map +1 -0
- package/hooks/use-conversation-history-page.d.ts +86 -0
- package/hooks/use-conversation-history-page.d.ts.map +1 -0
- package/hooks/use-conversation-history-page.js +97 -0
- package/hooks/use-conversation-history-page.js.map +1 -0
- package/hooks/use-conversation-lifecycle.d.ts +80 -0
- package/hooks/use-conversation-lifecycle.d.ts.map +1 -0
- package/hooks/use-conversation-lifecycle.js +54 -0
- package/hooks/use-conversation-lifecycle.js.map +1 -0
- package/hooks/use-conversation-page.d.ts +82 -0
- package/hooks/use-conversation-page.d.ts.map +1 -0
- package/hooks/use-conversation-page.js +138 -0
- package/hooks/use-conversation-page.js.map +1 -0
- package/hooks/use-conversation-seen.d.ts +17 -0
- package/hooks/use-conversation-seen.d.ts.map +1 -0
- package/hooks/use-conversation-seen.js +58 -0
- package/hooks/use-conversation-seen.js.map +1 -0
- package/hooks/use-conversation-timeline-items.d.ts +21 -0
- package/hooks/use-conversation-timeline-items.d.ts.map +1 -0
- package/hooks/use-conversation-timeline-items.js +87 -0
- package/hooks/use-conversation-timeline-items.js.map +1 -0
- package/hooks/use-conversation-typing.d.ts +13 -0
- package/hooks/use-conversation-typing.d.ts.map +1 -0
- package/hooks/use-conversation-typing.js +34 -0
- package/hooks/use-conversation-typing.js.map +1 -0
- package/hooks/use-conversation.d.ts +18 -0
- package/hooks/use-conversation.d.ts.map +1 -0
- package/hooks/use-conversation.js +44 -0
- package/hooks/use-conversation.js.map +1 -0
- package/hooks/use-conversations.d.ts +20 -0
- package/hooks/use-conversations.d.ts.map +1 -0
- package/hooks/use-conversations.js +68 -0
- package/hooks/use-conversations.js.map +1 -0
- package/hooks/use-create-conversation.d.ts +30 -0
- package/hooks/use-create-conversation.d.ts.map +1 -0
- package/hooks/use-create-conversation.js +67 -0
- package/hooks/use-create-conversation.js.map +1 -0
- package/hooks/use-home-page.d.ts +82 -0
- package/hooks/use-home-page.d.ts.map +1 -0
- package/hooks/use-home-page.js +89 -0
- package/hooks/use-home-page.js.map +1 -0
- package/hooks/use-message-composer.d.ts +88 -0
- package/hooks/use-message-composer.d.ts.map +1 -0
- package/hooks/use-message-composer.js +94 -0
- package/hooks/use-message-composer.js.map +1 -0
- package/hooks/use-realtime-support.d.ts +25 -0
- package/hooks/use-realtime-support.d.ts.map +1 -0
- package/hooks/use-realtime-support.js +29 -0
- package/hooks/use-realtime-support.js.map +1 -0
- package/hooks/use-send-message.d.ts +34 -0
- package/hooks/use-send-message.d.ts.map +1 -0
- package/hooks/use-send-message.js +118 -0
- package/hooks/use-send-message.js.map +1 -0
- package/hooks/use-visitor.d.ts +28 -0
- package/hooks/use-visitor.d.ts.map +1 -0
- package/hooks/use-visitor.js +59 -0
- package/hooks/use-visitor.js.map +1 -0
- package/hooks/use-window-visibility-focus.d.ts +9 -0
- package/hooks/use-window-visibility-focus.d.ts.map +1 -0
- package/hooks/use-window-visibility-focus.js +53 -0
- package/hooks/use-window-visibility-focus.js.map +1 -0
- package/identify-visitor.d.ts +18 -0
- package/identify-visitor.d.ts.map +1 -0
- package/identify-visitor.js +26 -0
- package/identify-visitor.js.map +1 -0
- package/index.d.ts +38 -0
- package/index.js +38 -0
- package/package.json +121 -0
- package/primitives/avatar/avatar.d.ts +31 -0
- package/primitives/avatar/avatar.d.ts.map +1 -0
- package/primitives/avatar/avatar.js +49 -0
- package/primitives/avatar/avatar.js.map +1 -0
- package/primitives/avatar/fallback.d.ts +24 -0
- package/primitives/avatar/fallback.d.ts.map +1 -0
- package/primitives/avatar/fallback.js +57 -0
- package/primitives/avatar/fallback.js.map +1 -0
- package/primitives/avatar/image.d.ts +27 -0
- package/primitives/avatar/image.d.ts.map +1 -0
- package/primitives/avatar/image.js +58 -0
- package/primitives/avatar/image.js.map +1 -0
- package/primitives/avatar/index.d.ts +4 -0
- package/primitives/avatar/index.js +5 -0
- package/primitives/avatar/index.parts.d.ts +4 -0
- package/primitives/avatar/index.parts.js +5 -0
- package/primitives/bubble.d.ts +28 -0
- package/primitives/bubble.d.ts.map +1 -0
- package/primitives/bubble.js +43 -0
- package/primitives/bubble.js.map +1 -0
- package/primitives/button.d.ts +19 -0
- package/primitives/button.d.ts.map +1 -0
- package/primitives/button.js +27 -0
- package/primitives/button.js.map +1 -0
- package/primitives/conversation-timeline.d.ts +86 -0
- package/primitives/conversation-timeline.d.ts.map +1 -0
- package/primitives/conversation-timeline.js +119 -0
- package/primitives/conversation-timeline.js.map +1 -0
- package/primitives/index.d.ts +20 -0
- package/primitives/index.d.ts.map +1 -0
- package/primitives/index.js +45 -0
- package/primitives/index.js.map +1 -0
- package/primitives/index.parts.d.ts +13 -0
- package/primitives/index.parts.js +14 -0
- package/primitives/multimodal-input.d.ts +53 -0
- package/primitives/multimodal-input.d.ts.map +1 -0
- package/primitives/multimodal-input.js +106 -0
- package/primitives/multimodal-input.js.map +1 -0
- package/primitives/timeline-item-group.d.ts +166 -0
- package/primitives/timeline-item-group.d.ts.map +1 -0
- package/primitives/timeline-item-group.js +204 -0
- package/primitives/timeline-item-group.js.map +1 -0
- package/primitives/timeline-item.d.ts +75 -0
- package/primitives/timeline-item.d.ts.map +1 -0
- package/primitives/timeline-item.js +145 -0
- package/primitives/timeline-item.js.map +1 -0
- package/primitives/window.d.ts +31 -0
- package/primitives/window.d.ts.map +1 -0
- package/primitives/window.js +58 -0
- package/primitives/window.js.map +1 -0
- package/provider.d.ts +95 -0
- package/provider.d.ts.map +1 -0
- package/provider.js +124 -0
- package/provider.js.map +1 -0
- package/realtime/event-filter.d.ts +8 -0
- package/realtime/event-filter.d.ts.map +1 -0
- package/realtime/event-filter.js +21 -0
- package/realtime/event-filter.js.map +1 -0
- package/realtime/index.d.ts +6 -0
- package/realtime/index.js +7 -0
- package/realtime/provider.d.ts +57 -0
- package/realtime/provider.d.ts.map +1 -0
- package/realtime/provider.js +351 -0
- package/realtime/provider.js.map +1 -0
- package/realtime/seen-store.d.ts +23 -0
- package/realtime/seen-store.d.ts.map +1 -0
- package/realtime/seen-store.js +34 -0
- package/realtime/seen-store.js.map +1 -0
- package/realtime/support-provider.d.ts +17 -0
- package/realtime/support-provider.d.ts.map +1 -0
- package/realtime/support-provider.js +54 -0
- package/realtime/support-provider.js.map +1 -0
- package/realtime/typing-store.d.ts +30 -0
- package/realtime/typing-store.d.ts.map +1 -0
- package/realtime/typing-store.js +34 -0
- package/realtime/typing-store.js.map +1 -0
- package/realtime/use-realtime.d.ts +29 -0
- package/realtime/use-realtime.d.ts.map +1 -0
- package/realtime/use-realtime.js +47 -0
- package/realtime/use-realtime.js.map +1 -0
- package/realtime-events.d.ts +344 -0
- package/realtime-events.d.ts.map +1 -0
- package/schemas.d.ts +90 -0
- package/schemas.d.ts.map +1 -0
- package/support/components/avatar-stack.d.ts +45 -0
- package/support/components/avatar-stack.d.ts.map +1 -0
- package/support/components/avatar-stack.js +72 -0
- package/support/components/avatar-stack.js.map +1 -0
- package/support/components/avatar.d.ts +15 -0
- package/support/components/avatar.d.ts.map +1 -0
- package/support/components/avatar.js +23 -0
- package/support/components/avatar.js.map +1 -0
- package/support/components/bubble.d.ts +10 -0
- package/support/components/bubble.d.ts.map +1 -0
- package/support/components/bubble.js +95 -0
- package/support/components/bubble.js.map +1 -0
- package/support/components/button.d.ts +20 -0
- package/support/components/button.d.ts.map +1 -0
- package/support/components/button.js +41 -0
- package/support/components/button.js.map +1 -0
- package/support/components/container.d.ts +14 -0
- package/support/components/container.d.ts.map +1 -0
- package/support/components/container.js +115 -0
- package/support/components/container.js.map +1 -0
- package/support/components/conversation-button-link.d.ts +34 -0
- package/support/components/conversation-button-link.d.ts.map +1 -0
- package/support/components/conversation-button-link.js +195 -0
- package/support/components/conversation-button-link.js.map +1 -0
- package/support/components/conversation-event.d.ts +14 -0
- package/support/components/conversation-event.d.ts.map +1 -0
- package/support/components/conversation-event.js +76 -0
- package/support/components/conversation-event.js.map +1 -0
- package/support/components/conversation-timeline.d.ts +17 -0
- package/support/components/conversation-timeline.d.ts.map +1 -0
- package/support/components/conversation-timeline.js +95 -0
- package/support/components/conversation-timeline.js.map +1 -0
- package/support/components/cossistant-branding.d.ts +12 -0
- package/support/components/cossistant-branding.d.ts.map +1 -0
- package/support/components/cossistant-branding.js +22 -0
- package/support/components/cossistant-branding.js.map +1 -0
- package/support/components/header.d.ts +11 -0
- package/support/components/header.d.ts.map +1 -0
- package/support/components/header.js +43 -0
- package/support/components/header.js.map +1 -0
- package/support/components/icons.d.ts +21 -0
- package/support/components/icons.d.ts.map +1 -0
- package/support/components/icons.js +131 -0
- package/support/components/icons.js.map +1 -0
- package/support/components/index.d.ts +11 -0
- package/support/components/index.js +12 -0
- package/support/components/multimodal-input.d.ts +28 -0
- package/support/components/multimodal-input.d.ts.map +1 -0
- package/support/components/multimodal-input.js +138 -0
- package/support/components/multimodal-input.js.map +1 -0
- package/support/components/navigation-tab.d.ts +7 -0
- package/support/components/navigation-tab.d.ts.map +1 -0
- package/support/components/navigation-tab.js +40 -0
- package/support/components/navigation-tab.js.map +1 -0
- package/support/components/support-content.d.ts +22 -0
- package/support/components/support-content.d.ts.map +1 -0
- package/support/components/support-content.js +50 -0
- package/support/components/support-content.js.map +1 -0
- package/support/components/text-effect.d.ts +49 -0
- package/support/components/text-effect.d.ts.map +1 -0
- package/support/components/text-effect.js +221 -0
- package/support/components/text-effect.js.map +1 -0
- package/support/components/timeline-message-group.d.ts +16 -0
- package/support/components/timeline-message-group.d.ts.map +1 -0
- package/support/components/timeline-message-group.js +117 -0
- package/support/components/timeline-message-group.js.map +1 -0
- package/support/components/timeline-message-item.d.ts +17 -0
- package/support/components/timeline-message-item.d.ts.map +1 -0
- package/support/components/timeline-message-item.js +42 -0
- package/support/components/timeline-message-item.js.map +1 -0
- package/support/components/typing-indicator.d.ts +26 -0
- package/support/components/typing-indicator.d.ts.map +1 -0
- package/support/components/typing-indicator.js +37 -0
- package/support/components/typing-indicator.js.map +1 -0
- package/support/components/watermark.d.ts +8 -0
- package/support/components/watermark.d.ts.map +1 -0
- package/support/components/watermark.js +34 -0
- package/support/components/watermark.js.map +1 -0
- package/support/context/config.d.ts +32 -0
- package/support/context/config.d.ts.map +1 -0
- package/support/context/config.js +27 -0
- package/support/context/config.js.map +1 -0
- package/support/context/websocket.d.ts +22 -0
- package/support/context/websocket.d.ts.map +1 -0
- package/support/context/websocket.js +113 -0
- package/support/context/websocket.js.map +1 -0
- package/support/index.d.ts +39 -0
- package/support/index.d.ts.map +1 -0
- package/support/index.js +43 -0
- package/support/index.js.map +1 -0
- package/support/pages/articles.d.ts +7 -0
- package/support/pages/articles.d.ts.map +1 -0
- package/support/pages/articles.js +39 -0
- package/support/pages/articles.js.map +1 -0
- package/support/pages/conversation-history.d.ts +18 -0
- package/support/pages/conversation-history.d.ts.map +1 -0
- package/support/pages/conversation-history.js +120 -0
- package/support/pages/conversation-history.js.map +1 -0
- package/support/pages/conversation.d.ts +32 -0
- package/support/pages/conversation.d.ts.map +1 -0
- package/support/pages/conversation.js +92 -0
- package/support/pages/conversation.js.map +1 -0
- package/support/pages/home.d.ts +20 -0
- package/support/pages/home.d.ts.map +1 -0
- package/support/pages/home.js +184 -0
- package/support/pages/home.js.map +1 -0
- package/support/router.d.ts +14 -0
- package/support/router.d.ts.map +1 -0
- package/support/router.js +31 -0
- package/support/router.js.map +1 -0
- package/support/store/index.d.ts +2 -0
- package/support/store/index.js +3 -0
- package/support/store/support-store.d.ts +42 -0
- package/support/store/support-store.d.ts.map +1 -0
- package/support/store/support-store.js +66 -0
- package/support/store/support-store.js.map +1 -0
- package/support/support-CMoDLQoC.css +408 -0
- package/support/support-CMoDLQoC.css.map +1 -0
- package/support/support.js +1 -0
- package/support/text/index.d.ts +35 -0
- package/support/text/index.d.ts.map +1 -0
- package/support/text/index.js +71 -0
- package/support/text/index.js.map +1 -0
- package/support/text/locales/en.d.ts +7 -0
- package/support/text/locales/en.d.ts.map +1 -0
- package/support/text/locales/en.js +65 -0
- package/support/text/locales/en.js.map +1 -0
- package/support/text/locales/es.d.ts +7 -0
- package/support/text/locales/es.d.ts.map +1 -0
- package/support/text/locales/es.js +64 -0
- package/support/text/locales/es.js.map +1 -0
- package/support/text/locales/fr.d.ts +7 -0
- package/support/text/locales/fr.d.ts.map +1 -0
- package/support/text/locales/fr.js +64 -0
- package/support/text/locales/fr.js.map +1 -0
- package/support/text/locales/keys.d.ts +216 -0
- package/support/text/locales/keys.d.ts.map +1 -0
- package/support/text/locales/keys.js +54 -0
- package/support/text/locales/keys.js.map +1 -0
- package/support/text/runtime.d.ts +17 -0
- package/support/text/runtime.d.ts.map +1 -0
- package/support/text/runtime.js +156 -0
- package/support/text/runtime.js.map +1 -0
- package/support/utils/index.d.ts +7 -0
- package/support/utils/index.d.ts.map +1 -0
- package/support/utils/index.js +11 -0
- package/support/utils/index.js.map +1 -0
- package/support/utils/time.d.ts +5 -0
- package/support/utils/time.d.ts.map +1 -0
- package/support/utils/time.js +28 -0
- package/support/utils/time.js.map +1 -0
- package/support-config.d.ts +20 -0
- package/support-config.d.ts.map +1 -0
- package/support-config.js +25 -0
- package/support-config.js.map +1 -0
- package/support.css +2 -0
- package/timeline-item.d.ts +133 -0
- package/timeline-item.d.ts.map +1 -0
- package/utils/id.d.ts +6 -0
- package/utils/id.d.ts.map +1 -0
- package/utils/id.js +13 -0
- package/utils/id.js.map +1 -0
- package/utils/index.d.ts +3 -0
- package/utils/index.js +4 -0
- package/utils/text.d.ts +5 -0
- package/utils/text.d.ts.map +1 -0
- package/utils/text.js +9 -0
- package/utils/text.js.map +1 -0
- package/utils/use-render-element.d.ts +22 -0
- package/utils/use-render-element.d.ts.map +1 -0
- package/utils/use-render-element.js +35 -0
- package/utils/use-render-element.js.map +1 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as react_jsx_runtime10 from "react/jsx-runtime";
|
|
2
|
+
|
|
3
|
+
//#region src/support/components/avatar.d.ts
|
|
4
|
+
declare function Avatar({
|
|
5
|
+
className,
|
|
6
|
+
image,
|
|
7
|
+
name
|
|
8
|
+
}: {
|
|
9
|
+
className?: string;
|
|
10
|
+
image?: string | null;
|
|
11
|
+
name: string;
|
|
12
|
+
}): react_jsx_runtime10.JSX.Element;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { Avatar };
|
|
15
|
+
//# sourceMappingURL=avatar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"avatar.d.ts","names":[],"sources":["../../../src/support/components/avatar.tsx"],"sourcesContent":[],"mappings":";;;iBAOgB,MAAA;;;;;;;EAAA,IAAA,EAAA,MAAM;CAAA,CAAA,EAQrB,mBAAA,CAAA,GAAA,CAAA,OARqB"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { cn } from "../utils/index.js";
|
|
2
|
+
import { Avatar as Avatar$1 } from "../../primitives/avatar/avatar.js";
|
|
3
|
+
import { AvatarFallback } from "../../primitives/avatar/fallback.js";
|
|
4
|
+
import { AvatarImage } from "../../primitives/avatar/image.js";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
|
|
7
|
+
//#region src/support/components/avatar.tsx
|
|
8
|
+
function Avatar({ className, image, name }) {
|
|
9
|
+
return /* @__PURE__ */ jsxs(Avatar$1, {
|
|
10
|
+
className: cn("flex size-9 items-center justify-center overflow-clip rounded-full bg-co-background-200 dark:bg-co-background-500", className),
|
|
11
|
+
children: [image && /* @__PURE__ */ jsx(AvatarImage, {
|
|
12
|
+
alt: name,
|
|
13
|
+
src: image
|
|
14
|
+
}), /* @__PURE__ */ jsx(AvatarFallback, {
|
|
15
|
+
className: "font-medium text-xs",
|
|
16
|
+
name
|
|
17
|
+
})]
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
export { Avatar };
|
|
23
|
+
//# sourceMappingURL=avatar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"avatar.js","names":["AvatarPrimitive"],"sources":["../../../src/support/components/avatar.tsx"],"sourcesContent":["import {\n\tAvatarFallback,\n\tAvatarImage,\n\tAvatar as AvatarPrimitive,\n} from \"../../primitives/avatar\";\nimport { cn } from \"../utils\";\n\nexport function Avatar({\n\tclassName,\n\timage,\n\tname,\n}: {\n\tclassName?: string;\n\timage?: string | null;\n\tname: string;\n}) {\n\treturn (\n\t\t<AvatarPrimitive\n\t\t\tclassName={cn(\n\t\t\t\t\"flex size-9 items-center justify-center overflow-clip rounded-full bg-co-background-200 dark:bg-co-background-500\",\n\t\t\t\tclassName\n\t\t\t)}\n\t\t>\n\t\t\t{image && <AvatarImage alt={name} src={image} />}\n\t\t\t<AvatarFallback className=\"font-medium text-xs\" name={name} />\n\t\t</AvatarPrimitive>\n\t);\n}\n"],"mappings":";;;;;;;AAOA,SAAgB,OAAO,EACtB,WACA,OACA,QAKE;AACF,QACC,qBAACA;EACA,WAAW,GACV,qHACA,UACA;aAEA,SAAS,oBAAC;GAAY,KAAK;GAAM,KAAK;IAAS,EAChD,oBAAC;GAAe,WAAU;GAA4B;IAAQ;GAC7C"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/support/components/bubble.d.ts
|
|
4
|
+
type BubbleProps = {
|
|
5
|
+
className?: string;
|
|
6
|
+
};
|
|
7
|
+
declare const Bubble: React.FC<BubbleProps>;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { Bubble, BubbleProps };
|
|
10
|
+
//# sourceMappingURL=bubble.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bubble.d.ts","names":[],"sources":["../../../src/support/components/bubble.tsx"],"sourcesContent":[],"mappings":";;;KAQY,WAAA;;AAAZ,CAAA;AAIa,cAAA,MAiEZ,EAjEoB,KAAA,CAAM,EAiE1B,CAjE6B,WAiE7B,CAAA"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import { cn } from "../utils/index.js";
|
|
5
|
+
import { SupportBubble } from "../../primitives/bubble.js";
|
|
6
|
+
import icons_default from "./icons.js";
|
|
7
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { AnimatePresence, motion } from "motion/react";
|
|
9
|
+
|
|
10
|
+
//#region src/support/components/bubble.tsx
|
|
11
|
+
const Bubble = ({ className }) => /* @__PURE__ */ jsx(SupportBubble, {
|
|
12
|
+
className: cn("relative flex size-12 cursor-pointer items-center justify-center rounded-full bg-co-primary text-co-primary-foreground transition-colors hover:bg-co-primary/90 data-[open=true]:bg-co-primary/90", className),
|
|
13
|
+
children: ({ isOpen, unreadCount }) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(AnimatePresence, {
|
|
14
|
+
mode: "wait",
|
|
15
|
+
children: isOpen ? /* @__PURE__ */ jsx(motion.div, {
|
|
16
|
+
animate: {
|
|
17
|
+
scale: 1,
|
|
18
|
+
rotate: 0,
|
|
19
|
+
opacity: 1,
|
|
20
|
+
transition: {
|
|
21
|
+
duration: .2,
|
|
22
|
+
ease: "easeOut"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
className: "flex items-center justify-center",
|
|
26
|
+
exit: {
|
|
27
|
+
scale: .9,
|
|
28
|
+
rotate: -45,
|
|
29
|
+
opacity: 0,
|
|
30
|
+
transition: {
|
|
31
|
+
duration: .1,
|
|
32
|
+
ease: "easeIn"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
initial: {
|
|
36
|
+
scale: .9,
|
|
37
|
+
rotate: 45,
|
|
38
|
+
opacity: 0
|
|
39
|
+
},
|
|
40
|
+
children: /* @__PURE__ */ jsx(icons_default, {
|
|
41
|
+
className: "h-5 w-5",
|
|
42
|
+
name: "chevron-down"
|
|
43
|
+
})
|
|
44
|
+
}, "chevron") : /* @__PURE__ */ jsx(motion.div, {
|
|
45
|
+
animate: {
|
|
46
|
+
scale: 1,
|
|
47
|
+
rotate: 0,
|
|
48
|
+
opacity: 1,
|
|
49
|
+
transition: {
|
|
50
|
+
duration: .2,
|
|
51
|
+
ease: "easeOut"
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
className: "flex items-center justify-center",
|
|
55
|
+
exit: {
|
|
56
|
+
scale: .9,
|
|
57
|
+
rotate: 45,
|
|
58
|
+
opacity: 0,
|
|
59
|
+
transition: {
|
|
60
|
+
duration: .1,
|
|
61
|
+
ease: "easeIn"
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
initial: {
|
|
65
|
+
scale: .9,
|
|
66
|
+
rotate: -45,
|
|
67
|
+
opacity: 0
|
|
68
|
+
},
|
|
69
|
+
children: /* @__PURE__ */ jsx(icons_default, {
|
|
70
|
+
className: "h-6 w-6",
|
|
71
|
+
name: "chat",
|
|
72
|
+
variant: "filled"
|
|
73
|
+
})
|
|
74
|
+
}, "chat")
|
|
75
|
+
}), unreadCount > 0 && /* @__PURE__ */ jsx(motion.span, {
|
|
76
|
+
animate: {
|
|
77
|
+
scale: 1,
|
|
78
|
+
opacity: 1
|
|
79
|
+
},
|
|
80
|
+
className: "-top-1 -right-1 absolute flex h-4 w-4 items-center justify-center rounded-full bg-co-destructive font-medium text-co-destructive-foreground text-xs",
|
|
81
|
+
exit: {
|
|
82
|
+
scale: 0,
|
|
83
|
+
opacity: 0
|
|
84
|
+
},
|
|
85
|
+
initial: {
|
|
86
|
+
scale: 0,
|
|
87
|
+
opacity: 0
|
|
88
|
+
},
|
|
89
|
+
children: unreadCount
|
|
90
|
+
})] })
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
//#endregion
|
|
94
|
+
export { Bubble };
|
|
95
|
+
//# sourceMappingURL=bubble.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bubble.js","names":["Bubble: React.FC<BubbleProps>","Primitive.Bubble","Icon"],"sources":["../../../src/support/components/bubble.tsx"],"sourcesContent":["\"use client\";\n\nimport { AnimatePresence, motion } from \"motion/react\";\nimport type React from \"react\";\nimport * as Primitive from \"../../primitives\";\nimport { cn } from \"../utils\";\nimport Icon from \"./icons\";\n\nexport type BubbleProps = {\n\tclassName?: string;\n};\n\nexport const Bubble: React.FC<BubbleProps> = ({ className }) => (\n\t<Primitive.Bubble\n\t\tclassName={cn(\n\t\t\t\"relative flex size-12 cursor-pointer items-center justify-center rounded-full bg-co-primary text-co-primary-foreground transition-colors hover:bg-co-primary/90 data-[open=true]:bg-co-primary/90\",\n\t\t\tclassName\n\t\t)}\n\t>\n\t\t{({ isOpen, unreadCount }) => (\n\t\t\t<>\n\t\t\t\t<AnimatePresence mode=\"wait\">\n\t\t\t\t\t{isOpen ? (\n\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\tanimate={{\n\t\t\t\t\t\t\t\tscale: 1,\n\t\t\t\t\t\t\t\trotate: 0,\n\t\t\t\t\t\t\t\topacity: 1,\n\t\t\t\t\t\t\t\ttransition: { duration: 0.2, ease: \"easeOut\" },\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\tclassName=\"flex items-center justify-center\"\n\t\t\t\t\t\t\texit={{\n\t\t\t\t\t\t\t\tscale: 0.9,\n\t\t\t\t\t\t\t\trotate: -45,\n\t\t\t\t\t\t\t\topacity: 0,\n\t\t\t\t\t\t\t\ttransition: { duration: 0.1, ease: \"easeIn\" },\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\tinitial={{ scale: 0.9, rotate: 45, opacity: 0 }}\n\t\t\t\t\t\t\tkey=\"chevron\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Icon className=\"h-5 w-5\" name=\"chevron-down\" />\n\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\tanimate={{\n\t\t\t\t\t\t\t\tscale: 1,\n\t\t\t\t\t\t\t\trotate: 0,\n\t\t\t\t\t\t\t\topacity: 1,\n\t\t\t\t\t\t\t\ttransition: { duration: 0.2, ease: \"easeOut\" },\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\tclassName=\"flex items-center justify-center\"\n\t\t\t\t\t\t\texit={{\n\t\t\t\t\t\t\t\tscale: 0.9,\n\t\t\t\t\t\t\t\trotate: 45,\n\t\t\t\t\t\t\t\topacity: 0,\n\t\t\t\t\t\t\t\ttransition: { duration: 0.1, ease: \"easeIn\" },\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\tinitial={{ scale: 0.9, rotate: -45, opacity: 0 }}\n\t\t\t\t\t\t\tkey=\"chat\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Icon className=\"h-6 w-6\" name=\"chat\" variant=\"filled\" />\n\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t)}\n\t\t\t\t</AnimatePresence>\n\t\t\t\t{unreadCount > 0 && (\n\t\t\t\t\t<motion.span\n\t\t\t\t\t\tanimate={{ scale: 1, opacity: 1 }}\n\t\t\t\t\t\tclassName=\"-top-1 -right-1 absolute flex h-4 w-4 items-center justify-center rounded-full bg-co-destructive font-medium text-co-destructive-foreground text-xs\"\n\t\t\t\t\t\texit={{ scale: 0, opacity: 0 }}\n\t\t\t\t\t\tinitial={{ scale: 0, opacity: 0 }}\n\t\t\t\t\t>\n\t\t\t\t\t\t{unreadCount}\n\t\t\t\t\t</motion.span>\n\t\t\t\t)}\n\t\t\t</>\n\t\t)}\n\t</Primitive.Bubble>\n);\n"],"mappings":";;;;;;;;;;AAYA,MAAaA,UAAiC,EAAE,gBAC/C,oBAACC;CACA,WAAW,GACV,qMACA,UACA;YAEC,EAAE,QAAQ,kBACX,4CACC,oBAAC;EAAgB,MAAK;YACpB,SACA,oBAAC,OAAO;GACP,SAAS;IACR,OAAO;IACP,QAAQ;IACR,SAAS;IACT,YAAY;KAAE,UAAU;KAAK,MAAM;KAAW;IAC9C;GACD,WAAU;GACV,MAAM;IACL,OAAO;IACP,QAAQ;IACR,SAAS;IACT,YAAY;KAAE,UAAU;KAAK,MAAM;KAAU;IAC7C;GACD,SAAS;IAAE,OAAO;IAAK,QAAQ;IAAI,SAAS;IAAG;aAG/C,oBAACC;IAAK,WAAU;IAAU,MAAK;KAAiB;KAF5C,UAGQ,GAEb,oBAAC,OAAO;GACP,SAAS;IACR,OAAO;IACP,QAAQ;IACR,SAAS;IACT,YAAY;KAAE,UAAU;KAAK,MAAM;KAAW;IAC9C;GACD,WAAU;GACV,MAAM;IACL,OAAO;IACP,QAAQ;IACR,SAAS;IACT,YAAY;KAAE,UAAU;KAAK,MAAM;KAAU;IAC7C;GACD,SAAS;IAAE,OAAO;IAAK,QAAQ;IAAK,SAAS;IAAG;aAGhD,oBAACA;IAAK,WAAU;IAAU,MAAK;IAAO,SAAQ;KAAW;KAFrD,OAGQ;GAEG,EACjB,cAAc,KACd,oBAAC,OAAO;EACP,SAAS;GAAE,OAAO;GAAG,SAAS;GAAG;EACjC,WAAU;EACV,MAAM;GAAE,OAAO;GAAG,SAAS;GAAG;EAC9B,SAAS;GAAE,OAAO;GAAG,SAAS;GAAG;YAEhC;GACY,IAEb;EAEc"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React$1 from "react";
|
|
2
|
+
import * as react_jsx_runtime11 from "react/jsx-runtime";
|
|
3
|
+
import * as class_variance_authority_types0 from "class-variance-authority/types";
|
|
4
|
+
import { VariantProps } from "class-variance-authority";
|
|
5
|
+
|
|
6
|
+
//#region src/support/components/button.d.ts
|
|
7
|
+
declare const coButtonVariants: (props?: ({
|
|
8
|
+
variant?: "default" | "tab" | "secondary" | "ghost" | "outline" | "tab-selected" | null | undefined;
|
|
9
|
+
size?: "default" | "large" | "icon" | null | undefined;
|
|
10
|
+
} & class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
11
|
+
type CossistantButtonProps = React$1.ComponentProps<"button"> & VariantProps<typeof coButtonVariants>;
|
|
12
|
+
declare function Button({
|
|
13
|
+
className,
|
|
14
|
+
variant,
|
|
15
|
+
size,
|
|
16
|
+
...props
|
|
17
|
+
}: CossistantButtonProps): react_jsx_runtime11.JSX.Element;
|
|
18
|
+
//#endregion
|
|
19
|
+
export { Button, CossistantButtonProps, coButtonVariants };
|
|
20
|
+
//# sourceMappingURL=button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button.d.ts","names":[],"sources":["../../../src/support/components/button.tsx"],"sourcesContent":[],"mappings":";;;;;;cAKa;;;IA4BZ,+BAAA,CAAA;AA5BY,KA8BD,qBAAA,GAAwB,OAAA,CAAM,cAFzC,CAAA,QAAA,CAAA,GAGA,YAHA,CAAA,OAGoB,gBAHpB,CAAA;AAEW,iBAGI,MAAA,CAHiB;EAAA,SAAA;EAAA,OAAA;EAAA,IAAA;EAAA,GAAA;AAAA,CAAA,EAQ9B,qBAR8B,CAAA,EAQT,mBAAA,CAAA,GAAA,CAAA,OARS"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { cn } from "../utils/index.js";
|
|
2
|
+
import { Button as Button$1 } from "../../primitives/button.js";
|
|
3
|
+
import { cva } from "../../node_modules/class-variance-authority/dist/index.js";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
|
|
6
|
+
//#region src/support/components/button.tsx
|
|
7
|
+
const coButtonVariants = cva("group/btn inline-flex shrink-0 items-center justify-center gap-2 whitespace-nowrap rounded-md border font-medium text-sm outline-none transition-all hover:cursor-pointer focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0", {
|
|
8
|
+
variants: {
|
|
9
|
+
variant: {
|
|
10
|
+
default: "bg-co-primary text-co-primary-foreground hover:bg-co-primary/90",
|
|
11
|
+
secondary: "border-co-border/50 bg-co-background-50 hover:bg-co-background-100 hover:text-co-foreground dark:bg-co-background-300 dark:hover:bg-co-background-400",
|
|
12
|
+
ghost: "border-transparent hover:bg-co-background-200 hover:text-co-foreground dark:hover:bg-co-background-300",
|
|
13
|
+
outline: "border border-co-border bg-co-background hover:bg-co-background-100 dark:bg-co-background-200 dark:hover:bg-co-background-300",
|
|
14
|
+
tab: "opacity-40 hover:bg-co-background-100 hover:text-co-foreground hover:opacity-90 dark:hover:bg-co-background-200",
|
|
15
|
+
"tab-selected": "hover:bg-co-background-100 hover:text-co-foreground dark:hover:bg-co-background-200"
|
|
16
|
+
},
|
|
17
|
+
size: {
|
|
18
|
+
default: "h-8 px-4 py-2 has-[>svg]:px-3",
|
|
19
|
+
large: "h-14 px-6 has-[>svg]:px-4",
|
|
20
|
+
icon: "size-6"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
defaultVariants: {
|
|
24
|
+
variant: "default",
|
|
25
|
+
size: "default"
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
function Button({ className, variant, size,...props }) {
|
|
29
|
+
return /* @__PURE__ */ jsx(Button$1, {
|
|
30
|
+
className: cn(coButtonVariants({
|
|
31
|
+
variant,
|
|
32
|
+
size,
|
|
33
|
+
className
|
|
34
|
+
})),
|
|
35
|
+
...props
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
//#endregion
|
|
40
|
+
export { Button, coButtonVariants };
|
|
41
|
+
//# sourceMappingURL=button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button.js","names":["ButtonPrimitive"],"sources":["../../../src/support/components/button.tsx"],"sourcesContent":["import { cva, type VariantProps } from \"class-variance-authority\";\nimport type * as React from \"react\";\nimport { Button as ButtonPrimitive } from \"../../primitives/button\";\nimport { cn } from \"../utils\";\n\nexport const coButtonVariants = cva(\n\t\"group/btn inline-flex shrink-0 items-center justify-center gap-2 whitespace-nowrap rounded-md border font-medium text-sm outline-none transition-all hover:cursor-pointer focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0\",\n\t{\n\t\tvariants: {\n\t\t\tvariant: {\n\t\t\t\tdefault:\n\t\t\t\t\t\"bg-co-primary text-co-primary-foreground hover:bg-co-primary/90\",\n\t\t\t\tsecondary:\n\t\t\t\t\t\"border-co-border/50 bg-co-background-50 hover:bg-co-background-100 hover:text-co-foreground dark:bg-co-background-300 dark:hover:bg-co-background-400\",\n\t\t\t\tghost:\n\t\t\t\t\t\"border-transparent hover:bg-co-background-200 hover:text-co-foreground dark:hover:bg-co-background-300\",\n\t\t\t\toutline:\n\t\t\t\t\t\"border border-co-border bg-co-background hover:bg-co-background-100 dark:bg-co-background-200 dark:hover:bg-co-background-300\",\n\t\t\t\ttab: \"opacity-40 hover:bg-co-background-100 hover:text-co-foreground hover:opacity-90 dark:hover:bg-co-background-200\",\n\t\t\t\t\"tab-selected\":\n\t\t\t\t\t\"hover:bg-co-background-100 hover:text-co-foreground dark:hover:bg-co-background-200\",\n\t\t\t},\n\t\t\tsize: {\n\t\t\t\tdefault: \"h-8 px-4 py-2 has-[>svg]:px-3\",\n\t\t\t\tlarge: \"h-14 px-6 has-[>svg]:px-4\",\n\t\t\t\ticon: \"size-6\",\n\t\t\t},\n\t\t},\n\t\tdefaultVariants: {\n\t\t\tvariant: \"default\",\n\t\t\tsize: \"default\",\n\t\t},\n\t}\n);\n\nexport type CossistantButtonProps = React.ComponentProps<\"button\"> &\n\tVariantProps<typeof coButtonVariants>;\n\nexport function Button({\n\tclassName,\n\tvariant,\n\tsize,\n\t...props\n}: CossistantButtonProps) {\n\treturn (\n\t\t<ButtonPrimitive\n\t\t\tclassName={cn(coButtonVariants({ variant, size, className }))}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;AAKA,MAAa,mBAAmB,IAC/B,qeACA;CACC,UAAU;EACT,SAAS;GACR,SACC;GACD,WACC;GACD,OACC;GACD,SACC;GACD,KAAK;GACL,gBACC;GACD;EACD,MAAM;GACL,SAAS;GACT,OAAO;GACP,MAAM;GACN;EACD;CACD,iBAAiB;EAChB,SAAS;EACT,MAAM;EACN;CACD,CACD;AAKD,SAAgB,OAAO,EACtB,WACA,SACA,KACA,GAAG,SACsB;AACzB,QACC,oBAACA;EACA,WAAW,GAAG,iBAAiB;GAAE;GAAS;GAAM;GAAW,CAAC,CAAC;EAC7D,GAAI;GACH"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/support/components/container.d.ts
|
|
4
|
+
type ContainerProps = {
|
|
5
|
+
className?: string;
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
mode?: "floating" | "responsive";
|
|
8
|
+
position?: "top" | "bottom";
|
|
9
|
+
align?: "right" | "left";
|
|
10
|
+
};
|
|
11
|
+
declare const Container: React.FC<ContainerProps>;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { Container, ContainerProps };
|
|
14
|
+
//# sourceMappingURL=container.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"container.d.ts","names":[],"sources":["../../../src/support/components/container.tsx"],"sourcesContent":[],"mappings":";;;KAQY,cAAA;;EAAA,QAAA,EAED,KAAA,CAAM,SAFS;EAQb,IAAA,CAAA,EAAA,UAwIZ,GAAA,YAAA;EAAA,QAAA,CAAA,EAAA,KAAA,GAAA,QAAA;OAxIgC,CAAA,EAAA,OAAA,GAAA,MAAA;;AAAD,cAAnB,SAAmB,EAAR,KAAA,CAAM,EAAE,CAAC,cAAD,CAAA"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import { cn } from "../utils/index.js";
|
|
5
|
+
import { SupportWindow } from "../../primitives/window.js";
|
|
6
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
7
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { AnimatePresence, motion } from "motion/react";
|
|
9
|
+
|
|
10
|
+
//#region src/support/components/container.tsx
|
|
11
|
+
const Container = ({ className, children, mode = "floating", position = "bottom", align = "right" }) => {
|
|
12
|
+
const [showScrollIndicator, setShowScrollIndicator] = useState(false);
|
|
13
|
+
const containerRef = useRef(null);
|
|
14
|
+
const checkScroll = useCallback(() => {
|
|
15
|
+
const container = containerRef.current;
|
|
16
|
+
if (!container) return;
|
|
17
|
+
const { scrollTop, scrollHeight, clientHeight } = container;
|
|
18
|
+
const isScrollable = scrollHeight > clientHeight;
|
|
19
|
+
const isAtBottom = Math.abs(scrollHeight - scrollTop - clientHeight) < 5;
|
|
20
|
+
setShowScrollIndicator(isScrollable && !isAtBottom);
|
|
21
|
+
}, []);
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
const container = containerRef.current;
|
|
24
|
+
if (!container) return;
|
|
25
|
+
checkScroll();
|
|
26
|
+
const handleScroll = () => {
|
|
27
|
+
checkScroll();
|
|
28
|
+
};
|
|
29
|
+
container.addEventListener("scroll", handleScroll, { passive: true });
|
|
30
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
31
|
+
checkScroll();
|
|
32
|
+
});
|
|
33
|
+
resizeObserver.observe(container);
|
|
34
|
+
const mutationObserver = new MutationObserver(() => {
|
|
35
|
+
checkScroll();
|
|
36
|
+
});
|
|
37
|
+
mutationObserver.observe(container, {
|
|
38
|
+
childList: true,
|
|
39
|
+
subtree: true,
|
|
40
|
+
characterData: true
|
|
41
|
+
});
|
|
42
|
+
return () => {
|
|
43
|
+
container.removeEventListener("scroll", handleScroll);
|
|
44
|
+
resizeObserver.disconnect();
|
|
45
|
+
mutationObserver.disconnect();
|
|
46
|
+
};
|
|
47
|
+
}, [checkScroll]);
|
|
48
|
+
return /* @__PURE__ */ jsx(SupportWindow, {
|
|
49
|
+
asChild: true,
|
|
50
|
+
children: /* @__PURE__ */ jsx(motion.div, {
|
|
51
|
+
animate: "visible",
|
|
52
|
+
className: cn("flex flex-col overflow-hidden overscroll-none bg-co-background", mode === "floating" ? "max-md:fixed max-md:inset-0" : "max-md:relative max-md:h-full max-md:w-full", mode === "floating" && [
|
|
53
|
+
"z-[9999] md:absolute md:z-[9900] md:aspect-[9/18] md:max-h-[calc(100vh-6rem)] md:w-[400px] md:rounded-lg md:border md:border-co-border md:shadow-xl md:dark:shadow-co-background-600/50",
|
|
54
|
+
position === "bottom" && "md:bottom-16",
|
|
55
|
+
position === "top" && "md:top-16",
|
|
56
|
+
align === "right" && "md:right-0",
|
|
57
|
+
align === "left" && "md:left-0"
|
|
58
|
+
], mode === "responsive" && "md:relative md:h-full md:w-full md:rounded-none md:border-0 md:shadow-none", className),
|
|
59
|
+
exit: "exit",
|
|
60
|
+
initial: "hidden",
|
|
61
|
+
transition: {
|
|
62
|
+
default: { ease: "anticipate" },
|
|
63
|
+
layout: { duration: .3 }
|
|
64
|
+
},
|
|
65
|
+
variants: {
|
|
66
|
+
hidden: {
|
|
67
|
+
opacity: 0,
|
|
68
|
+
y: 10,
|
|
69
|
+
filter: "blur(6px)"
|
|
70
|
+
},
|
|
71
|
+
visible: {
|
|
72
|
+
opacity: 1,
|
|
73
|
+
y: 0,
|
|
74
|
+
filter: "blur(0px)"
|
|
75
|
+
},
|
|
76
|
+
exit: {
|
|
77
|
+
opacity: 0,
|
|
78
|
+
y: 10,
|
|
79
|
+
filter: "blur(6px)"
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
83
|
+
className: "relative flex h-full w-full flex-col",
|
|
84
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
85
|
+
className: "flex flex-1 flex-col overflow-y-auto pt-18",
|
|
86
|
+
ref: containerRef,
|
|
87
|
+
children
|
|
88
|
+
}), /* @__PURE__ */ jsx(AnimatePresence, { children: showScrollIndicator && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(motion.div, {
|
|
89
|
+
animate: { opacity: 1 },
|
|
90
|
+
className: "pointer-events-none absolute inset-x-0 bottom-0 z-5 h-32 bg-gradient-to-t from-co-background via-co-background/70 to-transparent",
|
|
91
|
+
exit: { opacity: 0 },
|
|
92
|
+
initial: { opacity: 0 },
|
|
93
|
+
transition: {
|
|
94
|
+
duration: .3,
|
|
95
|
+
ease: "easeInOut"
|
|
96
|
+
}
|
|
97
|
+
}), /* @__PURE__ */ jsx(motion.div, {
|
|
98
|
+
animate: { opacity: .6 },
|
|
99
|
+
className: "pointer-events-none absolute inset-x-0 bottom-0 z-5 h-48 bg-gradient-to-t from-co-background/80 via-co-background/30 to-transparent",
|
|
100
|
+
exit: { opacity: 0 },
|
|
101
|
+
initial: { opacity: 0 },
|
|
102
|
+
transition: {
|
|
103
|
+
duration: .4,
|
|
104
|
+
ease: "easeInOut",
|
|
105
|
+
delay: .05
|
|
106
|
+
}
|
|
107
|
+
})] }) })]
|
|
108
|
+
})
|
|
109
|
+
})
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
//#endregion
|
|
114
|
+
export { Container };
|
|
115
|
+
//# sourceMappingURL=container.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"container.js","names":["Container: React.FC<ContainerProps>","Primitive.Window"],"sources":["../../../src/support/components/container.tsx"],"sourcesContent":["\"use client\";\n\nimport { AnimatePresence, motion } from \"motion/react\";\nimport type React from \"react\";\nimport { useCallback, useEffect, useRef, useState } from \"react\";\nimport * as Primitive from \"../../primitives\";\nimport { cn } from \"../utils\";\n\nexport type ContainerProps = {\n\tclassName?: string;\n\tchildren: React.ReactNode;\n\tmode?: \"floating\" | \"responsive\";\n\tposition?: \"top\" | \"bottom\";\n\talign?: \"right\" | \"left\";\n};\n\nexport const Container: React.FC<ContainerProps> = ({\n\tclassName,\n\tchildren,\n\tmode = \"floating\",\n\tposition = \"bottom\",\n\talign = \"right\",\n}) => {\n\tconst [showScrollIndicator, setShowScrollIndicator] = useState(false);\n\tconst containerRef = useRef<HTMLDivElement>(null);\n\n\tconst checkScroll = useCallback(() => {\n\t\tconst container = containerRef.current;\n\t\tif (!container) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { scrollTop, scrollHeight, clientHeight } = container;\n\t\tconst isScrollable = scrollHeight > clientHeight;\n\t\tconst isAtBottom = Math.abs(scrollHeight - scrollTop - clientHeight) < 5; // 5px threshold\n\n\t\tsetShowScrollIndicator(isScrollable && !isAtBottom);\n\t}, []);\n\n\tuseEffect(() => {\n\t\tconst container = containerRef.current;\n\t\tif (!container) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Instant initial check\n\t\tcheckScroll();\n\n\t\t// Direct scroll listener on the container\n\t\tconst handleScroll = () => {\n\t\t\tcheckScroll();\n\t\t};\n\n\t\tcontainer.addEventListener(\"scroll\", handleScroll, { passive: true });\n\n\t\t// Use ResizeObserver to detect content changes instantly\n\t\tconst resizeObserver = new ResizeObserver(() => {\n\t\t\tcheckScroll();\n\t\t});\n\n\t\tresizeObserver.observe(container);\n\n\t\t// Also observe all child elements for dynamic content\n\t\tconst mutationObserver = new MutationObserver(() => {\n\t\t\tcheckScroll();\n\t\t});\n\n\t\tmutationObserver.observe(container, {\n\t\t\tchildList: true,\n\t\t\tsubtree: true,\n\t\t\tcharacterData: true,\n\t\t});\n\n\t\treturn () => {\n\t\t\tcontainer.removeEventListener(\"scroll\", handleScroll);\n\t\t\tresizeObserver.disconnect();\n\t\t\tmutationObserver.disconnect();\n\t\t};\n\t}, [checkScroll]);\n\n\treturn (\n\t\t<Primitive.Window asChild>\n\t\t\t<motion.div\n\t\t\t\tanimate=\"visible\"\n\t\t\t\tclassName={cn(\n\t\t\t\t\t// Common base styles\n\t\t\t\t\t\"flex flex-col overflow-hidden overscroll-none bg-co-background\",\n\n\t\t\t\t\tmode === \"floating\"\n\t\t\t\t\t\t? \"max-md:fixed max-md:inset-0\"\n\t\t\t\t\t\t: \"max-md:relative max-md:h-full max-md:w-full\",\n\n\t\t\t\t\t// Desktop floating mode\n\t\t\t\t\tmode === \"floating\" && [\n\t\t\t\t\t\t\"z-[9999] md:absolute md:z-[9900] md:aspect-[9/18] md:max-h-[calc(100vh-6rem)] md:w-[400px] md:rounded-lg md:border md:border-co-border md:shadow-xl md:dark:shadow-co-background-600/50\",\n\t\t\t\t\t\tposition === \"bottom\" && \"md:bottom-16\",\n\t\t\t\t\t\tposition === \"top\" && \"md:top-16\",\n\t\t\t\t\t\talign === \"right\" && \"md:right-0\",\n\t\t\t\t\t\talign === \"left\" && \"md:left-0\",\n\t\t\t\t\t],\n\n\t\t\t\t\t// Desktop responsive mode\n\t\t\t\t\tmode === \"responsive\" &&\n\t\t\t\t\t\t\"md:relative md:h-full md:w-full md:rounded-none md:border-0 md:shadow-none\",\n\n\t\t\t\t\tclassName\n\t\t\t\t)}\n\t\t\t\texit=\"exit\"\n\t\t\t\tinitial=\"hidden\"\n\t\t\t\ttransition={{\n\t\t\t\t\tdefault: { ease: \"anticipate\" },\n\t\t\t\t\tlayout: { duration: 0.3 },\n\t\t\t\t}}\n\t\t\t\tvariants={{\n\t\t\t\t\thidden: { opacity: 0, y: 10, filter: \"blur(6px)\" },\n\t\t\t\t\tvisible: { opacity: 1, y: 0, filter: \"blur(0px)\" },\n\t\t\t\t\texit: { opacity: 0, y: 10, filter: \"blur(6px)\" },\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<div className=\"relative flex h-full w-full flex-col\">\n\t\t\t\t\t{/* Scrollable content area */}\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName=\"flex flex-1 flex-col overflow-y-auto pt-18\"\n\t\t\t\t\t\tref={containerRef}\n\t\t\t\t\t>\n\t\t\t\t\t\t{children}\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<AnimatePresence>\n\t\t\t\t\t\t{showScrollIndicator && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\t\tanimate={{ opacity: 1 }}\n\t\t\t\t\t\t\t\t\tclassName=\"pointer-events-none absolute inset-x-0 bottom-0 z-5 h-32 bg-gradient-to-t from-co-background via-co-background/70 to-transparent\"\n\t\t\t\t\t\t\t\t\texit={{ opacity: 0 }}\n\t\t\t\t\t\t\t\t\tinitial={{ opacity: 0 }}\n\t\t\t\t\t\t\t\t\ttransition={{ duration: 0.3, ease: \"easeInOut\" }}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\t\tanimate={{ opacity: 0.6 }}\n\t\t\t\t\t\t\t\t\tclassName=\"pointer-events-none absolute inset-x-0 bottom-0 z-5 h-48 bg-gradient-to-t from-co-background/80 via-co-background/30 to-transparent\"\n\t\t\t\t\t\t\t\t\texit={{ opacity: 0 }}\n\t\t\t\t\t\t\t\t\tinitial={{ opacity: 0 }}\n\t\t\t\t\t\t\t\t\ttransition={{ duration: 0.4, ease: \"easeInOut\", delay: 0.05 }}\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</AnimatePresence>\n\t\t\t\t</div>\n\t\t\t</motion.div>\n\t\t</Primitive.Window>\n\t);\n};\n"],"mappings":";;;;;;;;;;AAgBA,MAAaA,aAAuC,EACnD,WACA,UACA,OAAO,YACP,WAAW,UACX,QAAQ,cACH;CACL,MAAM,CAAC,qBAAqB,0BAA0B,SAAS,MAAM;CACrE,MAAM,eAAe,OAAuB,KAAK;CAEjD,MAAM,cAAc,kBAAkB;EACrC,MAAM,YAAY,aAAa;AAC/B,MAAI,CAAC,UACJ;EAGD,MAAM,EAAE,WAAW,cAAc,iBAAiB;EAClD,MAAM,eAAe,eAAe;EACpC,MAAM,aAAa,KAAK,IAAI,eAAe,YAAY,aAAa,GAAG;AAEvE,yBAAuB,gBAAgB,CAAC,WAAW;IACjD,EAAE,CAAC;AAEN,iBAAgB;EACf,MAAM,YAAY,aAAa;AAC/B,MAAI,CAAC,UACJ;AAID,eAAa;EAGb,MAAM,qBAAqB;AAC1B,gBAAa;;AAGd,YAAU,iBAAiB,UAAU,cAAc,EAAE,SAAS,MAAM,CAAC;EAGrE,MAAM,iBAAiB,IAAI,qBAAqB;AAC/C,gBAAa;IACZ;AAEF,iBAAe,QAAQ,UAAU;EAGjC,MAAM,mBAAmB,IAAI,uBAAuB;AACnD,gBAAa;IACZ;AAEF,mBAAiB,QAAQ,WAAW;GACnC,WAAW;GACX,SAAS;GACT,eAAe;GACf,CAAC;AAEF,eAAa;AACZ,aAAU,oBAAoB,UAAU,aAAa;AACrD,kBAAe,YAAY;AAC3B,oBAAiB,YAAY;;IAE5B,CAAC,YAAY,CAAC;AAEjB,QACC,oBAACC;EAAiB;YACjB,oBAAC,OAAO;GACP,SAAQ;GACR,WAAW,GAEV,kEAEA,SAAS,aACN,gCACA,+CAGH,SAAS,cAAc;IACtB;IACA,aAAa,YAAY;IACzB,aAAa,SAAS;IACtB,UAAU,WAAW;IACrB,UAAU,UAAU;IACpB,EAGD,SAAS,gBACR,8EAED,UACA;GACD,MAAK;GACL,SAAQ;GACR,YAAY;IACX,SAAS,EAAE,MAAM,cAAc;IAC/B,QAAQ,EAAE,UAAU,IAAK;IACzB;GACD,UAAU;IACT,QAAQ;KAAE,SAAS;KAAG,GAAG;KAAI,QAAQ;KAAa;IAClD,SAAS;KAAE,SAAS;KAAG,GAAG;KAAG,QAAQ;KAAa;IAClD,MAAM;KAAE,SAAS;KAAG,GAAG;KAAI,QAAQ;KAAa;IAChD;aAED,qBAAC;IAAI,WAAU;eAEd,oBAAC;KACA,WAAU;KACV,KAAK;KAEJ;MACI,EAEN,oBAAC,6BACC,uBACA,4CACC,oBAAC,OAAO;KACP,SAAS,EAAE,SAAS,GAAG;KACvB,WAAU;KACV,MAAM,EAAE,SAAS,GAAG;KACpB,SAAS,EAAE,SAAS,GAAG;KACvB,YAAY;MAAE,UAAU;MAAK,MAAM;MAAa;MAC/C,EACF,oBAAC,OAAO;KACP,SAAS,EAAE,SAAS,IAAK;KACzB,WAAU;KACV,MAAM,EAAE,SAAS,GAAG;KACpB,SAAS,EAAE,SAAS,GAAG;KACvB,YAAY;MAAE,UAAU;MAAK,MAAM;MAAa,OAAO;MAAM;MAC5D,IACA,GAEa;KACb;IACM;GACK"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Conversation } from "@cossistant/types";
|
|
3
|
+
|
|
4
|
+
//#region src/support/components/conversation-button-link.d.ts
|
|
5
|
+
type ConversationButtonLinkProps = {
|
|
6
|
+
conversation: Conversation;
|
|
7
|
+
onClick?: () => void;
|
|
8
|
+
className?: string | ((state: ConversationButtonLinkState) => string);
|
|
9
|
+
render?: (props: React.HTMLProps<HTMLButtonElement>, state: ConversationButtonLinkState) => React.ReactElement;
|
|
10
|
+
};
|
|
11
|
+
type ConversationButtonLinkAgent = {
|
|
12
|
+
name: string;
|
|
13
|
+
image: string | null;
|
|
14
|
+
type: "human" | "ai" | "fallback";
|
|
15
|
+
};
|
|
16
|
+
type ConversationButtonLinkState = {
|
|
17
|
+
conversation: Conversation;
|
|
18
|
+
lastMessage: {
|
|
19
|
+
content: string;
|
|
20
|
+
time: string;
|
|
21
|
+
isFromVisitor: boolean;
|
|
22
|
+
senderName?: string;
|
|
23
|
+
senderImage?: string | null;
|
|
24
|
+
} | null;
|
|
25
|
+
assignedAgent: ConversationButtonLinkAgent;
|
|
26
|
+
};
|
|
27
|
+
declare function ConversationButtonLink({
|
|
28
|
+
conversation,
|
|
29
|
+
onClick,
|
|
30
|
+
...props
|
|
31
|
+
}: ConversationButtonLinkProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | null;
|
|
32
|
+
//#endregion
|
|
33
|
+
export { ConversationButtonLink, ConversationButtonLinkAgent, ConversationButtonLinkProps, ConversationButtonLinkState };
|
|
34
|
+
//# sourceMappingURL=conversation-button-link.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversation-button-link.d.ts","names":[],"sources":["../../../src/support/components/conversation-button-link.tsx"],"sourcesContent":[],"mappings":";;;;KAkBY,2BAAA;gBACG;EADH,OAAA,CAAA,EAAA,GAAA,GAAA,IAAA;EAA2B,SAAA,CAAA,EAAA,MAAA,GAAA,CAAA,CAAA,KAAA,EAGR,2BAHQ,EAAA,GAAA,MAAA,CAAA;QACxB,CAAA,EAAA,CAAA,KAAA,EAIN,KAAA,CAAM,SAJA,CAIU,iBAJV,CAAA,EAAA,KAAA,EAKN,2BALM,EAAA,GAMT,KAAA,CAAM,YANG;;AAIU,KAKb,2BAAA,GALa;MAAhB,EAAA,MAAM;OACN,EAAA,MAAA,GAAA,IAAA;MACH,EAAA,OAAM,GAAA,IAAA,GAAA,UAAA;CAAY;AAGZ,KAMA,2BAAA,GAN2B;EAM3B,YAAA,EACG,YADH;EAA2B,WAAA,EAAA;IACxB,OAAA,EAAA,MAAA;IAQC,IAAA,EAAA,MAAA;IAA2B,aAAA,EAAA,OAAA;IA+C3B,UAAA,CAAA,EAAA,MAAA;IAAsB,WAAA,CAAA,EAAA,MAAA,GAAA,IAAA;MACrC,IAAA;eACA,EAjDe,2BAiDf;;AAE6B,iBAJd,sBAAA,CAIc;EAAA,YAAA;EAAA,OAAA;EAAA,GAAA;AAAA,CAAA,EAA3B,2BAA2B,CAAA,EAAA,KAAA,CAAA,YAAA,CAAA,OAAA,EAAA,MAAA,GAAA,KAAA,CAAA,qBAAA,CAAA,GAAA,CAAA,CAAA,GAAA,IAAA"}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import { cn } from "../utils/index.js";
|
|
2
|
+
import { useRenderElement } from "../../utils/use-render-element.js";
|
|
3
|
+
import { Avatar } from "./avatar.js";
|
|
4
|
+
import { BouncingDots } from "./typing-indicator.js";
|
|
5
|
+
import { coButtonVariants } from "./button.js";
|
|
6
|
+
import icons_default from "./icons.js";
|
|
7
|
+
import { useSupportText } from "../text/index.js";
|
|
8
|
+
import { useConversationTimelineItems } from "../../hooks/use-conversation-timeline-items.js";
|
|
9
|
+
import { formatTimeAgo } from "../utils/time.js";
|
|
10
|
+
import { useSupport } from "../../provider.js";
|
|
11
|
+
import { useConversationTyping } from "../../hooks/use-conversation-typing.js";
|
|
12
|
+
import { useMemo } from "react";
|
|
13
|
+
import { ConversationStatus } from "@cossistant/types";
|
|
14
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
15
|
+
|
|
16
|
+
//#region src/support/components/conversation-button-link.tsx
|
|
17
|
+
function getLastTimelineItemInfo(item, availableHumanAgents, website, text) {
|
|
18
|
+
const isFromVisitor = item.visitorId !== null;
|
|
19
|
+
let senderName = text("common.fallbacks.unknown");
|
|
20
|
+
let senderImage = null;
|
|
21
|
+
if (isFromVisitor) senderName = text("common.fallbacks.you");
|
|
22
|
+
else if (item.userId) {
|
|
23
|
+
const agent = availableHumanAgents.find((a) => a.id === item.userId);
|
|
24
|
+
if (agent) {
|
|
25
|
+
senderName = agent.name;
|
|
26
|
+
senderImage = agent.image;
|
|
27
|
+
} else senderName = text("common.fallbacks.supportTeam");
|
|
28
|
+
} else if (item.aiAgentId && website?.availableAIAgents) {
|
|
29
|
+
const aiAgent = website.availableAIAgents.find((a) => a.id === item.aiAgentId);
|
|
30
|
+
if (aiAgent) {
|
|
31
|
+
senderName = aiAgent.name;
|
|
32
|
+
senderImage = aiAgent.image;
|
|
33
|
+
} else senderName = text("common.fallbacks.aiAssistant");
|
|
34
|
+
} else senderName = text("common.fallbacks.supportTeam");
|
|
35
|
+
return {
|
|
36
|
+
content: item.text || "",
|
|
37
|
+
time: formatTimeAgo(item.createdAt),
|
|
38
|
+
isFromVisitor,
|
|
39
|
+
senderName,
|
|
40
|
+
senderImage
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function ConversationButtonLink({ conversation, onClick,...props }) {
|
|
44
|
+
const { availableHumanAgents, availableAIAgents, website, visitor } = useSupport();
|
|
45
|
+
const { items } = useConversationTimelineItems(conversation.id);
|
|
46
|
+
const text = useSupportText();
|
|
47
|
+
const typingEntries = useConversationTyping(conversation.id, { excludeVisitorId: visitor?.id ?? null });
|
|
48
|
+
const typingInfo = useMemo(() => {
|
|
49
|
+
if (typingEntries.length === 0) return null;
|
|
50
|
+
const entry = typingEntries[0];
|
|
51
|
+
let name = text("common.fallbacks.someone");
|
|
52
|
+
if (entry?.actorType === "user") {
|
|
53
|
+
const human = availableHumanAgents.find((agent) => agent.id === entry.actorId);
|
|
54
|
+
name = human?.name || text("common.fallbacks.supportTeam");
|
|
55
|
+
human?.image;
|
|
56
|
+
} else if (entry?.actorType === "ai_agent") {
|
|
57
|
+
const ai = availableAIAgents.find((agent) => agent.id === entry.actorId);
|
|
58
|
+
name = ai?.name || text("common.fallbacks.aiAssistant");
|
|
59
|
+
ai?.image;
|
|
60
|
+
}
|
|
61
|
+
return { name };
|
|
62
|
+
}, [
|
|
63
|
+
typingEntries,
|
|
64
|
+
availableHumanAgents,
|
|
65
|
+
availableAIAgents,
|
|
66
|
+
text
|
|
67
|
+
]);
|
|
68
|
+
const lastMessage = useMemo(() => {
|
|
69
|
+
const timelineItemToDisplay = (items.length > 0 ? items[items.length - 1] : null) || conversation.lastTimelineItem;
|
|
70
|
+
return timelineItemToDisplay ? getLastTimelineItemInfo(timelineItemToDisplay, availableHumanAgents, website, text) : null;
|
|
71
|
+
}, [
|
|
72
|
+
items,
|
|
73
|
+
conversation.lastTimelineItem,
|
|
74
|
+
availableHumanAgents,
|
|
75
|
+
website,
|
|
76
|
+
text
|
|
77
|
+
]);
|
|
78
|
+
const assignedAgent = useMemo(() => {
|
|
79
|
+
const supportFallbackName = text("common.fallbacks.supportTeam");
|
|
80
|
+
const aiFallbackName = text("common.fallbacks.aiAssistant");
|
|
81
|
+
const knownItems = items.slice();
|
|
82
|
+
if (conversation.lastTimelineItem && !knownItems.some((item) => item.id === conversation.lastTimelineItem?.id)) knownItems.push(conversation.lastTimelineItem);
|
|
83
|
+
const lastAgentItem = [...knownItems].reverse().find((item) => item.userId !== null || item.aiAgentId !== null);
|
|
84
|
+
if (lastAgentItem?.userId) {
|
|
85
|
+
const human = availableHumanAgents.find((agent) => agent.id === lastAgentItem.userId);
|
|
86
|
+
if (human) return {
|
|
87
|
+
type: "human",
|
|
88
|
+
name: human.name,
|
|
89
|
+
image: human.image ?? null
|
|
90
|
+
};
|
|
91
|
+
return {
|
|
92
|
+
type: "human",
|
|
93
|
+
name: supportFallbackName,
|
|
94
|
+
image: null
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
if (lastAgentItem?.aiAgentId) {
|
|
98
|
+
const ai = availableAIAgents.find((agent) => agent.id === lastAgentItem.aiAgentId);
|
|
99
|
+
if (ai) return {
|
|
100
|
+
type: "ai",
|
|
101
|
+
name: ai.name,
|
|
102
|
+
image: ai.image ?? null
|
|
103
|
+
};
|
|
104
|
+
return {
|
|
105
|
+
type: "ai",
|
|
106
|
+
name: aiFallbackName,
|
|
107
|
+
image: null
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
const fallbackHuman = availableHumanAgents[0];
|
|
111
|
+
if (fallbackHuman) return {
|
|
112
|
+
type: "human",
|
|
113
|
+
name: fallbackHuman.name,
|
|
114
|
+
image: fallbackHuman.image ?? null
|
|
115
|
+
};
|
|
116
|
+
const fallbackAi = availableAIAgents[0];
|
|
117
|
+
if (fallbackAi) return {
|
|
118
|
+
type: "ai",
|
|
119
|
+
name: fallbackAi.name,
|
|
120
|
+
image: fallbackAi.image ?? null
|
|
121
|
+
};
|
|
122
|
+
return {
|
|
123
|
+
type: "fallback",
|
|
124
|
+
name: supportFallbackName,
|
|
125
|
+
image: null
|
|
126
|
+
};
|
|
127
|
+
}, [
|
|
128
|
+
items,
|
|
129
|
+
conversation.lastTimelineItem,
|
|
130
|
+
availableHumanAgents,
|
|
131
|
+
availableAIAgents,
|
|
132
|
+
text
|
|
133
|
+
]);
|
|
134
|
+
const conversationTitle = useMemo(() => {
|
|
135
|
+
if (conversation.title) return conversation.title;
|
|
136
|
+
if (lastMessage?.content) return lastMessage.content;
|
|
137
|
+
return text("component.conversationButtonLink.fallbackTitle");
|
|
138
|
+
}, [
|
|
139
|
+
conversation.title,
|
|
140
|
+
lastMessage?.content,
|
|
141
|
+
text
|
|
142
|
+
]);
|
|
143
|
+
const state = {
|
|
144
|
+
conversation,
|
|
145
|
+
lastMessage,
|
|
146
|
+
assignedAgent
|
|
147
|
+
};
|
|
148
|
+
return useRenderElement("button", props, {
|
|
149
|
+
state,
|
|
150
|
+
props: {
|
|
151
|
+
onClick,
|
|
152
|
+
type: "button",
|
|
153
|
+
className: cn(coButtonVariants({
|
|
154
|
+
variant: "secondary",
|
|
155
|
+
size: "large"
|
|
156
|
+
}), "relative gap-3 border-0 border-co-border/50 border-b text-left transition-colors first-of-type:rounded-t last-of-type:rounded-b last-of-type:border-b-0", typeof props.className === "function" ? props.className(state) : props.className),
|
|
157
|
+
children: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
158
|
+
/* @__PURE__ */ jsx(Avatar, {
|
|
159
|
+
className: "size-8 flex-shrink-0",
|
|
160
|
+
image: assignedAgent.image,
|
|
161
|
+
name: assignedAgent.name
|
|
162
|
+
}),
|
|
163
|
+
/* @__PURE__ */ jsx("div", {
|
|
164
|
+
className: "flex min-w-0 flex-1 flex-col gap-0.5",
|
|
165
|
+
children: typingInfo ? /* @__PURE__ */ jsx(BouncingDots, {}) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
|
|
166
|
+
className: "flex max-w-[90%] items-center justify-between gap-2",
|
|
167
|
+
children: /* @__PURE__ */ jsx("h3", {
|
|
168
|
+
className: "truncate font-medium text-co-primary text-sm",
|
|
169
|
+
children: conversationTitle
|
|
170
|
+
})
|
|
171
|
+
}), lastMessage ? /* @__PURE__ */ jsx("p", {
|
|
172
|
+
className: "text-co-primary/60 text-xs",
|
|
173
|
+
children: lastMessage.isFromVisitor ? /* @__PURE__ */ jsx("span", { children: text("component.conversationButtonLink.lastMessage.visitor", { time: lastMessage.time }) }) : /* @__PURE__ */ jsx("span", { children: text("component.conversationButtonLink.lastMessage.agent", {
|
|
174
|
+
name: lastMessage.senderName || text("common.fallbacks.supportTeam"),
|
|
175
|
+
time: lastMessage.time
|
|
176
|
+
}) })
|
|
177
|
+
}) : null] })
|
|
178
|
+
}),
|
|
179
|
+
/* @__PURE__ */ jsx("div", {
|
|
180
|
+
className: cn("mr-6 inline-flex items-center rounded px-2 py-0.5 font-medium text-[9px] uppercase", conversation.status === ConversationStatus.OPEN ? "bg-co-success/20 text-co-success-foreground" : conversation.status === ConversationStatus.RESOLVED ? "bg-co-neutral/20 text-co-neutral-foreground" : "bg-co-warning/20 text-co-warning-foreground"),
|
|
181
|
+
children: conversation.status
|
|
182
|
+
}),
|
|
183
|
+
/* @__PURE__ */ jsx(icons_default, {
|
|
184
|
+
className: "-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",
|
|
185
|
+
name: "arrow-right",
|
|
186
|
+
variant: "default"
|
|
187
|
+
})
|
|
188
|
+
] })
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
//#endregion
|
|
194
|
+
export { ConversationButtonLink };
|
|
195
|
+
//# sourceMappingURL=conversation-button-link.js.map
|