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