@homefile/components-v2 2.49.4 → 2.49.6

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 (28) hide show
  1. package/dist/assets/locales/en/index.json +2 -1
  2. package/dist/components/buttons/LeftButton.js +1 -1
  3. package/dist/components/icons/Plus.d.ts +2 -2
  4. package/dist/components/inboxTile/panel/MessageCard.js +4 -5
  5. package/dist/components/inboxTile/panel/MessageChatPanel.d.ts +1 -1
  6. package/dist/components/inboxTile/panel/MessageChatPanel.js +18 -4
  7. package/dist/components/inboxTile/panel/MessagePanel.d.ts +1 -1
  8. package/dist/components/inboxTile/panel/MessagePanel.js +15 -3
  9. package/dist/components/inboxTile/panel/MessageSenderCard.d.ts +2 -0
  10. package/dist/components/inboxTile/panel/MessageSenderCard.js +28 -0
  11. package/dist/components/inboxTile/panel/MessageSenderCardAddress.d.ts +2 -0
  12. package/dist/components/inboxTile/panel/MessageSenderCardAddress.js +8 -0
  13. package/dist/components/inboxTile/panel/MessageSenderCardHeader.d.ts +1 -0
  14. package/dist/components/inboxTile/panel/MessageSenderCardHeader.js +7 -0
  15. package/dist/components/inboxTile/panel/MessageSenderCardInfo.d.ts +2 -0
  16. package/dist/components/inboxTile/panel/MessageSenderCardInfo.js +14 -0
  17. package/dist/components/inboxTile/panel/index.d.ts +4 -0
  18. package/dist/components/inboxTile/panel/index.js +4 -0
  19. package/dist/interfaces/inboxTile/MessageChatPanel.interface.d.ts +6 -4
  20. package/dist/interfaces/inboxTile/MessagePanel.interface.d.ts +4 -2
  21. package/dist/interfaces/inboxTile/MessageSenderCard.interface.d.ts +18 -0
  22. package/dist/interfaces/inboxTile/MessageSenderCard.interface.js +1 -0
  23. package/dist/interfaces/inboxTile/index.d.ts +1 -0
  24. package/dist/interfaces/inboxTile/index.js +1 -0
  25. package/dist/stories/inboxTile/MessagePanel.stories.js +29 -3
  26. package/dist/utils/Formaters.utils.d.ts +1 -0
  27. package/dist/utils/Formaters.utils.js +14 -8
  28. package/package.json +1 -1
@@ -524,7 +524,8 @@
524
524
  "forwardTo": "Simply forward images & paperwork to ",
525
525
  "forwardTo2": " or add a receipt image below.",
526
526
  "from": "From: ",
527
- "message": "Message"
527
+ "message": "Message",
528
+ "senderDetails": "Customer Details"
528
529
  },
529
530
  "launchpad": {
530
531
  "menu": {
@@ -14,5 +14,5 @@ import { Button } from '@chakra-ui/react';
14
14
  import { Plus } from '../../components';
15
15
  export const LeftButton = (_a) => {
16
16
  var { bgColor = 'green.1', onClick, height = '1.75rem', label } = _a, props = __rest(_a, ["bgColor", "onClick", "height", "label"]);
17
- return (_jsxs(Button, Object.assign({}, props, { h: height, variant: "leftRounded", bg: bgColor, onClick: onClick, px: "1rem", children: [_jsx(Plus, {}), label] })));
17
+ return (_jsxs(Button, Object.assign({}, props, { h: height, variant: "leftRounded", bg: bgColor, onClick: onClick, px: "1rem", children: [_jsx(Plus, { size: "1em" }), label] })));
18
18
  };
@@ -1,4 +1,4 @@
1
1
  export declare const Plus: ({ stroke, size }: {
2
- stroke?: string | undefined;
3
- size?: number | undefined;
2
+ stroke?: string;
3
+ size?: string | number;
4
4
  }) => import("react/jsx-runtime").JSX.Element;
@@ -1,16 +1,15 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { t } from 'i18next';
3
- import { Avatar, Box, Center, chakra, Container, Divider, Flex, Stack, Text, } from '@chakra-ui/react';
2
+ import { Avatar, Box, Center, Container, Divider, Flex, Stack, Text, } from '@chakra-ui/react';
4
3
  import { ChatBubble } from '../../../assets/images';
5
4
  import { TextBadge } from '../../../components';
6
- import { formatDateWithAt } from '../../../utils';
5
+ import { formatLongDateWithAt } from '../../../utils';
7
6
  export const MessageCard = ({ message, onClick, variant = 'inbox', }) => {
8
7
  const { currentUser, from, subject, date, isNew, chatReplies, description = '', } = message;
9
- const formattedDate = formatDateWithAt({ date });
8
+ const formattedDate = formatLongDateWithAt({ date });
10
9
  const showChatBubble = Number(chatReplies === null || chatReplies === void 0 ? void 0 : chatReplies.length) > 0;
11
10
  const isInbox = variant === 'inbox';
12
11
  const isCurrentUser = (currentUser === null || currentUser === void 0 ? void 0 : currentUser.userName) === from;
13
- return (_jsxs(Flex, { gap: "base", children: [!isCurrentUser && !isInbox && (_jsx(Avatar, { size: "sm", name: from, bg: "blue.4", fontWeight: "bold", color: "neutral.white" })), _jsx(Container, { as: isInbox ? 'button' : 'div', bg: isCurrentUser ? 'yellow.6' : 'neutral.white', transition: "background-color 0.3s", textAlign: "left", _hover: isInbox ? { bg: 'lightGreen.1' } : {}, onClick: () => onClick === null || onClick === void 0 ? void 0 : onClick(message), children: _jsxs(Box, { children: [!isCurrentUser && (_jsxs(Flex, { justify: "space-between", align: "center", py: "1", pr: "base", pl: isNew ? '' : 'base', children: [_jsxs(Flex, { gap: "base", align: "center", position: "relative", left: isNew ? '-13px' : '', children: [isNew && isInbox && (_jsx(TextBadge, { text: "New", showAnimation: false, bgColor: "violet.1" })), _jsxs(Text, { variant: "home", color: "gray.1", children: [t('inbox.from'), _jsx(chakra.span, { color: "gray.4", children: from })] })] }), _jsx(Text, { variant: "home", fontSize: "xs", children: formattedDate })] })), isInbox && _jsx(Divider, {}), _jsxs(Stack, { spacing: "base", p: "base", children: [_jsxs(Flex, { align: "center", justify: "space-between", children: [_jsx(Text, { variant: "home", fontWeight: "bold", children: subject }), showChatBubble && isInbox && (_jsx(Center, { backgroundImage: `url(${ChatBubble})`, backgroundRepeat: "no-repeat", backgroundSize: "contain", backgroundPosition: "bottom", w: "20px", h: "24px", children: _jsx(Text, { fontSize: "10px", color: "blue.2", fontWeight: "bold", children: chatReplies === null || chatReplies === void 0 ? void 0 : chatReplies.length }) }))] }), isInbox && (_jsx(Text, { variant: "home", noOfLines: 3, textOverflow: "ellipsis", dangerouslySetInnerHTML: {
12
+ return (_jsxs(Flex, { gap: "base", children: [!isCurrentUser && !isInbox && (_jsx(Avatar, { size: "sm", name: from, bg: "blue.4", fontWeight: "bold", color: "neutral.white" })), _jsx(Container, { as: isInbox ? 'button' : 'div', bg: isCurrentUser ? 'yellow.6' : 'neutral.white', transition: "background-color 0.3s", textAlign: "left", _hover: isInbox ? { bg: 'lightGreen.1' } : {}, onClick: () => onClick === null || onClick === void 0 ? void 0 : onClick(message), children: _jsxs(Box, { children: [!isCurrentUser && (_jsx(Flex, { justify: "space-between", align: "center", py: "1", pr: "base", pl: isNew ? '' : 'base', children: _jsxs(Flex, { gap: "base", align: "center", position: "relative", left: isNew ? '-13px' : '', children: [isNew && isInbox && (_jsx(TextBadge, { text: "New", showAnimation: false, bgColor: "violet.1" })), _jsx(Text, { variant: "home", fontSize: "xs", children: formattedDate })] }) })), isInbox && _jsx(Divider, {}), _jsxs(Stack, { spacing: "base", p: "base", children: [_jsxs(Flex, { align: "center", justify: "space-between", children: [_jsx(Text, { variant: "home", fontWeight: "bold", children: subject }), showChatBubble && isInbox && (_jsx(Center, { backgroundImage: `url(${ChatBubble})`, backgroundRepeat: "no-repeat", backgroundSize: "contain", backgroundPosition: "bottom", w: "20px", h: "24px", children: _jsx(Text, { fontSize: "10px", color: "blue.2", fontWeight: "bold", children: chatReplies === null || chatReplies === void 0 ? void 0 : chatReplies.length }) }))] }), isInbox && (_jsx(Text, { variant: "home", noOfLines: 3, textOverflow: "ellipsis", dangerouslySetInnerHTML: {
14
13
  __html: description,
15
14
  } })), !isInbox && (_jsx(Text, { variant: "home", dangerouslySetInnerHTML: {
16
15
  __html: description,
@@ -1,4 +1,4 @@
1
1
  import { MessageChatPanelI } from '../../../interfaces';
2
2
  import 'react-quill-new/dist/quill.snow.css';
3
3
  import '../../../styles';
4
- export declare const MessageChatPanel: ({ message, onBack, onClose, onReply, }: MessageChatPanelI) => import("react/jsx-runtime").JSX.Element;
4
+ export declare const MessageChatPanel: ({ actionLabel, address, city, email, firstName, icon, lastName, message, onBack, onAction, onClose, onReply, phone, showAvatar, showHeader, state, title, zip, }: MessageChatPanelI) => import("react/jsx-runtime").JSX.Element;
@@ -12,13 +12,27 @@ import { useState } from 'react';
12
12
  import { t } from 'i18next';
13
13
  import { Box, DrawerBody, DrawerContent, DrawerFooter, DrawerHeader, Stack, Text, } from '@chakra-ui/react';
14
14
  import QuillEditor from 'react-quill-new';
15
- import { Document2 } from '../../../assets/images';
16
- import { BackCircleButton, FooterButtons, MessageCard, PanelHeader, up, WrapperWithShadow, } from '../../../components';
15
+ import { Inbox } from '../../../assets/images';
16
+ import { BackCircleButton, FooterButtons, MessageCard, MessageSenderCard, PanelHeader, up, WrapperWithShadow, } from '../../../components';
17
17
  import 'react-quill-new/dist/quill.snow.css';
18
18
  import '../../../styles';
19
- export const MessageChatPanel = ({ message, onBack, onClose, onReply, }) => {
19
+ export const MessageChatPanel = ({ actionLabel, address, city, email, firstName, icon = Inbox, lastName, message, onBack, onAction, onClose, onReply, phone, showAvatar, showHeader, state, title, zip, }) => {
20
20
  var _a, _b;
21
21
  const [value, setValue] = useState('');
22
+ const senderCardData = {
23
+ actionLabel,
24
+ address,
25
+ city,
26
+ email,
27
+ firstName,
28
+ lastName,
29
+ onAction,
30
+ phone,
31
+ showAvatar,
32
+ showHeader,
33
+ state,
34
+ zip,
35
+ };
22
36
  const onChange = (content) => {
23
37
  setValue(content);
24
38
  };
@@ -30,7 +44,7 @@ export const MessageChatPanel = ({ message, onBack, onClose, onReply, }) => {
30
44
  });
31
45
  setValue('');
32
46
  });
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: {
47
+ return (_jsxs(DrawerContent, { bg: "lightBlue.1", children: [_jsx(DrawerHeader, { p: "0", children: _jsx(PanelHeader, { handleCloseButton: onClose, title: (_a = title !== null && title !== void 0 ? title : message === null || message === void 0 ? void 0 : message.from) !== null && _a !== void 0 ? _a : '', icon: icon }) }), _jsx(DrawerBody, { p: "0", children: _jsxs(Stack, { spacing: "base", children: [onBack && (_jsx(Box, { bg: "lightBlue.2", py: "2", px: "base", children: _jsx(BackCircleButton, { onClick: onBack }) })), _jsx(MessageSenderCard, Object.assign({}, senderCardData)), _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: {
34
48
  buttonStyle: 'secondaryFooter',
35
49
  label: t('buttons.send'),
36
50
  isDisabled: Number(value.length) === 0,
@@ -1,2 +1,2 @@
1
1
  import { MessagePanelI } from '../../../interfaces';
2
- export declare const MessagePanel: ({ messages, onClick, onClose }: MessagePanelI) => import("react/jsx-runtime").JSX.Element;
2
+ export declare const MessagePanel: ({ icon, messages, onClick, onClose, title, ...senderCardData }: MessagePanelI) => import("react/jsx-runtime").JSX.Element;
@@ -1,12 +1,24 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
1
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
13
  import { t } from 'i18next';
3
14
  import { Box, DrawerBody, DrawerContent, DrawerHeader, Stack, } from '@chakra-ui/react';
4
15
  import { Inbox } from '../../../assets/images';
5
- import { BaseCounter, MessageCard, PanelHeader, SelectInput, } from '../../../components';
16
+ import { BaseCounter, MessageCard, MessageSenderCard, PanelHeader, SelectInput, } from '../../../components';
6
17
  import { useMessagePanel } from '../../../hooks';
7
18
  import { pluralize } from '../../../utils';
8
- export const MessagePanel = ({ messages, onClick, onClose }) => {
19
+ export const MessagePanel = (_a) => {
20
+ var { icon = Inbox, messages, onClick, onClose, title = t('inbox.message') } = _a, senderCardData = __rest(_a, ["icon", "messages", "onClick", "onClose", "title"]);
9
21
  const { currentSort, sortedMessages, handleSelectItem, items } = useMessagePanel(messages);
10
22
  const baseCounterText = `${t('counter.showing')} ${sortedMessages.length} ${t('counter.of')} ${messages.length} ${pluralize(sortedMessages.length, t('inbox.message').toLowerCase())} `;
11
- return (_jsxs(DrawerContent, { bg: "lightBlue.1", children: [_jsx(DrawerHeader, { p: "0", children: _jsx(PanelHeader, { handleCloseButton: onClose, title: t('inbox.message'), icon: Inbox }) }), _jsx(DrawerBody, { p: "0", children: _jsxs(Stack, { spacing: "base", pb: "4", children: [_jsx(Box, { p: "base", bg: "lightBlue.2", children: _jsx(SelectInput, { handleClick: handleSelectItem, initialValue: currentSort, items: items }) }), _jsx(Box, { px: "base", children: _jsx(BaseCounter, { text: baseCounterText }) }), _jsx(Stack, { spacing: "1", pl: "26px", pr: "base", children: sortedMessages.map((message) => (_jsx(MessageCard, { message: message, onClick: onClick }, message._id))) })] }) })] }));
23
+ return (_jsxs(DrawerContent, { bg: "lightBlue.1", children: [_jsx(DrawerHeader, { p: "0", children: _jsx(PanelHeader, { handleCloseButton: onClose, title: title, icon: icon }) }), _jsx(DrawerBody, { p: "0", children: _jsxs(Stack, { spacing: "base", children: [_jsxs(Box, { children: [_jsx(MessageSenderCard, Object.assign({}, senderCardData)), _jsx(Box, { p: "base", bg: "lightBlue.2", children: _jsx(SelectInput, { handleClick: handleSelectItem, initialValue: currentSort, items: items }) })] }), _jsx(Box, { px: "base", children: _jsx(BaseCounter, { text: baseCounterText }) }), _jsx(Stack, { spacing: "1", pl: "26px", pr: "base", children: sortedMessages.map((message) => (_jsx(MessageCard, { message: message, onClick: onClick }, message._id))) })] }) })] }));
12
24
  };
@@ -0,0 +1,2 @@
1
+ import { MessageSenderCardI } from '../../../interfaces';
2
+ export declare const MessageSenderCard: ({ address, city, email, firstName, lastName, phone, showAvatar, showHeader, state, zip, onAction, actionLabel, }: MessageSenderCardI) => import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,28 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { Box, Flex, Stack, Text } from '@chakra-ui/react';
3
+ import { MessageSenderCardHeader, MessageSenderCardInfo, LeftButton, } from '../../../components';
4
+ export const MessageSenderCard = ({ address, city, email, firstName, lastName, phone, showAvatar = true, showHeader = true, state, zip, onAction, actionLabel = '', }) => {
5
+ const hasData = firstName || lastName || email || phone || address || city || state || zip;
6
+ if (!hasData) {
7
+ return null;
8
+ }
9
+ return (_jsxs(Box, { position: "relative", w: "100%", children: [_jsx(Box, { bg: "lightGreen.1", p: "base", children: _jsxs(Stack, { spacing: "2", children: [showHeader && _jsx(MessageSenderCardHeader, {}), _jsx(CardBody, { address,
10
+ city,
11
+ email,
12
+ firstName,
13
+ lastName,
14
+ phone,
15
+ showAvatar,
16
+ state,
17
+ zip })] }) }), onAction && (_jsx(Box, { position: "absolute", right: "0", top: "2", children: _jsx(LeftButton, { bgColor: "blue.2", onClick: onAction, label: actionLabel, fontSize: "sm", fontWeight: "medium", gap: "1" }) }))] }));
18
+ };
19
+ const CardBody = ({ address, city, email, firstName, lastName, phone, showAvatar, state, zip, }) => {
20
+ const hasContact = Boolean(phone || email);
21
+ return (_jsxs(Flex, { align: "stretch", gap: "8", children: [_jsx(MessageSenderCardInfo, { address,
22
+ city,
23
+ firstName,
24
+ lastName,
25
+ state,
26
+ showAvatar,
27
+ zip }), hasContact && (_jsxs(_Fragment, { children: [_jsx(Box, { bg: "lightBlue.2", w: "1px" }), _jsxs(Stack, { spacing: "0", justify: "end", children: [phone && (_jsx(Text, { fontSize: "12px", fontFamily: "secondary", lineHeight: "15px", children: phone })), email && (_jsx(Text, { variant: "email", fontSize: "12px", fontFamily: "secondary", lineHeight: "15px", children: email }))] })] }))] }));
28
+ };
@@ -0,0 +1,2 @@
1
+ import { SenderDetailsAddressI } from '../../../interfaces';
2
+ export declare const MessageSenderCardAddress: ({ address, city, state, zip, }: SenderDetailsAddressI) => import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Stack, Text } from '@chakra-ui/react';
3
+ export const MessageSenderCardAddress = ({ address, city, state, zip, }) => {
4
+ if (!address && !city && !state && !zip) {
5
+ return null;
6
+ }
7
+ return (_jsxs(Stack, { spacing: "0", minH: "full", children: [address && (_jsx(Text, { variant: "address", lineHeight: "13px", children: address })), (city || state || zip) && (_jsxs(Text, { variant: "address", lineHeight: "13px", children: [city, city && state ? ', ' : '', state, " ", zip] }))] }));
8
+ };
@@ -0,0 +1 @@
1
+ export declare const MessageSenderCardHeader: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { t } from 'i18next';
3
+ import { Flex, Image, Text } from '@chakra-ui/react';
4
+ import { BillingAddress } from '../../../assets/images';
5
+ export const MessageSenderCardHeader = () => {
6
+ return (_jsxs(Flex, { align: "center", gap: "2", children: [_jsx(Image, { src: BillingAddress, alt: "Sender Details", h: "18px", w: "auto" }), _jsx(Text, { fontSize: "10px", textTransform: "uppercase", lineHeight: "1", children: t('inbox.senderDetails') })] }));
7
+ };
@@ -0,0 +1,2 @@
1
+ import { MessageSenderCardI } from '../../../interfaces';
2
+ export declare const MessageSenderCardInfo: ({ address, city, firstName, lastName, state, showAvatar, zip, }: MessageSenderCardI) => import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Avatar, Flex, Box, Text } from '@chakra-ui/react';
3
+ import { MessageSenderCardAddress } from '../../../components';
4
+ export const MessageSenderCardInfo = ({ address, city, firstName, lastName, state, showAvatar = true, zip, }) => {
5
+ const name = `${firstName} ${lastName}`.trim();
6
+ const hasAddress = Boolean(address || city || state || zip);
7
+ if (!name && !hasAddress) {
8
+ return null;
9
+ }
10
+ return (_jsxs(Flex, { gap: "base", align: "center", children: [showAvatar && name && (_jsx(Avatar, { boxSize: "50px", borderRadius: "none", bg: "blue.4", fontWeight: "bold", color: "neutral.white", name: name })), _jsxs(Box, { children: [name && (_jsx(Text, { fontWeight: "medium", fontSize: "lg", lineHeight: "1.2", children: name })), _jsx(MessageSenderCardAddress, { address,
11
+ city,
12
+ state,
13
+ zip })] })] }));
14
+ };
@@ -1,3 +1,7 @@
1
1
  export * from './MessageCard';
2
2
  export * from './MessageChatPanel';
3
3
  export * from './MessagePanel';
4
+ export * from './MessageSenderCard';
5
+ export * from './MessageSenderCardHeader';
6
+ export * from './MessageSenderCardInfo';
7
+ export * from './MessageSenderCardAddress';
@@ -1,3 +1,7 @@
1
1
  export * from './MessageCard';
2
2
  export * from './MessageChatPanel';
3
3
  export * from './MessagePanel';
4
+ export * from './MessageSenderCard';
5
+ export * from './MessageSenderCardHeader';
6
+ export * from './MessageSenderCardInfo';
7
+ export * from './MessageSenderCardAddress';
@@ -1,12 +1,14 @@
1
- import { InboxMessageI } from '../../interfaces';
1
+ import { InboxMessageI, MessageSenderCardI } from '../../interfaces';
2
2
  interface InboxMessageReplyI {
3
3
  id: string;
4
4
  message: string;
5
5
  }
6
- export interface MessageChatPanelI {
6
+ export interface MessageChatPanelI extends Partial<MessageSenderCardI> {
7
+ icon?: string;
7
8
  message?: InboxMessageI;
8
- onReply: (props: InboxMessageReplyI) => void | Promise<void>;
9
- onClose: () => void;
10
9
  onBack?: () => void;
10
+ onClose: () => void;
11
+ onReply: (props: InboxMessageReplyI) => void | Promise<void>;
12
+ title?: string;
11
13
  }
12
14
  export {};
@@ -1,6 +1,8 @@
1
- import { InboxMessageI } from '../../interfaces';
2
- export interface MessagePanelI {
1
+ import { InboxMessageI, MessageSenderCardI } from '../../interfaces';
2
+ export interface MessagePanelI extends Partial<MessageSenderCardI> {
3
+ icon?: string;
3
4
  messages: InboxMessageI[];
5
+ title?: string;
4
6
  onClick: (message: InboxMessageI) => void;
5
7
  onClose: () => void;
6
8
  }
@@ -0,0 +1,18 @@
1
+ export interface SenderDetailsInfoI {
2
+ email?: string;
3
+ firstName?: string;
4
+ lastName?: string;
5
+ phone?: string;
6
+ showAvatar?: boolean;
7
+ }
8
+ export interface SenderDetailsAddressI {
9
+ address?: string;
10
+ city?: string;
11
+ state?: string;
12
+ zip?: string;
13
+ }
14
+ export interface MessageSenderCardI extends SenderDetailsInfoI, SenderDetailsAddressI {
15
+ onAction?: () => void;
16
+ actionLabel?: string;
17
+ showHeader?: boolean;
18
+ }
@@ -3,3 +3,4 @@ export * from './InboxTile.interface';
3
3
  export * from './MessageCard.interface';
4
4
  export * from './MessageChatPanel.interface';
5
5
  export * from './MessagePanel.interface';
6
+ export * from './MessageSenderCard.interface';
@@ -3,3 +3,4 @@ export * from './InboxTile.interface';
3
3
  export * from './MessageCard.interface';
4
4
  export * from './MessageChatPanel.interface';
5
5
  export * from './MessagePanel.interface';
6
+ export * from './MessageSenderCard.interface';
@@ -12,25 +12,51 @@ import { MessageChatPanel, MessagePanel, RightPanel } from '../../components';
12
12
  import { action } from '@storybook/addon-actions';
13
13
  import { messagesMock } from '../../mocks';
14
14
  import { Fragment, useState } from 'react';
15
+ import { Manager } from '../../assets/images';
15
16
  export default {
16
17
  title: 'Components/Inbox',
17
18
  component: MessagePanel,
18
19
  args: {
19
20
  messages: messagesMock,
21
+ title: 'Service Ticket : 422325623',
22
+ icon: Manager,
23
+ firstName: 'Michael',
24
+ lastName: 'Smith',
25
+ email: 'email.address@gmail.com',
26
+ phone: '555-555-1212',
27
+ address: '1134 South First Avenue',
28
+ city: 'Austin',
29
+ state: 'TX',
30
+ zip: '78732',
31
+ showAvatar: true,
32
+ showHeader: true,
20
33
  },
21
34
  decorators: [
22
- (Story) => (_jsx(RightPanel, { isOpen: true, onClose: action('onClose'), children: _jsx(Story, {}) })),
35
+ (Story) => (_jsx(RightPanel, { isOpen: true, onClose: action('onClose'), blockScrollOnMount: false, children: _jsx(Story, {}) })),
23
36
  ],
24
37
  };
25
38
  export const MessagePanelComponent = (args) => {
26
39
  const [showMessageChat, setShowMessageChat] = useState(false);
27
40
  const [selectedMessage, setSelectedMessage] = useState(undefined);
28
41
  const onReply = action('onReply');
42
+ const senderCardData = {
43
+ actionLabel: args.actionLabel,
44
+ address: args.address,
45
+ city: args.city,
46
+ email: args.email,
47
+ firstName: args.firstName,
48
+ lastName: args.lastName,
49
+ phone: args.phone,
50
+ showAvatar: args.showAvatar,
51
+ showHeader: args.showHeader,
52
+ state: args.state,
53
+ zip: args.zip,
54
+ };
29
55
  const handleMessageChatToggle = () => setShowMessageChat(!showMessageChat);
30
56
  return (_jsxs(Fragment, { children: [_jsx(MessagePanel, Object.assign({}, args, { onClick: (message) => {
31
57
  setSelectedMessage(message);
32
58
  handleMessageChatToggle();
33
- } })), _jsx(RightPanel, { isOpen: showMessageChat, onClose: handleMessageChatToggle, children: _jsx(MessageChatPanel, { message: selectedMessage, onReply: (reply) => __awaiter(void 0, void 0, void 0, function* () {
59
+ }, onAction: action('onAction'), actionLabel: "NOTE" })), _jsx(RightPanel, { isOpen: showMessageChat, onClose: handleMessageChatToggle, blockScrollOnMount: false, children: _jsx(MessageChatPanel, Object.assign({}, senderCardData, { actionLabel: "NOTE", icon: args.icon, message: selectedMessage, onAction: action('onActionChat'), onReply: (reply) => __awaiter(void 0, void 0, void 0, function* () {
34
60
  onReply(reply);
35
- }), onClose: action('onCloseChatPanel'), onBack: handleMessageChatToggle }) })] }));
61
+ }), onClose: action('onCloseChatPanel'), onBack: handleMessageChatToggle, title: args.title })) })] }));
36
62
  };
@@ -5,6 +5,7 @@ interface FormatDateI {
5
5
  }
6
6
  export declare const formatDate: ({ date, locale }: FormatDateI) => string;
7
7
  export declare const formatDateWithAt: ({ date, locale, }: FormatDateI) => string;
8
+ export declare const formatLongDateWithAt: ({ date }: FormatDateI) => string;
8
9
  export declare const shortFormatDate: ({ date, locale, }: FormatDateI) => string;
9
10
  export declare const monthAndYearFormatDate: ({ date, locale, }: FormatDateI) => string;
10
11
  export declare const dayAndMonthFormatDate: ({ date, locale, }: FormatDateI) => string;
@@ -35,6 +35,14 @@ export const formatDateWithAt = ({ date, locale = 'en-US', }) => {
35
35
  .replaceAll('/', '.');
36
36
  return dateFormat + ' @ ' + timeFormat;
37
37
  };
38
+ export const formatLongDateWithAt = ({ date }) => {
39
+ if (!date)
40
+ return '';
41
+ const parsedDate = new Date(date);
42
+ const dateFormat = format(parsedDate, 'EEEE MMM d, yyyy');
43
+ const timeFormat = format(parsedDate, 'h:mm a');
44
+ return `${dateFormat} @${timeFormat}`;
45
+ };
38
46
  export const shortFormatDate = ({ date, locale = 'en-US', }) => {
39
47
  if (!date)
40
48
  return '';
@@ -104,21 +112,19 @@ export const joinDayMonthYear = (value) => {
104
112
  });
105
113
  };
106
114
  export const formatISODate = (value) => {
107
- const displayValue = (isValid(parseISO(value)) || isValid(new Date(value)))
115
+ const displayValue = isValid(parseISO(value)) || isValid(new Date(value))
108
116
  ? format(value, 'MM/dd/yyyy')
109
117
  : '';
110
118
  return displayValue;
111
119
  };
112
120
  export const toQuantity = (q) => {
113
- if (typeof q === "number")
114
- return Number.isFinite(q) ? q : "";
115
- const cleaned = (q !== null && q !== void 0 ? q : "")
116
- .toString()
117
- .replace(/\D/g, ""); // remove all non-digits
121
+ if (typeof q === 'number')
122
+ return Number.isFinite(q) ? q : '';
123
+ const cleaned = (q !== null && q !== void 0 ? q : '').toString().replace(/\D/g, ''); // remove all non-digits
118
124
  if (!cleaned)
119
- return ""; // no digits found
125
+ return ''; // no digits found
120
126
  const n = Number(cleaned);
121
- return Number.isInteger(n) && n > 0 ? n : "";
127
+ return Number.isInteger(n) && n > 0 ? n : '';
122
128
  };
123
129
  export const formatCurrency = ({ country = 'en-US', currrency = 'USD', value, }) => {
124
130
  if (!value) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homefile/components-v2",
3
- "version": "2.49.4",
3
+ "version": "2.49.6",
4
4
  "author": "Homefile",
5
5
  "license": "UNLICENSED",
6
6
  "typings": "dist/index.d.ts",