@messenger-box/platform-browser 0.0.1-alpha.86 → 0.0.1-alpha.94

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 (44) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/lib/components/InboxMessage/InboxDetails/index.d.ts +1 -0
  3. package/lib/components/InboxMessage/InboxSidebar/index.d.ts +1 -0
  4. package/lib/components/InboxMessage/Messages/index.d.ts +1 -0
  5. package/lib/components/InboxMessage/MessagesList/index.d.ts +1 -0
  6. package/lib/components/InboxMessage/Popover/index.d.ts +1 -0
  7. package/lib/components/InboxMessage/index.d.ts +1 -0
  8. package/lib/components/messenger/more_action/index.d.ts +1 -0
  9. package/lib/components/post/channel_intro_message/channel_intro_message.d.ts +1 -0
  10. package/lib/components/post/channel_layout/channel_identifier_router/channel_identifier_router.d.ts +1 -0
  11. package/lib/components/post/channel_view/channel_view.d.ts +1 -0
  12. package/lib/components/post/create_post/create_post.d.ts +1 -0
  13. package/lib/components/post/failed_post_options/failed_post_options.d.ts +1 -0
  14. package/lib/components/post/index.d.ts +1 -0
  15. package/lib/components/post/markdown/markdown.d.ts +1 -0
  16. package/lib/components/post/post/post.d.ts +1 -0
  17. package/lib/components/post/post_body/post_body.d.ts +1 -0
  18. package/lib/components/post/post_header/post_header.d.ts +1 -0
  19. package/lib/components/post/post_header/post_header_custom_status.d.ts +1 -0
  20. package/lib/components/post/post_info/post_info.d.ts +1 -0
  21. package/lib/components/post/post_list/index.d.ts +1 -0
  22. package/lib/components/post/post_list/post_list.d.ts +1 -0
  23. package/lib/components/post/post_list_row/post_list_row.d.ts +1 -0
  24. package/lib/components/post/post_list_virtualized/latest_post_reader.d.ts +1 -0
  25. package/lib/components/post/post_list_virtualized/post_list_virtualized.d.ts +1 -0
  26. package/lib/components/post/post_markdown/post_markdown.d.ts +1 -0
  27. package/lib/components/post/post_message_view/post_message_view.d.ts +1 -0
  28. package/lib/components/post/post_pre_header/post_pre_header.d.ts +1 -0
  29. package/lib/components/post/post_profile_picture/post_profile_picture.d.ts +1 -0
  30. package/lib/components/post/post_view.d.ts +1 -0
  31. package/lib/components/post/profile_picture/profile_picture.d.ts +1 -0
  32. package/lib/components/post/show_more/show_more.d.ts +1 -0
  33. package/lib/components/post/threading/channel_threads/thread_footer/thread_footer.d.ts +1 -0
  34. package/lib/components/status_icon.d.ts +1 -0
  35. package/lib/containers/Inbox.d.ts +1 -0
  36. package/lib/index.js +62 -38
  37. package/lib/index.js.map +1 -1
  38. package/package.json +2 -2
  39. package/src/components/InboxMessage/InboxSidebar/index.tsx +12 -7
  40. package/src/components/InboxMessage/MessagesList/index.tsx +0 -1
  41. package/src/components/InboxMessage/index.tsx +38 -18
  42. package/src/components/messenger/messagesList/index.tsx +65 -62
  43. package/src/compute.tsx +1 -6
  44. package/src/containers/Dashboard.tsx +7 -5
package/CHANGELOG.md CHANGED
@@ -3,6 +3,38 @@
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.94](https://github.com/cdmbase/messenger-box/compare/v0.0.1-alpha.93...v0.0.1-alpha.94) (2021-12-01)
7
+
8
+ **Note:** Version bump only for package @messenger-box/platform-browser
9
+
10
+
11
+
12
+
13
+
14
+ ## [0.0.1-alpha.93](https://github.com/cdmbase/messenger-box/compare/v0.0.1-alpha.92...v0.0.1-alpha.93) (2021-11-30)
15
+
16
+ **Note:** Version bump only for package @messenger-box/platform-browser
17
+
18
+
19
+
20
+
21
+
22
+ ## [0.0.1-alpha.88](https://github.com/cdmbase/messenger-box/compare/v0.0.1-alpha.87...v0.0.1-alpha.88) (2021-11-26)
23
+
24
+ **Note:** Version bump only for package @messenger-box/platform-browser
25
+
26
+
27
+
28
+
29
+
30
+ ## [0.0.1-alpha.87](https://github.com/cdmbase/messenger-box/compare/v0.0.1-alpha.86...v0.0.1-alpha.87) (2021-11-26)
31
+
32
+ **Note:** Version bump only for package @messenger-box/platform-browser
33
+
34
+
35
+
36
+
37
+
6
38
  ## [0.0.1-alpha.86](https://github.com/cdmbase/messenger-box/compare/v0.0.1-alpha.85...v0.0.1-alpha.86) (2021-11-25)
7
39
 
8
40
  **Note:** Version bump only for package @messenger-box/platform-browser
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export default function InboxDetails({ handleToggle, toggleDrawer }: any): JSX.Element;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  declare type IPropsType = {
2
3
  handleSelectMessgae?: any;
3
4
  user?: [] | any;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export default function Messages({ id, user, userId, currentUser }: any): JSX.Element;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export default function MsgList({ messageList, currentUser }: any): JSX.Element;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export default function Popover({ toggleDrawer }: any): JSX.Element;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export default function InboxMessage(): JSX.Element;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  declare type IProps = {
2
3
  handleShowSideBar?: any;
3
4
  handleDeleteMessage?: any;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export declare const ChannelIntroMessage: (props: any) => JSX.Element;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export declare const ChannelIdentifierRouter: (props: any) => JSX.Element;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export declare const ChannelView: (props: any) => JSX.Element;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export declare const CreatePost: (props: any) => JSX.Element;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export declare const FailedPostOptions: (props: any) => JSX.Element;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare const PostViewPage: ({ channel, refetchCall }: {
2
3
  channel: any;
3
4
  refetchCall: any;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export declare const Markdown: (props: any) => JSX.Element;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export declare const Post: (props: any) => JSX.Element;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export declare const PostBody: (props: any) => JSX.Element;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export declare const PostHeader: (props: any) => JSX.Element;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export declare const PostHeaderCustomStatus: (props: any) => JSX.Element;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export declare const PostInfo: (props: any) => JSX.Element;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export declare const PostListPage: () => JSX.Element;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export declare const PostList: (props: any) => JSX.Element;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export declare const PostListRow: (props: any) => JSX.Element;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export declare const LatestPostReader: () => JSX.Element;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export declare const VirtPostList: (props: any) => JSX.Element;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export declare const PostMarkdown: (props: any) => JSX.Element;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export declare const PostMessageView: (props: any) => JSX.Element;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { IntlShape } from 'react-intl';
2
3
  export declare type Props = {
3
4
  intl?: IntlShape;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export declare const PostProfilePicture: (props: any) => JSX.Element;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export declare const PostView: () => JSX.Element;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export declare const ProfilePicture: (props: any) => JSX.Element;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export declare const ShowMore: (props: any) => JSX.Element;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export declare const ThreadFooter: (props: any) => JSX.Element;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export declare const StatusIcon: (props: any) => JSX.Element;
@@ -1,2 +1,3 @@
1
+ /// <reference types="react" />
1
2
  declare const Inbox: () => JSX.Element;
2
3
  export default Inbox;
package/lib/index.js CHANGED
@@ -195,14 +195,12 @@ const styles_1 = __webpack_require__(/*! ./styles */ "./src/components/InboxMess
195
195
  function InboxSidebar({ handleSelectMessgae, user, messageList, currentUser, userId }) {
196
196
  const { css } = react_fela_1.useFela();
197
197
  return (React.createElement("div", { className: css(styles_1.styleSheet.inboxSibarStyles) }, (user === null || user === void 0 ? void 0 : user.length) > 0 ? user === null || user === void 0 ? void 0 : user.map((item, index) => {
198
+ var _a, _b, _c;
198
199
  const lastMessage = messageList[(messageList === null || messageList === void 0 ? void 0 : messageList.length) - 1];
199
200
  if (item.displayName !== currentUser && item.displayName !== 'admin (you)' && item.displayName !== 'surveybot') {
200
201
  return React.createElement("a", { className: 'show-message', onClick: () => handleSelectMessgae(item), key: index },
201
202
  React.createElement("div", { className: 'inbox-contacts' },
202
- React.createElement(antd_1.Avatar, { size: 45 }, item.displayName
203
- .match(/\b(\w)/g)
204
- .join('')
205
- .toUpperCase()),
203
+ React.createElement(antd_1.Avatar, { size: 45 }, (_c = (_b = (_a = item === null || item === void 0 ? void 0 : item.displayName) === null || _a === void 0 ? void 0 : _a.match(/\b(\w)/g)) === null || _b === void 0 ? void 0 : _b.join('')) === null || _c === void 0 ? void 0 : _c.toUpperCase()),
206
204
  React.createElement("div", { className: 'last-message' },
207
205
  React.createElement("h5", null, item === null || item === void 0 ? void 0 : item.displayName),
208
206
  React.createElement("p", null, lastMessage === null || lastMessage === void 0 ? void 0 : lastMessage.message))));
@@ -213,6 +211,13 @@ function InboxSidebar({ handleSelectMessgae, user, messageList, currentUser, use
213
211
  React.createElement(antd_1.Button, null, "Explore"))));
214
212
  }
215
213
  exports.default = InboxSidebar;
214
+ // {
215
+ // cnl.displayName.split(',').length > 1 ?
216
+ // <span
217
+ // className="num_style">{cnl.displayName.split(',').length}</span> :
218
+ // <span className="icon icon__globe"
219
+ // color="white"><RiAdminFill /></span>
220
+ // }
216
221
 
217
222
 
218
223
  /***/ }),
@@ -679,17 +684,17 @@ function InboxMessage() {
679
684
  const [options, setOptions] = react_1.useState([]);
680
685
  const [userId, setUserId] = react_1.useState();
681
686
  const [selectedValues, setSelectedValues] = react_1.useState();
682
- const [clickedChannel, setClickedChannel] = react_1.useState({});
683
687
  const [channels, setChannels] = react_1.useState([]);
684
688
  const [selectedChannel, setSelectedChannel] = react_1.useState();
685
689
  const { data, loading, error, refetch } = core_1.useGetMessagesQuery({
686
690
  variables: {
687
- channelId: '619c358964bcaf93a240b23e'
691
+ channelId: '61a009978512232154f65a0c'
688
692
  }
689
693
  });
690
694
  const currentUserAuth0Id = react_redux_1.useSelector((state) => state.user.auth0UserId);
691
695
  const channelData = core_1.useGetChannelsByUserQuery();
692
696
  const allChannels = core_1.useGetAllChannelQuery();
697
+ console.log(allChannels);
693
698
  react_1.useEffect(() => {
694
699
  if (!channelData.loading) {
695
700
  let fChannel = [];
@@ -710,17 +715,19 @@ function InboxMessage() {
710
715
  }
711
716
  });
712
717
  }
713
- setChannel([...channelData === null || channelData === void 0 ? void 0 : channelData.data.channelsByUser.filter(chl => chl.type === "DIRECT"), ...fChannel.filter(chl => chl.type === "DIRECT")]);
718
+ console.log(fChannel);
719
+ setChannel([...channelData === null || channelData === void 0 ? void 0 : channelData.data.channelsByUser.filter(chl => chl.type === "DIRECT" && (chl === null || chl === void 0 ? void 0 : chl.displayName) !== 'admin (you)' && (chl === null || chl === void 0 ? void 0 : chl.displayName) !== 'surveybot'), ...fChannel.filter(chl => chl.type === "DIRECT")]);
714
720
  }
715
721
  }, [loading, channelData, currentUserId]);
716
722
  const handleSelectMessgae = (item) => {
717
723
  setShowMessageSide(true);
718
- item.members.map((i) => {
719
- return setUserId(i.user);
720
- });
721
724
  setId(item === null || item === void 0 ? void 0 : item.id);
725
+ item.members.map((e) => {
726
+ return setUserId(e.user);
727
+ });
722
728
  setSelectedChannel(item);
723
729
  };
730
+ console.log(userId, channel);
724
731
  const usersRes = core_1.useGetAllUsersQuery();
725
732
  react_1.useEffect(() => {
726
733
  var _a;
@@ -760,10 +767,16 @@ function InboxMessage() {
760
767
  const [createDirectChannel, addedDirectChannel] = core_1.useAddDirectChannelMutation({
761
768
  context: { headers: {} }
762
769
  });
770
+ react_1.useEffect(() => {
771
+ if (!addedDirectChannel.loading && addedDirectChannel.data) {
772
+ setSelectedChannel(addedDirectChannel.data.createDirectChannel);
773
+ }
774
+ });
763
775
  const handleGo = () => {
764
776
  if (selectedValues) {
765
777
  let uids = [];
766
778
  let dName = '';
779
+ console.log(selectedChannel === null || selectedChannel === void 0 ? void 0 : selectedChannel.value);
767
780
  if (selectedValues.length > 1) {
768
781
  selectedValues.forEach(i => {
769
782
  uids.push(i.value.uid);
@@ -777,18 +790,28 @@ function InboxMessage() {
777
790
  uids.push(selectedValues[0].value.uid);
778
791
  dName = selectedValues[0].value.username;
779
792
  }
780
- createDirectChannel({
781
- variables: {
782
- receiver: uids,
783
- displayName: dName
793
+ let channl;
794
+ channel.forEach((i) => {
795
+ if ((i === null || i === void 0 ? void 0 : i.displayName) == dName) {
796
+ channl = i.members.find((e) => {
797
+ return e.user == uids;
798
+ });
784
799
  }
785
- }).then((res) => {
786
- setClickedChannel(res.data.createDirectChannel);
787
- channelData.refetch().then((value => {
788
- setChannels(value.data.channelsByUser);
789
- setSelectedValues([]);
790
- }));
791
800
  });
801
+ if ((channl === null || channl === void 0 ? void 0 : channl.user) !== uids[0]) {
802
+ createDirectChannel({
803
+ variables: {
804
+ receiver: uids,
805
+ displayName: dName
806
+ }
807
+ }).then((res) => {
808
+ setSelectedChannel(res.data.createDirectChannel);
809
+ channelData.refetch().then((value => {
810
+ setChannels(value.data.channelsByUser);
811
+ setSelectedValues([]);
812
+ }));
813
+ });
814
+ }
792
815
  handleClose();
793
816
  }
794
817
  };
@@ -1408,26 +1431,26 @@ const MessagesList = ({ userMessagesList, handleShowSideBar, handleDeleteMessage
1408
1431
  index !== 0 ?
1409
1432
  moment_1.default(userMessagesList[index].createdAt).format('DD/MM/YYYY')
1410
1433
  !== moment_1.default(userMessagesList[index - 1].createdAt).format('DD/MM/YYYY') ?
1411
- react_1.default.createElement("div", { className: "text-divider" }, moment_1.default(item.createdAt).diff(moment_1.default().format(), 'days') == -1
1412
- ? 'yesterday'
1413
- : moment_1.default(item.createdAt).diff(moment_1.default().format(), 'days') <= -2
1414
- ? `${moment_1.default(item.createdAt).format('dddd')}`
1415
- : moment_1.default(item.createdAt).diff(moment_1.default().format(), 'weeks') <= -1
1416
- ? `${moment_1.default(item.createdAt).format('ddd MMMM DD')}`
1417
- : moment_1.default(item.createdAt).diff(moment_1.default().format(), 'months') <= -1
1418
- ? `${moment_1.default(item.createdAt).format('MMMM DD')}`
1419
- : 'Today')
1434
+ react_1.default.createElement("div", { className: "text-divider" }, moment_1.default(item.createdAt).diff(moment_1.default().format(), "year") == 0
1435
+ ? moment_1.default(item.createdAt).diff(moment_1.default().format(), "day") == 0
1436
+ ? 'Today'
1437
+ : moment_1.default(item.createdAt).diff(moment_1.default().format(), "day") == -1
1438
+ ? 'Yesterday'
1439
+ : moment_1.default(item.createdAt).diff(moment_1.default().format(), "day") >= -6
1440
+ ? `${moment_1.default(item.createdAt).format('dddd')}`
1441
+ : `${moment_1.default(item.createdAt).format('MMMM DD')}`
1442
+ : `${moment_1.default(item.createdAt).format('MMMM Do, YYYY')}`)
1420
1443
  : ''
1421
1444
  :
1422
- react_1.default.createElement("div", { className: "text-divider" }, moment_1.default(item.createdAt).diff(moment_1.default().format(), 'days') == -1
1423
- ? 'yesterday'
1424
- : moment_1.default(item.createdAt).diff(moment_1.default().format(), 'days') <= -2
1425
- ? `${moment_1.default(item.createdAt).format('dddd')}`
1426
- : moment_1.default(item.createdAt).diff(moment_1.default().format(), 'weeks') <= -1
1427
- ? `${moment_1.default(item.createdAt).format('ddd MMMM DD')}`
1428
- : moment_1.default(item.createdAt).diff(moment_1.default().format(), 'months') <= -1
1429
- ? `${moment_1.default(item.createdAt).format('MMMM DD')}`
1430
- : 'Today'),
1445
+ react_1.default.createElement("div", { className: "text-divider" }, moment_1.default(item.createdAt).diff(moment_1.default().format(), "year") == 0
1446
+ ? moment_1.default(item.createdAt).diff(moment_1.default().format(), "day") == 0
1447
+ ? 'Today'
1448
+ : moment_1.default(item.createdAt).diff(moment_1.default().format(), "day") == -1
1449
+ ? 'Yesterday'
1450
+ : moment_1.default(item.createdAt).diff(moment_1.default().format(), "day") >= -6
1451
+ ? `${moment_1.default(item.createdAt).format('dddd')}`
1452
+ : `${moment_1.default(item.createdAt).format('MMMM DD')}`
1453
+ : `${moment_1.default(item.createdAt).format('MMMM Do, YYYY')}`),
1431
1454
  displayEmoji && msgIndex === index ? (react_1.default.createElement(emoji_mart_1.Picker, { onSelect: handleOnSelect, native: true, set: "apple", emoji: "point_up", title: "Pick your emoji...", emojiSize: 24, perLine: 6, color: "#ae65c5", sheetSize: 16, showPreview: true, showSkinTones: false, notFoundEmoji: "sleuth_or_spy" })) : (''),
1432
1455
  react_1.default.createElement("div", { className: "btn-hover" },
1433
1456
  react_1.default.createElement("div", { className: "hover_btns" },
@@ -22679,6 +22702,7 @@ const Dashboard = () => {
22679
22702
  setClickedChannel(addedDirectChannel.data.createDirectChannel);
22680
22703
  }
22681
22704
  }, [addedDirectChannel.loading, addedDirectChannel.data]);
22705
+ console.log(directChannels, 'here');
22682
22706
  const handleGo = () => {
22683
22707
  if (selectedValues) {
22684
22708
  let uids = [];