@matchain/matchid-sdk-react 0.1.53-alpha.24 → 0.1.53-alpha.26

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.
Files changed (52) hide show
  1. package/dist/assets/icon/index.d.mts +2 -2
  2. package/dist/assets/icon/index.d.ts +2 -2
  3. package/dist/{chunk-QQO3XHLB.mjs → chunk-L6N4WRWG.mjs} +250 -451
  4. package/dist/chunk-L6N4WRWG.mjs.map +1 -0
  5. package/dist/components/index.d.mts +3 -3
  6. package/dist/components/index.d.ts +3 -3
  7. package/dist/components/index.js +2 -241
  8. package/dist/components/index.js.map +1 -1
  9. package/dist/components/index.mjs +3 -5
  10. package/dist/hooks/api/index.d.mts +2 -2
  11. package/dist/hooks/api/index.d.ts +2 -2
  12. package/dist/hooks/api/index.js +78 -92
  13. package/dist/hooks/api/index.js.map +1 -1
  14. package/dist/hooks/api/index.mjs +3 -3
  15. package/dist/hooks/index.d.mts +2 -2
  16. package/dist/hooks/index.d.ts +2 -2
  17. package/dist/hooks/index.js +140 -155
  18. package/dist/hooks/index.js.map +1 -1
  19. package/dist/hooks/index.mjs +3 -3
  20. package/dist/{index-NCW6XL4g.d.ts → index-91BdMYDA.d.ts} +1 -1
  21. package/dist/{index-DkmLS3T6.d.mts → index-CPk553v5.d.mts} +1 -1
  22. package/dist/{index-D50gqmw9.d.ts → index-CPwcm70o.d.mts} +4 -11
  23. package/dist/{index-CO1V_sgI.d.ts → index-CZu_8fKl.d.ts} +1 -1
  24. package/dist/{index-70zSYbsL.d.mts → index-ChHJD4NZ.d.mts} +1 -1
  25. package/dist/{index-DXzb_pAu.d.mts → index-CkHDxE7B.d.mts} +1 -1
  26. package/dist/{index-CCnyLdRT.d.ts → index-D5geEbXf.d.ts} +2 -2
  27. package/dist/{index-DbLQvcnt.d.ts → index-DFBrN7dx.d.ts} +1 -1
  28. package/dist/{index-Cg-ZKy0h.d.mts → index-DSvRdAyZ.d.mts} +2 -2
  29. package/dist/{index-J73TIwDj.d.mts → index-DX1vzCrM.d.mts} +1 -1
  30. package/dist/{index-B00EBLeP.d.mts → index-Dj1K-UdZ.d.ts} +4 -11
  31. package/dist/{index-C1bSqPBd.d.mts → index-DjwwXNp4.d.mts} +1 -1
  32. package/dist/{index-C7GIoYyE.d.ts → index-SRHVQn5G.d.ts} +1 -1
  33. package/dist/{index-eMj_YVb6.d.ts → index-Vxvd14yW.d.ts} +1 -1
  34. package/dist/index.css +1 -0
  35. package/dist/index.d.mts +8 -8
  36. package/dist/index.d.ts +8 -8
  37. package/dist/index.js +251 -451
  38. package/dist/index.js.map +1 -1
  39. package/dist/index.mjs +6 -6
  40. package/dist/types/index.d.mts +1 -1
  41. package/dist/types/index.d.ts +1 -1
  42. package/dist/{types-CbLw2SJX.d.mts → types-Bi9iq57H.d.mts} +2 -1
  43. package/dist/{types-CbLw2SJX.d.ts → types-Bi9iq57H.d.ts} +2 -1
  44. package/dist/ui/index.d.mts +3 -3
  45. package/dist/ui/index.d.ts +3 -3
  46. package/dist/ui/index.js +52 -65
  47. package/dist/ui/index.js.map +1 -1
  48. package/dist/ui/index.mjs +3 -3
  49. package/example/src/App.tsx +0 -2
  50. package/package.json +1 -1
  51. package/dist/chunk-QQO3XHLB.mjs.map +0 -1
  52. package/example/src/pages/Message/index.tsx +0 -5
@@ -1,6 +1,6 @@
1
- export { B as BTCModal, l as ContactCard, C as ContactList, d as EVMModal, E as EmailModal, L as LoginBox, a as LoginButton, c as LoginModal, b as LoginPanel, M as MessageList, e as TONModal, T as TRONModal, g as TokenDetail, h as TokenSend, j as TokenSendList, k as TransactionList, U as UsernameModal, f as WalletAsset, W as WalletModal } from '../index-B00EBLeP.mjs';
2
- export { B as Button, F as Field, I as Input, M as Modal, a as ModalWithHeader, O as Overlay, P as Popover } from '../index-DXzb_pAu.mjs';
1
+ export { B as BTCModal, l as ContactCard, C as ContactList, d as EVMModal, E as EmailModal, L as LoginBox, a as LoginButton, c as LoginModal, b as LoginPanel, e as TONModal, T as TRONModal, g as TokenDetail, h as TokenSend, j as TokenSendList, k as TransactionList, U as UsernameModal, f as WalletAsset, W as WalletModal } from '../index-CPwcm70o.mjs';
2
+ export { B as Button, F as Field, I as Input, M as Modal, a as ModalWithHeader, O as Overlay, P as Popover } from '../index-CkHDxE7B.mjs';
3
3
  import 'react/jsx-runtime';
4
- import '../types-CbLw2SJX.mjs';
4
+ import '../types-Bi9iq57H.mjs';
5
5
  import 'react';
6
6
  import '@tanstack/react-query/src/types';
@@ -1,6 +1,6 @@
1
- export { B as BTCModal, l as ContactCard, C as ContactList, d as EVMModal, E as EmailModal, L as LoginBox, a as LoginButton, c as LoginModal, b as LoginPanel, M as MessageList, e as TONModal, T as TRONModal, g as TokenDetail, h as TokenSend, j as TokenSendList, k as TransactionList, U as UsernameModal, f as WalletAsset, W as WalletModal } from '../index-D50gqmw9.js';
2
- export { B as Button, F as Field, I as Input, M as Modal, a as ModalWithHeader, O as Overlay, P as Popover } from '../index-C7GIoYyE.js';
1
+ export { B as BTCModal, l as ContactCard, C as ContactList, d as EVMModal, E as EmailModal, L as LoginBox, a as LoginButton, c as LoginModal, b as LoginPanel, e as TONModal, T as TRONModal, g as TokenDetail, h as TokenSend, j as TokenSendList, k as TransactionList, U as UsernameModal, f as WalletAsset, W as WalletModal } from '../index-Dj1K-UdZ.js';
2
+ export { B as Button, F as Field, I as Input, M as Modal, a as ModalWithHeader, O as Overlay, P as Popover } from '../index-SRHVQn5G.js';
3
3
  import 'react/jsx-runtime';
4
- import '../types-CbLw2SJX.js';
4
+ import '../types-Bi9iq57H.js';
5
5
  import 'react';
6
6
  import '@tanstack/react-query/src/types';
@@ -42,7 +42,6 @@ __export(components_exports, {
42
42
  LoginButton: () => LoginButton,
43
43
  LoginModal: () => LoginModal,
44
44
  LoginPanel: () => LoginPanel,
45
- MessageList: () => MessageList,
46
45
  Modal: () => Modal,
47
46
  ModalWithHeader: () => ModalWithHeader,
48
47
  Overlay: () => Overlay,
@@ -1324,44 +1323,6 @@ function ModalWithHeader({
1324
1323
  children
1325
1324
  ] });
1326
1325
  }
1327
- function ConfirmModal({
1328
- title,
1329
- children,
1330
- onClose,
1331
- onConfirm,
1332
- isOpen,
1333
- confirmText,
1334
- zIndex = 100
1335
- }) {
1336
- const intl = (0, import_react_intl.useIntl)();
1337
- const [loading, setLoading] = (0, import_react3.useState)(false);
1338
- const [error, setError] = (0, import_react3.useState)("");
1339
- (0, import_react3.useEffect)(() => {
1340
- if (isOpen) {
1341
- setError("");
1342
- setLoading(false);
1343
- }
1344
- }, [isOpen]);
1345
- const onSubmit = async () => {
1346
- setError("");
1347
- setLoading(true);
1348
- try {
1349
- await onConfirm();
1350
- } catch (e) {
1351
- setError(e.message);
1352
- console.error(e);
1353
- } finally {
1354
- setLoading(false);
1355
- }
1356
- };
1357
- return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(ModalWithHeader, { isOpen, onClose, title, zIndex, children: /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "matchid-confirm-modal", children: [
1358
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "matchid-w-full", children }),
1359
- error && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: `matchid-error`, children: error }),
1360
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Button, { size: "lg", onClick: onSubmit, loading, block: true, highlight: true, children: confirmText ?? intl.formatMessage({
1361
- id: "Confirm"
1362
- }) })
1363
- ] }) });
1364
- }
1365
1326
 
1366
1327
  // src/components/EmailModal/StepEmail.tsx
1367
1328
  var import_react5 = require("react");
@@ -1951,20 +1912,6 @@ var userInviteApi = (data) => {
1951
1912
  data
1952
1913
  });
1953
1914
  };
1954
- var getUserMessageListApi = (data) => {
1955
- return request_default({
1956
- url: `/api/v1/user/message/list`,
1957
- method: "POST",
1958
- data
1959
- });
1960
- };
1961
- var handleMessageApi = (data) => {
1962
- return request_default({
1963
- url: `/api/v1/user/message`,
1964
- method: "POST",
1965
- data
1966
- });
1967
- };
1968
1915
 
1969
1916
  // src/store/useLocalStore.ts
1970
1917
  var persistedState = (0, import_middleware.persist)(
@@ -6544,7 +6491,6 @@ var import_react43 = require("react");
6544
6491
  function useContactList(page_size = 10, type = "Friend") {
6545
6492
  const { address } = useUserInfo();
6546
6493
  const limitIdRef = (0, import_react43.useRef)(0);
6547
- const queryClient2 = (0, import_react_query13.useQueryClient)();
6548
6494
  const contactQuery = (0, import_react_query13.useInfiniteQuery)({
6549
6495
  queryKey: ["matchid-contacts-list", type, address],
6550
6496
  initialPageParam: 1,
@@ -6663,9 +6609,9 @@ function ContactCard({
6663
6609
  const isDownMd = useDownMd();
6664
6610
  return /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)("div", { className: "matchid-flex matchid-contact-item", children: [
6665
6611
  /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)("div", { className: "matchid-contact-item-content", children: [
6666
- /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(Skeleton_default, { width: isDownMd ? 36 : 48, height: isDownMd ? 36 : 48, radius: 100, loading, children: data?.avatar ? /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("img", { src: data?.avatar, className: "matchid-contact-item-avatar" }) : /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(AlphaAvatar, { size: isDownMd ? 36 : 48, name: data?.name || "MatchID" }) }),
6612
+ /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(Skeleton_default, { width: isDownMd ? 36 : 48, height: isDownMd ? 36 : 48, radius: 100, loading, children: data?.avatar ? /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("img", { src: data?.avatar, className: "matchid-contact-item-avatar" }) : /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(AlphaAvatar, { size: isDownMd ? 36 : 48, name: data?.name || data?.username || "MatchID" }) }),
6667
6613
  /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)("div", { className: "matchid-contact-item-info", children: [
6668
- /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("div", { className: "matchid-contact-item-name", children: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(Skeleton_default, { width: 80, height: isDownMd ? 16 : 20, loading, children: data?.name || "MatchID User" }) }),
6614
+ /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("div", { className: "matchid-contact-item-name", children: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(Skeleton_default, { width: 80, height: isDownMd ? 16 : 20, loading, children: data?.name || data?.username || "MatchID User" }) }),
6669
6615
  /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("div", { className: "matchid-contact-item-address", children: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(Skeleton_default, { width: 80, height: isDownMd ? 12 : 16, loading, children: truncateAddress(data?.address || "", 6, 6) }) })
6670
6616
  ] })
6671
6617
  ] }),
@@ -6767,190 +6713,6 @@ function ContactList({
6767
6713
  }
6768
6714
  );
6769
6715
  }
6770
-
6771
- // src/hooks/api/message.ts
6772
- var import_react_query14 = require("@tanstack/react-query");
6773
- var import_last2 = __toESM(require("lodash/last"));
6774
- var import_react45 = require("react");
6775
- function useMessageListQuery(page_size = 20) {
6776
- const { token } = useLocalStore_default();
6777
- const [hasMore, setHasMore] = (0, import_react45.useState)(true);
6778
- const messageListQuery = (0, import_react_query14.useInfiniteQuery)({
6779
- queryKey: ["matchid-message-list", token],
6780
- initialPageParam: 0,
6781
- queryFn: async (args) => {
6782
- const res = (await getUserMessageListApi({
6783
- limit: page_size,
6784
- limit_id: args.pageParam
6785
- })).data;
6786
- console.log("hasMore", !(!res || res.length == 0 || res.length < page_size));
6787
- setHasMore(!(!res || res.length == 0 || res.length < page_size));
6788
- return res || [];
6789
- },
6790
- getNextPageParam: (lastPage, allPages) => {
6791
- if (!lastPage || lastPage.length == 0 || lastPage.length < page_size) return void 0;
6792
- return (0, import_last2.default)(lastPage)?.limit_id;
6793
- }
6794
- });
6795
- (0, import_react45.useEffect)(() => {
6796
- console.log("messageListQuery.data", messageListQuery.data);
6797
- }, [messageListQuery.data]);
6798
- const data = (0, import_react45.useMemo)(() => {
6799
- return (messageListQuery.data?.pages ?? []).reduce(
6800
- (a, b) => {
6801
- return a.concat(b || []);
6802
- },
6803
- []
6804
- );
6805
- }, [messageListQuery.data]);
6806
- return {
6807
- data,
6808
- totalCount: hasMore ? data.length + 1 : data.length,
6809
- loading: messageListQuery.isLoading,
6810
- loadingNextPage: messageListQuery.isFetchingNextPage,
6811
- hasNextPage: messageListQuery.hasNextPage,
6812
- onLoadMore: messageListQuery.fetchNextPage,
6813
- queryKey: ["matchid-message-list", token]
6814
- };
6815
- }
6816
-
6817
- // src/components/MessageList/index.tsx
6818
- var import_react46 = require("react");
6819
- var import_react_virtuoso2 = require("react-virtuoso");
6820
- var import_react_intl25 = require("react-intl");
6821
- var import_react47 = __toESM(require("react"));
6822
- var import_react_query15 = require("@tanstack/react-query");
6823
- var import_jsx_runtime100 = require("react/jsx-runtime");
6824
- function MessageList({
6825
- empty,
6826
- height = 600,
6827
- pageSize = 20
6828
- }) {
6829
- const { loading, totalCount, data, onLoadMore, queryKey, ...query } = useMessageListQuery(pageSize);
6830
- (0, import_react46.useEffect)(() => {
6831
- console.log("query", query);
6832
- }, [query]);
6833
- const modal = useModal();
6834
- const toast = useToast();
6835
- const isDownMd = useDownMd();
6836
- const queryClient2 = (0, import_react_query15.useQueryClient)();
6837
- const intl = (0, import_react_intl25.useIntl)();
6838
- const updateList = (limit_id, newData) => {
6839
- queryClient2.setQueryData(queryKey, (oldData) => {
6840
- if (!oldData) return oldData;
6841
- return {
6842
- ...oldData,
6843
- pages: oldData.pages.map((page) => page.map(
6844
- (item) => item.limit_id === limit_id ? { ...item, ...newData } : item
6845
- ))
6846
- };
6847
- });
6848
- };
6849
- const handleShortPress = async (data2, index) => {
6850
- if (data2.status == 0) {
6851
- updateList(data2.limit_id, { status: 1 });
6852
- const res = await handleMessageApi({
6853
- limit_id: data2.limit_id,
6854
- status: 1
6855
- });
6856
- if (!isSuccess(res)) {
6857
- updateList(data2.limit_id, { status: 0 });
6858
- }
6859
- }
6860
- };
6861
- const handleDelete = (data2, index) => {
6862
- modal.show(({ close, zIndex }) => {
6863
- return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
6864
- ConfirmModal,
6865
- {
6866
- title: intl.formatMessage({
6867
- id: "Delete Message Confirm"
6868
- }),
6869
- onClose: close,
6870
- onConfirm: async () => {
6871
- const res = await handleMessageApi({
6872
- limit_id: data2.limit_id,
6873
- status: 2
6874
- });
6875
- close();
6876
- if (isSuccess(res)) {
6877
- toast.success(intl.formatMessage({
6878
- id: "Message has been cleared"
6879
- }));
6880
- updateList(data2.limit_id, { hidden: true });
6881
- return;
6882
- }
6883
- toast.error(res.message);
6884
- },
6885
- isOpen: true,
6886
- zIndex,
6887
- children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(import_react_intl25.FormattedMessage, { id: "Are you sure to delete this message?" })
6888
- }
6889
- );
6890
- });
6891
- };
6892
- const handleLongPress = (data2, index) => {
6893
- handleDelete(data2, index);
6894
- };
6895
- return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
6896
- import_react_virtuoso2.Virtuoso,
6897
- {
6898
- style: {
6899
- height
6900
- },
6901
- totalCount: loading ? 0 : totalCount,
6902
- itemContent: (index) => {
6903
- const item = data[index];
6904
- if (!item) return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(import_jsx_runtime100.Fragment, {});
6905
- if (item.hidden) {
6906
- return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(import_jsx_runtime100.Fragment, {});
6907
- }
6908
- return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(import_react47.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)(
6909
- "div",
6910
- {
6911
- className: "matchid-message-item",
6912
- onClick: () => handleShortPress(item, index),
6913
- onContextMenu: (e) => {
6914
- if (isDownMd) {
6915
- e.preventDefault();
6916
- handleLongPress(item, index);
6917
- }
6918
- },
6919
- children: [
6920
- /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: "matchid-message-item-content", children: [
6921
- /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: "matchid-message-item-content-message", children: item.message }),
6922
- /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: "matchid-message-item-content-status", children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
6923
- "div",
6924
- {
6925
- className: `matchid-message-item-content-status-indicator ${item.status == 0 ? "highlight" : "default"}`
6926
- }
6927
- ) })
6928
- ] }),
6929
- /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: "matchid-message-item-footer", children: [
6930
- /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { children: !isDownMd && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
6931
- "div",
6932
- {
6933
- className: "matchid-message-item-footer-delete",
6934
- onClick: () => handleDelete(item, index),
6935
- children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(import_react_intl25.FormattedMessage, { id: "Delete" })
6936
- }
6937
- ) }),
6938
- /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { children: formatDate(item.dispatch_time, "YYYY.MM.DD HH:mm") })
6939
- ] })
6940
- ]
6941
- }
6942
- ) });
6943
- },
6944
- endReached: () => {
6945
- onLoadMore();
6946
- },
6947
- components: {
6948
- EmptyPlaceholder: () => empty || /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: "matchid-nomore", children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(import_react_intl25.FormattedMessage, { id: "There is no Data here!" }) }),
6949
- Footer: data.length > 0 ? () => /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: "matchid-nomore", children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(import_react_intl25.FormattedMessage, { id: "There is no Message here!" }) }) : () => /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: "matchid-nomore", children: "Loading..." })
6950
- }
6951
- }
6952
- );
6953
- }
6954
6716
  // Annotate the CommonJS export names for ESM import in node:
6955
6717
  0 && (module.exports = {
6956
6718
  BTCModal,
@@ -6965,7 +6727,6 @@ function MessageList({
6965
6727
  LoginButton,
6966
6728
  LoginModal,
6967
6729
  LoginPanel,
6968
- MessageList,
6969
6730
  Modal,
6970
6731
  ModalWithHeader,
6971
6732
  Overlay,