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