@linktr.ee/messaging-react 1.6.5 → 1.7.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.
- package/dist/index.d.ts +5 -0
- package/dist/index.js +789 -649
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ChannelList/index.tsx +53 -11
- package/src/components/ChannelView.stories.tsx +365 -0
- package/src/components/ChannelView.tsx +32 -15
- package/src/components/MessagingShell/ChannelEmptyState.tsx +17 -0
- package/src/index.ts +1 -0
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsx as e, jsxs as d, Fragment as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { StreamChatService as
|
|
5
|
-
import { Chat as
|
|
6
|
-
import { NotePencilIcon as
|
|
7
|
-
const
|
|
1
|
+
import we, { jsx as e, jsxs as d, Fragment as de } from "react/jsx-runtime";
|
|
2
|
+
import _ from "classnames";
|
|
3
|
+
import G, { createContext as Oe, useContext as Te, useCallback as M, useState as I, useRef as A, useEffect as $ } from "react";
|
|
4
|
+
import { StreamChatService as je } from "@linktr.ee/messaging-core";
|
|
5
|
+
import { Chat as Ue, useChatContext as Le, ChannelList as Be, Channel as Ae, useChannelStateContext as ye, Window as $e, MessageList as Ge, MessageInput as He } from "stream-chat-react";
|
|
6
|
+
import { NotePencilIcon as qe, XIcon as Ee, ArrowLeftIcon as We, DotsThreeIcon as ze, SpinnerGapIcon as re, SignOutIcon as Ve, ProhibitInsetIcon as fe, FlagIcon as Xe, MagnifyingGlassIcon as Qe, ChatCircleDotsIcon as me } from "@phosphor-icons/react";
|
|
7
|
+
const Ie = Oe({
|
|
8
8
|
service: null,
|
|
9
9
|
client: null,
|
|
10
10
|
isConnected: !1,
|
|
@@ -15,221 +15,308 @@ const fe = we({
|
|
|
15
15
|
refreshConnection: async () => {
|
|
16
16
|
},
|
|
17
17
|
debug: !1
|
|
18
|
-
}),
|
|
18
|
+
}), le = () => Te(Ie), Is = ({
|
|
19
19
|
children: t,
|
|
20
20
|
user: s,
|
|
21
21
|
serviceConfig: n,
|
|
22
|
-
apiKey:
|
|
23
|
-
capabilities:
|
|
22
|
+
apiKey: l,
|
|
23
|
+
capabilities: a = {},
|
|
24
24
|
customization: c = {},
|
|
25
|
-
debug:
|
|
25
|
+
debug: i = !1
|
|
26
26
|
}) => {
|
|
27
|
-
const
|
|
28
|
-
(
|
|
29
|
-
|
|
27
|
+
const r = M(
|
|
28
|
+
(y, ...F) => {
|
|
29
|
+
i && console.log(`🔥 [MessagingProvider] ${y}`, ...F);
|
|
30
30
|
},
|
|
31
|
-
[
|
|
31
|
+
[i]
|
|
32
32
|
);
|
|
33
|
-
|
|
33
|
+
r("🔄 RENDER START", {
|
|
34
34
|
userId: s == null ? void 0 : s.id,
|
|
35
|
-
apiKey: (
|
|
35
|
+
apiKey: (l == null ? void 0 : l.substring(0, 8)) + "...",
|
|
36
36
|
serviceConfig: !!n,
|
|
37
|
-
capabilities: Object.keys(
|
|
37
|
+
capabilities: Object.keys(a),
|
|
38
38
|
customization: Object.keys(c)
|
|
39
39
|
});
|
|
40
|
-
const [
|
|
40
|
+
const [o, C] = I(null), [u, x] = I(null), [b, h] = I(!1), [f, m] = I(!1), [N, S] = I(null), k = A(!1), E = A({
|
|
41
41
|
userId: s == null ? void 0 : s.id,
|
|
42
|
-
apiKey:
|
|
42
|
+
apiKey: l,
|
|
43
43
|
serviceConfig: n,
|
|
44
|
-
capabilities:
|
|
44
|
+
capabilities: a,
|
|
45
45
|
customization: c
|
|
46
|
-
}),
|
|
47
|
-
|
|
48
|
-
renderCount:
|
|
49
|
-
currentProps: { userId: s == null ? void 0 : s.id, apiKey: (
|
|
46
|
+
}), P = A(0);
|
|
47
|
+
P.current++, r("📊 RENDER INFO", {
|
|
48
|
+
renderCount: P.current,
|
|
49
|
+
currentProps: { userId: s == null ? void 0 : s.id, apiKey: (l == null ? void 0 : l.substring(0, 8)) + "..." },
|
|
50
50
|
propChanges: {
|
|
51
|
-
userChanged:
|
|
52
|
-
apiKeyChanged:
|
|
53
|
-
serviceConfigChanged:
|
|
54
|
-
capabilitiesChanged:
|
|
55
|
-
customizationChanged:
|
|
51
|
+
userChanged: E.current.userId !== (s == null ? void 0 : s.id),
|
|
52
|
+
apiKeyChanged: E.current.apiKey !== l,
|
|
53
|
+
serviceConfigChanged: E.current.serviceConfig !== n,
|
|
54
|
+
capabilitiesChanged: E.current.capabilities !== a,
|
|
55
|
+
customizationChanged: E.current.customization !== c
|
|
56
56
|
}
|
|
57
|
-
}),
|
|
57
|
+
}), E.current = {
|
|
58
58
|
userId: s == null ? void 0 : s.id,
|
|
59
|
-
apiKey:
|
|
59
|
+
apiKey: l,
|
|
60
60
|
serviceConfig: n,
|
|
61
|
-
capabilities:
|
|
61
|
+
capabilities: a,
|
|
62
62
|
customization: c
|
|
63
63
|
}, $(() => {
|
|
64
|
-
const
|
|
65
|
-
if (
|
|
66
|
-
renderCount:
|
|
67
|
-
apiKey: !!
|
|
64
|
+
const y = P.current;
|
|
65
|
+
if (r("🔧 SERVICE INIT EFFECT TRIGGERED", {
|
|
66
|
+
renderCount: y,
|
|
67
|
+
apiKey: !!l,
|
|
68
68
|
serviceConfig: !!n,
|
|
69
69
|
dependencies: {
|
|
70
|
-
apiKey: (
|
|
70
|
+
apiKey: (l == null ? void 0 : l.substring(0, 8)) + "...",
|
|
71
71
|
serviceConfigRef: n,
|
|
72
|
-
serviceConfigStable:
|
|
73
|
-
apiKeyStable:
|
|
72
|
+
serviceConfigStable: E.current.serviceConfig === n,
|
|
73
|
+
apiKeyStable: E.current.apiKey === l
|
|
74
74
|
}
|
|
75
|
-
}), !
|
|
76
|
-
|
|
77
|
-
renderCount:
|
|
75
|
+
}), !l || !n) {
|
|
76
|
+
r("⚠️ SERVICE INIT SKIPPED", {
|
|
77
|
+
renderCount: y,
|
|
78
78
|
reason: "Missing apiKey or serviceConfig"
|
|
79
79
|
});
|
|
80
80
|
return;
|
|
81
81
|
}
|
|
82
|
-
|
|
83
|
-
renderCount:
|
|
84
|
-
apiKey: (
|
|
85
|
-
serviceConfigChanged:
|
|
82
|
+
r("🚀 CREATING NEW SERVICE", {
|
|
83
|
+
renderCount: y,
|
|
84
|
+
apiKey: (l == null ? void 0 : l.substring(0, 8)) + "...",
|
|
85
|
+
serviceConfigChanged: E.current.serviceConfig !== n
|
|
86
86
|
});
|
|
87
|
-
const
|
|
87
|
+
const F = new je({
|
|
88
88
|
...n,
|
|
89
|
-
apiKey:
|
|
90
|
-
debug:
|
|
89
|
+
apiKey: l,
|
|
90
|
+
debug: i
|
|
91
91
|
});
|
|
92
|
-
return
|
|
93
|
-
renderCount:
|
|
94
|
-
serviceInstance: !!
|
|
92
|
+
return C(F), r("✅ SERVICE SET", {
|
|
93
|
+
renderCount: y,
|
|
94
|
+
serviceInstance: !!F
|
|
95
95
|
}), () => {
|
|
96
|
-
|
|
97
|
-
renderCount:
|
|
96
|
+
r("🧹 SERVICE CLEANUP", {
|
|
97
|
+
renderCount: y,
|
|
98
98
|
reason: "Effect cleanup"
|
|
99
|
-
}),
|
|
99
|
+
}), F.disconnectUser().catch(console.error);
|
|
100
100
|
};
|
|
101
|
-
}, [
|
|
102
|
-
const
|
|
101
|
+
}, [l, n, i, r]);
|
|
102
|
+
const p = A(null);
|
|
103
103
|
$(() => {
|
|
104
|
-
var
|
|
105
|
-
if (
|
|
106
|
-
hasService: !!
|
|
104
|
+
var F, T;
|
|
105
|
+
if (r("🔗 USER CONNECTION EFFECT TRIGGERED", {
|
|
106
|
+
hasService: !!o,
|
|
107
107
|
hasUser: !!s,
|
|
108
108
|
userId: s == null ? void 0 : s.id,
|
|
109
|
-
isConnecting:
|
|
110
|
-
isConnected:
|
|
111
|
-
dependencies: { service: !!
|
|
112
|
-
}), !
|
|
113
|
-
|
|
109
|
+
isConnecting: k.current,
|
|
110
|
+
isConnected: b,
|
|
111
|
+
dependencies: { service: !!o, userId: s == null ? void 0 : s.id }
|
|
112
|
+
}), !o || !s) {
|
|
113
|
+
r("⚠️ USER CONNECTION SKIPPED", "Missing service or user");
|
|
114
114
|
return;
|
|
115
115
|
}
|
|
116
|
-
if (
|
|
117
|
-
|
|
116
|
+
if (k.current) {
|
|
117
|
+
r("⚠️ USER CONNECTION SKIPPED", "Already connecting");
|
|
118
118
|
return;
|
|
119
119
|
}
|
|
120
|
-
if (((
|
|
121
|
-
|
|
120
|
+
if (((F = p.current) == null ? void 0 : F.serviceId) === o && ((T = p.current) == null ? void 0 : T.userId) === s.id) {
|
|
121
|
+
r(
|
|
122
122
|
"⚠️ USER CONNECTION SKIPPED",
|
|
123
123
|
"Already connected this user with this service"
|
|
124
124
|
);
|
|
125
125
|
return;
|
|
126
126
|
}
|
|
127
127
|
(async () => {
|
|
128
|
-
|
|
128
|
+
r("🚀 STARTING USER CONNECTION", { userId: s.id }), k.current = !0, m(!0), S(null);
|
|
129
129
|
try {
|
|
130
|
-
|
|
131
|
-
const
|
|
132
|
-
|
|
130
|
+
r("📞 CALLING SERVICE.CONNECTUSER", { userId: s.id });
|
|
131
|
+
const j = await o.connectUser(s);
|
|
132
|
+
x(j), h(!0), p.current = { serviceId: o, userId: s.id }, r("✅ USER CONNECTION SUCCESS", {
|
|
133
133
|
userId: s.id,
|
|
134
|
-
clientId:
|
|
134
|
+
clientId: j.userID
|
|
135
135
|
});
|
|
136
|
-
} catch (
|
|
137
|
-
const H =
|
|
138
|
-
S(H),
|
|
136
|
+
} catch (j) {
|
|
137
|
+
const H = j instanceof Error ? j.message : "Connection failed";
|
|
138
|
+
S(H), r("❌ USER CONNECTION ERROR", {
|
|
139
139
|
userId: s.id,
|
|
140
140
|
error: H
|
|
141
141
|
});
|
|
142
142
|
} finally {
|
|
143
|
-
|
|
143
|
+
m(!1), k.current = !1, r("🔄 USER CONNECTION FINISHED", {
|
|
144
144
|
userId: s.id,
|
|
145
|
-
isConnected:
|
|
145
|
+
isConnected: b
|
|
146
146
|
});
|
|
147
147
|
}
|
|
148
148
|
})();
|
|
149
|
-
}, [
|
|
150
|
-
hasService: !!
|
|
151
|
-
isConnected:
|
|
149
|
+
}, [o, s, r, b]), $(() => (r("🔌 CLEANUP EFFECT REGISTERED", {
|
|
150
|
+
hasService: !!o,
|
|
151
|
+
isConnected: b
|
|
152
152
|
}), () => {
|
|
153
|
-
|
|
153
|
+
o && b ? (r(
|
|
154
154
|
"🧹 CLEANUP EFFECT TRIGGERED",
|
|
155
155
|
"Cleaning up connection on unmount"
|
|
156
|
-
),
|
|
157
|
-
hasService: !!
|
|
158
|
-
isConnected:
|
|
156
|
+
), p.current = null, o.disconnectUser().catch(console.error)) : r("🔇 CLEANUP EFFECT SKIPPED", {
|
|
157
|
+
hasService: !!o,
|
|
158
|
+
isConnected: b
|
|
159
159
|
});
|
|
160
|
-
}), [
|
|
161
|
-
const
|
|
162
|
-
if (
|
|
163
|
-
hasService: !!
|
|
160
|
+
}), [o, b, r]);
|
|
161
|
+
const g = M(async () => {
|
|
162
|
+
if (r("🔄 REFRESH CONNECTION CALLED", {
|
|
163
|
+
hasService: !!o,
|
|
164
164
|
hasUser: !!s
|
|
165
|
-
}), !
|
|
166
|
-
|
|
165
|
+
}), !o || !s) {
|
|
166
|
+
r("⚠️ REFRESH CONNECTION SKIPPED", "Missing service or user");
|
|
167
167
|
return;
|
|
168
168
|
}
|
|
169
|
-
|
|
169
|
+
r("🚀 STARTING CONNECTION REFRESH", { userId: s.id }), m(!0);
|
|
170
170
|
try {
|
|
171
|
-
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
} catch (
|
|
175
|
-
const
|
|
176
|
-
S(
|
|
171
|
+
r("🔌 DISCONNECTING FOR REFRESH"), await o.disconnectUser(), r("📞 RECONNECTING FOR REFRESH");
|
|
172
|
+
const y = await o.connectUser(s);
|
|
173
|
+
x(y), h(!0), S(null), r("✅ CONNECTION REFRESH SUCCESS", { userId: s.id });
|
|
174
|
+
} catch (y) {
|
|
175
|
+
const F = y instanceof Error ? y.message : "Refresh failed";
|
|
176
|
+
S(F), r("❌ CONNECTION REFRESH ERROR", {
|
|
177
177
|
userId: s.id,
|
|
178
|
-
error:
|
|
178
|
+
error: F
|
|
179
179
|
});
|
|
180
180
|
} finally {
|
|
181
|
-
|
|
181
|
+
m(!1), r("🔄 CONNECTION REFRESH FINISHED", { userId: s.id });
|
|
182
182
|
}
|
|
183
|
-
}, [
|
|
184
|
-
hasService: !!
|
|
183
|
+
}, [o, s, r]), v = G.useMemo(() => (r("💫 CONTEXT VALUE MEMOIZATION", {
|
|
184
|
+
hasService: !!o,
|
|
185
185
|
hasClient: !!u,
|
|
186
|
-
isConnected:
|
|
187
|
-
isLoading:
|
|
188
|
-
hasError: !!
|
|
189
|
-
capabilitiesKeys: Object.keys(
|
|
186
|
+
isConnected: b,
|
|
187
|
+
isLoading: f,
|
|
188
|
+
hasError: !!N,
|
|
189
|
+
capabilitiesKeys: Object.keys(a),
|
|
190
190
|
customizationKeys: Object.keys(c)
|
|
191
191
|
}), {
|
|
192
|
-
service:
|
|
192
|
+
service: o,
|
|
193
193
|
client: u,
|
|
194
|
-
isConnected:
|
|
195
|
-
isLoading:
|
|
196
|
-
error:
|
|
197
|
-
capabilities:
|
|
194
|
+
isConnected: b,
|
|
195
|
+
isLoading: f,
|
|
196
|
+
error: N,
|
|
197
|
+
capabilities: a,
|
|
198
198
|
customization: c,
|
|
199
|
-
refreshConnection:
|
|
200
|
-
debug:
|
|
199
|
+
refreshConnection: g,
|
|
200
|
+
debug: i
|
|
201
201
|
}), [
|
|
202
|
-
|
|
202
|
+
o,
|
|
203
203
|
u,
|
|
204
|
-
|
|
205
|
-
N,
|
|
206
|
-
v,
|
|
207
|
-
i,
|
|
208
|
-
c,
|
|
204
|
+
b,
|
|
209
205
|
f,
|
|
206
|
+
N,
|
|
210
207
|
a,
|
|
211
|
-
|
|
208
|
+
c,
|
|
209
|
+
g,
|
|
210
|
+
i,
|
|
211
|
+
r
|
|
212
212
|
]);
|
|
213
|
-
return
|
|
214
|
-
renderCount:
|
|
215
|
-
willRenderChat: !!(u &&
|
|
216
|
-
contextValueReady: !!
|
|
217
|
-
}), /* @__PURE__ */ e(
|
|
218
|
-
},
|
|
219
|
-
function
|
|
213
|
+
return r("🔄 RENDER END", {
|
|
214
|
+
renderCount: P.current,
|
|
215
|
+
willRenderChat: !!(u && b),
|
|
216
|
+
contextValueReady: !!v
|
|
217
|
+
}), /* @__PURE__ */ e(Ie.Provider, { value: v, children: u && b ? /* @__PURE__ */ e(Ue, { client: u, children: t }) : t });
|
|
218
|
+
}, Ze = () => le();
|
|
219
|
+
function Se(t) {
|
|
220
|
+
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
221
|
+
}
|
|
222
|
+
var K = {}, Q = {}, ee = {}, he;
|
|
223
|
+
function Je() {
|
|
224
|
+
return he || (he = 1, (function(t) {
|
|
225
|
+
var s = ee && ee.__importDefault || function(c) {
|
|
226
|
+
return c && c.__esModule ? c : { default: c };
|
|
227
|
+
};
|
|
228
|
+
Object.defineProperty(t, "__esModule", { value: !0 }), t.baseStyleClasses = void 0;
|
|
229
|
+
const n = s(G), l = s(_);
|
|
230
|
+
t.baseStyleClasses = (0, l.default)("text-sm", "h-2xl", "block", "p-md", "w-full", "rounded-sm", "bg-chalk", "text-black", "transition", "duration-75", "ease-out", "!outline-none");
|
|
231
|
+
const a = ({ className: c, onChange: i, onChangeValue: r, appearance: o = "default", ...C }, u) => {
|
|
232
|
+
const x = o === "none" ? "appearance-none" : t.baseStyleClasses, b = ({ target: { value: h, checked: f } }) => C.type === "checkbox" ? r == null ? void 0 : r(f) : r == null ? void 0 : r(h);
|
|
233
|
+
return n.default.createElement("input", {
|
|
234
|
+
...C,
|
|
235
|
+
className: (0, l.default)(c, x),
|
|
236
|
+
onChange: i || r && b,
|
|
237
|
+
ref: u
|
|
238
|
+
});
|
|
239
|
+
};
|
|
240
|
+
t.default = n.default.forwardRef(a);
|
|
241
|
+
})(ee)), ee;
|
|
242
|
+
}
|
|
243
|
+
var ge;
|
|
244
|
+
function Ye() {
|
|
245
|
+
if (ge) return Q;
|
|
246
|
+
ge = 1;
|
|
247
|
+
var t = Q && Q.__importDefault || function(i) {
|
|
248
|
+
return i && i.__esModule ? i : { default: i };
|
|
249
|
+
};
|
|
250
|
+
Object.defineProperty(Q, "__esModule", { value: !0 });
|
|
251
|
+
const s = we, n = t(G), l = t(_), a = t(Je()), c = ({ id: i, name: r, label: o, className: C = "", checked: u, defaultChecked: x, inactive: b, value: h, tabIndex: f, icon: m, ...N }, S) => {
|
|
252
|
+
const k = u || x, E = b || (N == null ? void 0 : N.disabled), P = ({ key: p, code: g }) => {
|
|
253
|
+
var v;
|
|
254
|
+
N.onChangeValue && (p === "Enter" || g === "Space") && ((v = N.onChangeValue) == null || v.call(N, h));
|
|
255
|
+
};
|
|
256
|
+
return (0, s.jsx)("div", { className: (0, l.default)("inline-flex", "first:ml-xs", "max-w-full"), children: (0, s.jsxs)("label", { htmlFor: i, tabIndex: f, className: (0, l.default)("w-fit", "h-10", "px-md", "rounded-lg", "inline-flex", "justify-center", "border", "hover:ring-1", "hover:ring-sand", "relative", "transition duration-75 ease-out", "max-w-full", C, {
|
|
257
|
+
"pointer-events-none": E,
|
|
258
|
+
"cursor-pointer": !E,
|
|
259
|
+
// Selected
|
|
260
|
+
"border-black": k,
|
|
261
|
+
"bg-black": k,
|
|
262
|
+
// Not selected
|
|
263
|
+
"bg-white": !k,
|
|
264
|
+
"border-sand": !k,
|
|
265
|
+
"hover:border-sand": !k
|
|
266
|
+
}), children: [(0, s.jsx)(a.default, { type: "checkbox", id: i, name: r, value: h, checked: u, defaultChecked: x, appearance: "none", className: (0, l.default)("cursor-pointer", "outline-none", "focus-visible:ring-2", "focus-visible:ring-black", "absolute", "-top-[3px]", "left-4px", "w-[calc(100%+6px)]", "h-[calc(100%+6px)]", "rounded-[48px]", "transition duration-75 ease-out"), disabled: E, onKeyDown: P, ref: S, ...N }), (0, s.jsxs)("span", { className: (0, l.default)("pointer-events-none", "select-none", "self-center", "text-sm", "flex", "mt-[1px]", "truncate", {
|
|
267
|
+
"text-pebble": E,
|
|
268
|
+
"text-white": k,
|
|
269
|
+
"text-black": !k && !E
|
|
270
|
+
}), children: [m && (0, s.jsx)("div", { className: "icon mr-xs self-center", children: m }), (0, s.jsx)("span", { className: "label", children: o || r })] })] }) });
|
|
271
|
+
};
|
|
272
|
+
return Q.default = n.default.forwardRef(c), Q;
|
|
273
|
+
}
|
|
274
|
+
var Z = {}, xe;
|
|
275
|
+
function ke() {
|
|
276
|
+
if (xe) return Z;
|
|
277
|
+
xe = 1;
|
|
278
|
+
var t = Z && Z.__importDefault || function(a) {
|
|
279
|
+
return a && a.__esModule ? a : { default: a };
|
|
280
|
+
};
|
|
281
|
+
Object.defineProperty(Z, "__esModule", { value: !0 });
|
|
282
|
+
const s = we, n = t(G), l = ({ children: a, label: c, className: i = "" }, r) => (0, s.jsxs)("fieldset", { className: `${i} -ml-xs space-x-xs space-y-xs`, ref: r, children: [c && (0, s.jsx)("legend", { className: "mb-sm ml-sm text-sm font-semibold", children: c }), a] });
|
|
283
|
+
return Z.default = n.default.forwardRef(l), Z;
|
|
284
|
+
}
|
|
285
|
+
var be;
|
|
286
|
+
function Ke() {
|
|
287
|
+
return be || (be = 1, (function(t) {
|
|
288
|
+
var s = K && K.__importDefault || function(a) {
|
|
289
|
+
return a && a.__esModule ? a : { default: a };
|
|
290
|
+
};
|
|
291
|
+
Object.defineProperty(t, "__esModule", { value: !0 }), t.InputSelectPillGroup = t.default = void 0;
|
|
292
|
+
var n = Ye();
|
|
293
|
+
Object.defineProperty(t, "default", { enumerable: !0, get: function() {
|
|
294
|
+
return s(n).default;
|
|
295
|
+
} });
|
|
296
|
+
var l = ke();
|
|
297
|
+
Object.defineProperty(t, "InputSelectPillGroup", { enumerable: !0, get: function() {
|
|
298
|
+
return s(l).default;
|
|
299
|
+
} });
|
|
300
|
+
})(K)), K;
|
|
301
|
+
}
|
|
302
|
+
var es = Ke();
|
|
303
|
+
const Ne = /* @__PURE__ */ Se(es);
|
|
304
|
+
var ss = ke();
|
|
305
|
+
const ts = /* @__PURE__ */ Se(ss);
|
|
306
|
+
function oe({ label: t, className: s, children: n, ...l }) {
|
|
220
307
|
return /* @__PURE__ */ d(
|
|
221
308
|
"button",
|
|
222
309
|
{
|
|
223
310
|
type: "button",
|
|
224
|
-
className:
|
|
311
|
+
className: _(
|
|
225
312
|
"rounded-full p-2 transition-colors focus-ring",
|
|
226
313
|
{
|
|
227
|
-
"cursor-not-allowed opacity-50":
|
|
228
|
-
"hover:bg-sand": !
|
|
314
|
+
"cursor-not-allowed opacity-50": l.disabled,
|
|
315
|
+
"hover:bg-sand": !l.disabled
|
|
229
316
|
},
|
|
230
317
|
s
|
|
231
318
|
),
|
|
232
|
-
...
|
|
319
|
+
...l,
|
|
233
320
|
children: [
|
|
234
321
|
/* @__PURE__ */ e("span", { className: "sr-only", children: t }),
|
|
235
322
|
n
|
|
@@ -237,7 +324,7 @@ function ne({ label: t, className: s, children: n, ...o }) {
|
|
|
237
324
|
}
|
|
238
325
|
);
|
|
239
326
|
}
|
|
240
|
-
const
|
|
327
|
+
const ve = [
|
|
241
328
|
"🍎",
|
|
242
329
|
// Apple
|
|
243
330
|
"🍌",
|
|
@@ -265,31 +352,31 @@ const de = [
|
|
|
265
352
|
"🍈"
|
|
266
353
|
// Melon
|
|
267
354
|
];
|
|
268
|
-
function
|
|
355
|
+
function ns(t) {
|
|
269
356
|
let s = 0;
|
|
270
357
|
for (let n = 0; n < t.length; n++) {
|
|
271
|
-
const
|
|
272
|
-
s = (s << 5) - s +
|
|
358
|
+
const l = t.charCodeAt(n);
|
|
359
|
+
s = (s << 5) - s + l, s = s & s;
|
|
273
360
|
}
|
|
274
361
|
return Math.abs(s);
|
|
275
362
|
}
|
|
276
|
-
function
|
|
277
|
-
const n =
|
|
278
|
-
return
|
|
363
|
+
function rs(t) {
|
|
364
|
+
const n = ns(t) % ve.length;
|
|
365
|
+
return ve[n];
|
|
279
366
|
}
|
|
280
|
-
const
|
|
367
|
+
const se = ({
|
|
281
368
|
id: t,
|
|
282
369
|
image: s,
|
|
283
370
|
size: n = 40,
|
|
284
|
-
className:
|
|
371
|
+
className: l
|
|
285
372
|
}) => {
|
|
286
|
-
const
|
|
373
|
+
const a = rs(t), c = "#FBFAF9", r = n < 32 ? "text-xs" : n < 56 ? "text-sm" : "text-lg";
|
|
287
374
|
return /* @__PURE__ */ e(
|
|
288
375
|
"div",
|
|
289
376
|
{
|
|
290
|
-
className:
|
|
377
|
+
className: _(
|
|
291
378
|
"flex-shrink-0 overflow-hidden rounded-lg",
|
|
292
|
-
|
|
379
|
+
l
|
|
293
380
|
),
|
|
294
381
|
style: { width: `${n}px`, height: `${n}px` },
|
|
295
382
|
children: s ? /* @__PURE__ */ e(
|
|
@@ -303,44 +390,44 @@ const J = ({
|
|
|
303
390
|
"div",
|
|
304
391
|
{
|
|
305
392
|
"aria-hidden": "true",
|
|
306
|
-
className:
|
|
393
|
+
className: _(
|
|
307
394
|
"flex h-full w-full items-center justify-center font-semibold rounded-sm",
|
|
308
|
-
|
|
395
|
+
r
|
|
309
396
|
),
|
|
310
397
|
style: {
|
|
311
398
|
color: c,
|
|
312
399
|
backgroundColor: `color-mix(in srgb, ${c} 60%, solid)`
|
|
313
400
|
},
|
|
314
|
-
children:
|
|
401
|
+
children: a
|
|
315
402
|
}
|
|
316
403
|
)
|
|
317
404
|
}
|
|
318
405
|
);
|
|
319
|
-
},
|
|
320
|
-
var
|
|
321
|
-
const c = (s == null ? void 0 : s.id) === (t == null ? void 0 : t.id),
|
|
406
|
+
}, ls = ({ channel: t, selectedChannel: s, onChannelSelect: n, debug: l = !1, unread: a }) => {
|
|
407
|
+
var m, N, S, k, E, P;
|
|
408
|
+
const c = (s == null ? void 0 : s.id) === (t == null ? void 0 : t.id), i = () => {
|
|
322
409
|
t && n(t);
|
|
323
|
-
},
|
|
324
|
-
(
|
|
325
|
-
var
|
|
326
|
-
return ((
|
|
410
|
+
}, o = Object.values(((m = t == null ? void 0 : t.state) == null ? void 0 : m.members) || {}).find(
|
|
411
|
+
(p) => {
|
|
412
|
+
var g, v;
|
|
413
|
+
return ((g = p.user) == null ? void 0 : g.id) && p.user.id !== ((v = t == null ? void 0 : t._client) == null ? void 0 : v.userID);
|
|
327
414
|
}
|
|
328
|
-
),
|
|
415
|
+
), C = ((N = o == null ? void 0 : o.user) == null ? void 0 : N.name) || "Conversation", u = (S = o == null ? void 0 : o.user) == null ? void 0 : S.image, x = (E = (k = t == null ? void 0 : t.state) == null ? void 0 : k.messages) == null ? void 0 : E[t.state.messages.length - 1], b = (x == null ? void 0 : x.text) || "No messages yet", h = x != null && x.created_at ? new Date(x.created_at).toLocaleTimeString([], {
|
|
329
416
|
hour: "2-digit",
|
|
330
417
|
minute: "2-digit"
|
|
331
|
-
}) : "",
|
|
332
|
-
return
|
|
418
|
+
}) : "", f = a ?? 0;
|
|
419
|
+
return l && console.log("📺 [ChannelList] 📋 CHANNEL PREVIEW RENDER", {
|
|
333
420
|
channelId: t == null ? void 0 : t.id,
|
|
334
421
|
isSelected: c,
|
|
335
|
-
participantName:
|
|
336
|
-
unreadCount:
|
|
337
|
-
hasTimestamp: !!
|
|
422
|
+
participantName: C,
|
|
423
|
+
unreadCount: f,
|
|
424
|
+
hasTimestamp: !!h
|
|
338
425
|
}), /* @__PURE__ */ e(
|
|
339
426
|
"button",
|
|
340
427
|
{
|
|
341
428
|
type: "button",
|
|
342
|
-
onClick:
|
|
343
|
-
className:
|
|
429
|
+
onClick: i,
|
|
430
|
+
className: _(
|
|
344
431
|
"w-full px-4 py-3 transition-colors border-b border-sand text-left max-w-full overflow-hidden focus-ring",
|
|
345
432
|
{
|
|
346
433
|
"bg-primary-alt/10 border-l-4 border-l-primary": c,
|
|
@@ -349,10 +436,10 @@ const J = ({
|
|
|
349
436
|
),
|
|
350
437
|
children: /* @__PURE__ */ d("div", { className: "flex items-start gap-3", children: [
|
|
351
438
|
/* @__PURE__ */ e(
|
|
352
|
-
|
|
439
|
+
se,
|
|
353
440
|
{
|
|
354
|
-
id: ((
|
|
355
|
-
name:
|
|
441
|
+
id: ((P = o == null ? void 0 : o.user) == null ? void 0 : P.id) || t.id || "unknown",
|
|
442
|
+
name: C,
|
|
356
443
|
image: u,
|
|
357
444
|
size: 44
|
|
358
445
|
}
|
|
@@ -362,105 +449,137 @@ const J = ({
|
|
|
362
449
|
/* @__PURE__ */ e(
|
|
363
450
|
"h3",
|
|
364
451
|
{
|
|
365
|
-
className:
|
|
452
|
+
className: _(
|
|
366
453
|
"text-sm font-medium truncate",
|
|
367
454
|
c ? "text-primary" : "text-charcoal"
|
|
368
455
|
),
|
|
369
|
-
children:
|
|
456
|
+
children: C
|
|
370
457
|
}
|
|
371
458
|
),
|
|
372
|
-
|
|
459
|
+
h && /* @__PURE__ */ e("span", { className: "text-xs text-stone flex-shrink-0", children: h })
|
|
373
460
|
] }),
|
|
374
461
|
/* @__PURE__ */ d("div", { className: "flex items-center justify-between gap-2 min-w-0", children: [
|
|
375
|
-
/* @__PURE__ */ e("p", { className: "text-xs text-stone mr-2 flex-1 line-clamp-2", children:
|
|
376
|
-
|
|
462
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-stone mr-2 flex-1 line-clamp-2", children: b }),
|
|
463
|
+
f > 0 && /* @__PURE__ */ e("span", { className: "bg-primary text-white text-xs px-2 py-0.5 rounded-full min-w-[20px] text-center flex-shrink-0", children: f > 99 ? "99+" : f })
|
|
377
464
|
] })
|
|
378
465
|
] })
|
|
379
466
|
] })
|
|
380
467
|
}
|
|
381
468
|
);
|
|
382
|
-
},
|
|
469
|
+
}, os = ({
|
|
383
470
|
onChannelSelect: t,
|
|
384
471
|
selectedChannel: s,
|
|
385
472
|
showStartConversation: n = !1,
|
|
386
|
-
onStartConversation:
|
|
387
|
-
participantLabel:
|
|
473
|
+
onStartConversation: l,
|
|
474
|
+
participantLabel: a = "participants",
|
|
388
475
|
className: c
|
|
389
476
|
}) => {
|
|
390
|
-
var
|
|
391
|
-
const
|
|
392
|
-
|
|
393
|
-
const { debug:
|
|
394
|
-
|
|
395
|
-
renderCount:
|
|
477
|
+
var b;
|
|
478
|
+
const i = G.useRef(0);
|
|
479
|
+
i.current++;
|
|
480
|
+
const { debug: r = !1 } = le();
|
|
481
|
+
r && console.log("📺 [ChannelList] 🔄 RENDER START", {
|
|
482
|
+
renderCount: i.current,
|
|
396
483
|
selectedChannelId: s == null ? void 0 : s.id,
|
|
397
484
|
showStartConversation: n,
|
|
398
|
-
participantLabel:
|
|
485
|
+
participantLabel: a
|
|
399
486
|
});
|
|
400
|
-
const { client:
|
|
401
|
-
|
|
402
|
-
renderCount:
|
|
403
|
-
hasClient: !!
|
|
404
|
-
clientUserId:
|
|
405
|
-
clientConnected: (
|
|
487
|
+
const { client: o } = Le();
|
|
488
|
+
r && console.log("📺 [ChannelList] 📡 CHAT CONTEXT", {
|
|
489
|
+
renderCount: i.current,
|
|
490
|
+
hasClient: !!o,
|
|
491
|
+
clientUserId: o == null ? void 0 : o.userID,
|
|
492
|
+
clientConnected: (b = o == null ? void 0 : o.wsConnection) == null ? void 0 : b.isHealthy
|
|
406
493
|
});
|
|
407
|
-
const
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
}
|
|
419
|
-
|
|
494
|
+
const [C, u] = I({
|
|
495
|
+
type: "messaging",
|
|
496
|
+
last_message_at: { $exists: !0 },
|
|
497
|
+
has_unread: void 0
|
|
498
|
+
}), x = G.useMemo(() => {
|
|
499
|
+
const h = o.userID, f = {
|
|
500
|
+
...C,
|
|
501
|
+
...h && {
|
|
502
|
+
members: { $in: [h] },
|
|
503
|
+
hidden: !1
|
|
504
|
+
}
|
|
505
|
+
};
|
|
506
|
+
return r && console.log("📺 [ChannelList] 🔍 FILTERS MEMOIZED", {
|
|
507
|
+
renderCount: i.current,
|
|
508
|
+
userId: h,
|
|
509
|
+
filters: f
|
|
510
|
+
}), f;
|
|
511
|
+
}, [o.userID, r, C]);
|
|
420
512
|
return /* @__PURE__ */ d(
|
|
421
513
|
"div",
|
|
422
514
|
{
|
|
423
|
-
className:
|
|
515
|
+
className: _(
|
|
424
516
|
"messaging-channel-list h-full flex flex-col min-w-0 overflow-hidden",
|
|
425
517
|
c
|
|
426
518
|
),
|
|
427
519
|
children: [
|
|
428
520
|
/* @__PURE__ */ e("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: /* @__PURE__ */ d("div", { className: "flex items-center justify-between gap-3 min-h-10 min-w-0", children: [
|
|
429
|
-
/* @__PURE__ */
|
|
430
|
-
|
|
431
|
-
|
|
521
|
+
/* @__PURE__ */ d("div", { children: [
|
|
522
|
+
/* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-charcoal", children: "Conversations" }),
|
|
523
|
+
/* @__PURE__ */ d(ts, { children: [
|
|
524
|
+
/* @__PURE__ */ e(
|
|
525
|
+
Ne,
|
|
526
|
+
{
|
|
527
|
+
checked: !x.has_unread,
|
|
528
|
+
name: "All",
|
|
529
|
+
onChange: () => u((h) => ({
|
|
530
|
+
...h,
|
|
531
|
+
has_unread: void 0
|
|
532
|
+
})),
|
|
533
|
+
value: 0
|
|
534
|
+
/* All */
|
|
535
|
+
}
|
|
536
|
+
),
|
|
537
|
+
/* @__PURE__ */ e(
|
|
538
|
+
Ne,
|
|
539
|
+
{
|
|
540
|
+
checked: x.has_unread,
|
|
541
|
+
name: "Unread",
|
|
542
|
+
onChange: () => u((h) => ({ ...h, has_unread: !0 })),
|
|
543
|
+
value: 1
|
|
544
|
+
/* Unread */
|
|
545
|
+
}
|
|
546
|
+
)
|
|
547
|
+
] })
|
|
548
|
+
] }),
|
|
549
|
+
/* @__PURE__ */ e("div", { className: "flex items-center gap-2", children: n && l && /* @__PURE__ */ e(
|
|
550
|
+
oe,
|
|
432
551
|
{
|
|
433
552
|
label: "Start a new conversation",
|
|
434
|
-
onClick:
|
|
553
|
+
onClick: l,
|
|
435
554
|
className: "inline-flex size-10 items-center justify-center",
|
|
436
|
-
children: /* @__PURE__ */ e(
|
|
555
|
+
children: /* @__PURE__ */ e(qe, { className: "h-5 w-5" })
|
|
437
556
|
}
|
|
438
557
|
) })
|
|
439
558
|
] }) }),
|
|
440
|
-
/* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden min-w-0", children: (
|
|
441
|
-
renderCount:
|
|
442
|
-
filters:
|
|
443
|
-
hasClient: !!
|
|
444
|
-
clientUserId:
|
|
559
|
+
/* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden min-w-0", children: (r && console.log("📺 [ChannelList] 🎬 RENDERING STREAM CHANNEL LIST", {
|
|
560
|
+
renderCount: i.current,
|
|
561
|
+
filters: x,
|
|
562
|
+
hasClient: !!o,
|
|
563
|
+
clientUserId: o == null ? void 0 : o.userID
|
|
445
564
|
}), /* @__PURE__ */ e(
|
|
446
|
-
|
|
565
|
+
Be,
|
|
447
566
|
{
|
|
448
|
-
filters:
|
|
567
|
+
filters: x,
|
|
449
568
|
sort: { last_message_at: -1 },
|
|
450
569
|
options: { limit: 30 },
|
|
451
|
-
Preview: (
|
|
452
|
-
var
|
|
453
|
-
return
|
|
454
|
-
channelId: (
|
|
570
|
+
Preview: (h) => {
|
|
571
|
+
var f, m;
|
|
572
|
+
return r && console.log("📺 [ChannelList] 📋 CHANNEL PREVIEW RENDER", {
|
|
573
|
+
channelId: (f = h.channel) == null ? void 0 : f.id,
|
|
455
574
|
selectedChannelId: s == null ? void 0 : s.id,
|
|
456
|
-
isSelected: (s == null ? void 0 : s.id) === ((
|
|
575
|
+
isSelected: (s == null ? void 0 : s.id) === ((m = h.channel) == null ? void 0 : m.id)
|
|
457
576
|
}), /* @__PURE__ */ e(
|
|
458
|
-
|
|
577
|
+
ls,
|
|
459
578
|
{
|
|
460
|
-
...
|
|
579
|
+
...h,
|
|
461
580
|
selectedChannel: s,
|
|
462
581
|
onChannelSelect: t,
|
|
463
|
-
debug:
|
|
582
|
+
debug: r
|
|
464
583
|
}
|
|
465
584
|
);
|
|
466
585
|
}
|
|
@@ -469,38 +588,41 @@ const J = ({
|
|
|
469
588
|
]
|
|
470
589
|
}
|
|
471
590
|
);
|
|
472
|
-
},
|
|
591
|
+
}, ne = ({
|
|
473
592
|
variant: t = "default",
|
|
474
593
|
className: s,
|
|
475
594
|
children: n,
|
|
476
|
-
...
|
|
595
|
+
...l
|
|
477
596
|
}) => /* @__PURE__ */ e(
|
|
478
597
|
"button",
|
|
479
598
|
{
|
|
480
599
|
type: "button",
|
|
481
|
-
className:
|
|
600
|
+
className: _(
|
|
482
601
|
"flex w-full items-center gap-3 rounded-lg px-4 py-3 text-left text-sm transition-colors focus-ring disabled:cursor-not-allowed disabled:opacity-60",
|
|
483
602
|
t === "danger" ? "text-danger hover:bg-danger/50" : "text-charcoal hover:bg-sand",
|
|
484
603
|
s
|
|
485
604
|
),
|
|
486
|
-
...
|
|
605
|
+
...l,
|
|
487
606
|
children: n
|
|
488
607
|
}
|
|
489
608
|
);
|
|
490
|
-
function
|
|
491
|
-
return /* @__PURE__ */ e(
|
|
609
|
+
function Re({ onClick: t }) {
|
|
610
|
+
return /* @__PURE__ */ e(oe, { label: "Close", onClick: t, className: "p-1", children: /* @__PURE__ */ e(Ee, { className: "h-5 w-5 text-stone", weight: "bold" }) });
|
|
492
611
|
}
|
|
493
|
-
const
|
|
612
|
+
const Pe = () => /* @__PURE__ */ e("div", { className: "messaging-channel-empty-state flex items-center justify-center h-full p-8 text-balance", children: /* @__PURE__ */ d("div", { className: "text-center max-w-sm", children: [
|
|
613
|
+
/* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal mb-2", children: "No messages yet 👀" }),
|
|
614
|
+
/* @__PURE__ */ e("p", { className: "text-stone text-xs", children: "Share to social media to generate more conversations" })
|
|
615
|
+
] }) }), as = ({ renderActions: t }) => /* @__PURE__ */ d("div", { className: "message-input flex items-center gap-2 p-4", children: [
|
|
494
616
|
t && t(),
|
|
495
|
-
/* @__PURE__ */ e("div", { className: "flex-1", children: /* @__PURE__ */ e(
|
|
496
|
-
] }),
|
|
497
|
-
var
|
|
498
|
-
const { channel:
|
|
499
|
-
(
|
|
500
|
-
var
|
|
501
|
-
return ((
|
|
617
|
+
/* @__PURE__ */ e("div", { className: "flex-1", children: /* @__PURE__ */ e(He, { focus: !0, maxRows: 4 }) })
|
|
618
|
+
] }), is = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: l }) => {
|
|
619
|
+
var o, C, u, x;
|
|
620
|
+
const { channel: a } = ye(), c = G.useMemo(() => Object.values(a.state.members || {}).find(
|
|
621
|
+
(h) => {
|
|
622
|
+
var f;
|
|
623
|
+
return ((f = h.user) == null ? void 0 : f.id) && h.user.id !== a._client.userID;
|
|
502
624
|
}
|
|
503
|
-
), [
|
|
625
|
+
), [a._client.userID, a.state.members]), i = ((o = c == null ? void 0 : c.user) == null ? void 0 : o.name) || ((C = c == null ? void 0 : c.user) == null ? void 0 : C.id) || "Unknown member", r = (u = c == null ? void 0 : c.user) == null ? void 0 : u.image;
|
|
504
626
|
return /* @__PURE__ */ d("div", { className: "flex items-center justify-between gap-3 min-h-12", children: [
|
|
505
627
|
/* @__PURE__ */ d("div", { className: "flex items-center gap-3 min-w-0", children: [
|
|
506
628
|
s && t && /* @__PURE__ */ e(
|
|
@@ -510,96 +632,96 @@ const He = ({ renderActions: t }) => /* @__PURE__ */ d("div", { className: "mess
|
|
|
510
632
|
onClick: t,
|
|
511
633
|
className: "inline-flex items-center justify-center w-8 h-8 rounded-lg hover:bg-sand focus:outline-none focus:ring-2 focus:ring-primary transition-colors lg:hidden",
|
|
512
634
|
"aria-label": "Back to conversations",
|
|
513
|
-
children: /* @__PURE__ */ e(
|
|
635
|
+
children: /* @__PURE__ */ e(We, { className: "h-5 w-5 text-stone", weight: "bold" })
|
|
514
636
|
}
|
|
515
637
|
),
|
|
516
638
|
/* @__PURE__ */ e(
|
|
517
|
-
|
|
639
|
+
se,
|
|
518
640
|
{
|
|
519
|
-
id: ((
|
|
520
|
-
name:
|
|
521
|
-
image:
|
|
641
|
+
id: ((x = c == null ? void 0 : c.user) == null ? void 0 : x.id) || a.id || "unknown",
|
|
642
|
+
name: i,
|
|
643
|
+
image: r,
|
|
522
644
|
size: 40
|
|
523
645
|
}
|
|
524
646
|
),
|
|
525
|
-
/* @__PURE__ */ e("div", { className: "min-w-0", children: /* @__PURE__ */ e("h1", { className: "text-lg font-semibold text-charcoal truncate", children:
|
|
647
|
+
/* @__PURE__ */ e("div", { className: "min-w-0", children: /* @__PURE__ */ e("h1", { className: "text-lg font-semibold text-charcoal truncate", children: i }) })
|
|
526
648
|
] }),
|
|
527
|
-
|
|
649
|
+
l && n && /* @__PURE__ */ e(oe, { label: "Chat info", onClick: n, children: /* @__PURE__ */ e(ze, { className: "h-6 w-6 text-charcoal", weight: "bold" }) })
|
|
528
650
|
] });
|
|
529
|
-
},
|
|
651
|
+
}, cs = ({
|
|
530
652
|
isOpen: t,
|
|
531
653
|
onClose: s,
|
|
532
654
|
participant: n,
|
|
533
|
-
channel:
|
|
534
|
-
followerStatusLabel:
|
|
655
|
+
channel: l,
|
|
656
|
+
followerStatusLabel: a,
|
|
535
657
|
onLeaveConversation: c,
|
|
536
|
-
onBlockParticipant:
|
|
658
|
+
onBlockParticipant: i
|
|
537
659
|
}) => {
|
|
538
|
-
var
|
|
539
|
-
const { service:
|
|
660
|
+
var j, H, q, W, J, z, V;
|
|
661
|
+
const { service: r, debug: o } = le(), C = A(null), [u, x] = I(!1), [b, h] = I(!1), [f, m] = I(!1);
|
|
540
662
|
$(() => {
|
|
541
|
-
const R =
|
|
663
|
+
const R = C.current;
|
|
542
664
|
R && (t ? R.showModal() : R.close());
|
|
543
665
|
}, [t]);
|
|
544
|
-
const
|
|
666
|
+
const N = M(async () => {
|
|
545
667
|
var R;
|
|
546
|
-
if (!(!
|
|
668
|
+
if (!(!r || !((R = n == null ? void 0 : n.user) != null && R.id)))
|
|
547
669
|
try {
|
|
548
|
-
const
|
|
549
|
-
(
|
|
550
|
-
var
|
|
551
|
-
return
|
|
670
|
+
const L = (await r.getBlockedUsers()).some(
|
|
671
|
+
(X) => {
|
|
672
|
+
var Y;
|
|
673
|
+
return X.blocked_user_id === ((Y = n == null ? void 0 : n.user) == null ? void 0 : Y.id);
|
|
552
674
|
}
|
|
553
675
|
);
|
|
554
|
-
|
|
555
|
-
} catch (
|
|
676
|
+
x(L);
|
|
677
|
+
} catch (D) {
|
|
556
678
|
console.error(
|
|
557
679
|
"[ChannelInfoDialog] Failed to check blocked status:",
|
|
558
|
-
|
|
680
|
+
D
|
|
559
681
|
);
|
|
560
682
|
}
|
|
561
|
-
}, [
|
|
683
|
+
}, [r, (j = n == null ? void 0 : n.user) == null ? void 0 : j.id]);
|
|
562
684
|
$(() => {
|
|
563
|
-
t &&
|
|
564
|
-
}, [t,
|
|
685
|
+
t && N();
|
|
686
|
+
}, [t, N]);
|
|
565
687
|
const S = async () => {
|
|
566
688
|
var R;
|
|
567
|
-
if (!
|
|
568
|
-
|
|
689
|
+
if (!b) {
|
|
690
|
+
o && console.log("[ChannelInfoDialog] Leave conversation", l.cid), h(!0);
|
|
569
691
|
try {
|
|
570
|
-
const
|
|
571
|
-
await
|
|
572
|
-
} catch (
|
|
573
|
-
console.error("[ChannelInfoDialog] Failed to leave conversation",
|
|
692
|
+
const D = ((R = l._client) == null ? void 0 : R.userID) ?? null;
|
|
693
|
+
await l.hide(D, !1), c && await c(l), s();
|
|
694
|
+
} catch (D) {
|
|
695
|
+
console.error("[ChannelInfoDialog] Failed to leave conversation", D);
|
|
574
696
|
} finally {
|
|
575
|
-
|
|
697
|
+
h(!1);
|
|
576
698
|
}
|
|
577
699
|
}
|
|
578
|
-
},
|
|
579
|
-
var R,
|
|
580
|
-
if (!(
|
|
581
|
-
|
|
700
|
+
}, k = async () => {
|
|
701
|
+
var R, D, L;
|
|
702
|
+
if (!(f || !r)) {
|
|
703
|
+
o && console.log("[ChannelInfoDialog] Block member", (R = n == null ? void 0 : n.user) == null ? void 0 : R.id), m(!0);
|
|
582
704
|
try {
|
|
583
|
-
await
|
|
584
|
-
} catch (
|
|
585
|
-
console.error("[ChannelInfoDialog] Failed to block member",
|
|
705
|
+
await r.blockUser((D = n == null ? void 0 : n.user) == null ? void 0 : D.id), i && await i((L = n == null ? void 0 : n.user) == null ? void 0 : L.id), s();
|
|
706
|
+
} catch (X) {
|
|
707
|
+
console.error("[ChannelInfoDialog] Failed to block member", X);
|
|
586
708
|
} finally {
|
|
587
|
-
|
|
709
|
+
m(!1);
|
|
588
710
|
}
|
|
589
711
|
}
|
|
590
|
-
},
|
|
591
|
-
var R,
|
|
592
|
-
if (!(
|
|
593
|
-
|
|
712
|
+
}, E = async () => {
|
|
713
|
+
var R, D, L;
|
|
714
|
+
if (!(f || !r)) {
|
|
715
|
+
o && console.log("[ChannelInfoDialog] Unblock member", (R = n == null ? void 0 : n.user) == null ? void 0 : R.id), m(!0);
|
|
594
716
|
try {
|
|
595
|
-
await
|
|
596
|
-
} catch (
|
|
597
|
-
console.error("[ChannelInfoDialog] Failed to unblock member",
|
|
717
|
+
await r.unBlockUser((D = n == null ? void 0 : n.user) == null ? void 0 : D.id), i && await i((L = n == null ? void 0 : n.user) == null ? void 0 : L.id), s();
|
|
718
|
+
} catch (X) {
|
|
719
|
+
console.error("[ChannelInfoDialog] Failed to unblock member", X);
|
|
598
720
|
} finally {
|
|
599
|
-
|
|
721
|
+
m(!1);
|
|
600
722
|
}
|
|
601
723
|
}
|
|
602
|
-
},
|
|
724
|
+
}, P = () => {
|
|
603
725
|
s(), window.open(
|
|
604
726
|
"https://linktr.ee/s/about/trust-center/report",
|
|
605
727
|
"_blank",
|
|
@@ -607,78 +729,92 @@ const He = ({ renderActions: t }) => /* @__PURE__ */ d("div", { className: "mess
|
|
|
607
729
|
);
|
|
608
730
|
};
|
|
609
731
|
if (!n) return null;
|
|
610
|
-
const
|
|
732
|
+
const p = ((H = n.user) == null ? void 0 : H.name) || ((q = n.user) == null ? void 0 : q.id) || "Unknown member", g = (W = n.user) == null ? void 0 : W.image, v = (J = n.user) == null ? void 0 : J.email, y = (z = n.user) == null ? void 0 : z.username, F = v || (y ? `linktr.ee/${y}` : void 0), T = ((V = n.user) == null ? void 0 : V.id) || "unknown";
|
|
611
733
|
return (
|
|
612
734
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
|
|
613
735
|
/* @__PURE__ */ e(
|
|
614
736
|
"dialog",
|
|
615
737
|
{
|
|
616
|
-
ref:
|
|
738
|
+
ref: C,
|
|
617
739
|
className: "mes-dialog",
|
|
618
740
|
onClose: s,
|
|
619
741
|
onClick: (R) => {
|
|
620
|
-
R.target ===
|
|
742
|
+
R.target === C.current && s();
|
|
621
743
|
},
|
|
622
744
|
children: /* @__PURE__ */ d("div", { className: "ml-auto flex h-full w-full flex-col bg-white shadow-max-elevation-light", children: [
|
|
623
745
|
/* @__PURE__ */ d("div", { className: "flex items-center justify-between border-b border-sand px-4 py-3", children: [
|
|
624
746
|
/* @__PURE__ */ e("h2", { className: "text-base font-semibold text-charcoal", children: "Chat info" }),
|
|
625
|
-
/* @__PURE__ */ e(
|
|
747
|
+
/* @__PURE__ */ e(Re, { onClick: s })
|
|
626
748
|
] }),
|
|
627
|
-
/* @__PURE__ */ d("div", { className: "flex-1 overflow-y-auto
|
|
628
|
-
/* @__PURE__ */ e("div", { className: "
|
|
749
|
+
/* @__PURE__ */ d("div", { className: "flex-1 px-2 overflow-y-auto w-full", children: [
|
|
750
|
+
/* @__PURE__ */ e("div", { className: "flex flex-col items-center gap-3 self-stretch px-4 py-2 mt-6 rounded-lg border border-black/[0.04]", style: { backgroundColor: "#FBFAF9" }, children: /* @__PURE__ */ d("div", { className: "flex items-center gap-3 w-full", children: [
|
|
629
751
|
/* @__PURE__ */ e(
|
|
630
|
-
|
|
752
|
+
se,
|
|
631
753
|
{
|
|
632
|
-
id:
|
|
633
|
-
name:
|
|
634
|
-
image:
|
|
635
|
-
size:
|
|
754
|
+
id: T,
|
|
755
|
+
name: p,
|
|
756
|
+
image: g,
|
|
757
|
+
size: 88,
|
|
758
|
+
className: "!rounded-full"
|
|
636
759
|
}
|
|
637
760
|
),
|
|
638
|
-
/* @__PURE__ */ d("div", { className: "min-w-0 flex-1", children: [
|
|
639
|
-
/* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children:
|
|
640
|
-
|
|
641
|
-
|
|
761
|
+
/* @__PURE__ */ d("div", { className: "flex flex-col min-w-0 flex-1", children: [
|
|
762
|
+
/* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children: p }),
|
|
763
|
+
F && /* @__PURE__ */ e("p", { className: "truncate text-sm text-[#00000055]", children: F }),
|
|
764
|
+
a && /* @__PURE__ */ e(
|
|
765
|
+
"span",
|
|
766
|
+
{
|
|
767
|
+
className: "mt-1 rounded-full text-xs font-normal w-fit",
|
|
768
|
+
style: {
|
|
769
|
+
padding: "4px 8px",
|
|
770
|
+
backgroundColor: a === "Subscribed to you" ? "#DCFCE7" : "#F5F5F4",
|
|
771
|
+
color: a === "Subscribed to you" ? "#008236" : "#78716C",
|
|
772
|
+
lineHeight: "133.333%",
|
|
773
|
+
letterSpacing: "0.21px"
|
|
774
|
+
},
|
|
775
|
+
children: a
|
|
776
|
+
}
|
|
777
|
+
)
|
|
642
778
|
] })
|
|
643
779
|
] }) }),
|
|
644
780
|
/* @__PURE__ */ d("ul", { className: "flex flex-col gap-2 mt-2", children: [
|
|
645
781
|
/* @__PURE__ */ e("li", { children: /* @__PURE__ */ d(
|
|
646
|
-
|
|
782
|
+
ne,
|
|
647
783
|
{
|
|
648
784
|
onClick: S,
|
|
649
|
-
disabled:
|
|
650
|
-
"aria-busy":
|
|
785
|
+
disabled: b,
|
|
786
|
+
"aria-busy": b,
|
|
651
787
|
children: [
|
|
652
|
-
|
|
788
|
+
b ? /* @__PURE__ */ e(re, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(Ve, { className: "h-5 w-5" }),
|
|
653
789
|
/* @__PURE__ */ e("span", { children: "Leave Conversation" })
|
|
654
790
|
]
|
|
655
791
|
}
|
|
656
792
|
) }),
|
|
657
793
|
/* @__PURE__ */ e("li", { children: u ? /* @__PURE__ */ d(
|
|
658
|
-
|
|
794
|
+
ne,
|
|
659
795
|
{
|
|
660
|
-
onClick:
|
|
661
|
-
disabled:
|
|
662
|
-
"aria-busy":
|
|
796
|
+
onClick: E,
|
|
797
|
+
disabled: f,
|
|
798
|
+
"aria-busy": f,
|
|
663
799
|
children: [
|
|
664
|
-
|
|
800
|
+
f ? /* @__PURE__ */ e(re, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(fe, { className: "h-5 w-5" }),
|
|
665
801
|
/* @__PURE__ */ e("span", { children: "Unblock" })
|
|
666
802
|
]
|
|
667
803
|
}
|
|
668
804
|
) : /* @__PURE__ */ d(
|
|
669
|
-
|
|
805
|
+
ne,
|
|
670
806
|
{
|
|
671
|
-
onClick:
|
|
672
|
-
disabled:
|
|
673
|
-
"aria-busy":
|
|
807
|
+
onClick: k,
|
|
808
|
+
disabled: f,
|
|
809
|
+
"aria-busy": f,
|
|
674
810
|
children: [
|
|
675
|
-
|
|
811
|
+
f ? /* @__PURE__ */ e(re, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(fe, { className: "h-5 w-5" }),
|
|
676
812
|
/* @__PURE__ */ e("span", { children: "Block" })
|
|
677
813
|
]
|
|
678
814
|
}
|
|
679
815
|
) }),
|
|
680
|
-
/* @__PURE__ */ e("li", { children: /* @__PURE__ */ d(
|
|
681
|
-
/* @__PURE__ */ e(
|
|
816
|
+
/* @__PURE__ */ e("li", { children: /* @__PURE__ */ d(ne, { variant: "danger", onClick: P, children: [
|
|
817
|
+
/* @__PURE__ */ e(Xe, { className: "h-5 w-5" }),
|
|
682
818
|
/* @__PURE__ */ e("span", { children: "Report" })
|
|
683
819
|
] }) })
|
|
684
820
|
] })
|
|
@@ -687,97 +823,100 @@ const He = ({ renderActions: t }) => /* @__PURE__ */ d("div", { className: "mess
|
|
|
687
823
|
}
|
|
688
824
|
)
|
|
689
825
|
);
|
|
690
|
-
},
|
|
826
|
+
}, ds = ({
|
|
691
827
|
onBack: t,
|
|
692
828
|
showBackButton: s,
|
|
693
829
|
renderMessageInputActions: n,
|
|
694
|
-
onLeaveConversation:
|
|
695
|
-
onBlockParticipant:
|
|
696
|
-
CustomChannelEmptyState: c
|
|
830
|
+
onLeaveConversation: l,
|
|
831
|
+
onBlockParticipant: a,
|
|
832
|
+
CustomChannelEmptyState: c = Pe
|
|
697
833
|
}) => {
|
|
698
|
-
var
|
|
699
|
-
const { channel:
|
|
700
|
-
(
|
|
701
|
-
var
|
|
702
|
-
return ((
|
|
834
|
+
var b, h;
|
|
835
|
+
const { channel: i } = ye(), [r, o] = I(!1), C = (((h = (b = i == null ? void 0 : i.state) == null ? void 0 : b.messages) == null ? void 0 : h.length) ?? 0) > 0, u = G.useMemo(() => Object.values(i.state.members || {}).find(
|
|
836
|
+
(m) => {
|
|
837
|
+
var N;
|
|
838
|
+
return ((N = m.user) == null ? void 0 : N.id) && m.user.id !== i._client.userID;
|
|
703
839
|
}
|
|
704
|
-
), [
|
|
705
|
-
const
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
840
|
+
), [i._client.userID, i.state.members]), x = G.useMemo(() => {
|
|
841
|
+
const f = i.data ?? {};
|
|
842
|
+
if (f.followerStatus)
|
|
843
|
+
return String(f.followerStatus);
|
|
844
|
+
if (f.isFollower !== void 0)
|
|
845
|
+
return f.isFollower ? "Subscribed to you" : "Not subscribed";
|
|
846
|
+
}, [i.data]);
|
|
847
|
+
return /* @__PURE__ */ d(de, { children: [
|
|
848
|
+
/* @__PURE__ */ d($e, { children: [
|
|
710
849
|
/* @__PURE__ */ e("div", { className: "border-b border-sand bg-white px-4 py-3", children: /* @__PURE__ */ e(
|
|
711
|
-
|
|
850
|
+
is,
|
|
712
851
|
{
|
|
713
852
|
onBack: t,
|
|
714
853
|
showBackButton: s,
|
|
715
|
-
onShowInfo: () =>
|
|
854
|
+
onShowInfo: () => o(!0),
|
|
716
855
|
canShowInfo: !!u
|
|
717
856
|
}
|
|
718
857
|
) }),
|
|
719
858
|
/* @__PURE__ */ d("div", { className: "flex-1 overflow-hidden relative", children: [
|
|
720
|
-
/* @__PURE__ */ e(
|
|
721
|
-
!
|
|
859
|
+
/* @__PURE__ */ e(Ge, { hideDeletedMessages: !0, hideNewMessageSeparator: !1 }),
|
|
860
|
+
!C && c && /* @__PURE__ */ e("div", { className: "absolute inset-0 w-full h-full bg-white", children: /* @__PURE__ */ e(c, {}) })
|
|
722
861
|
] }),
|
|
723
862
|
/* @__PURE__ */ e(
|
|
724
|
-
|
|
863
|
+
as,
|
|
725
864
|
{
|
|
726
|
-
renderActions: () => n == null ? void 0 : n(
|
|
865
|
+
renderActions: () => n == null ? void 0 : n(i)
|
|
727
866
|
}
|
|
728
867
|
)
|
|
729
868
|
] }),
|
|
730
869
|
/* @__PURE__ */ e(
|
|
731
|
-
|
|
870
|
+
cs,
|
|
732
871
|
{
|
|
733
|
-
isOpen:
|
|
734
|
-
onClose: () =>
|
|
872
|
+
isOpen: r,
|
|
873
|
+
onClose: () => o(!1),
|
|
735
874
|
participant: u,
|
|
736
|
-
channel:
|
|
737
|
-
followerStatusLabel:
|
|
738
|
-
onLeaveConversation:
|
|
739
|
-
onBlockParticipant:
|
|
875
|
+
channel: i,
|
|
876
|
+
followerStatusLabel: x,
|
|
877
|
+
onLeaveConversation: l,
|
|
878
|
+
onBlockParticipant: a
|
|
740
879
|
}
|
|
741
880
|
)
|
|
742
881
|
] });
|
|
743
|
-
},
|
|
882
|
+
}, us = ({
|
|
744
883
|
channel: t,
|
|
745
884
|
onBack: s,
|
|
746
885
|
showBackButton: n = !1,
|
|
747
|
-
renderMessageInputActions:
|
|
748
|
-
onLeaveConversation:
|
|
886
|
+
renderMessageInputActions: l,
|
|
887
|
+
onLeaveConversation: a,
|
|
749
888
|
onBlockParticipant: c,
|
|
750
|
-
className:
|
|
751
|
-
CustomChannelEmptyState:
|
|
889
|
+
className: i,
|
|
890
|
+
CustomChannelEmptyState: r = Pe
|
|
752
891
|
}) => /* @__PURE__ */ e(
|
|
753
892
|
"div",
|
|
754
893
|
{
|
|
755
|
-
className:
|
|
894
|
+
className: _(
|
|
756
895
|
"messaging-channel-view h-full flex flex-col",
|
|
757
|
-
|
|
896
|
+
i
|
|
758
897
|
),
|
|
759
|
-
children: /* @__PURE__ */ e(
|
|
760
|
-
|
|
898
|
+
children: /* @__PURE__ */ e(Ae, { channel: t, children: /* @__PURE__ */ e(
|
|
899
|
+
ds,
|
|
761
900
|
{
|
|
762
901
|
onBack: s,
|
|
763
902
|
showBackButton: n,
|
|
764
|
-
renderMessageInputActions:
|
|
765
|
-
onLeaveConversation:
|
|
903
|
+
renderMessageInputActions: l,
|
|
904
|
+
onLeaveConversation: a,
|
|
766
905
|
onBlockParticipant: c,
|
|
767
|
-
CustomChannelEmptyState:
|
|
906
|
+
CustomChannelEmptyState: r
|
|
768
907
|
}
|
|
769
908
|
) })
|
|
770
909
|
}
|
|
771
910
|
);
|
|
772
|
-
function
|
|
911
|
+
function fs({
|
|
773
912
|
searchQuery: t,
|
|
774
913
|
setSearchQuery: s,
|
|
775
914
|
placeholder: n
|
|
776
915
|
}) {
|
|
777
|
-
const
|
|
916
|
+
const l = A(null);
|
|
778
917
|
return /* @__PURE__ */ d("div", { className: "relative", children: [
|
|
779
918
|
/* @__PURE__ */ e(
|
|
780
|
-
|
|
919
|
+
Qe,
|
|
781
920
|
{
|
|
782
921
|
className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-stone",
|
|
783
922
|
weight: "bold"
|
|
@@ -786,185 +925,185 @@ function qe({
|
|
|
786
925
|
/* @__PURE__ */ e(
|
|
787
926
|
"input",
|
|
788
927
|
{
|
|
789
|
-
ref:
|
|
928
|
+
ref: l,
|
|
790
929
|
type: "text",
|
|
791
930
|
placeholder: n,
|
|
792
931
|
value: t,
|
|
793
|
-
onChange: (
|
|
932
|
+
onChange: (a) => s(a.target.value),
|
|
794
933
|
className: "w-full pl-10 pr-10 py-3 text-sm border border-sand rounded-xl focus:outline-none focus:ring-2 focus:ring-black focus:border-transparent"
|
|
795
934
|
}
|
|
796
935
|
),
|
|
797
936
|
t && /* @__PURE__ */ e(
|
|
798
|
-
|
|
937
|
+
oe,
|
|
799
938
|
{
|
|
800
939
|
label: "Clear search",
|
|
801
940
|
onClick: () => {
|
|
802
|
-
var
|
|
803
|
-
s(""), (
|
|
941
|
+
var a;
|
|
942
|
+
s(""), (a = l.current) == null || a.focus();
|
|
804
943
|
},
|
|
805
944
|
className: "absolute right-3 top-1/2 -translate-y-1/2 p-1 text-stone hover:text-charcoal",
|
|
806
|
-
children: /* @__PURE__ */ e(
|
|
945
|
+
children: /* @__PURE__ */ e(Ee, { className: "h-4 w-4", weight: "bold" })
|
|
807
946
|
}
|
|
808
947
|
)
|
|
809
948
|
] });
|
|
810
949
|
}
|
|
811
|
-
const
|
|
950
|
+
const ms = ({
|
|
812
951
|
participantSource: t,
|
|
813
952
|
onSelectParticipant: s,
|
|
814
953
|
onClose: n,
|
|
815
|
-
existingParticipantIds:
|
|
816
|
-
participantLabel:
|
|
954
|
+
existingParticipantIds: l = /* @__PURE__ */ new Set(),
|
|
955
|
+
participantLabel: a = "participants",
|
|
817
956
|
searchPlaceholder: c = "Search participants...",
|
|
818
|
-
className:
|
|
957
|
+
className: i
|
|
819
958
|
}) => {
|
|
820
|
-
const { debug:
|
|
959
|
+
const { debug: r } = le(), [o, C] = I(""), [u, x] = I([]), [b, h] = I(!1), [f, m] = I(null), [N, S] = I(
|
|
821
960
|
null
|
|
822
|
-
),
|
|
961
|
+
), k = A(!1);
|
|
823
962
|
$(() => {
|
|
824
963
|
if (t.loading) {
|
|
825
|
-
|
|
964
|
+
r && console.log(
|
|
826
965
|
"[ParticipantPicker] Waiting for participant source to finish loading..."
|
|
827
966
|
);
|
|
828
967
|
return;
|
|
829
968
|
}
|
|
830
|
-
if (
|
|
969
|
+
if (k.current) return;
|
|
831
970
|
(async () => {
|
|
832
|
-
|
|
971
|
+
r && console.log("[ParticipantPicker] Loading initial participants..."), h(!0), m(null);
|
|
833
972
|
try {
|
|
834
|
-
const
|
|
973
|
+
const v = await t.loadParticipants({
|
|
835
974
|
search: "",
|
|
836
975
|
// Load all participants initially
|
|
837
976
|
limit: 100
|
|
838
977
|
});
|
|
839
|
-
|
|
978
|
+
x(v.participants), k.current = !0, r && console.log(
|
|
840
979
|
"[ParticipantPicker] Participants loaded successfully:",
|
|
841
|
-
|
|
980
|
+
v.participants.length
|
|
842
981
|
);
|
|
843
|
-
} catch (
|
|
844
|
-
const
|
|
845
|
-
|
|
982
|
+
} catch (v) {
|
|
983
|
+
const y = v instanceof Error ? v.message : "Failed to load participants";
|
|
984
|
+
m(y), console.error("[ParticipantPicker] Failed to load participants:", v);
|
|
846
985
|
} finally {
|
|
847
|
-
|
|
986
|
+
h(!1);
|
|
848
987
|
}
|
|
849
988
|
})();
|
|
850
|
-
}, [t.loading,
|
|
851
|
-
const
|
|
852
|
-
var
|
|
853
|
-
if (!
|
|
854
|
-
const
|
|
855
|
-
return
|
|
856
|
-
}),
|
|
857
|
-
async (
|
|
858
|
-
if (!
|
|
859
|
-
S(
|
|
989
|
+
}, [t.loading, r]);
|
|
990
|
+
const E = u.filter((g) => !l.has(g.id)).filter((g) => {
|
|
991
|
+
var y;
|
|
992
|
+
if (!o) return !0;
|
|
993
|
+
const v = o.toLowerCase();
|
|
994
|
+
return g.name.toLowerCase().includes(v) || ((y = g.email) == null ? void 0 : y.toLowerCase().includes(v)) || !1;
|
|
995
|
+
}), P = M(
|
|
996
|
+
async (g) => {
|
|
997
|
+
if (!N) {
|
|
998
|
+
S(g.id);
|
|
860
999
|
try {
|
|
861
|
-
await s(
|
|
862
|
-
} catch (
|
|
863
|
-
console.error("[ParticipantPicker] Failed to start chat:",
|
|
1000
|
+
await s(g);
|
|
1001
|
+
} catch (v) {
|
|
1002
|
+
console.error("[ParticipantPicker] Failed to start chat:", v), S(null);
|
|
864
1003
|
}
|
|
865
1004
|
}
|
|
866
1005
|
},
|
|
867
|
-
[s,
|
|
868
|
-
),
|
|
869
|
-
(
|
|
1006
|
+
[s, N]
|
|
1007
|
+
), p = (g, v) => {
|
|
1008
|
+
(g.key === "Enter" || g.key === " ") && (g.preventDefault(), P(v));
|
|
870
1009
|
};
|
|
871
|
-
return /* @__PURE__ */ d("div", { className:
|
|
1010
|
+
return /* @__PURE__ */ d("div", { className: _("flex flex-col h-full", i), children: [
|
|
872
1011
|
/* @__PURE__ */ d("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
|
|
873
1012
|
/* @__PURE__ */ d("div", { className: "flex items-center justify-between mb-3", children: [
|
|
874
1013
|
/* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-charcoal", children: "Start a new Conversation" }),
|
|
875
|
-
/* @__PURE__ */ e(
|
|
1014
|
+
/* @__PURE__ */ e(Re, { onClick: n })
|
|
876
1015
|
] }),
|
|
877
1016
|
/* @__PURE__ */ d("p", { className: "text-xs text-stone mb-3", children: [
|
|
878
1017
|
"Select a ",
|
|
879
|
-
|
|
1018
|
+
a.slice(0, -1),
|
|
880
1019
|
" to start messaging (",
|
|
881
|
-
|
|
1020
|
+
E.length,
|
|
882
1021
|
" available)",
|
|
883
|
-
t.totalCount !== void 0 && ` • ${t.totalCount} ${
|
|
1022
|
+
t.totalCount !== void 0 && ` • ${t.totalCount} ${a} total`
|
|
884
1023
|
] }),
|
|
885
1024
|
/* @__PURE__ */ e(
|
|
886
|
-
|
|
1025
|
+
fs,
|
|
887
1026
|
{
|
|
888
|
-
searchQuery:
|
|
889
|
-
setSearchQuery:
|
|
1027
|
+
searchQuery: o,
|
|
1028
|
+
setSearchQuery: C,
|
|
890
1029
|
placeholder: c
|
|
891
1030
|
}
|
|
892
1031
|
)
|
|
893
1032
|
] }),
|
|
894
|
-
|
|
1033
|
+
f && /* @__PURE__ */ d("div", { className: "p-4 text-sm text-danger bg-danger-alt", children: [
|
|
895
1034
|
"Error loading ",
|
|
896
|
-
|
|
1035
|
+
a,
|
|
897
1036
|
": ",
|
|
898
|
-
|
|
1037
|
+
f
|
|
899
1038
|
] }),
|
|
900
|
-
/* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children:
|
|
1039
|
+
/* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: b && E.length === 0 ? /* @__PURE__ */ e("div", { className: "h-32 flex items-center justify-center", children: /* @__PURE__ */ d("div", { className: "flex items-center space-x-2", children: [
|
|
901
1040
|
/* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
|
|
902
1041
|
/* @__PURE__ */ d("span", { className: "text-sm text-stone", children: [
|
|
903
1042
|
"Loading ",
|
|
904
|
-
|
|
1043
|
+
a,
|
|
905
1044
|
"..."
|
|
906
1045
|
] })
|
|
907
|
-
] }) }) :
|
|
908
|
-
/* @__PURE__ */ e("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-sand", children: /* @__PURE__ */ e(
|
|
909
|
-
/* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children:
|
|
910
|
-
/* @__PURE__ */ e("p", { className: "text-xs text-stone", children:
|
|
1046
|
+
] }) }) : E.length === 0 ? /* @__PURE__ */ d("div", { className: "p-6 text-center", children: [
|
|
1047
|
+
/* @__PURE__ */ e("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-sand", children: /* @__PURE__ */ e(me, { className: "h-8 w-8 text-charcoal" }) }),
|
|
1048
|
+
/* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: o ? `No ${a} found` : u.length > 0 ? `Already chatting with all ${a}` : `No ${a} yet` }),
|
|
1049
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-stone", children: o ? "Try a different search term" : u.length > 0 ? `You have existing conversations with all your ${a}` : `${a.charAt(0).toUpperCase() + a.slice(1)} will appear here` })
|
|
911
1050
|
] }) : /* @__PURE__ */ d("ul", { className: "space-y-0", children: [
|
|
912
|
-
|
|
913
|
-
const
|
|
1051
|
+
E.map((g) => {
|
|
1052
|
+
const v = g.name || g.email || g.id, y = g.email && g.name ? g.email : g.phone;
|
|
914
1053
|
return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
|
|
915
1054
|
"button",
|
|
916
1055
|
{
|
|
917
1056
|
type: "button",
|
|
918
|
-
onClick: () =>
|
|
919
|
-
onKeyDown: (
|
|
1057
|
+
onClick: () => P(g),
|
|
1058
|
+
onKeyDown: (F) => p(F, g),
|
|
920
1059
|
className: "w-full px-4 py-3 hover:bg-sand transition-colors border-b border-sand text-left focus:outline-none focus:ring-2 focus:ring-black",
|
|
921
1060
|
children: /* @__PURE__ */ d("div", { className: "flex items-center justify-between", children: [
|
|
922
1061
|
/* @__PURE__ */ d("div", { className: "flex items-center space-x-3 flex-1 min-w-0", children: [
|
|
923
1062
|
/* @__PURE__ */ e(
|
|
924
|
-
|
|
1063
|
+
se,
|
|
925
1064
|
{
|
|
926
|
-
id:
|
|
927
|
-
name:
|
|
928
|
-
image:
|
|
1065
|
+
id: g.id,
|
|
1066
|
+
name: v,
|
|
1067
|
+
image: g.image,
|
|
929
1068
|
size: 40
|
|
930
1069
|
}
|
|
931
1070
|
),
|
|
932
1071
|
/* @__PURE__ */ d("div", { className: "flex-1 min-w-0", children: [
|
|
933
|
-
/* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children:
|
|
934
|
-
|
|
1072
|
+
/* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children: v }),
|
|
1073
|
+
y && /* @__PURE__ */ e("p", { className: "text-xs text-stone truncate", children: y })
|
|
935
1074
|
] })
|
|
936
1075
|
] }),
|
|
937
|
-
/* @__PURE__ */ e("div", { className: "flex-shrink-0", children:
|
|
1076
|
+
/* @__PURE__ */ e("div", { className: "flex-shrink-0", children: N === g.id ? /* @__PURE__ */ e(re, { className: "h-5 w-5 text-primary animate-spin" }) : /* @__PURE__ */ e(me, { className: "h-5 w-5 text-stone" }) })
|
|
938
1077
|
] })
|
|
939
1078
|
}
|
|
940
|
-
) },
|
|
1079
|
+
) }, g.id);
|
|
941
1080
|
}),
|
|
942
|
-
|
|
1081
|
+
b && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */ d("div", { className: "flex items-center space-x-2", children: [
|
|
943
1082
|
/* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
|
|
944
1083
|
/* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading more..." })
|
|
945
1084
|
] }) })
|
|
946
1085
|
] }) })
|
|
947
1086
|
] });
|
|
948
|
-
},
|
|
1087
|
+
}, hs = ({ hasChannels: t, onStartConversation: s, participantLabel: n }) => /* @__PURE__ */ e("div", { className: "messaging-empty-state flex items-center justify-center h-full p-8 text-balance", children: /* @__PURE__ */ d("div", { className: "text-center max-w-sm", children: [
|
|
949
1088
|
/* @__PURE__ */ e("div", { className: "w-24 h-24 bg-primary-alt/10 rounded-full flex items-center justify-center mx-auto mb-6", children: /* @__PURE__ */ e("span", { className: "text-4xl", children: "💬" }) }),
|
|
950
1089
|
/* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal", children: "Welcome to Messages" }),
|
|
951
|
-
/* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t ? /* @__PURE__ */ d(
|
|
1090
|
+
/* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t ? /* @__PURE__ */ d(de, { children: [
|
|
952
1091
|
"Choose a conversation from the list or",
|
|
953
1092
|
" ",
|
|
954
|
-
s && /* @__PURE__ */ d(
|
|
1093
|
+
s && /* @__PURE__ */ d(Ce, { onClick: s, children: [
|
|
955
1094
|
"start a new conversation with a ",
|
|
956
1095
|
n.slice(0, -1),
|
|
957
1096
|
"."
|
|
958
1097
|
] })
|
|
959
|
-
] }) : s && /* @__PURE__ */ d(
|
|
960
|
-
/* @__PURE__ */ d(
|
|
1098
|
+
] }) : s && /* @__PURE__ */ d(de, { children: [
|
|
1099
|
+
/* @__PURE__ */ d(Ce, { onClick: s, children: [
|
|
961
1100
|
"Start a new conversation with one of your ",
|
|
962
1101
|
n
|
|
963
1102
|
] }),
|
|
964
1103
|
" ",
|
|
965
1104
|
"to begin messaging."
|
|
966
1105
|
] }) })
|
|
967
|
-
] }) }),
|
|
1106
|
+
] }) }), Ce = ({
|
|
968
1107
|
onClick: t,
|
|
969
1108
|
children: s
|
|
970
1109
|
}) => /* @__PURE__ */ e(
|
|
@@ -975,7 +1114,7 @@ const Xe = ({
|
|
|
975
1114
|
className: "inline-flex items-center gap-1 text-sm font-medium text-primary hover:text-primary-alt focus:outline-none focus:ring-2 focus:ring-primary",
|
|
976
1115
|
children: s
|
|
977
1116
|
}
|
|
978
|
-
),
|
|
1117
|
+
), ce = ({ message: t, onBack: s }) => /* @__PURE__ */ e("div", { className: "messaging-error-state flex items-center justify-center h-full p-8", children: /* @__PURE__ */ d("div", { className: "text-center max-w-sm", children: [
|
|
979
1118
|
/* @__PURE__ */ e("div", { className: "w-24 h-24 bg-danger-alt/20 rounded-full flex items-center justify-center mx-auto mb-6", children: /* @__PURE__ */ e("span", { className: "text-4xl", children: "⚠️" }) }),
|
|
980
1119
|
/* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal mb-2", children: "Oops!" }),
|
|
981
1120
|
/* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t }),
|
|
@@ -988,10 +1127,10 @@ const Xe = ({
|
|
|
988
1127
|
children: "Go Back"
|
|
989
1128
|
}
|
|
990
1129
|
)
|
|
991
|
-
] }) }),
|
|
1130
|
+
] }) }), gs = ({ className: t, message: s }) => /* @__PURE__ */ d(
|
|
992
1131
|
"div",
|
|
993
1132
|
{
|
|
994
|
-
className:
|
|
1133
|
+
className: _("flex items-center justify-center h-full", t),
|
|
995
1134
|
children: [
|
|
996
1135
|
/* @__PURE__ */ d("svg", { viewBox: "0 0 100 100", className: "size-8 fill-pebble", stroke: "none", children: [
|
|
997
1136
|
/* @__PURE__ */ e("circle", { cx: "6", cy: "50", r: "6", children: /* @__PURE__ */ e(
|
|
@@ -1031,101 +1170,101 @@ const Xe = ({
|
|
|
1031
1170
|
s && /* @__PURE__ */ e("span", { className: "text-stone", children: s })
|
|
1032
1171
|
]
|
|
1033
1172
|
}
|
|
1034
|
-
),
|
|
1035
|
-
/* @__PURE__ */ e(
|
|
1173
|
+
), xs = () => /* @__PURE__ */ e("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */ d("div", { className: "flex items-center", children: [
|
|
1174
|
+
/* @__PURE__ */ e(gs, { className: "w-6 h-6" }),
|
|
1036
1175
|
/* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading messages" })
|
|
1037
|
-
] }) }),
|
|
1176
|
+
] }) }), Ss = ({
|
|
1038
1177
|
capabilities: t = {},
|
|
1039
1178
|
className: s,
|
|
1040
1179
|
renderMessageInputActions: n,
|
|
1041
|
-
onChannelSelect:
|
|
1042
|
-
onParticipantSelect:
|
|
1180
|
+
onChannelSelect: l,
|
|
1181
|
+
onParticipantSelect: a,
|
|
1043
1182
|
initialParticipantFilter: c,
|
|
1044
|
-
initialParticipantData:
|
|
1045
|
-
CustomChannelEmptyState:
|
|
1046
|
-
showChannelList:
|
|
1183
|
+
initialParticipantData: i,
|
|
1184
|
+
CustomChannelEmptyState: r,
|
|
1185
|
+
showChannelList: o = !0
|
|
1047
1186
|
}) => {
|
|
1048
1187
|
const {
|
|
1049
|
-
service:
|
|
1188
|
+
service: C,
|
|
1050
1189
|
client: u,
|
|
1051
|
-
isConnected:
|
|
1052
|
-
isLoading:
|
|
1053
|
-
error:
|
|
1054
|
-
refreshConnection:
|
|
1055
|
-
debug:
|
|
1056
|
-
} =
|
|
1057
|
-
showStartConversation:
|
|
1058
|
-
participantSource:
|
|
1059
|
-
participantLabel:
|
|
1060
|
-
} = t, R =
|
|
1061
|
-
if (!u || !
|
|
1062
|
-
const
|
|
1063
|
-
if (
|
|
1190
|
+
isConnected: x,
|
|
1191
|
+
isLoading: b,
|
|
1192
|
+
error: h,
|
|
1193
|
+
refreshConnection: f,
|
|
1194
|
+
debug: m
|
|
1195
|
+
} = Ze(), [N, S] = I(null), [k, E] = I(!1), [P, p] = I(!1), [g, v] = I(/* @__PURE__ */ new Set()), [y, F] = I(0), [T, j] = I(!1), [H, q] = I(null), W = A(null), {
|
|
1196
|
+
showStartConversation: J = !1,
|
|
1197
|
+
participantSource: z,
|
|
1198
|
+
participantLabel: V = "participants"
|
|
1199
|
+
} = t, R = A(null), D = M(async () => {
|
|
1200
|
+
if (!u || !x) return;
|
|
1201
|
+
const w = u.userID;
|
|
1202
|
+
if (w)
|
|
1064
1203
|
try {
|
|
1065
|
-
|
|
1066
|
-
const
|
|
1204
|
+
m && console.log("[MessagingShell] Syncing channels for user:", w);
|
|
1205
|
+
const U = await u.queryChannels(
|
|
1067
1206
|
{
|
|
1068
1207
|
type: "messaging",
|
|
1069
|
-
members: { $in: [
|
|
1208
|
+
members: { $in: [w] }
|
|
1070
1209
|
},
|
|
1071
1210
|
{},
|
|
1072
1211
|
{ limit: 100 }
|
|
1073
|
-
),
|
|
1074
|
-
|
|
1075
|
-
const
|
|
1076
|
-
Object.values(
|
|
1077
|
-
var
|
|
1078
|
-
const
|
|
1079
|
-
|
|
1212
|
+
), O = /* @__PURE__ */ new Set();
|
|
1213
|
+
U.forEach((B) => {
|
|
1214
|
+
const Fe = B.state.members;
|
|
1215
|
+
Object.values(Fe).forEach((Me) => {
|
|
1216
|
+
var ue;
|
|
1217
|
+
const ie = (ue = Me.user) == null ? void 0 : ue.id;
|
|
1218
|
+
ie && ie !== w && O.add(ie);
|
|
1080
1219
|
});
|
|
1081
|
-
}),
|
|
1082
|
-
channelCount:
|
|
1083
|
-
memberCount:
|
|
1220
|
+
}), v(O), E(U.length > 0), R.current = w, m && console.log("[MessagingShell] Channels synced successfully:", {
|
|
1221
|
+
channelCount: U.length,
|
|
1222
|
+
memberCount: O.size
|
|
1084
1223
|
});
|
|
1085
|
-
} catch (
|
|
1086
|
-
console.error("[MessagingShell] Failed to sync channels:",
|
|
1224
|
+
} catch (U) {
|
|
1225
|
+
console.error("[MessagingShell] Failed to sync channels:", U);
|
|
1087
1226
|
}
|
|
1088
|
-
}, [u,
|
|
1227
|
+
}, [u, x, m]);
|
|
1089
1228
|
$(() => {
|
|
1090
|
-
if (!u || !
|
|
1091
|
-
const
|
|
1092
|
-
|
|
1093
|
-
}, [u,
|
|
1094
|
-
if (!c || !u || !
|
|
1229
|
+
if (!u || !x) return;
|
|
1230
|
+
const w = u.userID;
|
|
1231
|
+
w && R.current !== w && D();
|
|
1232
|
+
}, [u, x, D]), $(() => {
|
|
1233
|
+
if (!c || !u || !x) return;
|
|
1095
1234
|
(async () => {
|
|
1096
|
-
const
|
|
1097
|
-
if (
|
|
1235
|
+
const U = u.userID;
|
|
1236
|
+
if (U)
|
|
1098
1237
|
try {
|
|
1099
|
-
|
|
1238
|
+
m && console.log(
|
|
1100
1239
|
"[MessagingShell] Loading initial conversation with:",
|
|
1101
1240
|
c
|
|
1102
1241
|
);
|
|
1103
|
-
const
|
|
1242
|
+
const O = await u.queryChannels(
|
|
1104
1243
|
{
|
|
1105
1244
|
type: "messaging",
|
|
1106
|
-
members: { $eq: [
|
|
1245
|
+
members: { $eq: [U, c] }
|
|
1107
1246
|
},
|
|
1108
1247
|
{},
|
|
1109
1248
|
{ limit: 1 }
|
|
1110
1249
|
);
|
|
1111
|
-
if (
|
|
1112
|
-
S(
|
|
1250
|
+
if (O.length > 0)
|
|
1251
|
+
S(O[0]), j(!0), q(null), l && l(O[0]), m && console.log(
|
|
1113
1252
|
"[MessagingShell] Initial conversation loaded:",
|
|
1114
|
-
|
|
1253
|
+
O[0].id
|
|
1115
1254
|
);
|
|
1116
|
-
else if (
|
|
1117
|
-
|
|
1255
|
+
else if (i && C) {
|
|
1256
|
+
m && console.log(
|
|
1118
1257
|
"[MessagingShell] No conversation found, creating one for:",
|
|
1119
|
-
|
|
1258
|
+
i
|
|
1120
1259
|
);
|
|
1121
1260
|
try {
|
|
1122
|
-
const B = await
|
|
1123
|
-
id:
|
|
1124
|
-
name:
|
|
1125
|
-
email:
|
|
1126
|
-
phone:
|
|
1261
|
+
const B = await C.startChannelWithParticipant({
|
|
1262
|
+
id: i.id,
|
|
1263
|
+
name: i.name,
|
|
1264
|
+
email: i.email,
|
|
1265
|
+
phone: i.phone
|
|
1127
1266
|
});
|
|
1128
|
-
S(B),
|
|
1267
|
+
S(B), j(!0), q(null), l && l(B), m && console.log(
|
|
1129
1268
|
"[MessagingShell] Channel created and loaded:",
|
|
1130
1269
|
B.id
|
|
1131
1270
|
);
|
|
@@ -1133,91 +1272,91 @@ const Xe = ({
|
|
|
1133
1272
|
console.error(
|
|
1134
1273
|
"[MessagingShell] Failed to create conversation:",
|
|
1135
1274
|
B
|
|
1136
|
-
),
|
|
1275
|
+
), q("Failed to create conversation");
|
|
1137
1276
|
}
|
|
1138
1277
|
} else
|
|
1139
|
-
|
|
1278
|
+
q(
|
|
1140
1279
|
"No conversation found with this account"
|
|
1141
|
-
),
|
|
1280
|
+
), m && console.log(
|
|
1142
1281
|
"[MessagingShell] No conversation found for:",
|
|
1143
1282
|
c
|
|
1144
1283
|
);
|
|
1145
|
-
} catch (
|
|
1284
|
+
} catch (O) {
|
|
1146
1285
|
console.error(
|
|
1147
1286
|
"[MessagingShell] Failed to load initial conversation:",
|
|
1148
|
-
|
|
1149
|
-
),
|
|
1287
|
+
O
|
|
1288
|
+
), q("Failed to load conversation");
|
|
1150
1289
|
}
|
|
1151
1290
|
})();
|
|
1152
1291
|
}, [
|
|
1153
1292
|
c,
|
|
1154
|
-
|
|
1293
|
+
i,
|
|
1155
1294
|
u,
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1295
|
+
x,
|
|
1296
|
+
C,
|
|
1297
|
+
m,
|
|
1298
|
+
l
|
|
1160
1299
|
]);
|
|
1161
|
-
const
|
|
1162
|
-
(
|
|
1163
|
-
S(
|
|
1300
|
+
const L = M(
|
|
1301
|
+
(w) => {
|
|
1302
|
+
S(w), l == null || l(w);
|
|
1164
1303
|
},
|
|
1165
|
-
[
|
|
1166
|
-
),
|
|
1167
|
-
|
|
1168
|
-
}, [
|
|
1169
|
-
var
|
|
1170
|
-
|
|
1171
|
-
}, [
|
|
1172
|
-
async (
|
|
1173
|
-
var
|
|
1174
|
-
if (
|
|
1304
|
+
[l]
|
|
1305
|
+
), X = M(() => {
|
|
1306
|
+
T || S(null);
|
|
1307
|
+
}, [T]), Y = M(() => {
|
|
1308
|
+
var w;
|
|
1309
|
+
z && (F((U) => U + 1), p(!0), (w = W.current) == null || w.showModal());
|
|
1310
|
+
}, [z]), pe = M(
|
|
1311
|
+
async (w) => {
|
|
1312
|
+
var U;
|
|
1313
|
+
if (C)
|
|
1175
1314
|
try {
|
|
1176
|
-
|
|
1315
|
+
m && console.log(
|
|
1177
1316
|
"[MessagingShell] Starting conversation with:",
|
|
1178
|
-
|
|
1317
|
+
w.id
|
|
1179
1318
|
);
|
|
1180
|
-
const
|
|
1181
|
-
id:
|
|
1182
|
-
name:
|
|
1183
|
-
email:
|
|
1184
|
-
phone:
|
|
1319
|
+
const O = await C.startChannelWithParticipant({
|
|
1320
|
+
id: w.id,
|
|
1321
|
+
name: w.name,
|
|
1322
|
+
email: w.email,
|
|
1323
|
+
phone: w.phone
|
|
1185
1324
|
});
|
|
1186
1325
|
try {
|
|
1187
|
-
await
|
|
1326
|
+
await O.show();
|
|
1188
1327
|
} catch (B) {
|
|
1189
1328
|
console.warn("[MessagingShell] Failed to unhide channel:", B);
|
|
1190
1329
|
}
|
|
1191
|
-
S(
|
|
1192
|
-
} catch (
|
|
1193
|
-
console.error("[MessagingShell] Failed to start conversation:",
|
|
1330
|
+
S(O), p(!1), (U = W.current) == null || U.close(), a == null || a(w);
|
|
1331
|
+
} catch (O) {
|
|
1332
|
+
console.error("[MessagingShell] Failed to start conversation:", O);
|
|
1194
1333
|
}
|
|
1195
1334
|
},
|
|
1196
|
-
[
|
|
1197
|
-
),
|
|
1198
|
-
var
|
|
1199
|
-
|
|
1200
|
-
}, []),
|
|
1201
|
-
async (
|
|
1202
|
-
|
|
1335
|
+
[C, a, m]
|
|
1336
|
+
), ae = M(() => {
|
|
1337
|
+
var w;
|
|
1338
|
+
p(!1), (w = W.current) == null || w.close();
|
|
1339
|
+
}, []), _e = M(
|
|
1340
|
+
async (w) => {
|
|
1341
|
+
m && console.log("[MessagingShell] Leaving conversation:", w.id), S(null), j(!1), R.current = null, await D();
|
|
1203
1342
|
},
|
|
1204
|
-
[
|
|
1205
|
-
),
|
|
1206
|
-
async (
|
|
1207
|
-
|
|
1343
|
+
[D, m]
|
|
1344
|
+
), De = M(
|
|
1345
|
+
async (w) => {
|
|
1346
|
+
m && console.log("[MessagingShell] Blocking participant:", w), S(null), j(!1), R.current = null, await D();
|
|
1208
1347
|
},
|
|
1209
|
-
[
|
|
1210
|
-
),
|
|
1211
|
-
return
|
|
1212
|
-
|
|
1348
|
+
[D, m]
|
|
1349
|
+
), te = !!N;
|
|
1350
|
+
return b ? /* @__PURE__ */ e("div", { className: _("h-full", s), children: /* @__PURE__ */ e(xs, {}) }) : h ? /* @__PURE__ */ e("div", { className: _("h-full", s), children: /* @__PURE__ */ e(ce, { message: h, onBack: f }) }) : !x || !u ? /* @__PURE__ */ e("div", { className: _("h-full", s), children: /* @__PURE__ */ e(
|
|
1351
|
+
ce,
|
|
1213
1352
|
{
|
|
1214
1353
|
message: "Not connected to messaging service",
|
|
1215
|
-
onBack:
|
|
1354
|
+
onBack: f
|
|
1216
1355
|
}
|
|
1217
|
-
) }) : H ? /* @__PURE__ */ e("div", { className:
|
|
1356
|
+
) }) : H ? /* @__PURE__ */ e("div", { className: _("h-full", s), children: /* @__PURE__ */ e(ce, { message: H }) }) : /* @__PURE__ */ d(
|
|
1218
1357
|
"div",
|
|
1219
1358
|
{
|
|
1220
|
-
className:
|
|
1359
|
+
className: _(
|
|
1221
1360
|
"messaging-shell h-full bg-white overflow-hidden",
|
|
1222
1361
|
s
|
|
1223
1362
|
),
|
|
@@ -1226,25 +1365,25 @@ const Xe = ({
|
|
|
1226
1365
|
/* @__PURE__ */ e(
|
|
1227
1366
|
"div",
|
|
1228
1367
|
{
|
|
1229
|
-
className:
|
|
1368
|
+
className: _(
|
|
1230
1369
|
"messaging-channel-list-sidebar min-h-0 min-w-0 bg-white lg:bg-chalk lg:flex lg:flex-col lg:border-r lg:border-sand",
|
|
1231
1370
|
{
|
|
1232
1371
|
// Explicitly hidden via prop or in direct conversation mode
|
|
1233
|
-
"!hidden":
|
|
1372
|
+
"!hidden": o === !1 || T,
|
|
1234
1373
|
// Normal mode: hide on mobile when channel selected, show on desktop
|
|
1235
|
-
"hidden lg:flex lg:w-80 lg:min-w-[280px] lg:max-w-[360px]":
|
|
1374
|
+
"hidden lg:flex lg:w-80 lg:min-w-[280px] lg:max-w-[360px]": o !== !1 && !T && te,
|
|
1236
1375
|
// Normal mode: show when no channel selected
|
|
1237
|
-
"flex flex-col w-full lg:flex-1 lg:max-w-2xl":
|
|
1376
|
+
"flex flex-col w-full lg:flex-1 lg:max-w-2xl": o !== !1 && !T && !te
|
|
1238
1377
|
}
|
|
1239
1378
|
),
|
|
1240
1379
|
children: /* @__PURE__ */ e(
|
|
1241
|
-
|
|
1380
|
+
os,
|
|
1242
1381
|
{
|
|
1243
|
-
onChannelSelect:
|
|
1244
|
-
selectedChannel:
|
|
1245
|
-
showStartConversation:
|
|
1246
|
-
onStartConversation:
|
|
1247
|
-
participantLabel:
|
|
1382
|
+
onChannelSelect: L,
|
|
1383
|
+
selectedChannel: N || void 0,
|
|
1384
|
+
showStartConversation: J && !!z,
|
|
1385
|
+
onStartConversation: Y,
|
|
1386
|
+
participantLabel: V
|
|
1248
1387
|
}
|
|
1249
1388
|
)
|
|
1250
1389
|
}
|
|
@@ -1252,70 +1391,70 @@ const Xe = ({
|
|
|
1252
1391
|
/* @__PURE__ */ e(
|
|
1253
1392
|
"div",
|
|
1254
1393
|
{
|
|
1255
|
-
className:
|
|
1394
|
+
className: _(
|
|
1256
1395
|
"messaging-conversation-view flex-1 flex-col min-w-0 min-h-0",
|
|
1257
1396
|
{
|
|
1258
1397
|
// In direct conversation mode, always show (full width)
|
|
1259
|
-
flex:
|
|
1398
|
+
flex: T || te,
|
|
1260
1399
|
// Normal mode: hide on mobile when no channel selected
|
|
1261
|
-
"hidden lg:flex": !
|
|
1400
|
+
"hidden lg:flex": !T && !te
|
|
1262
1401
|
}
|
|
1263
1402
|
),
|
|
1264
|
-
children:
|
|
1265
|
-
|
|
1403
|
+
children: N ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
|
|
1404
|
+
us,
|
|
1266
1405
|
{
|
|
1267
|
-
channel:
|
|
1268
|
-
onBack:
|
|
1269
|
-
showBackButton: !
|
|
1406
|
+
channel: N,
|
|
1407
|
+
onBack: X,
|
|
1408
|
+
showBackButton: !T,
|
|
1270
1409
|
renderMessageInputActions: n,
|
|
1271
|
-
onLeaveConversation:
|
|
1272
|
-
onBlockParticipant:
|
|
1273
|
-
CustomChannelEmptyState:
|
|
1410
|
+
onLeaveConversation: _e,
|
|
1411
|
+
onBlockParticipant: De,
|
|
1412
|
+
CustomChannelEmptyState: r
|
|
1274
1413
|
},
|
|
1275
|
-
|
|
1414
|
+
N.id
|
|
1276
1415
|
) }) : /* @__PURE__ */ e(
|
|
1277
|
-
|
|
1416
|
+
hs,
|
|
1278
1417
|
{
|
|
1279
|
-
hasChannels:
|
|
1280
|
-
onStartConversation:
|
|
1281
|
-
participantLabel:
|
|
1418
|
+
hasChannels: k,
|
|
1419
|
+
onStartConversation: J ? Y : void 0,
|
|
1420
|
+
participantLabel: V
|
|
1282
1421
|
}
|
|
1283
1422
|
)
|
|
1284
1423
|
}
|
|
1285
1424
|
)
|
|
1286
1425
|
] }),
|
|
1287
|
-
|
|
1426
|
+
z && // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
|
|
1288
1427
|
/* @__PURE__ */ e(
|
|
1289
1428
|
"dialog",
|
|
1290
1429
|
{
|
|
1291
|
-
ref:
|
|
1430
|
+
ref: W,
|
|
1292
1431
|
className: "mes-dialog",
|
|
1293
|
-
onClick: (
|
|
1294
|
-
|
|
1432
|
+
onClick: (w) => {
|
|
1433
|
+
w.target === W.current && ae();
|
|
1295
1434
|
},
|
|
1296
|
-
onClose:
|
|
1435
|
+
onClose: ae,
|
|
1297
1436
|
children: /* @__PURE__ */ e("div", { className: "h-full w-full bg-white shadow-max-elevation-light", children: /* @__PURE__ */ e(
|
|
1298
|
-
|
|
1437
|
+
ms,
|
|
1299
1438
|
{
|
|
1300
|
-
participantSource:
|
|
1301
|
-
onSelectParticipant:
|
|
1302
|
-
onClose:
|
|
1303
|
-
existingParticipantIds:
|
|
1304
|
-
participantLabel:
|
|
1305
|
-
searchPlaceholder: `Search ${
|
|
1439
|
+
participantSource: z,
|
|
1440
|
+
onSelectParticipant: pe,
|
|
1441
|
+
onClose: ae,
|
|
1442
|
+
existingParticipantIds: g,
|
|
1443
|
+
participantLabel: V,
|
|
1444
|
+
searchPlaceholder: `Search ${V}...`
|
|
1306
1445
|
},
|
|
1307
|
-
|
|
1446
|
+
y
|
|
1308
1447
|
) })
|
|
1309
1448
|
}
|
|
1310
1449
|
)
|
|
1311
1450
|
]
|
|
1312
1451
|
}
|
|
1313
1452
|
);
|
|
1314
|
-
},
|
|
1453
|
+
}, bs = ({
|
|
1315
1454
|
question: t,
|
|
1316
1455
|
onClick: s,
|
|
1317
1456
|
loading: n = !1,
|
|
1318
|
-
className:
|
|
1457
|
+
className: l
|
|
1319
1458
|
}) => /* @__PURE__ */ e(
|
|
1320
1459
|
"button",
|
|
1321
1460
|
{
|
|
@@ -1323,32 +1462,32 @@ const Xe = ({
|
|
|
1323
1462
|
onClick: s,
|
|
1324
1463
|
disabled: n,
|
|
1325
1464
|
style: { backgroundColor: "#E6E5E3" },
|
|
1326
|
-
className:
|
|
1465
|
+
className: _(
|
|
1327
1466
|
"w-full text-center p-4 rounded-xl text-charcoal font-medium transition-colors",
|
|
1328
1467
|
{
|
|
1329
1468
|
"hover:brightness-95 active:brightness-90": !n,
|
|
1330
1469
|
"opacity-50 cursor-not-allowed": n
|
|
1331
1470
|
},
|
|
1332
|
-
|
|
1471
|
+
l
|
|
1333
1472
|
),
|
|
1334
1473
|
children: t
|
|
1335
1474
|
}
|
|
1336
|
-
),
|
|
1475
|
+
), ks = ({
|
|
1337
1476
|
faqs: t,
|
|
1338
1477
|
onFaqClick: s,
|
|
1339
1478
|
loadingFaqId: n,
|
|
1340
|
-
headerText:
|
|
1341
|
-
className:
|
|
1479
|
+
headerText: l,
|
|
1480
|
+
className: a,
|
|
1342
1481
|
avatarImage: c,
|
|
1343
|
-
avatarName:
|
|
1482
|
+
avatarName: i
|
|
1344
1483
|
}) => {
|
|
1345
|
-
const
|
|
1346
|
-
return
|
|
1347
|
-
(c ||
|
|
1348
|
-
|
|
1484
|
+
const r = t.filter((o) => o.enabled).sort((o, C) => (o.order ?? 0) - (C.order ?? 0));
|
|
1485
|
+
return r.length === 0 ? null : /* @__PURE__ */ e("div", { className: _("px-4 py-6", a), children: /* @__PURE__ */ d("div", { className: "flex gap-3 items-end", children: [
|
|
1486
|
+
(c || i) && /* @__PURE__ */ e("div", { className: "flex-none", children: /* @__PURE__ */ e(
|
|
1487
|
+
se,
|
|
1349
1488
|
{
|
|
1350
|
-
id:
|
|
1351
|
-
name:
|
|
1489
|
+
id: i || "account",
|
|
1490
|
+
name: i || "Account",
|
|
1352
1491
|
image: c,
|
|
1353
1492
|
size: 24
|
|
1354
1493
|
}
|
|
@@ -1359,71 +1498,72 @@ const Xe = ({
|
|
|
1359
1498
|
className: "flex-1 rounded-lg p-4 space-y-3",
|
|
1360
1499
|
style: { backgroundColor: "#F1F0EE" },
|
|
1361
1500
|
children: [
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1501
|
+
l && /* @__PURE__ */ e("p", { className: "text-md text-charcoal mb-4", children: l }),
|
|
1502
|
+
r.map((o) => /* @__PURE__ */ e(
|
|
1503
|
+
bs,
|
|
1365
1504
|
{
|
|
1366
|
-
question:
|
|
1367
|
-
onClick: () => s(
|
|
1368
|
-
loading: n ===
|
|
1505
|
+
question: o.question,
|
|
1506
|
+
onClick: () => s(o.id),
|
|
1507
|
+
loading: n === o.id
|
|
1369
1508
|
},
|
|
1370
|
-
|
|
1509
|
+
o.id
|
|
1371
1510
|
))
|
|
1372
1511
|
]
|
|
1373
1512
|
}
|
|
1374
1513
|
)
|
|
1375
1514
|
] }) });
|
|
1376
|
-
},
|
|
1377
|
-
const { initialSearch: n = "", pageSize:
|
|
1378
|
-
if (
|
|
1379
|
-
const
|
|
1380
|
-
|
|
1515
|
+
}, Rs = (t, s = {}) => {
|
|
1516
|
+
const { initialSearch: n = "", pageSize: l = 20 } = s, [a, c] = I([]), [i, r] = I(!1), [o, C] = I(null), [u, x] = I(n), [b, h] = I(!0), [f, m] = I(), N = M(async (P = !1, p) => {
|
|
1517
|
+
if (i) return;
|
|
1518
|
+
const g = p !== void 0 ? p : u;
|
|
1519
|
+
r(!0), C(null);
|
|
1381
1520
|
try {
|
|
1382
|
-
const
|
|
1383
|
-
search:
|
|
1384
|
-
limit:
|
|
1385
|
-
cursor:
|
|
1521
|
+
const v = await t.loadParticipants({
|
|
1522
|
+
search: g || void 0,
|
|
1523
|
+
limit: l,
|
|
1524
|
+
cursor: P ? void 0 : f
|
|
1386
1525
|
});
|
|
1387
1526
|
c(
|
|
1388
|
-
(
|
|
1389
|
-
),
|
|
1390
|
-
} catch (
|
|
1391
|
-
const
|
|
1392
|
-
|
|
1527
|
+
(y) => P ? v.participants : [...y, ...v.participants]
|
|
1528
|
+
), h(v.hasMore), m(v.nextCursor);
|
|
1529
|
+
} catch (v) {
|
|
1530
|
+
const y = v instanceof Error ? v.message : "Failed to load participants";
|
|
1531
|
+
C(y), console.error("[useParticipants] Load error:", v);
|
|
1393
1532
|
} finally {
|
|
1394
|
-
|
|
1533
|
+
r(!1);
|
|
1395
1534
|
}
|
|
1396
|
-
}, [t, u,
|
|
1397
|
-
|
|
1398
|
-
}, [
|
|
1399
|
-
|
|
1400
|
-
}, [
|
|
1401
|
-
|
|
1402
|
-
}, [
|
|
1535
|
+
}, [t, u, f, l, i]), S = M(() => {
|
|
1536
|
+
b && !i && N(!1);
|
|
1537
|
+
}, [b, i, N]), k = M((P) => {
|
|
1538
|
+
x(P), m(void 0), N(!0, P);
|
|
1539
|
+
}, [N]), E = M(() => {
|
|
1540
|
+
m(void 0), N(!0);
|
|
1541
|
+
}, [N]);
|
|
1403
1542
|
return $(() => {
|
|
1404
|
-
|
|
1543
|
+
N(!0);
|
|
1405
1544
|
}, [t.loadParticipants]), {
|
|
1406
|
-
participants:
|
|
1407
|
-
loading:
|
|
1408
|
-
error:
|
|
1545
|
+
participants: a,
|
|
1546
|
+
loading: i,
|
|
1547
|
+
error: o,
|
|
1409
1548
|
searchQuery: u,
|
|
1410
|
-
hasMore:
|
|
1549
|
+
hasMore: b,
|
|
1411
1550
|
totalCount: t.totalCount,
|
|
1412
1551
|
loadMore: S,
|
|
1413
|
-
search:
|
|
1414
|
-
refresh:
|
|
1552
|
+
search: k,
|
|
1553
|
+
refresh: E
|
|
1415
1554
|
};
|
|
1416
1555
|
};
|
|
1417
1556
|
export {
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1557
|
+
se as Avatar,
|
|
1558
|
+
Pe as ChannelEmptyState,
|
|
1559
|
+
os as ChannelList,
|
|
1560
|
+
us as ChannelView,
|
|
1561
|
+
ks as FaqList,
|
|
1562
|
+
bs as FaqListItem,
|
|
1563
|
+
Is as MessagingProvider,
|
|
1564
|
+
Ss as MessagingShell,
|
|
1565
|
+
ms as ParticipantPicker,
|
|
1566
|
+
Ze as useMessaging,
|
|
1567
|
+
Rs as useParticipants
|
|
1428
1568
|
};
|
|
1429
1569
|
//# sourceMappingURL=index.js.map
|