@paramms/chat-widget 1.0.6 → 1.0.8
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/dist/chatlist.d.ts +66 -0
- package/dist/chatlist.js +124 -0
- package/dist/chatlist.js.map +1 -0
- package/dist/index.d.ts +1 -6
- package/dist/index.js +607 -861
- package/dist/index.js.map +1 -1
- package/dist/protocol/entities.d.ts +3 -0
- package/dist/protocol/frames.d.ts +2 -0
- package/dist/react.d.ts +103 -8
- package/dist/react.js +314 -94
- package/dist/react.js.map +1 -1
- package/dist/renderer.d.ts +1 -46
- package/dist/uid.d.ts +3 -0
- package/dist/uid.js +63 -0
- package/dist/uid.js.map +1 -0
- package/package.json +11 -1
|
@@ -104,6 +104,9 @@ export interface Subject {
|
|
|
104
104
|
title: string;
|
|
105
105
|
state: string;
|
|
106
106
|
fields: Record<string, string | number | boolean>;
|
|
107
|
+
/** URL of the page where the subject lives (e.g. the listing page URL).
|
|
108
|
+
* Captured automatically by the widget and stored on first open. */
|
|
109
|
+
url?: string;
|
|
107
110
|
createdAt: number;
|
|
108
111
|
updatedAt: number;
|
|
109
112
|
}
|
package/dist/react.d.ts
CHANGED
|
@@ -34,13 +34,7 @@ export interface ChatWidgetProps extends BaseProps {
|
|
|
34
34
|
contextTitle?: string;
|
|
35
35
|
contextSubtitle?: string;
|
|
36
36
|
contextStatus?: string;
|
|
37
|
-
/**
|
|
38
|
-
* Use when users can have more than one thread on this profile
|
|
39
|
-
* (e.g. one thread per support ticket, one per booking). */
|
|
40
|
-
showChatList?: boolean;
|
|
41
|
-
/** Stable item ID — pins this conversation to a specific item/thread.
|
|
42
|
-
* When showChatList is also true, the widget opens this thread immediately
|
|
43
|
-
* but the user can navigate back to the full list. */
|
|
37
|
+
/** Stable item ID — pins this conversation to a specific item/thread. */
|
|
44
38
|
subjectId?: string;
|
|
45
39
|
}
|
|
46
40
|
/**
|
|
@@ -70,7 +64,7 @@ export interface ChatWidgetProps extends BaseProps {
|
|
|
70
64
|
* />
|
|
71
65
|
* ```
|
|
72
66
|
*/
|
|
73
|
-
export declare function ChatWidget({ url, profileId, userId, userName, userEmail, userAvatar, contextTitle, contextSubtitle, contextStatus,
|
|
67
|
+
export declare function ChatWidget({ url, profileId, userId, userName, userEmail, userAvatar, contextTitle, contextSubtitle, contextStatus, subjectId, accent, launcher, position, quickReplies, height, i18n, translateLang, }: ChatWidgetProps): JSX.Element;
|
|
74
68
|
export interface MarketplaceChatProps extends BaseProps {
|
|
75
69
|
/** Unique ID for this listing — each listing gets its own thread.
|
|
76
70
|
* Omit for a general (non-item-specific) conversation. */
|
|
@@ -121,4 +115,105 @@ export interface MarketplaceChatProps extends BaseProps {
|
|
|
121
115
|
* Only `url` and `profileId` are required. All other props are optional.
|
|
122
116
|
*/
|
|
123
117
|
export declare function MarketplaceChat({ url, profileId, listingId, listingTitle, listingMeta, listingPrice, listingStatus, userId, userName, userEmail, userAvatar, accent, launcher, position, quickReplies, height, i18n, translateLang, }: MarketplaceChatProps): JSX.Element;
|
|
118
|
+
export interface ChatAppProps {
|
|
119
|
+
/** Relay WebSocket URL — required */
|
|
120
|
+
url: string;
|
|
121
|
+
/** Your Relay profile ID — required */
|
|
122
|
+
profileId: string;
|
|
123
|
+
/** Your logged-in user's stable ID. Omit for anonymous (uses localStorage UID) */
|
|
124
|
+
userId?: string;
|
|
125
|
+
/** Optional: shown to agents in the dashboard */
|
|
126
|
+
userName?: string;
|
|
127
|
+
/** Optional: shown to agents in the dashboard */
|
|
128
|
+
userEmail?: string;
|
|
129
|
+
/** Brand colour hex — default '#f5713c' */
|
|
130
|
+
accent?: string;
|
|
131
|
+
/** Container height. Default: '100%' */
|
|
132
|
+
height?: string;
|
|
133
|
+
/** i18n overrides */
|
|
134
|
+
i18n?: import('./chatlist.js').ChatListOptions['i18n'];
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Full chat-app component: conversation list on the left (or full screen on
|
|
138
|
+
* mobile), chat room on the right when a thread is selected.
|
|
139
|
+
*
|
|
140
|
+
* Works like a standalone messaging app — tapping a thread opens the chat
|
|
141
|
+
* inline without navigating away from the page.
|
|
142
|
+
*
|
|
143
|
+
* @example
|
|
144
|
+
* ```tsx
|
|
145
|
+
* 'use client'
|
|
146
|
+
* import { ChatList } from '@paramms/chat-widget/react'
|
|
147
|
+
*
|
|
148
|
+
* export default function MessagesPage({ session }) {
|
|
149
|
+
* return (
|
|
150
|
+
* <div style={{ height: '100vh' }}>
|
|
151
|
+
* <ChatList
|
|
152
|
+
* url={process.env.NEXT_PUBLIC_RELAY_WS_URL}
|
|
153
|
+
* profileId={process.env.NEXT_PUBLIC_RELAY_PROFILE_ID}
|
|
154
|
+
* userId={session?.user.id}
|
|
155
|
+
* userName={session?.user.name}
|
|
156
|
+
* userEmail={session?.user.email}
|
|
157
|
+
* />
|
|
158
|
+
* </div>
|
|
159
|
+
* )
|
|
160
|
+
* }
|
|
161
|
+
* ```
|
|
162
|
+
*/
|
|
163
|
+
export declare function ChatApp({ url, profileId, userId, userName, userEmail, accent, height, i18n, }: ChatAppProps): JSX.Element;
|
|
164
|
+
export interface ChatAppLauncherProps {
|
|
165
|
+
/** Relay WebSocket URL — required */
|
|
166
|
+
url: string;
|
|
167
|
+
/** Your Relay profile ID — required */
|
|
168
|
+
profileId: string;
|
|
169
|
+
/** Your logged-in user's stable ID */
|
|
170
|
+
userId?: string;
|
|
171
|
+
userName?: string;
|
|
172
|
+
userEmail?: string;
|
|
173
|
+
/** Brand colour hex — default '#4F63F5' */
|
|
174
|
+
accent?: string;
|
|
175
|
+
/** true → floating bubble fixed to the corner of the screen (like Intercom)
|
|
176
|
+
* false → an inline "Messages" button that expands a panel below it
|
|
177
|
+
* Default: true */
|
|
178
|
+
floating?: boolean;
|
|
179
|
+
/** Only used when floating=true. Default: 'bottom-right' */
|
|
180
|
+
position?: 'bottom-right' | 'bottom-left';
|
|
181
|
+
/** Label shown on the button. Default: '💬' for floating, 'Messages' for inline */
|
|
182
|
+
label?: string;
|
|
183
|
+
/** Width of the chat panel. Default: '420px' (floating) or '100%' (inline) */
|
|
184
|
+
panelWidth?: string;
|
|
185
|
+
/** Height of the chat panel. Default: '600px' */
|
|
186
|
+
panelHeight?: string;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* A button that opens the full ChatApp (list → chat) in a panel.
|
|
190
|
+
*
|
|
191
|
+
* floating=true → fixed bubble in the corner of the screen, like WhatsApp Web's
|
|
192
|
+
* chat button or Intercom.
|
|
193
|
+
* floating=false → an inline button (e.g. in your nav bar) that expands a panel
|
|
194
|
+
* below it.
|
|
195
|
+
*
|
|
196
|
+
* @example Floating bubble (bottom-right)
|
|
197
|
+
* ```tsx
|
|
198
|
+
* <ChatAppLauncher
|
|
199
|
+
* url={process.env.NEXT_PUBLIC_RELAY_WS_URL}
|
|
200
|
+
* profileId={process.env.NEXT_PUBLIC_RELAY_PROFILE_ID}
|
|
201
|
+
* userId={session?.user.id}
|
|
202
|
+
* floating
|
|
203
|
+
* position="bottom-right"
|
|
204
|
+
* />
|
|
205
|
+
* ```
|
|
206
|
+
*
|
|
207
|
+
* @example Inline nav button
|
|
208
|
+
* ```tsx
|
|
209
|
+
* <ChatAppLauncher
|
|
210
|
+
* url={process.env.NEXT_PUBLIC_RELAY_WS_URL}
|
|
211
|
+
* profileId={process.env.NEXT_PUBLIC_RELAY_PROFILE_ID}
|
|
212
|
+
* userId={session?.user.id}
|
|
213
|
+
* floating={false}
|
|
214
|
+
* label="Messages"
|
|
215
|
+
* />
|
|
216
|
+
* ```
|
|
217
|
+
*/
|
|
218
|
+
export declare function ChatAppLauncher({ url, profileId, userId, userName, userEmail, accent, floating, position, label, panelWidth, panelHeight, }: ChatAppLauncherProps): JSX.Element;
|
|
124
219
|
export {};
|
package/dist/react.js
CHANGED
|
@@ -1,143 +1,363 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { mount as
|
|
4
|
-
function
|
|
1
|
+
import { jsxs as k, jsx as c, Fragment as M } from "react/jsx-runtime";
|
|
2
|
+
import { useState as z, useRef as w, useEffect as j } from "react";
|
|
3
|
+
import { mount as S } from "./index.js";
|
|
4
|
+
function H({
|
|
5
5
|
url: u,
|
|
6
|
-
profileId:
|
|
6
|
+
profileId: x,
|
|
7
7
|
userId: t,
|
|
8
|
-
userName:
|
|
9
|
-
userEmail:
|
|
10
|
-
userAvatar:
|
|
11
|
-
contextTitle:
|
|
12
|
-
contextSubtitle:
|
|
13
|
-
contextStatus:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
translateLang: s
|
|
8
|
+
userName: r,
|
|
9
|
+
userEmail: l,
|
|
10
|
+
userAvatar: n,
|
|
11
|
+
contextTitle: g,
|
|
12
|
+
contextSubtitle: b,
|
|
13
|
+
contextStatus: e,
|
|
14
|
+
subjectId: p,
|
|
15
|
+
accent: h,
|
|
16
|
+
launcher: o,
|
|
17
|
+
position: d,
|
|
18
|
+
quickReplies: y,
|
|
19
|
+
height: s = "100%",
|
|
20
|
+
i18n: f,
|
|
21
|
+
translateLang: a
|
|
23
22
|
}) {
|
|
24
|
-
const
|
|
25
|
-
return
|
|
26
|
-
if (
|
|
27
|
-
return i.current =
|
|
28
|
-
el:
|
|
23
|
+
const v = w(null), i = w(null);
|
|
24
|
+
return j(() => {
|
|
25
|
+
if (v.current)
|
|
26
|
+
return i.current = S({
|
|
27
|
+
el: v.current,
|
|
29
28
|
url: u,
|
|
30
|
-
profileId:
|
|
31
|
-
...
|
|
29
|
+
profileId: x,
|
|
30
|
+
...p ? { subjectId: p } : {},
|
|
32
31
|
...t ? { token: t } : {},
|
|
33
|
-
...t ||
|
|
32
|
+
...t || r || l || n ? {
|
|
34
33
|
user: {
|
|
35
|
-
...
|
|
36
|
-
...
|
|
37
|
-
...
|
|
34
|
+
...r ? { name: r } : {},
|
|
35
|
+
...l ? { email: l } : {},
|
|
36
|
+
...n ? { avatar: n } : {}
|
|
38
37
|
}
|
|
39
38
|
} : {},
|
|
40
|
-
...
|
|
39
|
+
...g ? {
|
|
41
40
|
subject: {
|
|
42
|
-
title:
|
|
43
|
-
...
|
|
44
|
-
...
|
|
41
|
+
title: g,
|
|
42
|
+
...b ? { subtitle: b } : {},
|
|
43
|
+
...e ? { status: e } : {}
|
|
45
44
|
}
|
|
46
45
|
} : {},
|
|
47
|
-
...
|
|
48
|
-
...
|
|
49
|
-
...
|
|
50
|
-
...
|
|
51
|
-
...
|
|
52
|
-
...n ? { launcher: n, position: k ?? "bottom-right" } : {}
|
|
46
|
+
...y ? { quickReplies: y } : {},
|
|
47
|
+
...h ? { accent: h } : {},
|
|
48
|
+
...a ? { translateLang: a } : {},
|
|
49
|
+
...f ? { i18n: f } : {},
|
|
50
|
+
...o ? { launcher: o, position: d ?? "bottom-right" } : {}
|
|
53
51
|
}), () => {
|
|
54
|
-
var
|
|
55
|
-
(
|
|
52
|
+
var m;
|
|
53
|
+
(m = i.current) == null || m.close(), i.current = null;
|
|
56
54
|
};
|
|
57
|
-
}, [u,
|
|
55
|
+
}, [u, x, p, t]), /* @__PURE__ */ c(
|
|
58
56
|
"div",
|
|
59
57
|
{
|
|
60
|
-
ref:
|
|
61
|
-
style:
|
|
58
|
+
ref: v,
|
|
59
|
+
style: o ? { width: 0, height: 0, overflow: "hidden" } : { width: "100%", height: s, minHeight: s === "100%" ? "480px" : void 0 }
|
|
62
60
|
}
|
|
63
61
|
);
|
|
64
62
|
}
|
|
65
|
-
const
|
|
63
|
+
const W = [
|
|
66
64
|
"Is this still available?",
|
|
67
65
|
"Can I schedule a viewing?",
|
|
68
66
|
"What is your best price?"
|
|
69
67
|
];
|
|
70
|
-
function
|
|
68
|
+
function _({
|
|
71
69
|
url: u,
|
|
72
|
-
profileId:
|
|
70
|
+
profileId: x,
|
|
73
71
|
listingId: t,
|
|
74
|
-
listingTitle:
|
|
75
|
-
listingMeta:
|
|
76
|
-
listingPrice:
|
|
77
|
-
listingStatus:
|
|
78
|
-
userId:
|
|
79
|
-
userName:
|
|
72
|
+
listingTitle: r,
|
|
73
|
+
listingMeta: l,
|
|
74
|
+
listingPrice: n,
|
|
75
|
+
listingStatus: g,
|
|
76
|
+
userId: b,
|
|
77
|
+
userName: e,
|
|
80
78
|
userEmail: p,
|
|
81
|
-
userAvatar:
|
|
82
|
-
accent:
|
|
83
|
-
launcher:
|
|
84
|
-
position:
|
|
85
|
-
quickReplies:
|
|
86
|
-
height:
|
|
87
|
-
i18n:
|
|
88
|
-
translateLang:
|
|
79
|
+
userAvatar: h,
|
|
80
|
+
accent: o,
|
|
81
|
+
launcher: d,
|
|
82
|
+
position: y,
|
|
83
|
+
quickReplies: s,
|
|
84
|
+
height: f = "100%",
|
|
85
|
+
i18n: a,
|
|
86
|
+
translateLang: v
|
|
89
87
|
}) {
|
|
90
|
-
const
|
|
91
|
-
return
|
|
92
|
-
if (
|
|
93
|
-
return
|
|
94
|
-
el:
|
|
88
|
+
const i = w(null), m = w(null);
|
|
89
|
+
return j(() => {
|
|
90
|
+
if (i.current)
|
|
91
|
+
return m.current = S({
|
|
92
|
+
el: i.current,
|
|
95
93
|
url: u,
|
|
96
|
-
profileId:
|
|
94
|
+
profileId: x,
|
|
97
95
|
// ── Listing context ────────────────────────────────────────────────────
|
|
98
96
|
// When listingId is present: open that listing's chat directly (no list).
|
|
99
97
|
// When listingId is absent: show the thread list (dedicated inbox page).
|
|
100
98
|
...t ? { subjectId: `listing_${t}` } : {},
|
|
101
|
-
...
|
|
102
|
-
...
|
|
99
|
+
...b ? { token: b } : {},
|
|
100
|
+
...b || e || p || h ? {
|
|
103
101
|
user: {
|
|
104
|
-
...
|
|
102
|
+
...e ? { name: e } : {},
|
|
105
103
|
...p ? { email: p } : {},
|
|
106
|
-
...
|
|
104
|
+
...h ? { avatar: h } : {},
|
|
107
105
|
...t ? { meta: { listingId: t } } : {}
|
|
108
106
|
}
|
|
109
107
|
} : {},
|
|
110
|
-
...
|
|
108
|
+
...r ? {
|
|
111
109
|
subject: {
|
|
112
|
-
title:
|
|
113
|
-
...
|
|
114
|
-
...
|
|
115
|
-
...
|
|
110
|
+
title: r,
|
|
111
|
+
...l ? { subtitle: l } : {},
|
|
112
|
+
...n ? { tags: [`$${n.toLocaleString()}`] } : {},
|
|
113
|
+
...g ? { status: g } : {}
|
|
116
114
|
}
|
|
117
115
|
} : {},
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
...b ? { accent: b } : {},
|
|
124
|
-
...s ? { translateLang: s } : {},
|
|
125
|
-
...C ? { i18n: C } : {},
|
|
126
|
-
...n ? { launcher: n, position: k ?? "bottom-right" } : {}
|
|
116
|
+
quickReplies: s ?? W,
|
|
117
|
+
...o ? { accent: o } : {},
|
|
118
|
+
...v ? { translateLang: v } : {},
|
|
119
|
+
...a ? { i18n: a } : {},
|
|
120
|
+
...d ? { launcher: d, position: y ?? "bottom-right" } : {}
|
|
127
121
|
}), () => {
|
|
128
|
-
var
|
|
129
|
-
(
|
|
122
|
+
var C;
|
|
123
|
+
(C = m.current) == null || C.close(), m.current = null;
|
|
130
124
|
};
|
|
131
|
-
}, [u,
|
|
125
|
+
}, [u, x, t, b]), /* @__PURE__ */ c(
|
|
132
126
|
"div",
|
|
133
127
|
{
|
|
134
|
-
ref:
|
|
135
|
-
style:
|
|
128
|
+
ref: i,
|
|
129
|
+
style: d ? { width: 0, height: 0, overflow: "hidden" } : { width: "100%", height: f, minHeight: f === "100%" ? "480px" : void 0 }
|
|
136
130
|
}
|
|
137
131
|
);
|
|
138
132
|
}
|
|
133
|
+
function L({
|
|
134
|
+
url: u,
|
|
135
|
+
profileId: x,
|
|
136
|
+
userId: t,
|
|
137
|
+
userName: r,
|
|
138
|
+
userEmail: l,
|
|
139
|
+
accent: n,
|
|
140
|
+
height: g = "100%",
|
|
141
|
+
i18n: b
|
|
142
|
+
}) {
|
|
143
|
+
const [e, p] = z(null), h = w(null), o = w(null), d = w(null), y = w(null);
|
|
144
|
+
j(() => {
|
|
145
|
+
if (h.current)
|
|
146
|
+
return import("./chatlist.js").then(({ mountChatList: f }) => {
|
|
147
|
+
d.current = f({
|
|
148
|
+
el: h.current,
|
|
149
|
+
url: u,
|
|
150
|
+
profileId: x,
|
|
151
|
+
onSelect: (a) => p(a),
|
|
152
|
+
...t ? { userId: t } : {},
|
|
153
|
+
...n ? { accent: n } : {},
|
|
154
|
+
...b ? { i18n: b } : {}
|
|
155
|
+
});
|
|
156
|
+
}), () => {
|
|
157
|
+
var f;
|
|
158
|
+
(f = d.current) == null || f.close(), d.current = null;
|
|
159
|
+
};
|
|
160
|
+
}, [u, x, t]), j(() => {
|
|
161
|
+
var f;
|
|
162
|
+
if (!(!o.current || !e))
|
|
163
|
+
return (f = y.current) == null || f.close(), y.current = S({
|
|
164
|
+
el: o.current,
|
|
165
|
+
url: u,
|
|
166
|
+
profileId: x,
|
|
167
|
+
...e.subjectId ? { subjectId: e.subjectId } : {},
|
|
168
|
+
...t ? { token: t } : {},
|
|
169
|
+
...t || r || l ? {
|
|
170
|
+
user: {
|
|
171
|
+
...r ? { name: r } : {},
|
|
172
|
+
...l ? { email: l } : {}
|
|
173
|
+
}
|
|
174
|
+
} : {},
|
|
175
|
+
...e.subjectTitle ? {
|
|
176
|
+
subject: {
|
|
177
|
+
title: e.subjectTitle,
|
|
178
|
+
...e.subjectMeta ? { subtitle: e.subjectMeta } : {}
|
|
179
|
+
}
|
|
180
|
+
} : {},
|
|
181
|
+
...n ? { accent: n } : {}
|
|
182
|
+
}), () => {
|
|
183
|
+
var a;
|
|
184
|
+
(a = y.current) == null || a.close(), y.current = null;
|
|
185
|
+
};
|
|
186
|
+
}, [e == null ? void 0 : e.id]);
|
|
187
|
+
const s = typeof window < "u" && window.innerWidth < 768;
|
|
188
|
+
return /* @__PURE__ */ k("div", { style: { display: "flex", width: "100%", height: g, minHeight: "400px", overflow: "hidden" }, children: [
|
|
189
|
+
/* @__PURE__ */ c("div", { style: {
|
|
190
|
+
width: s ? "100%" : "360px",
|
|
191
|
+
flex: s && e ? "none" : void 0,
|
|
192
|
+
display: s && e ? "none" : "flex",
|
|
193
|
+
flexDirection: "column",
|
|
194
|
+
borderRight: s ? "none" : "1px solid #e8eaed",
|
|
195
|
+
minWidth: 0
|
|
196
|
+
}, children: /* @__PURE__ */ c("div", { ref: h, style: { width: "100%", height: "100%" } }) }),
|
|
197
|
+
e ? /* @__PURE__ */ k("div", { style: { flex: 1, display: "flex", flexDirection: "column", minWidth: 0, position: "relative" }, children: [
|
|
198
|
+
s && /* @__PURE__ */ c(
|
|
199
|
+
"button",
|
|
200
|
+
{
|
|
201
|
+
onClick: () => p(null),
|
|
202
|
+
style: { position: "absolute", top: 12, left: 12, zIndex: 10, background: "none", border: "none", fontSize: 22, cursor: "pointer", color: "#1c1b1a" },
|
|
203
|
+
children: "←"
|
|
204
|
+
}
|
|
205
|
+
),
|
|
206
|
+
/* @__PURE__ */ c("div", { ref: o, style: { width: "100%", height: "100%" } })
|
|
207
|
+
] }) : /* @__PURE__ */ c("div", { style: { flex: 1, display: s ? "none" : "flex", alignItems: "center", justifyContent: "center", color: "#9b9690", fontSize: 14 }, children: "Select a conversation" })
|
|
208
|
+
] });
|
|
209
|
+
}
|
|
210
|
+
function O({
|
|
211
|
+
url: u,
|
|
212
|
+
profileId: x,
|
|
213
|
+
userId: t,
|
|
214
|
+
userName: r,
|
|
215
|
+
userEmail: l,
|
|
216
|
+
accent: n = "#4F63F5",
|
|
217
|
+
floating: g = !0,
|
|
218
|
+
position: b = "bottom-right",
|
|
219
|
+
label: e,
|
|
220
|
+
panelWidth: p,
|
|
221
|
+
panelHeight: h = "600px"
|
|
222
|
+
}) {
|
|
223
|
+
const [o, d] = z(!1), y = w(null), s = b === "bottom-right", a = e ?? (g ? "💬" : "Messages");
|
|
224
|
+
if (j(() => {
|
|
225
|
+
const i = (m) => {
|
|
226
|
+
m.key === "Escape" && d(!1);
|
|
227
|
+
};
|
|
228
|
+
return document.addEventListener("keydown", i), () => document.removeEventListener("keydown", i);
|
|
229
|
+
}, []), g) {
|
|
230
|
+
const i = typeof window < "u" && window.innerWidth < 480, m = i ? "100vw" : p ?? "420px", C = i ? "100dvh" : h;
|
|
231
|
+
return /* @__PURE__ */ k("div", { style: {
|
|
232
|
+
position: "fixed",
|
|
233
|
+
[s ? "right" : "left"]: "20px",
|
|
234
|
+
bottom: "20px",
|
|
235
|
+
zIndex: 9999,
|
|
236
|
+
display: "flex",
|
|
237
|
+
flexDirection: "column",
|
|
238
|
+
alignItems: s ? "flex-end" : "flex-start",
|
|
239
|
+
gap: "12px"
|
|
240
|
+
}, children: [
|
|
241
|
+
/* @__PURE__ */ c("div", { style: {
|
|
242
|
+
width: m,
|
|
243
|
+
height: C,
|
|
244
|
+
borderRadius: i ? "0" : "16px",
|
|
245
|
+
overflow: "hidden",
|
|
246
|
+
boxShadow: "0 8px 40px rgba(0,0,0,.18)",
|
|
247
|
+
background: "#fff",
|
|
248
|
+
display: o ? "flex" : "none",
|
|
249
|
+
flexDirection: "column",
|
|
250
|
+
transformOrigin: `bottom ${s ? "right" : "left"}`,
|
|
251
|
+
animation: o ? "ocl-pop-in .18s ease" : "none"
|
|
252
|
+
}, children: /* @__PURE__ */ c(
|
|
253
|
+
L,
|
|
254
|
+
{
|
|
255
|
+
url: u,
|
|
256
|
+
profileId: x,
|
|
257
|
+
...t ? { userId: t } : {},
|
|
258
|
+
...r ? { userName: r } : {},
|
|
259
|
+
...l ? { userEmail: l } : {},
|
|
260
|
+
accent: n,
|
|
261
|
+
height: "100%"
|
|
262
|
+
}
|
|
263
|
+
) }),
|
|
264
|
+
/* @__PURE__ */ c(
|
|
265
|
+
"button",
|
|
266
|
+
{
|
|
267
|
+
ref: y,
|
|
268
|
+
onClick: () => d((R) => !R),
|
|
269
|
+
style: {
|
|
270
|
+
width: "56px",
|
|
271
|
+
height: "56px",
|
|
272
|
+
borderRadius: "50%",
|
|
273
|
+
background: n,
|
|
274
|
+
color: "#fff",
|
|
275
|
+
border: "none",
|
|
276
|
+
fontSize: "24px",
|
|
277
|
+
cursor: "pointer",
|
|
278
|
+
flexShrink: 0,
|
|
279
|
+
boxShadow: "0 4px 16px rgba(0,0,0,.25)",
|
|
280
|
+
transition: "transform .15s"
|
|
281
|
+
},
|
|
282
|
+
onMouseEnter: (R) => {
|
|
283
|
+
R.target.style.transform = "scale(1.08)";
|
|
284
|
+
},
|
|
285
|
+
onMouseLeave: (R) => {
|
|
286
|
+
R.target.style.transform = "scale(1)";
|
|
287
|
+
},
|
|
288
|
+
children: o ? "✕" : a
|
|
289
|
+
}
|
|
290
|
+
),
|
|
291
|
+
/* @__PURE__ */ c("style", { children: "@keyframes ocl-pop-in { from { opacity:0; transform:scale(.95) } to { opacity:1; transform:scale(1) } }" })
|
|
292
|
+
] });
|
|
293
|
+
}
|
|
294
|
+
const v = p ?? "420px";
|
|
295
|
+
return /* @__PURE__ */ k("div", { style: { position: "relative", display: "inline-block" }, children: [
|
|
296
|
+
/* @__PURE__ */ k(
|
|
297
|
+
"button",
|
|
298
|
+
{
|
|
299
|
+
ref: y,
|
|
300
|
+
onClick: () => d((i) => !i),
|
|
301
|
+
style: {
|
|
302
|
+
display: "inline-flex",
|
|
303
|
+
alignItems: "center",
|
|
304
|
+
gap: "6px",
|
|
305
|
+
padding: "8px 16px",
|
|
306
|
+
borderRadius: "8px",
|
|
307
|
+
background: o ? n : "transparent",
|
|
308
|
+
color: o ? "#fff" : n,
|
|
309
|
+
border: `2px solid ${n}`,
|
|
310
|
+
fontSize: "14px",
|
|
311
|
+
fontWeight: 600,
|
|
312
|
+
cursor: "pointer",
|
|
313
|
+
transition: "background .15s, color .15s"
|
|
314
|
+
},
|
|
315
|
+
children: [
|
|
316
|
+
"💬 ",
|
|
317
|
+
a
|
|
318
|
+
]
|
|
319
|
+
}
|
|
320
|
+
),
|
|
321
|
+
o && /* @__PURE__ */ k(M, { children: [
|
|
322
|
+
/* @__PURE__ */ c(
|
|
323
|
+
"div",
|
|
324
|
+
{
|
|
325
|
+
onClick: () => d(!1),
|
|
326
|
+
style: { position: "fixed", inset: 0, zIndex: 999 }
|
|
327
|
+
}
|
|
328
|
+
),
|
|
329
|
+
/* @__PURE__ */ c("div", { style: {
|
|
330
|
+
position: "absolute",
|
|
331
|
+
top: "calc(100% + 8px)",
|
|
332
|
+
right: 0,
|
|
333
|
+
width: v,
|
|
334
|
+
height: h,
|
|
335
|
+
borderRadius: "16px",
|
|
336
|
+
overflow: "hidden",
|
|
337
|
+
boxShadow: "0 8px 40px rgba(0,0,0,.18)",
|
|
338
|
+
background: "#fff",
|
|
339
|
+
zIndex: 1e3,
|
|
340
|
+
animation: "ocl-pop-in .18s ease"
|
|
341
|
+
}, children: /* @__PURE__ */ c(
|
|
342
|
+
L,
|
|
343
|
+
{
|
|
344
|
+
url: u,
|
|
345
|
+
profileId: x,
|
|
346
|
+
...t ? { userId: t } : {},
|
|
347
|
+
...r ? { userName: r } : {},
|
|
348
|
+
...l ? { userEmail: l } : {},
|
|
349
|
+
accent: n,
|
|
350
|
+
height: "100%"
|
|
351
|
+
}
|
|
352
|
+
) }),
|
|
353
|
+
/* @__PURE__ */ c("style", { children: "@keyframes ocl-pop-in { from { opacity:0; transform:translateY(-8px) } to { opacity:1; transform:translateY(0) } }" })
|
|
354
|
+
] })
|
|
355
|
+
] });
|
|
356
|
+
}
|
|
139
357
|
export {
|
|
140
|
-
|
|
141
|
-
|
|
358
|
+
L as ChatApp,
|
|
359
|
+
O as ChatAppLauncher,
|
|
360
|
+
H as ChatWidget,
|
|
361
|
+
_ as MarketplaceChat
|
|
142
362
|
};
|
|
143
363
|
//# sourceMappingURL=react.js.map
|