@messenger-box/platform-browser 0.0.1-alpha.176 → 0.0.1-alpha.178

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/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [0.0.1-alpha.178](https://github.com/cdmbase/messenger-box/compare/v0.0.1-alpha.177...v0.0.1-alpha.178) (2022-06-09)
7
+
8
+ **Note:** Version bump only for package @messenger-box/platform-browser
9
+
10
+
11
+
12
+
13
+
6
14
  ## [0.0.1-alpha.176](https://github.com/cdmbase/messenger-box/compare/v0.0.1-alpha.175...v0.0.1-alpha.176) (2022-06-08)
7
15
 
8
16
  **Note:** Version bump only for package @messenger-box/platform-browser
@@ -1,5 +1,5 @@
1
1
  import { FC } from 'react';
2
- import { IPostPropsFragment } from '@messenger-box/core';
2
+ import { IPostPropsFragment } from '@messenger-box/platform-client';
3
3
  import 'antd/dist/antd.css';
4
4
  interface IProps {
5
5
  userMessagesList: IPostPropsFragment[];
package/lib/index.js CHANGED
@@ -341,7 +341,7 @@ const styles_1 = __webpack_require__(/*! ./styles */ "./src/components/InboxMess
341
341
  const react_2 = __webpack_require__(/*! @chakra-ui/react */ "@chakra-ui/react");
342
342
  const bi_1 = __webpack_require__(/*! react-icons/bi */ "react-icons/bi");
343
343
  const all_1 = __webpack_require__(/*! react-icons/all */ "react-icons/all");
344
- const core_1 = __webpack_require__(/*! @messenger-box/core */ "@messenger-box/core");
344
+ const platform_client_1 = __webpack_require__(/*! @messenger-box/platform-client */ "@messenger-box/platform-client");
345
345
  const MessagesList_1 = __importDefault(__webpack_require__(/*! ../MessagesList */ "./src/components/InboxMessage/MessagesList/index.tsx"));
346
346
  function Messages({ id, user, userId, currentUser }) {
347
347
  var _a;
@@ -350,7 +350,7 @@ function Messages({ id, user, userId, currentUser }) {
350
350
  const [messageList, setMessageList] = react_1.useState([]);
351
351
  const [flag, setFlag] = react_1.useState(false);
352
352
  const [height, setHeight] = react_1.useState('40px');
353
- const { data, loading, error, refetch } = core_1.useGetMessagesQuery({
353
+ const { data, loading, error, refetch } = platform_client_1.useGetMessagesQuery({
354
354
  variables: {
355
355
  channelId: id,
356
356
  },
@@ -360,7 +360,7 @@ function Messages({ id, user, userId, currentUser }) {
360
360
  setMessageList(data.messages.data);
361
361
  }
362
362
  }, [loading, id, (_a = data === null || data === void 0 ? void 0 : data.messages) === null || _a === void 0 ? void 0 : _a.data, messageList]);
363
- const [sendMsg, {}] = core_1.useSendMessagesMutation({
363
+ const [sendMsg, {}] = platform_client_1.useSendMessagesMutation({
364
364
  context: {},
365
365
  });
366
366
  const messagesEndRef = react_1.useRef(null);
@@ -898,7 +898,7 @@ const InboxDetails_1 = __importDefault(__webpack_require__(/*! ./InboxDetails */
898
898
  const react_bootstrap_1 = __webpack_require__(/*! react-bootstrap */ "react-bootstrap");
899
899
  const react_select_1 = __importDefault(__webpack_require__(/*! react-select */ "react-select"));
900
900
  const lodash_es_1 = __webpack_require__(/*! lodash-es */ "lodash-es");
901
- const core_1 = __webpack_require__(/*! @messenger-box/core */ "@messenger-box/core");
901
+ const platform_client_1 = __webpack_require__(/*! @messenger-box/platform-client */ "@messenger-box/platform-client");
902
902
  const react_redux_1 = __webpack_require__(/*! react-redux */ "react-redux");
903
903
  function InboxMessage() {
904
904
  const { css } = react_fela_1.useFela();
@@ -917,14 +917,14 @@ function InboxMessage() {
917
917
  const [selectedValues, setSelectedValues] = react_1.useState();
918
918
  const [channels, setChannels] = react_1.useState([]);
919
919
  const [selectedChannel, setSelectedChannel] = react_1.useState();
920
- const { data, loading, error, refetch } = core_1.useGetMessagesQuery({
920
+ const { data, loading, error, refetch } = platform_client_1.useGetMessagesQuery({
921
921
  variables: {
922
922
  channelId: '61a009978512232154f65a0c',
923
923
  },
924
924
  });
925
925
  const currentUserAuth0Id = react_redux_1.useSelector((state) => state.user.auth0UserId);
926
- const channelData = core_1.useGetChannelsByUserQuery();
927
- const allChannels = core_1.useGetAllChannelQuery();
926
+ const channelData = platform_client_1.useGetChannelsByUserQuery();
927
+ const allChannels = platform_client_1.useGetAllChannelQuery();
928
928
  react_1.useEffect(() => {
929
929
  if (!channelData.loading) {
930
930
  let fChannel = [];
@@ -962,7 +962,7 @@ function InboxMessage() {
962
962
  setSelectedChannel(item);
963
963
  setToggleDrawer(false);
964
964
  };
965
- const usersRes = core_1.useGetAllUsersQuery();
965
+ const usersRes = platform_client_1.useGetAllUsersQuery();
966
966
  react_1.useEffect(() => {
967
967
  var _a;
968
968
  if (!usersRes.loading) {
@@ -1000,7 +1000,7 @@ function InboxMessage() {
1000
1000
  const handleSelect = (selectedOption) => {
1001
1001
  setSelectedValues(selectedOption);
1002
1002
  };
1003
- const [createDirectChannel, addedDirectChannel] = core_1.useAddDirectChannelMutation({
1003
+ const [createDirectChannel, addedDirectChannel] = platform_client_1.useAddDirectChannelMutation({
1004
1004
  context: { headers: {} },
1005
1005
  });
1006
1006
  react_1.useEffect(() => {
@@ -1659,12 +1659,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
1659
1659
  exports.MessengerComponent = void 0;
1660
1660
  const react_1 = __importStar(__webpack_require__(/*! react */ "react"));
1661
1661
  const antd_1 = __webpack_require__(/*! antd */ "antd");
1662
- const core_1 = __webpack_require__(/*! @messenger-box/core */ "@messenger-box/core");
1662
+ const platform_client_1 = __webpack_require__(/*! @messenger-box/platform-client */ "@messenger-box/platform-client");
1663
1663
  const all_1 = __webpack_require__(/*! react-icons/all */ "react-icons/all");
1664
1664
  const react_fela_1 = __webpack_require__(/*! react-fela */ "react-fela");
1665
1665
  const emoji_mart_1 = __webpack_require__(/*! emoji-mart */ "emoji-mart");
1666
1666
  __webpack_require__(/*! emoji-mart/css/emoji-mart.css */ "emoji-mart/css/emoji-mart.css");
1667
- const platform_client_1 = __webpack_require__(/*! @messenger-box/platform-client */ "@messenger-box/platform-client");
1667
+ const platform_client_2 = __webpack_require__(/*! @messenger-box/platform-client */ "@messenger-box/platform-client");
1668
1668
  const style_1 = __webpack_require__(/*! ./messagesList/style */ "./src/components/messenger/messagesList/style.ts");
1669
1669
  const messagesList_1 = __webpack_require__(/*! ./messagesList */ "./src/components/messenger/messagesList/index.tsx");
1670
1670
  const MessengerComponent = ({ channel, currentUsrId }) => {
@@ -1679,12 +1679,12 @@ const MessengerComponent = ({ channel, currentUsrId }) => {
1679
1679
  const [day, setDay] = react_1.useState('Today');
1680
1680
  const [threadEmoji, setThreadEmoji] = react_1.useState(false);
1681
1681
  const [files, setFiles] = react_1.useState([]);
1682
- const { startUploads } = platform_client_1.useUploadFiles();
1682
+ const { startUpload } = platform_client_2.useUploadFiles();
1683
1683
  // let token;
1684
1684
  // useEffect(() => {
1685
1685
  // token = window.localStorage.getItem('access_token');
1686
1686
  // }, []);
1687
- const { data, loading, error, refetch } = core_1.useGetMessagesQuery({
1687
+ const { data, loading, error, refetch } = platform_client_1.useGetMessagesQuery({
1688
1688
  variables: {
1689
1689
  channelId: channel.id,
1690
1690
  },
@@ -1704,7 +1704,7 @@ const MessengerComponent = ({ channel, currentUsrId }) => {
1704
1704
  setUserMessagesList((_a = data === null || data === void 0 ? void 0 : data.messages) === null || _a === void 0 ? void 0 : _a.data);
1705
1705
  }
1706
1706
  }, [loading, data]);
1707
- const [sendMsg, sentMessage] = core_1.useSendMessagesMutation({
1707
+ const [sendMsg, sentMessage] = platform_client_1.useSendMessagesMutation({
1708
1708
  update: (cache, mutationResult) => {
1709
1709
  setFiles([]);
1710
1710
  cache.modify({
@@ -1729,16 +1729,24 @@ const MessengerComponent = ({ channel, currentUsrId }) => {
1729
1729
  files: []
1730
1730
  },
1731
1731
  });
1732
- const uploadedFiles = await startUploads({
1733
- files,
1734
- ref: data.sendMessage.id,
1735
- refName: 'postId'
1732
+ const { data: uploadedFiles } = await startUpload({
1733
+ file: files,
1734
+ saveUploadedFile: {
1735
+ variables: {
1736
+ postId: data.sendMessage.id
1737
+ }
1738
+ },
1739
+ createUploadLink: {
1740
+ variables: {
1741
+ postId: data.sendMessage.id
1742
+ }
1743
+ }
1736
1744
  });
1737
1745
  await editMessage({
1738
1746
  variables: {
1739
1747
  channelId: channel.id,
1740
1748
  messageId: data.sendMessage.id,
1741
- files: uploadedFiles.map(i => i.data.id),
1749
+ files: uploadedFiles.map(i => i.id),
1742
1750
  content: enterValue
1743
1751
  }
1744
1752
  });
@@ -1746,7 +1754,7 @@ const MessengerComponent = ({ channel, currentUsrId }) => {
1746
1754
  scrollToBottom();
1747
1755
  setFlag(true);
1748
1756
  }, [channel, files, enterValue]);
1749
- const [deleteMsg, {}] = core_1.useDeleteMessageMutation({
1757
+ const [deleteMsg, {}] = platform_client_1.useDeleteMessageMutation({
1750
1758
  // context: {headers: {Authorization: token}},
1751
1759
  // refetchQueries: ['GetMessages']
1752
1760
  });
@@ -1761,7 +1769,7 @@ const MessengerComponent = ({ channel, currentUsrId }) => {
1761
1769
  const onEmojiClick = (event, emojiObject) => {
1762
1770
  setChosenEmoji(emojiObject);
1763
1771
  };
1764
- const [editMessage, {}] = core_1.useEditMessageMutation({
1772
+ const [editMessage, {}] = platform_client_1.useEditMessageMutation({
1765
1773
  // refetchQueries: ['GetMessages']
1766
1774
  });
1767
1775
  const clickRef = react_1.useRef();
@@ -1811,17 +1819,21 @@ const MessengerComponent = ({ channel, currentUsrId }) => {
1811
1819
  setShowThread(!showThread);
1812
1820
  };
1813
1821
  const handleEditMessage = react_1.useCallback(async (id, msg) => {
1814
- const uploadedFiles = await startUploads({
1815
- files,
1816
- ref: id,
1817
- refName: 'postId'
1822
+ const { data: uploadedFiles } = await startUpload({
1823
+ file: files,
1824
+ saveUploadedFile: {
1825
+ variables: {
1826
+ ref: id,
1827
+ refName: 'postId'
1828
+ }
1829
+ }
1818
1830
  });
1819
1831
  return editMessage({
1820
1832
  variables: {
1821
1833
  channelId: channel.id,
1822
1834
  messageId: id,
1823
1835
  content: msg,
1824
- files: uploadedFiles.map(i => i.data.id),
1836
+ files: uploadedFiles.map(i => i.id),
1825
1837
  },
1826
1838
  });
1827
1839
  }, [files, channel]);
@@ -3067,12 +3079,12 @@ const ri_1 = __webpack_require__(/*! react-icons/ri */ "react-icons/ri");
3067
3079
  const bs_1 = __webpack_require__(/*! react-icons/bs */ "react-icons/bs");
3068
3080
  const io5_1 = __webpack_require__(/*! react-icons/io5 */ "react-icons/io5");
3069
3081
  const antd_1 = __webpack_require__(/*! antd */ "antd");
3070
- const core_1 = __webpack_require__(/*! @messenger-box/core */ "@messenger-box/core");
3082
+ const platform_client_1 = __webpack_require__(/*! @messenger-box/platform-client */ "@messenger-box/platform-client");
3071
3083
  const react_router_dom_1 = __webpack_require__(/*! react-router-dom */ "react-router-dom");
3072
3084
  const PostViewPage = ({ channel, currentUsrId }) => {
3073
3085
  const { css } = react_fela_1.useFela();
3074
3086
  const his = react_router_dom_1.useHistory();
3075
- const [deleteChannel, deleteChannelResponse] = core_1.useDeleteChannelMutation({
3087
+ const [deleteChannel, deleteChannelResponse] = platform_client_1.useDeleteChannelMutation({
3076
3088
  // update: (cache, mutationResult) => {
3077
3089
  // const normalizedId = cache.identify({ ChannelId, __typename: 'Channel' });
3078
3090
  // cache.evict({ id: normalizedId });
@@ -23403,7 +23415,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
23403
23415
  Object.defineProperty(exports, "__esModule", { value: true });
23404
23416
  const React = __importStar(__webpack_require__(/*! react */ "react"));
23405
23417
  const style_1 = __webpack_require__(/*! ../style */ "./src/style.ts");
23406
- const core_1 = __webpack_require__(/*! @messenger-box/core */ "@messenger-box/core");
23418
+ const platform_client_1 = __webpack_require__(/*! @messenger-box/platform-client */ "@messenger-box/platform-client");
23407
23419
  const menu_header_1 = __webpack_require__(/*! ../components/dashboard/menu_header */ "./src/components/dashboard/menu_header.tsx");
23408
23420
  const modals_1 = __webpack_require__(/*! ../components/dashboard/modals */ "./src/components/dashboard/modals.tsx");
23409
23421
  const direct_modal_1 = __webpack_require__(/*! ../components/dashboard/modals/direct_modal */ "./src/components/dashboard/modals/direct_modal.tsx");
@@ -23435,12 +23447,12 @@ const Dashboard = () => {
23435
23447
  });
23436
23448
  const currentUserAuth0Id = react_redux_1.useSelector((state) => state.user.auth0UserId);
23437
23449
  const his = react_router_dom_1.useHistory();
23438
- const allUsers = core_1.useGetAllUsersQuery();
23439
- const usersToChat = core_1.useUsersToChatQuery({ variables: { auth0Id: currentUserAuth0Id } });
23440
- const currentUserRes = core_1.useCurrentUserQuery({ variables: { auth0Id: currentUserAuth0Id } });
23441
- const { data, loading, error, refetch } = core_1.useGetChannelsByUserQuery();
23442
- const allChannels = core_1.useGetAllChannelQuery();
23443
- const [addMemberToChannelMutationInput, addMemberToChannelMutationResponse] = core_1.useAddMemberToChannelMutation({
23450
+ const allUsers = platform_client_1.useGetAllUsersQuery();
23451
+ const usersToChat = platform_client_1.useUsersToChatQuery({ variables: { auth0Id: currentUserAuth0Id } });
23452
+ const currentUserRes = platform_client_1.useCurrentUserQuery({ variables: { auth0Id: currentUserAuth0Id } });
23453
+ const { data, loading, error, refetch } = platform_client_1.useGetChannelsByUserQuery();
23454
+ const allChannels = platform_client_1.useGetAllChannelQuery();
23455
+ const [addMemberToChannelMutationInput, addMemberToChannelMutationResponse] = platform_client_1.useAddMemberToChannelMutation({
23444
23456
  update: (cache, mutationResult) => {
23445
23457
  cache.modify({
23446
23458
  fields: {
@@ -23451,7 +23463,7 @@ const Dashboard = () => {
23451
23463
  });
23452
23464
  },
23453
23465
  });
23454
- const [sendMessagesMutationInput, sendMessagesMutationResponase] = core_1.useSendMessagesMutation({
23466
+ const [sendMessagesMutationInput, sendMessagesMutationResponase] = platform_client_1.useSendMessagesMutation({
23455
23467
  update: (cache, mutationResult) => {
23456
23468
  cache.modify({
23457
23469
  fields: {
@@ -23462,7 +23474,7 @@ const Dashboard = () => {
23462
23474
  });
23463
23475
  },
23464
23476
  });
23465
- const [createDirectChannel, addedDirectChannel] = core_1.useAddDirectChannelMutation({
23477
+ const [createDirectChannel, addedDirectChannel] = platform_client_1.useAddDirectChannelMutation({
23466
23478
  update: (cache, mutationResult) => {
23467
23479
  his.push(`/o/${his.location.pathname.split('/')[2]}/dashboard/message/${mutationResult.data.createDirectChannel.displayName.split('_').length === 2 ?
23468
23480
  mutationResult.data.createDirectChannel.displayName.split('_')[0].split('-')[0] !== currentUser.id ?
@@ -23480,7 +23492,7 @@ const Dashboard = () => {
23480
23492
  });
23481
23493
  },
23482
23494
  });
23483
- const [createChannel, createdChannel] = core_1.useAddChannelMutation({
23495
+ const [createChannel, createdChannel] = platform_client_1.useAddChannelMutation({
23484
23496
  update: (cache, mutationResult) => {
23485
23497
  his.push(`/o/${his.location.pathname.split('/')[2]}/dashboard/channel/${mutationResult.data.createChannel.title}`, {
23486
23498
  channel: mutationResult.data.createChannel,
@@ -24394,17 +24406,6 @@ module.exports = require("@common-stack/client-react");
24394
24406
 
24395
24407
  /***/ }),
24396
24408
 
24397
- /***/ "@messenger-box/core":
24398
- /*!**************************************!*\
24399
- !*** external "@messenger-box/core" ***!
24400
- \**************************************/
24401
- /*! no static exports found */
24402
- /***/ (function(module, exports) {
24403
-
24404
- module.exports = require("@messenger-box/core");
24405
-
24406
- /***/ }),
24407
-
24408
24409
  /***/ "@messenger-box/platform-client":
24409
24410
  /*!*************************************************!*\
24410
24411
  !*** external "@messenger-box/platform-client" ***!