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