goji-search 1.1.3 → 2.0.0

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 (26) hide show
  1. package/dist/goji-search/assets/avatar1.jpeg +0 -0
  2. package/dist/goji-search/assets/avatar2.jpeg +0 -0
  3. package/dist/goji-search/assets/avatar3.jpeg +0 -0
  4. package/dist/goji-search/assets/chat-logo.png +0 -0
  5. package/dist/goji-search/components/elements/closing-card.d.ts +20 -0
  6. package/dist/goji-search/components/elements/inspiration-menu.d.ts +3 -1
  7. package/dist/goji-search/components/elements/language-selector.d.ts +10 -0
  8. package/dist/goji-search/components/elements/message-list.d.ts +3 -1
  9. package/dist/goji-search/components/elements/search-input.d.ts +3 -1
  10. package/dist/goji-search/components/goji-search-component.d.ts +21 -2
  11. package/dist/goji-search/hooks/useCompanyTheme.d.ts +21 -0
  12. package/dist/goji-search/lib/goji-client.d.ts +24 -4
  13. package/dist/index.js +11767 -4
  14. package/package.json +20 -17
  15. package/dist/goji-search/components/elements/action-buttons.js +0 -164
  16. package/dist/goji-search/components/elements/auto-expanding-textarea.js +0 -46
  17. package/dist/goji-search/components/elements/calendar-integration.js +0 -49
  18. package/dist/goji-search/components/elements/inspiration-menu.js +0 -87
  19. package/dist/goji-search/components/elements/message-list.js +0 -301
  20. package/dist/goji-search/components/elements/search-input.js +0 -136
  21. package/dist/goji-search/components/elements/suggested-questions.js +0 -57
  22. package/dist/goji-search/components/goji-search-component.js +0 -679
  23. package/dist/goji-search/components/goji-search.css +0 -1
  24. package/dist/goji-search/config/company.js +0 -100
  25. package/dist/goji-search/lib/calendar-config.js +0 -10
  26. package/dist/goji-search/lib/goji-client.js +0 -229
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "goji-search",
3
- "version": "1.1.3",
3
+ "version": "2.0.0",
4
4
  "description": "Embeddable GojiSearch components for both React and vanilla JS",
5
5
  "private": false,
6
6
  "type": "module",
@@ -13,34 +13,37 @@
13
13
  "exports": {
14
14
  ".": {
15
15
  "types": "./dist/index.d.ts",
16
- "import": "./dist/index.js"
17
- }
16
+ "import": "./dist/index.js",
17
+ "default": "./dist/index.js"
18
+ },
19
+ "./dist/*": "./dist/*",
20
+ "./*": "./*"
18
21
  },
19
22
  "scripts": {
20
23
  "dev": "vite",
21
- "build": "tsc && vite build && npx tsc && mv dist/goji-search.css dist/goji-search/components/goji-search.css",
22
- "dev-pack": "tsc && vite build && npx tsc && cp dist/goji-search.css dist/goji-search/components/goji-search.css && cp -r src/goji-search/assets dist/goji-search/ && npm pack",
24
+ "build": "vite build && tsc --emitDeclarationOnly && cp -r src/goji-search/assets dist/goji-search/",
25
+ "dev-pack": "vite build && tsc --emitDeclarationOnly && cp -r src/goji-search/assets dist/goji-search/ && npm pack",
23
26
  "lint": "eslint ."
24
27
  },
25
28
  "peerDependencies": {
26
- "react": "^18.0.0 || ^19.0.0",
27
- "react-dom": "^18.0.0 || ^19.0.0"
29
+ "react": "^19.2.3",
30
+ "react-dom": "^19.2.3"
28
31
  },
29
32
  "devDependencies": {
30
- "@eslint/js": "^8.57.0",
31
- "@types/node": "^20.12.0",
32
- "@types/react": "^18.2.56",
33
- "@types/react-dom": "^18.2.19",
34
- "@vitejs/plugin-react": "^4.2.1",
35
- "eslint": "^8.57.0",
36
- "eslint-plugin-react-hooks": "^4.6.0",
37
- "eslint-plugin-react-refresh": "^0.4.5",
38
- "typescript": "^5.4.5",
33
+ "@eslint/js": "^9.39.2",
34
+ "@types/node": "^25.0.3",
35
+ "@types/react": "^19.2.7",
36
+ "@types/react-dom": "^19.2.3",
37
+ "@vitejs/plugin-react": "^5.1.2",
38
+ "eslint": "^9.39.2",
39
+ "eslint-plugin-react-hooks": "^7.0.1",
40
+ "eslint-plugin-react-refresh": "^0.4.26",
41
+ "typescript": "^5.9.3",
39
42
  "vite": "^7.1.9"
40
43
  },
41
44
  "dependencies": {
42
45
  "@calcom/embed-react": "^1.5.3",
43
- "lucide-react": "^0.545.0",
46
+ "lucide-react": "^0.562.0",
44
47
  "react-markdown": "^10.1.0",
45
48
  "remark-gfm": "^4.0.1"
46
49
  }
@@ -1,164 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { Mic, Calendar, ArrowUp } from "lucide-react";
3
- import { useState, useId } from "react";
4
- export function ActionButtons({ size, isHovered, isStreaming, searchQuery, isRecording = false, onSubmit, onVoiceSearch, onClose, onCalendarClick, // Added calendar click handler
5
- }) {
6
- if (size !== "m" && size !== "l" && size !== "xl")
7
- return null;
8
- // tooltip hover/focus states
9
- const [hoverCalendar, setHoverCalendar] = useState(false);
10
- const [hoverSubmit, setHoverSubmit] = useState(false);
11
- const [hoverVoice, setHoverVoice] = useState(false);
12
- // base id for accessibility
13
- const idBase = useId();
14
- const calendarTooltipId = `${idBase}-calendar-tip`;
15
- const submitTooltipId = `${idBase}-submit-tip`;
16
- const voiceTooltipId = `${idBase}-voice-tip`;
17
- return (_jsxs(_Fragment, { children: [_jsxs("div", { style: { position: "relative", display: "inline-block", marginLeft: "0.25rem" }, onMouseEnter: () => setHoverSubmit(true), onMouseLeave: () => setHoverSubmit(false), children: [_jsx("button", { type: "submit", disabled: isStreaming, onClick: onSubmit, "aria-describedby": hoverSubmit ? submitTooltipId : undefined, onFocus: () => setHoverSubmit(true), onBlur: () => setHoverSubmit(false), style: {
18
- borderRadius: "1.3rem",
19
- border: "1px solid rgba(255, 255, 255, 0.3)",
20
- backgroundColor: "rgba(255, 255, 255, 0.2)",
21
- padding: size === "l" || size === "xl" ? "0.5rem" : "0.3rem",
22
- display: "flex",
23
- alignItems: "center",
24
- justifyContent: "center",
25
- color: "rgba(0, 0, 0, 0.75)",
26
- backdropFilter: "blur(20px)",
27
- WebkitBackdropFilter: "blur(20px)",
28
- transition: "all 0.2s",
29
- cursor: isStreaming ? "not-allowed" : "pointer",
30
- outline: "none",
31
- opacity: isStreaming ? 0.5 : size === "m" && !isHovered ? 0.7 : 1,
32
- boxShadow: "inset 0 1px 0 rgba(255, 255, 255, 0.3)",
33
- }, children: _jsx(ArrowUp, { style: {
34
- width: size === "l" || size === "xl" ? "1rem" : "0.875rem",
35
- height: size === "l" || size === "xl" ? "1rem" : "0.875rem",
36
- } }) }), _jsx("span", { id: submitTooltipId, role: "tooltip", style: {
37
- position: "absolute",
38
- top: "calc(100% + 0.4rem)",
39
- left: "50%",
40
- transform: "translateX(-50%)",
41
- whiteSpace: "nowrap",
42
- background: "rgba(0,0,0,0.9)",
43
- color: "#fff",
44
- padding: "4px 6px",
45
- borderRadius: "1.3rem",
46
- fontSize: "0.55rem",
47
- boxShadow: "0 6px 18px rgba(0,0,0,0.35)",
48
- opacity: hoverSubmit ? 1 : 0,
49
- pointerEvents: "none",
50
- transition: "opacity 120ms ease-in-out",
51
- zIndex: 30,
52
- }, children: "Send message" })] }), _jsxs("div", { style: { position: "relative", display: "inline-block", marginLeft: "0.25rem" }, onMouseEnter: () => setHoverVoice(true), onMouseLeave: () => setHoverVoice(false), children: [_jsxs("button", { type: "button", onClick: onVoiceSearch, "aria-describedby": hoverVoice ? voiceTooltipId : undefined, onFocus: () => setHoverVoice(true), onBlur: () => setHoverVoice(false), style: {
53
- borderRadius: "1.3rem",
54
- border: "1px solid rgba(255, 255, 255, 0.3)",
55
- backgroundColor: "rgba(255, 255, 255, 0.2)",
56
- padding: size === "l" || size === "xl" ? "0.5rem" : "0.3rem",
57
- display: "flex",
58
- alignItems: "center",
59
- justifyContent: "center",
60
- color: "rgba(0, 0, 0, 0.75)",
61
- backdropFilter: "blur(20px)",
62
- WebkitBackdropFilter: "blur(20px)",
63
- transition: "all 0.2s",
64
- cursor: "pointer",
65
- outline: "none",
66
- opacity: size === "m" && !isHovered ? 0.7 : 1,
67
- boxShadow: "inset 0 1px 0 rgba(255, 255, 255, 0.3)",
68
- }, onMouseEnter: (e) => {
69
- e.currentTarget.style.backgroundColor = "rgba(255, 255, 255, 0.3)";
70
- }, onMouseLeave: (e) => {
71
- e.currentTarget.style.backgroundColor = "rgba(255, 255, 255, 0.2)";
72
- }, children: [_jsx(Mic, { style: {
73
- width: size === "l" || size === "xl" ? "1rem" : "0.875rem",
74
- height: size === "l" || size === "xl" ? "1rem" : "0.875rem",
75
- } }), isRecording && (_jsxs("span", { "aria-hidden": "true", style: {
76
- display: "inline-flex",
77
- alignItems: "flex-end",
78
- gap: "2px",
79
- marginLeft: size === "l" || size === "xl" ? "6px" : "4px",
80
- height: size === "l" || size === "xl" ? "1rem" : "0.875rem",
81
- }, children: [_jsx("span", { style: {
82
- width: "2px",
83
- height: "55%",
84
- backgroundColor: "rgba(0, 0, 0, 0.75)",
85
- borderRadius: "1px",
86
- transformOrigin: "bottom",
87
- animation: "eqPulse 900ms ease-in-out 0ms infinite",
88
- } }), _jsx("span", { style: {
89
- width: "2px",
90
- height: "85%",
91
- backgroundColor: "rgba(0, 0, 0, 0.75)",
92
- borderRadius: "1px",
93
- transformOrigin: "bottom",
94
- animation: "eqPulse 900ms ease-in-out 100ms infinite",
95
- } }), _jsx("span", { style: {
96
- width: "2px",
97
- height: "65%",
98
- backgroundColor: "rgba(0, 0, 0, 0.75)",
99
- borderRadius: "1px",
100
- transformOrigin: "bottom",
101
- animation: "eqPulse 900ms ease-in-out 200ms infinite",
102
- } }), _jsx("span", { style: {
103
- width: "2px",
104
- height: "78%",
105
- backgroundColor: "rgba(0, 0, 0, 0.75)",
106
- borderRadius: "1px",
107
- transformOrigin: "bottom",
108
- animation: "eqPulse 900ms ease-in-out 300ms infinite",
109
- } })] }))] }), _jsx("span", { id: voiceTooltipId, role: "tooltip", style: {
110
- position: "absolute",
111
- top: "calc(100% + 0.4rem)",
112
- left: "50%",
113
- transform: "translateX(-50%)",
114
- whiteSpace: "nowrap",
115
- background: "rgba(0,0,0,0.9)",
116
- color: "#fff",
117
- padding: "4px 6px",
118
- borderRadius: "1.3rem",
119
- fontSize: "0.55rem",
120
- boxShadow: "0 6px 18px rgba(0,0,0,0.35)",
121
- opacity: hoverVoice ? 1 : 0,
122
- pointerEvents: "none",
123
- transition: "opacity 120ms ease-in-out",
124
- zIndex: 30,
125
- }, children: isRecording ? "Stop recording" : "Voice input" })] }), _jsxs("div", { style: { position: "relative", display: "inline-block", marginRight: "0.25rem" }, onMouseEnter: () => setHoverCalendar(true), onMouseLeave: () => setHoverCalendar(false), children: [_jsxs("button", { type: "button", disabled: isStreaming, onClick: onCalendarClick, "aria-describedby": hoverCalendar ? calendarTooltipId : undefined, onFocus: () => setHoverCalendar(true), onBlur: () => setHoverCalendar(false), style: {
126
- borderRadius: "1.3rem",
127
- border: "1px solid rgba(255, 255, 255, 0.3)",
128
- backgroundColor: "rgb(0, 0, 0)",
129
- padding: size === "l" || size === "xl" ? "0.5rem" : "0.4rem",
130
- display: size === "l" || size === "m" || size === "xl" ? "flex" : "none",
131
- alignItems: "center",
132
- justifyContent: "center",
133
- color: "rgb(255, 255, 255)",
134
- transition: "all 0.2s",
135
- cursor: isStreaming ? "not-allowed" : "pointer",
136
- outline: "none",
137
- opacity: isStreaming ? 0.7 : size === "l" && !isHovered ? 0.85 : 1,
138
- }, children: [_jsx(Calendar, { style: {
139
- width: size === "l" || size === "xl" ? "1rem" : "0.875rem",
140
- height: size === "l" || size === "xl" ? "1rem" : "0.875rem",
141
- } }), _jsx("span", { style: {
142
- marginLeft: "0.5rem",
143
- fontSize: "0.7rem",
144
- fontWeight: 400,
145
- display: size === "m" || searchQuery.length > 0 ? "none" : "block",
146
- transition: "all 0.4s",
147
- }, children: "Book a call" })] }), _jsx("span", { id: calendarTooltipId, role: "tooltip", style: {
148
- position: "absolute",
149
- top: "calc(100% + 0.4rem)",
150
- left: "50%",
151
- transform: "translateX(-50%)",
152
- whiteSpace: "nowrap",
153
- background: "rgba(0,0,0,0.9)",
154
- color: "#fff",
155
- padding: "4px 6px",
156
- borderRadius: "1.3rem",
157
- fontSize: "0.55rem",
158
- boxShadow: "0 6px 18px rgba(0,0,0,0.35)",
159
- opacity: hoverCalendar ? 1 : 0,
160
- pointerEvents: "none",
161
- transition: "opacity 120ms ease-in-out",
162
- zIndex: 30,
163
- }, children: "Book a call" })] })] }));
164
- }
@@ -1,46 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useRef, useEffect, forwardRef } from "react";
3
- const AutoExpandingTextarea = forwardRef(({ value, onChange, onKeyDown, className, style, ...props }, ref) => {
4
- const textareaRef = useRef(null);
5
- useEffect(() => {
6
- const el = ref?.current || textareaRef.current;
7
- if (el) {
8
- // Reset to minimum height when value is empty
9
- if (!value || value.trim() === '') {
10
- el.style.height = "24px";
11
- return;
12
- }
13
- el.style.height = "auto";
14
- const scrollHeight = el.scrollHeight;
15
- const minHeight = 24; // one line height
16
- const maxHeight = 160; // max ~5 lines
17
- el.style.height = `${Math.min(Math.max(scrollHeight, minHeight), maxHeight)}px`;
18
- }
19
- }, [value, ref]);
20
- return (_jsx("textarea", { ref: ref || textareaRef, value: value, onChange: onChange, onKeyDown: (e) => {
21
- if (e.key === "Enter" && !e.shiftKey) {
22
- e.preventDefault();
23
- // Trigger form submission by finding parent form and calling submit
24
- const form = e.currentTarget.closest('form');
25
- if (form) {
26
- form.requestSubmit(); // This triggers onSubmit handler
27
- }
28
- onKeyDown?.(e);
29
- }
30
- else {
31
- onKeyDown?.(e);
32
- }
33
- }, placeholder: "Chat with me...", className: `w-full bg-white placeholder:text-gray-500 rounded-lg text-sm sm:text-base ${className}`, style: {
34
- lineHeight: "1.5rem",
35
- padding: "0.5rem 0.75rem",
36
- minHeight: "1.5rem",
37
- maxHeight: "160px",
38
- outline: "none",
39
- overflow: "hidden", // ← hide scrollbars
40
- resize: "none", // ← remove corner handle
41
- transition: "height 0.15s ease-out",
42
- ...style,
43
- }, rows: 1, ...props }));
44
- });
45
- AutoExpandingTextarea.displayName = "AutoExpandingTextarea";
46
- export default AutoExpandingTextarea;
@@ -1,49 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import Cal, { getCalApi } from "@calcom/embed-react";
3
- import { useEffect } from "react";
4
- import { getCalendarConfig } from "../../lib/calendar-config";
5
- export default function CalendarIntegration(props = {}) {
6
- const { onBooked } = props;
7
- const calendarConfig = getCalendarConfig();
8
- useEffect(() => {
9
- if (!calendarConfig || calendarConfig.provider !== "calcom")
10
- return;
11
- void (async () => {
12
- const cal = await getCalApi({ namespace: calendarConfig.namespace || "default" });
13
- cal("ui", {
14
- hideEventTypeDetails: false,
15
- layout: calendarConfig.layout || "month_view",
16
- });
17
- // Listen for successful booking
18
- try {
19
- cal("on", {
20
- action: "bookingSuccessful",
21
- callback: () => {
22
- window.dispatchEvent(new Event("calendar-booked"));
23
- onBooked?.();
24
- },
25
- });
26
- }
27
- catch (_) {
28
- // no-op
29
- }
30
- })();
31
- // Also listen via postMessage
32
- const handleMessage = (event) => {
33
- const data = event?.data;
34
- const name = data?.event || data?.action || data?.name;
35
- if (typeof name === "string" &&
36
- name.toLowerCase().includes("booking") &&
37
- name.toLowerCase().includes("success")) {
38
- window.dispatchEvent(new Event("calendar-booked"));
39
- onBooked?.();
40
- }
41
- };
42
- window.addEventListener("message", handleMessage);
43
- return () => window.removeEventListener("message", handleMessage);
44
- }, [calendarConfig, onBooked]);
45
- return (_jsx("div", { style: { width: "100%", height: "100%", overflow: "auto" }, children: _jsx(Cal, { namespace: calendarConfig.namespace || "default", calLink: calendarConfig.link, style: { width: "100%", height: "100%", minHeight: "500px" }, config: {
46
- layout: calendarConfig.layout || "month_view",
47
- theme: calendarConfig.theme || "light",
48
- } }) }));
49
- }
@@ -1,87 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { X } from "lucide-react";
3
- export function InspirationMenu({ questions, onQuestionClick, onClose, suggestedLabel = "Suggested" }) {
4
- return (_jsxs("div", { "data-inspiration-menu": true, style: {
5
- position: "absolute",
6
- bottom: "calc(100% + 0.5rem)",
7
- left: 0,
8
- minWidth: "16rem",
9
- maxWidth: "20rem",
10
- borderRadius: "0.75rem",
11
- border: "1px solid rgba(255, 255, 255, 0.35)",
12
- // Glass-like background with transparency
13
- backgroundColor: "rgba(255, 255, 255, 0.75)",
14
- backdropFilter: "blur(24px) saturate(180%)",
15
- WebkitBackdropFilter: "blur(24px) saturate(180%)",
16
- boxShadow: "0 8px 28px rgba(0, 0, 0, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.8)",
17
- padding: "0.625rem",
18
- animation: "slideUpMenu 0.25s cubic-bezier(0.4, 0, 0.2, 1)",
19
- // Ensure the popover sits above chat bubbles and other content
20
- zIndex: 1000,
21
- }, onClick: (e) => e.stopPropagation(), onMouseEnter: (e) => e.stopPropagation(), onMouseLeave: onClose, children: [_jsxs("div", { style: {
22
- display: "flex",
23
- justifyContent: "space-between",
24
- alignItems: "center",
25
- marginBottom: "0.5rem",
26
- paddingBottom: "0.5rem",
27
- borderBottom: "1px solid rgba(0, 0, 0, 0.06)",
28
- }, children: [_jsx("div", { style: {
29
- fontSize: "0.6875rem",
30
- fontWeight: 600,
31
- color: "rgba(0, 0, 0, 0.5)",
32
- letterSpacing: "0.05em",
33
- textTransform: "capitalize",
34
- }, children: suggestedLabel }), _jsx("button", { type: "button", onClick: onClose, style: {
35
- padding: "0.25rem",
36
- borderRadius: "0.375rem",
37
- border: "1px solid rgba(255, 255, 255, 0.2)",
38
- backgroundColor: "rgba(255, 255, 255, 0.15)",
39
- color: "rgba(0, 0, 0, 0.5)",
40
- cursor: "pointer",
41
- display: "flex",
42
- alignItems: "center",
43
- justifyContent: "center",
44
- transition: "all 0.2s",
45
- outline: "none",
46
- backdropFilter: "blur(10px)",
47
- WebkitBackdropFilter: "blur(10px)",
48
- }, onMouseEnter: (e) => {
49
- e.currentTarget.style.backgroundColor = "rgba(255, 255, 255, 0.3)";
50
- e.currentTarget.style.color = "rgba(0, 0, 0, 0.8)";
51
- e.currentTarget.style.borderColor = "rgba(255, 255, 255, 0.35)";
52
- }, onMouseLeave: (e) => {
53
- e.currentTarget.style.backgroundColor = "rgba(255, 255, 255, 0.15)";
54
- e.currentTarget.style.color = "rgba(0, 0, 0, 0.5)";
55
- e.currentTarget.style.borderColor = "rgba(255, 255, 255, 0.2)";
56
- }, children: _jsx(X, { style: { width: "0.875rem", height: "0.875rem" } }) })] }), _jsx("div", { style: { display: "flex", flexDirection: "column", gap: "0.375rem" }, children: questions.map((question, index) => {
57
- const truncatedQuestion = question.length > 80 ? question.slice(0, 80) + '...' : question;
58
- return (_jsx("button", { type: "button", onClick: () => onQuestionClick(question), title: question.length > 80 ? question : undefined, style: {
59
- padding: "0.5rem 0.75rem",
60
- borderRadius: "1.3rem",
61
- border: "1px solid rgba(0, 0, 0, 0.06)",
62
- backgroundColor: "#ffffff",
63
- color: "rgba(0, 0, 0, 0.85)",
64
- fontSize: "0.75rem",
65
- fontWeight: 500,
66
- textAlign: "left",
67
- cursor: "pointer",
68
- transition: "all 0.2s cubic-bezier(0.4, 0, 0.2, 1)",
69
- boxShadow: "0 1px 2px rgba(0, 0, 0, 0.06)",
70
- outline: "none",
71
- lineHeight: "1.3",
72
- overflow: "hidden",
73
- textOverflow: "ellipsis",
74
- whiteSpace: "nowrap",
75
- }, onMouseEnter: (e) => {
76
- e.currentTarget.style.backgroundColor = "rgba(140, 110, 230, 0.12)";
77
- e.currentTarget.style.borderColor = "rgba(140, 110, 230, 0.3)";
78
- e.currentTarget.style.transform = "translateY(-1px)";
79
- e.currentTarget.style.boxShadow = "0 3px 8px rgba(140, 110, 230, 0.15)";
80
- }, onMouseLeave: (e) => {
81
- e.currentTarget.style.backgroundColor = "#ffffff";
82
- e.currentTarget.style.borderColor = "rgba(0, 0, 0, 0.06)";
83
- e.currentTarget.style.transform = "translateY(0)";
84
- e.currentTarget.style.boxShadow = "0 1px 2px rgba(0, 0, 0, 0.06)";
85
- }, children: truncatedQuestion }, index));
86
- }) })] }));
87
- }