@blocklet/payment-react 1.16.12 → 1.16.16
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/es/checkout/donate.d.ts +2 -3
- package/es/checkout/donate.js +2 -2
- package/es/checkout/form.d.ts +1 -2
- package/es/checkout/form.js +1 -1
- package/es/checkout/table.d.ts +1 -2
- package/es/components/blockchain/gas.d.ts +0 -1
- package/es/components/blockchain/tx.d.ts +0 -1
- package/es/components/country-select.d.ts +2 -3
- package/es/components/input.d.ts +13 -14
- package/es/components/livemode.d.ts +1 -2
- package/es/components/over-due-invoice-payment.d.ts +0 -1
- package/es/components/pricing-item.d.ts +1 -2
- package/es/components/pricing-item.js +1 -1
- package/es/components/pricing-table.d.ts +0 -1
- package/es/components/status.d.ts +1 -2
- package/es/components/switch-button.d.ts +5 -4
- package/es/components/switch-button.js +40 -37
- package/es/components/truncated-text.d.ts +0 -1
- package/es/contexts/payment.d.ts +0 -1
- package/es/history/invoice/list.d.ts +0 -1
- package/es/history/payment/list.d.ts +0 -1
- package/es/libs/util.d.ts +2 -5
- package/es/libs/util.js +1 -1
- package/es/locales/index.d.ts +1 -1
- package/es/payment/amount.d.ts +1 -2
- package/es/payment/error.d.ts +0 -1
- package/es/payment/footer.d.ts +0 -1
- package/es/payment/form/addon.d.ts +0 -1
- package/es/payment/form/address.d.ts +1 -2
- package/es/payment/form/currency.d.ts +0 -1
- package/es/payment/form/index.d.ts +1 -2
- package/es/payment/form/index.js +4 -1
- package/es/payment/form/phone.d.ts +0 -1
- package/es/payment/form/stripe/form.d.ts +0 -1
- package/es/payment/form/stripe/index.d.ts +0 -1
- package/es/payment/header.d.ts +0 -1
- package/es/payment/index.d.ts +5 -6
- package/es/payment/product-card.d.ts +0 -1
- package/es/payment/product-donation.d.ts +0 -1
- package/es/payment/product-skeleton.d.ts +0 -1
- package/es/payment/skeleton/overview.d.ts +0 -1
- package/es/payment/skeleton/payment.d.ts +0 -1
- package/es/payment/success.d.ts +0 -1
- package/es/payment/summary.d.ts +0 -1
- package/es/payment/summary.js +1 -11
- package/es/theme/index.d.ts +1 -1
- package/es/types/index.d.ts +2 -2
- package/lib/checkout/donate.d.ts +2 -3
- package/lib/checkout/donate.js +2 -2
- package/lib/checkout/form.d.ts +1 -2
- package/lib/checkout/form.js +1 -1
- package/lib/checkout/table.d.ts +1 -2
- package/lib/components/blockchain/gas.d.ts +0 -1
- package/lib/components/blockchain/tx.d.ts +0 -1
- package/lib/components/country-select.d.ts +2 -3
- package/lib/components/input.d.ts +13 -14
- package/lib/components/livemode.d.ts +1 -2
- package/lib/components/over-due-invoice-payment.d.ts +0 -1
- package/lib/components/pricing-item.d.ts +1 -2
- package/lib/components/pricing-item.js +1 -1
- package/lib/components/pricing-table.d.ts +0 -1
- package/lib/components/status.d.ts +1 -2
- package/lib/components/switch-button.d.ts +5 -4
- package/lib/components/switch-button.js +3 -2
- package/lib/components/truncated-text.d.ts +0 -1
- package/lib/contexts/payment.d.ts +0 -1
- package/lib/history/invoice/list.d.ts +0 -1
- package/lib/history/payment/list.d.ts +0 -1
- package/lib/libs/util.d.ts +2 -5
- package/lib/libs/util.js +1 -1
- package/lib/locales/index.d.ts +1 -1
- package/lib/payment/amount.d.ts +1 -2
- package/lib/payment/error.d.ts +0 -1
- package/lib/payment/footer.d.ts +0 -1
- package/lib/payment/form/addon.d.ts +0 -1
- package/lib/payment/form/address.d.ts +1 -2
- package/lib/payment/form/currency.d.ts +0 -1
- package/lib/payment/form/index.d.ts +1 -2
- package/lib/payment/form/index.js +4 -1
- package/lib/payment/form/phone.d.ts +0 -1
- package/lib/payment/form/stripe/form.d.ts +0 -1
- package/lib/payment/form/stripe/index.d.ts +0 -1
- package/lib/payment/header.d.ts +0 -1
- package/lib/payment/index.d.ts +5 -6
- package/lib/payment/product-card.d.ts +0 -1
- package/lib/payment/product-donation.d.ts +0 -1
- package/lib/payment/product-skeleton.d.ts +0 -1
- package/lib/payment/skeleton/overview.d.ts +0 -1
- package/lib/payment/skeleton/payment.d.ts +0 -1
- package/lib/payment/success.d.ts +0 -1
- package/lib/payment/summary.d.ts +0 -1
- package/lib/theme/index.d.ts +1 -1
- package/lib/types/index.d.ts +2 -2
- package/package.json +16 -15
- package/src/checkout/donate.tsx +4 -4
- package/src/checkout/form.tsx +2 -2
- package/src/checkout/table.tsx +3 -3
- package/src/components/country-select.tsx +5 -3
- package/src/components/input.tsx +4 -2
- package/src/components/livemode.tsx +2 -1
- package/src/components/pricing-item.tsx +2 -2
- package/src/components/status.tsx +2 -1
- package/src/components/switch-button.tsx +44 -39
- package/src/components/truncated-text.tsx +2 -1
- package/src/contexts/payment.tsx +2 -2
- package/src/libs/api.ts +2 -2
- package/src/libs/util.ts +4 -5
- package/src/payment/amount.tsx +2 -1
- package/src/payment/form/address.tsx +2 -1
- package/src/payment/form/index.tsx +2 -1
- package/src/payment/form/phone.tsx +3 -2
- package/src/payment/index.tsx +4 -3
- package/src/payment/summary.tsx +2 -12
- package/src/theme/index.tsx +1 -1
- package/src/types/index.ts +2 -2
package/es/checkout/donate.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import type { DonationSettings, TCheckoutSessionExpanded, TPaymentCurrency, TPaymentMethod } from '@blocklet/payment-types';
|
|
3
|
-
import { ButtonProps as MUIButtonProps } from '@mui/material';
|
|
4
|
-
import { CheckoutProps, PaymentThemeOptions } from '../types';
|
|
2
|
+
import { type ButtonProps as MUIButtonProps } from '@mui/material';
|
|
3
|
+
import type { CheckoutProps, PaymentThemeOptions } from '../types';
|
|
5
4
|
export type DonateHistory = {
|
|
6
5
|
supporters: TCheckoutSessionExpanded[];
|
|
7
6
|
currency: TPaymentCurrency;
|
package/es/checkout/donate.js
CHANGED
|
@@ -31,7 +31,7 @@ const donationCache = {};
|
|
|
31
31
|
const createOrUpdateDonation = (settings, livemode = true) => {
|
|
32
32
|
const donationKey = `${settings.target}-${livemode}`;
|
|
33
33
|
if (!donationCache[donationKey]) {
|
|
34
|
-
donationCache[donationKey] = api.post(`/api/donations?livemode=${livemode}`, omit(settings, ["appearance"])).then((res) => res
|
|
34
|
+
donationCache[donationKey] = api.post(`/api/donations?livemode=${livemode}`, omit(settings, ["appearance"])).then((res) => res?.data).finally(() => {
|
|
35
35
|
setTimeout(() => {
|
|
36
36
|
delete donationCache[donationKey];
|
|
37
37
|
}, 3e3);
|
|
@@ -42,7 +42,7 @@ const createOrUpdateDonation = (settings, livemode = true) => {
|
|
|
42
42
|
const supporterCache = {};
|
|
43
43
|
const fetchSupporters = (target, livemode = true) => {
|
|
44
44
|
if (!supporterCache[target]) {
|
|
45
|
-
supporterCache[target] = api.get("/api/donations", { params: { target, livemode } }).then((res) => res
|
|
45
|
+
supporterCache[target] = api.get("/api/donations", { params: { target, livemode } }).then((res) => res?.data).finally(() => {
|
|
46
46
|
setTimeout(() => {
|
|
47
47
|
delete supporterCache[target];
|
|
48
48
|
}, 3e3);
|
package/es/checkout/form.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import { CheckoutProps } from '../types';
|
|
1
|
+
import type { CheckoutProps } from '../types';
|
|
3
2
|
declare function CheckoutForm({ id, mode, onPaid, onError, onChange, goBack, extraParams, action, theme, ...restProps }: CheckoutProps): import("react").JSX.Element;
|
|
4
3
|
declare namespace CheckoutForm {
|
|
5
4
|
var defaultProps: {
|
package/es/checkout/form.js
CHANGED
|
@@ -10,7 +10,7 @@ import { PaymentThemeProvider } from "../theme/index.js";
|
|
|
10
10
|
const promises = {};
|
|
11
11
|
const startFromPaymentLink = (id, params) => {
|
|
12
12
|
if (!promises[id]) {
|
|
13
|
-
promises[id] = api.post(`/api/checkout-sessions/start/${id}?${mergeExtraParams(params)}`).then((res) => res
|
|
13
|
+
promises[id] = api.post(`/api/checkout-sessions/start/${id}?${mergeExtraParams(params)}`).then((res) => res?.data).finally(() => {
|
|
14
14
|
setTimeout(() => {
|
|
15
15
|
delete promises[id];
|
|
16
16
|
}, 3e3);
|
package/es/checkout/table.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import { CountryIso2 } from 'react-international-phone';
|
|
1
|
+
import type { SxProps } from '@mui/material';
|
|
2
|
+
import type { CountryIso2 } from 'react-international-phone';
|
|
4
3
|
export type CountrySelectProps = {
|
|
5
4
|
value: CountryIso2;
|
|
6
5
|
onChange: (value: CountryIso2) => void;
|
package/es/components/input.d.ts
CHANGED
|
@@ -1,25 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
import { RegisterOptions } from 'react-hook-form';
|
|
1
|
+
import type { RegisterOptions } from 'react-hook-form';
|
|
3
2
|
declare const FormInput: import("react").ForwardRefExoticComponent<(Omit<import("@mui/material").OutlinedTextFieldProps & {
|
|
4
3
|
name: string;
|
|
5
|
-
label?: string
|
|
6
|
-
placeholder?: string
|
|
7
|
-
errorPosition?: "
|
|
8
|
-
rules?: RegisterOptions
|
|
4
|
+
label?: string;
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
errorPosition?: "right" | "bottom";
|
|
7
|
+
rules?: RegisterOptions;
|
|
9
8
|
wrapperStyle?: any;
|
|
10
9
|
}, "ref"> | Omit<import("@mui/material").FilledTextFieldProps & {
|
|
11
10
|
name: string;
|
|
12
|
-
label?: string
|
|
13
|
-
placeholder?: string
|
|
14
|
-
errorPosition?: "
|
|
15
|
-
rules?: RegisterOptions
|
|
11
|
+
label?: string;
|
|
12
|
+
placeholder?: string;
|
|
13
|
+
errorPosition?: "right" | "bottom";
|
|
14
|
+
rules?: RegisterOptions;
|
|
16
15
|
wrapperStyle?: any;
|
|
17
16
|
}, "ref"> | Omit<import("@mui/material").StandardTextFieldProps & {
|
|
18
17
|
name: string;
|
|
19
|
-
label?: string
|
|
20
|
-
placeholder?: string
|
|
21
|
-
errorPosition?: "
|
|
22
|
-
rules?: RegisterOptions
|
|
18
|
+
label?: string;
|
|
19
|
+
placeholder?: string;
|
|
20
|
+
errorPosition?: "right" | "bottom";
|
|
21
|
+
rules?: RegisterOptions;
|
|
23
22
|
wrapperStyle?: any;
|
|
24
23
|
}, "ref">) & import("react").RefAttributes<HTMLInputElement>>;
|
|
25
24
|
export default FormInput;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import type { TProductExpanded } from '@blocklet/payment-types';
|
|
3
|
-
import { PricingRenderProps } from '../types';
|
|
2
|
+
import type { PricingRenderProps } from '../types';
|
|
4
3
|
export type PricingItemProps = {
|
|
5
4
|
productId: string;
|
|
6
5
|
quantity: number;
|
|
@@ -8,7 +8,7 @@ import { Box } from "@mui/system";
|
|
|
8
8
|
import api from "../libs/api.js";
|
|
9
9
|
import { formatError, formatTotalPrice } from "../libs/util.js";
|
|
10
10
|
const fetchProduct = (productId) => {
|
|
11
|
-
return api.get(`/api/products/${productId}`).then((res) => res
|
|
11
|
+
return api.get(`/api/products/${productId}`).then((res) => res?.data);
|
|
12
12
|
};
|
|
13
13
|
function PricingItem({ productId, quantity, children, priceId }) {
|
|
14
14
|
const { locale } = useLocaleContext();
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { LiteralUnion } from 'type-fest';
|
|
2
|
-
type SwitchProps
|
|
2
|
+
import type { SwitchProps as MuiSwitchProps } from '@mui/material';
|
|
3
|
+
type CustomSwitchProps = {
|
|
3
4
|
variant?: LiteralUnion<'success' | 'error' | 'warning' | 'info' | 'primary' | 'secondary', string>;
|
|
4
|
-
};
|
|
5
|
-
declare const
|
|
6
|
-
export default
|
|
5
|
+
} & MuiSwitchProps;
|
|
6
|
+
declare const SwitchButton: React.FC<CustomSwitchProps>;
|
|
7
|
+
export default SwitchButton;
|
|
@@ -1,42 +1,45 @@
|
|
|
1
1
|
import { Switch } from "@mui/material";
|
|
2
2
|
import { styled } from "@mui/system";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"
|
|
10
|
-
|
|
3
|
+
const SwitchButton = styled(Switch)(
|
|
4
|
+
({ variant = "success", theme }) => ({
|
|
5
|
+
width: 28,
|
|
6
|
+
height: 16,
|
|
7
|
+
padding: 0,
|
|
8
|
+
display: "inline-flex",
|
|
9
|
+
"&:active": {
|
|
10
|
+
"& .MuiSwitch-thumb": {
|
|
11
|
+
width: 15
|
|
12
|
+
},
|
|
13
|
+
"& .MuiSwitch-switchBase.Mui-checked": {
|
|
14
|
+
transform: "translateX(9px)"
|
|
15
|
+
}
|
|
11
16
|
},
|
|
12
|
-
"& .MuiSwitch-switchBase
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"& + .MuiSwitch-track": {
|
|
22
|
-
opacity: 1,
|
|
23
|
-
backgroundColor: theme.palette[variant]?.light
|
|
17
|
+
"& .MuiSwitch-switchBase": {
|
|
18
|
+
padding: 2,
|
|
19
|
+
"&.Mui-checked": {
|
|
20
|
+
transform: "translateX(12px)",
|
|
21
|
+
color: "#fff",
|
|
22
|
+
"& + .MuiSwitch-track": {
|
|
23
|
+
opacity: 1,
|
|
24
|
+
backgroundColor: theme.palette[variant]?.light
|
|
25
|
+
}
|
|
24
26
|
}
|
|
27
|
+
},
|
|
28
|
+
"& .MuiSwitch-thumb": {
|
|
29
|
+
boxShadow: "0 2px 4px 0 rgb(0 35 11 / 20%)",
|
|
30
|
+
width: 12,
|
|
31
|
+
height: 12,
|
|
32
|
+
borderRadius: 6,
|
|
33
|
+
transition: theme.transitions?.create(["width"], {
|
|
34
|
+
duration: 200
|
|
35
|
+
})
|
|
36
|
+
},
|
|
37
|
+
"& .MuiSwitch-track": {
|
|
38
|
+
borderRadius: 16 / 2,
|
|
39
|
+
opacity: 1,
|
|
40
|
+
backgroundColor: theme.palette.mode === "dark" ? "rgba(255,255,255,.35)" : "rgba(0,0,0,.25)",
|
|
41
|
+
boxSizing: "border-box"
|
|
25
42
|
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
width: 12,
|
|
30
|
-
height: 12,
|
|
31
|
-
borderRadius: 6,
|
|
32
|
-
transition: theme.transitions?.create(["width"], {
|
|
33
|
-
duration: 200
|
|
34
|
-
})
|
|
35
|
-
},
|
|
36
|
-
"& .MuiSwitch-track": {
|
|
37
|
-
borderRadius: 16 / 2,
|
|
38
|
-
opacity: 1,
|
|
39
|
-
backgroundColor: theme.palette.mode === "dark" ? "rgba(255,255,255,.35)" : "rgba(0,0,0,.25)",
|
|
40
|
-
boxSizing: "border-box"
|
|
41
|
-
}
|
|
42
|
-
}));
|
|
43
|
+
})
|
|
44
|
+
);
|
|
45
|
+
export default SwitchButton;
|
package/es/contexts/payment.d.ts
CHANGED
package/es/libs/util.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import type { PaymentDetails, PriceCurrency, PriceRecurring, TInvoiceExpanded, TLineItemExpanded, TPaymentCurrency, TPaymentCurrencyExpanded, TPaymentMethod, TPaymentMethodExpanded, TPrice, TProductExpanded, TSubscriptionExpanded, TSubscriptionItemExpanded } from '@blocklet/payment-types';
|
|
3
|
-
import { ActionProps, PricingRenderProps } from '../types';
|
|
2
|
+
import type { ActionProps, PricingRenderProps } from '../types';
|
|
4
3
|
export declare const PAYMENT_KIT_DID = "z2qaCNvKMv5GjouKdcDWexv6WqtHbpNPQDnAk";
|
|
5
4
|
export declare const isPaymentKitMounted: () => any;
|
|
6
5
|
export declare const getPrefix: () => string;
|
|
@@ -85,9 +84,7 @@ export declare const getSubscriptionAction: (subscription: TSubscriptionExpanded
|
|
|
85
84
|
sx?: any;
|
|
86
85
|
} | null;
|
|
87
86
|
export declare const mergeExtraParams: (extra?: Record<string, any>) => string;
|
|
88
|
-
export declare const flattenPaymentMethods: (methods?: TPaymentMethodExpanded[]) =>
|
|
89
|
-
omit: never;
|
|
90
|
-
}>[];
|
|
87
|
+
export declare const flattenPaymentMethods: (methods?: TPaymentMethodExpanded[]) => TPaymentCurrency[];
|
|
91
88
|
export declare const getTxLink: (method: TPaymentMethod, details: PaymentDetails) => {
|
|
92
89
|
link: string;
|
|
93
90
|
text: string;
|
package/es/libs/util.js
CHANGED
|
@@ -30,7 +30,7 @@ export const getPrefix = () => {
|
|
|
30
30
|
if (componentId === PAYMENT_KIT_DID) {
|
|
31
31
|
return joinURL(baseUrl, prefix);
|
|
32
32
|
}
|
|
33
|
-
const component = (window.blocklet?.componentMountPoints || []).find((x) => x
|
|
33
|
+
const component = (window.blocklet?.componentMountPoints || []).find((x) => x?.did === PAYMENT_KIT_DID);
|
|
34
34
|
if (component) {
|
|
35
35
|
return joinURL(baseUrl, component.mountPoint);
|
|
36
36
|
}
|
package/es/locales/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export declare const translations: {
|
|
|
3
3
|
en: any;
|
|
4
4
|
};
|
|
5
5
|
export declare const createTranslator: ({ fallbackLocale }: {
|
|
6
|
-
fallbackLocale?: string
|
|
6
|
+
fallbackLocale?: string;
|
|
7
7
|
}, langs?: any) => (key: string, locale?: string, data?: Record<string, any>) => string;
|
|
8
8
|
export declare const translate: (key: string, locale?: string, data?: Record<string, any>) => string;
|
|
9
9
|
export declare const t: (key: string, locale?: string, data?: Record<string, any>) => string;
|
package/es/payment/amount.d.ts
CHANGED
package/es/payment/error.d.ts
CHANGED
package/es/payment/footer.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import 'react-international-phone/style.css';
|
|
3
|
-
import { CheckoutCallbacks, CheckoutContext } from '../../types';
|
|
2
|
+
import type { CheckoutCallbacks, CheckoutContext } from '../../types';
|
|
4
3
|
type PageData = CheckoutContext & CheckoutCallbacks;
|
|
5
4
|
declare function PaymentForm({ checkoutSession, paymentMethods, paymentIntent, paymentLink, customer, onPaid, onError, action, currencyId, }: PageData): import("react").JSX.Element;
|
|
6
5
|
declare namespace PaymentForm {
|
package/es/payment/form/index.js
CHANGED
|
@@ -40,7 +40,10 @@ const waitForCheckoutComplete = async (sessionId) => {
|
|
|
40
40
|
throw new Error(data.paymentIntent.last_payment_error.message);
|
|
41
41
|
}
|
|
42
42
|
result = data;
|
|
43
|
-
return
|
|
43
|
+
return (
|
|
44
|
+
// eslint-disable-next-line @typescript-eslint/return-await
|
|
45
|
+
data.checkoutSession?.status === "complete" && ["paid", "no_payment_required"].includes(data.checkoutSession?.payment_status)
|
|
46
|
+
);
|
|
44
47
|
},
|
|
45
48
|
{ interval: 2e3, timeout: 3 * 60 * 1e3 }
|
|
46
49
|
);
|
package/es/payment/header.d.ts
CHANGED
package/es/payment/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { type BoxProps } from '@mui/material';
|
|
2
2
|
import type { LiteralUnion } from 'type-fest';
|
|
3
|
-
import { CheckoutCallbacks, CheckoutContext } from '../types';
|
|
3
|
+
import type { CheckoutCallbacks, CheckoutContext } from '../types';
|
|
4
4
|
type Props = CheckoutContext & CheckoutCallbacks & {
|
|
5
5
|
completed?: boolean;
|
|
6
6
|
error?: any;
|
|
@@ -15,8 +15,7 @@ declare namespace Payment {
|
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
17
|
export default Payment;
|
|
18
|
-
|
|
19
|
-
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
20
|
-
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/system").Theme> & {
|
|
18
|
+
type RootProps = {
|
|
21
19
|
mode: LiteralUnion<'standalone' | 'inline' | 'popup', string>;
|
|
22
|
-
}
|
|
20
|
+
} & BoxProps;
|
|
21
|
+
export declare const Root: React.FC<RootProps>;
|
package/es/payment/success.d.ts
CHANGED
package/es/payment/summary.d.ts
CHANGED
package/es/payment/summary.js
CHANGED
|
@@ -2,17 +2,7 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useLocaleContext } from "@arcblock/ux/lib/Locale/context";
|
|
3
3
|
import { HelpOutline } from "@mui/icons-material";
|
|
4
4
|
import { LoadingButton } from "@mui/lab";
|
|
5
|
-
import {
|
|
6
|
-
Box,
|
|
7
|
-
Divider,
|
|
8
|
-
Fade,
|
|
9
|
-
Grow,
|
|
10
|
-
Stack,
|
|
11
|
-
Tooltip,
|
|
12
|
-
Typography,
|
|
13
|
-
Collapse,
|
|
14
|
-
IconButton
|
|
15
|
-
} from "@mui/material";
|
|
5
|
+
import { Box, Divider, Fade, Grow, Stack, Tooltip, Typography, Collapse, IconButton } from "@mui/material";
|
|
16
6
|
import { BN, fromTokenToUnit, fromUnitToToken } from "@ocap/util";
|
|
17
7
|
import { useRequest, useSetState } from "ahooks";
|
|
18
8
|
import noop from "lodash/noop";
|
package/es/theme/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { typography } from './typography';
|
|
3
3
|
import './index.css';
|
|
4
|
-
import { PaymentThemeOptions } from '../types';
|
|
4
|
+
import type { PaymentThemeOptions } from '../types';
|
|
5
5
|
export { typography };
|
|
6
6
|
export declare function PaymentThemeProvider({ children, theme: customTheme, }: {
|
|
7
7
|
children: React.ReactNode;
|
package/es/types/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TCheckoutSessionExpanded, TCustomer, TPaymentIntent, TPaymentLink, TPaymentMethodExpanded } from '@blocklet/payment-types';
|
|
2
|
-
import { SxProps, ThemeOptions } from '@mui/material';
|
|
3
|
-
import { LiteralUnion } from 'type-fest';
|
|
2
|
+
import type { SxProps, ThemeOptions } from '@mui/material';
|
|
3
|
+
import type { LiteralUnion } from 'type-fest';
|
|
4
4
|
export type CheckoutContext = {
|
|
5
5
|
checkoutSession: TCheckoutSessionExpanded;
|
|
6
6
|
paymentMethods: TPaymentMethodExpanded[];
|
package/lib/checkout/donate.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import type { DonationSettings, TCheckoutSessionExpanded, TPaymentCurrency, TPaymentMethod } from '@blocklet/payment-types';
|
|
3
|
-
import { ButtonProps as MUIButtonProps } from '@mui/material';
|
|
4
|
-
import { CheckoutProps, PaymentThemeOptions } from '../types';
|
|
2
|
+
import { type ButtonProps as MUIButtonProps } from '@mui/material';
|
|
3
|
+
import type { CheckoutProps, PaymentThemeOptions } from '../types';
|
|
5
4
|
export type DonateHistory = {
|
|
6
5
|
supporters: TCheckoutSessionExpanded[];
|
|
7
6
|
currency: TPaymentCurrency;
|
package/lib/checkout/donate.js
CHANGED
|
@@ -23,7 +23,7 @@ const donationCache = {};
|
|
|
23
23
|
const createOrUpdateDonation = (settings, livemode = true) => {
|
|
24
24
|
const donationKey = `${settings.target}-${livemode}`;
|
|
25
25
|
if (!donationCache[donationKey]) {
|
|
26
|
-
donationCache[donationKey] = _api.default.post(`/api/donations?livemode=${livemode}`, (0, _omit.default)(settings, ["appearance"])).then(res => res
|
|
26
|
+
donationCache[donationKey] = _api.default.post(`/api/donations?livemode=${livemode}`, (0, _omit.default)(settings, ["appearance"])).then(res => res?.data).finally(() => {
|
|
27
27
|
setTimeout(() => {
|
|
28
28
|
delete donationCache[donationKey];
|
|
29
29
|
}, 3e3);
|
|
@@ -39,7 +39,7 @@ const fetchSupporters = (target, livemode = true) => {
|
|
|
39
39
|
target,
|
|
40
40
|
livemode
|
|
41
41
|
}
|
|
42
|
-
}).then(res => res
|
|
42
|
+
}).then(res => res?.data).finally(() => {
|
|
43
43
|
setTimeout(() => {
|
|
44
44
|
delete supporterCache[target];
|
|
45
45
|
}, 3e3);
|
package/lib/checkout/form.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import { CheckoutProps } from '../types';
|
|
1
|
+
import type { CheckoutProps } from '../types';
|
|
3
2
|
declare function CheckoutForm({ id, mode, onPaid, onError, onChange, goBack, extraParams, action, theme, ...restProps }: CheckoutProps): import("react").JSX.Element;
|
|
4
3
|
declare namespace CheckoutForm {
|
|
5
4
|
var defaultProps: {
|
package/lib/checkout/form.js
CHANGED
|
@@ -17,7 +17,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
17
17
|
const promises = {};
|
|
18
18
|
const startFromPaymentLink = (id, params) => {
|
|
19
19
|
if (!promises[id]) {
|
|
20
|
-
promises[id] = _api.default.post(`/api/checkout-sessions/start/${id}?${(0, _util.mergeExtraParams)(params)}`).then(res => res
|
|
20
|
+
promises[id] = _api.default.post(`/api/checkout-sessions/start/${id}?${(0, _util.mergeExtraParams)(params)}`).then(res => res?.data).finally(() => {
|
|
21
21
|
setTimeout(() => {
|
|
22
22
|
delete promises[id];
|
|
23
23
|
}, 3e3);
|
package/lib/checkout/table.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import { CountryIso2 } from 'react-international-phone';
|
|
1
|
+
import type { SxProps } from '@mui/material';
|
|
2
|
+
import type { CountryIso2 } from 'react-international-phone';
|
|
4
3
|
export type CountrySelectProps = {
|
|
5
4
|
value: CountryIso2;
|
|
6
5
|
onChange: (value: CountryIso2) => void;
|