Skip to content

Commit a1d1398

Browse files
committed
fix: build errors
1 parent 88a4986 commit a1d1398

File tree

5 files changed

+11
-12
lines changed

5 files changed

+11
-12
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
const megabyteSize = 1048576;
2+
3+
export const validateMaxSize = (fileObj: Record<string, number>, maxSizeInMB: string) => {
4+
const fileSize = (fileObj.size / megabyteSize).toFixed(2);
5+
return parseFloat(fileSize) < parseFloat(maxSizeInMB);
6+
};

packages/react-sdk-components/src/components/widget/Attachment/Attachment.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ import {
1111
insertAttachments,
1212
useDeepMemo,
1313
useFileDownload,
14-
validateFileExtension,
15-
validateMaxSize
14+
validateFileExtension
1615
} from './AttachmentUtils';
16+
import { validateMaxSize } from '../../helpers/attachmentShared';
1717
import type { PageInstructionOptions } from './Attachment.types';
1818
import type { PConnFieldProps } from '../../../types/PConnProps';
1919

packages/react-sdk-components/src/components/widget/Attachment/AttachmentUtils.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ import equal from 'fast-deep-equal';
44

55
import type { FileObject, PageInstructionOptions, ReduxAttachments } from './Attachment.types';
66

7-
const megabyteSize = 1048576;
8-
97
export const isContentBinary = (headers: Record<string, string>) => {
108
return headers && headers['content-transfer-encoding'] === 'binary';
119
};
@@ -14,11 +12,6 @@ export const isContentBase64 = (headers: Record<string, string>) => {
1412
return headers && headers['content-transfer-encoding'] === 'base64';
1513
};
1614

17-
export const validateMaxSize = (fileObj: Record<string, number>, maxSizeInMB: string) => {
18-
const fileSize = (fileObj.size / megabyteSize).toFixed(2);
19-
return parseFloat(fileSize) < parseFloat(maxSizeInMB);
20-
};
21-
2215
export const validateFileExtension = (fileObj: Record<string, string>, allowedExtensions: string) => {
2316
if (!allowedExtensions) {
2417
return true;

packages/react-sdk-components/src/components/widget/FileUtility/FileUtility/FileUtility.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import './FileUtility.css';
1010
import { IconButton, Menu, MenuItem, Button, CircularProgress, Card } from '@mui/material';
1111
import MoreVertIcon from '@mui/icons-material/MoreVert';
1212

13-
import { validateMaxSize } from '../../../helpers/attachmentHelpers';
13+
import { validateMaxSize } from '../../../helpers/attachmentShared';
1414
import { getComponentFromMap } from '../../../../bridge/helpers/sdk_component_map';
1515
import type { PConnProps } from '../../../../types/PConnProps';
1616

0 commit comments

Comments
 (0)