@blocklet/payment-react 1.16.13 → 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
|
@@ -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;
|
|
@@ -15,7 +15,7 @@ var _api = _interopRequireDefault(require("../libs/api"));
|
|
|
15
15
|
var _util = require("../libs/util");
|
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
17
|
const fetchProduct = productId => {
|
|
18
|
-
return _api.default.get(`/api/products/${productId}`).then(res => res
|
|
18
|
+
return _api.default.get(`/api/products/${productId}`).then(res => res?.data);
|
|
19
19
|
};
|
|
20
20
|
function PricingItem({
|
|
21
21
|
productId,
|
|
@@ -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;
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
|
|
7
7
|
var _material = require("@mui/material");
|
|
8
8
|
var _system = require("@mui/system");
|
|
9
|
-
|
|
9
|
+
const SwitchButton = (0, _system.styled)(_material.Switch)(({
|
|
10
10
|
variant = "success",
|
|
11
11
|
theme
|
|
12
12
|
}) => ({
|
|
@@ -48,4 +48,5 @@ module.exports = (0, _system.styled)(_material.Switch)(({
|
|
|
48
48
|
backgroundColor: theme.palette.mode === "dark" ? "rgba(255,255,255,.35)" : "rgba(0,0,0,.25)",
|
|
49
49
|
boxSizing: "border-box"
|
|
50
50
|
}
|
|
51
|
-
}));
|
|
51
|
+
}));
|
|
52
|
+
module.exports = SwitchButton;
|
package/lib/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/lib/libs/util.js
CHANGED
|
@@ -89,7 +89,7 @@ const getPrefix = () => {
|
|
|
89
89
|
if (componentId === PAYMENT_KIT_DID) {
|
|
90
90
|
return (0, _ufo.joinURL)(baseUrl, prefix);
|
|
91
91
|
}
|
|
92
|
-
const component = (window.blocklet?.componentMountPoints || []).find(x => x
|
|
92
|
+
const component = (window.blocklet?.componentMountPoints || []).find(x => x?.did === PAYMENT_KIT_DID);
|
|
93
93
|
if (component) {
|
|
94
94
|
return (0, _ufo.joinURL)(baseUrl, component.mountPoint);
|
|
95
95
|
}
|
package/lib/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/lib/payment/amount.d.ts
CHANGED
package/lib/payment/error.d.ts
CHANGED
package/lib/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 {
|
|
@@ -41,7 +41,10 @@ const waitForCheckoutComplete = async sessionId => {
|
|
|
41
41
|
throw new Error(data.paymentIntent.last_payment_error.message);
|
|
42
42
|
}
|
|
43
43
|
result = data;
|
|
44
|
-
return
|
|
44
|
+
return (
|
|
45
|
+
// eslint-disable-next-line @typescript-eslint/return-await
|
|
46
|
+
data.checkoutSession?.status === "complete" && ["paid", "no_payment_required"].includes(data.checkoutSession?.payment_status)
|
|
47
|
+
);
|
|
45
48
|
}, {
|
|
46
49
|
interval: 2e3,
|
|
47
50
|
timeout: 3 * 60 * 1e3
|
package/lib/payment/header.d.ts
CHANGED
package/lib/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/lib/payment/success.d.ts
CHANGED
package/lib/payment/summary.d.ts
CHANGED
package/lib/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/lib/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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/payment-react",
|
|
3
|
-
"version": "1.16.
|
|
3
|
+
"version": "1.16.16",
|
|
4
4
|
"description": "Reusable react components for payment kit v2",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -17,14 +17,14 @@
|
|
|
17
17
|
},
|
|
18
18
|
"scripts": {
|
|
19
19
|
"lint": "tsc --noEmit && eslint src tests --ext js --ext jsx --ext ts --ext tsx",
|
|
20
|
-
"lint:fix": "
|
|
21
|
-
"build": "tsc --noEmit && unbuild && node tools/auto-exports.js &&
|
|
20
|
+
"lint:fix": "pnpm run lint --fix",
|
|
21
|
+
"build": "tsc --noEmit && unbuild && node tools/auto-exports.js && pnpm run cpfiles",
|
|
22
22
|
"watch": "CONSOLA_LEVEL=1 nodemon -e .jsx,.js,.ts,.tsx -w src -x 'yalc publish --push'",
|
|
23
|
-
"precommit": "CI=1
|
|
24
|
-
"prepush": "CI=1
|
|
25
|
-
"prepublish": "
|
|
23
|
+
"precommit": "CI=1 pnpm run lint",
|
|
24
|
+
"prepush": "CI=1 pnpm run lint",
|
|
25
|
+
"prepublish": "pnpm run build",
|
|
26
26
|
"test": "node tools/jest.js",
|
|
27
|
-
"coverage": "
|
|
27
|
+
"coverage": "pnpm run test --coverage",
|
|
28
28
|
"storybook": "storybook dev -p 6006",
|
|
29
29
|
"build-storybook": "storybook build",
|
|
30
30
|
"cpfiles": "copyfiles -u 1 './src/**/*.css' lib/ && copyfiles -u 1 './src/**/*.css' es/"
|
|
@@ -53,15 +53,15 @@
|
|
|
53
53
|
}
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@arcblock/did-connect": "^2.10.
|
|
57
|
-
"@arcblock/ux": "^2.10.
|
|
58
|
-
"@arcblock/ws": "^1.18.
|
|
59
|
-
"@blocklet/ui-react": "^2.10.
|
|
56
|
+
"@arcblock/did-connect": "^2.10.87",
|
|
57
|
+
"@arcblock/ux": "^2.10.87",
|
|
58
|
+
"@arcblock/ws": "^1.18.161",
|
|
59
|
+
"@blocklet/ui-react": "^2.10.87",
|
|
60
60
|
"@mui/icons-material": "^5.16.6",
|
|
61
61
|
"@mui/lab": "^5.0.0-alpha.173",
|
|
62
62
|
"@mui/material": "^5.16.6",
|
|
63
63
|
"@mui/system": "^5.16.6",
|
|
64
|
-
"@ocap/util": "^1.18.
|
|
64
|
+
"@ocap/util": "^1.18.161",
|
|
65
65
|
"@stripe/react-stripe-js": "^2.7.3",
|
|
66
66
|
"@stripe/stripe-js": "^2.4.0",
|
|
67
67
|
"@vitejs/plugin-legacy": "^5.4.1",
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"@babel/core": "^7.25.2",
|
|
93
93
|
"@babel/preset-env": "^7.25.2",
|
|
94
94
|
"@babel/preset-react": "^7.24.7",
|
|
95
|
-
"@blocklet/payment-types": "1.16.
|
|
95
|
+
"@blocklet/payment-types": "1.16.16",
|
|
96
96
|
"@storybook/addon-essentials": "^7.6.20",
|
|
97
97
|
"@storybook/addon-interactions": "^7.6.20",
|
|
98
98
|
"@storybook/addon-links": "^7.6.20",
|
|
@@ -117,10 +117,11 @@
|
|
|
117
117
|
"storybook": "^7.6.20",
|
|
118
118
|
"ts-jest": "^29.2.5",
|
|
119
119
|
"type-fest": "^4.23.0",
|
|
120
|
-
"typescript": "^
|
|
120
|
+
"typescript": "^5.5.4",
|
|
121
121
|
"unbuild": "^2.0.0",
|
|
122
|
+
"vite": "^5.3.5",
|
|
122
123
|
"vite-plugin-babel": "^1.2.0",
|
|
123
124
|
"vite-plugin-node-polyfills": "^0.21.0"
|
|
124
125
|
},
|
|
125
|
-
"gitHead": "
|
|
126
|
+
"gitHead": "fdffd2c105f53202dc73f3802d773a6141c5ea73"
|
|
126
127
|
}
|
package/src/checkout/donate.tsx
CHANGED
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
TableCell,
|
|
26
26
|
TableRow,
|
|
27
27
|
Typography,
|
|
28
|
-
ButtonProps as MUIButtonProps,
|
|
28
|
+
type ButtonProps as MUIButtonProps,
|
|
29
29
|
} from '@mui/material';
|
|
30
30
|
import { useMount, useRequest, useSetState } from 'ahooks';
|
|
31
31
|
import omit from 'lodash/omit';
|
|
@@ -35,7 +35,7 @@ import { useEffect, useState } from 'react';
|
|
|
35
35
|
import TxLink from '../components/blockchain/tx';
|
|
36
36
|
import api from '../libs/api';
|
|
37
37
|
import { formatAmount, formatBNStr, formatDateTime, formatError, getCustomerAvatar, lazyLoad } from '../libs/util';
|
|
38
|
-
import { CheckoutProps, PaymentThemeOptions } from '../types';
|
|
38
|
+
import type { CheckoutProps, PaymentThemeOptions } from '../types';
|
|
39
39
|
import CheckoutForm from './form';
|
|
40
40
|
import { PaymentThemeProvider } from '../theme';
|
|
41
41
|
import { usePaymentContext } from '../contexts/payment';
|
|
@@ -76,7 +76,7 @@ const createOrUpdateDonation = (settings: DonationSettings, livemode: boolean =
|
|
|
76
76
|
if (!donationCache[donationKey]) {
|
|
77
77
|
donationCache[donationKey] = api
|
|
78
78
|
.post(`/api/donations?livemode=${livemode}`, omit(settings, ['appearance']))
|
|
79
|
-
.then((res) => res
|
|
79
|
+
.then((res: any) => res?.data)
|
|
80
80
|
.finally(() => {
|
|
81
81
|
setTimeout(() => {
|
|
82
82
|
delete donationCache[donationKey];
|
|
@@ -92,7 +92,7 @@ const fetchSupporters = (target: string, livemode: boolean = true): Promise<Dona
|
|
|
92
92
|
if (!supporterCache[target]) {
|
|
93
93
|
supporterCache[target] = api
|
|
94
94
|
.get('/api/donations', { params: { target, livemode } })
|
|
95
|
-
.then((res) => res
|
|
95
|
+
.then((res: any) => res?.data)
|
|
96
96
|
.finally(() => {
|
|
97
97
|
setTimeout(() => {
|
|
98
98
|
delete supporterCache[target];
|
package/src/checkout/form.tsx
CHANGED
|
@@ -7,7 +7,7 @@ import { joinURL } from 'ufo';
|
|
|
7
7
|
import api from '../libs/api';
|
|
8
8
|
import { getPrefix, mergeExtraParams } from '../libs/util';
|
|
9
9
|
import Payment from '../payment';
|
|
10
|
-
import { CheckoutContext, CheckoutProps } from '../types';
|
|
10
|
+
import type { CheckoutContext, CheckoutProps } from '../types';
|
|
11
11
|
import { PaymentThemeProvider } from '../theme';
|
|
12
12
|
|
|
13
13
|
const promises: { [key: string]: Promise<any> } = {};
|
|
@@ -15,7 +15,7 @@ const startFromPaymentLink = (id: string, params?: Record<string, any>): Promise
|
|
|
15
15
|
if (!promises[id]) {
|
|
16
16
|
promises[id] = api
|
|
17
17
|
.post(`/api/checkout-sessions/start/${id}?${mergeExtraParams(params)}`)
|
|
18
|
-
.then((res) => res
|
|
18
|
+
.then((res: any) => res?.data)
|
|
19
19
|
.finally(() => {
|
|
20
20
|
setTimeout(() => {
|
|
21
21
|
delete promises[id];
|
package/src/checkout/table.tsx
CHANGED
|
@@ -10,7 +10,7 @@ import Livemode from '../components/livemode';
|
|
|
10
10
|
import PricingTable from '../components/pricing-table';
|
|
11
11
|
import api from '../libs/api';
|
|
12
12
|
import { mergeExtraParams } from '../libs/util';
|
|
13
|
-
import { CheckoutProps } from '../types';
|
|
13
|
+
import type { CheckoutProps } from '../types';
|
|
14
14
|
import CheckoutForm from './form';
|
|
15
15
|
import { PaymentThemeProvider } from '../theme';
|
|
16
16
|
import TruncatedText from '../components/truncated-text';
|
|
@@ -58,7 +58,7 @@ function CheckoutTableInner({ id, mode, onPaid, onError, onChange, extraParams,
|
|
|
58
58
|
currencyId,
|
|
59
59
|
})}`
|
|
60
60
|
)
|
|
61
|
-
.then((res) => {
|
|
61
|
+
.then((res: any) => {
|
|
62
62
|
if (mode === 'standalone') {
|
|
63
63
|
let { url } = res.data;
|
|
64
64
|
url = url.indexOf('?') > -1 ? `${url}¤cyId=${currencyId}` : `${url}?currencyId=${currencyId}`;
|
|
@@ -68,7 +68,7 @@ function CheckoutTableInner({ id, mode, onPaid, onError, onChange, extraParams,
|
|
|
68
68
|
setSessionId(res.data.id);
|
|
69
69
|
}
|
|
70
70
|
})
|
|
71
|
-
.catch((err) => {
|
|
71
|
+
.catch((err: any) => {
|
|
72
72
|
console.error(err);
|
|
73
73
|
Toast.error(err.message);
|
|
74
74
|
});
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { useMemo, forwardRef } from 'react';
|
|
2
|
-
import { Box, MenuItem, Select,
|
|
2
|
+
import { Box, MenuItem, Select, Typography } from '@mui/material';
|
|
3
3
|
import { useFormContext } from 'react-hook-form';
|
|
4
|
-
import {
|
|
4
|
+
import { FlagEmoji, defaultCountries, parseCountry } from 'react-international-phone';
|
|
5
|
+
import type { SxProps } from '@mui/material';
|
|
6
|
+
import type { CountryIso2 } from 'react-international-phone';
|
|
5
7
|
|
|
6
8
|
export type CountrySelectProps = {
|
|
7
9
|
value: CountryIso2;
|
|
@@ -71,7 +73,7 @@ const CountrySelect = forwardRef<HTMLDivElement, CountrySelectProps>(({ value, o
|
|
|
71
73
|
</Box>
|
|
72
74
|
);
|
|
73
75
|
}}>
|
|
74
|
-
{defaultCountries.map((c) => {
|
|
76
|
+
{defaultCountries.map((c: any) => {
|
|
75
77
|
const parsed = parseCountry(c);
|
|
76
78
|
return (
|
|
77
79
|
<MenuItem key={parsed.iso2} value={parsed.iso2}>
|
package/src/components/input.tsx
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import React, { forwardRef, useImperativeHandle, useRef } from 'react';
|
|
2
|
-
import { Box, FormLabel, InputAdornment, TextField,
|
|
2
|
+
import { Box, FormLabel, InputAdornment, TextField, Typography } from '@mui/material';
|
|
3
3
|
import get from 'lodash/get';
|
|
4
|
-
import { Controller,
|
|
4
|
+
import { Controller, useFormContext } from 'react-hook-form';
|
|
5
|
+
import type { TextFieldProps } from '@mui/material';
|
|
6
|
+
import type { RegisterOptions } from 'react-hook-form';
|
|
5
7
|
|
|
6
8
|
type InputProps = TextFieldProps & {
|
|
7
9
|
name: string;
|
|
@@ -7,10 +7,10 @@ import Toast from '@arcblock/ux/lib/Toast';
|
|
|
7
7
|
import { Box } from '@mui/system';
|
|
8
8
|
import api from '../libs/api';
|
|
9
9
|
import { formatError, formatTotalPrice } from '../libs/util';
|
|
10
|
-
import { PricingRenderProps } from '../types';
|
|
10
|
+
import type { PricingRenderProps } from '../types';
|
|
11
11
|
|
|
12
12
|
const fetchProduct = (productId: string): Promise<TProductExpanded> => {
|
|
13
|
-
return api.get(`/api/products/${productId}`).then((res) => res
|
|
13
|
+
return api.get(`/api/products/${productId}`).then((res: any) => res?.data);
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
export type PricingItemProps = {
|