@homefile/components-v2 2.24.17 → 2.24.19
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/dist/components/receipts/AssignableReceiptCard.js +2 -2
- package/dist/components/receipts/autofiler/AutofilerBubble.js +2 -2
- package/dist/components/receipts/displayReceipts/GridReceipt.js +2 -2
- package/dist/components/receipts/displayReceipts/ListReceipt.js +2 -2
- package/dist/components/receipts/receipt/ReceiptDetails.js +2 -2
- package/dist/components/rooms/GroupCard.js +2 -2
- package/dist/helpers/receipts/Receipts.helper.d.ts +1 -0
- package/dist/helpers/receipts/Receipts.helper.js +4 -0
- package/dist/interfaces/notifications/NotificationsPanel.interface.d.ts +3 -1
- package/dist/mocks/notifications/notifications.mock.js +8 -0
- package/package.json +1 -1
- package/src/components/receipts/AssignableReceiptCard.tsx +2 -2
- package/src/components/receipts/autofiler/AutofilerBubble.tsx +2 -2
- package/src/components/receipts/displayReceipts/GridReceipt.tsx +2 -2
- package/src/components/receipts/displayReceipts/ListReceipt.tsx +2 -2
- package/src/components/receipts/receipt/ReceiptDetails.tsx +2 -2
- package/src/components/rooms/GroupCard.tsx +2 -2
- package/src/helpers/receipts/Receipts.helper.ts +4 -0
- package/src/interfaces/notifications/NotificationsPanel.interface.ts +3 -1
- package/src/mocks/notifications/notifications.mock.ts +8 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { t } from 'i18next';
|
|
3
3
|
import { Checkbox, Flex, Stack, Image, Text } from '@chakra-ui/react';
|
|
4
|
-
import {
|
|
4
|
+
import { getReceiptOrigin } from '../../helpers';
|
|
5
5
|
import { formatCurrency, formatDateWithAt } from '../../utils';
|
|
6
6
|
export const AssignableReceiptCard = ({ isChecked, itemQuantity = 1, onChange, purchaseDate = new Date(), origin = '', total = '0', }) => {
|
|
7
7
|
const date = formatDateWithAt({ date: purchaseDate });
|
|
@@ -9,5 +9,5 @@ export const AssignableReceiptCard = ({ isChecked, itemQuantity = 1, onChange, p
|
|
|
9
9
|
const totalItems = itemQuantity > 1
|
|
10
10
|
? `${itemQuantity} ${t('receipts.items')}`
|
|
11
11
|
: `${itemQuantity} ${t('receipts.item')}`;
|
|
12
|
-
return (_jsxs(Flex, { bg: "lightBlue.2", gap: "4", borderTop: "1px solid", borderColor: "lightBlue.2", children: [_jsx(Checkbox, { isChecked: isChecked, onChange: onChange }), _jsx(Stack, { w: "100%", p: "base", bg: isChecked ? 'lightGreen.1' : 'neutral.white', spacing: "1", children: _jsxs(Flex, { align: "center", gap: "base", children: [_jsx(Image, { src:
|
|
12
|
+
return (_jsxs(Flex, { bg: "lightBlue.2", gap: "4", borderTop: "1px solid", borderColor: "lightBlue.2", children: [_jsx(Checkbox, { isChecked: isChecked, onChange: onChange }), _jsx(Stack, { w: "100%", p: "base", bg: isChecked ? 'lightGreen.1' : 'neutral.white', spacing: "1", children: _jsxs(Flex, { align: "center", gap: "base", children: [_jsx(Image, { src: getReceiptOrigin(origin), w: "auto", h: ["40px", "69px"], fit: "contain" }), _jsxs(Stack, { w: "100%", spacing: "1", children: [_jsx(Text, { fontSize: "xxs", children: date }), _jsx(Text, { textTransform: "capitalize", children: `${origin} ${t('receipts.receipt')}` }), _jsxs(Flex, { align: "baseline", justify: "flex-end", gap: "4", children: [_jsx(Text, { fontSize: "xs", fontFamily: "secondary", textTransform: "uppercase", children: totalItems }), _jsx(Text, { children: totalFormatted })] })] })] }) })] }));
|
|
13
13
|
};
|
|
@@ -2,8 +2,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { t } from 'i18next';
|
|
3
3
|
import { Stack, Box, Flex, Text, Image } from '@chakra-ui/react';
|
|
4
4
|
import { BubbleText } from '../..';
|
|
5
|
-
import {
|
|
5
|
+
import { getReceiptOrigin } from '../../../helpers';
|
|
6
6
|
export const AutofilerBubble = () => {
|
|
7
7
|
const retails = ['homeDepot', 'lowes', 'walmart'];
|
|
8
|
-
return (_jsxs(Stack, { spacing: "4", pb: "4", children: [_jsx(BubbleText, { title: t('tour.steps.autofilerSummary.title'), description: t('tour.steps.autofilerSummary.description') }), _jsx(Box, { py: "2", px: "base", bg: "violet.1", borderRadius: "lg", children: _jsx(Text, { fontSize: "sm", fontFamily: "secondary", color: "neutral.white", lineHeight: "16px", children: t('tour.steps.autofilerSummary.alert') }) }), _jsx(Text, { fontFamily: "secondary", fontWeight: "semibold", children: t('tour.steps.autofilerSummary.currentAdded') }), _jsx(Flex, { gap: "base", children: retails.map((retail) => (_jsx(Image, { src:
|
|
8
|
+
return (_jsxs(Stack, { spacing: "4", pb: "4", children: [_jsx(BubbleText, { title: t('tour.steps.autofilerSummary.title'), description: t('tour.steps.autofilerSummary.description') }), _jsx(Box, { py: "2", px: "base", bg: "violet.1", borderRadius: "lg", children: _jsx(Text, { fontSize: "sm", fontFamily: "secondary", color: "neutral.white", lineHeight: "16px", children: t('tour.steps.autofilerSummary.alert') }) }), _jsx(Text, { fontFamily: "secondary", fontWeight: "semibold", children: t('tour.steps.autofilerSummary.currentAdded') }), _jsx(Flex, { gap: "base", children: retails.map((retail) => (_jsx(Image, { src: getReceiptOrigin(retail), w: "auto", h: "70px", fit: "contain" }, retail))) })] }));
|
|
9
9
|
};
|
|
@@ -3,10 +3,10 @@ import { t } from 'i18next';
|
|
|
3
3
|
import { ButtonGroup, Box, Stack, Flex, Img, Text } from '@chakra-ui/react';
|
|
4
4
|
import { ReceiptBg } from '../../../assets/images';
|
|
5
5
|
import { IconMenu, MoreHorizontal, TextBadge } from '../..';
|
|
6
|
-
import {
|
|
6
|
+
import { getReceiptOrigin } from '../../../helpers';
|
|
7
7
|
import { formatDateTime } from '../../../utils';
|
|
8
8
|
export const GridReceipt = ({ assignStatus = 'unfiled', _id, itemQuantity, menuItems, onClick, purchaseDate, origin = '', total, name }) => {
|
|
9
|
-
const storeImage =
|
|
9
|
+
const storeImage = getReceiptOrigin(origin);
|
|
10
10
|
const handleClick = () => onClick(_id);
|
|
11
11
|
const { formattedDate: date, formattedTime: time } = formatDateTime({
|
|
12
12
|
date: purchaseDate,
|
|
@@ -2,10 +2,10 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { t } from 'i18next';
|
|
3
3
|
import { Box, Flex, Img, Stack, Text } from '@chakra-ui/react';
|
|
4
4
|
import { IconMenu, MoreHorizontal } from '../..';
|
|
5
|
-
import {
|
|
5
|
+
import { getReceiptOrigin } from '../../../helpers';
|
|
6
6
|
import { formatDateTime } from '../../../utils';
|
|
7
7
|
export const ListReceipt = ({ menuItems, onClick, _id, total, store, itemQuantity, purchaseDate, origin = '', name }) => {
|
|
8
|
-
const storeImage =
|
|
8
|
+
const storeImage = getReceiptOrigin(origin);
|
|
9
9
|
const handleClick = () => onClick(_id);
|
|
10
10
|
const { formattedDate: date, formattedTime: time } = formatDateTime({
|
|
11
11
|
date: purchaseDate,
|
|
@@ -3,9 +3,9 @@ import { t } from 'i18next';
|
|
|
3
3
|
import { Box, Divider, Flex, IconButton, Image, Text } from '@chakra-ui/react';
|
|
4
4
|
import { formatDate } from '../../../utils';
|
|
5
5
|
import { DetailsColumn, Edit } from '../..';
|
|
6
|
-
import {
|
|
6
|
+
import { getReceiptOrigin } from '../../../helpers';
|
|
7
7
|
export const ReceiptDetails = ({ name, cashier = '', itemQuantity, paymentMethod, purchaseDate, tax, store, origin = "", storePhone = '', total, onEdit, }) => {
|
|
8
|
-
const storeImage =
|
|
8
|
+
const storeImage = getReceiptOrigin(origin);
|
|
9
9
|
const leftLabels = t('receipts.columnLeft').split(',');
|
|
10
10
|
const rightLabels = t('receipts.columnRight').split(',');
|
|
11
11
|
const leftColumn = [
|
|
@@ -15,7 +15,7 @@ import { Box, Flex, Wrap } from '@chakra-ui/react';
|
|
|
15
15
|
import { ItemCard, GroupCardHeader, LeftButtonAnimated, AddItemCard, SearchInput, TileTooltip, } from '..';
|
|
16
16
|
import { handleMapMedia } from '../../utils';
|
|
17
17
|
import { useGroupCard } from '../../hooks';
|
|
18
|
-
import {
|
|
18
|
+
import { getReceiptOrigin } from '../../helpers';
|
|
19
19
|
const storageUrl = import.meta.env.VITE_STORAGE_URL;
|
|
20
20
|
export const GroupCard = (_a) => {
|
|
21
21
|
var { items, menuItems, onAddItem, onAddImage, onClickDelete, onClickDetails, title, totalAmount, disabled, itemsDisabled } = _a, props = __rest(_a, ["items", "menuItems", "onAddItem", "onAddImage", "onClickDelete", "onClickDetails", "title", "totalAmount", "disabled", "itemsDisabled"]);
|
|
@@ -36,7 +36,7 @@ export const GroupCard = (_a) => {
|
|
|
36
36
|
const hasImage = images.length > 0;
|
|
37
37
|
const imageUrl = `${storageUrl}/${(_b = images[0]) === null || _b === void 0 ? void 0 : _b.bucketName}/${(_c = images[0]) === null || _c === void 0 ? void 0 : _c.fileName}.${(_d = images[0]) === null || _d === void 0 ? void 0 : _d.extension}`;
|
|
38
38
|
const storeImage = (metadata === null || metadata === void 0 ? void 0 : metadata.origin)
|
|
39
|
-
?
|
|
39
|
+
? getReceiptOrigin(metadata === null || metadata === void 0 ? void 0 : metadata.origin)
|
|
40
40
|
: '';
|
|
41
41
|
const handleImage = (files) => {
|
|
42
42
|
if (files) {
|
|
@@ -8,6 +8,10 @@ export const receiptOrigins = {
|
|
|
8
8
|
Walmart: Walmart,
|
|
9
9
|
"": DefaultReceipt
|
|
10
10
|
};
|
|
11
|
+
export const getReceiptOrigin = (key) => {
|
|
12
|
+
var _a;
|
|
13
|
+
return (_a = receiptOrigins[key]) !== null && _a !== void 0 ? _a : DefaultReceipt;
|
|
14
|
+
};
|
|
11
15
|
export const receipts = [
|
|
12
16
|
{
|
|
13
17
|
purchaseDate: new Date(),
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
type NotificationType = 'simple';
|
|
1
|
+
type NotificationType = 'simple' | 'service';
|
|
2
2
|
type NotificationStatus = 'added' | 'removed' | 'updated' | 'shared';
|
|
3
3
|
export interface NotificationCardI {
|
|
4
4
|
active: boolean;
|
|
5
5
|
createdAt: Date;
|
|
6
|
+
docId: string;
|
|
6
7
|
_id: string;
|
|
7
8
|
label: string;
|
|
8
9
|
message: string;
|
|
9
10
|
status: NotificationStatus;
|
|
10
11
|
type?: NotificationType;
|
|
12
|
+
user: string;
|
|
11
13
|
}
|
|
12
14
|
export interface NotificationsPanelI {
|
|
13
15
|
notifications: NotificationCardI[];
|
|
@@ -2,11 +2,13 @@ import { faker } from '@faker-js/faker';
|
|
|
2
2
|
export const notificationsMock = [
|
|
3
3
|
{
|
|
4
4
|
active: true,
|
|
5
|
+
docId: "",
|
|
5
6
|
_id: '1',
|
|
6
7
|
createdAt: new Date(),
|
|
7
8
|
message: faker.lorem.sentence(),
|
|
8
9
|
status: 'added',
|
|
9
10
|
label: 'contact added',
|
|
11
|
+
user: "123"
|
|
10
12
|
},
|
|
11
13
|
{
|
|
12
14
|
active: true,
|
|
@@ -15,6 +17,8 @@ export const notificationsMock = [
|
|
|
15
17
|
message: faker.lorem.sentence(),
|
|
16
18
|
status: 'removed',
|
|
17
19
|
label: 'file removed',
|
|
20
|
+
docId: "",
|
|
21
|
+
user: "123"
|
|
18
22
|
},
|
|
19
23
|
{
|
|
20
24
|
active: true,
|
|
@@ -23,6 +27,8 @@ export const notificationsMock = [
|
|
|
23
27
|
message: faker.lorem.sentence(),
|
|
24
28
|
status: 'shared',
|
|
25
29
|
label: 'folder shared',
|
|
30
|
+
docId: "",
|
|
31
|
+
user: "123"
|
|
26
32
|
},
|
|
27
33
|
{
|
|
28
34
|
active: true,
|
|
@@ -31,5 +37,7 @@ export const notificationsMock = [
|
|
|
31
37
|
message: faker.lorem.sentence(),
|
|
32
38
|
status: 'updated',
|
|
33
39
|
label: 'updated payment',
|
|
40
|
+
docId: "",
|
|
41
|
+
user: "123"
|
|
34
42
|
},
|
|
35
43
|
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t } from 'i18next'
|
|
2
2
|
import { Checkbox, Flex, Stack, Image, Text } from '@chakra-ui/react'
|
|
3
|
-
import {
|
|
3
|
+
import { getReceiptOrigin } from '@/helpers'
|
|
4
4
|
import { formatCurrency, formatDateWithAt } from '@/utils'
|
|
5
5
|
import { AssignableReceiptCardI } from '@/interfaces'
|
|
6
6
|
|
|
@@ -34,7 +34,7 @@ export const AssignableReceiptCard = ({
|
|
|
34
34
|
>
|
|
35
35
|
<Flex align="center" gap="base">
|
|
36
36
|
<Image
|
|
37
|
-
src={
|
|
37
|
+
src={getReceiptOrigin(origin)}
|
|
38
38
|
w="auto"
|
|
39
39
|
h={["40px","69px"]}
|
|
40
40
|
fit="contain"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t } from 'i18next'
|
|
2
2
|
import { Stack, Box, Flex, Text, Image } from '@chakra-ui/react'
|
|
3
3
|
import { BubbleText } from '@/components'
|
|
4
|
-
import {
|
|
4
|
+
import { getReceiptOrigin } from '@/helpers'
|
|
5
5
|
|
|
6
6
|
export const AutofilerBubble = () => {
|
|
7
7
|
const retails: string[] = ['homeDepot', 'lowes', 'walmart']
|
|
@@ -28,7 +28,7 @@ export const AutofilerBubble = () => {
|
|
|
28
28
|
{retails.map((retail) => (
|
|
29
29
|
<Image
|
|
30
30
|
key={retail}
|
|
31
|
-
src={
|
|
31
|
+
src={getReceiptOrigin(retail)}
|
|
32
32
|
w="auto"
|
|
33
33
|
h="70px"
|
|
34
34
|
fit="contain"
|
|
@@ -3,7 +3,7 @@ import { ButtonGroup, Box, Stack, Flex, Img, Text } from '@chakra-ui/react'
|
|
|
3
3
|
import { ReceiptBg } from '@/assets/images'
|
|
4
4
|
import { IconMenu, MoreHorizontal, TextBadge } from '@/components'
|
|
5
5
|
import { ReceiptI } from '@/interfaces'
|
|
6
|
-
import {
|
|
6
|
+
import { getReceiptOrigin } from '@/helpers'
|
|
7
7
|
import { formatDateTime } from '@/utils'
|
|
8
8
|
|
|
9
9
|
export const GridReceipt = ({
|
|
@@ -17,7 +17,7 @@ export const GridReceipt = ({
|
|
|
17
17
|
total,
|
|
18
18
|
name
|
|
19
19
|
}: ReceiptI) => {
|
|
20
|
-
const storeImage =
|
|
20
|
+
const storeImage = getReceiptOrigin(origin)
|
|
21
21
|
const handleClick = () => onClick(_id)
|
|
22
22
|
|
|
23
23
|
const { formattedDate: date, formattedTime: time } = formatDateTime({
|
|
@@ -2,7 +2,7 @@ import { t } from 'i18next'
|
|
|
2
2
|
import { Box, Flex, Img, Stack, Text } from '@chakra-ui/react'
|
|
3
3
|
import { IconMenu, MoreHorizontal } from '@/components'
|
|
4
4
|
import { ReceiptI } from '@/interfaces'
|
|
5
|
-
import {
|
|
5
|
+
import { getReceiptOrigin } from '@/helpers'
|
|
6
6
|
import { formatDateTime } from '@/utils'
|
|
7
7
|
|
|
8
8
|
export const ListReceipt = ({
|
|
@@ -16,7 +16,7 @@ export const ListReceipt = ({
|
|
|
16
16
|
origin = '',
|
|
17
17
|
name
|
|
18
18
|
}: ReceiptI) => {
|
|
19
|
-
const storeImage =
|
|
19
|
+
const storeImage = getReceiptOrigin(origin)
|
|
20
20
|
const handleClick = () => onClick(_id)
|
|
21
21
|
const { formattedDate: date, formattedTime: time } = formatDateTime({
|
|
22
22
|
date: purchaseDate,
|
|
@@ -3,7 +3,7 @@ import { Box, Divider, Flex, IconButton, Image, Text } from '@chakra-ui/react'
|
|
|
3
3
|
import { formatDate } from '@/utils'
|
|
4
4
|
import { DetailsColumn, Edit } from '@/components'
|
|
5
5
|
import { ColumnDetailsType, ReceiptDetailsDBI } from '@/interfaces'
|
|
6
|
-
import {
|
|
6
|
+
import { getReceiptOrigin } from '@/helpers'
|
|
7
7
|
|
|
8
8
|
export const ReceiptDetails = ({
|
|
9
9
|
name,
|
|
@@ -18,7 +18,7 @@ export const ReceiptDetails = ({
|
|
|
18
18
|
total,
|
|
19
19
|
onEdit,
|
|
20
20
|
}: Partial<ReceiptDetailsDBI> & { onEdit?: () => void }) => {
|
|
21
|
-
const storeImage =
|
|
21
|
+
const storeImage = getReceiptOrigin(origin)
|
|
22
22
|
const leftLabels = t('receipts.columnLeft').split(',')
|
|
23
23
|
const rightLabels = t('receipts.columnRight').split(',')
|
|
24
24
|
const leftColumn: Partial<ColumnDetailsType>[] = [
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
import { GroupCardI } from '@/interfaces'
|
|
12
12
|
import { handleMapMedia } from '@/utils'
|
|
13
13
|
import { useGroupCard } from '@/hooks'
|
|
14
|
-
import {
|
|
14
|
+
import { getReceiptOrigin } from '@/helpers'
|
|
15
15
|
|
|
16
16
|
const storageUrl = import.meta.env.VITE_STORAGE_URL
|
|
17
17
|
|
|
@@ -97,7 +97,7 @@ export const GroupCard = ({
|
|
|
97
97
|
const imageUrl = `${storageUrl}/${images[0]?.bucketName}/${images[0]?.fileName}.${images[0]?.extension}`
|
|
98
98
|
|
|
99
99
|
const storeImage = metadata?.origin
|
|
100
|
-
?
|
|
100
|
+
? getReceiptOrigin(metadata?.origin)
|
|
101
101
|
: ''
|
|
102
102
|
|
|
103
103
|
const handleImage = (files: File[] | any) => {
|
|
@@ -11,6 +11,10 @@ export const receiptOrigins: Record<string, string> = {
|
|
|
11
11
|
"" : DefaultReceipt
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
export const getReceiptOrigin = (key: string): string => {
|
|
15
|
+
return receiptOrigins[key] ?? DefaultReceipt;
|
|
16
|
+
};
|
|
17
|
+
|
|
14
18
|
export const receipts: ReceiptCardItemI[] = [
|
|
15
19
|
{
|
|
16
20
|
purchaseDate: new Date(),
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
type NotificationType = 'simple'
|
|
1
|
+
type NotificationType = 'simple' | 'service'
|
|
2
2
|
type NotificationStatus = 'added' | 'removed' | 'updated' | 'shared'
|
|
3
3
|
|
|
4
4
|
export interface NotificationCardI {
|
|
5
5
|
active: boolean
|
|
6
6
|
createdAt: Date
|
|
7
|
+
docId: string
|
|
7
8
|
_id: string
|
|
8
9
|
label: string
|
|
9
10
|
message: string
|
|
10
11
|
status: NotificationStatus
|
|
11
12
|
type?: NotificationType
|
|
13
|
+
user: string
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
export interface NotificationsPanelI {
|
|
@@ -4,11 +4,13 @@ import { faker } from '@faker-js/faker'
|
|
|
4
4
|
export const notificationsMock: NotificationCardI[] = [
|
|
5
5
|
{
|
|
6
6
|
active: true,
|
|
7
|
+
docId: "",
|
|
7
8
|
_id: '1',
|
|
8
9
|
createdAt: new Date(),
|
|
9
10
|
message: faker.lorem.sentence(),
|
|
10
11
|
status: 'added',
|
|
11
12
|
label: 'contact added',
|
|
13
|
+
user: "123"
|
|
12
14
|
},
|
|
13
15
|
{
|
|
14
16
|
active: true,
|
|
@@ -17,6 +19,8 @@ export const notificationsMock: NotificationCardI[] = [
|
|
|
17
19
|
message: faker.lorem.sentence(),
|
|
18
20
|
status: 'removed',
|
|
19
21
|
label: 'file removed',
|
|
22
|
+
docId: "",
|
|
23
|
+
user: "123"
|
|
20
24
|
},
|
|
21
25
|
{
|
|
22
26
|
active: true,
|
|
@@ -25,6 +29,8 @@ export const notificationsMock: NotificationCardI[] = [
|
|
|
25
29
|
message: faker.lorem.sentence(),
|
|
26
30
|
status: 'shared',
|
|
27
31
|
label: 'folder shared',
|
|
32
|
+
docId: "",
|
|
33
|
+
user: "123"
|
|
28
34
|
},
|
|
29
35
|
{
|
|
30
36
|
active: true,
|
|
@@ -33,5 +39,7 @@ export const notificationsMock: NotificationCardI[] = [
|
|
|
33
39
|
message: faker.lorem.sentence(),
|
|
34
40
|
status: 'updated',
|
|
35
41
|
label: 'updated payment',
|
|
42
|
+
docId: "",
|
|
43
|
+
user: "123"
|
|
36
44
|
},
|
|
37
45
|
]
|