Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/clone/wp-conte.../plugins/leadin/scripts/elemento.../FormWidg...
File: ElementorFormSelect.tsx
import React, { useState, useEffect, Fragment } from 'react';
[0] Fix | Delete
import { portalId, refreshToken } from '../../constants/leadinConfig';
[1] Fix | Delete
import ElementorBanner from '../Common/ElementorBanner';
[2] Fix | Delete
import UISpinner from '../../shared/UIComponents/UISpinner';
[3] Fix | Delete
import { __ } from '@wordpress/i18n';
[4] Fix | Delete
import {
[5] Fix | Delete
BackgroudAppContext,
[6] Fix | Delete
useBackgroundAppContext,
[7] Fix | Delete
} from '../../iframe/useBackgroundApp';
[8] Fix | Delete
import useForms from './hooks/useForms';
[9] Fix | Delete
import { getOrCreateBackgroundApp } from '../../utils/backgroundAppUtils';
[10] Fix | Delete
[11] Fix | Delete
interface IElementorFormSelectProps {
[12] Fix | Delete
formId: string;
[13] Fix | Delete
setAttributes: Function;
[14] Fix | Delete
}
[15] Fix | Delete
[16] Fix | Delete
function ElementorFormSelect({
[17] Fix | Delete
formId,
[18] Fix | Delete
setAttributes,
[19] Fix | Delete
}: IElementorFormSelectProps) {
[20] Fix | Delete
const { hasError, forms, loading } = useForms();
[21] Fix | Delete
[22] Fix | Delete
return loading ? (
[23] Fix | Delete
<div>
[24] Fix | Delete
<UISpinner />
[25] Fix | Delete
</div>
[26] Fix | Delete
) : hasError ? (
[27] Fix | Delete
<ElementorBanner type="danger">
[28] Fix | Delete
{__('Please refresh your forms or try again in a few minutes', 'leadin')}
[29] Fix | Delete
</ElementorBanner>
[30] Fix | Delete
) : (
[31] Fix | Delete
<select
[32] Fix | Delete
value={formId}
[33] Fix | Delete
onChange={event => {
[34] Fix | Delete
const selectedForm = forms.find(
[35] Fix | Delete
form => form.value === event.target.value
[36] Fix | Delete
);
[37] Fix | Delete
if (selectedForm) {
[38] Fix | Delete
setAttributes({
[39] Fix | Delete
portalId,
[40] Fix | Delete
formId: selectedForm.value,
[41] Fix | Delete
formName: selectedForm.label,
[42] Fix | Delete
});
[43] Fix | Delete
}
[44] Fix | Delete
}}
[45] Fix | Delete
>
[46] Fix | Delete
<option value="" disabled={true} selected={true}>
[47] Fix | Delete
{__('Search for a form', 'leadin')}
[48] Fix | Delete
</option>
[49] Fix | Delete
{forms.map(form => (
[50] Fix | Delete
<option key={form.value} value={form.value}>
[51] Fix | Delete
{form.label}
[52] Fix | Delete
</option>
[53] Fix | Delete
))}
[54] Fix | Delete
</select>
[55] Fix | Delete
);
[56] Fix | Delete
}
[57] Fix | Delete
[58] Fix | Delete
function ElementorFormSelectWrapper(props: IElementorFormSelectProps) {
[59] Fix | Delete
const isBackgroundAppReady = useBackgroundAppContext();
[60] Fix | Delete
[61] Fix | Delete
return (
[62] Fix | Delete
<Fragment>
[63] Fix | Delete
{!isBackgroundAppReady ? (
[64] Fix | Delete
<div>
[65] Fix | Delete
<UISpinner />
[66] Fix | Delete
</div>
[67] Fix | Delete
) : (
[68] Fix | Delete
<ElementorFormSelect {...props} />
[69] Fix | Delete
)}
[70] Fix | Delete
</Fragment>
[71] Fix | Delete
);
[72] Fix | Delete
}
[73] Fix | Delete
[74] Fix | Delete
export default function ElementorFormSelectContainer(
[75] Fix | Delete
props: IElementorFormSelectProps
[76] Fix | Delete
) {
[77] Fix | Delete
return (
[78] Fix | Delete
<BackgroudAppContext.Provider
[79] Fix | Delete
value={refreshToken && getOrCreateBackgroundApp(refreshToken)}
[80] Fix | Delete
>
[81] Fix | Delete
<ElementorFormSelectWrapper {...props} />
[82] Fix | Delete
</BackgroudAppContext.Provider>
[83] Fix | Delete
);
[84] Fix | Delete
}
[85] Fix | Delete
[86] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function