@clubmed/trident-ui 2.1.0-beta.3 → 2.1.0-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/README.md +1 -0
  2. package/chunks/ChatMessage.js +282 -265
  3. package/chunks/ChatMessage.js.map +1 -1
  4. package/examples/chat-body-demo.js +4 -2
  5. package/examples/chat-body-demo.js.map +1 -1
  6. package/examples/chat-button-demo.js +2 -1
  7. package/examples/chat-button-demo.js.map +1 -1
  8. package/examples/chat-button-offset-demo.js +2 -1
  9. package/examples/chat-button-offset-demo.js.map +1 -1
  10. package/examples/chat-header-demo.js +2 -1
  11. package/examples/chat-header-demo.js.map +1 -1
  12. package/examples/chat-input-demo.js +2 -1
  13. package/examples/chat-input-demo.js.map +1 -1
  14. package/examples/chat-input-streaming-demo.d.ts +1 -0
  15. package/examples/chat-input-streaming-demo.js +30 -0
  16. package/examples/chat-input-streaming-demo.js.map +1 -0
  17. package/examples/chat-input-submit-on-enter-demo.d.ts +1 -0
  18. package/examples/chat-input-submit-on-enter-demo.js +23 -0
  19. package/examples/chat-input-submit-on-enter-demo.js.map +1 -0
  20. package/examples/chat-message-actions-demo.d.ts +1 -0
  21. package/examples/chat-message-actions-demo.js +29 -0
  22. package/examples/chat-message-actions-demo.js.map +1 -0
  23. package/examples/chat-message-demo.js +1 -0
  24. package/examples/chat-message-demo.js.map +1 -1
  25. package/examples/chat-message-editor-demo.d.ts +1 -0
  26. package/examples/chat-message-editor-demo.js +30 -0
  27. package/examples/chat-message-editor-demo.js.map +1 -0
  28. package/examples/chat-message-with-actions-demo.d.ts +1 -0
  29. package/examples/chat-message-with-actions-demo.js +26 -0
  30. package/examples/chat-message-with-actions-demo.js.map +1 -0
  31. package/examples/chat-typing-indicator-demo.js +2 -1
  32. package/examples/chat-typing-indicator-demo.js.map +1 -1
  33. package/examples/chat-window-csat-demo.js +2 -1
  34. package/examples/chat-window-csat-demo.js.map +1 -1
  35. package/examples/chat-window-csat-prompt-demo.js +2 -1
  36. package/examples/chat-window-csat-prompt-demo.js.map +1 -1
  37. package/examples/chat-window-demo.js +2 -1
  38. package/examples/chat-window-demo.js.map +1 -1
  39. package/examples/chat-window-quote-demo.js +2 -1
  40. package/examples/chat-window-quote-demo.js.map +1 -1
  41. package/examples/chat-window-quotes-demo.js +2 -1
  42. package/examples/chat-window-quotes-demo.js.map +1 -1
  43. package/package.json +1 -1
  44. package/ui/ChatBody.d.ts +1 -25
  45. package/ui/ChatBody.js +2 -88
  46. package/ui/ChatButton.d.ts +1 -6
  47. package/ui/ChatButton.js +2 -33
  48. package/ui/ChatHeader.d.ts +1 -6
  49. package/ui/ChatHeader.js +2 -43
  50. package/ui/ChatInput.d.ts +1 -10
  51. package/ui/ChatInput.js +2 -148
  52. package/ui/ChatMessage.d.ts +1 -6
  53. package/ui/ChatMessage.js +1 -0
  54. package/ui/ChatTypingIndicator.d.ts +1 -2
  55. package/ui/ChatTypingIndicator.js +2 -30
  56. package/ui/ChatWindow.d.ts +1 -34
  57. package/ui/ChatWindow.js +2 -57
  58. package/ui/ChatWindowCsatPrompt.d.ts +1 -15
  59. package/ui/ChatWindowCsatPrompt.js +2 -70
  60. package/ui/ChatWindowCsatThankYou.d.ts +1 -9
  61. package/ui/ChatWindowCsatThankYou.js +2 -28
  62. package/ui/ChatWindowQuote.d.ts +1 -22
  63. package/ui/ChatWindowQuote.js +2 -140
  64. package/ui/chat/ChatBody.d.ts +31 -0
  65. package/ui/chat/ChatBody.js +92 -0
  66. package/ui/chat/ChatBody.js.map +1 -0
  67. package/ui/chat/ChatButton.d.ts +6 -0
  68. package/ui/chat/ChatButton.js +33 -0
  69. package/ui/chat/ChatButton.js.map +1 -0
  70. package/ui/chat/ChatHeader.d.ts +6 -0
  71. package/ui/chat/ChatHeader.js +43 -0
  72. package/ui/chat/ChatHeader.js.map +1 -0
  73. package/ui/chat/ChatInput.d.ts +28 -0
  74. package/ui/chat/ChatInput.js +165 -0
  75. package/ui/chat/ChatInput.js.map +1 -0
  76. package/ui/chat/ChatMessage.d.ts +17 -0
  77. package/ui/chat/ChatMessage.js +2 -0
  78. package/ui/chat/ChatMessageActions.d.ts +23 -0
  79. package/ui/chat/ChatMessageActions.js +69 -0
  80. package/ui/chat/ChatMessageActions.js.map +1 -0
  81. package/ui/chat/ChatMessageEditor.d.ts +9 -0
  82. package/ui/chat/ChatMessageEditor.js +57 -0
  83. package/ui/chat/ChatMessageEditor.js.map +1 -0
  84. package/ui/chat/ChatTypingIndicator.d.ts +2 -0
  85. package/ui/chat/ChatTypingIndicator.js +30 -0
  86. package/ui/chat/ChatTypingIndicator.js.map +1 -0
  87. package/ui/chat/ChatWindow.d.ts +37 -0
  88. package/ui/chat/ChatWindow.js +65 -0
  89. package/ui/chat/ChatWindow.js.map +1 -0
  90. package/ui/chat/ChatWindowCsatPrompt.d.ts +15 -0
  91. package/ui/chat/ChatWindowCsatPrompt.js +71 -0
  92. package/ui/chat/ChatWindowCsatPrompt.js.map +1 -0
  93. package/ui/chat/ChatWindowCsatThankYou.d.ts +9 -0
  94. package/ui/chat/ChatWindowCsatThankYou.js +29 -0
  95. package/ui/chat/ChatWindowCsatThankYou.js.map +1 -0
  96. package/ui/chat/ChatWindowQuote.d.ts +22 -0
  97. package/ui/chat/ChatWindowQuote.js +141 -0
  98. package/ui/chat/ChatWindowQuote.js.map +1 -0
  99. package/ui/ChatBody.js.map +0 -1
  100. package/ui/ChatButton.js.map +0 -1
  101. package/ui/ChatHeader.js.map +0 -1
  102. package/ui/ChatInput.js.map +0 -1
  103. package/ui/ChatTypingIndicator.js.map +0 -1
  104. package/ui/ChatWindow.js.map +0 -1
  105. package/ui/ChatWindowCsatPrompt.js.map +0 -1
  106. package/ui/ChatWindowCsatThankYou.js.map +0 -1
  107. package/ui/ChatWindowQuote.js.map +0 -1
package/ui/ChatButton.js CHANGED
@@ -1,33 +1,2 @@
1
- import { twMerge as e } from "./helpers/twMerge.js";
2
- import { jsx as t, jsxs as n } from "react/jsx-runtime";
3
- import { Icon as r } from "@clubmed/trident-icons";
4
- //#region lib/ui/ChatButton.tsx
5
- var i = "AI Agent: Have you got a question?", a = "Chat with your assistant";
6
- function o({ children: o = i, className: s, type: c = "button", "aria-label": l, tabIndex: u, offset: d, unfoldOn: f = "hover", ...p }) {
7
- let m = l ?? (typeof o == "string" && o.trim().length > 0 ? o.trim() : a);
8
- return /* @__PURE__ */ n("button", {
9
- type: c,
10
- "aria-label": m,
11
- tabIndex: u ?? 0,
12
- ...p,
13
- className: e("chat-border grid grid-cols-[24px_0fr] transition-[grid-template-columns] justify-center items-center overflow-hidden cursor-pointer transition-all rounded-pill px-8 md:px-16 outline-none group/Chatbutton focus-visible:ring-4 focus-visible:ring-black focus-visible:ring-offset-2 pointer-events-auto h-48 min-h-48 md:min-w-80 md:h-80 active:scale-[0.98]", d && "md:translate-x-[40px] focus-visible:translate-x-0", f === "hover" && "group/hoverChatbutton hover:grid-cols-[24px_1fr] hover:translate-x-0", f === "active" && "group/activeChatbutton active:grid-cols-[24px_1fr] active:translate-x-0", "focus-visible:grid-cols-[24px_1fr]", s),
14
- children: [/* @__PURE__ */ t(r, {
15
- name: "Sparkles",
16
- className: e("chat-button-icon w-24 transition-all", d && "relative md:start-[calc(-16px)] group-focus-visible/Chatbutton:start-0 group-hover/hoverChatbutton:start-0 group-active/activeChatbutton:start-0")
17
- }), /* @__PURE__ */ t("div", {
18
- className: "grid grid-cols-[0fr] overflow-hidden opacity-0 transition-opacity group-hover/hoverChatbutton:opacity-100 group-focus-visible/Chatbutton:opacity-100 group-active/activeChatbutton:opacity-100 duration-500",
19
- children: /* @__PURE__ */ n("span", {
20
- "aria-hidden": "true",
21
- className: "chat-button-text items-center ps-20 flex gap-10 whitespace-nowrap font-semibold text-b3 text-black",
22
- children: [o, /* @__PURE__ */ t(r, {
23
- name: "ArrowTailRight",
24
- width: "24px"
25
- })]
26
- })
27
- })]
28
- });
29
- }
30
- //#endregion
31
- export { o as ChatButton };
32
-
33
- //# sourceMappingURL=ChatButton.js.map
1
+ import { ChatButton as e } from "./chat/ChatButton.js";
2
+ export { e as ChatButton };
@@ -1,6 +1 @@
1
- import { ReactNode } from 'react';
2
- export interface ChatHeaderProps {
3
- title?: string;
4
- logo?: ReactNode;
5
- }
6
- export declare function ChatHeader({ title, logo }: ChatHeaderProps): import("react/jsx-runtime").JSX.Element;
1
+ export * from './chat/ChatHeader';
package/ui/ChatHeader.js CHANGED
@@ -1,43 +1,2 @@
1
- import { jsx as e, jsxs as t } from "react/jsx-runtime";
2
- import { Icon as n } from "@clubmed/trident-icons";
3
- //#region lib/ui/ChatHeader.tsx
4
- var r = /* @__PURE__ */ e("svg", {
5
- className: "absolute top-full inset-x-[50%] -translate-x-1/2",
6
- width: "118",
7
- height: "27",
8
- viewBox: "0 0 118 27",
9
- children: /* @__PURE__ */ e("path", {
10
- d: "M0 0C10.8283 0 21.1946 5.40419 28.7327 13.2062L30.2673 14.7945C45.991 31.0685 72.009 31.0685 87.7327 14.7945L89.2673 13.2062C96.8054 5.40419 107.172 0 118 0C118 0 80.6853 0 0 0Z",
11
- fill: "#F6EFE7"
12
- })
13
- });
14
- function i({ title: i = "Ask me a question", logo: a }) {
15
- return /* @__PURE__ */ t("div", {
16
- className: "relative flex flex-col items-center shrink-0 pt-4 px-4 h-118 overflow-hidden",
17
- children: [/* @__PURE__ */ e("div", {
18
- className: "absolute inset-x-4 top-4 h-87 bg-lightSand rounded-[24px]",
19
- children: r
20
- }), /* @__PURE__ */ t("div", {
21
- className: "relative flex flex-col flex-1 items-center justify-end pb-8 w-full z-10",
22
- children: [/* @__PURE__ */ e("div", {
23
- className: "flex items-center justify-center px-12 py-8 w-full",
24
- children: /* @__PURE__ */ e("p", {
25
- className: "font-serif font-bold italic text-h5 text-center text-black line-clamp-2",
26
- children: i
27
- })
28
- }), a ?? /* @__PURE__ */ e("button", {
29
- type: "button",
30
- "aria-label": "AI assistant",
31
- className: "chat-border flex items-center justify-center size-48 rounded-full bg-white outline-none focus-visible:ring-4 focus-visible:ring-black focus-visible:ring-offset-2",
32
- children: /* @__PURE__ */ e(n, {
33
- name: "Sparkles",
34
- width: "24px"
35
- })
36
- })]
37
- })]
38
- });
39
- }
40
- //#endregion
41
- export { i as ChatHeader };
42
-
43
- //# sourceMappingURL=ChatHeader.js.map
1
+ import { ChatHeader as e } from "./chat/ChatHeader.js";
2
+ export { e as ChatHeader };
package/ui/ChatInput.d.ts CHANGED
@@ -1,10 +1 @@
1
- import { FormHTMLAttributes } from 'react';
2
- export interface ChatInputProps extends FormHTMLAttributes<HTMLFormElement> {
3
- value: string;
4
- placeholder?: string;
5
- onValueChange: (value: string) => void;
6
- onSubmit: () => void;
7
- /** Fallback for when the browser does not support the Web Speech API */
8
- onAudioClick?: () => void;
9
- }
10
- export declare function ChatInput({ value, placeholder, onValueChange, onSubmit, onAudioClick, className, ...props }: ChatInputProps): import("react/jsx-runtime").JSX.Element;
1
+ export * from './chat/ChatInput';
package/ui/ChatInput.js CHANGED
@@ -1,149 +1,3 @@
1
1
  "use client";
2
- import { Button as e } from "./buttons/Button.js";
3
- import { twMerge as t } from "./helpers/twMerge.js";
4
- import { useEffect as n, useRef as r, useState as i } from "react";
5
- import { jsx as a, jsxs as o } from "react/jsx-runtime";
6
- //#region lib/ui/ChatInput.tsx
7
- var s = 12, c = 48, l = 8;
8
- function u(e) {
9
- let t = r(e);
10
- return n(() => {
11
- t.current = e;
12
- }), t;
13
- }
14
- var d = 3e3;
15
- function f(e) {
16
- let [t, a] = i(!1), [o, s] = i(!1), c = r(null), l = r(null), f = r(!1), p = u(e);
17
- function m() {
18
- l.current && clearTimeout(l.current);
19
- }
20
- function h() {
21
- m(), l.current = setTimeout(() => {
22
- f.current = !1, s(!1), c.current?.stop();
23
- }, d);
24
- }
25
- n(() => {
26
- let e = window.webkitSpeechRecognition ?? window.SpeechRecognition;
27
- if (!e) return;
28
- a(!0);
29
- let t = new e();
30
- return t.continuous = !0, t.interimResults = !0, t.lang = navigator.language, t.onresult = (e) => {
31
- let t = Array.from(e.results).map((e) => e[0].transcript).join("");
32
- p.current(t), h();
33
- }, t.onend = () => {
34
- if (m(), f.current) try {
35
- t.start();
36
- } catch {}
37
- else s(!1);
38
- }, t.onerror = (e) => {
39
- (e.error === "not-allowed" || e.error === "aborted") && (f.current = !1, s(!1), m());
40
- }, c.current = t, () => {
41
- t.abort(), m();
42
- };
43
- }, []);
44
- function g() {
45
- let e = c.current;
46
- e && (f.current ? (f.current = !1, e.stop()) : (f.current = !0, s(!0), e.start(), h()));
47
- }
48
- return {
49
- isSupported: t,
50
- isListening: o,
51
- toggle: g
52
- };
53
- }
54
- function p(e) {
55
- let t = r(null);
56
- return n(() => {
57
- let n = t.current;
58
- if (!e) {
59
- n && (n.style.height = "0px");
60
- return;
61
- }
62
- let r, i = null, a = null;
63
- return navigator.mediaDevices.getUserMedia({
64
- audio: !0,
65
- video: !1
66
- }).then((e) => {
67
- i = e, a = new AudioContext();
68
- let n = a.createMediaStreamSource(i), o = a.createAnalyser();
69
- o.fftSize = 256, n.connect(o);
70
- let s = new Uint8Array(o.frequencyBinCount);
71
- function c() {
72
- o.getByteFrequencyData(s);
73
- let e = s.reduce((e, t) => e + t, 0) / s.length, n = t.current;
74
- n && (n.style.height = `${Math.sqrt(e / 255) * 10}px`), r = requestAnimationFrame(c);
75
- }
76
- r = requestAnimationFrame(c);
77
- }), () => {
78
- cancelAnimationFrame(r), i?.getTracks().forEach((e) => e.stop()), a?.close();
79
- };
80
- }, [e]), t;
81
- }
82
- function m({ value: n, placeholder: r = "Ask a question?", onValueChange: u, onSubmit: d, onAudioClick: m, className: h, ...g }) {
83
- let [_, v] = i(!1), y = n.trim(), b = _ || y.length > 0, { isSupported: x, isListening: S, toggle: C } = f(u), w = p(S), T = x || !!m, E = T ? c + l + c : c;
84
- function D() {
85
- x ? C() : m?.();
86
- }
87
- function O(e) {
88
- e.preventDefault(), y && d();
89
- }
90
- return /* @__PURE__ */ o("form", {
91
- onSubmit: O,
92
- onMouseDown: (e) => {
93
- e.target.tagName !== "TEXTAREA" && e.preventDefault();
94
- },
95
- ...g,
96
- style: { paddingBottom: b ? s + l + c : s },
97
- className: t("relative flex items-start overflow-hidden bg-white border border-lightGrey p-12 w-full", "transition-[padding-bottom,border-radius] duration-250 ease-out rounded-b-[24px]", b ? "rounded-32" : "rounded-[40px]", h),
98
- children: [/* @__PURE__ */ a("textarea", {
99
- rows: b ? 3 : 1,
100
- value: n,
101
- onChange: (e) => u(e.target.value),
102
- onKeyDown: (e) => {
103
- e.key === "Enter" && (e.metaKey || e.ctrlKey) && y && (e.preventDefault(), d());
104
- },
105
- onFocus: () => v(!0),
106
- onBlur: () => v(!1),
107
- placeholder: r,
108
- "aria-label": r,
109
- style: { marginInlineEnd: b ? 0 : E + l },
110
- className: t("scrollbar-hidden bg-transparent text-b3 py-12 outline-none focus-visible:ring-4 focus-visible:ring-black focus-visible:ring-offset-2 resize-none w-full px-20 border border-middleGrey", "transition-[margin-inline-end,border-radius] duration-250 ease-out", b ? "text-black rounded-[20px]" : "text-darkGrey placeholder:text-darkGrey rounded-[40px]")
111
- }), /* @__PURE__ */ o("div", {
112
- style: {
113
- insetInlineStart: b ? `calc(50% - ${E / 2}px)` : `calc(100% - ${s + E}px)`,
114
- bottom: s
115
- },
116
- className: "absolute flex gap-8 items-center transition-[inset-inline-start] duration-250 ease-out",
117
- children: [/* @__PURE__ */ a(e, {
118
- type: "submit",
119
- "aria-label": "Send message",
120
- disabled: !y,
121
- variant: "circle",
122
- color: "saffron",
123
- icon: "ArrowTailRight",
124
- iconWidth: "24px"
125
- }), T && /* @__PURE__ */ a(e, {
126
- type: "button",
127
- "aria-label": S ? "Stop recording" : "Use microphone",
128
- "aria-pressed": S,
129
- onClick: D,
130
- variant: "circle",
131
- theme: S ? "solid" : "outline",
132
- color: S ? "sienna" : "black",
133
- icon: "Audio",
134
- iconWidth: "24px",
135
- className: t("relative", S && "animate-pulse", !S && "border-lightGrey"),
136
- children: /* @__PURE__ */ a("span", {
137
- ref: w,
138
- "aria-hidden": "true",
139
- className: "bg-current absolute w-5 bottom-21",
140
- style: { height: "0px" }
141
- })
142
- })]
143
- })]
144
- });
145
- }
146
- //#endregion
147
- export { m as ChatInput };
148
-
149
- //# sourceMappingURL=ChatInput.js.map
2
+ import { ChatInput as e } from "./chat/ChatInput.js";
3
+ export { e as ChatInput };
@@ -1,6 +1 @@
1
- import { HTMLAttributes, PropsWithChildren } from 'react';
2
- export type ChatMessageSender = 'assistant' | 'user';
3
- export interface ChatMessageProps extends HTMLAttributes<HTMLDivElement> {
4
- sender: ChatMessageSender;
5
- }
6
- export declare const ChatMessage: import('react').NamedExoticComponent<PropsWithChildren<ChatMessageProps>>;
1
+ export * from './chat/ChatMessage';
package/ui/ChatMessage.js CHANGED
@@ -1,2 +1,3 @@
1
+ "use client";
1
2
  import { t as e } from "../chunks/ChatMessage.js";
2
3
  export { e as ChatMessage };
@@ -1,2 +1 @@
1
- import { HTMLAttributes } from 'react';
2
- export declare const ChatTypingIndicator: import('react').NamedExoticComponent<HTMLAttributes<HTMLDivElement>>;
1
+ export * from './chat/ChatTypingIndicator';
@@ -1,30 +1,2 @@
1
- import { twMerge as e } from "./helpers/twMerge.js";
2
- import { memo as t } from "react";
3
- import { jsx as n, jsxs as r } from "react/jsx-runtime";
4
- //#region lib/ui/ChatTypingIndicator.tsx
5
- var i = t(function({ className: t, ...i }) {
6
- return /* @__PURE__ */ r("div", {
7
- role: "status",
8
- "aria-label": "Typing",
9
- ...i,
10
- className: e("flex items-center gap-4 h-34 w-66 overflow-hidden rounded-pill bg-pearl px-20", t),
11
- children: [
12
- /* @__PURE__ */ n("span", {
13
- "aria-hidden": "true",
14
- className: "size-6 rounded-full bg-black animate-bounce [animation-delay:-300ms]"
15
- }),
16
- /* @__PURE__ */ n("span", {
17
- "aria-hidden": "true",
18
- className: "size-6 rounded-full bg-black animate-bounce [animation-delay:-150ms]"
19
- }),
20
- /* @__PURE__ */ n("span", {
21
- "aria-hidden": "true",
22
- className: "size-6 rounded-full bg-black animate-bounce"
23
- })
24
- ]
25
- });
26
- });
27
- //#endregion
28
- export { i as ChatTypingIndicator };
29
-
30
- //# sourceMappingURL=ChatTypingIndicator.js.map
1
+ import { ChatTypingIndicator as e } from "./chat/ChatTypingIndicator.js";
2
+ export { e as ChatTypingIndicator };
@@ -1,34 +1 @@
1
- import { ReactNode } from 'react';
2
- import { ChatMessageSender } from './ChatMessage';
3
- import { ChatWindowCsatPromptLabels } from './ChatWindowCsatPrompt';
4
- import { ChatWindowCsatThankYouLabels } from './ChatWindowCsatThankYou';
5
- import { ChatWindowQuoteItem } from './ChatWindowQuote';
6
- import { ChatHeaderProps } from './ChatHeader';
7
- import { ChatBodyProps } from './ChatBody';
8
- import { ChatInputProps } from './ChatInput';
9
- export type { ChatWindowCsatPromptLabels, ChatWindowCsatThankYouLabels, ChatWindowQuoteItem };
10
- export interface ChatWindowMessage {
11
- id: string;
12
- sender: ChatMessageSender;
13
- content: ReactNode;
14
- }
15
- interface ChatWindowInputProps {
16
- inputValue: ChatInputProps['value'];
17
- inputPlaceholder?: ChatInputProps['placeholder'];
18
- onInputChange: ChatInputProps['onValueChange'];
19
- onSubmit: ChatInputProps['onSubmit'];
20
- onAudioClick?: ChatInputProps['onAudioClick'];
21
- }
22
- interface ChatWindowBaseProps extends ChatHeaderProps {
23
- onClose?: () => void;
24
- }
25
- export type ChatWindowProps = ChatWindowBaseProps & (({
26
- children: ReactNode;
27
- } & Partial<ChatBodyProps> & Partial<ChatWindowInputProps>) | (ChatBodyProps & ChatWindowInputProps & {
28
- children?: undefined;
29
- }));
30
- export interface ChatWindowHandle {
31
- askForFeedback: () => void;
32
- showQuotes: (quotes: ChatWindowQuoteItem[]) => void;
33
- }
34
- export declare const ChatWindow: import('react').ForwardRefExoticComponent<ChatWindowProps & import('react').RefAttributes<ChatWindowHandle>>;
1
+ export * from './chat/ChatWindow';
package/ui/ChatWindow.js CHANGED
@@ -1,58 +1,3 @@
1
1
  "use client";
2
- import { twMerge as e } from "./helpers/twMerge.js";
3
- import { ChatBody as t } from "./ChatBody.js";
4
- import { ChatInput as n } from "./ChatInput.js";
5
- import { ChatHeader as r } from "./ChatHeader.js";
6
- import { forwardRef as i } from "react";
7
- import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
8
- import { Icon as c } from "@clubmed/trident-icons";
9
- //#region lib/ui/ChatWindow.tsx
10
- var l = i(function({ title: i, onClose: l, logo: u, className: d, children: f, inputValue: p, inputPlaceholder: m, onInputChange: h, onSubmit: g, onAudioClick: _, greeting: v, messages: y, isTyping: b, onFeedbackRate: x, csatLabels: S, csatRenderRatingLabel: C, csatThankYouLabels: w, onQuoteCtaClick: T, ...E }, D) {
11
- return /* @__PURE__ */ s("div", {
12
- ...E,
13
- className: e("flex flex-col gap-20 items-center", d),
14
- children: [/* @__PURE__ */ o("div", {
15
- className: "chat-border bg-white flex flex-col h-full w-full rounded-32 overflow-hidden",
16
- children: f ?? /* @__PURE__ */ s(a, { children: [
17
- /* @__PURE__ */ o(r, {
18
- title: i,
19
- logo: u
20
- }),
21
- /* @__PURE__ */ o(t, {
22
- greeting: v,
23
- messages: y,
24
- isTyping: b,
25
- onFeedbackRate: x,
26
- csatLabels: S,
27
- csatRenderRatingLabel: C,
28
- csatThankYouLabels: w,
29
- onQuoteCtaClick: T,
30
- ref: D
31
- }),
32
- /* @__PURE__ */ o("div", {
33
- className: "shrink-0 px-8 pb-8 pt-12",
34
- children: /* @__PURE__ */ o(n, {
35
- value: p,
36
- placeholder: m,
37
- onValueChange: h,
38
- onSubmit: g,
39
- onAudioClick: _
40
- })
41
- })
42
- ] })
43
- }), l && /* @__PURE__ */ o("button", {
44
- type: "button",
45
- "aria-label": "Close chat",
46
- onClick: l,
47
- className: "flex items-center justify-center size-48 rounded-full bg-black border border-black text-white shrink-0 hover:opacity-80 transition-opacity outline-none focus-visible:ring-4 focus-visible:ring-black focus-visible:ring-offset-2",
48
- children: /* @__PURE__ */ o(c, {
49
- name: "CrossDefault",
50
- width: "24px"
51
- })
52
- })]
53
- });
54
- });
55
- //#endregion
56
- export { l as ChatWindow };
57
-
58
- //# sourceMappingURL=ChatWindow.js.map
2
+ import { ChatWindow as e } from "./chat/ChatWindow.js";
3
+ export { e as ChatWindow };
@@ -1,15 +1 @@
1
- import { ReactNode } from 'react';
2
- export interface ChatWindowCsatPromptLabels {
3
- intro: string;
4
- question: string;
5
- questionNote: string;
6
- groupAriaLabel: string;
7
- starLabels: [string, string, string, string, string];
8
- }
9
- export interface ChatWindowCsatPromptProps {
10
- onRate: (rating: number) => void;
11
- labels: ChatWindowCsatPromptLabels;
12
- renderRatingLabel: (rating: number) => ReactNode;
13
- className?: string;
14
- }
15
- export declare function ChatWindowCsatPrompt({ onRate, labels, renderRatingLabel, className, }: ChatWindowCsatPromptProps): import("react/jsx-runtime").JSX.Element;
1
+ export * from './chat/ChatWindowCsatPrompt';
@@ -1,71 +1,3 @@
1
1
  "use client";
2
- import { twMerge as e } from "./helpers/twMerge.js";
3
- import { useState as t } from "react";
4
- import { jsx as n, jsxs as r } from "react/jsx-runtime";
5
- import { Icon as i } from "@clubmed/trident-icons";
6
- //#region lib/ui/ChatWindowCsatPrompt.tsx
7
- function a({ onRate: a, labels: o, renderRatingLabel: s, className: c }) {
8
- let [l, u] = t(0), [d, f] = t(0);
9
- function p(e) {
10
- d > 0 || (f(e), a(e));
11
- }
12
- let m = l || d, h = d > 0;
13
- return /* @__PURE__ */ r("div", {
14
- className: e("flex flex-col gap-20 px-20", c),
15
- children: [
16
- /* @__PURE__ */ r("div", {
17
- className: "flex flex-col gap-4",
18
- children: [/* @__PURE__ */ n("p", {
19
- className: "text-b3 text-black",
20
- children: o.intro
21
- }), /* @__PURE__ */ r("p", {
22
- className: "text-b3 text-black",
23
- children: [
24
- o.question,
25
- " ",
26
- /* @__PURE__ */ n("span", {
27
- className: "text-b4 text-black",
28
- children: o.questionNote
29
- })
30
- ]
31
- })]
32
- }),
33
- /* @__PURE__ */ n("div", {
34
- role: "group",
35
- "aria-label": o.groupAriaLabel,
36
- className: "flex items-center gap-0",
37
- children: o.starLabels.map((t, r) => {
38
- let a = r + 1, o = a <= m;
39
- return /* @__PURE__ */ n("button", {
40
- type: "button",
41
- "aria-label": `${a} star${a > 1 ? "s" : ""} — ${t}`,
42
- "aria-pressed": d === a,
43
- "aria-disabled": h,
44
- onClick: () => p(a),
45
- onMouseEnter: () => {
46
- h || u(a);
47
- },
48
- onMouseLeave: () => {
49
- h || u(0);
50
- },
51
- className: e("flex items-center justify-center size-48 rounded-full transition-colors outline-none focus-visible:ring-4 focus-visible:ring-black focus-visible:ring-offset-2", h ? "cursor-default" : "hover:bg-lightSand"),
52
- children: /* @__PURE__ */ n(i, {
53
- name: o ? "StarFilled" : "StarOutlined",
54
- width: "24px",
55
- className: "text-black"
56
- })
57
- }, a);
58
- })
59
- }),
60
- m > 0 && /* @__PURE__ */ n("p", {
61
- className: "text-b4 text-darkGrey",
62
- "aria-live": "polite",
63
- children: s(m)
64
- })
65
- ]
66
- });
67
- }
68
- //#endregion
69
- export { a as ChatWindowCsatPrompt };
70
-
71
- //# sourceMappingURL=ChatWindowCsatPrompt.js.map
2
+ import { ChatWindowCsatPrompt as e } from "./chat/ChatWindowCsatPrompt.js";
3
+ export { e as ChatWindowCsatPrompt };
@@ -1,9 +1 @@
1
- import { HTMLAttributes } from 'react';
2
- export interface ChatWindowCsatThankYouLabels {
3
- title: string;
4
- body: string;
5
- }
6
- export interface ChatWindowCsatThankYouProps extends HTMLAttributes<HTMLDivElement> {
7
- labels: ChatWindowCsatThankYouLabels;
8
- }
9
- export declare function ChatWindowCsatThankYou({ labels, className, ...props }: ChatWindowCsatThankYouProps): import("react/jsx-runtime").JSX.Element;
1
+ export * from './chat/ChatWindowCsatThankYou';
@@ -1,29 +1,3 @@
1
1
  "use client";
2
- import { twMerge as e } from "./helpers/twMerge.js";
3
- import { jsx as t, jsxs as n } from "react/jsx-runtime";
4
- import { Icon as r } from "@clubmed/trident-icons";
5
- //#region lib/ui/ChatWindowCsatThankYou.tsx
6
- function i({ labels: i, className: a, ...o }) {
7
- return /* @__PURE__ */ n("div", {
8
- ...o,
9
- className: e("flex flex-col gap-20 px-20", a),
10
- children: [/* @__PURE__ */ n("div", {
11
- className: "flex items-center gap-4 text-green",
12
- children: [/* @__PURE__ */ t(r, {
13
- name: "CheckFilled",
14
- width: "24px",
15
- className: "shrink-0"
16
- }), /* @__PURE__ */ t("p", {
17
- className: "text-b3 font-semibold text-black",
18
- children: i.title
19
- })]
20
- }), /* @__PURE__ */ t("p", {
21
- className: "text-b3 text-black",
22
- children: i.body
23
- })]
24
- });
25
- }
26
- //#endregion
27
- export { i as ChatWindowCsatThankYou };
28
-
29
- //# sourceMappingURL=ChatWindowCsatThankYou.js.map
2
+ import { ChatWindowCsatThankYou as e } from "./chat/ChatWindowCsatThankYou.js";
3
+ export { e as ChatWindowCsatThankYou };
@@ -1,22 +1 @@
1
- export interface ChatWindowQuoteItem {
2
- id: string;
3
- resortName: string;
4
- country: string;
5
- imageUrl: string;
6
- /** Date range, e.g. "15 June 2026 to 24 June 2026" */
7
- dateRange: string;
8
- /** Pax info, e.g. "for 2 adults 2 children" */
9
- pax: string;
10
- /** CTA button label. Defaults to "See prices" */
11
- ctaLabel?: string;
12
- /** Bullet-point package items. Shown in single-quote inline mode only */
13
- packageIncludes?: string[];
14
- /** Free-text paragraph shown in single-quote inline mode only */
15
- additionalInfo?: string;
16
- }
17
- export interface ChatWindowQuoteProps {
18
- quotes: ChatWindowQuoteItem[];
19
- onCtaClick?: (quote: ChatWindowQuoteItem) => void;
20
- className?: string;
21
- }
22
- export declare function ChatWindowQuote({ quotes, onCtaClick, className }: ChatWindowQuoteProps): import("react/jsx-runtime").JSX.Element | null;
1
+ export * from './chat/ChatWindowQuote';