@homefile/components-v2 2.49.2 → 2.49.4

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.
@@ -1,3 +1,12 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
1
10
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
11
  import { useState } from 'react';
3
12
  import { t } from 'i18next';
@@ -13,16 +22,20 @@ export const MessageChatPanel = ({ message, onBack, onClose, onReply, }) => {
13
22
  const onChange = (content) => {
14
23
  setValue(content);
15
24
  };
16
- return (_jsxs(DrawerContent, { bg: "lightBlue.1", children: [_jsx(DrawerHeader, { p: "0", children: _jsx(PanelHeader, { handleCloseButton: onClose, title: (_a = message === null || message === void 0 ? void 0 : message.from) !== null && _a !== void 0 ? _a : '', icon: Document2 }) }), _jsxs(DrawerBody, { p: "0", children: [_jsx(Box, { bg: "lightBlue.2", py: "2", px: "base", children: _jsx(BackCircleButton, { onClick: onBack }) }), _jsx(Stack, { spacing: "base", p: "base", pb: "4", children: (_b = message === null || message === void 0 ? void 0 : message.chatReplies) === null || _b === void 0 ? void 0 : _b.map((reply) => (_jsx(MessageCard, { message: Object.assign(Object.assign({}, reply), { currentUser: message.currentUser }), variant: "chat" }, reply._id))) })] }), _jsx(DrawerFooter, { p: "0", maxH: "400px", children: _jsx(WrapperWithShadow, { animation: up, fadeDelay: 0.2, children: _jsxs(Stack, { spacing: "base", children: [_jsx(Text, { children: t('inbox.createReply') }), _jsx(QuillEditor, { theme: "snow", value: value, modules: { toolbar }, onChange: onChange, placeholder: t('inbox.enterContent') }), _jsx(FooterButtons, { px: "0", button1: {
25
+ const handleReply = () => __awaiter(void 0, void 0, void 0, function* () {
26
+ var _a;
27
+ yield onReply({
28
+ id: (_a = message === null || message === void 0 ? void 0 : message._id) !== null && _a !== void 0 ? _a : '',
29
+ message: value,
30
+ });
31
+ setValue('');
32
+ });
33
+ return (_jsxs(DrawerContent, { bg: "lightBlue.1", children: [_jsx(DrawerHeader, { p: "0", children: _jsx(PanelHeader, { handleCloseButton: onClose, title: (_a = message === null || message === void 0 ? void 0 : message.from) !== null && _a !== void 0 ? _a : '', icon: Document2 }) }), _jsxs(DrawerBody, { p: "0", children: [onBack && (_jsx(Box, { bg: "lightBlue.2", py: "2", px: "base", children: _jsx(BackCircleButton, { onClick: onBack }) })), _jsx(Stack, { spacing: "base", p: "base", pb: "4", children: (_b = message === null || message === void 0 ? void 0 : message.chatReplies) === null || _b === void 0 ? void 0 : _b.map((reply) => (_jsx(MessageCard, { message: Object.assign(Object.assign({}, reply), { currentUser: message.currentUser }), variant: "chat" }, reply._id))) })] }), _jsx(DrawerFooter, { p: "0", maxH: "400px", children: _jsx(WrapperWithShadow, { animation: up, fadeDelay: 0.2, children: _jsxs(Stack, { spacing: "base", children: [_jsx(Text, { children: t('inbox.createReply') }), _jsx(QuillEditor, { theme: "snow", value: value, modules: { toolbar }, onChange: onChange, placeholder: t('inbox.enterContent') }), _jsx(FooterButtons, { px: "0", button1: {
17
34
  buttonStyle: 'secondaryFooter',
18
35
  label: t('buttons.send'),
19
36
  isDisabled: Number(value.length) === 0,
20
37
  onClick: () => {
21
- var _a;
22
- return onReply({
23
- id: (_a = message === null || message === void 0 ? void 0 : message._id) !== null && _a !== void 0 ? _a : '',
24
- message: value,
25
- });
38
+ void handleReply();
26
39
  },
27
40
  } })] }) }) })] }));
28
41
  };
@@ -5,8 +5,8 @@ interface InboxMessageReplyI {
5
5
  }
6
6
  export interface MessageChatPanelI {
7
7
  message?: InboxMessageI;
8
- onReply: (props: InboxMessageReplyI) => void;
8
+ onReply: (props: InboxMessageReplyI) => void | Promise<void>;
9
9
  onClose: () => void;
10
- onBack: () => void;
10
+ onBack?: () => void;
11
11
  }
12
12
  export {};
@@ -1,3 +1,12 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
1
10
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
11
  import { MessageChatPanel, MessagePanel, RightPanel } from '../../components';
3
12
  import { action } from '@storybook/addon-actions';
@@ -16,9 +25,12 @@ export default {
16
25
  export const MessagePanelComponent = (args) => {
17
26
  const [showMessageChat, setShowMessageChat] = useState(false);
18
27
  const [selectedMessage, setSelectedMessage] = useState(undefined);
28
+ const onReply = action('onReply');
19
29
  const handleMessageChatToggle = () => setShowMessageChat(!showMessageChat);
20
30
  return (_jsxs(Fragment, { children: [_jsx(MessagePanel, Object.assign({}, args, { onClick: (message) => {
21
31
  setSelectedMessage(message);
22
32
  handleMessageChatToggle();
23
- } })), _jsx(RightPanel, { isOpen: showMessageChat, onClose: handleMessageChatToggle, children: _jsx(MessageChatPanel, { message: selectedMessage, onReply: action('onReply'), onClose: action('onCloseChatPanel'), onBack: handleMessageChatToggle }) })] }));
33
+ } })), _jsx(RightPanel, { isOpen: showMessageChat, onClose: handleMessageChatToggle, children: _jsx(MessageChatPanel, { message: selectedMessage, onReply: (reply) => __awaiter(void 0, void 0, void 0, function* () {
34
+ onReply(reply);
35
+ }), onClose: action('onCloseChatPanel'), onBack: handleMessageChatToggle }) })] }));
24
36
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homefile/components-v2",
3
- "version": "2.49.2",
3
+ "version": "2.49.4",
4
4
  "author": "Homefile",
5
5
  "license": "UNLICENSED",
6
6
  "typings": "dist/index.d.ts",