mainstack-payments 0.5.11 → 0.5.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/mainstack-payments.js +7722 -7644
- package/build/src/components/ContactForm.d.ts +22 -0
- package/build/src/components/PaymentOptions/PaystackPayments.d.ts +12 -0
- package/build/src/components/SummaryCard.d.ts +39 -0
- package/build/src/hooks/usePaystackPayment.d.ts +31 -0
- package/build/src/index.d.ts +9 -0
- package/build/src/types/index.d.ts +7 -1
- package/package.json +1 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
interface IProps {
|
|
4
|
+
title: string | ReactNode;
|
|
5
|
+
showFullname: boolean;
|
|
6
|
+
showEmail: boolean;
|
|
7
|
+
showPhone: boolean;
|
|
8
|
+
customForm: ReactNode;
|
|
9
|
+
values: {
|
|
10
|
+
fullname: string;
|
|
11
|
+
email: string;
|
|
12
|
+
phone: string;
|
|
13
|
+
};
|
|
14
|
+
errors: {
|
|
15
|
+
fullname?: string;
|
|
16
|
+
email?: string;
|
|
17
|
+
phone?: string;
|
|
18
|
+
};
|
|
19
|
+
setFieldValue: (name: string, value: any) => void;
|
|
20
|
+
}
|
|
21
|
+
declare const ContactForm: ({ title, showFullname, showEmail, showPhone, customForm, values, errors, setFieldValue, }: IProps) => import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export default ContactForm;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** @format */
|
|
2
|
+
interface IProps {
|
|
3
|
+
showBackButton?: boolean;
|
|
4
|
+
onGoBack?: () => void;
|
|
5
|
+
themeColor?: string;
|
|
6
|
+
buttonLabel?: string;
|
|
7
|
+
paymentLoading: boolean;
|
|
8
|
+
feesLoading: boolean;
|
|
9
|
+
handlePaymentInitialization: (e: any) => Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
declare const PaystackPayments: ({ showBackButton, onGoBack, themeColor, buttonLabel, paymentLoading, feesLoading, handlePaymentInitialization, }: IProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export default PaystackPayments;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { TDiscount } from 'types';
|
|
3
|
+
|
|
4
|
+
interface IProps {
|
|
5
|
+
styles?: object;
|
|
6
|
+
summaryTitle: string | ReactNode;
|
|
7
|
+
currency: string;
|
|
8
|
+
amount: number;
|
|
9
|
+
feesLoading: boolean;
|
|
10
|
+
discount: TDiscount;
|
|
11
|
+
setDiscount: React.Dispatch<React.SetStateAction<TDiscount>>;
|
|
12
|
+
hasDiscountCode?: boolean;
|
|
13
|
+
discountCode: string;
|
|
14
|
+
setDiscountCode: React.Dispatch<React.SetStateAction<string>>;
|
|
15
|
+
applyDiscount: () => Promise<any>;
|
|
16
|
+
isApplyingDiscount: boolean;
|
|
17
|
+
taxFees: {
|
|
18
|
+
localTaxFees: number;
|
|
19
|
+
shouldApplyTax?: boolean;
|
|
20
|
+
taxedPercent: number;
|
|
21
|
+
};
|
|
22
|
+
switchingFees: {
|
|
23
|
+
applySwitchingFee: boolean;
|
|
24
|
+
localSwitchingFee: number;
|
|
25
|
+
switchingFeeRate: number;
|
|
26
|
+
};
|
|
27
|
+
transactionFees: {
|
|
28
|
+
totalAmountPlusFees: number;
|
|
29
|
+
applied_fees: Array<{
|
|
30
|
+
_id: number;
|
|
31
|
+
display_name: string;
|
|
32
|
+
amount: number;
|
|
33
|
+
extra: number;
|
|
34
|
+
}>;
|
|
35
|
+
transactionFeeValue: number;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
declare const SummaryCard: ({ styles, summaryTitle, currency, amount, feesLoading, discount, setDiscount, hasDiscountCode, discountCode, setDiscountCode, applyDiscount, isApplyingDiscount, taxFees, switchingFees, transactionFees, }: IProps) => import("react/jsx-runtime").JSX.Element;
|
|
39
|
+
export default SummaryCard;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { AxiosInstance } from 'axios';
|
|
2
|
+
import { TMetadata } from 'types';
|
|
3
|
+
|
|
4
|
+
type TInitPayload = {
|
|
5
|
+
amount: number;
|
|
6
|
+
currency: string;
|
|
7
|
+
reference: string;
|
|
8
|
+
metadata: TMetadata;
|
|
9
|
+
};
|
|
10
|
+
type TChargePayload = {
|
|
11
|
+
amount: number;
|
|
12
|
+
currency: string;
|
|
13
|
+
metadata: TMetadata;
|
|
14
|
+
callback_url?: string;
|
|
15
|
+
};
|
|
16
|
+
interface IProps {
|
|
17
|
+
Request: AxiosInstance;
|
|
18
|
+
}
|
|
19
|
+
interface IMakePaymentArgs {
|
|
20
|
+
initPayload: TInitPayload;
|
|
21
|
+
chargePayload: TChargePayload;
|
|
22
|
+
handleChargeSuccess: (data: object) => void;
|
|
23
|
+
handleChargeError: (err?: object) => void;
|
|
24
|
+
handleInitError: (err?: object) => void;
|
|
25
|
+
}
|
|
26
|
+
export declare function usePaystackPayment({ Request }: IProps): {
|
|
27
|
+
makePaystackPayment: ({ initPayload, chargePayload, handleChargeError, handleInitError, handleChargeSuccess, }: IMakePaymentArgs) => void;
|
|
28
|
+
isInitializingPayment: boolean;
|
|
29
|
+
isChargingCard: boolean;
|
|
30
|
+
};
|
|
31
|
+
export {};
|
package/build/src/index.d.ts
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
1
|
/** @format */
|
|
2
2
|
export { default as MainstackPayments } from './components/Payment';
|
|
3
3
|
export { default as MainstackPaymentsProvider } from './provider';
|
|
4
|
+
export { default as FeesSummaryCard } from './components/SummaryCard';
|
|
5
|
+
export { default as WalletPay } from './components/WalletPay';
|
|
6
|
+
export { default as CheckoutForm } from './components/CheckoutForm';
|
|
7
|
+
export { default as ContactForm } from './components/ContactForm';
|
|
8
|
+
export { default as PaystackPayments } from './components/PaymentOptions/PaystackPayments';
|
|
9
|
+
export { PaymentActionModal } from './components/PaymentActionModal';
|
|
10
|
+
export { default as PaystackPaymentErrorModal } from './components/PaystackPaymentErrorModal';
|
|
11
|
+
export { usePaystackPayment } from './hooks/usePaystackPayment';
|
|
12
|
+
export * from './api';
|
|
@@ -48,4 +48,10 @@ type TPaymentConfig = {
|
|
|
48
48
|
shouldApplyTax?: boolean;
|
|
49
49
|
paymentModel?: TPaymentModel;
|
|
50
50
|
};
|
|
51
|
-
|
|
51
|
+
type TDiscount = {
|
|
52
|
+
amount: number;
|
|
53
|
+
type: string;
|
|
54
|
+
value: number;
|
|
55
|
+
isFullDiscount: boolean;
|
|
56
|
+
};
|
|
57
|
+
export type { TPaymentConfig, TMetadata, TCustomizations, TPaymentOption, TPaymentModel, TDiscount, };
|