@orbitconnect/react 0.1.1 → 0.1.3
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/OrbitContext.d.ts +3 -1
- package/dist/index.js +54 -47
- package/package.json +1 -1
package/dist/OrbitContext.d.ts
CHANGED
|
@@ -33,6 +33,8 @@ export interface AppConfig {
|
|
|
33
33
|
sounds?: SoundConfig;
|
|
34
34
|
/** Show the chat header bar (default: true) */
|
|
35
35
|
showChatHeader?: boolean;
|
|
36
|
+
/** Show the conversation list header — brand/title + new-chat button (default: true) */
|
|
37
|
+
showConversationHeader?: boolean;
|
|
36
38
|
/** Show the quick-message button in the composer (default: true) */
|
|
37
39
|
showQuickMessageButton?: boolean;
|
|
38
40
|
/** Use the rich-text (contentEditable) editor; false = plain textarea (default: true) */
|
|
@@ -95,4 +97,4 @@ export interface OrbitContextValue {
|
|
|
95
97
|
export declare const OrbitContext: import("react").Context<OrbitContextValue | null>;
|
|
96
98
|
export declare function useOrbit(): OrbitContextValue;
|
|
97
99
|
/** Convenience hook — returns appConfig with safe defaults applied */
|
|
98
|
-
export declare function useAppConfig(): Required<Pick<AppConfig, 'showChatHeader' | 'showQuickMessageButton' | 'useRichTextEditor' | 'showAttachMentButton' | 'showSearchIcon' | 'showAudioIcon' | 'showVideoIcon' | 'enableMeetingUi' | 'showPoweredBy' | 'enableE2E'>> & Pick<AppConfig, 'attachmentIcon' | 'recordIcon' | 'QuickmessageIcon' | 'emojIcon' | 'stickerIcon' | 'sendIcon' | 'deliveredIcon' | 'sentIcon' | 'readIcon' | 'callIcon' | 'VideoCallIcon'>;
|
|
100
|
+
export declare function useAppConfig(): Required<Pick<AppConfig, 'showChatHeader' | 'showConversationHeader' | 'showQuickMessageButton' | 'useRichTextEditor' | 'showAttachMentButton' | 'showSearchIcon' | 'showAudioIcon' | 'showVideoIcon' | 'enableMeetingUi' | 'showPoweredBy' | 'enableE2E'>> & Pick<AppConfig, 'attachmentIcon' | 'recordIcon' | 'QuickmessageIcon' | 'emojIcon' | 'stickerIcon' | 'sendIcon' | 'deliveredIcon' | 'sentIcon' | 'readIcon' | 'callIcon' | 'VideoCallIcon'>;
|
package/dist/index.js
CHANGED
|
@@ -27,30 +27,31 @@ function v() {
|
|
|
27
27
|
return e;
|
|
28
28
|
}
|
|
29
29
|
function y() {
|
|
30
|
-
let e = (0, g.c)(
|
|
31
|
-
return e[0] !== n || e[1] !== r || e[2] !== f || e[3] !== p || e[4] !== m || e[5] !== h || e[6] !== _ || e[7] !== y || e[8] !== b || e[9] !== x || e[10] !== S || e[11] !== C || e[12] !== i || e[13] !== w || e[14] !==
|
|
30
|
+
let e = (0, g.c)(23), { appConfig: t } = v(), n = t?.showChatHeader ?? !0, r = t?.showConversationHeader ?? !0, i = t?.showQuickMessageButton ?? !0, a = t?.useRichTextEditor ?? !0, o = t?.showAttachMentButton ?? !0, s = t?.showSearchIcon ?? !0, c = t?.showAudioIcon ?? !0, l = t?.showVideoIcon ?? !0, u = t?.enableMeetingUi ?? !0, d = t?.showPoweredBy ?? !0, f = t?.enableE2E ?? !1, p = t?.attachmentIcon, m = t?.recordIcon, h = t?.QuickmessageIcon, _ = t?.emojIcon, y = t?.stickerIcon, b = t?.sendIcon, x = t?.deliveredIcon, S = t?.sentIcon, C = t?.readIcon, w = t?.callIcon, T = t?.VideoCallIcon, E;
|
|
31
|
+
return e[0] !== n || e[1] !== r || e[2] !== f || e[3] !== p || e[4] !== m || e[5] !== h || e[6] !== _ || e[7] !== y || e[8] !== b || e[9] !== x || e[10] !== S || e[11] !== C || e[12] !== i || e[13] !== w || e[14] !== T || e[15] !== a || e[16] !== o || e[17] !== s || e[18] !== c || e[19] !== l || e[20] !== u || e[21] !== d ? (E = {
|
|
32
32
|
showChatHeader: n,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
33
|
+
showConversationHeader: r,
|
|
34
|
+
showQuickMessageButton: i,
|
|
35
|
+
useRichTextEditor: a,
|
|
36
|
+
showAttachMentButton: o,
|
|
37
|
+
showSearchIcon: s,
|
|
38
|
+
showAudioIcon: c,
|
|
39
|
+
showVideoIcon: l,
|
|
40
|
+
enableMeetingUi: u,
|
|
41
|
+
showPoweredBy: d,
|
|
42
|
+
enableE2E: f,
|
|
43
|
+
attachmentIcon: p,
|
|
44
|
+
recordIcon: m,
|
|
45
|
+
QuickmessageIcon: h,
|
|
46
|
+
emojIcon: _,
|
|
47
|
+
stickerIcon: y,
|
|
48
|
+
sendIcon: b,
|
|
49
|
+
deliveredIcon: x,
|
|
50
|
+
sentIcon: S,
|
|
51
|
+
readIcon: C,
|
|
52
|
+
callIcon: w,
|
|
53
|
+
VideoCallIcon: T
|
|
54
|
+
}, e[0] = n, e[1] = r, e[2] = f, e[3] = p, e[4] = m, e[5] = h, e[6] = _, e[7] = y, e[8] = b, e[9] = x, e[10] = S, e[11] = C, e[12] = i, e[13] = w, e[14] = T, e[15] = a, e[16] = o, e[17] = s, e[18] = c, e[19] = l, e[20] = u, e[21] = d, e[22] = E) : E = e[22], E;
|
|
54
55
|
}
|
|
55
56
|
//#endregion
|
|
56
57
|
//#region src/api/client.ts
|
|
@@ -2052,39 +2053,39 @@ function Me() {
|
|
|
2052
2053
|
//#endregion
|
|
2053
2054
|
//#region src/components/chat/ConversationList.tsx
|
|
2054
2055
|
function Ne({ conversations: e, onSelect: t, onNewChat: n, activeTab: i = "chats", onTabChange: a, globalSearchApiUrl: d, authToken: f, onNavigateToMessage: p }) {
|
|
2055
|
-
let [m, h] = s("All"), [g, _] = s(""), [v,
|
|
2056
|
+
let [m, h] = s("All"), [g, _] = s(""), [v, b] = s(null), [x, S] = s(!1), C = o(null), w = Me(), T = y();
|
|
2056
2057
|
r(() => {
|
|
2057
2058
|
if (!d || g.length < 2) {
|
|
2058
|
-
|
|
2059
|
+
b(null);
|
|
2059
2060
|
return;
|
|
2060
2061
|
}
|
|
2061
|
-
return
|
|
2062
|
-
|
|
2062
|
+
return C.current && clearTimeout(C.current), C.current = setTimeout(async () => {
|
|
2063
|
+
S(!0);
|
|
2063
2064
|
try {
|
|
2064
2065
|
let e = { "Content-Type": "application/json" };
|
|
2065
2066
|
f && (e.Authorization = `Bearer ${f}`);
|
|
2066
2067
|
let t = await fetch(`${d}?q=${encodeURIComponent(g)}`, { headers: e });
|
|
2067
|
-
t.ok &&
|
|
2068
|
+
t.ok && b(await t.json());
|
|
2068
2069
|
} catch {} finally {
|
|
2069
|
-
|
|
2070
|
+
S(!1);
|
|
2070
2071
|
}
|
|
2071
2072
|
}, 300), () => {
|
|
2072
|
-
|
|
2073
|
+
C.current && clearTimeout(C.current);
|
|
2073
2074
|
};
|
|
2074
2075
|
}, [
|
|
2075
2076
|
g,
|
|
2076
2077
|
d,
|
|
2077
2078
|
f
|
|
2078
2079
|
]);
|
|
2079
|
-
let
|
|
2080
|
+
let E = e.filter((e) => g && !e.name.toLowerCase().includes(g.toLowerCase()) ? !1 : m === "Unread" ? (e.unreadCount ?? 0) > 0 : m === "Groups" ? e.isGroup : !0);
|
|
2080
2081
|
return /* @__PURE__ */ u("div", {
|
|
2081
2082
|
className: "flex flex-col h-full bg-background text-foreground font-body",
|
|
2082
2083
|
children: [
|
|
2083
|
-
/* @__PURE__ */ u("header", {
|
|
2084
|
+
T.showConversationHeader && /* @__PURE__ */ u("header", {
|
|
2084
2085
|
className: "flex-shrink-0 h-14 flex items-center justify-between px-4 bg-background/95 backdrop-blur border-b border-border",
|
|
2085
2086
|
children: [/* @__PURE__ */ l("div", {
|
|
2086
2087
|
className: "flex items-center gap-1 text-lg font-bold text-foreground",
|
|
2087
|
-
children:
|
|
2088
|
+
children: w ?? /* @__PURE__ */ u(c, { children: ["OrbitConnect", /* @__PURE__ */ l("span", { className: "w-1.5 h-1.5 rounded-full bg-primary ml-1" })] })
|
|
2088
2089
|
}), /* @__PURE__ */ u("div", {
|
|
2089
2090
|
className: "flex gap-1",
|
|
2090
2091
|
children: [/* @__PURE__ */ l("button", {
|
|
@@ -2187,7 +2188,7 @@ function Ne({ conversations: e, onSelect: t, onNewChat: n, activeTab: i = "chats
|
|
|
2187
2188
|
}),
|
|
2188
2189
|
/* @__PURE__ */ l("div", {
|
|
2189
2190
|
className: "flex-1 overflow-y-auto",
|
|
2190
|
-
children: v === null ?
|
|
2191
|
+
children: v === null ? E.map((e) => /* @__PURE__ */ u("button", {
|
|
2191
2192
|
onClick: () => t(e.id),
|
|
2192
2193
|
className: "w-full h-[72px] flex items-center gap-3 px-4 border-none bg-transparent cursor-pointer text-left border-b",
|
|
2193
2194
|
style: {
|
|
@@ -2305,11 +2306,11 @@ function Ne({ conversations: e, onSelect: t, onNewChat: n, activeTab: i = "chats
|
|
|
2305
2306
|
})]
|
|
2306
2307
|
})]
|
|
2307
2308
|
}, e.id)) : /* @__PURE__ */ u(c, { children: [
|
|
2308
|
-
|
|
2309
|
+
x && /* @__PURE__ */ l("div", {
|
|
2309
2310
|
className: "px-4 py-3 text-sm text-muted-foreground",
|
|
2310
2311
|
children: "Searching…"
|
|
2311
2312
|
}),
|
|
2312
|
-
!
|
|
2313
|
+
!x && v.length === 0 && /* @__PURE__ */ l("div", {
|
|
2313
2314
|
className: "px-4 py-3 text-sm text-muted-foreground",
|
|
2314
2315
|
children: "No messages found"
|
|
2315
2316
|
}),
|
|
@@ -9792,7 +9793,11 @@ function Ar() {
|
|
|
9792
9793
|
//#endregion
|
|
9793
9794
|
//#region src/widgets/Chat.tsx
|
|
9794
9795
|
function jr({ conversationId: e, onCallRequest: t, renderHeader: n, chatBanner: i, defaultQuickMessages: d }) {
|
|
9795
|
-
let { apiClient: f, baseUrl: p } = v(), { initiateCall: m } = P(), { conversations: h, loading: g, createDirect: _ } = ve(), { records: y } = Te(), [b, x] = s(e ?? null), [S, C] = s("chats"), [w, T] = s(!1), [E, D] = s([]), [O, k] = s(!1)
|
|
9796
|
+
let { apiClient: f, baseUrl: p } = v(), { initiateCall: m } = P(), { conversations: h, loading: g, createDirect: _ } = ve(), { records: y } = Te(), [b, x] = s(e ?? null), [S, C] = s("chats"), [w, T] = s(!1), [E, D] = s([]), [O, k] = s(!1);
|
|
9797
|
+
r(() => {
|
|
9798
|
+
e && x(e);
|
|
9799
|
+
}, [e]);
|
|
9800
|
+
let [A, j] = s(null), [M, N] = s(!1), [I, L] = s([]), [R, z] = s(null), [B, V] = s(null), [H, U] = s(null), [W, G] = s(!1), [K, q] = s(""), [J, Y] = s([]), [X, Z] = s(0), [ee, Q] = s(null), [te, ne] = s("offline");
|
|
9796
9801
|
r(() => {
|
|
9797
9802
|
b && ne(h.find((e) => e.id === b)?.presenceStatus ?? "offline");
|
|
9798
9803
|
}, [b, h]), F("presence:changed", ({ app_user_id: e, status: t }) => {
|
|
@@ -9947,30 +9952,32 @@ function jr({ conversationId: e, onCallRequest: t, renderHeader: n, chatBanner:
|
|
|
9947
9952
|
T(!1), x(await _(e));
|
|
9948
9953
|
}
|
|
9949
9954
|
if (b) {
|
|
9950
|
-
let
|
|
9955
|
+
let r = h.find((e) => e.id === b), a = r?.otherUserId ?? r?.id ?? "", o = h.map((e) => ({
|
|
9951
9956
|
id: e.id,
|
|
9952
9957
|
name: e.name,
|
|
9953
9958
|
avatarSrc: e.avatarSrc
|
|
9954
9959
|
}));
|
|
9955
9960
|
return /* @__PURE__ */ u(c, { children: [
|
|
9956
9961
|
/* @__PURE__ */ l(zn, {
|
|
9957
|
-
conversationName:
|
|
9958
|
-
avatarSrc:
|
|
9959
|
-
isOnline:
|
|
9960
|
-
isGroup:
|
|
9961
|
-
otherUserId:
|
|
9962
|
+
conversationName: r?.name ?? "…",
|
|
9963
|
+
avatarSrc: r?.avatarSrc,
|
|
9964
|
+
isOnline: r?.online,
|
|
9965
|
+
isGroup: r?.isGroup,
|
|
9966
|
+
otherUserId: a,
|
|
9962
9967
|
presenceStatus: te,
|
|
9963
9968
|
renderHeader: n,
|
|
9964
9969
|
chatBanner: i,
|
|
9965
9970
|
defaultQuickMessages: d,
|
|
9966
9971
|
messages: re,
|
|
9967
9972
|
typingUsers: $,
|
|
9968
|
-
onBack: () =>
|
|
9973
|
+
onBack: () => {
|
|
9974
|
+
e || x(null);
|
|
9975
|
+
},
|
|
9969
9976
|
onCall: t || m ? () => {
|
|
9970
|
-
|
|
9977
|
+
a ? m(a, "voice", b ?? void 0) : t?.(a, "voice");
|
|
9971
9978
|
} : void 0,
|
|
9972
9979
|
onVideoCall: t || m ? () => {
|
|
9973
|
-
|
|
9980
|
+
a ? m(a, "video", b ?? void 0) : t?.(a, "video");
|
|
9974
9981
|
} : void 0,
|
|
9975
9982
|
onSend: (e, t) => {
|
|
9976
9983
|
A ? (f.post(`/conversations/${b}/messages/reply`, {
|
|
@@ -10041,7 +10048,7 @@ function jr({ conversationId: e, onCallRequest: t, renderHeader: n, chatBanner:
|
|
|
10041
10048
|
onClose: fe
|
|
10042
10049
|
}),
|
|
10043
10050
|
(R || B) && /* @__PURE__ */ l(Un, {
|
|
10044
|
-
conversations:
|
|
10051
|
+
conversations: o,
|
|
10045
10052
|
onConfirm: _e,
|
|
10046
10053
|
onClose: () => {
|
|
10047
10054
|
z(null), V(null);
|
package/package.json
CHANGED