@cossistant/react 0.0.4 → 0.0.5
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 +19 -0
- package/conversation.d.ts +26 -3
- 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 +11 -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 +17 -3
- package/realtime-events.d.ts.map +1 -1
- package/schemas.d.ts +7 -1
- 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/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,15 +1,20 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ReactElement } from "react";
|
|
2
2
|
|
|
3
3
|
//#region src/support/components/avatar.d.ts
|
|
4
|
+
type AvatarProps = {
|
|
5
|
+
className?: string;
|
|
6
|
+
image?: string | null;
|
|
7
|
+
name: string;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Renders a circular avatar with graceful fallbacks when no image is
|
|
11
|
+
* available.
|
|
12
|
+
*/
|
|
4
13
|
declare function Avatar({
|
|
5
14
|
className,
|
|
6
15
|
image,
|
|
7
16
|
name
|
|
8
|
-
}:
|
|
9
|
-
className?: string;
|
|
10
|
-
image?: string | null;
|
|
11
|
-
name: string;
|
|
12
|
-
}): react_jsx_runtime3.JSX.Element;
|
|
17
|
+
}: AvatarProps): ReactElement;
|
|
13
18
|
//#endregion
|
|
14
19
|
export { Avatar };
|
|
15
20
|
//# sourceMappingURL=avatar.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"avatar.d.ts","names":[],"sources":["../../../src/support/components/avatar.tsx"],"sourcesContent":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"avatar.d.ts","names":[],"sources":["../../../src/support/components/avatar.tsx"],"sourcesContent":[],"mappings":";;;KASK,WAAA;;EAAA,KAAA,CAAA,EAAA,MAAW,GAAA,IAAA;EAUA,IAAA,EAAA,MAAM;CAAG;;;;;AAAoD,iBAA7D,MAAA,CAA6D;EAAA,SAAA;EAAA,KAAA;EAAA;AAAA,CAAA,EAA1B,WAA0B,CAAA,EAAZ,YAAY"}
|
|
@@ -5,6 +5,10 @@ import { AvatarImage } from "../../primitives/avatar/image.js";
|
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
|
|
7
7
|
//#region src/support/components/avatar.tsx
|
|
8
|
+
/**
|
|
9
|
+
* Renders a circular avatar with graceful fallbacks when no image is
|
|
10
|
+
* available.
|
|
11
|
+
*/
|
|
8
12
|
function Avatar({ className, image, name }) {
|
|
9
13
|
return /* @__PURE__ */ jsxs(Avatar$1, {
|
|
10
14
|
className: cn("flex size-9 items-center justify-center overflow-clip rounded-full bg-co-background-200 dark:bg-co-background-500", className),
|
|
@@ -1 +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\
|
|
1
|
+
{"version":3,"file":"avatar.js","names":["AvatarPrimitive"],"sources":["../../../src/support/components/avatar.tsx"],"sourcesContent":["import type { ReactElement } from \"react\";\n\nimport {\n\tAvatarFallback,\n\tAvatarImage,\n\tAvatar as AvatarPrimitive,\n} from \"../../primitives/avatar\";\nimport { cn } from \"../utils\";\n\ntype AvatarProps = {\n\tclassName?: string;\n\timage?: string | null;\n\tname: string;\n};\n\n/**\n * Renders a circular avatar with graceful fallbacks when no image is\n * available.\n */\nexport function Avatar({ className, image, name }: AvatarProps): ReactElement {\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":";;;;;;;;;;;AAmBA,SAAgB,OAAO,EAAE,WAAW,OAAO,QAAmC;AAC7E,QACC,qBAACA;EACA,WAAW,GACV,qHACA,UACA;aAEA,SAAS,oBAAC;GAAY,KAAK;GAAM,KAAK;IAAS,EAChD,oBAAC;GAAe,WAAU;GAA4B;IAAQ;GAC7C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bubble.d.ts","names":[],"sources":["../../../src/support/components/bubble.tsx"],"sourcesContent":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"bubble.d.ts","names":[],"sources":["../../../src/support/components/bubble.tsx"],"sourcesContent":[],"mappings":";;;KASY,WAAA;;AAAZ,CAAA;AAIa,cAAA,MAAiB,EAAT,KAAA,CAAM,EAAG,CAAA,WAAD,CAAA"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
import { cn } from "../utils/index.js";
|
|
5
|
+
import { BouncingDots } from "./typing-indicator.js";
|
|
5
6
|
import { SupportBubble } from "../../primitives/bubble.js";
|
|
6
7
|
import icons_default from "./icons.js";
|
|
7
8
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -10,7 +11,7 @@ import { AnimatePresence, motion } from "motion/react";
|
|
|
10
11
|
//#region src/support/components/bubble.tsx
|
|
11
12
|
const Bubble = ({ className }) => /* @__PURE__ */ jsx(SupportBubble, {
|
|
12
13
|
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
|
+
children: ({ isOpen, unreadCount, isTyping }) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(AnimatePresence, {
|
|
14
15
|
mode: "wait",
|
|
15
16
|
children: isOpen ? /* @__PURE__ */ jsx(motion.div, {
|
|
16
17
|
animate: {
|
|
@@ -41,7 +42,30 @@ const Bubble = ({ className }) => /* @__PURE__ */ jsx(SupportBubble, {
|
|
|
41
42
|
className: "h-5 w-5",
|
|
42
43
|
name: "chevron-down"
|
|
43
44
|
})
|
|
44
|
-
}, "chevron") : /* @__PURE__ */ jsx(motion.
|
|
45
|
+
}, "chevron") : isTyping ? /* @__PURE__ */ jsx(motion.span, {
|
|
46
|
+
animate: {
|
|
47
|
+
opacity: 1,
|
|
48
|
+
scale: 1,
|
|
49
|
+
transition: {
|
|
50
|
+
duration: .2,
|
|
51
|
+
ease: "easeOut"
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
className: "pointer-events-none flex items-center rounded-full text-primary",
|
|
55
|
+
exit: {
|
|
56
|
+
opacity: 0,
|
|
57
|
+
scale: .9,
|
|
58
|
+
transition: {
|
|
59
|
+
duration: .1,
|
|
60
|
+
ease: "easeIn"
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
initial: {
|
|
64
|
+
opacity: 0,
|
|
65
|
+
scale: .9
|
|
66
|
+
},
|
|
67
|
+
children: /* @__PURE__ */ jsx(BouncingDots, { className: "bg-co-primary-foreground" })
|
|
68
|
+
}, "typing-indicator") : /* @__PURE__ */ jsx(motion.div, {
|
|
45
69
|
animate: {
|
|
46
70
|
scale: 1,
|
|
47
71
|
rotate: 0,
|
|
@@ -72,12 +96,12 @@ const Bubble = ({ className }) => /* @__PURE__ */ jsx(SupportBubble, {
|
|
|
72
96
|
variant: "filled"
|
|
73
97
|
})
|
|
74
98
|
}, "chat")
|
|
75
|
-
}), unreadCount > 0 && /* @__PURE__ */ jsx(motion.
|
|
99
|
+
}), unreadCount > 0 && /* @__PURE__ */ jsx(motion.div, {
|
|
76
100
|
animate: {
|
|
77
101
|
scale: 1,
|
|
78
102
|
opacity: 1
|
|
79
103
|
},
|
|
80
|
-
className: "-top-
|
|
104
|
+
className: "-top-0 -right-0 absolute flex h-3 w-3 items-center justify-center rounded-full bg-co-destructive font-medium text-[10px] text-co-destructive-foreground text-white text-xs",
|
|
81
105
|
exit: {
|
|
82
106
|
scale: 0,
|
|
83
107
|
opacity: 0
|
|
@@ -85,8 +109,7 @@ const Bubble = ({ className }) => /* @__PURE__ */ jsx(SupportBubble, {
|
|
|
85
109
|
initial: {
|
|
86
110
|
scale: 0,
|
|
87
111
|
opacity: 0
|
|
88
|
-
}
|
|
89
|
-
children: unreadCount
|
|
112
|
+
}
|
|
90
113
|
})] })
|
|
91
114
|
});
|
|
92
115
|
|
|
@@ -1 +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.
|
|
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\";\nimport { BouncingDots } from \"./typing-indicator\";\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, isTyping }) => (\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) : isTyping ? (\n\t\t\t\t\t\t<motion.span\n\t\t\t\t\t\t\tanimate={{\n\t\t\t\t\t\t\t\topacity: 1,\n\t\t\t\t\t\t\t\tscale: 1,\n\t\t\t\t\t\t\t\ttransition: {\n\t\t\t\t\t\t\t\t\tduration: 0.2,\n\t\t\t\t\t\t\t\t\tease: \"easeOut\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\tclassName=\"pointer-events-none flex items-center rounded-full text-primary\"\n\t\t\t\t\t\t\texit={{\n\t\t\t\t\t\t\t\topacity: 0,\n\t\t\t\t\t\t\t\tscale: 0.9,\n\t\t\t\t\t\t\t\ttransition: {\n\t\t\t\t\t\t\t\t\tduration: 0.1,\n\t\t\t\t\t\t\t\t\tease: \"easeIn\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\tinitial={{ opacity: 0, scale: 0.9 }}\n\t\t\t\t\t\t\tkey=\"typing-indicator\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<BouncingDots className=\"bg-co-primary-foreground\" />\n\t\t\t\t\t\t</motion.span>\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\n\t\t\t\t{unreadCount > 0 && (\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tanimate={{ scale: 1, opacity: 1 }}\n\t\t\t\t\t\tclassName=\"-top-0 -right-0 absolute flex h-3 w-3 items-center justify-center rounded-full bg-co-destructive font-medium text-[10px] text-co-destructive-foreground text-white 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)}\n\t\t\t</>\n\t\t)}\n\t</Primitive.Bubble>\n);\n"],"mappings":";;;;;;;;;;;AAaA,MAAaA,UAAiC,EAAE,gBAC/C,oBAACC;CACA,WAAW,GACV,qMACA,UACA;YAEC,EAAE,QAAQ,aAAa,eACxB,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,GACV,WACH,oBAAC,OAAO;GACP,SAAS;IACR,SAAS;IACT,OAAO;IACP,YAAY;KACX,UAAU;KACV,MAAM;KACN;IACD;GACD,WAAU;GACV,MAAM;IACL,SAAS;IACT,OAAO;IACP,YAAY;KACX,UAAU;KACV,MAAM;KACN;IACD;GACD,SAAS;IAAE,SAAS;IAAG,OAAO;IAAK;aAGnC,oBAAC,gBAAa,WAAU,6BAA6B;KAFjD,mBAGS,GAEd,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,EAEjB,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;GAChC,IAED;EAEc"}
|
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
import * as React$1 from "react";
|
|
2
|
-
import * as react_jsx_runtime5 from "react/jsx-runtime";
|
|
3
|
-
import * as class_variance_authority_types0 from "class-variance-authority/types";
|
|
4
2
|
import { VariantProps } from "class-variance-authority";
|
|
3
|
+
import * as class_variance_authority_dist_types0 from "class-variance-authority/dist/types";
|
|
5
4
|
|
|
6
5
|
//#region src/support/components/button.d.ts
|
|
7
6
|
declare const coButtonVariants: (props?: ({
|
|
8
|
-
variant?: "
|
|
7
|
+
variant?: "tab" | "default" | "secondary" | "ghost" | "outline" | "tab-selected" | null | undefined;
|
|
9
8
|
size?: "default" | "large" | "icon" | null | undefined;
|
|
10
|
-
} &
|
|
9
|
+
} & class_variance_authority_dist_types0.ClassProp) | undefined) => string;
|
|
11
10
|
type CossistantButtonProps = React$1.ComponentProps<"button"> & VariantProps<typeof coButtonVariants>;
|
|
11
|
+
/**
|
|
12
|
+
* Styled button primitive that forwards variant and size props to the shared
|
|
13
|
+
* design tokens.
|
|
14
|
+
*/
|
|
12
15
|
declare function Button({
|
|
13
16
|
className,
|
|
14
17
|
variant,
|
|
15
18
|
size,
|
|
16
19
|
...props
|
|
17
|
-
}: CossistantButtonProps):
|
|
20
|
+
}: CossistantButtonProps): React$1.ReactElement;
|
|
18
21
|
//#endregion
|
|
19
22
|
export { Button, CossistantButtonProps, coButtonVariants };
|
|
20
23
|
//# sourceMappingURL=button.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.d.ts","names":[],"sources":["../../../src/support/components/button.tsx"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"button.d.ts","names":[],"sources":["../../../src/support/components/button.tsx"],"sourcesContent":[],"mappings":";;;;;cAKa,wBA4BZ;;;AA5BD,CAAA,GA4BC,oCAAA,CAAA,SAAA,CAAA,GAAA,SAAA,EAAA,GAAA,MAAA;AAEW,KAAA,qBAAA,GAAwB,OAAA,CAAM,cAAT,CAAA,QAAA,CAAA,GAChC,YADgC,CAAA,OACZ,gBADY,CAAA;;;;;AAOjB,iBAAA,MAAA,CAAM;EAAA,SAAA;EAAA,OAAA;EAAA,IAAA;EAAA,GAAA;AAAA,CAAA,EAKnB,qBALmB,CAAA,EAKK,OAAA,CAAM,YALX"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { cn } from "../utils/index.js";
|
|
2
2
|
import { Button as Button$1 } from "../../primitives/button.js";
|
|
3
|
-
import { cva } from "../../node_modules/class-variance-authority/dist/index.js";
|
|
4
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
5
|
|
|
6
6
|
//#region src/support/components/button.tsx
|
|
7
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", {
|
|
@@ -25,6 +25,10 @@ const coButtonVariants = cva("group/btn inline-flex shrink-0 items-center justif
|
|
|
25
25
|
size: "default"
|
|
26
26
|
}
|
|
27
27
|
});
|
|
28
|
+
/**
|
|
29
|
+
* Styled button primitive that forwards variant and size props to the shared
|
|
30
|
+
* design tokens.
|
|
31
|
+
*/
|
|
28
32
|
function Button({ className, variant, size,...props }) {
|
|
29
33
|
return /* @__PURE__ */ jsx(Button$1, {
|
|
30
34
|
className: cn(coButtonVariants({
|
|
@@ -1 +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
|
|
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\n/**\n * Styled button primitive that forwards variant and size props to the shared\n * design tokens.\n */\nexport function Button({\n\tclassName,\n\tvariant,\n\tsize,\n\t...props\n}: CossistantButtonProps): React.ReactElement {\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;;;;;AASD,SAAgB,OAAO,EACtB,WACA,SACA,KACA,GAAG,SAC0C;AAC7C,QACC,oBAACA;EACA,WAAW,GAAG,iBAAiB;GAAE;GAAS;GAAM;GAAW,CAAC,CAAC;EAC7D,GAAI;GACH"}
|
|
@@ -1 +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;
|
|
1
|
+
{"version":3,"file":"container.d.ts","names":[],"sources":["../../../src/support/components/container.tsx"],"sourcesContent":[],"mappings":";;;KAQY,cAAA;;EAAA,QAAA,EAED,KAAA,CAAM,SAFS;EAOb,QAAA,CAAA,EAAA,KA6HZ,GAAA,QA7HgC;;;cAApB,WAAW,KAAA,CAAM,GAAG"}
|
|
@@ -8,7 +8,7 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
8
8
|
import { AnimatePresence, motion } from "motion/react";
|
|
9
9
|
|
|
10
10
|
//#region src/support/components/container.tsx
|
|
11
|
-
const Container = ({ className, children,
|
|
11
|
+
const Container = ({ className, children, position = "bottom", align = "right" }) => {
|
|
12
12
|
const [showScrollIndicator, setShowScrollIndicator] = useState(false);
|
|
13
13
|
const containerRef = useRef(null);
|
|
14
14
|
const checkScroll = useCallback(() => {
|
|
@@ -49,13 +49,7 @@ const Container = ({ className, children, mode = "floating", position = "bottom"
|
|
|
49
49
|
asChild: true,
|
|
50
50
|
children: /* @__PURE__ */ jsx(motion.div, {
|
|
51
51
|
animate: "visible",
|
|
52
|
-
className: cn("flex flex-col overflow-hidden overscroll-none bg-co-background
|
|
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),
|
|
52
|
+
className: cn("flex flex-col overflow-hidden overscroll-none bg-co-background max-md:fixed max-md:inset-0", "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", position === "bottom" && "md:bottom-16", position === "top" && "md:top-16", align === "right" && "md:right-0", align === "left" && "md:left-0", className),
|
|
59
53
|
exit: "exit",
|
|
60
54
|
initial: "hidden",
|
|
61
55
|
transition: {
|
|
@@ -1 +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\
|
|
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\tposition?: \"top\" | \"bottom\";\n\talign?: \"right\" | \"left\";\n};\n\nexport const Container: React.FC<ContainerProps> = ({\n\tclassName,\n\tchildren,\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 max-md:fixed max-md:inset-0\",\n\n\t\t\t\t\t// Desktop floating mode\n\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\tposition === \"bottom\" && \"md:bottom-16\",\n\t\t\t\t\tposition === \"top\" && \"md:top-16\",\n\t\t\t\t\talign === \"right\" && \"md:right-0\",\n\t\t\t\t\talign === \"left\" && \"md:left-0\",\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":";;;;;;;;;;AAeA,MAAaA,aAAuC,EACnD,WACA,UACA,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,8FAGA,2LACA,aAAa,YAAY,gBACzB,aAAa,SAAS,aACtB,UAAU,WAAW,cACrB,UAAU,UAAU,aAEpB,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"}
|
|
@@ -5,30 +5,17 @@ import { Conversation } from "@cossistant/types";
|
|
|
5
5
|
type ConversationButtonLinkProps = {
|
|
6
6
|
conversation: Conversation;
|
|
7
7
|
onClick?: () => void;
|
|
8
|
-
className?: 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;
|
|
8
|
+
className?: string;
|
|
26
9
|
};
|
|
10
|
+
/**
|
|
11
|
+
* Renders a navigable preview card for a conversation including assigned agent
|
|
12
|
+
* details, last message snippets and typing indicators.
|
|
13
|
+
*/
|
|
27
14
|
declare function ConversationButtonLink({
|
|
28
15
|
conversation,
|
|
29
16
|
onClick,
|
|
30
|
-
|
|
31
|
-
}: ConversationButtonLinkProps): React.ReactElement
|
|
17
|
+
className
|
|
18
|
+
}: ConversationButtonLinkProps): React.ReactElement | null;
|
|
32
19
|
//#endregion
|
|
33
|
-
export { ConversationButtonLink,
|
|
20
|
+
export { ConversationButtonLink, ConversationButtonLinkProps };
|
|
34
21
|
//# sourceMappingURL=conversation-button-link.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation-button-link.d.ts","names":[],"sources":["../../../src/support/components/conversation-button-link.tsx"],"sourcesContent":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"conversation-button-link.d.ts","names":[],"sources":["../../../src/support/components/conversation-button-link.tsx"],"sourcesContent":[],"mappings":";;;;KAUY,2BAAA;gBACG;EADH,OAAA,CAAA,EAAA,GAAA,GAAA,IAAA;EA0BI,SAAA,CAAA,EAAA,MAAA;CACf;;;;;AAGkD,iBAJnC,sBAAA,CAImC;EAAA,YAAA;EAAA,OAAA;EAAA;AAAA,CAAA,EAAhD,2BAAgD,CAAA,EAAlB,KAAA,CAAM,YAAY,GAAA,IAAA"}
|
|
@@ -1,192 +1,76 @@
|
|
|
1
1
|
import { cn } from "../utils/index.js";
|
|
2
|
-
import { useRenderElement } from "../../utils/use-render-element.js";
|
|
3
2
|
import { Avatar } from "./avatar.js";
|
|
4
3
|
import { BouncingDots } from "./typing-indicator.js";
|
|
5
4
|
import { coButtonVariants } from "./button.js";
|
|
6
5
|
import icons_default from "./icons.js";
|
|
7
6
|
import { useSupportText } from "../text/index.js";
|
|
8
|
-
import {
|
|
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";
|
|
7
|
+
import { useConversationPreview } from "../../hooks/use-conversation-preview.js";
|
|
13
8
|
import { ConversationStatus } from "@cossistant/types";
|
|
14
9
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
15
10
|
|
|
16
11
|
//#region src/support/components/conversation-button-link.tsx
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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);
|
|
12
|
+
const STATUS_BADGE_CLASSNAMES = {
|
|
13
|
+
[ConversationStatus.OPEN]: "bg-co-success/20 text-co-success-foreground",
|
|
14
|
+
[ConversationStatus.RESOLVED]: "bg-co-neutral/20 text-co-neutral-foreground",
|
|
15
|
+
[ConversationStatus.SPAM]: "bg-co-warning/20 text-co-warning-foreground"
|
|
16
|
+
};
|
|
17
|
+
const DEFAULT_STATUS_BADGE_CLASSNAME = "bg-co-neutral/20 text-co-neutral-foreground";
|
|
18
|
+
const STATUS_TEXT_KEYS = {
|
|
19
|
+
[ConversationStatus.OPEN]: "component.conversationButtonLink.status.open",
|
|
20
|
+
[ConversationStatus.RESOLVED]: "component.conversationButtonLink.status.resolved",
|
|
21
|
+
[ConversationStatus.SPAM]: "component.conversationButtonLink.status.spam"
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Renders a navigable preview card for a conversation including assigned agent
|
|
25
|
+
* details, last message snippets and typing indicators.
|
|
26
|
+
*/
|
|
27
|
+
function ConversationButtonLink({ conversation, onClick, className }) {
|
|
28
|
+
const preview = useConversationPreview({ conversation });
|
|
46
29
|
const text = useSupportText();
|
|
47
|
-
const
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
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
|
-
}
|
|
30
|
+
const { lastMessage, assignedAgent, typing } = preview;
|
|
31
|
+
const statusBadgeClassName = conversation.deletedAt ? STATUS_BADGE_CLASSNAMES[ConversationStatus.RESOLVED] : STATUS_BADGE_CLASSNAMES[conversation.status] ?? DEFAULT_STATUS_BADGE_CLASSNAME;
|
|
32
|
+
const statusTextKey = conversation.deletedAt ? STATUS_TEXT_KEYS[ConversationStatus.RESOLVED] : STATUS_TEXT_KEYS[conversation.status];
|
|
33
|
+
const statusText = conversation.deletedAt ? text("component.conversationButtonLink.status.closed") : statusTextKey ? text(statusTextKey) : text("common.fallbacks.unknown");
|
|
34
|
+
const lastMessageContent = lastMessage ? lastMessage.isFromVisitor ? /* @__PURE__ */ jsx("span", { children: text("component.conversationButtonLink.lastMessage.visitor", { time: lastMessage.time }) }) : /* @__PURE__ */ jsx("span", { children: text("component.conversationButtonLink.lastMessage.agent", {
|
|
35
|
+
name: lastMessage.senderName || text("common.fallbacks.supportTeam"),
|
|
36
|
+
time: lastMessage.time
|
|
37
|
+
}) }) : void 0;
|
|
38
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
39
|
+
className: cn(coButtonVariants({
|
|
40
|
+
variant: "secondary",
|
|
41
|
+
size: "large"
|
|
42
|
+
}), "group/btn 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", className),
|
|
43
|
+
onClick,
|
|
44
|
+
type: "button",
|
|
45
|
+
children: [
|
|
46
|
+
/* @__PURE__ */ jsx(Avatar, {
|
|
47
|
+
className: "flex size-8 flex-shrink-0 items-center justify-center overflow-clip rounded-full bg-co-background-200 dark:bg-co-background-500",
|
|
48
|
+
image: assignedAgent?.image,
|
|
49
|
+
name: assignedAgent?.name ?? text("common.fallbacks.supportTeam")
|
|
50
|
+
}),
|
|
51
|
+
/* @__PURE__ */ jsx("div", {
|
|
52
|
+
className: "flex min-w-0 flex-1 flex-col gap-0.5",
|
|
53
|
+
children: typing.isTyping ? /* @__PURE__ */ jsx(BouncingDots, {}) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
|
|
54
|
+
className: "flex max-w-[90%] items-center justify-between gap-2",
|
|
55
|
+
children: /* @__PURE__ */ jsx("h3", {
|
|
56
|
+
className: "truncate font-medium text-co-primary text-sm",
|
|
57
|
+
children: preview.title
|
|
58
|
+
})
|
|
59
|
+
}), lastMessageContent ? /* @__PURE__ */ jsx("p", {
|
|
60
|
+
className: "text-co-primary/60 text-xs",
|
|
61
|
+
children: lastMessageContent
|
|
62
|
+
}) : null] })
|
|
63
|
+
}),
|
|
64
|
+
/* @__PURE__ */ jsx("div", {
|
|
65
|
+
className: cn("mr-6 inline-flex items-center rounded px-2 py-0.5 font-medium text-[9px] uppercase", statusBadgeClassName),
|
|
66
|
+
children: statusText
|
|
67
|
+
}),
|
|
68
|
+
/* @__PURE__ */ jsx(icons_default, {
|
|
69
|
+
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",
|
|
70
|
+
name: "arrow-right",
|
|
71
|
+
variant: "default"
|
|
72
|
+
})
|
|
73
|
+
]
|
|
190
74
|
});
|
|
191
75
|
}
|
|
192
76
|
|