whyuzeim 1.1.159 → 1.1.161
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.
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { NoticeMessageBody } from "agora-chat-uikit/types/module/noticeMessage/NoticeMessage";
|
|
2
|
+
import { ChatSDK } from "agora-chat-uikit/types/module/SDK";
|
|
3
|
+
import React from "react";
|
|
4
|
+
interface INewCustomMsg {
|
|
5
|
+
msg: ChatSDK.MessageBody | NoticeMessageBody;
|
|
6
|
+
isMySelf: boolean;
|
|
7
|
+
avatar?: React.ReactNode;
|
|
8
|
+
onSelectOption?: (extInfo: any) => void;
|
|
9
|
+
}
|
|
10
|
+
declare const NewCustomMsg: React.FC<INewCustomMsg>;
|
|
11
|
+
export default NewCustomMsg;
|
package/cjs/index.js
CHANGED
|
@@ -136754,6 +136754,127 @@ var SystemNotificationMsg = function SystemNotificationMsg(props) {
|
|
|
136754
136754
|
}, "[Activate Now]")))));
|
|
136755
136755
|
};
|
|
136756
136756
|
|
|
136757
|
+
var NewCustomMsg = function NewCustomMsg(props) {
|
|
136758
|
+
var _context3, _context4;
|
|
136759
|
+
var msg = props.msg,
|
|
136760
|
+
isMySelf = props.isMySelf,
|
|
136761
|
+
avatar = props.avatar,
|
|
136762
|
+
onSelectOption = props.onSelectOption;
|
|
136763
|
+
// 从 customExts 中解析数据
|
|
136764
|
+
var data = React.useMemo(function () {
|
|
136765
|
+
try {
|
|
136766
|
+
if (msg.type === "custom" && msg.customEvent === "new_custom" && msg.customExts) {
|
|
136767
|
+
var _context, _context2;
|
|
136768
|
+
var exts = msg.customExts;
|
|
136769
|
+
// 解析 msg 字段:第一行作为描述标题,后续行作为帮助列表
|
|
136770
|
+
var rawMsg = exts.msg || "";
|
|
136771
|
+
// 按换行分割,去除多余空白
|
|
136772
|
+
var lines = _filterInstanceProperty(_context = _mapInstanceProperty(_context2 = rawMsg.split("\n")).call(_context2, function (line) {
|
|
136773
|
+
return _trimInstanceProperty(line).call(line);
|
|
136774
|
+
})).call(_context, function (line) {
|
|
136775
|
+
return line.length > 0;
|
|
136776
|
+
});
|
|
136777
|
+
var content = lines.length > 0 ? lines[0] : "I can help you:";
|
|
136778
|
+
var helpItems = lines.length > 1 ? _sliceInstanceProperty(lines).call(lines, 1) : [];
|
|
136779
|
+
// 解析 type 字段:[{ "Conservative": 1 }, { "Moderate": 2 }, ...]
|
|
136780
|
+
var typeArr = _Array$isArray(exts.type) ? exts.type : typeof exts.type === "string" ? JSON.parse(exts.type) : [];
|
|
136781
|
+
var options = _mapInstanceProperty(typeArr).call(typeArr, function (item) {
|
|
136782
|
+
var key = _Object$keys(item)[0];
|
|
136783
|
+
return {
|
|
136784
|
+
label: key,
|
|
136785
|
+
value: item[key]
|
|
136786
|
+
};
|
|
136787
|
+
});
|
|
136788
|
+
return {
|
|
136789
|
+
content: content,
|
|
136790
|
+
helpItems: helpItems,
|
|
136791
|
+
options: options
|
|
136792
|
+
};
|
|
136793
|
+
}
|
|
136794
|
+
return null;
|
|
136795
|
+
} catch (e) {
|
|
136796
|
+
console.error("Error parsing new_custom data:", e);
|
|
136797
|
+
return null;
|
|
136798
|
+
}
|
|
136799
|
+
}, [msg]);
|
|
136800
|
+
if (!data) return null;
|
|
136801
|
+
return /*#__PURE__*/React.createElement(qh, {
|
|
136802
|
+
bubbleType: "none",
|
|
136803
|
+
reaction: false,
|
|
136804
|
+
select: false,
|
|
136805
|
+
thread: false,
|
|
136806
|
+
direction: isMySelf ? "rtl" : "ltr",
|
|
136807
|
+
renderUserProfile: function renderUserProfile() {
|
|
136808
|
+
return null;
|
|
136809
|
+
},
|
|
136810
|
+
nickName: undefined,
|
|
136811
|
+
showMessageInfo: false,
|
|
136812
|
+
message: msg,
|
|
136813
|
+
customAction: {
|
|
136814
|
+
visible: false,
|
|
136815
|
+
icon: null,
|
|
136816
|
+
actions: []
|
|
136817
|
+
},
|
|
136818
|
+
showAvatar: true,
|
|
136819
|
+
avatar: avatar
|
|
136820
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
136821
|
+
className: "text-[var(--im-main-fontColor)] flex flex-col gap-1 ".concat(isMySelf ? "items-end" : "items-start")
|
|
136822
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
136823
|
+
style: {
|
|
136824
|
+
background: "var(--im-msg-bubble-color-left)",
|
|
136825
|
+
borderRadius: "9px",
|
|
136826
|
+
padding: "14px 16px",
|
|
136827
|
+
color: "var(--im-msg-bubble-font-color)",
|
|
136828
|
+
maxWidth: "380px"
|
|
136829
|
+
},
|
|
136830
|
+
className: "flex flex-col gap-3"
|
|
136831
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
136832
|
+
className: "font-semibold text-xs leading-snug",
|
|
136833
|
+
style: {
|
|
136834
|
+
color: "#90F926"
|
|
136835
|
+
}
|
|
136836
|
+
}, "Your Personalized AI Assistant"), /*#__PURE__*/React.createElement("div", {
|
|
136837
|
+
className: "text-xs leading-relaxed opacity-90"
|
|
136838
|
+
}, data.content), data.helpItems.length > 0 && /*#__PURE__*/React.createElement("ul", {
|
|
136839
|
+
className: "list-none m-0 p-0 flex flex-col gap-2"
|
|
136840
|
+
}, _mapInstanceProperty(_context3 = data.helpItems).call(_context3, function (item, idx) {
|
|
136841
|
+
return /*#__PURE__*/React.createElement("li", {
|
|
136842
|
+
key: idx,
|
|
136843
|
+
className: "text-xs leading-relaxed flex items-start gap-2",
|
|
136844
|
+
style: {
|
|
136845
|
+
color: "var(--im-msg-bubble-font-color)",
|
|
136846
|
+
opacity: 0.85
|
|
136847
|
+
}
|
|
136848
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
136849
|
+
className: "shrink-0 mt-[2px]"
|
|
136850
|
+
}, "\xB7"), /*#__PURE__*/React.createElement("span", null, item));
|
|
136851
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
136852
|
+
className: "text-sm font-semibold leading-snug mt-1",
|
|
136853
|
+
style: {
|
|
136854
|
+
color: "var(--im-msg-bubble-font-color)"
|
|
136855
|
+
}
|
|
136856
|
+
}, "Please select your AI Bot type:"), data.options.length > 0 && /*#__PURE__*/React.createElement("div", {
|
|
136857
|
+
className: "flex flex-wrap gap-2 mt-1"
|
|
136858
|
+
}, _mapInstanceProperty(_context4 = data.options).call(_context4, function (option, idx) {
|
|
136859
|
+
return /*#__PURE__*/React.createElement("button", {
|
|
136860
|
+
key: idx,
|
|
136861
|
+
className: "px-4 py-1 rounded-full text-sm font-normal cursor-pointer transition-opacity duration-200 hover:opacity-80",
|
|
136862
|
+
style: {
|
|
136863
|
+
background: "transparent",
|
|
136864
|
+
border: "1px solid #90F926",
|
|
136865
|
+
color: "#90F926"
|
|
136866
|
+
},
|
|
136867
|
+
onClick: function onClick() {
|
|
136868
|
+
onSelectOption && onSelectOption({
|
|
136869
|
+
text: option.label,
|
|
136870
|
+
value: option.value,
|
|
136871
|
+
customEvent: msg.customEvent
|
|
136872
|
+
});
|
|
136873
|
+
}
|
|
136874
|
+
}, option.label);
|
|
136875
|
+
})))));
|
|
136876
|
+
};
|
|
136877
|
+
|
|
136757
136878
|
var _excluded = ["children"],
|
|
136758
136879
|
_excluded2 = ["className", "children"];
|
|
136759
136880
|
function ownKeys$5(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -136888,8 +137009,9 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
136888
137009
|
delete currentUserInfo.ext;
|
|
136889
137010
|
}
|
|
136890
137011
|
cacheClearedRef.current = true;
|
|
136891
|
-
}
|
|
136892
|
-
|
|
137012
|
+
}
|
|
137013
|
+
// 如果已经清理过,重新获取(因为可能已经被其他逻辑修改)
|
|
137014
|
+
if (cacheClearedRef.current) {
|
|
136893
137015
|
currentUserInfo = Ut.addressStore.appUsersInfo[userInfo.uid];
|
|
136894
137016
|
}
|
|
136895
137017
|
var isFetching = fetchingUsersRef.current.has(userInfo.uid);
|
|
@@ -137261,6 +137383,18 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
137261
137383
|
}
|
|
137262
137384
|
}
|
|
137263
137385
|
});
|
|
137386
|
+
} else if (msg.type === "custom" && (msg === null || msg === void 0 ? void 0 : msg.customEvent) === "new_custom") {
|
|
137387
|
+
return /*#__PURE__*/React.createElement(NewCustomMsg, {
|
|
137388
|
+
msg: msg,
|
|
137389
|
+
isMySelf: isMySelf,
|
|
137390
|
+
avatar: !isMySelf ? /*#__PURE__*/React.createElement("img", {
|
|
137391
|
+
src: headerInfo.headerImageURL || img$q,
|
|
137392
|
+
className: "shrink-0 w-[32px] h-[32px] rounded-full overflow-hidden object-fit"
|
|
137393
|
+
}) : undefined,
|
|
137394
|
+
onSelectOption: function onSelectOption(extInfo) {
|
|
137395
|
+
handleSendMessage(extInfo.text, extInfo);
|
|
137396
|
+
}
|
|
137397
|
+
});
|
|
137264
137398
|
} else if (msg.type === "custom" && (msg === null || msg === void 0 ? void 0 : msg.customEvent) === "custom_system_notice") {
|
|
137265
137399
|
return /*#__PURE__*/React.createElement(SystemNotificationMsg, {
|
|
137266
137400
|
msg: msg,
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { NoticeMessageBody } from "agora-chat-uikit/types/module/noticeMessage/NoticeMessage";
|
|
2
|
+
import { ChatSDK } from "agora-chat-uikit/types/module/SDK";
|
|
3
|
+
import React from "react";
|
|
4
|
+
interface INewCustomMsg {
|
|
5
|
+
msg: ChatSDK.MessageBody | NoticeMessageBody;
|
|
6
|
+
isMySelf: boolean;
|
|
7
|
+
avatar?: React.ReactNode;
|
|
8
|
+
onSelectOption?: (extInfo: any) => void;
|
|
9
|
+
}
|
|
10
|
+
declare const NewCustomMsg: React.FC<INewCustomMsg>;
|
|
11
|
+
export default NewCustomMsg;
|
package/es/index.js
CHANGED
|
@@ -136733,6 +136733,127 @@ var SystemNotificationMsg = function SystemNotificationMsg(props) {
|
|
|
136733
136733
|
}, "[Activate Now]")))));
|
|
136734
136734
|
};
|
|
136735
136735
|
|
|
136736
|
+
var NewCustomMsg = function NewCustomMsg(props) {
|
|
136737
|
+
var _context3, _context4;
|
|
136738
|
+
var msg = props.msg,
|
|
136739
|
+
isMySelf = props.isMySelf,
|
|
136740
|
+
avatar = props.avatar,
|
|
136741
|
+
onSelectOption = props.onSelectOption;
|
|
136742
|
+
// 从 customExts 中解析数据
|
|
136743
|
+
var data = React__default.useMemo(function () {
|
|
136744
|
+
try {
|
|
136745
|
+
if (msg.type === "custom" && msg.customEvent === "new_custom" && msg.customExts) {
|
|
136746
|
+
var _context, _context2;
|
|
136747
|
+
var exts = msg.customExts;
|
|
136748
|
+
// 解析 msg 字段:第一行作为描述标题,后续行作为帮助列表
|
|
136749
|
+
var rawMsg = exts.msg || "";
|
|
136750
|
+
// 按换行分割,去除多余空白
|
|
136751
|
+
var lines = _filterInstanceProperty(_context = _mapInstanceProperty(_context2 = rawMsg.split("\n")).call(_context2, function (line) {
|
|
136752
|
+
return _trimInstanceProperty(line).call(line);
|
|
136753
|
+
})).call(_context, function (line) {
|
|
136754
|
+
return line.length > 0;
|
|
136755
|
+
});
|
|
136756
|
+
var content = lines.length > 0 ? lines[0] : "I can help you:";
|
|
136757
|
+
var helpItems = lines.length > 1 ? _sliceInstanceProperty(lines).call(lines, 1) : [];
|
|
136758
|
+
// 解析 type 字段:[{ "Conservative": 1 }, { "Moderate": 2 }, ...]
|
|
136759
|
+
var typeArr = _Array$isArray(exts.type) ? exts.type : typeof exts.type === "string" ? JSON.parse(exts.type) : [];
|
|
136760
|
+
var options = _mapInstanceProperty(typeArr).call(typeArr, function (item) {
|
|
136761
|
+
var key = _Object$keys(item)[0];
|
|
136762
|
+
return {
|
|
136763
|
+
label: key,
|
|
136764
|
+
value: item[key]
|
|
136765
|
+
};
|
|
136766
|
+
});
|
|
136767
|
+
return {
|
|
136768
|
+
content: content,
|
|
136769
|
+
helpItems: helpItems,
|
|
136770
|
+
options: options
|
|
136771
|
+
};
|
|
136772
|
+
}
|
|
136773
|
+
return null;
|
|
136774
|
+
} catch (e) {
|
|
136775
|
+
console.error("Error parsing new_custom data:", e);
|
|
136776
|
+
return null;
|
|
136777
|
+
}
|
|
136778
|
+
}, [msg]);
|
|
136779
|
+
if (!data) return null;
|
|
136780
|
+
return /*#__PURE__*/React__default.createElement(qh, {
|
|
136781
|
+
bubbleType: "none",
|
|
136782
|
+
reaction: false,
|
|
136783
|
+
select: false,
|
|
136784
|
+
thread: false,
|
|
136785
|
+
direction: isMySelf ? "rtl" : "ltr",
|
|
136786
|
+
renderUserProfile: function renderUserProfile() {
|
|
136787
|
+
return null;
|
|
136788
|
+
},
|
|
136789
|
+
nickName: undefined,
|
|
136790
|
+
showMessageInfo: false,
|
|
136791
|
+
message: msg,
|
|
136792
|
+
customAction: {
|
|
136793
|
+
visible: false,
|
|
136794
|
+
icon: null,
|
|
136795
|
+
actions: []
|
|
136796
|
+
},
|
|
136797
|
+
showAvatar: true,
|
|
136798
|
+
avatar: avatar
|
|
136799
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
136800
|
+
className: "text-[var(--im-main-fontColor)] flex flex-col gap-1 ".concat(isMySelf ? "items-end" : "items-start")
|
|
136801
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
136802
|
+
style: {
|
|
136803
|
+
background: "var(--im-msg-bubble-color-left)",
|
|
136804
|
+
borderRadius: "9px",
|
|
136805
|
+
padding: "14px 16px",
|
|
136806
|
+
color: "var(--im-msg-bubble-font-color)",
|
|
136807
|
+
maxWidth: "380px"
|
|
136808
|
+
},
|
|
136809
|
+
className: "flex flex-col gap-3"
|
|
136810
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
136811
|
+
className: "font-semibold text-xs leading-snug",
|
|
136812
|
+
style: {
|
|
136813
|
+
color: "#90F926"
|
|
136814
|
+
}
|
|
136815
|
+
}, "Your Personalized AI Assistant"), /*#__PURE__*/React__default.createElement("div", {
|
|
136816
|
+
className: "text-xs leading-relaxed opacity-90"
|
|
136817
|
+
}, data.content), data.helpItems.length > 0 && /*#__PURE__*/React__default.createElement("ul", {
|
|
136818
|
+
className: "list-none m-0 p-0 flex flex-col gap-2"
|
|
136819
|
+
}, _mapInstanceProperty(_context3 = data.helpItems).call(_context3, function (item, idx) {
|
|
136820
|
+
return /*#__PURE__*/React__default.createElement("li", {
|
|
136821
|
+
key: idx,
|
|
136822
|
+
className: "text-xs leading-relaxed flex items-start gap-2",
|
|
136823
|
+
style: {
|
|
136824
|
+
color: "var(--im-msg-bubble-font-color)",
|
|
136825
|
+
opacity: 0.85
|
|
136826
|
+
}
|
|
136827
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
|
136828
|
+
className: "shrink-0 mt-[2px]"
|
|
136829
|
+
}, "\xB7"), /*#__PURE__*/React__default.createElement("span", null, item));
|
|
136830
|
+
})), /*#__PURE__*/React__default.createElement("div", {
|
|
136831
|
+
className: "text-sm font-semibold leading-snug mt-1",
|
|
136832
|
+
style: {
|
|
136833
|
+
color: "var(--im-msg-bubble-font-color)"
|
|
136834
|
+
}
|
|
136835
|
+
}, "Please select your AI Bot type:"), data.options.length > 0 && /*#__PURE__*/React__default.createElement("div", {
|
|
136836
|
+
className: "flex flex-wrap gap-2 mt-1"
|
|
136837
|
+
}, _mapInstanceProperty(_context4 = data.options).call(_context4, function (option, idx) {
|
|
136838
|
+
return /*#__PURE__*/React__default.createElement("button", {
|
|
136839
|
+
key: idx,
|
|
136840
|
+
className: "px-4 py-1 rounded-full text-sm font-normal cursor-pointer transition-opacity duration-200 hover:opacity-80",
|
|
136841
|
+
style: {
|
|
136842
|
+
background: "transparent",
|
|
136843
|
+
border: "1px solid #90F926",
|
|
136844
|
+
color: "#90F926"
|
|
136845
|
+
},
|
|
136846
|
+
onClick: function onClick() {
|
|
136847
|
+
onSelectOption && onSelectOption({
|
|
136848
|
+
text: option.label,
|
|
136849
|
+
value: option.value,
|
|
136850
|
+
customEvent: msg.customEvent
|
|
136851
|
+
});
|
|
136852
|
+
}
|
|
136853
|
+
}, option.label);
|
|
136854
|
+
})))));
|
|
136855
|
+
};
|
|
136856
|
+
|
|
136736
136857
|
var _excluded = ["children"],
|
|
136737
136858
|
_excluded2 = ["className", "children"];
|
|
136738
136859
|
function ownKeys$5(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -136867,8 +136988,9 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
136867
136988
|
delete currentUserInfo.ext;
|
|
136868
136989
|
}
|
|
136869
136990
|
cacheClearedRef.current = true;
|
|
136870
|
-
}
|
|
136871
|
-
|
|
136991
|
+
}
|
|
136992
|
+
// 如果已经清理过,重新获取(因为可能已经被其他逻辑修改)
|
|
136993
|
+
if (cacheClearedRef.current) {
|
|
136872
136994
|
currentUserInfo = Ut.addressStore.appUsersInfo[userInfo.uid];
|
|
136873
136995
|
}
|
|
136874
136996
|
var isFetching = fetchingUsersRef.current.has(userInfo.uid);
|
|
@@ -137240,6 +137362,18 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
137240
137362
|
}
|
|
137241
137363
|
}
|
|
137242
137364
|
});
|
|
137365
|
+
} else if (msg.type === "custom" && (msg === null || msg === void 0 ? void 0 : msg.customEvent) === "new_custom") {
|
|
137366
|
+
return /*#__PURE__*/React__default.createElement(NewCustomMsg, {
|
|
137367
|
+
msg: msg,
|
|
137368
|
+
isMySelf: isMySelf,
|
|
137369
|
+
avatar: !isMySelf ? /*#__PURE__*/React__default.createElement("img", {
|
|
137370
|
+
src: headerInfo.headerImageURL || img$q,
|
|
137371
|
+
className: "shrink-0 w-[32px] h-[32px] rounded-full overflow-hidden object-fit"
|
|
137372
|
+
}) : undefined,
|
|
137373
|
+
onSelectOption: function onSelectOption(extInfo) {
|
|
137374
|
+
handleSendMessage(extInfo.text, extInfo);
|
|
137375
|
+
}
|
|
137376
|
+
});
|
|
137243
137377
|
} else if (msg.type === "custom" && (msg === null || msg === void 0 ? void 0 : msg.customEvent) === "custom_system_notice") {
|
|
137244
137378
|
return /*#__PURE__*/React__default.createElement(SystemNotificationMsg, {
|
|
137245
137379
|
msg: msg,
|