refactor: move types to config from client (#51266)

This commit is contained in:
Oliver Eyton-Williams
2023-08-14 18:54:37 +02:00
committed by GitHub
parent 97f33a9d9c
commit dec82f802f
4 changed files with 14 additions and 20 deletions

View File

@@ -11,7 +11,8 @@ import {
amountsConfig,
durationsConfig,
defaultDonation,
modalDefaultDonation
modalDefaultDonation,
type DonationConfig
} from '../../../../config/donation-settings';
import { defaultDonationFormState } from '../../redux';
import { updateDonationFormState, postCharge } from '../../redux/actions';
@@ -35,8 +36,7 @@ import {
PaymentContext,
PostPayment,
HandleAuthentication,
DonationApprovalData,
DonationConfig
DonationApprovalData
} from './types';
import './donation.css';

View File

@@ -6,17 +6,14 @@ import {
paypalConfigurator,
paypalConfigTypes,
defaultDonation,
PaymentProvider
PaymentProvider,
type DonationDuration,
type DonationAmount
} from '../../../../config/donation-settings';
import envData from '../../../../config/env.json';
import { userSelector, signInLoadingSelector } from '../../redux/selectors';
import { Themes } from '../settings/theme';
import {
DonationApprovalData,
PostPayment,
DonationDuration,
DonationAmount
} from './types';
import { DonationApprovalData, PostPayment } from './types';
import PayPalButtonScriptLoader from './paypal-button-script-loader';
type PaypalButtonProps = {

View File

@@ -8,13 +8,6 @@ export type HandleAuthentication = (
paymentMethod: string
) => Promise<PaymentIntentResult | { error: { type: string } }>;
export type DonationAmount = 500 | 1000 | 2000 | 3000 | 4000 | 5000;
export type DonationDuration = 'one-time' | 'month';
export interface DonationConfig {
donationAmount: DonationAmount;
donationDuration: DonationDuration;
}
export interface PostPayment {
paymentProvider: PaymentProvider;
data?: DonationApprovalData;

View File

@@ -1,5 +1,11 @@
// Configuration for client side
import { DonationConfig } from '../client/src/components/Donation/types';
export type DonationAmount = 500 | 1000 | 2000 | 3000 | 4000 | 5000;
export type DonationDuration = 'one-time' | 'month';
export interface DonationConfig {
donationAmount: DonationAmount;
donationDuration: DonationDuration;
}
export const durationsConfig: {
month: 'monthly';
@@ -80,8 +86,6 @@ export const paypalConfigTypes = {
}
};
type DonationAmount = 500 | 1000 | 2000 | 3000 | 4000 | 5000;
interface OneTimeConfig {
amount: DonationAmount;
duration: 'one-time';