@medipha/chat 1.0.66 → 1.0.67
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -80218,10 +80218,14 @@ function Gle({ conversationId: e, index: t, isWindowVisible: n, isExpanded: r, i
|
|
|
80218
80218
|
}
|
|
80219
80219
|
//#endregion
|
|
80220
80220
|
//#region src/module/widget/widget-chat-shell.tsx
|
|
80221
|
-
function Kle({ isWindowVisible: e, isExpanded: t, openConversationIds: n, windowCapacity: r, focusedConversationId: i, composerFocusRequest: a, onToggleExpand: o, onOpenConversation: s, onCloseConversation: c, onFocusConversation: l, onOpenFullPage: u, onRequestClose: f }) {
|
|
80222
|
-
let { currentUserId:
|
|
80223
|
-
|
|
80224
|
-
|
|
80221
|
+
function Kle({ isWindowVisible: e, isExpanded: t, openConversationIds: n, windowCapacity: r, focusedConversationId: i, composerFocusRequest: a, onToggleExpand: o, onOpenConversation: s, onCloseConversation: c, onFocusConversation: l, onOpenFullPage: u, onRequestClose: f, openProfileRequest: p }) {
|
|
80222
|
+
let { currentUserId: h, userProfile: g, startDirectChat: _ } = s2(), [v, y] = b(null), { openProfile: x } = g;
|
|
80223
|
+
m(() => {
|
|
80224
|
+
p && (y(null), x(p.userId));
|
|
80225
|
+
}, [p, x]);
|
|
80226
|
+
let S = nh((e) => v ? e.conversations.find((e) => H(Lc(e), v)) ?? null : null), C = n.slice(Math.max(0, n.length - r)), w = d((e, t) => {
|
|
80227
|
+
y(t), g.openProfile(e);
|
|
80228
|
+
}, [g]), T = f ? /* @__PURE__ */ A("button", {
|
|
80225
80229
|
type: "button",
|
|
80226
80230
|
className: "conversation-widget-close",
|
|
80227
80231
|
"aria-label": "Đóng khung chat",
|
|
@@ -80241,19 +80245,19 @@ function Kle({ isWindowVisible: e, isExpanded: t, openConversationIds: n, window
|
|
|
80241
80245
|
"aria-pressed": t,
|
|
80242
80246
|
onClick: o,
|
|
80243
80247
|
children: A(t ? Ut : Bt, {})
|
|
80244
|
-
}), t ?
|
|
80248
|
+
}), t ? T : null] }),
|
|
80245
80249
|
footerAction: t ? u ? /* @__PURE__ */ j("button", {
|
|
80246
80250
|
type: "button",
|
|
80247
80251
|
className: "conversation-widget-view-all",
|
|
80248
80252
|
onClick: () => u(void 0),
|
|
80249
80253
|
children: ["Xem Tất Cả", /* @__PURE__ */ A(Cr, {})]
|
|
80250
|
-
}) : null :
|
|
80254
|
+
}) : null : T
|
|
80251
80255
|
}),
|
|
80252
|
-
|
|
80256
|
+
C.map((n, r) => {
|
|
80253
80257
|
let o = H(i ?? "", n), d = H(a?.conversationId ?? "", n);
|
|
80254
80258
|
return /* @__PURE__ */ A(Wle, {
|
|
80255
80259
|
conversationId: n,
|
|
80256
|
-
index:
|
|
80260
|
+
index: C.length - 1 - r,
|
|
80257
80261
|
isWindowVisible: e,
|
|
80258
80262
|
isExpanded: t,
|
|
80259
80263
|
isFocused: o,
|
|
@@ -80261,16 +80265,16 @@ function Kle({ isWindowVisible: e, isExpanded: t, openConversationIds: n, window
|
|
|
80261
80265
|
onOpenConversation: s,
|
|
80262
80266
|
onCloseConversation: c,
|
|
80263
80267
|
onFocusConversation: l,
|
|
80264
|
-
onOpenUserProfile:
|
|
80268
|
+
onOpenUserProfile: w,
|
|
80265
80269
|
onOpenFullPage: u
|
|
80266
80270
|
}, n);
|
|
80267
80271
|
}),
|
|
80268
80272
|
/* @__PURE__ */ A(c2, {
|
|
80269
|
-
profileUserId:
|
|
80270
|
-
conversation:
|
|
80271
|
-
currentUserId:
|
|
80272
|
-
onClose: () =>
|
|
80273
|
-
onStartChat:
|
|
80273
|
+
profileUserId: g.profileUserId,
|
|
80274
|
+
conversation: S,
|
|
80275
|
+
currentUserId: h,
|
|
80276
|
+
onClose: () => g.closeProfile(),
|
|
80277
|
+
onStartChat: _
|
|
80274
80278
|
})
|
|
80275
80279
|
] });
|
|
80276
80280
|
}
|
|
@@ -80297,58 +80301,59 @@ function Qle(e) {
|
|
|
80297
80301
|
}
|
|
80298
80302
|
var $le = 200, A2 = 3;
|
|
80299
80303
|
function eue(e) {
|
|
80300
|
-
let { isOpen: t = !0,
|
|
80301
|
-
|
|
80304
|
+
let { isOpen: t = !0, openProfileRequest: n, onActiveConversationChange: r, onExpandChange: i, onOpenFullPage: a, onRequestClose: o, onUnreadTotalChange: s } = e, [c, l] = b([]), [u, f] = b(void 0), [p, h] = b(null), [g, _] = b(!1), [v, x] = b(!1), S = y(null), C = nh((e) => Qle(e.conversations)), w = g || v, T = Zle(w, A2), E = c[c.length - 1], D = d((e) => {
|
|
80305
|
+
l((t) => {
|
|
80302
80306
|
if (t.some((t) => H(t, e))) return t;
|
|
80303
80307
|
let n = [...t, e];
|
|
80304
80308
|
return n.slice(Math.max(0, n.length - A2));
|
|
80305
|
-
}),
|
|
80309
|
+
}), f(e), h((t) => ({
|
|
80306
80310
|
conversationId: e,
|
|
80307
80311
|
nonce: (t?.nonce ?? 0) + 1
|
|
80308
80312
|
}));
|
|
80309
|
-
}, []), D = d((e) => {
|
|
80310
|
-
c((t) => t.filter((t) => !H(t, e))), u((t) => H(t ?? "", e) ? void 0 : t);
|
|
80311
80313
|
}, []), O = d((e) => {
|
|
80312
|
-
|
|
80314
|
+
l((t) => t.filter((t) => !H(t, e))), f((t) => H(t ?? "", e) ? void 0 : t);
|
|
80313
80315
|
}, []), k = d((e) => {
|
|
80314
|
-
|
|
80315
|
-
}, [
|
|
80316
|
+
f((t) => H(t ?? "", e) ? t : e);
|
|
80317
|
+
}, []), j = d((e) => {
|
|
80318
|
+
l([]), f(void 0), h(null), a?.(e);
|
|
80319
|
+
}, [a]);
|
|
80316
80320
|
return m(() => {
|
|
80317
|
-
|
|
80318
|
-
}, [
|
|
80319
|
-
|
|
80320
|
-
}, [
|
|
80321
|
-
|
|
80322
|
-
}, [
|
|
80323
|
-
|
|
80321
|
+
r?.(E);
|
|
80322
|
+
}, [E, r]), m(() => {
|
|
80323
|
+
s?.(C);
|
|
80324
|
+
}, [C, s]), m(() => {
|
|
80325
|
+
i?.(g);
|
|
80326
|
+
}, [g, i]), m(() => () => {
|
|
80327
|
+
S.current && clearTimeout(S.current);
|
|
80324
80328
|
}, []), /* @__PURE__ */ A(k2, {
|
|
80325
80329
|
runtimeProps: e,
|
|
80326
|
-
rootClassName: `med-chat-widget${
|
|
80330
|
+
rootClassName: `med-chat-widget${w ? " is-rail-expanded" : ""}${v ? " is-rail-closing" : ""}`,
|
|
80327
80331
|
children: /* @__PURE__ */ A(Vle, {
|
|
80328
|
-
openConversationIds:
|
|
80329
|
-
onOpenConversation:
|
|
80330
|
-
onCloseConversation:
|
|
80332
|
+
openConversationIds: c,
|
|
80333
|
+
onOpenConversation: D,
|
|
80334
|
+
onCloseConversation: O,
|
|
80331
80335
|
children: /* @__PURE__ */ A(Kle, {
|
|
80332
80336
|
isWindowVisible: t,
|
|
80333
|
-
isExpanded:
|
|
80334
|
-
openConversationIds:
|
|
80335
|
-
windowCapacity:
|
|
80336
|
-
focusedConversationId:
|
|
80337
|
-
composerFocusRequest:
|
|
80337
|
+
isExpanded: w,
|
|
80338
|
+
openConversationIds: c,
|
|
80339
|
+
windowCapacity: T,
|
|
80340
|
+
focusedConversationId: u,
|
|
80341
|
+
composerFocusRequest: p,
|
|
80338
80342
|
onToggleExpand: () => {
|
|
80339
|
-
if (
|
|
80340
|
-
|
|
80343
|
+
if (S.current &&= (clearTimeout(S.current), null), !g) {
|
|
80344
|
+
x(!1), _(!0);
|
|
80341
80345
|
return;
|
|
80342
80346
|
}
|
|
80343
|
-
|
|
80344
|
-
|
|
80347
|
+
x(!0), S.current = setTimeout(() => {
|
|
80348
|
+
_(!1), x(!1), S.current = null;
|
|
80345
80349
|
}, $le);
|
|
80346
80350
|
},
|
|
80347
|
-
onOpenConversation:
|
|
80348
|
-
onCloseConversation:
|
|
80349
|
-
onFocusConversation:
|
|
80350
|
-
onOpenFullPage:
|
|
80351
|
-
onRequestClose:
|
|
80351
|
+
onOpenConversation: D,
|
|
80352
|
+
onCloseConversation: O,
|
|
80353
|
+
onFocusConversation: k,
|
|
80354
|
+
onOpenFullPage: a ? j : void 0,
|
|
80355
|
+
onRequestClose: o,
|
|
80356
|
+
openProfileRequest: n
|
|
80352
80357
|
})
|
|
80353
80358
|
})
|
|
80354
80359
|
});
|
|
@@ -3,12 +3,20 @@ export interface WidgetFocusRequest {
|
|
|
3
3
|
conversationId: string;
|
|
4
4
|
nonce: number;
|
|
5
5
|
}
|
|
6
|
+
/** Asks the widget to show a colleague's "Thông tin tài khoản" dialog (with its "Nhắn tin" button). */
|
|
7
|
+
export interface WidgetProfileRequest {
|
|
8
|
+
userId: string;
|
|
9
|
+
/** Change it on every request so asking for the same person again opens the dialog again. */
|
|
10
|
+
nonce: number;
|
|
11
|
+
}
|
|
6
12
|
export interface ChatWidgetProps extends ChatModuleProps {
|
|
7
13
|
/** Whether the host is currently showing the widget. Keep the widget mounted while this
|
|
8
14
|
* is false — the conversation list stays warm and onUnreadTotalChange keeps reporting —
|
|
9
15
|
* but the floating chat window is withheld, since it is portalled out of whatever box
|
|
10
16
|
* the host hides. Defaults to true. */
|
|
11
17
|
isOpen?: boolean;
|
|
18
|
+
/** Lets the host (e.g. the newsfeed) open a user's profile dialog inside this widget. */
|
|
19
|
+
openProfileRequest?: WidgetProfileRequest;
|
|
12
20
|
onActiveConversationChange?: (conversationId: string | undefined) => void;
|
|
13
21
|
onExpandChange?: (isExpanded: boolean) => void;
|
|
14
22
|
onOpenFullPage?: (conversationId: string | undefined) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WidgetFocusRequest } from './chat-widget.types';
|
|
1
|
+
import { WidgetFocusRequest, WidgetProfileRequest } from './chat-widget.types';
|
|
2
2
|
interface WidgetChatShellProps {
|
|
3
3
|
isWindowVisible: boolean;
|
|
4
4
|
isExpanded: boolean;
|
|
@@ -12,6 +12,7 @@ interface WidgetChatShellProps {
|
|
|
12
12
|
onFocusConversation: (conversationId: string) => void;
|
|
13
13
|
onOpenFullPage?: (conversationId: string | undefined) => void;
|
|
14
14
|
onRequestClose?: () => void;
|
|
15
|
+
openProfileRequest?: WidgetProfileRequest;
|
|
15
16
|
}
|
|
16
|
-
export declare function WidgetChatShell({ isWindowVisible, isExpanded, openConversationIds, windowCapacity, focusedConversationId, composerFocusRequest, onToggleExpand, onOpenConversation, onCloseConversation, onFocusConversation, onOpenFullPage, onRequestClose, }: WidgetChatShellProps): import('react/jsx-runtime').JSX.Element;
|
|
17
|
+
export declare function WidgetChatShell({ isWindowVisible, isExpanded, openConversationIds, windowCapacity, focusedConversationId, composerFocusRequest, onToggleExpand, onOpenConversation, onCloseConversation, onFocusConversation, onOpenFullPage, onRequestClose, openProfileRequest, }: WidgetChatShellProps): import('react/jsx-runtime').JSX.Element;
|
|
17
18
|
export {};
|