Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,156 changes: 567 additions & 589 deletions src/Payments.Mvc/ClientApp/package-lock.json

Large diffs are not rendered by default.

26 changes: 11 additions & 15 deletions src/Payments.Mvc/ClientApp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,34 +17,30 @@
"lint": "node node_modules/eslint/bin/eslint.js ClientApp --ext .tsx,.ts,.js,.jsx"
},
"dependencies": {
"axios": "^0.21.1",
"axios": "^1.7.9",
"bootstrap-datepicker": "^1.8.0",
"classnames": "^2.2.6",
"date-fns": "^1.30.1",
"date-fns": "^3.6.0",
"pretty-checkbox": "^3.0.3",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"react-error-overlay": "6.0.9",
"react-dropzone": "^8.0.4",
"react-router-dom": "5.3.0",
"react-scripts": "5.0.1",
"recompose": "^0.30.0"
"react-dropzone": "^14.3.5",
"react-router-dom": "^6.28.0",
"react-scripts": "5.0.1"
Comment on lines +25 to +30
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🌐 Web query:

react-scripts 5.0.1 React 19 compatibility support

💡 Result:

Short answer: [email protected] is not compatible with React 19 out of the box and will cause peer-dependency/conflict issues. react-scripts 5.x was published before React 19 and many CRA deps (and downstream libs) still expect React 18 or earlier, so installing React 19 with [email protected] commonly produces ERESOLVE/peer-dep errors. [1][2][3]

What to do (recommended)

  • Stay on React 18 for projects using [email protected] (pin react/react-dom@18). [2][3]
  • If you must use React 19, move off CRA/react-scripts (or wait for an official react-scripts update) — consider alternative toolchains (Vite, Next.js, or a CRA fork) or upgrade packages that declare strict peer deps. [1][3]
  • Short-term workarounds: use npm/yarn install flags (--legacy-peer-deps or --force) or dependency overrides to resolve peer conflicts, but expect runtime/compatibility risk. [3]

Sources

  1. React 19 release notes — react.dev.
  2. react-scripts v5.0.1 npm page.
  3. create-react-app GitHub issues reporting React 19 / peer-dependency conflicts with react-scripts.

[email protected] is incompatible with React 19 and will cause peer-dependency conflicts.

React 19 produces ERESOLVE/peer-dependency errors with react-scripts 5.x, which was released before React 19 and declares strict dependency constraints for earlier React versions. Either pin React/React-DOM to version 18, or migrate away from Create React App to a toolchain that supports React 19 (Vite, Next.js, or similar).

🤖 Prompt for AI Agents
In src/Payments.Mvc/ClientApp/package.json around lines 25 to 30, package.json
currently uses react and react-dom ^19.0.0 together with react-scripts 5.0.1
which is incompatible and causes peer-dependency errors; fix by either
downgrading react and react-dom to a 18.x range (e.g., "react": "^18.2.0",
"react-dom": "^18.2.0") to remain on CRA/react-scripts 5, or remove
react-scripts and migrate the project to a React-19-compatible toolchain (e.g.,
replace react-scripts with Vite/Next.js configuration and associated build/dev
scripts and deps); update package.json and npm/Yarn lockfile accordingly and run
an install to verify no peer-dependency conflicts.

},
"devDependencies": {
"@types/bootstrap-datepicker": "^0.0.13",
"@types/jquery": "^3.3.29",
"@types/node": "^14.14.31",
"@types/react": "^17.0.2",
"@types/react-dom": "^17.0.9",
"@types/node": "^22.10.1",
"@types/react": "^19.0.1",
"@types/react-dom": "^19.0.2",
"@types/react-hot-loader": "^4.1.0",
"@types/react-router": "5.1.8",
"@types/react-router-dom": "5.1.8",
"@types/recompose": "^0.30.10",
"eslint-config-prettier": "^8.3.0",
"isomorphic-fetch": "2.2.1",
"prettier": "2.0.5",
"sass": "^1.49.9",
"typescript": "^4.6.2"
"typescript": "^5.7.2"
},
"eslintConfig": {
"extends": [
Expand Down
1 change: 1 addition & 0 deletions src/Payments.Mvc/ClientApp/src/components/alert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as React from 'react';
interface IProps {
className: string;
onDismiss: () => void;
children?: React.ReactNode;
}

export default class Alert extends React.Component<IProps, {}> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as React from 'react';
import FileUpload from './fileUpload';

import { InvoiceAttachment } from '../models/InvoiceAttachment';
import { Team } from '../models/Team';

import TeamContext from '../contexts/TeamContext';

Expand All @@ -13,6 +14,7 @@ interface IProps {

export default class AttachmentsControl extends React.Component<IProps, {}> {
static contextType = TeamContext;
context!: Team;

public render() {
const { attachments } = this.props;
Expand All @@ -26,7 +28,7 @@ export default class AttachmentsControl extends React.Component<IProps, {}> {
}

private renderAttachment = (attachment: InvoiceAttachment) => {
const team = this.context;
const team = this.context as Team;

const fileTypeIcon = this.getFileTypeIcon(attachment.contentType);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';

import { isAfter } from 'date-fns';
import { isAfter, format } from 'date-fns';

import { Coupon } from '../models/Coupon';
import { InvoiceDiscount } from '../models/InvoiceDiscount';
Expand Down Expand Up @@ -140,7 +140,7 @@ export default class CouponSelectControl extends React.Component<
<dd className='col-sm-8'>${discountAmount}</dd>

<dt className='col-sm-4'>Expires On</dt>
<dd className='col-sm-8'>{expiresAt}</dd>
<dd className='col-sm-8'>{expiresAt ? format(expiresAt, 'MM/dd/yyyy') : ''}</dd>
</dl>
</div>
<div className='col-md-3 d-flex flex-column justify-content-around align-items-center'>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export default class DateControl extends React.Component<IProps, {}> {
className='input-group date'
data-provide='datepicker'
{...datePickerOptions}
ref={r => (this._datePicker = r)}
ref={r => { this._datePicker = r; }}
>
<input
type='text'
Expand Down
24 changes: 13 additions & 11 deletions src/Payments.Mvc/ClientApp/src/components/editItemsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,21 @@ export default class EditItemsTable extends React.Component<IProps, IState> {
};
}

public componentWillReceiveProps(nextProps: IProps) {
const items: IState['items'] = {
byHash: {},
byId: []
};
public componentDidUpdate(prevProps: IProps) {
if (prevProps.items !== this.props.items) {
const items: IState['items'] = {
byHash: {},
byId: []
};

nextProps.items.forEach((item, index) => {
const id = item.id;
items.byId.push(id);
items.byHash[id] = item;
});
this.props.items.forEach((item, index) => {
const id = item.id;
items.byId.push(id);
items.byHash[id] = item;
});

this.setState({ items });
this.setState({ items });
}
}

public render() {
Expand Down
55 changes: 30 additions & 25 deletions src/Payments.Mvc/ClientApp/src/components/fileUpload.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import * as React from 'react';

import axios, { AxiosResponse, CancelTokenSource } from 'axios';
import Dropzone, { DropzoneRenderArgs } from 'react-dropzone';
import axios, { AxiosResponse, AxiosProgressEvent, CancelTokenSource } from 'axios';
import { useDropzone } from 'react-dropzone';

import { InvoiceAttachment } from '../models/InvoiceAttachment';
import { Team } from '../models/Team';

import TeamContext from '../contexts/TeamContext';

Expand All @@ -27,6 +28,7 @@ interface IState {

export default class FileUpload extends React.Component<IProps, IState> {
static contextType = TeamContext;
context!: Team;

constructor(props) {
super(props);
Expand All @@ -42,32 +44,13 @@ export default class FileUpload extends React.Component<IProps, IState> {

return (
<div className={className}>
<Dropzone onDrop={this.startUpload}>{this.renderDropzone}</Dropzone>
<DropzoneWrapper onDrop={this.startUpload} />

{attachmentsUploading.map(this.renderUploadingAttachment)}
</div>
);
}

private renderDropzone = (args: DropzoneRenderArgs) => {
return (
<div {...args.getRootProps()} className='dropzone'>
<input {...args.getInputProps()} />
<div className='d-flex justify-content-center align-items-center'>
<i className='fas fa-upload fa-2x me-4' />
<div className='d-flex flex-column align-items-center'>
{args.isDragActive ? (
<span>Drop files here...</span>
) : (
<span>Drop files to attach, or click to Browse.</span>
)}
<span>(Individual file upload size limit 5 MB)</span>
</div>
</div>
</div>
);
};

private renderUploadingAttachment = (
attachment: UploadingInvoiceAttachment
) => {
Expand Down Expand Up @@ -146,7 +129,7 @@ export default class FileUpload extends React.Component<IProps, IState> {
return `${(size / 1024 / 1024).toFixed(1)} MB`;
};

private startUpload = (accepted: File[], rejected, event) => {
private startUpload = (accepted: File[]) => {
const { slug } = this.context;

// start uploads
Expand Down Expand Up @@ -189,7 +172,7 @@ export default class FileUpload extends React.Component<IProps, IState> {
};

private onUploadProgress = (
progressEvent: ProgressEvent,
progressEvent: AxiosProgressEvent,
identifier: string
) => {
const attachmentsUploading = [...this.state.attachmentsUploading];
Expand All @@ -198,7 +181,7 @@ export default class FileUpload extends React.Component<IProps, IState> {
const index = attachmentsUploading.findIndex(
a => a.identifier === identifier
);
if (index > -1) {
if (index > -1 && progressEvent.total) {
attachmentsUploading[index].progress =
(progressEvent.loaded / progressEvent.total) * 100;

Expand Down Expand Up @@ -254,3 +237,25 @@ export default class FileUpload extends React.Component<IProps, IState> {
});
};
}

// Wrapper component to use the useDropzone hook
function DropzoneWrapper({ onDrop }: { onDrop: (files: File[]) => void }) {
const { getRootProps, getInputProps, isDragActive } = useDropzone({ onDrop });

return (
<div {...getRootProps()} className='dropzone'>
<input {...getInputProps()} />
<div className='d-flex justify-content-center align-items-center'>
<i className='fas fa-upload fa-2x me-4' />
<div className='d-flex flex-column align-items-center'>
{isDragActive ? (
<span>Drop files here...</span>
) : (
<span>Drop files to attach, or click to Browse.</span>
)}
<span>(Individual file upload size limit 5 MB)</span>
</div>
</div>
</div>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ interface IProps {
className?: string;
validate: boolean;
formRef?: (form: HTMLFormElement) => void;
children?: React.ReactNode;
}

export default class InvoiceForm extends React.Component<IProps, {}> {
Expand Down
30 changes: 17 additions & 13 deletions src/Payments.Mvc/ClientApp/src/components/modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import Portal from './portal';
interface IProps {
dialogClassName?: string;
isOpen: boolean;
children?: React.ReactNode;

onOpened?: () => void;
onClosed?: () => void;
Expand Down Expand Up @@ -37,23 +38,26 @@ export default class LoadingModal extends React.Component<IProps, IState> {

public componentDidMount() {
this._isMounted = true;

if (this.props.isOpen) {
this.onOpen();
}
}

public componentWillReceiveProps(nextProps) {
if (nextProps.isOpen !== this.props.isOpen) {
this.setState({ isOpen: nextProps.isOpen });
}
public componentDidUpdate(prevProps: IProps, prevState: IState) {
// Handle isOpen prop changes
if (prevProps.isOpen !== this.props.isOpen) {
this.setState({ isOpen: this.props.isOpen });

if (nextProps.isOpen) {
this.onOpen();
} else {
this.onClose();
if (this.props.isOpen) {
this.onOpen();
} else {
this.onClose();
}
}
}

public componentWillUpdate(nextProps, nextState) {
// close -> open
if (nextState.isOpen && !this.state.isOpen) {
// Handle state changes: close -> open
if (this.state.isOpen && !prevState.isOpen) {
this.init();
}
}
Expand Down Expand Up @@ -94,7 +98,7 @@ export default class LoadingModal extends React.Component<IProps, IState> {
<div
className={`modal-dialog modal-dialog-centered ${dialogClassName}`}
role='document'
ref={r => (this._dialog = r)}
ref={r => { this._dialog = r; }}
>
<div className='modal-content'>{this.props.children}</div>
</div>
Expand Down
10 changes: 6 additions & 4 deletions src/Payments.Mvc/ClientApp/src/components/numberControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@ export default class NumberControl extends React.PureComponent<IProps, IState> {
};
}

public componentWillReceiveProps(nextProps: IProps) {
this.setState({
value: this.valueToString(nextProps.value)
});
public componentDidUpdate(prevProps: IProps) {
if (prevProps.value !== this.props.value) {
this.setState({
value: this.valueToString(this.props.value)
});
}
}

public render() {
Expand Down
3 changes: 2 additions & 1 deletion src/Payments.Mvc/ClientApp/src/components/portal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ const canUseDOM = !!(
);

interface IProps {
node: Element
node: Element;
children?: React.ReactNode;
}

export default class Portal extends React.Component<IProps, {}> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default class PreviewFrame extends React.Component<IProps, {}> {

return (
<div>
<form method="post" action={action} target="iframe_preview" ref={r => this._previewForm = r}>
<form method="post" action={action} target="iframe_preview" ref={r => { this._previewForm = r; }}>
<input type="hidden" name="json" value={value} />
</form>
<div className="d-flex" style={{ minHeight: '60vh' }}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1100,11 +1100,11 @@ export default class RechargeAccountsControl extends React.Component<
<td className='cell-financial-segment'>
<div className='input-group'>
<input
ref={el =>
(this.inputRefs[
ref={el => {
this.inputRefs[
`${direction.toLowerCase()}-${index}-chart`
] = el)
}
] = el;
}}
type='text'
className={`form-control ${
account.isValidating
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export default class CreateInvoiceContainer extends React.Component<
<InvoiceForm
className='card'
validate={validate}
formRef={r => (this._formRef = r)}
formRef={r => { this._formRef = r; }}
>
<LoadingModal loading={loading} />
<div className='card-header card-header-yellow'>
Expand Down Expand Up @@ -175,7 +175,7 @@ export default class CreateInvoiceContainer extends React.Component<
{invoiceType === 'Recharge' && (
<div className='card-body invoice-recharge-accounts'>
<RechargeAccountsControl
ref={r => (this._rechargeAccountsRef = r)}
ref={r => { this._rechargeAccountsRef = r; }}
rechargeAccounts={rechargeAccounts}
invoiceTotal={calculateTotal(items, discount, taxPercent)}
onChange={v => this.updateProperty('rechargeAccounts', v)}
Expand Down
Loading