@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.
Files changed (115) hide show
  1. package/es/checkout/donate.d.ts +2 -3
  2. package/es/checkout/donate.js +2 -2
  3. package/es/checkout/form.d.ts +1 -2
  4. package/es/checkout/form.js +1 -1
  5. package/es/checkout/table.d.ts +1 -2
  6. package/es/components/blockchain/gas.d.ts +0 -1
  7. package/es/components/blockchain/tx.d.ts +0 -1
  8. package/es/components/country-select.d.ts +2 -3
  9. package/es/components/input.d.ts +13 -14
  10. package/es/components/livemode.d.ts +1 -2
  11. package/es/components/over-due-invoice-payment.d.ts +0 -1
  12. package/es/components/pricing-item.d.ts +1 -2
  13. package/es/components/pricing-item.js +1 -1
  14. package/es/components/pricing-table.d.ts +0 -1
  15. package/es/components/status.d.ts +1 -2
  16. package/es/components/switch-button.d.ts +5 -4
  17. package/es/components/switch-button.js +40 -37
  18. package/es/components/truncated-text.d.ts +0 -1
  19. package/es/contexts/payment.d.ts +0 -1
  20. package/es/history/invoice/list.d.ts +0 -1
  21. package/es/history/payment/list.d.ts +0 -1
  22. package/es/libs/util.d.ts +2 -5
  23. package/es/libs/util.js +1 -1
  24. package/es/locales/index.d.ts +1 -1
  25. package/es/payment/amount.d.ts +1 -2
  26. package/es/payment/error.d.ts +0 -1
  27. package/es/payment/footer.d.ts +0 -1
  28. package/es/payment/form/addon.d.ts +0 -1
  29. package/es/payment/form/address.d.ts +1 -2
  30. package/es/payment/form/currency.d.ts +0 -1
  31. package/es/payment/form/index.d.ts +1 -2
  32. package/es/payment/form/index.js +4 -1
  33. package/es/payment/form/phone.d.ts +0 -1
  34. package/es/payment/form/stripe/form.d.ts +0 -1
  35. package/es/payment/form/stripe/index.d.ts +0 -1
  36. package/es/payment/header.d.ts +0 -1
  37. package/es/payment/index.d.ts +5 -6
  38. package/es/payment/product-card.d.ts +0 -1
  39. package/es/payment/product-donation.d.ts +0 -1
  40. package/es/payment/product-skeleton.d.ts +0 -1
  41. package/es/payment/skeleton/overview.d.ts +0 -1
  42. package/es/payment/skeleton/payment.d.ts +0 -1
  43. package/es/payment/success.d.ts +0 -1
  44. package/es/payment/summary.d.ts +0 -1
  45. package/es/payment/summary.js +1 -11
  46. package/es/theme/index.d.ts +1 -1
  47. package/es/types/index.d.ts +2 -2
  48. package/lib/checkout/donate.d.ts +2 -3
  49. package/lib/checkout/donate.js +2 -2
  50. package/lib/checkout/form.d.ts +1 -2
  51. package/lib/checkout/form.js +1 -1
  52. package/lib/checkout/table.d.ts +1 -2
  53. package/lib/components/blockchain/gas.d.ts +0 -1
  54. package/lib/components/blockchain/tx.d.ts +0 -1
  55. package/lib/components/country-select.d.ts +2 -3
  56. package/lib/components/input.d.ts +13 -14
  57. package/lib/components/livemode.d.ts +1 -2
  58. package/lib/components/over-due-invoice-payment.d.ts +0 -1
  59. package/lib/components/pricing-item.d.ts +1 -2
  60. package/lib/components/pricing-item.js +1 -1
  61. package/lib/components/pricing-table.d.ts +0 -1
  62. package/lib/components/status.d.ts +1 -2
  63. package/lib/components/switch-button.d.ts +5 -4
  64. package/lib/components/switch-button.js +3 -2
  65. package/lib/components/truncated-text.d.ts +0 -1
  66. package/lib/contexts/payment.d.ts +0 -1
  67. package/lib/history/invoice/list.d.ts +0 -1
  68. package/lib/history/payment/list.d.ts +0 -1
  69. package/lib/libs/util.d.ts +2 -5
  70. package/lib/libs/util.js +1 -1
  71. package/lib/locales/index.d.ts +1 -1
  72. package/lib/payment/amount.d.ts +1 -2
  73. package/lib/payment/error.d.ts +0 -1
  74. package/lib/payment/footer.d.ts +0 -1
  75. package/lib/payment/form/addon.d.ts +0 -1
  76. package/lib/payment/form/address.d.ts +1 -2
  77. package/lib/payment/form/currency.d.ts +0 -1
  78. package/lib/payment/form/index.d.ts +1 -2
  79. package/lib/payment/form/index.js +4 -1
  80. package/lib/payment/form/phone.d.ts +0 -1
  81. package/lib/payment/form/stripe/form.d.ts +0 -1
  82. package/lib/payment/form/stripe/index.d.ts +0 -1
  83. package/lib/payment/header.d.ts +0 -1
  84. package/lib/payment/index.d.ts +5 -6
  85. package/lib/payment/product-card.d.ts +0 -1
  86. package/lib/payment/product-donation.d.ts +0 -1
  87. package/lib/payment/product-skeleton.d.ts +0 -1
  88. package/lib/payment/skeleton/overview.d.ts +0 -1
  89. package/lib/payment/skeleton/payment.d.ts +0 -1
  90. package/lib/payment/success.d.ts +0 -1
  91. package/lib/payment/summary.d.ts +0 -1
  92. package/lib/theme/index.d.ts +1 -1
  93. package/lib/types/index.d.ts +2 -2
  94. package/package.json +16 -15
  95. package/src/checkout/donate.tsx +4 -4
  96. package/src/checkout/form.tsx +2 -2
  97. package/src/checkout/table.tsx +3 -3
  98. package/src/components/country-select.tsx +5 -3
  99. package/src/components/input.tsx +4 -2
  100. package/src/components/livemode.tsx +2 -1
  101. package/src/components/pricing-item.tsx +2 -2
  102. package/src/components/status.tsx +2 -1
  103. package/src/components/switch-button.tsx +44 -39
  104. package/src/components/truncated-text.tsx +2 -1
  105. package/src/contexts/payment.tsx +2 -2
  106. package/src/libs/api.ts +2 -2
  107. package/src/libs/util.ts +4 -5
  108. package/src/payment/amount.tsx +2 -1
  109. package/src/payment/form/address.tsx +2 -1
  110. package/src/payment/form/index.tsx +2 -1
  111. package/src/payment/form/phone.tsx +3 -2
  112. package/src/payment/index.tsx +4 -3
  113. package/src/payment/summary.tsx +2 -12
  114. package/src/theme/index.tsx +1 -1
  115. package/src/types/index.ts +2 -2
@@ -1,25 +1,24 @@
1
- /// <reference types="react" />
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 | undefined;
6
- placeholder?: string | undefined;
7
- errorPosition?: "bottom" | "right" | undefined;
8
- rules?: RegisterOptions<import("react-hook-form").FieldValues, string> | undefined;
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 | undefined;
13
- placeholder?: string | undefined;
14
- errorPosition?: "bottom" | "right" | undefined;
15
- rules?: RegisterOptions<import("react-hook-form").FieldValues, string> | undefined;
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 | undefined;
20
- placeholder?: string | undefined;
21
- errorPosition?: "bottom" | "right" | undefined;
22
- rules?: RegisterOptions<import("react-hook-form").FieldValues, string> | undefined;
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,5 +1,4 @@
1
- /// <reference types="react" />
2
- import { ChipOwnProps } from '@mui/material';
1
+ import type { ChipOwnProps } from '@mui/material';
3
2
  type Props = {
4
3
  color?: string;
5
4
  backgroundColor?: string;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { Invoice, PaymentCurrency, PaymentMethod, Subscription } from '@blocklet/payment-types';
3
2
  type DialogProps = {
4
3
  open?: boolean;
@@ -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.data);
18
+ return _api.default.get(`/api/products/${productId}`).then(res => res?.data);
19
19
  };
20
20
  function PricingItem({
21
21
  productId,
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { TPricingTableExpanded } from '@blocklet/payment-types';
3
2
  type Props = {
4
3
  table: TPricingTableExpanded;
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
- import { ChipProps } from '@mui/material';
1
+ import type { ChipProps } from '@mui/material';
3
2
  export default function Status(props: ChipProps): import("react").JSX.Element;
@@ -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 _default: import("@emotion/styled").StyledComponent<import("@mui/material").SwitchProps & import("@mui/system").MUIStyledCommonProps<import("@mui/system").Theme> & SwitchProps, {}, {}>;
6
- export default _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
- module.exports = (0, _system.styled)(_material.Switch)(({
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;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  interface TruncatedTextProps {
3
2
  text?: string;
4
3
  maxLength?: number;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { TPaymentCurrency, TPaymentMethodExpanded } from '@blocklet/payment-types';
3
2
  import type { Axios } from 'axios';
4
3
  export interface Settings {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  type Props = {
3
2
  customer_id?: string;
4
3
  subscription_id?: string;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  type Props = {
3
2
  customer_id: string;
4
3
  };
@@ -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[]) => import("sequelize").InferAttributes<import("@blocklet/payment-types").PaymentCurrency, {
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.did === PAYMENT_KIT_DID);
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
  }
@@ -3,7 +3,7 @@ export declare const translations: {
3
3
  en: any;
4
4
  };
5
5
  export declare const createTranslator: ({ fallbackLocale }: {
6
- fallbackLocale?: string | undefined;
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;
@@ -1,5 +1,4 @@
1
- /// <reference types="react" />
2
- import { TypographyProps } from '@mui/material';
1
+ import type { TypographyProps } from '@mui/material';
3
2
  type Props = {
4
3
  amount: string;
5
4
  } & TypographyProps;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { LiteralUnion } from 'type-fest';
3
2
  type ModeType = LiteralUnion<'standalone' | 'inline' | 'popup' | 'inline-minimal' | 'popup-minimal', string>;
4
3
  type Props = {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export default function CheckoutFooter({ ...props }: {
3
2
  [x: string]: any;
4
3
  }): import("react").JSX.Element;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export default function UserButtons(): import("react").JSX.Element;
@@ -1,5 +1,4 @@
1
- /// <reference types="react" />
2
- import { SxProps } from '@mui/material';
1
+ import type { SxProps } from '@mui/material';
3
2
  type Props = {
4
3
  mode: string;
5
4
  stripe: boolean;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { TPaymentCurrency } from '@blocklet/payment-types';
3
2
  type Props = {
4
3
  value: number;
@@ -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 data.checkoutSession?.status === "complete" && ["paid", "no_payment_required"].includes(data.checkoutSession?.payment_status);
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
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export default function PhoneInput({ ...props }: {
3
2
  [x: string]: any;
4
3
  }): import("react").JSX.Element;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { TCustomer } from '@blocklet/payment-types';
3
2
  export type StripeCheckoutFormProps = {
4
3
  clientSecret: string;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { StripeCheckoutProps } from './form';
3
2
  declare global {
4
3
  interface Window {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { TCheckoutSessionExpanded } from '@blocklet/payment-types';
3
2
  type Props = {
4
3
  checkoutSession: TCheckoutSessionExpanded;
@@ -1,6 +1,6 @@
1
- /// <reference types="react" />
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
- export declare const Root: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
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>;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { LiteralUnion } from 'type-fest';
3
2
  type Props = {
4
3
  name: string;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { DonationSettings, TLineItemExpanded, TPaymentCurrency } from '@blocklet/payment-types';
3
2
  export default function ProductDonation({ item, settings, onChange, currency, }: {
4
3
  item: TLineItemExpanded;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export default function ProductSkeleton({ count }: {
3
2
  count: number;
4
3
  }): import("react").JSX.Element;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export default function OverviewSkeleton(): import("react").JSX.Element;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export default function PaymentSkeleton(): import("react").JSX.Element;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  type Props = {
3
2
  mode: string;
4
3
  message: string;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { DonationSettings, TLineItemExpanded, TPaymentCurrency } from '@blocklet/payment-types';
3
2
  type Props = {
4
3
  items: TLineItemExpanded[];
@@ -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;
@@ -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.13",
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": "npm run lint -- --fix",
21
- "build": "tsc --noEmit && unbuild && node tools/auto-exports.js && npm run cpfiles",
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 npm run lint",
24
- "prepush": "CI=1 npm run lint",
25
- "prepublish": "npm run build",
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": "npm run test -- --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.74",
57
- "@arcblock/ux": "^2.10.74",
58
- "@arcblock/ws": "^1.18.150",
59
- "@blocklet/ui-react": "^2.10.74",
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.150",
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.13",
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": "^4.9.5",
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": "5196c900b1ca5b47b23b62d8efb8c67ec456276f"
126
+ "gitHead": "fdffd2c105f53202dc73f3802d773a6141c5ea73"
126
127
  }
@@ -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.data)
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.data)
95
+ .then((res: any) => res?.data)
96
96
  .finally(() => {
97
97
  setTimeout(() => {
98
98
  delete supporterCache[target];
@@ -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.data)
18
+ .then((res: any) => res?.data)
19
19
  .finally(() => {
20
20
  setTimeout(() => {
21
21
  delete promises[id];
@@ -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}&currencyId=${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, SxProps, Typography } from '@mui/material';
2
+ import { Box, MenuItem, Select, Typography } from '@mui/material';
3
3
  import { useFormContext } from 'react-hook-form';
4
- import { CountryIso2, FlagEmoji, defaultCountries, parseCountry } from 'react-international-phone';
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}>
@@ -1,7 +1,9 @@
1
1
  import React, { forwardRef, useImperativeHandle, useRef } from 'react';
2
- import { Box, FormLabel, InputAdornment, TextField, TextFieldProps, Typography } from '@mui/material';
2
+ import { Box, FormLabel, InputAdornment, TextField, Typography } from '@mui/material';
3
3
  import get from 'lodash/get';
4
- import { Controller, RegisterOptions, useFormContext } from 'react-hook-form';
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;
@@ -1,5 +1,6 @@
1
1
  import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
2
- import { Chip, ChipOwnProps } from '@mui/material';
2
+ import { Chip } from '@mui/material';
3
+ import type { ChipOwnProps } from '@mui/material';
3
4
 
4
5
  type Props = {
5
6
  color?: 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.data);
13
+ return api.get(`/api/products/${productId}`).then((res: any) => res?.data);
14
14
  };
15
15
 
16
16
  export type PricingItemProps = {
@@ -1,4 +1,5 @@
1
- import { Chip, ChipProps } from '@mui/material';
1
+ import { Chip } from '@mui/material';
2
+ import type { ChipProps } from '@mui/material';
2
3
 
3
4
  export default function Status(props: ChipProps) {
4
5
  return (