Fix the build from react-intl changes

This commit is contained in:
Eric 2020-06-30 16:41:47 -05:00 committed by Eric Schultz
parent d33600f663
commit 219c815bec
11 changed files with 33 additions and 33 deletions

View file

@ -1,7 +1,7 @@
// License: LGPL-3.0-or-later // License: LGPL-3.0-or-later
import * as React from 'react'; import * as React from 'react';
import {observer, Provider} from 'mobx-react'; import {observer, Provider} from 'mobx-react';
import {addLocaleData, IntlProvider} from 'react-intl'; import {IntlProvider} from 'react-intl';
import {convert} from 'dotize' import {convert} from 'dotize'
import {ApiManager} from "../../lib/api_manager"; import {ApiManager} from "../../lib/api_manager";
import {APIS} from "../../../api"; import {APIS} from "../../../api";
@ -9,14 +9,14 @@ import {CSRFInterceptor} from "../../lib/csrf_interceptor";
import * as CustomAPIS from "../../lib/apis" import * as CustomAPIS from "../../lib/apis"
const enLocaleData = require('react-intl/locale-data/en'); // const enLocaleData = require('react-intl/locale-data/en');
const I18n = require('../../../../i18n.js.erb') const I18n = require('../../../../i18n.js.erb')
const localeData = [...enLocaleData] // const localeData = [...enLocaleData]
Object.keys(I18n.translations).filter((i:string) => i !== 'en').forEach((i:string) => { // Object.keys(I18n.translations).filter((i:string) => i !== 'en').forEach((i:string) => {
const data = [...require(`react-intl/locale-data/${i}`)] // const data = [...require(`react-intl/locale-data/${i}`)]
localeData.concat(data) // localeData.concat(data)
}) // })
addLocaleData(localeData) // addLocaleData(localeData)
interface RootProps interface RootProps
{ {
@ -41,7 +41,7 @@ export default class Root extends React.Component<RootProps, {}> {
this.apiManager = new ApiManager(APIS.concat(CustomAPIS.APIS as Array<any>), CSRFInterceptor) this.apiManager = new ApiManager(APIS.concat(CustomAPIS.APIS as Array<any>), CSRFInterceptor)
} }
return <IntlProvider locale={I18n.locale} defaultLocale={I18n.defaultLocale} messages={convert(I18n.translations[I18n.locale])}> return <IntlProvider locale={I18n.locale} defaultLocale={I18n.defaultLocale} messages={I18n.translations[I18n.locale]}>
<Provider ApiManager={this.apiManager}> <Provider ApiManager={this.apiManager}>
{this.props.children} {this.props.children}
</Provider> </Provider>

View file

@ -1,7 +1,7 @@
// License: LGPL-3.0-or-later // License: LGPL-3.0-or-later
import * as React from 'react'; import * as React from 'react';
import { observer } from 'mobx-react'; import { observer } from 'mobx-react';
import { injectIntl} from 'react-intl'; import { injectIntl, WrappedComponentProps} from 'react-intl';
import Modal from "../common/Modal"; import Modal from "../common/Modal";
//import { FundraiserInfo} from "../edit_payment_pane/EditPaymentPane"; //import { FundraiserInfo} from "../edit_payment_pane/EditPaymentPane";
import {HoudiniForm} from "../../lib/houdini_form"; import {HoudiniForm} from "../../lib/houdini_form";
@ -48,9 +48,9 @@ class CreateOffsitePaymentPaneForm extends HoudiniForm {
} }
class CreateNewOffsitePaymentPane extends React.Component<CreateOffsitePaymentPaneProps & {}> { class CreateNewOffsitePaymentPane extends React.Component<CreateOffsitePaymentPaneProps & WrappedComponentProps, {}> {
constructor(props: CreateOffsitePaymentPaneProps & InjectedIntlProps) { constructor(props: CreateOffsitePaymentPaneProps & WrappedComponentProps) {
super(props); super(props);
this.postOffsiteDonation = new ApiManager(CustomAPIS.APIS as Array<any>, CSRFInterceptor).get(CreateOffsiteDonation) this.postOffsiteDonation = new ApiManager(CustomAPIS.APIS as Array<any>, CSRFInterceptor).get(CreateOffsiteDonation)

View file

@ -1,7 +1,7 @@
// License: LGPL-3.0-or-later // License: LGPL-3.0-or-later
import * as React from 'react'; import * as React from 'react';
import {observer} from 'mobx-react'; import {observer} from 'mobx-react';
import { injectIntl} from 'react-intl'; import { injectIntl, WrappedComponentProps} from 'react-intl';
import {action, computed} from "mobx"; import {action, computed} from "mobx";
import {FieldDefinition} from "mobx-react-form"; import {FieldDefinition} from "mobx-react-form";
import {HoudiniForm} from "../../lib/houdini_form"; import {HoudiniForm} from "../../lib/houdini_form";
@ -88,9 +88,9 @@ class EditPaymentPaneForm extends HoudiniForm {
@observer @observer
class EditPaymentPane extends React.Component<EditPaymentPaneProps & {}> { class EditPaymentPane extends React.Component<EditPaymentPaneProps & WrappedComponentProps,{}> {
constructor(props: EditPaymentPaneProps & InjectedIntlProps) { constructor(props: EditPaymentPaneProps & WrappedComponentProps) {
super(props); super(props);
this.putDonation = new ApiManager(CustomAPIS.APIS as Array<any>, CSRFInterceptor).get(PutDonation); this.putDonation = new ApiManager(CustomAPIS.APIS as Array<any>, CSRFInterceptor).get(PutDonation);

View file

@ -1,7 +1,7 @@
// License: LGPL-3.0-or-later // License: LGPL-3.0-or-later
import * as React from 'react'; import * as React from 'react';
import { observer } from 'mobx-react'; import { observer } from 'mobx-react';
import { injectIntl} from 'react-intl'; import { injectIntl, WrappedComponentProps} from 'react-intl';
import {Field, FieldDefinition} from "../../../../../../types/mobx-react-form"; import {Field, FieldDefinition} from "../../../../../../types/mobx-react-form";
import {BasicField} from "../common/fields"; import {BasicField} from "../common/fields";
import {ThreeColumnFields, TwoColumnFields} from "../common/layout"; import {ThreeColumnFields, TwoColumnFields} from "../common/layout";
@ -46,7 +46,7 @@ export const FieldDefinitions : Array<FieldDefinition> = [
} }
] ]
class NonprofitInfoForm extends React.Component<NonprofitInfoFormProps & {}> { class NonprofitInfoForm extends React.Component<NonprofitInfoFormProps & WrappedComponentProps, {}> {
render() { render() {

View file

@ -7,7 +7,7 @@ import { Field} from 'mobx-react-form'
import { observer } from 'mobx-react'; import { observer } from 'mobx-react';
import { computed } from 'mobx'; import { computed } from 'mobx';
import { WizardTabPanelState} from "../common/wizard/wizard_state"; import { WizardTabPanelState} from "../common/wizard/wizard_state";
import { injectIntl, InjectedIntl} from 'react-intl'; import { injectIntl, WrappedComponentProps} from 'react-intl';
import NonprofitInfoForm from "./NonprofitInfoForm"; import NonprofitInfoForm from "./NonprofitInfoForm";
export interface NonprofitInfoPanelProps extends WizardTabPanelProps export interface NonprofitInfoPanelProps extends WizardTabPanelProps
@ -15,7 +15,7 @@ export interface NonprofitInfoPanelProps extends WizardTabPanelProps
buttonText:string buttonText:string
} }
class NonprofitInfoPanel extends React.Component<NonprofitInfoPanelProps & {}> { class NonprofitInfoPanel extends React.Component<NonprofitInfoPanelProps & WrappedComponentProps, {}> {
@computed @computed
get wizardTab(): WizardTabPanelState { get wizardTab(): WizardTabPanelState {

View file

@ -3,7 +3,7 @@ import * as React from 'react';
import RegistrationWizard from "./RegistrationWizard"; import RegistrationWizard from "./RegistrationWizard";
import {observer} from 'mobx-react'; import {observer} from 'mobx-react';
import { injectIntl, InjectedIntl, FormattedMessage} from 'react-intl'; import { injectIntl, FormattedMessage, WrappedComponentProps} from 'react-intl';
export interface RegistrationPageProps export interface RegistrationPageProps
@ -11,7 +11,7 @@ export interface RegistrationPageProps
} }
class RegistrationPage extends React.Component<RegistrationPageProps & {}> { class RegistrationPage extends React.Component<RegistrationPageProps & WrappedComponentProps, {}> {

View file

@ -7,7 +7,7 @@ import {action, observable, computed, runInAction} from 'mobx';
import {Wizard} from '../common/wizard/Wizard' import {Wizard} from '../common/wizard/Wizard'
import {Form} from 'mobx-react-form'; import {Form} from 'mobx-react-form';
import {FormattedMessage, injectIntl, InjectedIntlProps} from 'react-intl'; import { injectIntl, WrappedComponentProps} from 'react-intl';
import {WizardState, WizardTabPanelState} from "../common/wizard/wizard_state"; import {WizardState, WizardTabPanelState} from "../common/wizard/wizard_state";
import UserInfoPanel, * as UserInfo from "./UserInfoPanel"; import UserInfoPanel, * as UserInfo from "./UserInfoPanel";
import { import {
@ -122,9 +122,9 @@ class RegistrationWizardState extends WizardState {
} }
export class InnerRegistrationWizard extends React.Component<RegistrationWizardProps & {}> { export class InnerRegistrationWizard extends React.Component<RegistrationWizardProps & WrappedComponentProps,{}> {
constructor(props: RegistrationWizardProps & InjectedIntlProps) { constructor(props: RegistrationWizardProps & WrappedComponentProps) {
super(props) super(props)
this.setRegistrationWizardState() this.setRegistrationWizardState()

View file

@ -1,7 +1,7 @@
// License: LGPL-3.0-or-later // License: LGPL-3.0-or-later
import * as React from 'react'; import * as React from 'react';
import { observer } from 'mobx-react'; import { observer } from 'mobx-react';
import { injectIntl} from 'react-intl'; import { injectIntl, WrappedComponentProps} from 'react-intl';
import {Validations} from "../../lib/vjf_rules"; import {Validations} from "../../lib/vjf_rules";
import {Field, FieldDefinition} from "mobx-react-form"; import {Field, FieldDefinition} from "mobx-react-form";
import {TwoColumnFields} from "../common/layout"; import {TwoColumnFields} from "../common/layout";
@ -40,7 +40,7 @@ export interface UserInfoFormProps
class UserInfoForm extends React.Component<UserInfoFormProps & {}> { class UserInfoForm extends React.Component<UserInfoFormProps & WrappedComponentProps, {}> {
render() { render() {
return <fieldset> return <fieldset>
<TwoColumnFields> <TwoColumnFields>

View file

@ -1,7 +1,7 @@
// License: LGPL-3.0-or-later // License: LGPL-3.0-or-later
import * as React from 'react'; import * as React from 'react';
import {observer} from 'mobx-react'; import {observer} from 'mobx-react';
import { injectIntl} from 'react-intl'; import { injectIntl, WrappedComponentProps} from 'react-intl';
import {Field} from "mobx-react-form"; import {Field} from "mobx-react-form";
import {computed} from 'mobx'; import {computed} from 'mobx';
import {WizardPanel, WizardTabPanelProps} from "../common/wizard/WizardPanel"; import {WizardPanel, WizardTabPanelProps} from "../common/wizard/WizardPanel";
@ -13,7 +13,7 @@ export interface UserInfoPanelProps extends WizardTabPanelProps {
buttonTextOnProgress?:string buttonTextOnProgress?:string
} }
class UserInfoPanel extends React.Component<UserInfoPanelProps & {}> { class UserInfoPanel extends React.Component<UserInfoPanelProps & WrappedComponentProps, {}> {
@computed @computed
get wizardTab(): WizardTabPanelState { get wizardTab(): WizardTabPanelState {

View file

@ -1,7 +1,7 @@
// License: LGPL-3.0-or-later // License: LGPL-3.0-or-later
import * as React from 'react'; import * as React from 'react';
import { observer, inject} from 'mobx-react'; import { observer, inject} from 'mobx-react';
import { injectIntl, FormattedMessage} from 'react-intl'; import { injectIntl, FormattedMessage, WrappedComponentProps} from 'react-intl';
import {Field, FieldDefinition, Form, initializationDefinition} from "../../../../../../types/mobx-react-form"; import {Field, FieldDefinition, Form, initializationDefinition} from "../../../../../../types/mobx-react-form";
import {Validations} from "../../lib/vjf_rules"; import {Validations} from "../../lib/vjf_rules";
import {WebLoginModel, WebUserSignInOut} from "../../lib/api/sign_in"; import {WebLoginModel, WebUserSignInOut} from "../../lib/api/sign_in";
@ -80,8 +80,8 @@ export class SessionPageForm extends HoudiniForm {
} }
class InnerSessionLoginForm extends React.Component<SessionLoginFormProps & {}> { class InnerSessionLoginForm extends React.Component<SessionLoginFormProps & WrappedComponentProps, {}> {
constructor(props: SessionLoginFormProps & InjectedIntlProps) { constructor(props: SessionLoginFormProps & WrappedComponentProps) {
super(props) super(props)
this.createForm(); this.createForm();
} }

View file

@ -1,7 +1,7 @@
// License: LGPL-3.0-or-later // License: LGPL-3.0-or-later
import * as React from 'react'; import * as React from 'react';
import { observer } from 'mobx-react'; import { observer } from 'mobx-react';
import { injectIntl, InjectedIntl, FormattedMessage} from 'react-intl'; import { injectIntl, FormattedMessage, WrappedComponentProps} from 'react-intl';
import SessionLoginForm from "./SessionLoginForm"; import SessionLoginForm from "./SessionLoginForm";
export interface SessionLoginPageProps export interface SessionLoginPageProps
@ -9,7 +9,7 @@ export interface SessionLoginPageProps
} }
class SessionLoginPage extends React.Component<SessionLoginPageProps & {}> { class SessionLoginPage extends React.Component<SessionLoginPageProps & WrappedComponentProps, {}> {
render() { render() {
return <div className="tw-bs"><div className="container"><div className="row"><div className={'col-sm-6'}> return <div className="tw-bs"><div className="container"><div className="row"><div className={'col-sm-6'}>
<h1><FormattedMessage id="login.header"/></h1> <h1><FormattedMessage id="login.header"/></h1>