@paramms/chat-widget 1.0.7 → 1.0.9
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 +4 -0
- package/dist/chatlist.js +1 -1
- package/dist/chatlist.js.map +1 -1
- package/dist/index.js +167 -162
- 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 +70 -16
- package/dist/react.js +307 -114
- package/dist/react.js.map +1 -1
- package/dist/uid.js +63 -0
- package/dist/uid.js.map +1 -0
- package/package.json +4 -2
|
@@ -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
|
@@ -115,51 +115,105 @@ export interface MarketplaceChatProps extends BaseProps {
|
|
|
115
115
|
* Only `url` and `profileId` are required. All other props are optional.
|
|
116
116
|
*/
|
|
117
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
|
|
118
|
+
export interface ChatAppProps {
|
|
119
119
|
/** Relay WebSocket URL — required */
|
|
120
120
|
url: string;
|
|
121
121
|
/** Your Relay profile ID — required */
|
|
122
122
|
profileId: string;
|
|
123
123
|
/** Your logged-in user's stable ID. Omit for anonymous (uses localStorage UID) */
|
|
124
124
|
userId?: string;
|
|
125
|
-
/**
|
|
126
|
-
|
|
127
|
-
|
|
125
|
+
/** Optional: shown to agents in the dashboard */
|
|
126
|
+
userName?: string;
|
|
127
|
+
/** Optional: shown to agents in the dashboard */
|
|
128
|
+
userEmail?: string;
|
|
128
129
|
/** Brand colour hex — default '#f5713c' */
|
|
129
130
|
accent?: string;
|
|
130
|
-
/** Container height
|
|
131
|
+
/** Container height. Default: '100%' */
|
|
131
132
|
height?: string;
|
|
132
133
|
/** i18n overrides */
|
|
133
134
|
i18n?: import('./chatlist.js').ChatListOptions['i18n'];
|
|
134
135
|
}
|
|
135
136
|
/**
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
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.
|
|
139
142
|
*
|
|
140
143
|
* @example
|
|
141
144
|
* ```tsx
|
|
142
145
|
* 'use client'
|
|
143
146
|
* import { ChatList } from '@paramms/chat-widget/react'
|
|
144
|
-
* import { useRouter } from 'next/navigation'
|
|
145
147
|
*
|
|
146
148
|
* export default function MessagesPage({ session }) {
|
|
147
|
-
* const router = useRouter()
|
|
148
149
|
* return (
|
|
149
|
-
* <div style={{ height: '
|
|
150
|
+
* <div style={{ height: '100vh' }}>
|
|
150
151
|
* <ChatList
|
|
151
152
|
* url={process.env.NEXT_PUBLIC_RELAY_WS_URL}
|
|
152
153
|
* profileId={process.env.NEXT_PUBLIC_RELAY_PROFILE_ID}
|
|
153
154
|
* userId={session?.user.id}
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
* router.push(`/listings/${entry.subjectId}`)
|
|
157
|
-
* }}
|
|
155
|
+
* userName={session?.user.name}
|
|
156
|
+
* userEmail={session?.user.email}
|
|
158
157
|
* />
|
|
159
158
|
* </div>
|
|
160
159
|
* )
|
|
161
160
|
* }
|
|
162
161
|
* ```
|
|
163
162
|
*/
|
|
164
|
-
export declare function
|
|
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;
|
|
165
219
|
export {};
|
package/dist/react.js
CHANGED
|
@@ -1,172 +1,365 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { mount as
|
|
4
|
-
function
|
|
5
|
-
url:
|
|
6
|
-
profileId:
|
|
1
|
+
import { jsxs as R, jsx as c, Fragment as M } from "react/jsx-runtime";
|
|
2
|
+
import { useState as W, useRef as m, useEffect as j } from "react";
|
|
3
|
+
import { mount as z } from "./index.js";
|
|
4
|
+
function Y({
|
|
5
|
+
url: x,
|
|
6
|
+
profileId: b,
|
|
7
7
|
userId: t,
|
|
8
|
-
userName:
|
|
8
|
+
userName: i,
|
|
9
9
|
userEmail: r,
|
|
10
|
-
userAvatar:
|
|
11
|
-
contextTitle:
|
|
12
|
-
contextSubtitle:
|
|
10
|
+
userAvatar: n,
|
|
11
|
+
contextTitle: g,
|
|
12
|
+
contextSubtitle: y,
|
|
13
13
|
contextStatus: e,
|
|
14
|
-
subjectId:
|
|
15
|
-
accent:
|
|
16
|
-
launcher:
|
|
17
|
-
position:
|
|
18
|
-
quickReplies:
|
|
19
|
-
height:
|
|
20
|
-
i18n:
|
|
21
|
-
translateLang:
|
|
14
|
+
subjectId: h,
|
|
15
|
+
accent: p,
|
|
16
|
+
launcher: o,
|
|
17
|
+
position: s,
|
|
18
|
+
quickReplies: d,
|
|
19
|
+
height: l = "100%",
|
|
20
|
+
i18n: f,
|
|
21
|
+
translateLang: a
|
|
22
22
|
}) {
|
|
23
|
-
const
|
|
24
|
-
return
|
|
25
|
-
if (
|
|
26
|
-
return
|
|
27
|
-
el:
|
|
28
|
-
url:
|
|
29
|
-
profileId:
|
|
30
|
-
...
|
|
23
|
+
const w = m(null), u = m(null);
|
|
24
|
+
return j(() => {
|
|
25
|
+
if (w.current)
|
|
26
|
+
return u.current = z({
|
|
27
|
+
el: w.current,
|
|
28
|
+
url: x,
|
|
29
|
+
profileId: b,
|
|
30
|
+
...h ? { subjectId: h } : {},
|
|
31
31
|
...t ? { token: t } : {},
|
|
32
|
-
...t ||
|
|
32
|
+
...t || i || r || n ? {
|
|
33
33
|
user: {
|
|
34
|
-
...
|
|
34
|
+
...i ? { name: i } : {},
|
|
35
35
|
...r ? { email: r } : {},
|
|
36
|
-
...
|
|
36
|
+
...n ? { avatar: n } : {}
|
|
37
37
|
}
|
|
38
38
|
} : {},
|
|
39
|
-
...
|
|
39
|
+
...g ? {
|
|
40
40
|
subject: {
|
|
41
|
-
title:
|
|
42
|
-
...
|
|
41
|
+
title: g,
|
|
42
|
+
...y ? { subtitle: y } : {},
|
|
43
43
|
...e ? { status: e } : {}
|
|
44
44
|
}
|
|
45
45
|
} : {},
|
|
46
|
-
...
|
|
47
|
-
...
|
|
48
|
-
...
|
|
49
|
-
...
|
|
50
|
-
...
|
|
46
|
+
...d ? { quickReplies: d } : {},
|
|
47
|
+
...p ? { accent: p } : {},
|
|
48
|
+
...a ? { translateLang: a } : {},
|
|
49
|
+
...f ? { i18n: f } : {},
|
|
50
|
+
...o ? { launcher: o, position: s ?? "bottom-right" } : {}
|
|
51
51
|
}), () => {
|
|
52
|
-
var
|
|
53
|
-
(
|
|
52
|
+
var v;
|
|
53
|
+
(v = u.current) == null || v.close(), u.current = null;
|
|
54
54
|
};
|
|
55
|
-
}, [
|
|
55
|
+
}, [x, b, h, t]), /* @__PURE__ */ c(
|
|
56
56
|
"div",
|
|
57
57
|
{
|
|
58
|
-
ref:
|
|
59
|
-
style:
|
|
58
|
+
ref: w,
|
|
59
|
+
style: o ? { width: 0, height: 0, overflow: "hidden" } : { width: "100%", height: l, minHeight: l === "100%" ? "480px" : void 0 }
|
|
60
60
|
}
|
|
61
61
|
);
|
|
62
62
|
}
|
|
63
|
-
const
|
|
63
|
+
const B = [
|
|
64
64
|
"Is this still available?",
|
|
65
65
|
"Can I schedule a viewing?",
|
|
66
66
|
"What is your best price?"
|
|
67
67
|
];
|
|
68
|
-
function
|
|
69
|
-
url:
|
|
70
|
-
profileId:
|
|
68
|
+
function A({
|
|
69
|
+
url: x,
|
|
70
|
+
profileId: b,
|
|
71
71
|
listingId: t,
|
|
72
|
-
listingTitle:
|
|
72
|
+
listingTitle: i,
|
|
73
73
|
listingMeta: r,
|
|
74
|
-
listingPrice:
|
|
75
|
-
listingStatus:
|
|
76
|
-
userId:
|
|
74
|
+
listingPrice: n,
|
|
75
|
+
listingStatus: g,
|
|
76
|
+
userId: y,
|
|
77
77
|
userName: e,
|
|
78
|
-
userEmail:
|
|
79
|
-
userAvatar:
|
|
80
|
-
accent:
|
|
81
|
-
launcher:
|
|
82
|
-
position:
|
|
83
|
-
quickReplies:
|
|
84
|
-
height:
|
|
85
|
-
i18n:
|
|
86
|
-
translateLang:
|
|
78
|
+
userEmail: h,
|
|
79
|
+
userAvatar: p,
|
|
80
|
+
accent: o,
|
|
81
|
+
launcher: s,
|
|
82
|
+
position: d,
|
|
83
|
+
quickReplies: l,
|
|
84
|
+
height: f = "100%",
|
|
85
|
+
i18n: a,
|
|
86
|
+
translateLang: w
|
|
87
87
|
}) {
|
|
88
|
-
const
|
|
89
|
-
return
|
|
90
|
-
if (
|
|
91
|
-
return
|
|
92
|
-
el:
|
|
93
|
-
url:
|
|
94
|
-
profileId:
|
|
88
|
+
const u = m(null), v = m(null);
|
|
89
|
+
return j(() => {
|
|
90
|
+
if (u.current)
|
|
91
|
+
return v.current = z({
|
|
92
|
+
el: u.current,
|
|
93
|
+
url: x,
|
|
94
|
+
profileId: b,
|
|
95
95
|
// ── Listing context ────────────────────────────────────────────────────
|
|
96
96
|
// When listingId is present: open that listing's chat directly (no list).
|
|
97
97
|
// When listingId is absent: show the thread list (dedicated inbox page).
|
|
98
98
|
...t ? { subjectId: `listing_${t}` } : {},
|
|
99
|
-
...
|
|
100
|
-
...
|
|
99
|
+
...y ? { token: y } : {},
|
|
100
|
+
...y || e || h || p ? {
|
|
101
101
|
user: {
|
|
102
102
|
...e ? { name: e } : {},
|
|
103
|
-
...
|
|
104
|
-
...
|
|
103
|
+
...h ? { email: h } : {},
|
|
104
|
+
...p ? { avatar: p } : {},
|
|
105
105
|
...t ? { meta: { listingId: t } } : {}
|
|
106
106
|
}
|
|
107
107
|
} : {},
|
|
108
|
-
...
|
|
108
|
+
...i ? {
|
|
109
109
|
subject: {
|
|
110
|
-
title:
|
|
110
|
+
title: i,
|
|
111
111
|
...r ? { subtitle: r } : {},
|
|
112
|
-
...
|
|
113
|
-
...
|
|
112
|
+
...n ? { tags: [`$${n.toLocaleString()}`] } : {},
|
|
113
|
+
...g ? { status: g } : {}
|
|
114
114
|
}
|
|
115
115
|
} : {},
|
|
116
|
-
quickReplies:
|
|
117
|
-
...
|
|
118
|
-
...
|
|
119
|
-
...
|
|
120
|
-
...
|
|
116
|
+
quickReplies: l ?? B,
|
|
117
|
+
...o ? { accent: o } : {},
|
|
118
|
+
...w ? { translateLang: w } : {},
|
|
119
|
+
...a ? { i18n: a } : {},
|
|
120
|
+
...s ? { launcher: s, position: d ?? "bottom-right" } : {}
|
|
121
121
|
}), () => {
|
|
122
|
-
var
|
|
123
|
-
(
|
|
122
|
+
var S;
|
|
123
|
+
(S = v.current) == null || S.close(), v.current = null;
|
|
124
124
|
};
|
|
125
|
-
}, [
|
|
125
|
+
}, [x, b, t, y]), /* @__PURE__ */ c(
|
|
126
126
|
"div",
|
|
127
127
|
{
|
|
128
|
-
ref:
|
|
129
|
-
style:
|
|
128
|
+
ref: u,
|
|
129
|
+
style: s ? { width: 0, height: 0, overflow: "hidden" } : { width: "100%", height: f, minHeight: f === "100%" ? "480px" : void 0 }
|
|
130
130
|
}
|
|
131
131
|
);
|
|
132
132
|
}
|
|
133
|
-
function
|
|
134
|
-
url:
|
|
135
|
-
profileId:
|
|
133
|
+
function D({
|
|
134
|
+
url: x,
|
|
135
|
+
profileId: b,
|
|
136
136
|
userId: t,
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
137
|
+
userName: i,
|
|
138
|
+
userEmail: r,
|
|
139
|
+
accent: n,
|
|
140
|
+
height: g = "100%",
|
|
141
|
+
i18n: y
|
|
141
142
|
}) {
|
|
142
|
-
const o =
|
|
143
|
-
|
|
144
|
-
if (
|
|
145
|
-
return import("./chatlist.js").then(({ mountChatList:
|
|
146
|
-
|
|
147
|
-
el:
|
|
148
|
-
url:
|
|
149
|
-
profileId:
|
|
150
|
-
onSelect:
|
|
143
|
+
const [e, h] = W(null), p = m(null), o = m(null), s = m(null), d = m(null);
|
|
144
|
+
j(() => {
|
|
145
|
+
if (p.current)
|
|
146
|
+
return import("./chatlist.js").then(({ mountChatList: f }) => {
|
|
147
|
+
s.current = f({
|
|
148
|
+
el: p.current,
|
|
149
|
+
url: x,
|
|
150
|
+
profileId: b,
|
|
151
|
+
onSelect: (a) => h(a),
|
|
151
152
|
...t ? { userId: t } : {},
|
|
152
|
-
...
|
|
153
|
-
...
|
|
153
|
+
...n ? { accent: n } : {},
|
|
154
|
+
...y ? { i18n: y } : {}
|
|
154
155
|
});
|
|
155
156
|
}), () => {
|
|
156
|
-
var
|
|
157
|
-
(
|
|
157
|
+
var f;
|
|
158
|
+
(f = s.current) == null || f.close(), s.current = null;
|
|
158
159
|
};
|
|
159
|
-
}, [
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
160
|
+
}, [x, b, t]), j(() => {
|
|
161
|
+
var f;
|
|
162
|
+
if (!(!o.current || !e))
|
|
163
|
+
return (f = d.current) == null || f.close(), d.current = z({
|
|
164
|
+
el: o.current,
|
|
165
|
+
url: x,
|
|
166
|
+
profileId: b,
|
|
167
|
+
...e.subjectId ? { subjectId: e.subjectId } : {},
|
|
168
|
+
...t ? { token: t } : {},
|
|
169
|
+
...t || i || r ? {
|
|
170
|
+
user: {
|
|
171
|
+
...i ? { name: i } : {},
|
|
172
|
+
...r ? { email: r } : {}
|
|
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 = d.current) == null || a.close(), d.current = null;
|
|
185
|
+
};
|
|
186
|
+
}, [e == null ? void 0 : e.id]);
|
|
187
|
+
const l = typeof window < "u" && window.innerWidth < 768;
|
|
188
|
+
return /* @__PURE__ */ R("div", { style: { display: "flex", width: "100%", height: g, minHeight: "400px", overflow: "hidden" }, children: [
|
|
189
|
+
/* @__PURE__ */ c("div", { style: {
|
|
190
|
+
width: l ? "100%" : "360px",
|
|
191
|
+
flex: l && e ? "none" : void 0,
|
|
192
|
+
display: l && e ? "none" : "flex",
|
|
193
|
+
flexDirection: "column",
|
|
194
|
+
borderRight: l ? "none" : "1px solid #e8eaed",
|
|
195
|
+
minWidth: 0
|
|
196
|
+
}, children: /* @__PURE__ */ c("div", { ref: p, style: { width: "100%", height: "100%" } }) }),
|
|
197
|
+
e ? /* @__PURE__ */ R("div", { style: { flex: 1, display: "flex", flexDirection: "column", minWidth: 0, position: "relative" }, children: [
|
|
198
|
+
l && /* @__PURE__ */ c(
|
|
199
|
+
"button",
|
|
200
|
+
{
|
|
201
|
+
onClick: () => h(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: l ? "none" : "flex", alignItems: "center", justifyContent: "center", color: "#9b9690", fontSize: 14 }, children: "Select a conversation" })
|
|
208
|
+
] });
|
|
209
|
+
}
|
|
210
|
+
function E({
|
|
211
|
+
url: x,
|
|
212
|
+
profileId: b,
|
|
213
|
+
userId: t,
|
|
214
|
+
userName: i,
|
|
215
|
+
userEmail: r,
|
|
216
|
+
accent: n = "#4F63F5",
|
|
217
|
+
floating: g = !0,
|
|
218
|
+
position: y = "bottom-right",
|
|
219
|
+
label: e,
|
|
220
|
+
panelWidth: h,
|
|
221
|
+
panelHeight: p = "600px"
|
|
222
|
+
}) {
|
|
223
|
+
const [o, s] = W(!1), d = m(null), l = y === "bottom-right", a = e ?? (g ? "💬" : "Messages");
|
|
224
|
+
if (j(() => {
|
|
225
|
+
const k = (L) => {
|
|
226
|
+
L.key === "Escape" && s(!1);
|
|
227
|
+
};
|
|
228
|
+
return document.addEventListener("keydown", k), () => document.removeEventListener("keydown", k);
|
|
229
|
+
}, []), g) {
|
|
230
|
+
const k = typeof window < "u" && window.innerWidth < 480, L = k ? "100vw" : h ?? "420px", H = k ? "100dvh" : p;
|
|
231
|
+
return /* @__PURE__ */ R("div", { style: {
|
|
232
|
+
position: "fixed",
|
|
233
|
+
[l ? "right" : "left"]: "20px",
|
|
234
|
+
bottom: "20px",
|
|
235
|
+
zIndex: 9999,
|
|
236
|
+
display: "flex",
|
|
237
|
+
flexDirection: "column",
|
|
238
|
+
alignItems: l ? "flex-end" : "flex-start",
|
|
239
|
+
gap: "12px"
|
|
240
|
+
}, children: [
|
|
241
|
+
/* @__PURE__ */ c("div", { style: {
|
|
242
|
+
width: L,
|
|
243
|
+
height: H,
|
|
244
|
+
borderRadius: k ? "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 ${l ? "right" : "left"}`,
|
|
251
|
+
animation: o ? "ocl-pop-in .18s ease" : "none"
|
|
252
|
+
}, children: /* @__PURE__ */ c(
|
|
253
|
+
D,
|
|
254
|
+
{
|
|
255
|
+
url: x,
|
|
256
|
+
profileId: b,
|
|
257
|
+
...t ? { userId: t } : {},
|
|
258
|
+
...i ? { userName: i } : {},
|
|
259
|
+
...r ? { userEmail: r } : {},
|
|
260
|
+
accent: n,
|
|
261
|
+
height: "100%"
|
|
262
|
+
}
|
|
263
|
+
) }),
|
|
264
|
+
/* @__PURE__ */ c(
|
|
265
|
+
"button",
|
|
266
|
+
{
|
|
267
|
+
ref: d,
|
|
268
|
+
onClick: () => s((C) => !C),
|
|
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: (C) => {
|
|
283
|
+
C.target.style.transform = "scale(1.08)";
|
|
284
|
+
},
|
|
285
|
+
onMouseLeave: (C) => {
|
|
286
|
+
C.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 w = h ?? "420px", [u, v] = W(null), S = () => {
|
|
295
|
+
!o && d.current && v(d.current.getBoundingClientRect()), s((k) => !k);
|
|
296
|
+
}, $ = u ? u.bottom + 8 : 0, F = u ? window.innerWidth - u.right : 0;
|
|
297
|
+
return /* @__PURE__ */ R(M, { children: [
|
|
298
|
+
/* @__PURE__ */ R(
|
|
299
|
+
"button",
|
|
300
|
+
{
|
|
301
|
+
ref: d,
|
|
302
|
+
onClick: S,
|
|
303
|
+
style: {
|
|
304
|
+
display: "inline-flex",
|
|
305
|
+
alignItems: "center",
|
|
306
|
+
gap: "6px",
|
|
307
|
+
padding: "8px 16px",
|
|
308
|
+
borderRadius: "8px",
|
|
309
|
+
background: o ? n : "transparent",
|
|
310
|
+
color: o ? "#fff" : n,
|
|
311
|
+
border: `2px solid ${n}`,
|
|
312
|
+
fontSize: "14px",
|
|
313
|
+
fontWeight: 600,
|
|
314
|
+
cursor: "pointer",
|
|
315
|
+
transition: "background .15s, color .15s"
|
|
316
|
+
},
|
|
317
|
+
children: [
|
|
318
|
+
"💬 ",
|
|
319
|
+
a
|
|
320
|
+
]
|
|
321
|
+
}
|
|
322
|
+
),
|
|
323
|
+
o && u && /* @__PURE__ */ R(M, { children: [
|
|
324
|
+
/* @__PURE__ */ c(
|
|
325
|
+
"div",
|
|
326
|
+
{
|
|
327
|
+
onClick: () => s(!1),
|
|
328
|
+
style: { position: "fixed", inset: 0, zIndex: 9998 }
|
|
329
|
+
}
|
|
330
|
+
),
|
|
331
|
+
/* @__PURE__ */ c("div", { style: {
|
|
332
|
+
position: "fixed",
|
|
333
|
+
top: $,
|
|
334
|
+
right: F,
|
|
335
|
+
width: w,
|
|
336
|
+
height: p,
|
|
337
|
+
borderRadius: "16px",
|
|
338
|
+
overflow: "hidden",
|
|
339
|
+
boxShadow: "0 8px 40px rgba(0,0,0,.2)",
|
|
340
|
+
background: "#fff",
|
|
341
|
+
zIndex: 9999,
|
|
342
|
+
animation: "ocl-slide-in .18s ease"
|
|
343
|
+
}, children: /* @__PURE__ */ c(
|
|
344
|
+
D,
|
|
345
|
+
{
|
|
346
|
+
url: x,
|
|
347
|
+
profileId: b,
|
|
348
|
+
...t ? { userId: t } : {},
|
|
349
|
+
...i ? { userName: i } : {},
|
|
350
|
+
...r ? { userEmail: r } : {},
|
|
351
|
+
accent: n,
|
|
352
|
+
height: "100%"
|
|
353
|
+
}
|
|
354
|
+
) }),
|
|
355
|
+
/* @__PURE__ */ c("style", { children: "@keyframes ocl-slide-in { from { opacity:0; transform:translateY(-8px) } to { opacity:1; transform:translateY(0) } }" })
|
|
356
|
+
] })
|
|
357
|
+
] });
|
|
166
358
|
}
|
|
167
359
|
export {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
360
|
+
D as ChatApp,
|
|
361
|
+
E as ChatAppLauncher,
|
|
362
|
+
Y as ChatWidget,
|
|
363
|
+
A as MarketplaceChat
|
|
171
364
|
};
|
|
172
365
|
//# sourceMappingURL=react.js.map
|