@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,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;
@@ -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.data).finally(() => {
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.data).finally(() => {
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);
@@ -1,5 +1,4 @@
1
- /// <reference types="react" />
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: {
@@ -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.data).finally(() => {
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);
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
- import { CheckoutProps } from '../types';
1
+ import type { CheckoutProps } from '../types';
3
2
  export default function CheckoutTable(props: CheckoutProps): import("react").JSX.Element;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { PaymentDetails, TPaymentMethod } from '@blocklet/payment-types';
3
2
  declare function TxGas(props: {
4
3
  details: PaymentDetails;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { PaymentDetails, TPaymentMethod } from '@blocklet/payment-types';
3
2
  declare function TxLink(props: {
4
3
  details: PaymentDetails;
@@ -1,6 +1,5 @@
1
- /// <reference types="react" />
2
- import { SxProps } from '@mui/material';
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;
@@ -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;
@@ -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.data);
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,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;
@@ -1,42 +1,45 @@
1
1
  import { Switch } from "@mui/material";
2
2
  import { styled } from "@mui/system";
3
- export default styled(Switch)(({ variant = "success", theme }) => ({
4
- width: 28,
5
- height: 16,
6
- padding: 0,
7
- display: "inline-flex",
8
- "&:active": {
9
- "& .MuiSwitch-thumb": {
10
- width: 15
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.Mui-checked": {
13
- transform: "translateX(9px)"
14
- }
15
- },
16
- "& .MuiSwitch-switchBase": {
17
- padding: 2,
18
- "&.Mui-checked": {
19
- transform: "translateX(12px)",
20
- color: "#fff",
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
- "& .MuiSwitch-thumb": {
28
- boxShadow: "0 2px 4px 0 rgb(0 35 11 / 20%)",
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;
@@ -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
  };
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[]) => 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/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.did === PAYMENT_KIT_DID);
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
  }
@@ -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 {
@@ -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 data.checkoutSession?.status === "complete" && ["paid", "no_payment_required"].includes(data.checkoutSession?.payment_status);
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
  );
@@ -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[];
@@ -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";
@@ -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[];
@@ -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;
@@ -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.data).finally(() => {
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.data).finally(() => {
42
+ }).then(res => res?.data).finally(() => {
43
43
  setTimeout(() => {
44
44
  delete supporterCache[target];
45
45
  }, 3e3);
@@ -1,5 +1,4 @@
1
- /// <reference types="react" />
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: {
@@ -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.data).finally(() => {
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);
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
- import { CheckoutProps } from '../types';
1
+ import type { CheckoutProps } from '../types';
3
2
  export default function CheckoutTable(props: CheckoutProps): import("react").JSX.Element;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { PaymentDetails, TPaymentMethod } from '@blocklet/payment-types';
3
2
  declare function TxGas(props: {
4
3
  details: PaymentDetails;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { PaymentDetails, TPaymentMethod } from '@blocklet/payment-types';
3
2
  declare function TxLink(props: {
4
3
  details: PaymentDetails;
@@ -1,6 +1,5 @@
1
- /// <reference types="react" />
2
- import { SxProps } from '@mui/material';
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;